This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #47361] Deparse do +{} and do({}) correctly
[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
d78f9ffa 31# Generated on Sat Oct 1 12:33:17 CEST 2011 [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=''
758a5d79
JH
568d_isfinite=''
569d_isinf=''
b4eb6b3d
JH
570d_isnan=''
571d_isnanl=''
572d_killpg=''
573d_lchown=''
574d_ldbl_dig=''
0a0abfba 575d_libm_lib_version=''
b4eb6b3d 576d_link=''
10bc17b6 577d_localtime_r=''
8572b25d 578d_localtime_r_needs_tzset=''
10bc17b6 579localtime_r_proto=''
b4eb6b3d
JH
580d_locconv=''
581d_lockf=''
582d_longdbl=''
583longdblsize=''
584d_longlong=''
585longlongsize=''
586d_lseekproto=''
587d_lstat=''
588d_madvise=''
7dd121ae
MB
589d_malloc_good_size=''
590d_malloc_size=''
b4eb6b3d
JH
591d_mblen=''
592d_mbstowcs=''
593d_mbtowc=''
594d_memchr=''
595d_memcmp=''
596d_memcpy=''
597d_memmove=''
598d_memset=''
599d_mkdir=''
600d_mkdtemp=''
601d_mkfifo=''
602d_mkstemp=''
603d_mkstemps=''
604d_mktime=''
605d_mmap=''
606mmaptype=''
607d_modfl=''
e67aeab1 608d_modfl_pow32_bug=''
bc9a1b2c 609d_modflproto=''
b4eb6b3d
JH
610d_mprotect=''
611d_msg=''
612d_msgctl=''
613d_msgget=''
4e0554ec 614d_msghdr_s=''
b4eb6b3d
JH
615d_msgrcv=''
616d_msgsnd=''
617d_msync=''
618d_munmap=''
619d_nice=''
2765b840 620d_nl_langinfo=''
b4eb6b3d
JH
621d_off64_t=''
622d_open3=''
623d_fpathconf=''
624d_pathconf=''
625d_pause=''
626d_pipe=''
627d_poll=''
2304df62 628d_portable=''
c796e3db
MB
629d_prctl=''
630d_prctl_set_name=''
a33c94aa 631d_procselfexe=''
f24dbf84 632procselfexe=''
b4eb6b3d
JH
633d_old_pthread_create_joinable=''
634old_pthread_create_joinable=''
d6483fcc 635d_pthread_atfork=''
58d975c3 636d_pthread_attr_setscope=''
b4eb6b3d
JH
637d_pthread_yield=''
638d_sched_yield=''
639sched_yield=''
640d_qgcvt=''
10bc17b6
JH
641d_random_r=''
642random_r_proto=''
643d_readdir64_r=''
644readdir64_r_proto=''
b4eb6b3d
JH
645d_readdir=''
646d_rewinddir=''
647d_seekdir=''
648d_telldir=''
10bc17b6
JH
649d_readdir_r=''
650readdir_r_proto=''
b4eb6b3d 651d_readlink=''
4e0554ec
JH
652d_readv=''
653d_recvmsg=''
b4eb6b3d
JH
654d_rename=''
655d_rmdir=''
656d_safebcpy=''
657d_safemcpy=''
658d_sanemcmp=''
ef9f17be 659d_sbrkproto=''
55954f19 660d_scalbnl=''
b4eb6b3d
JH
661d_select=''
662d_sem=''
663d_semctl=''
664d_semget=''
665d_semop=''
4e0554ec 666d_sendmsg=''
b4eb6b3d
JH
667d_setegid=''
668d_seteuid=''
669d_setgrent=''
10bc17b6
JH
670d_setgrent_r=''
671setgrent_r_proto=''
b4eb6b3d
JH
672d_setgrps=''
673d_sethent=''
10bc17b6
JH
674d_sethostent_r=''
675sethostent_r_proto=''
4e0554ec 676d_setitimer=''
b4eb6b3d
JH
677d_setlinebuf=''
678d_setlocale=''
10bc17b6
JH
679d_setlocale_r=''
680setlocale_r_proto=''
b4eb6b3d 681d_setnent=''
10bc17b6
JH
682d_setnetent_r=''
683setnetent_r_proto=''
b4eb6b3d
JH
684d_setpent=''
685d_setpgid=''
686d_setpgrp2=''
687d_bsdsetpgrp=''
688d_setpgrp=''
689d_setprior=''
690d_setproctitle=''
10bc17b6
JH
691d_setprotoent_r=''
692setprotoent_r_proto=''
b4eb6b3d 693d_setpwent=''
10bc17b6
JH
694d_setpwent_r=''
695setpwent_r_proto=''
b4eb6b3d
JH
696d_setregid=''
697d_setresgid=''
698d_setresuid=''
699d_setreuid=''
700d_setrgid=''
701d_setruid=''
702d_setsent=''
10bc17b6
JH
703d_setservent_r=''
704setservent_r_proto=''
b4eb6b3d
JH
705d_setsid=''
706d_setvbuf=''
707d_sfio=''
708usesfio=''
709d_shm=''
710d_shmat=''
711d_shmatprototype=''
712shmattype=''
713d_shmctl=''
714d_shmdt=''
715d_shmget=''
716d_sigaction=''
ed140128 717d_signbit=''
983dbef6 718d_sigprocmask=''
b4eb6b3d 719d_sigsetjmp=''
5f106f9c 720usesitecustomize=''
4f5da3e9
SP
721d_snprintf=''
722d_vsnprintf=''
49a78c82 723d_sockatmark=''
2ef53570 724d_sockatmarkproto=''
b4eb6b3d
JH
725d_msg_ctrunc=''
726d_msg_dontroute=''
727d_msg_oob=''
728d_msg_peek=''
729d_msg_proxy=''
730d_oldsock=''
731d_scm_rights=''
f53580fe 732d_sin6_scope_id=''
b8677e3b 733d_sockaddr_sa_len=''
b4eb6b3d
JH
734d_socket=''
735d_sockpair=''
736sockethdr=''
737socketlib=''
738d_socklen_t=''
739d_socks5_init=''
360321b3 740d_sprintf_returns_strlen=''
b4eb6b3d 741d_sqrtl=''
10bc17b6
JH
742d_srand48_r=''
743srand48_r_proto=''
744d_srandom_r=''
745srandom_r_proto=''
eef837ea 746d_sresgproto=''
640374d0 747d_sresuproto=''
b4eb6b3d
JH
748d_statblks=''
749d_statfs_f_flags=''
750d_statfs_s=''
17a6c8e3
AD
751d_static_inline=''
752perl_static_inline=''
b4eb6b3d
JH
753d_fstatvfs=''
754d_statvfs=''
755d_stdio_cnt_lval=''
756d_stdio_ptr_lval=''
a7ffa9b9
NC
757d_stdio_ptr_lval_nochange_cnt=''
758d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
759d_stdiobase=''
760d_stdstdio=''
761stdio_base=''
762stdio_bufsiz=''
763stdio_cnt=''
764stdio_filbuf=''
765stdio_ptr=''
766d_index=''
767d_strchr=''
768d_strcoll=''
769d_strctcpy=''
770d_strerrm=''
771d_strerror=''
772d_sysernlst=''
773d_syserrlst=''
10bc17b6
JH
774d_strerror_r=''
775strerror_r_proto=''
b3c85772 776d_strftime=''
08c92000
MB
777d_strlcat=''
778d_strlcpy=''
b4eb6b3d
JH
779d_strtod=''
780d_strtol=''
781d_strtold=''
782d_strtoll=''
28e5dec8 783d_strtoq=''
b4eb6b3d
JH
784d_strtoul=''
785d_strtoull=''
786d_strtouq=''
787d_strxfrm=''
788d_symlink=''
789d_syscall=''
2ef53570 790d_syscallproto=''
b4eb6b3d
JH
791d_sysconf=''
792d_system=''
793d_tcgetpgrp=''
794d_tcsetpgrp=''
795d_telldirproto=''
796d_time=''
797timetype=''
96938616
MB
798d_asctime64=''
799d_ctime64=''
800d_difftime64=''
801d_gmtime64=''
802d_localtime64=''
803d_mktime64=''
cbb9e8a7 804d_timegm=''
b4eb6b3d
JH
805clocktype=''
806d_times=''
10bc17b6
JH
807d_tmpnam_r=''
808tmpnam_r_proto=''
b4eb6b3d 809d_truncate=''
10bc17b6
JH
810d_ttyname_r=''
811ttyname_r_proto=''
b4eb6b3d 812d_tzname=''
4e0554ec
JH
813d_u32align=''
814d_ualarm=''
b4eb6b3d
JH
815d_umask=''
816d_semctl_semid_ds=''
817d_semctl_semun=''
818d_union_semun=''
758a5d79 819d_unordered=''
bdf33aa7 820d_unsetenv=''
4e0554ec 821d_usleep=''
2ef53570 822d_usleepproto=''
b4eb6b3d 823d_ustat=''
233e16ce 824d_pseudofork=''
b4eb6b3d
JH
825d_vfork=''
826usevfork=''
827d_voidsig=''
828signal_t=''
829d_volatile=''
830d_charvspr=''
831d_vprintf=''
832d_wait4=''
833d_waitpid=''
834d_wcstombs=''
835d_wctomb=''
4e0554ec 836d_writev=''
b4eb6b3d 837dlext=''
f1ce3bf1 838bin_ELF=''
85e6fe83
LW
839cccdlflags=''
840ccdlflags=''
2304df62 841dlsrc=''
232e078e 842ld=''
85e6fe83 843lddlflags=''
2304df62 844usedl=''
b4eb6b3d
JH
845doublesize=''
846ebcdic=''
847fflushNULL=''
848fflushall=''
849fpossize=''
850fpostype=''
2d736872 851gccansipedantic=''
5b463ca7 852gccosandvers=''
8a27cf78 853gccversion=''
b4eb6b3d
JH
854gidformat=''
855gidsign=''
856gidsize=''
857gidtype=''
858groupstype=''
859h_fcntl=''
860h_sysfile=''
6e1038e0
MB
861html1dir=''
862html1direxp=''
863installhtml1dir=''
864html3dir=''
865html3direxp=''
866installhtml3dir=''
b4eb6b3d 867i_arpainet=''
c0bacbef 868i_assert=''
10bc17b6 869i_crypt=''
b4eb6b3d
JH
870db_hashtype=''
871db_prefixtype=''
640374d0
JH
872db_version_major=''
873db_version_minor=''
874db_version_patch=''
b4eb6b3d
JH
875i_db=''
876i_dbm=''
877i_rpcsvcdbm=''
878d_dirnamlen=''
879direntrytype=''
880i_dirent=''
a0d0e21e 881i_dld=''
b4eb6b3d
JH
882i_dlfcn=''
883i_fcntl=''
884i_float=''
758a5d79
JH
885i_fp=''
886i_fp_class=''
b4eb6b3d
JH
887i_gdbm=''
888d_grpasswd=''
889i_grp=''
b4eb6b3d
JH
890i_ieeefp=''
891i_inttypes=''
2765b840 892i_langinfo=''
b4eb6b3d
JH
893i_libutil=''
894i_limits=''
895i_locale=''
896i_machcthr=''
897i_malloc=''
1cd66f7c 898i_mallocmalloc=''
b4eb6b3d
JH
899i_math=''
900i_memory=''
901i_mntent=''
e74475c7
MHM
902d_gdbm_ndbm_h_uses_prototypes=''
903d_gdbmndbm_h_uses_prototypes=''
a33f2d9f 904d_ndbm=''
e74475c7 905d_ndbm_h_uses_prototypes=''
a33f2d9f
AD
906i_gdbm_ndbm=''
907i_gdbmndbm=''
b4eb6b3d
JH
908i_ndbm=''
909i_netdb=''
910i_neterrno=''
911i_netinettcp=''
912i_niin=''
913i_sysin=''
914i_poll=''
915i_prot=''
916i_pthread=''
917d_pwage=''
918d_pwchange=''
919d_pwclass=''
920d_pwcomment=''
921d_pwexpire=''
922d_pwgecos=''
923d_pwpasswd=''
924d_pwquota=''
925i_pwd=''
926i_sfio=''
927i_shadow=''
928i_socks=''
bd31be4b 929i_stdbool=''
b4eb6b3d
JH
930i_stddef=''
931i_stdlib=''
932i_string=''
933strings=''
934i_sunmath=''
935i_sysaccess=''
936i_sysdir=''
937i_sysfile=''
938d_voidtty=''
939i_bsdioctl=''
940i_sysfilio=''
941i_sysioctl=''
942i_syssockio=''
943i_syslog=''
944i_sysmman=''
945i_sysmode=''
946i_sysmount=''
947i_sysndir=''
948i_sysparam=''
216dac04 949i_syspoll=''
b4eb6b3d
JH
950i_sysresrc=''
951i_syssecrt=''
952i_sysselct=''
953i_sysstat=''
954i_sysstatfs=''
955i_sysstatvfs=''
956i_systimes=''
957i_systypes=''
958i_sysuio=''
959i_sysun=''
960i_sysutsname=''
961i_sysvfs=''
962i_syswait=''
963i_sgtty=''
964i_termio=''
965i_termios=''
14b90194
JH
966d_tm_tm_gmtoff=''
967d_tm_tm_zone=''
b4eb6b3d
JH
968i_systime=''
969i_systimek=''
970i_time=''
971timeincl=''
972i_unistd=''
973i_ustat=''
974i_utime=''
975i_values=''
976i_stdarg=''
977i_varargs=''
978i_varhdr=''
979i_vfork=''
f3f1a2d8 980d_inc_version_list=''
b4eb6b3d
JH
981inc_version_list=''
982inc_version_list_init=''
983installprefix=''
984installprefixexp=''
985installstyle=''
986installusrbinperl=''
987intsize=''
988longsize=''
989shortsize=''
4b661809 990issymlink=''
2304df62 991libc=''
b4eb6b3d
JH
992ldlibpthname=''
993libperl=''
994shrpenv=''
995useshrplib=''
a0d0e21e 996glibpth=''
2304df62 997libpth=''
8e07c86e 998loclibpth=''
2304df62
AD
999plibpth=''
1000xlibpth=''
1cfa4ec7 1001ignore_versioned_solibs=''
2304df62 1002libs=''
43999f95
JH
1003libsdirs=''
1004libsfiles=''
1005libsfound=''
13b3f787 1006libspath=''
85e6fe83 1007lns=''
b4eb6b3d
JH
1008d_PRIEUldbl=''
1009d_PRIFUldbl=''
1010d_PRIGUldbl=''
1011d_PRIeldbl=''
1012d_PRIfldbl=''
1013d_PRIgldbl=''
1014d_SCNfldbl=''
1015sPRIEUldbl=''
1016sPRIFUldbl=''
1017sPRIGUldbl=''
1018sPRIeldbl=''
1019sPRIfldbl=''
1020sPRIgldbl=''
1021sSCNfldbl=''
1022lseeksize=''
1023lseektype=''
d620c7b3 1024mad=''
00e74f14
NC
1025madlyh=''
1026madlyobj=''
1027madlysrc=''
f3f1a2d8
MB
1028make_set_make=''
1029d_mymalloc=''
1030freetype=''
b4eb6b3d
JH
1031mallocobj=''
1032mallocsrc=''
1033malloctype=''
9df442c2 1034usemallocwrap=''
b4eb6b3d
JH
1035usemymalloc=''
1036installman1dir=''
1037man1dir=''
1038man1direxp=''
1039man1ext=''
1040installman3dir=''
1041man3dir=''
1042man3direxp=''
1043man3ext=''
1044modetype=''
1045multiarch=''
1046mydomain=''
1047myhostname=''
1048phostname=''
2304df62
AD
1049c=''
1050n=''
b4eb6b3d
JH
1051d_eofnblk=''
1052eagain=''
1053o_nonblock=''
1054rd_nodata=''
2cc61e15 1055need_va_copy=''
b4eb6b3d
JH
1056netdb_hlen_type=''
1057netdb_host_type=''
1058netdb_name_type=''
1059netdb_net_type=''
1060groupcat=''
1061hostcat=''
1062passcat=''
1063orderlib=''
1064ranlib=''
1065d_perl_otherlibdirs=''
1066otherlibdirs=''
2304df62
AD
1067package=''
1068spackage=''
b4eb6b3d
JH
1069pager=''
1070api_revision=''
1071api_subversion=''
1072api_version=''
1073api_versionstring=''
1074patchlevel=''
151e6568 1075perl_patchlevel=''
b4eb6b3d
JH
1076revision=''
1077subversion=''
1078version=''
861eb78d 1079version_patchlevel_string=''
b4eb6b3d
JH
1080perl5=''
1081perladmin=''
91f55cc7 1082perlpath=''
b4eb6b3d 1083d_nv_preserves_uv=''
f607920a 1084d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1085i16size=''
1086i16type=''
1087i32size=''
1088i32type=''
1089i64size=''
1090i64type=''
1091i8size=''
1092i8type=''
1093ivsize=''
1094ivtype=''
b68c599a 1095nv_overflows_integers_at=''
4137585d 1096nv_preserves_uv_bits=''
b4eb6b3d
JH
1097nvsize=''
1098nvtype=''
1099u16size=''
1100u16type=''
1101u32size=''
1102u32type=''
1103u64size=''
1104u64type=''
1105u8size=''
1106u8type=''
1107uvsize=''
1108uvtype=''
1109ivdformat=''
1110nvEUformat=''
1111nvFUformat=''
1112nvGUformat=''
1113nveformat=''
1114nvfformat=''
1115nvgformat=''
1116uvXUformat=''
1117uvoformat=''
1118uvuformat=''
1119uvxformat=''
1120pidtype=''
1121prefix=''
1122prefixexp=''
1123installprivlib=''
1124privlib=''
1125privlibexp=''
1126prototype=''
1127ptrsize=''
1128d_PRIXU64=''
1129d_PRId64=''
1130d_PRIi64=''
1131d_PRIo64=''
1132d_PRIu64=''
1133d_PRIx64=''
1134sPRIXU64=''
1135sPRId64=''
1136sPRIi64=''
1137sPRIo64=''
1138sPRIu64=''
1139sPRIx64=''
1140d_quad=''
1141quadkind=''
1142quadtype=''
1143uquadtype=''
1144drand01=''
1145randbits=''
1146randfunc=''
1147randseedtype=''
1148seedfunc=''
1149installscript=''
1150scriptdir=''
1151scriptdirexp=''
1152selectminbits=''
1153selecttype=''
8ff267be 1154sh=''
b4eb6b3d
JH
1155sig_count=''
1156sig_name=''
1157sig_name_init=''
1158sig_num=''
1159sig_num_init=''
76d3c696 1160sig_size=''
f3f1a2d8 1161d_sitearch=''
b4eb6b3d
JH
1162installsitearch=''
1163sitearch=''
1164sitearchexp=''
1165installsitebin=''
1166sitebin=''
1167sitebinexp=''
8d2cbf27
JH
1168installsitehtml1dir=''
1169sitehtml1dir=''
1170sitehtml1direxp=''
1171installsitehtml3dir=''
1172sitehtml3dir=''
1173sitehtml3direxp=''
b4eb6b3d
JH
1174installsitelib=''
1175sitelib=''
1176sitelib_stem=''
1177sitelibexp=''
91e123a8
JH
1178installsiteman1dir=''
1179siteman1dir=''
1180siteman1direxp=''
1181installsiteman3dir=''
1182siteman3dir=''
1183siteman3direxp=''
b4eb6b3d
JH
1184siteprefix=''
1185siteprefixexp=''
6e1038e0
MB
1186installsitescript=''
1187sitescript=''
1188sitescriptexp=''
b4eb6b3d
JH
1189sizesize=''
1190sizetype=''
a0d0e21e 1191so=''
b4eb6b3d 1192socksizetype=''
2304df62
AD
1193sharpbang=''
1194shsharp=''
1195spitshell=''
dfe9444c 1196src=''
b4eb6b3d 1197ssizetype=''
668fdbe1
MB
1198st_ino_sign=''
1199st_ino_size=''
b4eb6b3d 1200startperl=''
2304df62 1201startsh=''
b4eb6b3d
JH
1202stdchar=''
1203d_stdio_stream_array=''
1204stdio_stream_array=''
1205sysman=''
81c4fd9e
MB
1206sGMTIME_max=''
1207sGMTIME_min=''
73e6e416
MB
1208sLOCALTIME_max=''
1209sLOCALTIME_min=''
5ff3f7a4 1210trnl=''
b4eb6b3d
JH
1211uidformat=''
1212uidsign=''
1213uidsize=''
1214uidtype=''
1215archname64=''
1216use64bitall=''
1217use64bitint=''
34f1896b
MB
1218dtrace=''
1219usedtrace=''
15b61c98 1220usefaststdio=''
d78f9ffa 1221usekernprocpathname=''
b4eb6b3d
JH
1222ccflags_uselargefiles=''
1223ldflags_uselargefiles=''
1224libswanted_uselargefiles=''
1225uselargefiles=''
1226uselongdouble=''
1227usemorebits=''
1228usemultiplicity=''
2304df62 1229nm_opt=''
40a7a20a 1230nm_so_opt=''
2304df62
AD
1231runnm=''
1232usenm=''
ae60cb46 1233usensgetexecutablepath=''
b4eb6b3d 1234useperlio=''
29209bc5 1235usesocks=''
b4eb6b3d
JH
1236d_oldpthreads=''
1237use5005threads=''
1238useithreads=''
9514c62b 1239usereentrant=''
b4eb6b3d 1240usethreads=''
2304df62 1241incpath=''
2304df62
AD
1242mips_type=''
1243usrinc=''
d03b3b00 1244vaproto=''
b4eb6b3d
JH
1245d_vendorarch=''
1246installvendorarch=''
1247vendorarch=''
1248vendorarchexp=''
1249d_vendorbin=''
1250installvendorbin=''
1251vendorbin=''
1252vendorbinexp=''
8d2cbf27
JH
1253installvendorhtml1dir=''
1254vendorhtml1dir=''
1255vendorhtml1direxp=''
1256installvendorhtml3dir=''
1257vendorhtml3dir=''
1258vendorhtml3direxp=''
b4eb6b3d
JH
1259d_vendorlib=''
1260installvendorlib=''
1261vendorlib=''
1262vendorlib_stem=''
1263vendorlibexp=''
91e123a8
JH
1264installvendorman1dir=''
1265vendorman1dir=''
1266vendorman1direxp=''
1267installvendorman3dir=''
1268vendorman3dir=''
1269vendorman3direxp=''
b4eb6b3d
JH
1270usevendorprefix=''
1271vendorprefix=''
1272vendorprefixexp=''
6e1038e0
MB
1273d_vendorscript=''
1274installvendorscript=''
1275vendorscript=''
1276vendorscriptexp=''
d56c5707 1277versiononly=''
b4eb6b3d
JH
1278defvoidused=''
1279voidflags=''
3659ebf1
JH
1280yacc=''
1281yaccflags=''
2304df62
AD
1282CONFIG=''
1283
34f1896b 1284: Detect odd OSs
ecfc5424
AD
1285define='define'
1286undef='undef'
1287smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1288rmlist=''
1289
1290: We must find out about Eunice early
1291eunicefix=':'
1292if test -f /etc/unixtovms; then
1293 eunicefix=/etc/unixtovms
1294fi
1295if test -f /etc/unixtovms.exe; then
1296 eunicefix=/etc/unixtovms.exe
1297fi
1298
cfb04860 1299: Set executable suffix now -- needed before hints available
6153ba32
PG
1300if test -f "/libs/version.library"; then
1301: Amiga OS
1302 _exe=""
1303elif test -f "/system/gnu_library/bin/ar.pm"; then
1304: Stratus VOS
cfb04860 1305 _exe=".pm"
6153ba32
PG
1306elif test -n "$DJGPP"; then
1307: DOS DJGPP
cfb04860 1308 _exe=".exe"
5c728af0 1309elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1310: OS/2 or cygwin
ba863942
JH
1311 _exe=".exe"
1312fi
868439a2 1313
1d8eaf8c 1314groupstype=''
b4eb6b3d 1315i_whoami=''
06501368
MB
1316: Trailing extension. Override this in a hint file, if needed.
1317: Extra object files, if any, needed on this platform.
1318archobjs=''
b8677e3b
MB
1319archname=''
1320: Possible local include directories to search.
1321: Set locincpth to "" in a hint file to defeat local include searches.
1322locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1323locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1324:
1325: no include file wanted by default
1326inclwanted=''
1327
1328: Enable -DEBUGGING and -DDEBUGGING from the command line
1329EBUGGING=''
356123f1 1330DEBUGGING=''
b8677e3b 1331
64615a5e 1332libnames=''
732c9516
JH
1333: change the next line if compiling for Xenix/286 on Xenix/386
1334xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1335: Possible local library directories to search.
1336loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1337loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1338
1339: general looking path for locating libraries
5869b1f1 1340glibpth="/lib /usr/lib $xlibpth"
732c9516 1341glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1342test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1343test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1344test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1345
1346: Private path used by Configure to find libraries. Its value
1347: is prepended to libpth. This variable takes care of special
1348: machines, like the mips. Usually, it should be empty.
1349plibpth=''
1350
1cfa4ec7
GS
1351: default library list
1352libswanted=''
921b2963 1353: some systems want to use only the non-versioned libso:s
1cfa4ec7 1354ignore_versioned_solibs=''
06501368
MB
1355: set usethreads on the Configure command line to enable threads.
1356usereentrant='undef'
ed140128
AD
1357: full support for void wanted by default
1358defvoidused=15
1359
ed140128
AD
1360ccname=''
1361ccversion=''
1362perllibs=''
1363: set useposix=false in your hint file to disable the POSIX extension.
1364useposix=true
1365: set useopcode=false in your hint file to disable the Opcode extension.
1366useopcode=true
b4eb6b3d
JH
1367archname64=''
1368ccflags_uselargefiles=''
1369ldflags_uselargefiles=''
1370libswanted_uselargefiles=''
1371: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1372: set usesocks on the Configure command line to enable socks.
ecfc5424 1373: List of libraries we want.
15431986 1374: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef 1375libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8119684f 1376libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1377: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1378: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1379glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1380glibpth="/usr/shlib $glibpth"
1381: Do not use vfork unless overridden by a hint file.
1382usevfork=false
1383
8ff267be 1384: Find the basic shell for Bourne shell scripts
1385case "$sh" in
1386'')
8ff267be 1387 case "$SYSTYPE" in
1388 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1389 *) xxx='/bin/sh';;
1390 esac
1391 if test -f "$xxx"; then
1392 sh="$xxx"
1393 else
1394 : Build up a list and do a single loop so we can 'break' out.
1395 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1396 for xxx in sh bash ksh pdksh ash; do
1397 for p in $pth; do
1398 try="$try ${p}/${xxx}"
1399 done
1400 done
1401 for xxx in $try; do
1402 if test -f "$xxx"; then
1403 sh="$xxx";
8ff267be 1404 break
a5a94ea5
JH
1405 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1406 sh="$xxx";
1407 break
8ff267be 1408 elif test -f "$xxx.exe"; then
1409 sh="$xxx";
8ff267be 1410 break
1411 fi
1412 done
1413 fi
1414 ;;
1415esac
1416
1417case "$sh" in
a33c94aa 1418'') cat >&2 <<EOM
8ff267be 1419$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1420
8ff267be 1421Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1422Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1423we'll try to straighten this all out.
8ff267be 1424EOM
1425 exit 1
1426 ;;
1427esac
1428
760ac839 1429: see if sh knows # comments
73614538 1430if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1431 shsharp=true
1432 spitshell=cat
760ac839 1433 xcat=/bin/cat
a931254c
JH
1434 test -f $xcat$_exe || xcat=/usr/bin/cat
1435 if test ! -f $xcat$_exe; then
4bdb8fb5 1436 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1437 if test -f $p/cat$_exe; then
1deb0a86 1438 xcat=$p/cat
3c728e00
JH
1439 break
1440 fi
1441 done
1deb0a86
JH
1442 if test ! -f $xcat$_exe; then
1443 echo "Can't find cat anywhere!"
3c728e00
JH
1444 exit 1
1445 fi
1446 fi
5440bc8e
JH
1447 echo "#!$xcat" >sharp
1448 $eunicefix sharp
1449 chmod +x sharp
1d8eaf8c 1450 ./sharp > today 2>/dev/null
760ac839 1451 if test -s today; then
760ac839
LW
1452 sharpbang='#!'
1453 else
5440bc8e
JH
1454 echo "#! $xcat" > sharp
1455 $eunicefix sharp
1456 chmod +x sharp
1d8eaf8c 1457 ./sharp > today 2>/dev/null
760ac839 1458 if test -s today; then
760ac839
LW
1459 sharpbang='#! '
1460 else
760ac839
LW
1461 sharpbang=': use '
1462 fi
1463 fi
1464else
dfe9444c 1465 echo " "
8ff267be 1466 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1467 shsharp=false
1468 cd ..
1469 echo "exec grep -v '^[ ]*#'" >spitshell
1470 chmod +x spitshell
1471 $eunicefix spitshell
1472 spitshell=`pwd`/spitshell
1473 cd UU
1474 echo "I presume that if # doesn't work, #! won't work either!"
1475 sharpbang=': use '
1476fi
5440bc8e 1477rm -f sharp today
760ac839
LW
1478
1479: figure out how to guarantee sh startup
8ff267be 1480case "$startsh" in
1481'') startsh=${sharpbang}${sh} ;;
1482*)
760ac839 1483esac
5440bc8e 1484cat >sharp <<EOSS
760ac839
LW
1485$startsh
1486set abc
1487test "$?abc" != 1
1488EOSS
1489
5440bc8e
JH
1490chmod +x sharp
1491$eunicefix sharp
1492if ./sharp; then
8ff267be 1493 : echo "Yup, it does."
760ac839 1494else
dfe9444c
AD
1495 echo "Hmm... '$startsh' does not guarantee sh startup..."
1496 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1497fi
5440bc8e 1498rm -f sharp
760ac839 1499
aebf16e7
AD
1500: Save command line options in file UU/cmdline.opt for later use in
1501: generating config.sh.
1502cat > cmdline.opt <<EOSH
613d6c3e 1503: Configure command line arguments.
aebf16e7
AD
1504config_arg0='$0'
1505config_args='$*'
1506config_argc=$#
1507EOSH
1508argn=1
ee45ea83
IZ
1509args_exp=''
1510args_sep=''
aebf16e7
AD
1511for arg in "$@"; do
1512 cat >>cmdline.opt <<EOSH
1513config_arg$argn='$arg'
1514EOSH
ee45ea83
IZ
1515 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1516$arg
1517EOC
1518 arg_exp=`cat cmdl.opt`
1519 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1520 argn=`expr $argn + 1`
ee45ea83 1521 args_sep=' '
aebf16e7 1522done
ee45ea83 1523rm -f cmdl.opt
aebf16e7 1524
2304df62
AD
1525: produce awk script to parse command line options
1526cat >options.awk <<'EOF'
1527BEGIN {
02e93a22 1528 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1529
1530 len = length(optstr);
1531 for (i = 1; i <= len; i++) {
1532 c = substr(optstr, i, 1);
1533 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1534 if (a == ":") {
1535 arg[c] = 1;
1536 i++;
1537 }
1538 opt[c] = 1;
1539 }
1540}
1541{
1542 expect = 0;
1543 str = $0;
1544 if (substr(str, 1, 1) != "-") {
1545 printf("'%s'\n", str);
1546 next;
1547 }
1548 len = length($0);
1549 for (i = 2; i <= len; i++) {
1550 c = substr(str, i, 1);
1551 if (!opt[c]) {
1552 printf("-%s\n", substr(str, i));
1553 next;
1554 }
1555 printf("-%s\n", c);
1556 if (arg[c]) {
1557 if (i < len)
1558 printf("'%s'\n", substr(str, i + 1));
1559 else
1560 expect = 1;
1561 next;
1562 }
1563 }
1564}
1565END {
1566 if (expect)
1567 print "?";
1568}
1569EOF
1570
1571: process the command line options
4633a7c4
LW
1572set X `for arg in "$@"; do echo "X$arg"; done |
1573 sed -e s/X// | awk -f options.awk`
2304df62
AD
1574eval "set $*"
1575shift
1576rm -f options.awk
1577
1578: set up default values
1579fastread=''
1580reuseval=false
1581config_sh=''
1582alldone=''
1583error=''
1584silent=''
1585extractsh=''
ecfc5424 1586override=''
16d20bd9 1587knowitall=''
02e93a22 1588rm -f optdef.sh posthint.sh
28757baa 1589cat >optdef.sh <<EOS
1590$startsh
1591EOS
2304df62 1592
dfe9444c 1593
2304df62
AD
1594: option parsing
1595while test $# -gt 0; do
1596 case "$1" in
1597 -d) shift; fastread=yes;;
1598 -e) shift; alldone=cont;;
1599 -f)
1600 shift
1601 cd ..
1602 if test -r "$1"; then
1603 config_sh="$1"
1604 else
a0d0e21e 1605 echo "$me: cannot read config file $1." >&2
2304df62
AD
1606 error=true
1607 fi
1608 cd UU
1609 shift;;
3f30fabf 1610 --help|\
2304df62
AD
1611 -h) shift; error=true;;
1612 -r) shift; reuseval=true;;
dfe9444c 1613 -s) shift; silent=true; realsilent=true;;
2304df62 1614 -E) shift; alldone=exit;;
16d20bd9 1615 -K) shift; knowitall=true;;
ecfc5424 1616 -O) shift; override=true;;
dfe9444c 1617 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1618 -D)
1619 shift
1620 case "$1" in
1621 *=)
1622 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1623 echo "$me: ignoring -D $1" >&2
1624 ;;
ecfc5424 1625 *=*) echo "$1" | \
1aef975c
AD
1626 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1627 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1628 esac
1629 shift
1630 ;;
1631 -U)
1632 shift
1633 case "$1" in
1aef975c 1634 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1635 *=*)
1636 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1637 echo "$me: ignoring -U $1" >&2
1638 ;;
1aef975c 1639 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1640 esac
1641 shift
1642 ;;
02e93a22
JH
1643 -A)
1644 shift
1645 xxx=''
1646 yyy="$1"
02e93a22 1647 zzz=''
5f83a3e9 1648 uuu=undef
02e93a22 1649 case "$yyy" in
f7c31117 1650 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1651 case "$zzz" in
1652 *:*) zzz='' ;;
1653 *) xxx=append
613d6c3e 1654 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
f7c31117 1655 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1656 esac
1657 ;;
1658 esac
1659 case "$xxx" in
1660 '') case "$yyy" in
f7c31117
JH
1661 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1662 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1663 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1664 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1665 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1666 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9 1667 esac
613d6c3e 1668 ;;
5f83a3e9 1669 esac
02e93a22
JH
1670 case "$xxx" in
1671 append)
5f83a3e9 1672 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1673 clear)
5f83a3e9 1674 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1675 define)
1676 case "$zzz" in
1677 '') zzz=define ;;
1678 esac
5f83a3e9 1679 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1680 eval)
5f83a3e9 1681 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1682 prepend)
5f83a3e9 1683 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1684 undef)
1685 case "$zzz" in
1686 '') zzz="$uuu" ;;
1687 esac
5f83a3e9
JH
1688 echo "$yyy=$zzz" >> posthint.sh ;;
1689 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1690 esac
bde6b06b 1691 shift
02e93a22 1692 ;;
216dac04 1693 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
5f83a3e9 1694 exit 0;;
2304df62 1695 --) break;;
a0d0e21e 1696 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1697 *) break;;
1698 esac
1699done
1700
1701case "$error" in
1702true)
1703 cat >&2 <<EOM
2afac517 1704Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1705 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1706 -d : use defaults for all answers.
1707 -e : go on without questioning past the production of config.sh.
1708 -f : specify an alternate default configuration file.
1709 -h : print this help message and exit (with an error status).
1710 -r : reuse C symbols value if possible (skips costly nm extraction).
1711 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1712 -D : define symbol to have some value:
1713 -D symbol symbol gets the value 'define'
1714 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1715 common used examples (see INSTALL for more info):
1716 -Duse64bitint use 64bit integers
b79e0b55 1717 -Duse64bitall use 64bit integers and pointers
3f30fabf 1718 -Dusethreads use thread support
b79e0b55 1719 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1720 -DEBUGGING=none DEBUGGING options
1721 -Dcc=gcc choose your compiler
1722 -Dprefix=/opt/perl5 choose your destination
2304df62 1723 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1724 -K : do not use unless you know what you are doing.
ecfc5424 1725 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1726 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1727 -U : undefine symbol:
1728 -U symbol symbol gets the value 'undef'
1729 -U symbol= symbol gets completely empty
3f30fabf 1730 e.g.: -Uversiononly
02e93a22 1731 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1732 -A append:symbol=value append value to symbol
1733 -A symbol=value like append:, but with a separating space
1734 -A define:symbol=value define symbol to have value
1735 -A clear:symbol define symbol to be ''
1736 -A define:symbol define symbol to be 'define'
1737 -A eval:symbol=value define symbol to be eval of value
1738 -A prepend:symbol=value prepend value to symbol
1739 -A undef:symbol define symbol to be 'undef'
1740 -A undef:symbol= define symbol to be ''
3f30fabf 1741 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1742 -A ccflags=-DSOME_MACRO
2304df62
AD
1743 -V : print version number and exit (with a zero status).
1744EOM
1745 exit 1
1746 ;;
1747esac
1748
dfe9444c
AD
1749: Sanity checks
1750case "$fastread$alldone" in
1751yescont|yesexit) ;;
1752*)
aaeb8e51
GS
1753 case "$extractsh" in
1754 true) ;;
1755 *)
1756 if test ! -t 0; then
1757 echo "Say 'sh Configure', not 'sh <Configure'"
1758 exit 1
1759 fi
1760 ;;
1761 esac
dfe9444c
AD
1762 ;;
1763esac
1764
2304df62
AD
1765exec 4>&1
1766case "$silent" in
1767true) exec 1>/dev/null;;
1768esac
1769
ecfc5424 1770: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1771touch optdef.sh
1772. ./optdef.sh
02e93a22
JH
1773: create the posthint manipulation script and leave the file out there...
1774touch posthint.sh
a0d0e21e 1775
2304df62 1776: set package name
34f1896b 1777package='perl5'
b4eb6b3d
JH
1778first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1779last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1780case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1781ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1782*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1783esac
2304df62 1784
2304df62
AD
1785: Some greps do not return status, grrr.
1786echo "grimblepritz" >grimble
1787if grep blurfldyick grimble >/dev/null 2>&1 ; then
1788 contains=contains
1789elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1790 contains=grep
1791else
1792 contains=contains
1793fi
1794rm -f grimble
1795: the following should work in any shell
1796case "$contains" in
1797contains*)
1798 echo " "
1799 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1800 cat >contains <<'EOSS'
1801grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1802EOSS
1803chmod +x contains
1804esac
1805
dfe9444c
AD
1806: Find the path to the source tree
1807case "$src" in
1808'') case "$0" in
b233458b
JH
1809 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1810 case "$src" in
1811 /*) ;;
8504afb7 1812 .) ;;
b233458b
JH
1813 *) src=`cd ../$src && pwd` ;;
1814 esac
1815 ;;
dfe9444c
AD
1816 *) src='.';;
1817 esac;;
1818esac
1819case "$src" in
1820'') src=/
1821 rsrc=/
1822 ;;
34f1896b
MB
1823/*) rsrc="$src";;
1824*) rsrc="../$src";;
dfe9444c
AD
1825esac
1826if test -f $rsrc/Configure && \
34f1896b 1827 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
dfe9444c
AD
1828then
1829 : found it, so we are ok.
1830else
1831 rsrc=''
1832 for src in . .. ../.. ../../.. ../../../..; do
1833 if test -f ../$src/Configure && \
1834 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1835 then
1836 rsrc=../$src
1837 break
1838 fi
1839 done
1840fi
1841case "$rsrc" in
1842'')
1843 cat <<EOM >&4
1844
1845Sorry, I can't seem to locate the source dir for $package. Please start
1846Configure with an explicit path -- i.e. /some/path/Configure.
1847
1848EOM
1849 exit 1
1850 ;;
1851../.) rsrc='..';;
1852*)
1853 echo " "
1854 echo "Sources for $package found in \"$src\"." >&4
1855 ;;
1856esac
1857
1858: script used to extract .SH files with variable substitutions
1859cat >extract <<'EOS'
a02608de 1860PERL_CONFIG_SH=true
dfe9444c 1861echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1862if test -f MANIFEST; then
1863 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1864else
1865 echo "(Looking for .SH files under the source directory.)"
6904989c 1866 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1867fi
1868shift
1869case $# in
6904989c 18700) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1871esac
6904989c 1872if test ! -f "$src/$1"; then
dfe9444c
AD
1873 shift
1874fi
1875mkdir_p='
1876name=$1;
1877create="";
1878while test $name; do
1879 if test ! -d "$name"; then
1880 create="$name $create";
1881 name=`echo $name | sed -e "s|^[^/]*$||"`;
1882 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1883 else
1884 name="";
1885 fi;
1886done;
1887for file in $create; do
1888 mkdir $file;
1889done
1890'
1891for file in $*; do
1892 case "$src" in
1893 ".")
1894 case "$file" in
1895 */*)
1896 dir=`expr X$file : 'X\(.*\)/'`
1897 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1898 (cd "$dir" && . ./$file)
dfe9444c
AD
1899 ;;
1900 *)
1901 . ./$file
1902 ;;
1903 esac
1904 ;;
1905 *)
1906 case "$file" in
1907 */*)
1908 dir=`expr X$file : 'X\(.*\)/'`
1909 file=`expr X$file : 'X.*/\(.*\)'`
1910 (set x $dir; shift; eval $mkdir_p)
6904989c 1911 sh <"$src/$dir/$file"
dfe9444c
AD
1912 ;;
1913 *)
6904989c 1914 sh <"$src/$file"
dfe9444c
AD
1915 ;;
1916 esac
1917 ;;
1918 esac
1919done
6904989c 1920if test -f "$src/config_h.SH"; then
dfe9444c
AD
1921 if test ! -f config.h; then
1922 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1923 . "$src/config_h.SH"
dfe9444c
AD
1924 fi
1925fi
1926EOS
1927
1928: extract files and exit if asked to do so
1929case "$extractsh" in
1930true)
1931 case "$realsilent" in
1932 true) ;;
1933 *) exec 1>&4;;
1934 esac
1935 case "$config_sh" in
1936 '') config_sh='config.sh';;
1937 esac
1938 echo " "
1939 echo "Fetching answers from $config_sh..."
1940 cd ..
1941 . $config_sh
1942 test "$override" && . ./optdef.sh
1943 echo " "
1944 . UU/extract
1945 rm -rf UU
24ccb310 1946 echo "Extraction done."
dfe9444c
AD
1947 exit 0
1948 ;;
1949esac
1950
1951: Eunice requires " " instead of "", can you believe it
1952echo " "
1953: Here we go...
1954echo "Beginning of configuration questions for $package."
1955
1956trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1957
2304df62
AD
1958: first determine how to suppress newline on echo command
1959echo " "
1960echo "Checking echo to see how to suppress newlines..."
1961(echo "hi there\c" ; echo " ") >.echotmp
1962if $contains c .echotmp >/dev/null 2>&1 ; then
1963 echo "...using -n."
1964 n='-n'
1965 c=''
1966else
1967 cat <<'EOM'
1968...using \c
1969EOM
1970 n=''
1971 c='\c'
1972fi
1973echo $n "The star should be here-->$c"
1974echo '*'
1975rm -f .echotmp
1976
1977: Now test for existence of everything in MANIFEST
1978echo " "
6904989c 1979if test -f "$rsrc/MANIFEST"; then
2304df62 1980 echo "First let's make sure your kit is complete. Checking..." >&4
1d8eaf8c 1981 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
776a38e3 1982 (split -l 50 2>/dev/null || split -50)
2304df62 1983 rm -f missing
dfe9444c 1984 tmppwd=`pwd`
2304df62 1985 for filelist in x??; do
776a38e3
MB
1986 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1987 >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1988 done
1989 if test -s missing; then
1990 cat missing >&4
1991 cat >&4 <<'EOM'
1992
1993THIS PACKAGE SEEMS TO BE INCOMPLETE.
1994
1995You have the option of continuing the configuration process, despite the
1996distinct possibility that your kit is damaged, by typing 'y'es. If you
1997do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1998and contact the author (perlbug@perl.org).
2304df62
AD
1999
2000EOM
2001 echo $n "Continue? [n] $c" >&4
2002 read ans
2003 case "$ans" in
2004 y*)
2005 echo "Continuing..." >&4
2006 rm -f missing
2007 ;;
2008 *)
2009 echo "ABORTING..." >&4
2010 kill $$
2011 ;;
2012 esac
2013 else
dfe9444c 2014 echo "Looks good..."
2304df62
AD
2015 fi
2016else
2017 echo "There is no MANIFEST file. I hope your kit is complete !"
2018fi
2019rm -f missing x??
2020
5ff3f7a4 2021: Find the appropriate value for a newline for tr
613d6c3e 2022echo " "
5ff3f7a4
GS
2023if test -n "$DJGPP"; then
2024 trnl='\012'
2025fi
2026if test X"$trnl" = X; then
2027 case "`echo foo|tr '\n' x 2>/dev/null`" in
2028 foox) trnl='\n' ;;
2029 esac
2030fi
2031if test X"$trnl" = X; then
2032 case "`echo foo|tr '\012' x 2>/dev/null`" in
2033 foox) trnl='\012' ;;
2034 esac
2035fi
2036if test X"$trnl" = X; then
8be2c24c
JH
2037 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2038 fooxy) trnl='\n\r' ;;
2039 esac
2040fi
2041if test X"$trnl" = X; then
5ff3f7a4
GS
2042 cat <<EOM >&2
2043
2044$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2045
2046EOM
2047 exit 1
2048fi
2049
2304df62
AD
2050: compute the number of columns on the terminal for proper question formatting
2051case "$COLUMNS" in
2052'') COLUMNS='80';;
2053esac
2054
2055: set up the echo used in my read
2056myecho="case \"\$xxxm\" in
2057'') echo $n \"\$rp $c\" >&4;;
2058*) case \"\$rp\" in
2059 '') echo $n \"[\$xxxm] $c\";;
2060 *)
2061 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2062 echo \"\$rp\" >&4
2063 echo $n \"[\$xxxm] $c\" >&4
2064 else
2065 echo $n \"\$rp [\$xxxm] $c\" >&4
2066 fi
2067 ;;
2068 esac;;
2069esac"
2070
2071: now set up to do reads with possible shell escape and default assignment
2072cat <<EOSC >myread
28757baa 2073$startsh
2304df62
AD
2074xxxm=\$dflt
2075$myecho
2076ans='!'
2077case "\$fastread" in
2078yes) case "\$dflt" in
2079 '') ;;
2080 *) ans='';
2081 case "\$silent-\$rp" in
2082 true-) ;;
2083 *) echo " " >&4;;
2084 esac;;
2085 esac;;
2086*) case "\$silent" in
2087 true) case "\$rp" in
2088 '') ans='';;
2089 esac;;
2090 esac;;
2091esac
2092while expr "X\$ans" : "X!" >/dev/null; do
2093 read answ
2094 set x \$xxxm
2095 shift
dfe9444c 2096 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2097 case "\$answ" in
dfe9444c
AD
2098 "!")
2099 sh 1>&4
2100 echo " "
2101 $myecho
2102 ;;
2103 !*)
2104 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2105 shift
2106 sh 1>&4 -c "\$*"
2107 echo " "
2108 $myecho
2109 ;;
2304df62
AD
2110 "\$ans")
2111 case "\$ans" in
ecfc5424
AD
2112 \\&*)
2113 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2114 shift
2115 case "\$1" in
2116 -d)
2117 fastread=yes
40a7a20a 2118 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2119 ;;
2120 -*)
40a7a20a 2121 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2122 ;;
2123 esac
2124 $myecho
2125 ans=!
2126 ;;
2304df62
AD
2127 esac;;
2128 *)
2129 case "\$aok" in
2130 y)
2131 echo "*** Substitution done -- please confirm."
2132 xxxm="\$ans"
c9795ab7 2133 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2134 xxxm="\$ans"
2135 ans=!
2136 ;;
2137 *)
2138 echo "*** Error -- try again."
2139 ans=!
2140 ;;
2141 esac
2142 $myecho
2143 ;;
2144 esac
2145 case "\$ans\$xxxm\$nostick" in
2146 '')
2147 ans=!
2148 $myecho
2149 ;;
2150 esac
2151done
2152case "\$ans" in
2153'') ans="\$xxxm";;
2154esac
2155EOSC
2156
2157: create .config dir to save info across Configure sessions
2158test -d ../.config || mkdir ../.config
2159cat >../.config/README <<EOF
2160This directory created by Configure to save information that should
dfe9444c 2161persist across sessions for $package.
2304df62
AD
2162
2163You may safely delete it if you wish.
2164EOF
2165
613d6c3e 2166: See if we are using a devel version and want that
9507cadf 2167xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2168case "$usedevel" in
1be1b388
MB
2169$define|true|[yY]*)
2170 usedevel="$define" ;;
9507cadf 2171*) case "$xversion" in
0107c034
JH
2172 *[13579])
2173 cat >&4 <<EOH
2174*** WHOA THERE!!! ***
2175
2176 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2177 The version of this $package distribution is $xversion, that is, odd,
2178 (as opposed to even) and that signifies a development release.
3d5d58b1 2179 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2180
2181 Do ***NOT*** install this into production use.
2182 Data corruption and crashes are possible.
2183
2184 It is most seriously suggested that you do not continue any further
2185 unless you want to help in developing and debugging Perl.
2186
6adc6a45
JH
2187 If you *still* want to build perl, you can answer 'y' now,
2188 or pass -Dusedevel to Configure.
2189
0107c034
JH
2190EOH
2191 rp='Do you really want to continue?'
2192 dflt='n'
2193 . ./myread
2194 case "$ans" in
8feeef0e
JH
2195 [yY]) echo >&4 "Okay, continuing."
2196 usedevel="$define" ;;
0107c034
JH
2197 *) echo >&4 "Okay, bye."
2198 exit 1
2199 ;;
2200 esac
2201 ;;
2202 esac
1be1b388 2203 usedevel="$undef"
0107c034
JH
2204 ;;
2205esac
8feeef0e
JH
2206case "$usedevel" in
2207$define|true|[yY]*)
2208 case "$versiononly" in
2209 '') versiononly="$define" ;;
2210 esac
2211 case "$installusrbinperl" in
2212 '') installusrbinperl="$undef" ;;
2213 esac
2214 ;;
2215esac
0107c034 2216
2304df62
AD
2217: general instructions
2218needman=true
2219firsttime=true
760ac839 2220user=`(logname) 2>/dev/null`
dfe9444c
AD
2221case "$user" in
2222'') user=`whoami 2>&1`;;
760ac839 2223esac
2304df62
AD
2224if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2225 firsttime=false
2226 echo " "
2227 rp='Would you like to see the instructions?'
2228 dflt=n
2229 . ./myread
2230 case "$ans" in
2231 [yY]*) ;;
2232 *) needman=false;;
2233 esac
2234fi
2235if $needman; then
2236 cat <<EOH
4e2a5f63 2237
2304df62 2238This installation shell script will examine your system and ask you questions
a0d0e21e 2239to determine how the perl5 package should be installed. If you get
2304df62
AD
2240stuck on a question, you may use a ! shell escape to start a subshell or
2241execute a command. Many of the questions will have default answers in square
2242brackets; typing carriage return will give you the default.
2243
2244On some of the questions which ask for file or directory names you are allowed
2245to use the ~name construct to specify the login directory belonging to "name",
2246even if you don't have a shell which knows about that. Questions where this is
2247allowed will be marked "(~name ok)".
2248
2249EOH
2250 rp=''
2251 dflt='Type carriage return to continue'
2252 . ./myread
2253 cat <<'EOH'
2254
2255The prompter used in this script allows you to use shell variables and
2256backticks in your answers. You may use $1, $2, etc... to refer to the words
2257in the default answer, as if the default line was a set of arguments given to a
2258script shell. This means you may also use $* to repeat the whole default line,
2259so you do not have to re-type everything to add something to the default.
2260
cd95ead5 2261Every time there is a substitution, you will have to confirm. If there is an
2304df62
AD
2262error (e.g. an unmatched backtick), the default answer will remain unchanged
2263and you will be prompted again.
2264
2265If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2266the questions and use the computed defaults (or the previous answers if there
2267was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2268You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2269on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2270
2271EOH
2272 . ./myread
2273 cat <<EOH
2274
2275Much effort has been expended to ensure that this shell script will run on any
2276Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2277Configure and run it again. If you can't run Configure for some reason,
2278you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2279have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2280
2281This installation script affects things in two ways:
2282
22831) it may do direct variable substitutions on some of the files included
2284 in this kit.
22852) it builds a config.h file for inclusion in C programs. You may edit
2286 any of these files as the need arises after running this script.
2287
2288If you make a mistake on a question, there is no easy way to back up to it
2289currently. The easiest thing to do is to edit config.sh and rerun all the SH
2290files. Configure will offer to let you do this before it runs the SH files.
2291
2292EOH
2293 dflt='Type carriage return to continue'
2294 . ./myread
2295 case "$firsttime" in
2296 true) echo $user >>../.config/instruct;;
2297 esac
2298fi
2299
2304df62
AD
2300: find out where common programs are
2301echo " "
2302echo "Locating common programs..." >&4
2303cat <<EOSC >loc
2304$startsh
2305case \$# in
23060) exit 1;;
2307esac
2308thing=\$1
2309shift
2310dflt=\$1
2311shift
2312for dir in \$*; do
2313 case "\$thing" in
2314 .)
2315 if test -d \$dir/\$thing; then
2316 echo \$dir
2317 exit 0
2318 fi
2319 ;;
2320 *)
a0d0e21e 2321 for thisthing in \$dir/\$thing; do
ecfc5424 2322 : just loop through to pick last item
a0d0e21e 2323 done
25f94b33 2324 if test -f \$thisthing; then
a0d0e21e 2325 echo \$thisthing
2304df62 2326 exit 0
a5a94ea5
JH
2327 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2328 echo \$thisthing
776a38e3 2329 exit 0
2304df62 2330 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2331 if test -n "$DJGPP"; then
2332 echo \$dir/\$thing.exe
b921d661 2333 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2334 : on Eunice apparently
2335 echo \$dir/\$thing
2336 fi
2d736872 2337 exit 0
2304df62
AD
2338 fi
2339 ;;
2340 esac
2341done
2342echo \$dflt
2343exit 1
2344EOSC
2345chmod +x loc
2346$eunicefix loc
2347loclist="
2348awk
2349cat
f8006fac 2350chmod
b4eb6b3d
JH
2351comm
2352cp
2304df62
AD
2353echo
2354expr
2355grep
a0d0e21e 2356ls
b4eb6b3d 2357mkdir
2304df62
AD
2358rm
2359sed
b4eb6b3d 2360sort
85e6fe83 2361touch
2304df62 2362tr
b4eb6b3d 2363uniq
2304df62
AD
2364"
2365trylist="
dfe9444c 2366ar
3659ebf1 2367bison
b4eb6b3d 2368byacc
2304df62 2369cpp
b4eb6b3d 2370csh
2304df62
AD
2371date
2372egrep
1fef16b3 2373gmake
8ff267be 2374gzip
b4eb6b3d 2375less
8ff267be 2376ln
3c728e00 2377make
b4eb6b3d 2378more
693762b4 2379nm
b4eb6b3d 2380nroff
b8677e3b 2381perl
b4eb6b3d 2382pg
2304df62
AD
2383test
2384uname
8ff267be 2385zip
2304df62 2386"
8e07c86e 2387pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2388pth="$pth /lib /usr/lib"
2389for file in $loclist; do
dfe9444c
AD
2390 eval xxx=\$$file
2391 case "$xxx" in
2392 /*|?:[\\/]*)
2393 if test -f "$xxx"; then
2394 : ok
2395 else
2396 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2397 xxx=`./loc $file $file $pth`
2398 fi
2399 ;;
2400 '') xxx=`./loc $file $file $pth`;;
2401 *) xxx=`./loc $xxx $xxx $pth`;;
2402 esac
a5a94ea5 2403 eval $file=$xxx$_exe
2304df62
AD
2404 eval _$file=$xxx
2405 case "$xxx" in
2406 /*)
2407 echo $file is in $xxx.
2408 ;;
8e07c86e
AD
2409 ?:[\\/]*)
2410 echo $file is in $xxx.
2411 ;;
2304df62 2412 *)
25f94b33
AD
2413 echo "I don't know where '$file' is, and my life depends on it." >&4
2414 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2415 exit 1
2304df62
AD
2416 ;;
2417 esac
2418done
2419echo " "
2420echo "Don't worry if any of the following aren't found..."
2421say=offhand
2422for file in $trylist; do
dfe9444c
AD
2423 eval xxx=\$$file
2424 case "$xxx" in
2425 /*|?:[\\/]*)
2426 if test -f "$xxx"; then
2427 : ok
2428 else
2429 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2430 xxx=`./loc $file $file $pth`
2431 fi
2432 ;;
2433 '') xxx=`./loc $file $file $pth`;;
2434 *) xxx=`./loc $xxx $xxx $pth`;;
2435 esac
306a8474 2436 eval $file=$xxx$_exe
2304df62
AD
2437 eval _$file=$xxx
2438 case "$xxx" in
2439 /*)
2440 echo $file is in $xxx.
2441 ;;
8e07c86e
AD
2442 ?:[\\/]*)
2443 echo $file is in $xxx.
2444 ;;
2304df62
AD
2445 *)
2446 echo "I don't see $file out there, $say."
2447 say=either
2448 ;;
2449 esac
2450done
2451case "$egrep" in
1fef16b3 2452egrep)
2304df62
AD
2453 echo "Substituting grep for egrep."
2454 egrep=$grep
868439a2 2455 _egrep=$grep
2304df62
AD
2456 ;;
2457esac
3141af47
MB
2458case "$less" in
2459'') ;;
2460*) if $less -R </dev/null >/dev/null; then
2461 echo "Substituting less -R for less."
2462 less="$less -R"
2463 _less=$less
2464 fi
2465 ;;
2466esac
8ff267be 2467case "$ln" in
1fef16b3 2468ln)
8ff267be 2469 echo "Substituting cp for ln."
2470 ln=$cp
868439a2 2471 _ln=$cp
8ff267be 2472 ;;
2473esac
2e26f1d5 2474case "$make" in
613d6c3e 2475make)
2e26f1d5
JH
2476 case "$gmake" in
2477 gmake)
2478 echo "I can't find make or gmake, and my life depends on it." >&4
2479 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2480 exit 1
2481 ;;
2482 esac
2483 ;;
613d6c3e 2484esac
2e26f1d5
JH
2485case "$gmake" in
2486gmake) ;;
2487*) # We can't have osname yet.
1fef16b3
JH
2488 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2489 # Assume that gmake, if found, is definitely GNU make
2490 # and prefer it over the system make.
2491 echo "Substituting gmake for make."
2492 make=$gmake
868439a2 2493 _make=$gmake
1fef16b3
JH
2494 fi
2495 ;;
a5a94ea5 2496esac
2304df62
AD
2497case "$test" in
2498test)
2499 echo "Hopefully test is built into your sh."
2500 ;;
2501*)
73614538 2502 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2503 echo "Using the test built into your sh."
2304df62
AD
2504 test=test
2505 _test=test
2506 fi
2507 ;;
2508esac
2509case "$echo" in
2510echo)
2511 echo "Hopefully echo is built into your sh."
2512 ;;
2513'') ;;
2514*)
2515 echo " "
2516echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2517 $echo $n "hi there$c" >foo1
2518 echo $n "hi there$c" >foo2
2519 if cmp foo1 foo2 >/dev/null 2>&1; then
2520 echo "They are compatible. In fact, they may be identical."
2521 else
2522 case "$n" in
2523 '-n') n='' c='\c';;
2524 *) n='-n' c='';;
2525 esac
2526 cat <<FOO
2527They are not compatible! You are probably running ksh on a non-USG system.
2528I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2529have echo built in and we may have to run some Bourne shell scripts. That
2530means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2531
2532FOO
2533 $echo $n "The star should be here-->$c"
2534 $echo "*"
2535 fi
2536 $rm -f foo1 foo2
2537 ;;
2538esac
2539
2f88d857
MB
2540# This question was auctioned at YAPC::Europe-2007 in Vienna
2541# I never promised you could answer it. I only auctioned the question.
2542cat <<FOO
2543The following message is sponsored by
2544
2545 Dresden.pm<--The stars should be here.
2546
2547Dear Perl user, system administrator or package
2548maintainer, the Perl community sends greetings to
2549you. Do you (emblematical) greet back [Y/n]? n
2550
2551FOO
2552
613d6c3e 2553: Check what type of C compiler we use
6b769f8f 2554cat <<EOS >trygcc
2573c5f9
JH
2555$startsh
2556EOS
6b769f8f 2557cat <<'EOSC' >>trygcc
2573c5f9
JH
2558case "$cc" in
2559'') ;;
2560*) $rm -f try try.*
2561 $cat >try.c <<EOM
2562int main(int argc, char *argv[]) {
2563 return 0;
2564}
2565EOM
e4778687 2566 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2567 :
2568 else
2569 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2570 despair=yes
2571 trygcc=yes
2572 case "$cc" in
2573 *gcc*) trygcc=no ;;
2574 esac
dce40316
AD
2575 # Skip this test because it gives a false match on output like:
2576 # ./trygcc: line 23: cc: command not found
2577 # case "`$cc -v -c try.c 2>&1`" in
2578 # *gcc*) trygcc=no ;;
2579 # esac
2573c5f9
JH
2580 if $test X"$trygcc" = Xyes; then
2581 if gcc -o try -c try.c; then
2582 echo " "
2583 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2584 # Switching compilers may undo the work of hints files.
2585 # The most common problem is -D_REENTRANT for threads.
2586 # This heuristic catches that case, but gets false positives
2587 # if -Dusethreads was not actually specified. Better to
2588 # bail out here with a useful message than fail
2589 # mysteriously later. Should we perhaps just try to
2590 # re-invoke Configure -Dcc=gcc config_args ?
2591 if $test -f usethreads.cbu; then
2592 $cat >&4 <<EOM
2593
2594*** However, any setting of the C compiler flags (e.g. for thread support)
2595*** will be lost. It may be necessary for you to restart Configure and
2596*** add -Dcc=gcc to your Configure command line.
2597
2598EOM
2599 rp="Would you like to go ahead and try gcc anyway?"
2600 dflt=n
2601 else
2602 rp="Would you like to use it?"
2603 dflt=y
2604 fi
2573c5f9
JH
2605 if $test -f myread; then
2606 . ./myread
2607 else
2608 if $test -f UU/myread; then
2609 . ./UU/myread
2610 else
2611 echo "Cannot find myread, sorry. Aborting." >&2
2612 exit 1
2613 fi
2614 fi
2615 case "$ans" in
6371411c 2616 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2617 esac
2618 fi
2619 fi
6b769f8f
RB
2620 fi
2621 $rm -f try try.*
2622 ;;
2623esac
2624EOSC
2625
2626cat <<EOS >checkcc
2627$startsh
2628EOS
2629cat <<'EOSC' >>checkcc
2630case "$cc" in
2631'') ;;
2632*) $rm -f try try.*
2633 $cat >try.c <<EOM
2634int main(int argc, char *argv[]) {
2635 return 0;
2636}
2637EOM
2638 if $cc -o try $ccflags $ldflags try.c; then
2639 :
2640 else
2573c5f9 2641 if $test X"$despair" = Xyes; then
6b769f8f
RB
2642 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2643 fi
2644 $cat >&4 <<EOM
5dd4fbdf
MB
2645You need to find a working C compiler.
2646Either (purchase and) install the C compiler supplied by your OS vendor,
2647or for a free C compiler try http://gcc.gnu.org/
2648I cannot continue any further, aborting.
2649EOM
6b769f8f 2650 exit 1
2573c5f9
JH
2651 fi
2652 $rm -f try try.*
2653 ;;
2654esac
2655EOSC
2656
a0d0e21e
LW
2657: determine whether symbolic links are supported
2658echo " "
2659$touch blurfl
2660if $ln -s blurfl sym > /dev/null 2>&1 ; then
2661 echo "Symbolic links are supported." >&4
818f00be 2662 lns="$ln -s"
a0d0e21e
LW
2663else
2664 echo "Symbolic links are NOT supported." >&4
2665 lns="$ln"
2666fi
2667$rm -f blurfl sym
2668
dafca956
JH
2669: determine whether symbolic links are supported
2670echo " "
2671case "$lns" in
18ea2752 2672*"ln"*" -s")
dafca956
JH
2673 echo "Checking how to test for symbolic links..." >&4
2674 $lns blurfl sym
4b661809 2675 if $test "X$issymlink" = X; then
2e2a97a6
JH
2676 case "$newsh" in
2677 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2678 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2679 esac
5d644a95
MB
2680 if test $? = 0; then
2681 issymlink="test -h"
2e2a97a6
JH
2682 else
2683 echo "Your builtin 'test -h' may be broken." >&4
2684 case "$test" in
2685 /*) ;;
2686 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2687 for p in $pth
2688 do
2689 if test -f "$p/$test"; then
2690 test="$p/$test"
2691 break
2692 fi
2693 done
2694 ;;
2695 esac
2696 case "$test" in
2697 /*)
2698 echo "Trying external '$test -h'." >&4
2699 issymlink="$test -h"
2700 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2701 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2702 issymlink=''
2703 fi
2704 ;;
2705 *) issymlink='' ;;
2706 esac
5d644a95
MB
2707 fi
2708 fi
4b661809 2709 if $test "X$issymlink" = X; then
dafca956 2710 if $test -L sym 2>/dev/null; then
5d644a95 2711 issymlink="$test -L"
2e2a97a6 2712 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2713 fi
2714 fi
4b661809 2715 if $test "X$issymlink" != X; then
5d644a95 2716 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2717 else
2718 echo "I do not know how you can test for symbolic links." >&4
2719 fi
2720 $rm -f blurfl sym
2721 ;;
2722*) echo "No symbolic links, so not testing for their testing..." >&4
2723 ;;
2724esac
2725echo " "
2726
34f1896b 2727: Make symlinks util
dafca956
JH
2728case "$mksymlinks" in
2729$define|true|[yY]*)
2730 case "$src" in
2731 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2732 exit 1
2733 ;;
4b661809 2734 *) case "$lns:$issymlink" in
f314eb9f 2735 *"ln"*" -s:"*"test -"?)
dafca956
JH
2736 echo "Creating the symbolic links..." >&4
2737 echo "(First creating the subdirectories...)" >&4
2738 cd ..
2739 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2740 read directory
2741 test -z "$directory" && break
2742 mkdir -p $directory
2743 done
2744 # Sanity check 1.
2745 if test ! -d t/base; then
2746 echo "Failed to create the subdirectories. Aborting." >&4
2747 exit 1
2748 fi
2749 echo "(Then creating the symlinks...)" >&4
2750 awk '{print $1}' $src/MANIFEST | while true; do
2751 read filename
2752 test -z "$filename" && break
2753 if test -f $filename; then
5d644a95 2754 if $issymlink $filename; then
dafca956
JH
2755 rm -f $filename
2756 fi
2757 fi
2758 if test -f $filename; then
2759 echo "$filename already exists, not symlinking."
2760 else
2761 ln -s $src/$filename $filename
2762 fi
2763 done
2764 # Sanity check 2.
a0d24b8a
JH
2765 if test ! -f t/base/lex.t; then
2766 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2767 exit 1
2768 fi
2769 cd UU
2770 ;;
2771 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2772 ;;
2773 esac
2774 ;;
2775 esac
2776 ;;
2777esac
2778
613d6c3e 2779: Check for Cross-Compilation
5440bc8e
JH
2780case "$usecrosscompile" in
2781$define|true|[yY]*)
93bc48fa 2782 $echo "Cross-compiling..."
5440bc8e
JH
2783 croak=''
2784 case "$cc" in
2785 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2786 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2787 ar=$targetarch-ar
2788 # leave out ld, choosing it is more complex
2789 nm=$targetarch-nm
2790 ranlib=$targetarch-ranlib
93bc48fa 2791 $echo 'extern int foo;' > try.c
f8006fac 2792 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2793 shift
2794 if $test $# -gt 0; then
2795 incpth="$incpth $*"
f8006fac
JH
2796 incpth="`$echo $incpth|$sed 's/^ //'`"
2797 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2798 for i in $*; do
f8006fac 2799 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2800 if $test -d $j; then
2801 libpth="$libpth $j"
2802 fi
2803 done
f8006fac
JH
2804 libpth="`$echo $libpth|$sed 's/^ //'`"
2805 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2806 fi
2807 $rm -f try.c
5440bc8e
JH
2808 ;;
2809 esac
2810 case "$targetarch" in
93bc48fa
JH
2811 '') echo "Targetarch not defined." >&4; croak=y ;;
2812 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2813 esac
2814 case "$incpth" in
93bc48fa 2815 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2816 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2817 esac
2818 case "$libpth" in
93bc48fa 2819 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2820 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2821 esac
93bc48fa
JH
2822 case "$usrinc" in
2823 '') for i in $incpth; do
2824 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2825 usrinc=$i
2826 echo "Guessing usrinc $usrinc." >&4
2827 break
2828 fi
2829 done
2830 case "$usrinc" in
2831 '') echo "Usrinc not defined." >&4; croak=y ;;
2832 esac
2833 ;;
2834 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2835 esac
93bc48fa
JH
2836 case "$targethost" in
2837 '') echo "Targethost not defined." >&4; croak=y ;;
2838 *) echo "Using targethost $targethost." >&4
5440bc8e 2839 esac
93bc48fa
JH
2840 locincpth=' '
2841 loclibpth=' '
5440bc8e 2842 case "$croak" in
93bc48fa 2843 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2844 esac
2845 case "$src" in
2846 /*) run=$src/Cross/run
93c0359c 2847 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2848 to=$src/Cross/to
2849 from=$src/Cross/from
2850 ;;
93bc48fa 2851 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2852 run=$pwd/Cross/run
f8006fac 2853 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2854 to=$pwd/Cross/to
2855 from=$pwd/Cross/from
2856 ;;
2857 esac
2858 case "$targetrun" in
2859 '') targetrun=ssh ;;
2860 esac
2861 case "$targetto" in
2862 '') targetto=scp ;;
2863 esac
2864 case "$targetfrom" in
2865 '') targetfrom=scp ;;
2866 esac
2867 run=$run-$targetrun
2868 to=$to-$targetto
2869 from=$from-$targetfrom
93bc48fa
JH
2870 case "$targetdir" in
2871 '') targetdir=/tmp
2872 echo "Guessing targetdir $targetdir." >&4
2873 ;;
2874 esac
5440bc8e 2875 case "$targetuser" in
93bc48fa
JH
2876 '') targetuser=root
2877 echo "Guessing targetuser $targetuser." >&4
2878 ;;
5440bc8e
JH
2879 esac
2880 case "$targetfrom" in
2881 scp) q=-q ;;
2882 *) q='' ;;
2883 esac
2884 case "$targetrun" in
2885 ssh|rsh)
2886 cat >$run <<EOF
2887#!/bin/sh
93c0359c
JH
2888case "\$1" in
2889-cwd)
2890 shift
2891 cwd=\$1
2892 shift
2893 ;;
2894esac
2895case "\$cwd" in
2896'') cwd=$targetdir ;;
2897esac
5440bc8e
JH
2898exe=\$1
2899shift
93c0359c
JH
2900if $test ! -f \$exe.xok; then
2901 $to \$exe
2902 $touch \$exe.xok
2903fi
2904$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2905EOF
2906 ;;
93bc48fa 2907 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2908 exit 1
2909 ;;
2910 esac
93c0359c
JH
2911 case "$targetmkdir" in
2912 */Cross/mkdir)
2913 cat >$targetmkdir <<EOF
2914#!/bin/sh
2915$targetrun -l $targetuser $targethost "mkdir -p \$@"
2916EOF
f8006fac 2917 $chmod a+rx $targetmkdir
93c0359c
JH
2918 ;;
2919 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2920 exit 1
2921 ;;
2922 esac
5440bc8e
JH
2923 case "$targetto" in
2924 scp|rcp)
2925 cat >$to <<EOF
2926#!/bin/sh
2927for f in \$@
2928do
93c0359c
JH
2929 case "\$f" in
2930 /*)
2931 $targetmkdir \`dirname \$f\`
2932 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2933 ;;
2934 *)
2935 $targetmkdir $targetdir/\`dirname \$f\`
2936 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2937 ;;
2938 esac
5440bc8e
JH
2939done
2940exit 0
2941EOF
2942 ;;
2943 cp) cat >$to <<EOF
2944#!/bin/sh
93c0359c
JH
2945for f in \$@
2946do
2947 case "\$f" in
2948 /*)
2949 $mkdir -p $targetdir/\`dirname \$f\`
2950 $cp \$f $targetdir/\$f || exit 1
2951 ;;
2952 *)
2953 $targetmkdir $targetdir/\`dirname \$f\`
2954 $cp \$f $targetdir/\$f || exit 1
2955 ;;
2956 esac
2957done
2958exit 0
5440bc8e
JH
2959EOF
2960 ;;
93bc48fa 2961 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2962 exit 1
2963 ;;
2964 esac
2965 case "$targetfrom" in
2966 scp|rcp)
2967 cat >$from <<EOF
2968#!/bin/sh
2969for f in \$@
2970do
93c0359c 2971 $rm -f \$f
5440bc8e
JH
2972 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2973done
2974exit 0
2975EOF
2976 ;;
2977 cp) cat >$from <<EOF
2978#!/bin/sh
2979for f in \$@
2980do
93c0359c 2981 $rm -f \$f
5440bc8e
JH
2982 cp $targetdir/\$f . || exit 1
2983done
2984exit 0
2985EOF
2986 ;;
93bc48fa 2987 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2988 exit 1
2989 ;;
2990 esac
93bc48fa
JH
2991 if $test ! -f $run; then
2992 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2993 else
f8006fac 2994 $chmod a+rx $run
5440bc8e 2995 fi
93bc48fa
JH
2996 if $test ! -f $to; then
2997 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2998 else
f8006fac 2999 $chmod a+rx $to
5440bc8e 3000 fi
93bc48fa
JH
3001 if $test ! -f $from; then
3002 echo "Target 'from' script '$from' not found." >&4
5440bc8e 3003 else
f8006fac 3004 $chmod a+rx $from
5440bc8e 3005 fi
93bc48fa 3006 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
3007 exit 1
3008 fi
3009 cat >&4 <<EOF
f8006fac
JH
3010Using '$run' for remote execution,
3011and '$from' and '$to'
93bc48fa 3012for remote file transfer.
5440bc8e
JH
3013EOF
3014 ;;
3015*) run=''
3016 to=:
3017 from=:
3018 usecrosscompile='undef'
3019 targetarch=''
3020 ;;
3021esac
3022
ecfc5424
AD
3023: see whether [:lower:] and [:upper:] are supported character classes
3024echo " "
ecfc5424
AD
3025case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3026ABYZ)
3027 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3028 up='[:upper:]'
3029 low='[:lower:]'
3030 ;;
416d0bea
MB
3031*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3032 # (0xd9 and 0xe2), therefore that is a nice testing point.
3033 if test "X$up" = X -o "X$low" = X; then
3034 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3035 rs) up='[A-Z]'
3036 low='[a-z]'
28e8609d
JH
3037 ;;
3038 esac
416d0bea 3039 fi
28e8609d 3040 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3041 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3042 rs) up='A-Z'
28e8609d
JH
3043 low='a-z'
3044 ;;
3045 esac
416d0bea 3046 fi
28e8609d 3047 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3048 case "`echo RS | od -x 2>/dev/null`" in
3049 *D9E2*|*d9e2*)
28e8609d
JH
3050 echo "Hey, this might be EBCDIC." >&4
3051 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3052 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3053 rs) up='[A-IJ-RS-Z]'
3054 low='[a-ij-rs-z]'
28e8609d
JH
3055 ;;
3056 esac
3057 fi
3058 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3059 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3060 rs) up='A-IJ-RS-Z'
3061 low='a-ij-rs-z'
28e8609d
JH
3062 ;;
3063 esac
3064 fi
3065 ;;
3066 esac
3067 fi
3068esac
416d0bea
MB
3069case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3070rs)
28e8609d
JH
3071 echo "Using $up and $low to convert case." >&4
3072 ;;
ecfc5424 3073*)
28e8609d
JH
3074 echo "I don't know how to translate letters from upper to lower case." >&4
3075 echo "Your tr is not acting any way I know of." >&4
3076 exit 1
3077 ;;
ecfc5424
AD
3078esac
3079: set up the translation script tr, must be called with ./tr of course
3080cat >tr <<EOSC
3081$startsh
3082case "\$1\$2" in
3083'[A-Z][a-z]') exec $tr '$up' '$low';;
3084'[a-z][A-Z]') exec $tr '$low' '$up';;
3085esac
3086exec $tr "\$@"
3087EOSC
3088chmod +x tr
3089$eunicefix tr
3090
2304df62
AD
3091: Try to determine whether config.sh was made on this system
3092case "$config_sh" in
3093'')
43999f95
JH
3094myuname=`$uname -a 2>/dev/null`
3095$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3096# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3097# because the A-Z/a-z are not consecutive.
34e09935 3098myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3eaeeeae 3099 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3100newmyuname="$myuname"
2304df62 3101dflt=n
16d20bd9
AD
3102case "$knowitall" in
3103'')
3104 if test -f ../config.sh; then
3105 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3106 eval "`grep myuname= ../config.sh`"
3107 fi
3108 if test "X$myuname" = "X$newmyuname"; then
3109 dflt=y
3110 fi
2304df62 3111 fi
16d20bd9
AD
3112 ;;
3113*) dflt=y;;
3114esac
2304df62
AD
3115
3116: Get old answers from old config file if Configure was run on the
3117: same system, otherwise use the hints.
3118hint=default
3119cd ..
3120if test -f config.sh; then
16d20bd9
AD
3121 echo " "
3122 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3123 . UU/myread
3124 case "$ans" in
f83701cd
AD
3125 n*|N*) echo "OK, I'll ignore it."
3126 mv config.sh config.sh.old
3127 myuname="$newmyuname"
3128 ;;
2304df62 3129 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3130 tmp_n="$n"
3131 tmp_c="$c"
85cad39c 3132 tmp_sh="$sh"
2304df62
AD
3133 . ./config.sh
3134 cp config.sh UU
ecfc5424
AD
3135 n="$tmp_n"
3136 c="$tmp_c"
85cad39c 3137 : Older versions did not always set $sh. Catch re-use of such
3138 : an old config.sh.
3139 case "$sh" in
3140 '') sh="$tmp_sh" ;;
3141 esac
2304df62
AD
3142 hint=previous
3143 ;;
3144 esac
3145fi
2573c5f9 3146. ./UU/checkcc
2304df62
AD
3147if test ! -f config.sh; then
3148 $cat <<EOM
3149
4e2a5f63
AD
3150First time through, eh? I have some defaults handy for some systems
3151that need some extra help getting the Configure answers right:
2304df62
AD
3152
3153EOM
dfe9444c 3154 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3155 dflt=''
3156 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3157 : tests or hints, please send them to perlbug@perl.org
2304df62 3158 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3159 $test -f /irix && osname=irix
85e6fe83
LW
3160 $test -f /xenix && osname=sco_xenix
3161 $test -f /dynix && osname=dynix
3162 $test -f /dnix && osname=dnix
5f05dabc 3163 $test -f /lynx.os && osname=lynxos
3164 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3165 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3166 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3167 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3168 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3169 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3170 $test -d /usr/apollo/bin && osname=apollo
3171 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3172 $test -d /usr/include/minix && osname=minix
d54344fc 3173 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3174 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3175 osname=machten
4633a7c4 3176 if $test -x /sbin/version; then
dfe9444c 3177 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3178 $sed -e 's/[A-Za-z]$//'`
3179 elif $test -x /usr/etc/version; then
dfe9444c 3180 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3181 $sed -e 's/[A-Za-z]$//'`
3182 else
3183 osvers="$2.$3"
3184 fi
3185 fi
aaacdc8b
GS
3186
3187 $test -f /sys/posix.dll &&
3188 $test -f /usr/bin/what &&
3189 set X `/usr/bin/what /sys/posix.dll` &&
3190 $test "$3" = UWIN &&
3191 osname=uwin &&
3192 osvers="$5"
3193
2304df62
AD
3194 if $test -f $uname; then
3195 set X $myuname
3196 shift
3197
2304df62 3198 case "$5" in
85e6fe83 3199 fps*) osname=fps ;;
2304df62
AD
3200 mips*)
3201 case "$4" in
85e6fe83
LW
3202 umips) osname=umips ;;
3203 *) osname=mips ;;
2304df62 3204 esac;;
85e6fe83
LW
3205 [23]100) osname=mips ;;
3206 next*) osname=next ;;
ecfc5424 3207 i386*)
c6912327
JH
3208 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3209 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3210 osname='sco'
3211 osvers=$tmp
3212 elif $test -f /etc/kconfig; then
ecfc5424 3213 osname=isc
bd628c73 3214 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3215 osvers=4
3216 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3217 osvers=3
2304df62 3218 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3219 osvers=2
ecfc5424
AD
3220 fi
3221 fi
2000072c 3222 tmp=''
ecfc5424 3223 ;;
c4f23d77
AD
3224 pc*)
3225 if test -n "$DJGPP"; then
3226 osname=dos
3227 osvers=djgpp
3228 fi
3229 ;;
2304df62
AD
3230 esac
3231
3232 case "$1" in
a0d0e21e
LW
3233 aix) osname=aix
3234 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3235 case "$tmp" in
e81c5c2a
NC
3236 # oslevel can fail with:
3237 # oslevel: Unable to acquire lock.
3238 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3239 '<3240'|'<>3240') osvers=3.2.0 ;;
3240 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3241 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3242 *) osvers=$tmp;;
a0d0e21e
LW
3243 esac
3244 ;;
aaacdc8b
GS
3245 bsd386) osname=bsd386
3246 osvers=`$uname -r`
3247 ;;
3248 cygwin*) osname=cygwin
3249 osvers="$3"
3250 ;;
23f87696
SZ
3251 *dc.osx) osname=dcosx
3252 osvers="$3"
3253 ;;
a0d0e21e
LW
3254 dnix) osname=dnix
3255 osvers="$3"
3256 ;;
3257 domainos) osname=apollo
3258 osvers="$3"
3259 ;;
a774dfe6
RSG
3260 dgux) osname=dgux
3261 osvers="$3"
3262 ;;
3263 dragonfly) osname=dragonfly
a0d0e21e
LW
3264 osvers="$3"
3265 ;;
760ac839 3266 dynixptx*) osname=dynixptx
e58e581d 3267 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3268 ;;
a774dfe6 3269 freebsd) osname=freebsd
a0d0e21e 3270 osvers="$3" ;;
761ee4e8
BD
3271 genix) osname=genix ;;
3272 gnu) osname=gnu
3273 osvers="$3" ;;
a774dfe6 3274 hp*) osname=hpux
bfb7748a 3275 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3276 ;;
761ee4e8 3277 irix*) osname=irix
a0d0e21e
LW
3278 case "$3" in
3279 4*) osvers=4 ;;
3280 5*) osvers=5 ;;
ecfc5424 3281 *) osvers="$3" ;;
a0d0e21e
LW
3282 esac
3283 ;;
761ee4e8 3284 linux) osname=linux
a0d0e21e 3285 case "$3" in
a0d0e21e
LW
3286 *) osvers="$3" ;;
3287 esac
3288 ;;
761ee4e8 3289 MiNT) osname=mint
28e8609d
JH
3290 ;;
3291 netbsd*) osname=netbsd
ecfc5424
AD
3292 osvers="$3"
3293 ;;
4e81affe
MM
3294 news-os) osvers="$3"
3295 case "$3" in
3296 4*) osname=newsos4 ;;
3297 *) osname=newsos ;;
3298 esac
3299 ;;
aaacdc8b 3300 next*) osname=next ;;
28bb1e2c 3301 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3302 openbsd) osname=openbsd
3303 osvers="$3"
3304 ;;
5c728af0
IZ
3305 os2) osname=os2
3306 osvers="$4"
3307 ;;
aaacdc8b
GS
3308 POSIX-BC | posix-bc ) osname=posix-bc
3309 osvers="$3"
a0d0e21e 3310 ;;
ae3afa4e
TH
3311 powerux | power_ux | powermax_os | powermaxos | \
3312 powerunix | power_unix) osname=powerux
3313 osvers="$3"
3314 ;;
aaacdc8b
GS
3315 qnx) osname=qnx
3316 osvers="$4"
3317 ;;
a0d0e21e
LW
3318 solaris) osname=solaris
3319 case "$3" in
3320 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3321 *) osvers="$3" ;;
a0d0e21e
LW
3322 esac
3323 ;;
85e6fe83
LW
3324 sunos) osname=sunos
3325 case "$3" in
85e6fe83
LW
3326 5*) osname=solaris
3327 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3328 *) osvers="$3" ;;
2304df62
AD
3329 esac
3330 ;;
a0d0e21e 3331 titanos) osname=titanos
85e6fe83 3332 case "$3" in
a0d0e21e
LW
3333 1*) osvers=1 ;;
3334 2*) osvers=2 ;;
3335 3*) osvers=3 ;;
3336 4*) osvers=4 ;;
ecfc5424 3337 *) osvers="$3" ;;
2304df62
AD
3338 esac
3339 ;;
85e6fe83 3340 ultrix) osname=ultrix
ecfc5424 3341 osvers="$3"
2304df62 3342 ;;
28757baa 3343 osf1|mls+) case "$5" in
fed7345c
AD
3344 alpha)
3345 osname=dec_osf
fdd85a03 3346 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3347 case "$osvers" in
3348 [1-9].[0-9]*) ;;
3349 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3350 esac
ecfc5424
AD
3351 ;;
3352 hp*) osname=hp_osf1 ;;
3353 mips) osname=mips_osf1 ;;
85e6fe83
LW
3354 esac
3355 ;;
af1ff193 3356 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3357 openunix|unixware) osname=svr5
0337d152
BG
3358 osvers="$4"
3359 ;;
3c728e00 3360 uts) osname=uts
a0d0e21e
LW
3361 osvers="$3"
3362 ;;
3c728e00
JH
3363 vos) osvers="$3"
3364 ;;
85e6fe83 3365 $2) case "$osname" in
2304df62 3366 *isc*) ;;
a0d0e21e 3367 *freebsd*) ;;
5f05dabc 3368 svr*)
a0d0e21e 3369 : svr4.x or possibly later
a774dfe6 3370 case "svr$3" in
a0d0e21e
LW
3371 ${osname}*)
3372 osname=svr$3
3373 osvers=$4
3374 ;;
3375 esac
3376 case "$osname" in
3377 svr4.0)
3378 : Check for ESIX
3379 if test -f /stand/boot ; then
3380 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3381 if test -n "$INITPROG" -a -f "$INITPROG"; then
3382 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3383 if test -n "$isesix"; then
a0d0e21e
LW
3384 osname=esix4
3385 fi
3386 fi
3387 fi
3388 ;;
3389 esac
3390 ;;
2304df62 3391 *) if test -f /etc/systemid; then
a0d0e21e
LW
3392 osname=sco
3393 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3394 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3395 osvers=$1.$2.$3
c4f23d77 3396 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3397 osvers=$1.$2
c4f23d77 3398 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3399 osvers=$1
2304df62 3400 fi
a0d0e21e
LW
3401 else
3402 case "$osname" in
3403 '') : Still unknown. Probably a generic Sys V.
3404 osname="sysv"
3405 osvers="$3"
3406 ;;
3407 esac
2304df62
AD
3408 fi
3409 ;;
3410 esac
3411 ;;
a0d0e21e
LW
3412 *) case "$osname" in
3413 '') : Still unknown. Probably a generic BSD.
3414 osname="$1"
3415 osvers="$3"
3416 ;;
3417 esac
3418 ;;
2304df62
AD
3419 esac
3420 else
dfe9444c
AD
3421 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3422 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3423 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3424 osname=news_os
2304df62 3425 fi
dfe9444c 3426 $rm -f UU/kernel.what
5c728af0 3427 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3428 set X $myuname
3429 osname=os2
3430 osvers="$5"
2304df62
AD
3431 fi
3432 fi
a774dfe6 3433
5440bc8e
JH
3434 case "$targetarch" in
3435 '') ;;
3436 *) hostarch=$osname
3437 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3438 osvers=''
3439 ;;
3440 esac
3441
a0d0e21e
LW
3442 : Now look for a hint file osname_osvers, unless one has been
3443 : specified already.
3444 case "$hintfile" in
3445 ''|' ')
1e127011 3446 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3447 : Also try without trailing minor version numbers.
1e127011
DD
3448 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3449 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3450 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3451 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3452 case "$file" in
3453 '') dflt=none ;;
3454 *) case "$osvers" in
3455 '') dflt=$file
3456 ;;
dfe9444c 3457 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3458 dflt=$file
dfe9444c 3459 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3460 dflt=$xfile
dfe9444c 3461 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3462 dflt=$xxfile
dfe9444c 3463 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3464 dflt=$xxxfile
dfe9444c 3465 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3466 dflt=$xxxxfile
dfe9444c 3467 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3468 dflt="${osname}"
3469 else
3470 dflt=none
3471 fi
3472 ;;
3473 esac
85e6fe83
LW
3474 ;;
3475 esac
4e2a5f63
AD
3476 if $test -f Policy.sh ; then
3477 case "$dflt" in
3478 *Policy*) ;;
3479 none) dflt="Policy" ;;
3480 *) dflt="Policy $dflt" ;;
3481 esac
3482 fi
85e6fe83 3483 ;;
a0d0e21e 3484 *)
ecfc5424 3485 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3486 ;;
2304df62 3487 esac
1aef975c 3488
4e2a5f63
AD
3489 if $test -f Policy.sh ; then
3490 $cat <<EOM
3491
3492There's also a Policy hint file available, which should make the
3493site-specific (policy) questions easier to answer.
3494EOM
3495
3496 fi
3497
2304df62
AD
3498 $cat <<EOM
3499
3500You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3501If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3502previous run of Configure, you may specify it as well as or instead of
3503OS-specific hints. If hints are provided for your OS, you should use them:
3504although Perl can probably be built without hints on many platforms, using
3505hints often improve performance and may enable features that Configure can't
3506set up on its own. If there are no hints that match your OS, specify "none";
3507DO NOT give a wrong version or a wrong OS.
2304df62
AD
3508
3509EOM
4e2a5f63 3510
2304df62 3511 rp="Which of these apply, if any?"
dfe9444c 3512 . UU/myread
85e6fe83
LW
3513 tans=$ans
3514 for file in $tans; do
4e2a5f63
AD
3515 if $test X$file = XPolicy -a -f Policy.sh; then
3516 . Policy.sh
3517 $cat Policy.sh >> UU/config.sh
3518 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3519 . $src/hints/$file.sh
3520 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3521 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3522 : nothing
3523 else
85e6fe83
LW
3524 : Give one chance to correct a possible typo.
3525 echo "$file.sh does not exist"
3526 dflt=$file
3527 rp="hint to use instead?"
dfe9444c 3528 . UU/myread
85e6fe83 3529 for file in $ans; do
dfe9444c
AD
3530 if $test -f "$src/hints/$file.sh"; then
3531 . $src/hints/$file.sh
3532 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3533 elif $test X$ans = X -o X$ans = Xnone ; then
3534 : nothing
3535 else
3536 echo "$file.sh does not exist -- ignored."
3537 fi
3538 done
2304df62
AD
3539 fi
3540 done
85e6fe83 3541
2304df62 3542 hint=recommended
85e6fe83 3543 : Remember our hint file for later.
dfe9444c 3544 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3545 hintfile="$file"
85e6fe83 3546 else
a0d0e21e 3547 hintfile=''
85e6fe83 3548 fi
2304df62
AD
3549fi
3550cd UU
3551;;
3552*)
3553 echo " "
3554 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3555 tmp_n="$n"
3556 tmp_c="$c"
2304df62
AD
3557 cd ..
3558 cp $config_sh config.sh 2>/dev/null
a78b0d02 3559 chmod +w config.sh
2304df62
AD
3560 . ./config.sh
3561 cd UU
3562 cp ../config.sh .
ecfc5424
AD
3563 n="$tmp_n"
3564 c="$tmp_c"
2304df62
AD
3565 hint=previous
3566 ;;
3567esac
1aef975c 3568test "$override" && . ./optdef.sh
2304df62
AD
3569
3570: Restore computed paths
3571for file in $loclist $trylist; do
3572 eval $file="\$_$file"
3573done
3574
85e6fe83 3575cat << EOM
a0d0e21e 3576
85e6fe83 3577Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3578The default value is probably right if the name rings a bell. Otherwise,
3579since spelling matters for me, either accept the default or answer "none"
3580to leave it blank.
a0d0e21e 3581
85e6fe83 3582EOM
85e6fe83 3583case "$osname" in
a0d0e21e 3584 ''|' ')
85e6fe83 3585 case "$hintfile" in
a0d0e21e 3586 ''|' '|none) dflt=none ;;
ecfc5424 3587 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3588 esac
3589 ;;
3590 *) dflt="$osname" ;;
3591esac
3592rp="Operating system name?"
3593. ./myread
3594case "$ans" in
ecfc5424
AD
3595none) osname='' ;;
3596*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3597esac
8ff267be 3598echo " "
3599case "$osvers" in
3600 ''|' ')
3601 case "$hintfile" in
3602 ''|' '|none) dflt=none ;;
3603 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3604 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3605 case "$dflt" in
3606 ''|' ') dflt=none ;;
3607 esac
3608 ;;
3609 esac
3610 ;;
3611 *) dflt="$osvers" ;;
3612esac
3613rp="Operating system version?"
3614. ./myread
3615case "$ans" in
3616none) osvers='' ;;
3617*) osvers="$ans" ;;
3618esac
3619
02e93a22
JH
3620
3621. ./posthint.sh
3622
2304df62 3623: who configured the system
59b83a6f 3624cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3625case "$cf_by" in
3626"")
7c04078e 3627 cf_by=`(logname) 2>/dev/null`
dfe9444c 3628 case "$cf_by" in
7c04078e
GA
3629 "")
3630 cf_by=`(whoami) 2>/dev/null`
3631 case "$cf_by" in
3632 "") cf_by=unknown ;;
3633 esac ;;
8ff267be 3634 esac ;;
3635esac
2304df62 3636
f3f1a2d8
MB
3637: decide how portable to be. Allow command line overrides.
3638case "$d_portable" in
3639"$undef") ;;
3640*) d_portable="$define" ;;
b4eb6b3d 3641esac
b4eb6b3d 3642
f3f1a2d8
MB
3643: set up shell script to do ~ expansion
3644cat >filexp <<EOSS
3645$startsh
3646: expand filename
3647case "\$1" in
f16e9d76 3648 \~/*|\~)
f3f1a2d8
MB
3649 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3650 ;;
4137585d 3651 \~*)
f3f1a2d8
MB
3652 if $test -f /bin/csh; then
3653 /bin/csh -f -c "glob \$1"
3654 failed=\$?
3655 echo ""
3656 exit \$failed
3657 else
3658 name=\`$expr x\$1 : '..\([^/]*\)'\`
3659 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3660 if $test ! -d "\$dir"; then
3661 me=\`basename \$0\`
3662 echo "\$me: can't locate home directory for: \$name" >&2
3663 exit 1
3664 fi
3665 case "\$1" in
3666 */*)
3667 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3668 ;;
3669 *)
3670 echo \$dir
3671 ;;
3672 esac
3673 fi
3674 ;;
3675*)
3676 echo \$1
3677 ;;
b29b105d 3678esac
f3f1a2d8
MB
3679EOSS
3680chmod +x filexp
3681$eunicefix filexp
b29b105d 3682
f3f1a2d8
MB
3683: now set up to get a file name
3684cat <<EOS >getfile
3685$startsh
3686EOS
3687cat <<'EOSC' >>getfile
3688tilde=''
3689fullpath=''
3690already=''
3691skip=''
3692none_ok=''
3693exp_file=''
3694nopath_ok=''
3695orig_rp="$rp"
3696orig_dflt="$dflt"
3697case "$gfpth" in
3698'') gfpth='.' ;;
b29b105d 3699esac
b29b105d 3700
f3f1a2d8
MB
3701case "$fn" in
3702*\(*)
3703 : getfile will accept an answer from the comma-separated list
3704 : enclosed in parentheses even if it does not meet other criteria.
3705 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3706 fn=`echo $fn | sed 's/(.*)//'`
3707 ;;
b29b105d
JH
3708esac
3709
f3f1a2d8
MB
3710case "$fn" in
3711*:*)
3712 loc_file=`expr $fn : '.*:\(.*\)'`
3713 fn=`expr $fn : '\(.*\):.*'`
3714 ;;
b29b105d 3715esac
b29b105d 3716
f3f1a2d8
MB
3717case "$fn" in
3718*~*) tilde=true;;
3719esac
3720case "$fn" in
3721*/*) fullpath=true;;
3722esac
3723case "$fn" in
3724*+*) skip=true;;
3725esac
3726case "$fn" in
3727*n*) none_ok=true;;
3728esac
3729case "$fn" in
3730*e*) exp_file=true;;
3731esac
3732case "$fn" in
3733*p*) nopath_ok=true;;
b29b105d 3734esac
b29b105d 3735
f3f1a2d8
MB
3736case "$fn" in
3737*f*) type='File';;
3738*d*) type='Directory';;
3739*l*) type='Locate';;
3740esac
b29b105d 3741
f3f1a2d8
MB
3742what="$type"
3743case "$what" in
3744Locate) what='File';;
3745esac
b29b105d 3746
f3f1a2d8
MB
3747case "$exp_file" in
3748'')
3749 case "$d_portable" in
3750 "$define") ;;
3751 *) exp_file=true;;
b29b105d
JH
3752 esac
3753 ;;
3754esac
3755
f3f1a2d8
MB
3756cd ..
3757while test "$type"; do
3758 redo=''
3759 rp="$orig_rp"
3760 dflt="$orig_dflt"
3761 case "$tilde" in
3762 true) rp="$rp (~name ok)";;
3763 esac
3764 . UU/myread
3765 if test -f UU/getfile.ok && \
3766 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3767 then
3768 value="$ans"
3769 ansexp="$ans"
3770 break
3771 fi
3772 case "$ans" in
3773 none)
3774 value=''
3775 ansexp=''
3776 case "$none_ok" in
3777 true) type='';;
b29b105d
JH
3778 esac
3779 ;;
f3f1a2d8
MB
3780 *)
3781 case "$tilde" in
3782 '') value="$ans"
3783 ansexp="$ans";;
3784 *)
3785 value=`UU/filexp $ans`
3786 case $? in
3787 0)
3788 if test "$ans" != "$value"; then
3789 echo "(That expands to $value on this system.)"
3790 fi
3791 ;;
3792 *) value="$ans";;
3793 esac
3794 ansexp="$value"
3795 case "$exp_file" in
3796 '') value="$ans";;
3797 esac
3798 ;;
3799 esac
3800 case "$fullpath" in
3801 true)
3802 case "$ansexp" in
3803 /*) value="$ansexp" ;;
3804 [a-zA-Z]:/*) value="$ansexp" ;;
3805 *)
3806 redo=true
3807 case "$already" in
3808 true)
3809 echo "I shall only accept a full path name, as in /bin/ls." >&4
3810 echo "Use a ! shell escape if you wish to check pathnames." >&4
3811 ;;
3812 *)
3813 echo "Please give a full path name, starting with slash." >&4
3814 case "$tilde" in
3815 true)
3816 echo "Note that using ~name is ok provided it expands well." >&4
3817 already=true
3818 ;;
3819 esac
3820 esac
3821 ;;
3822 esac
3823 ;;
3824 esac
3825 case "$redo" in
3826 '')
3827 case "$type" in
3828 File)
3829 for fp in $gfpth; do
3830 if test "X$fp" = X.; then
3831 pf="$ansexp"
3832 else
3833 pf="$fp/$ansexp"
3834 fi
3835 if test -f "$pf"; then
3836 type=''
3837 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3838 then
3839 echo "($value is not a plain file, but that's ok.)"
3840 type=''
3841 fi
3842 if test X"$type" = X; then
3843 value="$pf"
3844 break
3845 fi
3846 done
3847 ;;
3848 Directory)
3849 for fp in $gfpth; do
3850 if test "X$fp" = X.; then
3851 dir="$ans"
3852 direxp="$ansexp"
3853 else
3854 dir="$fp/$ansexp"
3855 direxp="$fp/$ansexp"
3856 fi
3857 if test -d "$direxp"; then
3858 type=''
3859 value="$dir"
3860 break
3861 fi
3862 done
3863 ;;
3864 Locate)
3865 if test -d "$ansexp"; then
3866 echo "(Looking for $loc_file in directory $value.)"
3867 value="$value/$loc_file"
3868 ansexp="$ansexp/$loc_file"
3869 fi
3870 if test -f "$ansexp"; then
3871 type=''
3872 fi
3873 case "$nopath_ok" in
3874 true) case "$value" in
3875 */*) ;;
3876 *) echo "Assuming $value will be in people's path."
3877 type=''
3878 ;;
3879 esac
3880 ;;
3881 esac
3882 ;;
3883 esac
b4eb6b3d 3884
f3f1a2d8
MB
3885 case "$skip" in
3886 true) type='';
3887 esac
3888
3889 case "$type" in
3890 '') ;;
3891 *)
3892 if test "$fastread" = yes; then
3893 dflt=y
3894 else
3895 dflt=n
3896 fi
3897 rp="$what $value doesn't exist. Use that name anyway?"
3898 . UU/myread
3899 dflt=''
3900 case "$ans" in
3901 y*) type='';;
3902 *) echo " ";;
3903 esac
3904 ;;
3905 esac
3906 ;;
3907 esac
3908 ;;
b4eb6b3d 3909 esac
f3f1a2d8
MB
3910done
3911cd UU
3912ans="$value"
3913rp="$orig_rp"
3914dflt="$orig_dflt"
3915rm -f getfile.ok
3916test "X$gfpthkeep" != Xy && gfpth=""
3917EOSC
3918
3919: determine root of directory hierarchy where package will be installed.
3920case "$prefix" in
3921'')
3922 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3923 ;;
3924*?/)
3925 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3926 ;;
3927*)
f3f1a2d8 3928 dflt="$prefix"
b4eb6b3d
JH
3929 ;;
3930esac
f3f1a2d8 3931$cat <<EOM
b4eb6b3d 3932
f3f1a2d8
MB
3933By default, $package will be installed in $dflt/bin, manual pages
3934under $dflt/man, etc..., i.e. with $dflt as prefix for all
3935installation directories. Typically this is something like /usr/local.
3936If you wish to have binaries under /usr/bin but other parts of the
3937installation under /usr/local, that's ok: you will be prompted
3938separately for each of the installation directories, the prefix being
3939only used to set the defaults.
c915ce7f
JH
3940
3941EOM
f3f1a2d8
MB
3942fn=d~
3943rp='Installation prefix to use?'
3944. ./getfile
3945oldprefix=''
3946case "$prefix" in
3947'') ;;
3948*)
3949 case "$ans" in
3950 "$prefix") ;;
3951 *) oldprefix="$prefix";;
3952 esac
c915ce7f
JH
3953 ;;
3954esac
f3f1a2d8
MB
3955prefix="$ans"
3956prefixexp="$ansexp"
c915ce7f 3957
776a38e3 3958: allow them to override the AFS root
f3f1a2d8
MB
3959case "$afsroot" in
3960'') afsroot=/afs ;;
3961*) afsroot=$afsroot ;;
b4eb6b3d 3962esac
b4eb6b3d 3963
776a38e3 3964: is AFS running?
f3f1a2d8
MB
3965echo " "
3966case "$afs" in
3967$define|true) afs=true ;;
3968$undef|false) afs=false ;;
776a38e3 3969*) if $test -d $afsroot; then
f3f1a2d8
MB
3970 afs=true
3971 else
3972 afs=false
3973 fi
b4eb6b3d 3974 ;;
f3f1a2d8
MB
3975esac
3976if $afs; then
3977 echo "AFS may be running... I'll be extra cautious then..." >&4
3978else
3979 echo "AFS does not seem to be running..." >&4
9da7673b 3980fi
b4eb6b3d 3981
f3f1a2d8
MB
3982: determine installation prefix for where package is to be installed.
3983if $afs; then
3984$cat <<EOM
3985
3986Since you are running AFS, I need to distinguish the directory in which
3987files will reside from the directory in which they are installed (and from
3988which they are presumably copied to the former directory by occult means).
b4eb6b3d 3989
b4eb6b3d 3990EOM
f3f1a2d8
MB
3991 case "$installprefix" in
3992 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3993 *) dflt="$installprefix";;
3994 esac
3995else
3996$cat <<EOM
b4eb6b3d 3997
f3f1a2d8
MB
3998In some special cases, particularly when building $package for distribution,
3999it is convenient to distinguish the directory in which files should be
4000installed from the directory ($prefix) in which they will
4001eventually reside. For most users, these two directories are the same.
4002
4003EOM
4004 case "$installprefix" in
4005 '') dflt=$prefix ;;
4006 *) dflt=$installprefix;;
4007 esac
4008fi
4009fn=d~
4010rp='What installation prefix should I use for installing files?'
4011. ./getfile
4012installprefix="$ans"
4013installprefixexp="$ansexp"
4014
4015: Perform the prefixexp/installprefixexp correction if necessary
4016cat <<EOS >installprefix
4017$startsh
4018EOS
4019cat <<'EOSC' >>installprefix
4020: Change installation prefix, if necessary.
4021if $test X"$prefix" != X"$installprefix"; then
4022 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4023else
4024 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4025fi
4026EOSC
4027chmod +x installprefix
4028$eunicefix installprefix
4029
4030: Set variables such as privlib and privlibexp from the output of ./getfile
4031: performing the prefixexp/installprefixexp correction if necessary.
4032cat <<EOS >setprefixvar
4033$startsh
4034EOS
4035cat <<'EOSC' >>setprefixvar
4036eval "${prefixvar}=\"\$ans\""
4037eval "${prefixvar}exp=\"\$ansexp\""
4038. ./installprefix
4039EOSC
4040chmod +x setprefixvar
4041$eunicefix setprefixvar
4042
4043: set up the script used to warn in case of inconsistency
4044cat <<EOS >whoa
4045$startsh
4046EOS
4047cat <<'EOSC' >>whoa
4048dflt=y
dcb594bc
MB
4049case "$hint" in
4050 recommended)
4051 case "$hintfile" in
4052 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4053 ;;
4054 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4055 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4056 ;;
4057 esac
4058 ;;
4059 *) echo " "
4060 echo "*** WHOA THERE!!! ***" >&4
4061 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4062 ;;
4063esac
f3f1a2d8
MB
4064rp=" Keep the $hint value?"
4065. ./myread
4066case "$ans" in
4067y) td=$was; tu=$was;;
4068esac
4069EOSC
4070
216dac04 4071: function used to set '$1' to '$val'
f3f1a2d8
MB
4072setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4073case "$val$was" in
4074$define$undef) . ./whoa; eval "$var=\$td";;
4075$undef$define) . ./whoa; eval "$var=\$tu";;
4076*) eval "$var=$val";;
4077esac'
4078
5c40187f
MB
4079: get the patchlevel
4080echo " "
4081echo "Getting the current patchlevel..." >&4
4082if $test -r $rsrc/patchlevel.h;then
4083 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4084 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4085 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4086 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4087 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4088 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4089 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4090else
4091 revision=0
4092 patchlevel=0
4093 subversion=0
4094 api_revision=0
4095 api_version=0
4096 api_subversion=0
4097 perl_patchlevel=0
4098 $echo "(You do not have patchlevel.h. Eek.)"
4099fi
5c40187f
MB
4100: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4101version_patchlevel_string="version $patchlevel subversion $subversion"
4102case "$perl_patchlevel" in
41030|'') ;;
0f04e85f
MB
4104*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4105 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4106 ;;
5c40187f
MB
4107esac
4108
4109$echo "(You have $package $version_patchlevel_string.)"
4110
4111case "$osname" in
4112dos|vms)
4113 : XXX Should be a Configure test for double-dots in filenames.
4114 version=`echo $revision $patchlevel $subversion | \
4115 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4116 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4117 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4118 ;;
4119*)
4120 version=`echo $revision $patchlevel $subversion | \
4121 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4122 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4123 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4124 ;;
4125esac
4126: Special case the 5.005_xx maintenance series, which used 5.005
4127: without any subversion label as a subdirectory in $sitelib
4128if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4129 api_versionstring='5.005'
4130fi
4131
613d6c3e 4132: Do we want threads support and if so, what type
f3f1a2d8
MB
4133case "$usethreads" in
4134$define|true|[yY]*) dflt='y';;
4135*) # Catch case where user specified ithreads or 5005threads but
4136 # forgot -Dusethreads (A.D. 4/2002)
4137 case "$useithreads$use5005threads" in
dd35fa16
MB
4138 *$define*) dflt='y';;
4139 *) dflt='n';;
f3f1a2d8
MB
4140 esac
4141 ;;
4142esac
4143cat <<EOM
4144
4145Perl can be built to take advantage of threads on some systems.
4146To do so, Configure can be run with -Dusethreads.
4147
4148Note that Perl built with threading support runs slightly slower
4149and uses more memory than plain Perl. The current implementation
4150is believed to be stable, but it is fairly new, and so should be
4151treated with caution.
4152
4153If this doesn't make any sense to you, just accept the default '$dflt'.
4154EOM
4155rp='Build a threading Perl?'
4156. ./myread
4157case "$ans" in
4158y|Y) val="$define" ;;
4159*) val="$undef" ;;
4160esac
4161set usethreads
4162eval $setvar
4163
5c40187f
MB
4164if $test $patchlevel -lt 9; then
4165 case "$usethreads" in
4166 $define)
f3f1a2d8
MB
4167 $cat <<EOM
4168
4169Since release 5.6, Perl has had two different threading implementations,
4170the newer interpreter-based version (ithreads) with one interpreter per
4171thread, and the older 5.005 version (5005threads).
4172The 5005threads version is effectively unmaintained and will probably be
4173removed in Perl 5.10, so there should be no need to build a Perl using it
4174unless needed for backwards compatibility with some existing 5.005threads
4175code.
4176
4177EOM
4178 : Default to ithreads unless overridden on command line or with
4179 : old config.sh
4180 dflt='y'
4181 case "$use5005threads" in
4182 $define|true|[yY]*) dflt='n';;
4183 esac
4184 case "$useithreads" in
4185 $undef|false|[nN]*) dflt='n';;
4186 esac
4187 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4188 . ./myread
4189 case "$ans" in
f3f1a2d8 4190 y|Y) val="$define" ;;
b4eb6b3d
JH
4191 *) val="$undef" ;;
4192 esac
f3f1a2d8
MB
4193 set useithreads
4194 eval $setvar
4195 : Now set use5005threads to the opposite value.
4196 case "$useithreads" in
4197 $define) val="$undef" ;;
4198 *) val="$define" ;;
4199 esac
4200 set use5005threads
4201 eval $setvar
4202 ;;
5c40187f 4203 *)
f3f1a2d8
MB
4204 useithreads="$undef"
4205 use5005threads="$undef"
b4eb6b3d 4206 ;;
5c40187f 4207 esac
b4eb6b3d 4208
5c40187f
MB
4209 case "$useithreads$use5005threads" in
4210 "$define$define")
f3f1a2d8 4211 $cat >&4 <<EOM
96056487 4212
f3f1a2d8
MB
4213You cannot have both the ithreads and the 5.005 threads enabled
4214at the same time. Disabling the 5.005 threads since they are
4215much less stable than the ithreads.
4216
4217EOM
4218 use5005threads="$undef"
96056487 4219 ;;
5c40187f
MB
4220 esac
4221
4222else
4223: perl-5.9.x and later
4224
47f9f84c 4225 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4226 case "$use5005threads" in
4227 $define|true|[yY]*)
4228 $cat >&4 <<EOM
47f9f84c
JH
4229
42305.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4231
47f9f84c 4232EOM
3f30fabf
MB
4233 ;;
4234 esac
47f9f84c 4235 fi
3f30fabf 4236
47f9f84c
JH
4237 use5005threads="$undef"
4238 useithreads="$usethreads"
5c40187f 4239fi
96056487 4240
f3f1a2d8
MB
4241case "$d_oldpthreads" in
4242'') : Configure tests would be welcome here. For now, assume undef.
4243 val="$undef" ;;
4244*) val="$d_oldpthreads" ;;
4245esac
4246set d_oldpthreads
4247eval $setvar
4248
4249
4250: Look for a hint-file generated 'call-back-unit'. If the
4251: user has specified that a threading perl is to be built,
4252: we may need to set or change some other defaults.
4253if $test -f usethreads.cbu; then
4254 echo "Your platform has some specific hints regarding threaded builds, using them..."
4255 . ./usethreads.cbu
4256else
4257 case "$usethreads" in
4258 "$define"|true|[yY]*)
4259 $cat <<EOM
4260(Your platform does not have any specific hints for threaded builds.
4261 Assuming POSIX threads, then.)
4262EOM
4263 ;;
4264 esac
4265fi
4266
34f1896b 4267: Check if multiplicity is required
f3f1a2d8
MB
4268cat <<EOM
4269
4270Perl can be built so that multiple Perl interpreters can coexist
4271within the same Perl executable.
4272EOM
4273
4274case "$useithreads" in
4275$define)
4276 cat <<EOM
4277This multiple interpreter support is required for interpreter-based threads.
4278EOM
4279 val="$define"
4280 ;;
4281*) case "$usemultiplicity" in
4282 $define|true|[yY]*) dflt='y';;
4283 *) dflt='n';;
4284 esac
4285 echo " "
4286 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4287 rp='Build Perl for multiplicity?'
4288 . ./myread
4289 case "$ans" in
4290 y|Y) val="$define" ;;
4291 *) val="$undef" ;;
4292 esac
4293 ;;
4294esac
4295set usemultiplicity
4296eval $setvar
4297
34f1896b 4298: Check if morebits is requested
f3f1a2d8
MB
4299case "$usemorebits" in
4300"$define"|true|[yY]*)
4301 use64bitint="$define"
4302 uselongdouble="$define"
4303 usemorebits="$define"
4304 ;;
4305*) usemorebits="$undef"
4306 ;;
4307esac
4308
776a38e3
MB
4309: Determine the C compiler to be used
4310echo " "
4311case "$cc" in
4312'') dflt=cc;;
4313*) dflt="$cc";;
4314esac
4315rp="Use which C compiler?"
4316. ./myread
4317cc="$ans"
4318
4319: See whether they have no cc but they do have gcc
4320. ./trygcc
4321if $test -f cc.cbu; then
4322 . ./cc.cbu
4323fi
4324. ./checkcc
4325
f3f1a2d8
MB
4326: make some quick guesses about what we are up against
4327echo " "
4328$echo $n "Hmm... $c"
4329echo exit 1 >bsd
4330echo exit 1 >usg
4331echo exit 1 >v7
4332echo exit 1 >osf1
4333echo exit 1 >eunice
4334echo exit 1 >xenix
4335echo exit 1 >venix
4336echo exit 1 >os2
4337d_bsd="$undef"
4338$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4339if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4340then
4341 echo "Looks kind of like an OSF/1 system, but we'll see..."
4342 echo exit 0 >osf1
381aa1ff 4343elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4344 xxx=`./loc addbib blurfl $pth`
4345 if $test -f $xxx; then
4346 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4347 echo exit 0 >bsd
4348 echo exit 0 >usg
4349 else
4350 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4351 echo "Looks kind of like an extended USG system, but we'll see..."
4352 else
4353 echo "Looks kind of like a USG system, but we'll see..."
4354 fi
4355 echo exit 0 >usg
4356 fi
4357elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4358 echo "Looks kind of like a BSD system, but we'll see..."
4359 d_bsd="$define"
4360 echo exit 0 >bsd
4361else
4362 echo "Looks kind of like a Version 7 system, but we'll see..."
4363 echo exit 0 >v7
4364fi
4365case "$eunicefix" in
4366*unixtovms*)
4367 $cat <<'EOI'
4368There is, however, a strange, musty smell in the air that reminds me of
4369something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4370EOI
4371 echo exit 0 >eunice
4372 d_eunice="$define"
4373: it so happens the Eunice I know will not run shell scripts in Unix format
4374 ;;
4375*)
4376 echo " "
4377 echo "Congratulations. You aren't running Eunice."
4378 d_eunice="$undef"
4379 ;;
4380esac
4381: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4382: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4383: semicolon as a patch separator
e5e20432
JH
4384case "$p_" in
4385:) ;;
4386*)
4387 $cat <<'EOI'
4388I have the feeling something is not exactly right, however...don't tell me...
4389lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4390(Or you may be running DOS with DJGPP.)
e5e20432
JH
4391EOI
4392 echo exit 0 >os2
4393 ;;
4394esac
4395if test -f /xenix; then
4396 echo "Actually, this looks more like a XENIX system..."
4397 echo exit 0 >xenix
4398 d_xenix="$define"
4399else
4400 echo " "
4401 echo "It's not Xenix..."
4402 d_xenix="$undef"
4403fi
4404chmod +x xenix
4405$eunicefix xenix
4406if test -f /venix; then
4407 echo "Actually, this looks more like a VENIX system..."
4408 echo exit 0 >venix
4409else
4410 echo " "
4411 if ./xenix; then
4412 : null
4413 else
4414 echo "Nor is it Venix..."
4415 fi
4416fi
4417chmod +x bsd usg v7 osf1 eunice xenix venix os2
4418$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4419$rm -f foo
4420
613d6c3e 4421: Check if we are using GNU gcc and what its version is
e5e20432
JH
4422echo " "
4423echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4424$cat >try.c <<EOM
e5e20432
JH
4425#include <stdio.h>
4426int main() {
7686528e 4427#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4428#ifdef __VERSION__
4429 printf("%s\n", __VERSION__);
4430#else
4431 printf("%s\n", "1");
4432#endif
4433#endif
073b6de5 4434 return(0);
e5e20432
JH
4435}
4436EOM
5440bc8e
JH
4437if $cc -o try $ccflags $ldflags try.c; then
4438 gccversion=`$run ./try`
f3f1a2d8
MB
4439 case "$gccversion" in
4440 '') echo "You are not using GNU cc." ;;
4441 *) echo "You are using GNU cc $gccversion."
4442 ccname=gcc
4443 ;;
4444 esac
4445else
4446 echo " "
4447 echo "*** WHOA THERE!!! ***" >&4
4448 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4449 case "$knowitall" in
4450 '')
4451 echo " You'd better start hunting for one and let me know about it." >&4
4452 exit 1
2304df62
AD
4453 ;;
4454 esac
f3f1a2d8
MB
4455fi
4456$rm -f try try.*
4457case "$gccversion" in
44581*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4459esac
4460case "$gccversion" in
4461'') gccosandvers='' ;;
4462*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4463 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4464 gccshortvers=''
4465 case "$gccosandvers" in
4466 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4467 $osname$osvers) ;; # looking good
4468 $osname*) cat <<EOM >&4
4469
4470*** WHOA THERE!!! ***
4471
4472 Your gcc has not been compiled for the exact release of
4473 your operating system ($gccosandvers versus $osname$osvers).
4474
4475 In general it is a good idea to keep gcc synchronized with
4476 the operating system because otherwise serious problems
4477 may ensue when trying to compile software, like Perl.
4478
4479 I'm trying to be optimistic here, though, and will continue.
4480 If later during the configuration and build icky compilation
4481 problems appear (headerfile conflicts being the most common
4482 manifestation), I suggest reinstalling the gcc to match
4483 your operating system release.
4484
4485EOM
4486 ;;
4487 *) gccosandvers='' ;; # failed to parse, better be silent
4488 esac
4489 ;;
4490esac
4491case "$ccname" in
4492'') ccname="$cc" ;;
4493esac
4494
4495# gcc 3.* complain about adding -Idirectories that they already know about,
4496# so we will take those off from locincpth.
4497case "$gccversion" in
44983*)
4499 echo "main(){}">try.c
4500 for incdir in $locincpth; do
4501 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4502 grep '^c[cp]p*[01]: warning: changing search order '`
4503 if test "X$warn" != X; then
4504 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4505 fi
4506 done
4507 $rm -f try try.*
4508esac
2304df62 4509
bd9b35c9
JH
4510: What should the include directory be ?
4511echo " "
4512$echo $n "Hmm... $c"
4513dflt='/usr/include'
4514incpath=''
4515mips_type=''
4516if $test -f /bin/mips && /bin/mips; then
4517 echo "Looks like a MIPS system..."
4518 $cat >usr.c <<'EOCP'
4519#ifdef SYSTYPE_BSD43
4520/bsd43
4521#endif
4522EOCP
8a27cf78 4523 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4524 dflt='/bsd43/usr/include'
4525 incpath='/bsd43'
4526 mips_type='BSD 4.3'
4527 else
4528 mips_type='System V'
4529 fi
4530 $rm -f usr.c usr.out
4531 echo "and you're compiling with the $mips_type compiler and libraries."
4532 xxx_prompt=y
4533 echo "exit 0" >mips
4534else
4535 echo "Doesn't look like a MIPS system."
4536 xxx_prompt=n
4537 echo "exit 1" >mips
4538fi
4539chmod +x mips
4540$eunicefix mips
4541case "$usrinc" in
4542'') ;;
4543*) dflt="$usrinc";;
4544esac
4545case "$xxx_prompt" in
4546y) fn=d/
4547 echo " "
4548 rp='Where are the include files you want to use?'
4549 . ./getfile
4550 usrinc="$ans"
8e07c86e 4551 ;;
bd9b35c9 4552*) usrinc="$dflt"
8e07c86e
AD
4553 ;;
4554esac
2304df62 4555
96056487
JH
4556: see how we invoke the C preprocessor
4557echo " "
4558echo "Now, how can we feed standard input to your C preprocessor..." >&4
4559cat <<'EOT' >testcpp.c
4560#define ABC abc
4561#define XYZ xyz
4562ABC.XYZ
4563EOT
4564cd ..
4565if test ! -f cppstdin; then
4566 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4567 # AIX cc -E doesn't show the absolute headerfile
4568 # locations but we'll cheat by using the -M flag.
4569 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4570 else
4571 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4572 fi
4573else
4574 echo "Keeping your $hint cppstdin wrapper."
4575fi
4576chmod 755 cppstdin
4577wrapper=`pwd`/cppstdin
4578ok='false'
4579cd UU
4580
4581if $test "X$cppstdin" != "X" && \
4582 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4583 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4584then
4585 echo "You used to use $cppstdin $cppminus so we'll use that again."
4586 case "$cpprun" in
4587 '') echo "But let's see if we can live without a wrapper..." ;;
4588 *)
4589 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4590 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4591 then
4592 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4593 ok='true'
4594 else
4595 echo "(However, $cpprun $cpplast does not work, let's see...)"
4596 fi
4597 ;;
4598 esac
4599else
4600 case "$cppstdin" in
4601 '') ;;
4602 *)
4603 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4604 ;;
4605 esac
4606fi
4607
4608if $ok; then
4609 : nothing
4610elif echo 'Maybe "'"$cc"' -E" will work...'; \
4611 $cc -E <testcpp.c >testcpp.out 2>&1; \
4612 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4613 echo "Yup, it does."
4614 x_cpp="$cc -E"
4615 x_minus='';
4616elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4617 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4618 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4619 echo "Yup, it does."
4620 x_cpp="$cc -E"
4621 x_minus='-';
4622elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4623 $cc -P <testcpp.c >testcpp.out 2>&1; \
4624 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4625 echo "Yipee, that works!"
4626 x_cpp="$cc -P"
4627 x_minus='';
4628elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4629 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4630 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4631 echo "At long last!"
4632 x_cpp="$cc -P"
4633 x_minus='-';
4634elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4635 $cpp <testcpp.c >testcpp.out 2>&1; \
4636 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4637 echo "It works!"
4638 x_cpp="$cpp"
4639 x_minus='';
4640elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4641 $cpp - <testcpp.c >testcpp.out 2>&1; \
4642 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4643 echo "Hooray, it works! I was beginning to wonder."
4644 x_cpp="$cpp"
4645 x_minus='-';
4646elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4647 $wrapper <testcpp.c >testcpp.out 2>&1; \
4648 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4649 x_cpp="$wrapper"
4650 x_minus=''
4651 echo "Eureka!"
4652else
4653 dflt=''
4654 rp="No dice. I can't find a C preprocessor. Name one:"
4655 . ./myread
4656 x_cpp="$ans"
4657 x_minus=''
4658 $x_cpp <testcpp.c >testcpp.out 2>&1
4659 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4660 echo "OK, that will do." >&4
4661 else
4662echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4663 exit 1
4664 fi
4665fi
4666
4667case "$ok" in
4668false)
4669 cppstdin="$x_cpp"
4670 cppminus="$x_minus"
4671 cpprun="$x_cpp"
4672 cpplast="$x_minus"
4673 set X $x_cpp
4674 shift
4675 case "$1" in
4676 "$cpp")
4677 echo "Perhaps can we force $cc -E using a wrapper..."
4678 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4679 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4680 then
4681 echo "Yup, we can."
4682 cppstdin="$wrapper"
4683 cppminus='';
4684 else
4685 echo "Nope, we'll have to live without it..."
4686 fi
4687 ;;
4688 esac
4689 case "$cpprun" in
4690 "$wrapper")
4691 cpprun=''
4692 cpplast=''
4693 ;;
4694 esac
4695 ;;
4696esac
4697
4698case "$cppstdin" in
4699"$wrapper"|'cppstdin') ;;
4700*) $rm -f $wrapper;;
4701esac
4702$rm -f testcpp.c testcpp.out
4703
bd9b35c9
JH
4704: Set private lib path
4705case "$plibpth" in
4706'') if ./mips; then
4707 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4708 fi;;
4709esac
4710case "$libpth" in
4711' ') dlist='';;
4712'') dlist="$loclibpth $plibpth $glibpth";;
4713*) dlist="$libpth";;
4714esac
4715
4716: Now check and see which directories actually exist, avoiding duplicates
4717libpth=''
4718for xxx in $dlist
4719do
4720 if $test -d $xxx; then
4721 case " $libpth " in
4722 *" $xxx "*) ;;
4723 *) libpth="$libpth $xxx";;
4724 esac
4725 fi
4726done
4727$cat <<'EOM'
4728
4729Some systems have incompatible or broken versions of libraries. Among
4730the directories listed in the question below, please remove any you
4731know not to be holding relevant libraries, and add any that are needed.
4732Say "none" for none.
8e07c86e
AD
4733
4734EOM
bd9b35c9
JH
4735case "$libpth" in
4736'') dflt='none';;
8e07c86e 4737*)
bd9b35c9
JH
4738 set X $libpth
4739 shift
4740 dflt=${1+"$@"}
8e07c86e 4741 ;;
a0d0e21e 4742esac
bd9b35c9
JH
4743rp="Directories to use for library searches?"
4744. ./myread
4745case "$ans" in
4746none) libpth=' ';;
4747*) libpth="$ans";;
4748esac
a0d0e21e 4749
bd9b35c9
JH
4750: compute shared library extension
4751case "$so" in
4752'')
4753 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4754 dflt='sl'
dd4e71fd 4755 else
bd9b35c9 4756 dflt='so'
dd4e71fd
JH
4757 fi
4758 ;;
bd9b35c9 4759*) dflt="$so";;
dd4e71fd 4760esac
dd4e71fd
JH
4761$cat <<EOM
4762
bd9b35c9 4763On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4764you want to suppress searching of shared libraries for the remainder
bd9b35c9 4765of this configuration.
dd4e71fd
JH
4766
4767EOM
bd9b35c9
JH
4768rp='What is the file extension used for shared libraries?'
4769. ./myread
4770so="$ans"
dd4e71fd 4771
bd9b35c9
JH
4772: Define several unixisms.
4773: Hints files or command line option can be used to override them.
4774: The convoluted testing is in case hints files set either the old
4775: or the new name.
4776case "$_exe" in
4777'') case "$exe_ext" in
1fef16b3 4778 '') ;;
bd9b35c9 4779 *) _exe="$exe_ext" ;;
dd4e71fd 4780 esac
bd9b35c9 4781 ;;
bfb7748a 4782esac
bd9b35c9
JH
4783case "$_a" in
4784'') case "$lib_ext" in
4785 '') _a='.a';;
4786 *) _a="$lib_ext" ;;
dd4e71fd
JH
4787 esac
4788 ;;
dd4e71fd 4789esac
bd9b35c9
JH
4790case "$_o" in
4791'') case "$obj_ext" in
4792 '') _o='.o';;
4793 *) _o="$obj_ext";;
4794 esac
4795 ;;
4796esac
4797case "$p_" in
4798'') case "$path_sep" in
4799 '') p_=':';;
4800 *) p_="$path_sep";;
4801 esac
4802 ;;
4803esac
4804exe_ext=$_exe
4805lib_ext=$_a
4806obj_ext=$_o
4807path_sep=$p_
dd4e71fd 4808
5b813a60
MB
4809rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4810
b4eb6b3d
JH
4811: Which makefile gets called first. This is used by make depend.
4812case "$firstmakefile" in
4813'') firstmakefile='makefile';;
4633a7c4 4814esac
4633a7c4 4815
dd35fa16
MB
4816: Check is we will use socks
4817case "$usesocks" in
4818$define|true|[yY]*) dflt='y';;
4819*) dflt='n';;
4820esac
4821cat <<EOM
4822
4823Perl can be built to use the SOCKS proxy protocol library. To do so,
4824Configure must be run with -Dusesocks. If you use SOCKS you also need
4825to use the PerlIO abstraction layer, this will be implicitly selected.
4826
4827If this doesn't make any sense to you, just accept the default '$dflt'.
4828EOM
4829rp='Build Perl for SOCKS?'
4830. ./myread
4831case "$ans" in
4832y|Y) val="$define" ;;
4833*) val="$undef" ;;
4834esac
4835set usesocks
4836eval $setvar
4837
34f1896b 4838: Check for uselongdouble support
1f603089
JH
4839case "$ccflags" in
4840*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4841esac
4842
4843case "$uselongdouble" in
4844$define|true|[yY]*) dflt='y';;
4845*) dflt='n';;
4846esac
4847cat <<EOM
4848
4849Perl can be built to take advantage of long doubles which
4850(if available) may give more accuracy and range for floating point numbers.
4851
4852If this doesn't make any sense to you, just accept the default '$dflt'.
4853EOM
4854rp='Try to use long doubles if available?'
4855. ./myread
4856case "$ans" in
4857y|Y) val="$define" ;;
4858*) val="$undef" ;;
4859esac
4860set uselongdouble
4861eval $setvar
4862
4863case "$uselongdouble" in
4864true|[yY]*) uselongdouble="$define" ;;
4865esac
4866
1f603089
JH
4867: Look for a hint-file generated 'call-back-unit'. If the
4868: user has specified that long doubles should be used,
4869: we may need to set or change some other defaults.
9da7673b
MB
4870if $test -f uselongdouble.cbu; then
4871 echo "Your platform has some specific hints regarding long doubles, using them..."
4872 . ./uselongdouble.cbu
4873else
4874 case "$uselongdouble" in
4875 $define)
1f603089 4876 $cat <<EOM
9da7673b 4877(Your platform does not have any specific hints for long doubles.)
1f603089 4878EOM
1f603089 4879 ;;
9da7673b
MB
4880 esac
4881fi
1f603089 4882
bd9b35c9
JH
4883: Looking for optional libraries
4884echo " "
4885echo "Checking for optional libraries..." >&4
4886case "$libs" in
4887' '|'') dflt='';;
4888*) dflt="$libs";;
4889esac
4890case "$libswanted" in
4891'') libswanted='c_s';;
4892esac
4893case "$usesocks" in
923fc586 4894"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4895esac
68435ea7
JH
4896libsfound=''
4897libsfiles=''
4898libsdirs=''
13b3f787
JH
4899libspath=''
4900for thisdir in $libpth $xlibpth; do
4901 test -d $thisdir && libspath="$libspath $thisdir"
4902done
bd9b35c9 4903for thislib in $libswanted; do
13b3f787 4904 for thisdir in $libspath; do
f7dd4e7f
JH
4905 xxx=''
4906 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4907 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4908 $test -f "$xxx" && eval $libscheck
4909 $test -f "$xxx" && libstyle=shared
4910 fi
4911 if test ! -f "$xxx"; then
4912 xxx=$thisdir/lib$thislib.$so
4913 $test -f "$xxx" && eval $libscheck
4914 $test -f "$xxx" && libstyle=shared
613d6c3e 4915 fi
f7dd4e7f
JH
4916 if test ! -f "$xxx"; then
4917 xxx=$thisdir/lib$thislib$_a
4918 $test -f "$xxx" && eval $libscheck
4919 $test -f "$xxx" && libstyle=static
4920 fi
4921 if test ! -f "$xxx"; then
4922 xxx=$thisdir/$thislib$_a
4923 $test -f "$xxx" && eval $libscheck
4924 $test -f "$xxx" && libstyle=static
4925 fi
4926 if test ! -f "$xxx"; then
4927 xxx=$thisdir/lib${thislib}_s$_a
4928 $test -f "$xxx" && eval $libscheck
4929 $test -f "$xxx" && libstyle=static
09ea5ba9 4930 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4931 fi
4932 if test ! -f "$xxx"; then
4933 xxx=$thisdir/Slib$thislib$_a
4934 $test -f "$xxx" && eval $libscheck
4935 $test -f "$xxx" && libstyle=static
4936 fi
4937 if $test -f "$xxx"; then
43999f95 4938 case "$libstyle" in
f7dd4e7f
JH
4939 shared) echo "Found -l$thislib (shared)." ;;
4940 static) echo "Found -l$thislib." ;;
4941 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4942 esac
bd9b35c9
JH
4943 case " $dflt " in
4944 *"-l$thislib "*);;
f7dd4e7f 4945 *) dflt="$dflt -l$thislib"
43999f95
JH
4946 libsfound="$libsfound $xxx"
4947 yyy=`basename $xxx`
4948 libsfiles="$libsfiles $yyy"
1e127011 4949 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4950 case " $libsdirs " in
4951 *" $yyy "*) ;;
4952 *) libsdirs="$libsdirs $yyy" ;;
4953 esac
4954 ;;
bd9b35c9 4955 esac
f7dd4e7f 4956 break
613d6c3e 4957 fi
f7dd4e7f
JH
4958 done
4959 if $test ! -f "$xxx"; then
4960 echo "No -l$thislib."
bd9b35c9
JH
4961 fi
4962done
4963set X $dflt
4964shift
4965dflt="$*"
4966case "$libs" in
4967'') dflt="$dflt";;
4968*) dflt="$libs";;
4969esac
4970case "$dflt" in
4971' '|'') dflt='none';;
4972esac
4633a7c4 4973
bd9b35c9 4974$cat <<EOM
4633a7c4 4975
bd9b35c9
JH
4976In order to compile $package on your machine, a number of libraries
4977are usually needed. Include any other special libraries here as well.
4978Say "none" for none. The default list is almost always right.
8e07c86e 4979EOM
8e07c86e 4980
bd9b35c9
JH
4981echo " "
4982rp="What libraries to use?"
4983. ./myread
4984case "$ans" in
4985none) libs=' ';;
4986*) libs="$ans";;
4987esac
d71b2b6b 4988
bd9b35c9
JH
4989: determine optimization, if desired, or use for debug flag also
4990case "$optimize" in
4991' '|$undef) dflt='none';;
4992'') dflt='-O';;
4993*) dflt="$optimize";;
4994esac
4995$cat <<EOH
d71b2b6b 4996
bd9b35c9
JH
4997By default, $package compiles with the -O flag to use the optimizer.
4998Alternately, you might want to use the symbolic debugger, which uses
4999the -g flag (on traditional Unix systems). Either flag can be
5000specified here. To use neither flag, specify the word "none".
d71b2b6b 5001
bd9b35c9
JH
5002EOH
5003rp="What optimizer/debugger flag should be used?"
5004. ./myread
5005optimize="$ans"
5006case "$optimize" in
5007'none') optimize=" ";;
5008esac
5009
eaf812ae
MB
5010: Check what DEBUGGING is required from the command line
5011: -DEBUGGING or -DDEBUGGING or
5012: -DEBUGGING=both = -g + -DDEBUGGING
5013: -DEBUGGING=-g or -Doptimize=-g = -g
5014: -DEBUGGING=none or -UDEBUGGING =
5015: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5016case "$EBUGGING" in
5017'') ;;
5018*) DEBUGGING=$EBUGGING ;;
5019esac
5020
5021case "$DEBUGGING" in
5a7c70d6 5022-g|both|$define)
eaf812ae
MB
5023 case "$optimize" in
5024 *-g*) ;;
5025 *) optimize="$optimize -g" ;;
5026 esac ;;
5027none|$undef)
5028 case "$optimize" in
5029 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5030 shift
5031 optimize="$*"
5032 ;;
5033 esac ;;
5034esac
5035
bd9b35c9 5036dflt=''
eaf812ae
MB
5037case "$DEBUGGING" in
5038both|$define) dflt='-DDEBUGGING'
5039esac
5040
c34316b3
NC
5041: argument order is deliberate, as the flag will start with - which set could
5042: think is an option
6682be1c 5043checkccflag='check=$1; flag=$2; callback=$3;
c34316b3
NC
5044echo " ";
5045echo "Checking if your compiler accepts $flag" 2>&1;
5046echo "int main(void) { return 0; }" > gcctest.c;
04b62921 5047if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
c34316b3 5048 echo "Yes, it does." 2>&1;
580e570e 5049 if $test -s gcctest.out ; then
04b62921
MB
5050 echo "But your platform does not like it:";
5051 cat gcctest.out;
5052 else
5053 case "$ccflags" in
5054 *$check*)
5055 echo "Leaving current flags $ccflags alone." 2>&1
5056 ;;
5057 *) dflt="$dflt $flag";
5058 eval $callback
5059 ;;
5060 esac
5061 fi
c34316b3
NC
5062else
5063 echo "Nope, it does not, but that is ok." 2>&1;
5064fi
5065'
5066
bd9b35c9
JH
5067: We will not override a previous value, but we might want to
5068: augment a hint file
5069case "$hint" in
5070default|recommended)
5071 case "$gccversion" in
eaf812ae 5072 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5073 esac
eaf812ae
MB
5074 case "$optimize:$DEBUGGING" in
5075 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5076 esac
bd9b35c9 5077 case "$gccversion" in
580e570e 5078 2*) if $test -d /etc/conf/kconfig.d &&
bd9b35c9
JH
5079 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5080 then
00e89ad4 5081 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5082 dflt="$dflt -posix"
5083 fi
f0d04425 5084 ;;
bd9b35c9
JH
5085 esac
5086 case "$gccversion" in
5087 1*) ;;
5088 2.[0-8]*) ;;
c0bacbef 5089 ?*) set strict-aliasing -fno-strict-aliasing
c34316b3 5090 eval $checkccflag
f0d04425 5091 ;;
e5e20432 5092 esac
00e89ad4
AD
5093 # For gcc, adding -pipe speeds up compilations for some, but apparently
5094 # some assemblers can't read from stdin. (It also slows down compilations
5095 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5096 case "$gccversion" in
c34316b3
NC
5097 ?*) set pipe -pipe
5098 eval $checkccflag
00e89ad4
AD
5099 ;;
5100 esac
6682be1c
NC
5101
5102 # on x86_64 (at least) we require an extra library (libssp) in the
5103 # link command line. This library is not named, so I infer that it is
5104 # an implementation detail that may change. Hence the safest approach
5105 # is to add the flag to the flags passed to the compiler at link time,
5106 # as that way the compiler can do the right implementation dependant
5107 # thing. (NWC)
5108 case "$gccversion" in
8f68b0e6 5109 ?*) set stack-protector -fstack-protector
6682be1c
NC
5110 eval $checkccflag
5111 ;;
5112 esac
e5e20432
JH
5113 ;;
5114esac
5115
bd9b35c9
JH
5116case "$mips_type" in
5117*BSD*|'') inclwanted="$locincpth $usrinc";;
5118*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5119esac
5120for thisincl in $inclwanted; do
5121 if $test -d $thisincl; then
5122 if $test x$thisincl != x$usrinc; then
5123 case "$dflt" in
00e89ad4
AD
5124 *" -I$thisincl "*);;
5125 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5126 esac
5127 fi
5128 fi
5129done
40a7a20a 5130
bd9b35c9
JH
5131inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5132 xxx=true;
5133elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5134 xxx=true;
5135else
5136 xxx=false;
5137fi;
5138if $xxx; then
5139 case "$dflt" in
5140 *$2*);;
5141 *) dflt="$dflt -D$2";;
5142 esac;
5143fi'
40a7a20a 5144
bd9b35c9 5145set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5146
bd9b35c9
JH
5147case "$usesocks" in
5148$define)
5149 ccflags="$ccflags -DSOCKS"
5150 ;;
5151esac
40a7a20a 5152
bd9b35c9
JH
5153case "$hint" in
5154default|recommended) dflt="$ccflags $dflt" ;;
5155*) dflt="$ccflags";;
5156esac
40a7a20a 5157
bd9b35c9
JH
5158case "$dflt" in
5159''|' ') dflt=none;;
5160esac
422af00a 5161
bd9b35c9 5162$cat <<EOH
40a7a20a 5163
bd9b35c9
JH
5164Your C compiler may want other flags. For this question you should include
5165-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5166but you should NOT include libraries or ld flags like -lwhatever. If you
5167want $package to honor its debug switch, you should include -DDEBUGGING here.
5168Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5169
bd9b35c9 5170To use no flags, specify the word "none".
40a7a20a 5171
bd9b35c9
JH
5172EOH
5173set X $dflt
5174shift
5175dflt=${1+"$@"}
5176rp="Any additional cc flags?"
5177. ./myread
5178case "$ans" in
5179none) ccflags='';;
5180*) ccflags="$ans";;
5181esac
8e07c86e 5182
bd9b35c9 5183: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5184case "$cppflags" in
5185'') cppflags="$ccflags" ;;
5186*) cppflags="$cppflags $ccflags" ;;
5187esac
bd9b35c9
JH
5188case "$gccversion" in
51891*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5190esac
bd9b35c9
JH
5191case "$mips_type" in
5192'');;
5193*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5194esac
5195case "$cppflags" in
5196'');;
5197*)
5198 echo " "
5199 echo "Let me guess what the preprocessor flags are..." >&4
5200 set X $cppflags
5201 shift
5202 cppflags=''
5203 $cat >cpp.c <<'EOM'
5204#define BLURFL foo
8e07c86e 5205
bd9b35c9
JH
5206BLURFL xx LFRULB
5207EOM
5208 previous=''
5209 for flag in $*
5210 do
5211 case "$flag" in
5212 -*) ftry="$flag";;
5213 *) ftry="$previous $flag";;
5214 esac
5215 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5216 >cpp1.out 2>/dev/null && \
5217 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5218 >cpp2.out 2>/dev/null && \
5219 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5220 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5221 then
5222 cppflags="$cppflags $ftry"
5223 previous=''
5224 else
5225 previous="$flag"
5226 fi
5227 done
5228 set X $cppflags
5229 shift
5230 cppflags=${1+"$@"}
5231 case "$cppflags" in
5232 *-*) echo "They appear to be: $cppflags";;
5233 esac
5234 $rm -f cpp.c cpp?.out
2afac517 5235 ;;
5236esac
8e07c86e 5237
bd9b35c9
JH
5238: flags used in final linking phase
5239case "$ldflags" in
5240'') if ./venix; then
5241 dflt='-i -z'
10a23457 5242 else
bd9b35c9 5243 dflt=''
10a23457 5244 fi
bd9b35c9
JH
5245 case "$ccflags" in
5246 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5247 esac
bd9b35c9
JH
5248 ;;
5249*) dflt="$ldflags";;
5250esac
b2f871ed
AD
5251# See note above about -fstack-protector
5252case "$ccflags" in
5253*-fstack-protector*)
5254 case "$dflt" in
5255 *-fstack-protector*) ;; # Don't add it again
5256 *) dflt="$dflt -fstack-protector" ;;
5257 esac
5258 ;;
5259esac
bd9b35c9
JH
5260
5261: Try to guess additional flags to pick up local libraries.
5262for thislibdir in $libpth; do
5263 case " $loclibpth " in
5264 *" $thislibdir "*)
00e89ad4 5265 case "$dflt " in
bd9b35c9
JH
5266 *"-L$thislibdir "*) ;;
5267 *) dflt="$dflt -L$thislibdir" ;;
5268 esac
c4f23d77
AD
5269 ;;
5270 esac
bd9b35c9 5271done
c4f23d77 5272
bd9b35c9
JH
5273case "$dflt" in
5274'') dflt='none' ;;
5275esac
c4f23d77 5276
bd9b35c9
JH
5277$cat <<EOH
5278
5279Your C linker may need flags. For this question you should
5280include -L/whatever and any other flags used by the C linker, but you
5281should NOT include libraries like -lwhatever.
5282
5283Make sure you include the appropriate -L/path flags if your C linker
5284does not normally search all of the directories you specified above,
5285namely
5286 $libpth
5287To use no flags, specify the word "none".
5288
5289EOH
5290
5291rp="Any additional ld flags (NOT including libraries)?"
5292. ./myread
5293case "$ans" in
5294none) ldflags='';;
5295*) ldflags="$ans";;
5296esac
5297rmlist="$rmlist pdp11"
5298
5299: coherency check
5300echo " "
5301echo "Checking your choice of C compiler and flags for coherency..." >&4
5302$cat > try.c <<'EOF'
5303#include <stdio.h>
55954f19 5304int main() { printf("Ok\n"); return(0); }
bd9b35c9 5305EOF
7a282f6d 5306set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5307shift
5308$cat >try.msg <<'EOM'
5309I've tried to compile and run the following simple program:
5310
5311EOM
5312$cat try.c >> try.msg
5313
5314$cat >> try.msg <<EOM
5315
5316I used the command:
5317
5318 $*
5440bc8e 5319 $run ./try
bd9b35c9
JH
5320
5321and I got the following output:
5322
5323EOM
5324dflt=y
73614538 5325if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
613d6c3e 5326 if $sh -c "$run ./try " >>try.msg 2>&1; then
5440bc8e 5327 xxx=`$run ./try`
bd9b35c9
JH
5328 case "$xxx" in
5329 "Ok") dflt=n ;;
5330 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5331 case " $libs " in
5332 *" -lsfio "*)
5333 cat >> try.msg <<'EOQS'
5334If $libs contains -lsfio, and sfio is mis-configured, then it
5335sometimes (apparently) runs and exits with a 0 status, but with no
5336output! It may have to do with sfio's use of _exit vs. exit.
5337
5338EOQS
5339 rp="You have a big problem. Shall I abort Configure"
5340 dflt=y
5341 ;;
5342 esac
5343 ;;
5344 esac
5345 else
5346 echo "The program compiled OK, but exited with status $?." >>try.msg
5347 rp="You have a problem. Shall I abort Configure"
5348 dflt=y
5349 fi
5350else
5351 echo "I can't compile the test program." >>try.msg
5352 rp="You have a BIG problem. Shall I abort Configure"
5353 dflt=y
5354fi
5355case "$dflt" in
5356y)
5357 $cat try.msg >&4
5358 case "$knowitall" in
5359 '')
5360 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5361 ;;
bd9b35c9 5362 *) dflt=n;;
c4f23d77 5363 esac
bd9b35c9
JH
5364 echo " "
5365 . ./myread
5366 case "$ans" in
5367 n*|N*) ;;
5368 *) echo "Ok. Stopping Configure." >&4
5369 exit 1
c4f23d77
AD
5370 ;;
5371 esac
5372 ;;
bd9b35c9 5373n) echo "OK, that should do.";;
c4f23d77 5374esac
613d6c3e 5375$rm_try gcctest gcctest.out
c4f23d77 5376
bd9b35c9
JH
5377: define a shorthand compile call
5378compile='
5379mc_file=$1;
5380shift;
08593cf4
NC
5381case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5382echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5383exit 1;
5384fi;
5385esac;
08413ebc 5386$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5387: define a shorthand compile call for compilations that should be ok.
5388compile_ok='
5389mc_file=$1;
5390shift;
7a282f6d 5391$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5392
8dfa8df9
JH
5393: determine filename position in cpp output
5394echo " "
5395echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5396case "$osname" in
5397vos) testaccess=-e ;;
5398*) testaccess=-r ;;
5399esac
8dfa8df9
JH
5400echo '#include <stdio.h>' > foo.c
5401$cat >fieldn <<EOF
5402$startsh
5403$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5404$grep '^[ ]*#.*stdio\.h' | \
5405while read cline; do
5406 pos=1
5407 set \$cline
5408 while $test \$# -gt 0; do
a5a94ea5 5409 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5410 echo "\$pos"
5411 exit 0
5412 fi
5413 shift
5414 pos=\`expr \$pos + 1\`
5415 done
5416done
5417EOF
5418chmod +x fieldn
5419fieldn=`./fieldn`
5420$rm -f foo.c fieldn
5421case $fieldn in
5422'') pos='???';;
54231) pos=first;;
54242) pos=second;;
54253) pos=third;;
5426*) pos="${fieldn}th";;
5427esac
5428echo "Your cpp writes the filename in the $pos field of the line."
5429
3c728e00
JH
5430case "$osname" in
5431vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5432os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5433*) cppfilter='' ;;
5434esac
8dfa8df9
JH
5435: locate header file
5436$cat >findhdr <<EOF
5437$startsh
5438wanted=\$1
5439name=''
5440for usrincdir in $usrinc
5441do
5442 if test -f \$usrincdir/\$wanted; then
5443 echo "\$usrincdir/\$wanted"
5444 exit 0
5445 fi
5446done
5447awkprg='{ print \$$fieldn }'
5448echo "#include <\$wanted>" > foo\$\$.c
5449$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5450$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5451while read cline; do
5452 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5453 case "\$name" in
5454 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5455 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5456 *) exit 2;;
5457 esac;
5458done;
5459#
5460# status = 0: grep returned 0 lines, case statement not executed
5461# status = 1: headerfile found
5462# status = 2: while loop executed, no headerfile found
5463#
5464status=\$?
5465$rm -f foo\$\$.c;
5466if test \$status -eq 1; then
5467 exit 0;
5468fi
5469exit 1
5470EOF
5471chmod +x findhdr
5472
5473: define an alternate in-header-list? function
5474inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5475cont=true; xxf="echo \"<\$1> found.\" >&4";
5476case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5477*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5478esac;
5479case $# in 4) instead=instead;; *) instead="at last";; esac;
5480while $test "$cont"; do
5481 xxx=`./findhdr $1`
5482 var=$2; eval "was=\$$2";
5483 if $test "$xxx" && $test -r "$xxx";
5484 then eval $xxf;
5485 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5486 cont="";
5487 else eval $xxnf;
5488 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5489 set $yyy; shift; shift; yyy=$@;
5490 case $# in 0) cont="";;
5491 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5492 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5493 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5494 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5495 esac;
5496done;
5497while $test "$yyy";
5498do set $yyy; var=$2; eval "was=\$$2";
5499 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5500 set $yyy; shift; shift; yyy=$@;
5501done'
5502
d1daaddf
JH
5503: see if stdlib is available
5504set stdlib.h i_stdlib
5505eval $inhdr
5506
5507: check for lengths of integral types
5508echo " "
5509case "$intsize" in
5510'')
5511 echo "Checking to see how big your integers are..." >&4
c63dfae1 5512 $cat >try.c <<EOCP
d1daaddf
JH
5513#include <stdio.h>
5514#$i_stdlib I_STDLIB
5515#ifdef I_STDLIB
5516#include <stdlib.h>
5517#endif
5518int main()
5519{
5520 printf("intsize=%d;\n", (int)sizeof(int));
5521 printf("longsize=%d;\n", (int)sizeof(long));
5522 printf("shortsize=%d;\n", (int)sizeof(short));
5523 exit(0);
5524}
5525EOCP
5526 set try
5527 if eval $compile_ok && $run ./try > /dev/null; then
5528 eval `$run ./try`
5529 echo "Your integers are $intsize bytes long."
5530 echo "Your long integers are $longsize bytes long."
5531 echo "Your short integers are $shortsize bytes long."
5532 else
5533 $cat >&4 <<EOM
5534!
5535Help! I can't compile and run the intsize test program: please enlighten me!
5536(This is probably a misconfiguration in your system or libraries, and
5537you really ought to fix it. Still, I'll try anyway.)
5538!
5539EOM
5540 dflt=4
5541 rp="What is the size of an integer (in bytes)?"
5542 . ./myread
5543 intsize="$ans"
5544 dflt=$intsize
5545 rp="What is the size of a long integer (in bytes)?"
5546 . ./myread
5547 longsize="$ans"
5548 dflt=2
5549 rp="What is the size of a short integer (in bytes)?"
5550 . ./myread
5551 shortsize="$ans"
5552 fi
5553 ;;
5554esac
5b813a60 5555$rm_try
d1daaddf
JH
5556
5557: check for long long
5558echo " "
5559echo "Checking to see if you have long long..." >&4
5560echo 'int main() { long long x = 7; return 0; }' > try.c
5561set try
5562if eval $compile; then
5563 val="$define"
5564 echo "You have long long."
5565else
5566 val="$undef"
5567 echo "You do not have long long."
5568fi
5b813a60 5569$rm_try
d1daaddf
JH
5570set d_longlong
5571eval $setvar
5572
5573: check for length of long long
5574case "${d_longlong}${longlongsize}" in
5575$define)
5576 echo " "
5577 echo "Checking to see how big your long longs are..." >&4
5578 $cat >try.c <<'EOCP'
5579#include <stdio.h>
5580int main()
5581{
5582 printf("%d\n", (int)sizeof(long long));
5583 return(0);
5584}
5585EOCP
5586 set try
5587 if eval $compile_ok; then
5588 longlongsize=`$run ./try`
5589 echo "Your long longs are $longlongsize bytes long."
5590 else
5591 dflt='8'
5592 echo " "
5593 echo "(I can't seem to compile the test program. Guessing...)"
5594 rp="What is the size of a long long (in bytes)?"
5595 . ./myread
5596 longlongsize="$ans"
5597 fi
5598 if $test "X$longsize" = "X$longlongsize"; then
5599 echo "(That isn't any different from an ordinary long.)"
5b813a60 5600 fi
d1daaddf
JH
5601 ;;
5602esac
5b813a60 5603$rm_try
d1daaddf 5604
8dfa8df9
JH
5605: see if inttypes.h is available
5606: we want a real compile instead of Inhdr because some systems
5607: have an inttypes.h which includes non-existent headers
5608echo " "
5609$cat >try.c <<EOCP
5610#include <inttypes.h>
5611int main() {
5612 static int32_t foo32 = 0x12345678;
5613}
5614EOCP
5615set try
5616if eval $compile; then
5617 echo "<inttypes.h> found." >&4
5618 val="$define"
5619else
5620 echo "<inttypes.h> NOT found." >&4
5621 val="$undef"
5622fi
5b813a60 5623$rm_try
8dfa8df9
JH
5624set i_inttypes
5625eval $setvar
5626
5627: check for int64_t
5628echo " "
5629echo "Checking to see if you have int64_t..." >&4
5630$cat >try.c <<EOCP
5631#include <sys/types.h>
5632#$i_inttypes I_INTTYPES
5633#ifdef I_INTTYPES
5634#include <inttypes.h>
5635#endif
5636int main() { int64_t x = 7; }
5637EOCP
5638set try
5639if eval $compile; then
5640 val="$define"
5641 echo "You have int64_t."
5642else
5643 val="$undef"
5644 echo "You do not have int64_t."
5645fi
5b813a60 5646$rm_try
8dfa8df9
JH
5647set d_int64_t
5648eval $setvar
5649
613d6c3e 5650: Check if 64bit ints have a quad type
8dfa8df9
JH
5651echo " "
5652echo "Checking which 64-bit integer type we could use..." >&4
5653
5654case "$intsize" in
56558) val=int
5656 set quadtype
5657 eval $setvar
5658 val='"unsigned int"'
5659 set uquadtype
5660 eval $setvar
5661 quadkind=1
5662 ;;
5663*) case "$longsize" in
5664 8) val=long
5665 set quadtype
5666 eval $setvar
5667 val='"unsigned long"'
5668 set uquadtype
5669 eval $setvar
5670 quadkind=2
5671 ;;
5672 *) case "$d_longlong:$longlongsize" in
5673 define:8)
5674 val='"long long"'
5675 set quadtype
5676 eval $setvar
5677 val='"unsigned long long"'
5678 set uquadtype
5679 eval $setvar
5680 quadkind=3
5681 ;;
5682 *) case "$d_int64_t" in
5683 define)
5684 val=int64_t
5685 set quadtype
5686 eval $setvar
5687 val=uint64_t
5688 set uquadtype
5689 eval $setvar
5690 quadkind=4
5691 ;;
5692 esac
5693 ;;
5694 esac
5695 ;;
5696 esac
5697 ;;
5698esac
5699
5700case "$quadtype" in
5701'') echo "Alas, no 64-bit integer types in sight." >&4
5702 d_quad="$undef"
5703 ;;
5704*) echo "We could use '$quadtype' for 64-bit integers." >&4
5705 d_quad="$define"
5706 ;;
5707esac
5708
34f1896b 5709: Do we want 64bit support
b4eb6b3d
JH
5710case "$uselonglong" in
5711"$define"|true|[yY]*)
5712 cat <<EOM >&4
5713
5714*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5715EOM
5716 use64bitint="$define"
5717 ;;
613d6c3e 5718esac
b4eb6b3d
JH
5719case "$use64bits" in
5720"$define"|true|[yY]*)
5721 cat <<EOM >&4
5722
5723*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5724EOM
5725 use64bitint="$define"
5726 ;;
613d6c3e 5727esac
b4eb6b3d
JH
5728case "$use64bitints" in
5729"$define"|true|[yY]*)
5730 cat <<EOM >&4
5731
5732*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5733EOM
5734 use64bitint="$define"
5735 ;;
613d6c3e 5736esac
b4eb6b3d
JH
5737case "$use64bitsint" in
5738"$define"|true|[yY]*)
5739 cat <<EOM >&4
5740
5741*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5742EOM
5743 use64bitint="$define"
5744 ;;
613d6c3e 5745esac
b4eb6b3d
JH
5746case "$uselonglongs" in
5747"$define"|true|[yY]*)
5748 cat <<EOM >&4
5749
5750*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5751EOM
5752 use64bitint="$define"
5753 ;;
613d6c3e 5754esac
b4eb6b3d
JH
5755case "$use64bitsall" in
5756"$define"|true|[yY]*)
5757 cat <<EOM >&4
5758
5759*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5760EOM
5761 use64bitall="$define"
5762 ;;
613d6c3e 5763esac
b4eb6b3d
JH
5764
5765case "$ccflags" in
5766*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5767esac
5768case "$use64bitall" in
5769"$define"|true|[yY]*) use64bitint="$define" ;;
5770esac
5771
5772case "$longsize" in
57738) cat <<EOM
5774
5775You have natively 64-bit long integers.
5776EOM
5777 val="$define"
5778 ;;
5779*) case "$use64bitint" in
5780 "$define"|true|[yY]*) dflt='y';;
5781 *) dflt='n';;
5782 esac
8dfa8df9
JH
5783 case "$d_quad" in
5784 "$define") ;;
5785 *) dflt='n' ;;
5786 esac
b4eb6b3d
JH
5787 cat <<EOM
5788
5789Perl can be built to take advantage of 64-bit integer types
5790on some systems. To do so, Configure can be run with -Duse64bitint.
5791Choosing this option will most probably introduce binary incompatibilities.
5792
5793If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5794(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5795EOM
5796 rp='Try to use 64-bit integers, if available?'
5797 . ./myread
5798 case "$ans" in
5799 [yY]*) val="$define" ;;
5800 *) val="$undef" ;;
5801 esac
5802 ;;
5803esac
5804set use64bitint
5805eval $setvar
5806
5807case "$use64bitall" in
5808"$define"|true|[yY]*) dflt='y' ;;
5809*) case "$longsize" in
5810 8) dflt='y' ;;
5811 *) dflt='n' ;;
5812 esac
5813 ;;
613d6c3e 5814esac
b4eb6b3d
JH
5815cat <<EOM
5816
5817You may also choose to try maximal 64-bitness. It means using as much
581864-bitness as possible on the platform. This in turn means even more
5819binary incompatibilities. On the other hand, your platform may not
5820have any more 64-bitness available than what you already have chosen.
5821
5822If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5823(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5824EOM
5825rp='Try to use maximal 64-bit support, if available?'
5826. ./myread
5827case "$ans" in
5828[yY]*) val="$define" ;;
5829*) val="$undef" ;;
5830esac
5831set use64bitall
5832eval $setvar
5833case "$use64bitall" in
5834"$define")
5835 case "$use64bitint" in
5836 "$undef")
5837 cat <<EOM
5838
5839Since you have chosen a maximally 64-bit build, I'm also turning on
5840the use of 64-bit integers.
5841EOM
5842 use64bitint="$define" ;;
5843 esac
5844 ;;
5845esac
5846
b4eb6b3d
JH
5847: Look for a hint-file generated 'call-back-unit'. If the
5848: user has specified that a 64-bit perl is to be built,
5849: we may need to set or change some other defaults.
19a100ff 5850if $test -f use64bitint.cbu; then
9da7673b 5851 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5852 . ./use64bitint.cbu
5853fi
9da7673b
MB
5854case "$use64bitint" in
5855"$define"|true|[yY]*)
b4eb6b3d
JH
5856 case "$longsize" in
5857 4) case "$archname64" in
5858 '') archname64=64int ;;
5859 esac
5860 ;;
5861 esac
5862 ;;
5863esac
5864
b4eb6b3d
JH
5865: Look for a hint-file generated 'call-back-unit'. If the
5866: user has specified that a maximally 64-bit perl is to be built,
5867: we may need to set or change some other defaults.
19a100ff 5868if $test -f use64bitall.cbu; then
9da7673b 5869 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5870 . ./use64bitall.cbu
5871fi
9da7673b
MB
5872case "$use64bitall" in
5873"$define"|true|[yY]*)
b4eb6b3d
JH
5874 case "$longsize" in
5875 4) case "$archname64" in
5876 ''|64int) archname64=64all ;;
5877 esac
5878 ;;
5879 esac
5880 ;;
5881esac
5882
1911a026
JH
5883case "$d_quad:$use64bitint" in
5884$undef:$define)
5885 cat >&4 <<EOF
5886
5887*** You have chosen to use 64-bit integers,
19a100ff 5888*** but none can be found.
09b58c7b 5889*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5890*** Cannot continue, aborting.
5891
5892EOF
5893 exit 1
5894 ;;
5895esac
5896
36adc09b
JH
5897: check for length of double
5898echo " "
5899case "$doublesize" in
5900'')
5901 echo "Checking to see how big your double precision numbers are..." >&4
5902 $cat >try.c <<EOCP
5903#include <stdio.h>
1911a026
JH
5904#$i_stdlib I_STDLIB
5905#ifdef I_STDLIB
5906#include <stdlib.h>
5907#endif
36adc09b
JH
5908int main()
5909{
5910 printf("%d\n", (int)sizeof(double));
1911a026 5911 exit(0);
36adc09b
JH
5912}
5913EOCP
5914 set try
5915 if eval $compile_ok; then
5916 doublesize=`$run ./try`
5917 echo "Your double is $doublesize bytes long."
5918 else
5919 dflt='8'
5920 echo "(I can't seem to compile the test program. Guessing...)"
5921 rp="What is the size of a double precision number (in bytes)?"
5922 . ./myread
5923 doublesize="$ans"
5924 fi
5925 ;;
5926esac
5b813a60 5927$rm_try
36adc09b
JH
5928
5929: check for long doubles
5930echo " "
5931echo "Checking to see if you have long double..." >&4
5932echo 'int main() { long double x = 7.0; }' > try.c
5933set try
5934if eval $compile; then
5935 val="$define"
5936 echo "You have long double."
5937else
5938 val="$undef"
5939 echo "You do not have long double."
5940fi
5b813a60 5941$rm_try
36adc09b
JH
5942set d_longdbl
5943eval $setvar
5944
5945: check for length of long double
5946case "${d_longdbl}${longdblsize}" in
5947$define)
5948 echo " "
5949 echo "Checking to see how big your long doubles are..." >&4
5950 $cat >try.c <<'EOCP'
5951#include <stdio.h>
5952int main()
5953{
5954 printf("%d\n", sizeof(long double));
5955}
5956EOCP
5957 set try
5958 set try
5959 if eval $compile; then
5960 longdblsize=`$run ./try`
5961 echo "Your long doubles are $longdblsize bytes long."
5962 else
5963 dflt='8'
5964 echo " "
5965 echo "(I can't seem to compile the test program. Guessing...)" >&4
5966 rp="What is the size of a long double (in bytes)?"
5967 . ./myread
5968 longdblsize="$ans"
5969 fi
5970 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5971 echo "That isn't any different from an ordinary double."
5972 echo "I'll keep your setting anyway, but you may see some"
5973 echo "harmless compilation warnings."
5b813a60 5974 fi
36adc09b
JH
5975 ;;
5976esac
5b813a60 5977$rm_try
36adc09b 5978
89ce900e 5979: determine the architecture name
b4eb6b3d 5980echo " "
89ce900e
JH
5981if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5982 tarch=`arch`"-$osname"
5983elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5984 if uname -m > tmparch 2>&1 ; then
5985 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5986 -e 's/$/'"-$osname/" tmparch`
5987 else
5988 tarch="$osname"
5989 fi
5990 $rm -f tmparch
b4eb6b3d 5991else
89ce900e 5992 tarch="$osname"
b4eb6b3d 5993fi
89ce900e
JH
5994case "$myarchname" in
5995''|"$tarch") ;;
5996*)
5997 echo "(Your architecture name used to be $myarchname.)"
5998 archname=''
5999 ;;
6000esac
6001case "$targetarch" in
6002'') ;;
6003*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6004esac
6005myarchname="$tarch"
6006case "$archname" in
6007'') dflt="$tarch";;
6008*) dflt="$archname";;
6009esac
6010rp='What is your architecture name'
6011. ./myread
6012archname="$ans"
6013case "$usethreads" in
6014$define)
6015 echo "Threads selected." >&4
6016 case "$archname" in
6017 *-thread*) echo "...and architecture name already has -thread." >&4
6018 ;;
6019 *) archname="$archname-thread"
6020 echo "...setting architecture name to $archname." >&4
6021 ;;
6022 esac
6023 ;;
6024esac
6025case "$usemultiplicity" in
6026$define)
6027 echo "Multiplicity selected." >&4
6028 case "$archname" in
6029 *-multi*) echo "...and architecture name already has -multi." >&4
6030 ;;
6031 *) archname="$archname-multi"
6032 echo "...setting architecture name to $archname." >&4
6033 ;;
6034 esac
6035 ;;
6036esac
6037case "$use64bitint$use64bitall" in
6038*"$define"*)
6039 case "$archname64" in
6040 '')
6041 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6042 ;;
89ce900e
JH
6043 *)
6044 case "$use64bitint" in
6045 "$define") echo "64 bit integers selected." >&4 ;;
6046 esac
6047 case "$use64bitall" in
6048 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6049 esac
6050 case "$archname" in
6051 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6052 ;;
6053 *) archname="$archname-$archname64"
6054 echo "...setting architecture name to $archname." >&4
6055 ;;
6056 esac
c1a7f87b
JH
6057 ;;
6058 esac
89ce900e
JH
6059esac
6060case "$uselongdouble" in
6061$define)
6062 echo "Long doubles selected." >&4
6063 case "$longdblsize" in
6064 $doublesize)
6065 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6066 ;;
6067 *)
6068 case "$archname" in
6069 *-ld*) echo "...and architecture name already has -ld." >&4
6070 ;;
6071 *) archname="$archname-ld"
6072 echo "...setting architecture name to $archname." >&4
6073 ;;
6074 esac
bd9b35c9
JH
6075 ;;
6076 esac
bd9b35c9 6077 ;;
89ce900e 6078esac
d2e0c6f7
JH
6079if $test -f archname.cbu; then
6080 echo "Your platform has some specific hints for architecture name, using them..."
6081 . ./archname.cbu
6082fi
bd9b35c9 6083
b4eb6b3d
JH
6084: set the prefixit variable, to compute a suitable default value
6085prefixit='case "$3" in
6086""|none)
6087 case "$oldprefix" in
6088 "") eval "$1=\"\$$2\"";;
6089 *)
6090 case "$3" in
6091 "") eval "$1=";;
6092 none)
6093 eval "tp=\"\$$2\"";
6094 case "$tp" in
6095 ""|" ") eval "$1=\"\$$2\"";;
6096 *) eval "$1=";;
6097 esac;;
6098 esac;;
6099 esac;;
6100*)
6101 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6102 case "$tp" in
6103 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6104 /*-$oldprefix/*|\~*-$oldprefix/*)
6105 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6106 *) eval "$1=\"\$$2\"";;
6107 esac;;
6108esac'
6109
f3f1a2d8
MB
6110: determine installation style
6111: For now, try to deduce it from prefix unless it is already set.
6112: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6113case "$installstyle" in
6114'') case "$prefix" in
6115 *perl*) dflt='lib';;
6116 *) dflt='lib/perl5' ;;
6117 esac
6118 ;;
6119*) dflt="$installstyle" ;;
4d20abad 6120esac
f3f1a2d8
MB
6121: Probably not worth prompting for this since we prompt for all
6122: the directories individually, and the prompt would be too long and
6123: confusing anyway.
6124installstyle=$dflt
4d20abad 6125
eaf812ae
MB
6126: determine where public executables go
6127echo " "
6128set dflt bin bin
6129eval $prefixit
6130fn=d~
6131rp='Pathname where the public executables will reside?'
6132. ./getfile
6133if $test "X$ansexp" != "X$binexp"; then
6134 installbin=''
6135fi
6136prefixvar=bin
6137: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6138: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6139: this via initialinstalllocation
eaf812ae
MB
6140. ./setprefixvar
6141
6142case "$userelocatableinc" in
6143$define|true|[yY]*) dflt='y' ;;
6144*) dflt='n' ;;
6145esac
6146cat <<EOM
6147
6148Would you like to build Perl so that the installation is relocatable, so that
6149library paths in @INC are determined relative to the path of the perl binary?
6150This is not advised for system Perl installs, or if you need to run setid
6151scripts or scripts under taint mode.
6152
6153If this doesn't make any sense to you, just accept the default '$dflt'.
6154EOM
6155rp='Use relocatable @INC?'
6156. ./myread
6157case "$ans" in
6158y|Y) val="$define" ;;
6159*) val="$undef" ;;
6160esac
6161set userelocatableinc
6162eval $setvar
6163
ea7d701d 6164initialinstalllocation="$binexp"
eaf812ae
MB
6165: Default prefix is now "up one level from where the binaries are"
6166case "$userelocatableinc" in
6167$define|true|[yY]*)
eaf812ae
MB
6168 bin=".../"
6169 binexp=".../"
6170 prefix=".../.."
6171 prefixexp=".../.."
6172 installprefixexp=".../.."
6173 ;;
6174esac
6175
b4eb6b3d
JH
6176: determine where private library files go
6177: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6178: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6179: /opt/perl/lib/perl5... would be redundant.
6180: The default "style" setting is made in installstyle.U
6181case "$installstyle" in
6182*lib/perl5*) set dflt privlib lib/$package/$version ;;
6183*) set dflt privlib lib/$version ;;
6184esac
6185eval $prefixit
6186$cat <<EOM
6187
6188There are some auxiliary files for $package that need to be put into a
6189private library directory that is accessible by everyone.
6190
6191EOM
eaf812ae 6192fn=$binexp
b4eb6b3d
JH
6193fn=d~+
6194rp='Pathname where the private library files will reside?'
6195. ./getfile
79522dd2
NC
6196prefixvar=privlib
6197. ./setprefixvar
b4eb6b3d
JH
6198
6199: set the prefixup variable, to restore leading tilda escape
6200prefixup='case "$prefixexp" in
6201"$prefix") ;;
6202*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6203esac'
6204
6205: determine where public architecture dependent libraries go
6206set archlib archlib
6207eval $prefixit
6208: privlib default is /usr/local/lib/$package/$version
6209: archlib default is /usr/local/lib/$package/$version/$archname
6210: privlib may have an optional trailing /share.
6211tdflt=`echo $privlib | $sed 's,/share$,,'`
6212tdflt=$tdflt/$archname
6213case "$archlib" in
6214'') dflt=$tdflt
6215 ;;
6216*) dflt="$archlib"
6217 ;;
6218esac
6219$cat <<EOM
6220
6221$spackage contains architecture-dependent library files. If you are
6222sharing libraries in a heterogeneous environment, you might store
6223these files in a separate location. Otherwise, you can just include
6224them with the rest of the public library files.
6225
6226EOM
eaf812ae 6227fn=$binexp
b4eb6b3d
JH
6228fn=d+~
6229rp='Where do you want to put the public architecture-dependent libraries?'
6230. ./getfile
79522dd2
NC
6231prefixvar=archlib
6232. ./setprefixvar
b4eb6b3d
JH
6233if $test X"$archlib" = X"$privlib"; then
6234 d_archlib="$undef"
6235else
6236 d_archlib="$define"
6237fi
b4eb6b3d 6238
b4eb6b3d
JH
6239: see if setuid scripts can be secure
6240$cat <<EOM
6241
6242Some kernels have a bug that prevents setuid #! scripts from being
6243secure. Some sites have disabled setuid #! scripts because of this.
6244
6245First let's decide if your kernel supports secure setuid #! scripts.
6246(If setuid #! scripts would be secure but have been disabled anyway,
6247don't say that they are secure if asked.)
6248
6249EOM
6250
6251val="$undef"
6252if $test -d /dev/fd; then
6253 echo "#!$ls" >reflect
6254 chmod +x,u+s reflect
6255 ./reflect >flect 2>&1
6256 if $contains "/dev/fd" flect >/dev/null; then
6257 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6258 val="$define"
6259 else
6260 $cat <<EOM
6261If you are not sure if they are secure, I can check but I'll need a
6262username and password different from the one you are using right now.
6263If you don't have such a username or don't want me to test, simply
6264enter 'none'.
6265
6266EOM
6267 rp='Other username to test security of setuid scripts with?'
6268 dflt='none'
6269 . ./myread
6270 case "$ans" in
6271 n|none)
6272 case "$d_suidsafe" in
6273 '') echo "I'll assume setuid scripts are *not* secure." >&4
6274 dflt=n;;
6275 "$undef")
6276 echo "Well, the $hint value is *not* secure." >&4
6277 dflt=n;;
6278 *) echo "Well, the $hint value *is* secure." >&4
6279 dflt=y;;
6280 esac
c1a7f87b 6281 ;;
b4eb6b3d
JH
6282 *)
6283 $rm -f reflect flect
6284 echo "#!$ls" >reflect
6285 chmod +x,u+s reflect
6286 echo >flect
6287 chmod a+w flect
6288 echo '"su" will (probably) prompt you for '"$ans's password."
6289 su $ans -c './reflect >flect'
6290 if $contains "/dev/fd" flect >/dev/null; then
6291 echo "Okay, it looks like setuid scripts are secure." >&4
6292 dflt=y
6293 else
6294 echo "I don't think setuid scripts are secure." >&4
6295 dflt=n
6296 fi
6297 ;;
6298 esac
6299 rp='Does your kernel have *secure* setuid scripts?'
6300 . ./myread
6301 case "$ans" in
6302 [yY]*) val="$define";;
6303 *) val="$undef";;
6304 esac
6305 fi
6306else
6307 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6308 echo "(That's for file descriptors, not floppy disks.)"
6309 val="$undef"
6310fi
6311set d_suidsafe
6312eval $setvar
6313
6314$rm -f reflect flect
6315
6316: now see if they want to do setuid emulation
01614441 6317if $test $patchlevel -lt 11; then
b4eb6b3d
JH
6318echo " "
6319val="$undef"
6320case "$d_suidsafe" in
6321"$define")
6322 val="$undef"
3c728e00 6323 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6324 ;;
f3f1a2d8
MB
6325*)
6326 $cat <<EOM
6327Some systems have disabled setuid scripts, especially systems where
6328setuid scripts cannot be secure. On systems where setuid scripts have
6329been disabled, the setuid/setgid bits on scripts are currently
6330useless. It is possible for $package to detect those bits and emulate
6331setuid/setgid in a secure fashion. This emulation will only work if
6332setuid scripts have been disabled in your kernel.
6333
6334EOM
6335 case "$d_dosuid" in
6336 "$define") dflt=y ;;
6337 *) dflt=n ;;
6338 esac
6339 rp="Do you want to do setuid/setgid emulation?"
6340 . ./myread
6341 case "$ans" in
6342 [yY]*) val="$define";;
6343 *) val="$undef";;
6344 esac
6345 ;;
6346esac
6347set d_dosuid
6348eval $setvar
01614441
MB
6349else
6350 case "$d_dosuid" in
6351 "$define")
6352 cat >&4 <<EOH
6353
6354SUID emulation has been removed for 5.12
6355Please re-run Configure without -Dd_dosuid
6356
6357EOH
6358 exit 1;
6359 ;;
6360 esac
6361 d_dosuid=undef
6362fi
f3f1a2d8 6363
f3f1a2d8
MB
6364: Find perl5.005 or later.
6365echo "Looking for a previously installed perl5.005 or later... "
6366case "$perl5" in
6367'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6368 : Check if this perl is recent and can load a simple module
6369 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6370 perl5=$tdir/perl
6371 break;
6372 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6373 perl5=$tdir/perl5
6374 break;
6375 fi
6376 done
6377 ;;
6378*) perl5="$perl5"
6379 ;;
6380esac
6381case "$perl5" in
6382'') echo "None found. That's ok.";;
6383*) echo "Using $perl5." ;;
6384esac
6385
613d6c3e 6386: Set the siteprefix variables
f3f1a2d8
MB
6387$cat <<EOM
6388
6389After $package is installed, you may wish to install various
6390add-on modules and utilities. Typically, these add-ons will
6391be installed under $prefix with the rest
6392of this package. However, you may wish to install such add-ons
6393elsewhere under a different prefix.
6394
6395If you do not wish to put everything under a single prefix, that's
6396ok. You will be prompted for the individual locations; this siteprefix
6397is only used to suggest the defaults.
6398
6399The default should be fine for most people.
6400
6401EOM
6402fn=d~+
6403rp='Installation prefix to use for add-on modules and utilities?'
6404: XXX Here might be another good place for an installstyle setting.
6405case "$siteprefix" in
6406'') dflt=$prefix ;;
6407*) dflt=$siteprefix ;;
6408esac
6409. ./getfile
6410: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6411oldsiteprefix=''
6412case "$siteprefix" in
6413'') ;;
6414*) case "$ans" in
6415 "$prefix") ;;
6416 *) oldsiteprefix="$prefix";;
6417 esac
6418 ;;
6419esac
6420siteprefix="$ans"
6421siteprefixexp="$ansexp"
6422
6423: determine where site specific libraries go.
6424: Usual default is /usr/local/lib/perl5/site_perl/$version
6425: The default "style" setting is made in installstyle.U
6426: XXX No longer works with Prefixit stuff.
6427prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6428case "$sitelib" in
6429'') case "$installstyle" in
6430 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6431 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6432 esac
6433 ;;
6434*) dflt="$sitelib"
6435 ;;
6436esac
6437$cat <<EOM
6438
6439The installation process will create a directory for
6440site-specific extensions and modules. Most users find it convenient
6441to place all site-specific files in this directory rather than in the
6442main distribution directory.
6443
6444EOM
6445fn=d~+
6446rp='Pathname for the site-specific library files?'
6447. ./getfile
6448prefixvar=sitelib
6449. ./setprefixvar
6450sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6451
6452: Determine list of previous versions to include in @INC
6453$cat > getverlist <<EOPL
6454#!$perl5 -w
6455use File::Basename;
6456\$api_versionstring = "$api_versionstring";
6457\$version = "$version";
6458\$stem = "$sitelib_stem";
6459\$archname = "$archname";
6460EOPL
6461 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6462# The list found is store twice for each entry: the original name, and
6463# the binary broken down version as pack "sss", so sorting is easy and
6464# unambiguous. This will work for all versions that have a maximum of
6465# three digit groups, separate by '.'s or '_'s. Names are extended with
6466# ".0.0" to ensure at least three elements for the pack.
6467# -- H.Merijn Brand (m)'06 23-10-2006
6468
f3f1a2d8
MB
6469# Can't have leading @ because metaconfig interprets it as a command!
6470;@inc_version_list=();
6471# XXX Redo to do opendir/readdir?
6472if (-d $stem) {
6473 chdir($stem);
13cfc98d
MB
6474 ;@candidates = map {
6475 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
a71f1801 6476 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
f3f1a2d8
MB
6477}
6478else {
6479 ;@candidates = ();
6480}
6481
13cfc98d
MB
6482($pversion, $aversion, $vsn5005) = map {
6483 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6484foreach $d (@candidates) {
13cfc98d
MB
6485 if ($d->[1] lt $pversion) {
6486 if ($d->[1] ge $aversion) {
6487 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6488 }
13cfc98d
MB
6489 elsif ($d->[1] ge $vsn5005) {
6490 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6491 }
6492 }
6493 else {
6494 # Skip newer version. I.e. don't look in
6495 # 5.7.0 if we're installing 5.6.1.
6496 }
6497}
6498
6499if (@inc_version_list) {
6500 print join(' ', @inc_version_list);
6501}
6502else {
6503 # Blank space to preserve value for next Configure run.
6504 print " ";
6505}
6506EOPL
6507chmod +x getverlist
6508case "$inc_version_list" in
6509'') if test -x "$perl5$exe_ext"; then
6510 dflt=`$perl5 getverlist`
6511 else
6512 dflt='none'
6513 fi
6514 ;;
6515$undef) dflt='none' ;;
6516*) eval dflt=\"$inc_version_list\" ;;
6517esac
6518case "$dflt" in
6519''|' ') dflt=none ;;
6520esac
6521case "$dflt" in
65225.005) dflt=none ;;
6523esac
6524$cat <<EOM
6525
6526In order to ease the process of upgrading, this version of perl
6527can be configured to use modules built and installed with earlier
6528versions of perl that were installed under $prefix. Specify here
6529the list of earlier versions that this version of perl should check.
6530If Configure detected no earlier versions of perl installed under
6531$prefix, then the list will be empty. Answer 'none' to tell perl
6532to not search earlier versions.
b4eb6b3d 6533
f3f1a2d8
MB
6534The default should almost always be sensible, so if you're not sure,
6535just accept the default.
b4eb6b3d 6536EOM
f3f1a2d8
MB
6537
6538rp='List of earlier versions to include in @INC?'
6539. ./myread
6540case "$ans" in
6541[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6542*) inc_version_list="$ans" ;;
6543esac
6544case "$inc_version_list" in
6545''|' ')
6546 inc_version_list_init='0'
6547 d_inc_version_list="$undef"
6548 ;;
6549*) inc_version_list_init=`echo $inc_version_list |
6550 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6551 d_inc_version_list="$define"
b4eb6b3d
JH
6552 ;;
6553esac
f3f1a2d8 6554$rm -f getverlist
b4eb6b3d 6555
1cd66f7c
DD
6556: see if malloc/malloc.h has to be included
6557set malloc/malloc.h i_mallocmalloc
6558eval $inhdr
6559
b4eb6b3d 6560: see if this is a malloc.h system
01d07975
YST
6561: we want a real compile instead of Inhdr because some systems have a
6562: malloc.h that just gives a compile error saying to use stdlib.h instead
6563echo " "
6564$cat >try.c <<EOCP
6565#include <stdlib.h>
6566#include <malloc.h>
f25eda10 6567#$i_mallocmalloc I_MALLOCMALLOC
1cd66f7c
DD
6568#ifdef I_MALLOCMALLOC
6569# include <malloc/malloc.h>
6570#endif
6571
01d07975
YST
6572int main () { return 0; }
6573EOCP
6574set try
6575if eval $compile; then
6576 echo "<malloc.h> found." >&4
6577 val="$define"
6578else
6579 echo "<malloc.h> NOT found." >&4
6580 val="$undef"
6581fi
5b813a60 6582$rm_try
01d07975
YST
6583set i_malloc
6584eval $setvar
b4eb6b3d 6585
c8b93cf9
JH
6586: check for void type
6587echo " "
6588echo "Checking to see how well your C compiler groks the void type..." >&4
6589case "$voidflags" in
6590'')
c727eafa 6591 $cat >try.c <<EOCP
d1daaddf
JH
6592#$i_stdlib I_STDLIB
6593#ifdef I_STDLIB
6594#include <stdlib.h>
6595#endif
c8b93cf9
JH
6596#if TRY & 1
6597void sub() {
6598#else
6599sub() {
6600#endif
6601 extern void moo(); /* function returning void */
6602 void (*goo)(); /* ptr to func returning void */
6603#if TRY & 8
6604 void *hue; /* generic ptr */
6605#endif
6606#if TRY & 2
6607 void (*foo[10])();
6608#endif
6609
6610#if TRY & 4
6611 if(goo == moo) {
6612 exit(0);
6613 }
6614#endif
6615 exit(0);
6616}
6617int main() { sub(); }
6618EOCP
6619 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6620 voidflags=$defvoidused
6621 echo "Good. It appears to support void to the level $package wants.">&4
6622 if $contains warning .out >/dev/null 2>&1; then
6623 echo "However, you might get some warnings that look like this:"
6624 $cat .out
6625 fi
6626 else
6627echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6628 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6629 echo "It supports 1..."
6630 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6631 echo "It also supports 2..."
6632 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6633 voidflags=7
6634 echo "And it supports 4 but not 8 definitely."
6635 else
6636 echo "It doesn't support 4..."
6637 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6638 voidflags=11
6639 echo "But it supports 8."
6640 else
6641 voidflags=3
6642 echo "Neither does it support 8."
6643 fi
6644 fi
6645 else
6646 echo "It does not support 2..."
6647 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6648 voidflags=13
6649 echo "But it supports 4 and 8."
6650 else
6651 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6652 voidflags=5
6653 echo "And it supports 4 but has not heard about 8."
6654 else
6655 echo "However it supports 8 but not 4."
6656 fi
6657 fi
6658 fi
6659 else
6660 echo "There is no support at all for void."
6661 voidflags=0
6662 fi
6663 fi
6664esac
6665case "$voidflags" in
6666"$defvoidused") ;;
6667*) $cat >&4 <<'EOM'
6668 Support flag bits are:
6669 1: basic void declarations.
6670 2: arrays of pointers to functions returning void.
6671 4: operations between pointers to and addresses of void functions.
6672 8: generic void pointers.
6673EOM
6674 dflt="$voidflags";
6675 rp="Your void support flags add up to what?"
6676 . ./myread
6677 voidflags="$ans"
6678 ;;
6679esac
5b813a60 6680$rm_try
c8b93cf9
JH
6681
6682: check for length of pointer
6683echo " "
6684case "$ptrsize" in
6685'')
6686 echo "Checking to see how big your pointers are..." >&4
6687 if test "$voidflags" -gt 7; then
6688 echo '#define VOID_PTR char *' > try.c
6689 else
6690 echo '#define VOID_PTR void *' > try.c
6691 fi
74d00865 6692 $cat >>try.c <<EOCP
c8b93cf9 6693#include <stdio.h>
d1daaddf
JH
6694#$i_stdlib I_STDLIB
6695#ifdef I_STDLIB
6696#include <stdlib.h>
6697#endif
c8b93cf9
JH
6698int main()
6699{
6700 printf("%d\n", (int)sizeof(VOID_PTR));
6701 exit(0);
6702}
6703EOCP
6704 set try
6705 if eval $compile_ok; then
6706 ptrsize=`$run ./try`
6707 echo "Your pointers are $ptrsize bytes long."
6708 else
6709 dflt='4'
6710 echo "(I can't seem to compile the test program. Guessing...)" >&4
6711 rp="What is the size of a pointer (in bytes)?"
6712 . ./myread
6713 ptrsize="$ans"
6714 fi
6715 ;;
6716esac
5b813a60 6717$rm_try
c8b93cf9
JH
6718case "$use64bitall" in
6719"$define"|true|[yY]*)
6720 case "$ptrsize" in
6721 4) cat <<EOM >&4
6722
1911a026
JH
6723*** You have chosen a maximally 64-bit build,
6724*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6725*** Please rerun Configure without -Duse64bitall.
6726EOM
6727 case "$d_quad" in
6728 define)
6729 cat <<EOM >&4
6730*** Since you have quads, you could possibly try with -Duse64bitint.
6731EOM
6732 ;;
6733 esac
6734 cat <<EOM >&4
1911a026 6735*** Cannot continue, aborting.
c8b93cf9
JH
6736
6737EOM
09b58c7b 6738
1911a026 6739 exit 1
c8b93cf9
JH
6740 ;;
6741 esac
6742 ;;
6743esac
6744
19a100ff 6745
9df442c2
NC
6746: determine whether to use malloc wrapping
6747echo " "
6748case "$usemallocwrap" in
6749[yY]*|true|$define) dflt='y' ;;
6750[nN]*|false|$undef) dflt='n' ;;
6751*) case "$usedevel" in
6752 [yY]*|true|$define) dflt='y' ;;
6753 *) dflt='n' ;;
6754 esac
6755 ;;
6756esac
6757rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6758. ./myread
6759usemallocwrap="$ans"
6760case "$ans" in
6761y*|true)
6762 usemallocwrap="$define" ;;
6763*)
6764 usemallocwrap="$undef" ;;
6765esac
c8b93cf9 6766
b4eb6b3d
JH
6767: determine which malloc to compile in
6768echo " "
6769case "$usemymalloc" in
c4163172
JH
6770[yY]*|true|$define) dflt='y' ;;
6771[nN]*|false|$undef) dflt='n' ;;
6772*) case "$ptrsize" in
6773 4) dflt='y' ;;
6774 *) dflt='n' ;;
6775 esac
6776 ;;
8dfa8df9 6777esac
b4eb6b3d
JH
6778rp="Do you wish to attempt to use the malloc that comes with $package?"
6779. ./myread
6780usemymalloc="$ans"
6781case "$ans" in
6782y*|true)
6783 usemymalloc='y'
6784 mallocsrc='malloc.c'
6785 mallocobj="malloc$_o"
6786 d_mymalloc="$define"
6787 case "$libs" in
6788 *-lmalloc*)
6789 : Remove malloc from list of libraries to use
6790 echo "Removing unneeded -lmalloc from library list" >&4
6791 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6792 shift
6793 libs="$*"
6794 echo "libs = $libs" >&4
6795 ;;
6796 esac
6797 ;;
6798*)
6799 usemymalloc='n'
6800 mallocsrc=''
6801 mallocobj=''
6802 d_mymalloc="$undef"
6803 ;;
6804esac
6805
6806: compute the return types of malloc and free
6807echo " "
6808$cat >malloc.c <<END
6809#$i_malloc I_MALLOC
6810#$i_stdlib I_STDLIB
6811#include <stdio.h>
6812#include <sys/types.h>
6813#ifdef I_MALLOC
6814#include <malloc.h>
6815#endif
6816#ifdef I_STDLIB
6817#include <stdlib.h>
6818#endif
6819#ifdef TRY_MALLOC
6820void *malloc();
6821#endif
6822#ifdef TRY_FREE
6823void free();
6824#endif
6825END
6826case "$malloctype" in
6827'')
6828 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6829 malloctype='void *'
6830 else
6831 malloctype='char *'
6832 fi
6833 ;;
6834esac
6835echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6836
6837case "$freetype" in
6838'')
6839 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6840 freetype='void'
6841 else
6842 freetype='int'
6843 fi
6844 ;;
6845esac
6846echo "Your system uses $freetype free(), it would seem." >&4
6847$rm -f malloc.[co]
b4eb6b3d
JH
6848: determine where site specific architecture-dependent libraries go.
6849: sitelib default is /usr/local/lib/perl5/site_perl/$version
6850: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6851: sitelib may have an optional trailing /share.
6852case "$sitearch" in
6853'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6854 dflt="$dflt/$archname"
6855 ;;
6856*) dflt="$sitearch"
6857 ;;
6858esac
6859set sitearch sitearch none
6860eval $prefixit
6861$cat <<EOM
6862
6863The installation process will also create a directory for
6864architecture-dependent site-specific extensions and modules.
6865
6866EOM
6867fn=d~+
6868rp='Pathname for the site-specific architecture-dependent library files?'
6869. ./getfile
79522dd2
NC
6870prefixvar=sitearch
6871. ./setprefixvar
c95d0e17
GA
6872if $test X"$sitearch" = X"$sitelib"; then
6873 d_sitearch="$undef"
6874else
6875 d_sitearch="$define"
6876fi
b4eb6b3d 6877
613d6c3e 6878: Set the vendorprefix variables
b4eb6b3d
JH
6879$cat <<EOM
6880
6881The installation process will also create a directory for
6882vendor-supplied add-ons. Vendors who supply perl with their system
6883may find it convenient to place all vendor-supplied files in this
6884directory rather than in the main distribution directory. This will
6885ease upgrades between binary-compatible maintenance versions of perl.
6886
6887Of course you may also use these directories in whatever way you see
6888fit. For example, you might use them to access modules shared over a
6889company-wide network.
6890
6891The default answer should be fine for most people.
6892This causes further questions about vendor add-ons to be skipped
6893and no vendor-specific directories will be configured for perl.
6894
6895EOM
6896rp='Do you want to configure vendor-specific add-on directories?'
6897case "$usevendorprefix" in
6898define|true|[yY]*) dflt=y ;;
6899*) : User may have set vendorprefix directly on Configure command line.
6900 case "$vendorprefix" in
6901 ''|' ') dflt=n ;;
6902 *) dflt=y ;;
6903 esac
6904 ;;
6905esac
6906. ./myread
6907case "$ans" in
6908[yY]*) fn=d~+
6909 rp='Installation prefix to use for vendor-supplied add-ons?'
6910 case "$vendorprefix" in
6911 '') dflt='' ;;
6912 *) dflt=$vendorprefix ;;
6913 esac
6914 . ./getfile
6915 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6916 oldvendorprefix=''
6917 case "$vendorprefix" in
6918 '') ;;
6919 *) case "$ans" in
6920 "$prefix") ;;
6921 *) oldvendorprefix="$prefix";;
6922 esac
6923 ;;
6924 esac
6925 usevendorprefix="$define"
6926 vendorprefix="$ans"
6927 vendorprefixexp="$ansexp"
6928 ;;
6929*) usevendorprefix="$undef"
6930 vendorprefix=''
6931 vendorprefixexp=''
6932 ;;
6933esac
6934
613d6c3e 6935: Set the vendorlib variables
b4eb6b3d
JH
6936case "$vendorprefix" in
6937'') d_vendorlib="$undef"
6938 vendorlib=''
6939 vendorlibexp=''
6940 ;;
6941*) d_vendorlib="$define"
6942 : determine where vendor-supplied modules go.
6943 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6944 case "$vendorlib" in
6945 '')
6946 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6947 case "$installstyle" in
6948 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6949 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6950 esac
6951 ;;
6952 *) dflt="$vendorlib"
6953 ;;
6954 esac
6955 fn=d~+
6956 rp='Pathname for the vendor-supplied library files?'
6957 . ./getfile
6958 vendorlib="$ans"
6959 vendorlibexp="$ansexp"
6960 ;;
6961esac
6962vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6963prefixvar=vendorlib
6964. ./installprefix
b4eb6b3d 6965
613d6c3e 6966: Set the vendorarch variables
b4eb6b3d
JH
6967case "$vendorprefix" in
6968'') d_vendorarch="$undef"
6969 vendorarch=''
6970 vendorarchexp=''
6971 ;;
6972*) d_vendorarch="$define"
6973 : determine where vendor-supplied architecture-dependent libraries go.
6974 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6975 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6976 : vendorlib may have an optional trailing /share.
6977 case "$vendorarch" in
6978 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6979 dflt="$dflt/$archname"
6980 ;;
6981 *) dflt="$vendorarch" ;;
6982 esac
6983 fn=d~+
6984 rp='Pathname for vendor-supplied architecture-dependent files?'
6985 . ./getfile
6986 vendorarch="$ans"
6987 vendorarchexp="$ansexp"
6988 ;;
6989esac
a092d240
NC
6990prefixvar=vendorarch
6991. ./installprefix
1be1b388
MB
6992if $test X"$vendorarch" = X"$vendorlib"; then
6993 d_vendorarch="$undef"
6994else
6995 d_vendorarch="$define"
6996fi
b4eb6b3d
JH
6997
6998: Final catch-all directories to search
6999$cat <<EOM
7000
7001Lastly, you can have perl look in other directories for extensions and
7002modules in addition to those already specified.
7003These directories will be searched after
7004 $sitearch
7005 $sitelib
7006EOM
7007test X"$vendorlib" != "X" && echo ' ' $vendorlib
7008test X"$vendorarch" != "X" && echo ' ' $vendorarch
7009echo ' '
7010case "$otherlibdirs" in
7011''|' ') dflt='none' ;;
7012*) dflt="$otherlibdirs" ;;
7013esac
7014$cat <<EOM
7015Enter a colon-separated set of extra paths to include in perl's @INC
7016search path, or enter 'none' for no extra paths.
7017
7018EOM
7019
7020rp='Colon-separated list of additional directories for perl to search?'
7021. ./myread
7022case "$ans" in
7023' '|''|none) otherlibdirs=' ' ;;
7024*) otherlibdirs="$ans" ;;
7025esac
7026case "$otherlibdirs" in
7027' ') val=$undef ;;
7028*) val=$define ;;
7029esac
7030set d_perl_otherlibdirs
7031eval $setvar
7032
7033: Cruising for prototypes
7034echo " "
7035echo "Checking out function prototypes..." >&4
55954f19
JH
7036$cat >prototype.c <<EOCP
7037#$i_stdlib I_STDLIB
7038#ifdef I_STDLIB
7039#include <stdlib.h>
7040#endif
b4eb6b3d
JH
7041int main(int argc, char *argv[]) {
7042 exit(0);}
7043EOCP
7044if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7045 echo "Your C compiler appears to support function prototypes."
7046 val="$define"
7047else
7048 echo "Your C compiler doesn't seem to understand function prototypes."
7049 val="$undef"
7050fi
7051set prototype
7052eval $setvar
7053$rm -f prototype*
7054
613d6c3e 7055: Check if ansi2knr is required
b4eb6b3d
JH
7056case "$prototype" in
7057"$define") ;;
7058*) ansi2knr='ansi2knr'
7059 echo " "
7060 cat <<EOM >&4
7061
7062$me: FATAL ERROR:
7063This version of $package can only be compiled by a compiler that
7064understands function prototypes. Unfortunately, your C compiler
7065 $cc $ccflags
7066doesn't seem to understand them. Sorry about that.
7067
7068If GNU cc is available for your system, perhaps you could try that instead.
7069
7070Eventually, we hope to support building Perl with pre-ANSI compilers.
7071If you would like to help in that effort, please contact <perlbug@perl.org>.
7072
7073Aborting Configure now.
7074EOM
7075 exit 2
7076 ;;
7077esac
7078
34f1896b
MB
7079: DTrace support
7080dflt_dtrace='/usr/sbin/dtrace'
6e3b7bfa
MB
7081$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7082
34f1896b
MB
7083cat <<EOM
7084
7085Perl can be built to support DTrace on platforms that support it.
7086DTrace is a diagnosis and performance analysis tool from Sun.
7087
7088If this doesn't make any sense to you, just accept the default '$dflt'.
7089EOM
7090
7091while $test 1 ; do
7092 case "$usedtrace" in
7093 $define|true|[yY]*)
7094 dflt='y'
7095 ;;
7096 ?*)
7097 dflt='y'
7098 dflt_dtrace=$usedtrace
7099 ;;
7100 *)
7101 dflt='n'
7102 ;;
7103 esac
7104
7105 rp='Support DTrace if available?'
7106 . ./myread
7107 case "$ans" in
7108 y|Y) val="$define" ;;
7109 *) val="$undef" ;;
7110 esac
7111 set usedtrace
7112 eval $setvar
7113
7114 test "X$usedtrace" != "X$define" && break
7115
7116 echo " "
7117 rp='Where is the dtrace executable?'
7118 dflt=$dflt_dtrace
7119 . ./getfile
7120 val="$ans"
7121 set dtrace
7122 eval $setvar
7123
7124 if $test -f $dtrace
7125 then
7126 if $dtrace -h -s ../perldtrace.d \
7127 -o perldtrace.tmp >/dev/null 2>&1 \
7128 && rm -f perldtrace.tmp
7129 then
7130 echo " "
7131 echo "Good: your $dtrace knows about the -h flag."
7132 else
7133 cat >&2 <<EOM
7134
7135*** $me: Fatal Error: $dtrace doesn't support -h flag
7136***
7137*** Your installed dtrace doesn't support the -h switch to compile a D
7138*** program into a C header. Can't continue.
7139
7140EOM
7141 exit 1
7142 fi
7143 break;
7144 fi
7145
7146 case "$fastread" in
7147 yes)
7148 cat >&2 <<EOM
7149
7150*** $me: Fatal Error: $dtrace not found.
7151*** Can't continue.
7152
7153EOM
7154 exit 1
7155 ;;
7156 *)
7157 echo "*** $dtrace was not found."
7158 echo " "
7159 ;;
7160 esac
7161done
7162
613d6c3e 7163: See if we want extra modules installed
6fcddf3b 7164echo " "
6fcddf3b 7165case "$extras" in
bf35c3f6
JH
7166'') dflt='n';;
7167*) dflt='y';;
6fcddf3b
JH
7168esac
7169cat <<EOM
7170Perl can be built with extra modules or bundles of modules which
7171will be fetched from the CPAN and installed alongside Perl.
7172
7173Notice that you will need access to the CPAN; either via the Internet,
7174or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7175be asked later to configure the CPAN.pm module which will in turn do
7176the installation of the rest of the extra modules or bundles.)
7177
7178Notice also that if the modules require any external software such as
dd2de242
JH
7179libraries and headers (the libz library and the zlib.h header for the
7180Compress::Zlib module, for example) you MUST have any such software
7181already installed, this configuration process will NOT install such
7182things for you.
6fcddf3b
JH
7183
7184If this doesn't make any sense to you, just accept the default '$dflt'.
7185EOM
dd2de242 7186rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7187. ./myread
7188case "$ans" in
7189y|Y)
7190 cat <<EOM
7191
7192Please list any extra modules or bundles to be installed from CPAN,
7193with spaces between the names. The names can be in any format the
dd2de242
JH
7194'install' command of CPAN.pm will understand. (Answer 'none',
7195without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7196EOM
7197 rp='Extras?'
7198 dflt="$extras"
7199 . ./myread
7200 extras="$ans"
7201esac
7202case "$extras" in
7203''|'none')
7204 val=''
7205 $rm -f ../extras.lst
7206 ;;
7207*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7208 echo "$extras" > ../extras.lst
7209 val="'$extras'"
6fcddf3b
JH
7210 ;;
7211esac
7212set extras
7213eval $setvar
7214echo " "
7215
6e1038e0
MB
7216: determine where html pages for programs go
7217set html1dir html1dir none
7218eval $prefixit
7219$cat <<EOM
7220
f3f1a2d8 7221If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7222the appropriate directory here. To skip installing html files,
7223answer "none".
7224EOM
7225case "$html1dir" in
7226''|none|$undef|' ') dflt=none ;;
7227*) dflt=$html1dir ;;
7228esac
7229fn=dn+~
7230rp="Directory for the main $spackage html pages?"
7231. ./getfile
79522dd2
NC
7232prefixvar=html1dir
7233. ./setprefixvar
6e1038e0
MB
7234: Use ' ' for none so value is preserved next time through Configure
7235$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7236
7237: determine where html pages for libraries and modules go
7238set html3dir html3dir none
7239eval $prefixit
7240$cat <<EOM
7241
7242If you wish to install html files for modules associated with $spackage,
7243indicate the appropriate directory here. To skip installing html files,
7244answer "none".
7245EOM
7246: There is no obvious default. If they have specified html1dir, then
7247: try to key off that, possibly changing .../html1 into .../html3.
7248case "$html3dir" in
7249'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7250*) dflt=$html3dir ;;
7251esac
7252fn=dn+~
7253rp="Directory for the $spackage module html pages?"
7254. ./getfile
79522dd2
NC
7255prefixvar=html3dir
7256. ./setprefixvar
6e1038e0
MB
7257: Use ' ' for none so value is preserved next time through Configure
7258$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7259
89ce900e
JH
7260: determine whether to install perl also as /usr/bin/perl
7261
7262echo " "
7263if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7264 $cat <<EOM
7265Many scripts expect perl to be installed as /usr/bin/perl.
7266
7267If you want to, I can install the perl you are about to compile
7268as /usr/bin/perl (in addition to $bin/perl).
7269EOM
7270 if test -f /usr/bin/perl; then
7271 $cat <<EOM
7272
7273However, please note that because you already have a /usr/bin/perl,
7274overwriting that with a new Perl would very probably cause problems.
7275Therefore I'm assuming you don't want to do that (unless you insist).
7276
7277EOM
7278 case "$installusrbinperl" in
7279 "$define"|[yY]*) dflt='y';;
7280 *) dflt='n';;
7281 esac
7282 else
7283 $cat <<EOM
7284
7285Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7286
7287EOM
7288 case "$installusrbinperl" in
7289 "$undef"|[nN]*) dflt='n';;
7290 *) dflt='y';;
7291 esac
7292 fi
7293 rp="Do you want to install perl as /usr/bin/perl?"
7294 . ./myread
7295 case "$ans" in
7296 [yY]*) val="$define";;
7297 *) val="$undef" ;;
7298 esac
7299else
7300 val="$undef"
7301fi
7302set installusrbinperl
7303eval $setvar
7304
613d6c3e 7305: Check if we are using the GNU C library
89ce900e
JH
7306echo " "
7307echo "Checking for GNU C Library..." >&4
7308cat >try.c <<'EOCP'
7309/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7310 alone are insufficient to distinguish different versions, such as
7311 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7312 libc version 2.1.0. A. Dougherty, June 3, 2002.
7313*/
7314#include <stdio.h>
7315int main(void)
7316{
7317#ifdef __GLIBC__
7318# ifdef __GLIBC_MINOR__
4fb7dc7d 7319# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7320# include <gnu/libc-version.h>
7321 printf("%s\n", gnu_get_libc_version());
7322# else
7323 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7324# endif
7325# else
7326 printf("%d\n", __GLIBC__);
7327# endif
7328 return 0;
7329#else
7330 return 1;
7331#endif
7332}
7333EOCP
7334set try
7335if eval $compile_ok && $run ./try > glibc.ver; then
7336 val="$define"
7337 gnulibc_version=`$cat glibc.ver`
7338 echo "You are using the GNU C Library version $gnulibc_version"
7339else
7340 val="$undef"
7341 gnulibc_version=''
7342 echo "You are not using the GNU C Library"
7343fi
5b813a60 7344$rm_try glibc.ver
89ce900e
JH
7345set d_gnulibc
7346eval $setvar
7347
7348: see if nm is to be used to determine whether a symbol is defined or not
7349case "$usenm" in
7350'')
7351 dflt=''
7352 case "$d_gnulibc" in
7353 "$define")
7354 echo " "
7355 echo "nm probably won't work on the GNU C Library." >&4
7356 dflt=n
7357 ;;
7358 esac
7359 case "$dflt" in
7360 '')
7361 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7362 echo " "
7363 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7364 echo "'nm' won't be sufficient on this sytem." >&4
7365 dflt=n
7366 fi
7367 ;;
7368 esac
7369 case "$dflt" in
7370 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7371 if $test $dflt -gt 20; then
7372 dflt=y
7373 else
7374 dflt=n
7375 fi
7376 ;;
7377 esac
b4eb6b3d 7378 ;;
89ce900e
JH
7379*)
7380 case "$usenm" in
7381 true|$define) dflt=y;;
7382 *) dflt=n;;
7383 esac
b4eb6b3d
JH
7384 ;;
7385esac
89ce900e 7386$cat <<EOM
b4eb6b3d 7387
89ce900e
JH
7388I can use $nm to extract the symbols from your C libraries. This
7389is a time consuming task which may generate huge output on the disk (up
7390to 3 megabytes) but that should make the symbols extraction faster. The
7391alternative is to skip the 'nm' extraction part and to compile a small
7392test program instead to determine whether each symbol is present. If
7393you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7394this may be the best solution.
b4eb6b3d 7395
89ce900e 7396You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7397
89ce900e
JH
7398EOM
7399rp="Shall I use $nm to extract C symbols from the libraries?"
7400. ./myread
7401case "$ans" in
7402[Nn]*) usenm=false;;
7403*) usenm=true;;
b4eb6b3d 7404esac
89ce900e
JH
7405
7406runnm=$usenm
7407case "$reuseval" in
7408true) runnm=false;;
b4eb6b3d 7409esac
b4eb6b3d 7410
89ce900e
JH
7411: nm options which may be necessary
7412case "$nm_opt" in
7413'') if $test -f /mach_boot; then
7414 nm_opt='' # Mach
7415 elif $test -d /usr/ccs/lib; then
7416 nm_opt='-p' # Solaris (and SunOS?)
7417 elif $test -f /dgux; then
7418 nm_opt='-p' # DG-UX
7419 elif $test -f /lib64/rld; then
7420 nm_opt='-p' # 64-bit Irix
7421 else
7422 nm_opt=''
7423 fi;;
7424esac
b4eb6b3d 7425
89ce900e
JH
7426: nm options which may be necessary for shared libraries but illegal
7427: for archive libraries. Thank you, Linux.
7428case "$nm_so_opt" in
7429'') case "$myuname" in
fb2e1bc0 7430 *linux*|gnu*)
89ce900e
JH
7431 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7432 nm_so_opt='--dynamic'
7433 fi
7434 ;;
7435 esac
7436 ;;
7437esac
b4eb6b3d 7438
1d8eaf8c 7439: Figure out where the libc is located
89ce900e
JH
7440case "$runnm" in
7441true)
1d8eaf8c 7442: get list of predefined functions in a handy place
89ce900e
JH
7443echo " "
7444case "$libc" in
7445'') libc=unknown
7446 case "$libs" in
7447 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7448 esac
7449 ;;
b4eb6b3d 7450esac
89ce900e
JH
7451case "$libs" in
7452'') ;;
7453*) for thislib in $libs; do
7454 case "$thislib" in
7455 -lc|-lc_s)
7456 : Handle C library specially below.
7457 ;;
7458 -l*)
7459 thislib=`echo $thislib | $sed -e 's/^-l//'`
7460 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7461 :
7462 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7463 :
7464 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7465 :
7466 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7467 :
7468 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7469 :
7470 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7471 :
7472 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7473 :
7474 else
7475 try=''
7476 fi
7477 libnames="$libnames $try"
7478 ;;
7479 *) libnames="$libnames $thislib" ;;
7480 esac
7481 done
b4eb6b3d
JH
7482 ;;
7483esac
89ce900e
JH
7484xxx=normal
7485case "$libc" in
7486unknown)
7487 set /lib/libc.$so
7488 for xxx in $libpth; do
7489 $test -r $1 || set $xxx/libc.$so
7490 : The messy sed command sorts on library version numbers.
7491 $test -r $1 || \
7492 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7493 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7494 h
7495 s/[0-9][0-9]*/0000&/g
7496 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7497 G
7498 s/\n/ /' | \
7499 $sort | $sed -e 's/^.* //'`
7500 eval set \$$#
7501 done
7502 $test -r $1 || set /usr/ccs/lib/libc.$so
7503 $test -r $1 || set /lib/libsys_s$_a
7504 ;;
7505*)
7506 set blurfl
7507 ;;
7508esac
7509if $test -r "$1"; then
7510 echo "Your (shared) C library seems to be in $1."
7511 libc="$1"
7512elif $test -r /lib/libc && $test -r /lib/clib; then
7513 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7514 xxx=apollo
7515 libc='/lib/clib /lib/libc'
7516 if $test -r /lib/syslib; then
7517 echo "(Your math library is in /lib/syslib.)"
7518 libc="$libc /lib/syslib"
7519 fi
7520elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7521 echo "Your C library seems to be in $libc, as you said before."
7522elif $test -r $incpath/usr/lib/libc$_a; then
7523 libc=$incpath/usr/lib/libc$_a;
7524 echo "Your C library seems to be in $libc. That's fine."
7525elif $test -r /lib/libc$_a; then
7526 libc=/lib/libc$_a;
7527 echo "Your C library seems to be in $libc. You're normal."
7528else
7529 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7530 :
7531 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7532 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7533 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7534 :
7535 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7536 :
7537 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7538 :
7539 else
7540 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7541 fi
7542 if $test -r "$tans"; then
7543 echo "Your C library seems to be in $tans, of all places."
7544 libc=$tans
7545 else
7546 libc='blurfl'
7547 fi
7548fi
7549if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7550 dflt="$libc"
7551 cat <<EOM
b4eb6b3d 7552
89ce900e
JH
7553If the guess above is wrong (which it might be if you're using a strange
7554compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7555
89ce900e
JH
7556EOM
7557else
7558 dflt=''
7559 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7560 cat >&4 <<EOM
7561I can't seem to find your C library. I've looked in the following places:
5e366f65 7562
b4eb6b3d 7563EOM
89ce900e
JH
7564 $sed 's/^/ /' libpath
7565 cat <<EOM
5e366f65 7566
89ce900e 7567None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7568
7569EOM
89ce900e
JH
7570fi
7571fn=f
7572rp='Where is your C library?'
7573. ./getfile
7574libc="$ans"
5e366f65 7575
89ce900e
JH
7576echo " "
7577echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7578set X `cat libnames`
7579shift
7580xxx=files
7581case $# in 1) xxx=file; esac
7582echo "Extracting names from the following $xxx for later perusal:" >&4
7583echo " "
7584$sed 's/^/ /' libnames >&4
7585echo " "
7586$echo $n "This may take a while...$c" >&4
5e366f65 7587
89ce900e
JH
7588for file in $*; do
7589 case $file in
7590 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7591 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7592 esac
89ce900e
JH
7593done >libc.tmp
7594
7595$echo $n ".$c"
7596$grep fprintf libc.tmp > libc.ptf
7597xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7598xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
9e08e8f0 7599xxx='[ADTSIWi]'
ab900c53 7600if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7601 eval $xscan;\
7602 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7603 eval $xrun
7604elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7605 eval $xscan;\
7606 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7607 eval $xrun
7608elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7609 eval $xscan;\
7610 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7611 eval $xrun
7612elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7613 eval $xscan;\
7614 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7615 eval $xrun
7616elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7617 eval $xscan;\
7618 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7619 eval $xrun
7620elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7621 eval $xscan;\
7622 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7623 eval $xrun
7624elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7625 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7626 eval $xscan;\
7627 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7628 eval $xrun
7629elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7630 eval $xscan;\
7631 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7632 eval $xrun
7633elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7634 eval $xscan;\
7635 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7636 eval $xrun
7637elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7638 eval $xscan;\
7639 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7640 eval $xrun
7641elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7642 eval $xscan;\
7643 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7644 eval $xrun
7645elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7646 eval $xscan;\
7647 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7648 eval $xrun
7649elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7650 eval $xscan;\
7651 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7652 eval $xrun
7653elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7654 eval $xscan;\
7655 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656 eval $xrun
b4eb6b3d 7657else
89ce900e
JH
7658 $nm -p $* 2>/dev/null >libc.tmp
7659 $grep fprintf libc.tmp > libc.ptf
7660 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7661 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7662 then
7663 nm_opt='-p'
7664 eval $xrun
7665 else
7666 echo " "
7667 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7668 com=''
1d8eaf8c
MB
7669 if $ar t $libc > libc.tmp && \
7670 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7671 then
89ce900e
JH
7672 for thisname in $libnames $libc; do
7673 $ar t $thisname >>libc.tmp
7674 done
7675 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7676 echo "Ok." >&4
7677 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
89ce900e
JH
7678 for thisname in $libnames $libc; do
7679 $ar tv $thisname >>libc.tmp
89ce900e
JH
7680 emximp -o tmp.imp $thisname \
7681 2>/dev/null && \
7682 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7683 < tmp.imp >>libc.tmp
1d8eaf8c 7684 $rm -f tmp.imp
89ce900e
JH
7685 done
7686 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7687 echo "Ok." >&4
7688 else
7689 echo "$ar didn't seem to work right." >&4
7690 echo "Maybe this is a Cray...trying bld instead..." >&4
1d8eaf8c
MB
7691 if bld t $libc | \
7692 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7693 $test -s libc.list
89ce900e
JH
7694 then
7695 for thisname in $libnames; do
7696 bld t $libnames | \
7697 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7698 $ar t $thisname >>libc.tmp
7699 done
7700 echo "Ok." >&4
7701 else
7702 echo "That didn't work either. Giving up." >&4
7703 exit 1
7704 fi
7705 fi
7706 fi
b4eb6b3d 7707fi
89ce900e
JH
7708nm_extract="$com"
7709case "$PASE" in
7710define)
7711 echo " "
7712 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7713 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7714 ;;
7715*) if $test -f /lib/syscalls.exp; then
7716 echo " "
7717 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
1d8eaf8c
MB
7718 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7719 /lib/syscalls.exp >>libc.list
89ce900e
JH
7720 fi
7721 ;;
7722esac
7723;;
7724esac
7725$rm -f libnames libpath
b4eb6b3d
JH
7726
7727: see if dld is available
7728set dld.h i_dld
7729eval $inhdr
7730
613d6c3e 7731: Check if we are using C++
43dddb59
MB
7732echo " "
7733echo "Checking for C++..." >&4
20e87299 7734$cat >try.c <<'EOCP'
43dddb59
MB
7735#include <stdio.h>
7736int main(void)
7737{
7738#ifdef __cplusplus
20e87299 7739 return 0;
43dddb59 7740#else
20e87299 7741 return 1;
43dddb59 7742#endif
43dddb59
MB
7743}
7744EOCP
7745set try
20e87299
AD
7746if eval $compile_ok && $run ./try; then
7747 val="$define"
43dddb59
MB
7748 echo "You are using a C++ compiler."
7749else
7750 val="$undef"
7751 echo "You are not using a C++ compiler."
7752fi
5b813a60 7753$rm_try cplusplus$$
43dddb59
MB
7754set d_cplusplus
7755eval $setvar
7756
89ce900e
JH
7757: is a C symbol defined?
7758csym='tlook=$1;
7759case "$3" in
373dfab3
JH
7760-v) tf=libc.tmp; tdc="";;
7761-a) tf=libc.tmp; tdc="[]";;
7762*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e 7763esac;
61c26d18
MHM
7764case "$d_cplusplus" in
7765 $define) extern_C="extern \"C\"" ;;
7766 *) extern_C="extern" ;;
7767esac;
89ce900e
JH
7768tx=yes;
7769case "$reuseval-$4" in
7770true-) ;;
7771true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7772esac;
7773case "$tx" in
7774yes)
43dddb59 7775 tval=false;
5129fff4
JH
7776 if $test "$runnm" = true; then
7777 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7778 tval=true;
5129fff4 7779 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
9945eb56 7780 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7781 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7782 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7783 $rm_try;
89ce900e 7784 fi;
5129fff4 7785 else
9945eb56 7786 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7787 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5b813a60 7788 $rm_try;
ab900c53
AB
7789 fi;
7790 ;;
89ce900e
JH
7791*)
7792 case "$tval" in
7793 $define) tval=true;;
7794 *) tval=false;;
ab900c53
AB
7795 esac;
7796 ;;
89ce900e
JH
7797esac;
7798eval "$2=$tval"'
7799
7800: define an is-in-libc? function
7801inlibc='echo " "; td=$define; tu=$undef;
7802sym=$1; var=$2; eval "was=\$$2";
7803tx=yes;
7804case "$reuseval$was" in
7805true) ;;
7806true*) tx=no;;
7807esac;
7808case "$tx" in
7809yes)
7810 set $sym tres -f;
7811 eval $csym;
7812 case "$tres" in
7813 true)
7814 echo "$sym() found." >&4;
7815 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7816 *)
7817 echo "$sym() NOT found." >&4;
7818 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7819 esac;;
7820*)
7821 case "$was" in
7822 $define) echo "$sym() found." >&4;;
7823 *) echo "$sym() NOT found." >&4;;
7824 esac;;
7825esac'
7826
b4eb6b3d
JH
7827: see if dlopen exists
7828xxx_runnm="$runnm"
666ea192 7829xxx_ccflags="$ccflags"
b4eb6b3d 7830runnm=false
666ea192
JH
7831: with g++ one needs -shared to get is-in-libc to work for dlopen
7832case "$gccversion" in
7833'') ;;
7834*) case "$d_cplusplus" in
7835 "$define") ccflags="$ccflags -shared" ;;
7836 esac
7837 ;;
7838esac
b4eb6b3d
JH
7839set dlopen d_dlopen
7840eval $inlibc
7841runnm="$xxx_runnm"
666ea192 7842ccflags="$xxx_ccflags"
b4eb6b3d 7843
4fb7dc7d
JH
7844: see if this is a unistd.h system
7845set unistd.h i_unistd
7846eval $inhdr
7847
b4eb6b3d
JH
7848: determine which dynamic loading, if any, to compile in
7849echo " "
7850dldir="ext/DynaLoader"
7851case "$usedl" in
7852$define|y|true)
7853 dflt='y'
7854 usedl="$define"
7855 ;;
7856$undef|n|false)
7857 dflt='n'
7858 usedl="$undef"
7859 ;;
5b813a60 7860*)
b4eb6b3d
JH
7861 dflt='n'
7862 case "$d_dlopen" in
7863 $define) dflt='y' ;;
7864 esac
7865 case "$i_dld" in
7866 $define) dflt='y' ;;
7867 esac
7868 : Does a dl_xxx.xs file exist for this operating system
7869 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7870 ;;
7871esac
7872rp="Do you wish to use dynamic loading?"
7873. ./myread
7874usedl="$ans"
f1ce3bf1 7875bin_ELF="$undef"
b4eb6b3d
JH
7876case "$ans" in
7877y*) usedl="$define"
7878 case "$dlsrc" in
7879 '')
7880 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7881 dflt="$dldir/dl_${osname}.xs"
7882 elif $test "$d_dlopen" = "$define" ; then
7883 dflt="$dldir/dl_dlopen.xs"
7884 elif $test "$i_dld" = "$define" ; then
7885 dflt="$dldir/dl_dld.xs"
7886 else
7887 dflt=''
7888 fi
7889 ;;
7890 *) dflt="$dldir/$dlsrc"
7891 ;;
7892 esac
7893 echo "The following dynamic loading files are available:"
7894 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7895 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7896 rp="Source file to use for dynamic loading"
7897 fn="fne"
7898 gfpth="$src"
7899 . ./getfile
7900 usedl="$define"
7901 : emulate basename
7902 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7903
7904 $cat << EOM
7905
7906Some systems may require passing special flags to $cc -c to
7907compile modules that will be used to create a shared library.
7908To use no flags, say "none".
7909
7910EOM
7911 case "$cccdlflags" in
7912 '') case "$gccversion" in
7913 '') case "$osname" in
7914 hpux) dflt='+z' ;;
7915 next) dflt='none' ;;
7916 irix*) dflt='-KPIC' ;;
48bcfe03 7917 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7918 sunos) dflt='-pic' ;;
7919 *) dflt='none' ;;
7920 esac
7921 ;;
7922 *) case "$osname" in
b6cc0f4c 7923 darwin) dflt='none' ;;
15fcae63 7924 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7925 *) dflt='-fpic' ;;
7926 esac ;;
7927 esac ;;
7928 ' ') dflt='none' ;;
7929 *) dflt="$cccdlflags" ;;
7930 esac
7931 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7932 . ./myread
7933 case "$ans" in
7934 none) cccdlflags=' ' ;;
7935 *) cccdlflags="$ans" ;;
7936 esac
7937
7938 cat << EOM
7939
7940Some systems use ld to create libraries that can be dynamically loaded,
7941while other systems (such as those using ELF) use $cc.
7942
7943EOM
7944 case "$ld" in
55954f19 7945 '') $cat >try.c <<EOM
b4eb6b3d
JH
7946/* Test for whether ELF binaries are produced */
7947#include <fcntl.h>
55954f19
JH
7948#$i_stdlib I_STDLIB
7949#ifdef I_STDLIB
b4eb6b3d 7950#include <stdlib.h>
55954f19 7951#endif
4fb7dc7d
JH
7952#$i_unistd I_UNISTD
7953#ifdef I_UNISTD
7954#include <unistd.h>
7955#endif
b4eb6b3d
JH
7956int main() {
7957 char b[4];
7958 int i = open("a.out",O_RDONLY);
5b813a60 7959 if(i == -1)
b4eb6b3d
JH
7960 exit(1); /* fail */
7961 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7962 exit(0); /* succeed (yes, it's ELF) */
7963 else
7964 exit(1); /* fail */
7965}
7966EOM
5440bc8e 7967 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7968 cat <<EOM
7969You appear to have ELF support. I'll use $cc to build dynamic libraries.
7970EOM
7971 dflt="$cc"
f1ce3bf1 7972 bin_ELF="$define"
b4eb6b3d
JH
7973 else
7974 echo "I'll use ld to build dynamic libraries."
7975 dflt='ld'
7976 fi
5b813a60 7977 $rm_try
b4eb6b3d
JH
7978 ;;
7979 *) dflt="$ld"
7980 ;;
7981 esac
7982
7983 rp="What command should be used to create dynamic libraries?"
7984 . ./myread
7985 ld="$ans"
7986
7987 cat << EOM
7988
7989Some systems may require passing special flags to $ld to create a
7990library that can be dynamically loaded. If your ld flags include
7991-L/other/path options to locate libraries outside your loader's normal
7992search path, you may need to specify those -L options here as well. To
7993use no flags, say "none".
7994
7995EOM
7996 case "$lddlflags" in
7997 '') case "$osname" in
7998 beos) dflt='-nostart' ;;
df00ff3b 7999 haiku) dflt='-shared' ;;
b4eb6b3d
JH
8000 hpux) dflt='-b';
8001 case "$gccversion" in
8002 '') dflt="$dflt +vnocompatwarnings" ;;
8003 esac
5b813a60 8004 ;;
15fcae63 8005 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
8006 next) dflt='none' ;;
8007 solaris) dflt='-G' ;;
8008 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 8009 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
8010 *) dflt='none' ;;
8011 esac
8012 ;;
8013 *) dflt="$lddlflags" ;;
8014 esac
8015
8016 : Try to guess additional flags to pick up local libraries.
8017 : Be careful not to append to a plain 'none'
8018 case "$dflt" in
8019 none) dflt='' ;;
8020 esac
8021 for thisflag in $ldflags; do
8022 case "$thisflag" in
b5b9f165 8023 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
8024 case " $dflt " in
8025 *" $thisflag "*) ;;
8026 *) dflt="$dflt $thisflag" ;;
8027 esac
8028 ;;
8029 esac
8030 done
8031
8032 case "$dflt" in
8033 ''|' ') dflt='none' ;;
8034 esac
8035
8f68b0e6
AD
8036 case "$ldflags" in
8037 *-fstack-protector*)
8038 case "$dflt" in
8039 *-fstack-protector*) ;; # Don't add it again
8040 *) dflt="$dflt -fstack-protector" ;;
8041 esac
8042 ;;
8043 esac
8044
8045
b4eb6b3d
JH
8046 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8047 . ./myread
8048 case "$ans" in
8049 none) lddlflags=' ' ;;
8050 *) lddlflags="$ans" ;;
8051 esac
8052
8053 cat <<EOM
8054
8055Some systems may require passing special flags to $cc to indicate that
8056the resulting executable will use dynamic linking. To use no flags,
8057say "none".
8058
8059EOM
8060 case "$ccdlflags" in
8061 '') case "$osname" in
fb2e1bc0 8062 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
8063 next|sunos) dflt='none' ;;
8064 *) dflt='none' ;;
b4eb6b3d
JH
8065 esac ;;
8066 ' ') dflt='none' ;;
8067 *) dflt="$ccdlflags" ;;
8068 esac
8069 rp="Any special flags to pass to $cc to use dynamic linking?"
8070 . ./myread
8071 case "$ans" in
8072 none) ccdlflags=' ' ;;
8073 *) ccdlflags="$ans" ;;
8074 esac
8075 ;;
8076*) usedl="$undef"
8077 ld='ld'
8078 dlsrc='dl_none.xs'
8079 lddlflags=''
8080 ccdlflags=''
8081 ;;
8082esac
8083
34f1896b 8084: Do we want a shared libperl?
b4eb6b3d
JH
8085also=''
8086case "$usedl" in
8087$undef)
8088 # No dynamic loading being used, so don't bother even to prompt.
8089 useshrplib='false'
8090 ;;
8091*) case "$useshrplib" in
8092 '') case "$osname" in
df00ff3b 8093 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
b4eb6b3d
JH
8094 dflt=y
8095 also='Building a shared libperl is required for dynamic loading to work on your system.'
8096 ;;
8097 next*)
8098 case "$osvers" in
8099 4*) dflt=y
8100 also='Building a shared libperl is needed for MAB support.'
8101 ;;
8102 *) dflt=n
8103 ;;
8104 esac
8105 ;;
8106 *) dflt=n
8107 ;;
8108 esac
8109 ;;
8110 $define|true|[Yy]*)
8111 dflt=y
8112 ;;
8113 *) dflt=n
8114 ;;
8115 esac
8116 $cat << EOM
8117
8118The perl executable is normally obtained by linking perlmain.c with
8119libperl${_a}, any static extensions (usually just DynaLoader), and
8120any other libraries needed on this system (such as -lm, etc.). Since
8121your system supports dynamic loading, it is probably possible to build
8122a shared libperl.$so. If you will have more than one executable linked
8123to libperl.$so, this will significantly reduce the size of each
5cadb3f3 8124executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
8125default is probably sensible for your system.
8126$also
8127
8128EOM
8129 rp="Build a shared libperl.$so (y/n)"
8130 . ./myread
8131 case "$ans" in
8132 true|$define|[Yy]*)
8133 useshrplib='true' ;;
8134 *) useshrplib='false' ;;
8135 esac
8136 ;;
8137esac
8138
8139case "$useshrplib" in
8140true)
df31f9b1
MB
8141 case "$userelocatableinc" in
8142 true|define)
8143 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8144 echo "See INSTALL for an explanation why that won't work." >&4
8145 exit 4
8146 ;;
8147 esac
b4eb6b3d
JH
8148 case "$libperl" in
8149 '')
8150 # Figure out a good name for libperl.so. Since it gets stored in
8151 # a version-specific architecture-dependent library, the version
8152 # number isn't really that important, except for making cc/ld happy.
8153 #
56e771c1 8154 # A name such as libperl.so.10.1
b4eb6b3d 8155 majmin="libperl.$so.$patchlevel.$subversion"
56e771c1 8156 # A name such as libperl.so.100
b4eb6b3d
JH
8157 majonly=`echo $patchlevel $subversion |
8158 $awk '{printf "%d%02d", $1, $2}'`
8159 majonly=libperl.$so.$majonly
8160 # I'd prefer to keep the os-specific stuff here to a minimum, and
8161 # rely on figuring it out from the naming of libc.
8162 case "${osname}${osvers}" in
8163 next4*)
8164 dflt=libperl.5.$so
8165 # XXX How handle the --version stuff for MAB?
8166 ;;
fb2e1bc0 8167 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8168 dflt=libperl.$so
8169 ;;
56e771c1
RU
8170 cygwin*) # ld links now against the dll directly
8171 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8172 majonly=`echo $patchlevel $subversion |
8173 $awk '{printf "%03d%03d", $1, $2}'`
8174 majonly=cygperl5.$majonly.$so
8175 dflt=$majmin
b4eb6b3d
JH
8176 ;;
8177 *) # Try to guess based on whether libc has major.minor.
8178 case "$libc" in
8179 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8180 *libc.$so.[0-9]*) dflt=$majonly ;;
8181 *) dflt=libperl.$so ;;
8182 esac
8183 ;;
8184 esac
8185 ;;
8186 *) dflt=$libperl
8187 ;;
8188 esac
8189 cat << EOM
8190
8191I need to select a good name for the shared libperl. If your system uses
8192library names with major and minor numbers, then you might want something
8193like $majmin. Alternatively, if your system uses a single version
8194number for shared libraries, then you might want to use $majonly.
8195Or, your system might be quite happy with a simple libperl.$so.
8196
8197Since the shared libperl will get installed into a version-specific
8198architecture-dependent directory, the version number of the shared perl
8199library probably isn't important, so the default should be o.k.
8200
8201EOM
8202 rp='What name do you want to give to the shared libperl?'
8203 . ./myread
8204 libperl=$ans
8205 echo "Ok, I'll use $libperl"
8206 ;;
8207*)
8208 libperl="libperl${_a}"
8209 ;;
8210esac
8211
8212# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8213case "$shrpdir" in
8214'') ;;
8215*) $cat >&4 <<EOM
8216WARNING: Use of the shrpdir variable for the installation location of
8217the shared $libperl is not supported. It was never documented and
8218will not work in this version. Let me (perlbug@perl.org)
8219know of any problems this may cause.
8220
8221EOM
8222 case "$shrpdir" in
8223 "$archlibexp/CORE")
8224 $cat >&4 <<EOM
8225But your current setting of $shrpdir is
8226the default anyway, so it's harmless.
8227EOM
8228 ;;
8229 *)
8230 $cat >&4 <<EOM
8231Further, your current attempted setting of $shrpdir
8232conflicts with the value of $archlibexp/CORE
8233that installperl will use.
8234EOM
8235 ;;
8236 esac
8237 ;;
8238esac
8239
8240# How will the perl executable find the installed shared $libperl?
8241# Add $xxx to ccdlflags.
8242# If we can't figure out a command-line option, use $shrpenv to
8243# set env LD_RUN_PATH. The main perl makefile uses this.
8244shrpdir=$archlibexp/CORE
8245xxx=''
8246tmp_shrpenv=''
8247if "$useshrplib"; then
34f1896b 8248 case "$osname" in
b4eb6b3d
JH
8249 aix)
8250 # We'll set it in Makefile.SH...
8251 ;;
b5b9f165 8252 solaris)
b4eb6b3d
JH
8253 xxx="-R $shrpdir"
8254 ;;
c5f63f38 8255 freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8256 xxx="-Wl,-R$shrpdir"
8257 ;;
fb2e1bc0 8258 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8259 xxx="-Wl,-rpath,$shrpdir"
8260 ;;
8261 next)
8262 # next doesn't like the default...
8263 ;;
8264 beos)
8265 # beos doesn't like the default, either.
8266 ;;
df00ff3b
IW
8267 haiku)
8268 # Haiku doesn't like the default, either.
8269 ;;
b4eb6b3d
JH
8270 hpux*)
8271 # hpux doesn't like the default, either.
8272 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8273 ;;
56e771c1
RU
8274 cygwin)
8275 # cygwin needs only ldlibpth
8276 ;;
b4eb6b3d
JH
8277 *)
8278 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8279 ;;
8280 esac
8281 case "$xxx" in
8282 '') ;;
34f1896b 8283 *)
b4eb6b3d
JH
8284 # Only add $xxx if it isn't already in ccdlflags.
8285 case " $ccdlflags " in
8286 *" $xxx "*) ;;
8287 *) ccdlflags="$ccdlflags $xxx"
8288 cat <<EOM >&4
8289
8290Adding $xxx to the flags
34f1896b 8291passed to $ld so that the perl executable will find the
b4eb6b3d
JH
8292installed shared $libperl.
8293
8294EOM
8295 ;;
8296 esac
8297 ;;
8298 esac
8299fi
8300# Fix ccdlflags in AIX for building external extensions.
8301# (For building Perl itself bare -bE:perl.exp is needed,
8302# Makefile.SH takes care of this.)
8303case "$osname" in
8304aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8305esac
8306# Respect a hint or command-line value.
8307case "$shrpenv" in
8308'') shrpenv="$tmp_shrpenv" ;;
8309esac
8310case "$ldlibpthname" in
8311'') ldlibpthname=LD_LIBRARY_PATH ;;
8312none) ldlibpthname='' ;;
8313esac
8314
8315: determine where manual pages are on this system
8316echo " "
8317case "$sysman" in
8318'')
4a0a3829
SD
8319 syspath='/usr/share/man/man1 /usr/man/man1'
8320 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8321 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8322 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8323 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8324 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8325 sysman=`./loc . /usr/man/man1 $syspath`
8326 ;;
8327esac
8328if $test -d "$sysman"; then
8329 echo "System manual is in $sysman." >&4
8330else
8331 echo "Could not find manual pages in source form." >&4
8332fi
8333
8334: determine where manual pages go
8335set man1dir man1dir none
8336eval $prefixit
8337$cat <<EOM
8338
8339$spackage has manual pages available in source form.
8340EOM
8341case "$nroff" in
8342nroff)
8343 echo "However, you don't have nroff, so they're probably useless to you."
8344 case "$man1dir" in
8345 '') man1dir="none";;
8346 esac;;
8347esac
8348echo "If you don't want the manual sources installed, answer 'none'."
8349case "$man1dir" in
8350' ') dflt=none
8351 ;;
8352'')
4a0a3829
SD
8353 lookpath="$prefixexp/share/man/man1"
8354 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8355 lookpath="$lookpath $prefixexp/man/p_man/man1"
8356 lookpath="$lookpath $prefixexp/man/u_man/man1"
8357 lookpath="$lookpath $prefixexp/man/man.1"
8358 case "$sysman" in
8359 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8360 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8361 esac
8362 set dflt
8363 eval $prefixup
8364 ;;
8365*) dflt="$man1dir"
8366 ;;
8367esac
8368echo " "
8369fn=dn+~
8370rp="Where do the main $spackage manual pages (source) go?"
8371. ./getfile
8372if $test "X$man1direxp" != "X$ansexp"; then
8373 installman1dir=''
8374fi
79522dd2
NC
8375prefixvar=man1dir
8376. ./setprefixvar
8377
477140ee
NC
8378case "$man1dir" in
8379'') man1dir=' '
8380 installman1dir='';;
8381esac
b4eb6b3d
JH
8382
8383: What suffix to use on installed man pages
8384
8385case "$man1dir" in
8386' ')
8387 man1ext='0'
8388 ;;
8389*)
8390 rp="What suffix should be used for the main $spackage man pages?"
8391 case "$man1ext" in
8392 '') case "$man1dir" in
8393 *1) dflt=1 ;;
8394 *1p) dflt=1p ;;
8395 *1pm) dflt=1pm ;;
8396 *l) dflt=l;;
8397 *n) dflt=n;;
8398 *o) dflt=o;;
8399 *p) dflt=p;;
8400 *C) dflt=C;;
8401 *L) dflt=L;;
8402 *L1) dflt=L1;;
8403 *) dflt=1;;
8404 esac
8405 ;;
8406 *) dflt="$man1ext";;
8407 esac
8408 . ./myread
8409 man1ext="$ans"
8410 ;;
8411esac
8412
8413: see if we can have long filenames
8414echo " "
8415first=123456789abcdef
8416$rm -f $first
8417if (echo hi >$first) 2>/dev/null; then
8418 if $test -f 123456789abcde; then
8419 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8420 val="$undef"
8421 else
8422 echo 'You can have filenames longer than 14 characters.'>&4
8423 val="$define"
8424 fi
8425else
8426 $cat <<'EOM'
8427You can't have filenames longer than 14 chars.
8428You can't even think about them!
8429EOM
8430 val="$undef"
776a38e3 8431fi
b4eb6b3d
JH
8432set d_flexfnam
8433eval $setvar
8434$rm -rf 123456789abcde*
8435
8436: determine where library module manual pages go
8437set man3dir man3dir none
8438eval $prefixit
8439$cat <<EOM
8440
8441$spackage has manual pages for many of the library modules.
8442EOM
8443
8444case "$nroff" in
8445nroff)
8446 $cat <<'EOM'
8447However, you don't have nroff, so they're probably useless to you.
8448EOM
8449 case "$man3dir" in
8450 '') man3dir="none";;
8451 esac;;
8452esac
8453
8454case "$d_flexfnam" in
8455undef)
8456 $cat <<'EOM'
f3f1a2d8 8457However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8458EOM
8459 case "$man3dir" in
8460 '') man3dir="none";;
8461 esac;;
8462esac
8463
8464echo "If you don't want the manual sources installed, answer 'none'."
8465prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8466case "$man3dir" in
8467'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8468 if $test -d "$privlib/man/man3"; then
8469 cat <<EOM >&4
8470
8471WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8472$privlib/man/man3. This version will suggest a
8473new default of $dflt.
b4eb6b3d
JH
8474EOM
8475 tdflt=$dflt
8476 dflt='n'
8477 rp='Do you wish to preserve the old behavior?(y/n)'
8478 . ./myread
8479 case "$ans" in
8480 y*) dflt="$privlib/man/man3" ;;
8481 *) dflt=$tdflt ;;
8482 esac
8483 fi
8484 ;;
8485*) dflt="$man3dir" ;;
8486esac
8487case "$dflt" in
8488' ') dflt=none ;;
8489esac
8490echo " "
8491fn=dn+~
8492rp="Where do the $package library man pages (source) go?"
8493. ./getfile
79522dd2
NC
8494prefixvar=man3dir
8495. ./setprefixvar
8496
477140ee
NC
8497case "$man3dir" in
8498'') man3dir=' '
8499 installman3dir='';;
8500esac
b4eb6b3d
JH
8501
8502: What suffix to use on installed man pages
8503case "$man3dir" in
8504' ')
8505 man3ext='0'
8506 ;;
8507*)
8508 rp="What suffix should be used for the $package library man pages?"
8509 case "$man3ext" in
8510 '') case "$man3dir" in
8511 *3) dflt=3 ;;
8512 *3p) dflt=3p ;;
8513 *3pm) dflt=3pm ;;
8514 *l) dflt=l;;
8515 *n) dflt=n;;
8516 *o) dflt=o;;
8517 *p) dflt=p;;
8518 *C) dflt=C;;
8519 *L) dflt=L;;
8520 *L3) dflt=L3;;
8521 *) dflt=3;;
8522 esac
8523 ;;
8524 *) dflt="$man3ext";;
8525 esac
8526 . ./myread
8527 man3ext="$ans"
8528 ;;
8529esac
8530
8531: see if we have to deal with yellow pages, now NIS.
0384a54a 8532if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8533 if $test -f /usr/etc/nibindd; then
8534 echo " "
8535 echo "I'm fairly confident you're on a NeXT."
8536 echo " "
8537 rp='Do you get the hosts file via NetInfo?'
8538 dflt=y
8539 case "$hostcat" in
8540 nidump*) ;;
8541 '') ;;
8542 *) dflt=n;;
8543 esac
8544 . ./myread
8545 case "$ans" in
8546 y*) hostcat='nidump hosts .';;
8547 *) case "$hostcat" in
8548 nidump*) hostcat='';;
8549 esac
8550 ;;
8551 esac
8552 fi
8553 case "$hostcat" in
8554 nidump*) ;;
8555 *)
8556 case "$hostcat" in
8557 *ypcat*) dflt=y;;
8558 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8559 dflt=y
8560 else
8561 dflt=n
8562 fi;;
8563 *) dflt=n;;
8564 esac
8565 echo " "
8566 rp='Are you getting the hosts file via yellow pages?'
8567 . ./myread
8568 case "$ans" in
8569 y*) hostcat='ypcat hosts';;
8570 *) hostcat='cat /etc/hosts';;
8571 esac
8572 ;;
8573 esac
8574fi
8575case "$hostcat" in
8576'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8577esac
8578case "$groupcat" in
8579'') test -f /etc/group && groupcat='cat /etc/group';;
8580esac
8581case "$passcat" in
8582'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8583esac
8584
8585: now get the host name
8586echo " "
8587echo "Figuring out host name..." >&4
8588case "$myhostname" in
8589'') cont=true
8590 echo 'Maybe "hostname" will work...'
73614538 8591 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8592 myhostname=$tans
8593 phostname=hostname
8594 cont=''
8595 fi
8596 ;;
8597*) cont='';;
8598esac
8599if $test "$cont"; then
8600 if ./xenix; then
8601 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8602 if tans=`cat /etc/systemid 2>&1` ; then
8603 myhostname=$tans
8604 phostname='cat /etc/systemid'
8605 echo "Whadyaknow. Xenix always was a bit strange..."
8606 cont=''
8607 fi
8608 elif $test -r /etc/systemid; then
8609 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8610 fi
8611fi
8612if $test "$cont"; then
8613 echo 'No, maybe "uuname -l" will work...'
73614538 8614 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8615 myhostname=$tans
8616 phostname='uuname -l'
8617 else
8618 echo 'Strange. Maybe "uname -n" will work...'
73614538 8619 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8620 myhostname=$tans
8621 phostname='uname -n'
8622 else
8623 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8624 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8625 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8626 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8627 else
8628 case "$myhostname" in
8629 '') echo "Does this machine have an identity crisis or something?"
8630 phostname='';;
8631 *)
8632 echo "Well, you said $myhostname before..."
8633 phostname='echo $myhostname';;
8634 esac
8635 fi
8636 fi
8637 fi
8638fi
52a549d0
JH
8639case "$myhostname" in
8640'') myhostname=noname ;;
8641esac
b4eb6b3d
JH
8642: you do not want to know about this
8643set $myhostname
8644myhostname=$1
8645
8646: verify guess
8647if $test "$myhostname" ; then
8648 dflt=y
8649 rp='Your host name appears to be "'$myhostname'".'" Right?"
8650 . ./myread
8651 case "$ans" in
8652 y*) ;;
8653 *) myhostname='';;
8654 esac
8655fi
8656
8657: bad guess or no guess
8658while $test "X$myhostname" = X ; do
8659 dflt=''
8660 rp="Please type the (one word) name of your host:"
8661 . ./myread
8662 myhostname="$ans"
8663done
8664
8665: translate upper to lower if necessary
8666case "$myhostname" in
8667*[A-Z]*)
8668 echo "(Normalizing case in your host name)"
8669 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8670 ;;
8671esac
8672
8673case "$myhostname" in
8674*.*)
8675 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8676 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8677 echo "(Trimming domain name from host name--host name is now $myhostname)"
8678 ;;
8679*) case "$mydomain" in
8680 '')
8681 {
8682 test "X$hostcat" = "Xypcat hosts" &&
8683 ypmatch "$myhostname" hosts 2>/dev/null |\
8684 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8685 $test -s hosts
8686 } || {
8687 test "X$hostcat" != "X" &&
8688 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8689 /[ ]$myhostname[ . ]/p" > hosts
8690 }
8691 tmp_re="[ . ]"
f08cbdd1
PP
8692 if $test -f hosts; then
8693 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8694 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8695 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8696 hosts | $sort | $uniq | \
8697 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8698 case `$echo X$dflt` in
8699 X*\ *) echo "(Several hosts in the database matched hostname)"
8700 dflt=.
8701 ;;
8702 X.) echo "(You do not have fully-qualified names in the hosts database)"
8703 ;;
8704 esac
8705 else
8706 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8707 dflt=.
f08cbdd1 8708 fi
b4eb6b3d
JH
8709 case "$dflt" in
8710 .)
8711 tans=`./loc resolv.conf X /etc /usr/etc`
8712 if $test -f "$tans"; then
8713 echo "(Attempting domain name extraction from $tans)"
8714 dflt=.`$sed -n -e 's/ / /g' \
8715 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
1d40d392 8716 -e 1q 2>/dev/null`
b4eb6b3d
JH
8717 case "$dflt" in
8718 .) dflt=.`$sed -n -e 's/ / /g' \
8719 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
1d40d392 8720 -e 1q 2>/dev/null`
b4eb6b3d
JH
8721 ;;
8722 esac
8723 fi
8724 ;;
8725 esac
8726 case "$dflt" in
8727 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8728 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8729 case "$dflt" in
8730 '') dflt='.';;
8731 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8732 esac
8733 ;;
8734 esac
59c9e5d6
PP
8735 case "$dflt$osname" in
8736 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8737 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8738 ;;
8739 esac
b4eb6b3d
JH
8740 case "$dflt" in
8741 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8742 dflt='.nonet'
b4eb6b3d
JH
8743 ;;
8744 esac
8745 $rm -f hosts
8746 ;;
8747 *) dflt="$mydomain";;
8748 esac;;
8749esac
8750echo " "
8751rp="What is your domain name?"
8752. ./myread
8753tans="$ans"
8754case "$ans" in
8755'') ;;
8756.*) ;;
8757*) tans=".$tans";;
8758esac
8759mydomain="$tans"
8760
8761: translate upper to lower if necessary
8762case "$mydomain" in
8763*[A-Z]*)
8764 echo "(Normalizing case in your domain name)"
8765 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8766 ;;
8767esac
8768
8769: a little sanity check here
8770case "$phostname" in
8771'') ;;
8772*)
8773 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8774 $myhostname$mydomain|$myhostname) ;;
8775 *)
8776 case "$phostname" in
8777 sed*)
8778 echo "(That doesn't agree with your whoami.h file, by the way.)"
8779 ;;
8780 *)
8781 echo "(That doesn't agree with your $phostname command, by the way.)"
8782 ;;
8783 esac
8784 ;;
8785 esac
8786 ;;
8787esac
8788
776a38e3 8789: determine the e-mail address of the user who is running us
b4eb6b3d
JH
8790$cat <<EOM
8791
8792I need to get your e-mail address in Internet format if possible, i.e.
8793something like user@host.domain. Please answer accurately since I have
8794no easy means to double check it. The default value provided below
8795is most probably close to reality but may not be valid from outside
8796your organization...
8797
8798EOM
8799cont=x
8800while test "$cont"; do
8801 case "$cf_email" in
8802 '') dflt="$cf_by@$myhostname$mydomain";;
8803 *) dflt="$cf_email";;
8804 esac
8805 rp='What is your e-mail address?'
8806 . ./myread
8807 cf_email="$ans"
8808 case "$cf_email" in
8809 *@*.*) cont='' ;;
8810 *)
8811 rp='Address does not look like an Internet one. Use it anyway?'
8812 case "$fastread" in
8813 yes) dflt=y ;;
8814 *) dflt=n ;;
8815 esac
8816 . ./myread
8817 case "$ans" in
8818 y*) cont='' ;;
8819 *) echo " " ;;
8820 esac
8821 ;;
8822 esac
8823done
8824
34f1896b 8825: Ask e-mail of administrator
b4eb6b3d
JH
8826$cat <<EOM
8827
8828If you or somebody else will be maintaining perl at your site, please
8829fill in the correct e-mail address here so that they may be contacted
8830if necessary. Currently, the "perlbug" program included with perl
8831will send mail to this address in addition to perlbug@perl.org. You may
8832enter "none" for no administrator.
8833
8834EOM
8835case "$perladmin" in
8836'') dflt="$cf_email";;
8837*) dflt="$perladmin";;
8838esac
8839rp='Perl administrator e-mail address'
8840. ./myread
8841perladmin="$ans"
8842
91f55cc7
MB
8843: determine whether to only install version-specific parts.
8844echo " "
8845$cat <<EOM
8846Do you want to install only the version-specific parts of the perl
8847distribution? Usually you do *not* want to do this.
8848EOM
8849case "$versiononly" in
8850"$define"|[Yy]*|true) dflt='y' ;;
8851*) dflt='n';
8852esac
8853rp="Do you want to install only the version-specific parts of perl?"
8854. ./myread
8855case "$ans" in
8856[yY]*) val="$define";;
8857*) val="$undef" ;;
8858esac
8859set versiononly
8860eval $setvar
8861
8862case "$versiononly" in
8863"$define") inc_version_list=''
8864 inc_version_list_init=0
8865 ;;
8866esac
8867
8868: figure out how to guarantee perl startup
8869: XXX Note that this currently takes advantage of the bug that binexp ignores
8870: the Configure -Dinstallprefix setting, which in turn means that under
8871: relocatable @INC, initialinstalllocation is what binexp started as.
8872case "$startperl" in
8873'')
8874 case "$sharpbang" in
8875 *!)
8876 $cat <<EOH
8877
8878I can use the #! construct to start perl on your system. This will
8879make startup of perl scripts faster, but may cause problems if you
8880want to share those scripts and perl is not in a standard place
8881($initialinstalllocation/perl) on all your platforms. The alternative
8882is to force a shell by starting the script with a single ':' character.
8883
8884EOH
8885 case "$versiononly" in
8886 "$define") dflt="$initialinstalllocation/perl$version";;
8887 *) dflt="$initialinstalllocation/perl";;
8888 esac
8889 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8890 . ./myread
8891 case "$ans" in
8892 none) startperl=": # use perl";;
8893 *) startperl="#!$ans"
8894 if $test 30 -lt `echo "$ans" | wc -c`; then
8895 $cat >&4 <<EOM
8896
8897WARNING: Some systems limit the #! command to 32 characters.
8898If you experience difficulty running Perl scripts with #!, try
8899installing Perl in a directory with a shorter pathname.
8900
8901EOM
8902 fi ;;
8903 esac
8904 ;;
8905 *) startperl=": # use perl"
8906 ;;
8907 esac
8908 ;;
8909esac
8910echo "I'll use $startperl to start perl scripts."
8911
8912: figure best path for perl in scripts
8913case "$perlpath" in
8914'')
8915 case "$versiononly" in
8916 "$define") perlpath="$initialinstalllocation/perl$version";;
8917 *) perlpath="$initialinstalllocation/perl";;
8918 esac
8919 case "$startperl" in
8920 *!*) ;;
8921 *)
8922 $cat <<EOH
8923
8924I will use the "eval 'exec'" idiom to start Perl on your system.
8925I can use the full path of your Perl binary for this purpose, but
8926doing so may cause problems if you want to share those scripts and
8927Perl is not always in a standard place ($initialinstalllocation/perl).
8928
8929EOH
8930 dflt="$initialinstalllocation/perl"
8931 rp="What path shall I use in \"eval 'exec'\"?"
8932 . ./myread
8933 perlpath="$ans"
8934 ;;
8935 esac
8936 ;;
8937esac
8938case "$startperl" in
8939*!*) ;;
8940*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8941esac
8942
b4eb6b3d
JH
8943: determine where public executable scripts go
8944set scriptdir scriptdir
8945eval $prefixit
8946case "$scriptdir" in
8947'')
8948 dflt="$bin"
8949 : guess some guesses
8950 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8951 $test -d /usr/share/bin && dflt=/usr/share/bin
8952 $test -d /usr/local/script && dflt=/usr/local/script
8953 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8954 $test -d $prefixexp/script && dflt=$prefixexp/script
8955 set dflt
8956 eval $prefixup
8957 ;;
8958*) dflt="$scriptdir"
8959 ;;
8960esac
8961$cat <<EOM
f3f1a2d8 8962
b4eb6b3d
JH
8963Some installations have a separate directory just for executable scripts so
8964that they can mount it across multiple architectures but keep the scripts in
8965one spot. You might, for example, have a subdirectory of /usr/share for this.
8966Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8967
b4eb6b3d
JH
8968EOM
8969fn=d~
8970rp='Where do you keep publicly executable scripts?'
8971. ./getfile
8972if $test "X$ansexp" != "X$scriptdirexp"; then
8973 installscript=''
8974fi
f3f1a2d8 8975installscriptdir=''
79522dd2
NC
8976prefixvar=scriptdir
8977. ./setprefixvar
8978: A little fix up for an irregularly named variable.
8979installscript="$installscriptdir"
8980
b4eb6b3d
JH
8981: determine where add-on public executables go
8982case "$sitebin" in
8983'') dflt=$siteprefix/bin ;;
8984*) dflt=$sitebin ;;
8985esac
8986fn=d~
8987rp='Pathname where the add-on public executables should be installed?'
8988. ./getfile
79522dd2
NC
8989prefixvar=sitebin
8990. ./setprefixvar
b4eb6b3d 8991
6e1038e0 8992: determine where add-on html pages go
8d2cbf27 8993: There is no standard location, so try to copy the previously-selected
6e1038e0 8994: directory structure for the core html pages.
8d2cbf27
JH
8995case "$sitehtml1dir" in
8996'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8997*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8998esac
8999case "$dflt" in
9000''|' ') dflt=none ;;
9001esac
9002fn=dn+~
9003rp='Pathname where the site-specific html pages should be installed?'
9004. ./getfile
79522dd2
NC
9005prefixvar=sitehtml1dir
9006. ./setprefixvar
6e1038e0
MB
9007
9008: determine where add-on library html pages go
9009: There is no standard location, so try to copy the previously-selected
9010: directory structure for the core html pages.
8d2cbf27
JH
9011case "$sitehtml3dir" in
9012'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9013*) dflt=$sitehtml3dir ;;
6e1038e0
MB
9014esac
9015case "$dflt" in
9016''|' ') dflt=none ;;
9017esac
9018fn=dn+~
9019rp='Pathname where the site-specific library html pages should be installed?'
9020. ./getfile
79522dd2
NC
9021prefixvar=sitehtml3dir
9022. ./setprefixvar
6e1038e0
MB
9023
9024: determine where add-on manual pages go
91e123a8
JH
9025case "$siteman1dir" in
9026'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9027*) dflt=$siteman1dir ;;
6e1038e0 9028esac
257059b5
JH
9029case "$dflt" in
9030''|' ') dflt=none ;;
9031esac
6e1038e0
MB
9032fn=dn+~
9033rp='Pathname where the site-specific manual pages should be installed?'
9034. ./getfile
79522dd2
NC
9035prefixvar=siteman1dir
9036. ./setprefixvar
6e1038e0
MB
9037
9038: determine where add-on library man pages go
91e123a8
JH
9039case "$siteman3dir" in
9040'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9041*) dflt=$siteman3dir ;;
6e1038e0 9042esac
257059b5
JH
9043case "$dflt" in
9044''|' ') dflt=none ;;
9045esac
6e1038e0
MB
9046fn=dn+~
9047rp='Pathname where the site-specific library manual pages should be installed?'
9048. ./getfile
79522dd2
NC
9049prefixvar=siteman3dir
9050. ./setprefixvar
6e1038e0
MB
9051
9052: determine where add-on public executable scripts go
9053case "$sitescript" in
9054'') dflt=$siteprefix/script
9055 $test -d $dflt || dflt=$sitebin ;;
9056*) dflt="$sitescript" ;;
9057esac
9058fn=d~+
9059rp='Pathname where add-on public executable scripts should be installed?'
9060. ./getfile
79522dd2
NC
9061prefixvar=sitescript
9062. ./setprefixvar
6e1038e0 9063
34f1896b 9064: Check if faststdio is requested and available
15b61c98
JH
9065case "$usefaststdio" in
9066$define|true|[yY]*|'')
9067 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9068 case "$xversion" in
9069 [68]) dflt='y' ;;
9070 *) dflt='n' ;;
9071 esac
9072 ;;
9073*) dflt='n';;
9074esac
9075cat <<EOM
9076
9077Perl can be built to use 'fast stdio', which means using the stdio
9078library but also directly manipulating the stdio buffers to enable
9079faster I/O. Using stdio is better for backward compatibility (especially
9080for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9081interface has been preferred instead of stdio.
9082
9083If this doesn't make any sense to you, just accept the default '$dflt'.
9084EOM
9085rp='Use the "fast stdio" if available?'
9086. ./myread
9087case "$ans" in
34f1896b 9088y|Y) val="$define" ;;
15b61c98
JH
9089*) val="$undef" ;;
9090esac
9091set usefaststdio
9092eval $setvar
9093
9094
96056487
JH
9095: define an is-a-typedef? function
9096typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9097case "$inclist" in
9098"") inclist="sys/types.h";;
9099esac;
9100eval "varval=\$$var";
9101case "$varval" in
9102"")
9103 $rm -f temp.c;
9104 for inc in $inclist; do
9105 echo "#include <$inc>" >>temp.c;
9106 done;
9107 echo "#ifdef $type" >> temp.c;
9108 echo "printf(\"We have $type\");" >> temp.c;
9109 echo "#endif" >> temp.c;
9110 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9111 if $contains $type temp.E >/dev/null 2>&1; then
9112 eval "$var=\$type";
9113 else
9114 eval "$var=\$def";
9115 fi;
9116 $rm -f temp.?;;
9117*) eval "$var=\$varval";;
9118esac'
9119
9120: define an is-a-typedef? function that prompts if the type is not available.
9121typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9122case "$inclist" in
9123"") inclist="sys/types.h";;
9124esac;
9125eval "varval=\$$var";
9126case "$varval" in
9127"")
9128 $rm -f temp.c;
9129 for inc in $inclist; do
9130 echo "#include <$inc>" >>temp.c;
9131 done;
9132 echo "#ifdef $type" >> temp.c;
9133 echo "printf(\"We have $type\");" >> temp.c;
9134 echo "#endif" >> temp.c;
9135 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9136 echo " " ;
9137 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9138 if $contains $type temp.E >/dev/null 2>&1; then
9139 echo "$type found." >&4;
9140 eval "$var=\$type";
9141 else
9142 echo "$type NOT found." >&4;
9143 dflt="$def";
9144 . ./myread ;
9145 eval "$var=\$ans";
9146 fi;
9147 $rm -f temp.?;;
9148*) eval "$var=\$varval";;
9149esac'
9150
9151: see what type lseek is declared as in the kernel
9152rp="What is the type used for lseek's offset on this system?"
9153set off_t lseektype long stdio.h sys/types.h
9154eval $typedef_ask
9155
9156echo " "
9157echo "Checking to see how big your file offsets are..." >&4
9158$cat >try.c <<EOCP
9159#include <sys/types.h>
9160#include <stdio.h>
9161int main()
9162{
9163 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9164 return(0);
96056487
JH
9165}
9166EOCP
9167set try
9168if eval $compile_ok; then
9169 lseeksize=`$run ./try`
9170 echo "Your file offsets are $lseeksize bytes long."
9171else
9172 dflt=$longsize
9173 echo " "
9174 echo "(I can't seem to compile the test program. Guessing...)"
9175 rp="What is the size of your file offsets (in bytes)?"
9176 . ./myread
9177 lseeksize="$ans"
9178fi
5b813a60 9179$rm_try
96056487
JH
9180
9181: see what type file positions are declared as in the library
9182rp="What is the type for file position used by fsetpos()?"
9183set fpos_t fpostype long stdio.h sys/types.h
9184eval $typedef_ask
9185
613d6c3e 9186: Check size for Fpos_t
96056487
JH
9187echo " "
9188case "$fpostype" in
9189*_t) zzz="$fpostype" ;;
9190*) zzz="fpos_t" ;;
9191esac
613d6c3e 9192echo "Checking the size of $zzz..." >&4
96056487
JH
9193cat > try.c <<EOCP
9194#include <sys/types.h>
9195#include <stdio.h>
d1daaddf
JH
9196#$i_stdlib I_STDLIB
9197#ifdef I_STDLIB
9198#include <stdlib.h>
9199#endif
96056487
JH
9200int main() {
9201 printf("%d\n", (int)sizeof($fpostype));
9202 exit(0);
9203}
9204EOCP
9205set try
9206if eval $compile_ok; then
9207 yyy=`$run ./try`
9208 case "$yyy" in
9209 '') fpossize=4
9210 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9211 ;;
9212 *) fpossize=$yyy
9213 echo "Your $zzz is $fpossize bytes long."
9214 ;;
9215 esac
9216else
9217 dflt="$longsize"
9218 echo " " >&4
9219 echo "(I can't compile the test program. Guessing...)" >&4
9220 rp="What is the size of your file positions (in bytes)?"
9221 . ./myread
9222 fpossize="$ans"
9223fi
9224
613d6c3e 9225: Check for large file support
96056487
JH
9226# Backward compatibility (uselfs is deprecated).
9227case "$uselfs" in
9228"$define"|true|[yY]*)
9229 cat <<EOM >&4
9230
9231*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9232EOM
9233 uselargefiles="$define"
9234 ;;
5b813a60 9235esac
96056487
JH
9236
9237case "$lseeksize:$fpossize" in
92388:8) cat <<EOM
9239
9240You can have files larger than 2 gigabytes.
9241EOM
9242 val="$define" ;;
9243*) case "$uselargefiles" in
9244 "$undef"|false|[nN]*) dflt='n' ;;
9245 *) dflt='y' ;;
9246 esac
9247 cat <<EOM
9248
9249Perl can be built to understand large files (files larger than 2 gigabytes)
9250on some systems. To do so, Configure can be run with -Duselargefiles.
9251
9252If this doesn't make any sense to you, just accept the default '$dflt'.
9253EOM
9254 rp='Try to understand large files, if available?'
9255 . ./myread
9256 case "$ans" in
9257 y|Y) val="$define" ;;
9258 *) val="$undef" ;;
9259 esac
9260 ;;
9261esac
9262set uselargefiles
9263eval $setvar
96056487
JH
9264: Look for a hint-file generated 'call-back-unit'. If the
9265: user has specified that a large files perl is to be built,
9266: we may need to set or change some other defaults.
9da7673b
MB
9267if $test -f uselargefiles.cbu; then
9268 echo "Your platform has some specific hints regarding large file builds, using them..."
9269 . ./uselargefiles.cbu
9270fi
9271case "$uselargefiles" in
9272"$define")
96056487 9273 if $test -f uselargefiles.cbu; then
96056487
JH
9274 echo " "
9275 echo "Rechecking to see how big your file offsets are..." >&4
9276 $cat >try.c <<EOCP
9277#include <sys/types.h>
9278#include <stdio.h>
9279int main()
9280{
9281 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9282 return(0);
96056487
JH
9283}
9284EOCP
9285 set try
9286 if eval $compile_ok; then
9287 lseeksize=`$run ./try`
9288 $echo "Your file offsets are now $lseeksize bytes long."
9289 else
9290 dflt="$lseeksize"
9291 echo " "
9292 echo "(I can't seem to compile the test program. Guessing...)"
9293 rp="What is the size of your file offsets (in bytes)?"
9294 . ./myread
9295 lseeksize="$ans"
9296 fi
9297 case "$fpostype" in
9298 *_t) zzz="$fpostype" ;;
9299 *) zzz="fpos_t" ;;
9300 esac
5b813a60 9301 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9302 $cat > try.c <<EOCP
9303#include <sys/types.h>
9304#include <stdio.h>
55954f19
JH
9305#$i_stdlib I_STDLIB
9306#ifdef I_STDLIB
9307#include <stdlib.h>
9308#endif
96056487
JH
9309int main() {
9310 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9311 return(0);
96056487
JH
9312}
9313EOCP
9314 set try
9315 if eval $compile_ok; then
9316 yyy=`$run ./try`
9317 dflt="$lseeksize"
9318 case "$yyy" in
9319 '') echo " "
9320 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9321 ;;
9322 *) fpossize=$yyy
9323 echo " $fpossize bytes." >&4
9324 ;;
9325 esac
9326 else
9327 dflt="$fpossize"
9328 echo " "
9329 echo "(I can't compile the test program. Guessing...)" >&4
9330 rp="What is the size of your file positions (in bytes)?"
9331 . ./myread
9332 fpossize="$ans"
9333 fi
5b813a60 9334 $rm_try
96056487
JH
9335 fi
9336 ;;
9337esac
9338
dd35fa16
MB
9339: Check if we want perlio
9340useperlio="$define"
9341
613d6c3e 9342: Set the vendorbin variables
b4eb6b3d
JH
9343case "$vendorprefix" in
9344'') d_vendorbin="$undef"
9345 vendorbin=''
9346 vendorbinexp=''
9347 ;;
9348*) d_vendorbin="$define"
9349 : determine where vendor-supplied executables go.
9350 case "$vendorbin" in
9351 '') dflt=$vendorprefix/bin ;;
9352 *) dflt="$vendorbin" ;;
9353 esac
9354 fn=d~+
9355 rp='Pathname for the vendor-supplied executables directory?'
9356 . ./getfile
9357 vendorbin="$ans"
9358 vendorbinexp="$ansexp"
9359 ;;
9360esac
a092d240
NC
9361prefixvar=vendorbin
9362. ./installprefix
b4eb6b3d 9363
613d6c3e 9364: Set the vendorhtml1dir variables
6e1038e0 9365case "$vendorprefix" in
8d2cbf27
JH
9366'') vendorhtml1dir=''
9367 vendorhtml1direxp=''
6e1038e0
MB
9368 ;;
9369*) : determine where vendor-supplied html pages go.
9370 : There is no standard location, so try to copy the previously-selected
9371 : directory structure for the core html pages.
9372 : XXX Better default suggestions would be welcome.
8d2cbf27 9373 case "$vendorhtml1dir" in
6e1038e0 9374 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9375 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9376 esac
9377 case "$dflt" in
9378 ''|' ') dflt=none ;;
9379 esac
9380 fn=dn+~
9381 rp='Pathname for the vendor-supplied html pages?'
9382 . ./getfile
8d2cbf27
JH
9383 vendorhtml1dir="$ans"
9384 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9385 ;;
9386esac
9387: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9388$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9389prefixvar=vendorhtml1dir
9390. ./installprefix
6e1038e0 9391
613d6c3e 9392: Set the vendorhtml3dir variables
6e1038e0 9393case "$vendorprefix" in
8d2cbf27
JH
9394'') vendorhtml3dir=''
9395 vendorhtml3direxp=''
6e1038e0
MB
9396 ;;
9397*) : determine where vendor-supplied module html pages go.
9398 : There is no standard location, so try to copy the previously-selected
9399 : directory structure for the core html pages.
9400 : XXX Better default suggestions would be welcome.
8d2cbf27 9401 case "$vendorhtml3dir" in
6e1038e0 9402 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9403 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9404 esac
9405 case "$dflt" in
9406 ''|' ') dflt=none ;;
9407 esac
9408 fn=dn+~
9409 rp='Pathname for the vendor-supplied html pages?'
9410 . ./getfile
8d2cbf27
JH
9411 vendorhtml3dir="$ans"
9412 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9413 ;;
9414esac
9415: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9416$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9417prefixvar=vendorhtml3dir
9418. ./installprefix
6e1038e0 9419
613d6c3e 9420: Set the vendorman1dir variables
6e1038e0 9421case "$vendorprefix" in
91e123a8
JH
9422'') vendorman1dir=''
9423 vendorman1direxp=''
6e1038e0
MB
9424 ;;
9425*) : determine where vendor-supplied manual pages go.
91e123a8 9426 case "$vendorman1dir" in
6e1038e0 9427 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9428 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9429 esac
9430 case "$dflt" in
9431 ''|' ') dflt=none ;;
9432 esac
9433 fn=nd~+
9434 rp='Pathname for the vendor-supplied manual section 1 pages?'
9435 . ./getfile
91e123a8
JH
9436 vendorman1dir="$ans"
9437 vendorman1direxp="$ansexp"
6e1038e0
MB
9438 ;;
9439esac
9440: Use ' ' for none so value is preserved next time through Configure
91e123a8 9441$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9442prefixvar=vendorman1dir
9443. ./installprefix
6e1038e0 9444
613d6c3e 9445: Set the vendorman3dir variables
6e1038e0 9446case "$vendorprefix" in
91e123a8
JH
9447'') vendorman3dir=''
9448 vendorman3direxp=''
6e1038e0
MB
9449 ;;
9450*) : determine where vendor-supplied module manual pages go.
91e123a8 9451 case "$vendorman3dir" in
6e1038e0 9452 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9453 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9454 esac
9455 case "$dflt" in
9456 ''|' ') dflt=none ;;
9457 esac
9458 fn=nd~+
9459 rp='Pathname for the vendor-supplied manual section 3 pages?'
9460 . ./getfile
91e123a8
JH
9461 vendorman3dir="$ans"
9462 vendorman3direxp="$ansexp"
6e1038e0
MB
9463 ;;
9464esac
9465: Use ' ' for none so value is preserved next time through Configure
91e123a8 9466$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9467prefixvar=vendorman3dir
9468. ./installprefix
6e1038e0 9469
613d6c3e 9470: Set the vendorscript variables
6e1038e0
MB
9471case "$vendorprefix" in
9472'') d_vendorscript="$undef"
9473 vendorscript=''
9474 vendorscriptexp=''
9475 ;;
9476*) d_vendorscript="$define"
9477 : determine where vendor-supplied scripts go.
9478 case "$vendorscript" in
9479 '') dflt=$vendorprefix/script
9480 $test -d $dflt || dflt=$vendorbin ;;
9481 *) dflt="$vendorscript" ;;
9482 esac
9483 $cat <<EOM
9484
f3f1a2d8 9485The installation process will create a directory for
6e1038e0
MB
9486vendor-supplied scripts.
9487
9488EOM
9489 fn=d~+
9490 rp='Pathname for the vendor-supplied scripts directory?'
9491 . ./getfile
9492 vendorscript="$ans"
9493 vendorscriptexp="$ansexp"
9494 ;;
9495esac
a092d240
NC
9496prefixvar=vendorscript
9497. ./installprefix
6e1038e0 9498
f47f1645
TC
9499: script used to emit important warnings
9500cat >warn <<EOS
9501$startsh
9502if test \$# -gt 0; then
9503 echo "\$@" >msg
9504else
9505 cat >msg
9506fi
9507echo "*** WARNING:" >&4
9508sed -e 's/^/*** /' <msg >&4
9509echo "*** " >&4
9510cat msg >>config.msg
9511echo " " >>config.msg
9512rm -f msg
9513EOS
9514chmod +x warn
9515$eunicefix warn
9516
9517: see which of string.h or strings.h is needed
9518echo " "
9519strings=`./findhdr string.h`
9520if $test "$strings" && $test -r "$strings"; then
9521 echo "Using <string.h> instead of <strings.h>." >&4
9522 val="$define"
9523else
9524 val="$undef"
9525 strings=`./findhdr strings.h`
9526 if $test "$strings" && $test -r "$strings"; then
9527 echo "Using <strings.h> instead of <string.h>." >&4
9528 else
9529 ./warn "No string header found -- You'll surely have problems."
9530 fi
9531fi
9532set i_string
9533eval $setvar
9534case "$i_string" in
9535"$undef") strings=`./findhdr strings.h`;;
9536*) strings=`./findhdr string.h`;;
9537esac
9538
b4eb6b3d
JH
9539: see if qgcvt exists
9540set qgcvt d_qgcvt
9541eval $inlibc
9542
613d6c3e 9543: Check print/scan long double stuff
89ce900e
JH
9544echo " "
9545
9546if $test X"$d_longdbl" = X"$define"; then
9547
9548echo "Checking how to print long doubles..." >&4
9549
9550if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9551 $cat >try.c <<'EOCP'
9552#include <sys/types.h>
9553#include <stdio.h>
9554int main() {
9555 double d = 123.456;
9556 printf("%.3f\n", d);
9557}
9558EOCP
9559 set try
9560 if eval $compile; then
9561 yyy=`$run ./try`
9562 case "$yyy" in
9563 123.456)
9564 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9565 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9566 echo "We will use %f."
9567 ;;
9568 esac
9569 fi
9570fi
9571
9572if $test X"$sPRIfldbl" = X; then
9573 $cat >try.c <<'EOCP'
9574#include <sys/types.h>
9575#include <stdio.h>
9576int main() {
9577 long double d = 123.456;
9578 printf("%.3Lf\n", d);
9579}
9580EOCP
9581 set try
9582 if eval $compile; then
9583 yyy=`$run ./try`
9584 case "$yyy" in
9585 123.456)
9586 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9587 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9588 echo "We will use %Lf."
9589 ;;
9590 esac
9591 fi
9592fi
9593
9594if $test X"$sPRIfldbl" = X; then
9595 $cat >try.c <<'EOCP'
9596#include <sys/types.h>
9597#include <stdio.h>
9598int main() {
9599 long double d = 123.456;
9600 printf("%.3llf\n", d);
9601}
9602EOCP
9603 set try
9604 if eval $compile; then
9605 yyy=`$run ./try`
9606 case "$yyy" in
9607 123.456)
9608 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9609 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9610 echo "We will use %llf."
9611 ;;
9612 esac
9613 fi
9614fi
9615
9616if $test X"$sPRIfldbl" = X; then
9617 $cat >try.c <<'EOCP'
9618#include <sys/types.h>
9619#include <stdio.h>
9620int main() {
9621 long double d = 123.456;
9622 printf("%.3lf\n", d);
9623}
9624EOCP
9625 set try
9626 if eval $compile; then
9627 yyy=`$run ./try`
9628 case "$yyy" in
9629 123.456)
9630 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9631 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9632 echo "We will use %lf."
9633 ;;
9634 esac
9635 fi
9636fi
9637
9638if $test X"$sPRIfldbl" = X; then
9639 echo "Cannot figure out how to print long doubles." >&4
9640else
9641 sSCNfldbl=$sPRIfldbl # expect consistency
9642fi
9643
5b813a60 9644$rm_try
89ce900e
JH
9645
9646fi # d_longdbl
9647
9648case "$sPRIfldbl" in
5b813a60
MB
9649'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9650 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9651 d_SCNfldbl="$undef";
9652 ;;
5b813a60
MB
9653*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9654 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9655 d_SCNfldbl="$define";
9656 ;;
9657esac
9658
b4eb6b3d 9659: Check how to convert floats to strings.
a5b10d80
YST
9660
9661if test "X$d_Gconvert" = X; then
9662
b4eb6b3d
JH
9663echo " "
9664echo "Checking for an efficient way to convert floats to strings."
9665echo " " > try.c
9666case "$uselongdouble" in
9667"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9668esac
9669case "$d_longdbl" in
9670"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9671esac
9672case "$d_PRIgldbl" in
9673"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9674esac
9675$cat >>try.c <<EOP
9676#ifdef TRY_gconvert
9677#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9678char *myname = "gconvert";
9679#endif
9680#ifdef TRY_gcvt
9681#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9682char *myname = "gcvt";
9683#endif
9684#ifdef TRY_qgcvt
9685#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9686char *myname = "qgcvt";
9687#define DOUBLETYPE long double
9688#endif
9689#ifdef TRY_sprintf
a5b10d80
YST
9690#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9691#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9692#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9693#else
a5b10d80
YST
9694#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9695#endif
9696#else
b4eb6b3d
JH
9697#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9698#endif
9699char *myname = "sprintf";
9700#endif
9701
9702#ifndef DOUBLETYPE
9703#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9704#define DOUBLETYPE long double
9705#else
9706#define DOUBLETYPE double
9707#endif
9708#endif
9709
9710#include <stdio.h>
9711
f47f1645 9712#$i_stdlib I_STDLIB
b4eb6b3d
JH
9713#ifdef I_STDLIB
9714#include <stdlib.h>
9715#endif
f47f1645
TC
9716#$i_string I_STRING
9717#ifdef I_STRING
9718# include <string.h>
9719#else
9720# include <strings.h>
9721#endif
b4eb6b3d 9722
f47f1645 9723int checkit(char *expect, char *got)
b4eb6b3d
JH
9724{
9725 if (strcmp(expect, got)) {
9726 printf("%s oddity: Expected %s, got %s\n",
9727 myname, expect, got);
9728 exit(1);
9729 }
9730}
9731
9732int main()
5b813a60
MB
9733{
9734 char buf[64];
b4eb6b3d
JH
9735 buf[63] = '\0';
9736
9737 /* This must be 1st test on (which?) platform */
9738 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9739 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9740 checkit("0.1", buf);
9741
5b813a60 9742 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9743 checkit("0.01", buf);
9744
5b813a60 9745 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9746 checkit("0.001", buf);
9747
5b813a60 9748 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9749 checkit("0.0001", buf);
9750
9751 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9752 if (strlen(buf) > 5)
9753 checkit("9e-005", buf); /* for Microsoft ?? */
9754 else
9755 checkit("9e-05", buf);
9756
5b813a60 9757 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9758 checkit("1", buf);
9759
5b813a60 9760 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9761 checkit("1.1", buf);
9762
5b813a60 9763 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9764 checkit("1.01", buf);
9765
5b813a60 9766 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9767 checkit("1.001", buf);
9768
5b813a60 9769 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9770 checkit("1.0001", buf);
9771
5b813a60 9772 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9773 checkit("1.00001", buf);
9774
5b813a60 9775 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9776 checkit("1.000001", buf);
9777
5b813a60 9778 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9779 checkit("0", buf);
9780
5b813a60 9781 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9782 checkit("-1", buf);
9783
9784 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9785 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9786 checkit("100000", buf);
5b813a60 9787
b4eb6b3d 9788 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9789 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9790 checkit("-100000", buf);
9791
5b813a60 9792 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9793 checkit("123.456", buf);
9794
ab6ca9f4 9795 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9796 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9797 /* 34 should be enough to scare even long double
9798 * places into using the e notation. */
ab6ca9f4 9799 if (strlen(buf) > 5)
94b339ad 9800 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9801 else
94b339ad 9802 checkit("1e+34", buf);
8e2a5ede 9803
d1eb8299
YST
9804 /* For Perl, if you add additional tests here, also add them to
9805 * t/base/num.t for benefit of platforms not using Configure or
9806 * overriding d_Gconvert */
9807
b4eb6b3d
JH
9808 exit(0);
9809}
9810EOP
ab6ca9f4 9811: first add preferred functions to our list
a5b10d80 9812xxx_list=""
ab6ca9f4 9813for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9814 case $xxx_convert in
9815 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9816 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9817 esac
a5b10d80
YST
9818done
9819: then add any others
9820for xxx_convert in gconvert gcvt sprintf; do
9821 case "$xxx_list" in
9822 *$xxx_convert*) ;;
9823 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9824 esac
a5b10d80
YST
9825done
9826
9827case "$d_longdbl$uselongdouble" in
9828"$define$define")
cd95ead5 9829 : again, add preferred functions to our list first
a5b10d80 9830 xxx_ld_list=""
ab6ca9f4 9831 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9832 case $xxx_convert in
9833 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9834 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9835 esac
9836 done
9837 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9838 for xxx_convert in qgcvt sprintf $xxx_list; do
9839 case "$xxx_ld_list" in
9840 $xxx_convert*|*" $xxx_convert"*) ;;
9841 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9842 esac
9843 done
9844 : if sprintf cannot do long doubles, move it to the end
9845 if test "$d_PRIgldbl" != "$define"; then
9846 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9847 fi
9848 : if no qgcvt, remove it
9849 if test "$d_qgcvt" != "$define"; then
9850 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9851 fi
9852 : use the ld_list
9853 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9854 ;;
9855esac
9856
9857for xxx_convert in $xxx_list; do
9858 echo "Trying $xxx_convert..."
93451a0d 9859 $rm -f try try$_o core
b4eb6b3d
JH
9860 set try -DTRY_$xxx_convert
9861 if eval $compile; then
9862 echo "$xxx_convert() found." >&4
5440bc8e 9863 if $run ./try; then
b4eb6b3d
JH
9864 echo "I'll use $xxx_convert to convert floats into a string." >&4
9865 break;
9866 else
9867 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9868 xxx_convert=''
b4eb6b3d
JH
9869 fi
9870 else
9871 echo "$xxx_convert NOT found." >&4
9872 fi
9873done
ab6ca9f4 9874
a5b10d80
YST
9875if test X$xxx_convert = X; then
9876 echo "*** WHOA THERE!!! ***" >&4
9877 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9878 xxx_convert=sprintf
9879fi
9880
b4eb6b3d
JH
9881case "$xxx_convert" in
9882gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9883gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9884qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9885*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9886 "$define$define$define")
9887 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9888 "$define$define$undef")
9889 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9890 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9891 esac
5b813a60 9892 ;;
b4eb6b3d
JH
9893esac
9894
a5b10d80 9895fi
93451a0d 9896$rm_try
a5b10d80 9897
74cac757
JH
9898: see if _fwalk exists
9899set fwalk d__fwalk
9900eval $inlibc
9901
b4eb6b3d
JH
9902: Initialize h_fcntl
9903h_fcntl=false
9904
9905: Initialize h_sysfile
9906h_sysfile=false
9907
9908: access call always available on UNIX
9909set access d_access
9910eval $inlibc
9911
9912: locate the flags for 'access()'
9913case "$d_access" in
9914"$define")
9915 echo " "
55954f19 9916 $cat >access.c <<EOCP
b4eb6b3d
JH
9917#include <sys/types.h>
9918#ifdef I_FCNTL
9919#include <fcntl.h>
9920#endif
9921#ifdef I_SYS_FILE
9922#include <sys/file.h>
9923#endif
9924#ifdef I_UNISTD
9925#include <unistd.h>
9926#endif
55954f19
JH
9927#$i_stdlib I_STDLIB
9928#ifdef I_STDLIB
9929#include <stdlib.h>
9930#endif
b4eb6b3d
JH
9931int main() {
9932 exit(R_OK);
9933}
9934EOCP
9935 : check sys/file.h first, no particular reason here
9936 if $test `./findhdr sys/file.h` && \
7a282f6d 9937 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9938 h_sysfile=true;
9939 echo "<sys/file.h> defines the *_OK access constants." >&4
9940 elif $test `./findhdr fcntl.h` && \
7a282f6d 9941 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9942 h_fcntl=true;
9943 echo "<fcntl.h> defines the *_OK access constants." >&4
9944 elif $test `./findhdr unistd.h` && \
7a282f6d 9945 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9946 echo "<unistd.h> defines the *_OK access constants." >&4
9947 else
9948 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9949 fi
9950 ;;
9951esac
9952$rm -f access*
9953
9954: see if accessx exists
9955set accessx d_accessx
9956eval $inlibc
9957
89ce900e
JH
9958: see if aintl exists
9959set aintl d_aintl
9960eval $inlibc
9961
b4eb6b3d
JH
9962: see if alarm exists
9963set alarm d_alarm
9964eval $inlibc
9965
96938616
MB
9966: see if 64bit time functions exists
9967
9968set ctime64 d_ctime64
9969eval $inlibc
9970
9971set localtime64 d_localtime64
9972eval $inlibc
9973
9974set gmtime64 d_gmtime64
9975eval $inlibc
9976
9977set mktime64 d_mktime64
9978eval $inlibc
9979
9980set difftime64 d_difftime64
9981eval $inlibc
9982
9983set asctime64 d_asctime64
9984eval $inlibc
9985
a9dade78
JH
9986: see if POSIX threads are available
9987set pthread.h i_pthread
9988eval $inhdr
9989
cd95ead5 9990: define a function to check prototypes
10bc17b6
JH
9991$cat > protochk <<EOSH
9992$startsh
9993cc="$cc"
9994optimize="$optimize"
9995ccflags="$ccflags"
9996prototype="$prototype"
9997define="$define"
c944cfb9 9998rm_try="$rm_try"
a9dade78
JH
9999usethreads=$usethreads
10000i_pthread=$i_pthread
10001pthread_h_first=$pthread_h_first
10bc17b6
JH
10002EOSH
10003
10004$cat >> protochk <<'EOSH'
10005
5b813a60 10006$rm_try
10bc17b6
JH
10007foo="$1"
10008shift
10009while test $# -ge 2; do
10010 case "$1" in
10011 $define) echo "#include <$2>" >> try.c ;;
10012 literal) echo "$2" >> try.c ;;
10013 esac
cce6a207
MB
10014 # Extra magic for the benefit of systems that need pthread.h
10015 # to be included early to correctly detect threadsafe functions.
10016 # Such functions must guarantee themselves, though, that the usethreads
10017 # and i_pthread have been defined, before calling protochk.
10018 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10019 echo "#include <pthread.h>" >> try.c
10020 pthread_h_done=yes
10021 fi
10bc17b6
JH
10022 shift 2
10023done
10024test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10025cat >> try.c <<'EOCP'
10026#ifdef CAN_PROTOTYPE
10027#define _(args) args
10028#else
10029#define _(args) ()
10030#endif
10031EOCP
10032echo "$foo" >> try.c
10033echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10034$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10035status=$?
5b813a60 10036$rm_try
10bc17b6
JH
10037exit $status
10038EOSH
10039chmod +x protochk
10040$eunicefix protochk
10041
34f1896b 10042: Define hasproto macro for Configure internal use
89ce900e
JH
10043hasproto='varname=$1; func=$2; shift; shift;
10044while $test $# -ge 2; do
10045 case "$1" in
10046 $define) echo "#include <$2>";;
10047 esac ;
10048 shift 2;
10049done > try.c;
10050$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10051if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10052 echo "$func() prototype found.";
10053 val="$define";
10054else
10055 echo "$func() prototype NOT found.";
10056 val="$undef";
10057fi;
10058set $varname;
10059eval $setvar;
5b813a60 10060$rm_try tryout.c'
89ce900e 10061
10bc17b6
JH
10062: see if sys/types.h has to be included
10063set sys/types.h i_systypes
10064eval $inhdr
10065
10066: see if sys/select.h has to be included
10067set sys/select.h i_sysselct
10068eval $inhdr
10069
34f1896b 10070: Define hasfield macro for Configure internal use
10bc17b6
JH
10071hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10072while $test $# -ge 2; do
10073 case "$1" in
10074 $define) echo "#include <$2>";;
10075 esac ;
10076 shift 2;
10077done > try.c;
10078echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10079set try;
10080if eval $compile; then
10081 val="$define";
10082else
10083 val="$undef";
10084fi;
10085set $varname;
10086eval $setvar;
5b813a60 10087$rm_try'
10bc17b6
JH
10088
10089: see if we should include time.h, sys/time.h, or both
10090echo " "
10091if test "X$timeincl" = X; then
10092 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10093 $echo $n "I'm now running the test program...$c"
55954f19 10094 $cat >try.c <<EOCP
10bc17b6
JH
10095#include <sys/types.h>
10096#ifdef I_TIME
10097#include <time.h>
10098#endif
10099#ifdef I_SYSTIME
10100#ifdef SYSTIMEKERNEL
10101#define KERNEL
10102#endif
10103#include <sys/time.h>
10104#endif
10105#ifdef I_SYSSELECT
10106#include <sys/select.h>
10107#endif
55954f19
JH
10108#$i_stdlib I_STDLIB
10109#ifdef I_STDLIB
10110#include <stdlib.h>
10111#endif
10bc17b6
JH
10112int main()
10113{
10114 struct tm foo;
10115#ifdef S_TIMEVAL
10116 struct timeval bar;
10117#endif
10118#ifdef S_TIMEZONE
10119 struct timezone tzp;
10120#endif
10121 if (foo.tm_sec == foo.tm_sec)
10122 exit(0);
10123#ifdef S_TIMEVAL
10124 if (bar.tv_sec == bar.tv_sec)
10125 exit(0);
10126#endif
10127 exit(1);
10128}
10129EOCP
10130 flags=''
10131 for s_timezone in '-DS_TIMEZONE' ''; do
10132 sysselect=''
10133 for s_timeval in '-DS_TIMEVAL' ''; do
10134 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10135 for i_time in '' '-DI_TIME'; do
10136 for i_systime in '-DI_SYSTIME' ''; do
10137 case "$flags" in
10138 '') $echo $n ".$c"
10139 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10140 if eval $compile; then
10141 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10142 shift
10143 flags="$*"
10144 echo " "
10145 $echo $n "Succeeded with $flags$c"
10146 fi
10147 ;;
10148 esac
10149 done
10150 done
10151 done
10152 done
10153 done
10154 timeincl=''
10155 echo " "
10156 case "$flags" in
10157 *SYSTIMEKERNEL*) i_systimek="$define"
10158 timeincl=`./findhdr sys/time.h`
10159 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10160 *) i_systimek="$undef";;
10161 esac
10162 case "$flags" in
10163 *I_TIME*) i_time="$define"
10164 timeincl=`./findhdr time.h`" $timeincl"
10165 echo "We'll include <time.h>." >&4;;
10166 *) i_time="$undef";;
10167 esac
10168 case "$flags" in
10169 *I_SYSTIME*) i_systime="$define"
10170 timeincl=`./findhdr sys/time.h`" $timeincl"
10171 echo "We'll include <sys/time.h>." >&4;;
10172 *) i_systime="$undef";;
10173 esac
5b813a60 10174 $rm_try
10bc17b6
JH
10175fi
10176: see if struct tm knows about tm_zone
10177case "$i_systime$i_time" in
5b813a60 10178*$define*)
10bc17b6
JH
10179 echo " "
10180 echo "Checking to see if your struct tm has tm_zone field..." >&4
10181 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10182 eval $hasfield
10183 ;;
10184*) val="$undef"
10185 set d_tm_tm_zone
10186 eval $setvar
10187 ;;
10188esac
10189case "$d_tm_tm_zone" in
10190"$define") echo "Yes, it does." ;;
10191*) echo "No, it doesn't." ;;
10192esac
10193: see if struct tm knows about tm_gmtoff
10194case "$i_systime$i_time" in
5b813a60 10195*$define*)
10bc17b6
JH
10196 echo " "
10197 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10198 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10199 eval $hasfield
10200 ;;
10201*) val="$undef"
10202 set d_tm_tm_gmtoff
10203 eval $setvar
10204 ;;
10205esac
10206case "$d_tm_tm_gmtoff" in
10207"$define") echo "Yes, it does." ;;
10208*) echo "No, it doesn't." ;;
10209esac
10210
10211: see if asctime_r exists
10212set asctime_r d_asctime_r
10213eval $inlibc
10214case "$d_asctime_r" in
10215"$define")
d63eadf0 10216 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10217 case "$d_asctime_r_proto:$usethreads" in
10218 ":define") d_asctime_r_proto=define
a48ec845
JH
10219 set d_asctime_r_proto asctime_r $hdrs
10220 eval $hasproto ;;
10221 *) ;;
10222 esac
10223 case "$d_asctime_r_proto" in
10224 define)
10bc17b6
JH
10225 case "$asctime_r_proto" in
10226 ''|0) try='char* asctime_r(const struct tm*, char*);'
61c26d18 10227 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10bc17b6
JH
10228 esac
10229 case "$asctime_r_proto" in
10230 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
61c26d18 10231 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10bc17b6
JH
10232 esac
10233 case "$asctime_r_proto" in
10234 ''|0) try='int asctime_r(const struct tm*, char*);'
61c26d18 10235 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10bc17b6
JH
10236 esac
10237 case "$asctime_r_proto" in
10238 ''|0) try='int asctime_r(const struct tm*, char*, int);'
61c26d18 10239 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10bc17b6
JH
10240 esac
10241 case "$asctime_r_proto" in
90e831dc 10242 ''|0) d_asctime_r=undef
10bc17b6 10243 asctime_r_proto=0
a48ec845 10244 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10245 * ) case "$asctime_r_proto" in
10246 REENTRANT_PROTO*) ;;
10247 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10248 esac
10249 echo "Prototype: $try" ;;
10250 esac
10251 ;;
c18e646a
JH
10252 *) case "$usethreads" in
10253 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10254 esac
90e831dc
SB
10255 d_asctime_r=undef
10256 asctime_r_proto=0
c18e646a 10257 ;;
a48ec845
JH
10258 esac
10259 ;;
10bc17b6
JH
10260*) asctime_r_proto=0
10261 ;;
10262esac
10263
b4eb6b3d
JH
10264: see if atolf exists
10265set atolf d_atolf
10266eval $inlibc
10267
10268: see if atoll exists
10269set atoll d_atoll
10270eval $inlibc
10271
0dbb1585
AL
10272: Look for GCC-style attribute format
10273case "$d_attribute_format" in
bde30f85 10274'')
b4eb6b3d 10275echo " "
0dbb1585 10276echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10277$cat >attrib.c <<'EOCP'
10278#include <stdio.h>
0dbb1585 10279void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10280EOCP
10281if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10282 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10283 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10284 val="$undef"
10285 else
0dbb1585 10286 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10287 val="$define"
10288 fi
10289else
10290 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10291 val="$undef"
10292fi
bde30f85 10293;;
0dbb1585 10294*) val="$d_attribute_format" ;;
bde30f85 10295esac
0dbb1585
AL
10296set d_attribute_format
10297eval $setvar
10298$rm -f attrib*
10299
dcb594bc
MB
10300: Look for GCC-style attribute format with null format allowed
10301case "$d_printf_format_null" in
10302'') case "$d_attribute_format" in
10303 $define)
10304 echo " "
10305 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10306$cat >attrib.c <<EOCP
10307#include <stdio.h>
10308#$i_stdlib I_STDLIB
10309#ifdef I_STDLIB
10310#include <stdlib.h>
10311#endif
10312int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10313int null_printf (char* pat,...) { return (int)pat; }
10314int main () { exit(null_printf(NULL)); }
10315EOCP
10316 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10317 : run the executable in case it produces a run-time warning
10318 if $run ./attrib >>attrib.out 2>&1; then
10319 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10320 echo "Your C compiler doesn't allow __printf__ format to be null."
10321 val="$undef"
10322 else
10323 echo "Your C compiler allows __printf__ format to be null."
10324 val="$define"
10325 fi
10326 else
10327 echo "Your C compiler executable failed with __printf__ format null."
10328 val="$undef"
10329 fi
10330 else
10331 echo "Your C compiler fails with __printf__ format null."
10332 val="$undef"
10333 fi
10334 ;;
10335 *) val="$undef" ;;
10336 esac
10337;;
10338*) val="$d_printf_format_null" ;;
10339esac
10340set d_printf_format_null
10341eval $setvar
10342$rm -f attrib*
10343
0dbb1585
AL
10344: Look for GCC-style attribute malloc
10345case "$d_attribute_malloc" in
10346'')
10347echo " "
10348echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10349$cat >attrib.c <<'EOCP'
10350#include <stdio.h>
10351char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10352EOCP
10353if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10354 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10355 echo "Your C compiler doesn't support __attribute__((malloc))."
10356 val="$undef"
10357 else
10358 echo "Your C compiler supports __attribute__((malloc))."
10359 val="$define"
10360 fi
10361else
10362 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10363 val="$undef"
10364fi
10365;;
10366*) val="$d_attribute_malloc" ;;
10367esac
10368set d_attribute_malloc
10369eval $setvar
10370$rm -f attrib*
10371
10372: Look for GCC-style attribute nonnull
10373case "$d_attribute_nonnull" in
10374'')
10375echo " "
10376echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10377$cat >attrib.c <<'EOCP'
10378#include <stdio.h>
10379void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10380EOCP
10381if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10382 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10383 echo "Your C compiler doesn't support __attribute__((nonnull))."
10384 val="$undef"
10385 else
10386 echo "Your C compiler supports __attribute__((nonnull))."
10387 val="$define"
10388 fi
10389else
10390 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10391 val="$undef"
10392fi
10393;;
10394*) val="$d_attribute_nonnull" ;;
10395esac
10396set d_attribute_nonnull
10397eval $setvar
10398$rm -f attrib*
10399
10400: Look for GCC-style attribute noreturn
10401case "$d_attribute_noreturn" in
10402'')
10403echo " "
10404echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10405$cat >attrib.c <<'EOCP'
10406#include <stdio.h>
10407void fall_over_dead( void ) __attribute__((noreturn));
10408EOCP
10409if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10410 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10411 echo "Your C compiler doesn't support __attribute__((noreturn))."
10412 val="$undef"
10413 else
10414 echo "Your C compiler supports __attribute__((noreturn))."
10415 val="$define"
10416 fi
10417else
10418 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10419 val="$undef"
10420fi
10421;;
10422*) val="$d_attribute_noreturn" ;;
10423esac
10424set d_attribute_noreturn
10425eval $setvar
10426$rm -f attrib*
10427
10428: Look for GCC-style attribute pure
10429case "$d_attribute_pure" in
10430'')
10431echo " "
10432echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10433$cat >attrib.c <<'EOCP'
10434#include <stdio.h>
10435int square( int n ) __attribute__((pure));
10436EOCP
10437if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10438 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10439 echo "Your C compiler doesn't support __attribute__((pure))."
10440 val="$undef"
10441 else
10442 echo "Your C compiler supports __attribute__((pure))."
10443 val="$define"
10444 fi
10445else
10446 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10447 val="$undef"
10448fi
10449;;
10450*) val="$d_attribute_pure" ;;
10451esac
10452set d_attribute_pure
10453eval $setvar
10454$rm -f attrib*
10455
10456: Look for GCC-style attribute unused
10457case "$d_attribute_unused" in
10458'')
10459echo " "
10460echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10461$cat >attrib.c <<'EOCP'
10462#include <stdio.h>
10463int do_something( int dummy __attribute__((unused)), int n );
10464EOCP
10465if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10466 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10467 echo "Your C compiler doesn't support __attribute__((unused))."
10468 val="$undef"
10469 else
10470 echo "Your C compiler supports __attribute__((unused))."
10471 val="$define"
10472 fi
10473else
10474 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10475 val="$undef"
10476fi
10477;;
10478*) val="$d_attribute_unused" ;;
10479esac
10480set d_attribute_unused
10481eval $setvar
10482$rm -f attrib*
10483
fcdf39cf
RGS
10484: Look for GCC-style attribute deprecated
10485case "$d_attribute_deprecated" in
10486'')
10487echo " "
10488echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10489$cat >attrib.c <<'EOCP'
10490#include <stdio.h>
10491int I_am_deprecated(void) __attribute__((deprecated));
10492EOCP
10493if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10494 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10495 echo "Your C compiler doesn't support __attribute__((deprecated))."
10496 val="$undef"
10497 else
10498 echo "Your C compiler supports __attribute__((deprecated))."
10499 val="$define"
10500 fi
10501else
10502 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10503 val="$undef"
10504fi
10505;;
10506*) val="$d_attribute_deprecated" ;;
10507esac
10508set d_attribute_deprecated
10509eval $setvar
10510$rm -f attrib*
10511
0dbb1585
AL
10512: Look for GCC-style attribute warn_unused_result
10513case "$d_attribute_warn_unused_result" in
10514'')
10515echo " "
10516echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10517$cat >attrib.c <<'EOCP'
10518#include <stdio.h>
10519int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10520EOCP
10521if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10522 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10523 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10524 val="$undef"
10525 else
10526 echo "Your C compiler supports __attribute__((warn_unused_result))."
10527 val="$define"
10528 fi
10529else
10530 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10531 val="$undef"
10532fi
10533;;
10534*) val="$d_attribute_warn_unused_result" ;;
10535esac
10536set d_attribute_warn_unused_result
b4eb6b3d
JH
10537eval $setvar
10538$rm -f attrib*
10539
10540: see if bcmp exists
10541set bcmp d_bcmp
10542eval $inlibc
10543
10544: see if bcopy exists
10545set bcopy d_bcopy
10546eval $inlibc
10547
b4eb6b3d
JH
10548: see if getpgrp exists
10549set getpgrp d_getpgrp
10550eval $inlibc
10551
10552case "$d_getpgrp" in
10553"$define")
10554 echo " "
10555 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10556 $cat >try.c <<EOP
b4eb6b3d
JH
10557#$i_unistd I_UNISTD
10558#include <sys/types.h>
10559#ifdef I_UNISTD
10560# include <unistd.h>
10561#endif
55954f19
JH
10562#$i_stdlib I_STDLIB
10563#ifdef I_STDLIB
10564#include <stdlib.h>
10565#endif
b4eb6b3d
JH
10566int main()
10567{
10568 if (getuid() == 0) {
10569 printf("(I see you are running Configure as super-user...)\n");
10570 setuid(1);
10571 }
10572#ifdef TRY_BSD_PGRP
10573 if (getpgrp(1) == 0)
10574 exit(0);
10575#else
10576 if (getpgrp() > 0)
10577 exit(0);
10578#endif
10579 exit(1);
10580}
10581EOP
5440bc8e 10582 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10583 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10584 val="$define"
5440bc8e 10585 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10586 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10587 val="$undef"
10588 else
10589 echo "I can't seem to compile and run the test program."
10590 if ./usg; then
10591 xxx="a USG one, i.e. you use getpgrp()."
10592 else
10593 # SVR4 systems can appear rather BSD-ish.
10594 case "$i_unistd" in
10595 $undef)
10596 xxx="a BSD one, i.e. you use getpgrp(pid)."
10597 val="$define"
10598 ;;
10599 $define)
10600 xxx="probably a USG one, i.e. you use getpgrp()."
10601 val="$undef"
10602 ;;
10603 esac
10604 fi
10605 echo "Assuming your getpgrp is $xxx" >&4
10606 fi
10607 ;;
10608*) val="$undef";;
10609esac
10610set d_bsdgetpgrp
10611eval $setvar
5b813a60 10612$rm_try
b4eb6b3d
JH
10613
10614: see if setpgrp exists
10615set setpgrp d_setpgrp
10616eval $inlibc
10617
10618case "$d_setpgrp" in
10619"$define")
10620 echo " "
10621 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10622 $cat >try.c <<EOP
b4eb6b3d
JH
10623#$i_unistd I_UNISTD
10624#include <sys/types.h>
10625#ifdef I_UNISTD
10626# include <unistd.h>
10627#endif
55954f19
JH
10628#$i_stdlib I_STDLIB
10629#ifdef I_STDLIB
10630#include <stdlib.h>
10631#endif
b4eb6b3d
JH
10632int main()
10633{
10634 if (getuid() == 0) {
10635 printf("(I see you are running Configure as super-user...)\n");
10636 setuid(1);
10637 }
10638#ifdef TRY_BSD_PGRP
10639 if (-1 == setpgrp(1, 1))
10640 exit(0);
10641#else
10642 if (setpgrp() != -1)
10643 exit(0);
10644#endif
10645 exit(1);
10646}
10647EOP
5440bc8e 10648 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10649 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10650 val="$define"
5440bc8e 10651 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10652 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10653 val="$undef"
10654 else
10655 echo "(I can't seem to compile and run the test program.)"
10656 if ./usg; then
10657 xxx="a USG one, i.e. you use setpgrp()."
10658 else
10659 # SVR4 systems can appear rather BSD-ish.
10660 case "$i_unistd" in
10661 $undef)
10662 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10663 val="$define"
10664 ;;
10665 $define)
10666 xxx="probably a USG one, i.e. you use setpgrp()."
10667 val="$undef"
10668 ;;
10669 esac
10670 fi
10671 echo "Assuming your setpgrp is $xxx" >&4
10672 fi
10673 ;;
10674*) val="$undef";;
10675esac
10676set d_bsdsetpgrp
10677eval $setvar
5b813a60
MB
10678$rm_try
10679
635aebb7
AL
10680: Look for GCC-style __builtin_choose_expr
10681case "$d_builtin_choose_expr" in
10682'')
10683 echo " "
10684 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10685 $cat >try.c <<'EOCP'
10686#include <assert.h>
10687#include <stdlib.h>
10688#include <stdio.h>
10689
10690#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10691
10692int main(void) {
10693 assert( SYRINX(1) == 2112 );
10694 assert( SYRINX(1) != 5150 );
10695 assert( SYRINX(0) == 5150 );
10696 assert( SYRINX(0) != 2112 );
10697 puts( "All good!" );
10698 exit(0);
10699}
10700
10701EOCP
10702 set try
70ceb34a 10703 if eval $compile && $run ./try; then
635aebb7
AL
10704 echo "Your C compiler supports __builtin_choose_expr."
10705 val="$define"
10706 else
10707 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10708 val="$undef"
10709 fi
10710;;
10711*) val="$d_builtin_choose_expr" ;;
10712esac
10713
10714set d_builtin_choose_expr
10715eval $setvar
5b813a60 10716$rm_try
635aebb7
AL
10717
10718: Look for GCC-style __builtin_expect
10719case "$d_builtin_expect" in
10720'')
10721 echo " "
10722 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
70ceb34a 10723 $cat >try.c <<'EOCP'
635aebb7
AL
10724int main(void) {
10725 int n = 50;
10726 if ( __builtin_expect(n, 0) ) n = 1;
70ceb34a
NC
10727 /* Remember shell exit code truth is 0, C truth is non-zero */
10728 return !(n == 1);
635aebb7
AL
10729}
10730EOCP
10731 set try
70ceb34a
NC
10732 if eval $compile && $run ./try; then
10733 echo "Your C compiler supports __builtin_expect."
635aebb7
AL
10734 val="$define"
10735 else
70ceb34a 10736 echo "Your C compiler doesn't seem to understand __builtin_expect."
635aebb7
AL
10737 val="$undef"
10738 fi
10739 ;;
10740*) val="$d_builtin_expect" ;;
10741esac
10742
10743set d_builtin_expect
10744eval $setvar
5b813a60 10745$rm_try
635aebb7 10746
b4eb6b3d
JH
10747: see if bzero exists
10748set bzero d_bzero
10749eval $inlibc
10750
a2d23ec2
MB
10751: see if stdarg is available
10752echo " "
10753if $test `./findhdr stdarg.h`; then
10754 echo "<stdarg.h> found." >&4
10755 valstd="$define"
10756else
10757 echo "<stdarg.h> NOT found." >&4
10758 valstd="$undef"
10759fi
10760
10761: see if varags is available
10762echo " "
10763if $test `./findhdr varargs.h`; then
10764 echo "<varargs.h> found." >&4
10765else
10766 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10767fi
10768
10769: set up the varargs testing programs
10770$cat > varargs.c <<EOP
10771#ifdef I_STDARG
10772#include <stdarg.h>
10773#endif
10774#ifdef I_VARARGS
10775#include <varargs.h>
10776#endif
10777
10778#ifdef I_STDARG
10779int f(char *p, ...)
10780#else
10781int f(va_alist)
10782va_dcl
10783#endif
10784{
10785 va_list ap;
10786#ifndef I_STDARG
10787 char *p;
10788#endif
10789#ifdef I_STDARG
10790 va_start(ap,p);
10791#else
10792 va_start(ap);
10793 p = va_arg(ap, char *);
10794#endif
10795 va_end(ap);
4fb7dc7d 10796 return 0;
a2d23ec2
MB
10797}
10798EOP
10799$cat > varargs <<EOP
10800$startsh
10801if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10802 echo "true"
10803else
10804 echo "false"
10805fi
10806$rm -f varargs$_o
10807EOP
10808chmod +x varargs
10809
10810: now check which varargs header should be included
10811echo " "
10812i_varhdr=''
10813case "$valstd" in
10814"$define")
10815 if `./varargs I_STDARG`; then
10816 val='stdarg.h'
10817 elif `./varargs I_VARARGS`; then
10818 val='varargs.h'
10819 fi
10820 ;;
10821*)
10822 if `./varargs I_VARARGS`; then
10823 val='varargs.h'
10824 fi
10825 ;;
10826esac
10827case "$val" in
10828'')
10829echo "I could not find the definition for va_dcl... You have problems..." >&4
10830 val="$undef"; set i_stdarg; eval $setvar
10831 val="$undef"; set i_varargs; eval $setvar
10832 ;;
613d6c3e 10833*)
a2d23ec2
MB
10834 set i_varhdr
10835 eval $setvar
10836 case "$i_varhdr" in
10837 stdarg.h)
10838 val="$define"; set i_stdarg; eval $setvar
10839 val="$undef"; set i_varargs; eval $setvar
10840 ;;
10841 varargs.h)
10842 val="$undef"; set i_stdarg; eval $setvar
10843 val="$define"; set i_varargs; eval $setvar
10844 ;;
10845 esac
10846 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10847esac
10848$rm -f varargs*
10849
10850: see if the Compiler supports C99 variadic macros
10851case "$i_stdarg$i_stdlib" in
10852 "$define$define")
10853 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10854 $cat >try.c <<EOCP
10855#include <stdio.h>
10856#include <stdarg.h>
10857
10858#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10859
10860int main() {
10861 char buf[20];
10862 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10863 puts(buf);
10864 return 0;
10865}
10866EOCP
10867 set try
10868 if eval $compile && $run ./try 2>&1 >/dev/null; then
10869 case "`$run ./try`" in
10870 "123 456 789")
10871 echo "You have C99 variadic macros." >&4
10872 d_c99_variadic_macros="$define"
10873 ;;
10874 *)
10875 echo "You don't have functional C99 variadic macros." >&4
10876 d_c99_variadic_macros="$undef"
10877 ;;
10878 esac
10879 else
10880 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10881 d_c99_variadic_macros="$undef"
10882 fi
5b813a60 10883 $rm_try
a2d23ec2
MB
10884 ;;
10885 *)
10886 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10887 d_c99_variadic_macros="$undef"
10888 ;;
10889esac
10890
b4eb6b3d
JH
10891: see if signal is declared as pointer to function returning int or void
10892echo " "
10893xxx=`./findhdr signal.h`
10894$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10895if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10896 echo "You have int (*signal())() instead of void." >&4
10897 val="$undef"
10898elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10899 echo "You have void (*signal())()." >&4
10900 val="$define"
10901elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10902 echo "You have int (*signal())() instead of void." >&4
10903 val="$undef"
10904elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10905 echo "You have void (*signal())()." >&4
10906 val="$define"
10907else
10908 case "$d_voidsig" in
10909 '')
10910 echo "I can't determine whether signal handler returns void or int..." >&4
10911 dflt=void
10912 rp="What type does your signal handler return?"
10913 . ./myread
10914 case "$ans" in
10915 v*) val="$define";;
10916 *) val="$undef";;
10917 esac;;
10918 "$define")
10919 echo "As you already told me, signal handler returns void." >&4
10920 val="$define"
10921 ;;
10922 *) echo "As you already told me, signal handler returns int." >&4
10923 val="$undef"
10924 ;;
10925 esac
10926fi
10927set d_voidsig
10928eval $setvar
10929case "$d_voidsig" in
10930"$define") signal_t="void";;
10931*) signal_t="int";;
10932esac
10933$rm -f $$.tmp
10934
10935: check for ability to cast large floats to 32-bit ints.
10936echo " "
10937echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10938if $test "$intsize" -ge 4; then
10939 xxx=int
10940else
10941 xxx=long
10942fi
10943$cat >try.c <<EOCP
10944#include <stdio.h>
d1daaddf
JH
10945#$i_stdlib I_STDLIB
10946#ifdef I_STDLIB
10947#include <stdlib.h>
10948#endif
b4eb6b3d
JH
10949#include <sys/types.h>
10950#include <signal.h>
7090f861 10951$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10952int main()
10953{
10954 $xxx i32;
10955 double f, g;
10956 int result = 0;
10957 char str[16];
10958 signal(SIGFPE, blech);
10959
5b813a60 10960 /* Don't let compiler optimize the test away. Store the number
e237eb00 10961 in a writable string for gcc to pass to sscanf under HP-UX.
b4eb6b3d
JH
10962 */
10963 sprintf(str, "2147483647");
10964 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10965 g = 10 * f;
10966 i32 = ($xxx) g;
10967
10968 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10969 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10970 behavior here, which is to preserve the sign and give
10971 back 0x7fff ffff.
10972 */
10973 if (i32 != ($xxx) f)
10974 result |= 1;
10975 exit(result);
10976}
10977EOCP
10978set try
10979if eval $compile_ok; then
5440bc8e 10980 $run ./try
b4eb6b3d
JH
10981 yyy=$?
10982else
10983 echo "(I can't seem to compile the test program--assuming it can't)"
10984 yyy=1
10985fi
10986case "$yyy" in
109870) val="$define"
10988 echo "Yup, it can."
10989 ;;
10990*) val="$undef"
10991 echo "Nope, it can't."
10992 ;;
10993esac
10994set d_casti32
10995eval $setvar
5b813a60 10996$rm_try
b4eb6b3d
JH
10997
10998: check for ability to cast negative floats to unsigned
10999echo " "
11000echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11001$cat >try.c <<EOCP
11002#include <stdio.h>
d1daaddf
JH
11003#$i_stdlib I_STDLIB
11004#ifdef I_STDLIB
11005#include <stdlib.h>
11006#endif
b4eb6b3d
JH
11007#include <sys/types.h>
11008#include <signal.h>
7090f861
JH
11009$signal_t blech(int s) { exit(7); }
11010$signal_t blech_in_list(int s) { exit(4); }
11011unsigned long dummy_long(unsigned long p) { return p; }
11012unsigned int dummy_int(unsigned int p) { return p; }
11013unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
11014int main()
11015{
11016 double f;
11017 unsigned long along;
11018 unsigned int aint;
11019 unsigned short ashort;
11020 int result = 0;
11021 char str[16];
5b813a60 11022
b4eb6b3d
JH
11023 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11024 a direct f = -123. assignment. gcc-2.8.0 reportedly
11025 optimized the whole file away
11026 */
5b813a60 11027 /* Store the number in a writable string for gcc to pass to
e237eb00 11028 sscanf under HP-UX.
b4eb6b3d
JH
11029 */
11030 sprintf(str, "-123");
11031 sscanf(str, "%lf", &f); /* f = -123.; */
11032
11033 signal(SIGFPE, blech);
11034 along = (unsigned long)f;
11035 aint = (unsigned int)f;
11036 ashort = (unsigned short)f;
11037 if (along != (unsigned long)-123)
11038 result |= 1;
11039 if (aint != (unsigned int)-123)
11040 result |= 1;
11041 if (ashort != (unsigned short)-123)
11042 result |= 1;
11043 sprintf(str, "1073741824.");
11044 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11045 f = f + f;
11046 along = 0;
11047 along = (unsigned long)f;
11048 if (along != 0x80000000)
11049 result |= 2;
11050 f -= 1.;
11051 along = 0;
11052 along = (unsigned long)f;
11053 if (along != 0x7fffffff)
11054 result |= 1;
11055 f += 2.;
11056 along = 0;
11057 along = (unsigned long)f;
11058 if (along != 0x80000001)
11059 result |= 2;
11060 if (result)
11061 exit(result);
11062 signal(SIGFPE, blech_in_list);
11063 sprintf(str, "123.");
11064 sscanf(str, "%lf", &f); /* f = 123.; */
11065 along = dummy_long((unsigned long)f);
11066 aint = dummy_int((unsigned int)f);
11067 ashort = dummy_short((unsigned short)f);
11068 if (along != (unsigned long)123)
11069 result |= 4;
11070 if (aint != (unsigned int)123)
11071 result |= 4;
11072 if (ashort != (unsigned short)123)
11073 result |= 4;
11074 exit(result);
11075
11076}
11077EOCP
11078set try
11079if eval $compile_ok; then
5440bc8e 11080 $run ./try
b4eb6b3d
JH
11081 castflags=$?
11082else
11083 echo "(I can't seem to compile the test program--assuming it can't)"
11084 castflags=7
11085fi
11086case "$castflags" in
110870) val="$define"
11088 echo "Yup, it can."
11089 ;;
11090*) val="$undef"
11091 echo "Nope, it can't."
11092 ;;
11093esac
11094set d_castneg
11095eval $setvar
5b813a60 11096$rm_try
b4eb6b3d
JH
11097
11098: see if vprintf exists
11099echo " "
11100if set vprintf val -f d_vprintf; eval $csym; $val; then
11101 echo 'vprintf() found.' >&4
11102 val="$define"
55954f19 11103 $cat >try.c <<EOF
d0bc9cc8
AD
11104#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11105#$i_varargs I_VARARGS
11106
55954f19 11107#$i_stdlib I_STDLIB
d0bc9cc8
AD
11108#$i_unistd I_UNISTD
11109
11110#ifdef I_STDARG
11111# include <stdarg.h>
11112#else /* I_VARARGS */
11113# include <varargs.h>
11114#endif
11115
11116#ifdef I_UNISTD
11117# include <unistd.h>
11118#endif
11119
55954f19 11120#ifdef I_STDLIB
d0bc9cc8 11121# include <stdlib.h>
55954f19 11122#endif
b4eb6b3d 11123
d0bc9cc8
AD
11124#include <stdio.h> /* vsprintf prototype */
11125
11126#ifdef I_STDARG
11127void xxx(int n, ...)
11128{
11129 va_list args;
11130 char buf[10];
11131 va_start(args, n);
11132 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11133}
11134int main() { xxx(1, "foo"); }
11135
11136#else /* I_VARARGS */
b4eb6b3d
JH
11137
11138xxx(va_alist)
11139va_dcl
11140{
d0bc9cc8
AD
11141 va_list args;
11142 char buf[10];
11143 va_start(args);
11144 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 11145}
d0bc9cc8
AD
11146int main() { xxx("foo"); }
11147
11148#endif
11149
b4eb6b3d 11150EOF
5440bc8e 11151 set try
d0bc9cc8
AD
11152 if eval $compile_ok; then
11153 if $run ./try; then
11154 echo "Your vsprintf() returns (int)." >&4
11155 val2="$undef"
11156 else
11157 echo "Your vsprintf() returns (char*)." >&4
11158 val2="$define"
11159 fi
b4eb6b3d 11160 else
d0bc9cc8
AD
11161 echo 'I am unable to compile the vsprintf() test program.' >&4
11162 # We shouldn't get here. If we do, assume the standard signature,
11163 # not the old BSD one.
11164 echo 'Guessing that vsprintf() returns (int).' >&4
11165 val2="$undef"
b4eb6b3d
JH
11166 fi
11167else
11168 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
11169 val="$undef"
11170 val2="$undef"
b4eb6b3d 11171fi
5b813a60 11172$rm_try
b4eb6b3d
JH
11173set d_vprintf
11174eval $setvar
11175val=$val2
11176set d_charvspr
11177eval $setvar
11178
11179: see if chown exists
11180set chown d_chown
11181eval $inlibc
11182
11183: see if chroot exists
11184set chroot d_chroot
11185eval $inlibc
11186
11187: see if chsize exists
11188set chsize d_chsize
11189eval $inlibc
11190
758a5d79
JH
11191: see if class exists
11192set class d_class
11193eval $inlibc
11194
b0a2e8e6
MB
11195: see if clearenv exists
11196set clearenv d_clearenv
11197eval $inlibc
11198
34f1896b 11199: Define hasstruct macro for Configure internal use
4e0554ec
JH
11200hasstruct='varname=$1; struct=$2; shift; shift;
11201while $test $# -ge 2; do
11202 case "$1" in
11203 $define) echo "#include <$2>";;
11204 esac ;
11205 shift 2;
11206done > try.c;
11207echo "int main () { struct $struct foo; }" >> try.c;
11208set try;
11209if eval $compile; then
11210 val="$define";
11211else
11212 val="$undef";
11213fi;
11214set $varname;
11215eval $setvar;
5b813a60 11216$rm_try'
4e0554ec 11217
34f1896b 11218: see whether socket exists
4e0554ec
JH
11219socketlib=''
11220sockethdr=''
4e0554ec
JH
11221echo " "
11222$echo $n "Hmm... $c" >&4
11223if set socket val -f d_socket; eval $csym; $val; then
11224 echo "Looks like you have Berkeley networking support." >&4
11225 d_socket="$define"
11226 if set setsockopt val -f; eval $csym; $val; then
11227 d_oldsock="$undef"
11228 else
11229 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11230 d_oldsock="$define"
11231 fi
11232else
11233 if $contains socklib libc.list >/dev/null 2>&1; then
11234 echo "Looks like you have Berkeley networking support." >&4
11235 d_socket="$define"
11236 : we will have to assume that it supports the 4.2 BSD interface
11237 d_oldsock="$undef"
11238 else
11239 echo "You don't have Berkeley networking in libc$_a..." >&4
11240 if test "X$d_socket" = "X$define"; then
11241 echo "...but you seem to believe that you have sockets." >&4
11242 else
11243 for net in net socket
11244 do
11245 if test -f /usr/lib/lib$net$_a; then
11246 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
11247 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11248 if $contains socket libc.list >/dev/null 2>&1; then
11249 d_socket="$define"
11250 socketlib="-l$net"
11251 case "$net" in
11252 net)
11253 echo "...but the Wollongong group seems to have hacked it in." >&4
11254 sockethdr="-I/usr/netinclude"
11255 ;;
11256 esac
5b813a60 11257 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
11258 if $contains setsockopt libc.list >/dev/null 2>&1; then
11259 d_oldsock="$undef"
11260 else
11261 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11262 d_oldsock="$define"
11263 fi
11264 break
11265 fi
11266 fi
11267 done
11268 if test "X$d_socket" != "X$define"; then
11269 echo "or anywhere else I see." >&4
11270 d_socket="$undef"
11271 d_oldsock="$undef"
11272 fi
11273 fi
11274 fi
11275fi
11276
11277: see if socketpair exists
11278set socketpair d_sockpair
11279eval $inlibc
11280
11281
11282echo " "
b8677e3b
MB
11283echo "Checking the availability sa_len in the sock struct ..." >&4
11284$cat >try.c <<EOF
11285#include <sys/types.h>
11286#include <sys/socket.h>
11287int main() {
11288struct sockaddr sa;
11289return (sa.sa_len);
11290}
11291EOF
11292val="$undef"
11293set try; if eval $compile; then
11294 val="$define"
11295fi
11296set d_sockaddr_sa_len; eval $setvar
11297$rm_try
11298
11299echo " "
f53580fe
MB
11300echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11301$cat >try.c <<EOF
11302#include <sys/types.h>
11303#include <sys/socket.h>
11304#include <netinet/in.h>
11305int main() {
11306struct sockaddr_in6 sin6;
11307return (sin6.sin6_scope_id);
11308}
11309EOF
11310val="$undef"
11311set try; if eval $compile; then
11312 val="$define"
11313fi
11314set d_sin6_scope_id; eval $setvar
11315$rm_try
11316
11317echo " "
3c728e00 11318echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11319for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11320 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11321 $cat >try.c <<EOF
11322#include <sys/types.h>
11323#include <sys/socket.h>
11324int main() {
11325 int i = $ENUM;
11326}
11327EOF
11328 val="$undef"
11329 set try; if eval $compile; then
11330 val="$define"
11331 fi
11332 set d_${enum}; eval $setvar
5b813a60 11333 $rm_try
4e0554ec
JH
11334done
11335
11336: see if this is a sys/uio.h system
11337set sys/uio.h i_sysuio
11338eval $inhdr
11339
34f1896b 11340: Check for cmsghdr support
4e0554ec
JH
11341echo " "
11342echo "Checking to see if your system supports struct cmsghdr..." >&4
11343set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11344eval $hasstruct
11345case "$d_cmsghdr_s" in
11346"$define") echo "Yes, it does." ;;
11347*) echo "No, it doesn't." ;;
11348esac
11349
11350
b4eb6b3d
JH
11351: check for const keyword
11352echo " "
11353echo 'Checking to see if your C compiler knows about "const"...' >&4
11354$cat >const.c <<'EOCP'
11355typedef struct spug { int drokk; } spug;
76f47787 11356int main()
b4eb6b3d
JH
11357{
11358 const char *foo;
666ea192 11359 const spug y = { 0 };
b4eb6b3d
JH
11360}
11361EOCP
11362if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11363 val="$define"
11364 echo "Yup, it does."
11365else
11366 val="$undef"
11367 echo "Nope, it doesn't."
11368fi
11369set d_const
11370eval $setvar
11371
89ce900e
JH
11372: see if copysignl exists
11373set copysignl d_copysignl
11374eval $inlibc
11375
b4eb6b3d
JH
11376: see if crypt exists
11377echo " "
a5a94ea5
JH
11378set crypt d_crypt
11379eval $inlibc
11380case "$d_crypt" in
11381$define) cryptlib='' ;;
11382*) if set crypt val -f d_crypt; eval $csym; $val; then
11383 echo 'crypt() found.' >&4
b4eb6b3d 11384 val="$define"
a5a94ea5
JH
11385 cryptlib=''
11386 else
11387 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11388 if $test -z "$cryptlib"; then
11389 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11390 else
11391 cryptlib=-lcrypt
11392 fi
11393 if $test -z "$cryptlib"; then
11394 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11395 else
11396 cryptlib=-lcrypt
11397 fi
11398 if $test -z "$cryptlib"; then
11399 cryptlib=`./loc libcrypt$_a "" $libpth`
11400 else
11401 cryptlib=-lcrypt
11402 fi
11403 if $test -z "$cryptlib"; then
11404 echo 'crypt() NOT found.' >&4
11405 val="$undef"
11406 else
11407 val="$define"
11408 fi
b4eb6b3d 11409 fi
a5a94ea5
JH
11410 set d_crypt
11411 eval $setvar
11412 ;;
11413esac
b4eb6b3d 11414
10bc17b6
JH
11415: see if this is a crypt.h system
11416set crypt.h i_crypt
11417eval $inhdr
11418
11419: see if crypt_r exists
11420set crypt_r d_crypt_r
11421eval $inlibc
11422case "$d_crypt_r" in
11423"$define")
11424 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11425 case "$d_crypt_r_proto:$usethreads" in
11426 ":define") d_crypt_r_proto=define
a48ec845
JH
11427 set d_crypt_r_proto crypt_r $hdrs
11428 eval $hasproto ;;
11429 *) ;;
11430 esac
11431 case "$d_crypt_r_proto" in
11432 define)
10bc17b6
JH
11433 case "$crypt_r_proto" in
11434 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
61c26d18 11435 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
10bc17b6
JH
11436 esac
11437 case "$crypt_r_proto" in
b430fd04 11438 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
61c26d18 11439 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
b430fd04
JH
11440 esac
11441 case "$crypt_r_proto" in
90e831dc 11442 ''|0) d_crypt_r=undef
10bc17b6 11443 crypt_r_proto=0
a48ec845 11444 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11445 * ) case "$crypt_r_proto" in
11446 REENTRANT_PROTO*) ;;
11447 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11448 esac
11449 echo "Prototype: $try" ;;
11450 esac
11451 ;;
c18e646a
JH
11452 *) case "$usethreads" in
11453 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11454 esac
90e831dc
SB
11455 d_crypt_r=undef
11456 crypt_r_proto=0
c18e646a 11457 ;;
a48ec845
JH
11458 esac
11459 ;;
10bc17b6
JH
11460*) crypt_r_proto=0
11461 ;;
11462esac
11463
b4eb6b3d
JH
11464: get csh whereabouts
11465case "$csh" in
11466'csh') val="$undef" ;;
11467*) val="$define" ;;
11468esac
11469set d_csh
11470eval $setvar
11471: Respect a hint or command line value for full_csh.
11472case "$full_csh" in
11473'') full_csh=$csh ;;
11474esac
11475
13cfc98d
MB
11476: see if ctermid exists
11477set ctermid d_ctermid
11478eval $inlibc
11479
10bc17b6
JH
11480: see if ctermid_r exists
11481set ctermid_r d_ctermid_r
11482eval $inlibc
11483case "$d_ctermid_r" in
11484"$define")
31ee0cb7 11485 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11486 case "$d_ctermid_r_proto:$usethreads" in
11487 ":define") d_ctermid_r_proto=define
a48ec845
JH
11488 set d_ctermid_r_proto ctermid_r $hdrs
11489 eval $hasproto ;;
11490 *) ;;
11491 esac
11492 case "$d_ctermid_r_proto" in
11493 define)
10bc17b6
JH
11494 case "$ctermid_r_proto" in
11495 ''|0) try='char* ctermid_r(char*);'
61c26d18 11496 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
10bc17b6
JH
11497 esac
11498 case "$ctermid_r_proto" in
90e831dc 11499 ''|0) d_ctermid_r=undef
10bc17b6 11500 ctermid_r_proto=0
a48ec845 11501 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11502 * ) case "$ctermid_r_proto" in
11503 REENTRANT_PROTO*) ;;
11504 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11505 esac
11506 echo "Prototype: $try" ;;
11507 esac
11508 ;;
c18e646a
JH
11509 *) case "$usethreads" in
11510 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11511 esac
90e831dc
SB
11512 d_ctermid_r=undef
11513 ctermid_r_proto=0
c18e646a 11514 ;;
a48ec845
JH
11515 esac
11516 ;;
10bc17b6
JH
11517*) ctermid_r_proto=0
11518 ;;
11519esac
11520
11521: see if ctime_r exists
11522set ctime_r d_ctime_r
11523eval $inlibc
11524case "$d_ctime_r" in
11525"$define")
d63eadf0 11526 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11527 case "$d_ctime_r_proto:$usethreads" in
11528 ":define") d_ctime_r_proto=define
a48ec845
JH
11529 set d_ctime_r_proto ctime_r $hdrs
11530 eval $hasproto ;;
11531 *) ;;
11532 esac
11533 case "$d_ctime_r_proto" in
11534 define)
10bc17b6
JH
11535 case "$ctime_r_proto" in
11536 ''|0) try='char* ctime_r(const time_t*, char*);'
61c26d18 11537 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
10bc17b6
JH
11538 esac
11539 case "$ctime_r_proto" in
11540 ''|0) try='char* ctime_r(const time_t*, char*, int);'
61c26d18 11541 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
10bc17b6
JH
11542 esac
11543 case "$ctime_r_proto" in
11544 ''|0) try='int ctime_r(const time_t*, char*);'
61c26d18 11545 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
10bc17b6
JH
11546 esac
11547 case "$ctime_r_proto" in
11548 ''|0) try='int ctime_r(const time_t*, char*, int);'
61c26d18 11549 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
10bc17b6
JH
11550 esac
11551 case "$ctime_r_proto" in
90e831dc 11552 ''|0) d_ctime_r=undef
10bc17b6 11553 ctime_r_proto=0
a48ec845 11554 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11555 * ) case "$ctime_r_proto" in
11556 REENTRANT_PROTO*) ;;
11557 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11558 esac
11559 echo "Prototype: $try" ;;
11560 esac
11561 ;;
c18e646a
JH
11562 *) case "$usethreads" in
11563 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11564 esac
90e831dc
SB
11565 d_ctime_r=undef
11566 ctime_r_proto=0
c18e646a 11567 ;;
a48ec845
JH
11568 esac
11569 ;;
10bc17b6
JH
11570*) ctime_r_proto=0
11571 ;;
11572esac
11573
b4eb6b3d
JH
11574: see if cuserid exists
11575set cuserid d_cuserid
11576eval $inlibc
11577
11578: see if this is a limits.h system
11579set limits.h i_limits
11580eval $inhdr
11581
11582: see if this is a float.h system
11583set float.h i_float
11584eval $inhdr
11585
11586: See if number of significant digits in a double precision number is known
11587echo " "
11588$cat >dbl_dig.c <<EOM
11589#$i_limits I_LIMITS
11590#$i_float I_FLOAT
11591#ifdef I_LIMITS
11592#include <limits.h>
11593#endif
11594#ifdef I_FLOAT
11595#include <float.h>
11596#endif
11597#ifdef DBL_DIG
11598printf("Contains DBL_DIG");
11599#endif
11600EOM
11601$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11602if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11603 echo "DBL_DIG found." >&4
11604 val="$define"
11605else
11606 echo "DBL_DIG NOT found." >&4
11607 val="$undef"
11608fi
11609$rm -f dbl_dig.?
11610set d_dbl_dig
11611eval $setvar
11612
2ef53570
JH
11613: see if dbm.h is available
11614: see if dbmclose exists
11615set dbmclose d_dbmclose
11616eval $inlibc
11617
11618case "$d_dbmclose" in
11619$define)
11620 set dbm.h i_dbm
11621 eval $inhdr
11622 case "$i_dbm" in
11623 $define)
11624 val="$undef"
11625 set i_rpcsvcdbm
11626 eval $setvar
11627 ;;
11628 *) set rpcsvc/dbm.h i_rpcsvcdbm
11629 eval $inhdr
11630 ;;
11631 esac
11632 ;;
11633*) echo "We won't be including <dbm.h>"
11634 val="$undef"
11635 set i_dbm
11636 eval $setvar
11637 val="$undef"
11638 set i_rpcsvcdbm
11639 eval $setvar
11640 ;;
11641esac
11642
11643: see if prototype for dbminit is available
11644echo " "
11645set d_dbminitproto dbminit $i_dbm dbm.h
11646eval $hasproto
11647
b4eb6b3d
JH
11648: see if difftime exists
11649set difftime d_difftime
11650eval $inlibc
11651
11652: see if this is a dirent system
11653echo " "
11654if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11655 val="$define"
11656 echo "<dirent.h> found." >&4
11657else
11658 val="$undef"
11659 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11660 echo "<sys/dir.h> found." >&4
11661 echo " "
11662 else
11663 xinc=`./findhdr sys/ndir.h`
11664 fi
11665 echo "<dirent.h> NOT found." >&4
11666fi
11667set i_dirent
11668eval $setvar
11669
11670: Look for type of directory structure.
11671echo " "
11672$cppstdin $cppflags $cppminus < "$xinc" > try.c
11673
11674case "$direntrytype" in
11675''|' ')
11676 case "$i_dirent" in
11677 $define) guess1='struct dirent' ;;
11678 *) guess1='struct direct' ;;
11679 esac
11680 ;;
11681*) guess1="$direntrytype"
11682 ;;
11683esac
11684
11685case "$guess1" in
11686'struct dirent') guess2='struct direct' ;;
11687*) guess2='struct dirent' ;;
11688esac
5b813a60 11689
b4eb6b3d
JH
11690if $contains "$guess1" try.c >/dev/null 2>&1; then
11691 direntrytype="$guess1"
11692 echo "Your directory entries are $direntrytype." >&4
11693elif $contains "$guess2" try.c >/dev/null 2>&1; then
11694 direntrytype="$guess2"
11695 echo "Your directory entries seem to be $direntrytype." >&4
11696else
11697 echo "I don't recognize your system's directory entries." >&4
11698 rp="What type is used for directory entries on this system?"
11699 dflt="$guess1"
11700 . ./myread
11701 direntrytype="$ans"
11702fi
5b813a60 11703$rm_try
b4eb6b3d
JH
11704
11705: see if the directory entry stores field length
11706echo " "
11707$cppstdin $cppflags $cppminus < "$xinc" > try.c
11708if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11709 echo "Good, your directory entry keeps length information in d_namlen." >&4
11710 val="$define"
11711else
11712 echo "Your directory entry does not know about the d_namlen field." >&4
11713 val="$undef"
11714fi
11715set d_dirnamlen
11716eval $setvar
5b813a60 11717$rm_try
b4eb6b3d 11718
de52168c
SP
11719: Look for DIR.dd_fd
11720case "$i_dirent" in
11721"$define")
11722 echo "Checking to see if DIR has a dd_fd member variable" >&4
11723 $cat >try.c <<EOCP
11724#$i_stdlib I_STDLIB
11725#ifdef I_STDLIB
11726#include <stdlib.h>
11727#endif
11728#include <dirent.h>
11729
11730int main() {
11731 DIR dir;
11732 dir.dd_fd = 1;
11733 return 0;
11734}
11735EOCP
11736 val=$undef
11737 set try
11738 if eval $compile; then
11739 echo "Yes, it does."
11740 val="$define"
11741 else
11742 echo "No, it does not."
11743 val="$undef"
11744 fi
11745 ;;
11746*)
11747 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11748 val="$undef"
11749 ;;
11750esac
11751set d_dir_dd_fd
11752eval $setvar
5b813a60 11753$rm_try
de52168c 11754
ae0e3d3b
JH
11755: see if this is an sysdir system
11756set sys/dir.h i_sysdir
11757eval $inhdr
11758
11759: see if this is an sysndir system
11760set sys/ndir.h i_sysndir
11761eval $inhdr
11762
11763: Look for dirfd
11764echo " "
11765$cat >dirfd.c <<EOM
11766#include <stdio.h>
55954f19
JH
11767#$i_stdlib I_STDLIB
11768#ifdef I_STDLIB
11769#include <stdlib.h>
11770#endif
ae0e3d3b
JH
11771#$i_dirent I_DIRENT /**/
11772#$i_sysdir I_SYS_DIR /**/
11773#$i_sysndir I_SYS_NDIR /**/
11774#$i_systypes I_SYS_TYPES /**/
11775#if defined(I_SYS_TYPES)
11776#include <sys/types.h>
11777#endif
11778#if defined(I_DIRENT)
11779#include <dirent.h>
11780#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11781#include <sys/dir.h>
11782#endif
11783#else
11784#ifdef I_SYS_NDIR
11785#include <sys/ndir.h>
11786#else
11787#ifdef I_SYS_DIR
11788#ifdef hp9000s500
11789#include <ndir.h> /* may be wrong in the future */
11790#else
11791#include <sys/dir.h>
11792#endif
11793#endif
11794#endif
11795#endif
11796int main() {
11797 DIR *dirp = opendir(".");
11798 if (dirfd(dirp) >= 0)
11799 exit(0);
11800 else
11801 exit(1);
11802}
11803EOM
5cadb3f3 11804val=$undef
ae0e3d3b
JH
11805set dirfd
11806if eval $compile; then
11807 val="$define"
11808fi
11809case "$val" in
11810$define) echo "dirfd() found." >&4 ;;
11811*) echo "dirfd() NOT found." >&4 ;;
11812esac
11813set d_dirfd
11814eval $setvar
11815$rm -f dirfd*
11816
b4eb6b3d
JH
11817: see if dlerror exists
11818xxx_runnm="$runnm"
11819runnm=false
11820set dlerror d_dlerror
11821eval $inlibc
11822runnm="$xxx_runnm"
11823
11824: see if dlfcn is available
11825set dlfcn.h i_dlfcn
11826eval $inhdr
11827
34f1896b 11828: Check what extension to use for shared libs
b4eb6b3d
JH
11829case "$usedl" in
11830$define|y|true)
11831 $cat << EOM
11832
11833On a few systems, the dynamically loaded modules that perl generates and uses
11834will need a different extension than shared libs. The default will probably
11835be appropriate.
11836
11837EOM
11838 case "$dlext" in
11839 '') dflt="$so" ;;
11840 *) dflt="$dlext" ;;
11841 esac
11842 rp='What is the extension of dynamically loaded modules'
11843 . ./myread
11844 dlext="$ans"
11845 ;;
11846*)
11847 dlext="none"
11848 ;;
11849esac
11850
11851: Check if dlsym need a leading underscore
11852echo " "
11853val="$undef"
11854
11855case "$dlsrc" in
11856dl_dlopen.xs)
11857 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11858 $cat >dyna.c <<'EOM'
11859fred () { }
11860EOM
11861
11862$cat >fred.c<<EOM
11863
11864#include <stdio.h>
55954f19
JH
11865#$i_stdlib I_STDLIB
11866#ifdef I_STDLIB
11867#include <stdlib.h>
11868#endif
b4eb6b3d
JH
11869#$i_dlfcn I_DLFCN
11870#ifdef I_DLFCN
5440bc8e 11871#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11872#else
11873#include <sys/types.h>
11874#include <nlist.h>
11875#include <link.h>
11876#endif
11877
11878extern int fred() ;
11879
11880int main()
11881{
11882 void * handle ;
11883 void * symbol ;
11884#ifndef RTLD_LAZY
11885 int mode = 1 ;
11886#else
11887 int mode = RTLD_LAZY ;
11888#endif
11889 handle = dlopen("./dyna.$dlext", mode) ;
11890 if (handle == NULL) {
11891 printf ("1\n") ;
11892 fflush (stdout) ;
11893 exit(0);
11894 }
11895 symbol = dlsym(handle, "fred") ;
11896 if (symbol == NULL) {
11897 /* try putting a leading underscore */
11898 symbol = dlsym(handle, "_fred") ;
11899 if (symbol == NULL) {
11900 printf ("2\n") ;
11901 fflush (stdout) ;
11902 exit(0);
11903 }
11904 printf ("3\n") ;
11905 }
11906 else
11907 printf ("4\n") ;
11908 fflush (stdout) ;
11909 exit(0);
11910}
11911EOM
11912 : Call the object file tmp-dyna.o in case dlext=o.
613d6c3e
MB
11913 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11914 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11915 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11916 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11917 xxx=`$run ./fred`
b4eb6b3d
JH
11918 case $xxx in
11919 1) echo "Test program failed using dlopen." >&4
11920 echo "Perhaps you should not use dynamic loading." >&4;;
11921 2) echo "Test program failed using dlsym." >&4
11922 echo "Perhaps you should not use dynamic loading." >&4;;
11923 3) echo "dlsym needs a leading underscore" >&4
11924 val="$define" ;;
11925 4) echo "dlsym doesn't need a leading underscore." >&4;;
11926 esac
11927 else
11928 echo "I can't compile and run the test program." >&4
11929 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11930 fi
11931 ;;
11932esac
613d6c3e 11933
3c728e00 11934$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11935
11936set d_dlsymun
11937eval $setvar
11938
10bc17b6
JH
11939: see if drand48_r exists
11940set drand48_r d_drand48_r
11941eval $inlibc
11942case "$d_drand48_r" in
11943"$define")
11944 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11945 case "$d_drand48_r_proto:$usethreads" in
11946 ":define") d_drand48_r_proto=define
a48ec845
JH
11947 set d_drand48_r_proto drand48_r $hdrs
11948 eval $hasproto ;;
11949 *) ;;
11950 esac
11951 case "$d_drand48_r_proto" in
11952 define)
10bc17b6
JH
11953 case "$drand48_r_proto" in
11954 ''|0) try='int drand48_r(struct drand48_data*, double*);'
61c26d18 11955 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
10bc17b6
JH
11956 esac
11957 case "$drand48_r_proto" in
90e831dc 11958 ''|0) d_drand48_r=undef
10bc17b6 11959 drand48_r_proto=0
a48ec845 11960 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11961 * ) case "$drand48_r_proto" in
11962 REENTRANT_PROTO*) ;;
11963 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11964 esac
11965 echo "Prototype: $try" ;;
11966 esac
11967 ;;
c18e646a
JH
11968 *) case "$usethreads" in
11969 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11970 esac
90e831dc
SB
11971 d_drand48_r=undef
11972 drand48_r_proto=0
c18e646a 11973 ;;
a48ec845
JH
11974 esac
11975 ;;
10bc17b6
JH
11976*) drand48_r_proto=0
11977 ;;
11978esac
11979
11980: see if prototype for drand48 is available
11981echo " "
11982set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11983eval $hasproto
11984
b4eb6b3d
JH
11985: see if dup2 exists
11986set dup2 d_dup2
11987eval $inlibc
11988
11989: see if eaccess exists
11990set eaccess d_eaccess
11991eval $inlibc
11992
11993: see if endgrent exists
11994set endgrent d_endgrent
11995eval $inlibc
11996
10bc17b6
JH
11997: see if this is an grp system
11998set grp.h i_grp
11999eval $inhdr
12000
12001case "$i_grp" in
12002$define)
12003 xxx=`./findhdr grp.h`
12004 $cppstdin $cppflags $cppminus < $xxx >$$.h
12005
12006 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12007 val="$define"
12008 else
12009 val="$undef"
12010 fi
12011 set d_grpasswd
12012 eval $setvar
12013
12014 $rm -f $$.h
12015 ;;
12016*)
12017 val="$undef";
12018 set d_grpasswd; eval $setvar
12019 ;;
12020esac
12021
12022: see if endgrent_r exists
12023set endgrent_r d_endgrent_r
12024eval $inlibc
12025case "$d_endgrent_r" in
12026"$define")
12027 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12028 case "$d_endgrent_r_proto:$usethreads" in
12029 ":define") d_endgrent_r_proto=define
a48ec845
JH
12030 set d_endgrent_r_proto endgrent_r $hdrs
12031 eval $hasproto ;;
12032 *) ;;
12033 esac
12034 case "$d_endgrent_r_proto" in
12035 define)
10bc17b6
JH
12036 case "$endgrent_r_proto" in
12037 ''|0) try='int endgrent_r(FILE**);'
61c26d18 12038 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
10bc17b6
JH
12039 esac
12040 case "$endgrent_r_proto" in
12041 ''|0) try='void endgrent_r(FILE**);'
61c26d18 12042 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
10bc17b6
JH
12043 esac
12044 case "$endgrent_r_proto" in
90e831dc 12045 ''|0) d_endgrent_r=undef
10bc17b6 12046 endgrent_r_proto=0
a48ec845 12047 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12048 * ) case "$endgrent_r_proto" in
12049 REENTRANT_PROTO*) ;;
12050 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12051 esac
12052 echo "Prototype: $try" ;;
12053 esac
12054 ;;
c18e646a
JH
12055 *) case "$usethreads" in
12056 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12057 esac
90e831dc
SB
12058 d_endgrent_r=undef
12059 endgrent_r_proto=0
c18e646a 12060 ;;
a48ec845
JH
12061 esac
12062 ;;
10bc17b6
JH
12063*) endgrent_r_proto=0
12064 ;;
12065esac
12066
b4eb6b3d
JH
12067: see if endhostent exists
12068set endhostent d_endhent
12069eval $inlibc
12070
10bc17b6
JH
12071: see if this is a netdb.h system
12072set netdb.h i_netdb
12073eval $inhdr
12074
12075: see if endhostent_r exists
12076set endhostent_r d_endhostent_r
12077eval $inlibc
12078case "$d_endhostent_r" in
12079"$define")
12080 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12081 case "$d_endhostent_r_proto:$usethreads" in
12082 ":define") d_endhostent_r_proto=define
a48ec845
JH
12083 set d_endhostent_r_proto endhostent_r $hdrs
12084 eval $hasproto ;;
12085 *) ;;
12086 esac
12087 case "$d_endhostent_r_proto" in
12088 define)
10bc17b6
JH
12089 case "$endhostent_r_proto" in
12090 ''|0) try='int endhostent_r(struct hostent_data*);'
61c26d18 12091 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
12092 esac
12093 case "$endhostent_r_proto" in
12094 ''|0) try='void endhostent_r(struct hostent_data*);'
61c26d18 12095 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
12096 esac
12097 case "$endhostent_r_proto" in
90e831dc 12098 ''|0) d_endhostent_r=undef
10bc17b6 12099 endhostent_r_proto=0
a48ec845 12100 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12101 * ) case "$endhostent_r_proto" in
12102 REENTRANT_PROTO*) ;;
12103 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12104 esac
12105 echo "Prototype: $try" ;;
12106 esac
12107 ;;
c18e646a
JH
12108 *) case "$usethreads" in
12109 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12110 esac
90e831dc
SB
12111 d_endhostent_r=undef
12112 endhostent_r_proto=0
c18e646a 12113 ;;
a48ec845
JH
12114 esac
12115 ;;
10bc17b6
JH
12116*) endhostent_r_proto=0
12117 ;;
12118esac
12119
b4eb6b3d
JH
12120: see if endnetent exists
12121set endnetent d_endnent
12122eval $inlibc
12123
10bc17b6
JH
12124: see if endnetent_r exists
12125set endnetent_r d_endnetent_r
12126eval $inlibc
12127case "$d_endnetent_r" in
12128"$define")
12129 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12130 case "$d_endnetent_r_proto:$usethreads" in
12131 ":define") d_endnetent_r_proto=define
a48ec845
JH
12132 set d_endnetent_r_proto endnetent_r $hdrs
12133 eval $hasproto ;;
12134 *) ;;
12135 esac
12136 case "$d_endnetent_r_proto" in
12137 define)
10bc17b6
JH
12138 case "$endnetent_r_proto" in
12139 ''|0) try='int endnetent_r(struct netent_data*);'
61c26d18 12140 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
12141 esac
12142 case "$endnetent_r_proto" in
12143 ''|0) try='void endnetent_r(struct netent_data*);'
61c26d18 12144 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
12145 esac
12146 case "$endnetent_r_proto" in
90e831dc 12147 ''|0) d_endnetent_r=undef
10bc17b6 12148 endnetent_r_proto=0
a48ec845 12149 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12150 * ) case "$endnetent_r_proto" in
12151 REENTRANT_PROTO*) ;;
12152 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12153 esac
12154 echo "Prototype: $try" ;;
12155 esac
12156 ;;
c18e646a
JH
12157 *) case "$usethreads" in
12158 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12159 esac
90e831dc
SB
12160 d_endnetent_r=undef
12161 endnetent_r_proto=0
c18e646a 12162 ;;
a48ec845
JH
12163 esac
12164 ;;
10bc17b6
JH
12165*) endnetent_r_proto=0
12166 ;;
12167esac
12168
b4eb6b3d
JH
12169: see if endprotoent exists
12170set endprotoent d_endpent
12171eval $inlibc
12172
10bc17b6
JH
12173: see if endprotoent_r exists
12174set endprotoent_r d_endprotoent_r
12175eval $inlibc
12176case "$d_endprotoent_r" in
12177"$define")
12178 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12179 case "$d_endprotoent_r_proto:$usethreads" in
12180 ":define") d_endprotoent_r_proto=define
a48ec845
JH
12181 set d_endprotoent_r_proto endprotoent_r $hdrs
12182 eval $hasproto ;;
12183 *) ;;
12184 esac
12185 case "$d_endprotoent_r_proto" in
12186 define)
10bc17b6
JH
12187 case "$endprotoent_r_proto" in
12188 ''|0) try='int endprotoent_r(struct protoent_data*);'
61c26d18 12189 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
12190 esac
12191 case "$endprotoent_r_proto" in
12192 ''|0) try='void endprotoent_r(struct protoent_data*);'
61c26d18 12193 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
12194 esac
12195 case "$endprotoent_r_proto" in
90e831dc 12196 ''|0) d_endprotoent_r=undef
10bc17b6 12197 endprotoent_r_proto=0
a48ec845 12198 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12199 * ) case "$endprotoent_r_proto" in
12200 REENTRANT_PROTO*) ;;
12201 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12202 esac
12203 echo "Prototype: $try" ;;
12204 esac
12205 ;;
c18e646a
JH
12206 *) case "$usethreads" in
12207 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12208 esac
90e831dc
SB
12209 d_endprotoent_r=undef
12210 endprotoent_r_proto=0
c18e646a 12211 ;;
a48ec845
JH
12212 esac
12213 ;;
10bc17b6
JH
12214*) endprotoent_r_proto=0
12215 ;;
12216esac
12217
b4eb6b3d
JH
12218: see if endpwent exists
12219set endpwent d_endpwent
12220eval $inlibc
12221
10bc17b6
JH
12222: see if this is a pwd.h system
12223set pwd.h i_pwd
12224eval $inhdr
12225
12226case "$i_pwd" in
12227$define)
12228 xxx=`./findhdr pwd.h`
12229 $cppstdin $cppflags $cppminus < $xxx >$$.h
12230
12231 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12232 val="$define"
12233 else
12234 val="$undef"
12235 fi
12236 set d_pwquota
12237 eval $setvar
12238
12239 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12240 val="$define"
12241 else
12242 val="$undef"
12243 fi
12244 set d_pwage
12245 eval $setvar
12246
12247 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12248 val="$define"
12249 else
12250 val="$undef"
12251 fi
12252 set d_pwchange
12253 eval $setvar
12254
12255 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12256 val="$define"
12257 else
12258 val="$undef"
12259 fi
12260 set d_pwclass
12261 eval $setvar
12262
12263 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12264 val="$define"
12265 else
12266 val="$undef"
12267 fi
12268 set d_pwexpire
12269 eval $setvar
12270
12271 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12272 val="$define"
12273 else
12274 val="$undef"
12275 fi
12276 set d_pwcomment
12277 eval $setvar
12278
12279 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12280 val="$define"
12281 else
12282 val="$undef"
12283 fi
12284 set d_pwgecos
12285 eval $setvar
12286
12287 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12288 val="$define"
12289 else
12290 val="$undef"
12291 fi
12292 set d_pwpasswd
12293 eval $setvar
12294
12295 $rm -f $$.h
12296 ;;
12297*)
12298 val="$undef";
12299 set d_pwquota; eval $setvar
12300 set d_pwage; eval $setvar
12301 set d_pwchange; eval $setvar
12302 set d_pwclass; eval $setvar
12303 set d_pwexpire; eval $setvar
12304 set d_pwcomment; eval $setvar
12305 set d_pwgecos; eval $setvar
12306 set d_pwpasswd; eval $setvar
12307 ;;
12308esac
12309
12310: see if endpwent_r exists
12311set endpwent_r d_endpwent_r
12312eval $inlibc
12313case "$d_endpwent_r" in
12314"$define")
12315 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12316 case "$d_endpwent_r_proto:$usethreads" in
12317 ":define") d_endpwent_r_proto=define
a48ec845
JH
12318 set d_endpwent_r_proto endpwent_r $hdrs
12319 eval $hasproto ;;
12320 *) ;;
12321 esac
12322 case "$d_endpwent_r_proto" in
12323 define)
10bc17b6
JH
12324 case "$endpwent_r_proto" in
12325 ''|0) try='int endpwent_r(FILE**);'
61c26d18 12326 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
10bc17b6
JH
12327 esac
12328 case "$endpwent_r_proto" in
12329 ''|0) try='void endpwent_r(FILE**);'
61c26d18 12330 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
10bc17b6
JH
12331 esac
12332 case "$endpwent_r_proto" in
90e831dc 12333 ''|0) d_endpwent_r=undef
10bc17b6 12334 endpwent_r_proto=0
a48ec845 12335 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12336 * ) case "$endpwent_r_proto" in
12337 REENTRANT_PROTO*) ;;
12338 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12339 esac
12340 echo "Prototype: $try" ;;
12341 esac
12342 ;;
c18e646a
JH
12343 *) case "$usethreads" in
12344 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12345 esac
90e831dc
SB
12346 d_endpwent_r=undef
12347 endpwent_r_proto=0
c18e646a 12348 ;;
a48ec845
JH
12349 esac
12350 ;;
10bc17b6
JH
12351*) endpwent_r_proto=0
12352 ;;
12353esac
12354
b4eb6b3d
JH
12355: see if endservent exists
12356set endservent d_endsent
12357eval $inlibc
12358
10bc17b6
JH
12359: see if endservent_r exists
12360set endservent_r d_endservent_r
12361eval $inlibc
12362case "$d_endservent_r" in
12363"$define")
12364 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12365 case "$d_endservent_r_proto:$usethreads" in
12366 ":define") d_endservent_r_proto=define
a48ec845
JH
12367 set d_endservent_r_proto endservent_r $hdrs
12368 eval $hasproto ;;
12369 *) ;;
12370 esac
12371 case "$d_endservent_r_proto" in
12372 define)
10bc17b6
JH
12373 case "$endservent_r_proto" in
12374 ''|0) try='int endservent_r(struct servent_data*);'
61c26d18 12375 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12376 esac
12377 case "$endservent_r_proto" in
12378 ''|0) try='void endservent_r(struct servent_data*);'
61c26d18 12379 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12380 esac
12381 case "$endservent_r_proto" in
90e831dc 12382 ''|0) d_endservent_r=undef
10bc17b6 12383 endservent_r_proto=0
a48ec845 12384 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12385 * ) case "$endservent_r_proto" in
12386 REENTRANT_PROTO*) ;;
12387 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12388 esac
12389 echo "Prototype: $try" ;;
12390 esac
12391 ;;
c18e646a
JH
12392 *) case "$usethreads" in
12393 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12394 esac
90e831dc
SB
12395 d_endservent_r=undef
12396 endservent_r_proto=0
c18e646a 12397 ;;
a48ec845
JH
12398 esac
12399 ;;
10bc17b6
JH
12400*) endservent_r_proto=0
12401 ;;
12402esac
12403
b4eb6b3d
JH
12404: Locate the flags for 'open()'
12405echo " "
55954f19 12406$cat >try.c <<EOCP
b4eb6b3d
JH
12407#include <sys/types.h>
12408#ifdef I_FCNTL
12409#include <fcntl.h>
12410#endif
12411#ifdef I_SYS_FILE
12412#include <sys/file.h>
12413#endif
55954f19
JH
12414#$i_stdlib I_STDLIB
12415#ifdef I_STDLIB
12416#include <stdlib.h>
12417#endif
b4eb6b3d
JH
12418int main() {
12419 if(O_RDONLY);
12420#ifdef O_TRUNC
12421 exit(0);
12422#else
12423 exit(1);
12424#endif
12425}
12426EOCP
12427: check sys/file.h first to get FREAD on Sun
12428if $test `./findhdr sys/file.h` && \
5440bc8e 12429 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12430 h_sysfile=true;
12431 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12432 if $run ./try; then
b4eb6b3d
JH
12433 echo "and you have the 3 argument form of open()." >&4
12434 val="$define"
12435 else
12436 echo "but not the 3 argument form of open(). Oh, well." >&4
12437 val="$undef"
12438 fi
12439elif $test `./findhdr fcntl.h` && \
5440bc8e 12440 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12441 h_fcntl=true;
12442 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12443 if $run ./try; then
b4eb6b3d
JH
12444 echo "and you have the 3 argument form of open()." >&4
12445 val="$define"
12446 else
12447 echo "but not the 3 argument form of open(). Oh, well." >&4
12448 val="$undef"
12449 fi
12450else
12451 val="$undef"
12452 echo "I can't find the O_* constant definitions! You got problems." >&4
12453fi
12454set d_open3
12455eval $setvar
5b813a60 12456$rm_try
b4eb6b3d 12457
3c728e00
JH
12458: see if this is a sys/file.h system
12459val=''
12460set sys/file.h val
12461eval $inhdr
12462
12463: do we need to include sys/file.h ?
12464case "$val" in
12465"$define")
12466 echo " "
12467 if $h_sysfile; then
12468 val="$define"
12469 echo "We'll be including <sys/file.h>." >&4
12470 else
12471 val="$undef"
12472 echo "We won't be including <sys/file.h>." >&4
12473 fi
12474 ;;
12475*)
12476 h_sysfile=false
12477 ;;
12478esac
12479set i_sysfile
12480eval $setvar
12481
12482: see if fcntl.h is there
12483val=''
12484set fcntl.h val
12485eval $inhdr
12486
12487: see if we can include fcntl.h
12488case "$val" in
12489"$define")
12490 echo " "
12491 if $h_fcntl; then
12492 val="$define"
12493 echo "We'll be including <fcntl.h>." >&4
12494 else
12495 val="$undef"
12496 if $h_sysfile; then
12497 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12498 else
12499 echo "We won't be including <fcntl.h>." >&4
12500 fi
12501 fi
12502 ;;
12503*)
12504 h_fcntl=false
12505 val="$undef"
12506 ;;
12507esac
12508set i_fcntl
12509eval $setvar
12510
4dd8f9b3
JH
12511: see if fork exists
12512set fork d_fork
12513eval $inlibc
12514
12515: see if pipe exists
12516set pipe d_pipe
12517eval $inlibc
12518
b4eb6b3d
JH
12519: check for non-blocking I/O stuff
12520case "$h_sysfile" in
a0acbdc3
JH
12521true) echo "#include <sys/file.h>" > head.c;;
12522*)
12523 case "$h_fcntl" in
12524 true) echo "#include <fcntl.h>" > head.c;;
12525 *) echo "#include <sys/fcntl.h>" > head.c;;
12526 esac
12527 ;;
b4eb6b3d
JH
12528esac
12529echo " "
12530echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12531case "$o_nonblock" in
12532'')
12533 $cat head.c > try.c
3c728e00 12534 $cat >>try.c <<EOCP
b4eb6b3d 12535#include <stdio.h>
55954f19
JH
12536#$i_stdlib I_STDLIB
12537#ifdef I_STDLIB
80b3ef99 12538#include <stdlib.h>
55954f19 12539#endif
3c728e00
JH
12540#$i_fcntl I_FCNTL
12541#ifdef I_FCNTL
12542#include <fcntl.h>
12543#endif
b4eb6b3d
JH
12544int main() {
12545#ifdef O_NONBLOCK
12546 printf("O_NONBLOCK\n");
12547 exit(0);
12548#endif
12549#ifdef O_NDELAY
12550 printf("O_NDELAY\n");
12551 exit(0);
12552#endif
12553#ifdef FNDELAY
12554 printf("FNDELAY\n");
12555 exit(0);
12556#endif
12557 exit(0);
12558}
12559EOCP
12560 set try
12561 if eval $compile_ok; then
5440bc8e 12562 o_nonblock=`$run ./try`
b4eb6b3d
JH
12563 case "$o_nonblock" in
12564 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12565 *) echo "Seems like we can use $o_nonblock.";;
12566 esac
12567 else
12568 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12569 fi
12570 ;;
12571*) echo "Using $hint value $o_nonblock.";;
12572esac
5b813a60 12573$rm_try
b4eb6b3d
JH
12574
12575echo " "
12576echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12577case "$eagain" in
12578'')
4dd8f9b3
JH
12579 case "$d_fork:$d_pipe" in
12580 define:define)
b4eb6b3d
JH
12581 $cat head.c > try.c
12582 $cat >>try.c <<EOCP
12583#include <errno.h>
12584#include <sys/types.h>
12585#include <signal.h>
5b813a60 12586#include <stdio.h>
55954f19
JH
12587#$i_stdlib I_STDLIB
12588#ifdef I_STDLIB
12589#include <stdlib.h>
12590#endif
1deb0a86
JH
12591#$i_fcntl I_FCNTL
12592#ifdef I_FCNTL
12593#include <fcntl.h>
12594#endif
b4eb6b3d
JH
12595#define MY_O_NONBLOCK $o_nonblock
12596#ifndef errno /* XXX need better Configure test */
12597extern int errno;
12598#endif
12599#$i_unistd I_UNISTD
12600#ifdef I_UNISTD
12601#include <unistd.h>
12602#endif
12603#$i_string I_STRING
12604#ifdef I_STRING
12605#include <string.h>
12606#else
12607#include <strings.h>
12608#endif
7090f861 12609$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12610EOCP
12611 $cat >> try.c <<'EOCP'
12612int main()
12613{
12614 int pd[2];
12615 int pu[2];
12616 char buf[1];
12617 char string[100];
12618
12619 pipe(pd); /* Down: child -> parent */
12620 pipe(pu); /* Up: parent -> child */
12621 if (0 != fork()) {
12622 int ret;
12623 close(pd[1]); /* Parent reads from pd[0] */
12624 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12625#ifdef F_SETFL
b4eb6b3d
JH
12626 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12627 exit(1);
a0acbdc3
JH
12628#else
12629 exit(4);
12630#endif
b4eb6b3d
JH
12631 signal(SIGALRM, blech);
12632 alarm(5);
12633 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12634 exit(2);
12635 sprintf(string, "%d\n", ret);
12636 write(2, string, strlen(string));
12637 alarm(0);
12638#ifdef EAGAIN
12639 if (errno == EAGAIN) {
12640 printf("EAGAIN\n");
12641 goto ok;
12642 }
12643#endif
12644#ifdef EWOULDBLOCK
12645 if (errno == EWOULDBLOCK)
12646 printf("EWOULDBLOCK\n");
12647#endif
12648 ok:
12649 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12650 sleep(2); /* Give it time to close our pipe */
12651 alarm(5);
12652 ret = read(pd[0], buf, 1); /* Should read EOF */
12653 alarm(0);
12654 sprintf(string, "%d\n", ret);
868439a2 12655 write(4, string, strlen(string));
b4eb6b3d
JH
12656 exit(0);
12657 }
12658
12659 close(pd[0]); /* We write to pd[1] */
12660 close(pu[1]); /* We read from pu[0] */
12661 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12662 close(pd[1]); /* Pipe pd is now fully closed! */
12663 exit(0); /* Bye bye, thank you for playing! */
12664}
12665EOCP
12666 set try
12667 if eval $compile_ok; then
12668 echo "$startsh" >mtry
868439a2 12669 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12670 chmod +x mtry
12671 ./mtry >/dev/null 2>&1
12672 case $? in
12673 0) eagain=`$cat try.out`;;
12674 1) echo "Could not perform non-blocking setting!";;
12675 2) echo "I did a successful read() for something that was not there!";;
12676 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12677 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12678 *) echo "Something terribly wrong happened during testing.";;
12679 esac
12680 rd_nodata=`$cat try.ret`
12681 echo "A read() system call with no data present returns $rd_nodata."
12682 case "$rd_nodata" in
12683 0|-1) ;;
12684 *)
12685 echo "(That's peculiar, fixing that to be -1.)"
12686 rd_nodata=-1
12687 ;;
12688 esac
12689 case "$eagain" in
12690 '')
12691 echo "Forcing errno EAGAIN on read() with no data available."
12692 eagain=EAGAIN
12693 ;;
12694 *)
12695 echo "Your read() sets errno to $eagain when no data is available."
12696 ;;
12697 esac
12698 status=`$cat try.err`
12699 case "$status" in
12700 0) echo "And it correctly returns 0 to signal EOF.";;
12701 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12702 *) echo "However, your read() returns '$status' on EOF??";;
12703 esac
12704 val="$define"
12705 if test "$status" = "$rd_nodata"; then
12706 echo "WARNING: you can't distinguish between EOF and no data!"
12707 val="$undef"
12708 fi
12709 else
12710 echo "I can't compile the test program--assuming errno EAGAIN will do."
12711 eagain=EAGAIN
12712 fi
4dd8f9b3
JH
12713 ;;
12714 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12715 eagain=EAGAIN
12716 val="$define"
12717 ;;
12718 esac
b4eb6b3d
JH
12719 set d_eofnblk
12720 eval $setvar
12721 ;;
12722*)
12723 echo "Using $hint value $eagain."
12724 echo "Your read() returns $rd_nodata when no data is present."
12725 case "$d_eofnblk" in
12726 "$define") echo "And you can see EOF because read() returns 0.";;
12727 "$undef") echo "But you can't see EOF status from read() returned value.";;
12728 *)
12729 echo "(Assuming you can't see EOF status from read anyway.)"
12730 d_eofnblk=$undef
12731 ;;
12732 esac
12733 ;;
12734esac
5b813a60 12735$rm_try head.c mtry
b4eb6b3d 12736
15b61c98
JH
12737: see if _ptr and _cnt from stdio act std
12738echo " "
b4eb6b3d 12739
15b61c98
JH
12740if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12741 echo "(Looks like you have stdio.h from BSD.)"
12742 case "$stdio_ptr" in
12743 '') stdio_ptr='((fp)->_p)'
12744 ptr_lval=$define
12745 ;;
12746 *) ptr_lval=$d_stdio_ptr_lval;;
12747 esac
12748 case "$stdio_cnt" in
12749 '') stdio_cnt='((fp)->_r)'
12750 cnt_lval=$define
12751 ;;
12752 *) cnt_lval=$d_stdio_cnt_lval;;
12753 esac
12754 case "$stdio_base" in
12755 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12756 esac
12757 case "$stdio_bufsiz" in
12758 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12759 esac
12760elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12761 echo "(Looks like you have stdio.h from Linux.)"
12762 case "$stdio_ptr" in
12763 '') stdio_ptr='((fp)->_IO_read_ptr)'
12764 ptr_lval=$define
12765 ;;
12766 *) ptr_lval=$d_stdio_ptr_lval;;
12767 esac
12768 case "$stdio_cnt" in
12769 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12770 cnt_lval=$undef
12771 ;;
12772 *) cnt_lval=$d_stdio_cnt_lval;;
12773 esac
12774 case "$stdio_base" in
12775 '') stdio_base='((fp)->_IO_read_base)';;
12776 esac
12777 case "$stdio_bufsiz" in
12778 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12779 esac
12780else
12781 case "$stdio_ptr" in
12782 '') stdio_ptr='((fp)->_ptr)'
12783 ptr_lval=$define
12784 ;;
12785 *) ptr_lval=$d_stdio_ptr_lval;;
12786 esac
12787 case "$stdio_cnt" in
12788 '') stdio_cnt='((fp)->_cnt)'
12789 cnt_lval=$define
12790 ;;
12791 *) cnt_lval=$d_stdio_cnt_lval;;
12792 esac
12793 case "$stdio_base" in
12794 '') stdio_base='((fp)->_base)';;
12795 esac
12796 case "$stdio_bufsiz" in
12797 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12798 esac
12799fi
b4eb6b3d 12800
15b61c98
JH
12801: test whether _ptr and _cnt really work
12802echo "Checking how std your stdio is..." >&4
12803$cat >try.c <<EOP
12804#include <stdio.h>
55954f19
JH
12805#$i_stdlib I_STDLIB
12806#ifdef I_STDLIB
9d9004a9 12807#include <stdlib.h>
55954f19 12808#endif
15b61c98
JH
12809#define FILE_ptr(fp) $stdio_ptr
12810#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12811int main() {
15b61c98
JH
12812 FILE *fp = fopen("try.c", "r");
12813 char c = getc(fp);
12814 if (
12815 18 <= FILE_cnt(fp) &&
12816 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12817 )
12818 exit(0);
12819 exit(1);
9d9004a9 12820}
15b61c98
JH
12821EOP
12822val="$undef"
12823set try
12824if eval $compile && $to try.c; then
12825 if $run ./try; then
12826 echo "Your stdio acts pretty std."
12827 val="$define"
9d9004a9 12828 else
15b61c98 12829 echo "Your stdio isn't very std."
9d9004a9 12830 fi
15b61c98
JH
12831else
12832 echo "Your stdio doesn't appear very std."
12833fi
5b813a60 12834$rm_try
15b61c98
JH
12835
12836# glibc 2.2.90 and above apparently change stdio streams so Perl's
12837# direct buffer manipulation no longer works. The Configure tests
12838# should be changed to correctly detect this, but until then,
12839# the following check should at least let perl compile and run.
12840# (This quick fix should be updated before 5.8.1.)
12841# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12842# A. Dougherty, June 3, 2002.
12843case "$d_gnulibc" in
12844$define)
12845 case "$gnulibc_version" in
12846 2.[01]*) ;;
12847 2.2) ;;
12848 2.2.[0-9]) ;;
12849 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12850 val="$undef"
12851 ;;
12852 esac
9d9004a9
AD
12853 ;;
12854esac
15b61c98 12855set d_stdstdio
9d9004a9 12856eval $setvar
9d9004a9 12857
15b61c98
JH
12858: Can _ptr be used as an lvalue?
12859case "$d_stdstdio$ptr_lval" in
12860$define$define) val=$define ;;
12861*) val=$undef ;;
12862esac
12863set d_stdio_ptr_lval
12864eval $setvar
9d9004a9 12865
15b61c98
JH
12866: Can _cnt be used as an lvalue?
12867case "$d_stdstdio$cnt_lval" in
12868$define$define) val=$define ;;
12869*) val=$undef ;;
12870esac
12871set d_stdio_cnt_lval
12872eval $setvar
b4eb6b3d 12873
15b61c98
JH
12874
12875: test whether setting _ptr sets _cnt as a side effect
12876d_stdio_ptr_lval_sets_cnt="$undef"
12877d_stdio_ptr_lval_nochange_cnt="$undef"
12878case "$d_stdio_ptr_lval$d_stdstdio" in
12879$define$define)
12880 echo "Checking to see what happens if we set the stdio ptr..." >&4
12881$cat >try.c <<EOP
12882#include <stdio.h>
12883/* Can we scream? */
12884/* Eat dust sed :-) */
12885/* In the buffer space, no one can hear you scream. */
55954f19
JH
12886#$i_stdlib I_STDLIB
12887#ifdef I_STDLIB
12888#include <stdlib.h>
12889#endif
15b61c98
JH
12890#define FILE_ptr(fp) $stdio_ptr
12891#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12892#include <sys/types.h>
b4eb6b3d 12893int main() {
15b61c98
JH
12894 FILE *fp = fopen("try.c", "r");
12895 int c;
12896 char *ptr;
12897 size_t cnt;
12898 if (!fp) {
12899 puts("Fail even to read");
12900 exit(1);
12901 }
12902 c = getc(fp); /* Read away the first # */
12903 if (c == EOF) {
12904 puts("Fail even to read");
12905 exit(1);
12906 }
12907 if (!(
12908 18 <= FILE_cnt(fp) &&
12909 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12910 )) {
12911 puts("Fail even to read");
12912 exit (1);
12913 }
12914 ptr = (char*) FILE_ptr(fp);
12915 cnt = (size_t)FILE_cnt(fp);
12916
12917 FILE_ptr(fp) += 42;
12918
12919 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12920 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12921 exit (1);
12922 }
12923 if (FILE_cnt(fp) <= 20) {
12924 printf ("Fail (<20 chars to test)");
12925 exit (1);
12926 }
12927 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12928 puts("Fail compare");
12929 exit (1);
12930 }
12931 if (cnt == FILE_cnt(fp)) {
12932 puts("Pass_unchanged");
12933 exit (0);
5b813a60 12934 }
15b61c98
JH
12935 if (FILE_cnt(fp) == (cnt - 42)) {
12936 puts("Pass_changed");
12937 exit (0);
12938 }
12939 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12940 return 1;
12941
12942}
12943EOP
12944 set try
12945 if eval $compile && $to try.c; then
12946 case `$run ./try` in
12947 Pass_changed)
12948 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12949 d_stdio_ptr_lval_sets_cnt="$define" ;;
12950 Pass_unchanged)
12951 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12952 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12953 Fail*)
12954 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12955 *)
12956 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12957 esac
12958 else
12959 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12960 fi
5b813a60 12961 $rm_try
15b61c98
JH
12962 ;;
12963esac
12964
12965: see if _base is also standard
12966val="$undef"
12967case "$d_stdstdio" in
12968$define)
12969 $cat >try.c <<EOP
12970#include <stdio.h>
12971#$i_stdlib I_STDLIB
12972#ifdef I_STDLIB
12973#include <stdlib.h>
12974#endif
12975#define FILE_base(fp) $stdio_base
12976#define FILE_bufsiz(fp) $stdio_bufsiz
12977int main() {
12978 FILE *fp = fopen("try.c", "r");
12979 char c = getc(fp);
12980 if (
12981 19 <= FILE_bufsiz(fp) &&
12982 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12983 )
12984 exit(0);
12985 exit(1);
12986}
12987EOP
12988 set try
12989 if eval $compile && $to try.c; then
12990 if $run ./try; then
12991 echo "And its _base field acts std."
12992 val="$define"
12993 else
12994 echo "But its _base field isn't std."
12995 fi
12996 else
12997 echo "However, it seems to be lacking the _base field."
12998 fi
5b813a60 12999 $rm_try
15b61c98
JH
13000 ;;
13001esac
13002set d_stdiobase
13003eval $setvar
13004
13005: see if fast_stdio exists
13006val="$undef"
13007case "$d_stdstdio:$d_stdio_ptr_lval" in
13008"$define:$define")
13009 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13010 *$define*)
13011 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13012 val="$define"
13013 ;;
13014 esac
13015 ;;
13016esac
13017set d_faststdio
13018eval $setvar
13019
13020
13021
13022: see if fchdir exists
13023set fchdir d_fchdir
13024eval $inlibc
13025
13026: see if fchmod exists
13027set fchmod d_fchmod
13028eval $inlibc
13029
13030: see if fchown exists
13031set fchown d_fchown
13032eval $inlibc
13033
13034: see if this is an fcntl system
13035set fcntl d_fcntl
13036eval $inlibc
13037
15b61c98 13038: See if fcntl-based locking works.
613d6c3e 13039echo " "
15b61c98
JH
13040$cat >try.c <<EOCP
13041#$i_stdlib I_STDLIB
13042#ifdef I_STDLIB
13043#include <stdlib.h>
13044#endif
13045#include <unistd.h>
13046#include <fcntl.h>
13047#include <signal.h>
7090f861 13048$signal_t blech(int x) { exit(3); }
15b61c98
JH
13049int main() {
13050#if defined(F_SETLK) && defined(F_SETLKW)
13051 struct flock flock;
13052 int retval, fd;
13053 fd = open("try.c", O_RDONLY);
13054 flock.l_type = F_RDLCK;
13055 flock.l_whence = SEEK_SET;
13056 flock.l_start = flock.l_len = 0;
13057 signal(SIGALRM, blech);
13058 alarm(10);
13059 retval = fcntl(fd, F_SETLK, &flock);
13060 close(fd);
13061 (retval < 0 ? exit(2) : exit(0));
13062#else
13063 exit(2);
13064#endif
13065}
13066EOCP
13067echo "Checking if fcntl-based file locking works... "
13068case "$d_fcntl" in
13069"$define")
13070 set try
13071 if eval $compile_ok; then
13072 if $run ./try; then
13073 echo "Yes, it seems to work."
13074 val="$define"
13075 else
13076 echo "Nope, it didn't work."
13077 val="$undef"
13078 case "$?" in
13079 3) $cat >&4 <<EOM
13080***
13081*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13082*** This is (almost) impossible.
13083*** If your NFS lock daemons are not feeling well, something like
13084*** this may happen, please investigate. Cannot continue, aborting.
13085***
13086EOM
13087 exit 1
13088 ;;
13089 esac
13090 fi
13091 else
13092 echo "I'm unable to compile the test program, so I'll assume not."
13093 val="$undef"
13094 fi
13095 ;;
13096*) val="$undef";
13097 echo "Nope, since you don't even have fcntl()."
13098 ;;
13099esac
13100set d_fcntl_can_lock
13101eval $setvar
5b813a60 13102$rm_try
15b61c98
JH
13103
13104: check for fd_set items
13105$cat <<EOM
13106
13107Checking to see how well your C compiler handles fd_set and friends ...
13108EOM
13109$cat >try.c <<EOCP
13110#$i_stdlib I_STDLIB
13111#ifdef I_STDLIB
13112#include <stdlib.h>
13113#endif
13114#$i_systime I_SYS_TIME
13115#$i_sysselct I_SYS_SELECT
13116#$d_socket HAS_SOCKET
13117#include <sys/types.h>
13118#ifdef HAS_SOCKET
13119#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13120#endif
13121#ifdef I_SYS_TIME
13122#include <sys/time.h>
13123#endif
13124#ifdef I_SYS_SELECT
13125#include <sys/select.h>
13126#endif
13127int main() {
13128 fd_set fds;
13129
13130#ifdef TRYBITS
13131 if(fds.fds_bits);
13132#endif
13133
13134#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13135 exit(0);
13136#else
13137 exit(1);
13138#endif
13139}
13140EOCP
13141set try -DTRYBITS
13142if eval $compile; then
13143 d_fds_bits="$define"
13144 d_fd_set="$define"
13145 echo "Well, your system knows about the normal fd_set typedef..." >&4
13146 if $run ./try; then
b4eb6b3d
JH
13147 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13148 d_fd_macros="$define"
13149 else
13150 $cat >&4 <<'EOM'
13151but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13152EOM
13153 d_fd_macros="$undef"
13154 fi
13155else
13156 $cat <<'EOM'
13157Hmm, your compiler has some difficulty with fd_set. Checking further...
13158EOM
5440bc8e 13159 set try
b4eb6b3d
JH
13160 if eval $compile; then
13161 d_fds_bits="$undef"
13162 d_fd_set="$define"
13163 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 13164 if $run ./try; then
b4eb6b3d
JH
13165 echo "and you have the normal fd_set macros." >&4
13166 d_fd_macros="$define"
13167 else
13168 $cat <<'EOM'
13169but not the normal fd_set macros! Gross! More work for me...
13170EOM
13171 d_fd_macros="$undef"
13172 fi
13173 else
13174 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13175 d_fd_set="$undef"
13176 d_fds_bits="$undef"
13177 d_fd_macros="$undef"
13178 fi
13179fi
5b813a60 13180$rm_try
b4eb6b3d
JH
13181
13182: see if fgetpos exists
13183set fgetpos d_fgetpos
13184eval $inlibc
13185
758a5d79
JH
13186: see if finite exists
13187set finite d_finite
13188eval $inlibc
13189
13190: see if finitel exists
13191set finitel d_finitel
13192eval $inlibc
13193
b4eb6b3d
JH
13194: see if flock exists
13195set flock d_flock
13196eval $inlibc
13197
2ef53570
JH
13198: see if prototype for flock is available
13199echo " "
13200set d_flockproto flock $i_sysfile sys/file.h
13201eval $hasproto
13202
758a5d79
JH
13203: see if fp_class exists
13204set fp_class d_fp_class
13205eval $inlibc
13206
b4eb6b3d
JH
13207: see if pathconf exists
13208set pathconf d_pathconf
13209eval $inlibc
13210
13211: see if fpathconf exists
13212set fpathconf d_fpathconf
13213eval $inlibc
13214
758a5d79
JH
13215: see if fpclass exists
13216set fpclass d_fpclass
13217eval $inlibc
13218
13219: see if fpclassify exists
13220set fpclassify d_fpclassify
13221eval $inlibc
13222
13223: see if fpclassl exists
13224set fpclassl d_fpclassl
13225eval $inlibc
13226
b4eb6b3d
JH
13227: check for fpos64_t
13228echo " "
13229echo "Checking to see if you have fpos64_t..." >&4
13230$cat >try.c <<EOCP
13231#include <stdio.h>
13232int main() { fpos64_t x = 7; }
13233EOCP
13234set try
13235if eval $compile; then
13236 val="$define"
13237 echo "You have fpos64_t."
13238else
13239 val="$undef"
13240 echo "You do not have fpos64_t."
13241 case "$fpossize" in
13242 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13243 esac
13244fi
5b813a60 13245$rm_try
b4eb6b3d
JH
13246set d_fpos64_t
13247eval $setvar
13248
13249: see if frexpl exists
13250set frexpl d_frexpl
13251eval $inlibc
13252
b4eb6b3d
JH
13253: see if this is a sys/param system
13254set sys/param.h i_sysparam
13255eval $inhdr
13256
13257: see if this is a sys/mount.h system
13258set sys/mount.h i_sysmount
13259eval $inhdr
13260
34f1896b 13261: Check for fs_data_s
b4eb6b3d
JH
13262echo " "
13263echo "Checking to see if your system supports struct fs_data..." >&4
13264set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13265eval $hasstruct
13266case "$d_fs_data_s" in
13267"$define") echo "Yes, it does." ;;
13268*) echo "No, it doesn't." ;;
13269esac
13270
13271: see if fseeko exists
13272set fseeko d_fseeko
13273eval $inlibc
13274case "$longsize" in
132758) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13276esac
13277
13278: see if fsetpos exists
13279set fsetpos d_fsetpos
13280eval $inlibc
13281
b4eb6b3d
JH
13282: see if fstatfs exists
13283set fstatfs d_fstatfs
13284eval $inlibc
13285
b4eb6b3d
JH
13286: see if statvfs exists
13287set statvfs d_statvfs
13288eval $inlibc
13289
13290: see if fstatvfs exists
13291set fstatvfs d_fstatvfs
13292eval $inlibc
13293
13294
411ab01c
JH
13295: see if fsync exists
13296set fsync d_fsync
13297eval $inlibc
13298
b4eb6b3d
JH
13299: see if ftello exists
13300set ftello d_ftello
13301eval $inlibc
13302case "$longsize" in
133038) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13304esac
13305
bff98e24 13306: check for a working futimes
613d6c3e 13307d_futimes="$undef"
bff98e24 13308echo " "
5b813a60 13309echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13310$cat >try.c <<EOCP
13311#include <stdio.h>
13312#include <sys/time.h>
13313#include <errno.h>
13314#include <fcntl.h>
13315
13316int main ()
13317{
13318 int fd, rv;
13319 fd = open ("try.c", O_RDWR);
13320 if (-1 == fd) exit (1);
13321 rv = futimes (fd, NULL);
13322 exit (rv == -1 ? errno : 0);
13323}
13324EOCP
13325set try
13326if eval $compile; then
13327 `$run ./try`
13328 rc=$?
13329 case "$rc" in
5b813a60 13330 0) echo "Yes, you have" >&4
bff98e24
SP
13331 d_futimes="$define"
13332 ;;
5b813a60 13333 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13334 ;;
13335 esac
13336else
43dddb59 13337 echo "No, it does not (probably harmless)" >&4
bff98e24 13338fi
5b813a60 13339$rm_try
dc814df1 13340
e74475c7
MHM
13341: see if ndbm.h is available
13342set ndbm.h i_ndbm
13343eval $inhdr
13344: Compatibility location for RedHat 7.1
13345set gdbm/ndbm.h i_gdbmndbm
13346eval $inhdr
13347: Compatibility location for Debian 4.0
13348set gdbm-ndbm.h i_gdbm_ndbm
13349eval $inhdr
13350
13351val="$undef"
13352if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13353 : see if dbm_open exists
13354 set dbm_open d_dbm_open
13355 eval $inlibc
13356 case "$d_dbm_open" in
13357 $undef)
13358 i_ndbm="$undef"
13359 i_gdbmndbm="$undef"
13360 i_gdbm_ndbm="$undef"
13361 echo "We won't be including <ndbm.h>"
13362 val="$undef"
13363 ;;
13364 *) val="$define"
13365 ;;
13366 esac
13367fi
13368set d_ndbm
13369eval $setvar
13370
13371ndbm_hdr_protochk='name=$1; hdr=$2;
13372eval "ihdr=\$""i_$name";
13373val="$undef";
13374if $test "$ihdr" = "$define"; then
13375 $echo "Checking if your <$hdr> uses prototypes..." >&4;
13376 case "$d_cplusplus" in
13377 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13378 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13379 esac;
13380 case "$val" in
13381 $define) $echo "Your <$hdr> seems to have prototypes";;
13382 *) $echo "Your <$hdr> does not seem to have prototypes";;
13383 esac;
13384fi;
13385set "d_${name}_h_uses_prototypes";
13386eval $setvar'
13387
13388set ndbm ndbm.h
13389eval $ndbm_hdr_protochk
13390set gdbmndbm gdbm/ndbm.h
13391eval $ndbm_hdr_protochk
13392set gdbm_ndbm gdbm-ndbm.h
13393eval $ndbm_hdr_protochk
13394
5086dff9
MB
13395: see if getaddrinfo exists
13396set getaddrinfo d_getaddrinfo
13397eval $inlibc
13398
b4eb6b3d
JH
13399: see if getcwd exists
13400set getcwd d_getcwd
13401eval $inlibc
13402
13403: see if getespwnam exists
13404set getespwnam d_getespwnam
13405eval $inlibc
13406
b4eb6b3d
JH
13407: see if getfsstat exists
13408set getfsstat d_getfsstat
13409eval $inlibc
13410
13411: see if getgrent exists
13412set getgrent d_getgrent
13413eval $inlibc
13414
10bc17b6
JH
13415: see if getgrent_r exists
13416set getgrent_r d_getgrent_r
13417eval $inlibc
13418case "$d_getgrent_r" in
13419"$define")
13420 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13421 case "$d_getgrent_r_proto:$usethreads" in
13422 ":define") d_getgrent_r_proto=define
a48ec845
JH
13423 set d_getgrent_r_proto getgrent_r $hdrs
13424 eval $hasproto ;;
13425 *) ;;
13426 esac
13427 case "$d_getgrent_r_proto" in
13428 define)
10bc17b6
JH
13429 case "$getgrent_r_proto" in
13430 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
61c26d18 13431 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
10bc17b6
JH
13432 esac
13433 case "$getgrent_r_proto" in
13434 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
61c26d18 13435 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
10bc17b6
JH
13436 esac
13437 case "$getgrent_r_proto" in
13438 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
61c26d18 13439 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
10bc17b6
JH
13440 esac
13441 case "$getgrent_r_proto" in
13442 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
61c26d18 13443 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
10bc17b6
JH
13444 esac
13445 case "$getgrent_r_proto" in
13446 ''|0) try='int getgrent_r(struct group*, char*, int);'
61c26d18 13447 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
10bc17b6
JH
13448 esac
13449 case "$getgrent_r_proto" in
13450 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
61c26d18 13451 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
10bc17b6
JH
13452 esac
13453 case "$getgrent_r_proto" in
90e831dc 13454 ''|0) d_getgrent_r=undef
10bc17b6 13455 getgrent_r_proto=0
a48ec845 13456 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13457 * ) case "$getgrent_r_proto" in
13458 REENTRANT_PROTO*) ;;
13459 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13460 esac
13461 echo "Prototype: $try" ;;
13462 esac
13463 ;;
c18e646a
JH
13464 *) case "$usethreads" in
13465 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13466 esac
90e831dc
SB
13467 d_getgrent_r=undef
13468 getgrent_r_proto=0
c18e646a 13469 ;;
a48ec845
JH
13470 esac
13471 ;;
10bc17b6
JH
13472*) getgrent_r_proto=0
13473 ;;
13474esac
13475
13476: see if getgrgid_r exists
13477set getgrgid_r d_getgrgid_r
13478eval $inlibc
13479case "$d_getgrgid_r" in
13480"$define")
13481 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13482 case "$d_getgrgid_r_proto:$usethreads" in
13483 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13484 set d_getgrgid_r_proto getgrgid_r $hdrs
13485 eval $hasproto ;;
13486 *) ;;
13487 esac
13488 case "$d_getgrgid_r_proto" in
13489 define)
10bc17b6
JH
13490 case "$getgrgid_r_proto" in
13491 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
61c26d18 13492 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
10bc17b6
JH
13493 esac
13494 case "$getgrgid_r_proto" in
13495 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
61c26d18 13496 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
10bc17b6
JH
13497 esac
13498 case "$getgrgid_r_proto" in
13499 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13500 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
10bc17b6
JH
13501 esac
13502 case "$getgrgid_r_proto" in
13503 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13504 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
10bc17b6
JH
13505 esac
13506 case "$getgrgid_r_proto" in
90e831dc 13507 ''|0) d_getgrgid_r=undef
10bc17b6 13508 getgrgid_r_proto=0
a48ec845 13509 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13510 * ) case "$getgrgid_r_proto" in
13511 REENTRANT_PROTO*) ;;
13512 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13513 esac
13514 echo "Prototype: $try" ;;
13515 esac
13516 ;;
c18e646a
JH
13517 *) case "$usethreads" in
13518 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13519 esac
90e831dc
SB
13520 d_getgrgid_r=undef
13521 getgrgid_r_proto=0
c18e646a 13522 ;;
a48ec845
JH
13523 esac
13524 ;;
10bc17b6
JH
13525*) getgrgid_r_proto=0
13526 ;;
13527esac
13528
13529: see if getgrnam_r exists
13530set getgrnam_r d_getgrnam_r
13531eval $inlibc
13532case "$d_getgrnam_r" in
13533"$define")
13534 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13535 case "$d_getgrnam_r_proto:$usethreads" in
13536 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13537 set d_getgrnam_r_proto getgrnam_r $hdrs
13538 eval $hasproto ;;
13539 *) ;;
13540 esac
13541 case "$d_getgrnam_r_proto" in
13542 define)
10bc17b6
JH
13543 case "$getgrnam_r_proto" in
13544 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
61c26d18 13545 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
10bc17b6
JH
13546 esac
13547 case "$getgrnam_r_proto" in
13548 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
61c26d18 13549 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
10bc17b6
JH
13550 esac
13551 case "$getgrnam_r_proto" in
13552 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
61c26d18 13553 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
10bc17b6
JH
13554 esac
13555 case "$getgrnam_r_proto" in
13556 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13557 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
10bc17b6
JH
13558 esac
13559 case "$getgrnam_r_proto" in
13560 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13561 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
10bc17b6
JH
13562 esac
13563 case "$getgrnam_r_proto" in
90e831dc 13564 ''|0) d_getgrnam_r=undef
10bc17b6 13565 getgrnam_r_proto=0
a48ec845 13566 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13567 * ) case "$getgrnam_r_proto" in
13568 REENTRANT_PROTO*) ;;
13569 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13570 esac
13571 echo "Prototype: $try" ;;
13572 esac
13573 ;;
c18e646a
JH
13574 *) case "$usethreads" in
13575 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13576 esac
90e831dc
SB
13577 d_getgrnam_r=undef
13578 getgrnam_r_proto=0
c18e646a 13579 ;;
a48ec845
JH
13580 esac
13581 ;;
10bc17b6
JH
13582*) getgrnam_r_proto=0
13583 ;;
13584esac
13585
b4eb6b3d
JH
13586: see if gethostbyaddr exists
13587set gethostbyaddr d_gethbyaddr
13588eval $inlibc
13589
13590: see if gethostbyname exists
13591set gethostbyname d_gethbyname
13592eval $inlibc
13593
13594: see if gethostent exists
13595set gethostent d_gethent
13596eval $inlibc
13597
13598: see how we will look up host name
13599echo " "
13600call=''
13601if set gethostname val -f d_gethname; eval $csym; $val; then
13602 echo 'gethostname() found.' >&4
13603 d_gethname="$define"
13604 call=gethostname
13605fi
13606if set uname val -f d_uname; eval $csym; $val; then
13607 if ./xenix; then
13608 $cat <<'EOM'
13609uname() was found, but you're running xenix, and older versions of xenix
13610have a broken uname(). If you don't really know whether your xenix is old
13611enough to have a broken system call, use the default answer.
13612
13613EOM
13614 dflt=y
13615 case "$d_uname" in
13616 "$define") dflt=n;;
13617 esac
13618 rp='Is your uname() broken?'
13619 . ./myread
13620 case "$ans" in
13621 n*) d_uname="$define"; call=uname;;
13622 esac
13623 else
13624 echo 'uname() found.' >&4
13625 d_uname="$define"
13626 case "$call" in
13627 '') call=uname ;;
13628 esac
13629 fi
13630fi
13631case "$d_gethname" in
13632'') d_gethname="$undef";;
13633esac
13634case "$d_uname" in
13635'') d_uname="$undef";;
13636esac
13637case "$d_uname$d_gethname" in
13638*define*)
13639 dflt=n
13640 cat <<EOM
613d6c3e 13641
b4eb6b3d
JH
13642Every now and then someone has a $call() that lies about the hostname
13643but can't be fixed for political or economic reasons. If you wish, I can
13644pretend $call() isn't there and maybe compute hostname at run-time
13645thanks to the '$phostname' command.
13646
13647EOM
13648 rp="Shall I ignore $call() from now on?"
13649 . ./myread
13650 case "$ans" in
13651 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13652 esac;;
13653esac
13654case "$phostname" in
13655'') aphostname='';;
13656*) case "$aphostname" in
13657 /*) ;;
13658 *) set X $phostname
13659 shift
13660 file=$1
13661 shift
13662 file=`./loc $file $file $pth`
13663 aphostname=`echo $file $*`
13664 ;;
13665 esac
13666 ;;
13667esac
13668case "$d_uname$d_gethname" in
13669*define*) ;;
13670*)
13671 case "$phostname" in
13672 '')
13673 echo "There will be no way for $package to get your hostname." >&4;;
13674 *)
13675 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13676 ;;
13677 esac;;
13678esac
13679case "$d_phostname" in
13680'') d_phostname="$undef";;
13681esac
13682
10bc17b6
JH
13683: see if gethostbyaddr_r exists
13684set gethostbyaddr_r d_gethostbyaddr_r
13685eval $inlibc
13686case "$d_gethostbyaddr_r" in
13687"$define")
13688 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13689 case "$d_gethostbyaddr_r_proto:$usethreads" in
13690 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13691 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13692 eval $hasproto ;;
13693 *) ;;
13694 esac
13695 case "$d_gethostbyaddr_r_proto" in
13696 define)
10bc17b6
JH
13697 case "$gethostbyaddr_r_proto" in
13698 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13699 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
10bc17b6
JH
13700 esac
13701 case "$gethostbyaddr_r_proto" in
13702 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
61c26d18 13703 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
10bc17b6
JH
13704 esac
13705 case "$gethostbyaddr_r_proto" in
13706 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13707 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
10bc17b6
JH
13708 esac
13709 case "$gethostbyaddr_r_proto" in
13710 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13711 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
10bc17b6
JH
13712 esac
13713 case "$gethostbyaddr_r_proto" in
13714 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
61c26d18 13715 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
10bc17b6
JH
13716 esac
13717 case "$gethostbyaddr_r_proto" in
13718 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13719 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
10bc17b6
JH
13720 esac
13721 case "$gethostbyaddr_r_proto" in
13722 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
61c26d18 13723 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
10bc17b6
JH
13724 esac
13725 case "$gethostbyaddr_r_proto" in
13726 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
61c26d18 13727 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
10bc17b6
JH
13728 esac
13729 case "$gethostbyaddr_r_proto" in
13730 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
61c26d18 13731 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
10bc17b6
JH
13732 esac
13733 case "$gethostbyaddr_r_proto" in
13734 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
61c26d18 13735 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
10bc17b6
JH
13736 esac
13737 case "$gethostbyaddr_r_proto" in
a845a0d4 13738 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13739 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
a845a0d4
JH
13740 esac
13741 case "$gethostbyaddr_r_proto" in
90e831dc 13742 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13743 gethostbyaddr_r_proto=0
a48ec845 13744 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13745 * ) case "$gethostbyaddr_r_proto" in
13746 REENTRANT_PROTO*) ;;
13747 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13748 esac
13749 echo "Prototype: $try" ;;
13750 esac
13751 ;;
c18e646a
JH
13752 *) case "$usethreads" in
13753 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13754 esac
90e831dc
SB
13755 d_gethostbyaddr_r=undef
13756 gethostbyaddr_r_proto=0
c18e646a 13757 ;;
a48ec845
JH
13758 esac
13759 ;;
10bc17b6
JH
13760*) gethostbyaddr_r_proto=0
13761 ;;
13762esac
13763
13764: see if gethostbyname_r exists
13765set gethostbyname_r d_gethostbyname_r
13766eval $inlibc
13767case "$d_gethostbyname_r" in
13768"$define")
13769 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13770 case "$d_gethostbyname_r_proto:$usethreads" in
13771 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13772 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13773 eval $hasproto ;;
13774 *) ;;
13775 esac
13776 case "$d_gethostbyname_r_proto" in
13777 define)
10bc17b6
JH
13778 case "$gethostbyname_r_proto" in
13779 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13780 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
13781 esac
13782 case "$gethostbyname_r_proto" in
13783 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13784 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
10bc17b6
JH
13785 esac
13786 case "$gethostbyname_r_proto" in
13787 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
61c26d18 13788 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
10bc17b6
JH
13789 esac
13790 case "$gethostbyname_r_proto" in
90e831dc 13791 ''|0) d_gethostbyname_r=undef
10bc17b6 13792 gethostbyname_r_proto=0
a48ec845 13793 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13794 * ) case "$gethostbyname_r_proto" in
13795 REENTRANT_PROTO*) ;;
13796 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13797 esac
13798 echo "Prototype: $try" ;;
13799 esac
13800 ;;
c18e646a
JH
13801 *) case "$usethreads" in
13802 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13803 esac
90e831dc
SB
13804 d_gethostbyname_r=undef
13805 gethostbyname_r_proto=0
c18e646a 13806 ;;
a48ec845
JH
13807 esac
13808 ;;
10bc17b6
JH
13809*) gethostbyname_r_proto=0
13810 ;;
13811esac
13812
13813: see if gethostent_r exists
13814set gethostent_r d_gethostent_r
13815eval $inlibc
13816case "$d_gethostent_r" in
13817"$define")
13818 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13819 case "$d_gethostent_r_proto:$usethreads" in
13820 ":define") d_gethostent_r_proto=define
a48ec845
JH
13821 set d_gethostent_r_proto gethostent_r $hdrs
13822 eval $hasproto ;;
13823 *) ;;
13824 esac
13825 case "$d_gethostent_r_proto" in
13826 define)
10bc17b6
JH
13827 case "$gethostent_r_proto" in
13828 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13829 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
10bc17b6
JH
13830 esac
13831 case "$gethostent_r_proto" in
13832 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13833 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
10bc17b6
JH
13834 esac
13835 case "$gethostent_r_proto" in
13836 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13837 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
10bc17b6
JH
13838 esac
13839 case "$gethostent_r_proto" in
13840 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
61c26d18 13841 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
10bc17b6
JH
13842 esac
13843 case "$gethostent_r_proto" in
13844 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
61c26d18 13845 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
10bc17b6
JH
13846 esac
13847 case "$gethostent_r_proto" in
13848 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
61c26d18 13849 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
10bc17b6
JH
13850 esac
13851 case "$gethostent_r_proto" in
90e831dc 13852 ''|0) d_gethostent_r=undef
10bc17b6 13853 gethostent_r_proto=0
a48ec845 13854 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13855 * ) case "$gethostent_r_proto" in
13856 REENTRANT_PROTO*) ;;
13857 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13858 esac
13859 echo "Prototype: $try" ;;
13860 esac
13861 ;;
c18e646a
JH
13862 *) case "$usethreads" in
13863 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13864 esac
90e831dc
SB
13865 d_gethostent_r=undef
13866 gethostent_r_proto=0
c18e646a 13867 ;;
a48ec845
JH
13868 esac
13869 ;;
10bc17b6
JH
13870*) gethostent_r_proto=0
13871 ;;
13872esac
b4eb6b3d
JH
13873
13874: see if prototypes for various gethostxxx netdb.h functions are available
13875echo " "
13876set d_gethostprotos gethostent $i_netdb netdb.h
13877eval $hasproto
13878
4e0554ec
JH
13879: see if getitimer exists
13880set getitimer d_getitimer
13881eval $inlibc
13882
b4eb6b3d
JH
13883: see if getlogin exists
13884set getlogin d_getlogin
13885eval $inlibc
13886
10bc17b6
JH
13887: see if getlogin_r exists
13888set getlogin_r d_getlogin_r
13889eval $inlibc
13890case "$d_getlogin_r" in
13891"$define")
13892 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13893 case "$d_getlogin_r_proto:$usethreads" in
13894 ":define") d_getlogin_r_proto=define
a48ec845
JH
13895 set d_getlogin_r_proto getlogin_r $hdrs
13896 eval $hasproto ;;
13897 *) ;;
13898 esac
13899 case "$d_getlogin_r_proto" in
13900 define)
10bc17b6
JH
13901 case "$getlogin_r_proto" in
13902 ''|0) try='int getlogin_r(char*, size_t);'
61c26d18 13903 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
10bc17b6
JH
13904 esac
13905 case "$getlogin_r_proto" in
13906 ''|0) try='int getlogin_r(char*, int);'
61c26d18 13907 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
10bc17b6
JH
13908 esac
13909 case "$getlogin_r_proto" in
13910 ''|0) try='char* getlogin_r(char*, size_t);'
61c26d18 13911 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
10bc17b6
JH
13912 esac
13913 case "$getlogin_r_proto" in
13914 ''|0) try='char* getlogin_r(char*, int);'
61c26d18 13915 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
10bc17b6
JH
13916 esac
13917 case "$getlogin_r_proto" in
90e831dc 13918 ''|0) d_getlogin_r=undef
10bc17b6 13919 getlogin_r_proto=0
a48ec845 13920 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13921 * ) case "$getlogin_r_proto" in
13922 REENTRANT_PROTO*) ;;
13923 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13924 esac
13925 echo "Prototype: $try" ;;
13926 esac
13927 ;;
c18e646a
JH
13928 *) case "$usethreads" in
13929 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13930 esac
90e831dc
SB
13931 d_getlogin_r=undef
13932 getlogin_r_proto=0
c18e646a 13933 ;;
a48ec845
JH
13934 esac
13935 ;;
10bc17b6
JH
13936*) getlogin_r_proto=0
13937 ;;
13938esac
13939
b4eb6b3d
JH
13940: see if getmnt exists
13941set getmnt d_getmnt
13942eval $inlibc
13943
13944: see if getmntent exists
13945set getmntent d_getmntent
13946eval $inlibc
13947
5086dff9
MB
13948: see if getnameinfo exists
13949set getnameinfo d_getnameinfo
13950eval $inlibc
13951
b4eb6b3d
JH
13952: see if getnetbyaddr exists
13953set getnetbyaddr d_getnbyaddr
13954eval $inlibc
13955
13956: see if getnetbyname exists
13957set getnetbyname d_getnbyname
13958eval $inlibc
13959
13960: see if getnetent exists
13961set getnetent d_getnent
13962eval $inlibc
13963
10bc17b6
JH
13964: see if getnetbyaddr_r exists
13965set getnetbyaddr_r d_getnetbyaddr_r
13966eval $inlibc
13967case "$d_getnetbyaddr_r" in
13968"$define")
13969 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13970 case "$d_getnetbyaddr_r_proto:$usethreads" in
13971 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13972 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13973 eval $hasproto ;;
13974 *) ;;
13975 esac
13976 case "$d_getnetbyaddr_r_proto" in
13977 define)
10bc17b6
JH
13978 case "$getnetbyaddr_r_proto" in
13979 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 13980 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
10bc17b6
JH
13981 esac
13982 case "$getnetbyaddr_r_proto" in
13983 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 13984 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
10bc17b6
JH
13985 esac
13986 case "$getnetbyaddr_r_proto" in
13987 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
61c26d18 13988 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
10bc17b6
JH
13989 esac
13990 case "$getnetbyaddr_r_proto" in
13991 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 13992 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
10bc17b6
JH
13993 esac
13994 case "$getnetbyaddr_r_proto" in
13995 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
61c26d18 13996 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
10bc17b6
JH
13997 esac
13998 case "$getnetbyaddr_r_proto" in
13999 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
61c26d18 14000 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
10bc17b6
JH
14001 esac
14002 case "$getnetbyaddr_r_proto" in
14003 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
61c26d18 14004 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
10bc17b6
JH
14005 esac
14006 case "$getnetbyaddr_r_proto" in
a845a0d4 14007 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14008 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
a845a0d4
JH
14009 esac
14010 case "$getnetbyaddr_r_proto" in
90e831dc 14011 ''|0) d_getnetbyaddr_r=undef
10bc17b6 14012 getnetbyaddr_r_proto=0
a48ec845 14013 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14014 * ) case "$getnetbyaddr_r_proto" in
14015 REENTRANT_PROTO*) ;;
14016 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14017 esac
14018 echo "Prototype: $try" ;;
14019 esac
14020 ;;
c18e646a
JH
14021 *) case "$usethreads" in
14022 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14023 esac
90e831dc
SB
14024 d_getnetbyaddr_r=undef
14025 getnetbyaddr_r_proto=0
c18e646a 14026 ;;
a48ec845
JH
14027 esac
14028 ;;
10bc17b6
JH
14029*) getnetbyaddr_r_proto=0
14030 ;;
14031esac
14032
14033: see if getnetbyname_r exists
14034set getnetbyname_r d_getnetbyname_r
14035eval $inlibc
14036case "$d_getnetbyname_r" in
14037"$define")
14038 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14039 case "$d_getnetbyname_r_proto:$usethreads" in
14040 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
14041 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14042 eval $hasproto ;;
14043 *) ;;
14044 esac
14045 case "$d_getnetbyname_r_proto" in
14046 define)
10bc17b6
JH
14047 case "$getnetbyname_r_proto" in
14048 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14049 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
14050 esac
14051 case "$getnetbyname_r_proto" in
14052 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14053 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
10bc17b6
JH
14054 esac
14055 case "$getnetbyname_r_proto" in
14056 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14057 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
10bc17b6
JH
14058 esac
14059 case "$getnetbyname_r_proto" in
14060 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
61c26d18 14061 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
10bc17b6
JH
14062 esac
14063 case "$getnetbyname_r_proto" in
90e831dc 14064 ''|0) d_getnetbyname_r=undef
10bc17b6 14065 getnetbyname_r_proto=0
a48ec845 14066 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14067 * ) case "$getnetbyname_r_proto" in
14068 REENTRANT_PROTO*) ;;
14069 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14070 esac
14071 echo "Prototype: $try" ;;
14072 esac
14073 ;;
c18e646a
JH
14074 *) case "$usethreads" in
14075 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14076 esac
90e831dc
SB
14077 d_getnetbyname_r=undef
14078 getnetbyname_r_proto=0
c18e646a 14079 ;;
a48ec845
JH
14080 esac
14081 ;;
10bc17b6
JH
14082*) getnetbyname_r_proto=0
14083 ;;
14084esac
14085
14086: see if getnetent_r exists
14087set getnetent_r d_getnetent_r
14088eval $inlibc
14089case "$d_getnetent_r" in
14090"$define")
14091 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14092 case "$d_getnetent_r_proto:$usethreads" in
14093 ":define") d_getnetent_r_proto=define
a48ec845
JH
14094 set d_getnetent_r_proto getnetent_r $hdrs
14095 eval $hasproto ;;
14096 *) ;;
14097 esac
14098 case "$d_getnetent_r_proto" in
14099 define)
10bc17b6
JH
14100 case "$getnetent_r_proto" in
14101 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14102 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
10bc17b6
JH
14103 esac
14104 case "$getnetent_r_proto" in
14105 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14106 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
10bc17b6
JH
14107 esac
14108 case "$getnetent_r_proto" in
14109 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14110 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
10bc17b6
JH
14111 esac
14112 case "$getnetent_r_proto" in
14113 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
61c26d18 14114 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
10bc17b6
JH
14115 esac
14116 case "$getnetent_r_proto" in
14117 ''|0) try='int getnetent_r(struct netent*, char*, int);'
61c26d18 14118 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
10bc17b6
JH
14119 esac
14120 case "$getnetent_r_proto" in
14121 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
61c26d18 14122 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
10bc17b6
JH
14123 esac
14124 case "$getnetent_r_proto" in
90e831dc 14125 ''|0) d_getnetent_r=undef
10bc17b6 14126 getnetent_r_proto=0
a48ec845 14127 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14128 * ) case "$getnetent_r_proto" in
14129 REENTRANT_PROTO*) ;;
14130 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14131 esac
14132 echo "Prototype: $try" ;;
14133 esac
14134 ;;
c18e646a
JH
14135 *) case "$usethreads" in
14136 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14137 esac
90e831dc
SB
14138 d_getnetent_r=undef
14139 getnetent_r_proto=0
c18e646a 14140 ;;
a48ec845
JH
14141 esac
14142 ;;
10bc17b6
JH
14143*) getnetent_r_proto=0
14144 ;;
14145esac
14146
b4eb6b3d
JH
14147: see if prototypes for various getnetxxx netdb.h functions are available
14148echo " "
14149set d_getnetprotos getnetent $i_netdb netdb.h
14150eval $hasproto
14151
0c0643d0
JH
14152: see if getpagesize exists
14153set getpagesize d_getpagsz
14154eval $inlibc
14155
34f1896b 14156: Optional checks for getprotobyname and getprotobynumber
b4eb6b3d
JH
14157
14158: see if getprotobyname exists
14159set getprotobyname d_getpbyname
14160eval $inlibc
14161
14162: see if getprotobynumber exists
14163set getprotobynumber d_getpbynumber
14164eval $inlibc
14165
14166: see if getprotoent exists
14167set getprotoent d_getpent
14168eval $inlibc
14169
14170: see if getpgid exists
14171set getpgid d_getpgid
14172eval $inlibc
14173
14174: see if getpgrp2 exists
14175set getpgrp2 d_getpgrp2
14176eval $inlibc
14177
14178: see if getppid exists
14179set getppid d_getppid
14180eval $inlibc
14181
14182: see if getpriority exists
14183set getpriority d_getprior
14184eval $inlibc
14185
10bc17b6
JH
14186: see if getprotobyname_r exists
14187set getprotobyname_r d_getprotobyname_r
14188eval $inlibc
14189case "$d_getprotobyname_r" in
14190"$define")
14191 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14192 case "$d_getprotobyname_r_proto:$usethreads" in
14193 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
14194 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14195 eval $hasproto ;;
14196 *) ;;
14197 esac
14198 case "$d_getprotobyname_r_proto" in
14199 define)
10bc17b6
JH
14200 case "$getprotobyname_r_proto" in
14201 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14202 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
10bc17b6
JH
14203 esac
14204 case "$getprotobyname_r_proto" in
14205 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
61c26d18 14206 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
10bc17b6
JH
14207 esac
14208 case "$getprotobyname_r_proto" in
14209 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
61c26d18 14210 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
10bc17b6
JH
14211 esac
14212 case "$getprotobyname_r_proto" in
90e831dc 14213 ''|0) d_getprotobyname_r=undef
10bc17b6 14214 getprotobyname_r_proto=0
a48ec845 14215 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14216 * ) case "$getprotobyname_r_proto" in
14217 REENTRANT_PROTO*) ;;
14218 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14219 esac
14220 echo "Prototype: $try" ;;
14221 esac
14222 ;;
c18e646a
JH
14223 *) case "$usethreads" in
14224 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14225 esac
90e831dc
SB
14226 d_getprotobyname_r=undef
14227 getprotobyname_r_proto=0
c18e646a 14228 ;;
a48ec845
JH
14229 esac
14230 ;;
10bc17b6
JH
14231*) getprotobyname_r_proto=0
14232 ;;
14233esac
14234
14235: see if getprotobynumber_r exists
14236set getprotobynumber_r d_getprotobynumber_r
14237eval $inlibc
14238case "$d_getprotobynumber_r" in
14239"$define")
14240 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14241 case "$d_getprotobynumber_r_proto:$usethreads" in
14242 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
14243 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14244 eval $hasproto ;;
14245 *) ;;
14246 esac
14247 case "$d_getprotobynumber_r_proto" in
14248 define)
10bc17b6
JH
14249 case "$getprotobynumber_r_proto" in
14250 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14251 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
10bc17b6
JH
14252 esac
14253 case "$getprotobynumber_r_proto" in
14254 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
61c26d18 14255 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
10bc17b6
JH
14256 esac
14257 case "$getprotobynumber_r_proto" in
14258 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
61c26d18 14259 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
10bc17b6
JH
14260 esac
14261 case "$getprotobynumber_r_proto" in
90e831dc 14262 ''|0) d_getprotobynumber_r=undef
10bc17b6 14263 getprotobynumber_r_proto=0
a48ec845 14264 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14265 * ) case "$getprotobynumber_r_proto" in
14266 REENTRANT_PROTO*) ;;
14267 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14268 esac
14269 echo "Prototype: $try" ;;
14270 esac
14271 ;;
c18e646a
JH
14272 *) case "$usethreads" in
14273 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14274 esac
90e831dc
SB
14275 d_getprotobynumber_r=undef
14276 getprotobynumber_r_proto=0
c18e646a 14277 ;;
a48ec845
JH
14278 esac
14279 ;;
10bc17b6
JH
14280*) getprotobynumber_r_proto=0
14281 ;;
14282esac
14283
14284: see if getprotoent_r exists
14285set getprotoent_r d_getprotoent_r
14286eval $inlibc
14287case "$d_getprotoent_r" in
14288"$define")
14289 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14290 case "$d_getprotoent_r_proto:$usethreads" in
14291 ":define") d_getprotoent_r_proto=define
a48ec845
JH
14292 set d_getprotoent_r_proto getprotoent_r $hdrs
14293 eval $hasproto ;;
14294 *) ;;
14295 esac
14296 case "$d_getprotoent_r_proto" in
14297 define)
10bc17b6
JH
14298 case "$getprotoent_r_proto" in
14299 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14300 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
10bc17b6
JH
14301 esac
14302 case "$getprotoent_r_proto" in
14303 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
61c26d18 14304 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
10bc17b6
JH
14305 esac
14306 case "$getprotoent_r_proto" in
14307 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
61c26d18 14308 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
10bc17b6
JH
14309 esac
14310 case "$getprotoent_r_proto" in
14311 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
61c26d18 14312 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
10bc17b6
JH
14313 esac
14314 case "$getprotoent_r_proto" in
90e831dc 14315 ''|0) d_getprotoent_r=undef
10bc17b6 14316 getprotoent_r_proto=0
a48ec845 14317 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14318 * ) case "$getprotoent_r_proto" in
14319 REENTRANT_PROTO*) ;;
14320 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14321 esac
14322 echo "Prototype: $try" ;;
14323 esac
14324 ;;
c18e646a
JH
14325 *) case "$usethreads" in
14326 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14327 esac
90e831dc
SB
14328 d_getprotoent_r=undef
14329 getprotoent_r_proto=0
c18e646a 14330 ;;
a48ec845
JH
14331 esac
14332 ;;
10bc17b6
JH
14333*) getprotoent_r_proto=0
14334 ;;
14335esac
14336
b4eb6b3d
JH
14337: see if prototypes for various getprotoxxx netdb.h functions are available
14338echo " "
14339set d_getprotoprotos getprotoent $i_netdb netdb.h
14340eval $hasproto
14341
14342: see if getprpwnam exists
14343set getprpwnam d_getprpwnam
14344eval $inlibc
14345
14346: see if getpwent exists
14347set getpwent d_getpwent
14348eval $inlibc
14349
10bc17b6
JH
14350: see if getpwent_r exists
14351set getpwent_r d_getpwent_r
14352eval $inlibc
14353case "$d_getpwent_r" in
14354"$define")
14355 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14356 case "$d_getpwent_r_proto:$usethreads" in
14357 ":define") d_getpwent_r_proto=define
a48ec845
JH
14358 set d_getpwent_r_proto getpwent_r $hdrs
14359 eval $hasproto ;;
14360 *) ;;
14361 esac
14362 case "$d_getpwent_r_proto" in
14363 define)
10bc17b6
JH
14364 case "$getpwent_r_proto" in
14365 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14366 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
10bc17b6
JH
14367 esac
14368 case "$getpwent_r_proto" in
14369 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
61c26d18 14370 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
10bc17b6
JH
14371 esac
14372 case "$getpwent_r_proto" in
14373 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
61c26d18 14374 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
10bc17b6
JH
14375 esac
14376 case "$getpwent_r_proto" in
14377 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
61c26d18 14378 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
10bc17b6
JH
14379 esac
14380 case "$getpwent_r_proto" in
14381 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
61c26d18 14382 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
10bc17b6
JH
14383 esac
14384 case "$getpwent_r_proto" in
14385 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
61c26d18 14386 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
10bc17b6
JH
14387 esac
14388 case "$getpwent_r_proto" in
90e831dc 14389 ''|0) d_getpwent_r=undef
10bc17b6 14390 getpwent_r_proto=0
a48ec845 14391 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14392 * ) case "$getpwent_r_proto" in
14393 REENTRANT_PROTO*) ;;
14394 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14395 esac
14396 echo "Prototype: $try" ;;
14397 esac
14398 ;;
c18e646a
JH
14399 *) case "$usethreads" in
14400 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14401 esac
90e831dc
SB
14402 d_getpwent_r=undef
14403 getpwent_r_proto=0
c18e646a 14404 ;;
a48ec845
JH
14405 esac
14406 ;;
10bc17b6
JH
14407*) getpwent_r_proto=0
14408 ;;
14409esac
14410
14411: see if getpwnam_r exists
14412set getpwnam_r d_getpwnam_r
14413eval $inlibc
14414case "$d_getpwnam_r" in
14415"$define")
14416 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14417 case "$d_getpwnam_r_proto:$usethreads" in
14418 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14419 set d_getpwnam_r_proto getpwnam_r $hdrs
14420 eval $hasproto ;;
14421 *) ;;
14422 esac
14423 case "$d_getpwnam_r_proto" in
14424 define)
10bc17b6
JH
14425 case "$getpwnam_r_proto" in
14426 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14427 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14428 esac
14429 case "$getpwnam_r_proto" in
14430 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
61c26d18 14431 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
10bc17b6
JH
14432 esac
14433 case "$getpwnam_r_proto" in
14434 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14435 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
10bc17b6
JH
14436 esac
14437 case "$getpwnam_r_proto" in
14438 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14439 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
10bc17b6
JH
14440 esac
14441 case "$getpwnam_r_proto" in
90e831dc 14442 ''|0) d_getpwnam_r=undef
10bc17b6 14443 getpwnam_r_proto=0
a48ec845 14444 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14445 * ) case "$getpwnam_r_proto" in
14446 REENTRANT_PROTO*) ;;
14447 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14448 esac
14449 echo "Prototype: $try" ;;
14450 esac
14451 ;;
c18e646a
JH
14452 *) case "$usethreads" in
14453 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14454 esac
90e831dc
SB
14455 d_getpwnam_r=undef
14456 getpwnam_r_proto=0
c18e646a 14457 ;;
a48ec845
JH
14458 esac
14459 ;;
10bc17b6
JH
14460*) getpwnam_r_proto=0
14461 ;;
14462esac
14463
14464: see if getpwuid_r exists
14465set getpwuid_r d_getpwuid_r
14466eval $inlibc
14467case "$d_getpwuid_r" in
14468"$define")
14469 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14470 case "$d_getpwuid_r_proto:$usethreads" in
14471 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14472 set d_getpwuid_r_proto getpwuid_r $hdrs
14473 eval $hasproto ;;
14474 *) ;;
14475 esac
14476 case "$d_getpwuid_r_proto" in
14477 define)
10bc17b6
JH
14478 case "$getpwuid_r_proto" in
14479 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14480 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
10bc17b6
JH
14481 esac
14482 case "$getpwuid_r_proto" in
14483 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
61c26d18 14484 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
10bc17b6
JH
14485 esac
14486 case "$getpwuid_r_proto" in
14487 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14488 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
10bc17b6
JH
14489 esac
14490 case "$getpwuid_r_proto" in
14491 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14492 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
10bc17b6
JH
14493 esac
14494 case "$getpwuid_r_proto" in
90e831dc 14495 ''|0) d_getpwuid_r=undef
10bc17b6 14496 getpwuid_r_proto=0
a48ec845 14497 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14498 * ) case "$getpwuid_r_proto" in
14499 REENTRANT_PROTO*) ;;
14500 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14501 esac
14502 echo "Prototype: $try" ;;
14503 esac
14504 ;;
c18e646a
JH
14505 *) case "$usethreads" in
14506 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14507 esac
90e831dc
SB
14508 d_getpwuid_r=undef
14509 getpwuid_r_proto=0
c18e646a 14510 ;;
a48ec845
JH
14511 esac
14512 ;;
10bc17b6
JH
14513*) getpwuid_r_proto=0
14514 ;;
14515esac
14516
34f1896b 14517: Optional checks for getsbyname and getsbyport
b4eb6b3d
JH
14518
14519: see if getservbyname exists
14520set getservbyname d_getsbyname
14521eval $inlibc
14522
14523: see if getservbyport exists
14524set getservbyport d_getsbyport
14525eval $inlibc
14526
14527: see if getservent exists
14528set getservent d_getsent
14529eval $inlibc
14530
10bc17b6
JH
14531: see if getservbyname_r exists
14532set getservbyname_r d_getservbyname_r
14533eval $inlibc
14534case "$d_getservbyname_r" in
14535"$define")
14536 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14537 case "$d_getservbyname_r_proto:$usethreads" in
14538 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14539 set d_getservbyname_r_proto getservbyname_r $hdrs
14540 eval $hasproto ;;
14541 *) ;;
14542 esac
14543 case "$d_getservbyname_r_proto" in
14544 define)
10bc17b6
JH
14545 case "$getservbyname_r_proto" in
14546 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14547 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
10bc17b6
JH
14548 esac
14549 case "$getservbyname_r_proto" in
14550 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
61c26d18 14551 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
10bc17b6
JH
14552 esac
14553 case "$getservbyname_r_proto" in
14554 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
61c26d18 14555 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
10bc17b6
JH
14556 esac
14557 case "$getservbyname_r_proto" in
90e831dc 14558 ''|0) d_getservbyname_r=undef
10bc17b6 14559 getservbyname_r_proto=0
a48ec845 14560 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14561 * ) case "$getservbyname_r_proto" in
14562 REENTRANT_PROTO*) ;;
14563 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14564 esac
14565 echo "Prototype: $try" ;;
14566 esac
14567 ;;
c18e646a
JH
14568 *) case "$usethreads" in
14569 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14570 esac
90e831dc
SB
14571 d_getservbyname_r=undef
14572 getservbyname_r_proto=0
c18e646a 14573 ;;
a48ec845
JH
14574 esac
14575 ;;
10bc17b6
JH
14576*) getservbyname_r_proto=0
14577 ;;
14578esac
14579
14580: see if getservbyport_r exists
14581set getservbyport_r d_getservbyport_r
14582eval $inlibc
14583case "$d_getservbyport_r" in
14584"$define")
14585 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14586 case "$d_getservbyport_r_proto:$usethreads" in
14587 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14588 set d_getservbyport_r_proto getservbyport_r $hdrs
14589 eval $hasproto ;;
14590 *) ;;
14591 esac
14592 case "$d_getservbyport_r_proto" in
14593 define)
10bc17b6
JH
14594 case "$getservbyport_r_proto" in
14595 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14596 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
10bc17b6
JH
14597 esac
14598 case "$getservbyport_r_proto" in
14599 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
61c26d18 14600 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
10bc17b6
JH
14601 esac
14602 case "$getservbyport_r_proto" in
14603 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
61c26d18 14604 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
10bc17b6
JH
14605 esac
14606 case "$getservbyport_r_proto" in
90e831dc 14607 ''|0) d_getservbyport_r=undef
10bc17b6 14608 getservbyport_r_proto=0
a48ec845 14609 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14610 * ) case "$getservbyport_r_proto" in
14611 REENTRANT_PROTO*) ;;
14612 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14613 esac
14614 echo "Prototype: $try" ;;
14615 esac
14616 ;;
c18e646a
JH
14617 *) case "$usethreads" in
14618 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14619 esac
90e831dc
SB
14620 d_getservbyport_r=undef
14621 getservbyport_r_proto=0
c18e646a 14622 ;;
a48ec845
JH
14623 esac
14624 ;;
10bc17b6
JH
14625*) getservbyport_r_proto=0
14626 ;;
14627esac
14628
14629: see if getservent_r exists
14630set getservent_r d_getservent_r
14631eval $inlibc
14632case "$d_getservent_r" in
14633"$define")
14634 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14635 case "$d_getservent_r_proto:$usethreads" in
14636 ":define") d_getservent_r_proto=define
a48ec845
JH
14637 set d_getservent_r_proto getservent_r $hdrs
14638 eval $hasproto ;;
14639 *) ;;
14640 esac
14641 case "$d_getservent_r_proto" in
14642 define)
10bc17b6
JH
14643 case "$getservent_r_proto" in
14644 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
61c26d18 14645 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
10bc17b6
JH
14646 esac
14647 case "$getservent_r_proto" in
14648 ''|0) try='int getservent_r(struct servent*, char*, int);'
61c26d18 14649 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
10bc17b6
JH
14650 esac
14651 case "$getservent_r_proto" in
14652 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
61c26d18 14653 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
10bc17b6
JH
14654 esac
14655 case "$getservent_r_proto" in
14656 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
61c26d18 14657 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
10bc17b6
JH
14658 esac
14659 case "$getservent_r_proto" in
90e831dc 14660 ''|0) d_getservent_r=undef
10bc17b6 14661 getservent_r_proto=0
a48ec845 14662 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14663 * ) case "$getservent_r_proto" in
14664 REENTRANT_PROTO*) ;;
14665 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14666 esac
14667 echo "Prototype: $try" ;;
14668 esac
14669 ;;
c18e646a
JH
14670 *) case "$usethreads" in
14671 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14672 esac
90e831dc
SB
14673 d_getservent_r=undef
14674 getservent_r_proto=0
c18e646a 14675 ;;
a48ec845
JH
14676 esac
14677 ;;
10bc17b6
JH
14678*) getservent_r_proto=0
14679 ;;
14680esac
14681
b4eb6b3d
JH
14682: see if prototypes for various getservxxx netdb.h functions are available
14683echo " "
14684set d_getservprotos getservent $i_netdb netdb.h
14685eval $hasproto
14686
14687: see if getspnam exists
14688set getspnam d_getspnam
14689eval $inlibc
14690
10bc17b6
JH
14691: see if this is a shadow.h system
14692set shadow.h i_shadow
14693eval $inhdr
14694
14695: see if getspnam_r exists
14696set getspnam_r d_getspnam_r
14697eval $inlibc
14698case "$d_getspnam_r" in
14699"$define")
14700 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14701 case "$d_getspnam_r_proto:$usethreads" in
14702 ":define") d_getspnam_r_proto=define
a48ec845
JH
14703 set d_getspnam_r_proto getspnam_r $hdrs
14704 eval $hasproto ;;
14705 *) ;;
14706 esac
14707 case "$d_getspnam_r_proto" in
14708 define)
10bc17b6
JH
14709 case "$getspnam_r_proto" in
14710 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
61c26d18 14711 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14712 esac
14713 case "$getspnam_r_proto" in
14714 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
61c26d18 14715 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
10bc17b6
JH
14716 esac
14717 case "$getspnam_r_proto" in
90e831dc 14718 ''|0) d_getspnam_r=undef
10bc17b6 14719 getspnam_r_proto=0
a48ec845 14720 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14721 * ) case "$getspnam_r_proto" in
14722 REENTRANT_PROTO*) ;;
14723 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14724 esac
14725 echo "Prototype: $try" ;;
14726 esac
14727 ;;
c18e646a
JH
14728 *) case "$usethreads" in
14729 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14730 esac
90e831dc
SB
14731 d_getspnam_r=undef
14732 getspnam_r_proto=0
c18e646a 14733 ;;
a48ec845
JH
14734 esac
14735 ;;
10bc17b6
JH
14736*) getspnam_r_proto=0
14737 ;;
14738esac
14739
b4eb6b3d
JH
14740: see if gettimeofday or ftime exists
14741set gettimeofday d_gettimeod
14742eval $inlibc
14743case "$d_gettimeod" in
14744"$undef")
14745 set ftime d_ftime
14746 eval $inlibc
14747 ;;
14748*)
14749 val="$undef"; set d_ftime; eval $setvar
14750 ;;
14751esac
14752case "$d_gettimeod$d_ftime" in
14753"$undef$undef")
14754 echo " "
14755 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14756 ;;
14757esac
14758
10bc17b6
JH
14759: see if gmtime_r exists
14760set gmtime_r d_gmtime_r
14761eval $inlibc
14762case "$d_gmtime_r" in
14763"$define")
d63eadf0 14764 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14765 case "$d_gmtime_r_proto:$usethreads" in
14766 ":define") d_gmtime_r_proto=define
a48ec845
JH
14767 set d_gmtime_r_proto gmtime_r $hdrs
14768 eval $hasproto ;;
14769 *) ;;
14770 esac
14771 case "$d_gmtime_r_proto" in
14772 define)
10bc17b6
JH
14773 case "$gmtime_r_proto" in
14774 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
61c26d18 14775 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
10bc17b6
JH
14776 esac
14777 case "$gmtime_r_proto" in
14778 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
61c26d18 14779 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
10bc17b6
JH
14780 esac
14781 case "$gmtime_r_proto" in
90e831dc 14782 ''|0) d_gmtime_r=undef
10bc17b6 14783 gmtime_r_proto=0
a48ec845 14784 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14785 * ) case "$gmtime_r_proto" in
14786 REENTRANT_PROTO*) ;;
14787 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14788 esac
14789 echo "Prototype: $try" ;;
14790 esac
b4eb6b3d 14791 ;;
c18e646a
JH
14792 *) case "$usethreads" in
14793 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14794 esac
90e831dc
SB
14795 d_gmtime_r=undef
14796 gmtime_r_proto=0
c18e646a 14797 ;;
a48ec845
JH
14798 esac
14799 ;;
10bc17b6 14800*) gmtime_r_proto=0
b4eb6b3d
JH
14801 ;;
14802esac
14803
14804: see if hasmntopt exists
14805set hasmntopt d_hasmntopt
14806eval $inlibc
14807
14808: see if this is a netinet/in.h or sys/in.h system
14809set netinet/in.h i_niin sys/in.h i_sysin
14810eval $inhdr
14811
14812: see if arpa/inet.h has to be included
14813set arpa/inet.h i_arpainet
14814eval $inhdr
14815
14816: see if htonl --and friends-- exists
14817val=''
14818set htonl val
14819eval $inlibc
14820
14821: Maybe they are macros.
14822case "$val" in
14823$undef)
14824 $cat >htonl.c <<EOM
14825#include <stdio.h>
14826#include <sys/types.h>
14827#$i_niin I_NETINET_IN
14828#$i_sysin I_SYS_IN
14829#$i_arpainet I_ARPA_INET
14830#ifdef I_NETINET_IN
14831#include <netinet/in.h>
14832#endif
14833#ifdef I_SYS_IN
14834#include <sys/in.h>
14835#endif
14836#ifdef I_ARPA_INET
14837#include <arpa/inet.h>
14838#endif
14839#ifdef htonl
14840printf("Defined as a macro.");
14841#endif
14842EOM
14843 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14844 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14845 val="$define"
14846 echo "But it seems to be defined as a macro." >&4
14847 fi
14848 $rm -f htonl.?
14849 ;;
14850esac
14851set d_htonl
14852eval $setvar
14853
36adc09b
JH
14854: see if ilogbl exists
14855set ilogbl d_ilogbl
14856eval $inlibc
14857
b4eb6b3d
JH
14858: index or strchr
14859echo " "
14860if set index val -f; eval $csym; $val; then
14861 if set strchr val -f d_strchr; eval $csym; $val; then
14862 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14863 val="$define"
14864 vali="$undef"
14865 echo "strchr() found." >&4
14866 else
14867 val="$undef"
14868 vali="$define"
14869 echo "index() found." >&4
14870 fi
14871 else
14872 val="$undef"
14873 vali="$define"
8dfa8df9
JH
14874 echo "index() found." >&4
14875 fi
b4eb6b3d 14876else
8dfa8df9
JH
14877 if set strchr val -f d_strchr; eval $csym; $val; then
14878 val="$define"
14879 vali="$undef"
14880 echo "strchr() found." >&4
14881 else
14882 echo "No index() or strchr() found!" >&4
14883 val="$undef"
14884 vali="$undef"
14885 fi
b4eb6b3d 14886fi
8dfa8df9
JH
14887set d_strchr; eval $setvar
14888val="$vali"
14889set d_index; eval $setvar
14890
14891: check whether inet_aton exists
14892set inet_aton d_inetaton
14893eval $inlibc
b4eb6b3d 14894
5086dff9
MB
14895: see if inet_ntop exists
14896set inet_ntop d_inetntop
14897eval $inlibc
14898
14899: see if inet_pton exists
14900set inet_pton d_inetpton
14901eval $inlibc
14902
b4eb6b3d
JH
14903: Look for isascii
14904echo " "
36adc09b 14905$cat >isascii.c <<EOCP
b4eb6b3d
JH
14906#include <stdio.h>
14907#include <ctype.h>
55954f19
JH
14908#$i_stdlib I_STDLIB
14909#ifdef I_STDLIB
14910#include <stdlib.h>
14911#endif
b4eb6b3d
JH
14912int main() {
14913 int c = 'A';
14914 if (isascii(c))
14915 exit(0);
14916 else
14917 exit(1);
14918}
14919EOCP
14920set isascii
14921if eval $compile; then
14922 echo "isascii() found." >&4
14923 val="$define"
14924else
14925 echo "isascii() NOT found." >&4
14926 val="$undef"
14927fi
14928set d_isascii
14929eval $setvar
14930$rm -f isascii*
14931
758a5d79
JH
14932: see if isfinite exists
14933set isfinite d_isfinite
14934eval $inlibc
14935
14936: see if isinf exists
14937set isinf d_isinf
14938eval $inlibc
14939
b4eb6b3d
JH
14940: see if isnan exists
14941set isnan d_isnan
14942eval $inlibc
14943
14944: see if isnanl exists
14945set isnanl d_isnanl
14946eval $inlibc
14947
14948: see if killpg exists
14949set killpg d_killpg
14950eval $inlibc
14951
14952: see if lchown exists
14953echo " "
14954$cat > try.c <<'EOCP'
14955/* System header to define __stub macros and hopefully few prototypes,
14956 which can conflict with char lchown(); below. */
14957#include <assert.h>
14958/* Override any gcc2 internal prototype to avoid an error. */
14959/* We use char because int might match the return type of a gcc2
14960 builtin and then its argument prototype would still apply. */
14961char lchown();
14962int main() {
14963 /* The GNU C library defines this for functions which it implements
14964 to always fail with ENOSYS. Some functions are actually named
14965 something starting with __ and the normal name is an alias. */
14966#if defined (__stub_lchown) || defined (__stub___lchown)
14967choke me
14968#else
14969lchown();
14970#endif
14971; return 0; }
14972EOCP
14973set try
14974if eval $compile; then
14975 $echo "lchown() found." >&4
14976 val="$define"
14977else
14978 $echo "lchown() NOT found." >&4
14979 val="$undef"
14980fi
14981set d_lchown
14982eval $setvar
14983
14984: See if number of significant digits in a double precision number is known
14985echo " "
14986$cat >ldbl_dig.c <<EOM
14987#$i_limits I_LIMITS
14988#$i_float I_FLOAT
14989#ifdef I_LIMITS
14990#include <limits.h>
14991#endif
14992#ifdef I_FLOAT
14993#include <float.h>
14994#endif
14995#ifdef LDBL_DIG
14996printf("Contains LDBL_DIG");
14997#endif
14998EOM
14999$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15000if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15001 echo "LDBL_DIG found." >&4
15002 val="$define"
15003else
15004 echo "LDBL_DIG NOT found." >&4
15005 val="$undef"
15006fi
15007$rm -f ldbl_dig.?
15008set d_ldbl_dig
15009eval $setvar
15010
0a0abfba
MB
15011: see if this is a math.h system
15012set math.h i_math
15013eval $inhdr
15014
613d6c3e 15015: check to see if math.h defines _LIB_VERSION
0a0abfba
MB
15016d_libm_lib_version="$undef"
15017case $i_math in
15018 $define)
0a0abfba
MB
15019 echo " "
15020 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15021 $cat >try.c <<EOCP
15022#include <unistd.h>
15023#include <math.h>
15024int main (int argc, char *argv[])
15025{
15026 printf ("%d\n", _LIB_VERSION);
15027 return (0);
15028 } /* main */
15029EOCP
15030 set try
15031 if eval $compile; then
15032 foo=`$run ./try`
15033 echo "Yes, it does ($foo)" >&4
15034 d_libm_lib_version="$define"
15035 else
4dd8f9b3 15036 echo "No, it does not (probably harmless)" >&4
0a0abfba 15037 fi
5b813a60 15038 $rm_try
0a0abfba
MB
15039 ;;
15040
15041 esac
15042
b4eb6b3d
JH
15043: see if link exists
15044set link d_link
15045eval $inlibc
15046
10bc17b6
JH
15047: see if localtime_r exists
15048set localtime_r d_localtime_r
15049eval $inlibc
15050case "$d_localtime_r" in
15051"$define")
d63eadf0 15052 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
15053 case "$d_localtime_r_proto:$usethreads" in
15054 ":define") d_localtime_r_proto=define
a48ec845
JH
15055 set d_localtime_r_proto localtime_r $hdrs
15056 eval $hasproto ;;
15057 *) ;;
15058 esac
15059 case "$d_localtime_r_proto" in
15060 define)
10bc17b6
JH
15061 case "$localtime_r_proto" in
15062 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
61c26d18 15063 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
10bc17b6
JH
15064 esac
15065 case "$localtime_r_proto" in
15066 ''|0) try='int localtime_r(const time_t*, struct tm*);'
61c26d18 15067 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
10bc17b6
JH
15068 esac
15069 case "$localtime_r_proto" in
90e831dc 15070 ''|0) d_localtime_r=undef
10bc17b6 15071 localtime_r_proto=0
a48ec845 15072 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15073 * ) case "$localtime_r_proto" in
15074 REENTRANT_PROTO*) ;;
15075 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15076 esac
15077 echo "Prototype: $try" ;;
15078 esac
15079 ;;
c18e646a
JH
15080 *) case "$usethreads" in
15081 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15082 esac
90e831dc
SB
15083 d_localtime_r=undef
15084 localtime_r_proto=0
c18e646a 15085 ;;
a48ec845
JH
15086 esac
15087 ;;
10bc17b6
JH
15088*) localtime_r_proto=0
15089 ;;
15090esac
15091
8572b25d
BH
15092: see if localtime_r calls tzset
15093case "$localtime_r_proto" in
15094REENTRANT_PROTO*)
15095 $cat >try.c <<EOCP
15096/* Does our libc's localtime_r call tzset ?
15097 * return 0 if so, 1 otherwise.
15098 */
61c26d18
MHM
15099#$i_systypes I_SYS_TYPES
15100#$i_unistd I_UNISTD
15101#$i_time I_TIME
15102#$i_stdlib I_STDLIB
15103#$i_string I_STRING
15104#$i_malloc I_MALLOC
15105#ifdef I_SYS_TYPES
15106# include <sys/types.h>
15107#endif
15108#ifdef I_UNISTD
15109# include <unistd.h>
15110#endif
15111#ifdef I_TIME
15112# include <time.h>
15113#endif
15114#ifdef I_STDLIB
15115#include <stdlib.h>
15116#endif
15117#ifdef I_STRING
15118# include <string.h>
15119#else
15120# include <strings.h>
15121#endif
15122#ifdef I_MALLOC
15123# include <malloc.h>
15124#endif
8572b25d
BH
15125int main()
15126{
15127 time_t t = time(0L);
15128 char w_tz[]="TZ" "=GMT+5",
15129 e_tz[]="TZ" "=GMT-5",
15130 *tz_e = (char*)malloc(16),
15131 *tz_w = (char*)malloc(16);
15132 struct tm tm_e, tm_w;
15133 memset(&tm_e,'\0',sizeof(struct tm));
15134 memset(&tm_w,'\0',sizeof(struct tm));
15135 strcpy(tz_e,e_tz);
15136 strcpy(tz_w,w_tz);
15137
15138 putenv(tz_e);
15139 localtime_r(&t, &tm_e);
15140
15141 putenv(tz_w);
15142 localtime_r(&t, &tm_w);
15143
15144 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15145 return 1;
15146 return 0;
15147}
15148EOCP
15149 set try
15150 if eval $compile; then
43dddb59 15151 if $run ./try; then
8572b25d
BH
15152 d_localtime_r_needs_tzset=undef;
15153 else
15154 d_localtime_r_needs_tzset=define;
15155 fi;
15156 else
15157 d_localtime_r_needs_tzset=undef;
15158 fi;
15159 ;;
15160 *)
15161 d_localtime_r_needs_tzset=undef;
15162 ;;
15163esac
5b813a60 15164$rm_try
8572b25d 15165
b4eb6b3d
JH
15166: see if localeconv exists
15167set localeconv d_locconv
15168eval $inlibc
15169
15170: see if lockf exists
15171set lockf d_lockf
15172eval $inlibc
15173
b4eb6b3d
JH
15174: see if prototype for lseek is available
15175echo " "
4786929f 15176set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
15177eval $hasproto
15178
15179: see if lstat exists
15180set lstat d_lstat
15181eval $inlibc
15182
15183: see if madvise exists
15184set madvise d_madvise
15185eval $inlibc
15186
7dd121ae
MB
15187: see if malloc_size exists
15188set malloc_size d_malloc_size
15189eval $inlibc
15190
15191: see if malloc_size_good exists
15192set malloc_good_size d_malloc_good_size
15193eval $inlibc
15194
b4eb6b3d
JH
15195: see if mblen exists
15196set mblen d_mblen
15197eval $inlibc
15198
15199: see if mbstowcs exists
15200set mbstowcs d_mbstowcs
15201eval $inlibc
15202
15203: see if mbtowc exists
15204set mbtowc d_mbtowc
15205eval $inlibc
15206
15207: see if memchr exists
15208set memchr d_memchr
15209eval $inlibc
15210
15211: see if memcmp exists
15212set memcmp d_memcmp
15213eval $inlibc
15214
15215: see if memcpy exists
15216set memcpy d_memcpy
15217eval $inlibc
15218
15219: see if memmove exists
15220set memmove d_memmove
15221eval $inlibc
15222
15223: see if memset exists
15224set memset d_memset
15225eval $inlibc
15226
15227: see if mkdir exists
15228set mkdir d_mkdir
15229eval $inlibc
15230
15231: see if mkdtemp exists
15232set mkdtemp d_mkdtemp
15233eval $inlibc
15234
15235: see if mkfifo exists
15236set mkfifo d_mkfifo
15237eval $inlibc
15238
15239: see if mkstemp exists
15240set mkstemp d_mkstemp
15241eval $inlibc
15242
15243: see if mkstemps exists
15244set mkstemps d_mkstemps
15245eval $inlibc
15246
15247: see if mktime exists
15248set mktime d_mktime
15249eval $inlibc
15250
15251: see if this is a sys/mman.h system
15252set sys/mman.h i_sysmman
15253eval $inhdr
15254
15255: see if mmap exists
15256set mmap d_mmap
15257eval $inlibc
15258: see what shmat returns
15259: default to something harmless
15260mmaptype='void *'
15261case "$i_sysmman$d_mmap" in
15262"$define$define")
15263 $cat >mmap.c <<'END'
15264#include <sys/mman.h>
15265void *mmap();
15266END
15267 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15268 mmaptype='void *'
15269 else
15270 mmaptype='caddr_t'
15271 fi
15272 echo "and it returns ($mmaptype)." >&4
15273 ;;
15274esac
15275
15276
15277
89ce900e
JH
15278: see if sqrtl exists
15279set sqrtl d_sqrtl
15280eval $inlibc
15281
af1ff193
JH
15282: see if scalbnl exists
15283set scalbnl d_scalbnl
15284eval $inlibc
15285
89ce900e
JH
15286: see if modfl exists
15287set modfl d_modfl
15288eval $inlibc
15289
15290: see if prototype for modfl is available
15291echo " "
3a794506 15292set d_modflproto modfl $i_math math.h
89ce900e
JH
15293eval $hasproto
15294
15295d_modfl_pow32_bug="$undef"
15296
15297case "$d_longdbl$d_modfl" in
15298$define$define)
15299 $cat <<EOM
15300Checking to see whether your modfl() is okay for large values...
15301EOM
15302$cat >try.c <<EOCP
5b813a60 15303#include <math.h>
89ce900e
JH
15304#include <stdio.h>
15305EOCP
15306if $test "X$d_modflproto" != "X$define"; then
15307 $cat >>try.c <<EOCP
5b813a60 15308/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
15309long double modfl (long double, long double *);
15310EOCP
15311fi
15312$cat >>try.c <<EOCP
15313int main() {
15314 long double nv = 4294967303.15;
15315 long double v, w;
5b813a60 15316 v = modfl(nv, &w);
89ce900e
JH
15317#ifdef __GLIBC__
15318 printf("glibc");
15319#endif
15320 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15321 return 0;
15322}
15323EOCP
15324 case "$osname:$gccversion" in
15325 aix:) saveccflags="$ccflags"
15326 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15327 esac
15328 set try
15329 if eval $compile; then
15330 foo=`$run ./try`
15331 case "$foo" in
15332 *" 4294967303.150000 1.150000 4294967302.000000")
15333 echo >&4 "Your modfl() is broken for large values."
15334 d_modfl_pow32_bug="$define"
15335 case "$foo" in
15336 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15337 ;;
15338 esac
15339 ;;
15340 *" 4294967303.150000 0.150000 4294967303.000000")
15341 echo >&4 "Your modfl() seems okay for large values."
15342 ;;
15343 *) echo >&4 "I don't understand your modfl() at all."
15344 d_modfl="$undef"
15345 ;;
15346 esac
5b813a60 15347 $rm_try
89ce900e
JH
15348 else
15349 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15350 d_modfl="$undef"
15351 fi
15352 case "$osname:$gccversion" in
15353 aix:) ccflags="$saveccflags" ;; # restore
15354 esac
15355 ;;
15356esac
15357
15358if $test "$uselongdouble" = "$define"; then
af1ff193
JH
15359 message=""
15360 if $test "$d_sqrtl" != "$define"; then
15361 message="$message sqrtl"
15362 fi
15363 if $test "$d_modfl" != "$define"; then
89ce900e
JH
15364 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15365 echo "You have both aintl and copysignl, so I can emulate modfl."
15366 else
af1ff193 15367 message="$message modfl"
89ce900e 15368 fi
af1ff193
JH
15369 fi
15370 if $test "$d_frexpl" != "$define"; then
15371 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15372 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15373 else
15374 message="$message frexpl"
15375 fi
15376 fi
89ce900e 15377
af1ff193 15378 if $test "$message" != ""; then
89ce900e
JH
15379 $cat <<EOM >&4
15380
15381*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15382*** the following mathematical functions needed for long double support:
15383*** $message
fe63a0b4
JH
15384*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15385*** Cannot continue, aborting.
89ce900e
JH
15386
15387EOM
15388
fe63a0b4 15389 exit 1
89ce900e
JH
15390 fi
15391fi
15392
b4eb6b3d
JH
15393: see if mprotect exists
15394set mprotect d_mprotect
15395eval $inlibc
15396
15397: see if msgctl exists
15398set msgctl d_msgctl
15399eval $inlibc
15400
15401: see if msgget exists
15402set msgget d_msgget
15403eval $inlibc
15404
15405: see if msgsnd exists
15406set msgsnd d_msgsnd
15407eval $inlibc
15408
15409: see if msgrcv exists
15410set msgrcv d_msgrcv
15411eval $inlibc
15412
15413: see how much of the 'msg*(2)' library is present.
15414h_msg=true
15415echo " "
15416case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15417*"$undef"*) h_msg=false;;
15418esac
15419case "$osname" in
15420freebsd)
15421 case "`ipcs 2>&1`" in
15422 "SVID messages"*"not configured"*)
15423 echo "Your $osname does not have the msg*(2) configured." >&4
15424 h_msg=false
15425 val="$undef"
15426 set msgctl d_msgctl
15427 eval $setvar
15428 set msgget d_msgget
15429 eval $setvar
15430 set msgsnd d_msgsnd
15431 eval $setvar
15432 set msgrcv d_msgrcv
15433 eval $setvar
15434 ;;
15435 esac
15436 ;;
15437esac
15438: we could also check for sys/ipc.h ...
15439if $h_msg && $test `./findhdr sys/msg.h`; then
15440 echo "You have the full msg*(2) library." >&4
15441 val="$define"
15442else
15443 echo "You don't have the full msg*(2) library." >&4
15444 val="$undef"
15445fi
15446set d_msg
15447eval $setvar
15448
34f1896b 15449: Check for msghdr_s
4e0554ec
JH
15450echo " "
15451echo "Checking to see if your system supports struct msghdr..." >&4
15452set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15453eval $hasstruct
15454case "$d_msghdr_s" in
15455"$define") echo "Yes, it does." ;;
15456*) echo "No, it doesn't." ;;
15457esac
15458
15459
b4eb6b3d
JH
15460: see if msync exists
15461set msync d_msync
15462eval $inlibc
15463
15464: see if munmap exists
15465set munmap d_munmap
15466eval $inlibc
15467
15468: see if nice exists
15469set nice d_nice
15470eval $inlibc
15471
2765b840
JH
15472: see if this is a langinfo.h system
15473set langinfo.h i_langinfo
15474eval $inhdr
15475
15476: see if nl_langinfo exists
15477set nl_langinfo d_nl_langinfo
15478eval $inlibc
15479
1d1be0dc
NC
15480: check for volatile keyword
15481echo " "
15482echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15483$cat >try.c <<'EOCP'
76f47787 15484int main()
1d1be0dc
NC
15485{
15486 typedef struct _goo_struct goo_struct;
15487 goo_struct * volatile goo = ((goo_struct *)0);
15488 struct _goo_struct {
15489 long long_int;
15490 int reg_int;
15491 char char_var;
15492 };
15493 typedef unsigned short foo_t;
15494 char *volatile foo;
15495 volatile int bar;
15496 volatile foo_t blech;
15497 foo = foo;
15498}
15499EOCP
15500if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15501 val="$define"
15502 echo "Yup, it does."
15503else
15504 val="$undef"
15505 echo "Nope, it doesn't."
15506fi
15507set d_volatile
15508eval $setvar
5b813a60 15509$rm_try
1d1be0dc 15510
613d6c3e 15511: Check basic sizes
b4eb6b3d
JH
15512echo " "
15513$echo "Choosing the C types to be used for Perl's internal types..." >&4
15514
15515case "$use64bitint:$d_quad:$quadtype" in
15516define:define:?*)
15517 ivtype="$quadtype"
15518 uvtype="$uquadtype"
15519 ivsize=8
15520 uvsize=8
15521 ;;
15522*) ivtype="long"
15523 uvtype="unsigned long"
15524 ivsize=$longsize
15525 uvsize=$longsize
15526 ;;
15527esac
15528
15529case "$uselongdouble:$d_longdbl" in
15530define:define)
15531 nvtype="long double"
15532 nvsize=$longdblsize
15533 ;;
15534*) nvtype=double
15535 nvsize=$doublesize
15536 ;;
15537esac
15538
15539$echo "(IV will be "$ivtype", $ivsize bytes)"
15540$echo "(UV will be "$uvtype", $uvsize bytes)"
15541$echo "(NV will be "$nvtype", $nvsize bytes)"
15542
15543$cat >try.c <<EOCP
15544#$i_inttypes I_INTTYPES
15545#ifdef I_INTTYPES
15546#include <inttypes.h>
15547#endif
15548#include <stdio.h>
15549int main() {
15550#ifdef INT8
15551 int8_t i = INT8_MAX;
15552 uint8_t u = UINT8_MAX;
15553 printf("int8_t\n");
15554#endif
15555#ifdef INT16
15556 int16_t i = INT16_MAX;
15557 uint16_t i = UINT16_MAX;
15558 printf("int16_t\n");
15559#endif
15560#ifdef INT32
15561 int32_t i = INT32_MAX;
15562 uint32_t u = UINT32_MAX;
15563 printf("int32_t\n");
15564#endif
15565}
15566EOCP
15567
13187456 15568i8type="signed char"
0ab0821a
MB
15569u8type="unsigned char"
15570i8size=1
15571u8size=1
b4eb6b3d
JH
15572
15573case "$i16type" in
15574'') case "$shortsize" in
15575 2) i16type=short
15576 u16type="unsigned short"
15577 i16size=$shortsize
15578 u16size=$shortsize
15579 ;;
15580 esac
15581 ;;
15582esac
15583case "$i16type" in
15584'') set try -DINT16
15585 if eval $compile; then
5440bc8e 15586 case "`$run ./try`" in
b4eb6b3d
JH
15587 int16_t)
15588 i16type=int16_t
15589 u16type=uint16_t
15590 i16size=2
15591 u16size=2
15592 ;;
15593 esac
15594 fi
15595 ;;
15596esac
15597case "$i16type" in
15598'') if $test $shortsize -ge 2; then
15599 i16type=short
15600 u16type="unsigned short"
15601 i16size=$shortsize
15602 u16size=$shortsize
15603 fi
15604 ;;
15605esac
15606
15607case "$i32type" in
15608'') case "$longsize" in
15609 4) i32type=long
15610 u32type="unsigned long"
15611 i32size=$longsize
15612 u32size=$longsize
15613 ;;
15614 *) case "$intsize" in
15615 4) i32type=int
15616 u32type="unsigned int"
15617 i32size=$intsize
15618 u32size=$intsize
15619 ;;
15620 esac
15621 ;;
15622 esac
15623 ;;
15624esac
15625case "$i32type" in
15626'') set try -DINT32
15627 if eval $compile; then
5440bc8e 15628 case "`$run ./try`" in
b4eb6b3d
JH
15629 int32_t)
15630 i32type=int32_t
15631 u32type=uint32_t
15632 i32size=4
15633 u32size=4
15634 ;;
15635 esac
15636 fi
15637 ;;
15638esac
15639case "$i32type" in
15640'') if $test $intsize -ge 4; then
15641 i32type=int
15642 u32type="unsigned int"
15643 i32size=$intsize
15644 u32size=$intsize
15645 fi
15646 ;;
15647esac
15648
15649case "$i64type" in
15650'') case "$d_quad:$quadtype" in
15651 define:?*)
15652 i64type="$quadtype"
15653 u64type="$uquadtype"
15654 i64size=8
15655 u64size=8
15656 ;;
15657 esac
15658 ;;
15659esac
15660
1d1be0dc
NC
15661$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15662: volatile so that the compiler has to store it out to memory.
15663if test X"$d_volatile" = X"$define"; then
15664 volatile=volatile
15665fi
b4eb6b3d
JH
15666$cat <<EOP >try.c
15667#include <stdio.h>
55954f19
JH
15668#$i_stdlib I_STDLIB
15669#ifdef I_STDLIB
15670#include <stdlib.h>
15671#endif
1d1be0dc
NC
15672#include <sys/types.h>
15673#include <signal.h>
15674#ifdef SIGFPE
15675$volatile int bletched = 0;
7090f861 15676$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15677#endif
b4eb6b3d
JH
15678int main() {
15679 $uvtype u = 0;
1d1be0dc 15680 $nvtype d;
b4eb6b3d
JH
15681 int n = 8 * $uvsize;
15682 int i;
1d1be0dc
NC
15683#ifdef SIGFPE
15684 signal(SIGFPE, blech);
15685#endif
15686
b4eb6b3d
JH
15687 for (i = 0; i < n; i++) {
15688 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15689 d = ($nvtype)u;
15690 if (($uvtype)d != u)
b4eb6b3d 15691 break;
1d1be0dc
NC
15692 if (d <= 0)
15693 break;
15694 d = ($nvtype)(u - 1);
15695 if (($uvtype)d != (u - 1))
15696 break;
15697#ifdef SIGFPE
22676560 15698 if (bletched)
1d1be0dc
NC
15699 break;
15700#endif
b4eb6b3d 15701 }
efd1522b 15702 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15703 exit(0);
15704}
15705EOP
1d1be0dc
NC
15706set try
15707
15708d_nv_preserves_uv="$undef"
15709if eval $compile; then
53133ed1 15710 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15711fi
53133ed1 15712case "$nv_preserves_uv_bits" in
5b813a60 15713\-[1-9]*)
53133ed1
NC
15714 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15715 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15716 d_nv_preserves_uv="$define"
b4eb6b3d 15717 ;;
53133ed1 15718[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15719 d_nv_preserves_uv="$undef" ;;
15720*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15721 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15722esac
5b813a60 15723$rm_try
1d1be0dc 15724
b68c599a
NC
15725$echo "Checking to find the largest integer value your NVs can hold..." >&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
15730$cat <<EOP >try.c
15731#include <stdio.h>
15732
15733typedef $nvtype NV;
15734
15735int
15736main() {
15737 NV value = 2;
15738 int count = 1;
15739
15740 while(count < 256) {
15741 $volatile NV up = value + 1.0;
15742 $volatile NV negated = -value;
15743 $volatile NV down = negated - 1.0;
15744 $volatile NV got_up = up - value;
15745 int up_good = got_up == 1.0;
15746 int got_down = down - negated;
15747 int down_good = got_down == -1.0;
15748
15749 if (down_good != up_good) {
15750 fprintf(stderr,
15751 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15752 up_good, (double) got_up, down_good, (double) got_down,
15753 count, (double) value);
15754 return 1;
15755 }
15756 if (!up_good) {
15757 while (1) {
15758 if (count > 8) {
15759 count -= 8;
15760 fputs("256.0", stdout);
15761 } else {
15762 count--;
15763 fputs("2.0", stdout);
15764 }
15765 if (!count) {
15766 puts("");
15767 return 0;
15768 }
15769 fputs("*", stdout);
15770 }
15771 }
15772 value *= 2;
15773 ++count;
15774 }
15775 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15776 count, (double) value);
15777 return 1;
15778}
15779EOP
15780set try
15781
15782nv_overflows_integers_at='0'
15783if eval $compile; then
15784 xxx="`$run ./try`"
15785 case "$?" in
15786 0)
15787 case "$xxx" in
15788 2*) cat >&4 <<EOM
15789The largest integer your NVs can preserve is equal to $xxx
15790EOM
15791 nv_overflows_integers_at="$xxx"
15792 ;;
15793 *) cat >&4 <<EOM
15794Cannot determine the largest integer value your NVs can hold, unexpected output
15795'$xxx'
15796EOM
15797 ;;
15798 esac
15799 ;;
15800 *) cat >&4 <<EOM
15801Cannot determine the largest integer value your NVs can hold
15802EOM
15803 ;;
15804 esac
15805fi
15806$rm_try
15807
f607920a
CB
15808$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15809: volatile so that the compiler has to store it out to memory.
15810if test X"$d_volatile" = X"$define"; then
15811 volatile=volatile
15812fi
15813$cat <<EOP >try.c
15814#include <stdio.h>
15815#$i_stdlib I_STDLIB
15816#ifdef I_STDLIB
15817#include <stdlib.h>
15818#endif
15819#$i_string I_STRING
15820#ifdef I_STRING
15821# include <string.h>
15822#else
15823# include <strings.h>
15824#endif
15825#include <sys/types.h>
15826#include <signal.h>
15827#ifdef SIGFPE
15828$volatile int bletched = 0;
7090f861 15829$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15830#endif
15831
15832int checkit($nvtype d, char *where) {
15833 unsigned char *p = (char *)&d;
15834 unsigned char *end = p + sizeof(d);
15835 int fail = 0;
15836
15837 while (p < end)
15838 fail += *p++;
15839
15840 if (!fail)
17f6277d 15841 return 0;
f607920a
CB
15842
15843 p = (char *)&d;
15844 printf("No - %s: 0x", where);
15845 while (p < end)
15846 printf ("%02X", *p++);
15847 printf("\n");
15848 return 1;
15849}
15850
15851int main(int argc, char **argv) {
15852 $nvtype d = 0.0;
15853 int fail = 0;
15854 fail += checkit(d, "0.0");
15855
15856 /* The compiler shouldn't be assuming that bletched is 0 */
15857 d = bletched;
15858
15859 fail += checkit(d, "bleched");
15860
15861#ifdef SIGFPE
15862 signal(SIGFPE, blech);
15863#endif
15864
15865 /* Paranoia - the compiler should have no way of knowing that ANSI says
15866 that argv[argc] will always be NULL. Actually, if it did assume this it
15867 would be buggy, as this is C and main() can be called from elsewhere in
15868 the program. */
15869 d = argv[argc] ? 1 : 0;
15870
15871 if (d) {
15872 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15873 }
15874
15875 fail += checkit(d, "ternary");
15876
15877 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15878
15879 if (d != 0.0) {
15880 printf("No - memset doesn't give 0.0\n");
15881 /* This might just blow up: */
15882 printf("(gives %g)\n", d);
15883 return 1;
15884 }
5b813a60 15885
f607920a
CB
15886#ifdef SIGFPE
15887 if (bletched) {
15888 printf("No - something bleched\n");
15889 return 1;
15890 }
15891#endif
15892 if (fail) {
15893 printf("No - %d fail(s)\n", fail);
15894 return 1;
15895 }
15896 printf("Yes\n");
15897 return 0;
15898}
15899EOP
15900set try
15901
15902d_nv_zero_is_allbits_zero="$undef"
15903if eval $compile; then
15904 xxx="`$run ./try`"
15905 case "$?" in
15906 0)
15907 case "$xxx" in
15908 Yes) cat >&4 <<EOM
159090.0 is represented as all bits zero in memory
15910EOM
15911 d_nv_zero_is_allbits_zero="$define"
15912 ;;
15913 *) cat >&4 <<EOM
159140.0 is not represented as all bits zero in memory
15915EOM
15916 d_nv_zero_is_allbits_zero="$undef"
15917 ;;
15918 esac
15919 ;;
15920 *) cat >&4 <<EOM
159210.0 is not represented as all bits zero in memory
15922EOM
15923 d_nv_zero_is_allbits_zero="$undef"
15924 ;;
15925 esac
15926fi
5b813a60 15927$rm_try
b4eb6b3d
JH
15928
15929: check for off64_t
15930echo " "
15931echo "Checking to see if you have off64_t..." >&4
15932$cat >try.c <<EOCP
15933#include <sys/types.h>
15934#include <unistd.h>
15935int main() { off64_t x = 7; }
15936EOCP
15937set try
15938if eval $compile; then
15939 val="$define"
15940 echo "You have off64_t."
15941else
15942 val="$undef"
15943 echo "You do not have off64_t."
15944 case "$lseeksize" in
15945 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15946 esac
15947fi
5b813a60 15948$rm_try
b4eb6b3d
JH
15949set d_off64_t
15950eval $setvar
15951
b4eb6b3d
JH
15952: how to create joinable pthreads
15953if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15954 echo " "
5b813a60 15955 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
15956 $cat >try.c <<'EOCP'
15957#include <pthread.h>
15958int main() {
15959 int detachstate = JOINABLE;
15960}
15961EOCP
15962 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15963 if eval $compile; then
15964 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15965 val="$undef" # Yes, undef.
15966 set d_old_pthread_create_joinable
15967 eval $setvar
15968 val=""
15969 set old_pthread_create_joinable
15970 eval $setvar
15971 else
15972 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15973 if eval $compile; then
15974 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15975 val="$define"
15976 set d_old_pthread_create_joinable
15977 eval $setvar
15978 val=PTHREAD_CREATE_UNDETACHED
15979 set old_pthread_create_joinable
15980 eval $setvar
5b813a60 15981 else
b4eb6b3d
JH
15982 set try -DJOINABLE=__UNDETACHED
15983 if eval $compile; then
15984 echo "You seem to use __UNDETACHED." >&4
15985 val="$define"
15986 set d_old_pthread_create_joinable
15987 eval $setvar
15988 val=__UNDETACHED
15989 set old_pthread_create_joinable
15990 eval $setvar
15991 else
15992 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15993 val="$define"
15994 set d_old_pthread_create_joinable
15995 eval $setvar
15996 val=0
15997 set old_pthread_create_joinable
15998 eval $setvar
15999 fi
16000 fi
16001 fi
5b813a60 16002 $rm_try
b4eb6b3d
JH
16003else
16004 d_old_pthread_create_joinable="$undef"
16005 old_pthread_create_joinable=""
16006fi
16007
16008: see if pause exists
16009set pause d_pause
16010eval $inlibc
16011
b4eb6b3d
JH
16012: see if poll exists
16013set poll d_poll
16014eval $inlibc
16015
c796e3db
MB
16016: see if prctl exists
16017set prctl d_prctl
16018eval $inlibc
16019
16020: see if prctl supports PR_SET_NAME
16021d_prctl_set_name=$undef
16022case $d_prctl in
16023 $define)
16024 $cat >try.c <<EOM
16025#include <sys/prctl.h>
16026
16027int main (int argc, char *argv[])
16028{
16029 return (prctl (PR_SET_NAME, "Test"));
16030 } /* main */
16031EOM
16032 set try
16033 if eval $compile_ok && $run ./try; then
16034 echo "Your prctl (PR_SET_NAME, ...) works"
16035 d_prctl_set_name=$define
16036 fi
16037 $rm_try
16038 ;;
16039 esac
16040
c7aff470
NIS
16041: see if readlink exists
16042set readlink d_readlink
16043eval $inlibc
16044
613d6c3e 16045: Check if exe is symlink to abs path of executing program
c7aff470 16046echo " "
f24dbf84 16047procselfexe=''
c7aff470 16048val="$undef"
a33c94aa 16049case "$d_readlink" in
698ca84c 16050 "$define")
9e68546f
NC
16051 : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16052 : more tidy to avoid an extra level of symlink
16053 set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
698ca84c
NC
16054 while test $# -gt 0; do
16055 type=$1; try=$2
16056 shift; shift
16057 if $issymlink $try; then
16058 $ls -l $try > reflect
f24dbf84 16059 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
698ca84c
NC
16060 echo "You have $type-like $try."
16061 procselfexe='"'$try'"'
16062 val="$define"
16063 : This will break out of the loop
16064 set X; shift
c7aff470 16065 fi
698ca84c
NC
16066 fi
16067 done
a33c94aa
JH
16068 ;;
16069esac
428dc699 16070$rm -f reflect
c7aff470
NIS
16071set d_procselfexe
16072eval $setvar
16073
233e16ce
MB
16074: backward compatibility for d_hvfork
16075if test X$d_hvfork != X; then
16076 d_vfork="$d_hvfork"
16077 d_hvfork=''
16078fi
16079: see if there is a vfork
16080val=''
16081set vfork val
16082eval $inlibc
16083
16084d_pseudofork=$undef
16085
16086: Ok, but do we want to use it. vfork is reportedly unreliable in
16087: perl on Solaris 2.x, and probably elsewhere.
16088case "$val" in
16089$define)
16090 echo " "
16091 case "$usevfork" in
16092 false) dflt='n';;
16093 *) dflt='y';;
16094 esac
16095 cat <<'EOM'
16096
16097Perl can only use a vfork() that doesn't suffer from strict
16098restrictions on calling functions or modifying global data in
16099the child. For example, glibc-2.1 contains such a vfork()
16100that is unsuitable. If your system provides a proper fork()
16101call, chances are that you do NOT want perl to use vfork().
16102
16103EOM
16104 rp="Do you still want to use vfork()?"
16105 . ./myread
16106 case "$ans" in
16107 y|Y) ;;
16108 *)
16109 echo "Ok, we won't use vfork()."
16110 val="$undef"
16111 ;;
16112 esac
16113 ;;
16114esac
16115set d_vfork
16116eval $setvar
16117case "$d_vfork" in
16118$define) usevfork='true';;
16119*) usevfork='false';;
16120esac
16121
263fee3f
JH
16122: see whether the pthread_atfork exists
16123$cat >try.c <<EOP
16124#include <pthread.h>
16125#include <stdio.h>
16126int main() {
16127#ifdef PTHREAD_ATFORK
16128 pthread_atfork(NULL,NULL,NULL);
16129#endif
16130}
16131EOP
16132
d6483fcc 16133: see if pthread_atfork exists
263fee3f
JH
16134set try -DPTHREAD_ATFORK
16135if eval $compile; then
16136 val="$define"
16137else
16138 val="$undef"
16139fi
16140case "$usethreads" in
16141$define)
16142 case "$val" in
16143 $define) echo 'pthread_atfork found.' >&4 ;;
16144 *) echo 'pthread_atfork NOT found.' >&4 ;;
16145 esac
16146esac
16147set d_pthread_atfork
16148eval $setvar
d6483fcc 16149
58d975c3
JH
16150: see if pthread_attr_setscope exists
16151set pthread_attr_setscope d_pthread_attr_setscope
16152eval $inlibc
16153
b4eb6b3d
JH
16154: see whether the various POSIXish _yields exist
16155$cat >try.c <<EOP
16156#include <pthread.h>
16157#include <stdio.h>
16158int main() {
16159#ifdef SCHED_YIELD
16160 sched_yield();
16161#else
16162#ifdef PTHREAD_YIELD
16163 pthread_yield();
16164#else
16165#ifdef PTHREAD_YIELD_NULL
16166 pthread_yield(NULL);
16167#endif
16168#endif
16169#endif
16170}
16171EOP
16172: see if sched_yield exists
16173set try -DSCHED_YIELD
16174if eval $compile; then
16175 val="$define"
16176 sched_yield='sched_yield()'
16177else
16178 val="$undef"
16179fi
16180case "$usethreads" in
16181$define)
16182 case "$val" in
16183 $define) echo 'sched_yield() found.' >&4 ;;
16184 *) echo 'sched_yield() NOT found.' >&4 ;;
16185 esac
16186esac
10bc17b6
JH
16187set d_sched_yield
16188eval $setvar
b4eb6b3d 16189
10bc17b6
JH
16190: see if pthread_yield exists
16191set try -DPTHREAD_YIELD
16192if eval $compile; then
16193 val="$define"
16194 case "$sched_yield" in
16195 '') sched_yield='pthread_yield()' ;;
16196 esac
16197else
16198 set try -DPTHREAD_YIELD_NULL
16199 if eval $compile; then
16200 val="$define"
16201 case "$sched_yield" in
16202 '') sched_yield='pthread_yield(NULL)' ;;
16203 esac
16204 else
16205 val="$undef"
16206 fi
16207fi
16208case "$usethreads" in
16209$define)
16210 case "$val" in
16211 $define) echo 'pthread_yield() found.' >&4 ;;
16212 *) echo 'pthread_yield() NOT found.' >&4 ;;
16213 esac
16214 ;;
16215esac
16216set d_pthread_yield
16217eval $setvar
10bc17b6
JH
16218case "$sched_yield" in
16219'') sched_yield=undef ;;
16220esac
5b813a60 16221$rm_try
10bc17b6
JH
16222
16223: see if random_r exists
16224set random_r d_random_r
16225eval $inlibc
16226case "$d_random_r" in
16227"$define")
16228 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16229 case "$d_random_r_proto:$usethreads" in
16230 ":define") d_random_r_proto=define
a48ec845
JH
16231 set d_random_r_proto random_r $hdrs
16232 eval $hasproto ;;
16233 *) ;;
16234 esac
16235 case "$d_random_r_proto" in
16236 define)
10bc17b6
JH
16237 case "$random_r_proto" in
16238 ''|0) try='int random_r(int*, struct random_data*);'
61c26d18 16239 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
a845a0d4
JH
16240 esac
16241 case "$random_r_proto" in
16242 ''|0) try='int random_r(long*, struct random_data*);'
61c26d18 16243 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
a845a0d4
JH
16244 esac
16245 case "$random_r_proto" in
16246 ''|0) try='int random_r(struct random_data*, int32_t*);'
61c26d18 16247 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
16248 esac
16249 case "$random_r_proto" in
90e831dc 16250 ''|0) d_random_r=undef
10bc17b6 16251 random_r_proto=0
a48ec845 16252 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16253 * ) case "$random_r_proto" in
16254 REENTRANT_PROTO*) ;;
16255 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16256 esac
16257 echo "Prototype: $try" ;;
16258 esac
b4eb6b3d 16259 ;;
c18e646a
JH
16260 *) case "$usethreads" in
16261 define) echo "random_r has no prototype, not using it." >&4 ;;
16262 esac
90e831dc
SB
16263 d_random_r=undef
16264 random_r_proto=0
c18e646a 16265 ;;
a48ec845
JH
16266 esac
16267 ;;
10bc17b6 16268*) random_r_proto=0
b4eb6b3d
JH
16269 ;;
16270esac
16271
16272: see if readdir and friends exist
16273set readdir d_readdir
16274eval $inlibc
16275set seekdir d_seekdir
16276eval $inlibc
16277set telldir d_telldir
16278eval $inlibc
16279set rewinddir d_rewinddir
16280eval $inlibc
16281
10bc17b6
JH
16282: see if readdir64_r exists
16283set readdir64_r d_readdir64_r
16284eval $inlibc
16285case "$d_readdir64_r" in
16286"$define")
16287 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16288 case "$d_readdir64_r_proto:$usethreads" in
16289 ":define") d_readdir64_r_proto=define
a48ec845
JH
16290 set d_readdir64_r_proto readdir64_r $hdrs
16291 eval $hasproto ;;
16292 *) ;;
16293 esac
16294 case "$d_readdir64_r_proto" in
16295 define)
10bc17b6
JH
16296 case "$readdir64_r_proto" in
16297 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
61c26d18 16298 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
10bc17b6
JH
16299 esac
16300 case "$readdir64_r_proto" in
16301 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
61c26d18 16302 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
10bc17b6
JH
16303 esac
16304 case "$readdir64_r_proto" in
90e831dc 16305 ''|0) d_readdir64_r=undef
10bc17b6 16306 readdir64_r_proto=0
a48ec845 16307 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16308 * ) case "$readdir64_r_proto" in
16309 REENTRANT_PROTO*) ;;
16310 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16311 esac
16312 echo "Prototype: $try" ;;
16313 esac
16314 ;;
c18e646a
JH
16315 *) case "$usethreads" in
16316 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16317 esac
90e831dc
SB
16318 d_readdir64_r=undef
16319 readdir64_r_proto=0
c18e646a 16320 ;;
a48ec845
JH
16321 esac
16322 ;;
10bc17b6
JH
16323*) readdir64_r_proto=0
16324 ;;
16325esac
16326
16327: see if readdir_r exists
16328set readdir_r d_readdir_r
16329eval $inlibc
16330case "$d_readdir_r" in
16331"$define")
16332 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16333 case "$d_readdir_r_proto:$usethreads" in
16334 ":define") d_readdir_r_proto=define
a48ec845
JH
16335 set d_readdir_r_proto readdir_r $hdrs
16336 eval $hasproto ;;
16337 *) ;;
16338 esac
16339 case "$d_readdir_r_proto" in
16340 define)
10bc17b6
JH
16341 case "$readdir_r_proto" in
16342 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
61c26d18 16343 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
10bc17b6
JH
16344 esac
16345 case "$readdir_r_proto" in
16346 ''|0) try='int readdir_r(DIR*, struct dirent*);'
61c26d18 16347 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
10bc17b6
JH
16348 esac
16349 case "$readdir_r_proto" in
90e831dc 16350 ''|0) d_readdir_r=undef
10bc17b6 16351 readdir_r_proto=0
a48ec845 16352 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16353 * ) case "$readdir_r_proto" in
16354 REENTRANT_PROTO*) ;;
16355 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16356 esac
16357 echo "Prototype: $try" ;;
16358 esac
16359 ;;
c18e646a
JH
16360 *) case "$usethreads" in
16361 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16362 esac
90e831dc
SB
16363 d_readdir_r=undef
16364 readdir_r_proto=0
c18e646a 16365 ;;
a48ec845
JH
16366 esac
16367 ;;
10bc17b6
JH
16368*) readdir_r_proto=0
16369 ;;
16370esac
16371
4e0554ec
JH
16372: see if readv exists
16373set readv d_readv
16374eval $inlibc
16375
16376: see if recvmsg exists
16377set recvmsg d_recvmsg
16378eval $inlibc
16379
b4eb6b3d
JH
16380: see if rename exists
16381set rename d_rename
16382eval $inlibc
16383
16384: see if rmdir exists
16385set rmdir d_rmdir
16386eval $inlibc
16387
16388: see if memory.h is available.
16389val=''
16390set memory.h val
16391eval $inhdr
16392
16393: See if it conflicts with string.h
16394case "$val" in
16395$define)
16396 case "$strings" in
16397 '') ;;
16398 *)
16399 $cppstdin $cppflags $cppminus < $strings > mem.h
16400 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16401 echo " "
16402 echo "We won't be including <memory.h>."
16403 val="$undef"
16404 fi
16405 $rm -f mem.h
16406 ;;
16407 esac
16408esac
16409set i_memory
16410eval $setvar
16411
16412: can bcopy handle overlapping blocks?
b6cc3bc4 16413echo " "
b4eb6b3d 16414val="$undef"
b6cc3bc4
AD
16415case "$d_memmove" in
16416"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16417*) case "$d_bcopy" in
16418 "$define")
16419 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16420 $cat >try.c <<EOCP
b4eb6b3d
JH
16421#$i_memory I_MEMORY
16422#$i_stdlib I_STDLIB
16423#$i_string I_STRING
16424#$i_unistd I_UNISTD
16425EOCP
16426 $cat >>try.c <<'EOCP'
16427#include <stdio.h>
16428#ifdef I_MEMORY
16429# include <memory.h>
16430#endif
16431#ifdef I_STDLIB
16432# include <stdlib.h>
16433#endif
16434#ifdef I_STRING
16435# include <string.h>
16436#else
16437# include <strings.h>
16438#endif
16439#ifdef I_UNISTD
16440# include <unistd.h> /* Needed for NetBSD */
16441#endif
16442int main()
16443{
16444char buf[128], abc[128];
16445char *b;
16446int len;
16447int off;
16448int align;
16449
b6cc3bc4
AD
16450/* Copy "abcde..." string to char abc[] so that gcc doesn't
16451 try to store the string in read-only memory. */
b4eb6b3d
JH
16452bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16453
16454for (align = 7; align >= 0; align--) {
16455 for (len = 36; len; len--) {
16456 b = buf+align;
16457 bcopy(abc, b, len);
16458 for (off = 1; off <= len; off++) {
16459 bcopy(b, b+off, len);
16460 bcopy(b+off, b, len);
16461 if (bcmp(b, abc, len))
16462 exit(1);
16463 }
16464 }
16465}
16466exit(0);
16467}
16468EOCP
b6cc3bc4
AD
16469 set try
16470 if eval $compile_ok; then
43dddb59 16471 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16472 echo "Yes, it can."
16473 val="$define"
16474 else
16475 echo "It can't, sorry."
16476 fi
b4eb6b3d 16477 else
b6cc3bc4 16478 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16479 fi
b6cc3bc4
AD
16480 ;;
16481 esac
5b813a60 16482 $rm_try
b4eb6b3d
JH
16483 ;;
16484esac
b4eb6b3d
JH
16485set d_safebcpy
16486eval $setvar
16487
16488: can memcpy handle overlapping blocks?
b6cc3bc4 16489echo " "
b4eb6b3d 16490val="$undef"
b6cc3bc4
AD
16491case "$d_memmove" in
16492"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16493*) case "$d_memcpy" in
16494 "$define")
16495 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16496 $cat >try.c <<EOCP
b4eb6b3d
JH
16497#$i_memory I_MEMORY
16498#$i_stdlib I_STDLIB
16499#$i_string I_STRING
16500#$i_unistd I_UNISTD
16501EOCP
16502 $cat >>try.c <<'EOCP'
16503#include <stdio.h>
16504#ifdef I_MEMORY
16505# include <memory.h>
16506#endif
16507#ifdef I_STDLIB
16508# include <stdlib.h>
16509#endif
16510#ifdef I_STRING
16511# include <string.h>
16512#else
16513# include <strings.h>
16514#endif
16515#ifdef I_UNISTD
16516# include <unistd.h> /* Needed for NetBSD */
16517#endif
16518int main()
16519{
16520char buf[128], abc[128];
16521char *b;
16522int len;
16523int off;
16524int align;
16525
16526/* Copy "abcde..." string to char abc[] so that gcc doesn't
16527 try to store the string in read-only memory. */
16528memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16529
16530for (align = 7; align >= 0; align--) {
16531 for (len = 36; len; len--) {
16532 b = buf+align;
16533 memcpy(b, abc, len);
16534 for (off = 1; off <= len; off++) {
16535 memcpy(b+off, b, len);
16536 memcpy(b, b+off, len);
16537 if (memcmp(b, abc, len))
16538 exit(1);
16539 }
16540 }
16541}
16542exit(0);
16543}
16544EOCP
b6cc3bc4
AD
16545 set try
16546 if eval $compile_ok; then
43dddb59 16547 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16548 echo "Yes, it can."
16549 val="$define"
16550 else
16551 echo "It can't, sorry."
16552 fi
b4eb6b3d 16553 else
b6cc3bc4 16554 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16555 fi
b6cc3bc4
AD
16556 ;;
16557 esac
5b813a60 16558 $rm_try
b4eb6b3d
JH
16559 ;;
16560esac
b4eb6b3d
JH
16561set d_safemcpy
16562eval $setvar
16563
16564: can memcmp be trusted to compare relative magnitude?
16565val="$undef"
16566case "$d_memcmp" in
16567"$define")
16568 echo " "
16569 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16570 $cat >try.c <<EOCP
16571#$i_memory I_MEMORY
16572#$i_stdlib I_STDLIB
16573#$i_string I_STRING
16574#$i_unistd I_UNISTD
16575EOCP
16576 $cat >>try.c <<'EOCP'
16577#include <stdio.h>
16578#ifdef I_MEMORY
16579# include <memory.h>
16580#endif
16581#ifdef I_STDLIB
36adc09b 16582# include <stdlib.h>
b4eb6b3d
JH
16583#endif
16584#ifdef I_STRING
16585# include <string.h>
16586#else
16587# include <strings.h>
16588#endif
16589#ifdef I_UNISTD
16590# include <unistd.h> /* Needed for NetBSD */
16591#endif
16592int main()
16593{
16594char a = -1;
16595char b = 0;
16596if ((a < b) && memcmp(&a, &b, 1) < 0)
16597 exit(1);
16598exit(0);
16599}
16600EOCP
16601 set try
16602 if eval $compile_ok; then
5440bc8e 16603 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16604 echo "Yes, it can."
16605 val="$define"
16606 else
16607 echo "No, it can't (it uses signed chars)."
16608 fi
16609 else
16610 echo "(I can't compile the test program, so we'll assume not...)"
16611 fi
16612 ;;
16613esac
5b813a60 16614$rm_try
b4eb6b3d
JH
16615set d_sanemcmp
16616eval $setvar
16617
ef9f17be
JH
16618: see if prototype for sbrk is available
16619echo " "
16620set d_sbrkproto sbrk $i_unistd unistd.h
16621eval $hasproto
16622
b4eb6b3d
JH
16623: see if select exists
16624set select d_select
16625eval $inlibc
16626
16627: see if semctl exists
16628set semctl d_semctl
16629eval $inlibc
16630
16631: see if semget exists
16632set semget d_semget
16633eval $inlibc
16634
16635: see if semop exists
16636set semop d_semop
16637eval $inlibc
16638
16639: see how much of the 'sem*(2)' library is present.
16640h_sem=true
16641echo " "
16642case "$d_semctl$d_semget$d_semop" in
16643*"$undef"*) h_sem=false;;
16644esac
16645case "$osname" in
16646freebsd)
16647 case "`ipcs 2>&1`" in
16648 "SVID messages"*"not configured"*)
16649 echo "Your $osname does not have the sem*(2) configured." >&4
16650 h_sem=false
16651 val="$undef"
16652 set semctl d_semctl
16653 eval $setvar
16654 set semget d_semget
16655 eval $setvar
16656 set semop d_semop
16657 eval $setvar
16658 ;;
16659 esac
16660 ;;
16661esac
16662: we could also check for sys/ipc.h ...
16663if $h_sem && $test `./findhdr sys/sem.h`; then
16664 echo "You have the full sem*(2) library." >&4
16665 val="$define"
16666else
16667 echo "You don't have the full sem*(2) library." >&4
16668 val="$undef"
16669fi
16670set d_sem
16671eval $setvar
16672
16673: see whether sys/sem.h defines union semun
16674echo " "
16675$cat > try.c <<'END'
16676#include <sys/types.h>
16677#include <sys/ipc.h>
16678#include <sys/sem.h>
16679int main () { union semun semun; semun.buf = 0; }
16680END
16681set try
16682if eval $compile; then
16683 echo "You have union semun in <sys/sem.h>." >&4
16684 val="$define"
16685else
16686 echo "You do not have union semun in <sys/sem.h>." >&4
16687 val="$undef"
16688fi
5b813a60 16689$rm_try
b4eb6b3d
JH
16690set d_union_semun
16691eval $setvar
16692
16693: see how to do semctl IPC_STAT
16694case "$d_sem" in
16695$define)
b4eb6b3d 16696 echo " "
93451a0d 16697 $cat > tryh.h <<END
b4eb6b3d
JH
16698#ifndef S_IRUSR
16699# ifdef S_IREAD
16700# define S_IRUSR S_IREAD
16701# define S_IWUSR S_IWRITE
16702# define S_IXUSR S_IEXEC
16703# else
16704# define S_IRUSR 0400
16705# define S_IWUSR 0200
16706# define S_IXUSR 0100
16707# endif
16708# define S_IRGRP (S_IRUSR>>3)
16709# define S_IWGRP (S_IWUSR>>3)
16710# define S_IXGRP (S_IXUSR>>3)
16711# define S_IROTH (S_IRUSR>>6)
16712# define S_IWOTH (S_IWUSR>>6)
16713# define S_IXOTH (S_IXUSR>>6)
16714#endif
16715#ifndef S_IRWXU
16716# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16717# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16718# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16719#endif
16720END
2fad75a1 16721 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16722 case "$d_semctl_semun" in
16723 '')
35918792 16724 val="$undef"
2fad75a1 16725 $cat > try.c <<END
b4eb6b3d
JH
16726#include <sys/types.h>
16727#include <sys/ipc.h>
16728#include <sys/sem.h>
16729#include <sys/stat.h>
16730#include <stdio.h>
16731#include <errno.h>
93451a0d 16732#include "tryh.h"
b4eb6b3d
JH
16733#ifndef errno
16734extern int errno;
16735#endif
16736#$d_union_semun HAS_UNION_SEMUN
16737int main() {
16738 union semun
16739#ifndef HAS_UNION_SEMUN
16740 {
16741 int val;
16742 struct semid_ds *buf;
16743 unsigned short *array;
16744 }
16745#endif
16746 arg;
16747 int sem, st;
16748
16749#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16750 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16751 if (sem > -1) {
16752 struct semid_ds argbuf;
16753 arg.buf = &argbuf;
16754# ifdef IPC_STAT
16755 st = semctl(sem, 0, IPC_STAT, arg);
16756 if (st == 0)
16757 printf("semun\n");
16758 else
16759# endif /* IPC_STAT */
16760 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16761# ifdef IPC_RMID
16762 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16763# endif /* IPC_RMID */
b4eb6b3d
JH
16764 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16765 } else
16766#endif /* IPC_PRIVATE && ... */
16767 printf("semget failed: errno = %d\n", errno);
16768 return 0;
16769}
16770END
2fad75a1
JH
16771 set try
16772 if eval $compile; then
16773 xxx=`$run ./try`
16774 case "$xxx" in
16775 semun) val="$define" ;;
16776 esac
16777 fi
5b813a60 16778 $rm_try
35918792
YST
16779 set d_semctl_semun
16780 eval $setvar
2fad75a1
JH
16781 ;;
16782 esac
b4eb6b3d
JH
16783 case "$d_semctl_semun" in
16784 $define)
16785 echo "You can use union semun for semctl IPC_STAT." >&4
16786 also='also'
16787 ;;
16788 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16789 also=''
16790 ;;
16791 esac
16792
16793 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16794 case "$d_semctl_semid_ds" in
16795 '')
35918792 16796 val="$undef"
2fad75a1 16797 $cat > try.c <<'END'
b4eb6b3d
JH
16798#include <sys/types.h>
16799#include <sys/ipc.h>
16800#include <sys/sem.h>
16801#include <sys/stat.h>
93451a0d 16802#include "tryh.h"
b4eb6b3d
JH
16803#include <stdio.h>
16804#include <errno.h>
16805#ifndef errno
16806extern int errno;
16807#endif
16808int main() {
16809 struct semid_ds arg;
16810 int sem, st;
16811
16812#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16813 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16814 if (sem > -1) {
16815# ifdef IPC_STAT
16816 st = semctl(sem, 0, IPC_STAT, &arg);
16817 if (st == 0)
16818 printf("semid_ds\n");
16819 else
16820# endif /* IPC_STAT */
16821 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16822# ifdef IPC_RMID
16823 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16824# endif /* IPC_RMID */
16825 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16826 } else
16827#endif /* IPC_PRIVATE && ... */
16828 printf("semget failed: errno = %d\n", errno);
16829
16830 return 0;
16831}
16832END
2fad75a1
JH
16833 set try
16834 if eval $compile; then
16835 xxx=`$run ./try`
16836 case "$xxx" in
16837 semid_ds) val="$define" ;;
16838 esac
16839 fi
5b813a60 16840 $rm_try
35918792
YST
16841 set d_semctl_semid_ds
16842 eval $setvar
2fad75a1
JH
16843 ;;
16844 esac
b4eb6b3d
JH
16845 case "$d_semctl_semid_ds" in
16846 $define)
16847 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16848 ;;
16849 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16850 ;;
16851 esac
b4eb6b3d
JH
16852 ;;
16853*) val="$undef"
16854
16855 # We do not have the full sem*(2) library, so assume we can not
16856 # use either.
16857
16858 set d_semctl_semun
16859 eval $setvar
16860
16861 set d_semctl_semid_ds
16862 eval $setvar
16863 ;;
16864esac
93451a0d 16865$rm_try tryh.h
b4eb6b3d 16866
4e0554ec
JH
16867: see if sendmsg exists
16868set sendmsg d_sendmsg
16869eval $inlibc
16870
b4eb6b3d
JH
16871: see if setegid exists
16872set setegid d_setegid
16873eval $inlibc
16874
16875: see if seteuid exists
16876set seteuid d_seteuid
16877eval $inlibc
16878
16879: see if setgrent exists
16880set setgrent d_setgrent
16881eval $inlibc
16882
10bc17b6
JH
16883: see if setgrent_r exists
16884set setgrent_r d_setgrent_r
16885eval $inlibc
16886case "$d_setgrent_r" in
16887"$define")
16888 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16889 case "$d_setgrent_r_proto:$usethreads" in
16890 ":define") d_setgrent_r_proto=define
a48ec845
JH
16891 set d_setgrent_r_proto setgrent_r $hdrs
16892 eval $hasproto ;;
16893 *) ;;
16894 esac
16895 case "$d_setgrent_r_proto" in
16896 define)
10bc17b6
JH
16897 case "$setgrent_r_proto" in
16898 ''|0) try='int setgrent_r(FILE**);'
61c26d18 16899 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
10bc17b6
JH
16900 esac
16901 case "$setgrent_r_proto" in
16902 ''|0) try='void setgrent_r(FILE**);'
61c26d18 16903 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
10bc17b6
JH
16904 esac
16905 case "$setgrent_r_proto" in
90e831dc 16906 ''|0) d_setgrent_r=undef
10bc17b6 16907 setgrent_r_proto=0
a48ec845 16908 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16909 * ) case "$setgrent_r_proto" in
16910 REENTRANT_PROTO*) ;;
16911 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16912 esac
16913 echo "Prototype: $try" ;;
16914 esac
16915 ;;
c18e646a
JH
16916 *) case "$usethreads" in
16917 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16918 esac
90e831dc
SB
16919 d_setgrent_r=undef
16920 setgrent_r_proto=0
c18e646a 16921 ;;
a48ec845
JH
16922 esac
16923 ;;
10bc17b6
JH
16924*) setgrent_r_proto=0
16925 ;;
16926esac
16927
b4eb6b3d
JH
16928: see if sethostent exists
16929set sethostent d_sethent
16930eval $inlibc
16931
10bc17b6
JH
16932: see if sethostent_r exists
16933set sethostent_r d_sethostent_r
16934eval $inlibc
16935case "$d_sethostent_r" in
16936"$define")
16937 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16938 case "$d_sethostent_r_proto:$usethreads" in
16939 ":define") d_sethostent_r_proto=define
a48ec845
JH
16940 set d_sethostent_r_proto sethostent_r $hdrs
16941 eval $hasproto ;;
16942 *) ;;
16943 esac
16944 case "$d_sethostent_r_proto" in
16945 define)
10bc17b6
JH
16946 case "$sethostent_r_proto" in
16947 ''|0) try='int sethostent_r(int, struct hostent_data*);'
61c26d18 16948 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
10bc17b6
JH
16949 esac
16950 case "$sethostent_r_proto" in
16951 ''|0) try='void sethostent_r(int, struct hostent_data*);'
61c26d18 16952 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
10bc17b6
JH
16953 esac
16954 case "$sethostent_r_proto" in
90e831dc 16955 ''|0) d_sethostent_r=undef
10bc17b6 16956 sethostent_r_proto=0
a48ec845 16957 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16958 * ) case "$sethostent_r_proto" in
16959 REENTRANT_PROTO*) ;;
16960 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16961 esac
16962 echo "Prototype: $try" ;;
16963 esac
16964 ;;
c18e646a
JH
16965 *) case "$usethreads" in
16966 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16967 esac
90e831dc
SB
16968 d_sethostent_r=undef
16969 sethostent_r_proto=0
c18e646a 16970 ;;
a48ec845
JH
16971 esac
16972 ;;
10bc17b6
JH
16973*) sethostent_r_proto=0
16974 ;;
16975esac
16976
4e0554ec
JH
16977: see if setitimer exists
16978set setitimer d_setitimer
16979eval $inlibc
16980
b4eb6b3d
JH
16981: see if setlinebuf exists
16982set setlinebuf d_setlinebuf
16983eval $inlibc
16984
16985: see if setlocale exists
16986set setlocale d_setlocale
16987eval $inlibc
16988
10bc17b6
JH
16989: see if locale.h is available
16990set locale.h i_locale
16991eval $inhdr
16992
16993: see if setlocale_r exists
16994set setlocale_r d_setlocale_r
16995eval $inlibc
16996case "$d_setlocale_r" in
16997"$define")
16998 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16999 case "$d_setlocale_r_proto:$usethreads" in
17000 ":define") d_setlocale_r_proto=define
a48ec845
JH
17001 set d_setlocale_r_proto setlocale_r $hdrs
17002 eval $hasproto ;;
17003 *) ;;
17004 esac
17005 case "$d_setlocale_r_proto" in
17006 define)
10bc17b6
JH
17007 case "$setlocale_r_proto" in
17008 ''|0) try='int setlocale_r(int, const char*, char*, int);'
61c26d18 17009 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
10bc17b6
JH
17010 esac
17011 case "$setlocale_r_proto" in
90e831dc 17012 ''|0) d_setlocale_r=undef
10bc17b6 17013 setlocale_r_proto=0
a48ec845 17014 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17015 * ) case "$setlocale_r_proto" in
17016 REENTRANT_PROTO*) ;;
17017 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17018 esac
17019 echo "Prototype: $try" ;;
17020 esac
17021 ;;
c18e646a
JH
17022 *) case "$usethreads" in
17023 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17024 esac
90e831dc
SB
17025 d_setlocale_r=undef
17026 setlocale_r_proto=0
c18e646a 17027 ;;
a48ec845
JH
17028 esac
17029 ;;
10bc17b6
JH
17030*) setlocale_r_proto=0
17031 ;;
17032esac
17033
b4eb6b3d
JH
17034: see if setnetent exists
17035set setnetent d_setnent
17036eval $inlibc
17037
10bc17b6
JH
17038: see if setnetent_r exists
17039set setnetent_r d_setnetent_r
17040eval $inlibc
17041case "$d_setnetent_r" in
17042"$define")
17043 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17044 case "$d_setnetent_r_proto:$usethreads" in
17045 ":define") d_setnetent_r_proto=define
a48ec845
JH
17046 set d_setnetent_r_proto setnetent_r $hdrs
17047 eval $hasproto ;;
17048 *) ;;
17049 esac
17050 case "$d_setnetent_r_proto" in
17051 define)
10bc17b6
JH
17052 case "$setnetent_r_proto" in
17053 ''|0) try='int setnetent_r(int, struct netent_data*);'
61c26d18 17054 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
10bc17b6
JH
17055 esac
17056 case "$setnetent_r_proto" in
17057 ''|0) try='void setnetent_r(int, struct netent_data*);'
61c26d18 17058 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
10bc17b6
JH
17059 esac
17060 case "$setnetent_r_proto" in
90e831dc 17061 ''|0) d_setnetent_r=undef
10bc17b6 17062 setnetent_r_proto=0
a48ec845 17063 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17064 * ) case "$setnetent_r_proto" in
17065 REENTRANT_PROTO*) ;;
17066 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17067 esac
17068 echo "Prototype: $try" ;;
17069 esac
17070 ;;
c18e646a
JH
17071 *) case "$usethreads" in
17072 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17073 esac
90e831dc
SB
17074 d_setnetent_r=undef
17075 setnetent_r_proto=0
c18e646a 17076 ;;
a48ec845
JH
17077 esac
17078 ;;
10bc17b6
JH
17079*) setnetent_r_proto=0
17080 ;;
17081esac
17082
b4eb6b3d
JH
17083: see if setprotoent exists
17084set setprotoent d_setpent
17085eval $inlibc
17086
17087: see if setpgid exists
17088set setpgid d_setpgid
17089eval $inlibc
17090
17091: see if setpgrp2 exists
17092set setpgrp2 d_setpgrp2
17093eval $inlibc
17094
17095: see if setpriority exists
17096set setpriority d_setprior
17097eval $inlibc
17098
17099: see if setproctitle exists
17100set setproctitle d_setproctitle
17101eval $inlibc
17102
10bc17b6
JH
17103: see if setprotoent_r exists
17104set setprotoent_r d_setprotoent_r
17105eval $inlibc
17106case "$d_setprotoent_r" in
17107"$define")
17108 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17109 case "$d_setprotoent_r_proto:$usethreads" in
17110 ":define") d_setprotoent_r_proto=define
a48ec845
JH
17111 set d_setprotoent_r_proto setprotoent_r $hdrs
17112 eval $hasproto ;;
17113 *) ;;
17114 esac
17115 case "$d_setprotoent_r_proto" in
17116 define)
10bc17b6
JH
17117 case "$setprotoent_r_proto" in
17118 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
61c26d18 17119 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
10bc17b6
JH
17120 esac
17121 case "$setprotoent_r_proto" in
17122 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
61c26d18 17123 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
10bc17b6
JH
17124 esac
17125 case "$setprotoent_r_proto" in
90e831dc 17126 ''|0) d_setprotoent_r=undef
10bc17b6 17127 setprotoent_r_proto=0
a48ec845 17128 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17129 * ) case "$setprotoent_r_proto" in
17130 REENTRANT_PROTO*) ;;
17131 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17132 esac
17133 echo "Prototype: $try" ;;
17134 esac
17135 ;;
c18e646a
JH
17136 *) case "$usethreads" in
17137 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17138 esac
90e831dc
SB
17139 d_setprotoent_r=undef
17140 setprotoent_r_proto=0
c18e646a 17141 ;;
a48ec845
JH
17142 esac
17143 ;;
10bc17b6
JH
17144*) setprotoent_r_proto=0
17145 ;;
17146esac
17147
b4eb6b3d
JH
17148: see if setpwent exists
17149set setpwent d_setpwent
17150eval $inlibc
17151
10bc17b6
JH
17152: see if setpwent_r exists
17153set setpwent_r d_setpwent_r
17154eval $inlibc
17155case "$d_setpwent_r" in
17156"$define")
17157 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
17158 case "$d_setpwent_r_proto:$usethreads" in
17159 ":define") d_setpwent_r_proto=define
a48ec845
JH
17160 set d_setpwent_r_proto setpwent_r $hdrs
17161 eval $hasproto ;;
17162 *) ;;
17163 esac
17164 case "$d_setpwent_r_proto" in
17165 define)
10bc17b6
JH
17166 case "$setpwent_r_proto" in
17167 ''|0) try='int setpwent_r(FILE**);'
61c26d18 17168 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
10bc17b6
JH
17169 esac
17170 case "$setpwent_r_proto" in
17171 ''|0) try='void setpwent_r(FILE**);'
61c26d18 17172 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
10bc17b6
JH
17173 esac
17174 case "$setpwent_r_proto" in
90e831dc 17175 ''|0) d_setpwent_r=undef
10bc17b6 17176 setpwent_r_proto=0
a48ec845 17177 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17178 * ) case "$setpwent_r_proto" in
17179 REENTRANT_PROTO*) ;;
17180 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17181 esac
17182 echo "Prototype: $try" ;;
17183 esac
17184 ;;
c18e646a
JH
17185 *) case "$usethreads" in
17186 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17187 esac
90e831dc
SB
17188 d_setpwent_r=undef
17189 setpwent_r_proto=0
c18e646a 17190 ;;
a48ec845
JH
17191 esac
17192 ;;
10bc17b6
JH
17193*) setpwent_r_proto=0
17194 ;;
17195esac
17196
b4eb6b3d
JH
17197: see if setregid exists
17198set setregid d_setregid
17199eval $inlibc
17200set setresgid d_setresgid
17201eval $inlibc
17202
17203: see if setreuid exists
17204set setreuid d_setreuid
17205eval $inlibc
17206set setresuid d_setresuid
17207eval $inlibc
17208
17209: see if setrgid exists
17210set setrgid d_setrgid
17211eval $inlibc
17212
17213: see if setruid exists
17214set setruid d_setruid
17215eval $inlibc
17216
17217: see if setservent exists
17218set setservent d_setsent
17219eval $inlibc
17220
10bc17b6
JH
17221: see if setservent_r exists
17222set setservent_r d_setservent_r
17223eval $inlibc
17224case "$d_setservent_r" in
17225"$define")
17226 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17227 case "$d_setservent_r_proto:$usethreads" in
17228 ":define") d_setservent_r_proto=define
a48ec845
JH
17229 set d_setservent_r_proto setservent_r $hdrs
17230 eval $hasproto ;;
17231 *) ;;
17232 esac
17233 case "$d_setservent_r_proto" in
17234 define)
10bc17b6
JH
17235 case "$setservent_r_proto" in
17236 ''|0) try='int setservent_r(int, struct servent_data*);'
61c26d18 17237 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
10bc17b6
JH
17238 esac
17239 case "$setservent_r_proto" in
17240 ''|0) try='void setservent_r(int, struct servent_data*);'
61c26d18 17241 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
10bc17b6
JH
17242 esac
17243 case "$setservent_r_proto" in
90e831dc 17244 ''|0) d_setservent_r=undef
10bc17b6 17245 setservent_r_proto=0
a48ec845 17246 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17247 * ) case "$setservent_r_proto" in
17248 REENTRANT_PROTO*) ;;
17249 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17250 esac
17251 echo "Prototype: $try" ;;
17252 esac
17253 ;;
c18e646a
JH
17254 *) case "$usethreads" in
17255 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17256 esac
90e831dc
SB
17257 d_setservent_r=undef
17258 setservent_r_proto=0
c18e646a 17259 ;;
a48ec845
JH
17260 esac
17261 ;;
10bc17b6
JH
17262*) setservent_r_proto=0
17263 ;;
17264esac
17265
b4eb6b3d
JH
17266: see if setsid exists
17267set setsid d_setsid
17268eval $inlibc
17269
17270: see if setvbuf exists
17271set setvbuf d_setvbuf
17272eval $inlibc
17273
17274: see if sfio.h is available
17275set sfio.h i_sfio
17276eval $inhdr
17277
b4eb6b3d
JH
17278: see if sfio library is available
17279case "$i_sfio" in
17280$define)
17281 val=''
17282 set sfreserve val
17283 eval $inlibc
17284 ;;
17285*)
17286 val="$undef"
17287 ;;
17288esac
17289: Ok, but do we want to use it.
17290case "$val" in
17291$define)
17292 case "$usesfio" in
17293 true|$define|[yY]*) dflt='y';;
17294 *) dflt='n';;
17295 esac
17296 echo "$package can use the sfio library, but it is experimental."
b4eb6b3d
JH
17297 rp="You seem to have sfio available, do you want to try using it?"
17298 . ./myread
17299 case "$ans" in
dd35fa16 17300 y|Y) echo "Ok, turning on sfio then."
b4eb6b3d
JH
17301 val="$define"
17302 ;;
17303 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
17304 val="$undef"
b4eb6b3d
JH
17305 ;;
17306 esac
17307 ;;
17308*) case "$usesfio" in
17309 true|$define|[yY]*)
17310 echo "Sorry, cannot find sfio on this machine." >&4
17311 echo "Ignoring your setting of usesfio=$usesfio." >&4
17312 val="$undef"
17313 ;;
17314 esac
17315 ;;
17316esac
17317set d_sfio
17318eval $setvar
17319case "$d_sfio" in
17320$define) usesfio='true';;
17321*) usesfio='false';;
17322esac
3659ebf1
JH
17323case "$d_sfio" in
17324$define) ;;
17325*) : Remove sfio from list of libraries to use
7483f793
JH
17326 case "$libs" in
17327 *-lsfio*)
17328 echo "Removing unneeded -lsfio from library list" >&4
17329 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17330 shift
17331 libs="$*"
17332 echo "libs = $libs" >&4
17333 ;;
17334 esac
3659ebf1
JH
17335;;
17336esac
17337
b4eb6b3d
JH
17338
17339: see if shmctl exists
17340set shmctl d_shmctl
17341eval $inlibc
17342
17343: see if shmget exists
17344set shmget d_shmget
17345eval $inlibc
17346
17347: see if shmat exists
17348set shmat d_shmat
17349eval $inlibc
17350: see what shmat returns
17351case "$d_shmat" in
17352"$define")
17353 $cat >shmat.c <<'END'
17354#include <sys/shm.h>
17355void *shmat();
17356END
17357 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17358 shmattype='void *'
17359 else
17360 shmattype='char *'
17361 fi
17362 echo "and it returns ($shmattype)." >&4
17363 : see if a prototype for shmat is available
17364 xxx=`./findhdr sys/shm.h`
17365 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17366 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17367 val="$define"
17368 else
17369 val="$undef"
17370 fi
17371 $rm -f shmat.[co]
17372 ;;
17373*)
17374 val="$undef"
17375 ;;
17376esac
17377set d_shmatprototype
17378eval $setvar
17379
17380: see if shmdt exists
17381set shmdt d_shmdt
17382eval $inlibc
17383
17384: see how much of the 'shm*(2)' library is present.
17385h_shm=true
17386echo " "
17387case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17388*"$undef"*) h_shm=false;;
17389esac
17390case "$osname" in
17391freebsd)
17392 case "`ipcs 2>&1`" in
17393 "SVID shared memory"*"not configured"*)
17394 echo "Your $osname does not have the shm*(2) configured." >&4
17395 h_shm=false
17396 val="$undef"
17397 set shmctl d_shmctl
17398 evat $setvar
17399 set shmget d_shmget
17400 evat $setvar
17401 set shmat d_shmat
17402 evat $setvar
17403 set shmdt d_shmdt
17404 evat $setvar
17405 ;;
17406 esac
17407 ;;
17408esac
17409: we could also check for sys/ipc.h ...
17410if $h_shm && $test `./findhdr sys/shm.h`; then
17411 echo "You have the full shm*(2) library." >&4
17412 val="$define"
17413else
17414 echo "You don't have the full shm*(2) library." >&4
17415 val="$undef"
17416fi
17417set d_shm
17418eval $setvar
17419
b4eb6b3d 17420: see if we have sigaction
613d6c3e 17421echo " "
b4eb6b3d
JH
17422if set sigaction val -f d_sigaction; eval $csym; $val; then
17423 echo 'sigaction() found.' >&4
073b6de5 17424 $cat > try.c <<EOP
b4eb6b3d
JH
17425#include <stdio.h>
17426#include <sys/types.h>
17427#include <signal.h>
073b6de5
JH
17428#$i_stdlib I_STDLIB
17429#ifdef I_STDLIB
17430#include <stdlib.h>
17431#endif
b4eb6b3d
JH
17432int main()
17433{
17434 struct sigaction act, oact;
17435 act.sa_flags = 0;
17436 oact.sa_handler = 0;
17437 /* so that act and oact are used */
17438 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17439}
17440EOP
17441 set try
17442 if eval $compile_ok; then
17443 val="$define"
17444 else
17445 echo "But you don't seem to have a useable struct sigaction." >&4
17446 val="$undef"
17447 fi
17448else
17449 echo 'sigaction NOT found.' >&4
17450 val="$undef"
17451fi
17452set d_sigaction; eval $setvar
5b813a60 17453$rm_try
b4eb6b3d 17454
ed140128
AD
17455: see if this is a sunmath.h system
17456set sunmath.h i_sunmath
17457eval $inhdr
17458
17459: see if signbit exists
17460$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17461$cat >try.c <<EOCP
17462#$i_math I_MATH
17463#$i_sunmath I_SUNMATH
17464#ifdef I_MATH
17465# include <math.h>
17466#endif
17467#ifdef I_SUNMATH /* Solaris special math library */
17468# include <sunmath.h>
17469#endif
17470#define NV $nvtype
17471int main(int argc, char **argv)
17472{
17473 NV x = 0.0;
17474 NV y = -0.0;
17475 if ((signbit(x) == 0) && (signbit(y) != 0))
17476 return 0;
17477 else
17478 return 1;
17479}
17480EOCP
17481val="$undef"
17482set try
17483if eval $compile; then
17484 if $run ./try; then
17485 $echo "Yes." >&4
17486 val="$define"
17487 else
17488 $echo "Signbit seems to be available, but doesn't work as I expected."
17489 $echo "I won't use it." >&4
17490 val="$undef"
17491 fi
17492else
17493 $echo "Nope." >&4
17494 dflt="$undef"
17495fi
17496set d_signbit
17497eval $setvar
5b813a60 17498$rm_try
ed140128 17499
983dbef6
JH
17500: see if sigprocmask exists
17501set sigprocmask d_sigprocmask
17502eval $inlibc
17503
b4eb6b3d
JH
17504: see if sigsetjmp exists
17505echo " "
17506case "$d_sigsetjmp" in
17507'')
c727eafa 17508 $cat >try.c <<EOP
b4eb6b3d 17509#include <setjmp.h>
d1daaddf
JH
17510#$i_stdlib I_STDLIB
17511#ifdef I_STDLIB
17512#include <stdlib.h>
17513#endif
b4eb6b3d
JH
17514sigjmp_buf env;
17515int set = 1;
17516int main()
17517{
17518 if (sigsetjmp(env,1))
17519 exit(set);
17520 set = 0;
17521 siglongjmp(env, 1);
17522 exit(1);
17523}
17524EOP
17525 set try
17526 if eval $compile; then
5440bc8e 17527 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17528 echo "POSIX sigsetjmp found." >&4
17529 val="$define"
17530 else
17531 $cat >&4 <<EOM
17532Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17533I'll ignore them.
17534EOM
17535 val="$undef"
17536 fi
17537 else
17538 echo "sigsetjmp not found." >&4
17539 val="$undef"
17540 fi
17541 ;;
17542*) val="$d_sigsetjmp"
17543 case "$d_sigsetjmp" in
17544 $define) echo "POSIX sigsetjmp found." >&4;;
17545 $undef) echo "sigsetjmp not found." >&4;;
17546 esac
17547 ;;
17548esac
17549set d_sigsetjmp
17550eval $setvar
5b813a60 17551$rm_try
b4eb6b3d 17552
4f5da3e9
SP
17553: see if snprintf exists
17554set snprintf d_snprintf
17555eval $inlibc
17556
17557: see if vsnprintf exists
17558set vsnprintf d_vsnprintf
17559eval $inlibc
17560
2478f7a0
MB
17561case "$d_snprintf-$d_vsnprintf" in
17562"$define-$define")
17563 $cat <<EOM
17564Checking whether your snprintf() and vsnprintf() work okay...
17565EOM
17566 $cat >try.c <<'EOCP'
17567/* v?snprintf testing logic courtesy of Russ Allbery.
17568 * According to C99:
17569 * - if the buffer is too short it still must be \0-terminated
17570 * - if the buffer is too short the potentially required length
17571 * must be returned and not -1
17572 * - if the buffer is NULL the potentially required length
17573 * must be returned and not -1 or core dump
17574 */
17575#include <stdio.h>
17576#include <stdarg.h>
17577
17578char buf[2];
17579
17580int test (char *format, ...)
17581{
17582 va_list args;
17583 int count;
17584
17585 va_start (args, format);
17586 count = vsnprintf (buf, sizeof buf, format, args);
17587 va_end (args);
17588 return count;
17589}
17590
17591int main ()
17592{
17593 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17594 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17595}
17596EOCP
17597 set try
17598 if eval $compile; then
17599 `$run ./try`
17600 case "$?" in
17601 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17602 *) cat <<EOM >&4
17603Your snprintf() and snprintf() don't seem to be working okay.
17604EOM
17605 d_snprintf="$undef"
17606 d_vsnprintf="$undef"
17607 ;;
17608 esac
17609 else
17610 echo "(I can't seem to compile the test program--assuming they don't)"
17611 d_snprintf="$undef"
17612 d_vsnprintf="$undef"
17613 fi
5b813a60 17614 $rm_try
2478f7a0
MB
17615 ;;
17616esac
17617
49a78c82
JH
17618: see if sockatmark exists
17619set sockatmark d_sockatmark
17620eval $inlibc
17621
2ef53570
JH
17622: see if prototype for sockatmark is available
17623echo " "
17624set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17625eval $hasproto
17626
b4eb6b3d
JH
17627: see if socks5_init exists
17628set socks5_init d_socks5_init
17629eval $inlibc
17630
360321b3
YST
17631: see if sprintf returns the length of the string in the buffer as per ANSI
17632$echo "Checking whether sprintf returns the length of the string..." >&4
17633$cat <<EOP >try.c
17634#include <stdio.h>
17635#$i_stdlib I_STDLIB
17636#ifdef I_STDLIB
17637#include <stdlib.h>
17638#endif
17639#$i_string I_STRING
17640#ifdef I_STRING
17641# include <string.h>
17642#else
17643# include <strings.h>
17644#endif
17645#$i_math I_MATH
17646#ifdef I_MATH
17647#include <math.h>
17648#endif
17649
17650char buffer[256];
17651
17652int check (size_t expect, int test) {
17653 size_t got = strlen(buffer);
17654 if (expect == got)
17655 return 0;
17656
17657 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17658 test, buffer);
17659 exit (test);
17660}
17661
17662int main(int argc, char **argv) {
17663 int test = 0;
17664
17665 check(sprintf(buffer, ""), ++test);
17666 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17667 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17668
17669 return 0;
17670}
17671EOP
17672set try
17673
360321b3
YST
17674if eval $compile; then
17675 xxx="`$run ./try`"
17676 case "$?" in
17677 0) cat >&4 <<EOM
17678sprintf returns the length of the string (as ANSI says it should)
17679EOM
17680 d_sprintf_returns_strlen="$define"
17681 ;;
17682 *) cat >&4 <<EOM
17683sprintf does not return the length of the string (how old is this system?)
17684EOM
17685 d_sprintf_returns_strlen="$undef"
17686 ;;
17687 esac
d2821e72 17688else
36a30365
JH
17689 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17690 d_sprintf_returns_strlen="$undef"
360321b3 17691fi
5b813a60 17692$rm_try
360321b3 17693
10bc17b6
JH
17694: see if srand48_r exists
17695set srand48_r d_srand48_r
17696eval $inlibc
17697case "$d_srand48_r" in
17698"$define")
17699 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17700 case "$d_srand48_r_proto:$usethreads" in
17701 ":define") d_srand48_r_proto=define
a48ec845
JH
17702 set d_srand48_r_proto srand48_r $hdrs
17703 eval $hasproto ;;
17704 *) ;;
17705 esac
17706 case "$d_srand48_r_proto" in
17707 define)
10bc17b6
JH
17708 case "$srand48_r_proto" in
17709 ''|0) try='int srand48_r(long, struct drand48_data*);'
61c26d18 17710 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
10bc17b6
JH
17711 esac
17712 case "$srand48_r_proto" in
90e831dc 17713 ''|0) d_srand48_r=undef
10bc17b6 17714 srand48_r_proto=0
a48ec845 17715 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17716 * ) case "$srand48_r_proto" in
17717 REENTRANT_PROTO*) ;;
17718 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17719 esac
17720 echo "Prototype: $try" ;;
17721 esac
17722 ;;
c18e646a
JH
17723 *) case "$usethreads" in
17724 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17725 esac
90e831dc
SB
17726 d_srand48_r=undef
17727 srand48_r_proto=0
c18e646a 17728 ;;
a48ec845
JH
17729 esac
17730 ;;
10bc17b6
JH
17731*) srand48_r_proto=0
17732 ;;
17733esac
17734
17735: see if srandom_r exists
17736set srandom_r d_srandom_r
17737eval $inlibc
17738case "$d_srandom_r" in
17739"$define")
17740 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17741 case "$d_srandom_r_proto:$usethreads" in
17742 ":define") d_srandom_r_proto=define
a48ec845
JH
17743 set d_srandom_r_proto srandom_r $hdrs
17744 eval $hasproto ;;
17745 *) ;;
17746 esac
17747 case "$d_srandom_r_proto" in
17748 define)
10bc17b6
JH
17749 case "$srandom_r_proto" in
17750 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
61c26d18 17751 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
10bc17b6
JH
17752 esac
17753 case "$srandom_r_proto" in
90e831dc 17754 ''|0) d_srandom_r=undef
10bc17b6 17755 srandom_r_proto=0
a48ec845 17756 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17757 * ) case "$srandom_r_proto" in
17758 REENTRANT_PROTO*) ;;
17759 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17760 esac
17761 echo "Prototype: $try" ;;
17762 esac
17763 ;;
c18e646a
JH
17764 *) case "$usethreads" in
17765 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17766 esac
90e831dc
SB
17767 d_srandom_r=undef
17768 srandom_r_proto=0
c18e646a 17769 ;;
a48ec845
JH
17770 esac
17771 ;;
10bc17b6
JH
17772*) srandom_r_proto=0
17773 ;;
17774esac
17775
eef837ea
JH
17776: see if prototype for setresgid is available
17777echo " "
17778set d_sresgproto setresgid $i_unistd unistd.h
17779eval $hasproto
17780
640374d0
JH
17781: see if prototype for setresuid is available
17782echo " "
17783set d_sresuproto setresuid $i_unistd unistd.h
17784eval $hasproto
17785
b4eb6b3d
JH
17786: see if sys/stat.h is available
17787set sys/stat.h i_sysstat
17788eval $inhdr
17789
b4eb6b3d
JH
17790: see if stat knows about block sizes
17791echo " "
17792echo "Checking to see if your struct stat has st_blocks field..." >&4
17793set d_statblks stat st_blocks $i_sysstat sys/stat.h
17794eval $hasfield
17795
b4eb6b3d
JH
17796: see if this is a sys/vfs.h system
17797set sys/vfs.h i_sysvfs
17798eval $inhdr
17799
b4eb6b3d
JH
17800: see if this is a sys/statfs.h system
17801set sys/statfs.h i_sysstatfs
17802eval $inhdr
17803
34f1896b 17804: Check for statfs_s
b4eb6b3d
JH
17805echo " "
17806echo "Checking to see if your system supports struct statfs..." >&4
17807set 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
17808eval $hasstruct
17809case "$d_statfs_s" in
17810"$define") echo "Yes, it does." ;;
17811*) echo "No, it doesn't." ;;
17812esac
17813
17814
b4eb6b3d
JH
17815: see if struct statfs knows about f_flags
17816case "$d_statfs_s" in
34f1896b 17817define)
b4eb6b3d
JH
17818 echo " "
17819 echo "Checking to see if your struct statfs has f_flags field..." >&4
17820 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
17821 eval $hasfield
17822 ;;
17823*) val="$undef"
17824 set d_statfs_f_flags
17825 eval $setvar
17826 ;;
17827esac
17828case "$d_statfs_f_flags" in
17829"$define") echo "Yes, it does." ;;
17830*) echo "No, it doesn't." ;;
17831esac
17832
17a6c8e3
AD
17833: see what flavor, if any, of static inline is supported
17834echo " "
17835echo "Checking to see if your system supports static inline..."
17836$cat > try.c <<'EOCP'
17837#include <stdlib.h>
17838extern int f_via_a(int x);
17839extern int f_via_b(int x);
17840int main(int argc, char **argv)
17841{
17842 int y;
17843
17844 y = f_via_a(0);
17845#ifdef USE_B
17846 y = f_via_b(0);
17847#endif
17848 if (y == 42) {
17849 return EXIT_SUCCESS;
17850 }
17851 else {
17852 return EXIT_FAILURE;
17853 }
17854}
17855EOCP
17856$cat > a.c <<'EOCP'
17857static INLINE int f(int x) {
17858 int y;
17859 y = x + 42;
17860 return y;
17861}
17862
17863int f_via_a(int x)
17864{
17865 return f(x);
17866}
17867EOCP
17868$cat > b.c <<'EOCP'
17869extern int f(int x);
17870
17871int f_via_b(int x)
17872{
17873 return f(x);
17874}
17875EOCP
17876
17877# Respect a hint (or previous) value for perl_static_inline, if there is one.
17878case "$perl_static_inline" in
17879'') # Check the various possibilities, and break out on success.
17880 # For gcc, prefer __inline__, which will still permit
17881 # cflags.SH to add in -ansi.
17882 case "$gccversion" in
17883 '') xxx="inline __inline__ __inline _inline";;
17884 *) xxx="__inline__ inline __inline _inline";;
17885 esac
17886 for inline in $xxx; do
17887 set try -DINLINE=$inline a.c
17888 if eval $compile && $run ./try; then
17889 # Now make sure there is no external linkage of static
17890 # functions
17891 set try -DINLINE=$inline -DUSE_B a.c b.c
17892 if eval $compile && $run ./try; then
17893 $echo "Your compiler supports static $inline, " >&4
17894 $echo "but it also creates an external definition," >&4
17895 $echo "so I won't use it." >&4
17896 val=$undef
17897 else
17898 $echo "Your compiler supports static $inline." >&4
17899 val=$define
17900 perl_static_inline="static $inline";
17901 break;
17902 fi
17903 else
17904 $echo "Your compiler does NOT support static $inline." >&4
17905 val="$undef"
17906 fi
17907 done
17908 ;;
17909*inline*) # Some variant of inline exists.
17910 echo "Keeping your $hint value of $perl_static_inline."
17911 val=$define
17912 ;;
17913static) # No inline capabilities
17914 echo "Keeping your $hint value of $perl_static_inline."
17915 val=$undef
17916 ;;
17917*) # Unrecognized previous value -- blindly trust the supplied
17918 # value and hope it makes sense. Use old value for
17919 # d_static_inline, if there is one.
17920 echo "Keeping your $hint value of $perl_static_inline."
17921 case "$d_static_inline" in
17922 '') val=$define ;;
17923 *) val=$d_static_inline ;;
17924 esac
17925 ;;
17926esac
17927# Fallback to plain 'static' if nothing worked.
17928case "$perl_static_inline" in
17929'')
17930 perl_static_inline="static"
17931 val=$undef
17932 ;;
17933esac
17934set d_static_inline
17935eval $setvar
17936$rm -f a.[co] b.[co]
17937$rm_try
17938
613d6c3e 17939: Check stream access
b4eb6b3d
JH
17940$cat >&4 <<EOM
17941Checking how to access stdio streams by file descriptor number...
17942EOM
17943case "$stdio_stream_array" in
17944'') $cat >try.c <<EOCP
17945#include <stdio.h>
17946int main() {
17947 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17948 printf("yes\n");
17949}
17950EOCP
17951 for s in _iob __iob __sF
17952 do
17953 set try -DSTDIO_STREAM_ARRAY=$s
17954 if eval $compile; then
5440bc8e 17955 case "`$run ./try`" in
b4eb6b3d
JH
17956 yes) stdio_stream_array=$s; break ;;
17957 esac
17958 fi
17959 done
5b813a60 17960 $rm_try
b4eb6b3d
JH
17961esac
17962case "$stdio_stream_array" in
17963'') $cat >&4 <<EOM
17964I can't figure out how to access stdio streams by file descriptor number.
17965EOM
17966 d_stdio_stream_array="$undef"
17967 ;;
17968*) $cat >&4 <<EOM
17969You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17970EOM
17971 d_stdio_stream_array="$define"
17972 ;;
17973esac
17974
17975: see if strcoll exists
17976set strcoll d_strcoll
17977eval $inlibc
17978
17979: check for structure copying
17980echo " "
17981echo "Checking to see if your C compiler can copy structs..." >&4
17982$cat >try.c <<'EOCP'
76f47787 17983int main()
b4eb6b3d
JH
17984{
17985 struct blurfl {
17986 int dyick;
17987 } foo, bar;
17988
17989 foo = bar;
17990}
17991EOCP
17992if $cc -c try.c >/dev/null 2>&1 ; then
17993 val="$define"
17994 echo "Yup, it can."
17995else
17996 val="$undef"
17997 echo "Nope, it can't."
17998fi
17999set d_strctcpy
18000eval $setvar
5b813a60 18001$rm_try
b4eb6b3d
JH
18002
18003: see if strerror and/or sys_errlist[] exist
18004echo " "
18005if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18006 if set strerror val -f d_strerror; eval $csym; $val; then
18007 echo 'strerror() found.' >&4
18008 d_strerror="$define"
18009 d_strerrm='strerror(e)'
18010 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18011 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18012 d_syserrlst="$define"
18013 else
18014 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18015 d_syserrlst="$undef"
18016 fi
18017 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18018 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18019 echo 'strerror() found in string header.' >&4
18020 d_strerror="$define"
18021 d_strerrm='strerror(e)'
18022 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18023 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18024 d_syserrlst="$define"
18025 else
18026 echo "(You don't appear to have any sys_errlist[], how can this be?)"
18027 d_syserrlst="$undef"
18028 fi
18029 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18030 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18031 d_strerror="$undef"
18032 d_syserrlst="$define"
18033 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18034 else
18035 echo 'strerror() and sys_errlist[] NOT found.' >&4
18036 d_strerror="$undef"
18037 d_syserrlst="$undef"
18038 d_strerrm='"unknown"'
18039 fi
18040fi
18041
10bc17b6
JH
18042: see if strerror_r exists
18043set strerror_r d_strerror_r
18044eval $inlibc
18045case "$d_strerror_r" in
18046"$define")
18047 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
18048 case "$d_strerror_r_proto:$usethreads" in
18049 ":define") d_strerror_r_proto=define
a48ec845
JH
18050 set d_strerror_r_proto strerror_r $hdrs
18051 eval $hasproto ;;
18052 *) ;;
18053 esac
18054 case "$d_strerror_r_proto" in
18055 define)
10bc17b6
JH
18056 case "$strerror_r_proto" in
18057 ''|0) try='int strerror_r(int, char*, size_t);'
61c26d18 18058 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
10bc17b6
JH
18059 esac
18060 case "$strerror_r_proto" in
18061 ''|0) try='int strerror_r(int, char*, int);'
61c26d18 18062 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
10bc17b6
JH
18063 esac
18064 case "$strerror_r_proto" in
18065 ''|0) try='char* strerror_r(int, char*, size_t);'
61c26d18 18066 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
10bc17b6
JH
18067 esac
18068 case "$strerror_r_proto" in
90e831dc 18069 ''|0) d_strerror_r=undef
10bc17b6 18070 strerror_r_proto=0
a48ec845 18071 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18072 * ) case "$strerror_r_proto" in
18073 REENTRANT_PROTO*) ;;
18074 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18075 esac
18076 echo "Prototype: $try" ;;
18077 esac
18078 ;;
c18e646a
JH
18079 *) case "$usethreads" in
18080 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18081 esac
90e831dc
SB
18082 d_strerror_r=undef
18083 strerror_r_proto=0
c18e646a 18084 ;;
a48ec845
JH
18085 esac
18086 ;;
10bc17b6
JH
18087*) strerror_r_proto=0
18088 ;;
18089esac
18090
b3c85772
JH
18091: see if strftime exists
18092set strftime d_strftime
18093eval $inlibc
18094
08c92000
MB
18095: see if strlcat exists
18096set strlcat d_strlcat
18097eval $inlibc
18098
18099: see if strlcpy exists
18100set strlcpy d_strlcpy
18101eval $inlibc
18102
b4eb6b3d
JH
18103: see if strtod exists
18104set strtod d_strtod
18105eval $inlibc
18106
18107: see if strtol exists
18108set strtol d_strtol
18109eval $inlibc
18110
18111: see if strtold exists
18112set strtold d_strtold
18113eval $inlibc
18114
18115: see if strtoll exists
18116set strtoll d_strtoll
18117eval $inlibc
18118
18119case "$d_longlong-$d_strtoll" in
18120"$define-$define")
18121 $cat <<EOM
18122Checking whether your strtoll() works okay...
18123EOM
18124 $cat >try.c <<'EOCP'
18125#include <errno.h>
18126#ifdef __hpux
18127#define strtoll __strtoll
18128#endif
e75931a7
YST
18129#ifdef __EMX__
18130#define strtoll _strtoll
18131#endif
b4eb6b3d 18132#include <stdio.h>
613d6c3e 18133extern long long int strtoll(char *s, char **, int);
b4eb6b3d
JH
18134static int bad = 0;
18135int check(char *s, long long ell, int een) {
18136 long long gll;
18137 errno = 0;
18138 gll = strtoll(s, 0, 10);
18139 if (!((gll == ell) && (errno == een)))
18140 bad++;
18141}
18142int main() {
18143 check(" 1", 1LL, 0);
18144 check(" 0", 0LL, 0);
18145 check("-1", -1LL, 0);
18146 check("-9223372036854775808", -9223372036854775808LL, 0);
18147 check("-9223372036854775808", -9223372036854775808LL, 0);
18148 check(" 9223372036854775807", 9223372036854775807LL, 0);
18149 check("-9223372036854775808", -9223372036854775808LL, 0);
18150 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
18151 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18152 if (!bad)
18153 printf("ok\n");
18154}
18155EOCP
18156 set try
18157 if eval $compile; then
5440bc8e 18158 yyy=`$run ./try`
e75931a7 18159 case "$yyy" in
b4eb6b3d
JH
18160 ok) echo "Your strtoll() seems to be working okay." ;;
18161 *) cat <<EOM >&4
18162Your strtoll() doesn't seem to be working okay.
18163EOM
18164 d_strtoll="$undef"
18165 ;;
69eadf66 18166 esac
e75931a7
YST
18167 else
18168 echo "(I can't seem to compile the test program--assuming it doesn't)"
18169 d_strtoll="$undef"
b4eb6b3d
JH
18170 fi
18171 ;;
18172esac
18173
28e5dec8
JH
18174: see if strtoq exists
18175set strtoq d_strtoq
18176eval $inlibc
18177
b4eb6b3d
JH
18178: see if strtoul exists
18179set strtoul d_strtoul
18180eval $inlibc
18181
d0e6d399
NC
18182case "$d_strtoul" in
18183"$define")
18184 $cat <<EOM
18185Checking whether your strtoul() works okay...
18186EOM
18187 $cat >try.c <<'EOCP'
18188#include <errno.h>
18189#include <stdio.h>
613d6c3e 18190extern unsigned long int strtoul(char *s, char **, int);
d0e6d399
NC
18191static int bad = 0;
18192void check(char *s, unsigned long eul, int een) {
18193 unsigned long gul;
18194 errno = 0;
18195 gul = strtoul(s, 0, 10);
18196 if (!((gul == eul) && (errno == een)))
18197 bad++;
18198}
18199int main() {
18200 check(" 1", 1L, 0);
18201 check(" 0", 0L, 0);
18202EOCP
18203 case "$longsize" in
18204 8)
18205 $cat >>try.c <<'EOCP'
09c0d2c4
JH
18206 check("18446744073709551615", 18446744073709551615UL, 0);
18207 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 18208#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 18209 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
18210 check("-18446744073709551614", 2, 0);
18211 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
18212 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18213 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 18214#endif
d0e6d399
NC
18215EOCP
18216 ;;
18217 4)
18218 $cat >>try.c <<'EOCP'
18219 check("4294967295", 4294967295UL, 0);
18220 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 18221#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
18222 check("-1", 4294967295UL, 0);
18223 check("-4294967294", 2, 0);
18224 check("-4294967295", 1, 0);
18225 check("-4294967296", 4294967295UL, ERANGE);
18226 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 18227#endif
d0e6d399
NC
18228EOCP
18229 ;;
18230 *)
18231: Should we write these tests to be more portable by sprintf-ing
18232: ~0 and then manipulating that char string as input for strtol?
18233 ;;
18234 esac
18235 $cat >>try.c <<'EOCP'
18236 if (!bad)
18237 printf("ok\n");
18238 return 0;
18239}
18240EOCP
18241 set try
18242 if eval $compile; then
5440bc8e 18243 case "`$run ./try`" in
d0e6d399
NC
18244 ok) echo "Your strtoul() seems to be working okay." ;;
18245 *) cat <<EOM >&4
18246Your strtoul() doesn't seem to be working okay.
18247EOM
18248 d_strtoul="$undef"
18249 ;;
18250 esac
9597a80f
NC
18251 else
18252 echo "(I can't seem to compile the test program--assuming it doesn't)"
18253 d_strtoul="$undef"
d0e6d399
NC
18254 fi
18255 ;;
18256esac
18257
b4eb6b3d
JH
18258: see if strtoull exists
18259set strtoull d_strtoull
18260eval $inlibc
18261
18262case "$d_longlong-$d_strtoull" in
18263"$define-$define")
18264 $cat <<EOM
18265Checking whether your strtoull() works okay...
18266EOM
18267 $cat >try.c <<'EOCP'
18268#include <errno.h>
18269#ifdef __hpux
18270#define strtoull __strtoull
18271#endif
18272#include <stdio.h>
613d6c3e 18273extern unsigned long long int strtoull(char *s, char **, int);
b4eb6b3d
JH
18274static int bad = 0;
18275int check(char *s, long long eull, int een) {
18276 long long gull;
18277 errno = 0;
18278 gull = strtoull(s, 0, 10);
18279 if (!((gull == eull) && (errno == een)))
18280 bad++;
18281}
18282int main() {
d0e6d399
NC
18283 check(" 1", 1LL, 0);
18284 check(" 0", 0LL, 0);
18285 check("18446744073709551615", 18446744073709551615ULL, 0);
18286 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18287#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
18288 check("-1", 18446744073709551615ULL, 0);
18289 check("-18446744073709551614", 2LL, 0);
18290 check("-18446744073709551615", 1LL, 0);
18291 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18292 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18293#endif
b4eb6b3d
JH
18294 if (!bad)
18295 printf("ok\n");
18296}
18297EOCP
18298 set try
18299 if eval $compile; then
5440bc8e 18300 case "`$run ./try`" in
b4eb6b3d
JH
18301 ok) echo "Your strtoull() seems to be working okay." ;;
18302 *) cat <<EOM >&4
18303Your strtoull() doesn't seem to be working okay.
18304EOM
18305 d_strtoull="$undef"
18306 ;;
18307 esac
9597a80f
NC
18308 else
18309 echo "(I can't seem to compile the test program--assuming it doesn't)"
18310 d_strtoull="$undef"
b4eb6b3d
JH
18311 fi
18312 ;;
18313esac
18314
18315: see if strtouq exists
18316set strtouq d_strtouq
18317eval $inlibc
18318
d0e6d399
NC
18319case "$d_strtouq" in
18320"$define")
18321 $cat <<EOM
18322Checking whether your strtouq() works okay...
18323EOM
18324 $cat >try.c <<'EOCP'
18325#include <errno.h>
18326#include <stdio.h>
613d6c3e 18327extern unsigned long long int strtouq(char *s, char **, int);
d0e6d399
NC
18328static int bad = 0;
18329void check(char *s, unsigned long long eull, int een) {
18330 unsigned long long gull;
18331 errno = 0;
18332 gull = strtouq(s, 0, 10);
18333 if (!((gull == eull) && (errno == een)))
18334 bad++;
18335}
18336int main() {
18337 check(" 1", 1LL, 0);
18338 check(" 0", 0LL, 0);
18339 check("18446744073709551615", 18446744073709551615ULL, 0);
18340 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18341#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
18342 check("-1", 18446744073709551615ULL, 0);
18343 check("-18446744073709551614", 2LL, 0);
18344 check("-18446744073709551615", 1LL, 0);
18345 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18346 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18347#endif
d0e6d399
NC
18348 if (!bad)
18349 printf("ok\n");
18350 return 0;
18351}
18352EOCP
18353 set try
18354 if eval $compile; then
5440bc8e 18355 case "`$run ./try`" in
d0e6d399
NC
18356 ok) echo "Your strtouq() seems to be working okay." ;;
18357 *) cat <<EOM >&4
18358Your strtouq() doesn't seem to be working okay.
18359EOM
18360 d_strtouq="$undef"
18361 ;;
18362 esac
9597a80f
NC
18363 else
18364 echo "(I can't seem to compile the test program--assuming it doesn't)"
18365 d_strtouq="$undef"
d0e6d399
NC
18366 fi
18367 ;;
18368esac
18369
b4eb6b3d
JH
18370: see if strxfrm exists
18371set strxfrm d_strxfrm
18372eval $inlibc
18373
18374: see if symlink exists
18375set symlink d_symlink
18376eval $inlibc
18377
18378: see if syscall exists
18379set syscall d_syscall
18380eval $inlibc
18381
2ef53570
JH
18382: see if prototype for syscall is available
18383echo " "
18384set d_syscallproto syscall $i_unistd unistd.h
18385eval $hasproto
18386
b4eb6b3d
JH
18387: see if sysconf exists
18388set sysconf d_sysconf
18389eval $inlibc
18390
18391: see if system exists
18392set system d_system
18393eval $inlibc
18394
18395: see if tcgetpgrp exists
18396set tcgetpgrp d_tcgetpgrp
18397eval $inlibc
18398
18399: see if tcsetpgrp exists
18400set tcsetpgrp d_tcsetpgrp
18401eval $inlibc
18402
18403: see if prototype for telldir is available
18404echo " "
18405set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18406eval $hasproto
18407
ad493445
MB
18408: see if time exists
18409echo " "
18410if test "X$d_time" = X -o X"$timetype" = X; then
18411 if set time val -f d_time; eval $csym; $val; then
18412 echo 'time() found.' >&4
18413 val="$define"
18414 rp="What is the type returned by time() on this system?"
18415 set time_t timetype long stdio.h sys/types.h
18416 eval $typedef_ask
18417 else
18418 echo 'time() not found, hope that will do.' >&4
18419 val="$undef"
18420 timetype='int';
18421 fi
18422 set d_time
18423 eval $setvar
18424fi
18425
cbb9e8a7
MB
18426: see if timegm exists
18427set timegm d_timegm
18428eval $inlibc
18429
b4eb6b3d
JH
18430: see if this is a sys/times.h system
18431set sys/times.h i_systimes
18432eval $inhdr
18433
18434: see if times exists
18435echo " "
18436if set times val -f d_times; eval $csym; $val; then
18437 echo 'times() found.' >&4
18438 d_times="$define"
18439 inc=''
18440 case "$i_systimes" in
18441 "$define") inc='sys/times.h';;
18442 esac
18443 rp="What is the type returned by times() on this system?"
18444 set clock_t clocktype long stdio.h sys/types.h $inc
18445 eval $typedef_ask
18446else
18447 echo 'times() NOT found, hope that will do.' >&4
18448 d_times="$undef"
18449 clocktype='int'
18450fi
18451
10bc17b6
JH
18452: see if tmpnam_r exists
18453set tmpnam_r d_tmpnam_r
18454eval $inlibc
18455case "$d_tmpnam_r" in
18456"$define")
31ee0cb7 18457 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
18458 case "$d_tmpnam_r_proto:$usethreads" in
18459 ":define") d_tmpnam_r_proto=define
a48ec845
JH
18460 set d_tmpnam_r_proto tmpnam_r $hdrs
18461 eval $hasproto ;;
18462 *) ;;
18463 esac
18464 case "$d_tmpnam_r_proto" in
18465 define)
10bc17b6
JH
18466 case "$tmpnam_r_proto" in
18467 ''|0) try='char* tmpnam_r(char*);'
61c26d18 18468 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
10bc17b6
JH
18469 esac
18470 case "$tmpnam_r_proto" in
90e831dc 18471 ''|0) d_tmpnam_r=undef
10bc17b6 18472 tmpnam_r_proto=0
a48ec845 18473 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18474 * ) case "$tmpnam_r_proto" in
18475 REENTRANT_PROTO*) ;;
18476 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18477 esac
18478 echo "Prototype: $try" ;;
18479 esac
18480 ;;
c18e646a
JH
18481 *) case "$usethreads" in
18482 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18483 esac
90e831dc
SB
18484 d_tmpnam_r=undef
18485 tmpnam_r_proto=0
c18e646a 18486 ;;
a48ec845
JH
18487 esac
18488 ;;
10bc17b6
JH
18489*) tmpnam_r_proto=0
18490 ;;
18491esac
18492
b4eb6b3d
JH
18493: see if truncate exists
18494set truncate d_truncate
18495eval $inlibc
18496
10bc17b6
JH
18497: see if ttyname_r exists
18498set ttyname_r d_ttyname_r
18499eval $inlibc
18500case "$d_ttyname_r" in
18501"$define")
18502 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
18503 case "$d_ttyname_r_proto:$usethreads" in
18504 ":define") d_ttyname_r_proto=define
a48ec845
JH
18505 set d_ttyname_r_proto ttyname_r $hdrs
18506 eval $hasproto ;;
18507 *) ;;
18508 esac
18509 case "$d_ttyname_r_proto" in
18510 define)
10bc17b6
JH
18511 case "$ttyname_r_proto" in
18512 ''|0) try='int ttyname_r(int, char*, size_t);'
61c26d18 18513 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
10bc17b6
JH
18514 esac
18515 case "$ttyname_r_proto" in
18516 ''|0) try='int ttyname_r(int, char*, int);'
61c26d18 18517 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
10bc17b6
JH
18518 esac
18519 case "$ttyname_r_proto" in
18520 ''|0) try='char* ttyname_r(int, char*, int);'
61c26d18 18521 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
10bc17b6
JH
18522 esac
18523 case "$ttyname_r_proto" in
90e831dc 18524 ''|0) d_ttyname_r=undef
10bc17b6 18525 ttyname_r_proto=0
a48ec845 18526 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18527 * ) case "$ttyname_r_proto" in
18528 REENTRANT_PROTO*) ;;
18529 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18530 esac
18531 echo "Prototype: $try" ;;
18532 esac
18533 ;;
c18e646a
JH
18534 *) case "$usethreads" in
18535 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18536 esac
90e831dc
SB
18537 d_ttyname_r=undef
18538 ttyname_r_proto=0
c18e646a 18539 ;;
a48ec845
JH
18540 esac
18541 ;;
10bc17b6
JH
18542*) ttyname_r_proto=0
18543 ;;
18544esac
18545
b4eb6b3d
JH
18546: see if tzname[] exists
18547echo " "
18548if set tzname val -a d_tzname; eval $csym; $val; then
18549 val="$define"
18550 echo 'tzname[] found.' >&4
18551else
18552 val="$undef"
18553 echo 'tzname[] NOT found.' >&4
18554fi
18555set d_tzname
18556eval $setvar
18557
613d6c3e 18558: Check if is a multiplatform env
4e0554ec
JH
18559case "$osname" in
18560next|rhapsody|darwin) multiarch="$define" ;;
18561esac
18562case "$multiarch" in
18563''|[nN]*) multiarch="$undef" ;;
18564esac
18565
24412007 18566: check for ordering of bytes in a UV
4e0554ec 18567echo " "
5440bc8e 18568case "$usecrosscompile$multiarch" in
4e0554ec
JH
18569*$define*)
18570 $cat <<EOM
18571You seem to be either cross-compiling or doing a multiarchitecture build,
18572skipping the byteorder check.
18573
18574EOM
5440bc8e 18575 byteorder='ffff'
4e0554ec
JH
18576 ;;
18577*)
18578 case "$byteorder" in
18579 '')
18580 $cat <<'EOM'
18581In the following, larger digits indicate more significance. A big-endian
18582machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18583little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18584machines may have weird orders like 3412. A Cray will report 87654321,
18585an Alpha will report 12345678. If the test program works the default is
18586probably right.
18587I'm now running the test program...
18588EOM
24412007 18589 $cat >try.c <<EOCP
4e0554ec 18590#include <stdio.h>
55954f19
JH
18591#$i_stdlib I_STDLIB
18592#ifdef I_STDLIB
18593#include <stdlib.h>
18594#endif
24412007
JH
18595#include <sys/types.h>
18596typedef $uvtype UV;
4e0554ec
JH
18597int main()
18598{
18599 int i;
18600 union {
24412007
JH
18601 UV l;
18602 char c[$uvsize];
4e0554ec
JH
18603 } u;
18604
24412007 18605 if ($uvsize > 4)
b5ded3e5 18606 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18607 else
a4c53327 18608 u.l = (UV)0x04030201;
24412007 18609 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18610 printf("%c", u.c[i]+'0');
18611 printf("\n");
18612 exit(0);
18613}
18614EOCP
18615 xxx_prompt=y
18616 set try
43dddb59 18617 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18618 dflt=`$run ./try`
4e0554ec
JH
18619 case "$dflt" in
18620 [1-4][1-4][1-4][1-4]|12345678|87654321)
18621 echo "(The test program ran ok.)"
18622 echo "byteorder=$dflt"
18623 xxx_prompt=n
18624 ;;
18625 ????|????????) echo "(The test program ran ok.)" ;;
18626 *) echo "(The test program didn't run right for some reason.)" ;;
18627 esac
18628 else
18629 dflt='4321'
18630 cat <<'EOM'
18631(I can't seem to compile the test program. Guessing big-endian...)
18632EOM
18633 fi
18634 case "$xxx_prompt" in
18635 y)
24412007 18636 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18637 . ./myread
18638 byteorder="$ans"
18639 ;;
18640 *) byteorder=$dflt
18641 ;;
18642 esac
18643 ;;
18644 esac
5b813a60 18645 $rm_try
4e0554ec
JH
18646 ;;
18647esac
18648
cd95ead5 18649: Checking 32bit alignedness
4e0554ec
JH
18650$cat <<EOM
18651
18652Checking to see whether you can access character data unalignedly...
18653EOM
dc7b0a4f
JH
18654case "$d_u32align" in
18655'') $cat >try.c <<EOCP
4e0554ec 18656#include <stdio.h>
d1daaddf
JH
18657#$i_stdlib I_STDLIB
18658#ifdef I_STDLIB
18659#include <stdlib.h>
18660#endif
4e0554ec 18661#define U32 $u32type
d308175a
JH
18662#define BYTEORDER 0x$byteorder
18663#define U8 $u8type
9958dc3c
JH
18664#include <signal.h>
18665#ifdef SIGBUS
7090f861 18666$signal_t bletch(int s) { exit(4); }
9958dc3c 18667#endif
4e0554ec
JH
18668int main() {
18669#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
f1c7503b
MB
18670 volatile U8 buf[8];
18671 volatile U32 *up;
4e0554ec
JH
18672 int i;
18673
18674 if (sizeof(U32) != 4) {
18675 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18676 exit(1);
18677 }
18678
18679 fflush(stdout);
18680
9958dc3c
JH
18681#ifdef SIGBUS
18682 signal(SIGBUS, bletch);
18683#endif
18684
8906a23e
JH
18685 buf[0] = 0;
18686 buf[1] = 0;
18687 buf[2] = 0;
18688 buf[3] = 1;
7eac3fd6 18689 buf[4] = 0;
8906a23e
JH
18690 buf[5] = 0;
18691 buf[6] = 0;
7eac3fd6 18692 buf[7] = 1;
8906a23e 18693
4e0554ec
JH
18694 for (i = 0; i < 4; i++) {
18695 up = (U32*)(buf + i);
18696 if (! ((*up == 1 << (8*i)) || /* big-endian */
18697 (*up == 1 << (8*(3-i))) /* little-endian */
18698 )
18699 )
18700 {
18701 printf("read failed (%x)\n", *up);
18702 exit(2);
18703 }
18704 }
18705
18706 /* write test */
18707 for (i = 0; i < 4; i++) {
18708 up = (U32*)(buf + i);
18709 *up = 0xBeef;
18710 if (*up != 0xBeef) {
18711 printf("write failed (%x)\n", *up);
18712 exit(3);
18713 }
18714 }
18715
18716 exit(0);
18717#else
18718 printf("1\n");
18719 exit(1);
18720#endif
18721 return 0;
18722}
18723EOCP
18724set try
18725if eval $compile_ok; then
d308175a 18726 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18727 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18728 case "$?" in
18729 0) cat >&4 <<EOM
18730You can access character data pretty unalignedly.
18731EOM
18732 d_u32align="$undef"
18733 ;;
18734 *) cat >&4 <<EOM
18735It seems that you must access character data in an aligned manner.
18736EOM
18737 d_u32align="$define"
18738 ;;
18739 esac
4e0554ec
JH
18740else
18741 rp='Can you access character data at unaligned addresses?'
18742 dflt='n'
18743 . ./myread
18744 case "$ans" in
18745 [yY]*) d_u32align="$undef" ;;
18746 *) d_u32align="$define" ;;
18747 esac
18748fi
5b813a60 18749$rm_try
dc7b0a4f
JH
18750;;
18751esac
4e0554ec
JH
18752
18753: see if ualarm exists
18754set ualarm d_ualarm
18755eval $inlibc
18756
b4eb6b3d
JH
18757: see if umask exists
18758set umask d_umask
18759eval $inlibc
18760
758a5d79
JH
18761: see if unordered exists
18762set unordered d_unordered
18763eval $inlibc
18764
bdf33aa7
SP
18765: see if unsetenv exists
18766set unsetenv d_unsetenv
18767eval $inlibc
18768
4e0554ec
JH
18769: see if usleep exists
18770set usleep d_usleep
18771eval $inlibc
18772
2ef53570
JH
18773: see if prototype for usleep is available
18774echo " "
18775set d_usleepproto usleep $i_unistd unistd.h
18776eval $hasproto
18777
b4eb6b3d
JH
18778: see if ustat exists
18779set ustat d_ustat
18780eval $inlibc
18781
b4eb6b3d
JH
18782: see if closedir exists
18783set closedir d_closedir
18784eval $inlibc
18785
18786case "$d_closedir" in
18787"$define")
18788 echo " "
18789 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18790 cat > try.c <<EOM
b4eb6b3d
JH
18791#$i_dirent I_DIRENT /**/
18792#$i_sysdir I_SYS_DIR /**/
18793#$i_sysndir I_SYS_NDIR /**/
18794#$i_systypes I_SYS_TYPES /**/
18795
18796#if defined(I_SYS_TYPES)
18797#include <sys/types.h>
18798#endif
18799#if defined(I_DIRENT)
18800#include <dirent.h>
18801#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18802#include <sys/dir.h>
18803#endif
18804#else
18805#ifdef I_SYS_NDIR
18806#include <sys/ndir.h>
18807#else
18808#ifdef I_SYS_DIR
18809#ifdef hp9000s500
18810#include <ndir.h> /* may be wrong in the future */
18811#else
18812#include <sys/dir.h>
18813#endif
18814#endif
18815#endif
5b813a60 18816#endif
b4eb6b3d
JH
18817int main() { return closedir(opendir(".")); }
18818EOM
5440bc8e 18819 set try
b4eb6b3d 18820 if eval $compile_ok; then
5440bc8e 18821 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18822 echo "Yes, it does."
18823 val="$undef"
18824 else
18825 echo "No, it doesn't."
18826 val="$define"
18827 fi
18828 else
18829 echo "(I can't seem to compile the test program--assuming it doesn't)"
18830 val="$define"
18831 fi
18832 ;;
18833*)
18834 val="$undef";
18835 ;;
18836esac
18837set d_void_closedir
18838eval $setvar
5b813a60
MB
18839$rm_try
18840
b4eb6b3d
JH
18841: see if there is a wait4
18842set wait4 d_wait4
18843eval $inlibc
18844
18845: see if waitpid exists
18846set waitpid d_waitpid
18847eval $inlibc
18848
18849: see if wcstombs exists
18850set wcstombs d_wcstombs
18851eval $inlibc
18852
18853: see if wctomb exists
18854set wctomb d_wctomb
18855eval $inlibc
18856
4e0554ec
JH
18857: see if writev exists
18858set writev d_writev
18859eval $inlibc
18860
b4eb6b3d
JH
18861: preserve RCS keywords in files with variable substitution, grrr
18862Date='$Date'
18863Id='$Id'
18864Log='$Log'
18865RCSfile='$RCSfile'
18866Revision='$Revision'
18867
b4eb6b3d
JH
18868: check for alignment requirements
18869echo " "
5440bc8e 18870case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18871*$define*)
18872 $cat <<EOM
18873You seem to be either cross-compiling or doing a multiarchitecture build,
18874skipping the memory alignment check.
18875
18876EOM
18877 case "$alignbytes" in
18878 '') alignbytes=8 ;;
18879 esac
18880 ;;
18881*)
18882 case "$alignbytes" in
18883 '') echo "Checking alignment constraints..." >&4
18884 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18885 $cat >try.c <<'EOCP'
18886typedef long double NV;
18887EOCP
18888 else
18889 $cat >try.c <<'EOCP'
18890typedef double NV;
18891EOCP
18892 fi
18893 $cat >>try.c <<'EOCP'
18894#include <stdio.h>
18895struct foobar {
18896 char foo;
18897 NV bar;
18898} try_algn;
18899int main()
18900{
18901 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18902 return(0);
18903}
18904EOCP
18905 set try
18906 if eval $compile_ok; then
5440bc8e 18907 dflt=`$run ./try`
b4eb6b3d
JH
18908 else
18909 dflt='8'
18910 echo "(I can't seem to compile the test program...)"
18911 fi
18912 ;;
18913 *) dflt="$alignbytes"
18914 ;;
18915 esac
18916 rp="Doubles must be aligned on a how-many-byte boundary?"
18917 . ./myread
18918 alignbytes="$ans"
5b813a60 18919 $rm_try
b4eb6b3d
JH
18920 ;;
18921esac
18922
18923
18924: set the base revision
18925baserev=5.0
18926
89c1d914
MB
18927: length of character in bytes. Is always 1, otherwise it isnt C
18928: This used to be a test using sizeof
18929charsize=1
c193ef60
MB
18930
18931: Check for the number of bits in a character
18932case "$charbits" in
18933'') echo "Checking how long a character is (in bits)..." >&4
18934 $cat >try.c <<EOCP
18935#include <stdio.h>
18936int main ()
18937{
18938 int n;
18939 unsigned char c;
18940 for (c = 1, n = 0; c; c <<= 1, n++) ;
18941 printf ("%d\n", n);
18942 return (0);
18943 }
18944EOCP
18945 set try
18946 if eval $compile_ok; then
18947 dflt=`$run ./try`
18948 else
18949 dflt='8'
18950 echo "(I can't seem to compile the test program. Guessing...)"
18951 fi
18952 ;;
18953*)
18954 dflt="$charbits"
18955 ;;
18956esac
18957rp="What is the length of a character (in bits)?"
18958. ./myread
18959charbits="$ans"
18960$rm_try
18961case "$charbits" in
189628) ;;
18963*) cat >&4 << EOM
18964Your system has an unsigned character size of $charbits bits, which
18965is rather unusual (normally it is 8 bits). Perl likely will not work
18966correctly on your system, with subtle bugs in various places.
18967EOM
18968 rp='Do you really want to continue?'
18969 dflt='n'
18970 . ./myread
18971 case "$ans" in
18972 [yY]) echo >&4 "Okay, continuing." ;;
18973 *) exit 1 ;;
18974 esac
18975esac
18976
3099fc99 18977: how do we concatenate cpp tokens here?
b4eb6b3d 18978echo " "
3099fc99 18979echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
18980$cat >cpp_stuff.c <<'EOCP'
18981#define RCAT(a,b)a/**/b
18982#define ACAT(a,b)a ## b
18983RCAT(Rei,ser)
18984ACAT(Cir,cus)
18985EOCP
18986$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18987if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18988 echo "Oh! Smells like ANSI's been here." >&4
18989 echo "We can catify or stringify, separately or together!"
18990 cpp_stuff=42
18991elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18992 echo "Ah, yes! The good old days!" >&4
18993 echo "However, in the good old days we don't know how to stringify and"
18994 echo "catify at the same time."
18995 cpp_stuff=1
18996else
18997 $cat >&4 <<EOM
3099fc99
CW
18998Hmm, I don't seem to be able to concatenate tokens with your cpp.
18999You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
19000EOM
19001 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19002fi
19003$rm -f cpp_stuff.*
19004
19005: see if this is a db.h system
19006set db.h i_db
19007eval $inhdr
19008
19009case "$i_db" in
19010$define)
19011 : Check db version.
19012 echo " "
19013 echo "Checking Berkeley DB version ..." >&4
19014 $cat >try.c <<EOCP
19015#$d_const HASCONST
19016#ifndef HASCONST
19017#define const
19018#endif
19019#include <sys/types.h>
19020#include <stdio.h>
55954f19
JH
19021#$i_stdlib I_STDLIB
19022#ifdef I_STDLIB
19023#include <stdlib.h>
19024#endif
b4eb6b3d 19025#include <db.h>
640374d0 19026int main(int argc, char *argv[])
b4eb6b3d
JH
19027{
19028#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19029 int Major, Minor, Patch ;
19030 unsigned long Version ;
19031 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
19032 if (argc == 2) {
19033 printf("%d %d %d %d %d %d\n",
19034 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19035 Major, Minor, Patch);
19036 exit(0);
19037 }
19038 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
19039
19040 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19041 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19042 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19043 Major, Minor, Patch) ;
19044
19045 /* check that db.h & libdb are compatible */
19046 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 19047 printf("db.h and libdb are incompatible.\n") ;
5b813a60 19048 exit(3);
b4eb6b3d
JH
19049 }
19050
640374d0 19051 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
19052
19053 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19054 + DB_VERSION_PATCH ;
19055
19056 /* needs to be >= 2.3.4 */
19057 if (Version < 2003004) {
19058 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 19059 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 19060 exit(2);
b4eb6b3d
JH
19061 }
19062
19063 exit(0);
19064#else
19065#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
19066 if (argc == 2) {
19067 printf("1 0 0\n");
19068 exit(0);
19069 }
19070 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
19071 exit(0); /* DB version < 2: the coast is clear. */
19072#else
19073 exit(1); /* <db.h> not Berkeley DB? */
19074#endif
19075#endif
19076}
19077EOCP
19078 set try
5440bc8e 19079 if eval $compile_ok && $run ./try; then
b4eb6b3d 19080 echo 'Looks OK.' >&4
5440bc8e 19081 set `$run ./try 1`
640374d0
JH
19082 db_version_major=$1
19083 db_version_minor=$2
19084 db_version_patch=$3
b4eb6b3d
JH
19085 else
19086 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
19087 i_db=$undef
19088 case " $libs " in
19089 *"-ldb "*)
19090 : Remove db from list of libraries to use
19091 echo "Removing unusable -ldb from library list" >&4
19092 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19093 shift
19094 libs="$*"
19095 echo "libs = $libs" >&4
19096 ;;
19097 esac
19098 fi
5b813a60 19099 $rm_try
b4eb6b3d
JH
19100 ;;
19101esac
19102
19103case "$i_db" in
19104define)
5b813a60 19105 : Check the return type needed for hash
b4eb6b3d
JH
19106 echo " "
19107 echo "Checking return type needed for hash for Berkeley DB ..." >&4
19108 $cat >try.c <<EOCP
19109#$d_const HASCONST
19110#ifndef HASCONST
19111#define const
19112#endif
19113#include <sys/types.h>
19114#include <db.h>
19115
19116#ifndef DB_VERSION_MAJOR
19117u_int32_t hash_cb (ptr, size)
19118const void *ptr;
19119size_t size;
19120{
19121}
19122HASHINFO info;
19123int main()
19124{
19125 info.hash = hash_cb;
19126}
19127#endif
19128EOCP
19129 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19130 if $contains warning try.out >>/dev/null 2>&1 ; then
19131 db_hashtype='int'
19132 else
19133 db_hashtype='u_int32_t'
19134 fi
19135 else
19136 : XXX Maybe we should just give up here.
19137 db_hashtype=u_int32_t
19138 $cat try.out >&4
19139 echo "Help: I can't seem to compile the db test program." >&4
19140 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19141 fi
5b813a60 19142 $rm_try
b4eb6b3d
JH
19143 echo "Your version of Berkeley DB uses $db_hashtype for hash."
19144 ;;
19145*) db_hashtype=u_int32_t
19146 ;;
19147esac
19148case "$i_db" in
19149define)
5b813a60 19150 : Check the return type needed for prefix
b4eb6b3d
JH
19151 echo " "
19152 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19153 cat >try.c <<EOCP
19154#$d_const HASCONST
19155#ifndef HASCONST
19156#define const
19157#endif
19158#include <sys/types.h>
19159#include <db.h>
19160
19161#ifndef DB_VERSION_MAJOR
19162size_t prefix_cb (key1, key2)
19163const DBT *key1;
19164const DBT *key2;
19165{
19166}
19167BTREEINFO info;
19168int main()
19169{
19170 info.prefix = prefix_cb;
19171}
19172#endif
19173EOCP
19174 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19175 if $contains warning try.out >>/dev/null 2>&1 ; then
19176 db_prefixtype='int'
19177 else
19178 db_prefixtype='size_t'
19179 fi
19180 else
19181 db_prefixtype='size_t'
19182 : XXX Maybe we should just give up here.
19183 $cat try.out >&4
19184 echo "Help: I can't seem to compile the db test program." >&4
19185 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19186 fi
5b813a60 19187 $rm_try
b4eb6b3d
JH
19188 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19189 ;;
19190*) db_prefixtype='size_t'
19191 ;;
19192esac
19193
b4eb6b3d
JH
19194: How can we generate normalized random numbers ?
19195echo " "
19196echo "Looking for a random number function..." >&4
19197case "$randfunc" in
19198'')
19199 if set drand48 val -f; eval $csym; $val; then
19200 dflt="drand48"
19201 echo "Good, found drand48()." >&4
19202 elif set random val -f; eval $csym; $val; then
19203 dflt="random"
19204 echo "OK, found random()." >&4
19205 else
19206 dflt="rand"
19207 echo "Yick, looks like I have to use rand()." >&4
19208 fi
19209 echo " "
19210 ;;
19211*)
19212 dflt="$randfunc"
19213 ;;
19214esac
19215cont=true
19216
19217case "$ccflags" in
19218*-Dmy_rand=*|*-Dmy_srand=*)
19219 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19220 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19221 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19222 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19223 ;;
19224esac
19225
19226while $test "$cont"; do
19227 rp="Use which function to generate random numbers?"
19228 . ./myread
19229 if $test "$ans" = "$dflt"; then
19230 : null
19231 else
19232 randbits=''
19233 fi
19234 randfunc="$ans"
19235 if set $ans val -f; eval $csym; $val; then
19236 cont=''
19237 else
19238 dflt=y
19239 rp="I cannot find function $ans. Use that name anyway?"
19240 . ./myread
19241 dflt=rand
19242 case "$ans" in
19243 [yY]*) cont='';;
19244 esac
19245 fi
19246 case "$cont" in
19247 '')
19248 case "$randfunc" in
19249 drand48)
19250 drand01="drand48()"
19251 seedfunc="srand48"
19252 randbits=48
19253 randseedtype=long
19254 ;;
19255 rand|random)
19256 case "$randbits" in
19257 '')
19258echo "Checking to see how many bits your $randfunc() function produces..." >&4
19259 $cat >try.c <<EOCP
19260#$i_unistd I_UNISTD
19261#$i_stdlib I_STDLIB
19262#include <stdio.h>
19263#ifdef I_UNISTD
19264# include <unistd.h>
19265#endif
19266#ifdef I_STDLIB
19267# include <stdlib.h>
19268#endif
19269int main()
19270{
19271 register int i;
19272 register unsigned long tmp;
19273 register unsigned long max = 0L;
19274
19275 for (i = 1000; i; i--) {
19276 tmp = (unsigned long) $randfunc();
19277 if (tmp > max) max = tmp;
19278 }
19279 for (i = 0; max; i++)
19280 max /= 2;
19281 printf("%d\n",i);
19282}
19283EOCP
19284 set try
19285 if eval $compile_ok; then
19286 dflt=`try`
19287 else
19288 dflt='?'
19289 echo "(I can't seem to compile the test program...)"
19290 fi
19291 ;;
19292 *)
19293 dflt="$randbits"
19294 ;;
19295 esac
19296 rp="How many bits does your $randfunc() function produce?"
19297 . ./myread
19298 randbits="$ans"
5b813a60 19299 $rm_try
b4eb6b3d
JH
19300 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19301 seedfunc="s$randfunc"
19302 randseedtype=unsigned
19303 ;;
19304 *)
19305 dflt="31"
19306 rp="How many bits does your $randfunc() function produce?"
19307 . ./myread
19308 randbits="$ans"
19309 seedfunc="s$randfunc"
19310 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19311 if set $seedfunc val -f; eval $csym; $val; then
19312 echo "(Using $seedfunc() to seed random generator)"
19313 else
19314 echo "(Warning: no $seedfunc() to seed random generator)"
19315 seedfunc=rand
19316 fi
19317 randseedtype=unsigned
19318 ;;
19319 esac
19320 ;;
19321 esac
19322done
19323
613d6c3e 19324: Determine if this is an EBCDIC system
b4eb6b3d
JH
19325echo " "
19326echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 19327$cat >try.c <<'EOM'
b4eb6b3d
JH
19328int main()
19329{
19330 if ('M'==0xd4) return 0;
19331 return 1;
19332}
19333EOM
19334
19335val=$undef
5440bc8e 19336set try
b4eb6b3d 19337if eval $compile_ok; then
5440bc8e 19338 if $run ./try; then
b4eb6b3d
JH
19339 echo "You seem to speak EBCDIC." >&4
19340 val="$define"
19341 else
5440bc8e 19342 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
19343 fi
19344else
19345 echo "I'm unable to compile the test program." >&4
19346 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19347fi
5b813a60 19348$rm_try
b4eb6b3d
JH
19349set ebcdic
19350eval $setvar
19351
613d6c3e 19352: Check how to flush
b4eb6b3d
JH
19353echo " "
19354$cat >&4 <<EOM
19355Checking how to flush all pending stdio output...
19356EOM
19357# I only know how to find the first 32 possibly open files on SunOS.
19358# See also hints/sunos_4_1.sh and util.c --AD
19359case "$osname" in
19360sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19361esac
19362$cat >>try.c <<EOCP
19363#include <stdio.h>
55954f19
JH
19364#$i_stdlib I_STDLIB
19365#ifdef I_STDLIB
19366#include <stdlib.h>
19367#endif
b4eb6b3d
JH
19368#$i_unistd I_UNISTD
19369#ifdef I_UNISTD
19370# include <unistd.h>
19371#endif
19372#$d_sysconf HAS_SYSCONF
19373#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19374#ifdef HAS_STDIO_STREAM_ARRAY
19375# define STDIO_STREAM_ARRAY $stdio_stream_array
19376#endif
19377int main() {
5440bc8e
JH
19378 FILE* p;
19379 unlink("try.out");
19380 p = fopen("try.out", "w");
b4eb6b3d
JH
19381#ifdef TRY_FPUTC
19382 fputc('x', p);
19383#else
19384# ifdef TRY_FPRINTF
19385 fprintf(p, "x");
19386# endif
19387#endif
19388#ifdef TRY_FFLUSH_NULL
19389 fflush(NULL);
19390#endif
19391#ifdef TRY_FFLUSH_ALL
19392 {
19393 long open_max = -1;
19394# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19395 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19396# else
19397# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19398 open_max = sysconf(_SC_OPEN_MAX);
19399# else
19400# ifdef FOPEN_MAX
19401 open_max = FOPEN_MAX;
19402# else
19403# ifdef OPEN_MAX
19404 open_max = OPEN_MAX;
19405# else
19406# ifdef _NFILE
19407 open_max = _NFILE;
19408# endif
19409# endif
19410# endif
19411# endif
5b813a60 19412# endif
b4eb6b3d
JH
19413# ifdef HAS_STDIO_STREAM_ARRAY
19414 if (open_max > 0) {
19415 long i;
19416 for (i = 0; i < open_max; i++)
19417 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19418 STDIO_STREAM_ARRAY[i]._file < open_max &&
19419 STDIO_STREAM_ARRAY[i]._flag)
19420 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 19421 }
b4eb6b3d
JH
19422 }
19423# endif
19424#endif
19425 _exit(42);
19426}
19427EOCP
19428: first we have to find out how _not_ to flush
5440bc8e 19429$to try.c
b4eb6b3d
JH
19430if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19431 output=''
19432 set try -DTRY_FPUTC
19433 if eval $compile; then
fbe73d74 19434 $run ./try 2>/dev/null
28f5ac64 19435 code="$?"
5440bc8e 19436 $from try.out
28f5ac64 19437 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19438 output=-DTRY_FPUTC
19439 fi
19440 fi
19441 case "$output" in
19442 '')
19443 set try -DTRY_FPRINTF
b4eb6b3d 19444 if eval $compile; then
fbe73d74 19445 $run ./try 2>/dev/null
28f5ac64 19446 code="$?"
5440bc8e 19447 $from try.out
28f5ac64 19448 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19449 output=-DTRY_FPRINTF
19450 fi
19451 fi
19452 ;;
19453 esac
19454fi
19455: check for fflush NULL behaviour
19456case "$fflushNULL" in
19457'') set try -DTRY_FFLUSH_NULL $output
19458 if eval $compile; then
5440bc8e 19459 $run ./try 2>/dev/null
b4eb6b3d 19460 code="$?"
5440bc8e 19461 $from try.out
b4eb6b3d
JH
19462 if $test -s try.out -a "X$code" = X42; then
19463 fflushNULL="`$cat try.out`"
19464 else
19465 if $test "X$code" != X42; then
19466 $cat >&4 <<EOM
19467(If this test failed, don't worry, we'll try another method shortly.)
19468EOM
19469 fi
19470 fi
19471 fi
2c476adc 19472 $rm -f core try.core core.try.*
b4eb6b3d
JH
19473 case "$fflushNULL" in
19474 x) $cat >&4 <<EOM
19475Your fflush(NULL) works okay for output streams.
19476Let's see if it clobbers input pipes...
19477EOM
19478# As of mid-March 2000 all versions of Solaris appear to have a stdio
19479# bug that improperly flushes the input end of pipes. So we avoid the
19480# autoflush on fork/system/exec support for now. :-(
19481$cat >tryp.c <<EOCP
19482#include <stdio.h>
19483int
19484main(int argc, char **argv)
19485{
19486 char buf[1024];
19487 int i;
19488 char *bp = buf;
19489 while (1) {
19490 while ((i = getc(stdin)) != -1
19491 && (*bp++ = i) != '\n'
19492 && bp < &buf[1024])
19493 /* DO NOTHING */ ;
19494 *bp = '\0';
19495 fprintf(stdout, "%s", buf);
19496 fflush(NULL);
19497 if (i == -1)
19498 return 0;
19499 bp = buf;
19500 }
19501}
19502EOCP
19503 fflushNULL="$define"
19504 set tryp
19505 if eval $compile; then
19506 $rm -f tryp.out
5440bc8e 19507 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19508 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19509 $cat >&4 <<EOM
19510fflush(NULL) seems to behave okay with input streams.
19511EOM
19512 fflushNULL="$define"
19513 else
19514 $cat >&4 <<EOM
19515Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19516EOM
19517 fflushNULL="$undef"
19518 fi
19519 fi
19520 $rm -f core tryp.c tryp.core core.tryp.*
19521 ;;
19522 '') $cat >&4 <<EOM
19523Your fflush(NULL) isn't working (contrary to ANSI C).
19524EOM
19525 fflushNULL="$undef"
19526 ;;
19527 *) $cat >&4 <<EOM
19528Cannot figure out whether your fflush(NULL) works or not.
19529I'm assuming it doesn't (contrary to ANSI C).
19530EOM
19531 fflushNULL="$undef"
19532 ;;
19533 esac
19534 ;;
19535$define|true|[yY]*)
19536 fflushNULL="$define"
19537 ;;
19538*)
19539 fflushNULL="$undef"
19540 ;;
19541esac
19542: check explicit looping only if NULL did not work, and if the pipe
19543: bug does not show up on an explicit flush too
19544case "$fflushNULL" in
19545"$undef")
19546 $cat >tryp.c <<EOCP
19547#include <stdio.h>
19548int
19549main(int argc, char **argv)
19550{
19551 char buf[1024];
19552 int i;
19553 char *bp = buf;
19554 while (1) {
19555 while ((i = getc(stdin)) != -1
19556 && (*bp++ = i) != '\n'
19557 && bp < &buf[1024])
19558 /* DO NOTHING */ ;
19559 *bp = '\0';
19560 fprintf(stdout, "%s", buf);
19561 fflush(stdin);
19562 if (i == -1)
19563 return 0;
19564 bp = buf;
19565 }
19566}
19567EOCP
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
19574Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19575EOM
19576 : now check for fflushall behaviour
19577 case "$fflushall" in
19578 '') set try -DTRY_FFLUSH_ALL $output
19579 if eval $compile; then
19580 $cat >&4 <<EOM
19581(Now testing the other method--but note that this also may fail.)
19582EOM
5440bc8e 19583 $run ./try 2>/dev/null
28f5ac64 19584 code=$?
fbe73d74 19585 $from try.out
28f5ac64 19586 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19587 fflushall="`$cat try.out`"
19588 fi
19589 fi
5b813a60 19590 $rm_try
b4eb6b3d
JH
19591 case "$fflushall" in
19592 x) $cat >&4 <<EOM
19593Whew. Flushing explicitly all the stdio streams works.
19594EOM
19595 fflushall="$define"
19596 ;;
19597 '') $cat >&4 <<EOM
19598Sigh. Flushing explicitly all the stdio streams doesn't work.
19599EOM
19600 fflushall="$undef"
19601 ;;
19602 *) $cat >&4 <<EOM
19603Cannot figure out whether flushing stdio streams explicitly works or not.
19604I'm assuming it doesn't.
19605EOM
19606 fflushall="$undef"
19607 ;;
19608 esac
19609 ;;
19610 "$define"|true|[yY]*)
19611 fflushall="$define"
19612 ;;
19613 *)
19614 fflushall="$undef"
19615 ;;
19616 esac
19617 else
19618 $cat >&4 <<EOM
19619All is futile. Even fflush(stdin) clobbers input pipes!
19620EOM
19621 fflushall="$undef"
19622 fi
19623 else
19624 fflushall="$undef"
19625 fi
19626 $rm -f core tryp.c tryp.core core.tryp.*
19627 ;;
19628*) fflushall="$undef"
19629 ;;
19630esac
19631
19632case "$fflushNULL$fflushall" in
19633undefundef)
19634 $cat <<EOM
19635OK, I give up. I cannot figure out how to flush pending stdio output.
19636We won't be flushing handles at all before fork/exec/popen.
19637EOM
19638 ;;
19639esac
34f1896b 19640$rm_try tryp
b4eb6b3d
JH
19641
19642: Store the full pathname to the ar program for use in the C program
19643: Respect a hint or command line value for full_ar.
19644case "$full_ar" in
19645'') full_ar=$ar ;;
19646esac
19647
19648: Store the full pathname to the sed program for use in the C program
19649full_sed=$sed
19650
19651: see what type gids are declared as in the kernel
19652echo " "
19653echo "Looking for the type for group ids returned by getgid()."
19654set gid_t gidtype xxx stdio.h sys/types.h
19655eval $typedef
19656case "$gidtype" in
19657xxx)
19658 xxx=`./findhdr sys/user.h`
19659 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19660 case $1 in
19661 unsigned) dflt="$1 $2" ;;
19662 *) dflt="$1" ;;
19663 esac
19664 ;;
19665*) dflt="$gidtype";;
19666esac
19667case "$gidtype" in
19668gid_t) echo "gid_t found." ;;
19669*) rp="What is the type for group ids returned by getgid()?"
19670 . ./myread
19671 gidtype="$ans"
19672 ;;
19673esac
19674
613d6c3e 19675: Check the size of GID
b4eb6b3d
JH
19676echo " "
19677case "$gidtype" in
19678*_t) zzz="$gidtype" ;;
19679*) zzz="gid" ;;
19680esac
613d6c3e 19681echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
19682cat > try.c <<EOCP
19683#include <sys/types.h>
19684#include <stdio.h>
d1daaddf
JH
19685#$i_stdlib I_STDLIB
19686#ifdef I_STDLIB
19687#include <stdlib.h>
19688#endif
b4eb6b3d
JH
19689int main() {
19690 printf("%d\n", (int)sizeof($gidtype));
19691 exit(0);
19692}
19693EOCP
19694set try
19695if eval $compile_ok; then
5440bc8e 19696 yyy=`$run ./try`
b4eb6b3d
JH
19697 case "$yyy" in
19698 '') gidsize=4
19699 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19700 ;;
19701 *) gidsize=$yyy
19702 echo "Your $zzz is $gidsize bytes long."
19703 ;;
19704 esac
19705else
19706 gidsize=4
19707 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19708fi
19709
19710
613d6c3e 19711: Check if GID is signed
b4eb6b3d
JH
19712echo " "
19713case "$gidtype" in
19714*_t) zzz="$gidtype" ;;
19715*) zzz="gid" ;;
19716esac
613d6c3e 19717echo "Checking the sign of $zzz..." >&4
b4eb6b3d
JH
19718cat > try.c <<EOCP
19719#include <sys/types.h>
19720#include <stdio.h>
19721int main() {
19722 $gidtype foo = -1;
19723 if (foo < 0)
19724 printf("-1\n");
19725 else
19726 printf("1\n");
19727}
19728EOCP
19729set try
19730if eval $compile; then
5440bc8e 19731 yyy=`$run ./try`
b4eb6b3d
JH
19732 case "$yyy" in
19733 '') gidsign=1
19734 echo "(I can't execute the test program--guessing unsigned.)" >&4
19735 ;;
19736 *) gidsign=$yyy
19737 case "$gidsign" in
19738 1) echo "Your $zzz is unsigned." ;;
19739 -1) echo "Your $zzz is signed." ;;
19740 esac
19741 ;;
19742 esac
19743else
19744 gidsign=1
19745 echo "(I can't compile the test program--guessing unsigned.)" >&4
19746fi
19747
19748
613d6c3e 19749: Check 64bit sizes
b4eb6b3d
JH
19750echo " "
19751
19752if $test X"$quadtype" != X; then
19753
19754echo "Checking how to print 64-bit integers..." >&4
19755
19756if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19757 $cat >try.c <<'EOCP'
19758#include <sys/types.h>
19759#include <stdio.h>
19760int main() {
19761 int q = 12345678901;
19762 printf("%ld\n", q);
19763}
19764EOCP
19765 set try
19766 if eval $compile; then
5440bc8e 19767 yyy=`$run ./try`
b4eb6b3d
JH
19768 case "$yyy" in
19769 12345678901)
19770 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19771 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19772 echo "We will use %d."
19773 ;;
19774 esac
19775 fi
19776fi
19777
19778if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19779 $cat >try.c <<'EOCP'
19780#include <sys/types.h>
19781#include <stdio.h>
19782int main() {
19783 long q = 12345678901;
19784 printf("%ld\n", q);
19785}
19786EOCP
19787 set try
19788 if eval $compile; then
5440bc8e 19789 yyy=`$run ./try`
b4eb6b3d
JH
19790 case "$yyy" in
19791 12345678901)
19792 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19793 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19794 echo "We will use %ld."
19795 ;;
19796 esac
19797 fi
19798fi
19799
19800if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19801 $cat >try.c <<'EOCP'
19802#include <sys/types.h>
19803#include <inttypes.h>
19804#include <stdio.h>
19805int main() {
19806 int64_t q = 12345678901;
19807 printf("%" PRId64 "\n", q);
19808}
19809EOCP
19810 set try
19811 if eval $compile; then
5440bc8e 19812 yyy=`$run ./try`
b4eb6b3d
JH
19813 case "$yyy" in
19814 12345678901)
19815 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19816 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19817 echo "We will use the C9X style."
19818 ;;
19819 esac
19820 fi
19821fi
19822
2ef53570
JH
19823if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19824 $cat >try.c <<EOCP
b4eb6b3d
JH
19825#include <sys/types.h>
19826#include <stdio.h>
19827int main() {
2ef53570
JH
19828 $quadtype q = 12345678901;
19829 printf("%Ld\n", q);
b4eb6b3d
JH
19830}
19831EOCP
19832 set try
19833 if eval $compile; then
5440bc8e 19834 yyy=`$run ./try`
b4eb6b3d
JH
19835 case "$yyy" in
19836 12345678901)
2ef53570
JH
19837 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19838 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19839 echo "We will use %Ld."
b4eb6b3d
JH
19840 ;;
19841 esac
19842 fi
19843fi
19844
2ef53570
JH
19845if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19846 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19847#include <sys/types.h>
19848#include <stdio.h>
19849int main() {
2ef53570
JH
19850 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19851 printf("%lld\n", q);
b4eb6b3d
JH
19852}
19853EOCP
19854 set try
19855 if eval $compile; then
5440bc8e 19856 yyy=`$run ./try`
b4eb6b3d
JH
19857 case "$yyy" in
19858 12345678901)
2ef53570
JH
19859 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19860 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19861 echo "We will use the %lld style."
b4eb6b3d
JH
19862 ;;
19863 esac
19864 fi
19865fi
19866
19867if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19868 $cat >try.c <<EOCP
19869#include <sys/types.h>
19870#include <stdio.h>
19871int main() {
19872 $quadtype q = 12345678901;
19873 printf("%qd\n", q);
19874}
19875EOCP
19876 set try
19877 if eval $compile; then
5440bc8e 19878 yyy=`$run ./try`
b4eb6b3d
JH
19879 case "$yyy" in
19880 12345678901)
19881 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19882 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19883 echo "We will use %qd."
19884 ;;
19885 esac
19886 fi
19887fi
19888
19889if $test X"$sPRId64" = X; then
19890 echo "Cannot figure out how to print 64-bit integers." >&4
19891fi
5b813a60 19892$rm_try
b4eb6b3d
JH
19893
19894fi
19895
19896case "$sPRId64" in
5b813a60
MB
19897'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19898 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 19899 ;;
5b813a60
MB
19900*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19901 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
19902 ;;
19903esac
19904
34f1896b 19905: Check format strings for internal types
b4eb6b3d
JH
19906echo " "
19907$echo "Checking the format strings to be used for Perl's internal types..." >&4
19908
19909if $test X"$ivsize" = X8; then
19910 ivdformat="$sPRId64"
19911 uvuformat="$sPRIu64"
19912 uvoformat="$sPRIo64"
19913 uvxformat="$sPRIx64"
19914 uvXUformat="$sPRIXU64"
19915else
19916 if $test X"$ivsize" = X"$longsize"; then
19917 ivdformat='"ld"'
19918 uvuformat='"lu"'
19919 uvoformat='"lo"'
19920 uvxformat='"lx"'
19921 uvXUformat='"lX"'
19922 else
19923 if $test X"$ivsize" = X"$intsize"; then
19924 ivdformat='"d"'
19925 uvuformat='"u"'
19926 uvoformat='"o"'
19927 uvxformat='"x"'
19928 uvXUformat='"X"'
19929 else
19930 : far out
19931 if $test X"$ivsize" = X"$shortsize"; then
19932 ivdformat='"hd"'
19933 uvuformat='"hu"'
19934 uvoformat='"ho"'
19935 uvxformat='"hx"'
19936 uvXUformat='"hX"'
19937 fi
19938 fi
19939 fi
19940fi
19941
19942if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19943 nveformat="$sPRIeldbl"
19944 nvfformat="$sPRIfldbl"
19945 nvgformat="$sPRIgldbl"
19946 nvEUformat="$sPRIEUldbl"
19947 nvFUformat="$sPRIFUldbl"
19948 nvGUformat="$sPRIGUldbl"
19949else
19950 nveformat='"e"'
19951 nvfformat='"f"'
19952 nvgformat='"g"'
19953 nvEUformat='"E"'
19954 nvFUformat='"F"'
19955 nvGUformat='"G"'
19956fi
19957
19958case "$ivdformat" in
3c728e00 19959'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19960 exit 1
19961 ;;
19962esac
19963
34f1896b 19964: Check format string for GID
b4eb6b3d
JH
19965
19966echo " "
19967$echo "Checking the format string to be used for gids..." >&4
19968
19969case "$gidsign" in
19970-1) if $test X"$gidsize" = X"$ivsize"; then
19971 gidformat="$ivdformat"
19972 else
19973 if $test X"$gidsize" = X"$longsize"; then
19974 gidformat='"ld"'
19975 else
19976 if $test X"$gidsize" = X"$intsize"; then
19977 gidformat='"d"'
19978 else
19979 if $test X"$gidsize" = X"$shortsize"; then
19980 gidformat='"hd"'
19981 fi
19982 fi
19983 fi
19984 fi
19985 ;;
19986*) if $test X"$gidsize" = X"$uvsize"; then
19987 gidformat="$uvuformat"
19988 else
19989 if $test X"$gidsize" = X"$longsize"; then
19990 gidformat='"lu"'
19991 else
19992 if $test X"$gidsize" = X"$intsize"; then
19993 gidformat='"u"'
19994 else
19995 if $test X"$gidsize" = X"$shortsize"; then
19996 gidformat='"hu"'
19997 fi
19998 fi
19999 fi
20000 fi
20001 ;;
20002esac
20003
20004: see if getgroups exists
20005set getgroups d_getgrps
20006eval $inlibc
20007
20008: see if setgroups exists
20009set setgroups d_setgrps
20010eval $inlibc
20011
b4eb6b3d
JH
20012: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20013echo " "
20014case "$d_getgrps$d_setgrps" in
20015*define*)
20016 case "$groupstype" in
20017 '') dflt="$gidtype" ;;
20018 *) dflt="$groupstype" ;;
20019 esac
20020 $cat <<EOM
20021What type of pointer is the second argument to getgroups() and setgroups()?
20022Usually this is the same as group ids, $gidtype, but not always.
20023
20024EOM
20025 rp='What type pointer is the second argument to getgroups() and setgroups()?'
20026 . ./myread
20027 groupstype="$ans"
20028 ;;
20029*) groupstype="$gidtype";;
20030esac
20031
613d6c3e 20032: MAD = Misc Attribute Definition
d620c7b3 20033
fd655d33
NC
20034if $test $patchlevel -lt 9; then
20035: MAD is not available in 5.8.x or earlier.
20036 ans=n;
20037else
20038 case "$mad" in
20039 $define|true|[yY]*) dflt='y' ;;
20040 *) dflt='n' ;;
20041 esac
20042 cat <<EOM
d620c7b3
MB
20043
20044Would you like to build with Misc Attribute Decoration? This is development
20045work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20046overhead on the interpreter.
20047
20048If this doesn't make any sense to you, just accept the default '$dflt'.
20049EOM
fd655d33
NC
20050 rp='Build Perl with MAD?'
20051 . ./myread
20052fi
d620c7b3 20053case "$ans" in
00e74f14
NC
20054y|Y) val="$define"
20055 madlyh='madly.h madly.act madly.tab'
20056 madlysrc='madly.c'
20057 madlyobj="madly$_o" ;;
20058*) val="$undef"
20059 madlyh=''
20060 madlysrc=''
20061 madlyobj='' ;;
d620c7b3
MB
20062esac
20063set mad
20064eval $setvar
20065
216dac04 20066: check whether make sets MAKE
b4eb6b3d
JH
20067echo " "
20068echo "Checking if your $make program sets \$(MAKE)..." >&4
20069case "$make_set_make" in
20070'')
20071 $sed 's/^X //' > testmake.mak << 'EOF'
20072Xall:
20073X @echo 'maketemp="$(MAKE)"'
20074EOF
20075 case "`$make -f testmake.mak 2>/dev/null`" in
20076 *maketemp=*) make_set_make='#' ;;
20077 *) make_set_make="MAKE=$make" ;;
20078 esac
20079 $rm -f testmake.mak
20080 ;;
20081esac
20082case "$make_set_make" in
20083'#') echo "Yup, it does.";;
20084*) echo "Nope, it doesn't.";;
20085esac
20086
20087: see what type is used for mode_t
20088rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20089set mode_t modetype int stdio.h sys/types.h
20090eval $typedef_ask
20091
2cc61e15
DD
20092: see if we need va_copy
20093echo " "
20094case "$i_stdarg" in
20095"$define")
20096 $cat >try.c <<EOCP
20097#include <stdarg.h>
20098#include <stdio.h>
85c8a686
DD
20099#$i_stdlib I_STDLIB
20100#ifdef I_STDLIB
20101#include <stdlib.h>
20102#endif
20103#include <signal.h>
2cc61e15
DD
20104
20105int
20106ivfprintf(FILE *f, const char *fmt, va_list *valp)
20107{
20108 return vfprintf(f, fmt, *valp);
20109}
5b813a60
MB
20110
20111int
2cc61e15
DD
20112myvfprintf(FILE *f, const char *fmt, va_list val)
20113{
20114 return ivfprintf(f, fmt, &val);
20115}
5b813a60 20116
2cc61e15 20117int
5b813a60 20118myprintf(char *fmt, ...)
2cc61e15
DD
20119{
20120 va_list val;
20121 va_start(val, fmt);
5b813a60
MB
20122 return myvfprintf(stdout, fmt, val);
20123}
2cc61e15
DD
20124
20125int
20126main(int ac, char **av)
20127{
85c8a686
DD
20128 signal(SIGSEGV, exit);
20129
5b813a60
MB
20130 myprintf("%s%cs all right, then\n", "that", '\'');
20131 exit(0);
2cc61e15
DD
20132}
20133EOCP
20134 set try
5440bc8e
JH
20135 if eval $compile && $run ./try 2>&1 >/dev/null; then
20136 case "`$run ./try`" in
2cc61e15
DD
20137 "that's all right, then")
20138 okay=yes
20139 ;;
20140 esac
20141 fi
20142 case "$okay" in
20143 yes) echo "It seems that you don't need va_copy()." >&4
20144 need_va_copy="$undef"
20145 ;;
20146 *) echo "It seems that va_copy() or similar will be needed." >&4
20147 need_va_copy="$define"
20148 ;;
20149 esac
5b813a60 20150 $rm_try
2cc61e15
DD
20151 ;;
20152*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20153 ;;
20154esac
20155
b4eb6b3d
JH
20156: see what type is used for size_t
20157rp="What is the type used for the length parameter for string functions?"
20158set size_t sizetype 'unsigned int' stdio.h sys/types.h
20159eval $typedef_ask
20160
20161: check for type of arguments to gethostbyaddr.
20162if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20163 case "$d_gethbyaddr" in
20164 $define)
20165 $cat <<EOM
20166
20167Checking to see what type of arguments are accepted by gethostbyaddr().
20168EOM
20169 hdrs="$define sys/types.h
20170 $d_socket sys/socket.h
20171 $i_niin netinet/in.h
20172 $i_netdb netdb.h
20173 $i_unistd unistd.h"
20174 : The first arg can 'char *' or 'void *'
20175 : The second arg is some of integral type
20176 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20177 for yyy in size_t long int; do
20178 case "$netdb_host_type" in
61c26d18 20179 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
b4eb6b3d
JH
20180 if ./protochk "$try" $hdrs; then
20181 echo "Your system accepts $xxx for the first arg."
20182 echo "...and $yyy for the second arg."
20183 netdb_host_type="$xxx"
20184 netdb_hlen_type="$yyy"
20185 fi
20186 ;;
20187 esac
20188 done
20189 done
20190 : In case none of those worked, prompt the user.
20191 case "$netdb_host_type" in
20192 '') rp='What is the type for the 1st argument to gethostbyaddr?'
20193 dflt='char *'
20194 . ./myread
20195 netdb_host_type=$ans
20196 rp='What is the type for the 2nd argument to gethostbyaddr?'
20197 dflt="$sizetype"
20198 . ./myread
20199 netdb_hlen_type=$ans
20200 ;;
20201 esac
20202 ;;
20203 *) : no gethostbyaddr, so pick harmless defaults
20204 netdb_host_type='char *'
20205 netdb_hlen_type="$sizetype"
20206 ;;
20207 esac
20208 # Remove the "const" if needed. -- but then we'll have a
20209 # prototype clash!
20210 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20211fi
20212
20213: check for type of argument to gethostbyname.
20214if test "X$netdb_name_type" = X ; then
20215 case "$d_gethbyname" in
20216 $define)
20217 $cat <<EOM
20218
20219Checking to see what type of argument is accepted by gethostbyname().
20220EOM
20221 hdrs="$define sys/types.h
20222 $d_socket sys/socket.h
20223 $i_niin netinet/in.h
20224 $i_netdb netdb.h
20225 $i_unistd unistd.h"
20226 for xxx in "const char *" "char *"; do
20227 case "$netdb_name_type" in
61c26d18 20228 '') try="$extern_C struct hostent *gethostbyname($xxx);"
b4eb6b3d
JH
20229 if ./protochk "$try" $hdrs; then
20230 echo "Your system accepts $xxx."
20231 netdb_name_type="$xxx"
20232 fi
20233 ;;
20234 esac
20235 done
20236 : In case none of those worked, prompt the user.
20237 case "$netdb_name_type" in
20238 '') rp='What is the type for the 1st argument to gethostbyname?'
20239 dflt='char *'
20240 . ./myread
20241 netdb_name_type=$ans
20242 ;;
20243 esac
20244 ;;
20245 *) : no gethostbyname, so pick harmless default
20246 netdb_name_type='char *'
20247 ;;
20248 esac
20249fi
20250
20251: check for type of 1st argument to getnetbyaddr.
20252if test "X$netdb_net_type" = X ; then
20253 case "$d_getnbyaddr" in
20254 $define)
20255 $cat <<EOM
20256
20257Checking to see what type of 1st argument is accepted by getnetbyaddr().
20258EOM
20259 hdrs="$define sys/types.h
20260 $d_socket sys/socket.h
20261 $i_niin netinet/in.h
20262 $i_netdb netdb.h
20263 $i_unistd unistd.h"
20264 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20265 case "$netdb_net_type" in
61c26d18 20266 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
b4eb6b3d
JH
20267 if ./protochk "$try" $hdrs; then
20268 echo "Your system accepts $xxx."
20269 netdb_net_type="$xxx"
20270 fi
20271 ;;
20272 esac
20273 done
20274 : In case none of those worked, prompt the user.
20275 case "$netdb_net_type" in
20276 '') rp='What is the type for the 1st argument to getnetbyaddr?'
20277 dflt='long'
20278 . ./myread
20279 netdb_net_type=$ans
20280 ;;
20281 esac
20282 ;;
20283 *) : no getnetbyaddr, so pick harmless default
20284 netdb_net_type='long'
20285 ;;
20286 esac
20287fi
20288: locate the preferred pager for this system
d604bb53 20289fn=f/
b4eb6b3d
JH
20290case "$pager" in
20291'')
20292 dflt=''
20293 case "$pg" in
20294 /*) dflt=$pg;;
20295 [a-zA-Z]:/*) dflt=$pg;;
20296 esac
20297 case "$more" in
20298 /*) dflt=$more;;
20299 [a-zA-Z]:/*) dflt=$more;;
20300 esac
20301 case "$less" in
20302 /*) dflt=$less;;
20303 [a-zA-Z]:/*) dflt=$less;;
20304 esac
20305 case "$dflt" in
20306 '') dflt=/usr/ucb/more;;
20307 esac
20308 ;;
d604bb53 20309*) dflt="$pager"
d604bb53
JH
20310 fn="f/($pager)"
20311 ;;
b4eb6b3d
JH
20312esac
20313echo " "
b4eb6b3d
JH
20314rp='What pager is used on your system?'
20315. ./getfile
20316pager="$ans"
20317
20318: see what type pids are declared as in the kernel
20319rp="What is the type of process ids on this system?"
20320set pid_t pidtype int stdio.h sys/types.h
20321eval $typedef_ask
20322
b4eb6b3d
JH
20323: see if ar generates random libraries by itself
20324echo " "
20325echo "Checking how to generate random libraries on your machine..." >&4
20326echo 'int bar1() { return bar2(); }' > bar1.c
20327echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
20328$cat > foo.c <<EOP
20329#$i_stdlib I_STDLIB
20330#ifdef I_STDLIB
20331#include <stdlib.h>
20332#endif
b4eb6b3d
JH
20333int main() { printf("%d\n", bar1()); exit(0); }
20334EOP
20335$cc $ccflags -c bar1.c >/dev/null 2>&1
20336$cc $ccflags -c bar2.c >/dev/null 2>&1
20337$cc $ccflags -c foo.c >/dev/null 2>&1
20338$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 20339if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20340 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20341 echo "$ar appears to generate random libraries itself."
20342 orderlib=false
e39a9d84
LC
20343 if [ "X$ranlib" = "X" ]; then
20344 ranlib=":"
20345 fi
88d4d47b
PC
20346elif $ar s bar$_a >/dev/null 2>&1 &&
20347 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20348 $run ./foobar >/dev/null 2>&1; then
20349 echo "a table of contents needs to be added with '$ar s'."
20350 orderlib=false
20351 ranlib="$ar s"
b4eb6b3d 20352elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 20353 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20354 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20355 echo "a table of contents needs to be added with '$ar ts'."
20356 orderlib=false
20357 ranlib="$ar ts"
20358else
20359 case "$ranlib" in
20360 :) ranlib='';;
20361 '')
20362 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20363 $test -f $ranlib || ranlib=''
20364 ;;
20365 esac
20366 if $test -n "$ranlib"; then
20367 echo "your system has '$ranlib'; we'll use that."
20368 orderlib=false
20369 else
20370 echo "your system doesn't seem to support random libraries"
20371 echo "so we'll use lorder and tsort to order the libraries."
20372 orderlib=true
20373 ranlib=":"
20374 fi
20375fi
88d4d47b 20376$rm -f foo* bar*
b4eb6b3d 20377
92a3ac59
MB
20378: see if this is a values.h system
20379set values.h i_values
20380eval $inhdr
20381
73e6e416 20382: Check the max offset that gmtime and localtime accept
92a3ac59 20383echo "Checking max offsets that gmtime () accepts"
81c4fd9e 20384
92a3ac59
MB
20385case $i_values in
20386 define) yyy="#include <values.h>" ;;
20387 *) yyy="" ;;
20388 esac
20389
690aedd1
MB
20390case "$sGMTIME_min/$sGMTIME_max" in
20391 0/0|/)
20392 $cat >try.c <<EOCP
81c4fd9e
MB
20393#include <sys/types.h>
20394#include <stdio.h>
20395#include <time.h>
92a3ac59 20396$yyy
81c4fd9e 20397
92a3ac59
MB
20398int i;
20399struct tm *tmp;
20400time_t pt;
20401
1b289682 20402void gm_check (time_t t, int min_year, int max_year)
92a3ac59 20403{
81c4fd9e 20404 tmp = gmtime (&t);
1b289682
MB
20405 if ( tmp == NULL ||
20406 /* Check tm_year overflow */
20407 tmp->tm_year < min_year || tmp->tm_year > max_year)
92a3ac59
MB
20408 tmp = NULL;
20409 else
20410 pt = t;
20411 } /* gm_check */
81c4fd9e 20412
92a3ac59
MB
20413int check_max ()
20414{
73e6e416
MB
20415 tmp = NULL;
20416 pt = 0;
92a3ac59 20417#ifdef MAXLONG
1b289682 20418 gm_check (MAXLONG, 69, 0x7fffffff);
92a3ac59 20419#endif
73e6e416
MB
20420 if (tmp == NULL || tmp->tm_year < 0) {
20421 for (i = 63; i >= 0; i--) {
20422 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20423 if (x < 0 || x < pt) continue;
20424 gm_check (x, 69, 0x7fffffff);
73e6e416
MB
20425 }
20426 }
20427 printf ("sGMTIME_max=%ld\n", pt);
20428 return (0);
1b289682 20429 } /* check_max */
81c4fd9e 20430
92a3ac59
MB
20431int check_min ()
20432{
73e6e416
MB
20433 tmp = NULL;
20434 pt = 0;
92a3ac59 20435#ifdef MINLONG
1b289682 20436 gm_check (MINLONG, -1900, 70);
92a3ac59 20437#endif
73e6e416
MB
20438 if (tmp == NULL) {
20439 for (i = 36; i >= 0; i--) {
20440 time_t x = pt - ((time_t)1 << i);
20441 if (x > 0) continue;
1b289682 20442 gm_check (x, -1900, 70);
73e6e416
MB
20443 }
20444 }
20445 printf ("sGMTIME_min=%ld\n", pt);
20446 return (0);
20447 } /* check_min */
92a3ac59
MB
20448
20449int main (int argc, char *argv[])
20450{
73e6e416
MB
20451 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20452 check_max ();
20453 check_min ();
20454 return (0);
20455 } /* main */
81c4fd9e 20456EOCP
690aedd1
MB
20457 set try
20458 if eval $compile; then
20459 eval `$run ./try`
20460 else
20461 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20462 fi
20463 $rm_try
20464 ;;
20465 esac
81c4fd9e 20466
73e6e416
MB
20467echo "Checking max offsets that localtime () accepts"
20468
690aedd1
MB
20469case "$sLOCALTIME_min/$sLOCALTIME_max" in
20470 0/0|/)
20471 $cat >try.c <<EOCP
73e6e416
MB
20472#include <sys/types.h>
20473#include <stdio.h>
20474#include <time.h>
20475$yyy
20476
20477int i;
20478struct tm *tmp;
20479time_t pt;
20480
1b289682 20481void local_check (time_t t, int min_year, int max_year)
73e6e416 20482{
5bca5c48
MB
20483 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20484 tmp = NULL;
20485 else
20486 tmp = localtime (&t);
1b289682
MB
20487 if ( tmp == NULL ||
20488 /* Check tm_year overflow */
20489 tmp->tm_year < min_year || tmp->tm_year > max_year)
73e6e416
MB
20490 tmp = NULL;
20491 else
20492 pt = t;
20493 } /* local_check */
20494
20495int check_max ()
20496{
20497 tmp = NULL;
20498 pt = 0;
20499#ifdef MAXLONG
1b289682 20500 local_check (MAXLONG, 69, 0x7fffffff);
73e6e416
MB
20501#endif
20502 if (tmp == NULL || tmp->tm_year < 0) {
20503 for (i = 63; i >= 0; i--) {
20504 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20505 if (x < 0 || x < pt) continue;
20506 local_check (x, 69, 0x7fffffff);
73e6e416
MB
20507 }
20508 }
20509 printf ("sLOCALTIME_max=%ld\n", pt);
20510 return (0);
1b289682 20511 } /* check_max */
73e6e416
MB
20512
20513int check_min ()
20514{
20515 tmp = NULL;
20516 pt = 0;
20517#ifdef MINLONG
1b289682 20518 local_check (MINLONG, -1900, 70);
73e6e416
MB
20519#endif
20520 if (tmp == NULL) {
20521 for (i = 36; i >= 0; i--) {
20522 time_t x = pt - ((time_t)1 << i);
20523 if (x > 0) continue;
1b289682 20524 local_check (x, -1900, 70);
73e6e416
MB
20525 }
20526 }
20527 printf ("sLOCALTIME_min=%ld\n", pt);
20528 return (0);
20529 } /* check_min */
20530
20531int main (int argc, char *argv[])
20532{
20533 check_max ();
20534 check_min ();
20535 return (0);
20536 } /* main */
20537EOCP
690aedd1
MB
20538 set try
20539 if eval $compile; then
20540 eval `$run ./try`
20541 else
20542 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20543 fi
20544 $rm_try
20545 ;;
20546 esac
73e6e416 20547
c0bacbef 20548: check for type of arguments to select.
b4eb6b3d
JH
20549case "$selecttype" in
20550'') case "$d_select" in
20551 $define)
20552 echo " "
20553 $cat <<EOM
20554Checking to see what type of arguments are accepted by select().
20555EOM
20556 hdrs="$define sys/types.h
c0bacbef 20557 $i_systime sys/time.h
b4eb6b3d
JH
20558 $i_sysselct sys/select.h
20559 $d_socket sys/socket.h"
20560 : The first arg can be int, unsigned, or size_t
20561 : The last arg may or may not be 'const'
20562 val=''
20563 : void pointer has been seen but using that
20564 : breaks the selectminbits test
20565 for xxx in 'fd_set *' 'int *'; do
20566 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20567 for tmo in 'struct timeval *' 'const struct timeval *'; do
20568 case "$val" in
61c26d18 20569 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
b4eb6b3d
JH
20570 if ./protochk "$try" $hdrs; then
20571 echo "Your system accepts $xxx."
20572 val="$xxx"
20573 fi
20574 ;;
20575 esac
20576 done
20577 done
20578 done
20579 case "$val" in
20580 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20581 case "$d_fd_set" in
20582 $define) dflt="fd_set *" ;;
20583 *) dflt="int *" ;;
20584 esac
20585 . ./myread
20586 val=$ans
20587 ;;
20588 esac
20589 selecttype="$val"
20590 ;;
20591 *) : no select, so pick a harmless default
20592 selecttype='int *'
20593 ;;
20594 esac
20595 ;;
20596esac
20597
20598: check for the select 'width'
20599case "$selectminbits" in
e6e7e605
JH
20600'') safebits=`expr $ptrsize \* 8`
20601 case "$d_select" in
b4eb6b3d
JH
20602 $define)
20603 $cat <<EOM
20604
20605Checking to see on how many bits at a time your select() operates...
20606EOM
20607 $cat >try.c <<EOCP
20608#include <sys/types.h>
20609#$i_time I_TIME
20610#$i_systime I_SYS_TIME
20611#$i_systimek I_SYS_TIME_KERNEL
20612#ifdef I_TIME
20613# include <time.h>
20614#endif
20615#ifdef I_SYS_TIME
20616# ifdef I_SYS_TIME_KERNEL
20617# define KERNEL
20618# endif
20619# include <sys/time.h>
20620# ifdef I_SYS_TIME_KERNEL
20621# undef KERNEL
20622# endif
20623#endif
20624#$i_sysselct I_SYS_SELECT
20625#ifdef I_SYS_SELECT
20626#include <sys/select.h>
20627#endif
20628#$d_socket HAS_SOCKET
20629#ifdef HAS_SOCKET
20630# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20631#endif
20632#include <stdio.h>
d1daaddf
JH
20633#$i_stdlib I_STDLIB
20634#ifdef I_STDLIB
20635#include <stdlib.h>
20636#endif
b4eb6b3d
JH
20637$selecttype b;
20638#define S sizeof(*(b))
20639#define MINBITS 64
20640#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20641#define NBITS (NBYTES * 8)
20642int main() {
7090f861 20643 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
20644 struct timeval t;
20645 int i;
20646 FILE* fp;
20647 int fd;
20648
e6e7e605
JH
20649 if (!s)
20650 exit(1);
b4eb6b3d
JH
20651 fclose(stdin);
20652 fp = fopen("try.c", "r");
20653 if (fp == 0)
e6e7e605 20654 exit(2);
b4eb6b3d
JH
20655 fd = fileno(fp);
20656 if (fd < 0)
e6e7e605 20657 exit(3);
b4eb6b3d
JH
20658 b = ($selecttype)s;
20659 for (i = 0; i < NBITS; i++)
20660 FD_SET(i, b);
20661 t.tv_sec = 0;
20662 t.tv_usec = 0;
20663 select(fd + 1, b, 0, 0, &t);
20664 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 20665 free(s);
b4eb6b3d
JH
20666 printf("%d\n", i + 1);
20667 return 0;
20668}
20669EOCP
20670 set try
20671 if eval $compile_ok; then
5440bc8e 20672 selectminbits=`$run ./try`
b4eb6b3d
JH
20673 case "$selectminbits" in
20674 '') cat >&4 <<EOM
20675Cannot figure out on how many bits at a time your select() operates.
e6e7e605 20676I'll play safe and guess it is $safebits bits.
b4eb6b3d 20677EOM
e6e7e605
JH
20678 selectminbits=$safebits
20679 bits="$safebits bits"
b4eb6b3d
JH
20680 ;;
20681 1) bits="1 bit" ;;
20682 *) bits="$selectminbits bits" ;;
20683 esac
20684 echo "Your select() operates on $bits at a time." >&4
20685 else
20686 rp='What is the minimum number of bits your select() operates on?'
20687 case "$byteorder" in
e6e7e605
JH
20688 12345678) dflt=64 ;;
20689 1234) dflt=32 ;;
b4eb6b3d
JH
20690 *) dflt=1 ;;
20691 esac
20692 . ./myread
20693 val=$ans
20694 selectminbits="$val"
20695 fi
5b813a60 20696 $rm_try
b4eb6b3d
JH
20697 ;;
20698 *) : no select, so pick a harmless default
e6e7e605 20699 selectminbits=$safebits
b4eb6b3d
JH
20700 ;;
20701 esac
20702 ;;
20703esac
20704
20705: Trace out the files included by signal.h, then look for SIGxxx names.
b4eb6b3d
JH
20706if [ "X$fieldn" = X ]; then
20707 : Just make some guesses. We check them later.
20708 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20709else
20710 xxx=`echo '#include <signal.h>' |
20711 $cppstdin $cppminus $cppflags 2>/dev/null |
613d6c3e 20712 $grep '^[ ]*#.*include' |
776a38e3
MB
20713 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20714 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d 20715fi
b4eb6b3d
JH
20716xxxfiles=''
20717for xx in $xxx /dev/null ; do
20718 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20719done
b4eb6b3d
JH
20720case "$xxxfiles" in
20721'') xxxfiles=`./findhdr signal.h` ;;
20722esac
20723xxx=`awk '
20724$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20725 print substr($2, 4, 20)
20726}
20727$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20728 print substr($3, 4, 20)
20729}' $xxxfiles`
20730: Append some common names just in case the awk scan failed.
20731xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20732xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20733xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20734xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20735xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20736
20737: generate a few handy files for later
55954f19 20738$cat > signal.c <<EOCP
b4eb6b3d
JH
20739#include <sys/types.h>
20740#include <signal.h>
55954f19
JH
20741#$i_stdlib I_STDLIB
20742#ifdef I_STDLIB
20743#include <stdlib.h>
20744#endif
b4eb6b3d
JH
20745#include <stdio.h>
20746int main() {
20747
20748/* Strange style to avoid deeply-nested #if/#else/#endif */
20749#ifndef NSIG
20750# ifdef _NSIG
20751# define NSIG (_NSIG)
20752# endif
20753#endif
20754
20755#ifndef NSIG
20756# ifdef SIGMAX
20757# define NSIG (SIGMAX+1)
20758# endif
20759#endif
20760
20761#ifndef NSIG
20762# ifdef SIG_MAX
20763# define NSIG (SIG_MAX+1)
20764# endif
20765#endif
20766
20767#ifndef NSIG
3609ea0d
JH
20768# ifdef _SIG_MAX
20769# define NSIG (_SIG_MAX+1)
20770# endif
20771#endif
20772
20773#ifndef NSIG
b4eb6b3d
JH
20774# ifdef MAXSIG
20775# define NSIG (MAXSIG+1)
20776# endif
20777#endif
20778
20779#ifndef NSIG
20780# ifdef MAX_SIG
20781# define NSIG (MAX_SIG+1)
20782# endif
20783#endif
20784
20785#ifndef NSIG
20786# ifdef SIGARRAYSIZE
3609ea0d 20787# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
20788# endif
20789#endif
20790
20791#ifndef NSIG
20792# ifdef _sys_nsig
20793# define NSIG (_sys_nsig) /* Solaris 2.5 */
20794# endif
20795#endif
20796
20797/* Default to some arbitrary number that's big enough to get most
20798 of the common signals.
20799*/
20800#ifndef NSIG
20801# define NSIG 50
20802#endif
20803
20804printf("NSIG %d\n", NSIG);
20805
20806#ifndef JUST_NSIG
20807
20808EOCP
20809
20810echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20811{
20812 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 20813 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
20814 printf $1; printf ");\n"
20815 printf "#endif\n"
20816}
20817END {
20818 printf "#endif /* JUST_NSIG */\n";
20819 printf "exit(0);\n}\n";
20820}
20821' >>signal.c
20822$cat >signal.awk <<'EOP'
20823BEGIN { ndups = 0 }
65197d93 20824$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20825($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20826 if ($2 > maxsig) { maxsig = $2 }
20827 if (sig_name[$2]) {
20828 dup_name[ndups] = $1
20829 dup_num[ndups] = $2
613d6c3e 20830 ndups++
b4eb6b3d 20831 }
1ebe1ffb 20832 else {
65197d93
JH
20833 sig_name[$2] = $1
20834 sig_num[$2] = $2
b4eb6b3d
JH
20835 }
20836}
613d6c3e 20837END {
b4eb6b3d
JH
20838 if (nsig == 0) {
20839 nsig = maxsig + 1
20840 }
20841 printf("NSIG %d\n", nsig);
20842 for (n = 1; n < nsig; n++) {
20843 if (sig_name[n]) {
20844 printf("%s %d\n", sig_name[n], sig_num[n])
20845 }
20846 else {
613d6c3e 20847 printf("NUM%d %d\n", n, n)
b4eb6b3d
JH
20848 }
20849 }
20850 for (n = 0; n < ndups; n++) {
20851 printf("%s %d\n", dup_name[n], dup_num[n])
20852 }
20853}
20854EOP
20855$cat >signal_cmd <<EOS
20856$startsh
20857if $test -s signal.lst; then
20858 echo "Using your existing signal.lst file"
20859 exit 0
20860fi
20861xxx="$xxx"
20862EOS
20863$cat >>signal_cmd <<'EOS'
20864
20865set signal
20866if eval $compile_ok; then
776a38e3
MB
20867 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20868 $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20869else
20870 echo "(I can't seem be able to compile the whole test program)" >&4
20871 echo "(I'll try it in little pieces.)" >&4
20872 set signal -DJUST_NSIG
20873 if eval $compile_ok; then
5440bc8e 20874 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20875 $cat signal.nsg
20876 else
20877 echo "I can't seem to figure out how many signals you have." >&4
20878 echo "Guessing 50." >&4
20879 echo 'NSIG 50' > signal.nsg
20880 fi
20881 : Now look at all the signal names, one at a time.
20882 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20883 $cat > signal.c <<EOCP
20884#include <sys/types.h>
20885#include <signal.h>
20886#include <stdio.h>
20887int main() {
20888printf("$xx %d\n", SIG${xx});
20889return 0;
20890}
20891EOCP
20892 set signal
20893 if eval $compile; then
20894 echo "SIG${xx} found."
5440bc8e 20895 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20896 else
20897 echo "SIG${xx} NOT found."
20898 fi
20899 done
20900 if $test -s signal.ls1; then
20901 $cat signal.nsg signal.ls1 |
65197d93 20902 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20903 fi
20904
20905fi
20906if $test -s signal.lst; then
20907 :
20908else
20909 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20910 echo 'kill -l' >signal
20911 set X `csh -f <signal`
20912 $rm -f signal
20913 shift
20914 case $# in
20915 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20916 esac
20917 echo $@ | $tr ' ' $trnl | \
20918 $awk '{ printf "%s %d\n", $1, ++s; }
20919 END { printf "NSIG %d\n", ++s }' >signal.lst
20920fi
20921$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20922EOS
20923chmod a+x signal_cmd
20924$eunicefix signal_cmd
20925
20926: generate list of signal names
20927echo " "
20928case "$sig_name_init" in
20929'') doinit=yes ;;
20930*) case "$sig_num_init" in
20931 ''|*,*) doinit=yes ;;
20932 esac ;;
20933esac
20934case "$doinit" in
20935yes)
20936 echo "Generating a list of signal names and numbers..." >&4
20937 . ./signal_cmd
20938 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20939 sig_name=`$awk 'BEGIN { printf "ZERO " }
20940 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20941 sig_num=`$awk 'BEGIN { printf "0 " }
20942 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20943 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
20944 !/^NSIG/ { printf "\"%s\", ", $1 }
20945 END { printf "0\n" }' signal.lst`
20946 sig_num_init=`$awk 'BEGIN { printf "0, " }
20947 !/^NSIG/ { printf "%d, ", $2}
20948 END { printf "0\n"}' signal.lst`
20949 ;;
20950esac
20951echo "The following $sig_count signals are available:"
20952echo " "
20953echo $sig_name | $awk \
20954'BEGIN { linelen = 0 }
20955{
20956 for (i = 1; i <= NF; i++) {
20957 name = "SIG" $i " "
20958 linelen = linelen + length(name)
20959 if (linelen > 70) {
20960 printf "\n"
20961 linelen = length(name)
20962 }
20963 printf "%s", name
20964 }
20965 printf "\n"
20966}'
76d3c696 20967sig_size=`echo $sig_name | awk '{print NF}'`
c0bacbef 20968$rm -f signal signal.c signal.awk signal.lst signal_cmd
b4eb6b3d 20969
613d6c3e 20970: Check size of size
b4eb6b3d
JH
20971echo " "
20972case "$sizetype" in
20973*_t) zzz="$sizetype" ;;
20974*) zzz="filesize" ;;
20975esac
613d6c3e 20976echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
20977cat > try.c <<EOCP
20978#include <sys/types.h>
20979#include <stdio.h>
d1daaddf
JH
20980#$i_stdlib I_STDLIB
20981#ifdef I_STDLIB
20982#include <stdlib.h>
20983#endif
b4eb6b3d
JH
20984int main() {
20985 printf("%d\n", (int)sizeof($sizetype));
20986 exit(0);
20987}
20988EOCP
20989set try
20990if eval $compile_ok; then
5440bc8e 20991 yyy=`$run ./try`
b4eb6b3d
JH
20992 case "$yyy" in
20993 '') sizesize=4
20994 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20995 ;;
20996 *) sizesize=$yyy
20997 echo "Your $zzz size is $sizesize bytes."
20998 ;;
20999 esac
21000else
21001 sizesize=4
21002 echo "(I can't compile the test program--guessing $sizesize.)" >&4
21003fi
21004
21005
21006: check for socklen_t
21007echo " "
21008echo "Checking to see if you have socklen_t..." >&4
21009$cat >try.c <<EOCP
21010#include <sys/types.h>
21011#$d_socket HAS_SOCKET
21012#ifdef HAS_SOCKET
21013#include <sys/socket.h>
21014#endif
21015int main() { socklen_t x = 16; }
21016EOCP
21017set try
21018if eval $compile; then
21019 val="$define"
21020 echo "You have socklen_t."
21021else
21022 val="$undef"
21023 echo "You do not have socklen_t."
21024 case "$sizetype" in
21025 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21026 esac
21027fi
5b813a60 21028$rm_try
b4eb6b3d
JH
21029set d_socklen_t
21030eval $setvar
21031
a7710f8d
JH
21032: see if this is a socks.h system
21033set socks.h i_socks
21034eval $inhdr
21035
b4eb6b3d
JH
21036: check for type of the size argument to socket calls
21037case "$d_socket" in
21038"$define")
21039 $cat <<EOM
21040
21041Checking to see what type is the last argument of accept().
21042EOM
b4eb6b3d
JH
21043 yyy=''
21044 case "$d_socklen_t" in
21045 "$define") yyy="$yyy socklen_t"
21046 esac
21047 yyy="$yyy $sizetype int long unsigned"
21048 for xxx in $yyy; do
21049 case "$socksizetype" in
61c26d18 21050 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
21051 case "$usesocks" in
21052 "$define")
21053 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21054 echo "Your system accepts '$xxx *' for the last argument of accept()."
21055 socksizetype="$xxx"
21056 fi
21057 ;;
21058 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
21059 echo "Your system accepts '$xxx *' for the last argument of accept()."
21060 socksizetype="$xxx"
21061 fi
21062 ;;
21063 esac
b4eb6b3d
JH
21064 ;;
21065 esac
21066 done
21067: In case none of those worked, prompt the user.
21068 case "$socksizetype" in
21069 '') rp='What is the type for socket address structure sizes?'
21070 dflt='int'
21071 . ./myread
21072 socksizetype=$ans
21073 ;;
21074 esac
21075 ;;
21076*) : no sockets, so pick relatively harmless default
21077 socksizetype='int'
21078 ;;
21079esac
21080
21081: see what type is used for signed size_t
21082set ssize_t ssizetype int stdio.h sys/types.h
21083eval $typedef
21084dflt="$ssizetype"
5440bc8e 21085$cat > try.c <<EOM
b4eb6b3d 21086#include <stdio.h>
d1daaddf
JH
21087#$i_stdlib I_STDLIB
21088#ifdef I_STDLIB
21089#include <stdlib.h>
21090#endif
b4eb6b3d
JH
21091#include <sys/types.h>
21092#define Size_t $sizetype
21093#define SSize_t $dflt
21094int main()
21095{
21096 if (sizeof(Size_t) == sizeof(SSize_t))
21097 printf("$dflt\n");
21098 else if (sizeof(Size_t) == sizeof(int))
21099 printf("int\n");
5b813a60 21100 else
b4eb6b3d
JH
21101 printf("long\n");
21102 exit(0);
21103}
21104EOM
21105echo " "
5440bc8e
JH
21106set try
21107if eval $compile_ok && $run ./try > /dev/null; then
21108 ssizetype=`$run ./try`
b4eb6b3d
JH
21109 echo "I'll be using $ssizetype for functions returning a byte count." >&4
21110else
21111 $cat >&4 <<EOM
21112Help! I can't compile and run the ssize_t test program: please enlighten me!
21113(This is probably a misconfiguration in your system or libraries, and
21114you really ought to fix it. Still, I'll try anyway.)
21115
21116I need a type that is the same size as $sizetype, but is guaranteed to
21117be signed. Common values are ssize_t, int and long.
21118
21119EOM
21120 rp="What signed type is the same size as $sizetype?"
21121 . ./myread
21122 ssizetype="$ans"
21123fi
5b813a60 21124$rm_try
b4eb6b3d 21125
668fdbe1
MB
21126: Check the size of st_ino
21127$echo " "
21128$echo "Checking the size of st_ino..." >&4
21129$cat > try.c <<EOCP
21130#include <sys/stat.h>
21131#include <stdio.h>
21132#$i_stdlib I_STDLIB
21133#ifdef I_STDLIB
21134#include <stdlib.h>
21135#endif
21136int main() {
21137 struct stat st;
21138 printf("%d\n", (int)sizeof(st.st_ino));
21139 exit(0);
21140}
21141EOCP
21142set try
21143if eval $compile_ok; then
21144 val=`$run ./try`
21145 case "$val" in
21146 '') st_ino_size=4
21147 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21148 ;;
21149 *) st_ino_size=$val
21150 $echo "Your st_ino is $st_ino_size bytes long."
21151 ;;
21152 esac
21153else
21154 st_ino_size=4
21155 $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21156fi
21157$rm_try
21158
21159: Check if st_ino is signed
21160$echo " "
21161$echo "Checking the sign of st_ino..." >&4
21162$cat > try.c <<EOCP
21163#include <sys/stat.h>
21164#include <stdio.h>
21165int main() {
21166 struct stat foo;
21167 foo.st_ino = -1;
21168 if (foo.st_ino < 0)
21169 printf("-1\n");
21170 else
21171 printf("1\n");
21172}
21173EOCP
21174set try
21175if eval $compile; then
21176 val=`$run ./try`
21177 case "$val" in
21178 '') st_ino_sign=1
21179 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21180 ;;
21181 *) st_ino_sign=$val
21182 case "$st_ino_sign" in
21183 1) $echo "Your st_ino is unsigned." ;;
21184 -1) $echo "Your st_ino is signed." ;;
21185 esac
21186 ;;
21187 esac
21188else
21189 st_ino_sign=1
21190 $echo "(I can't compile the test program--guessing unsigned.)" >&4
21191fi
21192$rm_try
21193
b4eb6b3d
JH
21194: see what type of char stdio uses.
21195echo " "
1d8eaf8c 21196echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
aa517f50 21197if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
21198 echo "Your stdio uses unsigned chars." >&4
21199 stdchar="unsigned char"
21200else
aa517f50
JH
21201 echo "Your stdio uses signed chars." >&4
21202 stdchar="char"
b4eb6b3d 21203fi
1d8eaf8c 21204$rm -f stdioh
b4eb6b3d 21205
b4eb6b3d
JH
21206: see what type uids are declared as in the kernel
21207echo " "
21208echo "Looking for the type for user ids returned by getuid()."
21209set uid_t uidtype xxx stdio.h sys/types.h
21210eval $typedef
21211case "$uidtype" in
21212xxx)
21213 xxx=`./findhdr sys/user.h`
21214 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21215 case $1 in
21216 unsigned) dflt="$1 $2" ;;
21217 *) dflt="$1" ;;
21218 esac
21219 ;;
21220*) dflt="$uidtype";;
21221esac
21222case "$uidtype" in
21223uid_t) echo "uid_t found." ;;
21224*) rp="What is the type for user ids returned by getuid()?"
21225 . ./myread
21226 uidtype="$ans"
21227 ;;
21228esac
21229
613d6c3e 21230: Check size of UID
b4eb6b3d
JH
21231echo " "
21232case "$uidtype" in
21233*_t) zzz="$uidtype" ;;
21234*) zzz="uid" ;;
21235esac
613d6c3e 21236echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21237cat > try.c <<EOCP
21238#include <sys/types.h>
21239#include <stdio.h>
d1daaddf
JH
21240#$i_stdlib I_STDLIB
21241#ifdef I_STDLIB
21242#include <stdlib.h>
21243#endif
b4eb6b3d
JH
21244int main() {
21245 printf("%d\n", (int)sizeof($uidtype));
21246 exit(0);
21247}
21248EOCP
21249set try
21250if eval $compile_ok; then
5440bc8e 21251 yyy=`$run ./try`
b4eb6b3d
JH
21252 case "$yyy" in
21253 '') uidsize=4
21254 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21255 ;;
21256 *) uidsize=$yyy
21257 echo "Your $zzz is $uidsize bytes long."
21258 ;;
21259 esac
21260else
21261 uidsize=4
21262 echo "(I can't compile the test program--guessing $uidsize.)" >&4
21263fi
21264
613d6c3e 21265: Check if UID is signed
b4eb6b3d
JH
21266echo " "
21267case "$uidtype" in
21268*_t) zzz="$uidtype" ;;
21269*) zzz="uid" ;;
21270esac
21271echo "Checking the sign of $zzz..." >&4
21272cat > try.c <<EOCP
21273#include <sys/types.h>
21274#include <stdio.h>
21275int main() {
21276 $uidtype foo = -1;
21277 if (foo < 0)
21278 printf("-1\n");
21279 else
21280 printf("1\n");
21281}
21282EOCP
21283set try
21284if eval $compile; then
5440bc8e 21285 yyy=`$run ./try`
b4eb6b3d
JH
21286 case "$yyy" in
21287 '') uidsign=1
21288 echo "(I can't execute the test program--guessing unsigned.)" >&4
21289 ;;
21290 *) uidsign=$yyy
21291 case "$uidsign" in
21292 1) echo "Your $zzz is unsigned." ;;
21293 -1) echo "Your $zzz is signed." ;;
21294 esac
21295 ;;
21296 esac
21297else
21298 uidsign=1
21299 echo "(I can't compile the test program--guessing unsigned.)" >&4
21300fi
21301
21302
34f1896b 21303: Check format string for UID
b4eb6b3d
JH
21304echo " "
21305$echo "Checking the format string to be used for uids..." >&4
21306
21307case "$uidsign" in
21308-1) if $test X"$uidsize" = X"$ivsize"; then
21309 uidformat="$ivdformat"
21310 else
21311 if $test X"$uidsize" = X"$longsize"; then
21312 uidformat='"ld"'
21313 else
21314 if $test X"$uidsize" = X"$intsize"; then
21315 uidformat='"d"'
21316 else
21317 if $test X"$uidsize" = X"$shortsize"; then
21318 uidformat='"hd"'
21319 fi
21320 fi
21321 fi
21322 fi
21323 ;;
21324*) if $test X"$uidsize" = X"$uvsize"; then
21325 uidformat="$uvuformat"
21326 else
21327 if $test X"$uidsize" = X"$longsize"; then
21328 uidformat='"lu"'
21329 else
21330 if $test X"$uidsize" = X"$intsize"; then
21331 uidformat='"u"'
21332 else
21333 if $test X"$uidsize" = X"$shortsize"; then
21334 uidformat='"hu"'
21335 fi
21336 fi
21337 fi
21338 fi
21339 ;;
21340esac
21341
d78f9ffa
MB
21342: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21343echo " "
21344echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21345$cat >try.c <<'EOM'
21346/* Intentionally a long probe as I'd like to sanity check that the exact
21347 approach is going to work, as thinking it will work, but only having it
21348 part working at runtime is worse than not having it. */
21349
21350#include <sys/types.h>
21351#include <sys/sysctl.h>
21352#include <sys/param.h>
21353#include <stdio.h>
21354#include <string.h>
21355#include <stdlib.h>
21356#include <unistd.h>
21357
21358int
21359main(int argc, char **argv) {
21360 char *buffer;
21361 char *argv_leaf = strrchr(argv[0], '/');
21362 char *buffer_leaf;
21363 size_t size = 0;
21364 int mib[4];
21365
21366 mib[0] = CTL_KERN;
21367 mib[1] = KERN_PROC;
21368 mib[2] = KERN_PROC_PATHNAME;
21369 mib[3] = -1;
21370
21371 if (!argv_leaf) {
21372 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21373 return 1;
21374 }
21375
21376 if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21377 perror("sysctl");
21378 return 2;
21379 }
21380
21381 if (size < strlen(argv_leaf) + 1) {
21382 fprintf(stderr, "size %lu is too short for a path\n",
21383 (unsigned long) size);
21384 return 3;
21385 }
21386
21387 if (size > MAXPATHLEN * MAXPATHLEN) {
21388 fprintf(stderr, "size %lu is too long for a path\n",
21389 (unsigned long) size);
21390 return 4;
21391 }
21392
21393 buffer = malloc(size);
21394 if (!buffer) {
21395 perror("malloc");
21396 return 5;
21397 }
21398
21399 if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21400 perror("sysctl");
21401 return 6;
21402 }
21403
21404 if (strlen(buffer) + 1 != size) {
21405 fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21406 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21407 return 7;
21408 }
21409
21410
21411 if (*buffer != '/') {
21412 fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21413 return 8;
21414 }
21415
21416 if (strstr(buffer, "/./")) {
21417 fprintf(stderr, "Contains /./: '%s'\n", buffer);
21418 return 9;
21419 }
21420
21421 if (strstr(buffer, "/../")) {
21422 fprintf(stderr, "Contains /../: '%s'\n", buffer);
21423 return 10;
21424 }
21425
21426 buffer_leaf = strrchr(buffer, '/');
21427 if (strcmp(buffer_leaf, argv_leaf) != 0) {
21428 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21429 return 11;
21430 }
21431
21432 free(buffer);
21433
21434 return 0;
21435}
21436EOM
21437
21438val=$undef
21439set try
21440if eval $compile_ok; then
21441 if $run ./try; then
21442 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21443 val="$define"
21444 else
21445 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21446 val="$undef"
21447 fi
21448else
21449 echo "I'm unable to compile the test program." >&4
21450 echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21451 val="$undef"
21452fi
21453$rm_try
21454set usekernprocpathname
21455eval $setvar
21456
21457: Determine if we can use _NSGetExecutablePath to find executing program
21458echo " "
21459echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21460$cat >try.c <<'EOM'
21461/* Intentionally a long probe as I'd like to sanity check that the exact
21462 approach is going to work, as thinking it will work, but only having it
21463 part working at runtime is worse than not having it. */
21464#include <mach-o/dyld.h>
21465#include <stdio.h>
21466#include <stdlib.h>
21467#include <sys/param.h>
21468#include <string.h>
21469
21470int
21471main(int argc, char **argv) {
21472 char buf[1];
21473 uint32_t size = sizeof(buf);
21474 int result;
21475 char *buffer;
21476 char *tidied;
21477 char *argv_leaf = strrchr(argv[0], '/');
21478 char *tidied_leaf;
21479
21480 if (!argv_leaf) {
21481 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21482 return 1;
21483 }
21484
21485 _NSGetExecutablePath(buf, &size);
21486 if (size > MAXPATHLEN * MAXPATHLEN) {
21487 fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21488 (unsigned int) size);
21489 return 2;
21490 }
21491
21492 buffer = malloc(size);
21493 if (!buffer) {
21494 perror("malloc");
21495 return 3;
21496 }
21497
21498 result = _NSGetExecutablePath(buffer, &size);
21499 if (result != 0) {
21500 fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21501 result, (unsigned int) size);
21502 return 4;
21503 }
21504
21505 tidied = realpath(buffer, NULL);
21506 if (!tidied) {
21507 perror("realpath");
21508 return 5;
21509 }
21510
21511 free(buffer);
21512
21513 if (*tidied != '/') {
21514 fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21515 return 6;
21516 }
21517
21518 if (strstr(tidied, "/./")) {
21519 fprintf(stderr, "Contains /./: '%s'\n", tidied);
21520 return 7;
21521 }
21522
21523 if (strstr(tidied, "/../")) {
21524 fprintf(stderr, "Contains /../: '%s'\n", tidied);
21525 return 8;
21526 }
21527
21528 tidied_leaf = strrchr(tidied, '/');
21529 if (strcmp(tidied_leaf, argv_leaf) != 0) {
21530 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21531 return 9;
21532 }
21533
21534 free(tidied);
21535
21536 return 0;
21537}
21538EOM
21539
21540val=$undef
21541set try
21542if eval $compile_ok; then
21543 if $run ./try; then
21544 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21545 val="$define"
21546 else
21547 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21548 fi
21549else
21550 echo "I'm unable to compile the test program." >&4
21551 echo "I'll assume no _NSGetExecutablePath here." >&4
21552fi
21553$rm_try
21554set usensgetexecutablepath
21555eval $setvar
21556
34f1896b 21557: Check if site customization support was requested
4afd418c
MB
21558case "$usesitecustomize" in
21559 $define|true|[Yy]*)
21560 usesitecustomize="$define"
21561 ;;
21562 *)
21563 usesitecustomize="$undef"
21564 ;;
21565 esac
21566
d03b3b00
MB
21567: see if prototypes support variable argument declarations
21568echo " "
21569case "$prototype$i_stdarg" in
21570$define$define)
21571 echo "It appears we'll be able to prototype varargs functions." >&4
21572 val="$define"
21573 ;;
21574*)
21575 echo "Too bad... We won't be using prototyped varargs functions..." >&4
21576 val="$undef"
21577 ;;
21578esac
21579set vaproto
21580eval $setvar
21581
3659ebf1
JH
21582: determine compiler compiler
21583case "$yacc" in
21584'')
21585 dflt=yacc;;
21586*)
21587 dflt="$yacc";;
21588esac
21589echo " "
21590comp='yacc'
3c728e00 21591if $test -f "$byacc$_exe"; then
3659ebf1
JH
21592 dflt="$byacc"
21593 comp="byacc or $comp"
21594fi
3c728e00 21595if $test -f "$bison$_exe"; then
3659ebf1
JH
21596 comp="$comp or bison -y"
21597fi
21598rp="Which compiler compiler ($comp) shall I use?"
21599. ./myread
21600yacc="$ans"
21601case "$yacc" in
21602*bis*)
21603 case "$yacc" in
21604 *-y*) ;;
21605 *)
21606 yacc="$yacc -y"
21607 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21608 ;;
21609 esac
21610 ;;
21611esac
21612
c0bacbef
MB
21613: see if this is a assert.h system
21614set assert.h i_assert
21615eval $inhdr
21616
758a5d79
JH
21617: see if this is a fp.h system
21618set fp.h i_fp
21619eval $inhdr
21620
21621: see if this is a fp_class.h system
21622set fp_class.h i_fp_class
21623eval $inhdr
21624
13cfc98d
MB
21625: see if gdbm.h is available
21626set gdbm.h t_gdbm
21627eval $inhdr
21628case "$t_gdbm" in
21629$define)
21630 : see if gdbm_open exists
21631 set gdbm_open d_gdbm_open
21632 eval $inlibc
21633 case "$d_gdbm_open" in
21634 $undef)
21635 t_gdbm="$undef"
21636 echo "We won't be including <gdbm.h>"
21637 ;;
21638 esac
21639 ;;
21640esac
21641val="$t_gdbm"
21642set i_gdbm
21643eval $setvar
21644
b2f871ed
AD
21645: see if this is a ieeefp.h system
21646case "$i_ieeefp" in
21647'' ) set ieeefp.h i_ieeefp
21648 eval $inhdr
21649 ;;
21650esac
21651
21652: see if this is a libutil.h system
21653set libutil.h i_libutil
21654eval $inhdr
21655
21656: see if mach cthreads are available
21657if test "X$usethreads" = "X$define"; then
21658 set mach/cthreads.h i_machcthr
21659 eval $inhdr
21660else
21661 i_machcthr="$undef"
21662fi
21663
21664: see if this is a mntent.h system
21665set mntent.h i_mntent
21666eval $inhdr
21667
b4eb6b3d
JH
21668: see if net/errno.h is available
21669val=''
21670set net/errno.h val
21671eval $inhdr
21672
21673: Unfortunately, it causes problems on some systems. Arrgh.
21674case "$val" in
21675$define)
21676 cat > try.c <<'EOM'
21677#include <stdio.h>
21678#include <errno.h>
21679#include <net/errno.h>
21680int func()
21681{
21682 return ENOTSOCK;
21683}
21684EOM
21685 if $cc $ccflags -c try.c >/dev/null 2>&1; then
21686 echo "We'll be including <net/errno.h>." >&4
21687 else
21688 echo "We won't be including <net/errno.h>." >&4
21689 val="$undef"
21690 fi
5b813a60 21691 $rm_try
b4eb6b3d
JH
21692 ;;
21693esac
21694set i_neterrno
21695eval $setvar
21696
21697: see if netinet/tcp.h is available
21698set netinet/tcp.h i_netinettcp
21699eval $inhdr
21700
21701: see if this is a poll.h system
21702set poll.h i_poll
21703eval $inhdr
21704
21705: see if this is a prot.h system
21706set prot.h i_prot
21707eval $inhdr
21708
613d6c3e 21709: Preprocessor symbols
b4eb6b3d 21710echo " "
ddfca5da 21711$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
21712$cat <<'EOSH' > Cppsym.know
21713a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21714AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 21715alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
21716ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21717BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
21718BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21719bull c cadmus clipper CMU COFF COMPILER_VERSION
21720concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 21721CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
21722Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21723FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21724GLIBC GLIBC_MINOR
21725GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
21726H3050R H3050RX hbullx20 hcx host_mips
21727hp200 hp300 hp700 HP700 hp800 hp9000
21728hp9000s200 hp9000s300 hp9000s400 hp9000s500
21729hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21730i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 21731IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
21732INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21733LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21734LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 21735LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
21736LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21737M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21738M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21739M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21740MATH_HAS_NO_SIDE_EFFECTS
21741mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21742mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21743mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21744MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21745mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21746NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 21747news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
21748ns32016 ns32332 ns32k nsc32000
21749OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21750pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21751pc532 pdp11 PGC PIC plexus PORTAR posix
21752POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21753POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 21754PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 21755riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
21756SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21757sony sony_news sonyrisc sparc sparclite spectrum
21758stardent stdc STDC_EXT stratos sun sun3 sun386
21759Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21760SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21761SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21762sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 21763TM3200 TM5400 TM5600
b4eb6b3d
JH
21764tower tower32 tower32_200 tower32_600 tower32_700
21765tower32_800 tower32_850 tss
21766u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21767ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
21768unix UNIX95 UNIX99 unixpc unos
21769USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21770USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21771USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21772USGr4 USGr4_2
44c87379 21773Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
21774XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21775XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21776z8000
21777EOSH
21778# Maybe put other stuff here too.
21779cat <<EOSH >>Cppsym.know
21780$osname
21781EOSH
21782./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21783./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21784$cat Cppsym.know > Cppsym.c
381aa1ff 21785$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
21786$rm -f Cppsym.a Cppsym.b Cppsym.c
21787cat <<EOSH > Cppsym
21788$startsh
21789if $test \$# -gt 0; then
21790 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21791 if $test -s Cppsym.got; then
21792 $rm -f Cppsym.got
21793 exit 0
21794 fi
21795 $rm -f Cppsym.got
21796 exit 1
21797else
21798 $tr " " "$trnl" | ./Cppsym.try
21799 exit 0
21800fi
21801EOSH
21802chmod +x Cppsym
21803$eunicefix Cppsym
21804cat <<EOSH > Cppsym.try
21805$startsh
21806cat <<'EOCP' > try.c
21807#include <stdio.h>
360321b3
YST
21808#if cpp_stuff == 1
21809#define STRINGIFY(a) "a"
21810#endif
21811#if cpp_stuff == 42
21812#define StGiFy(a) #a
21813#define STRINGIFY(a) StGiFy(a)
21814#endif
21815#if $cpp_stuff != 1 && $cpp_stuff != 42
21816# include "Bletch: How does this C preprocessor stringify macros?"
21817#endif
b4eb6b3d
JH
21818int main() {
21819EOCP
21820$awk \\
21821EOSH
21822cat <<'EOSH' >> Cppsym.try
21823'length($1) > 0 {
360321b3
YST
21824 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21825 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21826 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21827 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 21828}' >> try.c
2ef53570 21829echo 'return 0;}' >> try.c
b4eb6b3d
JH
21830EOSH
21831cat <<EOSH >> Cppsym.try
21832ccflags="$ccflags"
21833case "$osname-$gccversion" in
21834irix-) ccflags="\$ccflags -woff 1178" ;;
21835os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21836esac
360321b3 21837$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
21838EOSH
21839chmod +x Cppsym.try
21840$eunicefix Cppsym.try
21841./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 21842: Add in any linux cpp "predefined macros":
b6a7163e 21843case "$osname::$gccversion" in
eeb92b76 21844 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
b6a7163e
MB
21845 tHdrH=_tmpHdr
21846 rm -f $tHdrH'.h' $tHdrH
21847 touch $tHdrH'.h'
6f5be6d1 21848 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
b6a7163e
MB
21849 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21850 if [ -s $tHdrH'_cppsym.real' ]; then
21851 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21852 fi
21853 fi
21854 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21855 ;;
21856esac
b4eb6b3d
JH
21857: now check the C compiler for additional symbols
21858postprocess_cc_v=''
21859case "$osname" in
21860aix) postprocess_cc_v="|$tr , ' '" ;;
21861esac
21862$cat >ccsym <<EOS
21863$startsh
21864$cat >tmp.c <<EOF
21865extern int foo;
21866EOF
21867for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21868do
21869 case "\$i" in
21870 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 21871 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
21872 esac
21873done
5b813a60 21874$rm_try
b4eb6b3d
JH
21875EOS
21876postprocess_cc_v=''
21877chmod +x ccsym
21878$eunicefix ccsym
21879./ccsym > ccsym1.raw
21880if $test -s ccsym1.raw; then
21881 $sort ccsym1.raw | $uniq >ccsym.raw
21882else
21883 mv ccsym1.raw ccsym.raw
21884fi
21885
21886$awk '/\=/ { print $0; next }
21887 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
21888$comm -13 Cppsym.true ccsym.list >ccsym.own
21889$comm -12 Cppsym.true ccsym.list >ccsym.com
21890$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
21891also=''
21892if $test -z ccsym.raw; then
21893 echo "Your C compiler doesn't seem to define any symbols!" >&4
21894 echo " "
21895 echo "However, your C preprocessor defines the following symbols:"
21896 $cat Cppsym.true
21897 ccsymbols=''
21898 cppsymbols=`$cat Cppsym.true`
21899 cppsymbols=`echo $cppsymbols`
21900 cppccsymbols="$cppsymbols"
21901else
21902 if $test -s ccsym.com; then
21903 echo "Your C compiler and pre-processor define these symbols:"
21904 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21905 also='also '
21906 symbols='ones'
21907 cppccsymbols=`$cat ccsym.com`
21908 cppccsymbols=`echo $cppccsymbols`
21909 $test "$silent" || sleep 1
21910 fi
21911 if $test -s ccsym.cpp; then
21912 $test "$also" && echo " "
21913 echo "Your C pre-processor ${also}defines the following symbols:"
21914 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21915 also='further '
21916 cppsymbols=`$cat ccsym.cpp`
21917 cppsymbols=`echo $cppsymbols`
21918 $test "$silent" || sleep 1
21919 fi
21920 if $test -s ccsym.own; then
21921 $test "$also" && echo " "
21922 echo "Your C compiler ${also}defines the following cpp symbols:"
21923 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21924 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21925 ccsymbols=`$cat ccsym.own`
21926 ccsymbols=`echo $ccsymbols`
21927 $test "$silent" || sleep 1
21928 fi
21929fi
b4eb6b3d
JH
21930
21931: see if this is a termio system
21932val="$undef"
21933val2="$undef"
21934val3="$undef"
21935if $test `./findhdr termios.h`; then
21936 set tcsetattr i_termios
21937 eval $inlibc
21938 val3="$i_termios"
21939fi
21940echo " "
21941case "$val3" in
21942"$define") echo "You have POSIX termios.h... good!" >&4;;
21943*) if ./Cppsym pyr; then
21944 case "`/bin/universe`" in
21945 ucb) if $test `./findhdr sgtty.h`; then
21946 val2="$define"
21947 echo "<sgtty.h> found." >&4
21948 else
21949 echo "System is pyramid with BSD universe."
216dac04 21950 ./warn "<sgtty.h> not found--you could have problems."
b4eb6b3d
JH
21951 fi;;
21952 *) if $test `./findhdr termio.h`; then
21953 val="$define"
21954 echo "<termio.h> found." >&4
21955 else
21956 echo "System is pyramid with USG universe."
216dac04 21957 ./warn "<termio.h> not found--you could have problems."
b4eb6b3d
JH
21958 fi;;
21959 esac
21960 elif ./usg; then
21961 if $test `./findhdr termio.h`; then
21962 echo "<termio.h> found." >&4
21963 val="$define"
21964 elif $test `./findhdr sgtty.h`; then
21965 echo "<sgtty.h> found." >&4
21966 val2="$define"
21967 else
216dac04 21968 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
b4eb6b3d
JH
21969 fi
21970 else
21971 if $test `./findhdr sgtty.h`; then
21972 echo "<sgtty.h> found." >&4
21973 val2="$define"
21974 elif $test `./findhdr termio.h`; then
21975 echo "<termio.h> found." >&4
21976 val="$define"
21977 else
216dac04 21978 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
b4eb6b3d
JH
21979 fi
21980 fi;;
21981esac
21982set i_termio; eval $setvar
21983val=$val2; set i_sgtty; eval $setvar
21984val=$val3; set i_termios; eval $setvar
21985
bd31be4b 21986: see if stdbool is available
0dcb3d88
MB
21987: we want a real compile instead of Inhdr because some Solaris systems
21988: have stdbool.h, but it can only be used if the compiler indicates it
21989: is sufficiently c99-compliant.
21990echo " "
21991$cat >try.c <<EOCP
21992#include <stdio.h>
21993#include <stdbool.h>
21994int func(bool x)
21995{
21996 return x ? 1 : 0;
21997}
21998int main(int argc, char **argv)
21999{
22000 return func(0);
22001}
22002EOCP
22003set try
22004if eval $compile; then
22005 echo "<stdbool.h> found." >&4
22006 val="$define"
22007else
22008 echo "<stdbool.h> NOT found." >&4
22009 val="$undef"
22010fi
22011$rm_try
22012set i_stdbool
22013eval $setvar
bd31be4b 22014
b4eb6b3d
JH
22015: see if stddef is available
22016set stddef.h i_stddef
22017eval $inhdr
923fc586 22018
b4eb6b3d
JH
22019: see if sys/access.h is available
22020set sys/access.h i_sysaccess
22021eval $inhdr
22022
22023: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22024set sys/filio.h i_sysfilio
22025eval $inhdr
22026echo " "
22027if $test `./findhdr sys/ioctl.h`; then
22028 val="$define"
22029 echo '<sys/ioctl.h> found.' >&4
22030else
22031 val="$undef"
22032 if $test $i_sysfilio = "$define"; then
22033 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 22034 else
b4eb6b3d
JH
22035 $test $i_sgtty = "$define" && xxx="sgtty.h"
22036 $test $i_termio = "$define" && xxx="termio.h"
22037 $test $i_termios = "$define" && xxx="termios.h"
22038echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22039 fi
22040fi
22041set i_sysioctl
22042eval $setvar
22043
49a78c82
JH
22044: see if socket ioctl defs are in sys/sockio.h
22045echo " "
22046xxx=`./findhdr sys/sockio.h`
22047if $test "$xxx"; then
22048 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22049 val="$define"
22050 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22051 else
22052 val="$undef"
22053 echo "No socket ioctls found in <sys/sockio.h>." >&4
22054 fi
22055else
22056 val="$undef"
22057 $cat <<EOM
22058<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22059EOM
22060fi
22061set i_syssockio
22062eval $setvar
22063
b4eb6b3d
JH
22064: see if this is a syslog.h system
22065set syslog.h i_syslog
22066eval $inhdr
22067
b4eb6b3d
JH
22068: see if this is a sys/mode.h system
22069set sys/mode.h i_sysmode
22070eval $inhdr
22071
216dac04
MB
22072: see if there is a sys/poll.h file
22073set sys/poll.h i_syspoll
22074eval $inhdr
22075
b4eb6b3d
JH
22076: see if sys/resource.h has to be included
22077set sys/resource.h i_sysresrc
22078eval $inhdr
22079
22080: see if sys/security.h is available
22081set sys/security.h i_syssecrt
22082eval $inhdr
22083
22084: see if this is a sys/statvfs.h system
22085set sys/statvfs.h i_sysstatvfs
22086eval $inhdr
22087
b4eb6b3d
JH
22088: see if this is a sys/un.h system
22089set sys/un.h i_sysun
22090eval $inhdr
22091
b4eb6b3d
JH
22092: see if this is a sys/utsname.h system
22093set sys/utsname.h i_sysutsname
22094eval $inhdr
22095
22096: see if this is a syswait system
22097set sys/wait.h i_syswait
22098eval $inhdr
22099
22100: see if this is a ustat.h system
22101set ustat.h i_ustat
22102eval $inhdr
22103
22104: see if this is an utime system
22105set utime.h i_utime
22106eval $inhdr
22107
b4eb6b3d
JH
22108: see if this is a vfork system
22109case "$d_vfork" in
22110"$define")
22111 set vfork.h i_vfork
22112 eval $inhdr
22113 ;;
22114*)
22115 i_vfork="$undef"
22116 ;;
22117esac
22118
613d6c3e 22119: Check extensions
b4eb6b3d
JH
22120echo " "
22121echo "Looking for extensions..." >&4
22122: If we are using the old config.sh, known_extensions may contain
22123: old or inaccurate or duplicate values.
22124known_extensions=''
22125nonxs_extensions=''
22126: We do not use find because it might not be available.
22127: We do not just use MANIFEST because the user may have dropped
22128: some additional extensions into the source tree and expect them
22129: to be built.
22130
38fddf8b
MB
22131: Function to recursively find available extensions, ignoring DynaLoader
22132: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
4cc80fc4 22133: In 5.10.1 and later, extensions are stored in directories
88a6f4fc 22134: like File-Glob instead of the older File/Glob/.
b4eb6b3d
JH
22135find_extensions='
22136 for xxx in *; do
822a6ee0
MB
22137 case "$xxx" in
22138 DynaLoader|dynaload) ;;
22139 *)
238a6851
NC
22140 this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22141 leaf=`echo $xxx | $sed -e s/.*-//`;
dd6c21be 22142 if $test -d File; then
38fddf8b
MB
22143 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22144 known_extensions="$known_extensions $1$this_ext";
22145 elif $test -f $xxx/Makefile.PL; then
22146 nonxs_extensions="$nonxs_extensions $1$this_ext";
22147 else
22148 if $test -d $xxx -a $# -lt 10; then
22149 set $1$xxx/ $*;
22150 cd "$xxx";
22151 eval $find_extensions;
22152 cd ..;
22153 shift;
22154 fi;
22155 fi;
dd6c21be
NC
22156 else
22157 $ls -1 $xxx > $$.tmp;
22158 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22159 known_extensions="$known_extensions $this_ext";
22160 elif $contains "\.c$" $$.tmp > /dev/null 2>&1; then
22161 known_extensions="$known_extensions $this_ext";
dd6c21be
NC
22162 elif $test -d $xxx; then
22163 nonxs_extensions="$nonxs_extensions $this_ext";
22164 fi;
22165 $rm -f $$.tmp;
822a6ee0
MB
22166 fi
22167 ;;
22168 esac;
b4eb6b3d
JH
22169 done'
22170tdir=`pwd`
dd6c21be
NC
22171cd "$rsrc/cpan"
22172set X
22173shift
22174eval $find_extensions
a193a2db
NC
22175cd "$rsrc/dist"
22176set X
22177shift
22178eval $find_extensions
6904989c 22179cd "$rsrc/ext"
b4eb6b3d
JH
22180set X
22181shift
22182eval $find_extensions
38fddf8b
MB
22183if $test -d File-Glob; then
22184 : All ext/ flattened
22185else
22186 # Special case: Add in modules that nest beyond the first level.
22187 # Currently threads/shared and Hash/Util/FieldHash, since they are
22188 # not picked up by the recursive find above (and adding in general
22189 # recursive finding breaks SDBM_File/sdbm).
22190 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22191 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22192fi
faae14e6
MB
22193set X $known_extensions
22194shift
a32b3e13 22195known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
b4eb6b3d
JH
22196set X $nonxs_extensions
22197shift
a32b3e13 22198nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
6904989c 22199cd "$tdir"
b4eb6b3d
JH
22200
22201: Now see which are supported on this system.
22202avail_ext=''
22203for xxx in $known_extensions ; do
22204 case "$xxx" in
22205 DB_File|db_file)
22206 case "$i_db" in
22207 $define) avail_ext="$avail_ext $xxx" ;;
22208 esac
22209 ;;
22210 GDBM_File|gdbm_fil)
7c345082 22211 case "$i_gdbm" in
b4eb6b3d
JH
22212 $define) avail_ext="$avail_ext $xxx" ;;
22213 esac
22214 ;;
1d59c593 22215 I18N/Langinfo|i18n_lan)
7c345082 22216 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
22217 $define$define) avail_ext="$avail_ext $xxx" ;;
22218 esac
22219 ;;
7978b0db
JH
22220 IPC/SysV|ipc/sysv)
22221 : XXX Do we need a useipcsysv variable here
22222 case "${d_msg}${d_sem}${d_shm}" in
22223 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22224 esac
22225 ;;
b4eb6b3d 22226 NDBM_File|ndbm_fil)
7894ad66 22227 case "$d_ndbm" in
b4eb6b3d
JH
22228 $define)
22229 case "$osname-$use64bitint" in
0be9fa5d 22230 hpux-define)
b4eb6b3d
JH
22231 case "$libs" in
22232 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22233 esac
22234 ;;
22235 *) avail_ext="$avail_ext $xxx" ;;
22236 esac
22237 ;;
22238 esac
22239 ;;
7c345082 22240 ODBM_File|odbm_fil)
b4eb6b3d
JH
22241 case "${i_dbm}${i_rpcsvcdbm}" in
22242 *"${define}"*)
7978b0db
JH
22243 case "$d_cplusplus" in
22244 define) ;; # delete as a function name will not work
22245 *) case "$osname-$use64bitint" in
22246 hpux-define)
22247 case "$libs" in
22248 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22249 esac
22250 ;;
22251 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
22252 esac
22253 ;;
b4eb6b3d
JH
22254 esac
22255 ;;
22256 esac
22257 ;;
7978b0db
JH
22258 Opcode|opcode)
22259 case "$useopcode" in
b4eb6b3d
JH
22260 true|define|y) avail_ext="$avail_ext $xxx" ;;
22261 esac
22262 ;;
7978b0db
JH
22263 POSIX|posix)
22264 case "$useposix" in
b4eb6b3d
JH
22265 true|define|y) avail_ext="$avail_ext $xxx" ;;
22266 esac
22267 ;;
22268 Socket|socket)
7c345082 22269 case "$d_socket" in
4a9f028c
JH
22270 true|$define|y)
22271 case "$osname" in
22272 beos) ;; # not unless BONE
22273 *) avail_ext="$avail_ext $xxx" ;;
22274 esac
22275 ;;
b4eb6b3d
JH
22276 esac
22277 ;;
22278 Sys/Syslog|sys/syslog)
22279 : XXX syslog requires socket
7c345082 22280 case "$d_socket" in
b4eb6b3d
JH
22281 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22282 esac
22283 ;;
22284 Thread|thread)
b00ec89b
AB
22285 case "$usethreads" in
22286 true|$define|y)
47f9f84c 22287 case "$use5005threads" in
3f30fabf 22288 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 22289 esac
b4eb6b3d
JH
22290 esac
22291 ;;
7978b0db
JH
22292 threads|threads/shared)
22293 # threads and threads::shared are special cases.
22294 # To stop people from asking "Perl 5.8.0 was supposed
22295 # to have this new fancy threads implementation but my
22296 # perl doesn't have it" and from people trying to
22297 # (re)install the threads module using CPAN.pm and
22298 # CPAN.pm then offering to reinstall Perl 5.8.0,
22299 # the threads.pm and threads/shared.pm will always be
22300 # there, croaking informatively ("you need to rebuild
22301 # all of Perl with threads, sorry") when threads haven't
22302 # been compiled in.
22303 # --jhi
22304 avail_ext="$avail_ext $xxx"
22305 ;;
aefe3e7e
NC
22306 VMS*)
22307 ;;
78ff2d7b 22308 Win32*)
b149d92d
JD
22309 case "$osname" in
22310 cygwin) avail_ext="$avail_ext $xxx" ;;
22311 esac
22312 ;;
f9b6ed1c
AD
22313 XS/APItest|xs/apitest)
22314 # This is just for testing. Skip it unless we have dynamic loading.
88e1f1a2
JV
22315
22316 case "$usedl" in
22317 $define) avail_ext="$avail_ext $xxx" ;;
22318 esac
22319 ;;
f9b6ed1c
AD
22320 XS/Typemap|xs/typemap)
22321 # This is just for testing. Skip it unless we have dynamic loading.
22322 case "$usedl" in
22323 $define) avail_ext="$avail_ext $xxx" ;;
22324 esac
22325 ;;
b4eb6b3d 22326 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
22327 ;;
22328 esac
b4eb6b3d 22329done
5f80c64f 22330
b4eb6b3d
JH
22331set X $avail_ext
22332shift
22333avail_ext="$*"
5f80c64f 22334
ef0c5be8
JH
22335case "$onlyextensions" in
22336'') ;;
22337*) keepextensions=''
cd95ead5 22338 echo "You have requested that only certain extensions be included..." >&4
ef0c5be8
JH
22339 for i in $onlyextensions; do
22340 case " $avail_ext " in
22341 *" $i "*)
22342 echo "Keeping extension $i."
22343 keepextensions="$keepextensions $i"
22344 ;;
22345 *) echo "Ignoring extension $i." ;;
22346 esac
22347 done
22348 avail_ext="$keepextensions"
22349 ;;
22350esac
22351
22352case "$noextensions" in
22353'') ;;
22354*) keepextensions=''
22355 echo "You have requested that certain extensions be ignored..." >&4
22356 for i in $avail_ext; do
c3dadc13
AD
22357 case " $noextensions " in
22358 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
22359 *) echo "Keeping extension $i.";
22360 keepextensions="$keepextensions $i"
22361 ;;
22362 esac
22363 done
22364 avail_ext="$keepextensions"
22365 ;;
22366esac
22367
b4eb6b3d
JH
22368: Now see which nonxs extensions are supported on this system.
22369: For now assume all are.
22370nonxs_ext=''
22371for xxx in $nonxs_extensions ; do
22372 case "$xxx" in
22373 *) nonxs_ext="$nonxs_ext $xxx"
22374 ;;
22375 esac
22376done
5f80c64f 22377
b4eb6b3d
JH
22378set X $nonxs_ext
22379shift
22380nonxs_ext="$*"
22381
22382case $usedl in
22383$define)
22384 $cat <<EOM
22385A number of extensions are supplied with $package. You may choose to
22386compile these extensions for dynamic loading (the default), compile
22387them into the $package executable (static loading), or not include
22388them at all. Answer "none" to include no extensions.
22389Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
22390
22391EOM
b4eb6b3d 22392 case "$dynamic_ext" in
736accd3
YST
22393 '')
22394 : Exclude those listed in static_ext
22395 dflt=''
22396 for xxx in $avail_ext; do
22397 case " $static_ext " in
22398 *" $xxx "*) ;;
22399 *) dflt="$dflt $xxx" ;;
22400 esac
22401 done
22402 set X $dflt
22403 shift
22404 dflt="$*"
22405 ;;
b4eb6b3d
JH
22406 *) dflt="$dynamic_ext"
22407 # Perhaps we are reusing an old out-of-date config.sh.
22408 case "$hint" in
22409 previous)
22410 if test X"$dynamic_ext" != X"$avail_ext"; then
22411 $cat <<EOM
7c345082
RGS
22412NOTICE: Your previous config.sh list may be incorrect.
22413The extensions now available to you are
b4eb6b3d
JH
22414 ${avail_ext}
22415but the default list from your previous config.sh is
7c345082 22416 ${dynamic_ext}
9c839522 22417
b4eb6b3d
JH
22418EOM
22419 fi
9c839522
PM
22420 ;;
22421 esac
b4eb6b3d
JH
22422 ;;
22423 esac
5f80c64f 22424 case "$dflt" in
b4eb6b3d
JH
22425 '') dflt=none;;
22426 esac
22427 rp="What extensions do you wish to load dynamically?"
22428 . ./myread
22429 case "$ans" in
22430 none) dynamic_ext=' ' ;;
22431 *) dynamic_ext="$ans" ;;
5f80c64f 22432 esac
5f80c64f 22433
b4eb6b3d
JH
22434 case "$static_ext" in
22435 '')
22436 : Exclude those already listed in dynamic linking
22437 dflt=''
22438 for xxx in $avail_ext; do
22439 case " $dynamic_ext " in
22440 *" $xxx "*) ;;
22441 *) dflt="$dflt $xxx" ;;
22442 esac
22443 done
22444 set X $dflt
22445 shift
22446 dflt="$*"
22447 ;;
7c345082 22448 *) dflt="$static_ext"
b4eb6b3d
JH
22449 ;;
22450 esac
9c839522 22451
b4eb6b3d
JH
22452 case "$dflt" in
22453 '') dflt=none;;
22454 esac
22455 rp="What extensions do you wish to load statically?"
22456 . ./myread
22457 case "$ans" in
22458 none) static_ext=' ' ;;
22459 *) static_ext="$ans" ;;
22460 esac
22461 ;;
22462*)
22463 $cat <<EOM
7c345082
RGS
22464A number of extensions are supplied with $package. Answer "none"
22465to include no extensions.
b4eb6b3d 22466Note that DynaLoader is always built and need not be mentioned here.
9c839522 22467
b4eb6b3d
JH
22468EOM
22469 case "$static_ext" in
22470 '') dflt="$avail_ext" ;;
22471 *) dflt="$static_ext"
22472 # Perhaps we are reusing an old out-of-date config.sh.
22473 case "$hint" in
22474 previous)
22475 if test X"$static_ext" != X"$avail_ext"; then
22476 $cat <<EOM
7c345082
RGS
22477NOTICE: Your previous config.sh list may be incorrect.
22478The extensions now available to you are
b4eb6b3d
JH
22479 ${avail_ext}
22480but the default list from your previous config.sh is
7c345082 22481 ${static_ext}
5f80c64f
JH
22482
22483EOM
b4eb6b3d
JH
22484 fi
22485 ;;
22486 esac
22487 ;;
22488 esac
22489 : Exclude those that are not xs extensions
22490 case "$dflt" in
22491 '') dflt=none;;
22492 esac
22493 rp="What extensions do you wish to include?"
22494 . ./myread
22495 case "$ans" in
22496 none) static_ext=' ' ;;
22497 *) static_ext="$ans" ;;
22498 esac
22499 ;;
5f80c64f 22500esac
7c345082 22501#
f1f6834f
AD
22502# Encode is a special case. If we are building Encode as a static
22503# extension, we need to explicitly list its subextensions as well.
22504# For other nested extensions, this is handled automatically by
22505# the appropriate Makefile.PL.
22506case " $static_ext " in
22507 *" Encode "*) # Add the subextensions of Encode
d9a4b459 22508 cd "$rsrc/cpan"
f1f6834f
AD
22509 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22510 static_ext="$static_ext Encode/$xxx"
22511 done
22512 cd "$tdir"
22513 ;;
22514esac
5f80c64f 22515
b4eb6b3d
JH
22516set X $dynamic_ext $static_ext $nonxs_ext
22517shift
22518extensions="$*"
22519
93a2cd18
AD
22520# Sanity check: We require an extension suitable for use with
22521# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
22522# should show up as failures in the test suite, but it's helpful to
22523# catch them now.) The 'extensions' list is normally sorted
22524# alphabetically, so we need to accept either
22525# DB_File ... Fcntl ... IO ....
22526# or something like
22527# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
22528case " $extensions" in
22529*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22530*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22531*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
22532*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22533 echo "WARNING: The Perl you are building will be quite crippled." >& 4
22534 ;;
22535esac
22536
9c839522
PM
22537: Remove libraries needed only for extensions
22538: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
22539: The exception is SunOS 4.x, which needs them.
22540case "${osname}X${osvers}" in
22541sunos*X4*)
22542 perllibs="$libs"
22543 ;;
22544*) case "$usedl" in
22545 $define|true|[yY]*)
a33f2d9f 22546 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
eedaba54
PM
22547 shift
22548 perllibs="$*"
22549 ;;
22550 *) perllibs="$libs"
22551 ;;
22552 esac
22553 ;;
9c839522 22554esac
5f80c64f
JH
22555
22556: Remove build directory name from cppstdin so it can be used from
22557: either the present location or the final installed location.
22558echo " "
22559: Get out of the UU directory to get correct path name.
22560cd ..
22561case "$cppstdin" in
22562`pwd`/cppstdin)
22563 echo "Stripping down cppstdin path name"
22564 cppstdin=cppstdin
22565 ;;
22566esac
22567cd UU
22568
22569: end of configuration questions
22570echo " "
22571echo "End of configuration questions."
22572echo " "
22573
22574: back to where it started
22575if test -d ../UU; then
22576 cd ..
22577fi
22578
776a38e3 22579: configuration may be unconditionally patched via a 'config.arch' file
48370efc 22580if $test -f config.arch; then
776a38e3 22581 echo "I see a config.arch file, loading it." >&4
48370efc
JH
22582 . ./config.arch
22583fi
22584
5f80c64f
JH
22585: configuration may be patched via a 'config.over' file
22586if $test -f config.over; then
22587 echo " "
22588 dflt=y
22589 rp='I see a config.over file. Do you wish to load it?'
22590 . UU/myread
22591 case "$ans" in
22592 n*) echo "OK, I'll ignore it.";;
22593 *) . ./config.over
22594 echo "Configuration override changes have been loaded."
22595 ;;
22596 esac
22597fi
22598
22599: in case they want portability, strip down executable paths
22600case "$d_portable" in
22601"$define")
22602 echo " "
22603 echo "Stripping down executable paths..." >&4
22604 for file in $loclist $trylist; do
534ac15a
JH
22605 eval temp=\$$file
22606 eval $file=`basename $temp`
5f80c64f
JH
22607 done
22608 ;;
22609esac
22610
22611: create config.sh file
22612echo " "
22613echo "Creating config.sh..." >&4
22614$spitshell <<EOT >config.sh
22615$startsh
22616#
22617# This file was produced by running the Configure script. It holds all the
22618# definitions figured out by Configure. Should you modify one of these values,
22619# do not forget to propagate your changes by running "Configure -der". You may
22620# instead choose to run each of the .SH files by yourself, or "Configure -S".
22621#
22622
22623# Package name : $package
22624# Source directory : $src
22625# Configuration time: $cf_time
22626# Configured by : $cf_by
22627# Target system : $myuname
22628
776a38e3 22629EOT
94a9a4bc 22630: Add in command line options if available
776a38e3 22631$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
94a9a4bc 22632
776a38e3
MB
22633$spitshell <<EOT >>config.sh
22634
5f80c64f
JH
22635Author='$Author'
22636Date='$Date'
22637Header='$Header'
22638Id='$Id'
22639Locker='$Locker'
22640Log='$Log'
5f80c64f
JH
22641RCSfile='$RCSfile'
22642Revision='$Revision'
22643Source='$Source'
22644State='$State'
22645_a='$_a'
22646_exe='$_exe'
22647_o='$_o'
b4eb6b3d 22648afs='$afs'
a6d26a0d 22649afsroot='$afsroot'
b4eb6b3d
JH
22650alignbytes='$alignbytes'
22651ansi2knr='$ansi2knr'
22652aphostname='$aphostname'
22653api_revision='$api_revision'
22654api_subversion='$api_subversion'
22655api_version='$api_version'
22656api_versionstring='$api_versionstring'
5f80c64f 22657ar='$ar'
b4eb6b3d
JH
22658archlib='$archlib'
22659archlibexp='$archlibexp'
22660archname64='$archname64'
22661archname='$archname'
5f80c64f 22662archobjs='$archobjs'
10bc17b6 22663asctime_r_proto='$asctime_r_proto'
5f80c64f 22664awk='$awk'
b4eb6b3d 22665baserev='$baserev'
5f80c64f 22666bash='$bash'
b4eb6b3d 22667bin='$bin'
f1ce3bf1 22668bin_ELF='$bin_ELF'
b4eb6b3d 22669binexp='$binexp'
5f80c64f
JH
22670bison='$bison'
22671byacc='$byacc'
b4eb6b3d 22672byteorder='$byteorder'
5f80c64f 22673c='$c'
b4eb6b3d 22674castflags='$castflags'
5f80c64f
JH
22675cat='$cat'
22676cc='$cc'
22677cccdlflags='$cccdlflags'
22678ccdlflags='$ccdlflags'
22679ccflags='$ccflags'
b4eb6b3d 22680ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 22681ccname='$ccname'
b4eb6b3d 22682ccsymbols='$ccsymbols'
6b356c8e 22683ccversion='$ccversion'
5f80c64f 22684cf_by='$cf_by'
b4eb6b3d 22685cf_email='$cf_email'
5f80c64f 22686cf_time='$cf_time'
c193ef60
MB
22687charbits='$charbits'
22688charsize='$charsize'
5f80c64f
JH
22689chgrp='$chgrp'
22690chmod='$chmod'
22691chown='$chown'
b4eb6b3d 22692clocktype='$clocktype'
5f80c64f
JH
22693comm='$comm'
22694compress='$compress'
22695contains='$contains'
22696cp='$cp'
22697cpio='$cpio'
22698cpp='$cpp'
b4eb6b3d
JH
22699cpp_stuff='$cpp_stuff'
22700cppccsymbols='$cppccsymbols'
5f80c64f
JH
22701cppflags='$cppflags'
22702cpplast='$cpplast'
22703cppminus='$cppminus'
22704cpprun='$cpprun'
22705cppstdin='$cppstdin'
b4eb6b3d 22706cppsymbols='$cppsymbols'
10bc17b6 22707crypt_r_proto='$crypt_r_proto'
b4eb6b3d 22708cryptlib='$cryptlib'
5f80c64f 22709csh='$csh'
10bc17b6
JH
22710ctermid_r_proto='$ctermid_r_proto'
22711ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
22712d_Gconvert='$d_Gconvert'
22713d_PRIEUldbl='$d_PRIEUldbl'
22714d_PRIFUldbl='$d_PRIFUldbl'
22715d_PRIGUldbl='$d_PRIGUldbl'
22716d_PRIXU64='$d_PRIXU64'
22717d_PRId64='$d_PRId64'
22718d_PRIeldbl='$d_PRIeldbl'
22719d_PRIfldbl='$d_PRIfldbl'
22720d_PRIgldbl='$d_PRIgldbl'
22721d_PRIi64='$d_PRIi64'
22722d_PRIo64='$d_PRIo64'
22723d_PRIu64='$d_PRIu64'
22724d_PRIx64='$d_PRIx64'
22725d_SCNfldbl='$d_SCNfldbl'
74cac757 22726d__fwalk='$d__fwalk'
b4eb6b3d
JH
22727d_access='$d_access'
22728d_accessx='$d_accessx'
55954f19 22729d_aintl='$d_aintl'
b4eb6b3d
JH
22730d_alarm='$d_alarm'
22731d_archlib='$d_archlib'
96938616 22732d_asctime64='$d_asctime64'
10bc17b6 22733d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
22734d_atolf='$d_atolf'
22735d_atoll='$d_atoll'
fcdf39cf 22736d_attribute_deprecated='$d_attribute_deprecated'
0dbb1585
AL
22737d_attribute_format='$d_attribute_format'
22738d_attribute_malloc='$d_attribute_malloc'
22739d_attribute_nonnull='$d_attribute_nonnull'
22740d_attribute_noreturn='$d_attribute_noreturn'
22741d_attribute_pure='$d_attribute_pure'
22742d_attribute_unused='$d_attribute_unused'
22743d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
22744d_bcmp='$d_bcmp'
22745d_bcopy='$d_bcopy'
5f80c64f 22746d_bsd='$d_bsd'
b4eb6b3d
JH
22747d_bsdgetpgrp='$d_bsdgetpgrp'
22748d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
22749d_builtin_choose_expr='$d_builtin_choose_expr'
22750d_builtin_expect='$d_builtin_expect'
b4eb6b3d 22751d_bzero='$d_bzero'
a2d23ec2 22752d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
22753d_casti32='$d_casti32'
22754d_castneg='$d_castneg'
22755d_charvspr='$d_charvspr'
22756d_chown='$d_chown'
22757d_chroot='$d_chroot'
22758d_chsize='$d_chsize'
758a5d79 22759d_class='$d_class'
b0a2e8e6 22760d_clearenv='$d_clearenv'
b4eb6b3d 22761d_closedir='$d_closedir'
4e0554ec 22762d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 22763d_const='$d_const'
55954f19 22764d_copysignl='$d_copysignl'
666ea192 22765d_cplusplus='$d_cplusplus'
b4eb6b3d 22766d_crypt='$d_crypt'
10bc17b6 22767d_crypt_r='$d_crypt_r'
b4eb6b3d 22768d_csh='$d_csh'
13cfc98d 22769d_ctermid='$d_ctermid'
10bc17b6 22770d_ctermid_r='$d_ctermid_r'
96938616 22771d_ctime64='$d_ctime64'
10bc17b6 22772d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
22773d_cuserid='$d_cuserid'
22774d_dbl_dig='$d_dbl_dig'
2ef53570 22775d_dbminitproto='$d_dbminitproto'
96938616 22776d_difftime64='$d_difftime64'
b4eb6b3d 22777d_difftime='$d_difftime'
de52168c 22778d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 22779d_dirfd='$d_dirfd'
b4eb6b3d
JH
22780d_dirnamlen='$d_dirnamlen'
22781d_dlerror='$d_dlerror'
5f80c64f 22782d_dlopen='$d_dlopen'
b4eb6b3d
JH
22783d_dlsymun='$d_dlsymun'
22784d_dosuid='$d_dosuid'
10bc17b6 22785d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
22786d_drand48proto='$d_drand48proto'
22787d_dup2='$d_dup2'
22788d_eaccess='$d_eaccess'
22789d_endgrent='$d_endgrent'
10bc17b6 22790d_endgrent_r='$d_endgrent_r'
b4eb6b3d 22791d_endhent='$d_endhent'
10bc17b6 22792d_endhostent_r='$d_endhostent_r'
b4eb6b3d 22793d_endnent='$d_endnent'
10bc17b6 22794d_endnetent_r='$d_endnetent_r'
b4eb6b3d 22795d_endpent='$d_endpent'
10bc17b6 22796d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 22797d_endpwent='$d_endpwent'
10bc17b6 22798d_endpwent_r='$d_endpwent_r'
b4eb6b3d 22799d_endsent='$d_endsent'
10bc17b6 22800d_endservent_r='$d_endservent_r'
b4eb6b3d 22801d_eofnblk='$d_eofnblk'
5f80c64f 22802d_eunice='$d_eunice'
15b61c98 22803d_faststdio='$d_faststdio'
b363b713 22804d_fchdir='$d_fchdir'
b4eb6b3d
JH
22805d_fchmod='$d_fchmod'
22806d_fchown='$d_fchown'
22807d_fcntl='$d_fcntl'
9d9004a9 22808d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
22809d_fd_macros='$d_fd_macros'
22810d_fd_set='$d_fd_set'
22811d_fds_bits='$d_fds_bits'
22812d_fgetpos='$d_fgetpos'
758a5d79
JH
22813d_finite='$d_finite'
22814d_finitel='$d_finitel'
b4eb6b3d
JH
22815d_flexfnam='$d_flexfnam'
22816d_flock='$d_flock'
2ef53570 22817d_flockproto='$d_flockproto'
b4eb6b3d 22818d_fork='$d_fork'
758a5d79 22819d_fp_class='$d_fp_class'
b4eb6b3d 22820d_fpathconf='$d_fpathconf'
758a5d79
JH
22821d_fpclass='$d_fpclass'
22822d_fpclassify='$d_fpclassify'
22823d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
22824d_fpos64_t='$d_fpos64_t'
22825d_frexpl='$d_frexpl'
22826d_fs_data_s='$d_fs_data_s'
22827d_fseeko='$d_fseeko'
22828d_fsetpos='$d_fsetpos'
22829d_fstatfs='$d_fstatfs'
22830d_fstatvfs='$d_fstatvfs'
411ab01c 22831d_fsync='$d_fsync'
b4eb6b3d
JH
22832d_ftello='$d_ftello'
22833d_ftime='$d_ftime'
dc814df1 22834d_futimes='$d_futimes'
e74475c7
MHM
22835d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22836d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
5086dff9 22837d_getaddrinfo='$d_getaddrinfo'
b4eb6b3d
JH
22838d_getcwd='$d_getcwd'
22839d_getespwnam='$d_getespwnam'
22840d_getfsstat='$d_getfsstat'
22841d_getgrent='$d_getgrent'
10bc17b6
JH
22842d_getgrent_r='$d_getgrent_r'
22843d_getgrgid_r='$d_getgrgid_r'
22844d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
22845d_getgrps='$d_getgrps'
22846d_gethbyaddr='$d_gethbyaddr'
22847d_gethbyname='$d_gethbyname'
22848d_gethent='$d_gethent'
22849d_gethname='$d_gethname'
10bc17b6
JH
22850d_gethostbyaddr_r='$d_gethostbyaddr_r'
22851d_gethostbyname_r='$d_gethostbyname_r'
22852d_gethostent_r='$d_gethostent_r'
b4eb6b3d 22853d_gethostprotos='$d_gethostprotos'
4e0554ec 22854d_getitimer='$d_getitimer'
b4eb6b3d 22855d_getlogin='$d_getlogin'
10bc17b6 22856d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
22857d_getmnt='$d_getmnt'
22858d_getmntent='$d_getmntent'
5086dff9 22859d_getnameinfo='$d_getnameinfo'
b4eb6b3d
JH
22860d_getnbyaddr='$d_getnbyaddr'
22861d_getnbyname='$d_getnbyname'
22862d_getnent='$d_getnent'
10bc17b6
JH
22863d_getnetbyaddr_r='$d_getnetbyaddr_r'
22864d_getnetbyname_r='$d_getnetbyname_r'
22865d_getnetent_r='$d_getnetent_r'
b4eb6b3d 22866d_getnetprotos='$d_getnetprotos'
0c0643d0 22867d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
22868d_getpbyname='$d_getpbyname'
22869d_getpbynumber='$d_getpbynumber'
22870d_getpent='$d_getpent'
22871d_getpgid='$d_getpgid'
22872d_getpgrp2='$d_getpgrp2'
22873d_getpgrp='$d_getpgrp'
22874d_getppid='$d_getppid'
22875d_getprior='$d_getprior'
10bc17b6
JH
22876d_getprotobyname_r='$d_getprotobyname_r'
22877d_getprotobynumber_r='$d_getprotobynumber_r'
22878d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
22879d_getprotoprotos='$d_getprotoprotos'
22880d_getprpwnam='$d_getprpwnam'
22881d_getpwent='$d_getpwent'
10bc17b6
JH
22882d_getpwent_r='$d_getpwent_r'
22883d_getpwnam_r='$d_getpwnam_r'
22884d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
22885d_getsbyname='$d_getsbyname'
22886d_getsbyport='$d_getsbyport'
22887d_getsent='$d_getsent'
10bc17b6
JH
22888d_getservbyname_r='$d_getservbyname_r'
22889d_getservbyport_r='$d_getservbyport_r'
22890d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
22891d_getservprotos='$d_getservprotos'
22892d_getspnam='$d_getspnam'
10bc17b6 22893d_getspnam_r='$d_getspnam_r'
b4eb6b3d 22894d_gettimeod='$d_gettimeod'
96938616 22895d_gmtime64='$d_gmtime64'
10bc17b6 22896d_gmtime_r='$d_gmtime_r'
5f80c64f 22897d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
22898d_grpasswd='$d_grpasswd'
22899d_hasmntopt='$d_hasmntopt'
22900d_htonl='$d_htonl'
55954f19 22901d_ilogbl='$d_ilogbl'
f3f1a2d8 22902d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
22903d_index='$d_index'
22904d_inetaton='$d_inetaton'
5086dff9
MB
22905d_inetntop='$d_inetntop'
22906d_inetpton='$d_inetpton'
b4eb6b3d
JH
22907d_int64_t='$d_int64_t'
22908d_isascii='$d_isascii'
758a5d79
JH
22909d_isfinite='$d_isfinite'
22910d_isinf='$d_isinf'
b4eb6b3d
JH
22911d_isnan='$d_isnan'
22912d_isnanl='$d_isnanl'
22913d_killpg='$d_killpg'
22914d_lchown='$d_lchown'
22915d_ldbl_dig='$d_ldbl_dig'
0a0abfba 22916d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 22917d_link='$d_link'
96938616 22918d_localtime64='$d_localtime64'
10bc17b6 22919d_localtime_r='$d_localtime_r'
8572b25d 22920d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
22921d_locconv='$d_locconv'
22922d_lockf='$d_lockf'
22923d_longdbl='$d_longdbl'
22924d_longlong='$d_longlong'
22925d_lseekproto='$d_lseekproto'
22926d_lstat='$d_lstat'
22927d_madvise='$d_madvise'
7dd121ae
MB
22928d_malloc_good_size='$d_malloc_good_size'
22929d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
22930d_mblen='$d_mblen'
22931d_mbstowcs='$d_mbstowcs'
22932d_mbtowc='$d_mbtowc'
22933d_memchr='$d_memchr'
22934d_memcmp='$d_memcmp'
22935d_memcpy='$d_memcpy'
22936d_memmove='$d_memmove'
22937d_memset='$d_memset'
22938d_mkdir='$d_mkdir'
22939d_mkdtemp='$d_mkdtemp'
22940d_mkfifo='$d_mkfifo'
22941d_mkstemp='$d_mkstemp'
22942d_mkstemps='$d_mkstemps'
96938616 22943d_mktime64='$d_mktime64'
b4eb6b3d
JH
22944d_mktime='$d_mktime'
22945d_mmap='$d_mmap'
22946d_modfl='$d_modfl'
e67aeab1 22947d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 22948d_modflproto='$d_modflproto'
b4eb6b3d
JH
22949d_mprotect='$d_mprotect'
22950d_msg='$d_msg'
22951d_msg_ctrunc='$d_msg_ctrunc'
22952d_msg_dontroute='$d_msg_dontroute'
22953d_msg_oob='$d_msg_oob'
22954d_msg_peek='$d_msg_peek'
22955d_msg_proxy='$d_msg_proxy'
22956d_msgctl='$d_msgctl'
22957d_msgget='$d_msgget'
4e0554ec 22958d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
22959d_msgrcv='$d_msgrcv'
22960d_msgsnd='$d_msgsnd'
22961d_msync='$d_msync'
22962d_munmap='$d_munmap'
22963d_mymalloc='$d_mymalloc'
a33f2d9f 22964d_ndbm='$d_ndbm'
e74475c7 22965d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
b4eb6b3d 22966d_nice='$d_nice'
2765b840 22967d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 22968d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 22969d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
22970d_off64_t='$d_off64_t'
22971d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22972d_oldpthreads='$d_oldpthreads'
22973d_oldsock='$d_oldsock'
22974d_open3='$d_open3'
22975d_pathconf='$d_pathconf'
22976d_pause='$d_pause'
22977d_perl_otherlibdirs='$d_perl_otherlibdirs'
22978d_phostname='$d_phostname'
22979d_pipe='$d_pipe'
22980d_poll='$d_poll'
5f80c64f 22981d_portable='$d_portable'
c796e3db
MB
22982d_prctl='$d_prctl'
22983d_prctl_set_name='$d_prctl_set_name'
dcb594bc 22984d_printf_format_null='$d_printf_format_null'
c7aff470 22985d_procselfexe='$d_procselfexe'
233e16ce 22986d_pseudofork='$d_pseudofork'
d6483fcc 22987d_pthread_atfork='$d_pthread_atfork'
58d975c3 22988d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
22989d_pthread_yield='$d_pthread_yield'
22990d_pwage='$d_pwage'
22991d_pwchange='$d_pwchange'
22992d_pwclass='$d_pwclass'
22993d_pwcomment='$d_pwcomment'
22994d_pwexpire='$d_pwexpire'
22995d_pwgecos='$d_pwgecos'
22996d_pwpasswd='$d_pwpasswd'
22997d_pwquota='$d_pwquota'
22998d_qgcvt='$d_qgcvt'
22999d_quad='$d_quad'
10bc17b6
JH
23000d_random_r='$d_random_r'
23001d_readdir64_r='$d_readdir64_r'
b4eb6b3d 23002d_readdir='$d_readdir'
10bc17b6 23003d_readdir_r='$d_readdir_r'
b4eb6b3d 23004d_readlink='$d_readlink'
4e0554ec
JH
23005d_readv='$d_readv'
23006d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
23007d_rename='$d_rename'
23008d_rewinddir='$d_rewinddir'
23009d_rmdir='$d_rmdir'
23010d_safebcpy='$d_safebcpy'
23011d_safemcpy='$d_safemcpy'
23012d_sanemcmp='$d_sanemcmp'
ef9f17be 23013d_sbrkproto='$d_sbrkproto'
55954f19 23014d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
23015d_sched_yield='$d_sched_yield'
23016d_scm_rights='$d_scm_rights'
23017d_seekdir='$d_seekdir'
23018d_select='$d_select'
23019d_sem='$d_sem'
23020d_semctl='$d_semctl'
23021d_semctl_semid_ds='$d_semctl_semid_ds'
23022d_semctl_semun='$d_semctl_semun'
23023d_semget='$d_semget'
23024d_semop='$d_semop'
4e0554ec 23025d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
23026d_setegid='$d_setegid'
23027d_seteuid='$d_seteuid'
23028d_setgrent='$d_setgrent'
10bc17b6 23029d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
23030d_setgrps='$d_setgrps'
23031d_sethent='$d_sethent'
10bc17b6 23032d_sethostent_r='$d_sethostent_r'
4e0554ec 23033d_setitimer='$d_setitimer'
b4eb6b3d
JH
23034d_setlinebuf='$d_setlinebuf'
23035d_setlocale='$d_setlocale'
10bc17b6 23036d_setlocale_r='$d_setlocale_r'
b4eb6b3d 23037d_setnent='$d_setnent'
10bc17b6 23038d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
23039d_setpent='$d_setpent'
23040d_setpgid='$d_setpgid'
23041d_setpgrp2='$d_setpgrp2'
23042d_setpgrp='$d_setpgrp'
23043d_setprior='$d_setprior'
23044d_setproctitle='$d_setproctitle'
10bc17b6 23045d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 23046d_setpwent='$d_setpwent'
10bc17b6 23047d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
23048d_setregid='$d_setregid'
23049d_setresgid='$d_setresgid'
23050d_setresuid='$d_setresuid'
23051d_setreuid='$d_setreuid'
23052d_setrgid='$d_setrgid'
23053d_setruid='$d_setruid'
23054d_setsent='$d_setsent'
10bc17b6 23055d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
23056d_setsid='$d_setsid'
23057d_setvbuf='$d_setvbuf'
23058d_sfio='$d_sfio'
23059d_shm='$d_shm'
23060d_shmat='$d_shmat'
23061d_shmatprototype='$d_shmatprototype'
23062d_shmctl='$d_shmctl'
23063d_shmdt='$d_shmdt'
23064d_shmget='$d_shmget'
23065d_sigaction='$d_sigaction'
ed140128 23066d_signbit='$d_signbit'
983dbef6 23067d_sigprocmask='$d_sigprocmask'
b4eb6b3d 23068d_sigsetjmp='$d_sigsetjmp'
f53580fe 23069d_sin6_scope_id='$d_sin6_scope_id'
c95d0e17 23070d_sitearch='$d_sitearch'
4f5da3e9 23071d_snprintf='$d_snprintf'
b8677e3b 23072d_sockaddr_sa_len='$d_sockaddr_sa_len'
49a78c82 23073d_sockatmark='$d_sockatmark'
2ef53570 23074d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
23075d_socket='$d_socket'
23076d_socklen_t='$d_socklen_t'
23077d_sockpair='$d_sockpair'
23078d_socks5_init='$d_socks5_init'
360321b3 23079d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 23080d_sqrtl='$d_sqrtl'
10bc17b6
JH
23081d_srand48_r='$d_srand48_r'
23082d_srandom_r='$d_srandom_r'
eef837ea 23083d_sresgproto='$d_sresgproto'
640374d0 23084d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
23085d_statblks='$d_statblks'
23086d_statfs_f_flags='$d_statfs_f_flags'
23087d_statfs_s='$d_statfs_s'
17a6c8e3 23088d_static_inline='$d_static_inline'
b4eb6b3d
JH
23089d_statvfs='$d_statvfs'
23090d_stdio_cnt_lval='$d_stdio_cnt_lval'
23091d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
23092d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23093d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
23094d_stdio_stream_array='$d_stdio_stream_array'
23095d_stdiobase='$d_stdiobase'
23096d_stdstdio='$d_stdstdio'
23097d_strchr='$d_strchr'
23098d_strcoll='$d_strcoll'
23099d_strctcpy='$d_strctcpy'
23100d_strerrm='$d_strerrm'
23101d_strerror='$d_strerror'
10bc17b6 23102d_strerror_r='$d_strerror_r'
b3c85772 23103d_strftime='$d_strftime'
08c92000
MB
23104d_strlcat='$d_strlcat'
23105d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
23106d_strtod='$d_strtod'
23107d_strtol='$d_strtol'
23108d_strtold='$d_strtold'
23109d_strtoll='$d_strtoll'
28e5dec8 23110d_strtoq='$d_strtoq'
b4eb6b3d
JH
23111d_strtoul='$d_strtoul'
23112d_strtoull='$d_strtoull'
23113d_strtouq='$d_strtouq'
23114d_strxfrm='$d_strxfrm'
23115d_suidsafe='$d_suidsafe'
23116d_symlink='$d_symlink'
23117d_syscall='$d_syscall'
2ef53570 23118d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
23119d_sysconf='$d_sysconf'
23120d_sysernlst='$d_sysernlst'
23121d_syserrlst='$d_syserrlst'
23122d_system='$d_system'
23123d_tcgetpgrp='$d_tcgetpgrp'
23124d_tcsetpgrp='$d_tcsetpgrp'
23125d_telldir='$d_telldir'
23126d_telldirproto='$d_telldirproto'
23127d_time='$d_time'
cbb9e8a7 23128d_timegm='$d_timegm'
b4eb6b3d 23129d_times='$d_times'
14b90194
JH
23130d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23131d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 23132d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 23133d_truncate='$d_truncate'
10bc17b6 23134d_ttyname_r='$d_ttyname_r'
b4eb6b3d 23135d_tzname='$d_tzname'
4e0554ec
JH
23136d_u32align='$d_u32align'
23137d_ualarm='$d_ualarm'
b4eb6b3d
JH
23138d_umask='$d_umask'
23139d_uname='$d_uname'
23140d_union_semun='$d_union_semun'
758a5d79 23141d_unordered='$d_unordered'
bdf33aa7 23142d_unsetenv='$d_unsetenv'
4e0554ec 23143d_usleep='$d_usleep'
2ef53570 23144d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
23145d_ustat='$d_ustat'
23146d_vendorarch='$d_vendorarch'
23147d_vendorbin='$d_vendorbin'
23148d_vendorlib='$d_vendorlib'
6e1038e0 23149d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
23150d_vfork='$d_vfork'
23151d_void_closedir='$d_void_closedir'
23152d_voidsig='$d_voidsig'
23153d_voidtty='$d_voidtty'
23154d_volatile='$d_volatile'
23155d_vprintf='$d_vprintf'
4f5da3e9 23156d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
23157d_wait4='$d_wait4'
23158d_waitpid='$d_waitpid'
23159d_wcstombs='$d_wcstombs'
23160d_wctomb='$d_wctomb'
4e0554ec 23161d_writev='$d_writev'
5f80c64f
JH
23162d_xenix='$d_xenix'
23163date='$date'
b4eb6b3d
JH
23164db_hashtype='$db_hashtype'
23165db_prefixtype='$db_prefixtype'
640374d0
JH
23166db_version_major='$db_version_major'
23167db_version_minor='$db_version_minor'
23168db_version_patch='$db_version_patch'
b4eb6b3d
JH
23169defvoidused='$defvoidused'
23170direntrytype='$direntrytype'
23171dlext='$dlext'
5f80c64f 23172dlsrc='$dlsrc'
b4eb6b3d
JH
23173doublesize='$doublesize'
23174drand01='$drand01'
10bc17b6 23175drand48_r_proto='$drand48_r_proto'
5ac1e9b2 23176dtrace='$dtrace'
b4eb6b3d
JH
23177dynamic_ext='$dynamic_ext'
23178eagain='$eagain'
23179ebcdic='$ebcdic'
5f80c64f
JH
23180echo='$echo'
23181egrep='$egrep'
23182emacs='$emacs'
10bc17b6
JH
23183endgrent_r_proto='$endgrent_r_proto'
23184endhostent_r_proto='$endhostent_r_proto'
23185endnetent_r_proto='$endnetent_r_proto'
23186endprotoent_r_proto='$endprotoent_r_proto'
23187endpwent_r_proto='$endpwent_r_proto'
23188endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
23189eunicefix='$eunicefix'
23190exe_ext='$exe_ext'
23191expr='$expr'
b4eb6b3d 23192extensions='$extensions'
61c26d18 23193extern_C='$extern_C'
6fcddf3b 23194extras='$extras'
b4eb6b3d
JH
23195fflushNULL='$fflushNULL'
23196fflushall='$fflushall'
5f80c64f
JH
23197find='$find'
23198firstmakefile='$firstmakefile'
23199flex='$flex'
b4eb6b3d
JH
23200fpossize='$fpossize'
23201fpostype='$fpostype'
23202freetype='$freetype'
5440bc8e 23203from='$from'
b4eb6b3d
JH
23204full_ar='$full_ar'
23205full_csh='$full_csh'
23206full_sed='$full_sed'
2d736872 23207gccansipedantic='$gccansipedantic'
5b463ca7 23208gccosandvers='$gccosandvers'
5f80c64f 23209gccversion='$gccversion'
10bc17b6
JH
23210getgrent_r_proto='$getgrent_r_proto'
23211getgrgid_r_proto='$getgrgid_r_proto'
23212getgrnam_r_proto='$getgrnam_r_proto'
23213gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23214gethostbyname_r_proto='$gethostbyname_r_proto'
23215gethostent_r_proto='$gethostent_r_proto'
23216getlogin_r_proto='$getlogin_r_proto'
23217getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23218getnetbyname_r_proto='$getnetbyname_r_proto'
23219getnetent_r_proto='$getnetent_r_proto'
23220getprotobyname_r_proto='$getprotobyname_r_proto'
23221getprotobynumber_r_proto='$getprotobynumber_r_proto'
23222getprotoent_r_proto='$getprotoent_r_proto'
23223getpwent_r_proto='$getpwent_r_proto'
23224getpwnam_r_proto='$getpwnam_r_proto'
23225getpwuid_r_proto='$getpwuid_r_proto'
23226getservbyname_r_proto='$getservbyname_r_proto'
23227getservbyport_r_proto='$getservbyport_r_proto'
23228getservent_r_proto='$getservent_r_proto'
23229getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
23230gidformat='$gidformat'
23231gidsign='$gidsign'
23232gidsize='$gidsize'
23233gidtype='$gidtype'
5f80c64f 23234glibpth='$glibpth'
3c728e00 23235gmake='$gmake'
10bc17b6 23236gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 23237gnulibc_version='$gnulibc_version'
5f80c64f 23238grep='$grep'
b4eb6b3d
JH
23239groupcat='$groupcat'
23240groupstype='$groupstype'
5f80c64f 23241gzip='$gzip'
b4eb6b3d
JH
23242h_fcntl='$h_fcntl'
23243h_sysfile='$h_sysfile'
5f80c64f 23244hint='$hint'
b4eb6b3d 23245hostcat='$hostcat'
6e1038e0
MB
23246html1dir='$html1dir'
23247html1direxp='$html1direxp'
23248html3dir='$html3dir'
23249html3direxp='$html3direxp'
b4eb6b3d
JH
23250i16size='$i16size'
23251i16type='$i16type'
23252i32size='$i32size'
23253i32type='$i32type'
23254i64size='$i64size'
23255i64type='$i64type'
23256i8size='$i8size'
23257i8type='$i8type'
23258i_arpainet='$i_arpainet'
2a0de2c5 23259i_assert='$i_assert'
b4eb6b3d 23260i_bsdioctl='$i_bsdioctl'
10bc17b6 23261i_crypt='$i_crypt'
b4eb6b3d
JH
23262i_db='$i_db'
23263i_dbm='$i_dbm'
23264i_dirent='$i_dirent'
5f80c64f 23265i_dld='$i_dld'
b4eb6b3d
JH
23266i_dlfcn='$i_dlfcn'
23267i_fcntl='$i_fcntl'
23268i_float='$i_float'
758a5d79
JH
23269i_fp='$i_fp'
23270i_fp_class='$i_fp_class'
b4eb6b3d 23271i_gdbm='$i_gdbm'
a33f2d9f
AD
23272i_gdbm_ndbm='$i_gdbm_ndbm'
23273i_gdbmndbm='$i_gdbmndbm'
b4eb6b3d 23274i_grp='$i_grp'
b4eb6b3d
JH
23275i_ieeefp='$i_ieeefp'
23276i_inttypes='$i_inttypes'
2765b840 23277i_langinfo='$i_langinfo'
b4eb6b3d
JH
23278i_libutil='$i_libutil'
23279i_limits='$i_limits'
23280i_locale='$i_locale'
23281i_machcthr='$i_machcthr'
23282i_malloc='$i_malloc'
1cd66f7c 23283i_mallocmalloc='$i_mallocmalloc'
b4eb6b3d
JH
23284i_math='$i_math'
23285i_memory='$i_memory'
23286i_mntent='$i_mntent'
23287i_ndbm='$i_ndbm'
23288i_netdb='$i_netdb'
23289i_neterrno='$i_neterrno'
23290i_netinettcp='$i_netinettcp'
23291i_niin='$i_niin'
23292i_poll='$i_poll'
23293i_prot='$i_prot'
23294i_pthread='$i_pthread'
23295i_pwd='$i_pwd'
23296i_rpcsvcdbm='$i_rpcsvcdbm'
23297i_sfio='$i_sfio'
23298i_sgtty='$i_sgtty'
23299i_shadow='$i_shadow'
23300i_socks='$i_socks'
23301i_stdarg='$i_stdarg'
bd31be4b 23302i_stdbool='$i_stdbool'
b4eb6b3d
JH
23303i_stddef='$i_stddef'
23304i_stdlib='$i_stdlib'
23305i_string='$i_string'
23306i_sunmath='$i_sunmath'
23307i_sysaccess='$i_sysaccess'
23308i_sysdir='$i_sysdir'
23309i_sysfile='$i_sysfile'
23310i_sysfilio='$i_sysfilio'
23311i_sysin='$i_sysin'
23312i_sysioctl='$i_sysioctl'
23313i_syslog='$i_syslog'
23314i_sysmman='$i_sysmman'
23315i_sysmode='$i_sysmode'
23316i_sysmount='$i_sysmount'
23317i_sysndir='$i_sysndir'
23318i_sysparam='$i_sysparam'
216dac04 23319i_syspoll='$i_syspoll'
b4eb6b3d
JH
23320i_sysresrc='$i_sysresrc'
23321i_syssecrt='$i_syssecrt'
23322i_sysselct='$i_sysselct'
23323i_syssockio='$i_syssockio'
23324i_sysstat='$i_sysstat'
23325i_sysstatfs='$i_sysstatfs'
23326i_sysstatvfs='$i_sysstatvfs'
23327i_systime='$i_systime'
23328i_systimek='$i_systimek'
23329i_systimes='$i_systimes'
23330i_systypes='$i_systypes'
23331i_sysuio='$i_sysuio'
23332i_sysun='$i_sysun'
23333i_sysutsname='$i_sysutsname'
23334i_sysvfs='$i_sysvfs'
23335i_syswait='$i_syswait'
23336i_termio='$i_termio'
23337i_termios='$i_termios'
23338i_time='$i_time'
23339i_unistd='$i_unistd'
23340i_ustat='$i_ustat'
23341i_utime='$i_utime'
23342i_values='$i_values'
23343i_varargs='$i_varargs'
23344i_varhdr='$i_varhdr'
23345i_vfork='$i_vfork'
5f80c64f 23346ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
23347inc_version_list='$inc_version_list'
23348inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
23349incpath='$incpath'
23350inews='$inews'
f3f1a2d8 23351initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
23352installarchlib='$installarchlib'
23353installbin='$installbin'
6e1038e0
MB
23354installhtml1dir='$installhtml1dir'
23355installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
23356installman1dir='$installman1dir'
23357installman3dir='$installman3dir'
23358installprefix='$installprefix'
23359installprefixexp='$installprefixexp'
23360installprivlib='$installprivlib'
23361installscript='$installscript'
23362installsitearch='$installsitearch'
23363installsitebin='$installsitebin'
8d2cbf27
JH
23364installsitehtml1dir='$installsitehtml1dir'
23365installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 23366installsitelib='$installsitelib'
91e123a8
JH
23367installsiteman1dir='$installsiteman1dir'
23368installsiteman3dir='$installsiteman3dir'
6e1038e0 23369installsitescript='$installsitescript'
b4eb6b3d
JH
23370installstyle='$installstyle'
23371installusrbinperl='$installusrbinperl'
23372installvendorarch='$installvendorarch'
23373installvendorbin='$installvendorbin'
8d2cbf27
JH
23374installvendorhtml1dir='$installvendorhtml1dir'
23375installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 23376installvendorlib='$installvendorlib'
91e123a8
JH
23377installvendorman1dir='$installvendorman1dir'
23378installvendorman3dir='$installvendorman3dir'
6e1038e0 23379installvendorscript='$installvendorscript'
b4eb6b3d 23380intsize='$intsize'
4b661809 23381issymlink='$issymlink'
b4eb6b3d
JH
23382ivdformat='$ivdformat'
23383ivsize='$ivsize'
23384ivtype='$ivtype'
23385known_extensions='$known_extensions'
5f80c64f 23386ksh='$ksh'
5f80c64f
JH
23387ld='$ld'
23388lddlflags='$lddlflags'
23389ldflags='$ldflags'
b4eb6b3d
JH
23390ldflags_uselargefiles='$ldflags_uselargefiles'
23391ldlibpthname='$ldlibpthname'
5f80c64f
JH
23392less='$less'
23393lib_ext='$lib_ext'
23394libc='$libc'
b4eb6b3d 23395libperl='$libperl'
5f80c64f
JH
23396libpth='$libpth'
23397libs='$libs'
43999f95
JH
23398libsdirs='$libsdirs'
23399libsfiles='$libsfiles'
23400libsfound='$libsfound'
13b3f787 23401libspath='$libspath'
5f80c64f 23402libswanted='$libswanted'
b4eb6b3d 23403libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
23404line='$line'
23405lint='$lint'
23406lkflags='$lkflags'
23407ln='$ln'
23408lns='$lns'
10bc17b6 23409localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
23410locincpth='$locincpth'
23411loclibpth='$loclibpth'
b4eb6b3d
JH
23412longdblsize='$longdblsize'
23413longlongsize='$longlongsize'
23414longsize='$longsize'
5f80c64f
JH
23415lp='$lp'
23416lpr='$lpr'
23417ls='$ls'
b4eb6b3d
JH
23418lseeksize='$lseeksize'
23419lseektype='$lseektype'
a724edfe 23420mad='$mad'
f3f1a2d8
MB
23421madlyh='$madlyh'
23422madlyobj='$madlyobj'
23423madlysrc='$madlysrc'
5f80c64f
JH
23424mail='$mail'
23425mailx='$mailx'
23426make='$make'
23427make_set_make='$make_set_make'
b4eb6b3d
JH
23428mallocobj='$mallocobj'
23429mallocsrc='$mallocsrc'
23430malloctype='$malloctype'
23431man1dir='$man1dir'
23432man1direxp='$man1direxp'
23433man1ext='$man1ext'
23434man3dir='$man3dir'
23435man3direxp='$man3direxp'
23436man3ext='$man3ext'
5f80c64f 23437mips_type='$mips_type'
5129fff4 23438mistrustnm='$mistrustnm'
5f80c64f 23439mkdir='$mkdir'
b4eb6b3d
JH
23440mmaptype='$mmaptype'
23441modetype='$modetype'
5f80c64f 23442more='$more'
b4eb6b3d 23443multiarch='$multiarch'
5f80c64f 23444mv='$mv'
b4eb6b3d
JH
23445myarchname='$myarchname'
23446mydomain='$mydomain'
23447myhostname='$myhostname'
5f80c64f
JH
23448myuname='$myuname'
23449n='$n'
2cc61e15 23450need_va_copy='$need_va_copy'
b4eb6b3d
JH
23451netdb_hlen_type='$netdb_hlen_type'
23452netdb_host_type='$netdb_host_type'
23453netdb_name_type='$netdb_name_type'
23454netdb_net_type='$netdb_net_type'
5f80c64f
JH
23455nm='$nm'
23456nm_opt='$nm_opt'
23457nm_so_opt='$nm_so_opt'
b4eb6b3d 23458nonxs_ext='$nonxs_ext'
5f80c64f 23459nroff='$nroff'
b4eb6b3d
JH
23460nvEUformat='$nvEUformat'
23461nvFUformat='$nvFUformat'
23462nvGUformat='$nvGUformat'
b68c599a 23463nv_overflows_integers_at='$nv_overflows_integers_at'
53133ed1 23464nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
23465nveformat='$nveformat'
23466nvfformat='$nvfformat'
23467nvgformat='$nvgformat'
23468nvsize='$nvsize'
23469nvtype='$nvtype'
23470o_nonblock='$o_nonblock'
5f80c64f 23471obj_ext='$obj_ext'
b4eb6b3d 23472old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 23473optimize='$optimize'
b4eb6b3d 23474orderlib='$orderlib'
5f80c64f
JH
23475osname='$osname'
23476osvers='$osvers'
b4eb6b3d 23477otherlibdirs='$otherlibdirs'
5f80c64f 23478package='$package'
b4eb6b3d
JH
23479pager='$pager'
23480passcat='$passcat'
23481patchlevel='$patchlevel'
5f80c64f 23482path_sep='$path_sep'
b4eb6b3d 23483perl5='$perl5'
5f80c64f 23484perl='$perl'
151e6568 23485perl_patchlevel='$perl_patchlevel'
17a6c8e3 23486perl_static_inline='$perl_static_inline'
b4eb6b3d 23487perladmin='$perladmin'
9c839522 23488perllibs='$perllibs'
91f55cc7 23489perlpath='$perlpath'
5f80c64f 23490pg='$pg'
b4eb6b3d
JH
23491phostname='$phostname'
23492pidtype='$pidtype'
5f80c64f
JH
23493plibpth='$plibpth'
23494pmake='$pmake'
23495pr='$pr'
b4eb6b3d
JH
23496prefix='$prefix'
23497prefixexp='$prefixexp'
23498privlib='$privlib'
23499privlibexp='$privlibexp'
f24dbf84 23500procselfexe='$procselfexe'
b4eb6b3d
JH
23501prototype='$prototype'
23502ptrsize='$ptrsize'
23503quadkind='$quadkind'
23504quadtype='$quadtype'
23505randbits='$randbits'
23506randfunc='$randfunc'
10bc17b6 23507random_r_proto='$random_r_proto'
b4eb6b3d
JH
23508randseedtype='$randseedtype'
23509ranlib='$ranlib'
23510rd_nodata='$rd_nodata'
10bc17b6
JH
23511readdir64_r_proto='$readdir64_r_proto'
23512readdir_r_proto='$readdir_r_proto'
b4eb6b3d 23513revision='$revision'
5f80c64f 23514rm='$rm'
5b813a60 23515rm_try='$rm_try'
5f80c64f 23516rmail='$rmail'
5440bc8e 23517run='$run'
5f80c64f 23518runnm='$runnm'
81c4fd9e
MB
23519sGMTIME_max='$sGMTIME_max'
23520sGMTIME_min='$sGMTIME_min'
73e6e416
MB
23521sLOCALTIME_max='$sLOCALTIME_max'
23522sLOCALTIME_min='$sLOCALTIME_min'
b4eb6b3d
JH
23523sPRIEUldbl='$sPRIEUldbl'
23524sPRIFUldbl='$sPRIFUldbl'
23525sPRIGUldbl='$sPRIGUldbl'
23526sPRIXU64='$sPRIXU64'
23527sPRId64='$sPRId64'
23528sPRIeldbl='$sPRIeldbl'
23529sPRIfldbl='$sPRIfldbl'
23530sPRIgldbl='$sPRIgldbl'
23531sPRIi64='$sPRIi64'
23532sPRIo64='$sPRIo64'
23533sPRIu64='$sPRIu64'
23534sPRIx64='$sPRIx64'
23535sSCNfldbl='$sSCNfldbl'
23536sched_yield='$sched_yield'
23537scriptdir='$scriptdir'
23538scriptdirexp='$scriptdirexp'
5f80c64f 23539sed='$sed'
b4eb6b3d
JH
23540seedfunc='$seedfunc'
23541selectminbits='$selectminbits'
23542selecttype='$selecttype'
5f80c64f 23543sendmail='$sendmail'
10bc17b6
JH
23544setgrent_r_proto='$setgrent_r_proto'
23545sethostent_r_proto='$sethostent_r_proto'
23546setlocale_r_proto='$setlocale_r_proto'
23547setnetent_r_proto='$setnetent_r_proto'
23548setprotoent_r_proto='$setprotoent_r_proto'
23549setpwent_r_proto='$setpwent_r_proto'
23550setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
23551sh='$sh'
23552shar='$shar'
23553sharpbang='$sharpbang'
b4eb6b3d
JH
23554shmattype='$shmattype'
23555shortsize='$shortsize'
23556shrpenv='$shrpenv'
5f80c64f 23557shsharp='$shsharp'
b4eb6b3d
JH
23558sig_count='$sig_count'
23559sig_name='$sig_name'
23560sig_name_init='$sig_name_init'
23561sig_num='$sig_num'
23562sig_num_init='$sig_num_init'
76d3c696 23563sig_size='$sig_size'
b4eb6b3d
JH
23564signal_t='$signal_t'
23565sitearch='$sitearch'
23566sitearchexp='$sitearchexp'
23567sitebin='$sitebin'
23568sitebinexp='$sitebinexp'
8d2cbf27
JH
23569sitehtml1dir='$sitehtml1dir'
23570sitehtml1direxp='$sitehtml1direxp'
23571sitehtml3dir='$sitehtml3dir'
23572sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
23573sitelib='$sitelib'
23574sitelib_stem='$sitelib_stem'
23575sitelibexp='$sitelibexp'
91e123a8
JH
23576siteman1dir='$siteman1dir'
23577siteman1direxp='$siteman1direxp'
23578siteman3dir='$siteman3dir'
23579siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
23580siteprefix='$siteprefix'
23581siteprefixexp='$siteprefixexp'
6e1038e0
MB
23582sitescript='$sitescript'
23583sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
23584sizesize='$sizesize'
23585sizetype='$sizetype'
5f80c64f
JH
23586sleep='$sleep'
23587smail='$smail'
5f80c64f 23588so='$so'
b4eb6b3d
JH
23589sockethdr='$sockethdr'
23590socketlib='$socketlib'
23591socksizetype='$socksizetype'
5f80c64f
JH
23592sort='$sort'
23593spackage='$spackage'
23594spitshell='$spitshell'
10bc17b6
JH
23595srand48_r_proto='$srand48_r_proto'
23596srandom_r_proto='$srandom_r_proto'
5f80c64f 23597src='$src'
b4eb6b3d 23598ssizetype='$ssizetype'
668fdbe1
MB
23599st_ino_sign='$st_ino_sign'
23600st_ino_size='$st_ino_size'
b4eb6b3d 23601startperl='$startperl'
5f80c64f 23602startsh='$startsh'
b4eb6b3d
JH
23603static_ext='$static_ext'
23604stdchar='$stdchar'
23605stdio_base='$stdio_base'
23606stdio_bufsiz='$stdio_bufsiz'
23607stdio_cnt='$stdio_cnt'
23608stdio_filbuf='$stdio_filbuf'
23609stdio_ptr='$stdio_ptr'
23610stdio_stream_array='$stdio_stream_array'
10bc17b6 23611strerror_r_proto='$strerror_r_proto'
b4eb6b3d 23612strings='$strings'
5f80c64f 23613submit='$submit'
b4eb6b3d
JH
23614subversion='$subversion'
23615sysman='$sysman'
5f80c64f
JH
23616tail='$tail'
23617tar='$tar'
5440bc8e 23618targetarch='$targetarch'
5f80c64f
JH
23619tbl='$tbl'
23620tee='$tee'
23621test='$test'
b4eb6b3d
JH
23622timeincl='$timeincl'
23623timetype='$timetype'
10bc17b6 23624tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 23625to='$to'
5f80c64f
JH
23626touch='$touch'
23627tr='$tr'
23628trnl='$trnl'
23629troff='$troff'
10bc17b6 23630ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
23631u16size='$u16size'
23632u16type='$u16type'
23633u32size='$u32size'
23634u32type='$u32type'
23635u64size='$u64size'
23636u64type='$u64type'
23637u8size='$u8size'
23638u8type='$u8type'
23639uidformat='$uidformat'
23640uidsign='$uidsign'
23641uidsize='$uidsize'
23642uidtype='$uidtype'
5f80c64f
JH
23643uname='$uname'
23644uniq='$uniq'
b4eb6b3d
JH
23645uquadtype='$uquadtype'
23646use5005threads='$use5005threads'
23647use64bitall='$use64bitall'
23648use64bitint='$use64bitint'
5440bc8e 23649usecrosscompile='$usecrosscompile'
1be1b388 23650usedevel='$usedevel'
5f80c64f 23651usedl='$usedl'
5ac1e9b2 23652usedtrace='$usedtrace'
15b61c98 23653usefaststdio='$usefaststdio'
b4eb6b3d 23654useithreads='$useithreads'
2982a345 23655usekernprocpathname='$usekernprocpathname'
b4eb6b3d
JH
23656uselargefiles='$uselargefiles'
23657uselongdouble='$uselongdouble'
19a100ff 23658usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
23659usemorebits='$usemorebits'
23660usemultiplicity='$usemultiplicity'
23661usemymalloc='$usemymalloc'
5f80c64f 23662usenm='$usenm'
ae60cb46 23663usensgetexecutablepath='$usensgetexecutablepath'
b4eb6b3d
JH
23664useopcode='$useopcode'
23665useperlio='$useperlio'
23666useposix='$useposix'
9514c62b 23667usereentrant='$usereentrant'
d51aaa9d 23668userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
23669usesfio='$usesfio'
23670useshrplib='$useshrplib'
5f106f9c 23671usesitecustomize='$usesitecustomize'
29209bc5 23672usesocks='$usesocks'
b4eb6b3d
JH
23673usethreads='$usethreads'
23674usevendorprefix='$usevendorprefix'
23675usevfork='$usevfork'
5f80c64f
JH
23676usrinc='$usrinc'
23677uuname='$uuname'
b4eb6b3d
JH
23678uvXUformat='$uvXUformat'
23679uvoformat='$uvoformat'
23680uvsize='$uvsize'
23681uvtype='$uvtype'
23682uvuformat='$uvuformat'
23683uvxformat='$uvxformat'
d03b3b00 23684vaproto='$vaproto'
b4eb6b3d
JH
23685vendorarch='$vendorarch'
23686vendorarchexp='$vendorarchexp'
23687vendorbin='$vendorbin'
23688vendorbinexp='$vendorbinexp'
8d2cbf27
JH
23689vendorhtml1dir='$vendorhtml1dir'
23690vendorhtml1direxp='$vendorhtml1direxp'
23691vendorhtml3dir='$vendorhtml3dir'
23692vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
23693vendorlib='$vendorlib'
23694vendorlib_stem='$vendorlib_stem'
23695vendorlibexp='$vendorlibexp'
91e123a8
JH
23696vendorman1dir='$vendorman1dir'
23697vendorman1direxp='$vendorman1direxp'
23698vendorman3dir='$vendorman3dir'
23699vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
23700vendorprefix='$vendorprefix'
23701vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
23702vendorscript='$vendorscript'
23703vendorscriptexp='$vendorscriptexp'
b4eb6b3d 23704version='$version'
861eb78d 23705version_patchlevel_string='$version_patchlevel_string'
d56c5707 23706versiononly='$versiononly'
5f80c64f 23707vi='$vi'
b4eb6b3d 23708voidflags='$voidflags'
5f80c64f 23709xlibpth='$xlibpth'
3659ebf1
JH
23710yacc='$yacc'
23711yaccflags='$yaccflags'
5f80c64f
JH
23712zcat='$zcat'
23713zip='$zip'
23714EOT
23715
5f80c64f
JH
23716: add special variables
23717$test -f $src/patchlevel.h && \
d9421656 23718awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
0f04e85f 23719echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
a02608de 23720echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
23721
23722: propagate old symbols
23723if $test -f UU/config.sh; then
381aa1ff 23724 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
776a38e3
MB
23725 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23726 config.sh config.sh UU/oldconfig.sh |\
23727 $sort | $uniq -u >UU/oldsyms
dd35fa16 23728 set X `$cat UU/oldsyms`
5f80c64f
JH
23729 shift
23730 case $# in
23731 0) ;;
23732 *)
dd35fa16 23733 $cat <<EOM
5f80c64f
JH
23734Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23735EOM
776a38e3 23736 echo ": Variables propagated from previous config.sh file." >>config.sh
dd35fa16 23737 for sym in `$cat UU/oldsyms`; do
5f80c64f
JH
23738 echo " Propagating $hint variable "'$'"$sym..."
23739 eval 'tmp="$'"${sym}"'"'
23740 echo "$tmp" | \
23741 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23742 done
23743 ;;
23744 esac
23745fi
23746
23747: Finish up by extracting the .SH files
23748case "$alldone" in
23749exit)
23750 $rm -rf UU
24ccb310 23751 echo "Extraction done."
5f80c64f
JH
23752 exit 0
23753 ;;
23754cont)
23755 ;;
23756'')
23757 dflt=''
23758 nostick=true
23759 $cat <<EOM
23760
23761If you'd like to make any changes to the config.sh file before I begin
23762to configure things, do it as a shell escape now (e.g. !vi config.sh).
23763
23764EOM
23765 rp="Press return or use a shell escape to edit config.sh:"
23766 . UU/myread
23767 nostick=''
23768 case "$ans" in
23769 '') ;;
23770 *) : in case they cannot read
23771 sh 1>&4 -c "$ans";;
23772 esac
23773 ;;
23774esac
23775
23776: if this fails, just run all the .SH files by hand
23777. ./config.sh
23778
23779echo " "
23780exec 1>&4
a43e8593 23781pwd=`pwd`
5f80c64f 23782. ./UU/extract
6904989c 23783cd "$pwd"
5f80c64f
JH
23784
23785if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23786 dflt=y
23787 case "$silent" in
23788 true) ;;
23789 *)
23790 $cat <<EOM
23791
23792Now you need to generate make dependencies by running "$make depend".
23793You might prefer to run it in background: "$make depend > makedepend.out &"
23794It can take a while, so you might not want to run it right now.
23795
23796EOM
23797 ;;
23798 esac
23799 rp="Run $make depend now?"
23800 . UU/myread
23801 case "$ans" in
23802 y*)
3d5d58b1 23803 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
23804 ;;
23805 *)
23806 echo "You must run '$make depend' then '$make'."
23807 ;;
23808 esac
23809elif test -f [Mm]akefile; then
23810 echo " "
23811 echo "Now you must run a $make."
23812else
24ccb310 23813 echo "Configure done."
5f80c64f
JH
23814fi
23815
23816if $test -f Policy.sh; then
23817 $cat <<EOM
23818
23819If you compile $package on a different machine or from a different object
23820directory, copy the Policy.sh file from this object directory to the
23821new one before you run Configure -- this will help you with most of
23822the policy defaults.
23823
23824EOM
23825fi
23826if $test -f config.msg; then
23827 echo "Hmm. I also noted the following information while running:"
23828 echo " "
23829 $cat config.msg >&4
23830 $rm -f config.msg
23831fi
23832$rm -f kit*isdone ark*isdone
23833$rm -rf UU
23834
23835: End of Configure
23836