This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
S_hfreeentries: collapse two loops
[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
356123f1 31# Generated on Mon Feb 14 23:00:18 CET 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=''
929i_stddef=''
930i_stdlib=''
931i_string=''
932strings=''
933i_sunmath=''
934i_sysaccess=''
935i_sysdir=''
936i_sysfile=''
937d_voidtty=''
938i_bsdioctl=''
939i_sysfilio=''
940i_sysioctl=''
941i_syssockio=''
942i_syslog=''
943i_sysmman=''
944i_sysmode=''
945i_sysmount=''
946i_sysndir=''
947i_sysparam=''
216dac04 948i_syspoll=''
b4eb6b3d
JH
949i_sysresrc=''
950i_syssecrt=''
951i_sysselct=''
952i_sysstat=''
953i_sysstatfs=''
954i_sysstatvfs=''
955i_systimes=''
956i_systypes=''
957i_sysuio=''
958i_sysun=''
959i_sysutsname=''
960i_sysvfs=''
961i_syswait=''
962i_sgtty=''
963i_termio=''
964i_termios=''
14b90194
JH
965d_tm_tm_gmtoff=''
966d_tm_tm_zone=''
b4eb6b3d
JH
967i_systime=''
968i_systimek=''
969i_time=''
970timeincl=''
971i_unistd=''
972i_ustat=''
973i_utime=''
974i_values=''
975i_stdarg=''
976i_varargs=''
977i_varhdr=''
978i_vfork=''
f3f1a2d8 979d_inc_version_list=''
b4eb6b3d
JH
980inc_version_list=''
981inc_version_list_init=''
982installprefix=''
983installprefixexp=''
984installstyle=''
985installusrbinperl=''
986intsize=''
987longsize=''
988shortsize=''
4b661809 989issymlink=''
2304df62 990libc=''
b4eb6b3d
JH
991ldlibpthname=''
992libperl=''
993shrpenv=''
994useshrplib=''
a0d0e21e 995glibpth=''
2304df62 996libpth=''
8e07c86e 997loclibpth=''
2304df62
AD
998plibpth=''
999xlibpth=''
1cfa4ec7 1000ignore_versioned_solibs=''
2304df62 1001libs=''
43999f95
JH
1002libsdirs=''
1003libsfiles=''
1004libsfound=''
13b3f787 1005libspath=''
85e6fe83 1006lns=''
b4eb6b3d
JH
1007d_PRIEUldbl=''
1008d_PRIFUldbl=''
1009d_PRIGUldbl=''
1010d_PRIeldbl=''
1011d_PRIfldbl=''
1012d_PRIgldbl=''
1013d_SCNfldbl=''
1014sPRIEUldbl=''
1015sPRIFUldbl=''
1016sPRIGUldbl=''
1017sPRIeldbl=''
1018sPRIfldbl=''
1019sPRIgldbl=''
1020sSCNfldbl=''
1021lseeksize=''
1022lseektype=''
d620c7b3 1023mad=''
00e74f14
NC
1024madlyh=''
1025madlyobj=''
1026madlysrc=''
f3f1a2d8
MB
1027make_set_make=''
1028d_mymalloc=''
1029freetype=''
b4eb6b3d
JH
1030mallocobj=''
1031mallocsrc=''
1032malloctype=''
9df442c2 1033usemallocwrap=''
b4eb6b3d
JH
1034usemymalloc=''
1035installman1dir=''
1036man1dir=''
1037man1direxp=''
1038man1ext=''
1039installman3dir=''
1040man3dir=''
1041man3direxp=''
1042man3ext=''
1043modetype=''
1044multiarch=''
1045mydomain=''
1046myhostname=''
1047phostname=''
2304df62
AD
1048c=''
1049n=''
b4eb6b3d
JH
1050d_eofnblk=''
1051eagain=''
1052o_nonblock=''
1053rd_nodata=''
2cc61e15 1054need_va_copy=''
b4eb6b3d
JH
1055netdb_hlen_type=''
1056netdb_host_type=''
1057netdb_name_type=''
1058netdb_net_type=''
1059groupcat=''
1060hostcat=''
1061passcat=''
1062orderlib=''
1063ranlib=''
1064d_perl_otherlibdirs=''
1065otherlibdirs=''
2304df62
AD
1066package=''
1067spackage=''
b4eb6b3d
JH
1068pager=''
1069api_revision=''
1070api_subversion=''
1071api_version=''
1072api_versionstring=''
1073patchlevel=''
151e6568 1074perl_patchlevel=''
b4eb6b3d
JH
1075revision=''
1076subversion=''
1077version=''
861eb78d 1078version_patchlevel_string=''
b4eb6b3d
JH
1079perl5=''
1080perladmin=''
91f55cc7 1081perlpath=''
b4eb6b3d 1082d_nv_preserves_uv=''
f607920a 1083d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1084i16size=''
1085i16type=''
1086i32size=''
1087i32type=''
1088i64size=''
1089i64type=''
1090i8size=''
1091i8type=''
1092ivsize=''
1093ivtype=''
b68c599a 1094nv_overflows_integers_at=''
4137585d 1095nv_preserves_uv_bits=''
b4eb6b3d
JH
1096nvsize=''
1097nvtype=''
1098u16size=''
1099u16type=''
1100u32size=''
1101u32type=''
1102u64size=''
1103u64type=''
1104u8size=''
1105u8type=''
1106uvsize=''
1107uvtype=''
1108ivdformat=''
1109nvEUformat=''
1110nvFUformat=''
1111nvGUformat=''
1112nveformat=''
1113nvfformat=''
1114nvgformat=''
1115uvXUformat=''
1116uvoformat=''
1117uvuformat=''
1118uvxformat=''
1119pidtype=''
1120prefix=''
1121prefixexp=''
1122installprivlib=''
1123privlib=''
1124privlibexp=''
1125prototype=''
1126ptrsize=''
1127d_PRIXU64=''
1128d_PRId64=''
1129d_PRIi64=''
1130d_PRIo64=''
1131d_PRIu64=''
1132d_PRIx64=''
1133sPRIXU64=''
1134sPRId64=''
1135sPRIi64=''
1136sPRIo64=''
1137sPRIu64=''
1138sPRIx64=''
1139d_quad=''
1140quadkind=''
1141quadtype=''
1142uquadtype=''
1143drand01=''
1144randbits=''
1145randfunc=''
1146randseedtype=''
1147seedfunc=''
1148installscript=''
1149scriptdir=''
1150scriptdirexp=''
1151selectminbits=''
1152selecttype=''
8ff267be 1153sh=''
b4eb6b3d
JH
1154sig_count=''
1155sig_name=''
1156sig_name_init=''
1157sig_num=''
1158sig_num_init=''
76d3c696 1159sig_size=''
f3f1a2d8 1160d_sitearch=''
b4eb6b3d
JH
1161installsitearch=''
1162sitearch=''
1163sitearchexp=''
1164installsitebin=''
1165sitebin=''
1166sitebinexp=''
8d2cbf27
JH
1167installsitehtml1dir=''
1168sitehtml1dir=''
1169sitehtml1direxp=''
1170installsitehtml3dir=''
1171sitehtml3dir=''
1172sitehtml3direxp=''
b4eb6b3d
JH
1173installsitelib=''
1174sitelib=''
1175sitelib_stem=''
1176sitelibexp=''
91e123a8
JH
1177installsiteman1dir=''
1178siteman1dir=''
1179siteman1direxp=''
1180installsiteman3dir=''
1181siteman3dir=''
1182siteman3direxp=''
b4eb6b3d
JH
1183siteprefix=''
1184siteprefixexp=''
6e1038e0
MB
1185installsitescript=''
1186sitescript=''
1187sitescriptexp=''
b4eb6b3d
JH
1188sizesize=''
1189sizetype=''
a0d0e21e 1190so=''
b4eb6b3d 1191socksizetype=''
2304df62
AD
1192sharpbang=''
1193shsharp=''
1194spitshell=''
dfe9444c 1195src=''
b4eb6b3d
JH
1196ssizetype=''
1197startperl=''
2304df62 1198startsh=''
b4eb6b3d
JH
1199stdchar=''
1200d_stdio_stream_array=''
1201stdio_stream_array=''
1202sysman=''
81c4fd9e
MB
1203sGMTIME_max=''
1204sGMTIME_min=''
73e6e416
MB
1205sLOCALTIME_max=''
1206sLOCALTIME_min=''
5ff3f7a4 1207trnl=''
b4eb6b3d
JH
1208uidformat=''
1209uidsign=''
1210uidsize=''
1211uidtype=''
1212archname64=''
1213use64bitall=''
1214use64bitint=''
34f1896b
MB
1215dtrace=''
1216usedtrace=''
15b61c98 1217usefaststdio=''
b4eb6b3d
JH
1218ccflags_uselargefiles=''
1219ldflags_uselargefiles=''
1220libswanted_uselargefiles=''
1221uselargefiles=''
1222uselongdouble=''
1223usemorebits=''
1224usemultiplicity=''
2304df62 1225nm_opt=''
40a7a20a 1226nm_so_opt=''
2304df62
AD
1227runnm=''
1228usenm=''
b4eb6b3d 1229useperlio=''
29209bc5 1230usesocks=''
b4eb6b3d
JH
1231d_oldpthreads=''
1232use5005threads=''
1233useithreads=''
9514c62b 1234usereentrant=''
b4eb6b3d 1235usethreads=''
2304df62 1236incpath=''
2304df62
AD
1237mips_type=''
1238usrinc=''
d03b3b00 1239vaproto=''
b4eb6b3d
JH
1240d_vendorarch=''
1241installvendorarch=''
1242vendorarch=''
1243vendorarchexp=''
1244d_vendorbin=''
1245installvendorbin=''
1246vendorbin=''
1247vendorbinexp=''
8d2cbf27
JH
1248installvendorhtml1dir=''
1249vendorhtml1dir=''
1250vendorhtml1direxp=''
1251installvendorhtml3dir=''
1252vendorhtml3dir=''
1253vendorhtml3direxp=''
b4eb6b3d
JH
1254d_vendorlib=''
1255installvendorlib=''
1256vendorlib=''
1257vendorlib_stem=''
1258vendorlibexp=''
91e123a8
JH
1259installvendorman1dir=''
1260vendorman1dir=''
1261vendorman1direxp=''
1262installvendorman3dir=''
1263vendorman3dir=''
1264vendorman3direxp=''
b4eb6b3d
JH
1265usevendorprefix=''
1266vendorprefix=''
1267vendorprefixexp=''
6e1038e0
MB
1268d_vendorscript=''
1269installvendorscript=''
1270vendorscript=''
1271vendorscriptexp=''
d56c5707 1272versiononly=''
b4eb6b3d
JH
1273defvoidused=''
1274voidflags=''
3659ebf1
JH
1275yacc=''
1276yaccflags=''
2304df62
AD
1277CONFIG=''
1278
34f1896b 1279: Detect odd OSs
ecfc5424
AD
1280define='define'
1281undef='undef'
1282smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1283rmlist=''
1284
1285: We must find out about Eunice early
1286eunicefix=':'
1287if test -f /etc/unixtovms; then
1288 eunicefix=/etc/unixtovms
1289fi
1290if test -f /etc/unixtovms.exe; then
1291 eunicefix=/etc/unixtovms.exe
1292fi
1293
cfb04860 1294: Set executable suffix now -- needed before hints available
6153ba32
PG
1295if test -f "/libs/version.library"; then
1296: Amiga OS
1297 _exe=""
1298elif test -f "/system/gnu_library/bin/ar.pm"; then
1299: Stratus VOS
cfb04860 1300 _exe=".pm"
6153ba32
PG
1301elif test -n "$DJGPP"; then
1302: DOS DJGPP
cfb04860 1303 _exe=".exe"
5c728af0 1304elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1305: OS/2 or cygwin
ba863942
JH
1306 _exe=".exe"
1307fi
868439a2 1308
1d8eaf8c 1309groupstype=''
b4eb6b3d 1310i_whoami=''
b8677e3b
MB
1311archname=''
1312: Possible local include directories to search.
1313: Set locincpth to "" in a hint file to defeat local include searches.
1314locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1315locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1316:
1317: no include file wanted by default
1318inclwanted=''
1319
1320: Enable -DEBUGGING and -DDEBUGGING from the command line
1321EBUGGING=''
356123f1 1322DEBUGGING=''
b8677e3b
MB
1323
1324: set usethreads on the Configure command line to enable threads.
1325usereentrant='undef'
9da7673b
MB
1326: Trailing extension. Override this in a hint file, if needed.
1327: Extra object files, if any, needed on this platform.
1328archobjs=''
64615a5e 1329libnames=''
732c9516
JH
1330: change the next line if compiling for Xenix/286 on Xenix/386
1331xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1332: Possible local library directories to search.
1333loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1334loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1335
1336: general looking path for locating libraries
5869b1f1 1337glibpth="/lib /usr/lib $xlibpth"
732c9516 1338glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1339test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1340test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1341test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1342
1343: Private path used by Configure to find libraries. Its value
1344: is prepended to libpth. This variable takes care of special
1345: machines, like the mips. Usually, it should be empty.
1346plibpth=''
1347
1cfa4ec7
GS
1348: default library list
1349libswanted=''
921b2963 1350: some systems want to use only the non-versioned libso:s
1cfa4ec7 1351ignore_versioned_solibs=''
ed140128
AD
1352: full support for void wanted by default
1353defvoidused=15
1354
ed140128
AD
1355ccname=''
1356ccversion=''
1357perllibs=''
1358: set useposix=false in your hint file to disable the POSIX extension.
1359useposix=true
1360: set useopcode=false in your hint file to disable the Opcode extension.
1361useopcode=true
b4eb6b3d
JH
1362archname64=''
1363ccflags_uselargefiles=''
1364ldflags_uselargefiles=''
1365libswanted_uselargefiles=''
1366: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1367: set usesocks on the Configure command line to enable socks.
ecfc5424 1368: List of libraries we want.
15431986 1369: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef 1370libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8119684f 1371libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1372: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1373: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1374glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1375glibpth="/usr/shlib $glibpth"
1376: Do not use vfork unless overridden by a hint file.
1377usevfork=false
1378
8ff267be 1379: Find the basic shell for Bourne shell scripts
1380case "$sh" in
1381'')
8ff267be 1382 case "$SYSTYPE" in
1383 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1384 *) xxx='/bin/sh';;
1385 esac
1386 if test -f "$xxx"; then
1387 sh="$xxx"
1388 else
1389 : Build up a list and do a single loop so we can 'break' out.
1390 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1391 for xxx in sh bash ksh pdksh ash; do
1392 for p in $pth; do
1393 try="$try ${p}/${xxx}"
1394 done
1395 done
1396 for xxx in $try; do
1397 if test -f "$xxx"; then
1398 sh="$xxx";
8ff267be 1399 break
a5a94ea5
JH
1400 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1401 sh="$xxx";
1402 break
8ff267be 1403 elif test -f "$xxx.exe"; then
1404 sh="$xxx";
8ff267be 1405 break
1406 fi
1407 done
1408 fi
1409 ;;
1410esac
1411
1412case "$sh" in
a33c94aa 1413'') cat >&2 <<EOM
8ff267be 1414$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1415
8ff267be 1416Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1417Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1418we'll try to straighten this all out.
8ff267be 1419EOM
1420 exit 1
1421 ;;
1422esac
1423
760ac839 1424: see if sh knows # comments
73614538 1425if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1426 shsharp=true
1427 spitshell=cat
760ac839 1428 xcat=/bin/cat
a931254c
JH
1429 test -f $xcat$_exe || xcat=/usr/bin/cat
1430 if test ! -f $xcat$_exe; then
4bdb8fb5 1431 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1432 if test -f $p/cat$_exe; then
1deb0a86 1433 xcat=$p/cat
3c728e00
JH
1434 break
1435 fi
1436 done
1deb0a86
JH
1437 if test ! -f $xcat$_exe; then
1438 echo "Can't find cat anywhere!"
3c728e00
JH
1439 exit 1
1440 fi
1441 fi
5440bc8e
JH
1442 echo "#!$xcat" >sharp
1443 $eunicefix sharp
1444 chmod +x sharp
1d8eaf8c 1445 ./sharp > today 2>/dev/null
760ac839 1446 if test -s today; then
760ac839
LW
1447 sharpbang='#!'
1448 else
5440bc8e
JH
1449 echo "#! $xcat" > sharp
1450 $eunicefix sharp
1451 chmod +x sharp
1d8eaf8c 1452 ./sharp > today 2>/dev/null
760ac839 1453 if test -s today; then
760ac839
LW
1454 sharpbang='#! '
1455 else
760ac839
LW
1456 sharpbang=': use '
1457 fi
1458 fi
1459else
dfe9444c 1460 echo " "
8ff267be 1461 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1462 shsharp=false
1463 cd ..
1464 echo "exec grep -v '^[ ]*#'" >spitshell
1465 chmod +x spitshell
1466 $eunicefix spitshell
1467 spitshell=`pwd`/spitshell
1468 cd UU
1469 echo "I presume that if # doesn't work, #! won't work either!"
1470 sharpbang=': use '
1471fi
5440bc8e 1472rm -f sharp today
760ac839
LW
1473
1474: figure out how to guarantee sh startup
8ff267be 1475case "$startsh" in
1476'') startsh=${sharpbang}${sh} ;;
1477*)
760ac839 1478esac
5440bc8e 1479cat >sharp <<EOSS
760ac839
LW
1480$startsh
1481set abc
1482test "$?abc" != 1
1483EOSS
1484
5440bc8e
JH
1485chmod +x sharp
1486$eunicefix sharp
1487if ./sharp; then
8ff267be 1488 : echo "Yup, it does."
760ac839 1489else
dfe9444c
AD
1490 echo "Hmm... '$startsh' does not guarantee sh startup..."
1491 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1492fi
5440bc8e 1493rm -f sharp
760ac839 1494
aebf16e7
AD
1495: Save command line options in file UU/cmdline.opt for later use in
1496: generating config.sh.
1497cat > cmdline.opt <<EOSH
613d6c3e 1498: Configure command line arguments.
aebf16e7
AD
1499config_arg0='$0'
1500config_args='$*'
1501config_argc=$#
1502EOSH
1503argn=1
ee45ea83
IZ
1504args_exp=''
1505args_sep=''
aebf16e7
AD
1506for arg in "$@"; do
1507 cat >>cmdline.opt <<EOSH
1508config_arg$argn='$arg'
1509EOSH
ee45ea83
IZ
1510 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1511$arg
1512EOC
1513 arg_exp=`cat cmdl.opt`
1514 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1515 argn=`expr $argn + 1`
ee45ea83 1516 args_sep=' '
aebf16e7 1517done
ee45ea83 1518rm -f cmdl.opt
aebf16e7 1519
2304df62
AD
1520: produce awk script to parse command line options
1521cat >options.awk <<'EOF'
1522BEGIN {
02e93a22 1523 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1524
1525 len = length(optstr);
1526 for (i = 1; i <= len; i++) {
1527 c = substr(optstr, i, 1);
1528 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1529 if (a == ":") {
1530 arg[c] = 1;
1531 i++;
1532 }
1533 opt[c] = 1;
1534 }
1535}
1536{
1537 expect = 0;
1538 str = $0;
1539 if (substr(str, 1, 1) != "-") {
1540 printf("'%s'\n", str);
1541 next;
1542 }
1543 len = length($0);
1544 for (i = 2; i <= len; i++) {
1545 c = substr(str, i, 1);
1546 if (!opt[c]) {
1547 printf("-%s\n", substr(str, i));
1548 next;
1549 }
1550 printf("-%s\n", c);
1551 if (arg[c]) {
1552 if (i < len)
1553 printf("'%s'\n", substr(str, i + 1));
1554 else
1555 expect = 1;
1556 next;
1557 }
1558 }
1559}
1560END {
1561 if (expect)
1562 print "?";
1563}
1564EOF
1565
1566: process the command line options
4633a7c4
LW
1567set X `for arg in "$@"; do echo "X$arg"; done |
1568 sed -e s/X// | awk -f options.awk`
2304df62
AD
1569eval "set $*"
1570shift
1571rm -f options.awk
1572
1573: set up default values
1574fastread=''
1575reuseval=false
1576config_sh=''
1577alldone=''
1578error=''
1579silent=''
1580extractsh=''
ecfc5424 1581override=''
16d20bd9 1582knowitall=''
02e93a22 1583rm -f optdef.sh posthint.sh
28757baa 1584cat >optdef.sh <<EOS
1585$startsh
1586EOS
2304df62 1587
dfe9444c 1588
2304df62
AD
1589: option parsing
1590while test $# -gt 0; do
1591 case "$1" in
1592 -d) shift; fastread=yes;;
1593 -e) shift; alldone=cont;;
1594 -f)
1595 shift
1596 cd ..
1597 if test -r "$1"; then
1598 config_sh="$1"
1599 else
a0d0e21e 1600 echo "$me: cannot read config file $1." >&2
2304df62
AD
1601 error=true
1602 fi
1603 cd UU
1604 shift;;
3f30fabf 1605 --help|\
2304df62
AD
1606 -h) shift; error=true;;
1607 -r) shift; reuseval=true;;
dfe9444c 1608 -s) shift; silent=true; realsilent=true;;
2304df62 1609 -E) shift; alldone=exit;;
16d20bd9 1610 -K) shift; knowitall=true;;
ecfc5424 1611 -O) shift; override=true;;
dfe9444c 1612 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1613 -D)
1614 shift
1615 case "$1" in
1616 *=)
1617 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1618 echo "$me: ignoring -D $1" >&2
1619 ;;
ecfc5424 1620 *=*) echo "$1" | \
1aef975c
AD
1621 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1622 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1623 esac
1624 shift
1625 ;;
1626 -U)
1627 shift
1628 case "$1" in
1aef975c 1629 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1630 *=*)
1631 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1632 echo "$me: ignoring -U $1" >&2
1633 ;;
1aef975c 1634 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1635 esac
1636 shift
1637 ;;
02e93a22
JH
1638 -A)
1639 shift
1640 xxx=''
1641 yyy="$1"
02e93a22 1642 zzz=''
5f83a3e9 1643 uuu=undef
02e93a22 1644 case "$yyy" in
f7c31117 1645 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1646 case "$zzz" in
1647 *:*) zzz='' ;;
1648 *) xxx=append
613d6c3e 1649 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
f7c31117 1650 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1651 esac
1652 ;;
1653 esac
1654 case "$xxx" in
1655 '') case "$yyy" in
f7c31117
JH
1656 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1657 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1658 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1659 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1660 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1661 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9 1662 esac
613d6c3e 1663 ;;
5f83a3e9 1664 esac
02e93a22
JH
1665 case "$xxx" in
1666 append)
5f83a3e9 1667 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1668 clear)
5f83a3e9 1669 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1670 define)
1671 case "$zzz" in
1672 '') zzz=define ;;
1673 esac
5f83a3e9 1674 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1675 eval)
5f83a3e9 1676 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1677 prepend)
5f83a3e9 1678 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1679 undef)
1680 case "$zzz" in
1681 '') zzz="$uuu" ;;
1682 esac
5f83a3e9
JH
1683 echo "$yyy=$zzz" >> posthint.sh ;;
1684 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1685 esac
bde6b06b 1686 shift
02e93a22 1687 ;;
216dac04 1688 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
5f83a3e9 1689 exit 0;;
2304df62 1690 --) break;;
a0d0e21e 1691 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1692 *) break;;
1693 esac
1694done
1695
1696case "$error" in
1697true)
1698 cat >&2 <<EOM
2afac517 1699Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1700 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1701 -d : use defaults for all answers.
1702 -e : go on without questioning past the production of config.sh.
1703 -f : specify an alternate default configuration file.
1704 -h : print this help message and exit (with an error status).
1705 -r : reuse C symbols value if possible (skips costly nm extraction).
1706 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1707 -D : define symbol to have some value:
1708 -D symbol symbol gets the value 'define'
1709 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1710 common used examples (see INSTALL for more info):
1711 -Duse64bitint use 64bit integers
b79e0b55 1712 -Duse64bitall use 64bit integers and pointers
3f30fabf 1713 -Dusethreads use thread support
b79e0b55 1714 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1715 -DEBUGGING=none DEBUGGING options
1716 -Dcc=gcc choose your compiler
1717 -Dprefix=/opt/perl5 choose your destination
2304df62 1718 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1719 -K : do not use unless you know what you are doing.
ecfc5424 1720 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1721 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1722 -U : undefine symbol:
1723 -U symbol symbol gets the value 'undef'
1724 -U symbol= symbol gets completely empty
3f30fabf 1725 e.g.: -Uversiononly
02e93a22 1726 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1727 -A append:symbol=value append value to symbol
1728 -A symbol=value like append:, but with a separating space
1729 -A define:symbol=value define symbol to have value
1730 -A clear:symbol define symbol to be ''
1731 -A define:symbol define symbol to be 'define'
1732 -A eval:symbol=value define symbol to be eval of value
1733 -A prepend:symbol=value prepend value to symbol
1734 -A undef:symbol define symbol to be 'undef'
1735 -A undef:symbol= define symbol to be ''
3f30fabf 1736 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1737 -A ccflags=-DSOME_MACRO
2304df62
AD
1738 -V : print version number and exit (with a zero status).
1739EOM
1740 exit 1
1741 ;;
1742esac
1743
dfe9444c
AD
1744: Sanity checks
1745case "$fastread$alldone" in
1746yescont|yesexit) ;;
1747*)
aaeb8e51
GS
1748 case "$extractsh" in
1749 true) ;;
1750 *)
1751 if test ! -t 0; then
1752 echo "Say 'sh Configure', not 'sh <Configure'"
1753 exit 1
1754 fi
1755 ;;
1756 esac
dfe9444c
AD
1757 ;;
1758esac
1759
2304df62
AD
1760exec 4>&1
1761case "$silent" in
1762true) exec 1>/dev/null;;
1763esac
1764
ecfc5424 1765: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1766touch optdef.sh
1767. ./optdef.sh
02e93a22
JH
1768: create the posthint manipulation script and leave the file out there...
1769touch posthint.sh
a0d0e21e 1770
2304df62 1771: set package name
34f1896b 1772package='perl5'
b4eb6b3d
JH
1773first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1774last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1775case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1776ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1777*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1778esac
2304df62 1779
2304df62
AD
1780: Some greps do not return status, grrr.
1781echo "grimblepritz" >grimble
1782if grep blurfldyick grimble >/dev/null 2>&1 ; then
1783 contains=contains
1784elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1785 contains=grep
1786else
1787 contains=contains
1788fi
1789rm -f grimble
1790: the following should work in any shell
1791case "$contains" in
1792contains*)
1793 echo " "
1794 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1795 cat >contains <<'EOSS'
1796grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1797EOSS
1798chmod +x contains
1799esac
1800
dfe9444c
AD
1801: Find the path to the source tree
1802case "$src" in
1803'') case "$0" in
b233458b
JH
1804 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1805 case "$src" in
1806 /*) ;;
8504afb7 1807 .) ;;
b233458b
JH
1808 *) src=`cd ../$src && pwd` ;;
1809 esac
1810 ;;
dfe9444c
AD
1811 *) src='.';;
1812 esac;;
1813esac
1814case "$src" in
1815'') src=/
1816 rsrc=/
1817 ;;
34f1896b
MB
1818/*) rsrc="$src";;
1819*) rsrc="../$src";;
dfe9444c
AD
1820esac
1821if test -f $rsrc/Configure && \
34f1896b 1822 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
dfe9444c
AD
1823then
1824 : found it, so we are ok.
1825else
1826 rsrc=''
1827 for src in . .. ../.. ../../.. ../../../..; do
1828 if test -f ../$src/Configure && \
1829 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1830 then
1831 rsrc=../$src
1832 break
1833 fi
1834 done
1835fi
1836case "$rsrc" in
1837'')
1838 cat <<EOM >&4
1839
1840Sorry, I can't seem to locate the source dir for $package. Please start
1841Configure with an explicit path -- i.e. /some/path/Configure.
1842
1843EOM
1844 exit 1
1845 ;;
1846../.) rsrc='..';;
1847*)
1848 echo " "
1849 echo "Sources for $package found in \"$src\"." >&4
1850 ;;
1851esac
1852
1853: script used to extract .SH files with variable substitutions
1854cat >extract <<'EOS'
a02608de 1855PERL_CONFIG_SH=true
dfe9444c 1856echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1857if test -f MANIFEST; then
1858 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1859else
1860 echo "(Looking for .SH files under the source directory.)"
6904989c 1861 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1862fi
1863shift
1864case $# in
6904989c 18650) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1866esac
6904989c 1867if test ! -f "$src/$1"; then
dfe9444c
AD
1868 shift
1869fi
1870mkdir_p='
1871name=$1;
1872create="";
1873while test $name; do
1874 if test ! -d "$name"; then
1875 create="$name $create";
1876 name=`echo $name | sed -e "s|^[^/]*$||"`;
1877 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1878 else
1879 name="";
1880 fi;
1881done;
1882for file in $create; do
1883 mkdir $file;
1884done
1885'
1886for file in $*; do
1887 case "$src" in
1888 ".")
1889 case "$file" in
1890 */*)
1891 dir=`expr X$file : 'X\(.*\)/'`
1892 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1893 (cd "$dir" && . ./$file)
dfe9444c
AD
1894 ;;
1895 *)
1896 . ./$file
1897 ;;
1898 esac
1899 ;;
1900 *)
1901 case "$file" in
1902 */*)
1903 dir=`expr X$file : 'X\(.*\)/'`
1904 file=`expr X$file : 'X.*/\(.*\)'`
1905 (set x $dir; shift; eval $mkdir_p)
6904989c 1906 sh <"$src/$dir/$file"
dfe9444c
AD
1907 ;;
1908 *)
6904989c 1909 sh <"$src/$file"
dfe9444c
AD
1910 ;;
1911 esac
1912 ;;
1913 esac
1914done
6904989c 1915if test -f "$src/config_h.SH"; then
dfe9444c
AD
1916 if test ! -f config.h; then
1917 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1918 . "$src/config_h.SH"
dfe9444c
AD
1919 fi
1920fi
1921EOS
1922
1923: extract files and exit if asked to do so
1924case "$extractsh" in
1925true)
1926 case "$realsilent" in
1927 true) ;;
1928 *) exec 1>&4;;
1929 esac
1930 case "$config_sh" in
1931 '') config_sh='config.sh';;
1932 esac
1933 echo " "
1934 echo "Fetching answers from $config_sh..."
1935 cd ..
1936 . $config_sh
1937 test "$override" && . ./optdef.sh
1938 echo " "
1939 . UU/extract
1940 rm -rf UU
24ccb310 1941 echo "Extraction done."
dfe9444c
AD
1942 exit 0
1943 ;;
1944esac
1945
1946: Eunice requires " " instead of "", can you believe it
1947echo " "
1948: Here we go...
1949echo "Beginning of configuration questions for $package."
1950
1951trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1952
2304df62
AD
1953: first determine how to suppress newline on echo command
1954echo " "
1955echo "Checking echo to see how to suppress newlines..."
1956(echo "hi there\c" ; echo " ") >.echotmp
1957if $contains c .echotmp >/dev/null 2>&1 ; then
1958 echo "...using -n."
1959 n='-n'
1960 c=''
1961else
1962 cat <<'EOM'
1963...using \c
1964EOM
1965 n=''
1966 c='\c'
1967fi
1968echo $n "The star should be here-->$c"
1969echo '*'
1970rm -f .echotmp
1971
1972: Now test for existence of everything in MANIFEST
1973echo " "
6904989c 1974if test -f "$rsrc/MANIFEST"; then
2304df62 1975 echo "First let's make sure your kit is complete. Checking..." >&4
1d8eaf8c 1976 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
776a38e3 1977 (split -l 50 2>/dev/null || split -50)
2304df62 1978 rm -f missing
dfe9444c 1979 tmppwd=`pwd`
2304df62 1980 for filelist in x??; do
776a38e3
MB
1981 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1982 >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1983 done
1984 if test -s missing; then
1985 cat missing >&4
1986 cat >&4 <<'EOM'
1987
1988THIS PACKAGE SEEMS TO BE INCOMPLETE.
1989
1990You have the option of continuing the configuration process, despite the
1991distinct possibility that your kit is damaged, by typing 'y'es. If you
1992do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1993and contact the author (perlbug@perl.org).
2304df62
AD
1994
1995EOM
1996 echo $n "Continue? [n] $c" >&4
1997 read ans
1998 case "$ans" in
1999 y*)
2000 echo "Continuing..." >&4
2001 rm -f missing
2002 ;;
2003 *)
2004 echo "ABORTING..." >&4
2005 kill $$
2006 ;;
2007 esac
2008 else
dfe9444c 2009 echo "Looks good..."
2304df62
AD
2010 fi
2011else
2012 echo "There is no MANIFEST file. I hope your kit is complete !"
2013fi
2014rm -f missing x??
2015
5ff3f7a4 2016: Find the appropriate value for a newline for tr
613d6c3e 2017echo " "
5ff3f7a4
GS
2018if test -n "$DJGPP"; then
2019 trnl='\012'
2020fi
2021if test X"$trnl" = X; then
2022 case "`echo foo|tr '\n' x 2>/dev/null`" in
2023 foox) trnl='\n' ;;
2024 esac
2025fi
2026if test X"$trnl" = X; then
2027 case "`echo foo|tr '\012' x 2>/dev/null`" in
2028 foox) trnl='\012' ;;
2029 esac
2030fi
2031if test X"$trnl" = X; then
8be2c24c
JH
2032 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2033 fooxy) trnl='\n\r' ;;
2034 esac
2035fi
2036if test X"$trnl" = X; then
5ff3f7a4
GS
2037 cat <<EOM >&2
2038
2039$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2040
2041EOM
2042 exit 1
2043fi
2044
2304df62
AD
2045: compute the number of columns on the terminal for proper question formatting
2046case "$COLUMNS" in
2047'') COLUMNS='80';;
2048esac
2049
2050: set up the echo used in my read
2051myecho="case \"\$xxxm\" in
2052'') echo $n \"\$rp $c\" >&4;;
2053*) case \"\$rp\" in
2054 '') echo $n \"[\$xxxm] $c\";;
2055 *)
2056 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2057 echo \"\$rp\" >&4
2058 echo $n \"[\$xxxm] $c\" >&4
2059 else
2060 echo $n \"\$rp [\$xxxm] $c\" >&4
2061 fi
2062 ;;
2063 esac;;
2064esac"
2065
2066: now set up to do reads with possible shell escape and default assignment
2067cat <<EOSC >myread
28757baa 2068$startsh
2304df62
AD
2069xxxm=\$dflt
2070$myecho
2071ans='!'
2072case "\$fastread" in
2073yes) case "\$dflt" in
2074 '') ;;
2075 *) ans='';
2076 case "\$silent-\$rp" in
2077 true-) ;;
2078 *) echo " " >&4;;
2079 esac;;
2080 esac;;
2081*) case "\$silent" in
2082 true) case "\$rp" in
2083 '') ans='';;
2084 esac;;
2085 esac;;
2086esac
2087while expr "X\$ans" : "X!" >/dev/null; do
2088 read answ
2089 set x \$xxxm
2090 shift
dfe9444c 2091 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2092 case "\$answ" in
dfe9444c
AD
2093 "!")
2094 sh 1>&4
2095 echo " "
2096 $myecho
2097 ;;
2098 !*)
2099 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2100 shift
2101 sh 1>&4 -c "\$*"
2102 echo " "
2103 $myecho
2104 ;;
2304df62
AD
2105 "\$ans")
2106 case "\$ans" in
ecfc5424
AD
2107 \\&*)
2108 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2109 shift
2110 case "\$1" in
2111 -d)
2112 fastread=yes
40a7a20a 2113 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2114 ;;
2115 -*)
40a7a20a 2116 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2117 ;;
2118 esac
2119 $myecho
2120 ans=!
2121 ;;
2304df62
AD
2122 esac;;
2123 *)
2124 case "\$aok" in
2125 y)
2126 echo "*** Substitution done -- please confirm."
2127 xxxm="\$ans"
c9795ab7 2128 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2129 xxxm="\$ans"
2130 ans=!
2131 ;;
2132 *)
2133 echo "*** Error -- try again."
2134 ans=!
2135 ;;
2136 esac
2137 $myecho
2138 ;;
2139 esac
2140 case "\$ans\$xxxm\$nostick" in
2141 '')
2142 ans=!
2143 $myecho
2144 ;;
2145 esac
2146done
2147case "\$ans" in
2148'') ans="\$xxxm";;
2149esac
2150EOSC
2151
2152: create .config dir to save info across Configure sessions
2153test -d ../.config || mkdir ../.config
2154cat >../.config/README <<EOF
2155This directory created by Configure to save information that should
dfe9444c 2156persist across sessions for $package.
2304df62
AD
2157
2158You may safely delete it if you wish.
2159EOF
2160
613d6c3e 2161: See if we are using a devel version and want that
9507cadf 2162xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2163case "$usedevel" in
1be1b388
MB
2164$define|true|[yY]*)
2165 usedevel="$define" ;;
9507cadf 2166*) case "$xversion" in
0107c034
JH
2167 *[13579])
2168 cat >&4 <<EOH
2169*** WHOA THERE!!! ***
2170
2171 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2172 The version of this $package distribution is $xversion, that is, odd,
2173 (as opposed to even) and that signifies a development release.
3d5d58b1 2174 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2175
2176 Do ***NOT*** install this into production use.
2177 Data corruption and crashes are possible.
2178
2179 It is most seriously suggested that you do not continue any further
2180 unless you want to help in developing and debugging Perl.
2181
6adc6a45
JH
2182 If you *still* want to build perl, you can answer 'y' now,
2183 or pass -Dusedevel to Configure.
2184
0107c034
JH
2185EOH
2186 rp='Do you really want to continue?'
2187 dflt='n'
2188 . ./myread
2189 case "$ans" in
8feeef0e
JH
2190 [yY]) echo >&4 "Okay, continuing."
2191 usedevel="$define" ;;
0107c034
JH
2192 *) echo >&4 "Okay, bye."
2193 exit 1
2194 ;;
2195 esac
2196 ;;
2197 esac
1be1b388 2198 usedevel="$undef"
0107c034
JH
2199 ;;
2200esac
8feeef0e
JH
2201case "$usedevel" in
2202$define|true|[yY]*)
2203 case "$versiononly" in
2204 '') versiononly="$define" ;;
2205 esac
2206 case "$installusrbinperl" in
2207 '') installusrbinperl="$undef" ;;
2208 esac
2209 ;;
2210esac
0107c034 2211
2304df62
AD
2212: general instructions
2213needman=true
2214firsttime=true
760ac839 2215user=`(logname) 2>/dev/null`
dfe9444c
AD
2216case "$user" in
2217'') user=`whoami 2>&1`;;
760ac839 2218esac
2304df62
AD
2219if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2220 firsttime=false
2221 echo " "
2222 rp='Would you like to see the instructions?'
2223 dflt=n
2224 . ./myread
2225 case "$ans" in
2226 [yY]*) ;;
2227 *) needman=false;;
2228 esac
2229fi
2230if $needman; then
2231 cat <<EOH
4e2a5f63 2232
2304df62 2233This installation shell script will examine your system and ask you questions
a0d0e21e 2234to determine how the perl5 package should be installed. If you get
2304df62
AD
2235stuck on a question, you may use a ! shell escape to start a subshell or
2236execute a command. Many of the questions will have default answers in square
2237brackets; typing carriage return will give you the default.
2238
2239On some of the questions which ask for file or directory names you are allowed
2240to use the ~name construct to specify the login directory belonging to "name",
2241even if you don't have a shell which knows about that. Questions where this is
2242allowed will be marked "(~name ok)".
2243
2244EOH
2245 rp=''
2246 dflt='Type carriage return to continue'
2247 . ./myread
2248 cat <<'EOH'
2249
2250The prompter used in this script allows you to use shell variables and
2251backticks in your answers. You may use $1, $2, etc... to refer to the words
2252in the default answer, as if the default line was a set of arguments given to a
2253script shell. This means you may also use $* to repeat the whole default line,
2254so you do not have to re-type everything to add something to the default.
2255
cd95ead5 2256Every time there is a substitution, you will have to confirm. If there is an
2304df62
AD
2257error (e.g. an unmatched backtick), the default answer will remain unchanged
2258and you will be prompted again.
2259
2260If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2261the questions and use the computed defaults (or the previous answers if there
2262was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2263You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2264on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2265
2266EOH
2267 . ./myread
2268 cat <<EOH
2269
2270Much effort has been expended to ensure that this shell script will run on any
2271Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2272Configure and run it again. If you can't run Configure for some reason,
2273you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2274have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2275
2276This installation script affects things in two ways:
2277
22781) it may do direct variable substitutions on some of the files included
2279 in this kit.
22802) it builds a config.h file for inclusion in C programs. You may edit
2281 any of these files as the need arises after running this script.
2282
2283If you make a mistake on a question, there is no easy way to back up to it
2284currently. The easiest thing to do is to edit config.sh and rerun all the SH
2285files. Configure will offer to let you do this before it runs the SH files.
2286
2287EOH
2288 dflt='Type carriage return to continue'
2289 . ./myread
2290 case "$firsttime" in
2291 true) echo $user >>../.config/instruct;;
2292 esac
2293fi
2294
2304df62
AD
2295: find out where common programs are
2296echo " "
2297echo "Locating common programs..." >&4
2298cat <<EOSC >loc
2299$startsh
2300case \$# in
23010) exit 1;;
2302esac
2303thing=\$1
2304shift
2305dflt=\$1
2306shift
2307for dir in \$*; do
2308 case "\$thing" in
2309 .)
2310 if test -d \$dir/\$thing; then
2311 echo \$dir
2312 exit 0
2313 fi
2314 ;;
2315 *)
a0d0e21e 2316 for thisthing in \$dir/\$thing; do
ecfc5424 2317 : just loop through to pick last item
a0d0e21e 2318 done
25f94b33 2319 if test -f \$thisthing; then
a0d0e21e 2320 echo \$thisthing
2304df62 2321 exit 0
a5a94ea5
JH
2322 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2323 echo \$thisthing
776a38e3 2324 exit 0
2304df62 2325 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2326 if test -n "$DJGPP"; then
2327 echo \$dir/\$thing.exe
b921d661 2328 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2329 : on Eunice apparently
2330 echo \$dir/\$thing
2331 fi
2d736872 2332 exit 0
2304df62
AD
2333 fi
2334 ;;
2335 esac
2336done
2337echo \$dflt
2338exit 1
2339EOSC
2340chmod +x loc
2341$eunicefix loc
2342loclist="
2343awk
2344cat
f8006fac 2345chmod
b4eb6b3d
JH
2346comm
2347cp
2304df62
AD
2348echo
2349expr
2350grep
a0d0e21e 2351ls
b4eb6b3d 2352mkdir
2304df62
AD
2353rm
2354sed
b4eb6b3d 2355sort
85e6fe83 2356touch
2304df62 2357tr
b4eb6b3d 2358uniq
2304df62
AD
2359"
2360trylist="
dfe9444c 2361ar
3659ebf1 2362bison
b4eb6b3d 2363byacc
2304df62 2364cpp
b4eb6b3d 2365csh
2304df62
AD
2366date
2367egrep
1fef16b3 2368gmake
8ff267be 2369gzip
b4eb6b3d 2370less
8ff267be 2371ln
3c728e00 2372make
b4eb6b3d 2373more
693762b4 2374nm
b4eb6b3d 2375nroff
b8677e3b 2376perl
b4eb6b3d 2377pg
2304df62
AD
2378test
2379uname
8ff267be 2380zip
2304df62 2381"
8e07c86e 2382pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2383pth="$pth /lib /usr/lib"
2384for file in $loclist; do
dfe9444c
AD
2385 eval xxx=\$$file
2386 case "$xxx" in
2387 /*|?:[\\/]*)
2388 if test -f "$xxx"; then
2389 : ok
2390 else
2391 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2392 xxx=`./loc $file $file $pth`
2393 fi
2394 ;;
2395 '') xxx=`./loc $file $file $pth`;;
2396 *) xxx=`./loc $xxx $xxx $pth`;;
2397 esac
a5a94ea5 2398 eval $file=$xxx$_exe
2304df62
AD
2399 eval _$file=$xxx
2400 case "$xxx" in
2401 /*)
2402 echo $file is in $xxx.
2403 ;;
8e07c86e
AD
2404 ?:[\\/]*)
2405 echo $file is in $xxx.
2406 ;;
2304df62 2407 *)
25f94b33
AD
2408 echo "I don't know where '$file' is, and my life depends on it." >&4
2409 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2410 exit 1
2304df62
AD
2411 ;;
2412 esac
2413done
2414echo " "
2415echo "Don't worry if any of the following aren't found..."
2416say=offhand
2417for file in $trylist; do
dfe9444c
AD
2418 eval xxx=\$$file
2419 case "$xxx" in
2420 /*|?:[\\/]*)
2421 if test -f "$xxx"; then
2422 : ok
2423 else
2424 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2425 xxx=`./loc $file $file $pth`
2426 fi
2427 ;;
2428 '') xxx=`./loc $file $file $pth`;;
2429 *) xxx=`./loc $xxx $xxx $pth`;;
2430 esac
306a8474 2431 eval $file=$xxx$_exe
2304df62
AD
2432 eval _$file=$xxx
2433 case "$xxx" in
2434 /*)
2435 echo $file is in $xxx.
2436 ;;
8e07c86e
AD
2437 ?:[\\/]*)
2438 echo $file is in $xxx.
2439 ;;
2304df62
AD
2440 *)
2441 echo "I don't see $file out there, $say."
2442 say=either
2443 ;;
2444 esac
2445done
2446case "$egrep" in
1fef16b3 2447egrep)
2304df62
AD
2448 echo "Substituting grep for egrep."
2449 egrep=$grep
868439a2 2450 _egrep=$grep
2304df62
AD
2451 ;;
2452esac
3141af47
MB
2453case "$less" in
2454'') ;;
2455*) if $less -R </dev/null >/dev/null; then
2456 echo "Substituting less -R for less."
2457 less="$less -R"
2458 _less=$less
2459 fi
2460 ;;
2461esac
8ff267be 2462case "$ln" in
1fef16b3 2463ln)
8ff267be 2464 echo "Substituting cp for ln."
2465 ln=$cp
868439a2 2466 _ln=$cp
8ff267be 2467 ;;
2468esac
2e26f1d5 2469case "$make" in
613d6c3e 2470make)
2e26f1d5
JH
2471 case "$gmake" in
2472 gmake)
2473 echo "I can't find make or gmake, and my life depends on it." >&4
2474 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2475 exit 1
2476 ;;
2477 esac
2478 ;;
613d6c3e 2479esac
2e26f1d5
JH
2480case "$gmake" in
2481gmake) ;;
2482*) # We can't have osname yet.
1fef16b3
JH
2483 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2484 # Assume that gmake, if found, is definitely GNU make
2485 # and prefer it over the system make.
2486 echo "Substituting gmake for make."
2487 make=$gmake
868439a2 2488 _make=$gmake
1fef16b3
JH
2489 fi
2490 ;;
a5a94ea5 2491esac
2304df62
AD
2492case "$test" in
2493test)
2494 echo "Hopefully test is built into your sh."
2495 ;;
2496*)
73614538 2497 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2498 echo "Using the test built into your sh."
2304df62
AD
2499 test=test
2500 _test=test
2501 fi
2502 ;;
2503esac
2504case "$echo" in
2505echo)
2506 echo "Hopefully echo is built into your sh."
2507 ;;
2508'') ;;
2509*)
2510 echo " "
2511echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2512 $echo $n "hi there$c" >foo1
2513 echo $n "hi there$c" >foo2
2514 if cmp foo1 foo2 >/dev/null 2>&1; then
2515 echo "They are compatible. In fact, they may be identical."
2516 else
2517 case "$n" in
2518 '-n') n='' c='\c';;
2519 *) n='-n' c='';;
2520 esac
2521 cat <<FOO
2522They are not compatible! You are probably running ksh on a non-USG system.
2523I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2524have echo built in and we may have to run some Bourne shell scripts. That
2525means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2526
2527FOO
2528 $echo $n "The star should be here-->$c"
2529 $echo "*"
2530 fi
2531 $rm -f foo1 foo2
2532 ;;
2533esac
2534
2f88d857
MB
2535# This question was auctioned at YAPC::Europe-2007 in Vienna
2536# I never promised you could answer it. I only auctioned the question.
2537cat <<FOO
2538The following message is sponsored by
2539
2540 Dresden.pm<--The stars should be here.
2541
2542Dear Perl user, system administrator or package
2543maintainer, the Perl community sends greetings to
2544you. Do you (emblematical) greet back [Y/n]? n
2545
2546FOO
2547
613d6c3e 2548: Check what type of C compiler we use
6b769f8f 2549cat <<EOS >trygcc
2573c5f9
JH
2550$startsh
2551EOS
6b769f8f 2552cat <<'EOSC' >>trygcc
2573c5f9
JH
2553case "$cc" in
2554'') ;;
2555*) $rm -f try try.*
2556 $cat >try.c <<EOM
2557int main(int argc, char *argv[]) {
2558 return 0;
2559}
2560EOM
e4778687 2561 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2562 :
2563 else
2564 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2565 despair=yes
2566 trygcc=yes
2567 case "$cc" in
2568 *gcc*) trygcc=no ;;
2569 esac
dce40316
AD
2570 # Skip this test because it gives a false match on output like:
2571 # ./trygcc: line 23: cc: command not found
2572 # case "`$cc -v -c try.c 2>&1`" in
2573 # *gcc*) trygcc=no ;;
2574 # esac
2573c5f9
JH
2575 if $test X"$trygcc" = Xyes; then
2576 if gcc -o try -c try.c; then
2577 echo " "
2578 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2579 # Switching compilers may undo the work of hints files.
2580 # The most common problem is -D_REENTRANT for threads.
2581 # This heuristic catches that case, but gets false positives
2582 # if -Dusethreads was not actually specified. Better to
2583 # bail out here with a useful message than fail
2584 # mysteriously later. Should we perhaps just try to
2585 # re-invoke Configure -Dcc=gcc config_args ?
2586 if $test -f usethreads.cbu; then
2587 $cat >&4 <<EOM
2588
2589*** However, any setting of the C compiler flags (e.g. for thread support)
2590*** will be lost. It may be necessary for you to restart Configure and
2591*** add -Dcc=gcc to your Configure command line.
2592
2593EOM
2594 rp="Would you like to go ahead and try gcc anyway?"
2595 dflt=n
2596 else
2597 rp="Would you like to use it?"
2598 dflt=y
2599 fi
2573c5f9
JH
2600 if $test -f myread; then
2601 . ./myread
2602 else
2603 if $test -f UU/myread; then
2604 . ./UU/myread
2605 else
2606 echo "Cannot find myread, sorry. Aborting." >&2
2607 exit 1
2608 fi
2609 fi
2610 case "$ans" in
6371411c 2611 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2612 esac
2613 fi
2614 fi
6b769f8f
RB
2615 fi
2616 $rm -f try try.*
2617 ;;
2618esac
2619EOSC
2620
2621cat <<EOS >checkcc
2622$startsh
2623EOS
2624cat <<'EOSC' >>checkcc
2625case "$cc" in
2626'') ;;
2627*) $rm -f try try.*
2628 $cat >try.c <<EOM
2629int main(int argc, char *argv[]) {
2630 return 0;
2631}
2632EOM
2633 if $cc -o try $ccflags $ldflags try.c; then
2634 :
2635 else
2573c5f9 2636 if $test X"$despair" = Xyes; then
6b769f8f
RB
2637 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2638 fi
2639 $cat >&4 <<EOM
5dd4fbdf
MB
2640You need to find a working C compiler.
2641Either (purchase and) install the C compiler supplied by your OS vendor,
2642or for a free C compiler try http://gcc.gnu.org/
2643I cannot continue any further, aborting.
2644EOM
6b769f8f 2645 exit 1
2573c5f9
JH
2646 fi
2647 $rm -f try try.*
2648 ;;
2649esac
2650EOSC
2651
a0d0e21e
LW
2652: determine whether symbolic links are supported
2653echo " "
2654$touch blurfl
2655if $ln -s blurfl sym > /dev/null 2>&1 ; then
2656 echo "Symbolic links are supported." >&4
818f00be 2657 lns="$ln -s"
a0d0e21e
LW
2658else
2659 echo "Symbolic links are NOT supported." >&4
2660 lns="$ln"
2661fi
2662$rm -f blurfl sym
2663
dafca956
JH
2664: determine whether symbolic links are supported
2665echo " "
2666case "$lns" in
18ea2752 2667*"ln"*" -s")
dafca956
JH
2668 echo "Checking how to test for symbolic links..." >&4
2669 $lns blurfl sym
4b661809 2670 if $test "X$issymlink" = X; then
2e2a97a6
JH
2671 case "$newsh" in
2672 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2673 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2674 esac
5d644a95
MB
2675 if test $? = 0; then
2676 issymlink="test -h"
2e2a97a6
JH
2677 else
2678 echo "Your builtin 'test -h' may be broken." >&4
2679 case "$test" in
2680 /*) ;;
2681 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2682 for p in $pth
2683 do
2684 if test -f "$p/$test"; then
2685 test="$p/$test"
2686 break
2687 fi
2688 done
2689 ;;
2690 esac
2691 case "$test" in
2692 /*)
2693 echo "Trying external '$test -h'." >&4
2694 issymlink="$test -h"
2695 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2696 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2697 issymlink=''
2698 fi
2699 ;;
2700 *) issymlink='' ;;
2701 esac
5d644a95
MB
2702 fi
2703 fi
4b661809 2704 if $test "X$issymlink" = X; then
dafca956 2705 if $test -L sym 2>/dev/null; then
5d644a95 2706 issymlink="$test -L"
2e2a97a6 2707 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2708 fi
2709 fi
4b661809 2710 if $test "X$issymlink" != X; then
5d644a95 2711 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2712 else
2713 echo "I do not know how you can test for symbolic links." >&4
2714 fi
2715 $rm -f blurfl sym
2716 ;;
2717*) echo "No symbolic links, so not testing for their testing..." >&4
2718 ;;
2719esac
2720echo " "
2721
34f1896b 2722: Make symlinks util
dafca956
JH
2723case "$mksymlinks" in
2724$define|true|[yY]*)
2725 case "$src" in
2726 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2727 exit 1
2728 ;;
4b661809 2729 *) case "$lns:$issymlink" in
f314eb9f 2730 *"ln"*" -s:"*"test -"?)
dafca956
JH
2731 echo "Creating the symbolic links..." >&4
2732 echo "(First creating the subdirectories...)" >&4
2733 cd ..
2734 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2735 read directory
2736 test -z "$directory" && break
2737 mkdir -p $directory
2738 done
2739 # Sanity check 1.
2740 if test ! -d t/base; then
2741 echo "Failed to create the subdirectories. Aborting." >&4
2742 exit 1
2743 fi
2744 echo "(Then creating the symlinks...)" >&4
2745 awk '{print $1}' $src/MANIFEST | while true; do
2746 read filename
2747 test -z "$filename" && break
2748 if test -f $filename; then
5d644a95 2749 if $issymlink $filename; then
dafca956
JH
2750 rm -f $filename
2751 fi
2752 fi
2753 if test -f $filename; then
2754 echo "$filename already exists, not symlinking."
2755 else
2756 ln -s $src/$filename $filename
2757 fi
2758 done
2759 # Sanity check 2.
a0d24b8a
JH
2760 if test ! -f t/base/lex.t; then
2761 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2762 exit 1
2763 fi
2764 cd UU
2765 ;;
2766 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2767 ;;
2768 esac
2769 ;;
2770 esac
2771 ;;
2772esac
2773
613d6c3e 2774: Check for Cross-Compilation
5440bc8e
JH
2775case "$usecrosscompile" in
2776$define|true|[yY]*)
93bc48fa 2777 $echo "Cross-compiling..."
5440bc8e
JH
2778 croak=''
2779 case "$cc" in
2780 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2781 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2782 ar=$targetarch-ar
2783 # leave out ld, choosing it is more complex
2784 nm=$targetarch-nm
2785 ranlib=$targetarch-ranlib
93bc48fa 2786 $echo 'extern int foo;' > try.c
f8006fac 2787 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2788 shift
2789 if $test $# -gt 0; then
2790 incpth="$incpth $*"
f8006fac
JH
2791 incpth="`$echo $incpth|$sed 's/^ //'`"
2792 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2793 for i in $*; do
f8006fac 2794 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2795 if $test -d $j; then
2796 libpth="$libpth $j"
2797 fi
2798 done
f8006fac
JH
2799 libpth="`$echo $libpth|$sed 's/^ //'`"
2800 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2801 fi
2802 $rm -f try.c
5440bc8e
JH
2803 ;;
2804 esac
2805 case "$targetarch" in
93bc48fa
JH
2806 '') echo "Targetarch not defined." >&4; croak=y ;;
2807 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2808 esac
2809 case "$incpth" in
93bc48fa 2810 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2811 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2812 esac
2813 case "$libpth" in
93bc48fa 2814 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2815 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2816 esac
93bc48fa
JH
2817 case "$usrinc" in
2818 '') for i in $incpth; do
2819 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2820 usrinc=$i
2821 echo "Guessing usrinc $usrinc." >&4
2822 break
2823 fi
2824 done
2825 case "$usrinc" in
2826 '') echo "Usrinc not defined." >&4; croak=y ;;
2827 esac
2828 ;;
2829 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2830 esac
93bc48fa
JH
2831 case "$targethost" in
2832 '') echo "Targethost not defined." >&4; croak=y ;;
2833 *) echo "Using targethost $targethost." >&4
5440bc8e 2834 esac
93bc48fa
JH
2835 locincpth=' '
2836 loclibpth=' '
5440bc8e 2837 case "$croak" in
93bc48fa 2838 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2839 esac
2840 case "$src" in
2841 /*) run=$src/Cross/run
93c0359c 2842 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2843 to=$src/Cross/to
2844 from=$src/Cross/from
2845 ;;
93bc48fa 2846 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2847 run=$pwd/Cross/run
f8006fac 2848 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2849 to=$pwd/Cross/to
2850 from=$pwd/Cross/from
2851 ;;
2852 esac
2853 case "$targetrun" in
2854 '') targetrun=ssh ;;
2855 esac
2856 case "$targetto" in
2857 '') targetto=scp ;;
2858 esac
2859 case "$targetfrom" in
2860 '') targetfrom=scp ;;
2861 esac
2862 run=$run-$targetrun
2863 to=$to-$targetto
2864 from=$from-$targetfrom
93bc48fa
JH
2865 case "$targetdir" in
2866 '') targetdir=/tmp
2867 echo "Guessing targetdir $targetdir." >&4
2868 ;;
2869 esac
5440bc8e 2870 case "$targetuser" in
93bc48fa
JH
2871 '') targetuser=root
2872 echo "Guessing targetuser $targetuser." >&4
2873 ;;
5440bc8e
JH
2874 esac
2875 case "$targetfrom" in
2876 scp) q=-q ;;
2877 *) q='' ;;
2878 esac
2879 case "$targetrun" in
2880 ssh|rsh)
2881 cat >$run <<EOF
2882#!/bin/sh
93c0359c
JH
2883case "\$1" in
2884-cwd)
2885 shift
2886 cwd=\$1
2887 shift
2888 ;;
2889esac
2890case "\$cwd" in
2891'') cwd=$targetdir ;;
2892esac
5440bc8e
JH
2893exe=\$1
2894shift
93c0359c
JH
2895if $test ! -f \$exe.xok; then
2896 $to \$exe
2897 $touch \$exe.xok
2898fi
2899$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2900EOF
2901 ;;
93bc48fa 2902 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2903 exit 1
2904 ;;
2905 esac
93c0359c
JH
2906 case "$targetmkdir" in
2907 */Cross/mkdir)
2908 cat >$targetmkdir <<EOF
2909#!/bin/sh
2910$targetrun -l $targetuser $targethost "mkdir -p \$@"
2911EOF
f8006fac 2912 $chmod a+rx $targetmkdir
93c0359c
JH
2913 ;;
2914 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2915 exit 1
2916 ;;
2917 esac
5440bc8e
JH
2918 case "$targetto" in
2919 scp|rcp)
2920 cat >$to <<EOF
2921#!/bin/sh
2922for f in \$@
2923do
93c0359c
JH
2924 case "\$f" in
2925 /*)
2926 $targetmkdir \`dirname \$f\`
2927 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2928 ;;
2929 *)
2930 $targetmkdir $targetdir/\`dirname \$f\`
2931 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2932 ;;
2933 esac
5440bc8e
JH
2934done
2935exit 0
2936EOF
2937 ;;
2938 cp) cat >$to <<EOF
2939#!/bin/sh
93c0359c
JH
2940for f in \$@
2941do
2942 case "\$f" in
2943 /*)
2944 $mkdir -p $targetdir/\`dirname \$f\`
2945 $cp \$f $targetdir/\$f || exit 1
2946 ;;
2947 *)
2948 $targetmkdir $targetdir/\`dirname \$f\`
2949 $cp \$f $targetdir/\$f || exit 1
2950 ;;
2951 esac
2952done
2953exit 0
5440bc8e
JH
2954EOF
2955 ;;
93bc48fa 2956 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2957 exit 1
2958 ;;
2959 esac
2960 case "$targetfrom" in
2961 scp|rcp)
2962 cat >$from <<EOF
2963#!/bin/sh
2964for f in \$@
2965do
93c0359c 2966 $rm -f \$f
5440bc8e
JH
2967 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2968done
2969exit 0
2970EOF
2971 ;;
2972 cp) cat >$from <<EOF
2973#!/bin/sh
2974for f in \$@
2975do
93c0359c 2976 $rm -f \$f
5440bc8e
JH
2977 cp $targetdir/\$f . || exit 1
2978done
2979exit 0
2980EOF
2981 ;;
93bc48fa 2982 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2983 exit 1
2984 ;;
2985 esac
93bc48fa
JH
2986 if $test ! -f $run; then
2987 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2988 else
f8006fac 2989 $chmod a+rx $run
5440bc8e 2990 fi
93bc48fa
JH
2991 if $test ! -f $to; then
2992 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2993 else
f8006fac 2994 $chmod a+rx $to
5440bc8e 2995 fi
93bc48fa
JH
2996 if $test ! -f $from; then
2997 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2998 else
f8006fac 2999 $chmod a+rx $from
5440bc8e 3000 fi
93bc48fa 3001 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
3002 exit 1
3003 fi
3004 cat >&4 <<EOF
f8006fac
JH
3005Using '$run' for remote execution,
3006and '$from' and '$to'
93bc48fa 3007for remote file transfer.
5440bc8e
JH
3008EOF
3009 ;;
3010*) run=''
3011 to=:
3012 from=:
3013 usecrosscompile='undef'
3014 targetarch=''
3015 ;;
3016esac
3017
ecfc5424
AD
3018: see whether [:lower:] and [:upper:] are supported character classes
3019echo " "
ecfc5424
AD
3020case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3021ABYZ)
3022 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3023 up='[:upper:]'
3024 low='[:lower:]'
3025 ;;
416d0bea
MB
3026*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3027 # (0xd9 and 0xe2), therefore that is a nice testing point.
3028 if test "X$up" = X -o "X$low" = X; then
3029 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3030 rs) up='[A-Z]'
3031 low='[a-z]'
28e8609d
JH
3032 ;;
3033 esac
416d0bea 3034 fi
28e8609d 3035 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3036 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3037 rs) up='A-Z'
28e8609d
JH
3038 low='a-z'
3039 ;;
3040 esac
416d0bea 3041 fi
28e8609d 3042 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3043 case "`echo RS | od -x 2>/dev/null`" in
3044 *D9E2*|*d9e2*)
28e8609d
JH
3045 echo "Hey, this might be EBCDIC." >&4
3046 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3047 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3048 rs) up='[A-IJ-RS-Z]'
3049 low='[a-ij-rs-z]'
28e8609d
JH
3050 ;;
3051 esac
3052 fi
3053 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3054 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3055 rs) up='A-IJ-RS-Z'
3056 low='a-ij-rs-z'
28e8609d
JH
3057 ;;
3058 esac
3059 fi
3060 ;;
3061 esac
3062 fi
3063esac
416d0bea
MB
3064case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3065rs)
28e8609d
JH
3066 echo "Using $up and $low to convert case." >&4
3067 ;;
ecfc5424 3068*)
28e8609d
JH
3069 echo "I don't know how to translate letters from upper to lower case." >&4
3070 echo "Your tr is not acting any way I know of." >&4
3071 exit 1
3072 ;;
ecfc5424
AD
3073esac
3074: set up the translation script tr, must be called with ./tr of course
3075cat >tr <<EOSC
3076$startsh
3077case "\$1\$2" in
3078'[A-Z][a-z]') exec $tr '$up' '$low';;
3079'[a-z][A-Z]') exec $tr '$low' '$up';;
3080esac
3081exec $tr "\$@"
3082EOSC
3083chmod +x tr
3084$eunicefix tr
3085
2304df62
AD
3086: Try to determine whether config.sh was made on this system
3087case "$config_sh" in
3088'')
43999f95
JH
3089myuname=`$uname -a 2>/dev/null`
3090$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3091# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3092# because the A-Z/a-z are not consecutive.
34e09935 3093myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3eaeeeae 3094 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3095newmyuname="$myuname"
2304df62 3096dflt=n
16d20bd9
AD
3097case "$knowitall" in
3098'')
3099 if test -f ../config.sh; then
3100 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3101 eval "`grep myuname= ../config.sh`"
3102 fi
3103 if test "X$myuname" = "X$newmyuname"; then
3104 dflt=y
3105 fi
2304df62 3106 fi
16d20bd9
AD
3107 ;;
3108*) dflt=y;;
3109esac
2304df62
AD
3110
3111: Get old answers from old config file if Configure was run on the
3112: same system, otherwise use the hints.
3113hint=default
3114cd ..
3115if test -f config.sh; then
16d20bd9
AD
3116 echo " "
3117 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3118 . UU/myread
3119 case "$ans" in
f83701cd
AD
3120 n*|N*) echo "OK, I'll ignore it."
3121 mv config.sh config.sh.old
3122 myuname="$newmyuname"
3123 ;;
2304df62 3124 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3125 tmp_n="$n"
3126 tmp_c="$c"
85cad39c 3127 tmp_sh="$sh"
2304df62
AD
3128 . ./config.sh
3129 cp config.sh UU
ecfc5424
AD
3130 n="$tmp_n"
3131 c="$tmp_c"
85cad39c 3132 : Older versions did not always set $sh. Catch re-use of such
3133 : an old config.sh.
3134 case "$sh" in
3135 '') sh="$tmp_sh" ;;
3136 esac
2304df62
AD
3137 hint=previous
3138 ;;
3139 esac
3140fi
2573c5f9 3141. ./UU/checkcc
2304df62
AD
3142if test ! -f config.sh; then
3143 $cat <<EOM
3144
4e2a5f63
AD
3145First time through, eh? I have some defaults handy for some systems
3146that need some extra help getting the Configure answers right:
2304df62
AD
3147
3148EOM
dfe9444c 3149 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3150 dflt=''
3151 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3152 : tests or hints, please send them to perlbug@perl.org
2304df62 3153 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3154 $test -f /irix && osname=irix
85e6fe83
LW
3155 $test -f /xenix && osname=sco_xenix
3156 $test -f /dynix && osname=dynix
3157 $test -f /dnix && osname=dnix
5f05dabc 3158 $test -f /lynx.os && osname=lynxos
3159 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3160 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3161 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3162 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3163 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3164 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3165 $test -d /usr/apollo/bin && osname=apollo
3166 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3167 $test -d /usr/include/minix && osname=minix
d54344fc 3168 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3169 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3170 osname=machten
4633a7c4 3171 if $test -x /sbin/version; then
dfe9444c 3172 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3173 $sed -e 's/[A-Za-z]$//'`
3174 elif $test -x /usr/etc/version; then
dfe9444c 3175 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3176 $sed -e 's/[A-Za-z]$//'`
3177 else
3178 osvers="$2.$3"
3179 fi
3180 fi
aaacdc8b
GS
3181
3182 $test -f /sys/posix.dll &&
3183 $test -f /usr/bin/what &&
3184 set X `/usr/bin/what /sys/posix.dll` &&
3185 $test "$3" = UWIN &&
3186 osname=uwin &&
3187 osvers="$5"
3188
2304df62
AD
3189 if $test -f $uname; then
3190 set X $myuname
3191 shift
3192
2304df62 3193 case "$5" in
85e6fe83 3194 fps*) osname=fps ;;
2304df62
AD
3195 mips*)
3196 case "$4" in
85e6fe83
LW
3197 umips) osname=umips ;;
3198 *) osname=mips ;;
2304df62 3199 esac;;
85e6fe83
LW
3200 [23]100) osname=mips ;;
3201 next*) osname=next ;;
ecfc5424 3202 i386*)
c6912327
JH
3203 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3204 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3205 osname='sco'
3206 osvers=$tmp
3207 elif $test -f /etc/kconfig; then
ecfc5424 3208 osname=isc
bd628c73 3209 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3210 osvers=4
3211 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3212 osvers=3
2304df62 3213 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3214 osvers=2
ecfc5424
AD
3215 fi
3216 fi
2000072c 3217 tmp=''
ecfc5424 3218 ;;
c4f23d77
AD
3219 pc*)
3220 if test -n "$DJGPP"; then
3221 osname=dos
3222 osvers=djgpp
3223 fi
3224 ;;
2304df62
AD
3225 esac
3226
3227 case "$1" in
a0d0e21e
LW
3228 aix) osname=aix
3229 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3230 case "$tmp" in
e81c5c2a
NC
3231 # oslevel can fail with:
3232 # oslevel: Unable to acquire lock.
3233 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3234 '<3240'|'<>3240') osvers=3.2.0 ;;
3235 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3236 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3237 *) osvers=$tmp;;
a0d0e21e
LW
3238 esac
3239 ;;
aaacdc8b
GS
3240 bsd386) osname=bsd386
3241 osvers=`$uname -r`
3242 ;;
3243 cygwin*) osname=cygwin
3244 osvers="$3"
3245 ;;
23f87696
SZ
3246 *dc.osx) osname=dcosx
3247 osvers="$3"
3248 ;;
a0d0e21e
LW
3249 dnix) osname=dnix
3250 osvers="$3"
3251 ;;
3252 domainos) osname=apollo
3253 osvers="$3"
3254 ;;
a774dfe6
RSG
3255 dgux) osname=dgux
3256 osvers="$3"
3257 ;;
3258 dragonfly) osname=dragonfly
a0d0e21e
LW
3259 osvers="$3"
3260 ;;
760ac839 3261 dynixptx*) osname=dynixptx
e58e581d 3262 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3263 ;;
a774dfe6 3264 freebsd) osname=freebsd
a0d0e21e 3265 osvers="$3" ;;
761ee4e8
BD
3266 genix) osname=genix ;;
3267 gnu) osname=gnu
3268 osvers="$3" ;;
a774dfe6 3269 hp*) osname=hpux
bfb7748a 3270 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3271 ;;
761ee4e8 3272 irix*) osname=irix
a0d0e21e
LW
3273 case "$3" in
3274 4*) osvers=4 ;;
3275 5*) osvers=5 ;;
ecfc5424 3276 *) osvers="$3" ;;
a0d0e21e
LW
3277 esac
3278 ;;
761ee4e8 3279 linux) osname=linux
a0d0e21e 3280 case "$3" in
a0d0e21e
LW
3281 *) osvers="$3" ;;
3282 esac
3283 ;;
761ee4e8 3284 MiNT) osname=mint
28e8609d
JH
3285 ;;
3286 netbsd*) osname=netbsd
ecfc5424
AD
3287 osvers="$3"
3288 ;;
4e81affe
MM
3289 news-os) osvers="$3"
3290 case "$3" in
3291 4*) osname=newsos4 ;;
3292 *) osname=newsos ;;
3293 esac
3294 ;;
aaacdc8b 3295 next*) osname=next ;;
28bb1e2c 3296 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3297 openbsd) osname=openbsd
3298 osvers="$3"
3299 ;;
5c728af0
IZ
3300 os2) osname=os2
3301 osvers="$4"
3302 ;;
aaacdc8b
GS
3303 POSIX-BC | posix-bc ) osname=posix-bc
3304 osvers="$3"
a0d0e21e 3305 ;;
ae3afa4e
TH
3306 powerux | power_ux | powermax_os | powermaxos | \
3307 powerunix | power_unix) osname=powerux
3308 osvers="$3"
3309 ;;
aaacdc8b
GS
3310 qnx) osname=qnx
3311 osvers="$4"
3312 ;;
a0d0e21e
LW
3313 solaris) osname=solaris
3314 case "$3" in
3315 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3316 *) osvers="$3" ;;
a0d0e21e
LW
3317 esac
3318 ;;
85e6fe83
LW
3319 sunos) osname=sunos
3320 case "$3" in
85e6fe83
LW
3321 5*) osname=solaris
3322 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3323 *) osvers="$3" ;;
2304df62
AD
3324 esac
3325 ;;
a0d0e21e 3326 titanos) osname=titanos
85e6fe83 3327 case "$3" in
a0d0e21e
LW
3328 1*) osvers=1 ;;
3329 2*) osvers=2 ;;
3330 3*) osvers=3 ;;
3331 4*) osvers=4 ;;
ecfc5424 3332 *) osvers="$3" ;;
2304df62
AD
3333 esac
3334 ;;
85e6fe83 3335 ultrix) osname=ultrix
ecfc5424 3336 osvers="$3"
2304df62 3337 ;;
28757baa 3338 osf1|mls+) case "$5" in
fed7345c
AD
3339 alpha)
3340 osname=dec_osf
fdd85a03 3341 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3342 case "$osvers" in
3343 [1-9].[0-9]*) ;;
3344 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3345 esac
ecfc5424
AD
3346 ;;
3347 hp*) osname=hp_osf1 ;;
3348 mips) osname=mips_osf1 ;;
85e6fe83
LW
3349 esac
3350 ;;
af1ff193 3351 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3352 openunix|unixware) osname=svr5
0337d152
BG
3353 osvers="$4"
3354 ;;
3c728e00 3355 uts) osname=uts
a0d0e21e
LW
3356 osvers="$3"
3357 ;;
3c728e00
JH
3358 vos) osvers="$3"
3359 ;;
85e6fe83 3360 $2) case "$osname" in
2304df62 3361 *isc*) ;;
a0d0e21e 3362 *freebsd*) ;;
5f05dabc 3363 svr*)
a0d0e21e 3364 : svr4.x or possibly later
a774dfe6 3365 case "svr$3" in
a0d0e21e
LW
3366 ${osname}*)
3367 osname=svr$3
3368 osvers=$4
3369 ;;
3370 esac
3371 case "$osname" in
3372 svr4.0)
3373 : Check for ESIX
3374 if test -f /stand/boot ; then
3375 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3376 if test -n "$INITPROG" -a -f "$INITPROG"; then
3377 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3378 if test -n "$isesix"; then
a0d0e21e
LW
3379 osname=esix4
3380 fi
3381 fi
3382 fi
3383 ;;
3384 esac
3385 ;;
2304df62 3386 *) if test -f /etc/systemid; then
a0d0e21e
LW
3387 osname=sco
3388 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3389 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3390 osvers=$1.$2.$3
c4f23d77 3391 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3392 osvers=$1.$2
c4f23d77 3393 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3394 osvers=$1
2304df62 3395 fi
a0d0e21e
LW
3396 else
3397 case "$osname" in
3398 '') : Still unknown. Probably a generic Sys V.
3399 osname="sysv"
3400 osvers="$3"
3401 ;;
3402 esac
2304df62
AD
3403 fi
3404 ;;
3405 esac
3406 ;;
a0d0e21e
LW
3407 *) case "$osname" in
3408 '') : Still unknown. Probably a generic BSD.
3409 osname="$1"
3410 osvers="$3"
3411 ;;
3412 esac
3413 ;;
2304df62
AD
3414 esac
3415 else
dfe9444c
AD
3416 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3417 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3418 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3419 osname=news_os
2304df62 3420 fi
dfe9444c 3421 $rm -f UU/kernel.what
5c728af0 3422 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3423 set X $myuname
3424 osname=os2
3425 osvers="$5"
2304df62
AD
3426 fi
3427 fi
a774dfe6 3428
5440bc8e
JH
3429 case "$targetarch" in
3430 '') ;;
3431 *) hostarch=$osname
3432 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3433 osvers=''
3434 ;;
3435 esac
3436
a0d0e21e
LW
3437 : Now look for a hint file osname_osvers, unless one has been
3438 : specified already.
3439 case "$hintfile" in
3440 ''|' ')
1e127011 3441 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3442 : Also try without trailing minor version numbers.
1e127011
DD
3443 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3444 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3445 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3446 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3447 case "$file" in
3448 '') dflt=none ;;
3449 *) case "$osvers" in
3450 '') dflt=$file
3451 ;;
dfe9444c 3452 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3453 dflt=$file
dfe9444c 3454 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3455 dflt=$xfile
dfe9444c 3456 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3457 dflt=$xxfile
dfe9444c 3458 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3459 dflt=$xxxfile
dfe9444c 3460 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3461 dflt=$xxxxfile
dfe9444c 3462 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3463 dflt="${osname}"
3464 else
3465 dflt=none
3466 fi
3467 ;;
3468 esac
85e6fe83
LW
3469 ;;
3470 esac
4e2a5f63
AD
3471 if $test -f Policy.sh ; then
3472 case "$dflt" in
3473 *Policy*) ;;
3474 none) dflt="Policy" ;;
3475 *) dflt="Policy $dflt" ;;
3476 esac
3477 fi
85e6fe83 3478 ;;
a0d0e21e 3479 *)
ecfc5424 3480 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3481 ;;
2304df62 3482 esac
1aef975c 3483
4e2a5f63
AD
3484 if $test -f Policy.sh ; then
3485 $cat <<EOM
3486
3487There's also a Policy hint file available, which should make the
3488site-specific (policy) questions easier to answer.
3489EOM
3490
3491 fi
3492
2304df62
AD
3493 $cat <<EOM
3494
3495You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3496If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3497previous run of Configure, you may specify it as well as or instead of
3498OS-specific hints. If hints are provided for your OS, you should use them:
3499although Perl can probably be built without hints on many platforms, using
3500hints often improve performance and may enable features that Configure can't
3501set up on its own. If there are no hints that match your OS, specify "none";
3502DO NOT give a wrong version or a wrong OS.
2304df62
AD
3503
3504EOM
4e2a5f63 3505
2304df62 3506 rp="Which of these apply, if any?"
dfe9444c 3507 . UU/myread
85e6fe83
LW
3508 tans=$ans
3509 for file in $tans; do
4e2a5f63
AD
3510 if $test X$file = XPolicy -a -f Policy.sh; then
3511 . Policy.sh
3512 $cat Policy.sh >> UU/config.sh
3513 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3514 . $src/hints/$file.sh
3515 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3516 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3517 : nothing
3518 else
85e6fe83
LW
3519 : Give one chance to correct a possible typo.
3520 echo "$file.sh does not exist"
3521 dflt=$file
3522 rp="hint to use instead?"
dfe9444c 3523 . UU/myread
85e6fe83 3524 for file in $ans; do
dfe9444c
AD
3525 if $test -f "$src/hints/$file.sh"; then
3526 . $src/hints/$file.sh
3527 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3528 elif $test X$ans = X -o X$ans = Xnone ; then
3529 : nothing
3530 else
3531 echo "$file.sh does not exist -- ignored."
3532 fi
3533 done
2304df62
AD
3534 fi
3535 done
85e6fe83 3536
2304df62 3537 hint=recommended
85e6fe83 3538 : Remember our hint file for later.
dfe9444c 3539 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3540 hintfile="$file"
85e6fe83 3541 else
a0d0e21e 3542 hintfile=''
85e6fe83 3543 fi
2304df62
AD
3544fi
3545cd UU
3546;;
3547*)
3548 echo " "
3549 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3550 tmp_n="$n"
3551 tmp_c="$c"
2304df62
AD
3552 cd ..
3553 cp $config_sh config.sh 2>/dev/null
a78b0d02 3554 chmod +w config.sh
2304df62
AD
3555 . ./config.sh
3556 cd UU
3557 cp ../config.sh .
ecfc5424
AD
3558 n="$tmp_n"
3559 c="$tmp_c"
2304df62
AD
3560 hint=previous
3561 ;;
3562esac
1aef975c 3563test "$override" && . ./optdef.sh
2304df62
AD
3564
3565: Restore computed paths
3566for file in $loclist $trylist; do
3567 eval $file="\$_$file"
3568done
3569
85e6fe83 3570cat << EOM
a0d0e21e 3571
85e6fe83 3572Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3573The default value is probably right if the name rings a bell. Otherwise,
3574since spelling matters for me, either accept the default or answer "none"
3575to leave it blank.
a0d0e21e 3576
85e6fe83 3577EOM
85e6fe83 3578case "$osname" in
a0d0e21e 3579 ''|' ')
85e6fe83 3580 case "$hintfile" in
a0d0e21e 3581 ''|' '|none) dflt=none ;;
ecfc5424 3582 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3583 esac
3584 ;;
3585 *) dflt="$osname" ;;
3586esac
3587rp="Operating system name?"
3588. ./myread
3589case "$ans" in
ecfc5424
AD
3590none) osname='' ;;
3591*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3592esac
8ff267be 3593echo " "
3594case "$osvers" in
3595 ''|' ')
3596 case "$hintfile" in
3597 ''|' '|none) dflt=none ;;
3598 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3599 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3600 case "$dflt" in
3601 ''|' ') dflt=none ;;
3602 esac
3603 ;;
3604 esac
3605 ;;
3606 *) dflt="$osvers" ;;
3607esac
3608rp="Operating system version?"
3609. ./myread
3610case "$ans" in
3611none) osvers='' ;;
3612*) osvers="$ans" ;;
3613esac
3614
02e93a22
JH
3615
3616. ./posthint.sh
3617
2304df62 3618: who configured the system
59b83a6f 3619cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3620case "$cf_by" in
3621"")
7c04078e 3622 cf_by=`(logname) 2>/dev/null`
dfe9444c 3623 case "$cf_by" in
7c04078e
GA
3624 "")
3625 cf_by=`(whoami) 2>/dev/null`
3626 case "$cf_by" in
3627 "") cf_by=unknown ;;
3628 esac ;;
8ff267be 3629 esac ;;
3630esac
2304df62 3631
f3f1a2d8
MB
3632: decide how portable to be. Allow command line overrides.
3633case "$d_portable" in
3634"$undef") ;;
3635*) d_portable="$define" ;;
b4eb6b3d 3636esac
b4eb6b3d 3637
f3f1a2d8
MB
3638: set up shell script to do ~ expansion
3639cat >filexp <<EOSS
3640$startsh
3641: expand filename
3642case "\$1" in
f16e9d76 3643 \~/*|\~)
f3f1a2d8
MB
3644 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3645 ;;
4137585d 3646 \~*)
f3f1a2d8
MB
3647 if $test -f /bin/csh; then
3648 /bin/csh -f -c "glob \$1"
3649 failed=\$?
3650 echo ""
3651 exit \$failed
3652 else
3653 name=\`$expr x\$1 : '..\([^/]*\)'\`
3654 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3655 if $test ! -d "\$dir"; then
3656 me=\`basename \$0\`
3657 echo "\$me: can't locate home directory for: \$name" >&2
3658 exit 1
3659 fi
3660 case "\$1" in
3661 */*)
3662 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3663 ;;
3664 *)
3665 echo \$dir
3666 ;;
3667 esac
3668 fi
3669 ;;
3670*)
3671 echo \$1
3672 ;;
b29b105d 3673esac
f3f1a2d8
MB
3674EOSS
3675chmod +x filexp
3676$eunicefix filexp
b29b105d 3677
f3f1a2d8
MB
3678: now set up to get a file name
3679cat <<EOS >getfile
3680$startsh
3681EOS
3682cat <<'EOSC' >>getfile
3683tilde=''
3684fullpath=''
3685already=''
3686skip=''
3687none_ok=''
3688exp_file=''
3689nopath_ok=''
3690orig_rp="$rp"
3691orig_dflt="$dflt"
3692case "$gfpth" in
3693'') gfpth='.' ;;
b29b105d 3694esac
b29b105d 3695
f3f1a2d8
MB
3696case "$fn" in
3697*\(*)
3698 : getfile will accept an answer from the comma-separated list
3699 : enclosed in parentheses even if it does not meet other criteria.
3700 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3701 fn=`echo $fn | sed 's/(.*)//'`
3702 ;;
b29b105d
JH
3703esac
3704
f3f1a2d8
MB
3705case "$fn" in
3706*:*)
3707 loc_file=`expr $fn : '.*:\(.*\)'`
3708 fn=`expr $fn : '\(.*\):.*'`
3709 ;;
b29b105d 3710esac
b29b105d 3711
f3f1a2d8
MB
3712case "$fn" in
3713*~*) tilde=true;;
3714esac
3715case "$fn" in
3716*/*) fullpath=true;;
3717esac
3718case "$fn" in
3719*+*) skip=true;;
3720esac
3721case "$fn" in
3722*n*) none_ok=true;;
3723esac
3724case "$fn" in
3725*e*) exp_file=true;;
3726esac
3727case "$fn" in
3728*p*) nopath_ok=true;;
b29b105d 3729esac
b29b105d 3730
f3f1a2d8
MB
3731case "$fn" in
3732*f*) type='File';;
3733*d*) type='Directory';;
3734*l*) type='Locate';;
3735esac
b29b105d 3736
f3f1a2d8
MB
3737what="$type"
3738case "$what" in
3739Locate) what='File';;
3740esac
b29b105d 3741
f3f1a2d8
MB
3742case "$exp_file" in
3743'')
3744 case "$d_portable" in
3745 "$define") ;;
3746 *) exp_file=true;;
b29b105d
JH
3747 esac
3748 ;;
3749esac
3750
f3f1a2d8
MB
3751cd ..
3752while test "$type"; do
3753 redo=''
3754 rp="$orig_rp"
3755 dflt="$orig_dflt"
3756 case "$tilde" in
3757 true) rp="$rp (~name ok)";;
3758 esac
3759 . UU/myread
3760 if test -f UU/getfile.ok && \
3761 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3762 then
3763 value="$ans"
3764 ansexp="$ans"
3765 break
3766 fi
3767 case "$ans" in
3768 none)
3769 value=''
3770 ansexp=''
3771 case "$none_ok" in
3772 true) type='';;
b29b105d
JH
3773 esac
3774 ;;
f3f1a2d8
MB
3775 *)
3776 case "$tilde" in
3777 '') value="$ans"
3778 ansexp="$ans";;
3779 *)
3780 value=`UU/filexp $ans`
3781 case $? in
3782 0)
3783 if test "$ans" != "$value"; then
3784 echo "(That expands to $value on this system.)"
3785 fi
3786 ;;
3787 *) value="$ans";;
3788 esac
3789 ansexp="$value"
3790 case "$exp_file" in
3791 '') value="$ans";;
3792 esac
3793 ;;
3794 esac
3795 case "$fullpath" in
3796 true)
3797 case "$ansexp" in
3798 /*) value="$ansexp" ;;
3799 [a-zA-Z]:/*) value="$ansexp" ;;
3800 *)
3801 redo=true
3802 case "$already" in
3803 true)
3804 echo "I shall only accept a full path name, as in /bin/ls." >&4
3805 echo "Use a ! shell escape if you wish to check pathnames." >&4
3806 ;;
3807 *)
3808 echo "Please give a full path name, starting with slash." >&4
3809 case "$tilde" in
3810 true)
3811 echo "Note that using ~name is ok provided it expands well." >&4
3812 already=true
3813 ;;
3814 esac
3815 esac
3816 ;;
3817 esac
3818 ;;
3819 esac
3820 case "$redo" in
3821 '')
3822 case "$type" in
3823 File)
3824 for fp in $gfpth; do
3825 if test "X$fp" = X.; then
3826 pf="$ansexp"
3827 else
3828 pf="$fp/$ansexp"
3829 fi
3830 if test -f "$pf"; then
3831 type=''
3832 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3833 then
3834 echo "($value is not a plain file, but that's ok.)"
3835 type=''
3836 fi
3837 if test X"$type" = X; then
3838 value="$pf"
3839 break
3840 fi
3841 done
3842 ;;
3843 Directory)
3844 for fp in $gfpth; do
3845 if test "X$fp" = X.; then
3846 dir="$ans"
3847 direxp="$ansexp"
3848 else
3849 dir="$fp/$ansexp"
3850 direxp="$fp/$ansexp"
3851 fi
3852 if test -d "$direxp"; then
3853 type=''
3854 value="$dir"
3855 break
3856 fi
3857 done
3858 ;;
3859 Locate)
3860 if test -d "$ansexp"; then
3861 echo "(Looking for $loc_file in directory $value.)"
3862 value="$value/$loc_file"
3863 ansexp="$ansexp/$loc_file"
3864 fi
3865 if test -f "$ansexp"; then
3866 type=''
3867 fi
3868 case "$nopath_ok" in
3869 true) case "$value" in
3870 */*) ;;
3871 *) echo "Assuming $value will be in people's path."
3872 type=''
3873 ;;
3874 esac
3875 ;;
3876 esac
3877 ;;
3878 esac
b4eb6b3d 3879
f3f1a2d8
MB
3880 case "$skip" in
3881 true) type='';
3882 esac
3883
3884 case "$type" in
3885 '') ;;
3886 *)
3887 if test "$fastread" = yes; then
3888 dflt=y
3889 else
3890 dflt=n
3891 fi
3892 rp="$what $value doesn't exist. Use that name anyway?"
3893 . UU/myread
3894 dflt=''
3895 case "$ans" in
3896 y*) type='';;
3897 *) echo " ";;
3898 esac
3899 ;;
3900 esac
3901 ;;
3902 esac
3903 ;;
b4eb6b3d 3904 esac
f3f1a2d8
MB
3905done
3906cd UU
3907ans="$value"
3908rp="$orig_rp"
3909dflt="$orig_dflt"
3910rm -f getfile.ok
3911test "X$gfpthkeep" != Xy && gfpth=""
3912EOSC
3913
3914: determine root of directory hierarchy where package will be installed.
3915case "$prefix" in
3916'')
3917 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3918 ;;
3919*?/)
3920 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3921 ;;
3922*)
f3f1a2d8 3923 dflt="$prefix"
b4eb6b3d
JH
3924 ;;
3925esac
f3f1a2d8 3926$cat <<EOM
b4eb6b3d 3927
f3f1a2d8
MB
3928By default, $package will be installed in $dflt/bin, manual pages
3929under $dflt/man, etc..., i.e. with $dflt as prefix for all
3930installation directories. Typically this is something like /usr/local.
3931If you wish to have binaries under /usr/bin but other parts of the
3932installation under /usr/local, that's ok: you will be prompted
3933separately for each of the installation directories, the prefix being
3934only used to set the defaults.
c915ce7f
JH
3935
3936EOM
f3f1a2d8
MB
3937fn=d~
3938rp='Installation prefix to use?'
3939. ./getfile
3940oldprefix=''
3941case "$prefix" in
3942'') ;;
3943*)
3944 case "$ans" in
3945 "$prefix") ;;
3946 *) oldprefix="$prefix";;
3947 esac
c915ce7f
JH
3948 ;;
3949esac
f3f1a2d8
MB
3950prefix="$ans"
3951prefixexp="$ansexp"
c915ce7f 3952
776a38e3 3953: allow them to override the AFS root
f3f1a2d8
MB
3954case "$afsroot" in
3955'') afsroot=/afs ;;
3956*) afsroot=$afsroot ;;
b4eb6b3d 3957esac
b4eb6b3d 3958
776a38e3 3959: is AFS running?
f3f1a2d8
MB
3960echo " "
3961case "$afs" in
3962$define|true) afs=true ;;
3963$undef|false) afs=false ;;
776a38e3 3964*) if $test -d $afsroot; then
f3f1a2d8
MB
3965 afs=true
3966 else
3967 afs=false
3968 fi
b4eb6b3d 3969 ;;
f3f1a2d8
MB
3970esac
3971if $afs; then
3972 echo "AFS may be running... I'll be extra cautious then..." >&4
3973else
3974 echo "AFS does not seem to be running..." >&4
9da7673b 3975fi
b4eb6b3d 3976
f3f1a2d8
MB
3977: determine installation prefix for where package is to be installed.
3978if $afs; then
3979$cat <<EOM
3980
3981Since you are running AFS, I need to distinguish the directory in which
3982files will reside from the directory in which they are installed (and from
3983which they are presumably copied to the former directory by occult means).
b4eb6b3d 3984
b4eb6b3d 3985EOM
f3f1a2d8
MB
3986 case "$installprefix" in
3987 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3988 *) dflt="$installprefix";;
3989 esac
3990else
3991$cat <<EOM
b4eb6b3d 3992
f3f1a2d8
MB
3993In some special cases, particularly when building $package for distribution,
3994it is convenient to distinguish the directory in which files should be
3995installed from the directory ($prefix) in which they will
3996eventually reside. For most users, these two directories are the same.
3997
3998EOM
3999 case "$installprefix" in
4000 '') dflt=$prefix ;;
4001 *) dflt=$installprefix;;
4002 esac
4003fi
4004fn=d~
4005rp='What installation prefix should I use for installing files?'
4006. ./getfile
4007installprefix="$ans"
4008installprefixexp="$ansexp"
4009
4010: Perform the prefixexp/installprefixexp correction if necessary
4011cat <<EOS >installprefix
4012$startsh
4013EOS
4014cat <<'EOSC' >>installprefix
4015: Change installation prefix, if necessary.
4016if $test X"$prefix" != X"$installprefix"; then
4017 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4018else
4019 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4020fi
4021EOSC
4022chmod +x installprefix
4023$eunicefix installprefix
4024
4025: Set variables such as privlib and privlibexp from the output of ./getfile
4026: performing the prefixexp/installprefixexp correction if necessary.
4027cat <<EOS >setprefixvar
4028$startsh
4029EOS
4030cat <<'EOSC' >>setprefixvar
4031eval "${prefixvar}=\"\$ans\""
4032eval "${prefixvar}exp=\"\$ansexp\""
4033. ./installprefix
4034EOSC
4035chmod +x setprefixvar
4036$eunicefix setprefixvar
4037
4038: set up the script used to warn in case of inconsistency
4039cat <<EOS >whoa
4040$startsh
4041EOS
4042cat <<'EOSC' >>whoa
4043dflt=y
dcb594bc
MB
4044case "$hint" in
4045 recommended)
4046 case "$hintfile" in
4047 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4048 ;;
4049 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4050 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4051 ;;
4052 esac
4053 ;;
4054 *) echo " "
4055 echo "*** WHOA THERE!!! ***" >&4
4056 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4057 ;;
4058esac
f3f1a2d8
MB
4059rp=" Keep the $hint value?"
4060. ./myread
4061case "$ans" in
4062y) td=$was; tu=$was;;
4063esac
4064EOSC
4065
216dac04 4066: function used to set '$1' to '$val'
f3f1a2d8
MB
4067setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4068case "$val$was" in
4069$define$undef) . ./whoa; eval "$var=\$td";;
4070$undef$define) . ./whoa; eval "$var=\$tu";;
4071*) eval "$var=$val";;
4072esac'
4073
34f1896b 4074: Check is we will use socks
f3f1a2d8
MB
4075case "$usesocks" in
4076$define|true|[yY]*) dflt='y';;
4077*) dflt='n';;
4078esac
4079cat <<EOM
4080
4081Perl can be built to use the SOCKS proxy protocol library. To do so,
4082Configure must be run with -Dusesocks. If you use SOCKS you also need
4083to use the PerlIO abstraction layer, this will be implicitly selected.
4084
4085If this doesn't make any sense to you, just accept the default '$dflt'.
4086EOM
4087rp='Build Perl for SOCKS?'
4088. ./myread
4089case "$ans" in
613d6c3e 4090y|Y) val="$define" ;;
f3f1a2d8
MB
4091*) val="$undef" ;;
4092esac
4093set usesocks
4094eval $setvar
4095
4096case "$usesocks" in
4097$define|true|[yY]*) useperlio="$define";;
4098esac
4099
34f1896b 4100: Check if we want perlio
f3f1a2d8
MB
4101case "$useperlio" in
4102$define|true|[yY]*|'') dflt='y';;
4103*) dflt='n';;
4104esac
4105cat <<EOM
4106
4107Previous version of $package used the standard IO mechanisms as
4108defined in <stdio.h>. Versions 5.003_02 and later of $package allow
4109alternate IO mechanisms via the PerlIO abstraction layer, but the
4110stdio mechanism is still available if needed. The abstraction layer
4111can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4112Using PerlIO with sfio may cause problems with some extension modules.
4113
4114If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 4115EOM
f3f1a2d8
MB
4116rp='Use the PerlIO abstraction layer?'
4117. ./myread
4118case "$ans" in
34f1896b 4119y|Y)
b4eb6b3d
JH
4120 val="$define"
4121 ;;
34f1896b 4122*)
f3f1a2d8
MB
4123 echo "Ok, doing things the stdio way."
4124 val="$undef"
4125 ;;
4126esac
4127set useperlio
34f1896b 4128eval $setvar
f3f1a2d8
MB
4129
4130case "$usesocks" in
4131$define|true|[yY]*)
4132 case "$useperlio" in
4133 $define|true|[yY]*) ;;
4134 *) cat >&4 <<EOM
4135
4136You are using the SOCKS proxy protocol library which means that you
4137should also use the PerlIO layer. You may be headed for trouble.
4138
4139EOM
4140 ;;
b4eb6b3d 4141 esac
f3f1a2d8
MB
4142 ;;
4143esac
4144
5c40187f
MB
4145: get the patchlevel
4146echo " "
4147echo "Getting the current patchlevel..." >&4
4148if $test -r $rsrc/patchlevel.h;then
4149 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4150 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4151 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4152 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4153 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4154 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4155 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4156else
4157 revision=0
4158 patchlevel=0
4159 subversion=0
4160 api_revision=0
4161 api_version=0
4162 api_subversion=0
4163 perl_patchlevel=0
4164 $echo "(You do not have patchlevel.h. Eek.)"
4165fi
5c40187f
MB
4166: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4167version_patchlevel_string="version $patchlevel subversion $subversion"
4168case "$perl_patchlevel" in
41690|'') ;;
0f04e85f
MB
4170*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4171 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4172 ;;
5c40187f
MB
4173esac
4174
4175$echo "(You have $package $version_patchlevel_string.)"
4176
4177case "$osname" in
4178dos|vms)
4179 : XXX Should be a Configure test for double-dots in filenames.
4180 version=`echo $revision $patchlevel $subversion | \
4181 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4182 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4183 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4184 ;;
4185*)
4186 version=`echo $revision $patchlevel $subversion | \
4187 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4188 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4189 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4190 ;;
4191esac
4192: Special case the 5.005_xx maintenance series, which used 5.005
4193: without any subversion label as a subdirectory in $sitelib
4194if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4195 api_versionstring='5.005'
4196fi
4197
613d6c3e 4198: Do we want threads support and if so, what type
f3f1a2d8
MB
4199case "$usethreads" in
4200$define|true|[yY]*) dflt='y';;
4201*) # Catch case where user specified ithreads or 5005threads but
4202 # forgot -Dusethreads (A.D. 4/2002)
4203 case "$useithreads$use5005threads" in
613d6c3e 4204 *$define*)
f3f1a2d8
MB
4205 case "$useperlio" in
4206 "$define") dflt='y' ;;
4207 *) dflt='n' ;;
4208 esac
4209 ;;
4210 *) dflt='n';;
4211 esac
4212 ;;
4213esac
4214cat <<EOM
4215
4216Perl can be built to take advantage of threads on some systems.
4217To do so, Configure can be run with -Dusethreads.
4218
4219Note that Perl built with threading support runs slightly slower
4220and uses more memory than plain Perl. The current implementation
4221is believed to be stable, but it is fairly new, and so should be
4222treated with caution.
4223
4224If this doesn't make any sense to you, just accept the default '$dflt'.
4225EOM
4226rp='Build a threading Perl?'
4227. ./myread
4228case "$ans" in
4229y|Y) val="$define" ;;
4230*) val="$undef" ;;
4231esac
4232set usethreads
4233eval $setvar
4234
5c40187f
MB
4235if $test $patchlevel -lt 9; then
4236 case "$usethreads" in
4237 $define)
f3f1a2d8
MB
4238 $cat <<EOM
4239
4240Since release 5.6, Perl has had two different threading implementations,
4241the newer interpreter-based version (ithreads) with one interpreter per
4242thread, and the older 5.005 version (5005threads).
4243The 5005threads version is effectively unmaintained and will probably be
4244removed in Perl 5.10, so there should be no need to build a Perl using it
4245unless needed for backwards compatibility with some existing 5.005threads
4246code.
4247
4248EOM
4249 : Default to ithreads unless overridden on command line or with
4250 : old config.sh
4251 dflt='y'
4252 case "$use5005threads" in
4253 $define|true|[yY]*) dflt='n';;
4254 esac
4255 case "$useithreads" in
4256 $undef|false|[nN]*) dflt='n';;
4257 esac
4258 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4259 . ./myread
4260 case "$ans" in
f3f1a2d8 4261 y|Y) val="$define" ;;
b4eb6b3d
JH
4262 *) val="$undef" ;;
4263 esac
f3f1a2d8
MB
4264 set useithreads
4265 eval $setvar
4266 : Now set use5005threads to the opposite value.
4267 case "$useithreads" in
4268 $define) val="$undef" ;;
4269 *) val="$define" ;;
4270 esac
4271 set use5005threads
4272 eval $setvar
4273 ;;
5c40187f 4274 *)
f3f1a2d8
MB
4275 useithreads="$undef"
4276 use5005threads="$undef"
b4eb6b3d 4277 ;;
5c40187f 4278 esac
b4eb6b3d 4279
5c40187f
MB
4280 case "$useithreads$use5005threads" in
4281 "$define$define")
f3f1a2d8 4282 $cat >&4 <<EOM
96056487 4283
f3f1a2d8
MB
4284You cannot have both the ithreads and the 5.005 threads enabled
4285at the same time. Disabling the 5.005 threads since they are
4286much less stable than the ithreads.
4287
4288EOM
4289 use5005threads="$undef"
96056487 4290 ;;
5c40187f
MB
4291 esac
4292
4293else
4294: perl-5.9.x and later
4295
47f9f84c 4296 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4297 case "$use5005threads" in
4298 $define|true|[yY]*)
4299 $cat >&4 <<EOM
47f9f84c
JH
4300
43015.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4302
47f9f84c 4303EOM
3f30fabf
MB
4304 ;;
4305 esac
47f9f84c 4306 fi
3f30fabf 4307
47f9f84c
JH
4308 use5005threads="$undef"
4309 useithreads="$usethreads"
5c40187f 4310fi
96056487 4311
f3f1a2d8
MB
4312if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4313 cat >&4 <<EOF
4314***
4315*** To build with ithreads you must also use the PerlIO layer.
4316*** Cannot continue, aborting.
4317***
4318EOF
4319 exit 1
4320fi
4321
4322case "$d_oldpthreads" in
4323'') : Configure tests would be welcome here. For now, assume undef.
4324 val="$undef" ;;
4325*) val="$d_oldpthreads" ;;
4326esac
4327set d_oldpthreads
4328eval $setvar
4329
4330
4331: Look for a hint-file generated 'call-back-unit'. If the
4332: user has specified that a threading perl is to be built,
4333: we may need to set or change some other defaults.
4334if $test -f usethreads.cbu; then
4335 echo "Your platform has some specific hints regarding threaded builds, using them..."
4336 . ./usethreads.cbu
4337else
4338 case "$usethreads" in
4339 "$define"|true|[yY]*)
4340 $cat <<EOM
4341(Your platform does not have any specific hints for threaded builds.
4342 Assuming POSIX threads, then.)
4343EOM
4344 ;;
4345 esac
4346fi
4347
34f1896b 4348: Check if multiplicity is required
f3f1a2d8
MB
4349cat <<EOM
4350
4351Perl can be built so that multiple Perl interpreters can coexist
4352within the same Perl executable.
4353EOM
4354
4355case "$useithreads" in
4356$define)
4357 cat <<EOM
4358This multiple interpreter support is required for interpreter-based threads.
4359EOM
4360 val="$define"
4361 ;;
4362*) case "$usemultiplicity" in
4363 $define|true|[yY]*) dflt='y';;
4364 *) dflt='n';;
4365 esac
4366 echo " "
4367 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4368 rp='Build Perl for multiplicity?'
4369 . ./myread
4370 case "$ans" in
4371 y|Y) val="$define" ;;
4372 *) val="$undef" ;;
4373 esac
4374 ;;
4375esac
4376set usemultiplicity
4377eval $setvar
4378
34f1896b 4379: Check if morebits is requested
f3f1a2d8
MB
4380case "$usemorebits" in
4381"$define"|true|[yY]*)
4382 use64bitint="$define"
4383 uselongdouble="$define"
4384 usemorebits="$define"
4385 ;;
4386*) usemorebits="$undef"
4387 ;;
4388esac
4389
776a38e3
MB
4390: Determine the C compiler to be used
4391echo " "
4392case "$cc" in
4393'') dflt=cc;;
4394*) dflt="$cc";;
4395esac
4396rp="Use which C compiler?"
4397. ./myread
4398cc="$ans"
4399
4400: See whether they have no cc but they do have gcc
4401. ./trygcc
4402if $test -f cc.cbu; then
4403 . ./cc.cbu
4404fi
4405. ./checkcc
4406
f3f1a2d8
MB
4407: make some quick guesses about what we are up against
4408echo " "
4409$echo $n "Hmm... $c"
4410echo exit 1 >bsd
4411echo exit 1 >usg
4412echo exit 1 >v7
4413echo exit 1 >osf1
4414echo exit 1 >eunice
4415echo exit 1 >xenix
4416echo exit 1 >venix
4417echo exit 1 >os2
4418d_bsd="$undef"
4419$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4420if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4421then
4422 echo "Looks kind of like an OSF/1 system, but we'll see..."
4423 echo exit 0 >osf1
381aa1ff 4424elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4425 xxx=`./loc addbib blurfl $pth`
4426 if $test -f $xxx; then
4427 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4428 echo exit 0 >bsd
4429 echo exit 0 >usg
4430 else
4431 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4432 echo "Looks kind of like an extended USG system, but we'll see..."
4433 else
4434 echo "Looks kind of like a USG system, but we'll see..."
4435 fi
4436 echo exit 0 >usg
4437 fi
4438elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4439 echo "Looks kind of like a BSD system, but we'll see..."
4440 d_bsd="$define"
4441 echo exit 0 >bsd
4442else
4443 echo "Looks kind of like a Version 7 system, but we'll see..."
4444 echo exit 0 >v7
4445fi
4446case "$eunicefix" in
4447*unixtovms*)
4448 $cat <<'EOI'
4449There is, however, a strange, musty smell in the air that reminds me of
4450something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4451EOI
4452 echo exit 0 >eunice
4453 d_eunice="$define"
4454: it so happens the Eunice I know will not run shell scripts in Unix format
4455 ;;
4456*)
4457 echo " "
4458 echo "Congratulations. You aren't running Eunice."
4459 d_eunice="$undef"
4460 ;;
4461esac
4462: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4463: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4464: semicolon as a patch separator
e5e20432
JH
4465case "$p_" in
4466:) ;;
4467*)
4468 $cat <<'EOI'
4469I have the feeling something is not exactly right, however...don't tell me...
4470lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4471(Or you may be running DOS with DJGPP.)
e5e20432
JH
4472EOI
4473 echo exit 0 >os2
4474 ;;
4475esac
4476if test -f /xenix; then
4477 echo "Actually, this looks more like a XENIX system..."
4478 echo exit 0 >xenix
4479 d_xenix="$define"
4480else
4481 echo " "
4482 echo "It's not Xenix..."
4483 d_xenix="$undef"
4484fi
4485chmod +x xenix
4486$eunicefix xenix
4487if test -f /venix; then
4488 echo "Actually, this looks more like a VENIX system..."
4489 echo exit 0 >venix
4490else
4491 echo " "
4492 if ./xenix; then
4493 : null
4494 else
4495 echo "Nor is it Venix..."
4496 fi
4497fi
4498chmod +x bsd usg v7 osf1 eunice xenix venix os2
4499$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4500$rm -f foo
4501
613d6c3e 4502: Check if we are using GNU gcc and what its version is
e5e20432
JH
4503echo " "
4504echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4505$cat >try.c <<EOM
e5e20432
JH
4506#include <stdio.h>
4507int main() {
7686528e 4508#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4509#ifdef __VERSION__
4510 printf("%s\n", __VERSION__);
4511#else
4512 printf("%s\n", "1");
4513#endif
4514#endif
073b6de5 4515 return(0);
e5e20432
JH
4516}
4517EOM
5440bc8e
JH
4518if $cc -o try $ccflags $ldflags try.c; then
4519 gccversion=`$run ./try`
f3f1a2d8
MB
4520 case "$gccversion" in
4521 '') echo "You are not using GNU cc." ;;
4522 *) echo "You are using GNU cc $gccversion."
4523 ccname=gcc
4524 ;;
4525 esac
4526else
4527 echo " "
4528 echo "*** WHOA THERE!!! ***" >&4
4529 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4530 case "$knowitall" in
4531 '')
4532 echo " You'd better start hunting for one and let me know about it." >&4
4533 exit 1
2304df62
AD
4534 ;;
4535 esac
f3f1a2d8
MB
4536fi
4537$rm -f try try.*
4538case "$gccversion" in
45391*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4540esac
4541case "$gccversion" in
4542'') gccosandvers='' ;;
4543*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4544 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4545 gccshortvers=''
4546 case "$gccosandvers" in
4547 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4548 $osname$osvers) ;; # looking good
4549 $osname*) cat <<EOM >&4
4550
4551*** WHOA THERE!!! ***
4552
4553 Your gcc has not been compiled for the exact release of
4554 your operating system ($gccosandvers versus $osname$osvers).
4555
4556 In general it is a good idea to keep gcc synchronized with
4557 the operating system because otherwise serious problems
4558 may ensue when trying to compile software, like Perl.
4559
4560 I'm trying to be optimistic here, though, and will continue.
4561 If later during the configuration and build icky compilation
4562 problems appear (headerfile conflicts being the most common
4563 manifestation), I suggest reinstalling the gcc to match
4564 your operating system release.
4565
4566EOM
4567 ;;
4568 *) gccosandvers='' ;; # failed to parse, better be silent
4569 esac
4570 ;;
4571esac
4572case "$ccname" in
4573'') ccname="$cc" ;;
4574esac
4575
4576# gcc 3.* complain about adding -Idirectories that they already know about,
4577# so we will take those off from locincpth.
4578case "$gccversion" in
45793*)
4580 echo "main(){}">try.c
4581 for incdir in $locincpth; do
4582 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4583 grep '^c[cp]p*[01]: warning: changing search order '`
4584 if test "X$warn" != X; then
4585 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4586 fi
4587 done
4588 $rm -f try try.*
4589esac
2304df62 4590
bd9b35c9
JH
4591: What should the include directory be ?
4592echo " "
4593$echo $n "Hmm... $c"
4594dflt='/usr/include'
4595incpath=''
4596mips_type=''
4597if $test -f /bin/mips && /bin/mips; then
4598 echo "Looks like a MIPS system..."
4599 $cat >usr.c <<'EOCP'
4600#ifdef SYSTYPE_BSD43
4601/bsd43
4602#endif
4603EOCP
8a27cf78 4604 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4605 dflt='/bsd43/usr/include'
4606 incpath='/bsd43'
4607 mips_type='BSD 4.3'
4608 else
4609 mips_type='System V'
4610 fi
4611 $rm -f usr.c usr.out
4612 echo "and you're compiling with the $mips_type compiler and libraries."
4613 xxx_prompt=y
4614 echo "exit 0" >mips
4615else
4616 echo "Doesn't look like a MIPS system."
4617 xxx_prompt=n
4618 echo "exit 1" >mips
4619fi
4620chmod +x mips
4621$eunicefix mips
4622case "$usrinc" in
4623'') ;;
4624*) dflt="$usrinc";;
4625esac
4626case "$xxx_prompt" in
4627y) fn=d/
4628 echo " "
4629 rp='Where are the include files you want to use?'
4630 . ./getfile
4631 usrinc="$ans"
8e07c86e 4632 ;;
bd9b35c9 4633*) usrinc="$dflt"
8e07c86e
AD
4634 ;;
4635esac
2304df62 4636
96056487
JH
4637: see how we invoke the C preprocessor
4638echo " "
4639echo "Now, how can we feed standard input to your C preprocessor..." >&4
4640cat <<'EOT' >testcpp.c
4641#define ABC abc
4642#define XYZ xyz
4643ABC.XYZ
4644EOT
4645cd ..
4646if test ! -f cppstdin; then
4647 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4648 # AIX cc -E doesn't show the absolute headerfile
4649 # locations but we'll cheat by using the -M flag.
4650 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
4651 else
4652 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4653 fi
4654else
4655 echo "Keeping your $hint cppstdin wrapper."
4656fi
4657chmod 755 cppstdin
4658wrapper=`pwd`/cppstdin
4659ok='false'
4660cd UU
4661
4662if $test "X$cppstdin" != "X" && \
4663 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4664 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4665then
4666 echo "You used to use $cppstdin $cppminus so we'll use that again."
4667 case "$cpprun" in
4668 '') echo "But let's see if we can live without a wrapper..." ;;
4669 *)
4670 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4671 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4672 then
4673 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4674 ok='true'
4675 else
4676 echo "(However, $cpprun $cpplast does not work, let's see...)"
4677 fi
4678 ;;
4679 esac
4680else
4681 case "$cppstdin" in
4682 '') ;;
4683 *)
4684 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4685 ;;
4686 esac
4687fi
4688
4689if $ok; then
4690 : nothing
4691elif echo 'Maybe "'"$cc"' -E" will work...'; \
4692 $cc -E <testcpp.c >testcpp.out 2>&1; \
4693 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4694 echo "Yup, it does."
4695 x_cpp="$cc -E"
4696 x_minus='';
4697elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4698 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4699 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4700 echo "Yup, it does."
4701 x_cpp="$cc -E"
4702 x_minus='-';
4703elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4704 $cc -P <testcpp.c >testcpp.out 2>&1; \
4705 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4706 echo "Yipee, that works!"
4707 x_cpp="$cc -P"
4708 x_minus='';
4709elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4710 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4711 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4712 echo "At long last!"
4713 x_cpp="$cc -P"
4714 x_minus='-';
4715elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4716 $cpp <testcpp.c >testcpp.out 2>&1; \
4717 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4718 echo "It works!"
4719 x_cpp="$cpp"
4720 x_minus='';
4721elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4722 $cpp - <testcpp.c >testcpp.out 2>&1; \
4723 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4724 echo "Hooray, it works! I was beginning to wonder."
4725 x_cpp="$cpp"
4726 x_minus='-';
4727elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4728 $wrapper <testcpp.c >testcpp.out 2>&1; \
4729 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4730 x_cpp="$wrapper"
4731 x_minus=''
4732 echo "Eureka!"
4733else
4734 dflt=''
4735 rp="No dice. I can't find a C preprocessor. Name one:"
4736 . ./myread
4737 x_cpp="$ans"
4738 x_minus=''
4739 $x_cpp <testcpp.c >testcpp.out 2>&1
4740 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4741 echo "OK, that will do." >&4
4742 else
4743echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4744 exit 1
4745 fi
4746fi
4747
4748case "$ok" in
4749false)
4750 cppstdin="$x_cpp"
4751 cppminus="$x_minus"
4752 cpprun="$x_cpp"
4753 cpplast="$x_minus"
4754 set X $x_cpp
4755 shift
4756 case "$1" in
4757 "$cpp")
4758 echo "Perhaps can we force $cc -E using a wrapper..."
4759 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4760 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4761 then
4762 echo "Yup, we can."
4763 cppstdin="$wrapper"
4764 cppminus='';
4765 else
4766 echo "Nope, we'll have to live without it..."
4767 fi
4768 ;;
4769 esac
4770 case "$cpprun" in
4771 "$wrapper")
4772 cpprun=''
4773 cpplast=''
4774 ;;
4775 esac
4776 ;;
4777esac
4778
4779case "$cppstdin" in
4780"$wrapper"|'cppstdin') ;;
4781*) $rm -f $wrapper;;
4782esac
4783$rm -f testcpp.c testcpp.out
4784
bd9b35c9
JH
4785: Set private lib path
4786case "$plibpth" in
4787'') if ./mips; then
4788 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4789 fi;;
4790esac
4791case "$libpth" in
4792' ') dlist='';;
4793'') dlist="$loclibpth $plibpth $glibpth";;
4794*) dlist="$libpth";;
4795esac
4796
4797: Now check and see which directories actually exist, avoiding duplicates
4798libpth=''
4799for xxx in $dlist
4800do
4801 if $test -d $xxx; then
4802 case " $libpth " in
4803 *" $xxx "*) ;;
4804 *) libpth="$libpth $xxx";;
4805 esac
4806 fi
4807done
4808$cat <<'EOM'
4809
4810Some systems have incompatible or broken versions of libraries. Among
4811the directories listed in the question below, please remove any you
4812know not to be holding relevant libraries, and add any that are needed.
4813Say "none" for none.
8e07c86e
AD
4814
4815EOM
bd9b35c9
JH
4816case "$libpth" in
4817'') dflt='none';;
8e07c86e 4818*)
bd9b35c9
JH
4819 set X $libpth
4820 shift
4821 dflt=${1+"$@"}
8e07c86e 4822 ;;
a0d0e21e 4823esac
bd9b35c9
JH
4824rp="Directories to use for library searches?"
4825. ./myread
4826case "$ans" in
4827none) libpth=' ';;
4828*) libpth="$ans";;
4829esac
a0d0e21e 4830
bd9b35c9
JH
4831: compute shared library extension
4832case "$so" in
4833'')
4834 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4835 dflt='sl'
dd4e71fd 4836 else
bd9b35c9 4837 dflt='so'
dd4e71fd
JH
4838 fi
4839 ;;
bd9b35c9 4840*) dflt="$so";;
dd4e71fd 4841esac
dd4e71fd
JH
4842$cat <<EOM
4843
bd9b35c9 4844On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4845you want to suppress searching of shared libraries for the remainder
bd9b35c9 4846of this configuration.
dd4e71fd
JH
4847
4848EOM
bd9b35c9
JH
4849rp='What is the file extension used for shared libraries?'
4850. ./myread
4851so="$ans"
dd4e71fd 4852
bd9b35c9
JH
4853: Define several unixisms.
4854: Hints files or command line option can be used to override them.
4855: The convoluted testing is in case hints files set either the old
4856: or the new name.
4857case "$_exe" in
4858'') case "$exe_ext" in
1fef16b3 4859 '') ;;
bd9b35c9 4860 *) _exe="$exe_ext" ;;
dd4e71fd 4861 esac
bd9b35c9 4862 ;;
bfb7748a 4863esac
bd9b35c9
JH
4864case "$_a" in
4865'') case "$lib_ext" in
4866 '') _a='.a';;
4867 *) _a="$lib_ext" ;;
dd4e71fd
JH
4868 esac
4869 ;;
dd4e71fd 4870esac
bd9b35c9
JH
4871case "$_o" in
4872'') case "$obj_ext" in
4873 '') _o='.o';;
4874 *) _o="$obj_ext";;
4875 esac
4876 ;;
4877esac
4878case "$p_" in
4879'') case "$path_sep" in
4880 '') p_=':';;
4881 *) p_="$path_sep";;
4882 esac
4883 ;;
4884esac
4885exe_ext=$_exe
4886lib_ext=$_a
4887obj_ext=$_o
4888path_sep=$p_
dd4e71fd 4889
5b813a60
MB
4890rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4891
b4eb6b3d
JH
4892: Which makefile gets called first. This is used by make depend.
4893case "$firstmakefile" in
4894'') firstmakefile='makefile';;
4633a7c4 4895esac
4633a7c4 4896
34f1896b 4897: Check for uselongdouble support
1f603089
JH
4898case "$ccflags" in
4899*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4900esac
4901
4902case "$uselongdouble" in
4903$define|true|[yY]*) dflt='y';;
4904*) dflt='n';;
4905esac
4906cat <<EOM
4907
4908Perl can be built to take advantage of long doubles which
4909(if available) may give more accuracy and range for floating point numbers.
4910
4911If this doesn't make any sense to you, just accept the default '$dflt'.
4912EOM
4913rp='Try to use long doubles if available?'
4914. ./myread
4915case "$ans" in
4916y|Y) val="$define" ;;
4917*) val="$undef" ;;
4918esac
4919set uselongdouble
4920eval $setvar
4921
4922case "$uselongdouble" in
4923true|[yY]*) uselongdouble="$define" ;;
4924esac
4925
1f603089
JH
4926: Look for a hint-file generated 'call-back-unit'. If the
4927: user has specified that long doubles should be used,
4928: we may need to set or change some other defaults.
9da7673b
MB
4929if $test -f uselongdouble.cbu; then
4930 echo "Your platform has some specific hints regarding long doubles, using them..."
4931 . ./uselongdouble.cbu
4932else
4933 case "$uselongdouble" in
4934 $define)
1f603089 4935 $cat <<EOM
9da7673b 4936(Your platform does not have any specific hints for long doubles.)
1f603089 4937EOM
1f603089 4938 ;;
9da7673b
MB
4939 esac
4940fi
1f603089 4941
bd9b35c9
JH
4942: Looking for optional libraries
4943echo " "
4944echo "Checking for optional libraries..." >&4
4945case "$libs" in
4946' '|'') dflt='';;
4947*) dflt="$libs";;
4948esac
4949case "$libswanted" in
4950'') libswanted='c_s';;
4951esac
4952case "$usesocks" in
923fc586 4953"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4954esac
68435ea7
JH
4955libsfound=''
4956libsfiles=''
4957libsdirs=''
13b3f787
JH
4958libspath=''
4959for thisdir in $libpth $xlibpth; do
4960 test -d $thisdir && libspath="$libspath $thisdir"
4961done
bd9b35c9 4962for thislib in $libswanted; do
13b3f787 4963 for thisdir in $libspath; do
f7dd4e7f
JH
4964 xxx=''
4965 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4966 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4967 $test -f "$xxx" && eval $libscheck
4968 $test -f "$xxx" && libstyle=shared
4969 fi
4970 if test ! -f "$xxx"; then
4971 xxx=$thisdir/lib$thislib.$so
4972 $test -f "$xxx" && eval $libscheck
4973 $test -f "$xxx" && libstyle=shared
613d6c3e 4974 fi
f7dd4e7f
JH
4975 if test ! -f "$xxx"; then
4976 xxx=$thisdir/lib$thislib$_a
4977 $test -f "$xxx" && eval $libscheck
4978 $test -f "$xxx" && libstyle=static
4979 fi
4980 if test ! -f "$xxx"; then
4981 xxx=$thisdir/$thislib$_a
4982 $test -f "$xxx" && eval $libscheck
4983 $test -f "$xxx" && libstyle=static
4984 fi
4985 if test ! -f "$xxx"; then
4986 xxx=$thisdir/lib${thislib}_s$_a
4987 $test -f "$xxx" && eval $libscheck
4988 $test -f "$xxx" && libstyle=static
09ea5ba9 4989 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4990 fi
4991 if test ! -f "$xxx"; then
4992 xxx=$thisdir/Slib$thislib$_a
4993 $test -f "$xxx" && eval $libscheck
4994 $test -f "$xxx" && libstyle=static
4995 fi
4996 if $test -f "$xxx"; then
43999f95 4997 case "$libstyle" in
f7dd4e7f
JH
4998 shared) echo "Found -l$thislib (shared)." ;;
4999 static) echo "Found -l$thislib." ;;
5000 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 5001 esac
bd9b35c9
JH
5002 case " $dflt " in
5003 *"-l$thislib "*);;
f7dd4e7f 5004 *) dflt="$dflt -l$thislib"
43999f95
JH
5005 libsfound="$libsfound $xxx"
5006 yyy=`basename $xxx`
5007 libsfiles="$libsfiles $yyy"
1e127011 5008 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
5009 case " $libsdirs " in
5010 *" $yyy "*) ;;
5011 *) libsdirs="$libsdirs $yyy" ;;
5012 esac
5013 ;;
bd9b35c9 5014 esac
f7dd4e7f 5015 break
613d6c3e 5016 fi
f7dd4e7f
JH
5017 done
5018 if $test ! -f "$xxx"; then
5019 echo "No -l$thislib."
bd9b35c9
JH
5020 fi
5021done
5022set X $dflt
5023shift
5024dflt="$*"
5025case "$libs" in
5026'') dflt="$dflt";;
5027*) dflt="$libs";;
5028esac
5029case "$dflt" in
5030' '|'') dflt='none';;
5031esac
4633a7c4 5032
bd9b35c9 5033$cat <<EOM
4633a7c4 5034
bd9b35c9
JH
5035In order to compile $package on your machine, a number of libraries
5036are usually needed. Include any other special libraries here as well.
5037Say "none" for none. The default list is almost always right.
8e07c86e 5038EOM
8e07c86e 5039
bd9b35c9
JH
5040echo " "
5041rp="What libraries to use?"
5042. ./myread
5043case "$ans" in
5044none) libs=' ';;
5045*) libs="$ans";;
5046esac
d71b2b6b 5047
bd9b35c9
JH
5048: determine optimization, if desired, or use for debug flag also
5049case "$optimize" in
5050' '|$undef) dflt='none';;
5051'') dflt='-O';;
5052*) dflt="$optimize";;
5053esac
5054$cat <<EOH
d71b2b6b 5055
bd9b35c9
JH
5056By default, $package compiles with the -O flag to use the optimizer.
5057Alternately, you might want to use the symbolic debugger, which uses
5058the -g flag (on traditional Unix systems). Either flag can be
5059specified here. To use neither flag, specify the word "none".
d71b2b6b 5060
bd9b35c9
JH
5061EOH
5062rp="What optimizer/debugger flag should be used?"
5063. ./myread
5064optimize="$ans"
5065case "$optimize" in
5066'none') optimize=" ";;
5067esac
5068
eaf812ae
MB
5069: Check what DEBUGGING is required from the command line
5070: -DEBUGGING or -DDEBUGGING or
5071: -DEBUGGING=both = -g + -DDEBUGGING
5072: -DEBUGGING=-g or -Doptimize=-g = -g
5073: -DEBUGGING=none or -UDEBUGGING =
5074: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5075case "$EBUGGING" in
5076'') ;;
5077*) DEBUGGING=$EBUGGING ;;
5078esac
5079
5080case "$DEBUGGING" in
5a7c70d6 5081-g|both|$define)
eaf812ae
MB
5082 case "$optimize" in
5083 *-g*) ;;
5084 *) optimize="$optimize -g" ;;
5085 esac ;;
5086none|$undef)
5087 case "$optimize" in
5088 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5089 shift
5090 optimize="$*"
5091 ;;
5092 esac ;;
5093esac
5094
bd9b35c9 5095dflt=''
eaf812ae
MB
5096case "$DEBUGGING" in
5097both|$define) dflt='-DDEBUGGING'
5098esac
5099
c34316b3
NC
5100: argument order is deliberate, as the flag will start with - which set could
5101: think is an option
6682be1c 5102checkccflag='check=$1; flag=$2; callback=$3;
c34316b3
NC
5103echo " ";
5104echo "Checking if your compiler accepts $flag" 2>&1;
5105echo "int main(void) { return 0; }" > gcctest.c;
04b62921 5106if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
c34316b3 5107 echo "Yes, it does." 2>&1;
580e570e 5108 if $test -s gcctest.out ; then
04b62921
MB
5109 echo "But your platform does not like it:";
5110 cat gcctest.out;
5111 else
5112 case "$ccflags" in
5113 *$check*)
5114 echo "Leaving current flags $ccflags alone." 2>&1
5115 ;;
5116 *) dflt="$dflt $flag";
5117 eval $callback
5118 ;;
5119 esac
5120 fi
c34316b3
NC
5121else
5122 echo "Nope, it does not, but that is ok." 2>&1;
5123fi
5124'
5125
bd9b35c9
JH
5126: We will not override a previous value, but we might want to
5127: augment a hint file
5128case "$hint" in
5129default|recommended)
5130 case "$gccversion" in
eaf812ae 5131 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5132 esac
eaf812ae
MB
5133 case "$optimize:$DEBUGGING" in
5134 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5135 esac
bd9b35c9 5136 case "$gccversion" in
580e570e 5137 2*) if $test -d /etc/conf/kconfig.d &&
bd9b35c9
JH
5138 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5139 then
00e89ad4 5140 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5141 dflt="$dflt -posix"
5142 fi
f0d04425 5143 ;;
bd9b35c9
JH
5144 esac
5145 case "$gccversion" in
5146 1*) ;;
5147 2.[0-8]*) ;;
c0bacbef 5148 ?*) set strict-aliasing -fno-strict-aliasing
c34316b3 5149 eval $checkccflag
f0d04425 5150 ;;
e5e20432 5151 esac
00e89ad4
AD
5152 # For gcc, adding -pipe speeds up compilations for some, but apparently
5153 # some assemblers can't read from stdin. (It also slows down compilations
5154 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5155 case "$gccversion" in
c34316b3
NC
5156 ?*) set pipe -pipe
5157 eval $checkccflag
00e89ad4
AD
5158 ;;
5159 esac
6682be1c
NC
5160
5161 # on x86_64 (at least) we require an extra library (libssp) in the
5162 # link command line. This library is not named, so I infer that it is
5163 # an implementation detail that may change. Hence the safest approach
5164 # is to add the flag to the flags passed to the compiler at link time,
5165 # as that way the compiler can do the right implementation dependant
5166 # thing. (NWC)
5167 case "$gccversion" in
8f68b0e6 5168 ?*) set stack-protector -fstack-protector
6682be1c
NC
5169 eval $checkccflag
5170 ;;
5171 esac
e5e20432
JH
5172 ;;
5173esac
5174
bd9b35c9
JH
5175case "$mips_type" in
5176*BSD*|'') inclwanted="$locincpth $usrinc";;
5177*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5178esac
5179for thisincl in $inclwanted; do
5180 if $test -d $thisincl; then
5181 if $test x$thisincl != x$usrinc; then
5182 case "$dflt" in
00e89ad4
AD
5183 *" -I$thisincl "*);;
5184 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5185 esac
5186 fi
5187 fi
5188done
40a7a20a 5189
bd9b35c9
JH
5190inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5191 xxx=true;
5192elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5193 xxx=true;
5194else
5195 xxx=false;
5196fi;
5197if $xxx; then
5198 case "$dflt" in
5199 *$2*);;
5200 *) dflt="$dflt -D$2";;
5201 esac;
5202fi'
40a7a20a 5203
bd9b35c9 5204set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5205
bd9b35c9
JH
5206case "$usesocks" in
5207$define)
5208 ccflags="$ccflags -DSOCKS"
5209 ;;
5210esac
40a7a20a 5211
bd9b35c9
JH
5212case "$hint" in
5213default|recommended) dflt="$ccflags $dflt" ;;
5214*) dflt="$ccflags";;
5215esac
40a7a20a 5216
bd9b35c9
JH
5217case "$dflt" in
5218''|' ') dflt=none;;
5219esac
422af00a 5220
bd9b35c9 5221$cat <<EOH
40a7a20a 5222
bd9b35c9
JH
5223Your C compiler may want other flags. For this question you should include
5224-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5225but you should NOT include libraries or ld flags like -lwhatever. If you
5226want $package to honor its debug switch, you should include -DDEBUGGING here.
5227Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5228
bd9b35c9 5229To use no flags, specify the word "none".
40a7a20a 5230
bd9b35c9
JH
5231EOH
5232set X $dflt
5233shift
5234dflt=${1+"$@"}
5235rp="Any additional cc flags?"
5236. ./myread
5237case "$ans" in
5238none) ccflags='';;
5239*) ccflags="$ans";;
5240esac
8e07c86e 5241
bd9b35c9 5242: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5243case "$cppflags" in
5244'') cppflags="$ccflags" ;;
5245*) cppflags="$cppflags $ccflags" ;;
5246esac
bd9b35c9
JH
5247case "$gccversion" in
52481*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5249esac
bd9b35c9
JH
5250case "$mips_type" in
5251'');;
5252*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5253esac
5254case "$cppflags" in
5255'');;
5256*)
5257 echo " "
5258 echo "Let me guess what the preprocessor flags are..." >&4
5259 set X $cppflags
5260 shift
5261 cppflags=''
5262 $cat >cpp.c <<'EOM'
5263#define BLURFL foo
8e07c86e 5264
bd9b35c9
JH
5265BLURFL xx LFRULB
5266EOM
5267 previous=''
5268 for flag in $*
5269 do
5270 case "$flag" in
5271 -*) ftry="$flag";;
5272 *) ftry="$previous $flag";;
5273 esac
5274 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5275 >cpp1.out 2>/dev/null && \
5276 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5277 >cpp2.out 2>/dev/null && \
5278 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5279 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5280 then
5281 cppflags="$cppflags $ftry"
5282 previous=''
5283 else
5284 previous="$flag"
5285 fi
5286 done
5287 set X $cppflags
5288 shift
5289 cppflags=${1+"$@"}
5290 case "$cppflags" in
5291 *-*) echo "They appear to be: $cppflags";;
5292 esac
5293 $rm -f cpp.c cpp?.out
2afac517 5294 ;;
5295esac
8e07c86e 5296
bd9b35c9
JH
5297: flags used in final linking phase
5298case "$ldflags" in
5299'') if ./venix; then
5300 dflt='-i -z'
10a23457 5301 else
bd9b35c9 5302 dflt=''
10a23457 5303 fi
bd9b35c9
JH
5304 case "$ccflags" in
5305 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5306 esac
bd9b35c9
JH
5307 ;;
5308*) dflt="$ldflags";;
5309esac
b2f871ed
AD
5310# See note above about -fstack-protector
5311case "$ccflags" in
5312*-fstack-protector*)
5313 case "$dflt" in
5314 *-fstack-protector*) ;; # Don't add it again
5315 *) dflt="$dflt -fstack-protector" ;;
5316 esac
5317 ;;
5318esac
bd9b35c9
JH
5319
5320: Try to guess additional flags to pick up local libraries.
5321for thislibdir in $libpth; do
5322 case " $loclibpth " in
5323 *" $thislibdir "*)
00e89ad4 5324 case "$dflt " in
bd9b35c9
JH
5325 *"-L$thislibdir "*) ;;
5326 *) dflt="$dflt -L$thislibdir" ;;
5327 esac
c4f23d77
AD
5328 ;;
5329 esac
bd9b35c9 5330done
c4f23d77 5331
bd9b35c9
JH
5332case "$dflt" in
5333'') dflt='none' ;;
5334esac
c4f23d77 5335
bd9b35c9
JH
5336$cat <<EOH
5337
5338Your C linker may need flags. For this question you should
5339include -L/whatever and any other flags used by the C linker, but you
5340should NOT include libraries like -lwhatever.
5341
5342Make sure you include the appropriate -L/path flags if your C linker
5343does not normally search all of the directories you specified above,
5344namely
5345 $libpth
5346To use no flags, specify the word "none".
5347
5348EOH
5349
5350rp="Any additional ld flags (NOT including libraries)?"
5351. ./myread
5352case "$ans" in
5353none) ldflags='';;
5354*) ldflags="$ans";;
5355esac
5356rmlist="$rmlist pdp11"
5357
5358: coherency check
5359echo " "
5360echo "Checking your choice of C compiler and flags for coherency..." >&4
5361$cat > try.c <<'EOF'
5362#include <stdio.h>
55954f19 5363int main() { printf("Ok\n"); return(0); }
bd9b35c9 5364EOF
7a282f6d 5365set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5366shift
5367$cat >try.msg <<'EOM'
5368I've tried to compile and run the following simple program:
5369
5370EOM
5371$cat try.c >> try.msg
5372
5373$cat >> try.msg <<EOM
5374
5375I used the command:
5376
5377 $*
5440bc8e 5378 $run ./try
bd9b35c9
JH
5379
5380and I got the following output:
5381
5382EOM
5383dflt=y
73614538 5384if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
613d6c3e 5385 if $sh -c "$run ./try " >>try.msg 2>&1; then
5440bc8e 5386 xxx=`$run ./try`
bd9b35c9
JH
5387 case "$xxx" in
5388 "Ok") dflt=n ;;
5389 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5390 case " $libs " in
5391 *" -lsfio "*)
5392 cat >> try.msg <<'EOQS'
5393If $libs contains -lsfio, and sfio is mis-configured, then it
5394sometimes (apparently) runs and exits with a 0 status, but with no
5395output! It may have to do with sfio's use of _exit vs. exit.
5396
5397EOQS
5398 rp="You have a big problem. Shall I abort Configure"
5399 dflt=y
5400 ;;
5401 esac
5402 ;;
5403 esac
5404 else
5405 echo "The program compiled OK, but exited with status $?." >>try.msg
5406 rp="You have a problem. Shall I abort Configure"
5407 dflt=y
5408 fi
5409else
5410 echo "I can't compile the test program." >>try.msg
5411 rp="You have a BIG problem. Shall I abort Configure"
5412 dflt=y
5413fi
5414case "$dflt" in
5415y)
5416 $cat try.msg >&4
5417 case "$knowitall" in
5418 '')
5419 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5420 ;;
bd9b35c9 5421 *) dflt=n;;
c4f23d77 5422 esac
bd9b35c9
JH
5423 echo " "
5424 . ./myread
5425 case "$ans" in
5426 n*|N*) ;;
5427 *) echo "Ok. Stopping Configure." >&4
5428 exit 1
c4f23d77
AD
5429 ;;
5430 esac
5431 ;;
bd9b35c9 5432n) echo "OK, that should do.";;
c4f23d77 5433esac
613d6c3e 5434$rm_try gcctest gcctest.out
c4f23d77 5435
bd9b35c9
JH
5436: define a shorthand compile call
5437compile='
5438mc_file=$1;
5439shift;
08593cf4
NC
5440case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5441echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5442exit 1;
5443fi;
5444esac;
08413ebc 5445$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5446: define a shorthand compile call for compilations that should be ok.
5447compile_ok='
5448mc_file=$1;
5449shift;
7a282f6d 5450$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5451
8dfa8df9
JH
5452: determine filename position in cpp output
5453echo " "
5454echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5455case "$osname" in
5456vos) testaccess=-e ;;
5457*) testaccess=-r ;;
5458esac
8dfa8df9
JH
5459echo '#include <stdio.h>' > foo.c
5460$cat >fieldn <<EOF
5461$startsh
5462$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5463$grep '^[ ]*#.*stdio\.h' | \
5464while read cline; do
5465 pos=1
5466 set \$cline
5467 while $test \$# -gt 0; do
a5a94ea5 5468 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5469 echo "\$pos"
5470 exit 0
5471 fi
5472 shift
5473 pos=\`expr \$pos + 1\`
5474 done
5475done
5476EOF
5477chmod +x fieldn
5478fieldn=`./fieldn`
5479$rm -f foo.c fieldn
5480case $fieldn in
5481'') pos='???';;
54821) pos=first;;
54832) pos=second;;
54843) pos=third;;
5485*) pos="${fieldn}th";;
5486esac
5487echo "Your cpp writes the filename in the $pos field of the line."
5488
3c728e00
JH
5489case "$osname" in
5490vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5491os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5492*) cppfilter='' ;;
5493esac
8dfa8df9
JH
5494: locate header file
5495$cat >findhdr <<EOF
5496$startsh
5497wanted=\$1
5498name=''
5499for usrincdir in $usrinc
5500do
5501 if test -f \$usrincdir/\$wanted; then
5502 echo "\$usrincdir/\$wanted"
5503 exit 0
5504 fi
5505done
5506awkprg='{ print \$$fieldn }'
5507echo "#include <\$wanted>" > foo\$\$.c
5508$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5509$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5510while read cline; do
5511 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5512 case "\$name" in
5513 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5514 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5515 *) exit 2;;
5516 esac;
5517done;
5518#
5519# status = 0: grep returned 0 lines, case statement not executed
5520# status = 1: headerfile found
5521# status = 2: while loop executed, no headerfile found
5522#
5523status=\$?
5524$rm -f foo\$\$.c;
5525if test \$status -eq 1; then
5526 exit 0;
5527fi
5528exit 1
5529EOF
5530chmod +x findhdr
5531
5532: define an alternate in-header-list? function
5533inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5534cont=true; xxf="echo \"<\$1> found.\" >&4";
5535case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5536*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5537esac;
5538case $# in 4) instead=instead;; *) instead="at last";; esac;
5539while $test "$cont"; do
5540 xxx=`./findhdr $1`
5541 var=$2; eval "was=\$$2";
5542 if $test "$xxx" && $test -r "$xxx";
5543 then eval $xxf;
5544 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5545 cont="";
5546 else eval $xxnf;
5547 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5548 set $yyy; shift; shift; yyy=$@;
5549 case $# in 0) cont="";;
5550 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5551 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5552 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5553 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5554 esac;
5555done;
5556while $test "$yyy";
5557do set $yyy; var=$2; eval "was=\$$2";
5558 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5559 set $yyy; shift; shift; yyy=$@;
5560done'
5561
d1daaddf
JH
5562: see if stdlib is available
5563set stdlib.h i_stdlib
5564eval $inhdr
5565
5566: check for lengths of integral types
5567echo " "
5568case "$intsize" in
5569'')
5570 echo "Checking to see how big your integers are..." >&4
c63dfae1 5571 $cat >try.c <<EOCP
d1daaddf
JH
5572#include <stdio.h>
5573#$i_stdlib I_STDLIB
5574#ifdef I_STDLIB
5575#include <stdlib.h>
5576#endif
5577int main()
5578{
5579 printf("intsize=%d;\n", (int)sizeof(int));
5580 printf("longsize=%d;\n", (int)sizeof(long));
5581 printf("shortsize=%d;\n", (int)sizeof(short));
5582 exit(0);
5583}
5584EOCP
5585 set try
5586 if eval $compile_ok && $run ./try > /dev/null; then
5587 eval `$run ./try`
5588 echo "Your integers are $intsize bytes long."
5589 echo "Your long integers are $longsize bytes long."
5590 echo "Your short integers are $shortsize bytes long."
5591 else
5592 $cat >&4 <<EOM
5593!
5594Help! I can't compile and run the intsize test program: please enlighten me!
5595(This is probably a misconfiguration in your system or libraries, and
5596you really ought to fix it. Still, I'll try anyway.)
5597!
5598EOM
5599 dflt=4
5600 rp="What is the size of an integer (in bytes)?"
5601 . ./myread
5602 intsize="$ans"
5603 dflt=$intsize
5604 rp="What is the size of a long integer (in bytes)?"
5605 . ./myread
5606 longsize="$ans"
5607 dflt=2
5608 rp="What is the size of a short integer (in bytes)?"
5609 . ./myread
5610 shortsize="$ans"
5611 fi
5612 ;;
5613esac
5b813a60 5614$rm_try
d1daaddf
JH
5615
5616: check for long long
5617echo " "
5618echo "Checking to see if you have long long..." >&4
5619echo 'int main() { long long x = 7; return 0; }' > try.c
5620set try
5621if eval $compile; then
5622 val="$define"
5623 echo "You have long long."
5624else
5625 val="$undef"
5626 echo "You do not have long long."
5627fi
5b813a60 5628$rm_try
d1daaddf
JH
5629set d_longlong
5630eval $setvar
5631
5632: check for length of long long
5633case "${d_longlong}${longlongsize}" in
5634$define)
5635 echo " "
5636 echo "Checking to see how big your long longs are..." >&4
5637 $cat >try.c <<'EOCP'
5638#include <stdio.h>
5639int main()
5640{
5641 printf("%d\n", (int)sizeof(long long));
5642 return(0);
5643}
5644EOCP
5645 set try
5646 if eval $compile_ok; then
5647 longlongsize=`$run ./try`
5648 echo "Your long longs are $longlongsize bytes long."
5649 else
5650 dflt='8'
5651 echo " "
5652 echo "(I can't seem to compile the test program. Guessing...)"
5653 rp="What is the size of a long long (in bytes)?"
5654 . ./myread
5655 longlongsize="$ans"
5656 fi
5657 if $test "X$longsize" = "X$longlongsize"; then
5658 echo "(That isn't any different from an ordinary long.)"
5b813a60 5659 fi
d1daaddf
JH
5660 ;;
5661esac
5b813a60 5662$rm_try
d1daaddf 5663
8dfa8df9
JH
5664: see if inttypes.h is available
5665: we want a real compile instead of Inhdr because some systems
5666: have an inttypes.h which includes non-existent headers
5667echo " "
5668$cat >try.c <<EOCP
5669#include <inttypes.h>
5670int main() {
5671 static int32_t foo32 = 0x12345678;
5672}
5673EOCP
5674set try
5675if eval $compile; then
5676 echo "<inttypes.h> found." >&4
5677 val="$define"
5678else
5679 echo "<inttypes.h> NOT found." >&4
5680 val="$undef"
5681fi
5b813a60 5682$rm_try
8dfa8df9
JH
5683set i_inttypes
5684eval $setvar
5685
5686: check for int64_t
5687echo " "
5688echo "Checking to see if you have int64_t..." >&4
5689$cat >try.c <<EOCP
5690#include <sys/types.h>
5691#$i_inttypes I_INTTYPES
5692#ifdef I_INTTYPES
5693#include <inttypes.h>
5694#endif
5695int main() { int64_t x = 7; }
5696EOCP
5697set try
5698if eval $compile; then
5699 val="$define"
5700 echo "You have int64_t."
5701else
5702 val="$undef"
5703 echo "You do not have int64_t."
5704fi
5b813a60 5705$rm_try
8dfa8df9
JH
5706set d_int64_t
5707eval $setvar
5708
613d6c3e 5709: Check if 64bit ints have a quad type
8dfa8df9
JH
5710echo " "
5711echo "Checking which 64-bit integer type we could use..." >&4
5712
5713case "$intsize" in
57148) val=int
5715 set quadtype
5716 eval $setvar
5717 val='"unsigned int"'
5718 set uquadtype
5719 eval $setvar
5720 quadkind=1
5721 ;;
5722*) case "$longsize" in
5723 8) val=long
5724 set quadtype
5725 eval $setvar
5726 val='"unsigned long"'
5727 set uquadtype
5728 eval $setvar
5729 quadkind=2
5730 ;;
5731 *) case "$d_longlong:$longlongsize" in
5732 define:8)
5733 val='"long long"'
5734 set quadtype
5735 eval $setvar
5736 val='"unsigned long long"'
5737 set uquadtype
5738 eval $setvar
5739 quadkind=3
5740 ;;
5741 *) case "$d_int64_t" in
5742 define)
5743 val=int64_t
5744 set quadtype
5745 eval $setvar
5746 val=uint64_t
5747 set uquadtype
5748 eval $setvar
5749 quadkind=4
5750 ;;
5751 esac
5752 ;;
5753 esac
5754 ;;
5755 esac
5756 ;;
5757esac
5758
5759case "$quadtype" in
5760'') echo "Alas, no 64-bit integer types in sight." >&4
5761 d_quad="$undef"
5762 ;;
5763*) echo "We could use '$quadtype' for 64-bit integers." >&4
5764 d_quad="$define"
5765 ;;
5766esac
5767
34f1896b 5768: Do we want 64bit support
b4eb6b3d
JH
5769case "$uselonglong" in
5770"$define"|true|[yY]*)
5771 cat <<EOM >&4
5772
5773*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5774EOM
5775 use64bitint="$define"
5776 ;;
613d6c3e 5777esac
b4eb6b3d
JH
5778case "$use64bits" in
5779"$define"|true|[yY]*)
5780 cat <<EOM >&4
5781
5782*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5783EOM
5784 use64bitint="$define"
5785 ;;
613d6c3e 5786esac
b4eb6b3d
JH
5787case "$use64bitints" in
5788"$define"|true|[yY]*)
5789 cat <<EOM >&4
5790
5791*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5792EOM
5793 use64bitint="$define"
5794 ;;
613d6c3e 5795esac
b4eb6b3d
JH
5796case "$use64bitsint" in
5797"$define"|true|[yY]*)
5798 cat <<EOM >&4
5799
5800*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5801EOM
5802 use64bitint="$define"
5803 ;;
613d6c3e 5804esac
b4eb6b3d
JH
5805case "$uselonglongs" in
5806"$define"|true|[yY]*)
5807 cat <<EOM >&4
5808
5809*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5810EOM
5811 use64bitint="$define"
5812 ;;
613d6c3e 5813esac
b4eb6b3d
JH
5814case "$use64bitsall" in
5815"$define"|true|[yY]*)
5816 cat <<EOM >&4
5817
5818*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5819EOM
5820 use64bitall="$define"
5821 ;;
613d6c3e 5822esac
b4eb6b3d
JH
5823
5824case "$ccflags" in
5825*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5826esac
5827case "$use64bitall" in
5828"$define"|true|[yY]*) use64bitint="$define" ;;
5829esac
5830
5831case "$longsize" in
58328) cat <<EOM
5833
5834You have natively 64-bit long integers.
5835EOM
5836 val="$define"
5837 ;;
5838*) case "$use64bitint" in
5839 "$define"|true|[yY]*) dflt='y';;
5840 *) dflt='n';;
5841 esac
8dfa8df9
JH
5842 case "$d_quad" in
5843 "$define") ;;
5844 *) dflt='n' ;;
5845 esac
b4eb6b3d
JH
5846 cat <<EOM
5847
5848Perl can be built to take advantage of 64-bit integer types
5849on some systems. To do so, Configure can be run with -Duse64bitint.
5850Choosing this option will most probably introduce binary incompatibilities.
5851
5852If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5853(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5854EOM
5855 rp='Try to use 64-bit integers, if available?'
5856 . ./myread
5857 case "$ans" in
5858 [yY]*) val="$define" ;;
5859 *) val="$undef" ;;
5860 esac
5861 ;;
5862esac
5863set use64bitint
5864eval $setvar
5865
5866case "$use64bitall" in
5867"$define"|true|[yY]*) dflt='y' ;;
5868*) case "$longsize" in
5869 8) dflt='y' ;;
5870 *) dflt='n' ;;
5871 esac
5872 ;;
613d6c3e 5873esac
b4eb6b3d
JH
5874cat <<EOM
5875
5876You may also choose to try maximal 64-bitness. It means using as much
587764-bitness as possible on the platform. This in turn means even more
5878binary incompatibilities. On the other hand, your platform may not
5879have any more 64-bitness available than what you already have chosen.
5880
5881If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5882(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5883EOM
5884rp='Try to use maximal 64-bit support, if available?'
5885. ./myread
5886case "$ans" in
5887[yY]*) val="$define" ;;
5888*) val="$undef" ;;
5889esac
5890set use64bitall
5891eval $setvar
5892case "$use64bitall" in
5893"$define")
5894 case "$use64bitint" in
5895 "$undef")
5896 cat <<EOM
5897
5898Since you have chosen a maximally 64-bit build, I'm also turning on
5899the use of 64-bit integers.
5900EOM
5901 use64bitint="$define" ;;
5902 esac
5903 ;;
5904esac
5905
b4eb6b3d
JH
5906: Look for a hint-file generated 'call-back-unit'. If the
5907: user has specified that a 64-bit perl is to be built,
5908: we may need to set or change some other defaults.
19a100ff 5909if $test -f use64bitint.cbu; then
9da7673b 5910 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5911 . ./use64bitint.cbu
5912fi
9da7673b
MB
5913case "$use64bitint" in
5914"$define"|true|[yY]*)
b4eb6b3d
JH
5915 case "$longsize" in
5916 4) case "$archname64" in
5917 '') archname64=64int ;;
5918 esac
5919 ;;
5920 esac
5921 ;;
5922esac
5923
b4eb6b3d
JH
5924: Look for a hint-file generated 'call-back-unit'. If the
5925: user has specified that a maximally 64-bit perl is to be built,
5926: we may need to set or change some other defaults.
19a100ff 5927if $test -f use64bitall.cbu; then
9da7673b 5928 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5929 . ./use64bitall.cbu
5930fi
9da7673b
MB
5931case "$use64bitall" in
5932"$define"|true|[yY]*)
b4eb6b3d
JH
5933 case "$longsize" in
5934 4) case "$archname64" in
5935 ''|64int) archname64=64all ;;
5936 esac
5937 ;;
5938 esac
5939 ;;
5940esac
5941
1911a026
JH
5942case "$d_quad:$use64bitint" in
5943$undef:$define)
5944 cat >&4 <<EOF
5945
5946*** You have chosen to use 64-bit integers,
19a100ff 5947*** but none can be found.
09b58c7b 5948*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5949*** Cannot continue, aborting.
5950
5951EOF
5952 exit 1
5953 ;;
5954esac
5955
36adc09b
JH
5956: check for length of double
5957echo " "
5958case "$doublesize" in
5959'')
5960 echo "Checking to see how big your double precision numbers are..." >&4
5961 $cat >try.c <<EOCP
5962#include <stdio.h>
1911a026
JH
5963#$i_stdlib I_STDLIB
5964#ifdef I_STDLIB
5965#include <stdlib.h>
5966#endif
36adc09b
JH
5967int main()
5968{
5969 printf("%d\n", (int)sizeof(double));
1911a026 5970 exit(0);
36adc09b
JH
5971}
5972EOCP
5973 set try
5974 if eval $compile_ok; then
5975 doublesize=`$run ./try`
5976 echo "Your double is $doublesize bytes long."
5977 else
5978 dflt='8'
5979 echo "(I can't seem to compile the test program. Guessing...)"
5980 rp="What is the size of a double precision number (in bytes)?"
5981 . ./myread
5982 doublesize="$ans"
5983 fi
5984 ;;
5985esac
5b813a60 5986$rm_try
36adc09b
JH
5987
5988: check for long doubles
5989echo " "
5990echo "Checking to see if you have long double..." >&4
5991echo 'int main() { long double x = 7.0; }' > try.c
5992set try
5993if eval $compile; then
5994 val="$define"
5995 echo "You have long double."
5996else
5997 val="$undef"
5998 echo "You do not have long double."
5999fi
5b813a60 6000$rm_try
36adc09b
JH
6001set d_longdbl
6002eval $setvar
6003
6004: check for length of long double
6005case "${d_longdbl}${longdblsize}" in
6006$define)
6007 echo " "
6008 echo "Checking to see how big your long doubles are..." >&4
6009 $cat >try.c <<'EOCP'
6010#include <stdio.h>
6011int main()
6012{
6013 printf("%d\n", sizeof(long double));
6014}
6015EOCP
6016 set try
6017 set try
6018 if eval $compile; then
6019 longdblsize=`$run ./try`
6020 echo "Your long doubles are $longdblsize bytes long."
6021 else
6022 dflt='8'
6023 echo " "
6024 echo "(I can't seem to compile the test program. Guessing...)" >&4
6025 rp="What is the size of a long double (in bytes)?"
6026 . ./myread
6027 longdblsize="$ans"
6028 fi
6029 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
6030 echo "That isn't any different from an ordinary double."
6031 echo "I'll keep your setting anyway, but you may see some"
6032 echo "harmless compilation warnings."
5b813a60 6033 fi
36adc09b
JH
6034 ;;
6035esac
5b813a60 6036$rm_try
36adc09b 6037
89ce900e 6038: determine the architecture name
b4eb6b3d 6039echo " "
89ce900e
JH
6040if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6041 tarch=`arch`"-$osname"
6042elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6043 if uname -m > tmparch 2>&1 ; then
6044 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6045 -e 's/$/'"-$osname/" tmparch`
6046 else
6047 tarch="$osname"
6048 fi
6049 $rm -f tmparch
b4eb6b3d 6050else
89ce900e 6051 tarch="$osname"
b4eb6b3d 6052fi
89ce900e
JH
6053case "$myarchname" in
6054''|"$tarch") ;;
6055*)
6056 echo "(Your architecture name used to be $myarchname.)"
6057 archname=''
6058 ;;
6059esac
6060case "$targetarch" in
6061'') ;;
6062*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6063esac
6064myarchname="$tarch"
6065case "$archname" in
6066'') dflt="$tarch";;
6067*) dflt="$archname";;
6068esac
6069rp='What is your architecture name'
6070. ./myread
6071archname="$ans"
6072case "$usethreads" in
6073$define)
6074 echo "Threads selected." >&4
6075 case "$archname" in
6076 *-thread*) echo "...and architecture name already has -thread." >&4
6077 ;;
6078 *) archname="$archname-thread"
6079 echo "...setting architecture name to $archname." >&4
6080 ;;
6081 esac
6082 ;;
6083esac
6084case "$usemultiplicity" in
6085$define)
6086 echo "Multiplicity selected." >&4
6087 case "$archname" in
6088 *-multi*) echo "...and architecture name already has -multi." >&4
6089 ;;
6090 *) archname="$archname-multi"
6091 echo "...setting architecture name to $archname." >&4
6092 ;;
6093 esac
6094 ;;
6095esac
6096case "$use64bitint$use64bitall" in
6097*"$define"*)
6098 case "$archname64" in
6099 '')
6100 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6101 ;;
89ce900e
JH
6102 *)
6103 case "$use64bitint" in
6104 "$define") echo "64 bit integers selected." >&4 ;;
6105 esac
6106 case "$use64bitall" in
6107 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6108 esac
6109 case "$archname" in
6110 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6111 ;;
6112 *) archname="$archname-$archname64"
6113 echo "...setting architecture name to $archname." >&4
6114 ;;
6115 esac
c1a7f87b
JH
6116 ;;
6117 esac
89ce900e
JH
6118esac
6119case "$uselongdouble" in
6120$define)
6121 echo "Long doubles selected." >&4
6122 case "$longdblsize" in
6123 $doublesize)
6124 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6125 ;;
6126 *)
6127 case "$archname" in
6128 *-ld*) echo "...and architecture name already has -ld." >&4
6129 ;;
6130 *) archname="$archname-ld"
6131 echo "...setting architecture name to $archname." >&4
6132 ;;
6133 esac
bd9b35c9
JH
6134 ;;
6135 esac
bd9b35c9 6136 ;;
89ce900e
JH
6137esac
6138case "$useperlio" in
6139$define)
6140 echo "Perlio selected." >&4
6141 ;;
bd9b35c9 6142*)
89ce900e
JH
6143 echo "Perlio not selected, using stdio." >&4
6144 case "$archname" in
6145 *-stdio*) echo "...and architecture name already has -stdio." >&4
6146 ;;
6147 *) archname="$archname-stdio"
6148 echo "...setting architecture name to $archname." >&4
6149 ;;
6150 esac
bd9b35c9
JH
6151 ;;
6152esac
d2e0c6f7
JH
6153if $test -f archname.cbu; then
6154 echo "Your platform has some specific hints for architecture name, using them..."
6155 . ./archname.cbu
6156fi
bd9b35c9 6157
b4eb6b3d
JH
6158: set the prefixit variable, to compute a suitable default value
6159prefixit='case "$3" in
6160""|none)
6161 case "$oldprefix" in
6162 "") eval "$1=\"\$$2\"";;
6163 *)
6164 case "$3" in
6165 "") eval "$1=";;
6166 none)
6167 eval "tp=\"\$$2\"";
6168 case "$tp" in
6169 ""|" ") eval "$1=\"\$$2\"";;
6170 *) eval "$1=";;
6171 esac;;
6172 esac;;
6173 esac;;
6174*)
6175 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6176 case "$tp" in
6177 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6178 /*-$oldprefix/*|\~*-$oldprefix/*)
6179 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6180 *) eval "$1=\"\$$2\"";;
6181 esac;;
6182esac'
6183
f3f1a2d8
MB
6184: determine installation style
6185: For now, try to deduce it from prefix unless it is already set.
6186: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6187case "$installstyle" in
6188'') case "$prefix" in
6189 *perl*) dflt='lib';;
6190 *) dflt='lib/perl5' ;;
6191 esac
6192 ;;
6193*) dflt="$installstyle" ;;
4d20abad 6194esac
f3f1a2d8
MB
6195: Probably not worth prompting for this since we prompt for all
6196: the directories individually, and the prompt would be too long and
6197: confusing anyway.
6198installstyle=$dflt
4d20abad 6199
eaf812ae
MB
6200: determine where public executables go
6201echo " "
6202set dflt bin bin
6203eval $prefixit
6204fn=d~
6205rp='Pathname where the public executables will reside?'
6206. ./getfile
6207if $test "X$ansexp" != "X$binexp"; then
6208 installbin=''
6209fi
6210prefixvar=bin
6211: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6212: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6213: this via initialinstalllocation
eaf812ae
MB
6214. ./setprefixvar
6215
6216case "$userelocatableinc" in
6217$define|true|[yY]*) dflt='y' ;;
6218*) dflt='n' ;;
6219esac
6220cat <<EOM
6221
6222Would you like to build Perl so that the installation is relocatable, so that
6223library paths in @INC are determined relative to the path of the perl binary?
6224This is not advised for system Perl installs, or if you need to run setid
6225scripts or scripts under taint mode.
6226
6227If this doesn't make any sense to you, just accept the default '$dflt'.
6228EOM
6229rp='Use relocatable @INC?'
6230. ./myread
6231case "$ans" in
6232y|Y) val="$define" ;;
6233*) val="$undef" ;;
6234esac
6235set userelocatableinc
6236eval $setvar
6237
ea7d701d 6238initialinstalllocation="$binexp"
eaf812ae
MB
6239: Default prefix is now "up one level from where the binaries are"
6240case "$userelocatableinc" in
6241$define|true|[yY]*)
eaf812ae
MB
6242 bin=".../"
6243 binexp=".../"
6244 prefix=".../.."
6245 prefixexp=".../.."
6246 installprefixexp=".../.."
6247 ;;
6248esac
6249
b4eb6b3d
JH
6250: determine where private library files go
6251: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6252: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6253: /opt/perl/lib/perl5... would be redundant.
6254: The default "style" setting is made in installstyle.U
6255case "$installstyle" in
6256*lib/perl5*) set dflt privlib lib/$package/$version ;;
6257*) set dflt privlib lib/$version ;;
6258esac
6259eval $prefixit
6260$cat <<EOM
6261
6262There are some auxiliary files for $package that need to be put into a
6263private library directory that is accessible by everyone.
6264
6265EOM
eaf812ae 6266fn=$binexp
b4eb6b3d
JH
6267fn=d~+
6268rp='Pathname where the private library files will reside?'
6269. ./getfile
79522dd2
NC
6270prefixvar=privlib
6271. ./setprefixvar
b4eb6b3d
JH
6272
6273: set the prefixup variable, to restore leading tilda escape
6274prefixup='case "$prefixexp" in
6275"$prefix") ;;
6276*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6277esac'
6278
6279: determine where public architecture dependent libraries go
6280set archlib archlib
6281eval $prefixit
6282: privlib default is /usr/local/lib/$package/$version
6283: archlib default is /usr/local/lib/$package/$version/$archname
6284: privlib may have an optional trailing /share.
6285tdflt=`echo $privlib | $sed 's,/share$,,'`
6286tdflt=$tdflt/$archname
6287case "$archlib" in
6288'') dflt=$tdflt
6289 ;;
6290*) dflt="$archlib"
6291 ;;
6292esac
6293$cat <<EOM
6294
6295$spackage contains architecture-dependent library files. If you are
6296sharing libraries in a heterogeneous environment, you might store
6297these files in a separate location. Otherwise, you can just include
6298them with the rest of the public library files.
6299
6300EOM
eaf812ae 6301fn=$binexp
b4eb6b3d
JH
6302fn=d+~
6303rp='Where do you want to put the public architecture-dependent libraries?'
6304. ./getfile
79522dd2
NC
6305prefixvar=archlib
6306. ./setprefixvar
b4eb6b3d
JH
6307if $test X"$archlib" = X"$privlib"; then
6308 d_archlib="$undef"
6309else
6310 d_archlib="$define"
6311fi
b4eb6b3d 6312
b4eb6b3d
JH
6313: see if setuid scripts can be secure
6314$cat <<EOM
6315
6316Some kernels have a bug that prevents setuid #! scripts from being
6317secure. Some sites have disabled setuid #! scripts because of this.
6318
6319First let's decide if your kernel supports secure setuid #! scripts.
6320(If setuid #! scripts would be secure but have been disabled anyway,
6321don't say that they are secure if asked.)
6322
6323EOM
6324
6325val="$undef"
6326if $test -d /dev/fd; then
6327 echo "#!$ls" >reflect
6328 chmod +x,u+s reflect
6329 ./reflect >flect 2>&1
6330 if $contains "/dev/fd" flect >/dev/null; then
6331 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6332 val="$define"
6333 else
6334 $cat <<EOM
6335If you are not sure if they are secure, I can check but I'll need a
6336username and password different from the one you are using right now.
6337If you don't have such a username or don't want me to test, simply
6338enter 'none'.
6339
6340EOM
6341 rp='Other username to test security of setuid scripts with?'
6342 dflt='none'
6343 . ./myread
6344 case "$ans" in
6345 n|none)
6346 case "$d_suidsafe" in
6347 '') echo "I'll assume setuid scripts are *not* secure." >&4
6348 dflt=n;;
6349 "$undef")
6350 echo "Well, the $hint value is *not* secure." >&4
6351 dflt=n;;
6352 *) echo "Well, the $hint value *is* secure." >&4
6353 dflt=y;;
6354 esac
c1a7f87b 6355 ;;
b4eb6b3d
JH
6356 *)
6357 $rm -f reflect flect
6358 echo "#!$ls" >reflect
6359 chmod +x,u+s reflect
6360 echo >flect
6361 chmod a+w flect
6362 echo '"su" will (probably) prompt you for '"$ans's password."
6363 su $ans -c './reflect >flect'
6364 if $contains "/dev/fd" flect >/dev/null; then
6365 echo "Okay, it looks like setuid scripts are secure." >&4
6366 dflt=y
6367 else
6368 echo "I don't think setuid scripts are secure." >&4
6369 dflt=n
6370 fi
6371 ;;
6372 esac
6373 rp='Does your kernel have *secure* setuid scripts?'
6374 . ./myread
6375 case "$ans" in
6376 [yY]*) val="$define";;
6377 *) val="$undef";;
6378 esac
6379 fi
6380else
6381 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6382 echo "(That's for file descriptors, not floppy disks.)"
6383 val="$undef"
6384fi
6385set d_suidsafe
6386eval $setvar
6387
6388$rm -f reflect flect
6389
6390: now see if they want to do setuid emulation
01614441 6391if $test $patchlevel -lt 11; then
b4eb6b3d
JH
6392echo " "
6393val="$undef"
6394case "$d_suidsafe" in
6395"$define")
6396 val="$undef"
3c728e00 6397 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6398 ;;
f3f1a2d8
MB
6399*)
6400 $cat <<EOM
6401Some systems have disabled setuid scripts, especially systems where
6402setuid scripts cannot be secure. On systems where setuid scripts have
6403been disabled, the setuid/setgid bits on scripts are currently
6404useless. It is possible for $package to detect those bits and emulate
6405setuid/setgid in a secure fashion. This emulation will only work if
6406setuid scripts have been disabled in your kernel.
6407
6408EOM
6409 case "$d_dosuid" in
6410 "$define") dflt=y ;;
6411 *) dflt=n ;;
6412 esac
6413 rp="Do you want to do setuid/setgid emulation?"
6414 . ./myread
6415 case "$ans" in
6416 [yY]*) val="$define";;
6417 *) val="$undef";;
6418 esac
6419 ;;
6420esac
6421set d_dosuid
6422eval $setvar
01614441
MB
6423else
6424 case "$d_dosuid" in
6425 "$define")
6426 cat >&4 <<EOH
6427
6428SUID emulation has been removed for 5.12
6429Please re-run Configure without -Dd_dosuid
6430
6431EOH
6432 exit 1;
6433 ;;
6434 esac
6435 d_dosuid=undef
6436fi
f3f1a2d8 6437
f3f1a2d8
MB
6438: Find perl5.005 or later.
6439echo "Looking for a previously installed perl5.005 or later... "
6440case "$perl5" in
6441'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6442 : Check if this perl is recent and can load a simple module
6443 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6444 perl5=$tdir/perl
6445 break;
6446 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6447 perl5=$tdir/perl5
6448 break;
6449 fi
6450 done
6451 ;;
6452*) perl5="$perl5"
6453 ;;
6454esac
6455case "$perl5" in
6456'') echo "None found. That's ok.";;
6457*) echo "Using $perl5." ;;
6458esac
6459
613d6c3e 6460: Set the siteprefix variables
f3f1a2d8
MB
6461$cat <<EOM
6462
6463After $package is installed, you may wish to install various
6464add-on modules and utilities. Typically, these add-ons will
6465be installed under $prefix with the rest
6466of this package. However, you may wish to install such add-ons
6467elsewhere under a different prefix.
6468
6469If you do not wish to put everything under a single prefix, that's
6470ok. You will be prompted for the individual locations; this siteprefix
6471is only used to suggest the defaults.
6472
6473The default should be fine for most people.
6474
6475EOM
6476fn=d~+
6477rp='Installation prefix to use for add-on modules and utilities?'
6478: XXX Here might be another good place for an installstyle setting.
6479case "$siteprefix" in
6480'') dflt=$prefix ;;
6481*) dflt=$siteprefix ;;
6482esac
6483. ./getfile
6484: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6485oldsiteprefix=''
6486case "$siteprefix" in
6487'') ;;
6488*) case "$ans" in
6489 "$prefix") ;;
6490 *) oldsiteprefix="$prefix";;
6491 esac
6492 ;;
6493esac
6494siteprefix="$ans"
6495siteprefixexp="$ansexp"
6496
6497: determine where site specific libraries go.
6498: Usual default is /usr/local/lib/perl5/site_perl/$version
6499: The default "style" setting is made in installstyle.U
6500: XXX No longer works with Prefixit stuff.
6501prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6502case "$sitelib" in
6503'') case "$installstyle" in
6504 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6505 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6506 esac
6507 ;;
6508*) dflt="$sitelib"
6509 ;;
6510esac
6511$cat <<EOM
6512
6513The installation process will create a directory for
6514site-specific extensions and modules. Most users find it convenient
6515to place all site-specific files in this directory rather than in the
6516main distribution directory.
6517
6518EOM
6519fn=d~+
6520rp='Pathname for the site-specific library files?'
6521. ./getfile
6522prefixvar=sitelib
6523. ./setprefixvar
6524sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6525
6526: Determine list of previous versions to include in @INC
6527$cat > getverlist <<EOPL
6528#!$perl5 -w
6529use File::Basename;
6530\$api_versionstring = "$api_versionstring";
6531\$version = "$version";
6532\$stem = "$sitelib_stem";
6533\$archname = "$archname";
6534EOPL
6535 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6536# The list found is store twice for each entry: the original name, and
6537# the binary broken down version as pack "sss", so sorting is easy and
6538# unambiguous. This will work for all versions that have a maximum of
6539# three digit groups, separate by '.'s or '_'s. Names are extended with
6540# ".0.0" to ensure at least three elements for the pack.
6541# -- H.Merijn Brand (m)'06 23-10-2006
6542
f3f1a2d8
MB
6543# Can't have leading @ because metaconfig interprets it as a command!
6544;@inc_version_list=();
6545# XXX Redo to do opendir/readdir?
6546if (-d $stem) {
6547 chdir($stem);
13cfc98d
MB
6548 ;@candidates = map {
6549 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
a71f1801 6550 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
f3f1a2d8
MB
6551}
6552else {
6553 ;@candidates = ();
6554}
6555
13cfc98d
MB
6556($pversion, $aversion, $vsn5005) = map {
6557 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6558foreach $d (@candidates) {
13cfc98d
MB
6559 if ($d->[1] lt $pversion) {
6560 if ($d->[1] ge $aversion) {
6561 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6562 }
13cfc98d
MB
6563 elsif ($d->[1] ge $vsn5005) {
6564 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6565 }
6566 }
6567 else {
6568 # Skip newer version. I.e. don't look in
6569 # 5.7.0 if we're installing 5.6.1.
6570 }
6571}
6572
6573if (@inc_version_list) {
6574 print join(' ', @inc_version_list);
6575}
6576else {
6577 # Blank space to preserve value for next Configure run.
6578 print " ";
6579}
6580EOPL
6581chmod +x getverlist
6582case "$inc_version_list" in
6583'') if test -x "$perl5$exe_ext"; then
6584 dflt=`$perl5 getverlist`
6585 else
6586 dflt='none'
6587 fi
6588 ;;
6589$undef) dflt='none' ;;
6590*) eval dflt=\"$inc_version_list\" ;;
6591esac
6592case "$dflt" in
6593''|' ') dflt=none ;;
6594esac
6595case "$dflt" in
65965.005) dflt=none ;;
6597esac
6598$cat <<EOM
6599
6600In order to ease the process of upgrading, this version of perl
6601can be configured to use modules built and installed with earlier
6602versions of perl that were installed under $prefix. Specify here
6603the list of earlier versions that this version of perl should check.
6604If Configure detected no earlier versions of perl installed under
6605$prefix, then the list will be empty. Answer 'none' to tell perl
6606to not search earlier versions.
b4eb6b3d 6607
f3f1a2d8
MB
6608The default should almost always be sensible, so if you're not sure,
6609just accept the default.
b4eb6b3d 6610EOM
f3f1a2d8
MB
6611
6612rp='List of earlier versions to include in @INC?'
6613. ./myread
6614case "$ans" in
6615[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6616*) inc_version_list="$ans" ;;
6617esac
6618case "$inc_version_list" in
6619''|' ')
6620 inc_version_list_init='0'
6621 d_inc_version_list="$undef"
6622 ;;
6623*) inc_version_list_init=`echo $inc_version_list |
6624 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6625 d_inc_version_list="$define"
b4eb6b3d
JH
6626 ;;
6627esac
f3f1a2d8 6628$rm -f getverlist
b4eb6b3d 6629
1cd66f7c
DD
6630: see if malloc/malloc.h has to be included
6631set malloc/malloc.h i_mallocmalloc
6632eval $inhdr
6633
b4eb6b3d 6634: see if this is a malloc.h system
01d07975
YST
6635: we want a real compile instead of Inhdr because some systems have a
6636: malloc.h that just gives a compile error saying to use stdlib.h instead
6637echo " "
6638$cat >try.c <<EOCP
6639#include <stdlib.h>
6640#include <malloc.h>
f25eda10 6641#$i_mallocmalloc I_MALLOCMALLOC
1cd66f7c
DD
6642#ifdef I_MALLOCMALLOC
6643# include <malloc/malloc.h>
6644#endif
6645
01d07975
YST
6646int main () { return 0; }
6647EOCP
6648set try
6649if eval $compile; then
6650 echo "<malloc.h> found." >&4
6651 val="$define"
6652else
6653 echo "<malloc.h> NOT found." >&4
6654 val="$undef"
6655fi
5b813a60 6656$rm_try
01d07975
YST
6657set i_malloc
6658eval $setvar
b4eb6b3d 6659
c8b93cf9
JH
6660: check for void type
6661echo " "
6662echo "Checking to see how well your C compiler groks the void type..." >&4
6663case "$voidflags" in
6664'')
c727eafa 6665 $cat >try.c <<EOCP
d1daaddf
JH
6666#$i_stdlib I_STDLIB
6667#ifdef I_STDLIB
6668#include <stdlib.h>
6669#endif
c8b93cf9
JH
6670#if TRY & 1
6671void sub() {
6672#else
6673sub() {
6674#endif
6675 extern void moo(); /* function returning void */
6676 void (*goo)(); /* ptr to func returning void */
6677#if TRY & 8
6678 void *hue; /* generic ptr */
6679#endif
6680#if TRY & 2
6681 void (*foo[10])();
6682#endif
6683
6684#if TRY & 4
6685 if(goo == moo) {
6686 exit(0);
6687 }
6688#endif
6689 exit(0);
6690}
6691int main() { sub(); }
6692EOCP
6693 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6694 voidflags=$defvoidused
6695 echo "Good. It appears to support void to the level $package wants.">&4
6696 if $contains warning .out >/dev/null 2>&1; then
6697 echo "However, you might get some warnings that look like this:"
6698 $cat .out
6699 fi
6700 else
6701echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6702 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6703 echo "It supports 1..."
6704 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6705 echo "It also supports 2..."
6706 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6707 voidflags=7
6708 echo "And it supports 4 but not 8 definitely."
6709 else
6710 echo "It doesn't support 4..."
6711 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6712 voidflags=11
6713 echo "But it supports 8."
6714 else
6715 voidflags=3
6716 echo "Neither does it support 8."
6717 fi
6718 fi
6719 else
6720 echo "It does not support 2..."
6721 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6722 voidflags=13
6723 echo "But it supports 4 and 8."
6724 else
6725 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6726 voidflags=5
6727 echo "And it supports 4 but has not heard about 8."
6728 else
6729 echo "However it supports 8 but not 4."
6730 fi
6731 fi
6732 fi
6733 else
6734 echo "There is no support at all for void."
6735 voidflags=0
6736 fi
6737 fi
6738esac
6739case "$voidflags" in
6740"$defvoidused") ;;
6741*) $cat >&4 <<'EOM'
6742 Support flag bits are:
6743 1: basic void declarations.
6744 2: arrays of pointers to functions returning void.
6745 4: operations between pointers to and addresses of void functions.
6746 8: generic void pointers.
6747EOM
6748 dflt="$voidflags";
6749 rp="Your void support flags add up to what?"
6750 . ./myread
6751 voidflags="$ans"
6752 ;;
6753esac
5b813a60 6754$rm_try
c8b93cf9
JH
6755
6756: check for length of pointer
6757echo " "
6758case "$ptrsize" in
6759'')
6760 echo "Checking to see how big your pointers are..." >&4
6761 if test "$voidflags" -gt 7; then
6762 echo '#define VOID_PTR char *' > try.c
6763 else
6764 echo '#define VOID_PTR void *' > try.c
6765 fi
74d00865 6766 $cat >>try.c <<EOCP
c8b93cf9 6767#include <stdio.h>
d1daaddf
JH
6768#$i_stdlib I_STDLIB
6769#ifdef I_STDLIB
6770#include <stdlib.h>
6771#endif
c8b93cf9
JH
6772int main()
6773{
6774 printf("%d\n", (int)sizeof(VOID_PTR));
6775 exit(0);
6776}
6777EOCP
6778 set try
6779 if eval $compile_ok; then
6780 ptrsize=`$run ./try`
6781 echo "Your pointers are $ptrsize bytes long."
6782 else
6783 dflt='4'
6784 echo "(I can't seem to compile the test program. Guessing...)" >&4
6785 rp="What is the size of a pointer (in bytes)?"
6786 . ./myread
6787 ptrsize="$ans"
6788 fi
6789 ;;
6790esac
5b813a60 6791$rm_try
c8b93cf9
JH
6792case "$use64bitall" in
6793"$define"|true|[yY]*)
6794 case "$ptrsize" in
6795 4) cat <<EOM >&4
6796
1911a026
JH
6797*** You have chosen a maximally 64-bit build,
6798*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6799*** Please rerun Configure without -Duse64bitall.
6800EOM
6801 case "$d_quad" in
6802 define)
6803 cat <<EOM >&4
6804*** Since you have quads, you could possibly try with -Duse64bitint.
6805EOM
6806 ;;
6807 esac
6808 cat <<EOM >&4
1911a026 6809*** Cannot continue, aborting.
c8b93cf9
JH
6810
6811EOM
09b58c7b 6812
1911a026 6813 exit 1
c8b93cf9
JH
6814 ;;
6815 esac
6816 ;;
6817esac
6818
19a100ff 6819
9df442c2
NC
6820: determine whether to use malloc wrapping
6821echo " "
6822case "$usemallocwrap" in
6823[yY]*|true|$define) dflt='y' ;;
6824[nN]*|false|$undef) dflt='n' ;;
6825*) case "$usedevel" in
6826 [yY]*|true|$define) dflt='y' ;;
6827 *) dflt='n' ;;
6828 esac
6829 ;;
6830esac
6831rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6832. ./myread
6833usemallocwrap="$ans"
6834case "$ans" in
6835y*|true)
6836 usemallocwrap="$define" ;;
6837*)
6838 usemallocwrap="$undef" ;;
6839esac
c8b93cf9 6840
b4eb6b3d
JH
6841: determine which malloc to compile in
6842echo " "
6843case "$usemymalloc" in
c4163172
JH
6844[yY]*|true|$define) dflt='y' ;;
6845[nN]*|false|$undef) dflt='n' ;;
6846*) case "$ptrsize" in
6847 4) dflt='y' ;;
6848 *) dflt='n' ;;
6849 esac
6850 ;;
8dfa8df9 6851esac
b4eb6b3d
JH
6852rp="Do you wish to attempt to use the malloc that comes with $package?"
6853. ./myread
6854usemymalloc="$ans"
6855case "$ans" in
6856y*|true)
6857 usemymalloc='y'
6858 mallocsrc='malloc.c'
6859 mallocobj="malloc$_o"
6860 d_mymalloc="$define"
6861 case "$libs" in
6862 *-lmalloc*)
6863 : Remove malloc from list of libraries to use
6864 echo "Removing unneeded -lmalloc from library list" >&4
6865 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6866 shift
6867 libs="$*"
6868 echo "libs = $libs" >&4
6869 ;;
6870 esac
6871 ;;
6872*)
6873 usemymalloc='n'
6874 mallocsrc=''
6875 mallocobj=''
6876 d_mymalloc="$undef"
6877 ;;
6878esac
6879
6880: compute the return types of malloc and free
6881echo " "
6882$cat >malloc.c <<END
6883#$i_malloc I_MALLOC
6884#$i_stdlib I_STDLIB
6885#include <stdio.h>
6886#include <sys/types.h>
6887#ifdef I_MALLOC
6888#include <malloc.h>
6889#endif
6890#ifdef I_STDLIB
6891#include <stdlib.h>
6892#endif
6893#ifdef TRY_MALLOC
6894void *malloc();
6895#endif
6896#ifdef TRY_FREE
6897void free();
6898#endif
6899END
6900case "$malloctype" in
6901'')
6902 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6903 malloctype='void *'
6904 else
6905 malloctype='char *'
6906 fi
6907 ;;
6908esac
6909echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6910
6911case "$freetype" in
6912'')
6913 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6914 freetype='void'
6915 else
6916 freetype='int'
6917 fi
6918 ;;
6919esac
6920echo "Your system uses $freetype free(), it would seem." >&4
6921$rm -f malloc.[co]
b4eb6b3d
JH
6922: determine where site specific architecture-dependent libraries go.
6923: sitelib default is /usr/local/lib/perl5/site_perl/$version
6924: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6925: sitelib may have an optional trailing /share.
6926case "$sitearch" in
6927'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6928 dflt="$dflt/$archname"
6929 ;;
6930*) dflt="$sitearch"
6931 ;;
6932esac
6933set sitearch sitearch none
6934eval $prefixit
6935$cat <<EOM
6936
6937The installation process will also create a directory for
6938architecture-dependent site-specific extensions and modules.
6939
6940EOM
6941fn=d~+
6942rp='Pathname for the site-specific architecture-dependent library files?'
6943. ./getfile
79522dd2
NC
6944prefixvar=sitearch
6945. ./setprefixvar
c95d0e17
GA
6946if $test X"$sitearch" = X"$sitelib"; then
6947 d_sitearch="$undef"
6948else
6949 d_sitearch="$define"
6950fi
b4eb6b3d 6951
613d6c3e 6952: Set the vendorprefix variables
b4eb6b3d
JH
6953$cat <<EOM
6954
6955The installation process will also create a directory for
6956vendor-supplied add-ons. Vendors who supply perl with their system
6957may find it convenient to place all vendor-supplied files in this
6958directory rather than in the main distribution directory. This will
6959ease upgrades between binary-compatible maintenance versions of perl.
6960
6961Of course you may also use these directories in whatever way you see
6962fit. For example, you might use them to access modules shared over a
6963company-wide network.
6964
6965The default answer should be fine for most people.
6966This causes further questions about vendor add-ons to be skipped
6967and no vendor-specific directories will be configured for perl.
6968
6969EOM
6970rp='Do you want to configure vendor-specific add-on directories?'
6971case "$usevendorprefix" in
6972define|true|[yY]*) dflt=y ;;
6973*) : User may have set vendorprefix directly on Configure command line.
6974 case "$vendorprefix" in
6975 ''|' ') dflt=n ;;
6976 *) dflt=y ;;
6977 esac
6978 ;;
6979esac
6980. ./myread
6981case "$ans" in
6982[yY]*) fn=d~+
6983 rp='Installation prefix to use for vendor-supplied add-ons?'
6984 case "$vendorprefix" in
6985 '') dflt='' ;;
6986 *) dflt=$vendorprefix ;;
6987 esac
6988 . ./getfile
6989 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6990 oldvendorprefix=''
6991 case "$vendorprefix" in
6992 '') ;;
6993 *) case "$ans" in
6994 "$prefix") ;;
6995 *) oldvendorprefix="$prefix";;
6996 esac
6997 ;;
6998 esac
6999 usevendorprefix="$define"
7000 vendorprefix="$ans"
7001 vendorprefixexp="$ansexp"
7002 ;;
7003*) usevendorprefix="$undef"
7004 vendorprefix=''
7005 vendorprefixexp=''
7006 ;;
7007esac
7008
613d6c3e 7009: Set the vendorlib variables
b4eb6b3d
JH
7010case "$vendorprefix" in
7011'') d_vendorlib="$undef"
7012 vendorlib=''
7013 vendorlibexp=''
7014 ;;
7015*) d_vendorlib="$define"
7016 : determine where vendor-supplied modules go.
7017 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7018 case "$vendorlib" in
7019 '')
7020 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7021 case "$installstyle" in
7022 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7023 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7024 esac
7025 ;;
7026 *) dflt="$vendorlib"
7027 ;;
7028 esac
7029 fn=d~+
7030 rp='Pathname for the vendor-supplied library files?'
7031 . ./getfile
7032 vendorlib="$ans"
7033 vendorlibexp="$ansexp"
7034 ;;
7035esac
7036vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
7037prefixvar=vendorlib
7038. ./installprefix
b4eb6b3d 7039
613d6c3e 7040: Set the vendorarch variables
b4eb6b3d
JH
7041case "$vendorprefix" in
7042'') d_vendorarch="$undef"
7043 vendorarch=''
7044 vendorarchexp=''
7045 ;;
7046*) d_vendorarch="$define"
7047 : determine where vendor-supplied architecture-dependent libraries go.
7048 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7049 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7050 : vendorlib may have an optional trailing /share.
7051 case "$vendorarch" in
7052 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7053 dflt="$dflt/$archname"
7054 ;;
7055 *) dflt="$vendorarch" ;;
7056 esac
7057 fn=d~+
7058 rp='Pathname for vendor-supplied architecture-dependent files?'
7059 . ./getfile
7060 vendorarch="$ans"
7061 vendorarchexp="$ansexp"
7062 ;;
7063esac
a092d240
NC
7064prefixvar=vendorarch
7065. ./installprefix
1be1b388
MB
7066if $test X"$vendorarch" = X"$vendorlib"; then
7067 d_vendorarch="$undef"
7068else
7069 d_vendorarch="$define"
7070fi
b4eb6b3d
JH
7071
7072: Final catch-all directories to search
7073$cat <<EOM
7074
7075Lastly, you can have perl look in other directories for extensions and
7076modules in addition to those already specified.
7077These directories will be searched after
7078 $sitearch
7079 $sitelib
7080EOM
7081test X"$vendorlib" != "X" && echo ' ' $vendorlib
7082test X"$vendorarch" != "X" && echo ' ' $vendorarch
7083echo ' '
7084case "$otherlibdirs" in
7085''|' ') dflt='none' ;;
7086*) dflt="$otherlibdirs" ;;
7087esac
7088$cat <<EOM
7089Enter a colon-separated set of extra paths to include in perl's @INC
7090search path, or enter 'none' for no extra paths.
7091
7092EOM
7093
7094rp='Colon-separated list of additional directories for perl to search?'
7095. ./myread
7096case "$ans" in
7097' '|''|none) otherlibdirs=' ' ;;
7098*) otherlibdirs="$ans" ;;
7099esac
7100case "$otherlibdirs" in
7101' ') val=$undef ;;
7102*) val=$define ;;
7103esac
7104set d_perl_otherlibdirs
7105eval $setvar
7106
7107: Cruising for prototypes
7108echo " "
7109echo "Checking out function prototypes..." >&4
55954f19
JH
7110$cat >prototype.c <<EOCP
7111#$i_stdlib I_STDLIB
7112#ifdef I_STDLIB
7113#include <stdlib.h>
7114#endif
b4eb6b3d
JH
7115int main(int argc, char *argv[]) {
7116 exit(0);}
7117EOCP
7118if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7119 echo "Your C compiler appears to support function prototypes."
7120 val="$define"
7121else
7122 echo "Your C compiler doesn't seem to understand function prototypes."
7123 val="$undef"
7124fi
7125set prototype
7126eval $setvar
7127$rm -f prototype*
7128
613d6c3e 7129: Check if ansi2knr is required
b4eb6b3d
JH
7130case "$prototype" in
7131"$define") ;;
7132*) ansi2knr='ansi2knr'
7133 echo " "
7134 cat <<EOM >&4
7135
7136$me: FATAL ERROR:
7137This version of $package can only be compiled by a compiler that
7138understands function prototypes. Unfortunately, your C compiler
7139 $cc $ccflags
7140doesn't seem to understand them. Sorry about that.
7141
7142If GNU cc is available for your system, perhaps you could try that instead.
7143
7144Eventually, we hope to support building Perl with pre-ANSI compilers.
7145If you would like to help in that effort, please contact <perlbug@perl.org>.
7146
7147Aborting Configure now.
7148EOM
7149 exit 2
7150 ;;
7151esac
7152
34f1896b
MB
7153: DTrace support
7154dflt_dtrace='/usr/sbin/dtrace'
6e3b7bfa
MB
7155$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7156
34f1896b
MB
7157cat <<EOM
7158
7159Perl can be built to support DTrace on platforms that support it.
7160DTrace is a diagnosis and performance analysis tool from Sun.
7161
7162If this doesn't make any sense to you, just accept the default '$dflt'.
7163EOM
7164
7165while $test 1 ; do
7166 case "$usedtrace" in
7167 $define|true|[yY]*)
7168 dflt='y'
7169 ;;
7170 ?*)
7171 dflt='y'
7172 dflt_dtrace=$usedtrace
7173 ;;
7174 *)
7175 dflt='n'
7176 ;;
7177 esac
7178
7179 rp='Support DTrace if available?'
7180 . ./myread
7181 case "$ans" in
7182 y|Y) val="$define" ;;
7183 *) val="$undef" ;;
7184 esac
7185 set usedtrace
7186 eval $setvar
7187
7188 test "X$usedtrace" != "X$define" && break
7189
7190 echo " "
7191 rp='Where is the dtrace executable?'
7192 dflt=$dflt_dtrace
7193 . ./getfile
7194 val="$ans"
7195 set dtrace
7196 eval $setvar
7197
7198 if $test -f $dtrace
7199 then
7200 if $dtrace -h -s ../perldtrace.d \
7201 -o perldtrace.tmp >/dev/null 2>&1 \
7202 && rm -f perldtrace.tmp
7203 then
7204 echo " "
7205 echo "Good: your $dtrace knows about the -h flag."
7206 else
7207 cat >&2 <<EOM
7208
7209*** $me: Fatal Error: $dtrace doesn't support -h flag
7210***
7211*** Your installed dtrace doesn't support the -h switch to compile a D
7212*** program into a C header. Can't continue.
7213
7214EOM
7215 exit 1
7216 fi
7217 break;
7218 fi
7219
7220 case "$fastread" in
7221 yes)
7222 cat >&2 <<EOM
7223
7224*** $me: Fatal Error: $dtrace not found.
7225*** Can't continue.
7226
7227EOM
7228 exit 1
7229 ;;
7230 *)
7231 echo "*** $dtrace was not found."
7232 echo " "
7233 ;;
7234 esac
7235done
7236
613d6c3e 7237: See if we want extra modules installed
6fcddf3b 7238echo " "
6fcddf3b 7239case "$extras" in
bf35c3f6
JH
7240'') dflt='n';;
7241*) dflt='y';;
6fcddf3b
JH
7242esac
7243cat <<EOM
7244Perl can be built with extra modules or bundles of modules which
7245will be fetched from the CPAN and installed alongside Perl.
7246
7247Notice that you will need access to the CPAN; either via the Internet,
7248or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7249be asked later to configure the CPAN.pm module which will in turn do
7250the installation of the rest of the extra modules or bundles.)
7251
7252Notice also that if the modules require any external software such as
dd2de242
JH
7253libraries and headers (the libz library and the zlib.h header for the
7254Compress::Zlib module, for example) you MUST have any such software
7255already installed, this configuration process will NOT install such
7256things for you.
6fcddf3b
JH
7257
7258If this doesn't make any sense to you, just accept the default '$dflt'.
7259EOM
dd2de242 7260rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7261. ./myread
7262case "$ans" in
7263y|Y)
7264 cat <<EOM
7265
7266Please list any extra modules or bundles to be installed from CPAN,
7267with spaces between the names. The names can be in any format the
dd2de242
JH
7268'install' command of CPAN.pm will understand. (Answer 'none',
7269without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7270EOM
7271 rp='Extras?'
7272 dflt="$extras"
7273 . ./myread
7274 extras="$ans"
7275esac
7276case "$extras" in
7277''|'none')
7278 val=''
7279 $rm -f ../extras.lst
7280 ;;
7281*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7282 echo "$extras" > ../extras.lst
7283 val="'$extras'"
6fcddf3b
JH
7284 ;;
7285esac
7286set extras
7287eval $setvar
7288echo " "
7289
6e1038e0
MB
7290: determine where html pages for programs go
7291set html1dir html1dir none
7292eval $prefixit
7293$cat <<EOM
7294
f3f1a2d8 7295If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7296the appropriate directory here. To skip installing html files,
7297answer "none".
7298EOM
7299case "$html1dir" in
7300''|none|$undef|' ') dflt=none ;;
7301*) dflt=$html1dir ;;
7302esac
7303fn=dn+~
7304rp="Directory for the main $spackage html pages?"
7305. ./getfile
79522dd2
NC
7306prefixvar=html1dir
7307. ./setprefixvar
6e1038e0
MB
7308: Use ' ' for none so value is preserved next time through Configure
7309$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7310
7311: determine where html pages for libraries and modules go
7312set html3dir html3dir none
7313eval $prefixit
7314$cat <<EOM
7315
7316If you wish to install html files for modules associated with $spackage,
7317indicate the appropriate directory here. To skip installing html files,
7318answer "none".
7319EOM
7320: There is no obvious default. If they have specified html1dir, then
7321: try to key off that, possibly changing .../html1 into .../html3.
7322case "$html3dir" in
7323'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7324*) dflt=$html3dir ;;
7325esac
7326fn=dn+~
7327rp="Directory for the $spackage module html pages?"
7328. ./getfile
79522dd2
NC
7329prefixvar=html3dir
7330. ./setprefixvar
6e1038e0
MB
7331: Use ' ' for none so value is preserved next time through Configure
7332$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7333
89ce900e
JH
7334: determine whether to install perl also as /usr/bin/perl
7335
7336echo " "
7337if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7338 $cat <<EOM
7339Many scripts expect perl to be installed as /usr/bin/perl.
7340
7341If you want to, I can install the perl you are about to compile
7342as /usr/bin/perl (in addition to $bin/perl).
7343EOM
7344 if test -f /usr/bin/perl; then
7345 $cat <<EOM
7346
7347However, please note that because you already have a /usr/bin/perl,
7348overwriting that with a new Perl would very probably cause problems.
7349Therefore I'm assuming you don't want to do that (unless you insist).
7350
7351EOM
7352 case "$installusrbinperl" in
7353 "$define"|[yY]*) dflt='y';;
7354 *) dflt='n';;
7355 esac
7356 else
7357 $cat <<EOM
7358
7359Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7360
7361EOM
7362 case "$installusrbinperl" in
7363 "$undef"|[nN]*) dflt='n';;
7364 *) dflt='y';;
7365 esac
7366 fi
7367 rp="Do you want to install perl as /usr/bin/perl?"
7368 . ./myread
7369 case "$ans" in
7370 [yY]*) val="$define";;
7371 *) val="$undef" ;;
7372 esac
7373else
7374 val="$undef"
7375fi
7376set installusrbinperl
7377eval $setvar
7378
613d6c3e 7379: Check if we are using the GNU C library
89ce900e
JH
7380echo " "
7381echo "Checking for GNU C Library..." >&4
7382cat >try.c <<'EOCP'
7383/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7384 alone are insufficient to distinguish different versions, such as
7385 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7386 libc version 2.1.0. A. Dougherty, June 3, 2002.
7387*/
7388#include <stdio.h>
7389int main(void)
7390{
7391#ifdef __GLIBC__
7392# ifdef __GLIBC_MINOR__
4fb7dc7d 7393# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7394# include <gnu/libc-version.h>
7395 printf("%s\n", gnu_get_libc_version());
7396# else
7397 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7398# endif
7399# else
7400 printf("%d\n", __GLIBC__);
7401# endif
7402 return 0;
7403#else
7404 return 1;
7405#endif
7406}
7407EOCP
7408set try
7409if eval $compile_ok && $run ./try > glibc.ver; then
7410 val="$define"
7411 gnulibc_version=`$cat glibc.ver`
7412 echo "You are using the GNU C Library version $gnulibc_version"
7413else
7414 val="$undef"
7415 gnulibc_version=''
7416 echo "You are not using the GNU C Library"
7417fi
5b813a60 7418$rm_try glibc.ver
89ce900e
JH
7419set d_gnulibc
7420eval $setvar
7421
7422: see if nm is to be used to determine whether a symbol is defined or not
7423case "$usenm" in
7424'')
7425 dflt=''
7426 case "$d_gnulibc" in
7427 "$define")
7428 echo " "
7429 echo "nm probably won't work on the GNU C Library." >&4
7430 dflt=n
7431 ;;
7432 esac
7433 case "$dflt" in
7434 '')
7435 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7436 echo " "
7437 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7438 echo "'nm' won't be sufficient on this sytem." >&4
7439 dflt=n
7440 fi
7441 ;;
7442 esac
7443 case "$dflt" in
7444 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7445 if $test $dflt -gt 20; then
7446 dflt=y
7447 else
7448 dflt=n
7449 fi
7450 ;;
7451 esac
b4eb6b3d 7452 ;;
89ce900e
JH
7453*)
7454 case "$usenm" in
7455 true|$define) dflt=y;;
7456 *) dflt=n;;
7457 esac
b4eb6b3d
JH
7458 ;;
7459esac
89ce900e 7460$cat <<EOM
b4eb6b3d 7461
89ce900e
JH
7462I can use $nm to extract the symbols from your C libraries. This
7463is a time consuming task which may generate huge output on the disk (up
7464to 3 megabytes) but that should make the symbols extraction faster. The
7465alternative is to skip the 'nm' extraction part and to compile a small
7466test program instead to determine whether each symbol is present. If
7467you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7468this may be the best solution.
b4eb6b3d 7469
89ce900e 7470You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7471
89ce900e
JH
7472EOM
7473rp="Shall I use $nm to extract C symbols from the libraries?"
7474. ./myread
7475case "$ans" in
7476[Nn]*) usenm=false;;
7477*) usenm=true;;
b4eb6b3d 7478esac
89ce900e
JH
7479
7480runnm=$usenm
7481case "$reuseval" in
7482true) runnm=false;;
b4eb6b3d 7483esac
b4eb6b3d 7484
89ce900e
JH
7485: nm options which may be necessary
7486case "$nm_opt" in
7487'') if $test -f /mach_boot; then
7488 nm_opt='' # Mach
7489 elif $test -d /usr/ccs/lib; then
7490 nm_opt='-p' # Solaris (and SunOS?)
7491 elif $test -f /dgux; then
7492 nm_opt='-p' # DG-UX
7493 elif $test -f /lib64/rld; then
7494 nm_opt='-p' # 64-bit Irix
7495 else
7496 nm_opt=''
7497 fi;;
7498esac
b4eb6b3d 7499
89ce900e
JH
7500: nm options which may be necessary for shared libraries but illegal
7501: for archive libraries. Thank you, Linux.
7502case "$nm_so_opt" in
7503'') case "$myuname" in
fb2e1bc0 7504 *linux*|gnu*)
89ce900e
JH
7505 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7506 nm_so_opt='--dynamic'
7507 fi
7508 ;;
7509 esac
7510 ;;
7511esac
b4eb6b3d 7512
1d8eaf8c 7513: Figure out where the libc is located
89ce900e
JH
7514case "$runnm" in
7515true)
1d8eaf8c 7516: get list of predefined functions in a handy place
89ce900e
JH
7517echo " "
7518case "$libc" in
7519'') libc=unknown
7520 case "$libs" in
7521 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7522 esac
7523 ;;
b4eb6b3d 7524esac
89ce900e
JH
7525case "$libs" in
7526'') ;;
7527*) for thislib in $libs; do
7528 case "$thislib" in
7529 -lc|-lc_s)
7530 : Handle C library specially below.
7531 ;;
7532 -l*)
7533 thislib=`echo $thislib | $sed -e 's/^-l//'`
7534 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7535 :
7536 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7537 :
7538 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7539 :
7540 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7541 :
7542 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7543 :
7544 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7545 :
7546 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7547 :
7548 else
7549 try=''
7550 fi
7551 libnames="$libnames $try"
7552 ;;
7553 *) libnames="$libnames $thislib" ;;
7554 esac
7555 done
b4eb6b3d
JH
7556 ;;
7557esac
89ce900e
JH
7558xxx=normal
7559case "$libc" in
7560unknown)
7561 set /lib/libc.$so
7562 for xxx in $libpth; do
7563 $test -r $1 || set $xxx/libc.$so
7564 : The messy sed command sorts on library version numbers.
7565 $test -r $1 || \
7566 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7567 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7568 h
7569 s/[0-9][0-9]*/0000&/g
7570 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7571 G
7572 s/\n/ /' | \
7573 $sort | $sed -e 's/^.* //'`
7574 eval set \$$#
7575 done
7576 $test -r $1 || set /usr/ccs/lib/libc.$so
7577 $test -r $1 || set /lib/libsys_s$_a
7578 ;;
7579*)
7580 set blurfl
7581 ;;
7582esac
7583if $test -r "$1"; then
7584 echo "Your (shared) C library seems to be in $1."
7585 libc="$1"
7586elif $test -r /lib/libc && $test -r /lib/clib; then
7587 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7588 xxx=apollo
7589 libc='/lib/clib /lib/libc'
7590 if $test -r /lib/syslib; then
7591 echo "(Your math library is in /lib/syslib.)"
7592 libc="$libc /lib/syslib"
7593 fi
7594elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7595 echo "Your C library seems to be in $libc, as you said before."
7596elif $test -r $incpath/usr/lib/libc$_a; then
7597 libc=$incpath/usr/lib/libc$_a;
7598 echo "Your C library seems to be in $libc. That's fine."
7599elif $test -r /lib/libc$_a; then
7600 libc=/lib/libc$_a;
7601 echo "Your C library seems to be in $libc. You're normal."
7602else
7603 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7604 :
7605 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7606 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7607 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7608 :
7609 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7610 :
7611 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7612 :
7613 else
7614 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7615 fi
7616 if $test -r "$tans"; then
7617 echo "Your C library seems to be in $tans, of all places."
7618 libc=$tans
7619 else
7620 libc='blurfl'
7621 fi
7622fi
7623if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7624 dflt="$libc"
7625 cat <<EOM
b4eb6b3d 7626
89ce900e
JH
7627If the guess above is wrong (which it might be if you're using a strange
7628compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7629
89ce900e
JH
7630EOM
7631else
7632 dflt=''
7633 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7634 cat >&4 <<EOM
7635I can't seem to find your C library. I've looked in the following places:
5e366f65 7636
b4eb6b3d 7637EOM
89ce900e
JH
7638 $sed 's/^/ /' libpath
7639 cat <<EOM
5e366f65 7640
89ce900e 7641None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7642
7643EOM
89ce900e
JH
7644fi
7645fn=f
7646rp='Where is your C library?'
7647. ./getfile
7648libc="$ans"
5e366f65 7649
89ce900e
JH
7650echo " "
7651echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7652set X `cat libnames`
7653shift
7654xxx=files
7655case $# in 1) xxx=file; esac
7656echo "Extracting names from the following $xxx for later perusal:" >&4
7657echo " "
7658$sed 's/^/ /' libnames >&4
7659echo " "
7660$echo $n "This may take a while...$c" >&4
5e366f65 7661
89ce900e
JH
7662for file in $*; do
7663 case $file in
7664 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7665 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7666 esac
89ce900e
JH
7667done >libc.tmp
7668
7669$echo $n ".$c"
7670$grep fprintf libc.tmp > libc.ptf
7671xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7672xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
9e08e8f0 7673xxx='[ADTSIWi]'
ab900c53 7674if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7675 eval $xscan;\
7676 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7677 eval $xrun
7678elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7679 eval $xscan;\
7680 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7681 eval $xrun
7682elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7683 eval $xscan;\
7684 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7685 eval $xrun
7686elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7687 eval $xscan;\
7688 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7689 eval $xrun
7690elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7691 eval $xscan;\
7692 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7693 eval $xrun
7694elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7695 eval $xscan;\
7696 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7697 eval $xrun
7698elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7699 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7700 eval $xscan;\
7701 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7702 eval $xrun
7703elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7704 eval $xscan;\
7705 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7706 eval $xrun
7707elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7708 eval $xscan;\
7709 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7710 eval $xrun
7711elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7712 eval $xscan;\
7713 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7714 eval $xrun
7715elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7716 eval $xscan;\
7717 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7718 eval $xrun
7719elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7720 eval $xscan;\
7721 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7722 eval $xrun
7723elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7724 eval $xscan;\
7725 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7726 eval $xrun
7727elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7728 eval $xscan;\
7729 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7730 eval $xrun
b4eb6b3d 7731else
89ce900e
JH
7732 $nm -p $* 2>/dev/null >libc.tmp
7733 $grep fprintf libc.tmp > libc.ptf
7734 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7735 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7736 then
7737 nm_opt='-p'
7738 eval $xrun
7739 else
7740 echo " "
7741 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7742 com=''
1d8eaf8c
MB
7743 if $ar t $libc > libc.tmp && \
7744 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7745 then
89ce900e
JH
7746 for thisname in $libnames $libc; do
7747 $ar t $thisname >>libc.tmp
7748 done
7749 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7750 echo "Ok." >&4
7751 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
89ce900e
JH
7752 for thisname in $libnames $libc; do
7753 $ar tv $thisname >>libc.tmp
89ce900e
JH
7754 emximp -o tmp.imp $thisname \
7755 2>/dev/null && \
7756 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7757 < tmp.imp >>libc.tmp
1d8eaf8c 7758 $rm -f tmp.imp
89ce900e
JH
7759 done
7760 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7761 echo "Ok." >&4
7762 else
7763 echo "$ar didn't seem to work right." >&4
7764 echo "Maybe this is a Cray...trying bld instead..." >&4
1d8eaf8c
MB
7765 if bld t $libc | \
7766 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7767 $test -s libc.list
89ce900e
JH
7768 then
7769 for thisname in $libnames; do
7770 bld t $libnames | \
7771 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7772 $ar t $thisname >>libc.tmp
7773 done
7774 echo "Ok." >&4
7775 else
7776 echo "That didn't work either. Giving up." >&4
7777 exit 1
7778 fi
7779 fi
7780 fi
b4eb6b3d 7781fi
89ce900e
JH
7782nm_extract="$com"
7783case "$PASE" in
7784define)
7785 echo " "
7786 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7787 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7788 ;;
7789*) if $test -f /lib/syscalls.exp; then
7790 echo " "
7791 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
1d8eaf8c
MB
7792 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7793 /lib/syscalls.exp >>libc.list
89ce900e
JH
7794 fi
7795 ;;
7796esac
7797;;
7798esac
7799$rm -f libnames libpath
b4eb6b3d
JH
7800
7801: see if dld is available
7802set dld.h i_dld
7803eval $inhdr
7804
613d6c3e 7805: Check if we are using C++
43dddb59
MB
7806echo " "
7807echo "Checking for C++..." >&4
20e87299 7808$cat >try.c <<'EOCP'
43dddb59
MB
7809#include <stdio.h>
7810int main(void)
7811{
7812#ifdef __cplusplus
20e87299 7813 return 0;
43dddb59 7814#else
20e87299 7815 return 1;
43dddb59 7816#endif
43dddb59
MB
7817}
7818EOCP
7819set try
20e87299
AD
7820if eval $compile_ok && $run ./try; then
7821 val="$define"
43dddb59
MB
7822 echo "You are using a C++ compiler."
7823else
7824 val="$undef"
7825 echo "You are not using a C++ compiler."
7826fi
5b813a60 7827$rm_try cplusplus$$
43dddb59
MB
7828set d_cplusplus
7829eval $setvar
7830
89ce900e
JH
7831: is a C symbol defined?
7832csym='tlook=$1;
7833case "$3" in
373dfab3
JH
7834-v) tf=libc.tmp; tdc="";;
7835-a) tf=libc.tmp; tdc="[]";;
7836*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e 7837esac;
61c26d18
MHM
7838case "$d_cplusplus" in
7839 $define) extern_C="extern \"C\"" ;;
7840 *) extern_C="extern" ;;
7841esac;
89ce900e
JH
7842tx=yes;
7843case "$reuseval-$4" in
7844true-) ;;
7845true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7846esac;
7847case "$tx" in
7848yes)
43dddb59 7849 tval=false;
5129fff4
JH
7850 if $test "$runnm" = true; then
7851 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7852 tval=true;
5129fff4 7853 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
61c26d18 7854 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7855 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7856 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7857 $rm_try;
89ce900e 7858 fi;
5129fff4 7859 else
61c26d18 7860 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7861 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5b813a60 7862 $rm_try;
ab900c53
AB
7863 fi;
7864 ;;
89ce900e
JH
7865*)
7866 case "$tval" in
7867 $define) tval=true;;
7868 *) tval=false;;
ab900c53
AB
7869 esac;
7870 ;;
89ce900e
JH
7871esac;
7872eval "$2=$tval"'
7873
7874: define an is-in-libc? function
7875inlibc='echo " "; td=$define; tu=$undef;
7876sym=$1; var=$2; eval "was=\$$2";
7877tx=yes;
7878case "$reuseval$was" in
7879true) ;;
7880true*) tx=no;;
7881esac;
7882case "$tx" in
7883yes)
7884 set $sym tres -f;
7885 eval $csym;
7886 case "$tres" in
7887 true)
7888 echo "$sym() found." >&4;
7889 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7890 *)
7891 echo "$sym() NOT found." >&4;
7892 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7893 esac;;
7894*)
7895 case "$was" in
7896 $define) echo "$sym() found." >&4;;
7897 *) echo "$sym() NOT found." >&4;;
7898 esac;;
7899esac'
7900
b4eb6b3d
JH
7901: see if dlopen exists
7902xxx_runnm="$runnm"
666ea192 7903xxx_ccflags="$ccflags"
b4eb6b3d 7904runnm=false
666ea192
JH
7905: with g++ one needs -shared to get is-in-libc to work for dlopen
7906case "$gccversion" in
7907'') ;;
7908*) case "$d_cplusplus" in
7909 "$define") ccflags="$ccflags -shared" ;;
7910 esac
7911 ;;
7912esac
b4eb6b3d
JH
7913set dlopen d_dlopen
7914eval $inlibc
7915runnm="$xxx_runnm"
666ea192 7916ccflags="$xxx_ccflags"
b4eb6b3d 7917
4fb7dc7d
JH
7918: see if this is a unistd.h system
7919set unistd.h i_unistd
7920eval $inhdr
7921
b4eb6b3d
JH
7922: determine which dynamic loading, if any, to compile in
7923echo " "
7924dldir="ext/DynaLoader"
7925case "$usedl" in
7926$define|y|true)
7927 dflt='y'
7928 usedl="$define"
7929 ;;
7930$undef|n|false)
7931 dflt='n'
7932 usedl="$undef"
7933 ;;
5b813a60 7934*)
b4eb6b3d
JH
7935 dflt='n'
7936 case "$d_dlopen" in
7937 $define) dflt='y' ;;
7938 esac
7939 case "$i_dld" in
7940 $define) dflt='y' ;;
7941 esac
7942 : Does a dl_xxx.xs file exist for this operating system
7943 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7944 ;;
7945esac
7946rp="Do you wish to use dynamic loading?"
7947. ./myread
7948usedl="$ans"
f1ce3bf1 7949bin_ELF="$undef"
b4eb6b3d
JH
7950case "$ans" in
7951y*) usedl="$define"
7952 case "$dlsrc" in
7953 '')
7954 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7955 dflt="$dldir/dl_${osname}.xs"
7956 elif $test "$d_dlopen" = "$define" ; then
7957 dflt="$dldir/dl_dlopen.xs"
7958 elif $test "$i_dld" = "$define" ; then
7959 dflt="$dldir/dl_dld.xs"
7960 else
7961 dflt=''
7962 fi
7963 ;;
7964 *) dflt="$dldir/$dlsrc"
7965 ;;
7966 esac
7967 echo "The following dynamic loading files are available:"
7968 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7969 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7970 rp="Source file to use for dynamic loading"
7971 fn="fne"
7972 gfpth="$src"
7973 . ./getfile
7974 usedl="$define"
7975 : emulate basename
7976 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7977
7978 $cat << EOM
7979
7980Some systems may require passing special flags to $cc -c to
7981compile modules that will be used to create a shared library.
7982To use no flags, say "none".
7983
7984EOM
7985 case "$cccdlflags" in
7986 '') case "$gccversion" in
7987 '') case "$osname" in
7988 hpux) dflt='+z' ;;
7989 next) dflt='none' ;;
7990 irix*) dflt='-KPIC' ;;
48bcfe03 7991 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7992 sunos) dflt='-pic' ;;
7993 *) dflt='none' ;;
7994 esac
7995 ;;
7996 *) case "$osname" in
b6cc0f4c 7997 darwin) dflt='none' ;;
15fcae63 7998 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7999 *) dflt='-fpic' ;;
8000 esac ;;
8001 esac ;;
8002 ' ') dflt='none' ;;
8003 *) dflt="$cccdlflags" ;;
8004 esac
8005 rp="Any special flags to pass to $cc -c to compile shared library modules?"
8006 . ./myread
8007 case "$ans" in
8008 none) cccdlflags=' ' ;;
8009 *) cccdlflags="$ans" ;;
8010 esac
8011
8012 cat << EOM
8013
8014Some systems use ld to create libraries that can be dynamically loaded,
8015while other systems (such as those using ELF) use $cc.
8016
8017EOM
8018 case "$ld" in
55954f19 8019 '') $cat >try.c <<EOM
b4eb6b3d
JH
8020/* Test for whether ELF binaries are produced */
8021#include <fcntl.h>
55954f19
JH
8022#$i_stdlib I_STDLIB
8023#ifdef I_STDLIB
b4eb6b3d 8024#include <stdlib.h>
55954f19 8025#endif
4fb7dc7d
JH
8026#$i_unistd I_UNISTD
8027#ifdef I_UNISTD
8028#include <unistd.h>
8029#endif
b4eb6b3d
JH
8030int main() {
8031 char b[4];
8032 int i = open("a.out",O_RDONLY);
5b813a60 8033 if(i == -1)
b4eb6b3d
JH
8034 exit(1); /* fail */
8035 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8036 exit(0); /* succeed (yes, it's ELF) */
8037 else
8038 exit(1); /* fail */
8039}
8040EOM
5440bc8e 8041 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
8042 cat <<EOM
8043You appear to have ELF support. I'll use $cc to build dynamic libraries.
8044EOM
8045 dflt="$cc"
f1ce3bf1 8046 bin_ELF="$define"
b4eb6b3d
JH
8047 else
8048 echo "I'll use ld to build dynamic libraries."
8049 dflt='ld'
8050 fi
5b813a60 8051 $rm_try
b4eb6b3d
JH
8052 ;;
8053 *) dflt="$ld"
8054 ;;
8055 esac
8056
8057 rp="What command should be used to create dynamic libraries?"
8058 . ./myread
8059 ld="$ans"
8060
8061 cat << EOM
8062
8063Some systems may require passing special flags to $ld to create a
8064library that can be dynamically loaded. If your ld flags include
8065-L/other/path options to locate libraries outside your loader's normal
8066search path, you may need to specify those -L options here as well. To
8067use no flags, say "none".
8068
8069EOM
8070 case "$lddlflags" in
8071 '') case "$osname" in
8072 beos) dflt='-nostart' ;;
df00ff3b 8073 haiku) dflt='-shared' ;;
b4eb6b3d
JH
8074 hpux) dflt='-b';
8075 case "$gccversion" in
8076 '') dflt="$dflt +vnocompatwarnings" ;;
8077 esac
5b813a60 8078 ;;
15fcae63 8079 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
8080 next) dflt='none' ;;
8081 solaris) dflt='-G' ;;
8082 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 8083 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
8084 *) dflt='none' ;;
8085 esac
8086 ;;
8087 *) dflt="$lddlflags" ;;
8088 esac
8089
8090 : Try to guess additional flags to pick up local libraries.
8091 : Be careful not to append to a plain 'none'
8092 case "$dflt" in
8093 none) dflt='' ;;
8094 esac
8095 for thisflag in $ldflags; do
8096 case "$thisflag" in
b5b9f165 8097 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
8098 case " $dflt " in
8099 *" $thisflag "*) ;;
8100 *) dflt="$dflt $thisflag" ;;
8101 esac
8102 ;;
8103 esac
8104 done
8105
8106 case "$dflt" in
8107 ''|' ') dflt='none' ;;
8108 esac
8109
8f68b0e6
AD
8110 case "$ldflags" in
8111 *-fstack-protector*)
8112 case "$dflt" in
8113 *-fstack-protector*) ;; # Don't add it again
8114 *) dflt="$dflt -fstack-protector" ;;
8115 esac
8116 ;;
8117 esac
8118
8119
b4eb6b3d
JH
8120 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8121 . ./myread
8122 case "$ans" in
8123 none) lddlflags=' ' ;;
8124 *) lddlflags="$ans" ;;
8125 esac
8126
8127 cat <<EOM
8128
8129Some systems may require passing special flags to $cc to indicate that
8130the resulting executable will use dynamic linking. To use no flags,
8131say "none".
8132
8133EOM
8134 case "$ccdlflags" in
8135 '') case "$osname" in
fb2e1bc0 8136 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
8137 next|sunos) dflt='none' ;;
8138 *) dflt='none' ;;
b4eb6b3d
JH
8139 esac ;;
8140 ' ') dflt='none' ;;
8141 *) dflt="$ccdlflags" ;;
8142 esac
8143 rp="Any special flags to pass to $cc to use dynamic linking?"
8144 . ./myread
8145 case "$ans" in
8146 none) ccdlflags=' ' ;;
8147 *) ccdlflags="$ans" ;;
8148 esac
8149 ;;
8150*) usedl="$undef"
8151 ld='ld'
8152 dlsrc='dl_none.xs'
8153 lddlflags=''
8154 ccdlflags=''
8155 ;;
8156esac
8157
34f1896b 8158: Do we want a shared libperl?
b4eb6b3d
JH
8159also=''
8160case "$usedl" in
8161$undef)
8162 # No dynamic loading being used, so don't bother even to prompt.
8163 useshrplib='false'
8164 ;;
8165*) case "$useshrplib" in
8166 '') case "$osname" in
df00ff3b 8167 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
b4eb6b3d
JH
8168 dflt=y
8169 also='Building a shared libperl is required for dynamic loading to work on your system.'
8170 ;;
8171 next*)
8172 case "$osvers" in
8173 4*) dflt=y
8174 also='Building a shared libperl is needed for MAB support.'
8175 ;;
8176 *) dflt=n
8177 ;;
8178 esac
8179 ;;
8180 *) dflt=n
8181 ;;
8182 esac
8183 ;;
8184 $define|true|[Yy]*)
8185 dflt=y
8186 ;;
8187 *) dflt=n
8188 ;;
8189 esac
8190 $cat << EOM
8191
8192The perl executable is normally obtained by linking perlmain.c with
8193libperl${_a}, any static extensions (usually just DynaLoader), and
8194any other libraries needed on this system (such as -lm, etc.). Since
8195your system supports dynamic loading, it is probably possible to build
8196a shared libperl.$so. If you will have more than one executable linked
8197to libperl.$so, this will significantly reduce the size of each
5cadb3f3 8198executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
8199default is probably sensible for your system.
8200$also
8201
8202EOM
8203 rp="Build a shared libperl.$so (y/n)"
8204 . ./myread
8205 case "$ans" in
8206 true|$define|[Yy]*)
8207 useshrplib='true' ;;
8208 *) useshrplib='false' ;;
8209 esac
8210 ;;
8211esac
8212
8213case "$useshrplib" in
8214true)
df31f9b1
MB
8215 case "$userelocatableinc" in
8216 true|define)
8217 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8218 echo "See INSTALL for an explanation why that won't work." >&4
8219 exit 4
8220 ;;
8221 esac
b4eb6b3d
JH
8222 case "$libperl" in
8223 '')
8224 # Figure out a good name for libperl.so. Since it gets stored in
8225 # a version-specific architecture-dependent library, the version
8226 # number isn't really that important, except for making cc/ld happy.
8227 #
56e771c1 8228 # A name such as libperl.so.10.1
b4eb6b3d 8229 majmin="libperl.$so.$patchlevel.$subversion"
56e771c1 8230 # A name such as libperl.so.100
b4eb6b3d
JH
8231 majonly=`echo $patchlevel $subversion |
8232 $awk '{printf "%d%02d", $1, $2}'`
8233 majonly=libperl.$so.$majonly
8234 # I'd prefer to keep the os-specific stuff here to a minimum, and
8235 # rely on figuring it out from the naming of libc.
8236 case "${osname}${osvers}" in
8237 next4*)
8238 dflt=libperl.5.$so
8239 # XXX How handle the --version stuff for MAB?
8240 ;;
fb2e1bc0 8241 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8242 dflt=libperl.$so
8243 ;;
56e771c1
RU
8244 cygwin*) # ld links now against the dll directly
8245 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8246 majonly=`echo $patchlevel $subversion |
8247 $awk '{printf "%03d%03d", $1, $2}'`
8248 majonly=cygperl5.$majonly.$so
8249 dflt=$majmin
b4eb6b3d
JH
8250 ;;
8251 *) # Try to guess based on whether libc has major.minor.
8252 case "$libc" in
8253 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8254 *libc.$so.[0-9]*) dflt=$majonly ;;
8255 *) dflt=libperl.$so ;;
8256 esac
8257 ;;
8258 esac
8259 ;;
8260 *) dflt=$libperl
8261 ;;
8262 esac
8263 cat << EOM
8264
8265I need to select a good name for the shared libperl. If your system uses
8266library names with major and minor numbers, then you might want something
8267like $majmin. Alternatively, if your system uses a single version
8268number for shared libraries, then you might want to use $majonly.
8269Or, your system might be quite happy with a simple libperl.$so.
8270
8271Since the shared libperl will get installed into a version-specific
8272architecture-dependent directory, the version number of the shared perl
8273library probably isn't important, so the default should be o.k.
8274
8275EOM
8276 rp='What name do you want to give to the shared libperl?'
8277 . ./myread
8278 libperl=$ans
8279 echo "Ok, I'll use $libperl"
8280 ;;
8281*)
8282 libperl="libperl${_a}"
8283 ;;
8284esac
8285
8286# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8287case "$shrpdir" in
8288'') ;;
8289*) $cat >&4 <<EOM
8290WARNING: Use of the shrpdir variable for the installation location of
8291the shared $libperl is not supported. It was never documented and
8292will not work in this version. Let me (perlbug@perl.org)
8293know of any problems this may cause.
8294
8295EOM
8296 case "$shrpdir" in
8297 "$archlibexp/CORE")
8298 $cat >&4 <<EOM
8299But your current setting of $shrpdir is
8300the default anyway, so it's harmless.
8301EOM
8302 ;;
8303 *)
8304 $cat >&4 <<EOM
8305Further, your current attempted setting of $shrpdir
8306conflicts with the value of $archlibexp/CORE
8307that installperl will use.
8308EOM
8309 ;;
8310 esac
8311 ;;
8312esac
8313
8314# How will the perl executable find the installed shared $libperl?
8315# Add $xxx to ccdlflags.
8316# If we can't figure out a command-line option, use $shrpenv to
8317# set env LD_RUN_PATH. The main perl makefile uses this.
8318shrpdir=$archlibexp/CORE
8319xxx=''
8320tmp_shrpenv=''
8321if "$useshrplib"; then
34f1896b 8322 case "$osname" in
b4eb6b3d
JH
8323 aix)
8324 # We'll set it in Makefile.SH...
8325 ;;
b5b9f165 8326 solaris)
b4eb6b3d
JH
8327 xxx="-R $shrpdir"
8328 ;;
c5f63f38 8329 freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8330 xxx="-Wl,-R$shrpdir"
8331 ;;
fb2e1bc0 8332 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8333 xxx="-Wl,-rpath,$shrpdir"
8334 ;;
8335 next)
8336 # next doesn't like the default...
8337 ;;
8338 beos)
8339 # beos doesn't like the default, either.
8340 ;;
df00ff3b
IW
8341 haiku)
8342 # Haiku doesn't like the default, either.
8343 ;;
b4eb6b3d
JH
8344 hpux*)
8345 # hpux doesn't like the default, either.
8346 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8347 ;;
56e771c1
RU
8348 cygwin)
8349 # cygwin needs only ldlibpth
8350 ;;
b4eb6b3d
JH
8351 *)
8352 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8353 ;;
8354 esac
8355 case "$xxx" in
8356 '') ;;
34f1896b 8357 *)
b4eb6b3d
JH
8358 # Only add $xxx if it isn't already in ccdlflags.
8359 case " $ccdlflags " in
8360 *" $xxx "*) ;;
8361 *) ccdlflags="$ccdlflags $xxx"
8362 cat <<EOM >&4
8363
8364Adding $xxx to the flags
34f1896b 8365passed to $ld so that the perl executable will find the
b4eb6b3d
JH
8366installed shared $libperl.
8367
8368EOM
8369 ;;
8370 esac
8371 ;;
8372 esac
8373fi
8374# Fix ccdlflags in AIX for building external extensions.
8375# (For building Perl itself bare -bE:perl.exp is needed,
8376# Makefile.SH takes care of this.)
8377case "$osname" in
8378aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8379esac
8380# Respect a hint or command-line value.
8381case "$shrpenv" in
8382'') shrpenv="$tmp_shrpenv" ;;
8383esac
8384case "$ldlibpthname" in
8385'') ldlibpthname=LD_LIBRARY_PATH ;;
8386none) ldlibpthname='' ;;
8387esac
8388
8389: determine where manual pages are on this system
8390echo " "
8391case "$sysman" in
8392'')
4a0a3829
SD
8393 syspath='/usr/share/man/man1 /usr/man/man1'
8394 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8395 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8396 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8397 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8398 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8399 sysman=`./loc . /usr/man/man1 $syspath`
8400 ;;
8401esac
8402if $test -d "$sysman"; then
8403 echo "System manual is in $sysman." >&4
8404else
8405 echo "Could not find manual pages in source form." >&4
8406fi
8407
8408: determine where manual pages go
8409set man1dir man1dir none
8410eval $prefixit
8411$cat <<EOM
8412
8413$spackage has manual pages available in source form.
8414EOM
8415case "$nroff" in
8416nroff)
8417 echo "However, you don't have nroff, so they're probably useless to you."
8418 case "$man1dir" in
8419 '') man1dir="none";;
8420 esac;;
8421esac
8422echo "If you don't want the manual sources installed, answer 'none'."
8423case "$man1dir" in
8424' ') dflt=none
8425 ;;
8426'')
4a0a3829
SD
8427 lookpath="$prefixexp/share/man/man1"
8428 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8429 lookpath="$lookpath $prefixexp/man/p_man/man1"
8430 lookpath="$lookpath $prefixexp/man/u_man/man1"
8431 lookpath="$lookpath $prefixexp/man/man.1"
8432 case "$sysman" in
8433 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8434 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8435 esac
8436 set dflt
8437 eval $prefixup
8438 ;;
8439*) dflt="$man1dir"
8440 ;;
8441esac
8442echo " "
8443fn=dn+~
8444rp="Where do the main $spackage manual pages (source) go?"
8445. ./getfile
8446if $test "X$man1direxp" != "X$ansexp"; then
8447 installman1dir=''
8448fi
79522dd2
NC
8449prefixvar=man1dir
8450. ./setprefixvar
8451
477140ee
NC
8452case "$man1dir" in
8453'') man1dir=' '
8454 installman1dir='';;
8455esac
b4eb6b3d
JH
8456
8457: What suffix to use on installed man pages
8458
8459case "$man1dir" in
8460' ')
8461 man1ext='0'
8462 ;;
8463*)
8464 rp="What suffix should be used for the main $spackage man pages?"
8465 case "$man1ext" in
8466 '') case "$man1dir" in
8467 *1) dflt=1 ;;
8468 *1p) dflt=1p ;;
8469 *1pm) dflt=1pm ;;
8470 *l) dflt=l;;
8471 *n) dflt=n;;
8472 *o) dflt=o;;
8473 *p) dflt=p;;
8474 *C) dflt=C;;
8475 *L) dflt=L;;
8476 *L1) dflt=L1;;
8477 *) dflt=1;;
8478 esac
8479 ;;
8480 *) dflt="$man1ext";;
8481 esac
8482 . ./myread
8483 man1ext="$ans"
8484 ;;
8485esac
8486
8487: see if we can have long filenames
8488echo " "
8489first=123456789abcdef
8490$rm -f $first
8491if (echo hi >$first) 2>/dev/null; then
8492 if $test -f 123456789abcde; then
8493 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8494 val="$undef"
8495 else
8496 echo 'You can have filenames longer than 14 characters.'>&4
8497 val="$define"
8498 fi
8499else
8500 $cat <<'EOM'
8501You can't have filenames longer than 14 chars.
8502You can't even think about them!
8503EOM
8504 val="$undef"
776a38e3 8505fi
b4eb6b3d
JH
8506set d_flexfnam
8507eval $setvar
8508$rm -rf 123456789abcde*
8509
8510: determine where library module manual pages go
8511set man3dir man3dir none
8512eval $prefixit
8513$cat <<EOM
8514
8515$spackage has manual pages for many of the library modules.
8516EOM
8517
8518case "$nroff" in
8519nroff)
8520 $cat <<'EOM'
8521However, you don't have nroff, so they're probably useless to you.
8522EOM
8523 case "$man3dir" in
8524 '') man3dir="none";;
8525 esac;;
8526esac
8527
8528case "$d_flexfnam" in
8529undef)
8530 $cat <<'EOM'
f3f1a2d8 8531However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8532EOM
8533 case "$man3dir" in
8534 '') man3dir="none";;
8535 esac;;
8536esac
8537
8538echo "If you don't want the manual sources installed, answer 'none'."
8539prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8540case "$man3dir" in
8541'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8542 if $test -d "$privlib/man/man3"; then
8543 cat <<EOM >&4
8544
8545WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8546$privlib/man/man3. This version will suggest a
8547new default of $dflt.
b4eb6b3d
JH
8548EOM
8549 tdflt=$dflt
8550 dflt='n'
8551 rp='Do you wish to preserve the old behavior?(y/n)'
8552 . ./myread
8553 case "$ans" in
8554 y*) dflt="$privlib/man/man3" ;;
8555 *) dflt=$tdflt ;;
8556 esac
8557 fi
8558 ;;
8559*) dflt="$man3dir" ;;
8560esac
8561case "$dflt" in
8562' ') dflt=none ;;
8563esac
8564echo " "
8565fn=dn+~
8566rp="Where do the $package library man pages (source) go?"
8567. ./getfile
79522dd2
NC
8568prefixvar=man3dir
8569. ./setprefixvar
8570
477140ee
NC
8571case "$man3dir" in
8572'') man3dir=' '
8573 installman3dir='';;
8574esac
b4eb6b3d
JH
8575
8576: What suffix to use on installed man pages
8577case "$man3dir" in
8578' ')
8579 man3ext='0'
8580 ;;
8581*)
8582 rp="What suffix should be used for the $package library man pages?"
8583 case "$man3ext" in
8584 '') case "$man3dir" in
8585 *3) dflt=3 ;;
8586 *3p) dflt=3p ;;
8587 *3pm) dflt=3pm ;;
8588 *l) dflt=l;;
8589 *n) dflt=n;;
8590 *o) dflt=o;;
8591 *p) dflt=p;;
8592 *C) dflt=C;;
8593 *L) dflt=L;;
8594 *L3) dflt=L3;;
8595 *) dflt=3;;
8596 esac
8597 ;;
8598 *) dflt="$man3ext";;
8599 esac
8600 . ./myread
8601 man3ext="$ans"
8602 ;;
8603esac
8604
8605: see if we have to deal with yellow pages, now NIS.
0384a54a 8606if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8607 if $test -f /usr/etc/nibindd; then
8608 echo " "
8609 echo "I'm fairly confident you're on a NeXT."
8610 echo " "
8611 rp='Do you get the hosts file via NetInfo?'
8612 dflt=y
8613 case "$hostcat" in
8614 nidump*) ;;
8615 '') ;;
8616 *) dflt=n;;
8617 esac
8618 . ./myread
8619 case "$ans" in
8620 y*) hostcat='nidump hosts .';;
8621 *) case "$hostcat" in
8622 nidump*) hostcat='';;
8623 esac
8624 ;;
8625 esac
8626 fi
8627 case "$hostcat" in
8628 nidump*) ;;
8629 *)
8630 case "$hostcat" in
8631 *ypcat*) dflt=y;;
8632 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8633 dflt=y
8634 else
8635 dflt=n
8636 fi;;
8637 *) dflt=n;;
8638 esac
8639 echo " "
8640 rp='Are you getting the hosts file via yellow pages?'
8641 . ./myread
8642 case "$ans" in
8643 y*) hostcat='ypcat hosts';;
8644 *) hostcat='cat /etc/hosts';;
8645 esac
8646 ;;
8647 esac
8648fi
8649case "$hostcat" in
8650'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8651esac
8652case "$groupcat" in
8653'') test -f /etc/group && groupcat='cat /etc/group';;
8654esac
8655case "$passcat" in
8656'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8657esac
8658
8659: now get the host name
8660echo " "
8661echo "Figuring out host name..." >&4
8662case "$myhostname" in
8663'') cont=true
8664 echo 'Maybe "hostname" will work...'
73614538 8665 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8666 myhostname=$tans
8667 phostname=hostname
8668 cont=''
8669 fi
8670 ;;
8671*) cont='';;
8672esac
8673if $test "$cont"; then
8674 if ./xenix; then
8675 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8676 if tans=`cat /etc/systemid 2>&1` ; then
8677 myhostname=$tans
8678 phostname='cat /etc/systemid'
8679 echo "Whadyaknow. Xenix always was a bit strange..."
8680 cont=''
8681 fi
8682 elif $test -r /etc/systemid; then
8683 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8684 fi
8685fi
8686if $test "$cont"; then
8687 echo 'No, maybe "uuname -l" will work...'
73614538 8688 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8689 myhostname=$tans
8690 phostname='uuname -l'
8691 else
8692 echo 'Strange. Maybe "uname -n" will work...'
73614538 8693 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8694 myhostname=$tans
8695 phostname='uname -n'
8696 else
8697 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8698 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8699 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8700 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8701 else
8702 case "$myhostname" in
8703 '') echo "Does this machine have an identity crisis or something?"
8704 phostname='';;
8705 *)
8706 echo "Well, you said $myhostname before..."
8707 phostname='echo $myhostname';;
8708 esac
8709 fi
8710 fi
8711 fi
8712fi
52a549d0
JH
8713case "$myhostname" in
8714'') myhostname=noname ;;
8715esac
b4eb6b3d
JH
8716: you do not want to know about this
8717set $myhostname
8718myhostname=$1
8719
8720: verify guess
8721if $test "$myhostname" ; then
8722 dflt=y
8723 rp='Your host name appears to be "'$myhostname'".'" Right?"
8724 . ./myread
8725 case "$ans" in
8726 y*) ;;
8727 *) myhostname='';;
8728 esac
8729fi
8730
8731: bad guess or no guess
8732while $test "X$myhostname" = X ; do
8733 dflt=''
8734 rp="Please type the (one word) name of your host:"
8735 . ./myread
8736 myhostname="$ans"
8737done
8738
8739: translate upper to lower if necessary
8740case "$myhostname" in
8741*[A-Z]*)
8742 echo "(Normalizing case in your host name)"
8743 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8744 ;;
8745esac
8746
8747case "$myhostname" in
8748*.*)
8749 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8750 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8751 echo "(Trimming domain name from host name--host name is now $myhostname)"
8752 ;;
8753*) case "$mydomain" in
8754 '')
8755 {
8756 test "X$hostcat" = "Xypcat hosts" &&
8757 ypmatch "$myhostname" hosts 2>/dev/null |\
8758 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8759 $test -s hosts
8760 } || {
8761 test "X$hostcat" != "X" &&
8762 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8763 /[ ]$myhostname[ . ]/p" > hosts
8764 }
8765 tmp_re="[ . ]"
f08cbdd1
PP
8766 if $test -f hosts; then
8767 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8768 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8769 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8770 hosts | $sort | $uniq | \
8771 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8772 case `$echo X$dflt` in
8773 X*\ *) echo "(Several hosts in the database matched hostname)"
8774 dflt=.
8775 ;;
8776 X.) echo "(You do not have fully-qualified names in the hosts database)"
8777 ;;
8778 esac
8779 else
8780 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8781 dflt=.
f08cbdd1 8782 fi
b4eb6b3d
JH
8783 case "$dflt" in
8784 .)
8785 tans=`./loc resolv.conf X /etc /usr/etc`
8786 if $test -f "$tans"; then
8787 echo "(Attempting domain name extraction from $tans)"
8788 dflt=.`$sed -n -e 's/ / /g' \
8789 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
1d40d392 8790 -e 1q 2>/dev/null`
b4eb6b3d
JH
8791 case "$dflt" in
8792 .) dflt=.`$sed -n -e 's/ / /g' \
8793 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
1d40d392 8794 -e 1q 2>/dev/null`
b4eb6b3d
JH
8795 ;;
8796 esac
8797 fi
8798 ;;
8799 esac
8800 case "$dflt" in
8801 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8802 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8803 case "$dflt" in
8804 '') dflt='.';;
8805 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8806 esac
8807 ;;
8808 esac
59c9e5d6
PP
8809 case "$dflt$osname" in
8810 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8811 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8812 ;;
8813 esac
b4eb6b3d
JH
8814 case "$dflt" in
8815 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8816 dflt='.nonet'
b4eb6b3d
JH
8817 ;;
8818 esac
8819 $rm -f hosts
8820 ;;
8821 *) dflt="$mydomain";;
8822 esac;;
8823esac
8824echo " "
8825rp="What is your domain name?"
8826. ./myread
8827tans="$ans"
8828case "$ans" in
8829'') ;;
8830.*) ;;
8831*) tans=".$tans";;
8832esac
8833mydomain="$tans"
8834
8835: translate upper to lower if necessary
8836case "$mydomain" in
8837*[A-Z]*)
8838 echo "(Normalizing case in your domain name)"
8839 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8840 ;;
8841esac
8842
8843: a little sanity check here
8844case "$phostname" in
8845'') ;;
8846*)
8847 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8848 $myhostname$mydomain|$myhostname) ;;
8849 *)
8850 case "$phostname" in
8851 sed*)
8852 echo "(That doesn't agree with your whoami.h file, by the way.)"
8853 ;;
8854 *)
8855 echo "(That doesn't agree with your $phostname command, by the way.)"
8856 ;;
8857 esac
8858 ;;
8859 esac
8860 ;;
8861esac
8862
776a38e3 8863: determine the e-mail address of the user who is running us
b4eb6b3d
JH
8864$cat <<EOM
8865
8866I need to get your e-mail address in Internet format if possible, i.e.
8867something like user@host.domain. Please answer accurately since I have
8868no easy means to double check it. The default value provided below
8869is most probably close to reality but may not be valid from outside
8870your organization...
8871
8872EOM
8873cont=x
8874while test "$cont"; do
8875 case "$cf_email" in
8876 '') dflt="$cf_by@$myhostname$mydomain";;
8877 *) dflt="$cf_email";;
8878 esac
8879 rp='What is your e-mail address?'
8880 . ./myread
8881 cf_email="$ans"
8882 case "$cf_email" in
8883 *@*.*) cont='' ;;
8884 *)
8885 rp='Address does not look like an Internet one. Use it anyway?'
8886 case "$fastread" in
8887 yes) dflt=y ;;
8888 *) dflt=n ;;
8889 esac
8890 . ./myread
8891 case "$ans" in
8892 y*) cont='' ;;
8893 *) echo " " ;;
8894 esac
8895 ;;
8896 esac
8897done
8898
34f1896b 8899: Ask e-mail of administrator
b4eb6b3d
JH
8900$cat <<EOM
8901
8902If you or somebody else will be maintaining perl at your site, please
8903fill in the correct e-mail address here so that they may be contacted
8904if necessary. Currently, the "perlbug" program included with perl
8905will send mail to this address in addition to perlbug@perl.org. You may
8906enter "none" for no administrator.
8907
8908EOM
8909case "$perladmin" in
8910'') dflt="$cf_email";;
8911*) dflt="$perladmin";;
8912esac
8913rp='Perl administrator e-mail address'
8914. ./myread
8915perladmin="$ans"
8916
91f55cc7
MB
8917: determine whether to only install version-specific parts.
8918echo " "
8919$cat <<EOM
8920Do you want to install only the version-specific parts of the perl
8921distribution? Usually you do *not* want to do this.
8922EOM
8923case "$versiononly" in
8924"$define"|[Yy]*|true) dflt='y' ;;
8925*) dflt='n';
8926esac
8927rp="Do you want to install only the version-specific parts of perl?"
8928. ./myread
8929case "$ans" in
8930[yY]*) val="$define";;
8931*) val="$undef" ;;
8932esac
8933set versiononly
8934eval $setvar
8935
8936case "$versiononly" in
8937"$define") inc_version_list=''
8938 inc_version_list_init=0
8939 ;;
8940esac
8941
8942: figure out how to guarantee perl startup
8943: XXX Note that this currently takes advantage of the bug that binexp ignores
8944: the Configure -Dinstallprefix setting, which in turn means that under
8945: relocatable @INC, initialinstalllocation is what binexp started as.
8946case "$startperl" in
8947'')
8948 case "$sharpbang" in
8949 *!)
8950 $cat <<EOH
8951
8952I can use the #! construct to start perl on your system. This will
8953make startup of perl scripts faster, but may cause problems if you
8954want to share those scripts and perl is not in a standard place
8955($initialinstalllocation/perl) on all your platforms. The alternative
8956is to force a shell by starting the script with a single ':' character.
8957
8958EOH
8959 case "$versiononly" in
8960 "$define") dflt="$initialinstalllocation/perl$version";;
8961 *) dflt="$initialinstalllocation/perl";;
8962 esac
8963 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8964 . ./myread
8965 case "$ans" in
8966 none) startperl=": # use perl";;
8967 *) startperl="#!$ans"
8968 if $test 30 -lt `echo "$ans" | wc -c`; then
8969 $cat >&4 <<EOM
8970
8971WARNING: Some systems limit the #! command to 32 characters.
8972If you experience difficulty running Perl scripts with #!, try
8973installing Perl in a directory with a shorter pathname.
8974
8975EOM
8976 fi ;;
8977 esac
8978 ;;
8979 *) startperl=": # use perl"
8980 ;;
8981 esac
8982 ;;
8983esac
8984echo "I'll use $startperl to start perl scripts."
8985
8986: figure best path for perl in scripts
8987case "$perlpath" in
8988'')
8989 case "$versiononly" in
8990 "$define") perlpath="$initialinstalllocation/perl$version";;
8991 *) perlpath="$initialinstalllocation/perl";;
8992 esac
8993 case "$startperl" in
8994 *!*) ;;
8995 *)
8996 $cat <<EOH
8997
8998I will use the "eval 'exec'" idiom to start Perl on your system.
8999I can use the full path of your Perl binary for this purpose, but
9000doing so may cause problems if you want to share those scripts and
9001Perl is not always in a standard place ($initialinstalllocation/perl).
9002
9003EOH
9004 dflt="$initialinstalllocation/perl"
9005 rp="What path shall I use in \"eval 'exec'\"?"
9006 . ./myread
9007 perlpath="$ans"
9008 ;;
9009 esac
9010 ;;
9011esac
9012case "$startperl" in
9013*!*) ;;
9014*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9015esac
9016
b4eb6b3d
JH
9017: determine where public executable scripts go
9018set scriptdir scriptdir
9019eval $prefixit
9020case "$scriptdir" in
9021'')
9022 dflt="$bin"
9023 : guess some guesses
9024 $test -d /usr/share/scripts && dflt=/usr/share/scripts
9025 $test -d /usr/share/bin && dflt=/usr/share/bin
9026 $test -d /usr/local/script && dflt=/usr/local/script
9027 $test -d /usr/local/scripts && dflt=/usr/local/scripts
9028 $test -d $prefixexp/script && dflt=$prefixexp/script
9029 set dflt
9030 eval $prefixup
9031 ;;
9032*) dflt="$scriptdir"
9033 ;;
9034esac
9035$cat <<EOM
f3f1a2d8 9036
b4eb6b3d
JH
9037Some installations have a separate directory just for executable scripts so
9038that they can mount it across multiple architectures but keep the scripts in
9039one spot. You might, for example, have a subdirectory of /usr/share for this.
9040Or you might just lump your scripts in with all your other executables.
f3f1a2d8 9041
b4eb6b3d
JH
9042EOM
9043fn=d~
9044rp='Where do you keep publicly executable scripts?'
9045. ./getfile
9046if $test "X$ansexp" != "X$scriptdirexp"; then
9047 installscript=''
9048fi
f3f1a2d8 9049installscriptdir=''
79522dd2
NC
9050prefixvar=scriptdir
9051. ./setprefixvar
9052: A little fix up for an irregularly named variable.
9053installscript="$installscriptdir"
9054
b4eb6b3d
JH
9055: determine where add-on public executables go
9056case "$sitebin" in
9057'') dflt=$siteprefix/bin ;;
9058*) dflt=$sitebin ;;
9059esac
9060fn=d~
9061rp='Pathname where the add-on public executables should be installed?'
9062. ./getfile
79522dd2
NC
9063prefixvar=sitebin
9064. ./setprefixvar
b4eb6b3d 9065
6e1038e0 9066: determine where add-on html pages go
8d2cbf27 9067: There is no standard location, so try to copy the previously-selected
6e1038e0 9068: directory structure for the core html pages.
8d2cbf27
JH
9069case "$sitehtml1dir" in
9070'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9071*) dflt=$sitehtml1dir ;;
6e1038e0
MB
9072esac
9073case "$dflt" in
9074''|' ') dflt=none ;;
9075esac
9076fn=dn+~
9077rp='Pathname where the site-specific html pages should be installed?'
9078. ./getfile
79522dd2
NC
9079prefixvar=sitehtml1dir
9080. ./setprefixvar
6e1038e0
MB
9081
9082: determine where add-on library html pages go
9083: There is no standard location, so try to copy the previously-selected
9084: directory structure for the core html pages.
8d2cbf27
JH
9085case "$sitehtml3dir" in
9086'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9087*) dflt=$sitehtml3dir ;;
6e1038e0
MB
9088esac
9089case "$dflt" in
9090''|' ') dflt=none ;;
9091esac
9092fn=dn+~
9093rp='Pathname where the site-specific library html pages should be installed?'
9094. ./getfile
79522dd2
NC
9095prefixvar=sitehtml3dir
9096. ./setprefixvar
6e1038e0
MB
9097
9098: determine where add-on manual pages go
91e123a8
JH
9099case "$siteman1dir" in
9100'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9101*) dflt=$siteman1dir ;;
6e1038e0 9102esac
257059b5
JH
9103case "$dflt" in
9104''|' ') dflt=none ;;
9105esac
6e1038e0
MB
9106fn=dn+~
9107rp='Pathname where the site-specific manual pages should be installed?'
9108. ./getfile
79522dd2
NC
9109prefixvar=siteman1dir
9110. ./setprefixvar
6e1038e0
MB
9111
9112: determine where add-on library man pages go
91e123a8
JH
9113case "$siteman3dir" in
9114'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9115*) dflt=$siteman3dir ;;
6e1038e0 9116esac
257059b5
JH
9117case "$dflt" in
9118''|' ') dflt=none ;;
9119esac
6e1038e0
MB
9120fn=dn+~
9121rp='Pathname where the site-specific library manual pages should be installed?'
9122. ./getfile
79522dd2
NC
9123prefixvar=siteman3dir
9124. ./setprefixvar
6e1038e0
MB
9125
9126: determine where add-on public executable scripts go
9127case "$sitescript" in
9128'') dflt=$siteprefix/script
9129 $test -d $dflt || dflt=$sitebin ;;
9130*) dflt="$sitescript" ;;
9131esac
9132fn=d~+
9133rp='Pathname where add-on public executable scripts should be installed?'
9134. ./getfile
79522dd2
NC
9135prefixvar=sitescript
9136. ./setprefixvar
6e1038e0 9137
34f1896b 9138: Check if faststdio is requested and available
15b61c98
JH
9139case "$usefaststdio" in
9140$define|true|[yY]*|'')
9141 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9142 case "$xversion" in
9143 [68]) dflt='y' ;;
9144 *) dflt='n' ;;
9145 esac
9146 ;;
9147*) dflt='n';;
9148esac
9149cat <<EOM
9150
9151Perl can be built to use 'fast stdio', which means using the stdio
9152library but also directly manipulating the stdio buffers to enable
9153faster I/O. Using stdio is better for backward compatibility (especially
9154for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9155interface has been preferred instead of stdio.
9156
9157If this doesn't make any sense to you, just accept the default '$dflt'.
9158EOM
9159rp='Use the "fast stdio" if available?'
9160. ./myread
9161case "$ans" in
34f1896b 9162y|Y) val="$define" ;;
15b61c98
JH
9163*) val="$undef" ;;
9164esac
9165set usefaststdio
9166eval $setvar
9167
9168
96056487
JH
9169: define an is-a-typedef? function
9170typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9171case "$inclist" in
9172"") inclist="sys/types.h";;
9173esac;
9174eval "varval=\$$var";
9175case "$varval" in
9176"")
9177 $rm -f temp.c;
9178 for inc in $inclist; do
9179 echo "#include <$inc>" >>temp.c;
9180 done;
9181 echo "#ifdef $type" >> temp.c;
9182 echo "printf(\"We have $type\");" >> temp.c;
9183 echo "#endif" >> temp.c;
9184 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9185 if $contains $type temp.E >/dev/null 2>&1; then
9186 eval "$var=\$type";
9187 else
9188 eval "$var=\$def";
9189 fi;
9190 $rm -f temp.?;;
9191*) eval "$var=\$varval";;
9192esac'
9193
9194: define an is-a-typedef? function that prompts if the type is not available.
9195typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9196case "$inclist" in
9197"") inclist="sys/types.h";;
9198esac;
9199eval "varval=\$$var";
9200case "$varval" in
9201"")
9202 $rm -f temp.c;
9203 for inc in $inclist; do
9204 echo "#include <$inc>" >>temp.c;
9205 done;
9206 echo "#ifdef $type" >> temp.c;
9207 echo "printf(\"We have $type\");" >> temp.c;
9208 echo "#endif" >> temp.c;
9209 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9210 echo " " ;
9211 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9212 if $contains $type temp.E >/dev/null 2>&1; then
9213 echo "$type found." >&4;
9214 eval "$var=\$type";
9215 else
9216 echo "$type NOT found." >&4;
9217 dflt="$def";
9218 . ./myread ;
9219 eval "$var=\$ans";
9220 fi;
9221 $rm -f temp.?;;
9222*) eval "$var=\$varval";;
9223esac'
9224
9225: see what type lseek is declared as in the kernel
9226rp="What is the type used for lseek's offset on this system?"
9227set off_t lseektype long stdio.h sys/types.h
9228eval $typedef_ask
9229
9230echo " "
9231echo "Checking to see how big your file offsets are..." >&4
9232$cat >try.c <<EOCP
9233#include <sys/types.h>
9234#include <stdio.h>
9235int main()
9236{
9237 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9238 return(0);
96056487
JH
9239}
9240EOCP
9241set try
9242if eval $compile_ok; then
9243 lseeksize=`$run ./try`
9244 echo "Your file offsets are $lseeksize bytes long."
9245else
9246 dflt=$longsize
9247 echo " "
9248 echo "(I can't seem to compile the test program. Guessing...)"
9249 rp="What is the size of your file offsets (in bytes)?"
9250 . ./myread
9251 lseeksize="$ans"
9252fi
5b813a60 9253$rm_try
96056487
JH
9254
9255: see what type file positions are declared as in the library
9256rp="What is the type for file position used by fsetpos()?"
9257set fpos_t fpostype long stdio.h sys/types.h
9258eval $typedef_ask
9259
613d6c3e 9260: Check size for Fpos_t
96056487
JH
9261echo " "
9262case "$fpostype" in
9263*_t) zzz="$fpostype" ;;
9264*) zzz="fpos_t" ;;
9265esac
613d6c3e 9266echo "Checking the size of $zzz..." >&4
96056487
JH
9267cat > try.c <<EOCP
9268#include <sys/types.h>
9269#include <stdio.h>
d1daaddf
JH
9270#$i_stdlib I_STDLIB
9271#ifdef I_STDLIB
9272#include <stdlib.h>
9273#endif
96056487
JH
9274int main() {
9275 printf("%d\n", (int)sizeof($fpostype));
9276 exit(0);
9277}
9278EOCP
9279set try
9280if eval $compile_ok; then
9281 yyy=`$run ./try`
9282 case "$yyy" in
9283 '') fpossize=4
9284 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9285 ;;
9286 *) fpossize=$yyy
9287 echo "Your $zzz is $fpossize bytes long."
9288 ;;
9289 esac
9290else
9291 dflt="$longsize"
9292 echo " " >&4
9293 echo "(I can't compile the test program. Guessing...)" >&4
9294 rp="What is the size of your file positions (in bytes)?"
9295 . ./myread
9296 fpossize="$ans"
9297fi
9298
613d6c3e 9299: Check for large file support
96056487
JH
9300# Backward compatibility (uselfs is deprecated).
9301case "$uselfs" in
9302"$define"|true|[yY]*)
9303 cat <<EOM >&4
9304
9305*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9306EOM
9307 uselargefiles="$define"
9308 ;;
5b813a60 9309esac
96056487
JH
9310
9311case "$lseeksize:$fpossize" in
93128:8) cat <<EOM
9313
9314You can have files larger than 2 gigabytes.
9315EOM
9316 val="$define" ;;
9317*) case "$uselargefiles" in
9318 "$undef"|false|[nN]*) dflt='n' ;;
9319 *) dflt='y' ;;
9320 esac
9321 cat <<EOM
9322
9323Perl can be built to understand large files (files larger than 2 gigabytes)
9324on some systems. To do so, Configure can be run with -Duselargefiles.
9325
9326If this doesn't make any sense to you, just accept the default '$dflt'.
9327EOM
9328 rp='Try to understand large files, if available?'
9329 . ./myread
9330 case "$ans" in
9331 y|Y) val="$define" ;;
9332 *) val="$undef" ;;
9333 esac
9334 ;;
9335esac
9336set uselargefiles
9337eval $setvar
96056487
JH
9338: Look for a hint-file generated 'call-back-unit'. If the
9339: user has specified that a large files perl is to be built,
9340: we may need to set or change some other defaults.
9da7673b
MB
9341if $test -f uselargefiles.cbu; then
9342 echo "Your platform has some specific hints regarding large file builds, using them..."
9343 . ./uselargefiles.cbu
9344fi
9345case "$uselargefiles" in
9346"$define")
96056487 9347 if $test -f uselargefiles.cbu; then
96056487
JH
9348 echo " "
9349 echo "Rechecking to see how big your file offsets are..." >&4
9350 $cat >try.c <<EOCP
9351#include <sys/types.h>
9352#include <stdio.h>
9353int main()
9354{
9355 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9356 return(0);
96056487
JH
9357}
9358EOCP
9359 set try
9360 if eval $compile_ok; then
9361 lseeksize=`$run ./try`
9362 $echo "Your file offsets are now $lseeksize bytes long."
9363 else
9364 dflt="$lseeksize"
9365 echo " "
9366 echo "(I can't seem to compile the test program. Guessing...)"
9367 rp="What is the size of your file offsets (in bytes)?"
9368 . ./myread
9369 lseeksize="$ans"
9370 fi
9371 case "$fpostype" in
9372 *_t) zzz="$fpostype" ;;
9373 *) zzz="fpos_t" ;;
9374 esac
5b813a60 9375 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9376 $cat > try.c <<EOCP
9377#include <sys/types.h>
9378#include <stdio.h>
55954f19
JH
9379#$i_stdlib I_STDLIB
9380#ifdef I_STDLIB
9381#include <stdlib.h>
9382#endif
96056487
JH
9383int main() {
9384 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9385 return(0);
96056487
JH
9386}
9387EOCP
9388 set try
9389 if eval $compile_ok; then
9390 yyy=`$run ./try`
9391 dflt="$lseeksize"
9392 case "$yyy" in
9393 '') echo " "
9394 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9395 ;;
9396 *) fpossize=$yyy
9397 echo " $fpossize bytes." >&4
9398 ;;
9399 esac
9400 else
9401 dflt="$fpossize"
9402 echo " "
9403 echo "(I can't compile the test program. Guessing...)" >&4
9404 rp="What is the size of your file positions (in bytes)?"
9405 . ./myread
9406 fpossize="$ans"
9407 fi
5b813a60 9408 $rm_try
96056487
JH
9409 fi
9410 ;;
9411esac
9412
613d6c3e 9413: Set the vendorbin variables
b4eb6b3d
JH
9414case "$vendorprefix" in
9415'') d_vendorbin="$undef"
9416 vendorbin=''
9417 vendorbinexp=''
9418 ;;
9419*) d_vendorbin="$define"
9420 : determine where vendor-supplied executables go.
9421 case "$vendorbin" in
9422 '') dflt=$vendorprefix/bin ;;
9423 *) dflt="$vendorbin" ;;
9424 esac
9425 fn=d~+
9426 rp='Pathname for the vendor-supplied executables directory?'
9427 . ./getfile
9428 vendorbin="$ans"
9429 vendorbinexp="$ansexp"
9430 ;;
9431esac
a092d240
NC
9432prefixvar=vendorbin
9433. ./installprefix
b4eb6b3d 9434
613d6c3e 9435: Set the vendorhtml1dir variables
6e1038e0 9436case "$vendorprefix" in
8d2cbf27
JH
9437'') vendorhtml1dir=''
9438 vendorhtml1direxp=''
6e1038e0
MB
9439 ;;
9440*) : determine where vendor-supplied html pages go.
9441 : There is no standard location, so try to copy the previously-selected
9442 : directory structure for the core html pages.
9443 : XXX Better default suggestions would be welcome.
8d2cbf27 9444 case "$vendorhtml1dir" in
6e1038e0 9445 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9446 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9447 esac
9448 case "$dflt" in
9449 ''|' ') dflt=none ;;
9450 esac
9451 fn=dn+~
9452 rp='Pathname for the vendor-supplied html pages?'
9453 . ./getfile
8d2cbf27
JH
9454 vendorhtml1dir="$ans"
9455 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9456 ;;
9457esac
9458: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9459$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9460prefixvar=vendorhtml1dir
9461. ./installprefix
6e1038e0 9462
613d6c3e 9463: Set the vendorhtml3dir variables
6e1038e0 9464case "$vendorprefix" in
8d2cbf27
JH
9465'') vendorhtml3dir=''
9466 vendorhtml3direxp=''
6e1038e0
MB
9467 ;;
9468*) : determine where vendor-supplied module html pages go.
9469 : There is no standard location, so try to copy the previously-selected
9470 : directory structure for the core html pages.
9471 : XXX Better default suggestions would be welcome.
8d2cbf27 9472 case "$vendorhtml3dir" in
6e1038e0 9473 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9474 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9475 esac
9476 case "$dflt" in
9477 ''|' ') dflt=none ;;
9478 esac
9479 fn=dn+~
9480 rp='Pathname for the vendor-supplied html pages?'
9481 . ./getfile
8d2cbf27
JH
9482 vendorhtml3dir="$ans"
9483 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9484 ;;
9485esac
9486: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9487$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9488prefixvar=vendorhtml3dir
9489. ./installprefix
6e1038e0 9490
613d6c3e 9491: Set the vendorman1dir variables
6e1038e0 9492case "$vendorprefix" in
91e123a8
JH
9493'') vendorman1dir=''
9494 vendorman1direxp=''
6e1038e0
MB
9495 ;;
9496*) : determine where vendor-supplied manual pages go.
91e123a8 9497 case "$vendorman1dir" in
6e1038e0 9498 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9499 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9500 esac
9501 case "$dflt" in
9502 ''|' ') dflt=none ;;
9503 esac
9504 fn=nd~+
9505 rp='Pathname for the vendor-supplied manual section 1 pages?'
9506 . ./getfile
91e123a8
JH
9507 vendorman1dir="$ans"
9508 vendorman1direxp="$ansexp"
6e1038e0
MB
9509 ;;
9510esac
9511: Use ' ' for none so value is preserved next time through Configure
91e123a8 9512$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9513prefixvar=vendorman1dir
9514. ./installprefix
6e1038e0 9515
613d6c3e 9516: Set the vendorman3dir variables
6e1038e0 9517case "$vendorprefix" in
91e123a8
JH
9518'') vendorman3dir=''
9519 vendorman3direxp=''
6e1038e0
MB
9520 ;;
9521*) : determine where vendor-supplied module manual pages go.
91e123a8 9522 case "$vendorman3dir" in
6e1038e0 9523 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9524 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9525 esac
9526 case "$dflt" in
9527 ''|' ') dflt=none ;;
9528 esac
9529 fn=nd~+
9530 rp='Pathname for the vendor-supplied manual section 3 pages?'
9531 . ./getfile
91e123a8
JH
9532 vendorman3dir="$ans"
9533 vendorman3direxp="$ansexp"
6e1038e0
MB
9534 ;;
9535esac
9536: Use ' ' for none so value is preserved next time through Configure
91e123a8 9537$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9538prefixvar=vendorman3dir
9539. ./installprefix
6e1038e0 9540
613d6c3e 9541: Set the vendorscript variables
6e1038e0
MB
9542case "$vendorprefix" in
9543'') d_vendorscript="$undef"
9544 vendorscript=''
9545 vendorscriptexp=''
9546 ;;
9547*) d_vendorscript="$define"
9548 : determine where vendor-supplied scripts go.
9549 case "$vendorscript" in
9550 '') dflt=$vendorprefix/script
9551 $test -d $dflt || dflt=$vendorbin ;;
9552 *) dflt="$vendorscript" ;;
9553 esac
9554 $cat <<EOM
9555
f3f1a2d8 9556The installation process will create a directory for
6e1038e0
MB
9557vendor-supplied scripts.
9558
9559EOM
9560 fn=d~+
9561 rp='Pathname for the vendor-supplied scripts directory?'
9562 . ./getfile
9563 vendorscript="$ans"
9564 vendorscriptexp="$ansexp"
9565 ;;
9566esac
a092d240
NC
9567prefixvar=vendorscript
9568. ./installprefix
6e1038e0 9569
f47f1645
TC
9570: script used to emit important warnings
9571cat >warn <<EOS
9572$startsh
9573if test \$# -gt 0; then
9574 echo "\$@" >msg
9575else
9576 cat >msg
9577fi
9578echo "*** WARNING:" >&4
9579sed -e 's/^/*** /' <msg >&4
9580echo "*** " >&4
9581cat msg >>config.msg
9582echo " " >>config.msg
9583rm -f msg
9584EOS
9585chmod +x warn
9586$eunicefix warn
9587
9588: see which of string.h or strings.h is needed
9589echo " "
9590strings=`./findhdr string.h`
9591if $test "$strings" && $test -r "$strings"; then
9592 echo "Using <string.h> instead of <strings.h>." >&4
9593 val="$define"
9594else
9595 val="$undef"
9596 strings=`./findhdr strings.h`
9597 if $test "$strings" && $test -r "$strings"; then
9598 echo "Using <strings.h> instead of <string.h>." >&4
9599 else
9600 ./warn "No string header found -- You'll surely have problems."
9601 fi
9602fi
9603set i_string
9604eval $setvar
9605case "$i_string" in
9606"$undef") strings=`./findhdr strings.h`;;
9607*) strings=`./findhdr string.h`;;
9608esac
9609
b4eb6b3d
JH
9610: see if qgcvt exists
9611set qgcvt d_qgcvt
9612eval $inlibc
9613
613d6c3e 9614: Check print/scan long double stuff
89ce900e
JH
9615echo " "
9616
9617if $test X"$d_longdbl" = X"$define"; then
9618
9619echo "Checking how to print long doubles..." >&4
9620
9621if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9622 $cat >try.c <<'EOCP'
9623#include <sys/types.h>
9624#include <stdio.h>
9625int main() {
9626 double d = 123.456;
9627 printf("%.3f\n", d);
9628}
9629EOCP
9630 set try
9631 if eval $compile; then
9632 yyy=`$run ./try`
9633 case "$yyy" in
9634 123.456)
9635 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9636 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9637 echo "We will use %f."
9638 ;;
9639 esac
9640 fi
9641fi
9642
9643if $test X"$sPRIfldbl" = X; then
9644 $cat >try.c <<'EOCP'
9645#include <sys/types.h>
9646#include <stdio.h>
9647int main() {
9648 long double d = 123.456;
9649 printf("%.3Lf\n", d);
9650}
9651EOCP
9652 set try
9653 if eval $compile; then
9654 yyy=`$run ./try`
9655 case "$yyy" in
9656 123.456)
9657 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9658 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9659 echo "We will use %Lf."
9660 ;;
9661 esac
9662 fi
9663fi
9664
9665if $test X"$sPRIfldbl" = X; then
9666 $cat >try.c <<'EOCP'
9667#include <sys/types.h>
9668#include <stdio.h>
9669int main() {
9670 long double d = 123.456;
9671 printf("%.3llf\n", d);
9672}
9673EOCP
9674 set try
9675 if eval $compile; then
9676 yyy=`$run ./try`
9677 case "$yyy" in
9678 123.456)
9679 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9680 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9681 echo "We will use %llf."
9682 ;;
9683 esac
9684 fi
9685fi
9686
9687if $test X"$sPRIfldbl" = X; then
9688 $cat >try.c <<'EOCP'
9689#include <sys/types.h>
9690#include <stdio.h>
9691int main() {
9692 long double d = 123.456;
9693 printf("%.3lf\n", d);
9694}
9695EOCP
9696 set try
9697 if eval $compile; then
9698 yyy=`$run ./try`
9699 case "$yyy" in
9700 123.456)
9701 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9702 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9703 echo "We will use %lf."
9704 ;;
9705 esac
9706 fi
9707fi
9708
9709if $test X"$sPRIfldbl" = X; then
9710 echo "Cannot figure out how to print long doubles." >&4
9711else
9712 sSCNfldbl=$sPRIfldbl # expect consistency
9713fi
9714
5b813a60 9715$rm_try
89ce900e
JH
9716
9717fi # d_longdbl
9718
9719case "$sPRIfldbl" in
5b813a60
MB
9720'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9721 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9722 d_SCNfldbl="$undef";
9723 ;;
5b813a60
MB
9724*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9725 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9726 d_SCNfldbl="$define";
9727 ;;
9728esac
9729
b4eb6b3d 9730: Check how to convert floats to strings.
a5b10d80
YST
9731
9732if test "X$d_Gconvert" = X; then
9733
b4eb6b3d
JH
9734echo " "
9735echo "Checking for an efficient way to convert floats to strings."
9736echo " " > try.c
9737case "$uselongdouble" in
9738"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9739esac
9740case "$d_longdbl" in
9741"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9742esac
9743case "$d_PRIgldbl" in
9744"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9745esac
9746$cat >>try.c <<EOP
9747#ifdef TRY_gconvert
9748#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9749char *myname = "gconvert";
9750#endif
9751#ifdef TRY_gcvt
9752#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9753char *myname = "gcvt";
9754#endif
9755#ifdef TRY_qgcvt
9756#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9757char *myname = "qgcvt";
9758#define DOUBLETYPE long double
9759#endif
9760#ifdef TRY_sprintf
a5b10d80
YST
9761#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9762#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9763#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9764#else
a5b10d80
YST
9765#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9766#endif
9767#else
b4eb6b3d
JH
9768#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9769#endif
9770char *myname = "sprintf";
9771#endif
9772
9773#ifndef DOUBLETYPE
9774#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9775#define DOUBLETYPE long double
9776#else
9777#define DOUBLETYPE double
9778#endif
9779#endif
9780
9781#include <stdio.h>
9782
f47f1645 9783#$i_stdlib I_STDLIB
b4eb6b3d
JH
9784#ifdef I_STDLIB
9785#include <stdlib.h>
9786#endif
f47f1645
TC
9787#$i_string I_STRING
9788#ifdef I_STRING
9789# include <string.h>
9790#else
9791# include <strings.h>
9792#endif
b4eb6b3d 9793
f47f1645 9794int checkit(char *expect, char *got)
b4eb6b3d
JH
9795{
9796 if (strcmp(expect, got)) {
9797 printf("%s oddity: Expected %s, got %s\n",
9798 myname, expect, got);
9799 exit(1);
9800 }
9801}
9802
9803int main()
5b813a60
MB
9804{
9805 char buf[64];
b4eb6b3d
JH
9806 buf[63] = '\0';
9807
9808 /* This must be 1st test on (which?) platform */
9809 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9810 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9811 checkit("0.1", buf);
9812
5b813a60 9813 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9814 checkit("0.01", buf);
9815
5b813a60 9816 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9817 checkit("0.001", buf);
9818
5b813a60 9819 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9820 checkit("0.0001", buf);
9821
9822 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9823 if (strlen(buf) > 5)
9824 checkit("9e-005", buf); /* for Microsoft ?? */
9825 else
9826 checkit("9e-05", buf);
9827
5b813a60 9828 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9829 checkit("1", buf);
9830
5b813a60 9831 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9832 checkit("1.1", buf);
9833
5b813a60 9834 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9835 checkit("1.01", buf);
9836
5b813a60 9837 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9838 checkit("1.001", buf);
9839
5b813a60 9840 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9841 checkit("1.0001", buf);
9842
5b813a60 9843 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9844 checkit("1.00001", buf);
9845
5b813a60 9846 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9847 checkit("1.000001", buf);
9848
5b813a60 9849 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9850 checkit("0", buf);
9851
5b813a60 9852 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9853 checkit("-1", buf);
9854
9855 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9856 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9857 checkit("100000", buf);
5b813a60 9858
b4eb6b3d 9859 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9860 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9861 checkit("-100000", buf);
9862
5b813a60 9863 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9864 checkit("123.456", buf);
9865
ab6ca9f4 9866 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9867 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9868 /* 34 should be enough to scare even long double
9869 * places into using the e notation. */
ab6ca9f4 9870 if (strlen(buf) > 5)
94b339ad 9871 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9872 else
94b339ad 9873 checkit("1e+34", buf);
8e2a5ede 9874
d1eb8299
YST
9875 /* For Perl, if you add additional tests here, also add them to
9876 * t/base/num.t for benefit of platforms not using Configure or
9877 * overriding d_Gconvert */
9878
b4eb6b3d
JH
9879 exit(0);
9880}
9881EOP
ab6ca9f4 9882: first add preferred functions to our list
a5b10d80 9883xxx_list=""
ab6ca9f4 9884for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9885 case $xxx_convert in
9886 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9887 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9888 esac
a5b10d80
YST
9889done
9890: then add any others
9891for xxx_convert in gconvert gcvt sprintf; do
9892 case "$xxx_list" in
9893 *$xxx_convert*) ;;
9894 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9895 esac
a5b10d80
YST
9896done
9897
9898case "$d_longdbl$uselongdouble" in
9899"$define$define")
cd95ead5 9900 : again, add preferred functions to our list first
a5b10d80 9901 xxx_ld_list=""
ab6ca9f4 9902 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9903 case $xxx_convert in
9904 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9905 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9906 esac
9907 done
9908 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9909 for xxx_convert in qgcvt sprintf $xxx_list; do
9910 case "$xxx_ld_list" in
9911 $xxx_convert*|*" $xxx_convert"*) ;;
9912 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9913 esac
9914 done
9915 : if sprintf cannot do long doubles, move it to the end
9916 if test "$d_PRIgldbl" != "$define"; then
9917 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9918 fi
9919 : if no qgcvt, remove it
9920 if test "$d_qgcvt" != "$define"; then
9921 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9922 fi
9923 : use the ld_list
9924 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9925 ;;
9926esac
9927
9928for xxx_convert in $xxx_list; do
9929 echo "Trying $xxx_convert..."
93451a0d 9930 $rm -f try try$_o core
b4eb6b3d
JH
9931 set try -DTRY_$xxx_convert
9932 if eval $compile; then
9933 echo "$xxx_convert() found." >&4
5440bc8e 9934 if $run ./try; then
b4eb6b3d
JH
9935 echo "I'll use $xxx_convert to convert floats into a string." >&4
9936 break;
9937 else
9938 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9939 xxx_convert=''
b4eb6b3d
JH
9940 fi
9941 else
9942 echo "$xxx_convert NOT found." >&4
9943 fi
9944done
ab6ca9f4 9945
a5b10d80
YST
9946if test X$xxx_convert = X; then
9947 echo "*** WHOA THERE!!! ***" >&4
9948 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9949 xxx_convert=sprintf
9950fi
9951
b4eb6b3d
JH
9952case "$xxx_convert" in
9953gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9954gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9955qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9956*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9957 "$define$define$define")
9958 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9959 "$define$define$undef")
9960 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9961 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9962 esac
5b813a60 9963 ;;
b4eb6b3d
JH
9964esac
9965
a5b10d80 9966fi
93451a0d 9967$rm_try
a5b10d80 9968
74cac757
JH
9969: see if _fwalk exists
9970set fwalk d__fwalk
9971eval $inlibc
9972
b4eb6b3d
JH
9973: Initialize h_fcntl
9974h_fcntl=false
9975
9976: Initialize h_sysfile
9977h_sysfile=false
9978
9979: access call always available on UNIX
9980set access d_access
9981eval $inlibc
9982
9983: locate the flags for 'access()'
9984case "$d_access" in
9985"$define")
9986 echo " "
55954f19 9987 $cat >access.c <<EOCP
b4eb6b3d
JH
9988#include <sys/types.h>
9989#ifdef I_FCNTL
9990#include <fcntl.h>
9991#endif
9992#ifdef I_SYS_FILE
9993#include <sys/file.h>
9994#endif
9995#ifdef I_UNISTD
9996#include <unistd.h>
9997#endif
55954f19
JH
9998#$i_stdlib I_STDLIB
9999#ifdef I_STDLIB
10000#include <stdlib.h>
10001#endif
b4eb6b3d
JH
10002int main() {
10003 exit(R_OK);
10004}
10005EOCP
10006 : check sys/file.h first, no particular reason here
10007 if $test `./findhdr sys/file.h` && \
7a282f6d 10008 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10009 h_sysfile=true;
10010 echo "<sys/file.h> defines the *_OK access constants." >&4
10011 elif $test `./findhdr fcntl.h` && \
7a282f6d 10012 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10013 h_fcntl=true;
10014 echo "<fcntl.h> defines the *_OK access constants." >&4
10015 elif $test `./findhdr unistd.h` && \
7a282f6d 10016 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10017 echo "<unistd.h> defines the *_OK access constants." >&4
10018 else
10019 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10020 fi
10021 ;;
10022esac
10023$rm -f access*
10024
10025: see if accessx exists
10026set accessx d_accessx
10027eval $inlibc
10028
89ce900e
JH
10029: see if aintl exists
10030set aintl d_aintl
10031eval $inlibc
10032
b4eb6b3d
JH
10033: see if alarm exists
10034set alarm d_alarm
10035eval $inlibc
10036
96938616
MB
10037: see if 64bit time functions exists
10038
10039set ctime64 d_ctime64
10040eval $inlibc
10041
10042set localtime64 d_localtime64
10043eval $inlibc
10044
10045set gmtime64 d_gmtime64
10046eval $inlibc
10047
10048set mktime64 d_mktime64
10049eval $inlibc
10050
10051set difftime64 d_difftime64
10052eval $inlibc
10053
10054set asctime64 d_asctime64
10055eval $inlibc
10056
a9dade78
JH
10057: see if POSIX threads are available
10058set pthread.h i_pthread
10059eval $inhdr
10060
cd95ead5 10061: define a function to check prototypes
10bc17b6
JH
10062$cat > protochk <<EOSH
10063$startsh
10064cc="$cc"
10065optimize="$optimize"
10066ccflags="$ccflags"
10067prototype="$prototype"
10068define="$define"
c944cfb9 10069rm_try="$rm_try"
a9dade78
JH
10070usethreads=$usethreads
10071i_pthread=$i_pthread
10072pthread_h_first=$pthread_h_first
10bc17b6
JH
10073EOSH
10074
10075$cat >> protochk <<'EOSH'
10076
5b813a60 10077$rm_try
10bc17b6
JH
10078foo="$1"
10079shift
10080while test $# -ge 2; do
10081 case "$1" in
10082 $define) echo "#include <$2>" >> try.c ;;
10083 literal) echo "$2" >> try.c ;;
10084 esac
cce6a207
MB
10085 # Extra magic for the benefit of systems that need pthread.h
10086 # to be included early to correctly detect threadsafe functions.
10087 # Such functions must guarantee themselves, though, that the usethreads
10088 # and i_pthread have been defined, before calling protochk.
10089 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10090 echo "#include <pthread.h>" >> try.c
10091 pthread_h_done=yes
10092 fi
10bc17b6
JH
10093 shift 2
10094done
10095test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10096cat >> try.c <<'EOCP'
10097#ifdef CAN_PROTOTYPE
10098#define _(args) args
10099#else
10100#define _(args) ()
10101#endif
10102EOCP
10103echo "$foo" >> try.c
10104echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10105$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10106status=$?
5b813a60 10107$rm_try
10bc17b6
JH
10108exit $status
10109EOSH
10110chmod +x protochk
10111$eunicefix protochk
10112
34f1896b 10113: Define hasproto macro for Configure internal use
89ce900e
JH
10114hasproto='varname=$1; func=$2; shift; shift;
10115while $test $# -ge 2; do
10116 case "$1" in
10117 $define) echo "#include <$2>";;
10118 esac ;
10119 shift 2;
10120done > try.c;
10121$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10122if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10123 echo "$func() prototype found.";
10124 val="$define";
10125else
10126 echo "$func() prototype NOT found.";
10127 val="$undef";
10128fi;
10129set $varname;
10130eval $setvar;
5b813a60 10131$rm_try tryout.c'
89ce900e 10132
10bc17b6
JH
10133: see if sys/types.h has to be included
10134set sys/types.h i_systypes
10135eval $inhdr
10136
10137: see if sys/select.h has to be included
10138set sys/select.h i_sysselct
10139eval $inhdr
10140
34f1896b 10141: Define hasfield macro for Configure internal use
10bc17b6
JH
10142hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10143while $test $# -ge 2; do
10144 case "$1" in
10145 $define) echo "#include <$2>";;
10146 esac ;
10147 shift 2;
10148done > try.c;
10149echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10150set try;
10151if eval $compile; then
10152 val="$define";
10153else
10154 val="$undef";
10155fi;
10156set $varname;
10157eval $setvar;
5b813a60 10158$rm_try'
10bc17b6
JH
10159
10160: see if we should include time.h, sys/time.h, or both
10161echo " "
10162if test "X$timeincl" = X; then
10163 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10164 $echo $n "I'm now running the test program...$c"
55954f19 10165 $cat >try.c <<EOCP
10bc17b6
JH
10166#include <sys/types.h>
10167#ifdef I_TIME
10168#include <time.h>
10169#endif
10170#ifdef I_SYSTIME
10171#ifdef SYSTIMEKERNEL
10172#define KERNEL
10173#endif
10174#include <sys/time.h>
10175#endif
10176#ifdef I_SYSSELECT
10177#include <sys/select.h>
10178#endif
55954f19
JH
10179#$i_stdlib I_STDLIB
10180#ifdef I_STDLIB
10181#include <stdlib.h>
10182#endif
10bc17b6
JH
10183int main()
10184{
10185 struct tm foo;
10186#ifdef S_TIMEVAL
10187 struct timeval bar;
10188#endif
10189#ifdef S_TIMEZONE
10190 struct timezone tzp;
10191#endif
10192 if (foo.tm_sec == foo.tm_sec)
10193 exit(0);
10194#ifdef S_TIMEVAL
10195 if (bar.tv_sec == bar.tv_sec)
10196 exit(0);
10197#endif
10198 exit(1);
10199}
10200EOCP
10201 flags=''
10202 for s_timezone in '-DS_TIMEZONE' ''; do
10203 sysselect=''
10204 for s_timeval in '-DS_TIMEVAL' ''; do
10205 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10206 for i_time in '' '-DI_TIME'; do
10207 for i_systime in '-DI_SYSTIME' ''; do
10208 case "$flags" in
10209 '') $echo $n ".$c"
10210 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10211 if eval $compile; then
10212 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10213 shift
10214 flags="$*"
10215 echo " "
10216 $echo $n "Succeeded with $flags$c"
10217 fi
10218 ;;
10219 esac
10220 done
10221 done
10222 done
10223 done
10224 done
10225 timeincl=''
10226 echo " "
10227 case "$flags" in
10228 *SYSTIMEKERNEL*) i_systimek="$define"
10229 timeincl=`./findhdr sys/time.h`
10230 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10231 *) i_systimek="$undef";;
10232 esac
10233 case "$flags" in
10234 *I_TIME*) i_time="$define"
10235 timeincl=`./findhdr time.h`" $timeincl"
10236 echo "We'll include <time.h>." >&4;;
10237 *) i_time="$undef";;
10238 esac
10239 case "$flags" in
10240 *I_SYSTIME*) i_systime="$define"
10241 timeincl=`./findhdr sys/time.h`" $timeincl"
10242 echo "We'll include <sys/time.h>." >&4;;
10243 *) i_systime="$undef";;
10244 esac
5b813a60 10245 $rm_try
10bc17b6
JH
10246fi
10247: see if struct tm knows about tm_zone
10248case "$i_systime$i_time" in
5b813a60 10249*$define*)
10bc17b6
JH
10250 echo " "
10251 echo "Checking to see if your struct tm has tm_zone field..." >&4
10252 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10253 eval $hasfield
10254 ;;
10255*) val="$undef"
10256 set d_tm_tm_zone
10257 eval $setvar
10258 ;;
10259esac
10260case "$d_tm_tm_zone" in
10261"$define") echo "Yes, it does." ;;
10262*) echo "No, it doesn't." ;;
10263esac
10264: see if struct tm knows about tm_gmtoff
10265case "$i_systime$i_time" in
5b813a60 10266*$define*)
10bc17b6
JH
10267 echo " "
10268 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10269 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10270 eval $hasfield
10271 ;;
10272*) val="$undef"
10273 set d_tm_tm_gmtoff
10274 eval $setvar
10275 ;;
10276esac
10277case "$d_tm_tm_gmtoff" in
10278"$define") echo "Yes, it does." ;;
10279*) echo "No, it doesn't." ;;
10280esac
10281
10282: see if asctime_r exists
10283set asctime_r d_asctime_r
10284eval $inlibc
10285case "$d_asctime_r" in
10286"$define")
d63eadf0 10287 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10288 case "$d_asctime_r_proto:$usethreads" in
10289 ":define") d_asctime_r_proto=define
a48ec845
JH
10290 set d_asctime_r_proto asctime_r $hdrs
10291 eval $hasproto ;;
10292 *) ;;
10293 esac
10294 case "$d_asctime_r_proto" in
10295 define)
10bc17b6
JH
10296 case "$asctime_r_proto" in
10297 ''|0) try='char* asctime_r(const struct tm*, char*);'
61c26d18 10298 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10bc17b6
JH
10299 esac
10300 case "$asctime_r_proto" in
10301 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
61c26d18 10302 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10bc17b6
JH
10303 esac
10304 case "$asctime_r_proto" in
10305 ''|0) try='int asctime_r(const struct tm*, char*);'
61c26d18 10306 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10bc17b6
JH
10307 esac
10308 case "$asctime_r_proto" in
10309 ''|0) try='int asctime_r(const struct tm*, char*, int);'
61c26d18 10310 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10bc17b6
JH
10311 esac
10312 case "$asctime_r_proto" in
90e831dc 10313 ''|0) d_asctime_r=undef
10bc17b6 10314 asctime_r_proto=0
a48ec845 10315 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10316 * ) case "$asctime_r_proto" in
10317 REENTRANT_PROTO*) ;;
10318 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10319 esac
10320 echo "Prototype: $try" ;;
10321 esac
10322 ;;
c18e646a
JH
10323 *) case "$usethreads" in
10324 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10325 esac
90e831dc
SB
10326 d_asctime_r=undef
10327 asctime_r_proto=0
c18e646a 10328 ;;
a48ec845
JH
10329 esac
10330 ;;
10bc17b6
JH
10331*) asctime_r_proto=0
10332 ;;
10333esac
10334
b4eb6b3d
JH
10335: see if atolf exists
10336set atolf d_atolf
10337eval $inlibc
10338
10339: see if atoll exists
10340set atoll d_atoll
10341eval $inlibc
10342
0dbb1585
AL
10343: Look for GCC-style attribute format
10344case "$d_attribute_format" in
bde30f85 10345'')
b4eb6b3d 10346echo " "
0dbb1585 10347echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10348$cat >attrib.c <<'EOCP'
10349#include <stdio.h>
0dbb1585 10350void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10351EOCP
10352if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10353 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10354 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10355 val="$undef"
10356 else
0dbb1585 10357 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10358 val="$define"
10359 fi
10360else
10361 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10362 val="$undef"
10363fi
bde30f85 10364;;
0dbb1585 10365*) val="$d_attribute_format" ;;
bde30f85 10366esac
0dbb1585
AL
10367set d_attribute_format
10368eval $setvar
10369$rm -f attrib*
10370
dcb594bc
MB
10371: Look for GCC-style attribute format with null format allowed
10372case "$d_printf_format_null" in
10373'') case "$d_attribute_format" in
10374 $define)
10375 echo " "
10376 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10377$cat >attrib.c <<EOCP
10378#include <stdio.h>
10379#$i_stdlib I_STDLIB
10380#ifdef I_STDLIB
10381#include <stdlib.h>
10382#endif
10383int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10384int null_printf (char* pat,...) { return (int)pat; }
10385int main () { exit(null_printf(NULL)); }
10386EOCP
10387 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10388 : run the executable in case it produces a run-time warning
10389 if $run ./attrib >>attrib.out 2>&1; then
10390 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10391 echo "Your C compiler doesn't allow __printf__ format to be null."
10392 val="$undef"
10393 else
10394 echo "Your C compiler allows __printf__ format to be null."
10395 val="$define"
10396 fi
10397 else
10398 echo "Your C compiler executable failed with __printf__ format null."
10399 val="$undef"
10400 fi
10401 else
10402 echo "Your C compiler fails with __printf__ format null."
10403 val="$undef"
10404 fi
10405 ;;
10406 *) val="$undef" ;;
10407 esac
10408;;
10409*) val="$d_printf_format_null" ;;
10410esac
10411set d_printf_format_null
10412eval $setvar
10413$rm -f attrib*
10414
0dbb1585
AL
10415: Look for GCC-style attribute malloc
10416case "$d_attribute_malloc" in
10417'')
10418echo " "
10419echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10420$cat >attrib.c <<'EOCP'
10421#include <stdio.h>
10422char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10423EOCP
10424if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10425 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10426 echo "Your C compiler doesn't support __attribute__((malloc))."
10427 val="$undef"
10428 else
10429 echo "Your C compiler supports __attribute__((malloc))."
10430 val="$define"
10431 fi
10432else
10433 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10434 val="$undef"
10435fi
10436;;
10437*) val="$d_attribute_malloc" ;;
10438esac
10439set d_attribute_malloc
10440eval $setvar
10441$rm -f attrib*
10442
10443: Look for GCC-style attribute nonnull
10444case "$d_attribute_nonnull" in
10445'')
10446echo " "
10447echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10448$cat >attrib.c <<'EOCP'
10449#include <stdio.h>
10450void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10451EOCP
10452if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10453 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10454 echo "Your C compiler doesn't support __attribute__((nonnull))."
10455 val="$undef"
10456 else
10457 echo "Your C compiler supports __attribute__((nonnull))."
10458 val="$define"
10459 fi
10460else
10461 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10462 val="$undef"
10463fi
10464;;
10465*) val="$d_attribute_nonnull" ;;
10466esac
10467set d_attribute_nonnull
10468eval $setvar
10469$rm -f attrib*
10470
10471: Look for GCC-style attribute noreturn
10472case "$d_attribute_noreturn" in
10473'')
10474echo " "
10475echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10476$cat >attrib.c <<'EOCP'
10477#include <stdio.h>
10478void fall_over_dead( void ) __attribute__((noreturn));
10479EOCP
10480if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10481 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10482 echo "Your C compiler doesn't support __attribute__((noreturn))."
10483 val="$undef"
10484 else
10485 echo "Your C compiler supports __attribute__((noreturn))."
10486 val="$define"
10487 fi
10488else
10489 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10490 val="$undef"
10491fi
10492;;
10493*) val="$d_attribute_noreturn" ;;
10494esac
10495set d_attribute_noreturn
10496eval $setvar
10497$rm -f attrib*
10498
10499: Look for GCC-style attribute pure
10500case "$d_attribute_pure" in
10501'')
10502echo " "
10503echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10504$cat >attrib.c <<'EOCP'
10505#include <stdio.h>
10506int square( int n ) __attribute__((pure));
10507EOCP
10508if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10509 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10510 echo "Your C compiler doesn't support __attribute__((pure))."
10511 val="$undef"
10512 else
10513 echo "Your C compiler supports __attribute__((pure))."
10514 val="$define"
10515 fi
10516else
10517 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10518 val="$undef"
10519fi
10520;;
10521*) val="$d_attribute_pure" ;;
10522esac
10523set d_attribute_pure
10524eval $setvar
10525$rm -f attrib*
10526
10527: Look for GCC-style attribute unused
10528case "$d_attribute_unused" in
10529'')
10530echo " "
10531echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10532$cat >attrib.c <<'EOCP'
10533#include <stdio.h>
10534int do_something( int dummy __attribute__((unused)), int n );
10535EOCP
10536if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10537 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10538 echo "Your C compiler doesn't support __attribute__((unused))."
10539 val="$undef"
10540 else
10541 echo "Your C compiler supports __attribute__((unused))."
10542 val="$define"
10543 fi
10544else
10545 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10546 val="$undef"
10547fi
10548;;
10549*) val="$d_attribute_unused" ;;
10550esac
10551set d_attribute_unused
10552eval $setvar
10553$rm -f attrib*
10554
fcdf39cf
RGS
10555: Look for GCC-style attribute deprecated
10556case "$d_attribute_deprecated" in
10557'')
10558echo " "
10559echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10560$cat >attrib.c <<'EOCP'
10561#include <stdio.h>
10562int I_am_deprecated(void) __attribute__((deprecated));
10563EOCP
10564if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10565 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10566 echo "Your C compiler doesn't support __attribute__((deprecated))."
10567 val="$undef"
10568 else
10569 echo "Your C compiler supports __attribute__((deprecated))."
10570 val="$define"
10571 fi
10572else
10573 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10574 val="$undef"
10575fi
10576;;
10577*) val="$d_attribute_deprecated" ;;
10578esac
10579set d_attribute_deprecated
10580eval $setvar
10581$rm -f attrib*
10582
0dbb1585
AL
10583: Look for GCC-style attribute warn_unused_result
10584case "$d_attribute_warn_unused_result" in
10585'')
10586echo " "
10587echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10588$cat >attrib.c <<'EOCP'
10589#include <stdio.h>
10590int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10591EOCP
10592if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10593 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10594 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10595 val="$undef"
10596 else
10597 echo "Your C compiler supports __attribute__((warn_unused_result))."
10598 val="$define"
10599 fi
10600else
10601 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10602 val="$undef"
10603fi
10604;;
10605*) val="$d_attribute_warn_unused_result" ;;
10606esac
10607set d_attribute_warn_unused_result
b4eb6b3d
JH
10608eval $setvar
10609$rm -f attrib*
10610
10611: see if bcmp exists
10612set bcmp d_bcmp
10613eval $inlibc
10614
10615: see if bcopy exists
10616set bcopy d_bcopy
10617eval $inlibc
10618
b4eb6b3d
JH
10619: see if getpgrp exists
10620set getpgrp d_getpgrp
10621eval $inlibc
10622
10623case "$d_getpgrp" in
10624"$define")
10625 echo " "
10626 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10627 $cat >try.c <<EOP
b4eb6b3d
JH
10628#$i_unistd I_UNISTD
10629#include <sys/types.h>
10630#ifdef I_UNISTD
10631# include <unistd.h>
10632#endif
55954f19
JH
10633#$i_stdlib I_STDLIB
10634#ifdef I_STDLIB
10635#include <stdlib.h>
10636#endif
b4eb6b3d
JH
10637int main()
10638{
10639 if (getuid() == 0) {
10640 printf("(I see you are running Configure as super-user...)\n");
10641 setuid(1);
10642 }
10643#ifdef TRY_BSD_PGRP
10644 if (getpgrp(1) == 0)
10645 exit(0);
10646#else
10647 if (getpgrp() > 0)
10648 exit(0);
10649#endif
10650 exit(1);
10651}
10652EOP
5440bc8e 10653 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10654 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10655 val="$define"
5440bc8e 10656 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10657 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10658 val="$undef"
10659 else
10660 echo "I can't seem to compile and run the test program."
10661 if ./usg; then
10662 xxx="a USG one, i.e. you use getpgrp()."
10663 else
10664 # SVR4 systems can appear rather BSD-ish.
10665 case "$i_unistd" in
10666 $undef)
10667 xxx="a BSD one, i.e. you use getpgrp(pid)."
10668 val="$define"
10669 ;;
10670 $define)
10671 xxx="probably a USG one, i.e. you use getpgrp()."
10672 val="$undef"
10673 ;;
10674 esac
10675 fi
10676 echo "Assuming your getpgrp is $xxx" >&4
10677 fi
10678 ;;
10679*) val="$undef";;
10680esac
10681set d_bsdgetpgrp
10682eval $setvar
5b813a60 10683$rm_try
b4eb6b3d
JH
10684
10685: see if setpgrp exists
10686set setpgrp d_setpgrp
10687eval $inlibc
10688
10689case "$d_setpgrp" in
10690"$define")
10691 echo " "
10692 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10693 $cat >try.c <<EOP
b4eb6b3d
JH
10694#$i_unistd I_UNISTD
10695#include <sys/types.h>
10696#ifdef I_UNISTD
10697# include <unistd.h>
10698#endif
55954f19
JH
10699#$i_stdlib I_STDLIB
10700#ifdef I_STDLIB
10701#include <stdlib.h>
10702#endif
b4eb6b3d
JH
10703int main()
10704{
10705 if (getuid() == 0) {
10706 printf("(I see you are running Configure as super-user...)\n");
10707 setuid(1);
10708 }
10709#ifdef TRY_BSD_PGRP
10710 if (-1 == setpgrp(1, 1))
10711 exit(0);
10712#else
10713 if (setpgrp() != -1)
10714 exit(0);
10715#endif
10716 exit(1);
10717}
10718EOP
5440bc8e 10719 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10720 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10721 val="$define"
5440bc8e 10722 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10723 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10724 val="$undef"
10725 else
10726 echo "(I can't seem to compile and run the test program.)"
10727 if ./usg; then
10728 xxx="a USG one, i.e. you use setpgrp()."
10729 else
10730 # SVR4 systems can appear rather BSD-ish.
10731 case "$i_unistd" in
10732 $undef)
10733 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10734 val="$define"
10735 ;;
10736 $define)
10737 xxx="probably a USG one, i.e. you use setpgrp()."
10738 val="$undef"
10739 ;;
10740 esac
10741 fi
10742 echo "Assuming your setpgrp is $xxx" >&4
10743 fi
10744 ;;
10745*) val="$undef";;
10746esac
10747set d_bsdsetpgrp
10748eval $setvar
5b813a60
MB
10749$rm_try
10750
635aebb7
AL
10751: Look for GCC-style __builtin_choose_expr
10752case "$d_builtin_choose_expr" in
10753'')
10754 echo " "
10755 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10756 $cat >try.c <<'EOCP'
10757#include <assert.h>
10758#include <stdlib.h>
10759#include <stdio.h>
10760
10761#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10762
10763int main(void) {
10764 assert( SYRINX(1) == 2112 );
10765 assert( SYRINX(1) != 5150 );
10766 assert( SYRINX(0) == 5150 );
10767 assert( SYRINX(0) != 2112 );
10768 puts( "All good!" );
10769 exit(0);
10770}
10771
10772EOCP
10773 set try
70ceb34a 10774 if eval $compile && $run ./try; then
635aebb7
AL
10775 echo "Your C compiler supports __builtin_choose_expr."
10776 val="$define"
10777 else
10778 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10779 val="$undef"
10780 fi
10781;;
10782*) val="$d_builtin_choose_expr" ;;
10783esac
10784
10785set d_builtin_choose_expr
10786eval $setvar
5b813a60 10787$rm_try
635aebb7
AL
10788
10789: Look for GCC-style __builtin_expect
10790case "$d_builtin_expect" in
10791'')
10792 echo " "
10793 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
70ceb34a 10794 $cat >try.c <<'EOCP'
635aebb7
AL
10795int main(void) {
10796 int n = 50;
10797 if ( __builtin_expect(n, 0) ) n = 1;
70ceb34a
NC
10798 /* Remember shell exit code truth is 0, C truth is non-zero */
10799 return !(n == 1);
635aebb7
AL
10800}
10801EOCP
10802 set try
70ceb34a
NC
10803 if eval $compile && $run ./try; then
10804 echo "Your C compiler supports __builtin_expect."
635aebb7
AL
10805 val="$define"
10806 else
70ceb34a 10807 echo "Your C compiler doesn't seem to understand __builtin_expect."
635aebb7
AL
10808 val="$undef"
10809 fi
10810 ;;
10811*) val="$d_builtin_expect" ;;
10812esac
10813
10814set d_builtin_expect
10815eval $setvar
5b813a60 10816$rm_try
635aebb7 10817
b4eb6b3d
JH
10818: see if bzero exists
10819set bzero d_bzero
10820eval $inlibc
10821
a2d23ec2
MB
10822: see if stdarg is available
10823echo " "
10824if $test `./findhdr stdarg.h`; then
10825 echo "<stdarg.h> found." >&4
10826 valstd="$define"
10827else
10828 echo "<stdarg.h> NOT found." >&4
10829 valstd="$undef"
10830fi
10831
10832: see if varags is available
10833echo " "
10834if $test `./findhdr varargs.h`; then
10835 echo "<varargs.h> found." >&4
10836else
10837 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10838fi
10839
10840: set up the varargs testing programs
10841$cat > varargs.c <<EOP
10842#ifdef I_STDARG
10843#include <stdarg.h>
10844#endif
10845#ifdef I_VARARGS
10846#include <varargs.h>
10847#endif
10848
10849#ifdef I_STDARG
10850int f(char *p, ...)
10851#else
10852int f(va_alist)
10853va_dcl
10854#endif
10855{
10856 va_list ap;
10857#ifndef I_STDARG
10858 char *p;
10859#endif
10860#ifdef I_STDARG
10861 va_start(ap,p);
10862#else
10863 va_start(ap);
10864 p = va_arg(ap, char *);
10865#endif
10866 va_end(ap);
4fb7dc7d 10867 return 0;
a2d23ec2
MB
10868}
10869EOP
10870$cat > varargs <<EOP
10871$startsh
10872if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10873 echo "true"
10874else
10875 echo "false"
10876fi
10877$rm -f varargs$_o
10878EOP
10879chmod +x varargs
10880
10881: now check which varargs header should be included
10882echo " "
10883i_varhdr=''
10884case "$valstd" in
10885"$define")
10886 if `./varargs I_STDARG`; then
10887 val='stdarg.h'
10888 elif `./varargs I_VARARGS`; then
10889 val='varargs.h'
10890 fi
10891 ;;
10892*)
10893 if `./varargs I_VARARGS`; then
10894 val='varargs.h'
10895 fi
10896 ;;
10897esac
10898case "$val" in
10899'')
10900echo "I could not find the definition for va_dcl... You have problems..." >&4
10901 val="$undef"; set i_stdarg; eval $setvar
10902 val="$undef"; set i_varargs; eval $setvar
10903 ;;
613d6c3e 10904*)
a2d23ec2
MB
10905 set i_varhdr
10906 eval $setvar
10907 case "$i_varhdr" in
10908 stdarg.h)
10909 val="$define"; set i_stdarg; eval $setvar
10910 val="$undef"; set i_varargs; eval $setvar
10911 ;;
10912 varargs.h)
10913 val="$undef"; set i_stdarg; eval $setvar
10914 val="$define"; set i_varargs; eval $setvar
10915 ;;
10916 esac
10917 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10918esac
10919$rm -f varargs*
10920
10921: see if the Compiler supports C99 variadic macros
10922case "$i_stdarg$i_stdlib" in
10923 "$define$define")
10924 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10925 $cat >try.c <<EOCP
10926#include <stdio.h>
10927#include <stdarg.h>
10928
10929#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10930
10931int main() {
10932 char buf[20];
10933 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10934 puts(buf);
10935 return 0;
10936}
10937EOCP
10938 set try
10939 if eval $compile && $run ./try 2>&1 >/dev/null; then
10940 case "`$run ./try`" in
10941 "123 456 789")
10942 echo "You have C99 variadic macros." >&4
10943 d_c99_variadic_macros="$define"
10944 ;;
10945 *)
10946 echo "You don't have functional C99 variadic macros." >&4
10947 d_c99_variadic_macros="$undef"
10948 ;;
10949 esac
10950 else
10951 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10952 d_c99_variadic_macros="$undef"
10953 fi
5b813a60 10954 $rm_try
a2d23ec2
MB
10955 ;;
10956 *)
10957 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10958 d_c99_variadic_macros="$undef"
10959 ;;
10960esac
10961
b4eb6b3d
JH
10962: see if signal is declared as pointer to function returning int or void
10963echo " "
10964xxx=`./findhdr signal.h`
10965$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10966if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10967 echo "You have int (*signal())() instead of void." >&4
10968 val="$undef"
10969elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10970 echo "You have void (*signal())()." >&4
10971 val="$define"
10972elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10973 echo "You have int (*signal())() instead of void." >&4
10974 val="$undef"
10975elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10976 echo "You have void (*signal())()." >&4
10977 val="$define"
10978else
10979 case "$d_voidsig" in
10980 '')
10981 echo "I can't determine whether signal handler returns void or int..." >&4
10982 dflt=void
10983 rp="What type does your signal handler return?"
10984 . ./myread
10985 case "$ans" in
10986 v*) val="$define";;
10987 *) val="$undef";;
10988 esac;;
10989 "$define")
10990 echo "As you already told me, signal handler returns void." >&4
10991 val="$define"
10992 ;;
10993 *) echo "As you already told me, signal handler returns int." >&4
10994 val="$undef"
10995 ;;
10996 esac
10997fi
10998set d_voidsig
10999eval $setvar
11000case "$d_voidsig" in
11001"$define") signal_t="void";;
11002*) signal_t="int";;
11003esac
11004$rm -f $$.tmp
11005
11006: check for ability to cast large floats to 32-bit ints.
11007echo " "
11008echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11009if $test "$intsize" -ge 4; then
11010 xxx=int
11011else
11012 xxx=long
11013fi
11014$cat >try.c <<EOCP
11015#include <stdio.h>
d1daaddf
JH
11016#$i_stdlib I_STDLIB
11017#ifdef I_STDLIB
11018#include <stdlib.h>
11019#endif
b4eb6b3d
JH
11020#include <sys/types.h>
11021#include <signal.h>
7090f861 11022$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
11023int main()
11024{
11025 $xxx i32;
11026 double f, g;
11027 int result = 0;
11028 char str[16];
11029 signal(SIGFPE, blech);
11030
5b813a60 11031 /* Don't let compiler optimize the test away. Store the number
e237eb00 11032 in a writable string for gcc to pass to sscanf under HP-UX.
b4eb6b3d
JH
11033 */
11034 sprintf(str, "2147483647");
11035 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11036 g = 10 * f;
11037 i32 = ($xxx) g;
11038
11039 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 11040 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
11041 behavior here, which is to preserve the sign and give
11042 back 0x7fff ffff.
11043 */
11044 if (i32 != ($xxx) f)
11045 result |= 1;
11046 exit(result);
11047}
11048EOCP
11049set try
11050if eval $compile_ok; then
5440bc8e 11051 $run ./try
b4eb6b3d
JH
11052 yyy=$?
11053else
11054 echo "(I can't seem to compile the test program--assuming it can't)"
11055 yyy=1
11056fi
11057case "$yyy" in
110580) val="$define"
11059 echo "Yup, it can."
11060 ;;
11061*) val="$undef"
11062 echo "Nope, it can't."
11063 ;;
11064esac
11065set d_casti32
11066eval $setvar
5b813a60 11067$rm_try
b4eb6b3d
JH
11068
11069: check for ability to cast negative floats to unsigned
11070echo " "
11071echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11072$cat >try.c <<EOCP
11073#include <stdio.h>
d1daaddf
JH
11074#$i_stdlib I_STDLIB
11075#ifdef I_STDLIB
11076#include <stdlib.h>
11077#endif
b4eb6b3d
JH
11078#include <sys/types.h>
11079#include <signal.h>
7090f861
JH
11080$signal_t blech(int s) { exit(7); }
11081$signal_t blech_in_list(int s) { exit(4); }
11082unsigned long dummy_long(unsigned long p) { return p; }
11083unsigned int dummy_int(unsigned int p) { return p; }
11084unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
11085int main()
11086{
11087 double f;
11088 unsigned long along;
11089 unsigned int aint;
11090 unsigned short ashort;
11091 int result = 0;
11092 char str[16];
5b813a60 11093
b4eb6b3d
JH
11094 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11095 a direct f = -123. assignment. gcc-2.8.0 reportedly
11096 optimized the whole file away
11097 */
5b813a60 11098 /* Store the number in a writable string for gcc to pass to
e237eb00 11099 sscanf under HP-UX.
b4eb6b3d
JH
11100 */
11101 sprintf(str, "-123");
11102 sscanf(str, "%lf", &f); /* f = -123.; */
11103
11104 signal(SIGFPE, blech);
11105 along = (unsigned long)f;
11106 aint = (unsigned int)f;
11107 ashort = (unsigned short)f;
11108 if (along != (unsigned long)-123)
11109 result |= 1;
11110 if (aint != (unsigned int)-123)
11111 result |= 1;
11112 if (ashort != (unsigned short)-123)
11113 result |= 1;
11114 sprintf(str, "1073741824.");
11115 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11116 f = f + f;
11117 along = 0;
11118 along = (unsigned long)f;
11119 if (along != 0x80000000)
11120 result |= 2;
11121 f -= 1.;
11122 along = 0;
11123 along = (unsigned long)f;
11124 if (along != 0x7fffffff)
11125 result |= 1;
11126 f += 2.;
11127 along = 0;
11128 along = (unsigned long)f;
11129 if (along != 0x80000001)
11130 result |= 2;
11131 if (result)
11132 exit(result);
11133 signal(SIGFPE, blech_in_list);
11134 sprintf(str, "123.");
11135 sscanf(str, "%lf", &f); /* f = 123.; */
11136 along = dummy_long((unsigned long)f);
11137 aint = dummy_int((unsigned int)f);
11138 ashort = dummy_short((unsigned short)f);
11139 if (along != (unsigned long)123)
11140 result |= 4;
11141 if (aint != (unsigned int)123)
11142 result |= 4;
11143 if (ashort != (unsigned short)123)
11144 result |= 4;
11145 exit(result);
11146
11147}
11148EOCP
11149set try
11150if eval $compile_ok; then
5440bc8e 11151 $run ./try
b4eb6b3d
JH
11152 castflags=$?
11153else
11154 echo "(I can't seem to compile the test program--assuming it can't)"
11155 castflags=7
11156fi
11157case "$castflags" in
111580) val="$define"
11159 echo "Yup, it can."
11160 ;;
11161*) val="$undef"
11162 echo "Nope, it can't."
11163 ;;
11164esac
11165set d_castneg
11166eval $setvar
5b813a60 11167$rm_try
b4eb6b3d
JH
11168
11169: see if vprintf exists
11170echo " "
11171if set vprintf val -f d_vprintf; eval $csym; $val; then
11172 echo 'vprintf() found.' >&4
11173 val="$define"
55954f19 11174 $cat >try.c <<EOF
d0bc9cc8
AD
11175#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11176#$i_varargs I_VARARGS
11177
55954f19 11178#$i_stdlib I_STDLIB
d0bc9cc8
AD
11179#$i_unistd I_UNISTD
11180
11181#ifdef I_STDARG
11182# include <stdarg.h>
11183#else /* I_VARARGS */
11184# include <varargs.h>
11185#endif
11186
11187#ifdef I_UNISTD
11188# include <unistd.h>
11189#endif
11190
55954f19 11191#ifdef I_STDLIB
d0bc9cc8 11192# include <stdlib.h>
55954f19 11193#endif
b4eb6b3d 11194
d0bc9cc8
AD
11195#include <stdio.h> /* vsprintf prototype */
11196
11197#ifdef I_STDARG
11198void xxx(int n, ...)
11199{
11200 va_list args;
11201 char buf[10];
11202 va_start(args, n);
11203 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11204}
11205int main() { xxx(1, "foo"); }
11206
11207#else /* I_VARARGS */
b4eb6b3d
JH
11208
11209xxx(va_alist)
11210va_dcl
11211{
d0bc9cc8
AD
11212 va_list args;
11213 char buf[10];
11214 va_start(args);
11215 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 11216}
d0bc9cc8
AD
11217int main() { xxx("foo"); }
11218
11219#endif
11220
b4eb6b3d 11221EOF
5440bc8e 11222 set try
d0bc9cc8
AD
11223 if eval $compile_ok; then
11224 if $run ./try; then
11225 echo "Your vsprintf() returns (int)." >&4
11226 val2="$undef"
11227 else
11228 echo "Your vsprintf() returns (char*)." >&4
11229 val2="$define"
11230 fi
b4eb6b3d 11231 else
d0bc9cc8
AD
11232 echo 'I am unable to compile the vsprintf() test program.' >&4
11233 # We shouldn't get here. If we do, assume the standard signature,
11234 # not the old BSD one.
11235 echo 'Guessing that vsprintf() returns (int).' >&4
11236 val2="$undef"
b4eb6b3d
JH
11237 fi
11238else
11239 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
11240 val="$undef"
11241 val2="$undef"
b4eb6b3d 11242fi
5b813a60 11243$rm_try
b4eb6b3d
JH
11244set d_vprintf
11245eval $setvar
11246val=$val2
11247set d_charvspr
11248eval $setvar
11249
11250: see if chown exists
11251set chown d_chown
11252eval $inlibc
11253
11254: see if chroot exists
11255set chroot d_chroot
11256eval $inlibc
11257
11258: see if chsize exists
11259set chsize d_chsize
11260eval $inlibc
11261
758a5d79
JH
11262: see if class exists
11263set class d_class
11264eval $inlibc
11265
b0a2e8e6
MB
11266: see if clearenv exists
11267set clearenv d_clearenv
11268eval $inlibc
11269
34f1896b 11270: Define hasstruct macro for Configure internal use
4e0554ec
JH
11271hasstruct='varname=$1; struct=$2; shift; shift;
11272while $test $# -ge 2; do
11273 case "$1" in
11274 $define) echo "#include <$2>";;
11275 esac ;
11276 shift 2;
11277done > try.c;
11278echo "int main () { struct $struct foo; }" >> try.c;
11279set try;
11280if eval $compile; then
11281 val="$define";
11282else
11283 val="$undef";
11284fi;
11285set $varname;
11286eval $setvar;
5b813a60 11287$rm_try'
4e0554ec 11288
34f1896b 11289: see whether socket exists
4e0554ec
JH
11290socketlib=''
11291sockethdr=''
4e0554ec
JH
11292echo " "
11293$echo $n "Hmm... $c" >&4
11294if set socket val -f d_socket; eval $csym; $val; then
11295 echo "Looks like you have Berkeley networking support." >&4
11296 d_socket="$define"
11297 if set setsockopt val -f; eval $csym; $val; then
11298 d_oldsock="$undef"
11299 else
11300 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11301 d_oldsock="$define"
11302 fi
11303else
11304 if $contains socklib libc.list >/dev/null 2>&1; then
11305 echo "Looks like you have Berkeley networking support." >&4
11306 d_socket="$define"
11307 : we will have to assume that it supports the 4.2 BSD interface
11308 d_oldsock="$undef"
11309 else
11310 echo "You don't have Berkeley networking in libc$_a..." >&4
11311 if test "X$d_socket" = "X$define"; then
11312 echo "...but you seem to believe that you have sockets." >&4
11313 else
11314 for net in net socket
11315 do
11316 if test -f /usr/lib/lib$net$_a; then
11317 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
11318 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11319 if $contains socket libc.list >/dev/null 2>&1; then
11320 d_socket="$define"
11321 socketlib="-l$net"
11322 case "$net" in
11323 net)
11324 echo "...but the Wollongong group seems to have hacked it in." >&4
11325 sockethdr="-I/usr/netinclude"
11326 ;;
11327 esac
5b813a60 11328 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
11329 if $contains setsockopt libc.list >/dev/null 2>&1; then
11330 d_oldsock="$undef"
11331 else
11332 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11333 d_oldsock="$define"
11334 fi
11335 break
11336 fi
11337 fi
11338 done
11339 if test "X$d_socket" != "X$define"; then
11340 echo "or anywhere else I see." >&4
11341 d_socket="$undef"
11342 d_oldsock="$undef"
11343 fi
11344 fi
11345 fi
11346fi
11347
11348: see if socketpair exists
11349set socketpair d_sockpair
11350eval $inlibc
11351
11352
11353echo " "
b8677e3b
MB
11354echo "Checking the availability sa_len in the sock struct ..." >&4
11355$cat >try.c <<EOF
11356#include <sys/types.h>
11357#include <sys/socket.h>
11358int main() {
11359struct sockaddr sa;
11360return (sa.sa_len);
11361}
11362EOF
11363val="$undef"
11364set try; if eval $compile; then
11365 val="$define"
11366fi
11367set d_sockaddr_sa_len; eval $setvar
11368$rm_try
11369
11370echo " "
f53580fe
MB
11371echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11372$cat >try.c <<EOF
11373#include <sys/types.h>
11374#include <sys/socket.h>
11375#include <netinet/in.h>
11376int main() {
11377struct sockaddr_in6 sin6;
11378return (sin6.sin6_scope_id);
11379}
11380EOF
11381val="$undef"
11382set try; if eval $compile; then
11383 val="$define"
11384fi
11385set d_sin6_scope_id; eval $setvar
11386$rm_try
11387
11388echo " "
3c728e00 11389echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11390for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11391 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11392 $cat >try.c <<EOF
11393#include <sys/types.h>
11394#include <sys/socket.h>
11395int main() {
11396 int i = $ENUM;
11397}
11398EOF
11399 val="$undef"
11400 set try; if eval $compile; then
11401 val="$define"
11402 fi
11403 set d_${enum}; eval $setvar
5b813a60 11404 $rm_try
4e0554ec
JH
11405done
11406
11407: see if this is a sys/uio.h system
11408set sys/uio.h i_sysuio
11409eval $inhdr
11410
34f1896b 11411: Check for cmsghdr support
4e0554ec
JH
11412echo " "
11413echo "Checking to see if your system supports struct cmsghdr..." >&4
11414set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11415eval $hasstruct
11416case "$d_cmsghdr_s" in
11417"$define") echo "Yes, it does." ;;
11418*) echo "No, it doesn't." ;;
11419esac
11420
11421
b4eb6b3d
JH
11422: check for const keyword
11423echo " "
11424echo 'Checking to see if your C compiler knows about "const"...' >&4
11425$cat >const.c <<'EOCP'
11426typedef struct spug { int drokk; } spug;
76f47787 11427int main()
b4eb6b3d
JH
11428{
11429 const char *foo;
666ea192 11430 const spug y = { 0 };
b4eb6b3d
JH
11431}
11432EOCP
11433if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11434 val="$define"
11435 echo "Yup, it does."
11436else
11437 val="$undef"
11438 echo "Nope, it doesn't."
11439fi
11440set d_const
11441eval $setvar
11442
89ce900e
JH
11443: see if copysignl exists
11444set copysignl d_copysignl
11445eval $inlibc
11446
b4eb6b3d
JH
11447: see if crypt exists
11448echo " "
a5a94ea5
JH
11449set crypt d_crypt
11450eval $inlibc
11451case "$d_crypt" in
11452$define) cryptlib='' ;;
11453*) if set crypt val -f d_crypt; eval $csym; $val; then
11454 echo 'crypt() found.' >&4
b4eb6b3d 11455 val="$define"
a5a94ea5
JH
11456 cryptlib=''
11457 else
11458 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11459 if $test -z "$cryptlib"; then
11460 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11461 else
11462 cryptlib=-lcrypt
11463 fi
11464 if $test -z "$cryptlib"; then
11465 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11466 else
11467 cryptlib=-lcrypt
11468 fi
11469 if $test -z "$cryptlib"; then
11470 cryptlib=`./loc libcrypt$_a "" $libpth`
11471 else
11472 cryptlib=-lcrypt
11473 fi
11474 if $test -z "$cryptlib"; then
11475 echo 'crypt() NOT found.' >&4
11476 val="$undef"
11477 else
11478 val="$define"
11479 fi
b4eb6b3d 11480 fi
a5a94ea5
JH
11481 set d_crypt
11482 eval $setvar
11483 ;;
11484esac
b4eb6b3d 11485
10bc17b6
JH
11486: see if this is a crypt.h system
11487set crypt.h i_crypt
11488eval $inhdr
11489
11490: see if crypt_r exists
11491set crypt_r d_crypt_r
11492eval $inlibc
11493case "$d_crypt_r" in
11494"$define")
11495 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11496 case "$d_crypt_r_proto:$usethreads" in
11497 ":define") d_crypt_r_proto=define
a48ec845
JH
11498 set d_crypt_r_proto crypt_r $hdrs
11499 eval $hasproto ;;
11500 *) ;;
11501 esac
11502 case "$d_crypt_r_proto" in
11503 define)
10bc17b6
JH
11504 case "$crypt_r_proto" in
11505 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
61c26d18 11506 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
10bc17b6
JH
11507 esac
11508 case "$crypt_r_proto" in
b430fd04 11509 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
61c26d18 11510 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
b430fd04
JH
11511 esac
11512 case "$crypt_r_proto" in
90e831dc 11513 ''|0) d_crypt_r=undef
10bc17b6 11514 crypt_r_proto=0
a48ec845 11515 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11516 * ) case "$crypt_r_proto" in
11517 REENTRANT_PROTO*) ;;
11518 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11519 esac
11520 echo "Prototype: $try" ;;
11521 esac
11522 ;;
c18e646a
JH
11523 *) case "$usethreads" in
11524 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11525 esac
90e831dc
SB
11526 d_crypt_r=undef
11527 crypt_r_proto=0
c18e646a 11528 ;;
a48ec845
JH
11529 esac
11530 ;;
10bc17b6
JH
11531*) crypt_r_proto=0
11532 ;;
11533esac
11534
b4eb6b3d
JH
11535: get csh whereabouts
11536case "$csh" in
11537'csh') val="$undef" ;;
11538*) val="$define" ;;
11539esac
11540set d_csh
11541eval $setvar
11542: Respect a hint or command line value for full_csh.
11543case "$full_csh" in
11544'') full_csh=$csh ;;
11545esac
11546
13cfc98d
MB
11547: see if ctermid exists
11548set ctermid d_ctermid
11549eval $inlibc
11550
10bc17b6
JH
11551: see if ctermid_r exists
11552set ctermid_r d_ctermid_r
11553eval $inlibc
11554case "$d_ctermid_r" in
11555"$define")
31ee0cb7 11556 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11557 case "$d_ctermid_r_proto:$usethreads" in
11558 ":define") d_ctermid_r_proto=define
a48ec845
JH
11559 set d_ctermid_r_proto ctermid_r $hdrs
11560 eval $hasproto ;;
11561 *) ;;
11562 esac
11563 case "$d_ctermid_r_proto" in
11564 define)
10bc17b6
JH
11565 case "$ctermid_r_proto" in
11566 ''|0) try='char* ctermid_r(char*);'
61c26d18 11567 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
10bc17b6
JH
11568 esac
11569 case "$ctermid_r_proto" in
90e831dc 11570 ''|0) d_ctermid_r=undef
10bc17b6 11571 ctermid_r_proto=0
a48ec845 11572 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11573 * ) case "$ctermid_r_proto" in
11574 REENTRANT_PROTO*) ;;
11575 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11576 esac
11577 echo "Prototype: $try" ;;
11578 esac
11579 ;;
c18e646a
JH
11580 *) case "$usethreads" in
11581 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11582 esac
90e831dc
SB
11583 d_ctermid_r=undef
11584 ctermid_r_proto=0
c18e646a 11585 ;;
a48ec845
JH
11586 esac
11587 ;;
10bc17b6
JH
11588*) ctermid_r_proto=0
11589 ;;
11590esac
11591
11592: see if ctime_r exists
11593set ctime_r d_ctime_r
11594eval $inlibc
11595case "$d_ctime_r" in
11596"$define")
d63eadf0 11597 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11598 case "$d_ctime_r_proto:$usethreads" in
11599 ":define") d_ctime_r_proto=define
a48ec845
JH
11600 set d_ctime_r_proto ctime_r $hdrs
11601 eval $hasproto ;;
11602 *) ;;
11603 esac
11604 case "$d_ctime_r_proto" in
11605 define)
10bc17b6
JH
11606 case "$ctime_r_proto" in
11607 ''|0) try='char* ctime_r(const time_t*, char*);'
61c26d18 11608 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
10bc17b6
JH
11609 esac
11610 case "$ctime_r_proto" in
11611 ''|0) try='char* ctime_r(const time_t*, char*, int);'
61c26d18 11612 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
10bc17b6
JH
11613 esac
11614 case "$ctime_r_proto" in
11615 ''|0) try='int ctime_r(const time_t*, char*);'
61c26d18 11616 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
10bc17b6
JH
11617 esac
11618 case "$ctime_r_proto" in
11619 ''|0) try='int ctime_r(const time_t*, char*, int);'
61c26d18 11620 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
10bc17b6
JH
11621 esac
11622 case "$ctime_r_proto" in
90e831dc 11623 ''|0) d_ctime_r=undef
10bc17b6 11624 ctime_r_proto=0
a48ec845 11625 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11626 * ) case "$ctime_r_proto" in
11627 REENTRANT_PROTO*) ;;
11628 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11629 esac
11630 echo "Prototype: $try" ;;
11631 esac
11632 ;;
c18e646a
JH
11633 *) case "$usethreads" in
11634 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11635 esac
90e831dc
SB
11636 d_ctime_r=undef
11637 ctime_r_proto=0
c18e646a 11638 ;;
a48ec845
JH
11639 esac
11640 ;;
10bc17b6
JH
11641*) ctime_r_proto=0
11642 ;;
11643esac
11644
b4eb6b3d
JH
11645: see if cuserid exists
11646set cuserid d_cuserid
11647eval $inlibc
11648
11649: see if this is a limits.h system
11650set limits.h i_limits
11651eval $inhdr
11652
11653: see if this is a float.h system
11654set float.h i_float
11655eval $inhdr
11656
11657: See if number of significant digits in a double precision number is known
11658echo " "
11659$cat >dbl_dig.c <<EOM
11660#$i_limits I_LIMITS
11661#$i_float I_FLOAT
11662#ifdef I_LIMITS
11663#include <limits.h>
11664#endif
11665#ifdef I_FLOAT
11666#include <float.h>
11667#endif
11668#ifdef DBL_DIG
11669printf("Contains DBL_DIG");
11670#endif
11671EOM
11672$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11673if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11674 echo "DBL_DIG found." >&4
11675 val="$define"
11676else
11677 echo "DBL_DIG NOT found." >&4
11678 val="$undef"
11679fi
11680$rm -f dbl_dig.?
11681set d_dbl_dig
11682eval $setvar
11683
2ef53570
JH
11684: see if dbm.h is available
11685: see if dbmclose exists
11686set dbmclose d_dbmclose
11687eval $inlibc
11688
11689case "$d_dbmclose" in
11690$define)
11691 set dbm.h i_dbm
11692 eval $inhdr
11693 case "$i_dbm" in
11694 $define)
11695 val="$undef"
11696 set i_rpcsvcdbm
11697 eval $setvar
11698 ;;
11699 *) set rpcsvc/dbm.h i_rpcsvcdbm
11700 eval $inhdr
11701 ;;
11702 esac
11703 ;;
11704*) echo "We won't be including <dbm.h>"
11705 val="$undef"
11706 set i_dbm
11707 eval $setvar
11708 val="$undef"
11709 set i_rpcsvcdbm
11710 eval $setvar
11711 ;;
11712esac
11713
11714: see if prototype for dbminit is available
11715echo " "
11716set d_dbminitproto dbminit $i_dbm dbm.h
11717eval $hasproto
11718
b4eb6b3d
JH
11719: see if difftime exists
11720set difftime d_difftime
11721eval $inlibc
11722
11723: see if this is a dirent system
11724echo " "
11725if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11726 val="$define"
11727 echo "<dirent.h> found." >&4
11728else
11729 val="$undef"
11730 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11731 echo "<sys/dir.h> found." >&4
11732 echo " "
11733 else
11734 xinc=`./findhdr sys/ndir.h`
11735 fi
11736 echo "<dirent.h> NOT found." >&4
11737fi
11738set i_dirent
11739eval $setvar
11740
11741: Look for type of directory structure.
11742echo " "
11743$cppstdin $cppflags $cppminus < "$xinc" > try.c
11744
11745case "$direntrytype" in
11746''|' ')
11747 case "$i_dirent" in
11748 $define) guess1='struct dirent' ;;
11749 *) guess1='struct direct' ;;
11750 esac
11751 ;;
11752*) guess1="$direntrytype"
11753 ;;
11754esac
11755
11756case "$guess1" in
11757'struct dirent') guess2='struct direct' ;;
11758*) guess2='struct dirent' ;;
11759esac
5b813a60 11760
b4eb6b3d
JH
11761if $contains "$guess1" try.c >/dev/null 2>&1; then
11762 direntrytype="$guess1"
11763 echo "Your directory entries are $direntrytype." >&4
11764elif $contains "$guess2" try.c >/dev/null 2>&1; then
11765 direntrytype="$guess2"
11766 echo "Your directory entries seem to be $direntrytype." >&4
11767else
11768 echo "I don't recognize your system's directory entries." >&4
11769 rp="What type is used for directory entries on this system?"
11770 dflt="$guess1"
11771 . ./myread
11772 direntrytype="$ans"
11773fi
5b813a60 11774$rm_try
b4eb6b3d
JH
11775
11776: see if the directory entry stores field length
11777echo " "
11778$cppstdin $cppflags $cppminus < "$xinc" > try.c
11779if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11780 echo "Good, your directory entry keeps length information in d_namlen." >&4
11781 val="$define"
11782else
11783 echo "Your directory entry does not know about the d_namlen field." >&4
11784 val="$undef"
11785fi
11786set d_dirnamlen
11787eval $setvar
5b813a60 11788$rm_try
b4eb6b3d 11789
de52168c
SP
11790: Look for DIR.dd_fd
11791case "$i_dirent" in
11792"$define")
11793 echo "Checking to see if DIR has a dd_fd member variable" >&4
11794 $cat >try.c <<EOCP
11795#$i_stdlib I_STDLIB
11796#ifdef I_STDLIB
11797#include <stdlib.h>
11798#endif
11799#include <dirent.h>
11800
11801int main() {
11802 DIR dir;
11803 dir.dd_fd = 1;
11804 return 0;
11805}
11806EOCP
11807 val=$undef
11808 set try
11809 if eval $compile; then
11810 echo "Yes, it does."
11811 val="$define"
11812 else
11813 echo "No, it does not."
11814 val="$undef"
11815 fi
11816 ;;
11817*)
11818 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11819 val="$undef"
11820 ;;
11821esac
11822set d_dir_dd_fd
11823eval $setvar
5b813a60 11824$rm_try
de52168c 11825
ae0e3d3b
JH
11826: see if this is an sysdir system
11827set sys/dir.h i_sysdir
11828eval $inhdr
11829
11830: see if this is an sysndir system
11831set sys/ndir.h i_sysndir
11832eval $inhdr
11833
11834: Look for dirfd
11835echo " "
11836$cat >dirfd.c <<EOM
11837#include <stdio.h>
55954f19
JH
11838#$i_stdlib I_STDLIB
11839#ifdef I_STDLIB
11840#include <stdlib.h>
11841#endif
ae0e3d3b
JH
11842#$i_dirent I_DIRENT /**/
11843#$i_sysdir I_SYS_DIR /**/
11844#$i_sysndir I_SYS_NDIR /**/
11845#$i_systypes I_SYS_TYPES /**/
11846#if defined(I_SYS_TYPES)
11847#include <sys/types.h>
11848#endif
11849#if defined(I_DIRENT)
11850#include <dirent.h>
11851#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11852#include <sys/dir.h>
11853#endif
11854#else
11855#ifdef I_SYS_NDIR
11856#include <sys/ndir.h>
11857#else
11858#ifdef I_SYS_DIR
11859#ifdef hp9000s500
11860#include <ndir.h> /* may be wrong in the future */
11861#else
11862#include <sys/dir.h>
11863#endif
11864#endif
11865#endif
11866#endif
11867int main() {
11868 DIR *dirp = opendir(".");
11869 if (dirfd(dirp) >= 0)
11870 exit(0);
11871 else
11872 exit(1);
11873}
11874EOM
5cadb3f3 11875val=$undef
ae0e3d3b
JH
11876set dirfd
11877if eval $compile; then
11878 val="$define"
11879fi
11880case "$val" in
11881$define) echo "dirfd() found." >&4 ;;
11882*) echo "dirfd() NOT found." >&4 ;;
11883esac
11884set d_dirfd
11885eval $setvar
11886$rm -f dirfd*
11887
b4eb6b3d
JH
11888: see if dlerror exists
11889xxx_runnm="$runnm"
11890runnm=false
11891set dlerror d_dlerror
11892eval $inlibc
11893runnm="$xxx_runnm"
11894
11895: see if dlfcn is available
11896set dlfcn.h i_dlfcn
11897eval $inhdr
11898
34f1896b 11899: Check what extension to use for shared libs
b4eb6b3d
JH
11900case "$usedl" in
11901$define|y|true)
11902 $cat << EOM
11903
11904On a few systems, the dynamically loaded modules that perl generates and uses
11905will need a different extension than shared libs. The default will probably
11906be appropriate.
11907
11908EOM
11909 case "$dlext" in
11910 '') dflt="$so" ;;
11911 *) dflt="$dlext" ;;
11912 esac
11913 rp='What is the extension of dynamically loaded modules'
11914 . ./myread
11915 dlext="$ans"
11916 ;;
11917*)
11918 dlext="none"
11919 ;;
11920esac
11921
11922: Check if dlsym need a leading underscore
11923echo " "
11924val="$undef"
11925
11926case "$dlsrc" in
11927dl_dlopen.xs)
11928 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11929 $cat >dyna.c <<'EOM'
11930fred () { }
11931EOM
11932
11933$cat >fred.c<<EOM
11934
11935#include <stdio.h>
55954f19
JH
11936#$i_stdlib I_STDLIB
11937#ifdef I_STDLIB
11938#include <stdlib.h>
11939#endif
b4eb6b3d
JH
11940#$i_dlfcn I_DLFCN
11941#ifdef I_DLFCN
5440bc8e 11942#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11943#else
11944#include <sys/types.h>
11945#include <nlist.h>
11946#include <link.h>
11947#endif
11948
11949extern int fred() ;
11950
11951int main()
11952{
11953 void * handle ;
11954 void * symbol ;
11955#ifndef RTLD_LAZY
11956 int mode = 1 ;
11957#else
11958 int mode = RTLD_LAZY ;
11959#endif
11960 handle = dlopen("./dyna.$dlext", mode) ;
11961 if (handle == NULL) {
11962 printf ("1\n") ;
11963 fflush (stdout) ;
11964 exit(0);
11965 }
11966 symbol = dlsym(handle, "fred") ;
11967 if (symbol == NULL) {
11968 /* try putting a leading underscore */
11969 symbol = dlsym(handle, "_fred") ;
11970 if (symbol == NULL) {
11971 printf ("2\n") ;
11972 fflush (stdout) ;
11973 exit(0);
11974 }
11975 printf ("3\n") ;
11976 }
11977 else
11978 printf ("4\n") ;
11979 fflush (stdout) ;
11980 exit(0);
11981}
11982EOM
11983 : Call the object file tmp-dyna.o in case dlext=o.
613d6c3e
MB
11984 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11985 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11986 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11987 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11988 xxx=`$run ./fred`
b4eb6b3d
JH
11989 case $xxx in
11990 1) echo "Test program failed using dlopen." >&4
11991 echo "Perhaps you should not use dynamic loading." >&4;;
11992 2) echo "Test program failed using dlsym." >&4
11993 echo "Perhaps you should not use dynamic loading." >&4;;
11994 3) echo "dlsym needs a leading underscore" >&4
11995 val="$define" ;;
11996 4) echo "dlsym doesn't need a leading underscore." >&4;;
11997 esac
11998 else
11999 echo "I can't compile and run the test program." >&4
12000 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12001 fi
12002 ;;
12003esac
613d6c3e 12004
3c728e00 12005$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
12006
12007set d_dlsymun
12008eval $setvar
12009
10bc17b6
JH
12010: see if drand48_r exists
12011set drand48_r d_drand48_r
12012eval $inlibc
12013case "$d_drand48_r" in
12014"$define")
12015 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
12016 case "$d_drand48_r_proto:$usethreads" in
12017 ":define") d_drand48_r_proto=define
a48ec845
JH
12018 set d_drand48_r_proto drand48_r $hdrs
12019 eval $hasproto ;;
12020 *) ;;
12021 esac
12022 case "$d_drand48_r_proto" in
12023 define)
10bc17b6
JH
12024 case "$drand48_r_proto" in
12025 ''|0) try='int drand48_r(struct drand48_data*, double*);'
61c26d18 12026 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
10bc17b6
JH
12027 esac
12028 case "$drand48_r_proto" in
90e831dc 12029 ''|0) d_drand48_r=undef
10bc17b6 12030 drand48_r_proto=0
a48ec845 12031 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12032 * ) case "$drand48_r_proto" in
12033 REENTRANT_PROTO*) ;;
12034 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12035 esac
12036 echo "Prototype: $try" ;;
12037 esac
12038 ;;
c18e646a
JH
12039 *) case "$usethreads" in
12040 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12041 esac
90e831dc
SB
12042 d_drand48_r=undef
12043 drand48_r_proto=0
c18e646a 12044 ;;
a48ec845
JH
12045 esac
12046 ;;
10bc17b6
JH
12047*) drand48_r_proto=0
12048 ;;
12049esac
12050
12051: see if prototype for drand48 is available
12052echo " "
12053set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12054eval $hasproto
12055
b4eb6b3d
JH
12056: see if dup2 exists
12057set dup2 d_dup2
12058eval $inlibc
12059
12060: see if eaccess exists
12061set eaccess d_eaccess
12062eval $inlibc
12063
12064: see if endgrent exists
12065set endgrent d_endgrent
12066eval $inlibc
12067
10bc17b6
JH
12068: see if this is an grp system
12069set grp.h i_grp
12070eval $inhdr
12071
12072case "$i_grp" in
12073$define)
12074 xxx=`./findhdr grp.h`
12075 $cppstdin $cppflags $cppminus < $xxx >$$.h
12076
12077 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12078 val="$define"
12079 else
12080 val="$undef"
12081 fi
12082 set d_grpasswd
12083 eval $setvar
12084
12085 $rm -f $$.h
12086 ;;
12087*)
12088 val="$undef";
12089 set d_grpasswd; eval $setvar
12090 ;;
12091esac
12092
12093: see if endgrent_r exists
12094set endgrent_r d_endgrent_r
12095eval $inlibc
12096case "$d_endgrent_r" in
12097"$define")
12098 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12099 case "$d_endgrent_r_proto:$usethreads" in
12100 ":define") d_endgrent_r_proto=define
a48ec845
JH
12101 set d_endgrent_r_proto endgrent_r $hdrs
12102 eval $hasproto ;;
12103 *) ;;
12104 esac
12105 case "$d_endgrent_r_proto" in
12106 define)
10bc17b6
JH
12107 case "$endgrent_r_proto" in
12108 ''|0) try='int endgrent_r(FILE**);'
61c26d18 12109 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
10bc17b6
JH
12110 esac
12111 case "$endgrent_r_proto" in
12112 ''|0) try='void endgrent_r(FILE**);'
61c26d18 12113 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
10bc17b6
JH
12114 esac
12115 case "$endgrent_r_proto" in
90e831dc 12116 ''|0) d_endgrent_r=undef
10bc17b6 12117 endgrent_r_proto=0
a48ec845 12118 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12119 * ) case "$endgrent_r_proto" in
12120 REENTRANT_PROTO*) ;;
12121 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12122 esac
12123 echo "Prototype: $try" ;;
12124 esac
12125 ;;
c18e646a
JH
12126 *) case "$usethreads" in
12127 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12128 esac
90e831dc
SB
12129 d_endgrent_r=undef
12130 endgrent_r_proto=0
c18e646a 12131 ;;
a48ec845
JH
12132 esac
12133 ;;
10bc17b6
JH
12134*) endgrent_r_proto=0
12135 ;;
12136esac
12137
b4eb6b3d
JH
12138: see if endhostent exists
12139set endhostent d_endhent
12140eval $inlibc
12141
10bc17b6
JH
12142: see if this is a netdb.h system
12143set netdb.h i_netdb
12144eval $inhdr
12145
12146: see if endhostent_r exists
12147set endhostent_r d_endhostent_r
12148eval $inlibc
12149case "$d_endhostent_r" in
12150"$define")
12151 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12152 case "$d_endhostent_r_proto:$usethreads" in
12153 ":define") d_endhostent_r_proto=define
a48ec845
JH
12154 set d_endhostent_r_proto endhostent_r $hdrs
12155 eval $hasproto ;;
12156 *) ;;
12157 esac
12158 case "$d_endhostent_r_proto" in
12159 define)
10bc17b6
JH
12160 case "$endhostent_r_proto" in
12161 ''|0) try='int endhostent_r(struct hostent_data*);'
61c26d18 12162 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
12163 esac
12164 case "$endhostent_r_proto" in
12165 ''|0) try='void endhostent_r(struct hostent_data*);'
61c26d18 12166 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
12167 esac
12168 case "$endhostent_r_proto" in
90e831dc 12169 ''|0) d_endhostent_r=undef
10bc17b6 12170 endhostent_r_proto=0
a48ec845 12171 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12172 * ) case "$endhostent_r_proto" in
12173 REENTRANT_PROTO*) ;;
12174 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12175 esac
12176 echo "Prototype: $try" ;;
12177 esac
12178 ;;
c18e646a
JH
12179 *) case "$usethreads" in
12180 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12181 esac
90e831dc
SB
12182 d_endhostent_r=undef
12183 endhostent_r_proto=0
c18e646a 12184 ;;
a48ec845
JH
12185 esac
12186 ;;
10bc17b6
JH
12187*) endhostent_r_proto=0
12188 ;;
12189esac
12190
b4eb6b3d
JH
12191: see if endnetent exists
12192set endnetent d_endnent
12193eval $inlibc
12194
10bc17b6
JH
12195: see if endnetent_r exists
12196set endnetent_r d_endnetent_r
12197eval $inlibc
12198case "$d_endnetent_r" in
12199"$define")
12200 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12201 case "$d_endnetent_r_proto:$usethreads" in
12202 ":define") d_endnetent_r_proto=define
a48ec845
JH
12203 set d_endnetent_r_proto endnetent_r $hdrs
12204 eval $hasproto ;;
12205 *) ;;
12206 esac
12207 case "$d_endnetent_r_proto" in
12208 define)
10bc17b6
JH
12209 case "$endnetent_r_proto" in
12210 ''|0) try='int endnetent_r(struct netent_data*);'
61c26d18 12211 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
12212 esac
12213 case "$endnetent_r_proto" in
12214 ''|0) try='void endnetent_r(struct netent_data*);'
61c26d18 12215 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
12216 esac
12217 case "$endnetent_r_proto" in
90e831dc 12218 ''|0) d_endnetent_r=undef
10bc17b6 12219 endnetent_r_proto=0
a48ec845 12220 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12221 * ) case "$endnetent_r_proto" in
12222 REENTRANT_PROTO*) ;;
12223 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12224 esac
12225 echo "Prototype: $try" ;;
12226 esac
12227 ;;
c18e646a
JH
12228 *) case "$usethreads" in
12229 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12230 esac
90e831dc
SB
12231 d_endnetent_r=undef
12232 endnetent_r_proto=0
c18e646a 12233 ;;
a48ec845
JH
12234 esac
12235 ;;
10bc17b6
JH
12236*) endnetent_r_proto=0
12237 ;;
12238esac
12239
b4eb6b3d
JH
12240: see if endprotoent exists
12241set endprotoent d_endpent
12242eval $inlibc
12243
10bc17b6
JH
12244: see if endprotoent_r exists
12245set endprotoent_r d_endprotoent_r
12246eval $inlibc
12247case "$d_endprotoent_r" in
12248"$define")
12249 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12250 case "$d_endprotoent_r_proto:$usethreads" in
12251 ":define") d_endprotoent_r_proto=define
a48ec845
JH
12252 set d_endprotoent_r_proto endprotoent_r $hdrs
12253 eval $hasproto ;;
12254 *) ;;
12255 esac
12256 case "$d_endprotoent_r_proto" in
12257 define)
10bc17b6
JH
12258 case "$endprotoent_r_proto" in
12259 ''|0) try='int endprotoent_r(struct protoent_data*);'
61c26d18 12260 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
12261 esac
12262 case "$endprotoent_r_proto" in
12263 ''|0) try='void endprotoent_r(struct protoent_data*);'
61c26d18 12264 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
12265 esac
12266 case "$endprotoent_r_proto" in
90e831dc 12267 ''|0) d_endprotoent_r=undef
10bc17b6 12268 endprotoent_r_proto=0
a48ec845 12269 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12270 * ) case "$endprotoent_r_proto" in
12271 REENTRANT_PROTO*) ;;
12272 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12273 esac
12274 echo "Prototype: $try" ;;
12275 esac
12276 ;;
c18e646a
JH
12277 *) case "$usethreads" in
12278 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12279 esac
90e831dc
SB
12280 d_endprotoent_r=undef
12281 endprotoent_r_proto=0
c18e646a 12282 ;;
a48ec845
JH
12283 esac
12284 ;;
10bc17b6
JH
12285*) endprotoent_r_proto=0
12286 ;;
12287esac
12288
b4eb6b3d
JH
12289: see if endpwent exists
12290set endpwent d_endpwent
12291eval $inlibc
12292
10bc17b6
JH
12293: see if this is a pwd.h system
12294set pwd.h i_pwd
12295eval $inhdr
12296
12297case "$i_pwd" in
12298$define)
12299 xxx=`./findhdr pwd.h`
12300 $cppstdin $cppflags $cppminus < $xxx >$$.h
12301
12302 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12303 val="$define"
12304 else
12305 val="$undef"
12306 fi
12307 set d_pwquota
12308 eval $setvar
12309
12310 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12311 val="$define"
12312 else
12313 val="$undef"
12314 fi
12315 set d_pwage
12316 eval $setvar
12317
12318 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12319 val="$define"
12320 else
12321 val="$undef"
12322 fi
12323 set d_pwchange
12324 eval $setvar
12325
12326 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12327 val="$define"
12328 else
12329 val="$undef"
12330 fi
12331 set d_pwclass
12332 eval $setvar
12333
12334 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12335 val="$define"
12336 else
12337 val="$undef"
12338 fi
12339 set d_pwexpire
12340 eval $setvar
12341
12342 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12343 val="$define"
12344 else
12345 val="$undef"
12346 fi
12347 set d_pwcomment
12348 eval $setvar
12349
12350 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12351 val="$define"
12352 else
12353 val="$undef"
12354 fi
12355 set d_pwgecos
12356 eval $setvar
12357
12358 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12359 val="$define"
12360 else
12361 val="$undef"
12362 fi
12363 set d_pwpasswd
12364 eval $setvar
12365
12366 $rm -f $$.h
12367 ;;
12368*)
12369 val="$undef";
12370 set d_pwquota; eval $setvar
12371 set d_pwage; eval $setvar
12372 set d_pwchange; eval $setvar
12373 set d_pwclass; eval $setvar
12374 set d_pwexpire; eval $setvar
12375 set d_pwcomment; eval $setvar
12376 set d_pwgecos; eval $setvar
12377 set d_pwpasswd; eval $setvar
12378 ;;
12379esac
12380
12381: see if endpwent_r exists
12382set endpwent_r d_endpwent_r
12383eval $inlibc
12384case "$d_endpwent_r" in
12385"$define")
12386 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12387 case "$d_endpwent_r_proto:$usethreads" in
12388 ":define") d_endpwent_r_proto=define
a48ec845
JH
12389 set d_endpwent_r_proto endpwent_r $hdrs
12390 eval $hasproto ;;
12391 *) ;;
12392 esac
12393 case "$d_endpwent_r_proto" in
12394 define)
10bc17b6
JH
12395 case "$endpwent_r_proto" in
12396 ''|0) try='int endpwent_r(FILE**);'
61c26d18 12397 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
10bc17b6
JH
12398 esac
12399 case "$endpwent_r_proto" in
12400 ''|0) try='void endpwent_r(FILE**);'
61c26d18 12401 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
10bc17b6
JH
12402 esac
12403 case "$endpwent_r_proto" in
90e831dc 12404 ''|0) d_endpwent_r=undef
10bc17b6 12405 endpwent_r_proto=0
a48ec845 12406 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12407 * ) case "$endpwent_r_proto" in
12408 REENTRANT_PROTO*) ;;
12409 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12410 esac
12411 echo "Prototype: $try" ;;
12412 esac
12413 ;;
c18e646a
JH
12414 *) case "$usethreads" in
12415 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12416 esac
90e831dc
SB
12417 d_endpwent_r=undef
12418 endpwent_r_proto=0
c18e646a 12419 ;;
a48ec845
JH
12420 esac
12421 ;;
10bc17b6
JH
12422*) endpwent_r_proto=0
12423 ;;
12424esac
12425
b4eb6b3d
JH
12426: see if endservent exists
12427set endservent d_endsent
12428eval $inlibc
12429
10bc17b6
JH
12430: see if endservent_r exists
12431set endservent_r d_endservent_r
12432eval $inlibc
12433case "$d_endservent_r" in
12434"$define")
12435 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12436 case "$d_endservent_r_proto:$usethreads" in
12437 ":define") d_endservent_r_proto=define
a48ec845
JH
12438 set d_endservent_r_proto endservent_r $hdrs
12439 eval $hasproto ;;
12440 *) ;;
12441 esac
12442 case "$d_endservent_r_proto" in
12443 define)
10bc17b6
JH
12444 case "$endservent_r_proto" in
12445 ''|0) try='int endservent_r(struct servent_data*);'
61c26d18 12446 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12447 esac
12448 case "$endservent_r_proto" in
12449 ''|0) try='void endservent_r(struct servent_data*);'
61c26d18 12450 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12451 esac
12452 case "$endservent_r_proto" in
90e831dc 12453 ''|0) d_endservent_r=undef
10bc17b6 12454 endservent_r_proto=0
a48ec845 12455 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12456 * ) case "$endservent_r_proto" in
12457 REENTRANT_PROTO*) ;;
12458 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12459 esac
12460 echo "Prototype: $try" ;;
12461 esac
12462 ;;
c18e646a
JH
12463 *) case "$usethreads" in
12464 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12465 esac
90e831dc
SB
12466 d_endservent_r=undef
12467 endservent_r_proto=0
c18e646a 12468 ;;
a48ec845
JH
12469 esac
12470 ;;
10bc17b6
JH
12471*) endservent_r_proto=0
12472 ;;
12473esac
12474
b4eb6b3d
JH
12475: Locate the flags for 'open()'
12476echo " "
55954f19 12477$cat >try.c <<EOCP
b4eb6b3d
JH
12478#include <sys/types.h>
12479#ifdef I_FCNTL
12480#include <fcntl.h>
12481#endif
12482#ifdef I_SYS_FILE
12483#include <sys/file.h>
12484#endif
55954f19
JH
12485#$i_stdlib I_STDLIB
12486#ifdef I_STDLIB
12487#include <stdlib.h>
12488#endif
b4eb6b3d
JH
12489int main() {
12490 if(O_RDONLY);
12491#ifdef O_TRUNC
12492 exit(0);
12493#else
12494 exit(1);
12495#endif
12496}
12497EOCP
12498: check sys/file.h first to get FREAD on Sun
12499if $test `./findhdr sys/file.h` && \
5440bc8e 12500 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12501 h_sysfile=true;
12502 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12503 if $run ./try; then
b4eb6b3d
JH
12504 echo "and you have the 3 argument form of open()." >&4
12505 val="$define"
12506 else
12507 echo "but not the 3 argument form of open(). Oh, well." >&4
12508 val="$undef"
12509 fi
12510elif $test `./findhdr fcntl.h` && \
5440bc8e 12511 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12512 h_fcntl=true;
12513 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12514 if $run ./try; then
b4eb6b3d
JH
12515 echo "and you have the 3 argument form of open()." >&4
12516 val="$define"
12517 else
12518 echo "but not the 3 argument form of open(). Oh, well." >&4
12519 val="$undef"
12520 fi
12521else
12522 val="$undef"
12523 echo "I can't find the O_* constant definitions! You got problems." >&4
12524fi
12525set d_open3
12526eval $setvar
5b813a60 12527$rm_try
b4eb6b3d 12528
3c728e00
JH
12529: see if this is a sys/file.h system
12530val=''
12531set sys/file.h val
12532eval $inhdr
12533
12534: do we need to include sys/file.h ?
12535case "$val" in
12536"$define")
12537 echo " "
12538 if $h_sysfile; then
12539 val="$define"
12540 echo "We'll be including <sys/file.h>." >&4
12541 else
12542 val="$undef"
12543 echo "We won't be including <sys/file.h>." >&4
12544 fi
12545 ;;
12546*)
12547 h_sysfile=false
12548 ;;
12549esac
12550set i_sysfile
12551eval $setvar
12552
12553: see if fcntl.h is there
12554val=''
12555set fcntl.h val
12556eval $inhdr
12557
12558: see if we can include fcntl.h
12559case "$val" in
12560"$define")
12561 echo " "
12562 if $h_fcntl; then
12563 val="$define"
12564 echo "We'll be including <fcntl.h>." >&4
12565 else
12566 val="$undef"
12567 if $h_sysfile; then
12568 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12569 else
12570 echo "We won't be including <fcntl.h>." >&4
12571 fi
12572 fi
12573 ;;
12574*)
12575 h_fcntl=false
12576 val="$undef"
12577 ;;
12578esac
12579set i_fcntl
12580eval $setvar
12581
4dd8f9b3
JH
12582: see if fork exists
12583set fork d_fork
12584eval $inlibc
12585
12586: see if pipe exists
12587set pipe d_pipe
12588eval $inlibc
12589
b4eb6b3d
JH
12590: check for non-blocking I/O stuff
12591case "$h_sysfile" in
a0acbdc3
JH
12592true) echo "#include <sys/file.h>" > head.c;;
12593*)
12594 case "$h_fcntl" in
12595 true) echo "#include <fcntl.h>" > head.c;;
12596 *) echo "#include <sys/fcntl.h>" > head.c;;
12597 esac
12598 ;;
b4eb6b3d
JH
12599esac
12600echo " "
12601echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12602case "$o_nonblock" in
12603'')
12604 $cat head.c > try.c
3c728e00 12605 $cat >>try.c <<EOCP
b4eb6b3d 12606#include <stdio.h>
55954f19
JH
12607#$i_stdlib I_STDLIB
12608#ifdef I_STDLIB
80b3ef99 12609#include <stdlib.h>
55954f19 12610#endif
3c728e00
JH
12611#$i_fcntl I_FCNTL
12612#ifdef I_FCNTL
12613#include <fcntl.h>
12614#endif
b4eb6b3d
JH
12615int main() {
12616#ifdef O_NONBLOCK
12617 printf("O_NONBLOCK\n");
12618 exit(0);
12619#endif
12620#ifdef O_NDELAY
12621 printf("O_NDELAY\n");
12622 exit(0);
12623#endif
12624#ifdef FNDELAY
12625 printf("FNDELAY\n");
12626 exit(0);
12627#endif
12628 exit(0);
12629}
12630EOCP
12631 set try
12632 if eval $compile_ok; then
5440bc8e 12633 o_nonblock=`$run ./try`
b4eb6b3d
JH
12634 case "$o_nonblock" in
12635 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12636 *) echo "Seems like we can use $o_nonblock.";;
12637 esac
12638 else
12639 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12640 fi
12641 ;;
12642*) echo "Using $hint value $o_nonblock.";;
12643esac
5b813a60 12644$rm_try
b4eb6b3d
JH
12645
12646echo " "
12647echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12648case "$eagain" in
12649'')
4dd8f9b3
JH
12650 case "$d_fork:$d_pipe" in
12651 define:define)
b4eb6b3d
JH
12652 $cat head.c > try.c
12653 $cat >>try.c <<EOCP
12654#include <errno.h>
12655#include <sys/types.h>
12656#include <signal.h>
5b813a60 12657#include <stdio.h>
55954f19
JH
12658#$i_stdlib I_STDLIB
12659#ifdef I_STDLIB
12660#include <stdlib.h>
12661#endif
1deb0a86
JH
12662#$i_fcntl I_FCNTL
12663#ifdef I_FCNTL
12664#include <fcntl.h>
12665#endif
b4eb6b3d
JH
12666#define MY_O_NONBLOCK $o_nonblock
12667#ifndef errno /* XXX need better Configure test */
12668extern int errno;
12669#endif
12670#$i_unistd I_UNISTD
12671#ifdef I_UNISTD
12672#include <unistd.h>
12673#endif
12674#$i_string I_STRING
12675#ifdef I_STRING
12676#include <string.h>
12677#else
12678#include <strings.h>
12679#endif
7090f861 12680$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12681EOCP
12682 $cat >> try.c <<'EOCP'
12683int main()
12684{
12685 int pd[2];
12686 int pu[2];
12687 char buf[1];
12688 char string[100];
12689
12690 pipe(pd); /* Down: child -> parent */
12691 pipe(pu); /* Up: parent -> child */
12692 if (0 != fork()) {
12693 int ret;
12694 close(pd[1]); /* Parent reads from pd[0] */
12695 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12696#ifdef F_SETFL
b4eb6b3d
JH
12697 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12698 exit(1);
a0acbdc3
JH
12699#else
12700 exit(4);
12701#endif
b4eb6b3d
JH
12702 signal(SIGALRM, blech);
12703 alarm(5);
12704 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12705 exit(2);
12706 sprintf(string, "%d\n", ret);
12707 write(2, string, strlen(string));
12708 alarm(0);
12709#ifdef EAGAIN
12710 if (errno == EAGAIN) {
12711 printf("EAGAIN\n");
12712 goto ok;
12713 }
12714#endif
12715#ifdef EWOULDBLOCK
12716 if (errno == EWOULDBLOCK)
12717 printf("EWOULDBLOCK\n");
12718#endif
12719 ok:
12720 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12721 sleep(2); /* Give it time to close our pipe */
12722 alarm(5);
12723 ret = read(pd[0], buf, 1); /* Should read EOF */
12724 alarm(0);
12725 sprintf(string, "%d\n", ret);
868439a2 12726 write(4, string, strlen(string));
b4eb6b3d
JH
12727 exit(0);
12728 }
12729
12730 close(pd[0]); /* We write to pd[1] */
12731 close(pu[1]); /* We read from pu[0] */
12732 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12733 close(pd[1]); /* Pipe pd is now fully closed! */
12734 exit(0); /* Bye bye, thank you for playing! */
12735}
12736EOCP
12737 set try
12738 if eval $compile_ok; then
12739 echo "$startsh" >mtry
868439a2 12740 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12741 chmod +x mtry
12742 ./mtry >/dev/null 2>&1
12743 case $? in
12744 0) eagain=`$cat try.out`;;
12745 1) echo "Could not perform non-blocking setting!";;
12746 2) echo "I did a successful read() for something that was not there!";;
12747 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12748 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12749 *) echo "Something terribly wrong happened during testing.";;
12750 esac
12751 rd_nodata=`$cat try.ret`
12752 echo "A read() system call with no data present returns $rd_nodata."
12753 case "$rd_nodata" in
12754 0|-1) ;;
12755 *)
12756 echo "(That's peculiar, fixing that to be -1.)"
12757 rd_nodata=-1
12758 ;;
12759 esac
12760 case "$eagain" in
12761 '')
12762 echo "Forcing errno EAGAIN on read() with no data available."
12763 eagain=EAGAIN
12764 ;;
12765 *)
12766 echo "Your read() sets errno to $eagain when no data is available."
12767 ;;
12768 esac
12769 status=`$cat try.err`
12770 case "$status" in
12771 0) echo "And it correctly returns 0 to signal EOF.";;
12772 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12773 *) echo "However, your read() returns '$status' on EOF??";;
12774 esac
12775 val="$define"
12776 if test "$status" = "$rd_nodata"; then
12777 echo "WARNING: you can't distinguish between EOF and no data!"
12778 val="$undef"
12779 fi
12780 else
12781 echo "I can't compile the test program--assuming errno EAGAIN will do."
12782 eagain=EAGAIN
12783 fi
4dd8f9b3
JH
12784 ;;
12785 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12786 eagain=EAGAIN
12787 val="$define"
12788 ;;
12789 esac
b4eb6b3d
JH
12790 set d_eofnblk
12791 eval $setvar
12792 ;;
12793*)
12794 echo "Using $hint value $eagain."
12795 echo "Your read() returns $rd_nodata when no data is present."
12796 case "$d_eofnblk" in
12797 "$define") echo "And you can see EOF because read() returns 0.";;
12798 "$undef") echo "But you can't see EOF status from read() returned value.";;
12799 *)
12800 echo "(Assuming you can't see EOF status from read anyway.)"
12801 d_eofnblk=$undef
12802 ;;
12803 esac
12804 ;;
12805esac
5b813a60 12806$rm_try head.c mtry
b4eb6b3d 12807
15b61c98
JH
12808: see if _ptr and _cnt from stdio act std
12809echo " "
b4eb6b3d 12810
15b61c98
JH
12811if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12812 echo "(Looks like you have stdio.h from BSD.)"
12813 case "$stdio_ptr" in
12814 '') stdio_ptr='((fp)->_p)'
12815 ptr_lval=$define
12816 ;;
12817 *) ptr_lval=$d_stdio_ptr_lval;;
12818 esac
12819 case "$stdio_cnt" in
12820 '') stdio_cnt='((fp)->_r)'
12821 cnt_lval=$define
12822 ;;
12823 *) cnt_lval=$d_stdio_cnt_lval;;
12824 esac
12825 case "$stdio_base" in
12826 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12827 esac
12828 case "$stdio_bufsiz" in
12829 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12830 esac
12831elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12832 echo "(Looks like you have stdio.h from Linux.)"
12833 case "$stdio_ptr" in
12834 '') stdio_ptr='((fp)->_IO_read_ptr)'
12835 ptr_lval=$define
12836 ;;
12837 *) ptr_lval=$d_stdio_ptr_lval;;
12838 esac
12839 case "$stdio_cnt" in
12840 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12841 cnt_lval=$undef
12842 ;;
12843 *) cnt_lval=$d_stdio_cnt_lval;;
12844 esac
12845 case "$stdio_base" in
12846 '') stdio_base='((fp)->_IO_read_base)';;
12847 esac
12848 case "$stdio_bufsiz" in
12849 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12850 esac
12851else
12852 case "$stdio_ptr" in
12853 '') stdio_ptr='((fp)->_ptr)'
12854 ptr_lval=$define
12855 ;;
12856 *) ptr_lval=$d_stdio_ptr_lval;;
12857 esac
12858 case "$stdio_cnt" in
12859 '') stdio_cnt='((fp)->_cnt)'
12860 cnt_lval=$define
12861 ;;
12862 *) cnt_lval=$d_stdio_cnt_lval;;
12863 esac
12864 case "$stdio_base" in
12865 '') stdio_base='((fp)->_base)';;
12866 esac
12867 case "$stdio_bufsiz" in
12868 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12869 esac
12870fi
b4eb6b3d 12871
15b61c98
JH
12872: test whether _ptr and _cnt really work
12873echo "Checking how std your stdio is..." >&4
12874$cat >try.c <<EOP
12875#include <stdio.h>
55954f19
JH
12876#$i_stdlib I_STDLIB
12877#ifdef I_STDLIB
9d9004a9 12878#include <stdlib.h>
55954f19 12879#endif
15b61c98
JH
12880#define FILE_ptr(fp) $stdio_ptr
12881#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12882int main() {
15b61c98
JH
12883 FILE *fp = fopen("try.c", "r");
12884 char c = getc(fp);
12885 if (
12886 18 <= FILE_cnt(fp) &&
12887 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12888 )
12889 exit(0);
12890 exit(1);
9d9004a9 12891}
15b61c98
JH
12892EOP
12893val="$undef"
12894set try
12895if eval $compile && $to try.c; then
12896 if $run ./try; then
12897 echo "Your stdio acts pretty std."
12898 val="$define"
9d9004a9 12899 else
15b61c98 12900 echo "Your stdio isn't very std."
9d9004a9 12901 fi
15b61c98
JH
12902else
12903 echo "Your stdio doesn't appear very std."
12904fi
5b813a60 12905$rm_try
15b61c98
JH
12906
12907# glibc 2.2.90 and above apparently change stdio streams so Perl's
12908# direct buffer manipulation no longer works. The Configure tests
12909# should be changed to correctly detect this, but until then,
12910# the following check should at least let perl compile and run.
12911# (This quick fix should be updated before 5.8.1.)
12912# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12913# A. Dougherty, June 3, 2002.
12914case "$d_gnulibc" in
12915$define)
12916 case "$gnulibc_version" in
12917 2.[01]*) ;;
12918 2.2) ;;
12919 2.2.[0-9]) ;;
12920 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12921 val="$undef"
12922 ;;
12923 esac
9d9004a9
AD
12924 ;;
12925esac
15b61c98 12926set d_stdstdio
9d9004a9 12927eval $setvar
9d9004a9 12928
15b61c98
JH
12929: Can _ptr be used as an lvalue?
12930case "$d_stdstdio$ptr_lval" in
12931$define$define) val=$define ;;
12932*) val=$undef ;;
12933esac
12934set d_stdio_ptr_lval
12935eval $setvar
9d9004a9 12936
15b61c98
JH
12937: Can _cnt be used as an lvalue?
12938case "$d_stdstdio$cnt_lval" in
12939$define$define) val=$define ;;
12940*) val=$undef ;;
12941esac
12942set d_stdio_cnt_lval
12943eval $setvar
b4eb6b3d 12944
15b61c98
JH
12945
12946: test whether setting _ptr sets _cnt as a side effect
12947d_stdio_ptr_lval_sets_cnt="$undef"
12948d_stdio_ptr_lval_nochange_cnt="$undef"
12949case "$d_stdio_ptr_lval$d_stdstdio" in
12950$define$define)
12951 echo "Checking to see what happens if we set the stdio ptr..." >&4
12952$cat >try.c <<EOP
12953#include <stdio.h>
12954/* Can we scream? */
12955/* Eat dust sed :-) */
12956/* In the buffer space, no one can hear you scream. */
55954f19
JH
12957#$i_stdlib I_STDLIB
12958#ifdef I_STDLIB
12959#include <stdlib.h>
12960#endif
15b61c98
JH
12961#define FILE_ptr(fp) $stdio_ptr
12962#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12963#include <sys/types.h>
b4eb6b3d 12964int main() {
15b61c98
JH
12965 FILE *fp = fopen("try.c", "r");
12966 int c;
12967 char *ptr;
12968 size_t cnt;
12969 if (!fp) {
12970 puts("Fail even to read");
12971 exit(1);
12972 }
12973 c = getc(fp); /* Read away the first # */
12974 if (c == EOF) {
12975 puts("Fail even to read");
12976 exit(1);
12977 }
12978 if (!(
12979 18 <= FILE_cnt(fp) &&
12980 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12981 )) {
12982 puts("Fail even to read");
12983 exit (1);
12984 }
12985 ptr = (char*) FILE_ptr(fp);
12986 cnt = (size_t)FILE_cnt(fp);
12987
12988 FILE_ptr(fp) += 42;
12989
12990 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12991 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12992 exit (1);
12993 }
12994 if (FILE_cnt(fp) <= 20) {
12995 printf ("Fail (<20 chars to test)");
12996 exit (1);
12997 }
12998 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12999 puts("Fail compare");
13000 exit (1);
13001 }
13002 if (cnt == FILE_cnt(fp)) {
13003 puts("Pass_unchanged");
13004 exit (0);
5b813a60 13005 }
15b61c98
JH
13006 if (FILE_cnt(fp) == (cnt - 42)) {
13007 puts("Pass_changed");
13008 exit (0);
13009 }
13010 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13011 return 1;
13012
13013}
13014EOP
13015 set try
13016 if eval $compile && $to try.c; then
13017 case `$run ./try` in
13018 Pass_changed)
13019 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
13020 d_stdio_ptr_lval_sets_cnt="$define" ;;
13021 Pass_unchanged)
13022 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
13023 d_stdio_ptr_lval_nochange_cnt="$define" ;;
13024 Fail*)
13025 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
13026 *)
13027 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13028 esac
13029 else
13030 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
13031 fi
5b813a60 13032 $rm_try
15b61c98
JH
13033 ;;
13034esac
13035
13036: see if _base is also standard
13037val="$undef"
13038case "$d_stdstdio" in
13039$define)
13040 $cat >try.c <<EOP
13041#include <stdio.h>
13042#$i_stdlib I_STDLIB
13043#ifdef I_STDLIB
13044#include <stdlib.h>
13045#endif
13046#define FILE_base(fp) $stdio_base
13047#define FILE_bufsiz(fp) $stdio_bufsiz
13048int main() {
13049 FILE *fp = fopen("try.c", "r");
13050 char c = getc(fp);
13051 if (
13052 19 <= FILE_bufsiz(fp) &&
13053 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13054 )
13055 exit(0);
13056 exit(1);
13057}
13058EOP
13059 set try
13060 if eval $compile && $to try.c; then
13061 if $run ./try; then
13062 echo "And its _base field acts std."
13063 val="$define"
13064 else
13065 echo "But its _base field isn't std."
13066 fi
13067 else
13068 echo "However, it seems to be lacking the _base field."
13069 fi
5b813a60 13070 $rm_try
15b61c98
JH
13071 ;;
13072esac
13073set d_stdiobase
13074eval $setvar
13075
13076: see if fast_stdio exists
13077val="$undef"
13078case "$d_stdstdio:$d_stdio_ptr_lval" in
13079"$define:$define")
13080 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13081 *$define*)
13082 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13083 val="$define"
13084 ;;
13085 esac
13086 ;;
13087esac
13088set d_faststdio
13089eval $setvar
13090
13091
13092
13093: see if fchdir exists
13094set fchdir d_fchdir
13095eval $inlibc
13096
13097: see if fchmod exists
13098set fchmod d_fchmod
13099eval $inlibc
13100
13101: see if fchown exists
13102set fchown d_fchown
13103eval $inlibc
13104
13105: see if this is an fcntl system
13106set fcntl d_fcntl
13107eval $inlibc
13108
15b61c98 13109: See if fcntl-based locking works.
613d6c3e 13110echo " "
15b61c98
JH
13111$cat >try.c <<EOCP
13112#$i_stdlib I_STDLIB
13113#ifdef I_STDLIB
13114#include <stdlib.h>
13115#endif
13116#include <unistd.h>
13117#include <fcntl.h>
13118#include <signal.h>
7090f861 13119$signal_t blech(int x) { exit(3); }
15b61c98
JH
13120int main() {
13121#if defined(F_SETLK) && defined(F_SETLKW)
13122 struct flock flock;
13123 int retval, fd;
13124 fd = open("try.c", O_RDONLY);
13125 flock.l_type = F_RDLCK;
13126 flock.l_whence = SEEK_SET;
13127 flock.l_start = flock.l_len = 0;
13128 signal(SIGALRM, blech);
13129 alarm(10);
13130 retval = fcntl(fd, F_SETLK, &flock);
13131 close(fd);
13132 (retval < 0 ? exit(2) : exit(0));
13133#else
13134 exit(2);
13135#endif
13136}
13137EOCP
13138echo "Checking if fcntl-based file locking works... "
13139case "$d_fcntl" in
13140"$define")
13141 set try
13142 if eval $compile_ok; then
13143 if $run ./try; then
13144 echo "Yes, it seems to work."
13145 val="$define"
13146 else
13147 echo "Nope, it didn't work."
13148 val="$undef"
13149 case "$?" in
13150 3) $cat >&4 <<EOM
13151***
13152*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13153*** This is (almost) impossible.
13154*** If your NFS lock daemons are not feeling well, something like
13155*** this may happen, please investigate. Cannot continue, aborting.
13156***
13157EOM
13158 exit 1
13159 ;;
13160 esac
13161 fi
13162 else
13163 echo "I'm unable to compile the test program, so I'll assume not."
13164 val="$undef"
13165 fi
13166 ;;
13167*) val="$undef";
13168 echo "Nope, since you don't even have fcntl()."
13169 ;;
13170esac
13171set d_fcntl_can_lock
13172eval $setvar
5b813a60 13173$rm_try
15b61c98
JH
13174
13175: check for fd_set items
13176$cat <<EOM
13177
13178Checking to see how well your C compiler handles fd_set and friends ...
13179EOM
13180$cat >try.c <<EOCP
13181#$i_stdlib I_STDLIB
13182#ifdef I_STDLIB
13183#include <stdlib.h>
13184#endif
13185#$i_systime I_SYS_TIME
13186#$i_sysselct I_SYS_SELECT
13187#$d_socket HAS_SOCKET
13188#include <sys/types.h>
13189#ifdef HAS_SOCKET
13190#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13191#endif
13192#ifdef I_SYS_TIME
13193#include <sys/time.h>
13194#endif
13195#ifdef I_SYS_SELECT
13196#include <sys/select.h>
13197#endif
13198int main() {
13199 fd_set fds;
13200
13201#ifdef TRYBITS
13202 if(fds.fds_bits);
13203#endif
13204
13205#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13206 exit(0);
13207#else
13208 exit(1);
13209#endif
13210}
13211EOCP
13212set try -DTRYBITS
13213if eval $compile; then
13214 d_fds_bits="$define"
13215 d_fd_set="$define"
13216 echo "Well, your system knows about the normal fd_set typedef..." >&4
13217 if $run ./try; then
b4eb6b3d
JH
13218 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13219 d_fd_macros="$define"
13220 else
13221 $cat >&4 <<'EOM'
13222but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13223EOM
13224 d_fd_macros="$undef"
13225 fi
13226else
13227 $cat <<'EOM'
13228Hmm, your compiler has some difficulty with fd_set. Checking further...
13229EOM
5440bc8e 13230 set try
b4eb6b3d
JH
13231 if eval $compile; then
13232 d_fds_bits="$undef"
13233 d_fd_set="$define"
13234 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 13235 if $run ./try; then
b4eb6b3d
JH
13236 echo "and you have the normal fd_set macros." >&4
13237 d_fd_macros="$define"
13238 else
13239 $cat <<'EOM'
13240but not the normal fd_set macros! Gross! More work for me...
13241EOM
13242 d_fd_macros="$undef"
13243 fi
13244 else
13245 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13246 d_fd_set="$undef"
13247 d_fds_bits="$undef"
13248 d_fd_macros="$undef"
13249 fi
13250fi
5b813a60 13251$rm_try
b4eb6b3d
JH
13252
13253: see if fgetpos exists
13254set fgetpos d_fgetpos
13255eval $inlibc
13256
758a5d79
JH
13257: see if finite exists
13258set finite d_finite
13259eval $inlibc
13260
13261: see if finitel exists
13262set finitel d_finitel
13263eval $inlibc
13264
b4eb6b3d
JH
13265: see if flock exists
13266set flock d_flock
13267eval $inlibc
13268
2ef53570
JH
13269: see if prototype for flock is available
13270echo " "
13271set d_flockproto flock $i_sysfile sys/file.h
13272eval $hasproto
13273
758a5d79
JH
13274: see if fp_class exists
13275set fp_class d_fp_class
13276eval $inlibc
13277
b4eb6b3d
JH
13278: see if pathconf exists
13279set pathconf d_pathconf
13280eval $inlibc
13281
13282: see if fpathconf exists
13283set fpathconf d_fpathconf
13284eval $inlibc
13285
758a5d79
JH
13286: see if fpclass exists
13287set fpclass d_fpclass
13288eval $inlibc
13289
13290: see if fpclassify exists
13291set fpclassify d_fpclassify
13292eval $inlibc
13293
13294: see if fpclassl exists
13295set fpclassl d_fpclassl
13296eval $inlibc
13297
b4eb6b3d
JH
13298: check for fpos64_t
13299echo " "
13300echo "Checking to see if you have fpos64_t..." >&4
13301$cat >try.c <<EOCP
13302#include <stdio.h>
13303int main() { fpos64_t x = 7; }
13304EOCP
13305set try
13306if eval $compile; then
13307 val="$define"
13308 echo "You have fpos64_t."
13309else
13310 val="$undef"
13311 echo "You do not have fpos64_t."
13312 case "$fpossize" in
13313 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13314 esac
13315fi
5b813a60 13316$rm_try
b4eb6b3d
JH
13317set d_fpos64_t
13318eval $setvar
13319
13320: see if frexpl exists
13321set frexpl d_frexpl
13322eval $inlibc
13323
b4eb6b3d
JH
13324: see if this is a sys/param system
13325set sys/param.h i_sysparam
13326eval $inhdr
13327
13328: see if this is a sys/mount.h system
13329set sys/mount.h i_sysmount
13330eval $inhdr
13331
34f1896b 13332: Check for fs_data_s
b4eb6b3d
JH
13333echo " "
13334echo "Checking to see if your system supports struct fs_data..." >&4
13335set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13336eval $hasstruct
13337case "$d_fs_data_s" in
13338"$define") echo "Yes, it does." ;;
13339*) echo "No, it doesn't." ;;
13340esac
13341
13342: see if fseeko exists
13343set fseeko d_fseeko
13344eval $inlibc
13345case "$longsize" in
133468) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13347esac
13348
13349: see if fsetpos exists
13350set fsetpos d_fsetpos
13351eval $inlibc
13352
b4eb6b3d
JH
13353: see if fstatfs exists
13354set fstatfs d_fstatfs
13355eval $inlibc
13356
b4eb6b3d
JH
13357: see if statvfs exists
13358set statvfs d_statvfs
13359eval $inlibc
13360
13361: see if fstatvfs exists
13362set fstatvfs d_fstatvfs
13363eval $inlibc
13364
13365
411ab01c
JH
13366: see if fsync exists
13367set fsync d_fsync
13368eval $inlibc
13369
b4eb6b3d
JH
13370: see if ftello exists
13371set ftello d_ftello
13372eval $inlibc
13373case "$longsize" in
133748) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13375esac
13376
bff98e24 13377: check for a working futimes
613d6c3e 13378d_futimes="$undef"
bff98e24 13379echo " "
5b813a60 13380echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13381$cat >try.c <<EOCP
13382#include <stdio.h>
13383#include <sys/time.h>
13384#include <errno.h>
13385#include <fcntl.h>
13386
13387int main ()
13388{
13389 int fd, rv;
13390 fd = open ("try.c", O_RDWR);
13391 if (-1 == fd) exit (1);
13392 rv = futimes (fd, NULL);
13393 exit (rv == -1 ? errno : 0);
13394}
13395EOCP
13396set try
13397if eval $compile; then
13398 `$run ./try`
13399 rc=$?
13400 case "$rc" in
5b813a60 13401 0) echo "Yes, you have" >&4
bff98e24
SP
13402 d_futimes="$define"
13403 ;;
5b813a60 13404 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13405 ;;
13406 esac
13407else
43dddb59 13408 echo "No, it does not (probably harmless)" >&4
bff98e24 13409fi
5b813a60 13410$rm_try
dc814df1 13411
e74475c7
MHM
13412: see if ndbm.h is available
13413set ndbm.h i_ndbm
13414eval $inhdr
13415: Compatibility location for RedHat 7.1
13416set gdbm/ndbm.h i_gdbmndbm
13417eval $inhdr
13418: Compatibility location for Debian 4.0
13419set gdbm-ndbm.h i_gdbm_ndbm
13420eval $inhdr
13421
13422val="$undef"
13423if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13424 : see if dbm_open exists
13425 set dbm_open d_dbm_open
13426 eval $inlibc
13427 case "$d_dbm_open" in
13428 $undef)
13429 i_ndbm="$undef"
13430 i_gdbmndbm="$undef"
13431 i_gdbm_ndbm="$undef"
13432 echo "We won't be including <ndbm.h>"
13433 val="$undef"
13434 ;;
13435 *) val="$define"
13436 ;;
13437 esac
13438fi
13439set d_ndbm
13440eval $setvar
13441
13442ndbm_hdr_protochk='name=$1; hdr=$2;
13443eval "ihdr=\$""i_$name";
13444val="$undef";
13445if $test "$ihdr" = "$define"; then
13446 $echo "Checking if your <$hdr> uses prototypes..." >&4;
13447 case "$d_cplusplus" in
13448 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13449 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13450 esac;
13451 case "$val" in
13452 $define) $echo "Your <$hdr> seems to have prototypes";;
13453 *) $echo "Your <$hdr> does not seem to have prototypes";;
13454 esac;
13455fi;
13456set "d_${name}_h_uses_prototypes";
13457eval $setvar'
13458
13459set ndbm ndbm.h
13460eval $ndbm_hdr_protochk
13461set gdbmndbm gdbm/ndbm.h
13462eval $ndbm_hdr_protochk
13463set gdbm_ndbm gdbm-ndbm.h
13464eval $ndbm_hdr_protochk
13465
5086dff9
MB
13466: see if getaddrinfo exists
13467set getaddrinfo d_getaddrinfo
13468eval $inlibc
13469
b4eb6b3d
JH
13470: see if getcwd exists
13471set getcwd d_getcwd
13472eval $inlibc
13473
13474: see if getespwnam exists
13475set getespwnam d_getespwnam
13476eval $inlibc
13477
b4eb6b3d
JH
13478: see if getfsstat exists
13479set getfsstat d_getfsstat
13480eval $inlibc
13481
13482: see if getgrent exists
13483set getgrent d_getgrent
13484eval $inlibc
13485
10bc17b6
JH
13486: see if getgrent_r exists
13487set getgrent_r d_getgrent_r
13488eval $inlibc
13489case "$d_getgrent_r" in
13490"$define")
13491 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13492 case "$d_getgrent_r_proto:$usethreads" in
13493 ":define") d_getgrent_r_proto=define
a48ec845
JH
13494 set d_getgrent_r_proto getgrent_r $hdrs
13495 eval $hasproto ;;
13496 *) ;;
13497 esac
13498 case "$d_getgrent_r_proto" in
13499 define)
10bc17b6
JH
13500 case "$getgrent_r_proto" in
13501 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
61c26d18 13502 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
10bc17b6
JH
13503 esac
13504 case "$getgrent_r_proto" in
13505 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
61c26d18 13506 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
10bc17b6
JH
13507 esac
13508 case "$getgrent_r_proto" in
13509 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
61c26d18 13510 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
10bc17b6
JH
13511 esac
13512 case "$getgrent_r_proto" in
13513 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
61c26d18 13514 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
10bc17b6
JH
13515 esac
13516 case "$getgrent_r_proto" in
13517 ''|0) try='int getgrent_r(struct group*, char*, int);'
61c26d18 13518 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
10bc17b6
JH
13519 esac
13520 case "$getgrent_r_proto" in
13521 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
61c26d18 13522 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
10bc17b6
JH
13523 esac
13524 case "$getgrent_r_proto" in
90e831dc 13525 ''|0) d_getgrent_r=undef
10bc17b6 13526 getgrent_r_proto=0
a48ec845 13527 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13528 * ) case "$getgrent_r_proto" in
13529 REENTRANT_PROTO*) ;;
13530 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13531 esac
13532 echo "Prototype: $try" ;;
13533 esac
13534 ;;
c18e646a
JH
13535 *) case "$usethreads" in
13536 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13537 esac
90e831dc
SB
13538 d_getgrent_r=undef
13539 getgrent_r_proto=0
c18e646a 13540 ;;
a48ec845
JH
13541 esac
13542 ;;
10bc17b6
JH
13543*) getgrent_r_proto=0
13544 ;;
13545esac
13546
13547: see if getgrgid_r exists
13548set getgrgid_r d_getgrgid_r
13549eval $inlibc
13550case "$d_getgrgid_r" in
13551"$define")
13552 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13553 case "$d_getgrgid_r_proto:$usethreads" in
13554 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13555 set d_getgrgid_r_proto getgrgid_r $hdrs
13556 eval $hasproto ;;
13557 *) ;;
13558 esac
13559 case "$d_getgrgid_r_proto" in
13560 define)
10bc17b6
JH
13561 case "$getgrgid_r_proto" in
13562 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
61c26d18 13563 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
10bc17b6
JH
13564 esac
13565 case "$getgrgid_r_proto" in
13566 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
61c26d18 13567 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
10bc17b6
JH
13568 esac
13569 case "$getgrgid_r_proto" in
13570 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13571 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
10bc17b6
JH
13572 esac
13573 case "$getgrgid_r_proto" in
13574 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13575 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
10bc17b6
JH
13576 esac
13577 case "$getgrgid_r_proto" in
90e831dc 13578 ''|0) d_getgrgid_r=undef
10bc17b6 13579 getgrgid_r_proto=0
a48ec845 13580 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13581 * ) case "$getgrgid_r_proto" in
13582 REENTRANT_PROTO*) ;;
13583 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13584 esac
13585 echo "Prototype: $try" ;;
13586 esac
13587 ;;
c18e646a
JH
13588 *) case "$usethreads" in
13589 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13590 esac
90e831dc
SB
13591 d_getgrgid_r=undef
13592 getgrgid_r_proto=0
c18e646a 13593 ;;
a48ec845
JH
13594 esac
13595 ;;
10bc17b6
JH
13596*) getgrgid_r_proto=0
13597 ;;
13598esac
13599
13600: see if getgrnam_r exists
13601set getgrnam_r d_getgrnam_r
13602eval $inlibc
13603case "$d_getgrnam_r" in
13604"$define")
13605 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13606 case "$d_getgrnam_r_proto:$usethreads" in
13607 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13608 set d_getgrnam_r_proto getgrnam_r $hdrs
13609 eval $hasproto ;;
13610 *) ;;
13611 esac
13612 case "$d_getgrnam_r_proto" in
13613 define)
10bc17b6
JH
13614 case "$getgrnam_r_proto" in
13615 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
61c26d18 13616 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
10bc17b6
JH
13617 esac
13618 case "$getgrnam_r_proto" in
13619 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
61c26d18 13620 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
10bc17b6
JH
13621 esac
13622 case "$getgrnam_r_proto" in
13623 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
61c26d18 13624 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
10bc17b6
JH
13625 esac
13626 case "$getgrnam_r_proto" in
13627 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13628 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
10bc17b6
JH
13629 esac
13630 case "$getgrnam_r_proto" in
13631 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13632 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
10bc17b6
JH
13633 esac
13634 case "$getgrnam_r_proto" in
90e831dc 13635 ''|0) d_getgrnam_r=undef
10bc17b6 13636 getgrnam_r_proto=0
a48ec845 13637 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13638 * ) case "$getgrnam_r_proto" in
13639 REENTRANT_PROTO*) ;;
13640 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13641 esac
13642 echo "Prototype: $try" ;;
13643 esac
13644 ;;
c18e646a
JH
13645 *) case "$usethreads" in
13646 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13647 esac
90e831dc
SB
13648 d_getgrnam_r=undef
13649 getgrnam_r_proto=0
c18e646a 13650 ;;
a48ec845
JH
13651 esac
13652 ;;
10bc17b6
JH
13653*) getgrnam_r_proto=0
13654 ;;
13655esac
13656
b4eb6b3d
JH
13657: see if gethostbyaddr exists
13658set gethostbyaddr d_gethbyaddr
13659eval $inlibc
13660
13661: see if gethostbyname exists
13662set gethostbyname d_gethbyname
13663eval $inlibc
13664
13665: see if gethostent exists
13666set gethostent d_gethent
13667eval $inlibc
13668
13669: see how we will look up host name
13670echo " "
13671call=''
13672if set gethostname val -f d_gethname; eval $csym; $val; then
13673 echo 'gethostname() found.' >&4
13674 d_gethname="$define"
13675 call=gethostname
13676fi
13677if set uname val -f d_uname; eval $csym; $val; then
13678 if ./xenix; then
13679 $cat <<'EOM'
13680uname() was found, but you're running xenix, and older versions of xenix
13681have a broken uname(). If you don't really know whether your xenix is old
13682enough to have a broken system call, use the default answer.
13683
13684EOM
13685 dflt=y
13686 case "$d_uname" in
13687 "$define") dflt=n;;
13688 esac
13689 rp='Is your uname() broken?'
13690 . ./myread
13691 case "$ans" in
13692 n*) d_uname="$define"; call=uname;;
13693 esac
13694 else
13695 echo 'uname() found.' >&4
13696 d_uname="$define"
13697 case "$call" in
13698 '') call=uname ;;
13699 esac
13700 fi
13701fi
13702case "$d_gethname" in
13703'') d_gethname="$undef";;
13704esac
13705case "$d_uname" in
13706'') d_uname="$undef";;
13707esac
13708case "$d_uname$d_gethname" in
13709*define*)
13710 dflt=n
13711 cat <<EOM
613d6c3e 13712
b4eb6b3d
JH
13713Every now and then someone has a $call() that lies about the hostname
13714but can't be fixed for political or economic reasons. If you wish, I can
13715pretend $call() isn't there and maybe compute hostname at run-time
13716thanks to the '$phostname' command.
13717
13718EOM
13719 rp="Shall I ignore $call() from now on?"
13720 . ./myread
13721 case "$ans" in
13722 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13723 esac;;
13724esac
13725case "$phostname" in
13726'') aphostname='';;
13727*) case "$aphostname" in
13728 /*) ;;
13729 *) set X $phostname
13730 shift
13731 file=$1
13732 shift
13733 file=`./loc $file $file $pth`
13734 aphostname=`echo $file $*`
13735 ;;
13736 esac
13737 ;;
13738esac
13739case "$d_uname$d_gethname" in
13740*define*) ;;
13741*)
13742 case "$phostname" in
13743 '')
13744 echo "There will be no way for $package to get your hostname." >&4;;
13745 *)
13746 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13747 ;;
13748 esac;;
13749esac
13750case "$d_phostname" in
13751'') d_phostname="$undef";;
13752esac
13753
10bc17b6
JH
13754: see if gethostbyaddr_r exists
13755set gethostbyaddr_r d_gethostbyaddr_r
13756eval $inlibc
13757case "$d_gethostbyaddr_r" in
13758"$define")
13759 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13760 case "$d_gethostbyaddr_r_proto:$usethreads" in
13761 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13762 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13763 eval $hasproto ;;
13764 *) ;;
13765 esac
13766 case "$d_gethostbyaddr_r_proto" in
13767 define)
10bc17b6
JH
13768 case "$gethostbyaddr_r_proto" in
13769 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13770 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
10bc17b6
JH
13771 esac
13772 case "$gethostbyaddr_r_proto" in
13773 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
61c26d18 13774 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
10bc17b6
JH
13775 esac
13776 case "$gethostbyaddr_r_proto" in
13777 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13778 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
10bc17b6
JH
13779 esac
13780 case "$gethostbyaddr_r_proto" in
13781 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13782 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
10bc17b6
JH
13783 esac
13784 case "$gethostbyaddr_r_proto" in
13785 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
61c26d18 13786 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
10bc17b6
JH
13787 esac
13788 case "$gethostbyaddr_r_proto" in
13789 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13790 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
10bc17b6
JH
13791 esac
13792 case "$gethostbyaddr_r_proto" in
13793 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
61c26d18 13794 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
10bc17b6
JH
13795 esac
13796 case "$gethostbyaddr_r_proto" in
13797 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
61c26d18 13798 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
10bc17b6
JH
13799 esac
13800 case "$gethostbyaddr_r_proto" in
13801 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
61c26d18 13802 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
10bc17b6
JH
13803 esac
13804 case "$gethostbyaddr_r_proto" in
13805 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
61c26d18 13806 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
10bc17b6
JH
13807 esac
13808 case "$gethostbyaddr_r_proto" in
a845a0d4 13809 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13810 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
a845a0d4
JH
13811 esac
13812 case "$gethostbyaddr_r_proto" in
90e831dc 13813 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13814 gethostbyaddr_r_proto=0
a48ec845 13815 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13816 * ) case "$gethostbyaddr_r_proto" in
13817 REENTRANT_PROTO*) ;;
13818 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13819 esac
13820 echo "Prototype: $try" ;;
13821 esac
13822 ;;
c18e646a
JH
13823 *) case "$usethreads" in
13824 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13825 esac
90e831dc
SB
13826 d_gethostbyaddr_r=undef
13827 gethostbyaddr_r_proto=0
c18e646a 13828 ;;
a48ec845
JH
13829 esac
13830 ;;
10bc17b6
JH
13831*) gethostbyaddr_r_proto=0
13832 ;;
13833esac
13834
13835: see if gethostbyname_r exists
13836set gethostbyname_r d_gethostbyname_r
13837eval $inlibc
13838case "$d_gethostbyname_r" in
13839"$define")
13840 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13841 case "$d_gethostbyname_r_proto:$usethreads" in
13842 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13843 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13844 eval $hasproto ;;
13845 *) ;;
13846 esac
13847 case "$d_gethostbyname_r_proto" in
13848 define)
10bc17b6
JH
13849 case "$gethostbyname_r_proto" in
13850 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13851 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
13852 esac
13853 case "$gethostbyname_r_proto" in
13854 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13855 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
10bc17b6
JH
13856 esac
13857 case "$gethostbyname_r_proto" in
13858 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
61c26d18 13859 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
10bc17b6
JH
13860 esac
13861 case "$gethostbyname_r_proto" in
90e831dc 13862 ''|0) d_gethostbyname_r=undef
10bc17b6 13863 gethostbyname_r_proto=0
a48ec845 13864 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13865 * ) case "$gethostbyname_r_proto" in
13866 REENTRANT_PROTO*) ;;
13867 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13868 esac
13869 echo "Prototype: $try" ;;
13870 esac
13871 ;;
c18e646a
JH
13872 *) case "$usethreads" in
13873 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13874 esac
90e831dc
SB
13875 d_gethostbyname_r=undef
13876 gethostbyname_r_proto=0
c18e646a 13877 ;;
a48ec845
JH
13878 esac
13879 ;;
10bc17b6
JH
13880*) gethostbyname_r_proto=0
13881 ;;
13882esac
13883
13884: see if gethostent_r exists
13885set gethostent_r d_gethostent_r
13886eval $inlibc
13887case "$d_gethostent_r" in
13888"$define")
13889 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13890 case "$d_gethostent_r_proto:$usethreads" in
13891 ":define") d_gethostent_r_proto=define
a48ec845
JH
13892 set d_gethostent_r_proto gethostent_r $hdrs
13893 eval $hasproto ;;
13894 *) ;;
13895 esac
13896 case "$d_gethostent_r_proto" in
13897 define)
10bc17b6
JH
13898 case "$gethostent_r_proto" in
13899 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13900 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
10bc17b6
JH
13901 esac
13902 case "$gethostent_r_proto" in
13903 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13904 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
10bc17b6
JH
13905 esac
13906 case "$gethostent_r_proto" in
13907 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13908 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
10bc17b6
JH
13909 esac
13910 case "$gethostent_r_proto" in
13911 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
61c26d18 13912 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
10bc17b6
JH
13913 esac
13914 case "$gethostent_r_proto" in
13915 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
61c26d18 13916 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
10bc17b6
JH
13917 esac
13918 case "$gethostent_r_proto" in
13919 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
61c26d18 13920 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
10bc17b6
JH
13921 esac
13922 case "$gethostent_r_proto" in
90e831dc 13923 ''|0) d_gethostent_r=undef
10bc17b6 13924 gethostent_r_proto=0
a48ec845 13925 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13926 * ) case "$gethostent_r_proto" in
13927 REENTRANT_PROTO*) ;;
13928 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13929 esac
13930 echo "Prototype: $try" ;;
13931 esac
13932 ;;
c18e646a
JH
13933 *) case "$usethreads" in
13934 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13935 esac
90e831dc
SB
13936 d_gethostent_r=undef
13937 gethostent_r_proto=0
c18e646a 13938 ;;
a48ec845
JH
13939 esac
13940 ;;
10bc17b6
JH
13941*) gethostent_r_proto=0
13942 ;;
13943esac
b4eb6b3d
JH
13944
13945: see if prototypes for various gethostxxx netdb.h functions are available
13946echo " "
13947set d_gethostprotos gethostent $i_netdb netdb.h
13948eval $hasproto
13949
4e0554ec
JH
13950: see if getitimer exists
13951set getitimer d_getitimer
13952eval $inlibc
13953
b4eb6b3d
JH
13954: see if getlogin exists
13955set getlogin d_getlogin
13956eval $inlibc
13957
10bc17b6
JH
13958: see if getlogin_r exists
13959set getlogin_r d_getlogin_r
13960eval $inlibc
13961case "$d_getlogin_r" in
13962"$define")
13963 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13964 case "$d_getlogin_r_proto:$usethreads" in
13965 ":define") d_getlogin_r_proto=define
a48ec845
JH
13966 set d_getlogin_r_proto getlogin_r $hdrs
13967 eval $hasproto ;;
13968 *) ;;
13969 esac
13970 case "$d_getlogin_r_proto" in
13971 define)
10bc17b6
JH
13972 case "$getlogin_r_proto" in
13973 ''|0) try='int getlogin_r(char*, size_t);'
61c26d18 13974 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
10bc17b6
JH
13975 esac
13976 case "$getlogin_r_proto" in
13977 ''|0) try='int getlogin_r(char*, int);'
61c26d18 13978 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
10bc17b6
JH
13979 esac
13980 case "$getlogin_r_proto" in
13981 ''|0) try='char* getlogin_r(char*, size_t);'
61c26d18 13982 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
10bc17b6
JH
13983 esac
13984 case "$getlogin_r_proto" in
13985 ''|0) try='char* getlogin_r(char*, int);'
61c26d18 13986 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
10bc17b6
JH
13987 esac
13988 case "$getlogin_r_proto" in
90e831dc 13989 ''|0) d_getlogin_r=undef
10bc17b6 13990 getlogin_r_proto=0
a48ec845 13991 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13992 * ) case "$getlogin_r_proto" in
13993 REENTRANT_PROTO*) ;;
13994 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13995 esac
13996 echo "Prototype: $try" ;;
13997 esac
13998 ;;
c18e646a
JH
13999 *) case "$usethreads" in
14000 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14001 esac
90e831dc
SB
14002 d_getlogin_r=undef
14003 getlogin_r_proto=0
c18e646a 14004 ;;
a48ec845
JH
14005 esac
14006 ;;
10bc17b6
JH
14007*) getlogin_r_proto=0
14008 ;;
14009esac
14010
b4eb6b3d
JH
14011: see if getmnt exists
14012set getmnt d_getmnt
14013eval $inlibc
14014
14015: see if getmntent exists
14016set getmntent d_getmntent
14017eval $inlibc
14018
5086dff9
MB
14019: see if getnameinfo exists
14020set getnameinfo d_getnameinfo
14021eval $inlibc
14022
b4eb6b3d
JH
14023: see if getnetbyaddr exists
14024set getnetbyaddr d_getnbyaddr
14025eval $inlibc
14026
14027: see if getnetbyname exists
14028set getnetbyname d_getnbyname
14029eval $inlibc
14030
14031: see if getnetent exists
14032set getnetent d_getnent
14033eval $inlibc
14034
10bc17b6
JH
14035: see if getnetbyaddr_r exists
14036set getnetbyaddr_r d_getnetbyaddr_r
14037eval $inlibc
14038case "$d_getnetbyaddr_r" in
14039"$define")
14040 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14041 case "$d_getnetbyaddr_r_proto:$usethreads" in
14042 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
14043 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14044 eval $hasproto ;;
14045 *) ;;
14046 esac
14047 case "$d_getnetbyaddr_r_proto" in
14048 define)
10bc17b6
JH
14049 case "$getnetbyaddr_r_proto" in
14050 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14051 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
10bc17b6
JH
14052 esac
14053 case "$getnetbyaddr_r_proto" in
14054 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14055 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
10bc17b6
JH
14056 esac
14057 case "$getnetbyaddr_r_proto" in
14058 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
61c26d18 14059 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
10bc17b6
JH
14060 esac
14061 case "$getnetbyaddr_r_proto" in
14062 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14063 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
10bc17b6
JH
14064 esac
14065 case "$getnetbyaddr_r_proto" in
14066 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
61c26d18 14067 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
10bc17b6
JH
14068 esac
14069 case "$getnetbyaddr_r_proto" in
14070 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
61c26d18 14071 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
10bc17b6
JH
14072 esac
14073 case "$getnetbyaddr_r_proto" in
14074 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
61c26d18 14075 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
10bc17b6
JH
14076 esac
14077 case "$getnetbyaddr_r_proto" in
a845a0d4 14078 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14079 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
a845a0d4
JH
14080 esac
14081 case "$getnetbyaddr_r_proto" in
90e831dc 14082 ''|0) d_getnetbyaddr_r=undef
10bc17b6 14083 getnetbyaddr_r_proto=0
a48ec845 14084 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14085 * ) case "$getnetbyaddr_r_proto" in
14086 REENTRANT_PROTO*) ;;
14087 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14088 esac
14089 echo "Prototype: $try" ;;
14090 esac
14091 ;;
c18e646a
JH
14092 *) case "$usethreads" in
14093 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14094 esac
90e831dc
SB
14095 d_getnetbyaddr_r=undef
14096 getnetbyaddr_r_proto=0
c18e646a 14097 ;;
a48ec845
JH
14098 esac
14099 ;;
10bc17b6
JH
14100*) getnetbyaddr_r_proto=0
14101 ;;
14102esac
14103
14104: see if getnetbyname_r exists
14105set getnetbyname_r d_getnetbyname_r
14106eval $inlibc
14107case "$d_getnetbyname_r" in
14108"$define")
14109 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14110 case "$d_getnetbyname_r_proto:$usethreads" in
14111 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
14112 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14113 eval $hasproto ;;
14114 *) ;;
14115 esac
14116 case "$d_getnetbyname_r_proto" in
14117 define)
10bc17b6
JH
14118 case "$getnetbyname_r_proto" in
14119 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14120 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
14121 esac
14122 case "$getnetbyname_r_proto" in
14123 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14124 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
10bc17b6
JH
14125 esac
14126 case "$getnetbyname_r_proto" in
14127 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14128 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
10bc17b6
JH
14129 esac
14130 case "$getnetbyname_r_proto" in
14131 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
61c26d18 14132 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
10bc17b6
JH
14133 esac
14134 case "$getnetbyname_r_proto" in
90e831dc 14135 ''|0) d_getnetbyname_r=undef
10bc17b6 14136 getnetbyname_r_proto=0
a48ec845 14137 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14138 * ) case "$getnetbyname_r_proto" in
14139 REENTRANT_PROTO*) ;;
14140 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14141 esac
14142 echo "Prototype: $try" ;;
14143 esac
14144 ;;
c18e646a
JH
14145 *) case "$usethreads" in
14146 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14147 esac
90e831dc
SB
14148 d_getnetbyname_r=undef
14149 getnetbyname_r_proto=0
c18e646a 14150 ;;
a48ec845
JH
14151 esac
14152 ;;
10bc17b6
JH
14153*) getnetbyname_r_proto=0
14154 ;;
14155esac
14156
14157: see if getnetent_r exists
14158set getnetent_r d_getnetent_r
14159eval $inlibc
14160case "$d_getnetent_r" in
14161"$define")
14162 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14163 case "$d_getnetent_r_proto:$usethreads" in
14164 ":define") d_getnetent_r_proto=define
a48ec845
JH
14165 set d_getnetent_r_proto getnetent_r $hdrs
14166 eval $hasproto ;;
14167 *) ;;
14168 esac
14169 case "$d_getnetent_r_proto" in
14170 define)
10bc17b6
JH
14171 case "$getnetent_r_proto" in
14172 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14173 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
10bc17b6
JH
14174 esac
14175 case "$getnetent_r_proto" in
14176 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14177 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
10bc17b6
JH
14178 esac
14179 case "$getnetent_r_proto" in
14180 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14181 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
10bc17b6
JH
14182 esac
14183 case "$getnetent_r_proto" in
14184 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
61c26d18 14185 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
10bc17b6
JH
14186 esac
14187 case "$getnetent_r_proto" in
14188 ''|0) try='int getnetent_r(struct netent*, char*, int);'
61c26d18 14189 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
10bc17b6
JH
14190 esac
14191 case "$getnetent_r_proto" in
14192 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
61c26d18 14193 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
10bc17b6
JH
14194 esac
14195 case "$getnetent_r_proto" in
90e831dc 14196 ''|0) d_getnetent_r=undef
10bc17b6 14197 getnetent_r_proto=0
a48ec845 14198 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14199 * ) case "$getnetent_r_proto" in
14200 REENTRANT_PROTO*) ;;
14201 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14202 esac
14203 echo "Prototype: $try" ;;
14204 esac
14205 ;;
c18e646a
JH
14206 *) case "$usethreads" in
14207 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14208 esac
90e831dc
SB
14209 d_getnetent_r=undef
14210 getnetent_r_proto=0
c18e646a 14211 ;;
a48ec845
JH
14212 esac
14213 ;;
10bc17b6
JH
14214*) getnetent_r_proto=0
14215 ;;
14216esac
14217
b4eb6b3d
JH
14218: see if prototypes for various getnetxxx netdb.h functions are available
14219echo " "
14220set d_getnetprotos getnetent $i_netdb netdb.h
14221eval $hasproto
14222
0c0643d0
JH
14223: see if getpagesize exists
14224set getpagesize d_getpagsz
14225eval $inlibc
14226
34f1896b 14227: Optional checks for getprotobyname and getprotobynumber
b4eb6b3d
JH
14228
14229: see if getprotobyname exists
14230set getprotobyname d_getpbyname
14231eval $inlibc
14232
14233: see if getprotobynumber exists
14234set getprotobynumber d_getpbynumber
14235eval $inlibc
14236
14237: see if getprotoent exists
14238set getprotoent d_getpent
14239eval $inlibc
14240
14241: see if getpgid exists
14242set getpgid d_getpgid
14243eval $inlibc
14244
14245: see if getpgrp2 exists
14246set getpgrp2 d_getpgrp2
14247eval $inlibc
14248
14249: see if getppid exists
14250set getppid d_getppid
14251eval $inlibc
14252
14253: see if getpriority exists
14254set getpriority d_getprior
14255eval $inlibc
14256
10bc17b6
JH
14257: see if getprotobyname_r exists
14258set getprotobyname_r d_getprotobyname_r
14259eval $inlibc
14260case "$d_getprotobyname_r" in
14261"$define")
14262 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14263 case "$d_getprotobyname_r_proto:$usethreads" in
14264 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
14265 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14266 eval $hasproto ;;
14267 *) ;;
14268 esac
14269 case "$d_getprotobyname_r_proto" in
14270 define)
10bc17b6
JH
14271 case "$getprotobyname_r_proto" in
14272 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14273 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
10bc17b6
JH
14274 esac
14275 case "$getprotobyname_r_proto" in
14276 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
61c26d18 14277 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
10bc17b6
JH
14278 esac
14279 case "$getprotobyname_r_proto" in
14280 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
61c26d18 14281 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
10bc17b6
JH
14282 esac
14283 case "$getprotobyname_r_proto" in
90e831dc 14284 ''|0) d_getprotobyname_r=undef
10bc17b6 14285 getprotobyname_r_proto=0
a48ec845 14286 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14287 * ) case "$getprotobyname_r_proto" in
14288 REENTRANT_PROTO*) ;;
14289 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14290 esac
14291 echo "Prototype: $try" ;;
14292 esac
14293 ;;
c18e646a
JH
14294 *) case "$usethreads" in
14295 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14296 esac
90e831dc
SB
14297 d_getprotobyname_r=undef
14298 getprotobyname_r_proto=0
c18e646a 14299 ;;
a48ec845
JH
14300 esac
14301 ;;
10bc17b6
JH
14302*) getprotobyname_r_proto=0
14303 ;;
14304esac
14305
14306: see if getprotobynumber_r exists
14307set getprotobynumber_r d_getprotobynumber_r
14308eval $inlibc
14309case "$d_getprotobynumber_r" in
14310"$define")
14311 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14312 case "$d_getprotobynumber_r_proto:$usethreads" in
14313 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
14314 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14315 eval $hasproto ;;
14316 *) ;;
14317 esac
14318 case "$d_getprotobynumber_r_proto" in
14319 define)
10bc17b6
JH
14320 case "$getprotobynumber_r_proto" in
14321 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14322 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
10bc17b6
JH
14323 esac
14324 case "$getprotobynumber_r_proto" in
14325 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
61c26d18 14326 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
10bc17b6
JH
14327 esac
14328 case "$getprotobynumber_r_proto" in
14329 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
61c26d18 14330 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
10bc17b6
JH
14331 esac
14332 case "$getprotobynumber_r_proto" in
90e831dc 14333 ''|0) d_getprotobynumber_r=undef
10bc17b6 14334 getprotobynumber_r_proto=0
a48ec845 14335 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14336 * ) case "$getprotobynumber_r_proto" in
14337 REENTRANT_PROTO*) ;;
14338 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14339 esac
14340 echo "Prototype: $try" ;;
14341 esac
14342 ;;
c18e646a
JH
14343 *) case "$usethreads" in
14344 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14345 esac
90e831dc
SB
14346 d_getprotobynumber_r=undef
14347 getprotobynumber_r_proto=0
c18e646a 14348 ;;
a48ec845
JH
14349 esac
14350 ;;
10bc17b6
JH
14351*) getprotobynumber_r_proto=0
14352 ;;
14353esac
14354
14355: see if getprotoent_r exists
14356set getprotoent_r d_getprotoent_r
14357eval $inlibc
14358case "$d_getprotoent_r" in
14359"$define")
14360 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14361 case "$d_getprotoent_r_proto:$usethreads" in
14362 ":define") d_getprotoent_r_proto=define
a48ec845
JH
14363 set d_getprotoent_r_proto getprotoent_r $hdrs
14364 eval $hasproto ;;
14365 *) ;;
14366 esac
14367 case "$d_getprotoent_r_proto" in
14368 define)
10bc17b6
JH
14369 case "$getprotoent_r_proto" in
14370 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14371 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
10bc17b6
JH
14372 esac
14373 case "$getprotoent_r_proto" in
14374 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
61c26d18 14375 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
10bc17b6
JH
14376 esac
14377 case "$getprotoent_r_proto" in
14378 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
61c26d18 14379 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
10bc17b6
JH
14380 esac
14381 case "$getprotoent_r_proto" in
14382 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
61c26d18 14383 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
10bc17b6
JH
14384 esac
14385 case "$getprotoent_r_proto" in
90e831dc 14386 ''|0) d_getprotoent_r=undef
10bc17b6 14387 getprotoent_r_proto=0
a48ec845 14388 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14389 * ) case "$getprotoent_r_proto" in
14390 REENTRANT_PROTO*) ;;
14391 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14392 esac
14393 echo "Prototype: $try" ;;
14394 esac
14395 ;;
c18e646a
JH
14396 *) case "$usethreads" in
14397 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14398 esac
90e831dc
SB
14399 d_getprotoent_r=undef
14400 getprotoent_r_proto=0
c18e646a 14401 ;;
a48ec845
JH
14402 esac
14403 ;;
10bc17b6
JH
14404*) getprotoent_r_proto=0
14405 ;;
14406esac
14407
b4eb6b3d
JH
14408: see if prototypes for various getprotoxxx netdb.h functions are available
14409echo " "
14410set d_getprotoprotos getprotoent $i_netdb netdb.h
14411eval $hasproto
14412
14413: see if getprpwnam exists
14414set getprpwnam d_getprpwnam
14415eval $inlibc
14416
14417: see if getpwent exists
14418set getpwent d_getpwent
14419eval $inlibc
14420
10bc17b6
JH
14421: see if getpwent_r exists
14422set getpwent_r d_getpwent_r
14423eval $inlibc
14424case "$d_getpwent_r" in
14425"$define")
14426 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14427 case "$d_getpwent_r_proto:$usethreads" in
14428 ":define") d_getpwent_r_proto=define
a48ec845
JH
14429 set d_getpwent_r_proto getpwent_r $hdrs
14430 eval $hasproto ;;
14431 *) ;;
14432 esac
14433 case "$d_getpwent_r_proto" in
14434 define)
10bc17b6
JH
14435 case "$getpwent_r_proto" in
14436 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14437 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
10bc17b6
JH
14438 esac
14439 case "$getpwent_r_proto" in
14440 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
61c26d18 14441 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
10bc17b6
JH
14442 esac
14443 case "$getpwent_r_proto" in
14444 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
61c26d18 14445 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
10bc17b6
JH
14446 esac
14447 case "$getpwent_r_proto" in
14448 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
61c26d18 14449 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
10bc17b6
JH
14450 esac
14451 case "$getpwent_r_proto" in
14452 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
61c26d18 14453 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
10bc17b6
JH
14454 esac
14455 case "$getpwent_r_proto" in
14456 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
61c26d18 14457 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
10bc17b6
JH
14458 esac
14459 case "$getpwent_r_proto" in
90e831dc 14460 ''|0) d_getpwent_r=undef
10bc17b6 14461 getpwent_r_proto=0
a48ec845 14462 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14463 * ) case "$getpwent_r_proto" in
14464 REENTRANT_PROTO*) ;;
14465 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14466 esac
14467 echo "Prototype: $try" ;;
14468 esac
14469 ;;
c18e646a
JH
14470 *) case "$usethreads" in
14471 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14472 esac
90e831dc
SB
14473 d_getpwent_r=undef
14474 getpwent_r_proto=0
c18e646a 14475 ;;
a48ec845
JH
14476 esac
14477 ;;
10bc17b6
JH
14478*) getpwent_r_proto=0
14479 ;;
14480esac
14481
14482: see if getpwnam_r exists
14483set getpwnam_r d_getpwnam_r
14484eval $inlibc
14485case "$d_getpwnam_r" in
14486"$define")
14487 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14488 case "$d_getpwnam_r_proto:$usethreads" in
14489 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14490 set d_getpwnam_r_proto getpwnam_r $hdrs
14491 eval $hasproto ;;
14492 *) ;;
14493 esac
14494 case "$d_getpwnam_r_proto" in
14495 define)
10bc17b6
JH
14496 case "$getpwnam_r_proto" in
14497 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14498 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14499 esac
14500 case "$getpwnam_r_proto" in
14501 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
61c26d18 14502 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
10bc17b6
JH
14503 esac
14504 case "$getpwnam_r_proto" in
14505 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14506 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
10bc17b6
JH
14507 esac
14508 case "$getpwnam_r_proto" in
14509 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14510 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
10bc17b6
JH
14511 esac
14512 case "$getpwnam_r_proto" in
90e831dc 14513 ''|0) d_getpwnam_r=undef
10bc17b6 14514 getpwnam_r_proto=0
a48ec845 14515 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14516 * ) case "$getpwnam_r_proto" in
14517 REENTRANT_PROTO*) ;;
14518 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14519 esac
14520 echo "Prototype: $try" ;;
14521 esac
14522 ;;
c18e646a
JH
14523 *) case "$usethreads" in
14524 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14525 esac
90e831dc
SB
14526 d_getpwnam_r=undef
14527 getpwnam_r_proto=0
c18e646a 14528 ;;
a48ec845
JH
14529 esac
14530 ;;
10bc17b6
JH
14531*) getpwnam_r_proto=0
14532 ;;
14533esac
14534
14535: see if getpwuid_r exists
14536set getpwuid_r d_getpwuid_r
14537eval $inlibc
14538case "$d_getpwuid_r" in
14539"$define")
14540 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14541 case "$d_getpwuid_r_proto:$usethreads" in
14542 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14543 set d_getpwuid_r_proto getpwuid_r $hdrs
14544 eval $hasproto ;;
14545 *) ;;
14546 esac
14547 case "$d_getpwuid_r_proto" in
14548 define)
10bc17b6
JH
14549 case "$getpwuid_r_proto" in
14550 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14551 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
10bc17b6
JH
14552 esac
14553 case "$getpwuid_r_proto" in
14554 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
61c26d18 14555 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
10bc17b6
JH
14556 esac
14557 case "$getpwuid_r_proto" in
14558 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14559 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
10bc17b6
JH
14560 esac
14561 case "$getpwuid_r_proto" in
14562 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14563 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
10bc17b6
JH
14564 esac
14565 case "$getpwuid_r_proto" in
90e831dc 14566 ''|0) d_getpwuid_r=undef
10bc17b6 14567 getpwuid_r_proto=0
a48ec845 14568 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14569 * ) case "$getpwuid_r_proto" in
14570 REENTRANT_PROTO*) ;;
14571 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14572 esac
14573 echo "Prototype: $try" ;;
14574 esac
14575 ;;
c18e646a
JH
14576 *) case "$usethreads" in
14577 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14578 esac
90e831dc
SB
14579 d_getpwuid_r=undef
14580 getpwuid_r_proto=0
c18e646a 14581 ;;
a48ec845
JH
14582 esac
14583 ;;
10bc17b6
JH
14584*) getpwuid_r_proto=0
14585 ;;
14586esac
14587
34f1896b 14588: Optional checks for getsbyname and getsbyport
b4eb6b3d
JH
14589
14590: see if getservbyname exists
14591set getservbyname d_getsbyname
14592eval $inlibc
14593
14594: see if getservbyport exists
14595set getservbyport d_getsbyport
14596eval $inlibc
14597
14598: see if getservent exists
14599set getservent d_getsent
14600eval $inlibc
14601
10bc17b6
JH
14602: see if getservbyname_r exists
14603set getservbyname_r d_getservbyname_r
14604eval $inlibc
14605case "$d_getservbyname_r" in
14606"$define")
14607 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14608 case "$d_getservbyname_r_proto:$usethreads" in
14609 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14610 set d_getservbyname_r_proto getservbyname_r $hdrs
14611 eval $hasproto ;;
14612 *) ;;
14613 esac
14614 case "$d_getservbyname_r_proto" in
14615 define)
10bc17b6
JH
14616 case "$getservbyname_r_proto" in
14617 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14618 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
10bc17b6
JH
14619 esac
14620 case "$getservbyname_r_proto" in
14621 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
61c26d18 14622 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
10bc17b6
JH
14623 esac
14624 case "$getservbyname_r_proto" in
14625 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
61c26d18 14626 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
10bc17b6
JH
14627 esac
14628 case "$getservbyname_r_proto" in
90e831dc 14629 ''|0) d_getservbyname_r=undef
10bc17b6 14630 getservbyname_r_proto=0
a48ec845 14631 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14632 * ) case "$getservbyname_r_proto" in
14633 REENTRANT_PROTO*) ;;
14634 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14635 esac
14636 echo "Prototype: $try" ;;
14637 esac
14638 ;;
c18e646a
JH
14639 *) case "$usethreads" in
14640 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14641 esac
90e831dc
SB
14642 d_getservbyname_r=undef
14643 getservbyname_r_proto=0
c18e646a 14644 ;;
a48ec845
JH
14645 esac
14646 ;;
10bc17b6
JH
14647*) getservbyname_r_proto=0
14648 ;;
14649esac
14650
14651: see if getservbyport_r exists
14652set getservbyport_r d_getservbyport_r
14653eval $inlibc
14654case "$d_getservbyport_r" in
14655"$define")
14656 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14657 case "$d_getservbyport_r_proto:$usethreads" in
14658 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14659 set d_getservbyport_r_proto getservbyport_r $hdrs
14660 eval $hasproto ;;
14661 *) ;;
14662 esac
14663 case "$d_getservbyport_r_proto" in
14664 define)
10bc17b6
JH
14665 case "$getservbyport_r_proto" in
14666 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14667 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
10bc17b6
JH
14668 esac
14669 case "$getservbyport_r_proto" in
14670 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
61c26d18 14671 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
10bc17b6
JH
14672 esac
14673 case "$getservbyport_r_proto" in
14674 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
61c26d18 14675 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
10bc17b6
JH
14676 esac
14677 case "$getservbyport_r_proto" in
90e831dc 14678 ''|0) d_getservbyport_r=undef
10bc17b6 14679 getservbyport_r_proto=0
a48ec845 14680 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14681 * ) case "$getservbyport_r_proto" in
14682 REENTRANT_PROTO*) ;;
14683 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14684 esac
14685 echo "Prototype: $try" ;;
14686 esac
14687 ;;
c18e646a
JH
14688 *) case "$usethreads" in
14689 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14690 esac
90e831dc
SB
14691 d_getservbyport_r=undef
14692 getservbyport_r_proto=0
c18e646a 14693 ;;
a48ec845
JH
14694 esac
14695 ;;
10bc17b6
JH
14696*) getservbyport_r_proto=0
14697 ;;
14698esac
14699
14700: see if getservent_r exists
14701set getservent_r d_getservent_r
14702eval $inlibc
14703case "$d_getservent_r" in
14704"$define")
14705 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14706 case "$d_getservent_r_proto:$usethreads" in
14707 ":define") d_getservent_r_proto=define
a48ec845
JH
14708 set d_getservent_r_proto getservent_r $hdrs
14709 eval $hasproto ;;
14710 *) ;;
14711 esac
14712 case "$d_getservent_r_proto" in
14713 define)
10bc17b6
JH
14714 case "$getservent_r_proto" in
14715 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
61c26d18 14716 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
10bc17b6
JH
14717 esac
14718 case "$getservent_r_proto" in
14719 ''|0) try='int getservent_r(struct servent*, char*, int);'
61c26d18 14720 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
10bc17b6
JH
14721 esac
14722 case "$getservent_r_proto" in
14723 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
61c26d18 14724 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
10bc17b6
JH
14725 esac
14726 case "$getservent_r_proto" in
14727 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
61c26d18 14728 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
10bc17b6
JH
14729 esac
14730 case "$getservent_r_proto" in
90e831dc 14731 ''|0) d_getservent_r=undef
10bc17b6 14732 getservent_r_proto=0
a48ec845 14733 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14734 * ) case "$getservent_r_proto" in
14735 REENTRANT_PROTO*) ;;
14736 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14737 esac
14738 echo "Prototype: $try" ;;
14739 esac
14740 ;;
c18e646a
JH
14741 *) case "$usethreads" in
14742 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14743 esac
90e831dc
SB
14744 d_getservent_r=undef
14745 getservent_r_proto=0
c18e646a 14746 ;;
a48ec845
JH
14747 esac
14748 ;;
10bc17b6
JH
14749*) getservent_r_proto=0
14750 ;;
14751esac
14752
b4eb6b3d
JH
14753: see if prototypes for various getservxxx netdb.h functions are available
14754echo " "
14755set d_getservprotos getservent $i_netdb netdb.h
14756eval $hasproto
14757
14758: see if getspnam exists
14759set getspnam d_getspnam
14760eval $inlibc
14761
10bc17b6
JH
14762: see if this is a shadow.h system
14763set shadow.h i_shadow
14764eval $inhdr
14765
14766: see if getspnam_r exists
14767set getspnam_r d_getspnam_r
14768eval $inlibc
14769case "$d_getspnam_r" in
14770"$define")
14771 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14772 case "$d_getspnam_r_proto:$usethreads" in
14773 ":define") d_getspnam_r_proto=define
a48ec845
JH
14774 set d_getspnam_r_proto getspnam_r $hdrs
14775 eval $hasproto ;;
14776 *) ;;
14777 esac
14778 case "$d_getspnam_r_proto" in
14779 define)
10bc17b6
JH
14780 case "$getspnam_r_proto" in
14781 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
61c26d18 14782 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14783 esac
14784 case "$getspnam_r_proto" in
14785 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
61c26d18 14786 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
10bc17b6
JH
14787 esac
14788 case "$getspnam_r_proto" in
90e831dc 14789 ''|0) d_getspnam_r=undef
10bc17b6 14790 getspnam_r_proto=0
a48ec845 14791 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14792 * ) case "$getspnam_r_proto" in
14793 REENTRANT_PROTO*) ;;
14794 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14795 esac
14796 echo "Prototype: $try" ;;
14797 esac
14798 ;;
c18e646a
JH
14799 *) case "$usethreads" in
14800 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14801 esac
90e831dc
SB
14802 d_getspnam_r=undef
14803 getspnam_r_proto=0
c18e646a 14804 ;;
a48ec845
JH
14805 esac
14806 ;;
10bc17b6
JH
14807*) getspnam_r_proto=0
14808 ;;
14809esac
14810
b4eb6b3d
JH
14811: see if gettimeofday or ftime exists
14812set gettimeofday d_gettimeod
14813eval $inlibc
14814case "$d_gettimeod" in
14815"$undef")
14816 set ftime d_ftime
14817 eval $inlibc
14818 ;;
14819*)
14820 val="$undef"; set d_ftime; eval $setvar
14821 ;;
14822esac
14823case "$d_gettimeod$d_ftime" in
14824"$undef$undef")
14825 echo " "
14826 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14827 ;;
14828esac
14829
10bc17b6
JH
14830: see if gmtime_r exists
14831set gmtime_r d_gmtime_r
14832eval $inlibc
14833case "$d_gmtime_r" in
14834"$define")
d63eadf0 14835 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14836 case "$d_gmtime_r_proto:$usethreads" in
14837 ":define") d_gmtime_r_proto=define
a48ec845
JH
14838 set d_gmtime_r_proto gmtime_r $hdrs
14839 eval $hasproto ;;
14840 *) ;;
14841 esac
14842 case "$d_gmtime_r_proto" in
14843 define)
10bc17b6
JH
14844 case "$gmtime_r_proto" in
14845 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
61c26d18 14846 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
10bc17b6
JH
14847 esac
14848 case "$gmtime_r_proto" in
14849 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
61c26d18 14850 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
10bc17b6
JH
14851 esac
14852 case "$gmtime_r_proto" in
90e831dc 14853 ''|0) d_gmtime_r=undef
10bc17b6 14854 gmtime_r_proto=0
a48ec845 14855 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14856 * ) case "$gmtime_r_proto" in
14857 REENTRANT_PROTO*) ;;
14858 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14859 esac
14860 echo "Prototype: $try" ;;
14861 esac
b4eb6b3d 14862 ;;
c18e646a
JH
14863 *) case "$usethreads" in
14864 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14865 esac
90e831dc
SB
14866 d_gmtime_r=undef
14867 gmtime_r_proto=0
c18e646a 14868 ;;
a48ec845
JH
14869 esac
14870 ;;
10bc17b6 14871*) gmtime_r_proto=0
b4eb6b3d
JH
14872 ;;
14873esac
14874
14875: see if hasmntopt exists
14876set hasmntopt d_hasmntopt
14877eval $inlibc
14878
14879: see if this is a netinet/in.h or sys/in.h system
14880set netinet/in.h i_niin sys/in.h i_sysin
14881eval $inhdr
14882
14883: see if arpa/inet.h has to be included
14884set arpa/inet.h i_arpainet
14885eval $inhdr
14886
14887: see if htonl --and friends-- exists
14888val=''
14889set htonl val
14890eval $inlibc
14891
14892: Maybe they are macros.
14893case "$val" in
14894$undef)
14895 $cat >htonl.c <<EOM
14896#include <stdio.h>
14897#include <sys/types.h>
14898#$i_niin I_NETINET_IN
14899#$i_sysin I_SYS_IN
14900#$i_arpainet I_ARPA_INET
14901#ifdef I_NETINET_IN
14902#include <netinet/in.h>
14903#endif
14904#ifdef I_SYS_IN
14905#include <sys/in.h>
14906#endif
14907#ifdef I_ARPA_INET
14908#include <arpa/inet.h>
14909#endif
14910#ifdef htonl
14911printf("Defined as a macro.");
14912#endif
14913EOM
14914 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14915 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14916 val="$define"
14917 echo "But it seems to be defined as a macro." >&4
14918 fi
14919 $rm -f htonl.?
14920 ;;
14921esac
14922set d_htonl
14923eval $setvar
14924
36adc09b
JH
14925: see if ilogbl exists
14926set ilogbl d_ilogbl
14927eval $inlibc
14928
b4eb6b3d
JH
14929: index or strchr
14930echo " "
14931if set index val -f; eval $csym; $val; then
14932 if set strchr val -f d_strchr; eval $csym; $val; then
14933 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14934 val="$define"
14935 vali="$undef"
14936 echo "strchr() found." >&4
14937 else
14938 val="$undef"
14939 vali="$define"
14940 echo "index() found." >&4
14941 fi
14942 else
14943 val="$undef"
14944 vali="$define"
8dfa8df9
JH
14945 echo "index() found." >&4
14946 fi
b4eb6b3d 14947else
8dfa8df9
JH
14948 if set strchr val -f d_strchr; eval $csym; $val; then
14949 val="$define"
14950 vali="$undef"
14951 echo "strchr() found." >&4
14952 else
14953 echo "No index() or strchr() found!" >&4
14954 val="$undef"
14955 vali="$undef"
14956 fi
b4eb6b3d 14957fi
8dfa8df9
JH
14958set d_strchr; eval $setvar
14959val="$vali"
14960set d_index; eval $setvar
14961
14962: check whether inet_aton exists
14963set inet_aton d_inetaton
14964eval $inlibc
b4eb6b3d 14965
5086dff9
MB
14966: see if inet_ntop exists
14967set inet_ntop d_inetntop
14968eval $inlibc
14969
14970: see if inet_pton exists
14971set inet_pton d_inetpton
14972eval $inlibc
14973
b4eb6b3d
JH
14974: Look for isascii
14975echo " "
36adc09b 14976$cat >isascii.c <<EOCP
b4eb6b3d
JH
14977#include <stdio.h>
14978#include <ctype.h>
55954f19
JH
14979#$i_stdlib I_STDLIB
14980#ifdef I_STDLIB
14981#include <stdlib.h>
14982#endif
b4eb6b3d
JH
14983int main() {
14984 int c = 'A';
14985 if (isascii(c))
14986 exit(0);
14987 else
14988 exit(1);
14989}
14990EOCP
14991set isascii
14992if eval $compile; then
14993 echo "isascii() found." >&4
14994 val="$define"
14995else
14996 echo "isascii() NOT found." >&4
14997 val="$undef"
14998fi
14999set d_isascii
15000eval $setvar
15001$rm -f isascii*
15002
758a5d79
JH
15003: see if isfinite exists
15004set isfinite d_isfinite
15005eval $inlibc
15006
15007: see if isinf exists
15008set isinf d_isinf
15009eval $inlibc
15010
b4eb6b3d
JH
15011: see if isnan exists
15012set isnan d_isnan
15013eval $inlibc
15014
15015: see if isnanl exists
15016set isnanl d_isnanl
15017eval $inlibc
15018
15019: see if killpg exists
15020set killpg d_killpg
15021eval $inlibc
15022
15023: see if lchown exists
15024echo " "
15025$cat > try.c <<'EOCP'
15026/* System header to define __stub macros and hopefully few prototypes,
15027 which can conflict with char lchown(); below. */
15028#include <assert.h>
15029/* Override any gcc2 internal prototype to avoid an error. */
15030/* We use char because int might match the return type of a gcc2
15031 builtin and then its argument prototype would still apply. */
15032char lchown();
15033int main() {
15034 /* The GNU C library defines this for functions which it implements
15035 to always fail with ENOSYS. Some functions are actually named
15036 something starting with __ and the normal name is an alias. */
15037#if defined (__stub_lchown) || defined (__stub___lchown)
15038choke me
15039#else
15040lchown();
15041#endif
15042; return 0; }
15043EOCP
15044set try
15045if eval $compile; then
15046 $echo "lchown() found." >&4
15047 val="$define"
15048else
15049 $echo "lchown() NOT found." >&4
15050 val="$undef"
15051fi
15052set d_lchown
15053eval $setvar
15054
15055: See if number of significant digits in a double precision number is known
15056echo " "
15057$cat >ldbl_dig.c <<EOM
15058#$i_limits I_LIMITS
15059#$i_float I_FLOAT
15060#ifdef I_LIMITS
15061#include <limits.h>
15062#endif
15063#ifdef I_FLOAT
15064#include <float.h>
15065#endif
15066#ifdef LDBL_DIG
15067printf("Contains LDBL_DIG");
15068#endif
15069EOM
15070$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15071if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15072 echo "LDBL_DIG found." >&4
15073 val="$define"
15074else
15075 echo "LDBL_DIG NOT found." >&4
15076 val="$undef"
15077fi
15078$rm -f ldbl_dig.?
15079set d_ldbl_dig
15080eval $setvar
15081
0a0abfba
MB
15082: see if this is a math.h system
15083set math.h i_math
15084eval $inhdr
15085
613d6c3e 15086: check to see if math.h defines _LIB_VERSION
0a0abfba
MB
15087d_libm_lib_version="$undef"
15088case $i_math in
15089 $define)
0a0abfba
MB
15090 echo " "
15091 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15092 $cat >try.c <<EOCP
15093#include <unistd.h>
15094#include <math.h>
15095int main (int argc, char *argv[])
15096{
15097 printf ("%d\n", _LIB_VERSION);
15098 return (0);
15099 } /* main */
15100EOCP
15101 set try
15102 if eval $compile; then
15103 foo=`$run ./try`
15104 echo "Yes, it does ($foo)" >&4
15105 d_libm_lib_version="$define"
15106 else
4dd8f9b3 15107 echo "No, it does not (probably harmless)" >&4
0a0abfba 15108 fi
5b813a60 15109 $rm_try
0a0abfba
MB
15110 ;;
15111
15112 esac
15113
b4eb6b3d
JH
15114: see if link exists
15115set link d_link
15116eval $inlibc
15117
10bc17b6
JH
15118: see if localtime_r exists
15119set localtime_r d_localtime_r
15120eval $inlibc
15121case "$d_localtime_r" in
15122"$define")
d63eadf0 15123 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
15124 case "$d_localtime_r_proto:$usethreads" in
15125 ":define") d_localtime_r_proto=define
a48ec845
JH
15126 set d_localtime_r_proto localtime_r $hdrs
15127 eval $hasproto ;;
15128 *) ;;
15129 esac
15130 case "$d_localtime_r_proto" in
15131 define)
10bc17b6
JH
15132 case "$localtime_r_proto" in
15133 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
61c26d18 15134 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
10bc17b6
JH
15135 esac
15136 case "$localtime_r_proto" in
15137 ''|0) try='int localtime_r(const time_t*, struct tm*);'
61c26d18 15138 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
10bc17b6
JH
15139 esac
15140 case "$localtime_r_proto" in
90e831dc 15141 ''|0) d_localtime_r=undef
10bc17b6 15142 localtime_r_proto=0
a48ec845 15143 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15144 * ) case "$localtime_r_proto" in
15145 REENTRANT_PROTO*) ;;
15146 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15147 esac
15148 echo "Prototype: $try" ;;
15149 esac
15150 ;;
c18e646a
JH
15151 *) case "$usethreads" in
15152 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15153 esac
90e831dc
SB
15154 d_localtime_r=undef
15155 localtime_r_proto=0
c18e646a 15156 ;;
a48ec845
JH
15157 esac
15158 ;;
10bc17b6
JH
15159*) localtime_r_proto=0
15160 ;;
15161esac
15162
8572b25d
BH
15163: see if localtime_r calls tzset
15164case "$localtime_r_proto" in
15165REENTRANT_PROTO*)
15166 $cat >try.c <<EOCP
15167/* Does our libc's localtime_r call tzset ?
15168 * return 0 if so, 1 otherwise.
15169 */
61c26d18
MHM
15170#$i_systypes I_SYS_TYPES
15171#$i_unistd I_UNISTD
15172#$i_time I_TIME
15173#$i_stdlib I_STDLIB
15174#$i_string I_STRING
15175#$i_malloc I_MALLOC
15176#ifdef I_SYS_TYPES
15177# include <sys/types.h>
15178#endif
15179#ifdef I_UNISTD
15180# include <unistd.h>
15181#endif
15182#ifdef I_TIME
15183# include <time.h>
15184#endif
15185#ifdef I_STDLIB
15186#include <stdlib.h>
15187#endif
15188#ifdef I_STRING
15189# include <string.h>
15190#else
15191# include <strings.h>
15192#endif
15193#ifdef I_MALLOC
15194# include <malloc.h>
15195#endif
8572b25d
BH
15196int main()
15197{
15198 time_t t = time(0L);
15199 char w_tz[]="TZ" "=GMT+5",
15200 e_tz[]="TZ" "=GMT-5",
15201 *tz_e = (char*)malloc(16),
15202 *tz_w = (char*)malloc(16);
15203 struct tm tm_e, tm_w;
15204 memset(&tm_e,'\0',sizeof(struct tm));
15205 memset(&tm_w,'\0',sizeof(struct tm));
15206 strcpy(tz_e,e_tz);
15207 strcpy(tz_w,w_tz);
15208
15209 putenv(tz_e);
15210 localtime_r(&t, &tm_e);
15211
15212 putenv(tz_w);
15213 localtime_r(&t, &tm_w);
15214
15215 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15216 return 1;
15217 return 0;
15218}
15219EOCP
15220 set try
15221 if eval $compile; then
43dddb59 15222 if $run ./try; then
8572b25d
BH
15223 d_localtime_r_needs_tzset=undef;
15224 else
15225 d_localtime_r_needs_tzset=define;
15226 fi;
15227 else
15228 d_localtime_r_needs_tzset=undef;
15229 fi;
15230 ;;
15231 *)
15232 d_localtime_r_needs_tzset=undef;
15233 ;;
15234esac
5b813a60 15235$rm_try
8572b25d 15236
b4eb6b3d
JH
15237: see if localeconv exists
15238set localeconv d_locconv
15239eval $inlibc
15240
15241: see if lockf exists
15242set lockf d_lockf
15243eval $inlibc
15244
b4eb6b3d
JH
15245: see if prototype for lseek is available
15246echo " "
4786929f 15247set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
15248eval $hasproto
15249
15250: see if lstat exists
15251set lstat d_lstat
15252eval $inlibc
15253
15254: see if madvise exists
15255set madvise d_madvise
15256eval $inlibc
15257
7dd121ae
MB
15258: see if malloc_size exists
15259set malloc_size d_malloc_size
15260eval $inlibc
15261
15262: see if malloc_size_good exists
15263set malloc_good_size d_malloc_good_size
15264eval $inlibc
15265
b4eb6b3d
JH
15266: see if mblen exists
15267set mblen d_mblen
15268eval $inlibc
15269
15270: see if mbstowcs exists
15271set mbstowcs d_mbstowcs
15272eval $inlibc
15273
15274: see if mbtowc exists
15275set mbtowc d_mbtowc
15276eval $inlibc
15277
15278: see if memchr exists
15279set memchr d_memchr
15280eval $inlibc
15281
15282: see if memcmp exists
15283set memcmp d_memcmp
15284eval $inlibc
15285
15286: see if memcpy exists
15287set memcpy d_memcpy
15288eval $inlibc
15289
15290: see if memmove exists
15291set memmove d_memmove
15292eval $inlibc
15293
15294: see if memset exists
15295set memset d_memset
15296eval $inlibc
15297
15298: see if mkdir exists
15299set mkdir d_mkdir
15300eval $inlibc
15301
15302: see if mkdtemp exists
15303set mkdtemp d_mkdtemp
15304eval $inlibc
15305
15306: see if mkfifo exists
15307set mkfifo d_mkfifo
15308eval $inlibc
15309
15310: see if mkstemp exists
15311set mkstemp d_mkstemp
15312eval $inlibc
15313
15314: see if mkstemps exists
15315set mkstemps d_mkstemps
15316eval $inlibc
15317
15318: see if mktime exists
15319set mktime d_mktime
15320eval $inlibc
15321
15322: see if this is a sys/mman.h system
15323set sys/mman.h i_sysmman
15324eval $inhdr
15325
15326: see if mmap exists
15327set mmap d_mmap
15328eval $inlibc
15329: see what shmat returns
15330: default to something harmless
15331mmaptype='void *'
15332case "$i_sysmman$d_mmap" in
15333"$define$define")
15334 $cat >mmap.c <<'END'
15335#include <sys/mman.h>
15336void *mmap();
15337END
15338 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15339 mmaptype='void *'
15340 else
15341 mmaptype='caddr_t'
15342 fi
15343 echo "and it returns ($mmaptype)." >&4
15344 ;;
15345esac
15346
15347
15348
89ce900e
JH
15349: see if sqrtl exists
15350set sqrtl d_sqrtl
15351eval $inlibc
15352
af1ff193
JH
15353: see if scalbnl exists
15354set scalbnl d_scalbnl
15355eval $inlibc
15356
89ce900e
JH
15357: see if modfl exists
15358set modfl d_modfl
15359eval $inlibc
15360
15361: see if prototype for modfl is available
15362echo " "
3a794506 15363set d_modflproto modfl $i_math math.h
89ce900e
JH
15364eval $hasproto
15365
15366d_modfl_pow32_bug="$undef"
15367
15368case "$d_longdbl$d_modfl" in
15369$define$define)
15370 $cat <<EOM
15371Checking to see whether your modfl() is okay for large values...
15372EOM
15373$cat >try.c <<EOCP
5b813a60 15374#include <math.h>
89ce900e
JH
15375#include <stdio.h>
15376EOCP
15377if $test "X$d_modflproto" != "X$define"; then
15378 $cat >>try.c <<EOCP
5b813a60 15379/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
15380long double modfl (long double, long double *);
15381EOCP
15382fi
15383$cat >>try.c <<EOCP
15384int main() {
15385 long double nv = 4294967303.15;
15386 long double v, w;
5b813a60 15387 v = modfl(nv, &w);
89ce900e
JH
15388#ifdef __GLIBC__
15389 printf("glibc");
15390#endif
15391 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15392 return 0;
15393}
15394EOCP
15395 case "$osname:$gccversion" in
15396 aix:) saveccflags="$ccflags"
15397 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15398 esac
15399 set try
15400 if eval $compile; then
15401 foo=`$run ./try`
15402 case "$foo" in
15403 *" 4294967303.150000 1.150000 4294967302.000000")
15404 echo >&4 "Your modfl() is broken for large values."
15405 d_modfl_pow32_bug="$define"
15406 case "$foo" in
15407 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15408 ;;
15409 esac
15410 ;;
15411 *" 4294967303.150000 0.150000 4294967303.000000")
15412 echo >&4 "Your modfl() seems okay for large values."
15413 ;;
15414 *) echo >&4 "I don't understand your modfl() at all."
15415 d_modfl="$undef"
15416 ;;
15417 esac
5b813a60 15418 $rm_try
89ce900e
JH
15419 else
15420 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15421 d_modfl="$undef"
15422 fi
15423 case "$osname:$gccversion" in
15424 aix:) ccflags="$saveccflags" ;; # restore
15425 esac
15426 ;;
15427esac
15428
15429if $test "$uselongdouble" = "$define"; then
af1ff193
JH
15430 message=""
15431 if $test "$d_sqrtl" != "$define"; then
15432 message="$message sqrtl"
15433 fi
15434 if $test "$d_modfl" != "$define"; then
89ce900e
JH
15435 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15436 echo "You have both aintl and copysignl, so I can emulate modfl."
15437 else
af1ff193 15438 message="$message modfl"
89ce900e 15439 fi
af1ff193
JH
15440 fi
15441 if $test "$d_frexpl" != "$define"; then
15442 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15443 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15444 else
15445 message="$message frexpl"
15446 fi
15447 fi
89ce900e 15448
af1ff193 15449 if $test "$message" != ""; then
89ce900e
JH
15450 $cat <<EOM >&4
15451
15452*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15453*** the following mathematical functions needed for long double support:
15454*** $message
fe63a0b4
JH
15455*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15456*** Cannot continue, aborting.
89ce900e
JH
15457
15458EOM
15459
fe63a0b4 15460 exit 1
89ce900e
JH
15461 fi
15462fi
15463
b4eb6b3d
JH
15464: see if mprotect exists
15465set mprotect d_mprotect
15466eval $inlibc
15467
15468: see if msgctl exists
15469set msgctl d_msgctl
15470eval $inlibc
15471
15472: see if msgget exists
15473set msgget d_msgget
15474eval $inlibc
15475
15476: see if msgsnd exists
15477set msgsnd d_msgsnd
15478eval $inlibc
15479
15480: see if msgrcv exists
15481set msgrcv d_msgrcv
15482eval $inlibc
15483
15484: see how much of the 'msg*(2)' library is present.
15485h_msg=true
15486echo " "
15487case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15488*"$undef"*) h_msg=false;;
15489esac
15490case "$osname" in
15491freebsd)
15492 case "`ipcs 2>&1`" in
15493 "SVID messages"*"not configured"*)
15494 echo "Your $osname does not have the msg*(2) configured." >&4
15495 h_msg=false
15496 val="$undef"
15497 set msgctl d_msgctl
15498 eval $setvar
15499 set msgget d_msgget
15500 eval $setvar
15501 set msgsnd d_msgsnd
15502 eval $setvar
15503 set msgrcv d_msgrcv
15504 eval $setvar
15505 ;;
15506 esac
15507 ;;
15508esac
15509: we could also check for sys/ipc.h ...
15510if $h_msg && $test `./findhdr sys/msg.h`; then
15511 echo "You have the full msg*(2) library." >&4
15512 val="$define"
15513else
15514 echo "You don't have the full msg*(2) library." >&4
15515 val="$undef"
15516fi
15517set d_msg
15518eval $setvar
15519
34f1896b 15520: Check for msghdr_s
4e0554ec
JH
15521echo " "
15522echo "Checking to see if your system supports struct msghdr..." >&4
15523set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15524eval $hasstruct
15525case "$d_msghdr_s" in
15526"$define") echo "Yes, it does." ;;
15527*) echo "No, it doesn't." ;;
15528esac
15529
15530
b4eb6b3d
JH
15531: see if msync exists
15532set msync d_msync
15533eval $inlibc
15534
15535: see if munmap exists
15536set munmap d_munmap
15537eval $inlibc
15538
15539: see if nice exists
15540set nice d_nice
15541eval $inlibc
15542
2765b840
JH
15543: see if this is a langinfo.h system
15544set langinfo.h i_langinfo
15545eval $inhdr
15546
15547: see if nl_langinfo exists
15548set nl_langinfo d_nl_langinfo
15549eval $inlibc
15550
1d1be0dc
NC
15551: check for volatile keyword
15552echo " "
15553echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15554$cat >try.c <<'EOCP'
76f47787 15555int main()
1d1be0dc
NC
15556{
15557 typedef struct _goo_struct goo_struct;
15558 goo_struct * volatile goo = ((goo_struct *)0);
15559 struct _goo_struct {
15560 long long_int;
15561 int reg_int;
15562 char char_var;
15563 };
15564 typedef unsigned short foo_t;
15565 char *volatile foo;
15566 volatile int bar;
15567 volatile foo_t blech;
15568 foo = foo;
15569}
15570EOCP
15571if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15572 val="$define"
15573 echo "Yup, it does."
15574else
15575 val="$undef"
15576 echo "Nope, it doesn't."
15577fi
15578set d_volatile
15579eval $setvar
5b813a60 15580$rm_try
1d1be0dc 15581
613d6c3e 15582: Check basic sizes
b4eb6b3d
JH
15583echo " "
15584$echo "Choosing the C types to be used for Perl's internal types..." >&4
15585
15586case "$use64bitint:$d_quad:$quadtype" in
15587define:define:?*)
15588 ivtype="$quadtype"
15589 uvtype="$uquadtype"
15590 ivsize=8
15591 uvsize=8
15592 ;;
15593*) ivtype="long"
15594 uvtype="unsigned long"
15595 ivsize=$longsize
15596 uvsize=$longsize
15597 ;;
15598esac
15599
15600case "$uselongdouble:$d_longdbl" in
15601define:define)
15602 nvtype="long double"
15603 nvsize=$longdblsize
15604 ;;
15605*) nvtype=double
15606 nvsize=$doublesize
15607 ;;
15608esac
15609
15610$echo "(IV will be "$ivtype", $ivsize bytes)"
15611$echo "(UV will be "$uvtype", $uvsize bytes)"
15612$echo "(NV will be "$nvtype", $nvsize bytes)"
15613
15614$cat >try.c <<EOCP
15615#$i_inttypes I_INTTYPES
15616#ifdef I_INTTYPES
15617#include <inttypes.h>
15618#endif
15619#include <stdio.h>
15620int main() {
15621#ifdef INT8
15622 int8_t i = INT8_MAX;
15623 uint8_t u = UINT8_MAX;
15624 printf("int8_t\n");
15625#endif
15626#ifdef INT16
15627 int16_t i = INT16_MAX;
15628 uint16_t i = UINT16_MAX;
15629 printf("int16_t\n");
15630#endif
15631#ifdef INT32
15632 int32_t i = INT32_MAX;
15633 uint32_t u = UINT32_MAX;
15634 printf("int32_t\n");
15635#endif
15636}
15637EOCP
15638
13187456 15639i8type="signed char"
0ab0821a
MB
15640u8type="unsigned char"
15641i8size=1
15642u8size=1
b4eb6b3d
JH
15643
15644case "$i16type" in
15645'') case "$shortsize" in
15646 2) i16type=short
15647 u16type="unsigned short"
15648 i16size=$shortsize
15649 u16size=$shortsize
15650 ;;
15651 esac
15652 ;;
15653esac
15654case "$i16type" in
15655'') set try -DINT16
15656 if eval $compile; then
5440bc8e 15657 case "`$run ./try`" in
b4eb6b3d
JH
15658 int16_t)
15659 i16type=int16_t
15660 u16type=uint16_t
15661 i16size=2
15662 u16size=2
15663 ;;
15664 esac
15665 fi
15666 ;;
15667esac
15668case "$i16type" in
15669'') if $test $shortsize -ge 2; then
15670 i16type=short
15671 u16type="unsigned short"
15672 i16size=$shortsize
15673 u16size=$shortsize
15674 fi
15675 ;;
15676esac
15677
15678case "$i32type" in
15679'') case "$longsize" in
15680 4) i32type=long
15681 u32type="unsigned long"
15682 i32size=$longsize
15683 u32size=$longsize
15684 ;;
15685 *) case "$intsize" in
15686 4) i32type=int
15687 u32type="unsigned int"
15688 i32size=$intsize
15689 u32size=$intsize
15690 ;;
15691 esac
15692 ;;
15693 esac
15694 ;;
15695esac
15696case "$i32type" in
15697'') set try -DINT32
15698 if eval $compile; then
5440bc8e 15699 case "`$run ./try`" in
b4eb6b3d
JH
15700 int32_t)
15701 i32type=int32_t
15702 u32type=uint32_t
15703 i32size=4
15704 u32size=4
15705 ;;
15706 esac
15707 fi
15708 ;;
15709esac
15710case "$i32type" in
15711'') if $test $intsize -ge 4; then
15712 i32type=int
15713 u32type="unsigned int"
15714 i32size=$intsize
15715 u32size=$intsize
15716 fi
15717 ;;
15718esac
15719
15720case "$i64type" in
15721'') case "$d_quad:$quadtype" in
15722 define:?*)
15723 i64type="$quadtype"
15724 u64type="$uquadtype"
15725 i64size=8
15726 u64size=8
15727 ;;
15728 esac
15729 ;;
15730esac
15731
1d1be0dc
NC
15732$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15733: volatile so that the compiler has to store it out to memory.
15734if test X"$d_volatile" = X"$define"; then
15735 volatile=volatile
15736fi
b4eb6b3d
JH
15737$cat <<EOP >try.c
15738#include <stdio.h>
55954f19
JH
15739#$i_stdlib I_STDLIB
15740#ifdef I_STDLIB
15741#include <stdlib.h>
15742#endif
1d1be0dc
NC
15743#include <sys/types.h>
15744#include <signal.h>
15745#ifdef SIGFPE
15746$volatile int bletched = 0;
7090f861 15747$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15748#endif
b4eb6b3d
JH
15749int main() {
15750 $uvtype u = 0;
1d1be0dc 15751 $nvtype d;
b4eb6b3d
JH
15752 int n = 8 * $uvsize;
15753 int i;
1d1be0dc
NC
15754#ifdef SIGFPE
15755 signal(SIGFPE, blech);
15756#endif
15757
b4eb6b3d
JH
15758 for (i = 0; i < n; i++) {
15759 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15760 d = ($nvtype)u;
15761 if (($uvtype)d != u)
b4eb6b3d 15762 break;
1d1be0dc
NC
15763 if (d <= 0)
15764 break;
15765 d = ($nvtype)(u - 1);
15766 if (($uvtype)d != (u - 1))
15767 break;
15768#ifdef SIGFPE
22676560 15769 if (bletched)
1d1be0dc
NC
15770 break;
15771#endif
b4eb6b3d 15772 }
efd1522b 15773 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15774 exit(0);
15775}
15776EOP
1d1be0dc
NC
15777set try
15778
15779d_nv_preserves_uv="$undef"
15780if eval $compile; then
53133ed1 15781 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15782fi
53133ed1 15783case "$nv_preserves_uv_bits" in
5b813a60 15784\-[1-9]*)
53133ed1
NC
15785 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15786 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15787 d_nv_preserves_uv="$define"
b4eb6b3d 15788 ;;
53133ed1 15789[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15790 d_nv_preserves_uv="$undef" ;;
15791*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15792 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15793esac
5b813a60 15794$rm_try
1d1be0dc 15795
b68c599a
NC
15796$echo "Checking to find the largest integer value your NVs can hold..." >&4
15797: volatile so that the compiler has to store it out to memory.
15798if test X"$d_volatile" = X"$define"; then
15799 volatile=volatile
15800fi
15801$cat <<EOP >try.c
15802#include <stdio.h>
15803
15804typedef $nvtype NV;
15805
15806int
15807main() {
15808 NV value = 2;
15809 int count = 1;
15810
15811 while(count < 256) {
15812 $volatile NV up = value + 1.0;
15813 $volatile NV negated = -value;
15814 $volatile NV down = negated - 1.0;
15815 $volatile NV got_up = up - value;
15816 int up_good = got_up == 1.0;
15817 int got_down = down - negated;
15818 int down_good = got_down == -1.0;
15819
15820 if (down_good != up_good) {
15821 fprintf(stderr,
15822 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15823 up_good, (double) got_up, down_good, (double) got_down,
15824 count, (double) value);
15825 return 1;
15826 }
15827 if (!up_good) {
15828 while (1) {
15829 if (count > 8) {
15830 count -= 8;
15831 fputs("256.0", stdout);
15832 } else {
15833 count--;
15834 fputs("2.0", stdout);
15835 }
15836 if (!count) {
15837 puts("");
15838 return 0;
15839 }
15840 fputs("*", stdout);
15841 }
15842 }
15843 value *= 2;
15844 ++count;
15845 }
15846 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15847 count, (double) value);
15848 return 1;
15849}
15850EOP
15851set try
15852
15853nv_overflows_integers_at='0'
15854if eval $compile; then
15855 xxx="`$run ./try`"
15856 case "$?" in
15857 0)
15858 case "$xxx" in
15859 2*) cat >&4 <<EOM
15860The largest integer your NVs can preserve is equal to $xxx
15861EOM
15862 nv_overflows_integers_at="$xxx"
15863 ;;
15864 *) cat >&4 <<EOM
15865Cannot determine the largest integer value your NVs can hold, unexpected output
15866'$xxx'
15867EOM
15868 ;;
15869 esac
15870 ;;
15871 *) cat >&4 <<EOM
15872Cannot determine the largest integer value your NVs can hold
15873EOM
15874 ;;
15875 esac
15876fi
15877$rm_try
15878
f607920a
CB
15879$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15880: volatile so that the compiler has to store it out to memory.
15881if test X"$d_volatile" = X"$define"; then
15882 volatile=volatile
15883fi
15884$cat <<EOP >try.c
15885#include <stdio.h>
15886#$i_stdlib I_STDLIB
15887#ifdef I_STDLIB
15888#include <stdlib.h>
15889#endif
15890#$i_string I_STRING
15891#ifdef I_STRING
15892# include <string.h>
15893#else
15894# include <strings.h>
15895#endif
15896#include <sys/types.h>
15897#include <signal.h>
15898#ifdef SIGFPE
15899$volatile int bletched = 0;
7090f861 15900$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15901#endif
15902
15903int checkit($nvtype d, char *where) {
15904 unsigned char *p = (char *)&d;
15905 unsigned char *end = p + sizeof(d);
15906 int fail = 0;
15907
15908 while (p < end)
15909 fail += *p++;
15910
15911 if (!fail)
17f6277d 15912 return 0;
f607920a
CB
15913
15914 p = (char *)&d;
15915 printf("No - %s: 0x", where);
15916 while (p < end)
15917 printf ("%02X", *p++);
15918 printf("\n");
15919 return 1;
15920}
15921
15922int main(int argc, char **argv) {
15923 $nvtype d = 0.0;
15924 int fail = 0;
15925 fail += checkit(d, "0.0");
15926
15927 /* The compiler shouldn't be assuming that bletched is 0 */
15928 d = bletched;
15929
15930 fail += checkit(d, "bleched");
15931
15932#ifdef SIGFPE
15933 signal(SIGFPE, blech);
15934#endif
15935
15936 /* Paranoia - the compiler should have no way of knowing that ANSI says
15937 that argv[argc] will always be NULL. Actually, if it did assume this it
15938 would be buggy, as this is C and main() can be called from elsewhere in
15939 the program. */
15940 d = argv[argc] ? 1 : 0;
15941
15942 if (d) {
15943 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15944 }
15945
15946 fail += checkit(d, "ternary");
15947
15948 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15949
15950 if (d != 0.0) {
15951 printf("No - memset doesn't give 0.0\n");
15952 /* This might just blow up: */
15953 printf("(gives %g)\n", d);
15954 return 1;
15955 }
5b813a60 15956
f607920a
CB
15957#ifdef SIGFPE
15958 if (bletched) {
15959 printf("No - something bleched\n");
15960 return 1;
15961 }
15962#endif
15963 if (fail) {
15964 printf("No - %d fail(s)\n", fail);
15965 return 1;
15966 }
15967 printf("Yes\n");
15968 return 0;
15969}
15970EOP
15971set try
15972
15973d_nv_zero_is_allbits_zero="$undef"
15974if eval $compile; then
15975 xxx="`$run ./try`"
15976 case "$?" in
15977 0)
15978 case "$xxx" in
15979 Yes) cat >&4 <<EOM
159800.0 is represented as all bits zero in memory
15981EOM
15982 d_nv_zero_is_allbits_zero="$define"
15983 ;;
15984 *) cat >&4 <<EOM
159850.0 is not represented as all bits zero in memory
15986EOM
15987 d_nv_zero_is_allbits_zero="$undef"
15988 ;;
15989 esac
15990 ;;
15991 *) cat >&4 <<EOM
159920.0 is not represented as all bits zero in memory
15993EOM
15994 d_nv_zero_is_allbits_zero="$undef"
15995 ;;
15996 esac
15997fi
5b813a60 15998$rm_try
b4eb6b3d
JH
15999
16000: check for off64_t
16001echo " "
16002echo "Checking to see if you have off64_t..." >&4
16003$cat >try.c <<EOCP
16004#include <sys/types.h>
16005#include <unistd.h>
16006int main() { off64_t x = 7; }
16007EOCP
16008set try
16009if eval $compile; then
16010 val="$define"
16011 echo "You have off64_t."
16012else
16013 val="$undef"
16014 echo "You do not have off64_t."
16015 case "$lseeksize" in
16016 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16017 esac
16018fi
5b813a60 16019$rm_try
b4eb6b3d
JH
16020set d_off64_t
16021eval $setvar
16022
b4eb6b3d
JH
16023: how to create joinable pthreads
16024if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16025 echo " "
5b813a60 16026 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
16027 $cat >try.c <<'EOCP'
16028#include <pthread.h>
16029int main() {
16030 int detachstate = JOINABLE;
16031}
16032EOCP
16033 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16034 if eval $compile; then
16035 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16036 val="$undef" # Yes, undef.
16037 set d_old_pthread_create_joinable
16038 eval $setvar
16039 val=""
16040 set old_pthread_create_joinable
16041 eval $setvar
16042 else
16043 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16044 if eval $compile; then
16045 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16046 val="$define"
16047 set d_old_pthread_create_joinable
16048 eval $setvar
16049 val=PTHREAD_CREATE_UNDETACHED
16050 set old_pthread_create_joinable
16051 eval $setvar
5b813a60 16052 else
b4eb6b3d
JH
16053 set try -DJOINABLE=__UNDETACHED
16054 if eval $compile; then
16055 echo "You seem to use __UNDETACHED." >&4
16056 val="$define"
16057 set d_old_pthread_create_joinable
16058 eval $setvar
16059 val=__UNDETACHED
16060 set old_pthread_create_joinable
16061 eval $setvar
16062 else
16063 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
16064 val="$define"
16065 set d_old_pthread_create_joinable
16066 eval $setvar
16067 val=0
16068 set old_pthread_create_joinable
16069 eval $setvar
16070 fi
16071 fi
16072 fi
5b813a60 16073 $rm_try
b4eb6b3d
JH
16074else
16075 d_old_pthread_create_joinable="$undef"
16076 old_pthread_create_joinable=""
16077fi
16078
16079: see if pause exists
16080set pause d_pause
16081eval $inlibc
16082
b4eb6b3d
JH
16083: see if poll exists
16084set poll d_poll
16085eval $inlibc
16086
c796e3db
MB
16087: see if prctl exists
16088set prctl d_prctl
16089eval $inlibc
16090
16091: see if prctl supports PR_SET_NAME
16092d_prctl_set_name=$undef
16093case $d_prctl in
16094 $define)
16095 $cat >try.c <<EOM
16096#include <sys/prctl.h>
16097
16098int main (int argc, char *argv[])
16099{
16100 return (prctl (PR_SET_NAME, "Test"));
16101 } /* main */
16102EOM
16103 set try
16104 if eval $compile_ok && $run ./try; then
16105 echo "Your prctl (PR_SET_NAME, ...) works"
16106 d_prctl_set_name=$define
16107 fi
16108 $rm_try
16109 ;;
16110 esac
16111
c7aff470
NIS
16112: see if readlink exists
16113set readlink d_readlink
16114eval $inlibc
16115
613d6c3e 16116: Check if exe is symlink to abs path of executing program
c7aff470 16117echo " "
f24dbf84 16118procselfexe=''
c7aff470 16119val="$undef"
a33c94aa
JH
16120case "$d_readlink" in
16121"$define")
c7aff470
NIS
16122 if $issymlink /proc/self/exe ; then
16123 $ls -l /proc/self/exe > reflect
51660ed5 16124 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 16125 echo "You have Linux-like /proc/self/exe."
92236451 16126 procselfexe='"/proc/self/exe"'
f24dbf84 16127 val="$define"
f24dbf84
JH
16128 fi
16129 fi
16130 if $issymlink /proc/curproc/file ; then
16131 $ls -l /proc/curproc/file > reflect
16132 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16133 echo "You have BSD-like /proc/curproc/file."
92236451 16134 procselfexe='"/proc/curproc/file"'
f24dbf84 16135 val="$define"
c7aff470 16136 fi
c7aff470 16137 fi
a33c94aa
JH
16138 ;;
16139esac
428dc699 16140$rm -f reflect
c7aff470
NIS
16141set d_procselfexe
16142eval $setvar
16143
233e16ce
MB
16144: backward compatibility for d_hvfork
16145if test X$d_hvfork != X; then
16146 d_vfork="$d_hvfork"
16147 d_hvfork=''
16148fi
16149: see if there is a vfork
16150val=''
16151set vfork val
16152eval $inlibc
16153
16154d_pseudofork=$undef
16155
16156: Ok, but do we want to use it. vfork is reportedly unreliable in
16157: perl on Solaris 2.x, and probably elsewhere.
16158case "$val" in
16159$define)
16160 echo " "
16161 case "$usevfork" in
16162 false) dflt='n';;
16163 *) dflt='y';;
16164 esac
16165 cat <<'EOM'
16166
16167Perl can only use a vfork() that doesn't suffer from strict
16168restrictions on calling functions or modifying global data in
16169the child. For example, glibc-2.1 contains such a vfork()
16170that is unsuitable. If your system provides a proper fork()
16171call, chances are that you do NOT want perl to use vfork().
16172
16173EOM
16174 rp="Do you still want to use vfork()?"
16175 . ./myread
16176 case "$ans" in
16177 y|Y) ;;
16178 *)
16179 echo "Ok, we won't use vfork()."
16180 val="$undef"
16181 ;;
16182 esac
16183 ;;
16184esac
16185set d_vfork
16186eval $setvar
16187case "$d_vfork" in
16188$define) usevfork='true';;
16189*) usevfork='false';;
16190esac
16191
263fee3f
JH
16192: see whether the pthread_atfork exists
16193$cat >try.c <<EOP
16194#include <pthread.h>
16195#include <stdio.h>
16196int main() {
16197#ifdef PTHREAD_ATFORK
16198 pthread_atfork(NULL,NULL,NULL);
16199#endif
16200}
16201EOP
16202
d6483fcc 16203: see if pthread_atfork exists
263fee3f
JH
16204set try -DPTHREAD_ATFORK
16205if eval $compile; then
16206 val="$define"
16207else
16208 val="$undef"
16209fi
16210case "$usethreads" in
16211$define)
16212 case "$val" in
16213 $define) echo 'pthread_atfork found.' >&4 ;;
16214 *) echo 'pthread_atfork NOT found.' >&4 ;;
16215 esac
16216esac
16217set d_pthread_atfork
16218eval $setvar
d6483fcc 16219
58d975c3
JH
16220: see if pthread_attr_setscope exists
16221set pthread_attr_setscope d_pthread_attr_setscope
16222eval $inlibc
16223
b4eb6b3d
JH
16224: see whether the various POSIXish _yields exist
16225$cat >try.c <<EOP
16226#include <pthread.h>
16227#include <stdio.h>
16228int main() {
16229#ifdef SCHED_YIELD
16230 sched_yield();
16231#else
16232#ifdef PTHREAD_YIELD
16233 pthread_yield();
16234#else
16235#ifdef PTHREAD_YIELD_NULL
16236 pthread_yield(NULL);
16237#endif
16238#endif
16239#endif
16240}
16241EOP
16242: see if sched_yield exists
16243set try -DSCHED_YIELD
16244if eval $compile; then
16245 val="$define"
16246 sched_yield='sched_yield()'
16247else
16248 val="$undef"
16249fi
16250case "$usethreads" in
16251$define)
16252 case "$val" in
16253 $define) echo 'sched_yield() found.' >&4 ;;
16254 *) echo 'sched_yield() NOT found.' >&4 ;;
16255 esac
16256esac
10bc17b6
JH
16257set d_sched_yield
16258eval $setvar
b4eb6b3d 16259
10bc17b6
JH
16260: see if pthread_yield exists
16261set try -DPTHREAD_YIELD
16262if eval $compile; then
16263 val="$define"
16264 case "$sched_yield" in
16265 '') sched_yield='pthread_yield()' ;;
16266 esac
16267else
16268 set try -DPTHREAD_YIELD_NULL
16269 if eval $compile; then
16270 val="$define"
16271 case "$sched_yield" in
16272 '') sched_yield='pthread_yield(NULL)' ;;
16273 esac
16274 else
16275 val="$undef"
16276 fi
16277fi
16278case "$usethreads" in
16279$define)
16280 case "$val" in
16281 $define) echo 'pthread_yield() found.' >&4 ;;
16282 *) echo 'pthread_yield() NOT found.' >&4 ;;
16283 esac
16284 ;;
16285esac
16286set d_pthread_yield
16287eval $setvar
10bc17b6
JH
16288case "$sched_yield" in
16289'') sched_yield=undef ;;
16290esac
5b813a60 16291$rm_try
10bc17b6
JH
16292
16293: see if random_r exists
16294set random_r d_random_r
16295eval $inlibc
16296case "$d_random_r" in
16297"$define")
16298 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16299 case "$d_random_r_proto:$usethreads" in
16300 ":define") d_random_r_proto=define
a48ec845
JH
16301 set d_random_r_proto random_r $hdrs
16302 eval $hasproto ;;
16303 *) ;;
16304 esac
16305 case "$d_random_r_proto" in
16306 define)
10bc17b6
JH
16307 case "$random_r_proto" in
16308 ''|0) try='int random_r(int*, struct random_data*);'
61c26d18 16309 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
a845a0d4
JH
16310 esac
16311 case "$random_r_proto" in
16312 ''|0) try='int random_r(long*, struct random_data*);'
61c26d18 16313 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
a845a0d4
JH
16314 esac
16315 case "$random_r_proto" in
16316 ''|0) try='int random_r(struct random_data*, int32_t*);'
61c26d18 16317 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
16318 esac
16319 case "$random_r_proto" in
90e831dc 16320 ''|0) d_random_r=undef
10bc17b6 16321 random_r_proto=0
a48ec845 16322 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16323 * ) case "$random_r_proto" in
16324 REENTRANT_PROTO*) ;;
16325 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16326 esac
16327 echo "Prototype: $try" ;;
16328 esac
b4eb6b3d 16329 ;;
c18e646a
JH
16330 *) case "$usethreads" in
16331 define) echo "random_r has no prototype, not using it." >&4 ;;
16332 esac
90e831dc
SB
16333 d_random_r=undef
16334 random_r_proto=0
c18e646a 16335 ;;
a48ec845
JH
16336 esac
16337 ;;
10bc17b6 16338*) random_r_proto=0
b4eb6b3d
JH
16339 ;;
16340esac
16341
16342: see if readdir and friends exist
16343set readdir d_readdir
16344eval $inlibc
16345set seekdir d_seekdir
16346eval $inlibc
16347set telldir d_telldir
16348eval $inlibc
16349set rewinddir d_rewinddir
16350eval $inlibc
16351
10bc17b6
JH
16352: see if readdir64_r exists
16353set readdir64_r d_readdir64_r
16354eval $inlibc
16355case "$d_readdir64_r" in
16356"$define")
16357 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16358 case "$d_readdir64_r_proto:$usethreads" in
16359 ":define") d_readdir64_r_proto=define
a48ec845
JH
16360 set d_readdir64_r_proto readdir64_r $hdrs
16361 eval $hasproto ;;
16362 *) ;;
16363 esac
16364 case "$d_readdir64_r_proto" in
16365 define)
10bc17b6
JH
16366 case "$readdir64_r_proto" in
16367 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
61c26d18 16368 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
10bc17b6
JH
16369 esac
16370 case "$readdir64_r_proto" in
16371 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
61c26d18 16372 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
10bc17b6
JH
16373 esac
16374 case "$readdir64_r_proto" in
90e831dc 16375 ''|0) d_readdir64_r=undef
10bc17b6 16376 readdir64_r_proto=0
a48ec845 16377 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16378 * ) case "$readdir64_r_proto" in
16379 REENTRANT_PROTO*) ;;
16380 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16381 esac
16382 echo "Prototype: $try" ;;
16383 esac
16384 ;;
c18e646a
JH
16385 *) case "$usethreads" in
16386 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16387 esac
90e831dc
SB
16388 d_readdir64_r=undef
16389 readdir64_r_proto=0
c18e646a 16390 ;;
a48ec845
JH
16391 esac
16392 ;;
10bc17b6
JH
16393*) readdir64_r_proto=0
16394 ;;
16395esac
16396
16397: see if readdir_r exists
16398set readdir_r d_readdir_r
16399eval $inlibc
16400case "$d_readdir_r" in
16401"$define")
16402 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16403 case "$d_readdir_r_proto:$usethreads" in
16404 ":define") d_readdir_r_proto=define
a48ec845
JH
16405 set d_readdir_r_proto readdir_r $hdrs
16406 eval $hasproto ;;
16407 *) ;;
16408 esac
16409 case "$d_readdir_r_proto" in
16410 define)
10bc17b6
JH
16411 case "$readdir_r_proto" in
16412 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
61c26d18 16413 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
10bc17b6
JH
16414 esac
16415 case "$readdir_r_proto" in
16416 ''|0) try='int readdir_r(DIR*, struct dirent*);'
61c26d18 16417 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
10bc17b6
JH
16418 esac
16419 case "$readdir_r_proto" in
90e831dc 16420 ''|0) d_readdir_r=undef
10bc17b6 16421 readdir_r_proto=0
a48ec845 16422 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16423 * ) case "$readdir_r_proto" in
16424 REENTRANT_PROTO*) ;;
16425 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16426 esac
16427 echo "Prototype: $try" ;;
16428 esac
16429 ;;
c18e646a
JH
16430 *) case "$usethreads" in
16431 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16432 esac
90e831dc
SB
16433 d_readdir_r=undef
16434 readdir_r_proto=0
c18e646a 16435 ;;
a48ec845
JH
16436 esac
16437 ;;
10bc17b6
JH
16438*) readdir_r_proto=0
16439 ;;
16440esac
16441
4e0554ec
JH
16442: see if readv exists
16443set readv d_readv
16444eval $inlibc
16445
16446: see if recvmsg exists
16447set recvmsg d_recvmsg
16448eval $inlibc
16449
b4eb6b3d
JH
16450: see if rename exists
16451set rename d_rename
16452eval $inlibc
16453
16454: see if rmdir exists
16455set rmdir d_rmdir
16456eval $inlibc
16457
16458: see if memory.h is available.
16459val=''
16460set memory.h val
16461eval $inhdr
16462
16463: See if it conflicts with string.h
16464case "$val" in
16465$define)
16466 case "$strings" in
16467 '') ;;
16468 *)
16469 $cppstdin $cppflags $cppminus < $strings > mem.h
16470 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16471 echo " "
16472 echo "We won't be including <memory.h>."
16473 val="$undef"
16474 fi
16475 $rm -f mem.h
16476 ;;
16477 esac
16478esac
16479set i_memory
16480eval $setvar
16481
16482: can bcopy handle overlapping blocks?
b6cc3bc4 16483echo " "
b4eb6b3d 16484val="$undef"
b6cc3bc4
AD
16485case "$d_memmove" in
16486"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16487*) case "$d_bcopy" in
16488 "$define")
16489 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16490 $cat >try.c <<EOCP
b4eb6b3d
JH
16491#$i_memory I_MEMORY
16492#$i_stdlib I_STDLIB
16493#$i_string I_STRING
16494#$i_unistd I_UNISTD
16495EOCP
16496 $cat >>try.c <<'EOCP'
16497#include <stdio.h>
16498#ifdef I_MEMORY
16499# include <memory.h>
16500#endif
16501#ifdef I_STDLIB
16502# include <stdlib.h>
16503#endif
16504#ifdef I_STRING
16505# include <string.h>
16506#else
16507# include <strings.h>
16508#endif
16509#ifdef I_UNISTD
16510# include <unistd.h> /* Needed for NetBSD */
16511#endif
16512int main()
16513{
16514char buf[128], abc[128];
16515char *b;
16516int len;
16517int off;
16518int align;
16519
b6cc3bc4
AD
16520/* Copy "abcde..." string to char abc[] so that gcc doesn't
16521 try to store the string in read-only memory. */
b4eb6b3d
JH
16522bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16523
16524for (align = 7; align >= 0; align--) {
16525 for (len = 36; len; len--) {
16526 b = buf+align;
16527 bcopy(abc, b, len);
16528 for (off = 1; off <= len; off++) {
16529 bcopy(b, b+off, len);
16530 bcopy(b+off, b, len);
16531 if (bcmp(b, abc, len))
16532 exit(1);
16533 }
16534 }
16535}
16536exit(0);
16537}
16538EOCP
b6cc3bc4
AD
16539 set try
16540 if eval $compile_ok; then
43dddb59 16541 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16542 echo "Yes, it can."
16543 val="$define"
16544 else
16545 echo "It can't, sorry."
16546 fi
b4eb6b3d 16547 else
b6cc3bc4 16548 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16549 fi
b6cc3bc4
AD
16550 ;;
16551 esac
5b813a60 16552 $rm_try
b4eb6b3d
JH
16553 ;;
16554esac
b4eb6b3d
JH
16555set d_safebcpy
16556eval $setvar
16557
16558: can memcpy handle overlapping blocks?
b6cc3bc4 16559echo " "
b4eb6b3d 16560val="$undef"
b6cc3bc4
AD
16561case "$d_memmove" in
16562"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16563*) case "$d_memcpy" in
16564 "$define")
16565 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16566 $cat >try.c <<EOCP
b4eb6b3d
JH
16567#$i_memory I_MEMORY
16568#$i_stdlib I_STDLIB
16569#$i_string I_STRING
16570#$i_unistd I_UNISTD
16571EOCP
16572 $cat >>try.c <<'EOCP'
16573#include <stdio.h>
16574#ifdef I_MEMORY
16575# include <memory.h>
16576#endif
16577#ifdef I_STDLIB
16578# include <stdlib.h>
16579#endif
16580#ifdef I_STRING
16581# include <string.h>
16582#else
16583# include <strings.h>
16584#endif
16585#ifdef I_UNISTD
16586# include <unistd.h> /* Needed for NetBSD */
16587#endif
16588int main()
16589{
16590char buf[128], abc[128];
16591char *b;
16592int len;
16593int off;
16594int align;
16595
16596/* Copy "abcde..." string to char abc[] so that gcc doesn't
16597 try to store the string in read-only memory. */
16598memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16599
16600for (align = 7; align >= 0; align--) {
16601 for (len = 36; len; len--) {
16602 b = buf+align;
16603 memcpy(b, abc, len);
16604 for (off = 1; off <= len; off++) {
16605 memcpy(b+off, b, len);
16606 memcpy(b, b+off, len);
16607 if (memcmp(b, abc, len))
16608 exit(1);
16609 }
16610 }
16611}
16612exit(0);
16613}
16614EOCP
b6cc3bc4
AD
16615 set try
16616 if eval $compile_ok; then
43dddb59 16617 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16618 echo "Yes, it can."
16619 val="$define"
16620 else
16621 echo "It can't, sorry."
16622 fi
b4eb6b3d 16623 else
b6cc3bc4 16624 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16625 fi
b6cc3bc4
AD
16626 ;;
16627 esac
5b813a60 16628 $rm_try
b4eb6b3d
JH
16629 ;;
16630esac
b4eb6b3d
JH
16631set d_safemcpy
16632eval $setvar
16633
16634: can memcmp be trusted to compare relative magnitude?
16635val="$undef"
16636case "$d_memcmp" in
16637"$define")
16638 echo " "
16639 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16640 $cat >try.c <<EOCP
16641#$i_memory I_MEMORY
16642#$i_stdlib I_STDLIB
16643#$i_string I_STRING
16644#$i_unistd I_UNISTD
16645EOCP
16646 $cat >>try.c <<'EOCP'
16647#include <stdio.h>
16648#ifdef I_MEMORY
16649# include <memory.h>
16650#endif
16651#ifdef I_STDLIB
36adc09b 16652# include <stdlib.h>
b4eb6b3d
JH
16653#endif
16654#ifdef I_STRING
16655# include <string.h>
16656#else
16657# include <strings.h>
16658#endif
16659#ifdef I_UNISTD
16660# include <unistd.h> /* Needed for NetBSD */
16661#endif
16662int main()
16663{
16664char a = -1;
16665char b = 0;
16666if ((a < b) && memcmp(&a, &b, 1) < 0)
16667 exit(1);
16668exit(0);
16669}
16670EOCP
16671 set try
16672 if eval $compile_ok; then
5440bc8e 16673 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16674 echo "Yes, it can."
16675 val="$define"
16676 else
16677 echo "No, it can't (it uses signed chars)."
16678 fi
16679 else
16680 echo "(I can't compile the test program, so we'll assume not...)"
16681 fi
16682 ;;
16683esac
5b813a60 16684$rm_try
b4eb6b3d
JH
16685set d_sanemcmp
16686eval $setvar
16687
ef9f17be
JH
16688: see if prototype for sbrk is available
16689echo " "
16690set d_sbrkproto sbrk $i_unistd unistd.h
16691eval $hasproto
16692
b4eb6b3d
JH
16693: see if select exists
16694set select d_select
16695eval $inlibc
16696
16697: see if semctl exists
16698set semctl d_semctl
16699eval $inlibc
16700
16701: see if semget exists
16702set semget d_semget
16703eval $inlibc
16704
16705: see if semop exists
16706set semop d_semop
16707eval $inlibc
16708
16709: see how much of the 'sem*(2)' library is present.
16710h_sem=true
16711echo " "
16712case "$d_semctl$d_semget$d_semop" in
16713*"$undef"*) h_sem=false;;
16714esac
16715case "$osname" in
16716freebsd)
16717 case "`ipcs 2>&1`" in
16718 "SVID messages"*"not configured"*)
16719 echo "Your $osname does not have the sem*(2) configured." >&4
16720 h_sem=false
16721 val="$undef"
16722 set semctl d_semctl
16723 eval $setvar
16724 set semget d_semget
16725 eval $setvar
16726 set semop d_semop
16727 eval $setvar
16728 ;;
16729 esac
16730 ;;
16731esac
16732: we could also check for sys/ipc.h ...
16733if $h_sem && $test `./findhdr sys/sem.h`; then
16734 echo "You have the full sem*(2) library." >&4
16735 val="$define"
16736else
16737 echo "You don't have the full sem*(2) library." >&4
16738 val="$undef"
16739fi
16740set d_sem
16741eval $setvar
16742
16743: see whether sys/sem.h defines union semun
16744echo " "
16745$cat > try.c <<'END'
16746#include <sys/types.h>
16747#include <sys/ipc.h>
16748#include <sys/sem.h>
16749int main () { union semun semun; semun.buf = 0; }
16750END
16751set try
16752if eval $compile; then
16753 echo "You have union semun in <sys/sem.h>." >&4
16754 val="$define"
16755else
16756 echo "You do not have union semun in <sys/sem.h>." >&4
16757 val="$undef"
16758fi
5b813a60 16759$rm_try
b4eb6b3d
JH
16760set d_union_semun
16761eval $setvar
16762
16763: see how to do semctl IPC_STAT
16764case "$d_sem" in
16765$define)
b4eb6b3d 16766 echo " "
93451a0d 16767 $cat > tryh.h <<END
b4eb6b3d
JH
16768#ifndef S_IRUSR
16769# ifdef S_IREAD
16770# define S_IRUSR S_IREAD
16771# define S_IWUSR S_IWRITE
16772# define S_IXUSR S_IEXEC
16773# else
16774# define S_IRUSR 0400
16775# define S_IWUSR 0200
16776# define S_IXUSR 0100
16777# endif
16778# define S_IRGRP (S_IRUSR>>3)
16779# define S_IWGRP (S_IWUSR>>3)
16780# define S_IXGRP (S_IXUSR>>3)
16781# define S_IROTH (S_IRUSR>>6)
16782# define S_IWOTH (S_IWUSR>>6)
16783# define S_IXOTH (S_IXUSR>>6)
16784#endif
16785#ifndef S_IRWXU
16786# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16787# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16788# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16789#endif
16790END
2fad75a1 16791 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16792 case "$d_semctl_semun" in
16793 '')
35918792 16794 val="$undef"
2fad75a1 16795 $cat > try.c <<END
b4eb6b3d
JH
16796#include <sys/types.h>
16797#include <sys/ipc.h>
16798#include <sys/sem.h>
16799#include <sys/stat.h>
16800#include <stdio.h>
16801#include <errno.h>
93451a0d 16802#include "tryh.h"
b4eb6b3d
JH
16803#ifndef errno
16804extern int errno;
16805#endif
16806#$d_union_semun HAS_UNION_SEMUN
16807int main() {
16808 union semun
16809#ifndef HAS_UNION_SEMUN
16810 {
16811 int val;
16812 struct semid_ds *buf;
16813 unsigned short *array;
16814 }
16815#endif
16816 arg;
16817 int sem, st;
16818
16819#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16820 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16821 if (sem > -1) {
16822 struct semid_ds argbuf;
16823 arg.buf = &argbuf;
16824# ifdef IPC_STAT
16825 st = semctl(sem, 0, IPC_STAT, arg);
16826 if (st == 0)
16827 printf("semun\n");
16828 else
16829# endif /* IPC_STAT */
16830 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16831# ifdef IPC_RMID
16832 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16833# endif /* IPC_RMID */
b4eb6b3d
JH
16834 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16835 } else
16836#endif /* IPC_PRIVATE && ... */
16837 printf("semget failed: errno = %d\n", errno);
16838 return 0;
16839}
16840END
2fad75a1
JH
16841 set try
16842 if eval $compile; then
16843 xxx=`$run ./try`
16844 case "$xxx" in
16845 semun) val="$define" ;;
16846 esac
16847 fi
5b813a60 16848 $rm_try
35918792
YST
16849 set d_semctl_semun
16850 eval $setvar
2fad75a1
JH
16851 ;;
16852 esac
b4eb6b3d
JH
16853 case "$d_semctl_semun" in
16854 $define)
16855 echo "You can use union semun for semctl IPC_STAT." >&4
16856 also='also'
16857 ;;
16858 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16859 also=''
16860 ;;
16861 esac
16862
16863 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16864 case "$d_semctl_semid_ds" in
16865 '')
35918792 16866 val="$undef"
2fad75a1 16867 $cat > try.c <<'END'
b4eb6b3d
JH
16868#include <sys/types.h>
16869#include <sys/ipc.h>
16870#include <sys/sem.h>
16871#include <sys/stat.h>
93451a0d 16872#include "tryh.h"
b4eb6b3d
JH
16873#include <stdio.h>
16874#include <errno.h>
16875#ifndef errno
16876extern int errno;
16877#endif
16878int main() {
16879 struct semid_ds arg;
16880 int sem, st;
16881
16882#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16883 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16884 if (sem > -1) {
16885# ifdef IPC_STAT
16886 st = semctl(sem, 0, IPC_STAT, &arg);
16887 if (st == 0)
16888 printf("semid_ds\n");
16889 else
16890# endif /* IPC_STAT */
16891 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16892# ifdef IPC_RMID
16893 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16894# endif /* IPC_RMID */
16895 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16896 } else
16897#endif /* IPC_PRIVATE && ... */
16898 printf("semget failed: errno = %d\n", errno);
16899
16900 return 0;
16901}
16902END
2fad75a1
JH
16903 set try
16904 if eval $compile; then
16905 xxx=`$run ./try`
16906 case "$xxx" in
16907 semid_ds) val="$define" ;;
16908 esac
16909 fi
5b813a60 16910 $rm_try
35918792
YST
16911 set d_semctl_semid_ds
16912 eval $setvar
2fad75a1
JH
16913 ;;
16914 esac
b4eb6b3d
JH
16915 case "$d_semctl_semid_ds" in
16916 $define)
16917 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16918 ;;
16919 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16920 ;;
16921 esac
b4eb6b3d
JH
16922 ;;
16923*) val="$undef"
16924
16925 # We do not have the full sem*(2) library, so assume we can not
16926 # use either.
16927
16928 set d_semctl_semun
16929 eval $setvar
16930
16931 set d_semctl_semid_ds
16932 eval $setvar
16933 ;;
16934esac
93451a0d 16935$rm_try tryh.h
b4eb6b3d 16936
4e0554ec
JH
16937: see if sendmsg exists
16938set sendmsg d_sendmsg
16939eval $inlibc
16940
b4eb6b3d
JH
16941: see if setegid exists
16942set setegid d_setegid
16943eval $inlibc
16944
16945: see if seteuid exists
16946set seteuid d_seteuid
16947eval $inlibc
16948
16949: see if setgrent exists
16950set setgrent d_setgrent
16951eval $inlibc
16952
10bc17b6
JH
16953: see if setgrent_r exists
16954set setgrent_r d_setgrent_r
16955eval $inlibc
16956case "$d_setgrent_r" in
16957"$define")
16958 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16959 case "$d_setgrent_r_proto:$usethreads" in
16960 ":define") d_setgrent_r_proto=define
a48ec845
JH
16961 set d_setgrent_r_proto setgrent_r $hdrs
16962 eval $hasproto ;;
16963 *) ;;
16964 esac
16965 case "$d_setgrent_r_proto" in
16966 define)
10bc17b6
JH
16967 case "$setgrent_r_proto" in
16968 ''|0) try='int setgrent_r(FILE**);'
61c26d18 16969 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
10bc17b6
JH
16970 esac
16971 case "$setgrent_r_proto" in
16972 ''|0) try='void setgrent_r(FILE**);'
61c26d18 16973 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
10bc17b6
JH
16974 esac
16975 case "$setgrent_r_proto" in
90e831dc 16976 ''|0) d_setgrent_r=undef
10bc17b6 16977 setgrent_r_proto=0
a48ec845 16978 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16979 * ) case "$setgrent_r_proto" in
16980 REENTRANT_PROTO*) ;;
16981 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16982 esac
16983 echo "Prototype: $try" ;;
16984 esac
16985 ;;
c18e646a
JH
16986 *) case "$usethreads" in
16987 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16988 esac
90e831dc
SB
16989 d_setgrent_r=undef
16990 setgrent_r_proto=0
c18e646a 16991 ;;
a48ec845
JH
16992 esac
16993 ;;
10bc17b6
JH
16994*) setgrent_r_proto=0
16995 ;;
16996esac
16997
b4eb6b3d
JH
16998: see if sethostent exists
16999set sethostent d_sethent
17000eval $inlibc
17001
10bc17b6
JH
17002: see if sethostent_r exists
17003set sethostent_r d_sethostent_r
17004eval $inlibc
17005case "$d_sethostent_r" in
17006"$define")
17007 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17008 case "$d_sethostent_r_proto:$usethreads" in
17009 ":define") d_sethostent_r_proto=define
a48ec845
JH
17010 set d_sethostent_r_proto sethostent_r $hdrs
17011 eval $hasproto ;;
17012 *) ;;
17013 esac
17014 case "$d_sethostent_r_proto" in
17015 define)
10bc17b6
JH
17016 case "$sethostent_r_proto" in
17017 ''|0) try='int sethostent_r(int, struct hostent_data*);'
61c26d18 17018 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
10bc17b6
JH
17019 esac
17020 case "$sethostent_r_proto" in
17021 ''|0) try='void sethostent_r(int, struct hostent_data*);'
61c26d18 17022 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
10bc17b6
JH
17023 esac
17024 case "$sethostent_r_proto" in
90e831dc 17025 ''|0) d_sethostent_r=undef
10bc17b6 17026 sethostent_r_proto=0
a48ec845 17027 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17028 * ) case "$sethostent_r_proto" in
17029 REENTRANT_PROTO*) ;;
17030 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17031 esac
17032 echo "Prototype: $try" ;;
17033 esac
17034 ;;
c18e646a
JH
17035 *) case "$usethreads" in
17036 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17037 esac
90e831dc
SB
17038 d_sethostent_r=undef
17039 sethostent_r_proto=0
c18e646a 17040 ;;
a48ec845
JH
17041 esac
17042 ;;
10bc17b6
JH
17043*) sethostent_r_proto=0
17044 ;;
17045esac
17046
4e0554ec
JH
17047: see if setitimer exists
17048set setitimer d_setitimer
17049eval $inlibc
17050
b4eb6b3d
JH
17051: see if setlinebuf exists
17052set setlinebuf d_setlinebuf
17053eval $inlibc
17054
17055: see if setlocale exists
17056set setlocale d_setlocale
17057eval $inlibc
17058
10bc17b6
JH
17059: see if locale.h is available
17060set locale.h i_locale
17061eval $inhdr
17062
17063: see if setlocale_r exists
17064set setlocale_r d_setlocale_r
17065eval $inlibc
17066case "$d_setlocale_r" in
17067"$define")
17068 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
17069 case "$d_setlocale_r_proto:$usethreads" in
17070 ":define") d_setlocale_r_proto=define
a48ec845
JH
17071 set d_setlocale_r_proto setlocale_r $hdrs
17072 eval $hasproto ;;
17073 *) ;;
17074 esac
17075 case "$d_setlocale_r_proto" in
17076 define)
10bc17b6
JH
17077 case "$setlocale_r_proto" in
17078 ''|0) try='int setlocale_r(int, const char*, char*, int);'
61c26d18 17079 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
10bc17b6
JH
17080 esac
17081 case "$setlocale_r_proto" in
90e831dc 17082 ''|0) d_setlocale_r=undef
10bc17b6 17083 setlocale_r_proto=0
a48ec845 17084 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17085 * ) case "$setlocale_r_proto" in
17086 REENTRANT_PROTO*) ;;
17087 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17088 esac
17089 echo "Prototype: $try" ;;
17090 esac
17091 ;;
c18e646a
JH
17092 *) case "$usethreads" in
17093 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17094 esac
90e831dc
SB
17095 d_setlocale_r=undef
17096 setlocale_r_proto=0
c18e646a 17097 ;;
a48ec845
JH
17098 esac
17099 ;;
10bc17b6
JH
17100*) setlocale_r_proto=0
17101 ;;
17102esac
17103
b4eb6b3d
JH
17104: see if setnetent exists
17105set setnetent d_setnent
17106eval $inlibc
17107
10bc17b6
JH
17108: see if setnetent_r exists
17109set setnetent_r d_setnetent_r
17110eval $inlibc
17111case "$d_setnetent_r" in
17112"$define")
17113 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17114 case "$d_setnetent_r_proto:$usethreads" in
17115 ":define") d_setnetent_r_proto=define
a48ec845
JH
17116 set d_setnetent_r_proto setnetent_r $hdrs
17117 eval $hasproto ;;
17118 *) ;;
17119 esac
17120 case "$d_setnetent_r_proto" in
17121 define)
10bc17b6
JH
17122 case "$setnetent_r_proto" in
17123 ''|0) try='int setnetent_r(int, struct netent_data*);'
61c26d18 17124 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
10bc17b6
JH
17125 esac
17126 case "$setnetent_r_proto" in
17127 ''|0) try='void setnetent_r(int, struct netent_data*);'
61c26d18 17128 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
10bc17b6
JH
17129 esac
17130 case "$setnetent_r_proto" in
90e831dc 17131 ''|0) d_setnetent_r=undef
10bc17b6 17132 setnetent_r_proto=0
a48ec845 17133 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17134 * ) case "$setnetent_r_proto" in
17135 REENTRANT_PROTO*) ;;
17136 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17137 esac
17138 echo "Prototype: $try" ;;
17139 esac
17140 ;;
c18e646a
JH
17141 *) case "$usethreads" in
17142 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17143 esac
90e831dc
SB
17144 d_setnetent_r=undef
17145 setnetent_r_proto=0
c18e646a 17146 ;;
a48ec845
JH
17147 esac
17148 ;;
10bc17b6
JH
17149*) setnetent_r_proto=0
17150 ;;
17151esac
17152
b4eb6b3d
JH
17153: see if setprotoent exists
17154set setprotoent d_setpent
17155eval $inlibc
17156
17157: see if setpgid exists
17158set setpgid d_setpgid
17159eval $inlibc
17160
17161: see if setpgrp2 exists
17162set setpgrp2 d_setpgrp2
17163eval $inlibc
17164
17165: see if setpriority exists
17166set setpriority d_setprior
17167eval $inlibc
17168
17169: see if setproctitle exists
17170set setproctitle d_setproctitle
17171eval $inlibc
17172
10bc17b6
JH
17173: see if setprotoent_r exists
17174set setprotoent_r d_setprotoent_r
17175eval $inlibc
17176case "$d_setprotoent_r" in
17177"$define")
17178 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17179 case "$d_setprotoent_r_proto:$usethreads" in
17180 ":define") d_setprotoent_r_proto=define
a48ec845
JH
17181 set d_setprotoent_r_proto setprotoent_r $hdrs
17182 eval $hasproto ;;
17183 *) ;;
17184 esac
17185 case "$d_setprotoent_r_proto" in
17186 define)
10bc17b6
JH
17187 case "$setprotoent_r_proto" in
17188 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
61c26d18 17189 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
10bc17b6
JH
17190 esac
17191 case "$setprotoent_r_proto" in
17192 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
61c26d18 17193 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
10bc17b6
JH
17194 esac
17195 case "$setprotoent_r_proto" in
90e831dc 17196 ''|0) d_setprotoent_r=undef
10bc17b6 17197 setprotoent_r_proto=0
a48ec845 17198 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17199 * ) case "$setprotoent_r_proto" in
17200 REENTRANT_PROTO*) ;;
17201 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17202 esac
17203 echo "Prototype: $try" ;;
17204 esac
17205 ;;
c18e646a
JH
17206 *) case "$usethreads" in
17207 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17208 esac
90e831dc
SB
17209 d_setprotoent_r=undef
17210 setprotoent_r_proto=0
c18e646a 17211 ;;
a48ec845
JH
17212 esac
17213 ;;
10bc17b6
JH
17214*) setprotoent_r_proto=0
17215 ;;
17216esac
17217
b4eb6b3d
JH
17218: see if setpwent exists
17219set setpwent d_setpwent
17220eval $inlibc
17221
10bc17b6
JH
17222: see if setpwent_r exists
17223set setpwent_r d_setpwent_r
17224eval $inlibc
17225case "$d_setpwent_r" in
17226"$define")
17227 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
17228 case "$d_setpwent_r_proto:$usethreads" in
17229 ":define") d_setpwent_r_proto=define
a48ec845
JH
17230 set d_setpwent_r_proto setpwent_r $hdrs
17231 eval $hasproto ;;
17232 *) ;;
17233 esac
17234 case "$d_setpwent_r_proto" in
17235 define)
10bc17b6
JH
17236 case "$setpwent_r_proto" in
17237 ''|0) try='int setpwent_r(FILE**);'
61c26d18 17238 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
10bc17b6
JH
17239 esac
17240 case "$setpwent_r_proto" in
17241 ''|0) try='void setpwent_r(FILE**);'
61c26d18 17242 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
10bc17b6
JH
17243 esac
17244 case "$setpwent_r_proto" in
90e831dc 17245 ''|0) d_setpwent_r=undef
10bc17b6 17246 setpwent_r_proto=0
a48ec845 17247 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17248 * ) case "$setpwent_r_proto" in
17249 REENTRANT_PROTO*) ;;
17250 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17251 esac
17252 echo "Prototype: $try" ;;
17253 esac
17254 ;;
c18e646a
JH
17255 *) case "$usethreads" in
17256 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17257 esac
90e831dc
SB
17258 d_setpwent_r=undef
17259 setpwent_r_proto=0
c18e646a 17260 ;;
a48ec845
JH
17261 esac
17262 ;;
10bc17b6
JH
17263*) setpwent_r_proto=0
17264 ;;
17265esac
17266
b4eb6b3d
JH
17267: see if setregid exists
17268set setregid d_setregid
17269eval $inlibc
17270set setresgid d_setresgid
17271eval $inlibc
17272
17273: see if setreuid exists
17274set setreuid d_setreuid
17275eval $inlibc
17276set setresuid d_setresuid
17277eval $inlibc
17278
17279: see if setrgid exists
17280set setrgid d_setrgid
17281eval $inlibc
17282
17283: see if setruid exists
17284set setruid d_setruid
17285eval $inlibc
17286
17287: see if setservent exists
17288set setservent d_setsent
17289eval $inlibc
17290
10bc17b6
JH
17291: see if setservent_r exists
17292set setservent_r d_setservent_r
17293eval $inlibc
17294case "$d_setservent_r" in
17295"$define")
17296 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17297 case "$d_setservent_r_proto:$usethreads" in
17298 ":define") d_setservent_r_proto=define
a48ec845
JH
17299 set d_setservent_r_proto setservent_r $hdrs
17300 eval $hasproto ;;
17301 *) ;;
17302 esac
17303 case "$d_setservent_r_proto" in
17304 define)
10bc17b6
JH
17305 case "$setservent_r_proto" in
17306 ''|0) try='int setservent_r(int, struct servent_data*);'
61c26d18 17307 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
10bc17b6
JH
17308 esac
17309 case "$setservent_r_proto" in
17310 ''|0) try='void setservent_r(int, struct servent_data*);'
61c26d18 17311 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
10bc17b6
JH
17312 esac
17313 case "$setservent_r_proto" in
90e831dc 17314 ''|0) d_setservent_r=undef
10bc17b6 17315 setservent_r_proto=0
a48ec845 17316 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17317 * ) case "$setservent_r_proto" in
17318 REENTRANT_PROTO*) ;;
17319 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17320 esac
17321 echo "Prototype: $try" ;;
17322 esac
17323 ;;
c18e646a
JH
17324 *) case "$usethreads" in
17325 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17326 esac
90e831dc
SB
17327 d_setservent_r=undef
17328 setservent_r_proto=0
c18e646a 17329 ;;
a48ec845
JH
17330 esac
17331 ;;
10bc17b6
JH
17332*) setservent_r_proto=0
17333 ;;
17334esac
17335
b4eb6b3d
JH
17336: see if setsid exists
17337set setsid d_setsid
17338eval $inlibc
17339
17340: see if setvbuf exists
17341set setvbuf d_setvbuf
17342eval $inlibc
17343
17344: see if sfio.h is available
17345set sfio.h i_sfio
17346eval $inhdr
17347
b4eb6b3d
JH
17348: see if sfio library is available
17349case "$i_sfio" in
17350$define)
17351 val=''
17352 set sfreserve val
17353 eval $inlibc
17354 ;;
17355*)
17356 val="$undef"
17357 ;;
17358esac
17359: Ok, but do we want to use it.
17360case "$val" in
17361$define)
17362 case "$usesfio" in
17363 true|$define|[yY]*) dflt='y';;
17364 *) dflt='n';;
17365 esac
17366 echo "$package can use the sfio library, but it is experimental."
17367 case "$useperlio" in
17368 "$undef")
17369 echo "For sfio also the PerlIO abstraction layer is needed."
17370 echo "Earlier you said you wouldn't want that."
17371 ;;
17372 esac
17373 rp="You seem to have sfio available, do you want to try using it?"
17374 . ./myread
17375 case "$ans" in
17376 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
17377 useperlio="$define"
17378 val="$define"
17379 ;;
17380 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
17381 val="$undef"
b4eb6b3d
JH
17382 ;;
17383 esac
17384 ;;
17385*) case "$usesfio" in
17386 true|$define|[yY]*)
17387 echo "Sorry, cannot find sfio on this machine." >&4
17388 echo "Ignoring your setting of usesfio=$usesfio." >&4
17389 val="$undef"
17390 ;;
17391 esac
17392 ;;
17393esac
17394set d_sfio
17395eval $setvar
17396case "$d_sfio" in
17397$define) usesfio='true';;
17398*) usesfio='false';;
17399esac
3659ebf1
JH
17400case "$d_sfio" in
17401$define) ;;
17402*) : Remove sfio from list of libraries to use
7483f793
JH
17403 case "$libs" in
17404 *-lsfio*)
17405 echo "Removing unneeded -lsfio from library list" >&4
17406 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17407 shift
17408 libs="$*"
17409 echo "libs = $libs" >&4
17410 ;;
17411 esac
3659ebf1
JH
17412;;
17413esac
17414
b4eb6b3d
JH
17415
17416: see if shmctl exists
17417set shmctl d_shmctl
17418eval $inlibc
17419
17420: see if shmget exists
17421set shmget d_shmget
17422eval $inlibc
17423
17424: see if shmat exists
17425set shmat d_shmat
17426eval $inlibc
17427: see what shmat returns
17428case "$d_shmat" in
17429"$define")
17430 $cat >shmat.c <<'END'
17431#include <sys/shm.h>
17432void *shmat();
17433END
17434 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17435 shmattype='void *'
17436 else
17437 shmattype='char *'
17438 fi
17439 echo "and it returns ($shmattype)." >&4
17440 : see if a prototype for shmat is available
17441 xxx=`./findhdr sys/shm.h`
17442 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17443 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17444 val="$define"
17445 else
17446 val="$undef"
17447 fi
17448 $rm -f shmat.[co]
17449 ;;
17450*)
17451 val="$undef"
17452 ;;
17453esac
17454set d_shmatprototype
17455eval $setvar
17456
17457: see if shmdt exists
17458set shmdt d_shmdt
17459eval $inlibc
17460
17461: see how much of the 'shm*(2)' library is present.
17462h_shm=true
17463echo " "
17464case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17465*"$undef"*) h_shm=false;;
17466esac
17467case "$osname" in
17468freebsd)
17469 case "`ipcs 2>&1`" in
17470 "SVID shared memory"*"not configured"*)
17471 echo "Your $osname does not have the shm*(2) configured." >&4
17472 h_shm=false
17473 val="$undef"
17474 set shmctl d_shmctl
17475 evat $setvar
17476 set shmget d_shmget
17477 evat $setvar
17478 set shmat d_shmat
17479 evat $setvar
17480 set shmdt d_shmdt
17481 evat $setvar
17482 ;;
17483 esac
17484 ;;
17485esac
17486: we could also check for sys/ipc.h ...
17487if $h_shm && $test `./findhdr sys/shm.h`; then
17488 echo "You have the full shm*(2) library." >&4
17489 val="$define"
17490else
17491 echo "You don't have the full shm*(2) library." >&4
17492 val="$undef"
17493fi
17494set d_shm
17495eval $setvar
17496
b4eb6b3d 17497: see if we have sigaction
613d6c3e 17498echo " "
b4eb6b3d
JH
17499if set sigaction val -f d_sigaction; eval $csym; $val; then
17500 echo 'sigaction() found.' >&4
073b6de5 17501 $cat > try.c <<EOP
b4eb6b3d
JH
17502#include <stdio.h>
17503#include <sys/types.h>
17504#include <signal.h>
073b6de5
JH
17505#$i_stdlib I_STDLIB
17506#ifdef I_STDLIB
17507#include <stdlib.h>
17508#endif
b4eb6b3d
JH
17509int main()
17510{
17511 struct sigaction act, oact;
17512 act.sa_flags = 0;
17513 oact.sa_handler = 0;
17514 /* so that act and oact are used */
17515 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17516}
17517EOP
17518 set try
17519 if eval $compile_ok; then
17520 val="$define"
17521 else
17522 echo "But you don't seem to have a useable struct sigaction." >&4
17523 val="$undef"
17524 fi
17525else
17526 echo 'sigaction NOT found.' >&4
17527 val="$undef"
17528fi
17529set d_sigaction; eval $setvar
5b813a60 17530$rm_try
b4eb6b3d 17531
ed140128
AD
17532: see if this is a sunmath.h system
17533set sunmath.h i_sunmath
17534eval $inhdr
17535
17536: see if signbit exists
17537$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17538$cat >try.c <<EOCP
17539#$i_math I_MATH
17540#$i_sunmath I_SUNMATH
17541#ifdef I_MATH
17542# include <math.h>
17543#endif
17544#ifdef I_SUNMATH /* Solaris special math library */
17545# include <sunmath.h>
17546#endif
17547#define NV $nvtype
17548int main(int argc, char **argv)
17549{
17550 NV x = 0.0;
17551 NV y = -0.0;
17552 if ((signbit(x) == 0) && (signbit(y) != 0))
17553 return 0;
17554 else
17555 return 1;
17556}
17557EOCP
17558val="$undef"
17559set try
17560if eval $compile; then
17561 if $run ./try; then
17562 $echo "Yes." >&4
17563 val="$define"
17564 else
17565 $echo "Signbit seems to be available, but doesn't work as I expected."
17566 $echo "I won't use it." >&4
17567 val="$undef"
17568 fi
17569else
17570 $echo "Nope." >&4
17571 dflt="$undef"
17572fi
17573set d_signbit
17574eval $setvar
5b813a60 17575$rm_try
ed140128 17576
983dbef6
JH
17577: see if sigprocmask exists
17578set sigprocmask d_sigprocmask
17579eval $inlibc
17580
b4eb6b3d
JH
17581: see if sigsetjmp exists
17582echo " "
17583case "$d_sigsetjmp" in
17584'')
c727eafa 17585 $cat >try.c <<EOP
b4eb6b3d 17586#include <setjmp.h>
d1daaddf
JH
17587#$i_stdlib I_STDLIB
17588#ifdef I_STDLIB
17589#include <stdlib.h>
17590#endif
b4eb6b3d
JH
17591sigjmp_buf env;
17592int set = 1;
17593int main()
17594{
17595 if (sigsetjmp(env,1))
17596 exit(set);
17597 set = 0;
17598 siglongjmp(env, 1);
17599 exit(1);
17600}
17601EOP
17602 set try
17603 if eval $compile; then
5440bc8e 17604 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17605 echo "POSIX sigsetjmp found." >&4
17606 val="$define"
17607 else
17608 $cat >&4 <<EOM
17609Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17610I'll ignore them.
17611EOM
17612 val="$undef"
17613 fi
17614 else
17615 echo "sigsetjmp not found." >&4
17616 val="$undef"
17617 fi
17618 ;;
17619*) val="$d_sigsetjmp"
17620 case "$d_sigsetjmp" in
17621 $define) echo "POSIX sigsetjmp found." >&4;;
17622 $undef) echo "sigsetjmp not found." >&4;;
17623 esac
17624 ;;
17625esac
17626set d_sigsetjmp
17627eval $setvar
5b813a60 17628$rm_try
b4eb6b3d 17629
4f5da3e9
SP
17630: see if snprintf exists
17631set snprintf d_snprintf
17632eval $inlibc
17633
17634: see if vsnprintf exists
17635set vsnprintf d_vsnprintf
17636eval $inlibc
17637
2478f7a0
MB
17638case "$d_snprintf-$d_vsnprintf" in
17639"$define-$define")
17640 $cat <<EOM
17641Checking whether your snprintf() and vsnprintf() work okay...
17642EOM
17643 $cat >try.c <<'EOCP'
17644/* v?snprintf testing logic courtesy of Russ Allbery.
17645 * According to C99:
17646 * - if the buffer is too short it still must be \0-terminated
17647 * - if the buffer is too short the potentially required length
17648 * must be returned and not -1
17649 * - if the buffer is NULL the potentially required length
17650 * must be returned and not -1 or core dump
17651 */
17652#include <stdio.h>
17653#include <stdarg.h>
17654
17655char buf[2];
17656
17657int test (char *format, ...)
17658{
17659 va_list args;
17660 int count;
17661
17662 va_start (args, format);
17663 count = vsnprintf (buf, sizeof buf, format, args);
17664 va_end (args);
17665 return count;
17666}
17667
17668int main ()
17669{
17670 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17671 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17672}
17673EOCP
17674 set try
17675 if eval $compile; then
17676 `$run ./try`
17677 case "$?" in
17678 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17679 *) cat <<EOM >&4
17680Your snprintf() and snprintf() don't seem to be working okay.
17681EOM
17682 d_snprintf="$undef"
17683 d_vsnprintf="$undef"
17684 ;;
17685 esac
17686 else
17687 echo "(I can't seem to compile the test program--assuming they don't)"
17688 d_snprintf="$undef"
17689 d_vsnprintf="$undef"
17690 fi
5b813a60 17691 $rm_try
2478f7a0
MB
17692 ;;
17693esac
17694
49a78c82
JH
17695: see if sockatmark exists
17696set sockatmark d_sockatmark
17697eval $inlibc
17698
2ef53570
JH
17699: see if prototype for sockatmark is available
17700echo " "
17701set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17702eval $hasproto
17703
b4eb6b3d
JH
17704: see if socks5_init exists
17705set socks5_init d_socks5_init
17706eval $inlibc
17707
360321b3
YST
17708: see if sprintf returns the length of the string in the buffer as per ANSI
17709$echo "Checking whether sprintf returns the length of the string..." >&4
17710$cat <<EOP >try.c
17711#include <stdio.h>
17712#$i_stdlib I_STDLIB
17713#ifdef I_STDLIB
17714#include <stdlib.h>
17715#endif
17716#$i_string I_STRING
17717#ifdef I_STRING
17718# include <string.h>
17719#else
17720# include <strings.h>
17721#endif
17722#$i_math I_MATH
17723#ifdef I_MATH
17724#include <math.h>
17725#endif
17726
17727char buffer[256];
17728
17729int check (size_t expect, int test) {
17730 size_t got = strlen(buffer);
17731 if (expect == got)
17732 return 0;
17733
17734 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17735 test, buffer);
17736 exit (test);
17737}
17738
17739int main(int argc, char **argv) {
17740 int test = 0;
17741
17742 check(sprintf(buffer, ""), ++test);
17743 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17744 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17745
17746 return 0;
17747}
17748EOP
17749set try
17750
360321b3
YST
17751if eval $compile; then
17752 xxx="`$run ./try`"
17753 case "$?" in
17754 0) cat >&4 <<EOM
17755sprintf returns the length of the string (as ANSI says it should)
17756EOM
17757 d_sprintf_returns_strlen="$define"
17758 ;;
17759 *) cat >&4 <<EOM
17760sprintf does not return the length of the string (how old is this system?)
17761EOM
17762 d_sprintf_returns_strlen="$undef"
17763 ;;
17764 esac
d2821e72 17765else
36a30365
JH
17766 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17767 d_sprintf_returns_strlen="$undef"
360321b3 17768fi
5b813a60 17769$rm_try
360321b3 17770
10bc17b6
JH
17771: see if srand48_r exists
17772set srand48_r d_srand48_r
17773eval $inlibc
17774case "$d_srand48_r" in
17775"$define")
17776 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17777 case "$d_srand48_r_proto:$usethreads" in
17778 ":define") d_srand48_r_proto=define
a48ec845
JH
17779 set d_srand48_r_proto srand48_r $hdrs
17780 eval $hasproto ;;
17781 *) ;;
17782 esac
17783 case "$d_srand48_r_proto" in
17784 define)
10bc17b6
JH
17785 case "$srand48_r_proto" in
17786 ''|0) try='int srand48_r(long, struct drand48_data*);'
61c26d18 17787 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
10bc17b6
JH
17788 esac
17789 case "$srand48_r_proto" in
90e831dc 17790 ''|0) d_srand48_r=undef
10bc17b6 17791 srand48_r_proto=0
a48ec845 17792 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17793 * ) case "$srand48_r_proto" in
17794 REENTRANT_PROTO*) ;;
17795 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17796 esac
17797 echo "Prototype: $try" ;;
17798 esac
17799 ;;
c18e646a
JH
17800 *) case "$usethreads" in
17801 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17802 esac
90e831dc
SB
17803 d_srand48_r=undef
17804 srand48_r_proto=0
c18e646a 17805 ;;
a48ec845
JH
17806 esac
17807 ;;
10bc17b6
JH
17808*) srand48_r_proto=0
17809 ;;
17810esac
17811
17812: see if srandom_r exists
17813set srandom_r d_srandom_r
17814eval $inlibc
17815case "$d_srandom_r" in
17816"$define")
17817 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17818 case "$d_srandom_r_proto:$usethreads" in
17819 ":define") d_srandom_r_proto=define
a48ec845
JH
17820 set d_srandom_r_proto srandom_r $hdrs
17821 eval $hasproto ;;
17822 *) ;;
17823 esac
17824 case "$d_srandom_r_proto" in
17825 define)
10bc17b6
JH
17826 case "$srandom_r_proto" in
17827 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
61c26d18 17828 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
10bc17b6
JH
17829 esac
17830 case "$srandom_r_proto" in
90e831dc 17831 ''|0) d_srandom_r=undef
10bc17b6 17832 srandom_r_proto=0
a48ec845 17833 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17834 * ) case "$srandom_r_proto" in
17835 REENTRANT_PROTO*) ;;
17836 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17837 esac
17838 echo "Prototype: $try" ;;
17839 esac
17840 ;;
c18e646a
JH
17841 *) case "$usethreads" in
17842 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17843 esac
90e831dc
SB
17844 d_srandom_r=undef
17845 srandom_r_proto=0
c18e646a 17846 ;;
a48ec845
JH
17847 esac
17848 ;;
10bc17b6
JH
17849*) srandom_r_proto=0
17850 ;;
17851esac
17852
eef837ea
JH
17853: see if prototype for setresgid is available
17854echo " "
17855set d_sresgproto setresgid $i_unistd unistd.h
17856eval $hasproto
17857
640374d0
JH
17858: see if prototype for setresuid is available
17859echo " "
17860set d_sresuproto setresuid $i_unistd unistd.h
17861eval $hasproto
17862
b4eb6b3d
JH
17863: see if sys/stat.h is available
17864set sys/stat.h i_sysstat
17865eval $inhdr
17866
b4eb6b3d
JH
17867: see if stat knows about block sizes
17868echo " "
17869echo "Checking to see if your struct stat has st_blocks field..." >&4
17870set d_statblks stat st_blocks $i_sysstat sys/stat.h
17871eval $hasfield
17872
b4eb6b3d
JH
17873: see if this is a sys/vfs.h system
17874set sys/vfs.h i_sysvfs
17875eval $inhdr
17876
b4eb6b3d
JH
17877: see if this is a sys/statfs.h system
17878set sys/statfs.h i_sysstatfs
17879eval $inhdr
17880
34f1896b 17881: Check for statfs_s
b4eb6b3d
JH
17882echo " "
17883echo "Checking to see if your system supports struct statfs..." >&4
17884set 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
17885eval $hasstruct
17886case "$d_statfs_s" in
17887"$define") echo "Yes, it does." ;;
17888*) echo "No, it doesn't." ;;
17889esac
17890
17891
b4eb6b3d
JH
17892: see if struct statfs knows about f_flags
17893case "$d_statfs_s" in
34f1896b 17894define)
b4eb6b3d
JH
17895 echo " "
17896 echo "Checking to see if your struct statfs has f_flags field..." >&4
17897 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
17898 eval $hasfield
17899 ;;
17900*) val="$undef"
17901 set d_statfs_f_flags
17902 eval $setvar
17903 ;;
17904esac
17905case "$d_statfs_f_flags" in
17906"$define") echo "Yes, it does." ;;
17907*) echo "No, it doesn't." ;;
17908esac
17909
17a6c8e3
AD
17910: see what flavor, if any, of static inline is supported
17911echo " "
17912echo "Checking to see if your system supports static inline..."
17913$cat > try.c <<'EOCP'
17914#include <stdlib.h>
17915extern int f_via_a(int x);
17916extern int f_via_b(int x);
17917int main(int argc, char **argv)
17918{
17919 int y;
17920
17921 y = f_via_a(0);
17922#ifdef USE_B
17923 y = f_via_b(0);
17924#endif
17925 if (y == 42) {
17926 return EXIT_SUCCESS;
17927 }
17928 else {
17929 return EXIT_FAILURE;
17930 }
17931}
17932EOCP
17933$cat > a.c <<'EOCP'
17934static INLINE int f(int x) {
17935 int y;
17936 y = x + 42;
17937 return y;
17938}
17939
17940int f_via_a(int x)
17941{
17942 return f(x);
17943}
17944EOCP
17945$cat > b.c <<'EOCP'
17946extern int f(int x);
17947
17948int f_via_b(int x)
17949{
17950 return f(x);
17951}
17952EOCP
17953
17954# Respect a hint (or previous) value for perl_static_inline, if there is one.
17955case "$perl_static_inline" in
17956'') # Check the various possibilities, and break out on success.
17957 # For gcc, prefer __inline__, which will still permit
17958 # cflags.SH to add in -ansi.
17959 case "$gccversion" in
17960 '') xxx="inline __inline__ __inline _inline";;
17961 *) xxx="__inline__ inline __inline _inline";;
17962 esac
17963 for inline in $xxx; do
17964 set try -DINLINE=$inline a.c
17965 if eval $compile && $run ./try; then
17966 # Now make sure there is no external linkage of static
17967 # functions
17968 set try -DINLINE=$inline -DUSE_B a.c b.c
17969 if eval $compile && $run ./try; then
17970 $echo "Your compiler supports static $inline, " >&4
17971 $echo "but it also creates an external definition," >&4
17972 $echo "so I won't use it." >&4
17973 val=$undef
17974 else
17975 $echo "Your compiler supports static $inline." >&4
17976 val=$define
17977 perl_static_inline="static $inline";
17978 break;
17979 fi
17980 else
17981 $echo "Your compiler does NOT support static $inline." >&4
17982 val="$undef"
17983 fi
17984 done
17985 ;;
17986*inline*) # Some variant of inline exists.
17987 echo "Keeping your $hint value of $perl_static_inline."
17988 val=$define
17989 ;;
17990static) # No inline capabilities
17991 echo "Keeping your $hint value of $perl_static_inline."
17992 val=$undef
17993 ;;
17994*) # Unrecognized previous value -- blindly trust the supplied
17995 # value and hope it makes sense. Use old value for
17996 # d_static_inline, if there is one.
17997 echo "Keeping your $hint value of $perl_static_inline."
17998 case "$d_static_inline" in
17999 '') val=$define ;;
18000 *) val=$d_static_inline ;;
18001 esac
18002 ;;
18003esac
18004# Fallback to plain 'static' if nothing worked.
18005case "$perl_static_inline" in
18006'')
18007 perl_static_inline="static"
18008 val=$undef
18009 ;;
18010esac
18011set d_static_inline
18012eval $setvar
18013$rm -f a.[co] b.[co]
18014$rm_try
18015
613d6c3e 18016: Check stream access
b4eb6b3d
JH
18017$cat >&4 <<EOM
18018Checking how to access stdio streams by file descriptor number...
18019EOM
18020case "$stdio_stream_array" in
18021'') $cat >try.c <<EOCP
18022#include <stdio.h>
18023int main() {
18024 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18025 printf("yes\n");
18026}
18027EOCP
18028 for s in _iob __iob __sF
18029 do
18030 set try -DSTDIO_STREAM_ARRAY=$s
18031 if eval $compile; then
5440bc8e 18032 case "`$run ./try`" in
b4eb6b3d
JH
18033 yes) stdio_stream_array=$s; break ;;
18034 esac
18035 fi
18036 done
5b813a60 18037 $rm_try
b4eb6b3d
JH
18038esac
18039case "$stdio_stream_array" in
18040'') $cat >&4 <<EOM
18041I can't figure out how to access stdio streams by file descriptor number.
18042EOM
18043 d_stdio_stream_array="$undef"
18044 ;;
18045*) $cat >&4 <<EOM
18046You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18047EOM
18048 d_stdio_stream_array="$define"
18049 ;;
18050esac
18051
18052: see if strcoll exists
18053set strcoll d_strcoll
18054eval $inlibc
18055
18056: check for structure copying
18057echo " "
18058echo "Checking to see if your C compiler can copy structs..." >&4
18059$cat >try.c <<'EOCP'
76f47787 18060int main()
b4eb6b3d
JH
18061{
18062 struct blurfl {
18063 int dyick;
18064 } foo, bar;
18065
18066 foo = bar;
18067}
18068EOCP
18069if $cc -c try.c >/dev/null 2>&1 ; then
18070 val="$define"
18071 echo "Yup, it can."
18072else
18073 val="$undef"
18074 echo "Nope, it can't."
18075fi
18076set d_strctcpy
18077eval $setvar
5b813a60 18078$rm_try
b4eb6b3d
JH
18079
18080: see if strerror and/or sys_errlist[] exist
18081echo " "
18082if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18083 if set strerror val -f d_strerror; eval $csym; $val; then
18084 echo 'strerror() found.' >&4
18085 d_strerror="$define"
18086 d_strerrm='strerror(e)'
18087 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18088 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18089 d_syserrlst="$define"
18090 else
18091 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18092 d_syserrlst="$undef"
18093 fi
18094 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18095 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18096 echo 'strerror() found in string header.' >&4
18097 d_strerror="$define"
18098 d_strerrm='strerror(e)'
18099 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18100 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18101 d_syserrlst="$define"
18102 else
18103 echo "(You don't appear to have any sys_errlist[], how can this be?)"
18104 d_syserrlst="$undef"
18105 fi
18106 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18107 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18108 d_strerror="$undef"
18109 d_syserrlst="$define"
18110 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18111 else
18112 echo 'strerror() and sys_errlist[] NOT found.' >&4
18113 d_strerror="$undef"
18114 d_syserrlst="$undef"
18115 d_strerrm='"unknown"'
18116 fi
18117fi
18118
10bc17b6
JH
18119: see if strerror_r exists
18120set strerror_r d_strerror_r
18121eval $inlibc
18122case "$d_strerror_r" in
18123"$define")
18124 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
18125 case "$d_strerror_r_proto:$usethreads" in
18126 ":define") d_strerror_r_proto=define
a48ec845
JH
18127 set d_strerror_r_proto strerror_r $hdrs
18128 eval $hasproto ;;
18129 *) ;;
18130 esac
18131 case "$d_strerror_r_proto" in
18132 define)
10bc17b6
JH
18133 case "$strerror_r_proto" in
18134 ''|0) try='int strerror_r(int, char*, size_t);'
61c26d18 18135 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
10bc17b6
JH
18136 esac
18137 case "$strerror_r_proto" in
18138 ''|0) try='int strerror_r(int, char*, int);'
61c26d18 18139 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
10bc17b6
JH
18140 esac
18141 case "$strerror_r_proto" in
18142 ''|0) try='char* strerror_r(int, char*, size_t);'
61c26d18 18143 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
10bc17b6
JH
18144 esac
18145 case "$strerror_r_proto" in
90e831dc 18146 ''|0) d_strerror_r=undef
10bc17b6 18147 strerror_r_proto=0
a48ec845 18148 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18149 * ) case "$strerror_r_proto" in
18150 REENTRANT_PROTO*) ;;
18151 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18152 esac
18153 echo "Prototype: $try" ;;
18154 esac
18155 ;;
c18e646a
JH
18156 *) case "$usethreads" in
18157 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18158 esac
90e831dc
SB
18159 d_strerror_r=undef
18160 strerror_r_proto=0
c18e646a 18161 ;;
a48ec845
JH
18162 esac
18163 ;;
10bc17b6
JH
18164*) strerror_r_proto=0
18165 ;;
18166esac
18167
b3c85772
JH
18168: see if strftime exists
18169set strftime d_strftime
18170eval $inlibc
18171
08c92000
MB
18172: see if strlcat exists
18173set strlcat d_strlcat
18174eval $inlibc
18175
18176: see if strlcpy exists
18177set strlcpy d_strlcpy
18178eval $inlibc
18179
b4eb6b3d
JH
18180: see if strtod exists
18181set strtod d_strtod
18182eval $inlibc
18183
18184: see if strtol exists
18185set strtol d_strtol
18186eval $inlibc
18187
18188: see if strtold exists
18189set strtold d_strtold
18190eval $inlibc
18191
18192: see if strtoll exists
18193set strtoll d_strtoll
18194eval $inlibc
18195
18196case "$d_longlong-$d_strtoll" in
18197"$define-$define")
18198 $cat <<EOM
18199Checking whether your strtoll() works okay...
18200EOM
18201 $cat >try.c <<'EOCP'
18202#include <errno.h>
18203#ifdef __hpux
18204#define strtoll __strtoll
18205#endif
e75931a7
YST
18206#ifdef __EMX__
18207#define strtoll _strtoll
18208#endif
b4eb6b3d 18209#include <stdio.h>
613d6c3e 18210extern long long int strtoll(char *s, char **, int);
b4eb6b3d
JH
18211static int bad = 0;
18212int check(char *s, long long ell, int een) {
18213 long long gll;
18214 errno = 0;
18215 gll = strtoll(s, 0, 10);
18216 if (!((gll == ell) && (errno == een)))
18217 bad++;
18218}
18219int main() {
18220 check(" 1", 1LL, 0);
18221 check(" 0", 0LL, 0);
18222 check("-1", -1LL, 0);
18223 check("-9223372036854775808", -9223372036854775808LL, 0);
18224 check("-9223372036854775808", -9223372036854775808LL, 0);
18225 check(" 9223372036854775807", 9223372036854775807LL, 0);
18226 check("-9223372036854775808", -9223372036854775808LL, 0);
18227 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
18228 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18229 if (!bad)
18230 printf("ok\n");
18231}
18232EOCP
18233 set try
18234 if eval $compile; then
5440bc8e 18235 yyy=`$run ./try`
e75931a7 18236 case "$yyy" in
b4eb6b3d
JH
18237 ok) echo "Your strtoll() seems to be working okay." ;;
18238 *) cat <<EOM >&4
18239Your strtoll() doesn't seem to be working okay.
18240EOM
18241 d_strtoll="$undef"
18242 ;;
69eadf66 18243 esac
e75931a7
YST
18244 else
18245 echo "(I can't seem to compile the test program--assuming it doesn't)"
18246 d_strtoll="$undef"
b4eb6b3d
JH
18247 fi
18248 ;;
18249esac
18250
28e5dec8
JH
18251: see if strtoq exists
18252set strtoq d_strtoq
18253eval $inlibc
18254
b4eb6b3d
JH
18255: see if strtoul exists
18256set strtoul d_strtoul
18257eval $inlibc
18258
d0e6d399
NC
18259case "$d_strtoul" in
18260"$define")
18261 $cat <<EOM
18262Checking whether your strtoul() works okay...
18263EOM
18264 $cat >try.c <<'EOCP'
18265#include <errno.h>
18266#include <stdio.h>
613d6c3e 18267extern unsigned long int strtoul(char *s, char **, int);
d0e6d399
NC
18268static int bad = 0;
18269void check(char *s, unsigned long eul, int een) {
18270 unsigned long gul;
18271 errno = 0;
18272 gul = strtoul(s, 0, 10);
18273 if (!((gul == eul) && (errno == een)))
18274 bad++;
18275}
18276int main() {
18277 check(" 1", 1L, 0);
18278 check(" 0", 0L, 0);
18279EOCP
18280 case "$longsize" in
18281 8)
18282 $cat >>try.c <<'EOCP'
09c0d2c4
JH
18283 check("18446744073709551615", 18446744073709551615UL, 0);
18284 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 18285#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 18286 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
18287 check("-18446744073709551614", 2, 0);
18288 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
18289 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18290 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 18291#endif
d0e6d399
NC
18292EOCP
18293 ;;
18294 4)
18295 $cat >>try.c <<'EOCP'
18296 check("4294967295", 4294967295UL, 0);
18297 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 18298#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
18299 check("-1", 4294967295UL, 0);
18300 check("-4294967294", 2, 0);
18301 check("-4294967295", 1, 0);
18302 check("-4294967296", 4294967295UL, ERANGE);
18303 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 18304#endif
d0e6d399
NC
18305EOCP
18306 ;;
18307 *)
18308: Should we write these tests to be more portable by sprintf-ing
18309: ~0 and then manipulating that char string as input for strtol?
18310 ;;
18311 esac
18312 $cat >>try.c <<'EOCP'
18313 if (!bad)
18314 printf("ok\n");
18315 return 0;
18316}
18317EOCP
18318 set try
18319 if eval $compile; then
5440bc8e 18320 case "`$run ./try`" in
d0e6d399
NC
18321 ok) echo "Your strtoul() seems to be working okay." ;;
18322 *) cat <<EOM >&4
18323Your strtoul() doesn't seem to be working okay.
18324EOM
18325 d_strtoul="$undef"
18326 ;;
18327 esac
9597a80f
NC
18328 else
18329 echo "(I can't seem to compile the test program--assuming it doesn't)"
18330 d_strtoul="$undef"
d0e6d399
NC
18331 fi
18332 ;;
18333esac
18334
b4eb6b3d
JH
18335: see if strtoull exists
18336set strtoull d_strtoull
18337eval $inlibc
18338
18339case "$d_longlong-$d_strtoull" in
18340"$define-$define")
18341 $cat <<EOM
18342Checking whether your strtoull() works okay...
18343EOM
18344 $cat >try.c <<'EOCP'
18345#include <errno.h>
18346#ifdef __hpux
18347#define strtoull __strtoull
18348#endif
18349#include <stdio.h>
613d6c3e 18350extern unsigned long long int strtoull(char *s, char **, int);
b4eb6b3d
JH
18351static int bad = 0;
18352int check(char *s, long long eull, int een) {
18353 long long gull;
18354 errno = 0;
18355 gull = strtoull(s, 0, 10);
18356 if (!((gull == eull) && (errno == een)))
18357 bad++;
18358}
18359int main() {
d0e6d399
NC
18360 check(" 1", 1LL, 0);
18361 check(" 0", 0LL, 0);
18362 check("18446744073709551615", 18446744073709551615ULL, 0);
18363 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18364#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
18365 check("-1", 18446744073709551615ULL, 0);
18366 check("-18446744073709551614", 2LL, 0);
18367 check("-18446744073709551615", 1LL, 0);
18368 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18369 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18370#endif
b4eb6b3d
JH
18371 if (!bad)
18372 printf("ok\n");
18373}
18374EOCP
18375 set try
18376 if eval $compile; then
5440bc8e 18377 case "`$run ./try`" in
b4eb6b3d
JH
18378 ok) echo "Your strtoull() seems to be working okay." ;;
18379 *) cat <<EOM >&4
18380Your strtoull() doesn't seem to be working okay.
18381EOM
18382 d_strtoull="$undef"
18383 ;;
18384 esac
9597a80f
NC
18385 else
18386 echo "(I can't seem to compile the test program--assuming it doesn't)"
18387 d_strtoull="$undef"
b4eb6b3d
JH
18388 fi
18389 ;;
18390esac
18391
18392: see if strtouq exists
18393set strtouq d_strtouq
18394eval $inlibc
18395
d0e6d399
NC
18396case "$d_strtouq" in
18397"$define")
18398 $cat <<EOM
18399Checking whether your strtouq() works okay...
18400EOM
18401 $cat >try.c <<'EOCP'
18402#include <errno.h>
18403#include <stdio.h>
613d6c3e 18404extern unsigned long long int strtouq(char *s, char **, int);
d0e6d399
NC
18405static int bad = 0;
18406void check(char *s, unsigned long long eull, int een) {
18407 unsigned long long gull;
18408 errno = 0;
18409 gull = strtouq(s, 0, 10);
18410 if (!((gull == eull) && (errno == een)))
18411 bad++;
18412}
18413int main() {
18414 check(" 1", 1LL, 0);
18415 check(" 0", 0LL, 0);
18416 check("18446744073709551615", 18446744073709551615ULL, 0);
18417 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18418#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
18419 check("-1", 18446744073709551615ULL, 0);
18420 check("-18446744073709551614", 2LL, 0);
18421 check("-18446744073709551615", 1LL, 0);
18422 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18423 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18424#endif
d0e6d399
NC
18425 if (!bad)
18426 printf("ok\n");
18427 return 0;
18428}
18429EOCP
18430 set try
18431 if eval $compile; then
5440bc8e 18432 case "`$run ./try`" in
d0e6d399
NC
18433 ok) echo "Your strtouq() seems to be working okay." ;;
18434 *) cat <<EOM >&4
18435Your strtouq() doesn't seem to be working okay.
18436EOM
18437 d_strtouq="$undef"
18438 ;;
18439 esac
9597a80f
NC
18440 else
18441 echo "(I can't seem to compile the test program--assuming it doesn't)"
18442 d_strtouq="$undef"
d0e6d399
NC
18443 fi
18444 ;;
18445esac
18446
b4eb6b3d
JH
18447: see if strxfrm exists
18448set strxfrm d_strxfrm
18449eval $inlibc
18450
18451: see if symlink exists
18452set symlink d_symlink
18453eval $inlibc
18454
18455: see if syscall exists
18456set syscall d_syscall
18457eval $inlibc
18458
2ef53570
JH
18459: see if prototype for syscall is available
18460echo " "
18461set d_syscallproto syscall $i_unistd unistd.h
18462eval $hasproto
18463
b4eb6b3d
JH
18464: see if sysconf exists
18465set sysconf d_sysconf
18466eval $inlibc
18467
18468: see if system exists
18469set system d_system
18470eval $inlibc
18471
18472: see if tcgetpgrp exists
18473set tcgetpgrp d_tcgetpgrp
18474eval $inlibc
18475
18476: see if tcsetpgrp exists
18477set tcsetpgrp d_tcsetpgrp
18478eval $inlibc
18479
18480: see if prototype for telldir is available
18481echo " "
18482set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18483eval $hasproto
18484
ad493445
MB
18485: see if time exists
18486echo " "
18487if test "X$d_time" = X -o X"$timetype" = X; then
18488 if set time val -f d_time; eval $csym; $val; then
18489 echo 'time() found.' >&4
18490 val="$define"
18491 rp="What is the type returned by time() on this system?"
18492 set time_t timetype long stdio.h sys/types.h
18493 eval $typedef_ask
18494 else
18495 echo 'time() not found, hope that will do.' >&4
18496 val="$undef"
18497 timetype='int';
18498 fi
18499 set d_time
18500 eval $setvar
18501fi
18502
cbb9e8a7
MB
18503: see if timegm exists
18504set timegm d_timegm
18505eval $inlibc
18506
b4eb6b3d
JH
18507: see if this is a sys/times.h system
18508set sys/times.h i_systimes
18509eval $inhdr
18510
18511: see if times exists
18512echo " "
18513if set times val -f d_times; eval $csym; $val; then
18514 echo 'times() found.' >&4
18515 d_times="$define"
18516 inc=''
18517 case "$i_systimes" in
18518 "$define") inc='sys/times.h';;
18519 esac
18520 rp="What is the type returned by times() on this system?"
18521 set clock_t clocktype long stdio.h sys/types.h $inc
18522 eval $typedef_ask
18523else
18524 echo 'times() NOT found, hope that will do.' >&4
18525 d_times="$undef"
18526 clocktype='int'
18527fi
18528
10bc17b6
JH
18529: see if tmpnam_r exists
18530set tmpnam_r d_tmpnam_r
18531eval $inlibc
18532case "$d_tmpnam_r" in
18533"$define")
31ee0cb7 18534 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
18535 case "$d_tmpnam_r_proto:$usethreads" in
18536 ":define") d_tmpnam_r_proto=define
a48ec845
JH
18537 set d_tmpnam_r_proto tmpnam_r $hdrs
18538 eval $hasproto ;;
18539 *) ;;
18540 esac
18541 case "$d_tmpnam_r_proto" in
18542 define)
10bc17b6
JH
18543 case "$tmpnam_r_proto" in
18544 ''|0) try='char* tmpnam_r(char*);'
61c26d18 18545 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
10bc17b6
JH
18546 esac
18547 case "$tmpnam_r_proto" in
90e831dc 18548 ''|0) d_tmpnam_r=undef
10bc17b6 18549 tmpnam_r_proto=0
a48ec845 18550 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18551 * ) case "$tmpnam_r_proto" in
18552 REENTRANT_PROTO*) ;;
18553 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18554 esac
18555 echo "Prototype: $try" ;;
18556 esac
18557 ;;
c18e646a
JH
18558 *) case "$usethreads" in
18559 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18560 esac
90e831dc
SB
18561 d_tmpnam_r=undef
18562 tmpnam_r_proto=0
c18e646a 18563 ;;
a48ec845
JH
18564 esac
18565 ;;
10bc17b6
JH
18566*) tmpnam_r_proto=0
18567 ;;
18568esac
18569
b4eb6b3d
JH
18570: see if truncate exists
18571set truncate d_truncate
18572eval $inlibc
18573
10bc17b6
JH
18574: see if ttyname_r exists
18575set ttyname_r d_ttyname_r
18576eval $inlibc
18577case "$d_ttyname_r" in
18578"$define")
18579 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
18580 case "$d_ttyname_r_proto:$usethreads" in
18581 ":define") d_ttyname_r_proto=define
a48ec845
JH
18582 set d_ttyname_r_proto ttyname_r $hdrs
18583 eval $hasproto ;;
18584 *) ;;
18585 esac
18586 case "$d_ttyname_r_proto" in
18587 define)
10bc17b6
JH
18588 case "$ttyname_r_proto" in
18589 ''|0) try='int ttyname_r(int, char*, size_t);'
61c26d18 18590 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
10bc17b6
JH
18591 esac
18592 case "$ttyname_r_proto" in
18593 ''|0) try='int ttyname_r(int, char*, int);'
61c26d18 18594 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
10bc17b6
JH
18595 esac
18596 case "$ttyname_r_proto" in
18597 ''|0) try='char* ttyname_r(int, char*, int);'
61c26d18 18598 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
10bc17b6
JH
18599 esac
18600 case "$ttyname_r_proto" in
90e831dc 18601 ''|0) d_ttyname_r=undef
10bc17b6 18602 ttyname_r_proto=0
a48ec845 18603 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18604 * ) case "$ttyname_r_proto" in
18605 REENTRANT_PROTO*) ;;
18606 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18607 esac
18608 echo "Prototype: $try" ;;
18609 esac
18610 ;;
c18e646a
JH
18611 *) case "$usethreads" in
18612 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18613 esac
90e831dc
SB
18614 d_ttyname_r=undef
18615 ttyname_r_proto=0
c18e646a 18616 ;;
a48ec845
JH
18617 esac
18618 ;;
10bc17b6
JH
18619*) ttyname_r_proto=0
18620 ;;
18621esac
18622
b4eb6b3d
JH
18623: see if tzname[] exists
18624echo " "
18625if set tzname val -a d_tzname; eval $csym; $val; then
18626 val="$define"
18627 echo 'tzname[] found.' >&4
18628else
18629 val="$undef"
18630 echo 'tzname[] NOT found.' >&4
18631fi
18632set d_tzname
18633eval $setvar
18634
613d6c3e 18635: Check if is a multiplatform env
4e0554ec
JH
18636case "$osname" in
18637next|rhapsody|darwin) multiarch="$define" ;;
18638esac
18639case "$multiarch" in
18640''|[nN]*) multiarch="$undef" ;;
18641esac
18642
24412007 18643: check for ordering of bytes in a UV
4e0554ec 18644echo " "
5440bc8e 18645case "$usecrosscompile$multiarch" in
4e0554ec
JH
18646*$define*)
18647 $cat <<EOM
18648You seem to be either cross-compiling or doing a multiarchitecture build,
18649skipping the byteorder check.
18650
18651EOM
5440bc8e 18652 byteorder='ffff'
4e0554ec
JH
18653 ;;
18654*)
18655 case "$byteorder" in
18656 '')
18657 $cat <<'EOM'
18658In the following, larger digits indicate more significance. A big-endian
18659machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18660little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18661machines may have weird orders like 3412. A Cray will report 87654321,
18662an Alpha will report 12345678. If the test program works the default is
18663probably right.
18664I'm now running the test program...
18665EOM
24412007 18666 $cat >try.c <<EOCP
4e0554ec 18667#include <stdio.h>
55954f19
JH
18668#$i_stdlib I_STDLIB
18669#ifdef I_STDLIB
18670#include <stdlib.h>
18671#endif
24412007
JH
18672#include <sys/types.h>
18673typedef $uvtype UV;
4e0554ec
JH
18674int main()
18675{
18676 int i;
18677 union {
24412007
JH
18678 UV l;
18679 char c[$uvsize];
4e0554ec
JH
18680 } u;
18681
24412007 18682 if ($uvsize > 4)
b5ded3e5 18683 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18684 else
a4c53327 18685 u.l = (UV)0x04030201;
24412007 18686 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18687 printf("%c", u.c[i]+'0');
18688 printf("\n");
18689 exit(0);
18690}
18691EOCP
18692 xxx_prompt=y
18693 set try
43dddb59 18694 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18695 dflt=`$run ./try`
4e0554ec
JH
18696 case "$dflt" in
18697 [1-4][1-4][1-4][1-4]|12345678|87654321)
18698 echo "(The test program ran ok.)"
18699 echo "byteorder=$dflt"
18700 xxx_prompt=n
18701 ;;
18702 ????|????????) echo "(The test program ran ok.)" ;;
18703 *) echo "(The test program didn't run right for some reason.)" ;;
18704 esac
18705 else
18706 dflt='4321'
18707 cat <<'EOM'
18708(I can't seem to compile the test program. Guessing big-endian...)
18709EOM
18710 fi
18711 case "$xxx_prompt" in
18712 y)
24412007 18713 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18714 . ./myread
18715 byteorder="$ans"
18716 ;;
18717 *) byteorder=$dflt
18718 ;;
18719 esac
18720 ;;
18721 esac
5b813a60 18722 $rm_try
4e0554ec
JH
18723 ;;
18724esac
18725
cd95ead5 18726: Checking 32bit alignedness
4e0554ec
JH
18727$cat <<EOM
18728
18729Checking to see whether you can access character data unalignedly...
18730EOM
dc7b0a4f
JH
18731case "$d_u32align" in
18732'') $cat >try.c <<EOCP
4e0554ec 18733#include <stdio.h>
d1daaddf
JH
18734#$i_stdlib I_STDLIB
18735#ifdef I_STDLIB
18736#include <stdlib.h>
18737#endif
4e0554ec 18738#define U32 $u32type
d308175a
JH
18739#define BYTEORDER 0x$byteorder
18740#define U8 $u8type
9958dc3c
JH
18741#include <signal.h>
18742#ifdef SIGBUS
7090f861 18743$signal_t bletch(int s) { exit(4); }
9958dc3c 18744#endif
4e0554ec
JH
18745int main() {
18746#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
f1c7503b
MB
18747 volatile U8 buf[8];
18748 volatile U32 *up;
4e0554ec
JH
18749 int i;
18750
18751 if (sizeof(U32) != 4) {
18752 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18753 exit(1);
18754 }
18755
18756 fflush(stdout);
18757
9958dc3c
JH
18758#ifdef SIGBUS
18759 signal(SIGBUS, bletch);
18760#endif
18761
8906a23e
JH
18762 buf[0] = 0;
18763 buf[1] = 0;
18764 buf[2] = 0;
18765 buf[3] = 1;
7eac3fd6 18766 buf[4] = 0;
8906a23e
JH
18767 buf[5] = 0;
18768 buf[6] = 0;
7eac3fd6 18769 buf[7] = 1;
8906a23e 18770
4e0554ec
JH
18771 for (i = 0; i < 4; i++) {
18772 up = (U32*)(buf + i);
18773 if (! ((*up == 1 << (8*i)) || /* big-endian */
18774 (*up == 1 << (8*(3-i))) /* little-endian */
18775 )
18776 )
18777 {
18778 printf("read failed (%x)\n", *up);
18779 exit(2);
18780 }
18781 }
18782
18783 /* write test */
18784 for (i = 0; i < 4; i++) {
18785 up = (U32*)(buf + i);
18786 *up = 0xBeef;
18787 if (*up != 0xBeef) {
18788 printf("write failed (%x)\n", *up);
18789 exit(3);
18790 }
18791 }
18792
18793 exit(0);
18794#else
18795 printf("1\n");
18796 exit(1);
18797#endif
18798 return 0;
18799}
18800EOCP
18801set try
18802if eval $compile_ok; then
d308175a 18803 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18804 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18805 case "$?" in
18806 0) cat >&4 <<EOM
18807You can access character data pretty unalignedly.
18808EOM
18809 d_u32align="$undef"
18810 ;;
18811 *) cat >&4 <<EOM
18812It seems that you must access character data in an aligned manner.
18813EOM
18814 d_u32align="$define"
18815 ;;
18816 esac
4e0554ec
JH
18817else
18818 rp='Can you access character data at unaligned addresses?'
18819 dflt='n'
18820 . ./myread
18821 case "$ans" in
18822 [yY]*) d_u32align="$undef" ;;
18823 *) d_u32align="$define" ;;
18824 esac
18825fi
5b813a60 18826$rm_try
dc7b0a4f
JH
18827;;
18828esac
4e0554ec
JH
18829
18830: see if ualarm exists
18831set ualarm d_ualarm
18832eval $inlibc
18833
b4eb6b3d
JH
18834: see if umask exists
18835set umask d_umask
18836eval $inlibc
18837
758a5d79
JH
18838: see if unordered exists
18839set unordered d_unordered
18840eval $inlibc
18841
bdf33aa7
SP
18842: see if unsetenv exists
18843set unsetenv d_unsetenv
18844eval $inlibc
18845
4e0554ec
JH
18846: see if usleep exists
18847set usleep d_usleep
18848eval $inlibc
18849
2ef53570
JH
18850: see if prototype for usleep is available
18851echo " "
18852set d_usleepproto usleep $i_unistd unistd.h
18853eval $hasproto
18854
b4eb6b3d
JH
18855: see if ustat exists
18856set ustat d_ustat
18857eval $inlibc
18858
b4eb6b3d
JH
18859: see if closedir exists
18860set closedir d_closedir
18861eval $inlibc
18862
18863case "$d_closedir" in
18864"$define")
18865 echo " "
18866 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18867 cat > try.c <<EOM
b4eb6b3d
JH
18868#$i_dirent I_DIRENT /**/
18869#$i_sysdir I_SYS_DIR /**/
18870#$i_sysndir I_SYS_NDIR /**/
18871#$i_systypes I_SYS_TYPES /**/
18872
18873#if defined(I_SYS_TYPES)
18874#include <sys/types.h>
18875#endif
18876#if defined(I_DIRENT)
18877#include <dirent.h>
18878#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18879#include <sys/dir.h>
18880#endif
18881#else
18882#ifdef I_SYS_NDIR
18883#include <sys/ndir.h>
18884#else
18885#ifdef I_SYS_DIR
18886#ifdef hp9000s500
18887#include <ndir.h> /* may be wrong in the future */
18888#else
18889#include <sys/dir.h>
18890#endif
18891#endif
18892#endif
5b813a60 18893#endif
b4eb6b3d
JH
18894int main() { return closedir(opendir(".")); }
18895EOM
5440bc8e 18896 set try
b4eb6b3d 18897 if eval $compile_ok; then
5440bc8e 18898 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18899 echo "Yes, it does."
18900 val="$undef"
18901 else
18902 echo "No, it doesn't."
18903 val="$define"
18904 fi
18905 else
18906 echo "(I can't seem to compile the test program--assuming it doesn't)"
18907 val="$define"
18908 fi
18909 ;;
18910*)
18911 val="$undef";
18912 ;;
18913esac
18914set d_void_closedir
18915eval $setvar
5b813a60
MB
18916$rm_try
18917
b4eb6b3d
JH
18918: see if there is a wait4
18919set wait4 d_wait4
18920eval $inlibc
18921
18922: see if waitpid exists
18923set waitpid d_waitpid
18924eval $inlibc
18925
18926: see if wcstombs exists
18927set wcstombs d_wcstombs
18928eval $inlibc
18929
18930: see if wctomb exists
18931set wctomb d_wctomb
18932eval $inlibc
18933
4e0554ec
JH
18934: see if writev exists
18935set writev d_writev
18936eval $inlibc
18937
b4eb6b3d
JH
18938: preserve RCS keywords in files with variable substitution, grrr
18939Date='$Date'
18940Id='$Id'
18941Log='$Log'
18942RCSfile='$RCSfile'
18943Revision='$Revision'
18944
b4eb6b3d
JH
18945: check for alignment requirements
18946echo " "
5440bc8e 18947case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18948*$define*)
18949 $cat <<EOM
18950You seem to be either cross-compiling or doing a multiarchitecture build,
18951skipping the memory alignment check.
18952
18953EOM
18954 case "$alignbytes" in
18955 '') alignbytes=8 ;;
18956 esac
18957 ;;
18958*)
18959 case "$alignbytes" in
18960 '') echo "Checking alignment constraints..." >&4
18961 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18962 $cat >try.c <<'EOCP'
18963typedef long double NV;
18964EOCP
18965 else
18966 $cat >try.c <<'EOCP'
18967typedef double NV;
18968EOCP
18969 fi
18970 $cat >>try.c <<'EOCP'
18971#include <stdio.h>
18972struct foobar {
18973 char foo;
18974 NV bar;
18975} try_algn;
18976int main()
18977{
18978 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18979 return(0);
18980}
18981EOCP
18982 set try
18983 if eval $compile_ok; then
5440bc8e 18984 dflt=`$run ./try`
b4eb6b3d
JH
18985 else
18986 dflt='8'
18987 echo "(I can't seem to compile the test program...)"
18988 fi
18989 ;;
18990 *) dflt="$alignbytes"
18991 ;;
18992 esac
18993 rp="Doubles must be aligned on a how-many-byte boundary?"
18994 . ./myread
18995 alignbytes="$ans"
5b813a60 18996 $rm_try
b4eb6b3d
JH
18997 ;;
18998esac
18999
19000
19001: set the base revision
19002baserev=5.0
19003
89c1d914
MB
19004: length of character in bytes. Is always 1, otherwise it isnt C
19005: This used to be a test using sizeof
19006charsize=1
c193ef60
MB
19007
19008: Check for the number of bits in a character
19009case "$charbits" in
19010'') echo "Checking how long a character is (in bits)..." >&4
19011 $cat >try.c <<EOCP
19012#include <stdio.h>
19013int main ()
19014{
19015 int n;
19016 unsigned char c;
19017 for (c = 1, n = 0; c; c <<= 1, n++) ;
19018 printf ("%d\n", n);
19019 return (0);
19020 }
19021EOCP
19022 set try
19023 if eval $compile_ok; then
19024 dflt=`$run ./try`
19025 else
19026 dflt='8'
19027 echo "(I can't seem to compile the test program. Guessing...)"
19028 fi
19029 ;;
19030*)
19031 dflt="$charbits"
19032 ;;
19033esac
19034rp="What is the length of a character (in bits)?"
19035. ./myread
19036charbits="$ans"
19037$rm_try
19038case "$charbits" in
190398) ;;
19040*) cat >&4 << EOM
19041Your system has an unsigned character size of $charbits bits, which
19042is rather unusual (normally it is 8 bits). Perl likely will not work
19043correctly on your system, with subtle bugs in various places.
19044EOM
19045 rp='Do you really want to continue?'
19046 dflt='n'
19047 . ./myread
19048 case "$ans" in
19049 [yY]) echo >&4 "Okay, continuing." ;;
19050 *) exit 1 ;;
19051 esac
19052esac
19053
3099fc99 19054: how do we concatenate cpp tokens here?
b4eb6b3d 19055echo " "
3099fc99 19056echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
19057$cat >cpp_stuff.c <<'EOCP'
19058#define RCAT(a,b)a/**/b
19059#define ACAT(a,b)a ## b
19060RCAT(Rei,ser)
19061ACAT(Cir,cus)
19062EOCP
19063$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19064if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19065 echo "Oh! Smells like ANSI's been here." >&4
19066 echo "We can catify or stringify, separately or together!"
19067 cpp_stuff=42
19068elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19069 echo "Ah, yes! The good old days!" >&4
19070 echo "However, in the good old days we don't know how to stringify and"
19071 echo "catify at the same time."
19072 cpp_stuff=1
19073else
19074 $cat >&4 <<EOM
3099fc99
CW
19075Hmm, I don't seem to be able to concatenate tokens with your cpp.
19076You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
19077EOM
19078 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19079fi
19080$rm -f cpp_stuff.*
19081
19082: see if this is a db.h system
19083set db.h i_db
19084eval $inhdr
19085
19086case "$i_db" in
19087$define)
19088 : Check db version.
19089 echo " "
19090 echo "Checking Berkeley DB version ..." >&4
19091 $cat >try.c <<EOCP
19092#$d_const HASCONST
19093#ifndef HASCONST
19094#define const
19095#endif
19096#include <sys/types.h>
19097#include <stdio.h>
55954f19
JH
19098#$i_stdlib I_STDLIB
19099#ifdef I_STDLIB
19100#include <stdlib.h>
19101#endif
b4eb6b3d 19102#include <db.h>
640374d0 19103int main(int argc, char *argv[])
b4eb6b3d
JH
19104{
19105#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19106 int Major, Minor, Patch ;
19107 unsigned long Version ;
19108 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
19109 if (argc == 2) {
19110 printf("%d %d %d %d %d %d\n",
19111 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19112 Major, Minor, Patch);
19113 exit(0);
19114 }
19115 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
19116
19117 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19118 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19119 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19120 Major, Minor, Patch) ;
19121
19122 /* check that db.h & libdb are compatible */
19123 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 19124 printf("db.h and libdb are incompatible.\n") ;
5b813a60 19125 exit(3);
b4eb6b3d
JH
19126 }
19127
640374d0 19128 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
19129
19130 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19131 + DB_VERSION_PATCH ;
19132
19133 /* needs to be >= 2.3.4 */
19134 if (Version < 2003004) {
19135 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 19136 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 19137 exit(2);
b4eb6b3d
JH
19138 }
19139
19140 exit(0);
19141#else
19142#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
19143 if (argc == 2) {
19144 printf("1 0 0\n");
19145 exit(0);
19146 }
19147 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
19148 exit(0); /* DB version < 2: the coast is clear. */
19149#else
19150 exit(1); /* <db.h> not Berkeley DB? */
19151#endif
19152#endif
19153}
19154EOCP
19155 set try
5440bc8e 19156 if eval $compile_ok && $run ./try; then
b4eb6b3d 19157 echo 'Looks OK.' >&4
5440bc8e 19158 set `$run ./try 1`
640374d0
JH
19159 db_version_major=$1
19160 db_version_minor=$2
19161 db_version_patch=$3
b4eb6b3d
JH
19162 else
19163 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
19164 i_db=$undef
19165 case " $libs " in
19166 *"-ldb "*)
19167 : Remove db from list of libraries to use
19168 echo "Removing unusable -ldb from library list" >&4
19169 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19170 shift
19171 libs="$*"
19172 echo "libs = $libs" >&4
19173 ;;
19174 esac
19175 fi
5b813a60 19176 $rm_try
b4eb6b3d
JH
19177 ;;
19178esac
19179
19180case "$i_db" in
19181define)
5b813a60 19182 : Check the return type needed for hash
b4eb6b3d
JH
19183 echo " "
19184 echo "Checking return type needed for hash for Berkeley DB ..." >&4
19185 $cat >try.c <<EOCP
19186#$d_const HASCONST
19187#ifndef HASCONST
19188#define const
19189#endif
19190#include <sys/types.h>
19191#include <db.h>
19192
19193#ifndef DB_VERSION_MAJOR
19194u_int32_t hash_cb (ptr, size)
19195const void *ptr;
19196size_t size;
19197{
19198}
19199HASHINFO info;
19200int main()
19201{
19202 info.hash = hash_cb;
19203}
19204#endif
19205EOCP
19206 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19207 if $contains warning try.out >>/dev/null 2>&1 ; then
19208 db_hashtype='int'
19209 else
19210 db_hashtype='u_int32_t'
19211 fi
19212 else
19213 : XXX Maybe we should just give up here.
19214 db_hashtype=u_int32_t
19215 $cat try.out >&4
19216 echo "Help: I can't seem to compile the db test program." >&4
19217 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19218 fi
5b813a60 19219 $rm_try
b4eb6b3d
JH
19220 echo "Your version of Berkeley DB uses $db_hashtype for hash."
19221 ;;
19222*) db_hashtype=u_int32_t
19223 ;;
19224esac
19225case "$i_db" in
19226define)
5b813a60 19227 : Check the return type needed for prefix
b4eb6b3d
JH
19228 echo " "
19229 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19230 cat >try.c <<EOCP
19231#$d_const HASCONST
19232#ifndef HASCONST
19233#define const
19234#endif
19235#include <sys/types.h>
19236#include <db.h>
19237
19238#ifndef DB_VERSION_MAJOR
19239size_t prefix_cb (key1, key2)
19240const DBT *key1;
19241const DBT *key2;
19242{
19243}
19244BTREEINFO info;
19245int main()
19246{
19247 info.prefix = prefix_cb;
19248}
19249#endif
19250EOCP
19251 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19252 if $contains warning try.out >>/dev/null 2>&1 ; then
19253 db_prefixtype='int'
19254 else
19255 db_prefixtype='size_t'
19256 fi
19257 else
19258 db_prefixtype='size_t'
19259 : XXX Maybe we should just give up here.
19260 $cat try.out >&4
19261 echo "Help: I can't seem to compile the db test program." >&4
19262 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19263 fi
5b813a60 19264 $rm_try
b4eb6b3d
JH
19265 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19266 ;;
19267*) db_prefixtype='size_t'
19268 ;;
19269esac
19270
b4eb6b3d
JH
19271: How can we generate normalized random numbers ?
19272echo " "
19273echo "Looking for a random number function..." >&4
19274case "$randfunc" in
19275'')
19276 if set drand48 val -f; eval $csym; $val; then
19277 dflt="drand48"
19278 echo "Good, found drand48()." >&4
19279 elif set random val -f; eval $csym; $val; then
19280 dflt="random"
19281 echo "OK, found random()." >&4
19282 else
19283 dflt="rand"
19284 echo "Yick, looks like I have to use rand()." >&4
19285 fi
19286 echo " "
19287 ;;
19288*)
19289 dflt="$randfunc"
19290 ;;
19291esac
19292cont=true
19293
19294case "$ccflags" in
19295*-Dmy_rand=*|*-Dmy_srand=*)
19296 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19297 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19298 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19299 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19300 ;;
19301esac
19302
19303while $test "$cont"; do
19304 rp="Use which function to generate random numbers?"
19305 . ./myread
19306 if $test "$ans" = "$dflt"; then
19307 : null
19308 else
19309 randbits=''
19310 fi
19311 randfunc="$ans"
19312 if set $ans val -f; eval $csym; $val; then
19313 cont=''
19314 else
19315 dflt=y
19316 rp="I cannot find function $ans. Use that name anyway?"
19317 . ./myread
19318 dflt=rand
19319 case "$ans" in
19320 [yY]*) cont='';;
19321 esac
19322 fi
19323 case "$cont" in
19324 '')
19325 case "$randfunc" in
19326 drand48)
19327 drand01="drand48()"
19328 seedfunc="srand48"
19329 randbits=48
19330 randseedtype=long
19331 ;;
19332 rand|random)
19333 case "$randbits" in
19334 '')
19335echo "Checking to see how many bits your $randfunc() function produces..." >&4
19336 $cat >try.c <<EOCP
19337#$i_unistd I_UNISTD
19338#$i_stdlib I_STDLIB
19339#include <stdio.h>
19340#ifdef I_UNISTD
19341# include <unistd.h>
19342#endif
19343#ifdef I_STDLIB
19344# include <stdlib.h>
19345#endif
19346int main()
19347{
19348 register int i;
19349 register unsigned long tmp;
19350 register unsigned long max = 0L;
19351
19352 for (i = 1000; i; i--) {
19353 tmp = (unsigned long) $randfunc();
19354 if (tmp > max) max = tmp;
19355 }
19356 for (i = 0; max; i++)
19357 max /= 2;
19358 printf("%d\n",i);
19359}
19360EOCP
19361 set try
19362 if eval $compile_ok; then
19363 dflt=`try`
19364 else
19365 dflt='?'
19366 echo "(I can't seem to compile the test program...)"
19367 fi
19368 ;;
19369 *)
19370 dflt="$randbits"
19371 ;;
19372 esac
19373 rp="How many bits does your $randfunc() function produce?"
19374 . ./myread
19375 randbits="$ans"
5b813a60 19376 $rm_try
b4eb6b3d
JH
19377 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19378 seedfunc="s$randfunc"
19379 randseedtype=unsigned
19380 ;;
19381 *)
19382 dflt="31"
19383 rp="How many bits does your $randfunc() function produce?"
19384 . ./myread
19385 randbits="$ans"
19386 seedfunc="s$randfunc"
19387 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19388 if set $seedfunc val -f; eval $csym; $val; then
19389 echo "(Using $seedfunc() to seed random generator)"
19390 else
19391 echo "(Warning: no $seedfunc() to seed random generator)"
19392 seedfunc=rand
19393 fi
19394 randseedtype=unsigned
19395 ;;
19396 esac
19397 ;;
19398 esac
19399done
19400
613d6c3e 19401: Determine if this is an EBCDIC system
b4eb6b3d
JH
19402echo " "
19403echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 19404$cat >try.c <<'EOM'
b4eb6b3d
JH
19405int main()
19406{
19407 if ('M'==0xd4) return 0;
19408 return 1;
19409}
19410EOM
19411
19412val=$undef
5440bc8e 19413set try
b4eb6b3d 19414if eval $compile_ok; then
5440bc8e 19415 if $run ./try; then
b4eb6b3d
JH
19416 echo "You seem to speak EBCDIC." >&4
19417 val="$define"
19418 else
5440bc8e 19419 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
19420 fi
19421else
19422 echo "I'm unable to compile the test program." >&4
19423 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19424fi
5b813a60 19425$rm_try
b4eb6b3d
JH
19426set ebcdic
19427eval $setvar
19428
613d6c3e 19429: Check how to flush
b4eb6b3d
JH
19430echo " "
19431$cat >&4 <<EOM
19432Checking how to flush all pending stdio output...
19433EOM
19434# I only know how to find the first 32 possibly open files on SunOS.
19435# See also hints/sunos_4_1.sh and util.c --AD
19436case "$osname" in
19437sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19438esac
19439$cat >>try.c <<EOCP
19440#include <stdio.h>
55954f19
JH
19441#$i_stdlib I_STDLIB
19442#ifdef I_STDLIB
19443#include <stdlib.h>
19444#endif
b4eb6b3d
JH
19445#$i_unistd I_UNISTD
19446#ifdef I_UNISTD
19447# include <unistd.h>
19448#endif
19449#$d_sysconf HAS_SYSCONF
19450#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19451#ifdef HAS_STDIO_STREAM_ARRAY
19452# define STDIO_STREAM_ARRAY $stdio_stream_array
19453#endif
19454int main() {
5440bc8e
JH
19455 FILE* p;
19456 unlink("try.out");
19457 p = fopen("try.out", "w");
b4eb6b3d
JH
19458#ifdef TRY_FPUTC
19459 fputc('x', p);
19460#else
19461# ifdef TRY_FPRINTF
19462 fprintf(p, "x");
19463# endif
19464#endif
19465#ifdef TRY_FFLUSH_NULL
19466 fflush(NULL);
19467#endif
19468#ifdef TRY_FFLUSH_ALL
19469 {
19470 long open_max = -1;
19471# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19472 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19473# else
19474# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19475 open_max = sysconf(_SC_OPEN_MAX);
19476# else
19477# ifdef FOPEN_MAX
19478 open_max = FOPEN_MAX;
19479# else
19480# ifdef OPEN_MAX
19481 open_max = OPEN_MAX;
19482# else
19483# ifdef _NFILE
19484 open_max = _NFILE;
19485# endif
19486# endif
19487# endif
19488# endif
5b813a60 19489# endif
b4eb6b3d
JH
19490# ifdef HAS_STDIO_STREAM_ARRAY
19491 if (open_max > 0) {
19492 long i;
19493 for (i = 0; i < open_max; i++)
19494 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19495 STDIO_STREAM_ARRAY[i]._file < open_max &&
19496 STDIO_STREAM_ARRAY[i]._flag)
19497 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 19498 }
b4eb6b3d
JH
19499 }
19500# endif
19501#endif
19502 _exit(42);
19503}
19504EOCP
19505: first we have to find out how _not_ to flush
5440bc8e 19506$to try.c
b4eb6b3d
JH
19507if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19508 output=''
19509 set try -DTRY_FPUTC
19510 if eval $compile; then
fbe73d74 19511 $run ./try 2>/dev/null
28f5ac64 19512 code="$?"
5440bc8e 19513 $from try.out
28f5ac64 19514 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19515 output=-DTRY_FPUTC
19516 fi
19517 fi
19518 case "$output" in
19519 '')
19520 set try -DTRY_FPRINTF
b4eb6b3d 19521 if eval $compile; then
fbe73d74 19522 $run ./try 2>/dev/null
28f5ac64 19523 code="$?"
5440bc8e 19524 $from try.out
28f5ac64 19525 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19526 output=-DTRY_FPRINTF
19527 fi
19528 fi
19529 ;;
19530 esac
19531fi
19532: check for fflush NULL behaviour
19533case "$fflushNULL" in
19534'') set try -DTRY_FFLUSH_NULL $output
19535 if eval $compile; then
5440bc8e 19536 $run ./try 2>/dev/null
b4eb6b3d 19537 code="$?"
5440bc8e 19538 $from try.out
b4eb6b3d
JH
19539 if $test -s try.out -a "X$code" = X42; then
19540 fflushNULL="`$cat try.out`"
19541 else
19542 if $test "X$code" != X42; then
19543 $cat >&4 <<EOM
19544(If this test failed, don't worry, we'll try another method shortly.)
19545EOM
19546 fi
19547 fi
19548 fi
2c476adc 19549 $rm -f core try.core core.try.*
b4eb6b3d
JH
19550 case "$fflushNULL" in
19551 x) $cat >&4 <<EOM
19552Your fflush(NULL) works okay for output streams.
19553Let's see if it clobbers input pipes...
19554EOM
19555# As of mid-March 2000 all versions of Solaris appear to have a stdio
19556# bug that improperly flushes the input end of pipes. So we avoid the
19557# autoflush on fork/system/exec support for now. :-(
19558$cat >tryp.c <<EOCP
19559#include <stdio.h>
19560int
19561main(int argc, char **argv)
19562{
19563 char buf[1024];
19564 int i;
19565 char *bp = buf;
19566 while (1) {
19567 while ((i = getc(stdin)) != -1
19568 && (*bp++ = i) != '\n'
19569 && bp < &buf[1024])
19570 /* DO NOTHING */ ;
19571 *bp = '\0';
19572 fprintf(stdout, "%s", buf);
19573 fflush(NULL);
19574 if (i == -1)
19575 return 0;
19576 bp = buf;
19577 }
19578}
19579EOCP
19580 fflushNULL="$define"
19581 set tryp
19582 if eval $compile; then
19583 $rm -f tryp.out
5440bc8e 19584 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19585 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19586 $cat >&4 <<EOM
19587fflush(NULL) seems to behave okay with input streams.
19588EOM
19589 fflushNULL="$define"
19590 else
19591 $cat >&4 <<EOM
19592Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19593EOM
19594 fflushNULL="$undef"
19595 fi
19596 fi
19597 $rm -f core tryp.c tryp.core core.tryp.*
19598 ;;
19599 '') $cat >&4 <<EOM
19600Your fflush(NULL) isn't working (contrary to ANSI C).
19601EOM
19602 fflushNULL="$undef"
19603 ;;
19604 *) $cat >&4 <<EOM
19605Cannot figure out whether your fflush(NULL) works or not.
19606I'm assuming it doesn't (contrary to ANSI C).
19607EOM
19608 fflushNULL="$undef"
19609 ;;
19610 esac
19611 ;;
19612$define|true|[yY]*)
19613 fflushNULL="$define"
19614 ;;
19615*)
19616 fflushNULL="$undef"
19617 ;;
19618esac
19619: check explicit looping only if NULL did not work, and if the pipe
19620: bug does not show up on an explicit flush too
19621case "$fflushNULL" in
19622"$undef")
19623 $cat >tryp.c <<EOCP
19624#include <stdio.h>
19625int
19626main(int argc, char **argv)
19627{
19628 char buf[1024];
19629 int i;
19630 char *bp = buf;
19631 while (1) {
19632 while ((i = getc(stdin)) != -1
19633 && (*bp++ = i) != '\n'
19634 && bp < &buf[1024])
19635 /* DO NOTHING */ ;
19636 *bp = '\0';
19637 fprintf(stdout, "%s", buf);
19638 fflush(stdin);
19639 if (i == -1)
19640 return 0;
19641 bp = buf;
19642 }
19643}
19644EOCP
19645 set tryp
19646 if eval $compile; then
19647 $rm -f tryp.out
5440bc8e 19648 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19649 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19650 $cat >&4 <<EOM
19651Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19652EOM
19653 : now check for fflushall behaviour
19654 case "$fflushall" in
19655 '') set try -DTRY_FFLUSH_ALL $output
19656 if eval $compile; then
19657 $cat >&4 <<EOM
19658(Now testing the other method--but note that this also may fail.)
19659EOM
5440bc8e 19660 $run ./try 2>/dev/null
28f5ac64 19661 code=$?
fbe73d74 19662 $from try.out
28f5ac64 19663 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19664 fflushall="`$cat try.out`"
19665 fi
19666 fi
5b813a60 19667 $rm_try
b4eb6b3d
JH
19668 case "$fflushall" in
19669 x) $cat >&4 <<EOM
19670Whew. Flushing explicitly all the stdio streams works.
19671EOM
19672 fflushall="$define"
19673 ;;
19674 '') $cat >&4 <<EOM
19675Sigh. Flushing explicitly all the stdio streams doesn't work.
19676EOM
19677 fflushall="$undef"
19678 ;;
19679 *) $cat >&4 <<EOM
19680Cannot figure out whether flushing stdio streams explicitly works or not.
19681I'm assuming it doesn't.
19682EOM
19683 fflushall="$undef"
19684 ;;
19685 esac
19686 ;;
19687 "$define"|true|[yY]*)
19688 fflushall="$define"
19689 ;;
19690 *)
19691 fflushall="$undef"
19692 ;;
19693 esac
19694 else
19695 $cat >&4 <<EOM
19696All is futile. Even fflush(stdin) clobbers input pipes!
19697EOM
19698 fflushall="$undef"
19699 fi
19700 else
19701 fflushall="$undef"
19702 fi
19703 $rm -f core tryp.c tryp.core core.tryp.*
19704 ;;
19705*) fflushall="$undef"
19706 ;;
19707esac
19708
19709case "$fflushNULL$fflushall" in
19710undefundef)
19711 $cat <<EOM
19712OK, I give up. I cannot figure out how to flush pending stdio output.
19713We won't be flushing handles at all before fork/exec/popen.
19714EOM
19715 ;;
19716esac
34f1896b 19717$rm_try tryp
b4eb6b3d
JH
19718
19719: Store the full pathname to the ar program for use in the C program
19720: Respect a hint or command line value for full_ar.
19721case "$full_ar" in
19722'') full_ar=$ar ;;
19723esac
19724
19725: Store the full pathname to the sed program for use in the C program
19726full_sed=$sed
19727
19728: see what type gids are declared as in the kernel
19729echo " "
19730echo "Looking for the type for group ids returned by getgid()."
19731set gid_t gidtype xxx stdio.h sys/types.h
19732eval $typedef
19733case "$gidtype" in
19734xxx)
19735 xxx=`./findhdr sys/user.h`
19736 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19737 case $1 in
19738 unsigned) dflt="$1 $2" ;;
19739 *) dflt="$1" ;;
19740 esac
19741 ;;
19742*) dflt="$gidtype";;
19743esac
19744case "$gidtype" in
19745gid_t) echo "gid_t found." ;;
19746*) rp="What is the type for group ids returned by getgid()?"
19747 . ./myread
19748 gidtype="$ans"
19749 ;;
19750esac
19751
613d6c3e 19752: Check the size of GID
b4eb6b3d
JH
19753echo " "
19754case "$gidtype" in
19755*_t) zzz="$gidtype" ;;
19756*) zzz="gid" ;;
19757esac
613d6c3e 19758echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
19759cat > try.c <<EOCP
19760#include <sys/types.h>
19761#include <stdio.h>
d1daaddf
JH
19762#$i_stdlib I_STDLIB
19763#ifdef I_STDLIB
19764#include <stdlib.h>
19765#endif
b4eb6b3d
JH
19766int main() {
19767 printf("%d\n", (int)sizeof($gidtype));
19768 exit(0);
19769}
19770EOCP
19771set try
19772if eval $compile_ok; then
5440bc8e 19773 yyy=`$run ./try`
b4eb6b3d
JH
19774 case "$yyy" in
19775 '') gidsize=4
19776 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19777 ;;
19778 *) gidsize=$yyy
19779 echo "Your $zzz is $gidsize bytes long."
19780 ;;
19781 esac
19782else
19783 gidsize=4
19784 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19785fi
19786
19787
613d6c3e 19788: Check if GID is signed
b4eb6b3d
JH
19789echo " "
19790case "$gidtype" in
19791*_t) zzz="$gidtype" ;;
19792*) zzz="gid" ;;
19793esac
613d6c3e 19794echo "Checking the sign of $zzz..." >&4
b4eb6b3d
JH
19795cat > try.c <<EOCP
19796#include <sys/types.h>
19797#include <stdio.h>
19798int main() {
19799 $gidtype foo = -1;
19800 if (foo < 0)
19801 printf("-1\n");
19802 else
19803 printf("1\n");
19804}
19805EOCP
19806set try
19807if eval $compile; then
5440bc8e 19808 yyy=`$run ./try`
b4eb6b3d
JH
19809 case "$yyy" in
19810 '') gidsign=1
19811 echo "(I can't execute the test program--guessing unsigned.)" >&4
19812 ;;
19813 *) gidsign=$yyy
19814 case "$gidsign" in
19815 1) echo "Your $zzz is unsigned." ;;
19816 -1) echo "Your $zzz is signed." ;;
19817 esac
19818 ;;
19819 esac
19820else
19821 gidsign=1
19822 echo "(I can't compile the test program--guessing unsigned.)" >&4
19823fi
19824
19825
613d6c3e 19826: Check 64bit sizes
b4eb6b3d
JH
19827echo " "
19828
19829if $test X"$quadtype" != X; then
19830
19831echo "Checking how to print 64-bit integers..." >&4
19832
19833if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19834 $cat >try.c <<'EOCP'
19835#include <sys/types.h>
19836#include <stdio.h>
19837int main() {
19838 int q = 12345678901;
19839 printf("%ld\n", q);
19840}
19841EOCP
19842 set try
19843 if eval $compile; then
5440bc8e 19844 yyy=`$run ./try`
b4eb6b3d
JH
19845 case "$yyy" in
19846 12345678901)
19847 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19848 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19849 echo "We will use %d."
19850 ;;
19851 esac
19852 fi
19853fi
19854
19855if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19856 $cat >try.c <<'EOCP'
19857#include <sys/types.h>
19858#include <stdio.h>
19859int main() {
19860 long q = 12345678901;
19861 printf("%ld\n", q);
19862}
19863EOCP
19864 set try
19865 if eval $compile; then
5440bc8e 19866 yyy=`$run ./try`
b4eb6b3d
JH
19867 case "$yyy" in
19868 12345678901)
19869 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19870 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19871 echo "We will use %ld."
19872 ;;
19873 esac
19874 fi
19875fi
19876
19877if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19878 $cat >try.c <<'EOCP'
19879#include <sys/types.h>
19880#include <inttypes.h>
19881#include <stdio.h>
19882int main() {
19883 int64_t q = 12345678901;
19884 printf("%" PRId64 "\n", q);
19885}
19886EOCP
19887 set try
19888 if eval $compile; then
5440bc8e 19889 yyy=`$run ./try`
b4eb6b3d
JH
19890 case "$yyy" in
19891 12345678901)
19892 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19893 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19894 echo "We will use the C9X style."
19895 ;;
19896 esac
19897 fi
19898fi
19899
2ef53570
JH
19900if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19901 $cat >try.c <<EOCP
b4eb6b3d
JH
19902#include <sys/types.h>
19903#include <stdio.h>
19904int main() {
2ef53570
JH
19905 $quadtype q = 12345678901;
19906 printf("%Ld\n", q);
b4eb6b3d
JH
19907}
19908EOCP
19909 set try
19910 if eval $compile; then
5440bc8e 19911 yyy=`$run ./try`
b4eb6b3d
JH
19912 case "$yyy" in
19913 12345678901)
2ef53570
JH
19914 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19915 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19916 echo "We will use %Ld."
b4eb6b3d
JH
19917 ;;
19918 esac
19919 fi
19920fi
19921
2ef53570
JH
19922if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19923 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19924#include <sys/types.h>
19925#include <stdio.h>
19926int main() {
2ef53570
JH
19927 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19928 printf("%lld\n", q);
b4eb6b3d
JH
19929}
19930EOCP
19931 set try
19932 if eval $compile; then
5440bc8e 19933 yyy=`$run ./try`
b4eb6b3d
JH
19934 case "$yyy" in
19935 12345678901)
2ef53570
JH
19936 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19937 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19938 echo "We will use the %lld style."
b4eb6b3d
JH
19939 ;;
19940 esac
19941 fi
19942fi
19943
19944if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19945 $cat >try.c <<EOCP
19946#include <sys/types.h>
19947#include <stdio.h>
19948int main() {
19949 $quadtype q = 12345678901;
19950 printf("%qd\n", q);
19951}
19952EOCP
19953 set try
19954 if eval $compile; then
5440bc8e 19955 yyy=`$run ./try`
b4eb6b3d
JH
19956 case "$yyy" in
19957 12345678901)
19958 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19959 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19960 echo "We will use %qd."
19961 ;;
19962 esac
19963 fi
19964fi
19965
19966if $test X"$sPRId64" = X; then
19967 echo "Cannot figure out how to print 64-bit integers." >&4
19968fi
5b813a60 19969$rm_try
b4eb6b3d
JH
19970
19971fi
19972
19973case "$sPRId64" in
5b813a60
MB
19974'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19975 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 19976 ;;
5b813a60
MB
19977*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19978 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
19979 ;;
19980esac
19981
34f1896b 19982: Check format strings for internal types
b4eb6b3d
JH
19983echo " "
19984$echo "Checking the format strings to be used for Perl's internal types..." >&4
19985
19986if $test X"$ivsize" = X8; then
19987 ivdformat="$sPRId64"
19988 uvuformat="$sPRIu64"
19989 uvoformat="$sPRIo64"
19990 uvxformat="$sPRIx64"
19991 uvXUformat="$sPRIXU64"
19992else
19993 if $test X"$ivsize" = X"$longsize"; then
19994 ivdformat='"ld"'
19995 uvuformat='"lu"'
19996 uvoformat='"lo"'
19997 uvxformat='"lx"'
19998 uvXUformat='"lX"'
19999 else
20000 if $test X"$ivsize" = X"$intsize"; then
20001 ivdformat='"d"'
20002 uvuformat='"u"'
20003 uvoformat='"o"'
20004 uvxformat='"x"'
20005 uvXUformat='"X"'
20006 else
20007 : far out
20008 if $test X"$ivsize" = X"$shortsize"; then
20009 ivdformat='"hd"'
20010 uvuformat='"hu"'
20011 uvoformat='"ho"'
20012 uvxformat='"hx"'
20013 uvXUformat='"hX"'
20014 fi
20015 fi
20016 fi
20017fi
20018
20019if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20020 nveformat="$sPRIeldbl"
20021 nvfformat="$sPRIfldbl"
20022 nvgformat="$sPRIgldbl"
20023 nvEUformat="$sPRIEUldbl"
20024 nvFUformat="$sPRIFUldbl"
20025 nvGUformat="$sPRIGUldbl"
20026else
20027 nveformat='"e"'
20028 nvfformat='"f"'
20029 nvgformat='"g"'
20030 nvEUformat='"E"'
20031 nvFUformat='"F"'
20032 nvGUformat='"G"'
20033fi
20034
20035case "$ivdformat" in
3c728e00 20036'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
20037 exit 1
20038 ;;
20039esac
20040
34f1896b 20041: Check format string for GID
b4eb6b3d
JH
20042
20043echo " "
20044$echo "Checking the format string to be used for gids..." >&4
20045
20046case "$gidsign" in
20047-1) if $test X"$gidsize" = X"$ivsize"; then
20048 gidformat="$ivdformat"
20049 else
20050 if $test X"$gidsize" = X"$longsize"; then
20051 gidformat='"ld"'
20052 else
20053 if $test X"$gidsize" = X"$intsize"; then
20054 gidformat='"d"'
20055 else
20056 if $test X"$gidsize" = X"$shortsize"; then
20057 gidformat='"hd"'
20058 fi
20059 fi
20060 fi
20061 fi
20062 ;;
20063*) if $test X"$gidsize" = X"$uvsize"; then
20064 gidformat="$uvuformat"
20065 else
20066 if $test X"$gidsize" = X"$longsize"; then
20067 gidformat='"lu"'
20068 else
20069 if $test X"$gidsize" = X"$intsize"; then
20070 gidformat='"u"'
20071 else
20072 if $test X"$gidsize" = X"$shortsize"; then
20073 gidformat='"hu"'
20074 fi
20075 fi
20076 fi
20077 fi
20078 ;;
20079esac
20080
20081: see if getgroups exists
20082set getgroups d_getgrps
20083eval $inlibc
20084
20085: see if setgroups exists
20086set setgroups d_setgrps
20087eval $inlibc
20088
b4eb6b3d
JH
20089: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20090echo " "
20091case "$d_getgrps$d_setgrps" in
20092*define*)
20093 case "$groupstype" in
20094 '') dflt="$gidtype" ;;
20095 *) dflt="$groupstype" ;;
20096 esac
20097 $cat <<EOM
20098What type of pointer is the second argument to getgroups() and setgroups()?
20099Usually this is the same as group ids, $gidtype, but not always.
20100
20101EOM
20102 rp='What type pointer is the second argument to getgroups() and setgroups()?'
20103 . ./myread
20104 groupstype="$ans"
20105 ;;
20106*) groupstype="$gidtype";;
20107esac
20108
613d6c3e 20109: MAD = Misc Attribute Definition
d620c7b3 20110
fd655d33
NC
20111if $test $patchlevel -lt 9; then
20112: MAD is not available in 5.8.x or earlier.
20113 ans=n;
20114else
20115 case "$mad" in
20116 $define|true|[yY]*) dflt='y' ;;
20117 *) dflt='n' ;;
20118 esac
20119 cat <<EOM
d620c7b3
MB
20120
20121Would you like to build with Misc Attribute Decoration? This is development
20122work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20123overhead on the interpreter.
20124
20125If this doesn't make any sense to you, just accept the default '$dflt'.
20126EOM
fd655d33
NC
20127 rp='Build Perl with MAD?'
20128 . ./myread
20129fi
d620c7b3 20130case "$ans" in
00e74f14
NC
20131y|Y) val="$define"
20132 madlyh='madly.h madly.act madly.tab'
20133 madlysrc='madly.c'
20134 madlyobj="madly$_o" ;;
20135*) val="$undef"
20136 madlyh=''
20137 madlysrc=''
20138 madlyobj='' ;;
d620c7b3
MB
20139esac
20140set mad
20141eval $setvar
20142
216dac04 20143: check whether make sets MAKE
b4eb6b3d
JH
20144echo " "
20145echo "Checking if your $make program sets \$(MAKE)..." >&4
20146case "$make_set_make" in
20147'')
20148 $sed 's/^X //' > testmake.mak << 'EOF'
20149Xall:
20150X @echo 'maketemp="$(MAKE)"'
20151EOF
20152 case "`$make -f testmake.mak 2>/dev/null`" in
20153 *maketemp=*) make_set_make='#' ;;
20154 *) make_set_make="MAKE=$make" ;;
20155 esac
20156 $rm -f testmake.mak
20157 ;;
20158esac
20159case "$make_set_make" in
20160'#') echo "Yup, it does.";;
20161*) echo "Nope, it doesn't.";;
20162esac
20163
20164: see what type is used for mode_t
20165rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20166set mode_t modetype int stdio.h sys/types.h
20167eval $typedef_ask
20168
2cc61e15
DD
20169: see if we need va_copy
20170echo " "
20171case "$i_stdarg" in
20172"$define")
20173 $cat >try.c <<EOCP
20174#include <stdarg.h>
20175#include <stdio.h>
85c8a686
DD
20176#$i_stdlib I_STDLIB
20177#ifdef I_STDLIB
20178#include <stdlib.h>
20179#endif
20180#include <signal.h>
2cc61e15
DD
20181
20182int
20183ivfprintf(FILE *f, const char *fmt, va_list *valp)
20184{
20185 return vfprintf(f, fmt, *valp);
20186}
5b813a60
MB
20187
20188int
2cc61e15
DD
20189myvfprintf(FILE *f, const char *fmt, va_list val)
20190{
20191 return ivfprintf(f, fmt, &val);
20192}
5b813a60 20193
2cc61e15 20194int
5b813a60 20195myprintf(char *fmt, ...)
2cc61e15
DD
20196{
20197 va_list val;
20198 va_start(val, fmt);
5b813a60
MB
20199 return myvfprintf(stdout, fmt, val);
20200}
2cc61e15
DD
20201
20202int
20203main(int ac, char **av)
20204{
85c8a686
DD
20205 signal(SIGSEGV, exit);
20206
5b813a60
MB
20207 myprintf("%s%cs all right, then\n", "that", '\'');
20208 exit(0);
2cc61e15
DD
20209}
20210EOCP
20211 set try
5440bc8e
JH
20212 if eval $compile && $run ./try 2>&1 >/dev/null; then
20213 case "`$run ./try`" in
2cc61e15
DD
20214 "that's all right, then")
20215 okay=yes
20216 ;;
20217 esac
20218 fi
20219 case "$okay" in
20220 yes) echo "It seems that you don't need va_copy()." >&4
20221 need_va_copy="$undef"
20222 ;;
20223 *) echo "It seems that va_copy() or similar will be needed." >&4
20224 need_va_copy="$define"
20225 ;;
20226 esac
5b813a60 20227 $rm_try
2cc61e15
DD
20228 ;;
20229*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20230 ;;
20231esac
20232
b4eb6b3d
JH
20233: see what type is used for size_t
20234rp="What is the type used for the length parameter for string functions?"
20235set size_t sizetype 'unsigned int' stdio.h sys/types.h
20236eval $typedef_ask
20237
20238: check for type of arguments to gethostbyaddr.
20239if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20240 case "$d_gethbyaddr" in
20241 $define)
20242 $cat <<EOM
20243
20244Checking to see what type of arguments are accepted by gethostbyaddr().
20245EOM
20246 hdrs="$define sys/types.h
20247 $d_socket sys/socket.h
20248 $i_niin netinet/in.h
20249 $i_netdb netdb.h
20250 $i_unistd unistd.h"
20251 : The first arg can 'char *' or 'void *'
20252 : The second arg is some of integral type
20253 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20254 for yyy in size_t long int; do
20255 case "$netdb_host_type" in
61c26d18 20256 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
b4eb6b3d
JH
20257 if ./protochk "$try" $hdrs; then
20258 echo "Your system accepts $xxx for the first arg."
20259 echo "...and $yyy for the second arg."
20260 netdb_host_type="$xxx"
20261 netdb_hlen_type="$yyy"
20262 fi
20263 ;;
20264 esac
20265 done
20266 done
20267 : In case none of those worked, prompt the user.
20268 case "$netdb_host_type" in
20269 '') rp='What is the type for the 1st argument to gethostbyaddr?'
20270 dflt='char *'
20271 . ./myread
20272 netdb_host_type=$ans
20273 rp='What is the type for the 2nd argument to gethostbyaddr?'
20274 dflt="$sizetype"
20275 . ./myread
20276 netdb_hlen_type=$ans
20277 ;;
20278 esac
20279 ;;
20280 *) : no gethostbyaddr, so pick harmless defaults
20281 netdb_host_type='char *'
20282 netdb_hlen_type="$sizetype"
20283 ;;
20284 esac
20285 # Remove the "const" if needed. -- but then we'll have a
20286 # prototype clash!
20287 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20288fi
20289
20290: check for type of argument to gethostbyname.
20291if test "X$netdb_name_type" = X ; then
20292 case "$d_gethbyname" in
20293 $define)
20294 $cat <<EOM
20295
20296Checking to see what type of argument is accepted by gethostbyname().
20297EOM
20298 hdrs="$define sys/types.h
20299 $d_socket sys/socket.h
20300 $i_niin netinet/in.h
20301 $i_netdb netdb.h
20302 $i_unistd unistd.h"
20303 for xxx in "const char *" "char *"; do
20304 case "$netdb_name_type" in
61c26d18 20305 '') try="$extern_C struct hostent *gethostbyname($xxx);"
b4eb6b3d
JH
20306 if ./protochk "$try" $hdrs; then
20307 echo "Your system accepts $xxx."
20308 netdb_name_type="$xxx"
20309 fi
20310 ;;
20311 esac
20312 done
20313 : In case none of those worked, prompt the user.
20314 case "$netdb_name_type" in
20315 '') rp='What is the type for the 1st argument to gethostbyname?'
20316 dflt='char *'
20317 . ./myread
20318 netdb_name_type=$ans
20319 ;;
20320 esac
20321 ;;
20322 *) : no gethostbyname, so pick harmless default
20323 netdb_name_type='char *'
20324 ;;
20325 esac
20326fi
20327
20328: check for type of 1st argument to getnetbyaddr.
20329if test "X$netdb_net_type" = X ; then
20330 case "$d_getnbyaddr" in
20331 $define)
20332 $cat <<EOM
20333
20334Checking to see what type of 1st argument is accepted by getnetbyaddr().
20335EOM
20336 hdrs="$define sys/types.h
20337 $d_socket sys/socket.h
20338 $i_niin netinet/in.h
20339 $i_netdb netdb.h
20340 $i_unistd unistd.h"
20341 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20342 case "$netdb_net_type" in
61c26d18 20343 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
b4eb6b3d
JH
20344 if ./protochk "$try" $hdrs; then
20345 echo "Your system accepts $xxx."
20346 netdb_net_type="$xxx"
20347 fi
20348 ;;
20349 esac
20350 done
20351 : In case none of those worked, prompt the user.
20352 case "$netdb_net_type" in
20353 '') rp='What is the type for the 1st argument to getnetbyaddr?'
20354 dflt='long'
20355 . ./myread
20356 netdb_net_type=$ans
20357 ;;
20358 esac
20359 ;;
20360 *) : no getnetbyaddr, so pick harmless default
20361 netdb_net_type='long'
20362 ;;
20363 esac
20364fi
20365: locate the preferred pager for this system
d604bb53 20366fn=f/
b4eb6b3d
JH
20367case "$pager" in
20368'')
20369 dflt=''
20370 case "$pg" in
20371 /*) dflt=$pg;;
20372 [a-zA-Z]:/*) dflt=$pg;;
20373 esac
20374 case "$more" in
20375 /*) dflt=$more;;
20376 [a-zA-Z]:/*) dflt=$more;;
20377 esac
20378 case "$less" in
20379 /*) dflt=$less;;
20380 [a-zA-Z]:/*) dflt=$less;;
20381 esac
20382 case "$dflt" in
20383 '') dflt=/usr/ucb/more;;
20384 esac
20385 ;;
d604bb53 20386*) dflt="$pager"
d604bb53
JH
20387 fn="f/($pager)"
20388 ;;
b4eb6b3d
JH
20389esac
20390echo " "
b4eb6b3d
JH
20391rp='What pager is used on your system?'
20392. ./getfile
20393pager="$ans"
20394
20395: see what type pids are declared as in the kernel
20396rp="What is the type of process ids on this system?"
20397set pid_t pidtype int stdio.h sys/types.h
20398eval $typedef_ask
20399
b4eb6b3d
JH
20400: see if ar generates random libraries by itself
20401echo " "
20402echo "Checking how to generate random libraries on your machine..." >&4
20403echo 'int bar1() { return bar2(); }' > bar1.c
20404echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
20405$cat > foo.c <<EOP
20406#$i_stdlib I_STDLIB
20407#ifdef I_STDLIB
20408#include <stdlib.h>
20409#endif
b4eb6b3d
JH
20410int main() { printf("%d\n", bar1()); exit(0); }
20411EOP
20412$cc $ccflags -c bar1.c >/dev/null 2>&1
20413$cc $ccflags -c bar2.c >/dev/null 2>&1
20414$cc $ccflags -c foo.c >/dev/null 2>&1
20415$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 20416if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20417 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20418 echo "$ar appears to generate random libraries itself."
20419 orderlib=false
e39a9d84
LC
20420 if [ "X$ranlib" = "X" ]; then
20421 ranlib=":"
20422 fi
88d4d47b
PC
20423elif $ar s bar$_a >/dev/null 2>&1 &&
20424 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20425 $run ./foobar >/dev/null 2>&1; then
20426 echo "a table of contents needs to be added with '$ar s'."
20427 orderlib=false
20428 ranlib="$ar s"
b4eb6b3d 20429elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 20430 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20431 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20432 echo "a table of contents needs to be added with '$ar ts'."
20433 orderlib=false
20434 ranlib="$ar ts"
20435else
20436 case "$ranlib" in
20437 :) ranlib='';;
20438 '')
20439 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20440 $test -f $ranlib || ranlib=''
20441 ;;
20442 esac
20443 if $test -n "$ranlib"; then
20444 echo "your system has '$ranlib'; we'll use that."
20445 orderlib=false
20446 else
20447 echo "your system doesn't seem to support random libraries"
20448 echo "so we'll use lorder and tsort to order the libraries."
20449 orderlib=true
20450 ranlib=":"
20451 fi
20452fi
88d4d47b 20453$rm -f foo* bar*
b4eb6b3d 20454
92a3ac59
MB
20455: see if this is a values.h system
20456set values.h i_values
20457eval $inhdr
20458
73e6e416 20459: Check the max offset that gmtime and localtime accept
92a3ac59 20460echo "Checking max offsets that gmtime () accepts"
81c4fd9e 20461
92a3ac59
MB
20462case $i_values in
20463 define) yyy="#include <values.h>" ;;
20464 *) yyy="" ;;
20465 esac
20466
690aedd1
MB
20467case "$sGMTIME_min/$sGMTIME_max" in
20468 0/0|/)
20469 $cat >try.c <<EOCP
81c4fd9e
MB
20470#include <sys/types.h>
20471#include <stdio.h>
20472#include <time.h>
92a3ac59 20473$yyy
81c4fd9e 20474
92a3ac59
MB
20475int i;
20476struct tm *tmp;
20477time_t pt;
20478
1b289682 20479void gm_check (time_t t, int min_year, int max_year)
92a3ac59 20480{
81c4fd9e 20481 tmp = gmtime (&t);
1b289682
MB
20482 if ( tmp == NULL ||
20483 /* Check tm_year overflow */
20484 tmp->tm_year < min_year || tmp->tm_year > max_year)
92a3ac59
MB
20485 tmp = NULL;
20486 else
20487 pt = t;
20488 } /* gm_check */
81c4fd9e 20489
92a3ac59
MB
20490int check_max ()
20491{
73e6e416
MB
20492 tmp = NULL;
20493 pt = 0;
92a3ac59 20494#ifdef MAXLONG
1b289682 20495 gm_check (MAXLONG, 69, 0x7fffffff);
92a3ac59 20496#endif
73e6e416
MB
20497 if (tmp == NULL || tmp->tm_year < 0) {
20498 for (i = 63; i >= 0; i--) {
20499 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20500 if (x < 0 || x < pt) continue;
20501 gm_check (x, 69, 0x7fffffff);
73e6e416
MB
20502 }
20503 }
20504 printf ("sGMTIME_max=%ld\n", pt);
20505 return (0);
1b289682 20506 } /* check_max */
81c4fd9e 20507
92a3ac59
MB
20508int check_min ()
20509{
73e6e416
MB
20510 tmp = NULL;
20511 pt = 0;
92a3ac59 20512#ifdef MINLONG
1b289682 20513 gm_check (MINLONG, -1900, 70);
92a3ac59 20514#endif
73e6e416
MB
20515 if (tmp == NULL) {
20516 for (i = 36; i >= 0; i--) {
20517 time_t x = pt - ((time_t)1 << i);
20518 if (x > 0) continue;
1b289682 20519 gm_check (x, -1900, 70);
73e6e416
MB
20520 }
20521 }
20522 printf ("sGMTIME_min=%ld\n", pt);
20523 return (0);
20524 } /* check_min */
92a3ac59
MB
20525
20526int main (int argc, char *argv[])
20527{
73e6e416
MB
20528 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20529 check_max ();
20530 check_min ();
20531 return (0);
20532 } /* main */
81c4fd9e 20533EOCP
690aedd1
MB
20534 set try
20535 if eval $compile; then
20536 eval `$run ./try`
20537 else
20538 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20539 fi
20540 $rm_try
20541 ;;
20542 esac
81c4fd9e 20543
73e6e416
MB
20544echo "Checking max offsets that localtime () accepts"
20545
690aedd1
MB
20546case "$sLOCALTIME_min/$sLOCALTIME_max" in
20547 0/0|/)
20548 $cat >try.c <<EOCP
73e6e416
MB
20549#include <sys/types.h>
20550#include <stdio.h>
20551#include <time.h>
20552$yyy
20553
20554int i;
20555struct tm *tmp;
20556time_t pt;
20557
1b289682 20558void local_check (time_t t, int min_year, int max_year)
73e6e416 20559{
5bca5c48
MB
20560 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20561 tmp = NULL;
20562 else
20563 tmp = localtime (&t);
1b289682
MB
20564 if ( tmp == NULL ||
20565 /* Check tm_year overflow */
20566 tmp->tm_year < min_year || tmp->tm_year > max_year)
73e6e416
MB
20567 tmp = NULL;
20568 else
20569 pt = t;
20570 } /* local_check */
20571
20572int check_max ()
20573{
20574 tmp = NULL;
20575 pt = 0;
20576#ifdef MAXLONG
1b289682 20577 local_check (MAXLONG, 69, 0x7fffffff);
73e6e416
MB
20578#endif
20579 if (tmp == NULL || tmp->tm_year < 0) {
20580 for (i = 63; i >= 0; i--) {
20581 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20582 if (x < 0 || x < pt) continue;
20583 local_check (x, 69, 0x7fffffff);
73e6e416
MB
20584 }
20585 }
20586 printf ("sLOCALTIME_max=%ld\n", pt);
20587 return (0);
1b289682 20588 } /* check_max */
73e6e416
MB
20589
20590int check_min ()
20591{
20592 tmp = NULL;
20593 pt = 0;
20594#ifdef MINLONG
1b289682 20595 local_check (MINLONG, -1900, 70);
73e6e416
MB
20596#endif
20597 if (tmp == NULL) {
20598 for (i = 36; i >= 0; i--) {
20599 time_t x = pt - ((time_t)1 << i);
20600 if (x > 0) continue;
1b289682 20601 local_check (x, -1900, 70);
73e6e416
MB
20602 }
20603 }
20604 printf ("sLOCALTIME_min=%ld\n", pt);
20605 return (0);
20606 } /* check_min */
20607
20608int main (int argc, char *argv[])
20609{
20610 check_max ();
20611 check_min ();
20612 return (0);
20613 } /* main */
20614EOCP
690aedd1
MB
20615 set try
20616 if eval $compile; then
20617 eval `$run ./try`
20618 else
20619 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20620 fi
20621 $rm_try
20622 ;;
20623 esac
73e6e416 20624
c0bacbef 20625: check for type of arguments to select.
b4eb6b3d
JH
20626case "$selecttype" in
20627'') case "$d_select" in
20628 $define)
20629 echo " "
20630 $cat <<EOM
20631Checking to see what type of arguments are accepted by select().
20632EOM
20633 hdrs="$define sys/types.h
c0bacbef 20634 $i_systime sys/time.h
b4eb6b3d
JH
20635 $i_sysselct sys/select.h
20636 $d_socket sys/socket.h"
20637 : The first arg can be int, unsigned, or size_t
20638 : The last arg may or may not be 'const'
20639 val=''
20640 : void pointer has been seen but using that
20641 : breaks the selectminbits test
20642 for xxx in 'fd_set *' 'int *'; do
20643 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20644 for tmo in 'struct timeval *' 'const struct timeval *'; do
20645 case "$val" in
61c26d18 20646 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
b4eb6b3d
JH
20647 if ./protochk "$try" $hdrs; then
20648 echo "Your system accepts $xxx."
20649 val="$xxx"
20650 fi
20651 ;;
20652 esac
20653 done
20654 done
20655 done
20656 case "$val" in
20657 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20658 case "$d_fd_set" in
20659 $define) dflt="fd_set *" ;;
20660 *) dflt="int *" ;;
20661 esac
20662 . ./myread
20663 val=$ans
20664 ;;
20665 esac
20666 selecttype="$val"
20667 ;;
20668 *) : no select, so pick a harmless default
20669 selecttype='int *'
20670 ;;
20671 esac
20672 ;;
20673esac
20674
20675: check for the select 'width'
20676case "$selectminbits" in
e6e7e605
JH
20677'') safebits=`expr $ptrsize \* 8`
20678 case "$d_select" in
b4eb6b3d
JH
20679 $define)
20680 $cat <<EOM
20681
20682Checking to see on how many bits at a time your select() operates...
20683EOM
20684 $cat >try.c <<EOCP
20685#include <sys/types.h>
20686#$i_time I_TIME
20687#$i_systime I_SYS_TIME
20688#$i_systimek I_SYS_TIME_KERNEL
20689#ifdef I_TIME
20690# include <time.h>
20691#endif
20692#ifdef I_SYS_TIME
20693# ifdef I_SYS_TIME_KERNEL
20694# define KERNEL
20695# endif
20696# include <sys/time.h>
20697# ifdef I_SYS_TIME_KERNEL
20698# undef KERNEL
20699# endif
20700#endif
20701#$i_sysselct I_SYS_SELECT
20702#ifdef I_SYS_SELECT
20703#include <sys/select.h>
20704#endif
20705#$d_socket HAS_SOCKET
20706#ifdef HAS_SOCKET
20707# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20708#endif
20709#include <stdio.h>
d1daaddf
JH
20710#$i_stdlib I_STDLIB
20711#ifdef I_STDLIB
20712#include <stdlib.h>
20713#endif
b4eb6b3d
JH
20714$selecttype b;
20715#define S sizeof(*(b))
20716#define MINBITS 64
20717#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20718#define NBITS (NBYTES * 8)
20719int main() {
7090f861 20720 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
20721 struct timeval t;
20722 int i;
20723 FILE* fp;
20724 int fd;
20725
e6e7e605
JH
20726 if (!s)
20727 exit(1);
b4eb6b3d
JH
20728 fclose(stdin);
20729 fp = fopen("try.c", "r");
20730 if (fp == 0)
e6e7e605 20731 exit(2);
b4eb6b3d
JH
20732 fd = fileno(fp);
20733 if (fd < 0)
e6e7e605 20734 exit(3);
b4eb6b3d
JH
20735 b = ($selecttype)s;
20736 for (i = 0; i < NBITS; i++)
20737 FD_SET(i, b);
20738 t.tv_sec = 0;
20739 t.tv_usec = 0;
20740 select(fd + 1, b, 0, 0, &t);
20741 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 20742 free(s);
b4eb6b3d
JH
20743 printf("%d\n", i + 1);
20744 return 0;
20745}
20746EOCP
20747 set try
20748 if eval $compile_ok; then
5440bc8e 20749 selectminbits=`$run ./try`
b4eb6b3d
JH
20750 case "$selectminbits" in
20751 '') cat >&4 <<EOM
20752Cannot figure out on how many bits at a time your select() operates.
e6e7e605 20753I'll play safe and guess it is $safebits bits.
b4eb6b3d 20754EOM
e6e7e605
JH
20755 selectminbits=$safebits
20756 bits="$safebits bits"
b4eb6b3d
JH
20757 ;;
20758 1) bits="1 bit" ;;
20759 *) bits="$selectminbits bits" ;;
20760 esac
20761 echo "Your select() operates on $bits at a time." >&4
20762 else
20763 rp='What is the minimum number of bits your select() operates on?'
20764 case "$byteorder" in
e6e7e605
JH
20765 12345678) dflt=64 ;;
20766 1234) dflt=32 ;;
b4eb6b3d
JH
20767 *) dflt=1 ;;
20768 esac
20769 . ./myread
20770 val=$ans
20771 selectminbits="$val"
20772 fi
5b813a60 20773 $rm_try
b4eb6b3d
JH
20774 ;;
20775 *) : no select, so pick a harmless default
e6e7e605 20776 selectminbits=$safebits
b4eb6b3d
JH
20777 ;;
20778 esac
20779 ;;
20780esac
20781
20782: Trace out the files included by signal.h, then look for SIGxxx names.
b4eb6b3d
JH
20783if [ "X$fieldn" = X ]; then
20784 : Just make some guesses. We check them later.
20785 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20786else
20787 xxx=`echo '#include <signal.h>' |
20788 $cppstdin $cppminus $cppflags 2>/dev/null |
613d6c3e 20789 $grep '^[ ]*#.*include' |
776a38e3
MB
20790 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20791 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d 20792fi
b4eb6b3d
JH
20793xxxfiles=''
20794for xx in $xxx /dev/null ; do
20795 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20796done
b4eb6b3d
JH
20797case "$xxxfiles" in
20798'') xxxfiles=`./findhdr signal.h` ;;
20799esac
20800xxx=`awk '
20801$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20802 print substr($2, 4, 20)
20803}
20804$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20805 print substr($3, 4, 20)
20806}' $xxxfiles`
20807: Append some common names just in case the awk scan failed.
20808xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20809xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20810xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20811xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20812xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20813
20814: generate a few handy files for later
55954f19 20815$cat > signal.c <<EOCP
b4eb6b3d
JH
20816#include <sys/types.h>
20817#include <signal.h>
55954f19
JH
20818#$i_stdlib I_STDLIB
20819#ifdef I_STDLIB
20820#include <stdlib.h>
20821#endif
b4eb6b3d
JH
20822#include <stdio.h>
20823int main() {
20824
20825/* Strange style to avoid deeply-nested #if/#else/#endif */
20826#ifndef NSIG
20827# ifdef _NSIG
20828# define NSIG (_NSIG)
20829# endif
20830#endif
20831
20832#ifndef NSIG
20833# ifdef SIGMAX
20834# define NSIG (SIGMAX+1)
20835# endif
20836#endif
20837
20838#ifndef NSIG
20839# ifdef SIG_MAX
20840# define NSIG (SIG_MAX+1)
20841# endif
20842#endif
20843
20844#ifndef NSIG
3609ea0d
JH
20845# ifdef _SIG_MAX
20846# define NSIG (_SIG_MAX+1)
20847# endif
20848#endif
20849
20850#ifndef NSIG
b4eb6b3d
JH
20851# ifdef MAXSIG
20852# define NSIG (MAXSIG+1)
20853# endif
20854#endif
20855
20856#ifndef NSIG
20857# ifdef MAX_SIG
20858# define NSIG (MAX_SIG+1)
20859# endif
20860#endif
20861
20862#ifndef NSIG
20863# ifdef SIGARRAYSIZE
3609ea0d 20864# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
20865# endif
20866#endif
20867
20868#ifndef NSIG
20869# ifdef _sys_nsig
20870# define NSIG (_sys_nsig) /* Solaris 2.5 */
20871# endif
20872#endif
20873
20874/* Default to some arbitrary number that's big enough to get most
20875 of the common signals.
20876*/
20877#ifndef NSIG
20878# define NSIG 50
20879#endif
20880
20881printf("NSIG %d\n", NSIG);
20882
20883#ifndef JUST_NSIG
20884
20885EOCP
20886
20887echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20888{
20889 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 20890 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
20891 printf $1; printf ");\n"
20892 printf "#endif\n"
20893}
20894END {
20895 printf "#endif /* JUST_NSIG */\n";
20896 printf "exit(0);\n}\n";
20897}
20898' >>signal.c
20899$cat >signal.awk <<'EOP'
20900BEGIN { ndups = 0 }
65197d93 20901$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20902($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20903 if ($2 > maxsig) { maxsig = $2 }
20904 if (sig_name[$2]) {
20905 dup_name[ndups] = $1
20906 dup_num[ndups] = $2
613d6c3e 20907 ndups++
b4eb6b3d 20908 }
1ebe1ffb 20909 else {
65197d93
JH
20910 sig_name[$2] = $1
20911 sig_num[$2] = $2
b4eb6b3d
JH
20912 }
20913}
613d6c3e 20914END {
b4eb6b3d
JH
20915 if (nsig == 0) {
20916 nsig = maxsig + 1
20917 }
20918 printf("NSIG %d\n", nsig);
20919 for (n = 1; n < nsig; n++) {
20920 if (sig_name[n]) {
20921 printf("%s %d\n", sig_name[n], sig_num[n])
20922 }
20923 else {
613d6c3e 20924 printf("NUM%d %d\n", n, n)
b4eb6b3d
JH
20925 }
20926 }
20927 for (n = 0; n < ndups; n++) {
20928 printf("%s %d\n", dup_name[n], dup_num[n])
20929 }
20930}
20931EOP
20932$cat >signal_cmd <<EOS
20933$startsh
20934if $test -s signal.lst; then
20935 echo "Using your existing signal.lst file"
20936 exit 0
20937fi
20938xxx="$xxx"
20939EOS
20940$cat >>signal_cmd <<'EOS'
20941
20942set signal
20943if eval $compile_ok; then
776a38e3
MB
20944 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20945 $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20946else
20947 echo "(I can't seem be able to compile the whole test program)" >&4
20948 echo "(I'll try it in little pieces.)" >&4
20949 set signal -DJUST_NSIG
20950 if eval $compile_ok; then
5440bc8e 20951 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20952 $cat signal.nsg
20953 else
20954 echo "I can't seem to figure out how many signals you have." >&4
20955 echo "Guessing 50." >&4
20956 echo 'NSIG 50' > signal.nsg
20957 fi
20958 : Now look at all the signal names, one at a time.
20959 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20960 $cat > signal.c <<EOCP
20961#include <sys/types.h>
20962#include <signal.h>
20963#include <stdio.h>
20964int main() {
20965printf("$xx %d\n", SIG${xx});
20966return 0;
20967}
20968EOCP
20969 set signal
20970 if eval $compile; then
20971 echo "SIG${xx} found."
5440bc8e 20972 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20973 else
20974 echo "SIG${xx} NOT found."
20975 fi
20976 done
20977 if $test -s signal.ls1; then
20978 $cat signal.nsg signal.ls1 |
65197d93 20979 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20980 fi
20981
20982fi
20983if $test -s signal.lst; then
20984 :
20985else
20986 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20987 echo 'kill -l' >signal
20988 set X `csh -f <signal`
20989 $rm -f signal
20990 shift
20991 case $# in
20992 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20993 esac
20994 echo $@ | $tr ' ' $trnl | \
20995 $awk '{ printf "%s %d\n", $1, ++s; }
20996 END { printf "NSIG %d\n", ++s }' >signal.lst
20997fi
20998$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20999EOS
21000chmod a+x signal_cmd
21001$eunicefix signal_cmd
21002
21003: generate list of signal names
21004echo " "
21005case "$sig_name_init" in
21006'') doinit=yes ;;
21007*) case "$sig_num_init" in
21008 ''|*,*) doinit=yes ;;
21009 esac ;;
21010esac
21011case "$doinit" in
21012yes)
21013 echo "Generating a list of signal names and numbers..." >&4
21014 . ./signal_cmd
21015 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21016 sig_name=`$awk 'BEGIN { printf "ZERO " }
21017 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21018 sig_num=`$awk 'BEGIN { printf "0 " }
21019 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21020 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
21021 !/^NSIG/ { printf "\"%s\", ", $1 }
21022 END { printf "0\n" }' signal.lst`
21023 sig_num_init=`$awk 'BEGIN { printf "0, " }
21024 !/^NSIG/ { printf "%d, ", $2}
21025 END { printf "0\n"}' signal.lst`
21026 ;;
21027esac
21028echo "The following $sig_count signals are available:"
21029echo " "
21030echo $sig_name | $awk \
21031'BEGIN { linelen = 0 }
21032{
21033 for (i = 1; i <= NF; i++) {
21034 name = "SIG" $i " "
21035 linelen = linelen + length(name)
21036 if (linelen > 70) {
21037 printf "\n"
21038 linelen = length(name)
21039 }
21040 printf "%s", name
21041 }
21042 printf "\n"
21043}'
76d3c696 21044sig_size=`echo $sig_name | awk '{print NF}'`
c0bacbef 21045$rm -f signal signal.c signal.awk signal.lst signal_cmd
b4eb6b3d 21046
613d6c3e 21047: Check size of size
b4eb6b3d
JH
21048echo " "
21049case "$sizetype" in
21050*_t) zzz="$sizetype" ;;
21051*) zzz="filesize" ;;
21052esac
613d6c3e 21053echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21054cat > try.c <<EOCP
21055#include <sys/types.h>
21056#include <stdio.h>
d1daaddf
JH
21057#$i_stdlib I_STDLIB
21058#ifdef I_STDLIB
21059#include <stdlib.h>
21060#endif
b4eb6b3d
JH
21061int main() {
21062 printf("%d\n", (int)sizeof($sizetype));
21063 exit(0);
21064}
21065EOCP
21066set try
21067if eval $compile_ok; then
5440bc8e 21068 yyy=`$run ./try`
b4eb6b3d
JH
21069 case "$yyy" in
21070 '') sizesize=4
21071 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21072 ;;
21073 *) sizesize=$yyy
21074 echo "Your $zzz size is $sizesize bytes."
21075 ;;
21076 esac
21077else
21078 sizesize=4
21079 echo "(I can't compile the test program--guessing $sizesize.)" >&4
21080fi
21081
21082
21083: check for socklen_t
21084echo " "
21085echo "Checking to see if you have socklen_t..." >&4
21086$cat >try.c <<EOCP
21087#include <sys/types.h>
21088#$d_socket HAS_SOCKET
21089#ifdef HAS_SOCKET
21090#include <sys/socket.h>
21091#endif
21092int main() { socklen_t x = 16; }
21093EOCP
21094set try
21095if eval $compile; then
21096 val="$define"
21097 echo "You have socklen_t."
21098else
21099 val="$undef"
21100 echo "You do not have socklen_t."
21101 case "$sizetype" in
21102 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21103 esac
21104fi
5b813a60 21105$rm_try
b4eb6b3d
JH
21106set d_socklen_t
21107eval $setvar
21108
a7710f8d
JH
21109: see if this is a socks.h system
21110set socks.h i_socks
21111eval $inhdr
21112
b4eb6b3d
JH
21113: check for type of the size argument to socket calls
21114case "$d_socket" in
21115"$define")
21116 $cat <<EOM
21117
21118Checking to see what type is the last argument of accept().
21119EOM
b4eb6b3d
JH
21120 yyy=''
21121 case "$d_socklen_t" in
21122 "$define") yyy="$yyy socklen_t"
21123 esac
21124 yyy="$yyy $sizetype int long unsigned"
21125 for xxx in $yyy; do
21126 case "$socksizetype" in
61c26d18 21127 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
21128 case "$usesocks" in
21129 "$define")
21130 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21131 echo "Your system accepts '$xxx *' for the last argument of accept()."
21132 socksizetype="$xxx"
21133 fi
21134 ;;
21135 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
21136 echo "Your system accepts '$xxx *' for the last argument of accept()."
21137 socksizetype="$xxx"
21138 fi
21139 ;;
21140 esac
b4eb6b3d
JH
21141 ;;
21142 esac
21143 done
21144: In case none of those worked, prompt the user.
21145 case "$socksizetype" in
21146 '') rp='What is the type for socket address structure sizes?'
21147 dflt='int'
21148 . ./myread
21149 socksizetype=$ans
21150 ;;
21151 esac
21152 ;;
21153*) : no sockets, so pick relatively harmless default
21154 socksizetype='int'
21155 ;;
21156esac
21157
21158: see what type is used for signed size_t
21159set ssize_t ssizetype int stdio.h sys/types.h
21160eval $typedef
21161dflt="$ssizetype"
5440bc8e 21162$cat > try.c <<EOM
b4eb6b3d 21163#include <stdio.h>
d1daaddf
JH
21164#$i_stdlib I_STDLIB
21165#ifdef I_STDLIB
21166#include <stdlib.h>
21167#endif
b4eb6b3d
JH
21168#include <sys/types.h>
21169#define Size_t $sizetype
21170#define SSize_t $dflt
21171int main()
21172{
21173 if (sizeof(Size_t) == sizeof(SSize_t))
21174 printf("$dflt\n");
21175 else if (sizeof(Size_t) == sizeof(int))
21176 printf("int\n");
5b813a60 21177 else
b4eb6b3d
JH
21178 printf("long\n");
21179 exit(0);
21180}
21181EOM
21182echo " "
5440bc8e
JH
21183set try
21184if eval $compile_ok && $run ./try > /dev/null; then
21185 ssizetype=`$run ./try`
b4eb6b3d
JH
21186 echo "I'll be using $ssizetype for functions returning a byte count." >&4
21187else
21188 $cat >&4 <<EOM
21189Help! I can't compile and run the ssize_t test program: please enlighten me!
21190(This is probably a misconfiguration in your system or libraries, and
21191you really ought to fix it. Still, I'll try anyway.)
21192
21193I need a type that is the same size as $sizetype, but is guaranteed to
21194be signed. Common values are ssize_t, int and long.
21195
21196EOM
21197 rp="What signed type is the same size as $sizetype?"
21198 . ./myread
21199 ssizetype="$ans"
21200fi
5b813a60 21201$rm_try
b4eb6b3d
JH
21202
21203: see what type of char stdio uses.
21204echo " "
1d8eaf8c 21205echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
aa517f50 21206if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
21207 echo "Your stdio uses unsigned chars." >&4
21208 stdchar="unsigned char"
21209else
aa517f50
JH
21210 echo "Your stdio uses signed chars." >&4
21211 stdchar="char"
b4eb6b3d 21212fi
1d8eaf8c 21213$rm -f stdioh
b4eb6b3d 21214
b4eb6b3d
JH
21215: see what type uids are declared as in the kernel
21216echo " "
21217echo "Looking for the type for user ids returned by getuid()."
21218set uid_t uidtype xxx stdio.h sys/types.h
21219eval $typedef
21220case "$uidtype" in
21221xxx)
21222 xxx=`./findhdr sys/user.h`
21223 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21224 case $1 in
21225 unsigned) dflt="$1 $2" ;;
21226 *) dflt="$1" ;;
21227 esac
21228 ;;
21229*) dflt="$uidtype";;
21230esac
21231case "$uidtype" in
21232uid_t) echo "uid_t found." ;;
21233*) rp="What is the type for user ids returned by getuid()?"
21234 . ./myread
21235 uidtype="$ans"
21236 ;;
21237esac
21238
613d6c3e 21239: Check size of UID
b4eb6b3d
JH
21240echo " "
21241case "$uidtype" in
21242*_t) zzz="$uidtype" ;;
21243*) zzz="uid" ;;
21244esac
613d6c3e 21245echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21246cat > try.c <<EOCP
21247#include <sys/types.h>
21248#include <stdio.h>
d1daaddf
JH
21249#$i_stdlib I_STDLIB
21250#ifdef I_STDLIB
21251#include <stdlib.h>
21252#endif
b4eb6b3d
JH
21253int main() {
21254 printf("%d\n", (int)sizeof($uidtype));
21255 exit(0);
21256}
21257EOCP
21258set try
21259if eval $compile_ok; then
5440bc8e 21260 yyy=`$run ./try`
b4eb6b3d
JH
21261 case "$yyy" in
21262 '') uidsize=4
21263 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21264 ;;
21265 *) uidsize=$yyy
21266 echo "Your $zzz is $uidsize bytes long."
21267 ;;
21268 esac
21269else
21270 uidsize=4
21271 echo "(I can't compile the test program--guessing $uidsize.)" >&4
21272fi
21273
613d6c3e 21274: Check if UID is signed
b4eb6b3d
JH
21275echo " "
21276case "$uidtype" in
21277*_t) zzz="$uidtype" ;;
21278*) zzz="uid" ;;
21279esac
21280echo "Checking the sign of $zzz..." >&4
21281cat > try.c <<EOCP
21282#include <sys/types.h>
21283#include <stdio.h>
21284int main() {
21285 $uidtype foo = -1;
21286 if (foo < 0)
21287 printf("-1\n");
21288 else
21289 printf("1\n");
21290}
21291EOCP
21292set try
21293if eval $compile; then
5440bc8e 21294 yyy=`$run ./try`
b4eb6b3d
JH
21295 case "$yyy" in
21296 '') uidsign=1
21297 echo "(I can't execute the test program--guessing unsigned.)" >&4
21298 ;;
21299 *) uidsign=$yyy
21300 case "$uidsign" in
21301 1) echo "Your $zzz is unsigned." ;;
21302 -1) echo "Your $zzz is signed." ;;
21303 esac
21304 ;;
21305 esac
21306else
21307 uidsign=1
21308 echo "(I can't compile the test program--guessing unsigned.)" >&4
21309fi
21310
21311
34f1896b 21312: Check format string for UID
b4eb6b3d
JH
21313echo " "
21314$echo "Checking the format string to be used for uids..." >&4
21315
21316case "$uidsign" in
21317-1) if $test X"$uidsize" = X"$ivsize"; then
21318 uidformat="$ivdformat"
21319 else
21320 if $test X"$uidsize" = X"$longsize"; then
21321 uidformat='"ld"'
21322 else
21323 if $test X"$uidsize" = X"$intsize"; then
21324 uidformat='"d"'
21325 else
21326 if $test X"$uidsize" = X"$shortsize"; then
21327 uidformat='"hd"'
21328 fi
21329 fi
21330 fi
21331 fi
21332 ;;
21333*) if $test X"$uidsize" = X"$uvsize"; then
21334 uidformat="$uvuformat"
21335 else
21336 if $test X"$uidsize" = X"$longsize"; then
21337 uidformat='"lu"'
21338 else
21339 if $test X"$uidsize" = X"$intsize"; then
21340 uidformat='"u"'
21341 else
21342 if $test X"$uidsize" = X"$shortsize"; then
21343 uidformat='"hu"'
21344 fi
21345 fi
21346 fi
21347 fi
21348 ;;
21349esac
21350
34f1896b 21351: Check if site customization support was requested
4afd418c
MB
21352case "$usesitecustomize" in
21353 $define|true|[Yy]*)
21354 usesitecustomize="$define"
21355 ;;
21356 *)
21357 usesitecustomize="$undef"
21358 ;;
21359 esac
21360
d03b3b00
MB
21361: see if prototypes support variable argument declarations
21362echo " "
21363case "$prototype$i_stdarg" in
21364$define$define)
21365 echo "It appears we'll be able to prototype varargs functions." >&4
21366 val="$define"
21367 ;;
21368*)
21369 echo "Too bad... We won't be using prototyped varargs functions..." >&4
21370 val="$undef"
21371 ;;
21372esac
21373set vaproto
21374eval $setvar
21375
3659ebf1
JH
21376: determine compiler compiler
21377case "$yacc" in
21378'')
21379 dflt=yacc;;
21380*)
21381 dflt="$yacc";;
21382esac
21383echo " "
21384comp='yacc'
3c728e00 21385if $test -f "$byacc$_exe"; then
3659ebf1
JH
21386 dflt="$byacc"
21387 comp="byacc or $comp"
21388fi
3c728e00 21389if $test -f "$bison$_exe"; then
3659ebf1
JH
21390 comp="$comp or bison -y"
21391fi
21392rp="Which compiler compiler ($comp) shall I use?"
21393. ./myread
21394yacc="$ans"
21395case "$yacc" in
21396*bis*)
21397 case "$yacc" in
21398 *-y*) ;;
21399 *)
21400 yacc="$yacc -y"
21401 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21402 ;;
21403 esac
21404 ;;
21405esac
21406
c0bacbef
MB
21407: see if this is a assert.h system
21408set assert.h i_assert
21409eval $inhdr
21410
758a5d79
JH
21411: see if this is a fp.h system
21412set fp.h i_fp
21413eval $inhdr
21414
21415: see if this is a fp_class.h system
21416set fp_class.h i_fp_class
21417eval $inhdr
21418
13cfc98d
MB
21419: see if gdbm.h is available
21420set gdbm.h t_gdbm
21421eval $inhdr
21422case "$t_gdbm" in
21423$define)
21424 : see if gdbm_open exists
21425 set gdbm_open d_gdbm_open
21426 eval $inlibc
21427 case "$d_gdbm_open" in
21428 $undef)
21429 t_gdbm="$undef"
21430 echo "We won't be including <gdbm.h>"
21431 ;;
21432 esac
21433 ;;
21434esac
21435val="$t_gdbm"
21436set i_gdbm
21437eval $setvar
21438
b2f871ed
AD
21439: see if this is a ieeefp.h system
21440case "$i_ieeefp" in
21441'' ) set ieeefp.h i_ieeefp
21442 eval $inhdr
21443 ;;
21444esac
21445
21446: see if this is a libutil.h system
21447set libutil.h i_libutil
21448eval $inhdr
21449
21450: see if mach cthreads are available
21451if test "X$usethreads" = "X$define"; then
21452 set mach/cthreads.h i_machcthr
21453 eval $inhdr
21454else
21455 i_machcthr="$undef"
21456fi
21457
21458: see if this is a mntent.h system
21459set mntent.h i_mntent
21460eval $inhdr
21461
b4eb6b3d
JH
21462: see if net/errno.h is available
21463val=''
21464set net/errno.h val
21465eval $inhdr
21466
21467: Unfortunately, it causes problems on some systems. Arrgh.
21468case "$val" in
21469$define)
21470 cat > try.c <<'EOM'
21471#include <stdio.h>
21472#include <errno.h>
21473#include <net/errno.h>
21474int func()
21475{
21476 return ENOTSOCK;
21477}
21478EOM
21479 if $cc $ccflags -c try.c >/dev/null 2>&1; then
21480 echo "We'll be including <net/errno.h>." >&4
21481 else
21482 echo "We won't be including <net/errno.h>." >&4
21483 val="$undef"
21484 fi
5b813a60 21485 $rm_try
b4eb6b3d
JH
21486 ;;
21487esac
21488set i_neterrno
21489eval $setvar
21490
21491: see if netinet/tcp.h is available
21492set netinet/tcp.h i_netinettcp
21493eval $inhdr
21494
21495: see if this is a poll.h system
21496set poll.h i_poll
21497eval $inhdr
21498
21499: see if this is a prot.h system
21500set prot.h i_prot
21501eval $inhdr
21502
613d6c3e 21503: Preprocessor symbols
b4eb6b3d 21504echo " "
ddfca5da 21505$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
21506$cat <<'EOSH' > Cppsym.know
21507a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21508AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 21509alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
21510ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21511BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
21512BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21513bull c cadmus clipper CMU COFF COMPILER_VERSION
21514concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 21515CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
21516Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21517FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21518GLIBC GLIBC_MINOR
21519GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
21520H3050R H3050RX hbullx20 hcx host_mips
21521hp200 hp300 hp700 HP700 hp800 hp9000
21522hp9000s200 hp9000s300 hp9000s400 hp9000s500
21523hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21524i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 21525IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
21526INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21527LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21528LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 21529LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
21530LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21531M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21532M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21533M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21534MATH_HAS_NO_SIDE_EFFECTS
21535mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21536mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21537mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21538MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21539mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21540NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 21541news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
21542ns32016 ns32332 ns32k nsc32000
21543OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21544pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21545pc532 pdp11 PGC PIC plexus PORTAR posix
21546POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21547POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 21548PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 21549riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
21550SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21551sony sony_news sonyrisc sparc sparclite spectrum
21552stardent stdc STDC_EXT stratos sun sun3 sun386
21553Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21554SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21555SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21556sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 21557TM3200 TM5400 TM5600
b4eb6b3d
JH
21558tower tower32 tower32_200 tower32_600 tower32_700
21559tower32_800 tower32_850 tss
21560u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21561ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
21562unix UNIX95 UNIX99 unixpc unos
21563USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21564USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21565USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21566USGr4 USGr4_2
44c87379 21567Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
21568XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21569XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21570z8000
21571EOSH
21572# Maybe put other stuff here too.
21573cat <<EOSH >>Cppsym.know
21574$osname
21575EOSH
21576./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21577./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21578$cat Cppsym.know > Cppsym.c
381aa1ff 21579$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
21580$rm -f Cppsym.a Cppsym.b Cppsym.c
21581cat <<EOSH > Cppsym
21582$startsh
21583if $test \$# -gt 0; then
21584 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21585 if $test -s Cppsym.got; then
21586 $rm -f Cppsym.got
21587 exit 0
21588 fi
21589 $rm -f Cppsym.got
21590 exit 1
21591else
21592 $tr " " "$trnl" | ./Cppsym.try
21593 exit 0
21594fi
21595EOSH
21596chmod +x Cppsym
21597$eunicefix Cppsym
21598cat <<EOSH > Cppsym.try
21599$startsh
21600cat <<'EOCP' > try.c
21601#include <stdio.h>
360321b3
YST
21602#if cpp_stuff == 1
21603#define STRINGIFY(a) "a"
21604#endif
21605#if cpp_stuff == 42
21606#define StGiFy(a) #a
21607#define STRINGIFY(a) StGiFy(a)
21608#endif
21609#if $cpp_stuff != 1 && $cpp_stuff != 42
21610# include "Bletch: How does this C preprocessor stringify macros?"
21611#endif
b4eb6b3d
JH
21612int main() {
21613EOCP
21614$awk \\
21615EOSH
21616cat <<'EOSH' >> Cppsym.try
21617'length($1) > 0 {
360321b3
YST
21618 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21619 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21620 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21621 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 21622}' >> try.c
2ef53570 21623echo 'return 0;}' >> try.c
b4eb6b3d
JH
21624EOSH
21625cat <<EOSH >> Cppsym.try
21626ccflags="$ccflags"
21627case "$osname-$gccversion" in
21628irix-) ccflags="\$ccflags -woff 1178" ;;
21629os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21630esac
360321b3 21631$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
21632EOSH
21633chmod +x Cppsym.try
21634$eunicefix Cppsym.try
21635./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 21636: Add in any linux cpp "predefined macros":
b6a7163e 21637case "$osname::$gccversion" in
eeb92b76 21638 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
b6a7163e
MB
21639 tHdrH=_tmpHdr
21640 rm -f $tHdrH'.h' $tHdrH
21641 touch $tHdrH'.h'
6f5be6d1 21642 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
b6a7163e
MB
21643 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21644 if [ -s $tHdrH'_cppsym.real' ]; then
21645 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21646 fi
21647 fi
21648 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21649 ;;
21650esac
b4eb6b3d
JH
21651: now check the C compiler for additional symbols
21652postprocess_cc_v=''
21653case "$osname" in
21654aix) postprocess_cc_v="|$tr , ' '" ;;
21655esac
21656$cat >ccsym <<EOS
21657$startsh
21658$cat >tmp.c <<EOF
21659extern int foo;
21660EOF
21661for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21662do
21663 case "\$i" in
21664 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 21665 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
21666 esac
21667done
5b813a60 21668$rm_try
b4eb6b3d
JH
21669EOS
21670postprocess_cc_v=''
21671chmod +x ccsym
21672$eunicefix ccsym
21673./ccsym > ccsym1.raw
21674if $test -s ccsym1.raw; then
21675 $sort ccsym1.raw | $uniq >ccsym.raw
21676else
21677 mv ccsym1.raw ccsym.raw
21678fi
21679
21680$awk '/\=/ { print $0; next }
21681 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
21682$comm -13 Cppsym.true ccsym.list >ccsym.own
21683$comm -12 Cppsym.true ccsym.list >ccsym.com
21684$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
21685also=''
21686if $test -z ccsym.raw; then
21687 echo "Your C compiler doesn't seem to define any symbols!" >&4
21688 echo " "
21689 echo "However, your C preprocessor defines the following symbols:"
21690 $cat Cppsym.true
21691 ccsymbols=''
21692 cppsymbols=`$cat Cppsym.true`
21693 cppsymbols=`echo $cppsymbols`
21694 cppccsymbols="$cppsymbols"
21695else
21696 if $test -s ccsym.com; then
21697 echo "Your C compiler and pre-processor define these symbols:"
21698 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21699 also='also '
21700 symbols='ones'
21701 cppccsymbols=`$cat ccsym.com`
21702 cppccsymbols=`echo $cppccsymbols`
21703 $test "$silent" || sleep 1
21704 fi
21705 if $test -s ccsym.cpp; then
21706 $test "$also" && echo " "
21707 echo "Your C pre-processor ${also}defines the following symbols:"
21708 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21709 also='further '
21710 cppsymbols=`$cat ccsym.cpp`
21711 cppsymbols=`echo $cppsymbols`
21712 $test "$silent" || sleep 1
21713 fi
21714 if $test -s ccsym.own; then
21715 $test "$also" && echo " "
21716 echo "Your C compiler ${also}defines the following cpp symbols:"
21717 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21718 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21719 ccsymbols=`$cat ccsym.own`
21720 ccsymbols=`echo $ccsymbols`
21721 $test "$silent" || sleep 1
21722 fi
21723fi
b4eb6b3d
JH
21724
21725: see if this is a termio system
21726val="$undef"
21727val2="$undef"
21728val3="$undef"
21729if $test `./findhdr termios.h`; then
21730 set tcsetattr i_termios
21731 eval $inlibc
21732 val3="$i_termios"
21733fi
21734echo " "
21735case "$val3" in
21736"$define") echo "You have POSIX termios.h... good!" >&4;;
21737*) if ./Cppsym pyr; then
21738 case "`/bin/universe`" in
21739 ucb) if $test `./findhdr sgtty.h`; then
21740 val2="$define"
21741 echo "<sgtty.h> found." >&4
21742 else
21743 echo "System is pyramid with BSD universe."
216dac04 21744 ./warn "<sgtty.h> not found--you could have problems."
b4eb6b3d
JH
21745 fi;;
21746 *) if $test `./findhdr termio.h`; then
21747 val="$define"
21748 echo "<termio.h> found." >&4
21749 else
21750 echo "System is pyramid with USG universe."
216dac04 21751 ./warn "<termio.h> not found--you could have problems."
b4eb6b3d
JH
21752 fi;;
21753 esac
21754 elif ./usg; then
21755 if $test `./findhdr termio.h`; then
21756 echo "<termio.h> found." >&4
21757 val="$define"
21758 elif $test `./findhdr sgtty.h`; then
21759 echo "<sgtty.h> found." >&4
21760 val2="$define"
21761 else
216dac04 21762 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
b4eb6b3d
JH
21763 fi
21764 else
21765 if $test `./findhdr sgtty.h`; then
21766 echo "<sgtty.h> found." >&4
21767 val2="$define"
21768 elif $test `./findhdr termio.h`; then
21769 echo "<termio.h> found." >&4
21770 val="$define"
21771 else
216dac04 21772 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
b4eb6b3d
JH
21773 fi
21774 fi;;
21775esac
21776set i_termio; eval $setvar
21777val=$val2; set i_sgtty; eval $setvar
21778val=$val3; set i_termios; eval $setvar
21779
b4eb6b3d
JH
21780: see if stddef is available
21781set stddef.h i_stddef
21782eval $inhdr
923fc586 21783
b4eb6b3d
JH
21784: see if sys/access.h is available
21785set sys/access.h i_sysaccess
21786eval $inhdr
21787
21788: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21789set sys/filio.h i_sysfilio
21790eval $inhdr
21791echo " "
21792if $test `./findhdr sys/ioctl.h`; then
21793 val="$define"
21794 echo '<sys/ioctl.h> found.' >&4
21795else
21796 val="$undef"
21797 if $test $i_sysfilio = "$define"; then
21798 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 21799 else
b4eb6b3d
JH
21800 $test $i_sgtty = "$define" && xxx="sgtty.h"
21801 $test $i_termio = "$define" && xxx="termio.h"
21802 $test $i_termios = "$define" && xxx="termios.h"
21803echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21804 fi
21805fi
21806set i_sysioctl
21807eval $setvar
21808
49a78c82
JH
21809: see if socket ioctl defs are in sys/sockio.h
21810echo " "
21811xxx=`./findhdr sys/sockio.h`
21812if $test "$xxx"; then
21813 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21814 val="$define"
21815 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21816 else
21817 val="$undef"
21818 echo "No socket ioctls found in <sys/sockio.h>." >&4
21819 fi
21820else
21821 val="$undef"
21822 $cat <<EOM
21823<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21824EOM
21825fi
21826set i_syssockio
21827eval $setvar
21828
b4eb6b3d
JH
21829: see if this is a syslog.h system
21830set syslog.h i_syslog
21831eval $inhdr
21832
b4eb6b3d
JH
21833: see if this is a sys/mode.h system
21834set sys/mode.h i_sysmode
21835eval $inhdr
21836
216dac04
MB
21837: see if there is a sys/poll.h file
21838set sys/poll.h i_syspoll
21839eval $inhdr
21840
b4eb6b3d
JH
21841: see if sys/resource.h has to be included
21842set sys/resource.h i_sysresrc
21843eval $inhdr
21844
21845: see if sys/security.h is available
21846set sys/security.h i_syssecrt
21847eval $inhdr
21848
21849: see if this is a sys/statvfs.h system
21850set sys/statvfs.h i_sysstatvfs
21851eval $inhdr
21852
b4eb6b3d
JH
21853: see if this is a sys/un.h system
21854set sys/un.h i_sysun
21855eval $inhdr
21856
b4eb6b3d
JH
21857: see if this is a sys/utsname.h system
21858set sys/utsname.h i_sysutsname
21859eval $inhdr
21860
21861: see if this is a syswait system
21862set sys/wait.h i_syswait
21863eval $inhdr
21864
21865: see if this is a ustat.h system
21866set ustat.h i_ustat
21867eval $inhdr
21868
21869: see if this is an utime system
21870set utime.h i_utime
21871eval $inhdr
21872
b4eb6b3d
JH
21873: see if this is a vfork system
21874case "$d_vfork" in
21875"$define")
21876 set vfork.h i_vfork
21877 eval $inhdr
21878 ;;
21879*)
21880 i_vfork="$undef"
21881 ;;
21882esac
21883
613d6c3e 21884: Check extensions
b4eb6b3d
JH
21885echo " "
21886echo "Looking for extensions..." >&4
21887: If we are using the old config.sh, known_extensions may contain
21888: old or inaccurate or duplicate values.
21889known_extensions=''
21890nonxs_extensions=''
21891: We do not use find because it might not be available.
21892: We do not just use MANIFEST because the user may have dropped
21893: some additional extensions into the source tree and expect them
21894: to be built.
21895
38fddf8b
MB
21896: Function to recursively find available extensions, ignoring DynaLoader
21897: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
4cc80fc4 21898: In 5.10.1 and later, extensions are stored in directories
88a6f4fc 21899: like File-Glob instead of the older File/Glob/.
b4eb6b3d
JH
21900find_extensions='
21901 for xxx in *; do
822a6ee0
MB
21902 case "$xxx" in
21903 DynaLoader|dynaload) ;;
21904 *)
238a6851
NC
21905 this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21906 leaf=`echo $xxx | $sed -e s/.*-//`;
dd6c21be 21907 if $test -d File; then
38fddf8b
MB
21908 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21909 known_extensions="$known_extensions $1$this_ext";
21910 elif $test -f $xxx/Makefile.PL; then
21911 nonxs_extensions="$nonxs_extensions $1$this_ext";
21912 else
21913 if $test -d $xxx -a $# -lt 10; then
21914 set $1$xxx/ $*;
21915 cd "$xxx";
21916 eval $find_extensions;
21917 cd ..;
21918 shift;
21919 fi;
21920 fi;
dd6c21be
NC
21921 else
21922 $ls -1 $xxx > $$.tmp;
21923 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21924 known_extensions="$known_extensions $this_ext";
21925 elif $contains "\.c$" $$.tmp > /dev/null 2>&1; then
21926 known_extensions="$known_extensions $this_ext";
dd6c21be
NC
21927 elif $test -d $xxx; then
21928 nonxs_extensions="$nonxs_extensions $this_ext";
21929 fi;
21930 $rm -f $$.tmp;
822a6ee0
MB
21931 fi
21932 ;;
21933 esac;
b4eb6b3d
JH
21934 done'
21935tdir=`pwd`
dd6c21be
NC
21936cd "$rsrc/cpan"
21937set X
21938shift
21939eval $find_extensions
a193a2db
NC
21940cd "$rsrc/dist"
21941set X
21942shift
21943eval $find_extensions
6904989c 21944cd "$rsrc/ext"
b4eb6b3d
JH
21945set X
21946shift
21947eval $find_extensions
38fddf8b
MB
21948if $test -d File-Glob; then
21949 : All ext/ flattened
21950else
21951 # Special case: Add in modules that nest beyond the first level.
21952 # Currently threads/shared and Hash/Util/FieldHash, since they are
21953 # not picked up by the recursive find above (and adding in general
21954 # recursive finding breaks SDBM_File/sdbm).
21955 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21956 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21957fi
faae14e6
MB
21958set X $known_extensions
21959shift
a32b3e13 21960known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
b4eb6b3d
JH
21961set X $nonxs_extensions
21962shift
a32b3e13 21963nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
6904989c 21964cd "$tdir"
b4eb6b3d
JH
21965
21966: Now see which are supported on this system.
21967avail_ext=''
21968for xxx in $known_extensions ; do
21969 case "$xxx" in
21970 DB_File|db_file)
21971 case "$i_db" in
21972 $define) avail_ext="$avail_ext $xxx" ;;
21973 esac
21974 ;;
21975 GDBM_File|gdbm_fil)
7c345082 21976 case "$i_gdbm" in
b4eb6b3d
JH
21977 $define) avail_ext="$avail_ext $xxx" ;;
21978 esac
21979 ;;
1d59c593 21980 I18N/Langinfo|i18n_lan)
7c345082 21981 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
21982 $define$define) avail_ext="$avail_ext $xxx" ;;
21983 esac
21984 ;;
7978b0db
JH
21985 IPC/SysV|ipc/sysv)
21986 : XXX Do we need a useipcsysv variable here
21987 case "${d_msg}${d_sem}${d_shm}" in
21988 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21989 esac
21990 ;;
b4eb6b3d 21991 NDBM_File|ndbm_fil)
7894ad66 21992 case "$d_ndbm" in
b4eb6b3d
JH
21993 $define)
21994 case "$osname-$use64bitint" in
0be9fa5d 21995 hpux-define)
b4eb6b3d
JH
21996 case "$libs" in
21997 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21998 esac
21999 ;;
22000 *) avail_ext="$avail_ext $xxx" ;;
22001 esac
22002 ;;
22003 esac
22004 ;;
7c345082 22005 ODBM_File|odbm_fil)
b4eb6b3d
JH
22006 case "${i_dbm}${i_rpcsvcdbm}" in
22007 *"${define}"*)
7978b0db
JH
22008 case "$d_cplusplus" in
22009 define) ;; # delete as a function name will not work
22010 *) case "$osname-$use64bitint" in
22011 hpux-define)
22012 case "$libs" in
22013 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22014 esac
22015 ;;
22016 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
22017 esac
22018 ;;
b4eb6b3d
JH
22019 esac
22020 ;;
22021 esac
22022 ;;
7978b0db
JH
22023 Opcode|opcode)
22024 case "$useopcode" in
b4eb6b3d
JH
22025 true|define|y) avail_ext="$avail_ext $xxx" ;;
22026 esac
22027 ;;
7978b0db
JH
22028 POSIX|posix)
22029 case "$useposix" in
b4eb6b3d
JH
22030 true|define|y) avail_ext="$avail_ext $xxx" ;;
22031 esac
22032 ;;
22033 Socket|socket)
7c345082 22034 case "$d_socket" in
4a9f028c
JH
22035 true|$define|y)
22036 case "$osname" in
22037 beos) ;; # not unless BONE
22038 *) avail_ext="$avail_ext $xxx" ;;
22039 esac
22040 ;;
b4eb6b3d
JH
22041 esac
22042 ;;
22043 Sys/Syslog|sys/syslog)
22044 : XXX syslog requires socket
7c345082 22045 case "$d_socket" in
b4eb6b3d
JH
22046 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22047 esac
22048 ;;
22049 Thread|thread)
b00ec89b
AB
22050 case "$usethreads" in
22051 true|$define|y)
47f9f84c 22052 case "$use5005threads" in
3f30fabf 22053 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 22054 esac
b4eb6b3d
JH
22055 esac
22056 ;;
7978b0db
JH
22057 threads|threads/shared)
22058 # threads and threads::shared are special cases.
22059 # To stop people from asking "Perl 5.8.0 was supposed
22060 # to have this new fancy threads implementation but my
22061 # perl doesn't have it" and from people trying to
22062 # (re)install the threads module using CPAN.pm and
22063 # CPAN.pm then offering to reinstall Perl 5.8.0,
22064 # the threads.pm and threads/shared.pm will always be
22065 # there, croaking informatively ("you need to rebuild
22066 # all of Perl with threads, sorry") when threads haven't
22067 # been compiled in.
22068 # --jhi
22069 avail_ext="$avail_ext $xxx"
22070 ;;
aefe3e7e
NC
22071 VMS*)
22072 ;;
78ff2d7b 22073 Win32*)
b149d92d
JD
22074 case "$osname" in
22075 cygwin) avail_ext="$avail_ext $xxx" ;;
22076 esac
22077 ;;
f9b6ed1c
AD
22078 XS/APItest|xs/apitest)
22079 # This is just for testing. Skip it unless we have dynamic loading.
88e1f1a2
JV
22080
22081 case "$usedl" in
22082 $define) avail_ext="$avail_ext $xxx" ;;
22083 esac
22084 ;;
f9b6ed1c
AD
22085 XS/Typemap|xs/typemap)
22086 # This is just for testing. Skip it unless we have dynamic loading.
22087 case "$usedl" in
22088 $define) avail_ext="$avail_ext $xxx" ;;
22089 esac
22090 ;;
b4eb6b3d 22091 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
22092 ;;
22093 esac
b4eb6b3d 22094done
5f80c64f 22095
b4eb6b3d
JH
22096set X $avail_ext
22097shift
22098avail_ext="$*"
5f80c64f 22099
ef0c5be8
JH
22100case "$onlyextensions" in
22101'') ;;
22102*) keepextensions=''
cd95ead5 22103 echo "You have requested that only certain extensions be included..." >&4
ef0c5be8
JH
22104 for i in $onlyextensions; do
22105 case " $avail_ext " in
22106 *" $i "*)
22107 echo "Keeping extension $i."
22108 keepextensions="$keepextensions $i"
22109 ;;
22110 *) echo "Ignoring extension $i." ;;
22111 esac
22112 done
22113 avail_ext="$keepextensions"
22114 ;;
22115esac
22116
22117case "$noextensions" in
22118'') ;;
22119*) keepextensions=''
22120 echo "You have requested that certain extensions be ignored..." >&4
22121 for i in $avail_ext; do
c3dadc13
AD
22122 case " $noextensions " in
22123 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
22124 *) echo "Keeping extension $i.";
22125 keepextensions="$keepextensions $i"
22126 ;;
22127 esac
22128 done
22129 avail_ext="$keepextensions"
22130 ;;
22131esac
22132
b4eb6b3d
JH
22133: Now see which nonxs extensions are supported on this system.
22134: For now assume all are.
22135nonxs_ext=''
22136for xxx in $nonxs_extensions ; do
22137 case "$xxx" in
22138 *) nonxs_ext="$nonxs_ext $xxx"
22139 ;;
22140 esac
22141done
5f80c64f 22142
b4eb6b3d
JH
22143set X $nonxs_ext
22144shift
22145nonxs_ext="$*"
22146
22147case $usedl in
22148$define)
22149 $cat <<EOM
22150A number of extensions are supplied with $package. You may choose to
22151compile these extensions for dynamic loading (the default), compile
22152them into the $package executable (static loading), or not include
22153them at all. Answer "none" to include no extensions.
22154Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
22155
22156EOM
b4eb6b3d 22157 case "$dynamic_ext" in
736accd3
YST
22158 '')
22159 : Exclude those listed in static_ext
22160 dflt=''
22161 for xxx in $avail_ext; do
22162 case " $static_ext " in
22163 *" $xxx "*) ;;
22164 *) dflt="$dflt $xxx" ;;
22165 esac
22166 done
22167 set X $dflt
22168 shift
22169 dflt="$*"
22170 ;;
b4eb6b3d
JH
22171 *) dflt="$dynamic_ext"
22172 # Perhaps we are reusing an old out-of-date config.sh.
22173 case "$hint" in
22174 previous)
22175 if test X"$dynamic_ext" != X"$avail_ext"; then
22176 $cat <<EOM
7c345082
RGS
22177NOTICE: Your previous config.sh list may be incorrect.
22178The extensions now available to you are
b4eb6b3d
JH
22179 ${avail_ext}
22180but the default list from your previous config.sh is
7c345082 22181 ${dynamic_ext}
9c839522 22182
b4eb6b3d
JH
22183EOM
22184 fi
9c839522
PM
22185 ;;
22186 esac
b4eb6b3d
JH
22187 ;;
22188 esac
5f80c64f 22189 case "$dflt" in
b4eb6b3d
JH
22190 '') dflt=none;;
22191 esac
22192 rp="What extensions do you wish to load dynamically?"
22193 . ./myread
22194 case "$ans" in
22195 none) dynamic_ext=' ' ;;
22196 *) dynamic_ext="$ans" ;;
5f80c64f 22197 esac
5f80c64f 22198
b4eb6b3d
JH
22199 case "$static_ext" in
22200 '')
22201 : Exclude those already listed in dynamic linking
22202 dflt=''
22203 for xxx in $avail_ext; do
22204 case " $dynamic_ext " in
22205 *" $xxx "*) ;;
22206 *) dflt="$dflt $xxx" ;;
22207 esac
22208 done
22209 set X $dflt
22210 shift
22211 dflt="$*"
22212 ;;
7c345082 22213 *) dflt="$static_ext"
b4eb6b3d
JH
22214 ;;
22215 esac
9c839522 22216
b4eb6b3d
JH
22217 case "$dflt" in
22218 '') dflt=none;;
22219 esac
22220 rp="What extensions do you wish to load statically?"
22221 . ./myread
22222 case "$ans" in
22223 none) static_ext=' ' ;;
22224 *) static_ext="$ans" ;;
22225 esac
22226 ;;
22227*)
22228 $cat <<EOM
7c345082
RGS
22229A number of extensions are supplied with $package. Answer "none"
22230to include no extensions.
b4eb6b3d 22231Note that DynaLoader is always built and need not be mentioned here.
9c839522 22232
b4eb6b3d
JH
22233EOM
22234 case "$static_ext" in
22235 '') dflt="$avail_ext" ;;
22236 *) dflt="$static_ext"
22237 # Perhaps we are reusing an old out-of-date config.sh.
22238 case "$hint" in
22239 previous)
22240 if test X"$static_ext" != X"$avail_ext"; then
22241 $cat <<EOM
7c345082
RGS
22242NOTICE: Your previous config.sh list may be incorrect.
22243The extensions now available to you are
b4eb6b3d
JH
22244 ${avail_ext}
22245but the default list from your previous config.sh is
7c345082 22246 ${static_ext}
5f80c64f
JH
22247
22248EOM
b4eb6b3d
JH
22249 fi
22250 ;;
22251 esac
22252 ;;
22253 esac
22254 : Exclude those that are not xs extensions
22255 case "$dflt" in
22256 '') dflt=none;;
22257 esac
22258 rp="What extensions do you wish to include?"
22259 . ./myread
22260 case "$ans" in
22261 none) static_ext=' ' ;;
22262 *) static_ext="$ans" ;;
22263 esac
22264 ;;
5f80c64f 22265esac
7c345082 22266#
f1f6834f
AD
22267# Encode is a special case. If we are building Encode as a static
22268# extension, we need to explicitly list its subextensions as well.
22269# For other nested extensions, this is handled automatically by
22270# the appropriate Makefile.PL.
22271case " $static_ext " in
22272 *" Encode "*) # Add the subextensions of Encode
d9a4b459 22273 cd "$rsrc/cpan"
f1f6834f
AD
22274 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22275 static_ext="$static_ext Encode/$xxx"
22276 done
22277 cd "$tdir"
22278 ;;
22279esac
5f80c64f 22280
b4eb6b3d
JH
22281set X $dynamic_ext $static_ext $nonxs_ext
22282shift
22283extensions="$*"
22284
93a2cd18
AD
22285# Sanity check: We require an extension suitable for use with
22286# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
22287# should show up as failures in the test suite, but it's helpful to
22288# catch them now.) The 'extensions' list is normally sorted
22289# alphabetically, so we need to accept either
22290# DB_File ... Fcntl ... IO ....
22291# or something like
22292# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
22293case " $extensions" in
22294*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22295*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22296*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
22297*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22298 echo "WARNING: The Perl you are building will be quite crippled." >& 4
22299 ;;
22300esac
22301
9c839522
PM
22302: Remove libraries needed only for extensions
22303: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
22304: The exception is SunOS 4.x, which needs them.
22305case "${osname}X${osvers}" in
22306sunos*X4*)
22307 perllibs="$libs"
22308 ;;
22309*) case "$usedl" in
22310 $define|true|[yY]*)
a33f2d9f 22311 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
eedaba54
PM
22312 shift
22313 perllibs="$*"
22314 ;;
22315 *) perllibs="$libs"
22316 ;;
22317 esac
22318 ;;
9c839522 22319esac
5f80c64f
JH
22320
22321: Remove build directory name from cppstdin so it can be used from
22322: either the present location or the final installed location.
22323echo " "
22324: Get out of the UU directory to get correct path name.
22325cd ..
22326case "$cppstdin" in
22327`pwd`/cppstdin)
22328 echo "Stripping down cppstdin path name"
22329 cppstdin=cppstdin
22330 ;;
22331esac
22332cd UU
22333
22334: end of configuration questions
22335echo " "
22336echo "End of configuration questions."
22337echo " "
22338
22339: back to where it started
22340if test -d ../UU; then
22341 cd ..
22342fi
22343
776a38e3 22344: configuration may be unconditionally patched via a 'config.arch' file
48370efc 22345if $test -f config.arch; then
776a38e3 22346 echo "I see a config.arch file, loading it." >&4
48370efc
JH
22347 . ./config.arch
22348fi
22349
5f80c64f
JH
22350: configuration may be patched via a 'config.over' file
22351if $test -f config.over; then
22352 echo " "
22353 dflt=y
22354 rp='I see a config.over file. Do you wish to load it?'
22355 . UU/myread
22356 case "$ans" in
22357 n*) echo "OK, I'll ignore it.";;
22358 *) . ./config.over
22359 echo "Configuration override changes have been loaded."
22360 ;;
22361 esac
22362fi
22363
22364: in case they want portability, strip down executable paths
22365case "$d_portable" in
22366"$define")
22367 echo " "
22368 echo "Stripping down executable paths..." >&4
22369 for file in $loclist $trylist; do
534ac15a
JH
22370 eval temp=\$$file
22371 eval $file=`basename $temp`
5f80c64f
JH
22372 done
22373 ;;
22374esac
22375
22376: create config.sh file
22377echo " "
22378echo "Creating config.sh..." >&4
22379$spitshell <<EOT >config.sh
22380$startsh
22381#
22382# This file was produced by running the Configure script. It holds all the
22383# definitions figured out by Configure. Should you modify one of these values,
22384# do not forget to propagate your changes by running "Configure -der". You may
22385# instead choose to run each of the .SH files by yourself, or "Configure -S".
22386#
22387
22388# Package name : $package
22389# Source directory : $src
22390# Configuration time: $cf_time
22391# Configured by : $cf_by
22392# Target system : $myuname
22393
776a38e3 22394EOT
94a9a4bc 22395: Add in command line options if available
776a38e3 22396$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
94a9a4bc 22397
776a38e3
MB
22398$spitshell <<EOT >>config.sh
22399
5f80c64f
JH
22400Author='$Author'
22401Date='$Date'
22402Header='$Header'
22403Id='$Id'
22404Locker='$Locker'
22405Log='$Log'
5f80c64f
JH
22406RCSfile='$RCSfile'
22407Revision='$Revision'
22408Source='$Source'
22409State='$State'
22410_a='$_a'
22411_exe='$_exe'
22412_o='$_o'
b4eb6b3d 22413afs='$afs'
a6d26a0d 22414afsroot='$afsroot'
b4eb6b3d
JH
22415alignbytes='$alignbytes'
22416ansi2knr='$ansi2knr'
22417aphostname='$aphostname'
22418api_revision='$api_revision'
22419api_subversion='$api_subversion'
22420api_version='$api_version'
22421api_versionstring='$api_versionstring'
5f80c64f 22422ar='$ar'
b4eb6b3d
JH
22423archlib='$archlib'
22424archlibexp='$archlibexp'
22425archname64='$archname64'
22426archname='$archname'
5f80c64f 22427archobjs='$archobjs'
10bc17b6 22428asctime_r_proto='$asctime_r_proto'
5f80c64f 22429awk='$awk'
b4eb6b3d 22430baserev='$baserev'
5f80c64f 22431bash='$bash'
b4eb6b3d 22432bin='$bin'
f1ce3bf1 22433bin_ELF='$bin_ELF'
b4eb6b3d 22434binexp='$binexp'
5f80c64f
JH
22435bison='$bison'
22436byacc='$byacc'
b4eb6b3d 22437byteorder='$byteorder'
5f80c64f 22438c='$c'
b4eb6b3d 22439castflags='$castflags'
5f80c64f
JH
22440cat='$cat'
22441cc='$cc'
22442cccdlflags='$cccdlflags'
22443ccdlflags='$ccdlflags'
22444ccflags='$ccflags'
b4eb6b3d 22445ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 22446ccname='$ccname'
b4eb6b3d 22447ccsymbols='$ccsymbols'
6b356c8e 22448ccversion='$ccversion'
5f80c64f 22449cf_by='$cf_by'
b4eb6b3d 22450cf_email='$cf_email'
5f80c64f 22451cf_time='$cf_time'
c193ef60
MB
22452charbits='$charbits'
22453charsize='$charsize'
5f80c64f
JH
22454chgrp='$chgrp'
22455chmod='$chmod'
22456chown='$chown'
b4eb6b3d 22457clocktype='$clocktype'
5f80c64f
JH
22458comm='$comm'
22459compress='$compress'
22460contains='$contains'
22461cp='$cp'
22462cpio='$cpio'
22463cpp='$cpp'
b4eb6b3d
JH
22464cpp_stuff='$cpp_stuff'
22465cppccsymbols='$cppccsymbols'
5f80c64f
JH
22466cppflags='$cppflags'
22467cpplast='$cpplast'
22468cppminus='$cppminus'
22469cpprun='$cpprun'
22470cppstdin='$cppstdin'
b4eb6b3d 22471cppsymbols='$cppsymbols'
10bc17b6 22472crypt_r_proto='$crypt_r_proto'
b4eb6b3d 22473cryptlib='$cryptlib'
5f80c64f 22474csh='$csh'
10bc17b6
JH
22475ctermid_r_proto='$ctermid_r_proto'
22476ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
22477d_Gconvert='$d_Gconvert'
22478d_PRIEUldbl='$d_PRIEUldbl'
22479d_PRIFUldbl='$d_PRIFUldbl'
22480d_PRIGUldbl='$d_PRIGUldbl'
22481d_PRIXU64='$d_PRIXU64'
22482d_PRId64='$d_PRId64'
22483d_PRIeldbl='$d_PRIeldbl'
22484d_PRIfldbl='$d_PRIfldbl'
22485d_PRIgldbl='$d_PRIgldbl'
22486d_PRIi64='$d_PRIi64'
22487d_PRIo64='$d_PRIo64'
22488d_PRIu64='$d_PRIu64'
22489d_PRIx64='$d_PRIx64'
22490d_SCNfldbl='$d_SCNfldbl'
74cac757 22491d__fwalk='$d__fwalk'
b4eb6b3d
JH
22492d_access='$d_access'
22493d_accessx='$d_accessx'
55954f19 22494d_aintl='$d_aintl'
b4eb6b3d
JH
22495d_alarm='$d_alarm'
22496d_archlib='$d_archlib'
96938616 22497d_asctime64='$d_asctime64'
10bc17b6 22498d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
22499d_atolf='$d_atolf'
22500d_atoll='$d_atoll'
fcdf39cf 22501d_attribute_deprecated='$d_attribute_deprecated'
0dbb1585
AL
22502d_attribute_format='$d_attribute_format'
22503d_attribute_malloc='$d_attribute_malloc'
22504d_attribute_nonnull='$d_attribute_nonnull'
22505d_attribute_noreturn='$d_attribute_noreturn'
22506d_attribute_pure='$d_attribute_pure'
22507d_attribute_unused='$d_attribute_unused'
22508d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
22509d_bcmp='$d_bcmp'
22510d_bcopy='$d_bcopy'
5f80c64f 22511d_bsd='$d_bsd'
b4eb6b3d
JH
22512d_bsdgetpgrp='$d_bsdgetpgrp'
22513d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
22514d_builtin_choose_expr='$d_builtin_choose_expr'
22515d_builtin_expect='$d_builtin_expect'
b4eb6b3d 22516d_bzero='$d_bzero'
a2d23ec2 22517d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
22518d_casti32='$d_casti32'
22519d_castneg='$d_castneg'
22520d_charvspr='$d_charvspr'
22521d_chown='$d_chown'
22522d_chroot='$d_chroot'
22523d_chsize='$d_chsize'
758a5d79 22524d_class='$d_class'
b0a2e8e6 22525d_clearenv='$d_clearenv'
b4eb6b3d 22526d_closedir='$d_closedir'
4e0554ec 22527d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 22528d_const='$d_const'
55954f19 22529d_copysignl='$d_copysignl'
666ea192 22530d_cplusplus='$d_cplusplus'
b4eb6b3d 22531d_crypt='$d_crypt'
10bc17b6 22532d_crypt_r='$d_crypt_r'
b4eb6b3d 22533d_csh='$d_csh'
13cfc98d 22534d_ctermid='$d_ctermid'
10bc17b6 22535d_ctermid_r='$d_ctermid_r'
96938616 22536d_ctime64='$d_ctime64'
10bc17b6 22537d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
22538d_cuserid='$d_cuserid'
22539d_dbl_dig='$d_dbl_dig'
2ef53570 22540d_dbminitproto='$d_dbminitproto'
96938616 22541d_difftime64='$d_difftime64'
b4eb6b3d 22542d_difftime='$d_difftime'
de52168c 22543d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 22544d_dirfd='$d_dirfd'
b4eb6b3d
JH
22545d_dirnamlen='$d_dirnamlen'
22546d_dlerror='$d_dlerror'
5f80c64f 22547d_dlopen='$d_dlopen'
b4eb6b3d
JH
22548d_dlsymun='$d_dlsymun'
22549d_dosuid='$d_dosuid'
10bc17b6 22550d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
22551d_drand48proto='$d_drand48proto'
22552d_dup2='$d_dup2'
22553d_eaccess='$d_eaccess'
22554d_endgrent='$d_endgrent'
10bc17b6 22555d_endgrent_r='$d_endgrent_r'
b4eb6b3d 22556d_endhent='$d_endhent'
10bc17b6 22557d_endhostent_r='$d_endhostent_r'
b4eb6b3d 22558d_endnent='$d_endnent'
10bc17b6 22559d_endnetent_r='$d_endnetent_r'
b4eb6b3d 22560d_endpent='$d_endpent'
10bc17b6 22561d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 22562d_endpwent='$d_endpwent'
10bc17b6 22563d_endpwent_r='$d_endpwent_r'
b4eb6b3d 22564d_endsent='$d_endsent'
10bc17b6 22565d_endservent_r='$d_endservent_r'
b4eb6b3d 22566d_eofnblk='$d_eofnblk'
5f80c64f 22567d_eunice='$d_eunice'
15b61c98 22568d_faststdio='$d_faststdio'
b363b713 22569d_fchdir='$d_fchdir'
b4eb6b3d
JH
22570d_fchmod='$d_fchmod'
22571d_fchown='$d_fchown'
22572d_fcntl='$d_fcntl'
9d9004a9 22573d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
22574d_fd_macros='$d_fd_macros'
22575d_fd_set='$d_fd_set'
22576d_fds_bits='$d_fds_bits'
22577d_fgetpos='$d_fgetpos'
758a5d79
JH
22578d_finite='$d_finite'
22579d_finitel='$d_finitel'
b4eb6b3d
JH
22580d_flexfnam='$d_flexfnam'
22581d_flock='$d_flock'
2ef53570 22582d_flockproto='$d_flockproto'
b4eb6b3d 22583d_fork='$d_fork'
758a5d79 22584d_fp_class='$d_fp_class'
b4eb6b3d 22585d_fpathconf='$d_fpathconf'
758a5d79
JH
22586d_fpclass='$d_fpclass'
22587d_fpclassify='$d_fpclassify'
22588d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
22589d_fpos64_t='$d_fpos64_t'
22590d_frexpl='$d_frexpl'
22591d_fs_data_s='$d_fs_data_s'
22592d_fseeko='$d_fseeko'
22593d_fsetpos='$d_fsetpos'
22594d_fstatfs='$d_fstatfs'
22595d_fstatvfs='$d_fstatvfs'
411ab01c 22596d_fsync='$d_fsync'
b4eb6b3d
JH
22597d_ftello='$d_ftello'
22598d_ftime='$d_ftime'
dc814df1 22599d_futimes='$d_futimes'
e74475c7
MHM
22600d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22601d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
5086dff9 22602d_getaddrinfo='$d_getaddrinfo'
b4eb6b3d
JH
22603d_getcwd='$d_getcwd'
22604d_getespwnam='$d_getespwnam'
22605d_getfsstat='$d_getfsstat'
22606d_getgrent='$d_getgrent'
10bc17b6
JH
22607d_getgrent_r='$d_getgrent_r'
22608d_getgrgid_r='$d_getgrgid_r'
22609d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
22610d_getgrps='$d_getgrps'
22611d_gethbyaddr='$d_gethbyaddr'
22612d_gethbyname='$d_gethbyname'
22613d_gethent='$d_gethent'
22614d_gethname='$d_gethname'
10bc17b6
JH
22615d_gethostbyaddr_r='$d_gethostbyaddr_r'
22616d_gethostbyname_r='$d_gethostbyname_r'
22617d_gethostent_r='$d_gethostent_r'
b4eb6b3d 22618d_gethostprotos='$d_gethostprotos'
4e0554ec 22619d_getitimer='$d_getitimer'
b4eb6b3d 22620d_getlogin='$d_getlogin'
10bc17b6 22621d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
22622d_getmnt='$d_getmnt'
22623d_getmntent='$d_getmntent'
5086dff9 22624d_getnameinfo='$d_getnameinfo'
b4eb6b3d
JH
22625d_getnbyaddr='$d_getnbyaddr'
22626d_getnbyname='$d_getnbyname'
22627d_getnent='$d_getnent'
10bc17b6
JH
22628d_getnetbyaddr_r='$d_getnetbyaddr_r'
22629d_getnetbyname_r='$d_getnetbyname_r'
22630d_getnetent_r='$d_getnetent_r'
b4eb6b3d 22631d_getnetprotos='$d_getnetprotos'
0c0643d0 22632d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
22633d_getpbyname='$d_getpbyname'
22634d_getpbynumber='$d_getpbynumber'
22635d_getpent='$d_getpent'
22636d_getpgid='$d_getpgid'
22637d_getpgrp2='$d_getpgrp2'
22638d_getpgrp='$d_getpgrp'
22639d_getppid='$d_getppid'
22640d_getprior='$d_getprior'
10bc17b6
JH
22641d_getprotobyname_r='$d_getprotobyname_r'
22642d_getprotobynumber_r='$d_getprotobynumber_r'
22643d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
22644d_getprotoprotos='$d_getprotoprotos'
22645d_getprpwnam='$d_getprpwnam'
22646d_getpwent='$d_getpwent'
10bc17b6
JH
22647d_getpwent_r='$d_getpwent_r'
22648d_getpwnam_r='$d_getpwnam_r'
22649d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
22650d_getsbyname='$d_getsbyname'
22651d_getsbyport='$d_getsbyport'
22652d_getsent='$d_getsent'
10bc17b6
JH
22653d_getservbyname_r='$d_getservbyname_r'
22654d_getservbyport_r='$d_getservbyport_r'
22655d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
22656d_getservprotos='$d_getservprotos'
22657d_getspnam='$d_getspnam'
10bc17b6 22658d_getspnam_r='$d_getspnam_r'
b4eb6b3d 22659d_gettimeod='$d_gettimeod'
96938616 22660d_gmtime64='$d_gmtime64'
10bc17b6 22661d_gmtime_r='$d_gmtime_r'
5f80c64f 22662d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
22663d_grpasswd='$d_grpasswd'
22664d_hasmntopt='$d_hasmntopt'
22665d_htonl='$d_htonl'
55954f19 22666d_ilogbl='$d_ilogbl'
f3f1a2d8 22667d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
22668d_index='$d_index'
22669d_inetaton='$d_inetaton'
5086dff9
MB
22670d_inetntop='$d_inetntop'
22671d_inetpton='$d_inetpton'
b4eb6b3d
JH
22672d_int64_t='$d_int64_t'
22673d_isascii='$d_isascii'
758a5d79
JH
22674d_isfinite='$d_isfinite'
22675d_isinf='$d_isinf'
b4eb6b3d
JH
22676d_isnan='$d_isnan'
22677d_isnanl='$d_isnanl'
22678d_killpg='$d_killpg'
22679d_lchown='$d_lchown'
22680d_ldbl_dig='$d_ldbl_dig'
0a0abfba 22681d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 22682d_link='$d_link'
96938616 22683d_localtime64='$d_localtime64'
10bc17b6 22684d_localtime_r='$d_localtime_r'
8572b25d 22685d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
22686d_locconv='$d_locconv'
22687d_lockf='$d_lockf'
22688d_longdbl='$d_longdbl'
22689d_longlong='$d_longlong'
22690d_lseekproto='$d_lseekproto'
22691d_lstat='$d_lstat'
22692d_madvise='$d_madvise'
7dd121ae
MB
22693d_malloc_good_size='$d_malloc_good_size'
22694d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
22695d_mblen='$d_mblen'
22696d_mbstowcs='$d_mbstowcs'
22697d_mbtowc='$d_mbtowc'
22698d_memchr='$d_memchr'
22699d_memcmp='$d_memcmp'
22700d_memcpy='$d_memcpy'
22701d_memmove='$d_memmove'
22702d_memset='$d_memset'
22703d_mkdir='$d_mkdir'
22704d_mkdtemp='$d_mkdtemp'
22705d_mkfifo='$d_mkfifo'
22706d_mkstemp='$d_mkstemp'
22707d_mkstemps='$d_mkstemps'
96938616 22708d_mktime64='$d_mktime64'
b4eb6b3d
JH
22709d_mktime='$d_mktime'
22710d_mmap='$d_mmap'
22711d_modfl='$d_modfl'
e67aeab1 22712d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 22713d_modflproto='$d_modflproto'
b4eb6b3d
JH
22714d_mprotect='$d_mprotect'
22715d_msg='$d_msg'
22716d_msg_ctrunc='$d_msg_ctrunc'
22717d_msg_dontroute='$d_msg_dontroute'
22718d_msg_oob='$d_msg_oob'
22719d_msg_peek='$d_msg_peek'
22720d_msg_proxy='$d_msg_proxy'
22721d_msgctl='$d_msgctl'
22722d_msgget='$d_msgget'
4e0554ec 22723d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
22724d_msgrcv='$d_msgrcv'
22725d_msgsnd='$d_msgsnd'
22726d_msync='$d_msync'
22727d_munmap='$d_munmap'
22728d_mymalloc='$d_mymalloc'
a33f2d9f 22729d_ndbm='$d_ndbm'
e74475c7 22730d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
b4eb6b3d 22731d_nice='$d_nice'
2765b840 22732d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 22733d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 22734d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
22735d_off64_t='$d_off64_t'
22736d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22737d_oldpthreads='$d_oldpthreads'
22738d_oldsock='$d_oldsock'
22739d_open3='$d_open3'
22740d_pathconf='$d_pathconf'
22741d_pause='$d_pause'
22742d_perl_otherlibdirs='$d_perl_otherlibdirs'
22743d_phostname='$d_phostname'
22744d_pipe='$d_pipe'
22745d_poll='$d_poll'
5f80c64f 22746d_portable='$d_portable'
c796e3db
MB
22747d_prctl='$d_prctl'
22748d_prctl_set_name='$d_prctl_set_name'
dcb594bc 22749d_printf_format_null='$d_printf_format_null'
c7aff470 22750d_procselfexe='$d_procselfexe'
233e16ce 22751d_pseudofork='$d_pseudofork'
d6483fcc 22752d_pthread_atfork='$d_pthread_atfork'
58d975c3 22753d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
22754d_pthread_yield='$d_pthread_yield'
22755d_pwage='$d_pwage'
22756d_pwchange='$d_pwchange'
22757d_pwclass='$d_pwclass'
22758d_pwcomment='$d_pwcomment'
22759d_pwexpire='$d_pwexpire'
22760d_pwgecos='$d_pwgecos'
22761d_pwpasswd='$d_pwpasswd'
22762d_pwquota='$d_pwquota'
22763d_qgcvt='$d_qgcvt'
22764d_quad='$d_quad'
10bc17b6
JH
22765d_random_r='$d_random_r'
22766d_readdir64_r='$d_readdir64_r'
b4eb6b3d 22767d_readdir='$d_readdir'
10bc17b6 22768d_readdir_r='$d_readdir_r'
b4eb6b3d 22769d_readlink='$d_readlink'
4e0554ec
JH
22770d_readv='$d_readv'
22771d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
22772d_rename='$d_rename'
22773d_rewinddir='$d_rewinddir'
22774d_rmdir='$d_rmdir'
22775d_safebcpy='$d_safebcpy'
22776d_safemcpy='$d_safemcpy'
22777d_sanemcmp='$d_sanemcmp'
ef9f17be 22778d_sbrkproto='$d_sbrkproto'
55954f19 22779d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
22780d_sched_yield='$d_sched_yield'
22781d_scm_rights='$d_scm_rights'
22782d_seekdir='$d_seekdir'
22783d_select='$d_select'
22784d_sem='$d_sem'
22785d_semctl='$d_semctl'
22786d_semctl_semid_ds='$d_semctl_semid_ds'
22787d_semctl_semun='$d_semctl_semun'
22788d_semget='$d_semget'
22789d_semop='$d_semop'
4e0554ec 22790d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
22791d_setegid='$d_setegid'
22792d_seteuid='$d_seteuid'
22793d_setgrent='$d_setgrent'
10bc17b6 22794d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
22795d_setgrps='$d_setgrps'
22796d_sethent='$d_sethent'
10bc17b6 22797d_sethostent_r='$d_sethostent_r'
4e0554ec 22798d_setitimer='$d_setitimer'
b4eb6b3d
JH
22799d_setlinebuf='$d_setlinebuf'
22800d_setlocale='$d_setlocale'
10bc17b6 22801d_setlocale_r='$d_setlocale_r'
b4eb6b3d 22802d_setnent='$d_setnent'
10bc17b6 22803d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
22804d_setpent='$d_setpent'
22805d_setpgid='$d_setpgid'
22806d_setpgrp2='$d_setpgrp2'
22807d_setpgrp='$d_setpgrp'
22808d_setprior='$d_setprior'
22809d_setproctitle='$d_setproctitle'
10bc17b6 22810d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 22811d_setpwent='$d_setpwent'
10bc17b6 22812d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
22813d_setregid='$d_setregid'
22814d_setresgid='$d_setresgid'
22815d_setresuid='$d_setresuid'
22816d_setreuid='$d_setreuid'
22817d_setrgid='$d_setrgid'
22818d_setruid='$d_setruid'
22819d_setsent='$d_setsent'
10bc17b6 22820d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
22821d_setsid='$d_setsid'
22822d_setvbuf='$d_setvbuf'
22823d_sfio='$d_sfio'
22824d_shm='$d_shm'
22825d_shmat='$d_shmat'
22826d_shmatprototype='$d_shmatprototype'
22827d_shmctl='$d_shmctl'
22828d_shmdt='$d_shmdt'
22829d_shmget='$d_shmget'
22830d_sigaction='$d_sigaction'
ed140128 22831d_signbit='$d_signbit'
983dbef6 22832d_sigprocmask='$d_sigprocmask'
b4eb6b3d 22833d_sigsetjmp='$d_sigsetjmp'
f53580fe 22834d_sin6_scope_id='$d_sin6_scope_id'
c95d0e17 22835d_sitearch='$d_sitearch'
4f5da3e9 22836d_snprintf='$d_snprintf'
b8677e3b 22837d_sockaddr_sa_len='$d_sockaddr_sa_len'
49a78c82 22838d_sockatmark='$d_sockatmark'
2ef53570 22839d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
22840d_socket='$d_socket'
22841d_socklen_t='$d_socklen_t'
22842d_sockpair='$d_sockpair'
22843d_socks5_init='$d_socks5_init'
360321b3 22844d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 22845d_sqrtl='$d_sqrtl'
10bc17b6
JH
22846d_srand48_r='$d_srand48_r'
22847d_srandom_r='$d_srandom_r'
eef837ea 22848d_sresgproto='$d_sresgproto'
640374d0 22849d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
22850d_statblks='$d_statblks'
22851d_statfs_f_flags='$d_statfs_f_flags'
22852d_statfs_s='$d_statfs_s'
17a6c8e3 22853d_static_inline='$d_static_inline'
b4eb6b3d
JH
22854d_statvfs='$d_statvfs'
22855d_stdio_cnt_lval='$d_stdio_cnt_lval'
22856d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
22857d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22858d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
22859d_stdio_stream_array='$d_stdio_stream_array'
22860d_stdiobase='$d_stdiobase'
22861d_stdstdio='$d_stdstdio'
22862d_strchr='$d_strchr'
22863d_strcoll='$d_strcoll'
22864d_strctcpy='$d_strctcpy'
22865d_strerrm='$d_strerrm'
22866d_strerror='$d_strerror'
10bc17b6 22867d_strerror_r='$d_strerror_r'
b3c85772 22868d_strftime='$d_strftime'
08c92000
MB
22869d_strlcat='$d_strlcat'
22870d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
22871d_strtod='$d_strtod'
22872d_strtol='$d_strtol'
22873d_strtold='$d_strtold'
22874d_strtoll='$d_strtoll'
28e5dec8 22875d_strtoq='$d_strtoq'
b4eb6b3d
JH
22876d_strtoul='$d_strtoul'
22877d_strtoull='$d_strtoull'
22878d_strtouq='$d_strtouq'
22879d_strxfrm='$d_strxfrm'
22880d_suidsafe='$d_suidsafe'
22881d_symlink='$d_symlink'
22882d_syscall='$d_syscall'
2ef53570 22883d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
22884d_sysconf='$d_sysconf'
22885d_sysernlst='$d_sysernlst'
22886d_syserrlst='$d_syserrlst'
22887d_system='$d_system'
22888d_tcgetpgrp='$d_tcgetpgrp'
22889d_tcsetpgrp='$d_tcsetpgrp'
22890d_telldir='$d_telldir'
22891d_telldirproto='$d_telldirproto'
22892d_time='$d_time'
cbb9e8a7 22893d_timegm='$d_timegm'
b4eb6b3d 22894d_times='$d_times'
14b90194
JH
22895d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22896d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 22897d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 22898d_truncate='$d_truncate'
10bc17b6 22899d_ttyname_r='$d_ttyname_r'
b4eb6b3d 22900d_tzname='$d_tzname'
4e0554ec
JH
22901d_u32align='$d_u32align'
22902d_ualarm='$d_ualarm'
b4eb6b3d
JH
22903d_umask='$d_umask'
22904d_uname='$d_uname'
22905d_union_semun='$d_union_semun'
758a5d79 22906d_unordered='$d_unordered'
bdf33aa7 22907d_unsetenv='$d_unsetenv'
4e0554ec 22908d_usleep='$d_usleep'
2ef53570 22909d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
22910d_ustat='$d_ustat'
22911d_vendorarch='$d_vendorarch'
22912d_vendorbin='$d_vendorbin'
22913d_vendorlib='$d_vendorlib'
6e1038e0 22914d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
22915d_vfork='$d_vfork'
22916d_void_closedir='$d_void_closedir'
22917d_voidsig='$d_voidsig'
22918d_voidtty='$d_voidtty'
22919d_volatile='$d_volatile'
22920d_vprintf='$d_vprintf'
4f5da3e9 22921d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
22922d_wait4='$d_wait4'
22923d_waitpid='$d_waitpid'
22924d_wcstombs='$d_wcstombs'
22925d_wctomb='$d_wctomb'
4e0554ec 22926d_writev='$d_writev'
5f80c64f
JH
22927d_xenix='$d_xenix'
22928date='$date'
b4eb6b3d
JH
22929db_hashtype='$db_hashtype'
22930db_prefixtype='$db_prefixtype'
640374d0
JH
22931db_version_major='$db_version_major'
22932db_version_minor='$db_version_minor'
22933db_version_patch='$db_version_patch'
b4eb6b3d
JH
22934defvoidused='$defvoidused'
22935direntrytype='$direntrytype'
22936dlext='$dlext'
5f80c64f 22937dlsrc='$dlsrc'
b4eb6b3d
JH
22938doublesize='$doublesize'
22939drand01='$drand01'
10bc17b6 22940drand48_r_proto='$drand48_r_proto'
5ac1e9b2 22941dtrace='$dtrace'
b4eb6b3d
JH
22942dynamic_ext='$dynamic_ext'
22943eagain='$eagain'
22944ebcdic='$ebcdic'
5f80c64f
JH
22945echo='$echo'
22946egrep='$egrep'
22947emacs='$emacs'
10bc17b6
JH
22948endgrent_r_proto='$endgrent_r_proto'
22949endhostent_r_proto='$endhostent_r_proto'
22950endnetent_r_proto='$endnetent_r_proto'
22951endprotoent_r_proto='$endprotoent_r_proto'
22952endpwent_r_proto='$endpwent_r_proto'
22953endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
22954eunicefix='$eunicefix'
22955exe_ext='$exe_ext'
22956expr='$expr'
b4eb6b3d 22957extensions='$extensions'
61c26d18 22958extern_C='$extern_C'
6fcddf3b 22959extras='$extras'
b4eb6b3d
JH
22960fflushNULL='$fflushNULL'
22961fflushall='$fflushall'
5f80c64f
JH
22962find='$find'
22963firstmakefile='$firstmakefile'
22964flex='$flex'
b4eb6b3d
JH
22965fpossize='$fpossize'
22966fpostype='$fpostype'
22967freetype='$freetype'
5440bc8e 22968from='$from'
b4eb6b3d
JH
22969full_ar='$full_ar'
22970full_csh='$full_csh'
22971full_sed='$full_sed'
2d736872 22972gccansipedantic='$gccansipedantic'
5b463ca7 22973gccosandvers='$gccosandvers'
5f80c64f 22974gccversion='$gccversion'
10bc17b6
JH
22975getgrent_r_proto='$getgrent_r_proto'
22976getgrgid_r_proto='$getgrgid_r_proto'
22977getgrnam_r_proto='$getgrnam_r_proto'
22978gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22979gethostbyname_r_proto='$gethostbyname_r_proto'
22980gethostent_r_proto='$gethostent_r_proto'
22981getlogin_r_proto='$getlogin_r_proto'
22982getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22983getnetbyname_r_proto='$getnetbyname_r_proto'
22984getnetent_r_proto='$getnetent_r_proto'
22985getprotobyname_r_proto='$getprotobyname_r_proto'
22986getprotobynumber_r_proto='$getprotobynumber_r_proto'
22987getprotoent_r_proto='$getprotoent_r_proto'
22988getpwent_r_proto='$getpwent_r_proto'
22989getpwnam_r_proto='$getpwnam_r_proto'
22990getpwuid_r_proto='$getpwuid_r_proto'
22991getservbyname_r_proto='$getservbyname_r_proto'
22992getservbyport_r_proto='$getservbyport_r_proto'
22993getservent_r_proto='$getservent_r_proto'
22994getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
22995gidformat='$gidformat'
22996gidsign='$gidsign'
22997gidsize='$gidsize'
22998gidtype='$gidtype'
5f80c64f 22999glibpth='$glibpth'
3c728e00 23000gmake='$gmake'
10bc17b6 23001gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 23002gnulibc_version='$gnulibc_version'
5f80c64f 23003grep='$grep'
b4eb6b3d
JH
23004groupcat='$groupcat'
23005groupstype='$groupstype'
5f80c64f 23006gzip='$gzip'
b4eb6b3d
JH
23007h_fcntl='$h_fcntl'
23008h_sysfile='$h_sysfile'
5f80c64f 23009hint='$hint'
b4eb6b3d 23010hostcat='$hostcat'
6e1038e0
MB
23011html1dir='$html1dir'
23012html1direxp='$html1direxp'
23013html3dir='$html3dir'
23014html3direxp='$html3direxp'
b4eb6b3d
JH
23015i16size='$i16size'
23016i16type='$i16type'
23017i32size='$i32size'
23018i32type='$i32type'
23019i64size='$i64size'
23020i64type='$i64type'
23021i8size='$i8size'
23022i8type='$i8type'
23023i_arpainet='$i_arpainet'
2a0de2c5 23024i_assert='$i_assert'
b4eb6b3d 23025i_bsdioctl='$i_bsdioctl'
10bc17b6 23026i_crypt='$i_crypt'
b4eb6b3d
JH
23027i_db='$i_db'
23028i_dbm='$i_dbm'
23029i_dirent='$i_dirent'
5f80c64f 23030i_dld='$i_dld'
b4eb6b3d
JH
23031i_dlfcn='$i_dlfcn'
23032i_fcntl='$i_fcntl'
23033i_float='$i_float'
758a5d79
JH
23034i_fp='$i_fp'
23035i_fp_class='$i_fp_class'
b4eb6b3d 23036i_gdbm='$i_gdbm'
a33f2d9f
AD
23037i_gdbm_ndbm='$i_gdbm_ndbm'
23038i_gdbmndbm='$i_gdbmndbm'
b4eb6b3d 23039i_grp='$i_grp'
b4eb6b3d
JH
23040i_ieeefp='$i_ieeefp'
23041i_inttypes='$i_inttypes'
2765b840 23042i_langinfo='$i_langinfo'
b4eb6b3d
JH
23043i_libutil='$i_libutil'
23044i_limits='$i_limits'
23045i_locale='$i_locale'
23046i_machcthr='$i_machcthr'
23047i_malloc='$i_malloc'
1cd66f7c 23048i_mallocmalloc='$i_mallocmalloc'
b4eb6b3d
JH
23049i_math='$i_math'
23050i_memory='$i_memory'
23051i_mntent='$i_mntent'
23052i_ndbm='$i_ndbm'
23053i_netdb='$i_netdb'
23054i_neterrno='$i_neterrno'
23055i_netinettcp='$i_netinettcp'
23056i_niin='$i_niin'
23057i_poll='$i_poll'
23058i_prot='$i_prot'
23059i_pthread='$i_pthread'
23060i_pwd='$i_pwd'
23061i_rpcsvcdbm='$i_rpcsvcdbm'
23062i_sfio='$i_sfio'
23063i_sgtty='$i_sgtty'
23064i_shadow='$i_shadow'
23065i_socks='$i_socks'
23066i_stdarg='$i_stdarg'
23067i_stddef='$i_stddef'
23068i_stdlib='$i_stdlib'
23069i_string='$i_string'
23070i_sunmath='$i_sunmath'
23071i_sysaccess='$i_sysaccess'
23072i_sysdir='$i_sysdir'
23073i_sysfile='$i_sysfile'
23074i_sysfilio='$i_sysfilio'
23075i_sysin='$i_sysin'
23076i_sysioctl='$i_sysioctl'
23077i_syslog='$i_syslog'
23078i_sysmman='$i_sysmman'
23079i_sysmode='$i_sysmode'
23080i_sysmount='$i_sysmount'
23081i_sysndir='$i_sysndir'
23082i_sysparam='$i_sysparam'
216dac04 23083i_syspoll='$i_syspoll'
b4eb6b3d
JH
23084i_sysresrc='$i_sysresrc'
23085i_syssecrt='$i_syssecrt'
23086i_sysselct='$i_sysselct'
23087i_syssockio='$i_syssockio'
23088i_sysstat='$i_sysstat'
23089i_sysstatfs='$i_sysstatfs'
23090i_sysstatvfs='$i_sysstatvfs'
23091i_systime='$i_systime'
23092i_systimek='$i_systimek'
23093i_systimes='$i_systimes'
23094i_systypes='$i_systypes'
23095i_sysuio='$i_sysuio'
23096i_sysun='$i_sysun'
23097i_sysutsname='$i_sysutsname'
23098i_sysvfs='$i_sysvfs'
23099i_syswait='$i_syswait'
23100i_termio='$i_termio'
23101i_termios='$i_termios'
23102i_time='$i_time'
23103i_unistd='$i_unistd'
23104i_ustat='$i_ustat'
23105i_utime='$i_utime'
23106i_values='$i_values'
23107i_varargs='$i_varargs'
23108i_varhdr='$i_varhdr'
23109i_vfork='$i_vfork'
5f80c64f 23110ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
23111inc_version_list='$inc_version_list'
23112inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
23113incpath='$incpath'
23114inews='$inews'
f3f1a2d8 23115initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
23116installarchlib='$installarchlib'
23117installbin='$installbin'
6e1038e0
MB
23118installhtml1dir='$installhtml1dir'
23119installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
23120installman1dir='$installman1dir'
23121installman3dir='$installman3dir'
23122installprefix='$installprefix'
23123installprefixexp='$installprefixexp'
23124installprivlib='$installprivlib'
23125installscript='$installscript'
23126installsitearch='$installsitearch'
23127installsitebin='$installsitebin'
8d2cbf27
JH
23128installsitehtml1dir='$installsitehtml1dir'
23129installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 23130installsitelib='$installsitelib'
91e123a8
JH
23131installsiteman1dir='$installsiteman1dir'
23132installsiteman3dir='$installsiteman3dir'
6e1038e0 23133installsitescript='$installsitescript'
b4eb6b3d
JH
23134installstyle='$installstyle'
23135installusrbinperl='$installusrbinperl'
23136installvendorarch='$installvendorarch'
23137installvendorbin='$installvendorbin'
8d2cbf27
JH
23138installvendorhtml1dir='$installvendorhtml1dir'
23139installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 23140installvendorlib='$installvendorlib'
91e123a8
JH
23141installvendorman1dir='$installvendorman1dir'
23142installvendorman3dir='$installvendorman3dir'
6e1038e0 23143installvendorscript='$installvendorscript'
b4eb6b3d 23144intsize='$intsize'
4b661809 23145issymlink='$issymlink'
b4eb6b3d
JH
23146ivdformat='$ivdformat'
23147ivsize='$ivsize'
23148ivtype='$ivtype'
23149known_extensions='$known_extensions'
5f80c64f 23150ksh='$ksh'
5f80c64f
JH
23151ld='$ld'
23152lddlflags='$lddlflags'
23153ldflags='$ldflags'
b4eb6b3d
JH
23154ldflags_uselargefiles='$ldflags_uselargefiles'
23155ldlibpthname='$ldlibpthname'
5f80c64f
JH
23156less='$less'
23157lib_ext='$lib_ext'
23158libc='$libc'
b4eb6b3d 23159libperl='$libperl'
5f80c64f
JH
23160libpth='$libpth'
23161libs='$libs'
43999f95
JH
23162libsdirs='$libsdirs'
23163libsfiles='$libsfiles'
23164libsfound='$libsfound'
13b3f787 23165libspath='$libspath'
5f80c64f 23166libswanted='$libswanted'
b4eb6b3d 23167libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
23168line='$line'
23169lint='$lint'
23170lkflags='$lkflags'
23171ln='$ln'
23172lns='$lns'
10bc17b6 23173localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
23174locincpth='$locincpth'
23175loclibpth='$loclibpth'
b4eb6b3d
JH
23176longdblsize='$longdblsize'
23177longlongsize='$longlongsize'
23178longsize='$longsize'
5f80c64f
JH
23179lp='$lp'
23180lpr='$lpr'
23181ls='$ls'
b4eb6b3d
JH
23182lseeksize='$lseeksize'
23183lseektype='$lseektype'
a724edfe 23184mad='$mad'
f3f1a2d8
MB
23185madlyh='$madlyh'
23186madlyobj='$madlyobj'
23187madlysrc='$madlysrc'
5f80c64f
JH
23188mail='$mail'
23189mailx='$mailx'
23190make='$make'
23191make_set_make='$make_set_make'
b4eb6b3d
JH
23192mallocobj='$mallocobj'
23193mallocsrc='$mallocsrc'
23194malloctype='$malloctype'
23195man1dir='$man1dir'
23196man1direxp='$man1direxp'
23197man1ext='$man1ext'
23198man3dir='$man3dir'
23199man3direxp='$man3direxp'
23200man3ext='$man3ext'
5f80c64f 23201mips_type='$mips_type'
5129fff4 23202mistrustnm='$mistrustnm'
5f80c64f 23203mkdir='$mkdir'
b4eb6b3d
JH
23204mmaptype='$mmaptype'
23205modetype='$modetype'
5f80c64f 23206more='$more'
b4eb6b3d 23207multiarch='$multiarch'
5f80c64f 23208mv='$mv'
b4eb6b3d
JH
23209myarchname='$myarchname'
23210mydomain='$mydomain'
23211myhostname='$myhostname'
5f80c64f
JH
23212myuname='$myuname'
23213n='$n'
2cc61e15 23214need_va_copy='$need_va_copy'
b4eb6b3d
JH
23215netdb_hlen_type='$netdb_hlen_type'
23216netdb_host_type='$netdb_host_type'
23217netdb_name_type='$netdb_name_type'
23218netdb_net_type='$netdb_net_type'
5f80c64f
JH
23219nm='$nm'
23220nm_opt='$nm_opt'
23221nm_so_opt='$nm_so_opt'
b4eb6b3d 23222nonxs_ext='$nonxs_ext'
5f80c64f 23223nroff='$nroff'
b4eb6b3d
JH
23224nvEUformat='$nvEUformat'
23225nvFUformat='$nvFUformat'
23226nvGUformat='$nvGUformat'
b68c599a 23227nv_overflows_integers_at='$nv_overflows_integers_at'
53133ed1 23228nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
23229nveformat='$nveformat'
23230nvfformat='$nvfformat'
23231nvgformat='$nvgformat'
23232nvsize='$nvsize'
23233nvtype='$nvtype'
23234o_nonblock='$o_nonblock'
5f80c64f 23235obj_ext='$obj_ext'
b4eb6b3d 23236old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 23237optimize='$optimize'
b4eb6b3d 23238orderlib='$orderlib'
5f80c64f
JH
23239osname='$osname'
23240osvers='$osvers'
b4eb6b3d 23241otherlibdirs='$otherlibdirs'
5f80c64f 23242package='$package'
b4eb6b3d
JH
23243pager='$pager'
23244passcat='$passcat'
23245patchlevel='$patchlevel'
5f80c64f 23246path_sep='$path_sep'
b4eb6b3d 23247perl5='$perl5'
5f80c64f 23248perl='$perl'
151e6568 23249perl_patchlevel='$perl_patchlevel'
17a6c8e3 23250perl_static_inline='$perl_static_inline'
b4eb6b3d 23251perladmin='$perladmin'
9c839522 23252perllibs='$perllibs'
91f55cc7 23253perlpath='$perlpath'
5f80c64f 23254pg='$pg'
b4eb6b3d
JH
23255phostname='$phostname'
23256pidtype='$pidtype'
5f80c64f
JH
23257plibpth='$plibpth'
23258pmake='$pmake'
23259pr='$pr'
b4eb6b3d
JH
23260prefix='$prefix'
23261prefixexp='$prefixexp'
23262privlib='$privlib'
23263privlibexp='$privlibexp'
f24dbf84 23264procselfexe='$procselfexe'
b4eb6b3d
JH
23265prototype='$prototype'
23266ptrsize='$ptrsize'
23267quadkind='$quadkind'
23268quadtype='$quadtype'
23269randbits='$randbits'
23270randfunc='$randfunc'
10bc17b6 23271random_r_proto='$random_r_proto'
b4eb6b3d
JH
23272randseedtype='$randseedtype'
23273ranlib='$ranlib'
23274rd_nodata='$rd_nodata'
10bc17b6
JH
23275readdir64_r_proto='$readdir64_r_proto'
23276readdir_r_proto='$readdir_r_proto'
b4eb6b3d 23277revision='$revision'
5f80c64f 23278rm='$rm'
5b813a60 23279rm_try='$rm_try'
5f80c64f 23280rmail='$rmail'
5440bc8e 23281run='$run'
5f80c64f 23282runnm='$runnm'
81c4fd9e
MB
23283sGMTIME_max='$sGMTIME_max'
23284sGMTIME_min='$sGMTIME_min'
73e6e416
MB
23285sLOCALTIME_max='$sLOCALTIME_max'
23286sLOCALTIME_min='$sLOCALTIME_min'
b4eb6b3d
JH
23287sPRIEUldbl='$sPRIEUldbl'
23288sPRIFUldbl='$sPRIFUldbl'
23289sPRIGUldbl='$sPRIGUldbl'
23290sPRIXU64='$sPRIXU64'
23291sPRId64='$sPRId64'
23292sPRIeldbl='$sPRIeldbl'
23293sPRIfldbl='$sPRIfldbl'
23294sPRIgldbl='$sPRIgldbl'
23295sPRIi64='$sPRIi64'
23296sPRIo64='$sPRIo64'
23297sPRIu64='$sPRIu64'
23298sPRIx64='$sPRIx64'
23299sSCNfldbl='$sSCNfldbl'
23300sched_yield='$sched_yield'
23301scriptdir='$scriptdir'
23302scriptdirexp='$scriptdirexp'
5f80c64f 23303sed='$sed'
b4eb6b3d
JH
23304seedfunc='$seedfunc'
23305selectminbits='$selectminbits'
23306selecttype='$selecttype'
5f80c64f 23307sendmail='$sendmail'
10bc17b6
JH
23308setgrent_r_proto='$setgrent_r_proto'
23309sethostent_r_proto='$sethostent_r_proto'
23310setlocale_r_proto='$setlocale_r_proto'
23311setnetent_r_proto='$setnetent_r_proto'
23312setprotoent_r_proto='$setprotoent_r_proto'
23313setpwent_r_proto='$setpwent_r_proto'
23314setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
23315sh='$sh'
23316shar='$shar'
23317sharpbang='$sharpbang'
b4eb6b3d
JH
23318shmattype='$shmattype'
23319shortsize='$shortsize'
23320shrpenv='$shrpenv'
5f80c64f 23321shsharp='$shsharp'
b4eb6b3d
JH
23322sig_count='$sig_count'
23323sig_name='$sig_name'
23324sig_name_init='$sig_name_init'
23325sig_num='$sig_num'
23326sig_num_init='$sig_num_init'
76d3c696 23327sig_size='$sig_size'
b4eb6b3d
JH
23328signal_t='$signal_t'
23329sitearch='$sitearch'
23330sitearchexp='$sitearchexp'
23331sitebin='$sitebin'
23332sitebinexp='$sitebinexp'
8d2cbf27
JH
23333sitehtml1dir='$sitehtml1dir'
23334sitehtml1direxp='$sitehtml1direxp'
23335sitehtml3dir='$sitehtml3dir'
23336sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
23337sitelib='$sitelib'
23338sitelib_stem='$sitelib_stem'
23339sitelibexp='$sitelibexp'
91e123a8
JH
23340siteman1dir='$siteman1dir'
23341siteman1direxp='$siteman1direxp'
23342siteman3dir='$siteman3dir'
23343siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
23344siteprefix='$siteprefix'
23345siteprefixexp='$siteprefixexp'
6e1038e0
MB
23346sitescript='$sitescript'
23347sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
23348sizesize='$sizesize'
23349sizetype='$sizetype'
5f80c64f
JH
23350sleep='$sleep'
23351smail='$smail'
5f80c64f 23352so='$so'
b4eb6b3d
JH
23353sockethdr='$sockethdr'
23354socketlib='$socketlib'
23355socksizetype='$socksizetype'
5f80c64f
JH
23356sort='$sort'
23357spackage='$spackage'
23358spitshell='$spitshell'
10bc17b6
JH
23359srand48_r_proto='$srand48_r_proto'
23360srandom_r_proto='$srandom_r_proto'
5f80c64f 23361src='$src'
b4eb6b3d
JH
23362ssizetype='$ssizetype'
23363startperl='$startperl'
5f80c64f 23364startsh='$startsh'
b4eb6b3d
JH
23365static_ext='$static_ext'
23366stdchar='$stdchar'
23367stdio_base='$stdio_base'
23368stdio_bufsiz='$stdio_bufsiz'
23369stdio_cnt='$stdio_cnt'
23370stdio_filbuf='$stdio_filbuf'
23371stdio_ptr='$stdio_ptr'
23372stdio_stream_array='$stdio_stream_array'
10bc17b6 23373strerror_r_proto='$strerror_r_proto'
b4eb6b3d 23374strings='$strings'
5f80c64f 23375submit='$submit'
b4eb6b3d
JH
23376subversion='$subversion'
23377sysman='$sysman'
5f80c64f
JH
23378tail='$tail'
23379tar='$tar'
5440bc8e 23380targetarch='$targetarch'
5f80c64f
JH
23381tbl='$tbl'
23382tee='$tee'
23383test='$test'
b4eb6b3d
JH
23384timeincl='$timeincl'
23385timetype='$timetype'
10bc17b6 23386tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 23387to='$to'
5f80c64f
JH
23388touch='$touch'
23389tr='$tr'
23390trnl='$trnl'
23391troff='$troff'
10bc17b6 23392ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
23393u16size='$u16size'
23394u16type='$u16type'
23395u32size='$u32size'
23396u32type='$u32type'
23397u64size='$u64size'
23398u64type='$u64type'
23399u8size='$u8size'
23400u8type='$u8type'
23401uidformat='$uidformat'
23402uidsign='$uidsign'
23403uidsize='$uidsize'
23404uidtype='$uidtype'
5f80c64f
JH
23405uname='$uname'
23406uniq='$uniq'
b4eb6b3d
JH
23407uquadtype='$uquadtype'
23408use5005threads='$use5005threads'
23409use64bitall='$use64bitall'
23410use64bitint='$use64bitint'
5440bc8e 23411usecrosscompile='$usecrosscompile'
1be1b388 23412usedevel='$usedevel'
5f80c64f 23413usedl='$usedl'
5ac1e9b2 23414usedtrace='$usedtrace'
15b61c98 23415usefaststdio='$usefaststdio'
b4eb6b3d
JH
23416useithreads='$useithreads'
23417uselargefiles='$uselargefiles'
23418uselongdouble='$uselongdouble'
19a100ff 23419usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
23420usemorebits='$usemorebits'
23421usemultiplicity='$usemultiplicity'
23422usemymalloc='$usemymalloc'
5f80c64f 23423usenm='$usenm'
b4eb6b3d
JH
23424useopcode='$useopcode'
23425useperlio='$useperlio'
23426useposix='$useposix'
9514c62b 23427usereentrant='$usereentrant'
d51aaa9d 23428userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
23429usesfio='$usesfio'
23430useshrplib='$useshrplib'
5f106f9c 23431usesitecustomize='$usesitecustomize'
29209bc5 23432usesocks='$usesocks'
b4eb6b3d
JH
23433usethreads='$usethreads'
23434usevendorprefix='$usevendorprefix'
23435usevfork='$usevfork'
5f80c64f
JH
23436usrinc='$usrinc'
23437uuname='$uuname'
b4eb6b3d
JH
23438uvXUformat='$uvXUformat'
23439uvoformat='$uvoformat'
23440uvsize='$uvsize'
23441uvtype='$uvtype'
23442uvuformat='$uvuformat'
23443uvxformat='$uvxformat'
d03b3b00 23444vaproto='$vaproto'
b4eb6b3d
JH
23445vendorarch='$vendorarch'
23446vendorarchexp='$vendorarchexp'
23447vendorbin='$vendorbin'
23448vendorbinexp='$vendorbinexp'
8d2cbf27
JH
23449vendorhtml1dir='$vendorhtml1dir'
23450vendorhtml1direxp='$vendorhtml1direxp'
23451vendorhtml3dir='$vendorhtml3dir'
23452vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
23453vendorlib='$vendorlib'
23454vendorlib_stem='$vendorlib_stem'
23455vendorlibexp='$vendorlibexp'
91e123a8
JH
23456vendorman1dir='$vendorman1dir'
23457vendorman1direxp='$vendorman1direxp'
23458vendorman3dir='$vendorman3dir'
23459vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
23460vendorprefix='$vendorprefix'
23461vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
23462vendorscript='$vendorscript'
23463vendorscriptexp='$vendorscriptexp'
b4eb6b3d 23464version='$version'
861eb78d 23465version_patchlevel_string='$version_patchlevel_string'
d56c5707 23466versiononly='$versiononly'
5f80c64f 23467vi='$vi'
b4eb6b3d 23468voidflags='$voidflags'
5f80c64f 23469xlibpth='$xlibpth'
3659ebf1
JH
23470yacc='$yacc'
23471yaccflags='$yaccflags'
5f80c64f
JH
23472zcat='$zcat'
23473zip='$zip'
23474EOT
23475
5f80c64f
JH
23476: add special variables
23477$test -f $src/patchlevel.h && \
d9421656 23478awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
0f04e85f 23479echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
a02608de 23480echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
23481
23482: propagate old symbols
23483if $test -f UU/config.sh; then
381aa1ff 23484 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
776a38e3
MB
23485 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23486 config.sh config.sh UU/oldconfig.sh |\
23487 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
23488 set X `cat UU/oldsyms`
23489 shift
23490 case $# in
23491 0) ;;
23492 *)
23493 cat <<EOM
23494Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23495EOM
776a38e3 23496 echo ": Variables propagated from previous config.sh file." >>config.sh
5f80c64f
JH
23497 for sym in `cat UU/oldsyms`; do
23498 echo " Propagating $hint variable "'$'"$sym..."
23499 eval 'tmp="$'"${sym}"'"'
23500 echo "$tmp" | \
23501 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23502 done
23503 ;;
23504 esac
23505fi
23506
23507: Finish up by extracting the .SH files
23508case "$alldone" in
23509exit)
23510 $rm -rf UU
24ccb310 23511 echo "Extraction done."
5f80c64f
JH
23512 exit 0
23513 ;;
23514cont)
23515 ;;
23516'')
23517 dflt=''
23518 nostick=true
23519 $cat <<EOM
23520
23521If you'd like to make any changes to the config.sh file before I begin
23522to configure things, do it as a shell escape now (e.g. !vi config.sh).
23523
23524EOM
23525 rp="Press return or use a shell escape to edit config.sh:"
23526 . UU/myread
23527 nostick=''
23528 case "$ans" in
23529 '') ;;
23530 *) : in case they cannot read
23531 sh 1>&4 -c "$ans";;
23532 esac
23533 ;;
23534esac
23535
23536: if this fails, just run all the .SH files by hand
23537. ./config.sh
23538
23539echo " "
23540exec 1>&4
a43e8593 23541pwd=`pwd`
5f80c64f 23542. ./UU/extract
6904989c 23543cd "$pwd"
5f80c64f
JH
23544
23545if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23546 dflt=y
23547 case "$silent" in
23548 true) ;;
23549 *)
23550 $cat <<EOM
23551
23552Now you need to generate make dependencies by running "$make depend".
23553You might prefer to run it in background: "$make depend > makedepend.out &"
23554It can take a while, so you might not want to run it right now.
23555
23556EOM
23557 ;;
23558 esac
23559 rp="Run $make depend now?"
23560 . UU/myread
23561 case "$ans" in
23562 y*)
3d5d58b1 23563 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
23564 ;;
23565 *)
23566 echo "You must run '$make depend' then '$make'."
23567 ;;
23568 esac
23569elif test -f [Mm]akefile; then
23570 echo " "
23571 echo "Now you must run a $make."
23572else
24ccb310 23573 echo "Configure done."
5f80c64f
JH
23574fi
23575
23576if $test -f Policy.sh; then
23577 $cat <<EOM
23578
23579If you compile $package on a different machine or from a different object
23580directory, copy the Policy.sh file from this object directory to the
23581new one before you run Configure -- this will help you with most of
23582the policy defaults.
23583
23584EOM
23585fi
23586if $test -f config.msg; then
23587 echo "Hmm. I also noted the following information while running:"
23588 echo " "
23589 $cat config.msg >&4
23590 $rm -f config.msg
23591fi
23592$rm -f kit*isdone ark*isdone
23593$rm -rf UU
23594
23595: End of Configure
23596