This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for cows sawing ampersands
[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
3e06601f 31# Generated on Sun Aug 26 14:33:39 CEST 2012 [metaconfig 3.5 PL0]
7f2de2d2 32# (with additional metaconfig patches by perlbug@perl.org)
2304df62 33
283fdd21 34cat >c1$$ <<EOF
2304df62
AD
35ARGGGHHHH!!!!!
36
37SCO csh still thinks true is false. Write to SCO today and tell them that next
38year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
41we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43[End of diatribe. We now return you to your regularly scheduled programming...]
44EOF
283fdd21 45cat >c2$$ <<EOF
2304df62
AD
46
47OOPS! You naughty creature! You didn't run Configure with sh!
48I will attempt to remedy the situation by running sh for you...
49EOF
50
283fdd21 51true || cat c1$$ c2$$
2304df62
AD
52true || exec sh $0 $argv:q
53
283fdd21 54(exit $?0) || cat c2$$
2304df62 55(exit $?0) || exec sh $0 $argv:q
283fdd21 56rm -f c1$$ c2$$
2304df62 57
f6538904 58if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
d03b3b00 59 cat <<EOF
cbee2ce6
JH
60***
61*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
63*** Please read the README.plan9 for further instructions.
64*** Cannot continue, aborting.
65***
66EOF
67 exit 1
68fi
69
f8e2af1d 70if test ! -c /dev/null ; then
d03b3b00 71 cat <<EOF
f8e2af1d
MC
72***
73*** I'm sorry, but /dev/null appears to be a file rather than a device.
74*** Please consult your operating sytem's notes for making a device
75*** in /dev.
76*** Cannot continue, aborting.
77***
78EOF
79 exit 1
80fi
81
a0d0e21e
LW
82: compute my invocation name
83me=$0
84case "$0" in
85*/*)
86 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87 test "$me" || me=$0
88 ;;
89esac
90
dfe9444c 91: Proper separator for the PATH environment variable
8e07c86e 92p_=:
613d6c3e 93: On OS/2 this directory should exist if this is not floppy only system ":-]"
5c728af0 94if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
613d6c3e 95 if test -n "$OS2_SHELL"; then
dfe9444c
AD
96 p_=\;
97 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 99 is_os2=yes
c4f23d77 100 elif test -n "$DJGPP"; then
495e2cbe
MB
101 case "X${MACHTYPE:-nonesuchmach}" in
102 *cygwin) ;;
103 *) p_=\; ;;
104 esac
dfe9444c 105 fi
39e571d4 106fi
a0d0e21e
LW
107
108: Proper PATH setting
109paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 110paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 111paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 112paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 113paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 114paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
115paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 117paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
118
119for p in $paths
120do
8e07c86e
AD
121 case "$p_$PATH$p_" in
122 *$p_$p$p_*) ;;
123 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
124 esac
125done
126
8e07c86e 127PATH=.$p_$PATH
2304df62
AD
128export PATH
129
dfe9444c
AD
130: shall we be using ksh?
131inksh=''
132needksh=''
133avoidksh=''
134newsh=/bin/ksh
135changesh=''
ff0cee69 136if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
137 inksh=true
138fi
139if test -f /hp-ux -a -f /bin/ksh; then
140 needksh='to avoid sh bug in "here document" expansion'
141fi
142if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143 if test X`/usr/bin/uname -v` = X4; then
144 avoidksh="to avoid AIX 4's /bin/sh"
145 newsh=/usr/bin/bsh
2304df62 146 fi
dfe9444c 147fi
cf04f91f
JH
148if test -f /osf_boot -a -f /usr/sbin/setld; then
149 if test X`/usr/bin/uname -s` = XOSF1; then
613d6c3e
MB
150 avoidksh="to avoid Digital UNIX' ksh"
151 newsh=/bin/sh
152 unset BIN_SH
cf04f91f
JH
153 fi
154fi
dfe9444c
AD
155case "$inksh/$needksh" in
156/[a-z]*)
c4f23d77 157 ENV=''
dfe9444c
AD
158 changesh=true
159 reason="$needksh"
160 ;;
161esac
162case "$inksh/$avoidksh" in
163true/[a-z]*)
164 changesh=true
165 reason="$avoidksh"
166 ;;
167esac
168case "$inksh/$needksh-$avoidksh-" in
169true/--)
a0d0e21e
LW
170 cat <<EOM
171(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 172mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 173EOM
dfe9444c
AD
174 ;;
175esac
176case "$changesh" in
177true)
2e2a97a6 178 export newsh
dfe9444c
AD
179 echo "(Feeding myself to $newsh $reason.)"
180 case "$0" in
181 Configure|*/Configure) exec $newsh $0 "$@";;
182 *) exec $newsh Configure "$@";;
183 esac
184 ;;
185esac
7730b9f4 186test -x "${newsh}" || unset newsh
2304df62 187
613d6c3e 188: if needed, set CDPATH to a harmless value that is not chatty
bfb7748a
AD
189: avoid bash 2.02 problems with empty CDPATH.
190case "$CDPATH" in
191'') ;;
192*) case "$SHELL" in
613d6c3e
MB
193 *bash*) CDPATH='.' ;;
194 *) CDPATH='' ;;
bfb7748a
AD
195 esac
196 ;;
197esac
613d6c3e 198
2304df62
AD
199: Configure runs within the UU subdirectory
200test -d UU || mkdir UU
8e07c86e 201cd UU && rm -f ./*
2304df62 202
6b356c8e
JH
203ccname=''
204ccversion=''
b4eb6b3d
JH
205ccsymbols=''
206cppccsymbols=''
207cppsymbols=''
5440bc8e
JH
208from=''
209run=''
210targetarch=''
211to=''
212usecrosscompile=''
61c26d18 213extern_C=''
6b34ded5 214mistrustnm=''
1be1b388 215usedevel=''
9c839522 216perllibs=''
b4eb6b3d
JH
217dynamic_ext=''
218extensions=''
219known_extensions=''
220nonxs_ext=''
221static_ext=''
222useopcode=''
223useposix=''
6fcddf3b 224extras=''
ecfc5424 225d_bsd=''
40a7a20a 226d_eunice=''
2304df62
AD
227d_xenix=''
228eunicefix=''
dfe9444c 229ar=''
2304df62
AD
230awk=''
231bash=''
232bison=''
233byacc=''
234cat=''
235chgrp=''
236chmod=''
237chown=''
ecfc5424 238comm=''
2304df62
AD
239compress=''
240cp=''
241cpio=''
242cpp=''
243csh=''
244date=''
245echo=''
246egrep=''
247emacs=''
248expr=''
249find=''
250flex=''
3c728e00 251gmake=''
2304df62 252grep=''
8ff267be 253gzip=''
2304df62
AD
254inews=''
255ksh=''
256less=''
257line=''
258lint=''
259ln=''
260lp=''
261lpr=''
262ls=''
263mail=''
264mailx=''
dfe9444c 265make=''
2304df62
AD
266mkdir=''
267more=''
268mv=''
693762b4 269nm=''
2304df62
AD
270nroff=''
271perl=''
272pg=''
273pmake=''
274pr=''
275rm=''
276rmail=''
277sed=''
278sendmail=''
2304df62
AD
279shar=''
280sleep=''
281smail=''
282sort=''
283submit=''
284tail=''
285tar=''
286tbl=''
693762b4 287tee=''
2304df62
AD
288test=''
289touch=''
290tr=''
291troff=''
292uname=''
293uniq=''
294uuname=''
295vi=''
296zcat=''
8ff267be 297zip=''
b4eb6b3d
JH
298full_ar=''
299full_sed=''
a0d0e21e 300libswanted=''
2304df62
AD
301hint=''
302myuname=''
85e6fe83
LW
303osname=''
304osvers=''
2304df62
AD
305Author=''
306Date=''
307Header=''
308Id=''
309Locker=''
310Log=''
311RCSfile=''
312Revision=''
313Source=''
314State=''
dfe9444c
AD
315_a=''
316_exe=''
317_o=''
4633a7c4
LW
318archobjs=''
319exe_ext=''
320firstmakefile=''
321lib_ext=''
322obj_ext=''
323path_sep=''
5b813a60 324rm_try=''
b4eb6b3d 325afs=''
a6d26a0d 326afsroot=''
b4eb6b3d
JH
327alignbytes=''
328ansi2knr=''
329archlib=''
330archlibexp=''
331d_archlib=''
332installarchlib=''
333archname=''
334myarchname=''
335d_atolf=''
336d_atoll=''
337baserev=''
338bin=''
339binexp=''
f3f1a2d8 340initialinstalllocation=''
b4eb6b3d 341installbin=''
f3f1a2d8 342userelocatableinc=''
b4eb6b3d 343byteorder=''
2304df62 344cc=''
2304df62
AD
345ccflags=''
346cppflags=''
347ldflags=''
348lkflags=''
8e07c86e 349locincpth=''
2304df62 350optimize=''
b4eb6b3d 351cf_email=''
2304df62
AD
352cf_by=''
353cf_time=''
c193ef60
MB
354charbits=''
355charsize=''
2304df62 356contains=''
b4eb6b3d 357cpp_stuff=''
2304df62
AD
358cpplast=''
359cppminus=''
360cpprun=''
361cppstdin=''
74cac757 362d__fwalk=''
b4eb6b3d
JH
363d_access=''
364d_accessx=''
55954f19 365d_aintl=''
b4eb6b3d 366d_alarm=''
10bc17b6
JH
367asctime_r_proto=''
368d_asctime_r=''
fcdf39cf 369d_attribute_deprecated=''
0dbb1585
AL
370d_attribute_format=''
371d_attribute_malloc=''
372d_attribute_nonnull=''
373d_attribute_noreturn=''
374d_attribute_pure=''
375d_attribute_unused=''
376d_attribute_warn_unused_result=''
dcb594bc 377d_printf_format_null=''
b4eb6b3d
JH
378d_bcmp=''
379d_bcopy=''
635aebb7
AL
380d_builtin_choose_expr=''
381d_builtin_expect=''
b4eb6b3d 382d_bzero=''
a2d23ec2 383d_c99_variadic_macros=''
b4eb6b3d
JH
384d_casti32=''
385castflags=''
386d_castneg=''
387d_chown=''
388d_chroot=''
389d_chsize=''
758a5d79 390d_class=''
b0a2e8e6 391d_clearenv=''
b4eb6b3d
JH
392d_closedir=''
393d_void_closedir=''
4e0554ec 394d_cmsghdr_s=''
b4eb6b3d 395d_const=''
36adc09b 396d_copysignl=''
666ea192 397d_cplusplus=''
b4eb6b3d
JH
398cryptlib=''
399d_crypt=''
10bc17b6
JH
400crypt_r_proto=''
401d_crypt_r=''
b4eb6b3d
JH
402d_csh=''
403full_csh=''
13cfc98d 404d_ctermid=''
10bc17b6
JH
405ctermid_r_proto=''
406d_ctermid_r=''
407ctime_r_proto=''
408d_ctime_r=''
b4eb6b3d
JH
409d_cuserid=''
410d_dbl_dig=''
2ef53570 411d_dbminitproto=''
b4eb6b3d 412d_difftime=''
de52168c 413d_dir_dd_fd=''
ae0e3d3b 414d_dirfd=''
b4eb6b3d 415d_dlerror=''
a0d0e21e 416d_dlopen=''
b4eb6b3d
JH
417d_dlsymun=''
418d_dosuid=''
419d_suidsafe=''
10bc17b6
JH
420d_drand48_r=''
421drand48_r_proto=''
b4eb6b3d
JH
422d_drand48proto=''
423d_dup2=''
424d_eaccess=''
425d_endgrent=''
10bc17b6
JH
426d_endgrent_r=''
427endgrent_r_proto=''
b4eb6b3d 428d_endhent=''
10bc17b6
JH
429d_endhostent_r=''
430endhostent_r_proto=''
b4eb6b3d 431d_endnent=''
10bc17b6
JH
432d_endnetent_r=''
433endnetent_r_proto=''
b4eb6b3d 434d_endpent=''
10bc17b6
JH
435d_endprotoent_r=''
436endprotoent_r_proto=''
b4eb6b3d 437d_endpwent=''
10bc17b6
JH
438d_endpwent_r=''
439endpwent_r_proto=''
b4eb6b3d 440d_endsent=''
10bc17b6
JH
441d_endservent_r=''
442endservent_r_proto=''
15b61c98 443d_faststdio=''
b363b713 444d_fchdir=''
b4eb6b3d
JH
445d_fchmod=''
446d_fchown=''
447d_fcntl=''
9d9004a9 448d_fcntl_can_lock=''
b4eb6b3d
JH
449d_fd_macros=''
450d_fd_set=''
451d_fds_bits=''
452d_fgetpos=''
758a5d79
JH
453d_finite=''
454d_finitel=''
b4eb6b3d
JH
455d_flexfnam=''
456d_flock=''
2ef53570 457d_flockproto=''
b4eb6b3d 458d_fork=''
758a5d79
JH
459d_fp_class=''
460d_fpclass=''
461d_fpclassify=''
462d_fpclassl=''
b4eb6b3d
JH
463d_fpos64_t=''
464d_frexpl=''
465d_fs_data_s=''
466d_fseeko=''
467d_fsetpos=''
468d_fstatfs=''
411ab01c 469d_fsync=''
b4eb6b3d
JH
470d_ftello=''
471d_ftime=''
472d_gettimeod=''
dc814df1 473d_futimes=''
b4eb6b3d 474d_Gconvert=''
5086dff9 475d_getaddrinfo=''
b4eb6b3d
JH
476d_getcwd=''
477d_getespwnam=''
478d_getfsstat=''
479d_getgrent=''
10bc17b6
JH
480d_getgrent_r=''
481getgrent_r_proto=''
482d_getgrgid_r=''
483getgrgid_r_proto=''
484d_getgrnam_r=''
485getgrnam_r_proto=''
b4eb6b3d
JH
486d_getgrps=''
487d_gethbyaddr=''
488d_gethbyname=''
489d_gethent=''
490aphostname=''
491d_gethname=''
492d_phostname=''
493d_uname=''
10bc17b6
JH
494d_gethostbyaddr_r=''
495gethostbyaddr_r_proto=''
496d_gethostbyname_r=''
497gethostbyname_r_proto=''
498d_gethostent_r=''
499gethostent_r_proto=''
b4eb6b3d 500d_gethostprotos=''
4e0554ec 501d_getitimer=''
b4eb6b3d 502d_getlogin=''
10bc17b6
JH
503d_getlogin_r=''
504getlogin_r_proto=''
b4eb6b3d
JH
505d_getmnt=''
506d_getmntent=''
5086dff9 507d_getnameinfo=''
b4eb6b3d
JH
508d_getnbyaddr=''
509d_getnbyname=''
510d_getnent=''
10bc17b6
JH
511d_getnetbyaddr_r=''
512getnetbyaddr_r_proto=''
513d_getnetbyname_r=''
514getnetbyname_r_proto=''
515d_getnetent_r=''
516getnetent_r_proto=''
b4eb6b3d 517d_getnetprotos=''
0c0643d0 518d_getpagsz=''
b4eb6b3d
JH
519d_getpent=''
520d_getpgid=''
521d_getpgrp2=''
522d_bsdgetpgrp=''
523d_getpgrp=''
524d_getppid=''
525d_getprior=''
526d_getpbyname=''
527d_getpbynumber=''
10bc17b6
JH
528d_getprotobyname_r=''
529getprotobyname_r_proto=''
530d_getprotobynumber_r=''
531getprotobynumber_r_proto=''
532d_getprotoent_r=''
533getprotoent_r_proto=''
b4eb6b3d
JH
534d_getprotoprotos=''
535d_getprpwnam=''
536d_getpwent=''
10bc17b6
JH
537d_getpwent_r=''
538getpwent_r_proto=''
539d_getpwnam_r=''
540getpwnam_r_proto=''
541d_getpwuid_r=''
542getpwuid_r_proto=''
b4eb6b3d 543d_getsent=''
10bc17b6
JH
544d_getservbyname_r=''
545getservbyname_r_proto=''
546d_getservbyport_r=''
547getservbyport_r_proto=''
548d_getservent_r=''
549getservent_r_proto=''
b4eb6b3d
JH
550d_getservprotos=''
551d_getspnam=''
10bc17b6
JH
552d_getspnam_r=''
553getspnam_r_proto=''
b4eb6b3d
JH
554d_getsbyname=''
555d_getsbyport=''
10bc17b6
JH
556d_gmtime_r=''
557gmtime_r_proto=''
a4f3eea9 558d_gnulibc=''
5f6e0ee4 559gnulibc_version=''
b4eb6b3d
JH
560d_hasmntopt=''
561d_htonl=''
55954f19 562d_ilogbl=''
b4eb6b3d 563d_inetaton=''
5086dff9
MB
564d_inetntop=''
565d_inetpton=''
b4eb6b3d
JH
566d_int64_t=''
567d_isascii=''
269a7913 568d_isblank=''
758a5d79
JH
569d_isfinite=''
570d_isinf=''
b4eb6b3d
JH
571d_isnan=''
572d_isnanl=''
573d_killpg=''
574d_lchown=''
575d_ldbl_dig=''
0a0abfba 576d_libm_lib_version=''
b4eb6b3d 577d_link=''
10bc17b6 578d_localtime_r=''
8572b25d 579d_localtime_r_needs_tzset=''
10bc17b6 580localtime_r_proto=''
b4eb6b3d
JH
581d_locconv=''
582d_lockf=''
583d_longdbl=''
584longdblsize=''
585d_longlong=''
586longlongsize=''
587d_lseekproto=''
588d_lstat=''
589d_madvise=''
7dd121ae
MB
590d_malloc_good_size=''
591d_malloc_size=''
b4eb6b3d
JH
592d_mblen=''
593d_mbstowcs=''
594d_mbtowc=''
595d_memchr=''
596d_memcmp=''
597d_memcpy=''
598d_memmove=''
599d_memset=''
600d_mkdir=''
601d_mkdtemp=''
602d_mkfifo=''
603d_mkstemp=''
604d_mkstemps=''
605d_mktime=''
606d_mmap=''
607mmaptype=''
608d_modfl=''
e67aeab1 609d_modfl_pow32_bug=''
bc9a1b2c 610d_modflproto=''
b4eb6b3d
JH
611d_mprotect=''
612d_msg=''
613d_msgctl=''
614d_msgget=''
4e0554ec 615d_msghdr_s=''
b4eb6b3d
JH
616d_msgrcv=''
617d_msgsnd=''
618d_msync=''
619d_munmap=''
620d_nice=''
2765b840 621d_nl_langinfo=''
b4eb6b3d
JH
622d_off64_t=''
623d_open3=''
624d_fpathconf=''
625d_pathconf=''
626d_pause=''
627d_pipe=''
628d_poll=''
2304df62 629d_portable=''
c796e3db
MB
630d_prctl=''
631d_prctl_set_name=''
a33c94aa 632d_procselfexe=''
f24dbf84 633procselfexe=''
b4eb6b3d
JH
634d_old_pthread_create_joinable=''
635old_pthread_create_joinable=''
d6483fcc 636d_pthread_atfork=''
58d975c3 637d_pthread_attr_setscope=''
b4eb6b3d
JH
638d_pthread_yield=''
639d_sched_yield=''
640sched_yield=''
641d_qgcvt=''
10bc17b6
JH
642d_random_r=''
643random_r_proto=''
644d_readdir64_r=''
645readdir64_r_proto=''
b4eb6b3d
JH
646d_readdir=''
647d_rewinddir=''
648d_seekdir=''
649d_telldir=''
10bc17b6
JH
650d_readdir_r=''
651readdir_r_proto=''
b4eb6b3d 652d_readlink=''
4e0554ec
JH
653d_readv=''
654d_recvmsg=''
b4eb6b3d
JH
655d_rename=''
656d_rmdir=''
657d_safebcpy=''
658d_safemcpy=''
659d_sanemcmp=''
ef9f17be 660d_sbrkproto=''
55954f19 661d_scalbnl=''
b4eb6b3d
JH
662d_select=''
663d_sem=''
664d_semctl=''
665d_semget=''
666d_semop=''
4e0554ec 667d_sendmsg=''
b4eb6b3d
JH
668d_setegid=''
669d_seteuid=''
670d_setgrent=''
10bc17b6
JH
671d_setgrent_r=''
672setgrent_r_proto=''
b4eb6b3d
JH
673d_setgrps=''
674d_sethent=''
10bc17b6
JH
675d_sethostent_r=''
676sethostent_r_proto=''
4e0554ec 677d_setitimer=''
b4eb6b3d
JH
678d_setlinebuf=''
679d_setlocale=''
10bc17b6
JH
680d_setlocale_r=''
681setlocale_r_proto=''
b4eb6b3d 682d_setnent=''
10bc17b6
JH
683d_setnetent_r=''
684setnetent_r_proto=''
b4eb6b3d
JH
685d_setpent=''
686d_setpgid=''
687d_setpgrp2=''
688d_bsdsetpgrp=''
689d_setpgrp=''
690d_setprior=''
691d_setproctitle=''
10bc17b6
JH
692d_setprotoent_r=''
693setprotoent_r_proto=''
b4eb6b3d 694d_setpwent=''
10bc17b6
JH
695d_setpwent_r=''
696setpwent_r_proto=''
b4eb6b3d
JH
697d_setregid=''
698d_setresgid=''
699d_setresuid=''
700d_setreuid=''
701d_setrgid=''
702d_setruid=''
703d_setsent=''
10bc17b6
JH
704d_setservent_r=''
705setservent_r_proto=''
b4eb6b3d
JH
706d_setsid=''
707d_setvbuf=''
708d_sfio=''
709usesfio=''
710d_shm=''
711d_shmat=''
712d_shmatprototype=''
713shmattype=''
714d_shmctl=''
715d_shmdt=''
716d_shmget=''
717d_sigaction=''
ed140128 718d_signbit=''
983dbef6 719d_sigprocmask=''
b4eb6b3d 720d_sigsetjmp=''
5f106f9c 721usesitecustomize=''
4f5da3e9
SP
722d_snprintf=''
723d_vsnprintf=''
49a78c82 724d_sockatmark=''
2ef53570 725d_sockatmarkproto=''
122b9bf4 726d_ip_mreq=''
3e06601f 727d_ip_mreq_source=''
18126d98 728d_ipv6_mreq=''
3e06601f 729d_ipv6_mreq_source=''
b4eb6b3d
JH
730d_msg_ctrunc=''
731d_msg_dontroute=''
732d_msg_oob=''
733d_msg_peek=''
734d_msg_proxy=''
735d_oldsock=''
736d_scm_rights=''
f53580fe 737d_sin6_scope_id=''
18126d98 738d_sockaddr_in6=''
b8677e3b 739d_sockaddr_sa_len=''
b4eb6b3d
JH
740d_socket=''
741d_sockpair=''
742sockethdr=''
743socketlib=''
744d_socklen_t=''
745d_socks5_init=''
360321b3 746d_sprintf_returns_strlen=''
b4eb6b3d 747d_sqrtl=''
10bc17b6
JH
748d_srand48_r=''
749srand48_r_proto=''
750d_srandom_r=''
751srandom_r_proto=''
eef837ea 752d_sresgproto=''
640374d0 753d_sresuproto=''
b4eb6b3d
JH
754d_statblks=''
755d_statfs_f_flags=''
756d_statfs_s=''
17a6c8e3
AD
757d_static_inline=''
758perl_static_inline=''
b4eb6b3d
JH
759d_fstatvfs=''
760d_statvfs=''
761d_stdio_cnt_lval=''
762d_stdio_ptr_lval=''
a7ffa9b9
NC
763d_stdio_ptr_lval_nochange_cnt=''
764d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
765d_stdiobase=''
766d_stdstdio=''
767stdio_base=''
768stdio_bufsiz=''
769stdio_cnt=''
770stdio_filbuf=''
771stdio_ptr=''
772d_index=''
773d_strchr=''
774d_strcoll=''
775d_strctcpy=''
776d_strerrm=''
777d_strerror=''
778d_sysernlst=''
779d_syserrlst=''
10bc17b6
JH
780d_strerror_r=''
781strerror_r_proto=''
b3c85772 782d_strftime=''
08c92000
MB
783d_strlcat=''
784d_strlcpy=''
b4eb6b3d
JH
785d_strtod=''
786d_strtol=''
787d_strtold=''
788d_strtoll=''
28e5dec8 789d_strtoq=''
b4eb6b3d
JH
790d_strtoul=''
791d_strtoull=''
792d_strtouq=''
793d_strxfrm=''
794d_symlink=''
795d_syscall=''
2ef53570 796d_syscallproto=''
b4eb6b3d
JH
797d_sysconf=''
798d_system=''
799d_tcgetpgrp=''
800d_tcsetpgrp=''
801d_telldirproto=''
802d_time=''
803timetype=''
96938616
MB
804d_asctime64=''
805d_ctime64=''
806d_difftime64=''
807d_gmtime64=''
808d_localtime64=''
809d_mktime64=''
cbb9e8a7 810d_timegm=''
b4eb6b3d
JH
811clocktype=''
812d_times=''
10bc17b6
JH
813d_tmpnam_r=''
814tmpnam_r_proto=''
b4eb6b3d 815d_truncate=''
10bc17b6
JH
816d_ttyname_r=''
817ttyname_r_proto=''
b4eb6b3d 818d_tzname=''
4e0554ec
JH
819d_u32align=''
820d_ualarm=''
b4eb6b3d
JH
821d_umask=''
822d_semctl_semid_ds=''
823d_semctl_semun=''
824d_union_semun=''
758a5d79 825d_unordered=''
bdf33aa7 826d_unsetenv=''
4e0554ec 827d_usleep=''
2ef53570 828d_usleepproto=''
b4eb6b3d 829d_ustat=''
233e16ce 830d_pseudofork=''
b4eb6b3d
JH
831d_vfork=''
832usevfork=''
833d_voidsig=''
834signal_t=''
835d_volatile=''
836d_charvspr=''
837d_vprintf=''
838d_wait4=''
839d_waitpid=''
840d_wcstombs=''
841d_wctomb=''
4e0554ec 842d_writev=''
b4eb6b3d 843dlext=''
f1ce3bf1 844bin_ELF=''
85e6fe83
LW
845cccdlflags=''
846ccdlflags=''
2304df62 847dlsrc=''
232e078e 848ld=''
9ec4dadf 849ld_can_script=''
85e6fe83 850lddlflags=''
2304df62 851usedl=''
b4eb6b3d
JH
852doublesize=''
853ebcdic=''
854fflushNULL=''
855fflushall=''
856fpossize=''
857fpostype=''
2d736872 858gccansipedantic=''
5b463ca7 859gccosandvers=''
8a27cf78 860gccversion=''
b4eb6b3d
JH
861gidformat=''
862gidsign=''
863gidsize=''
864gidtype=''
865groupstype=''
866h_fcntl=''
867h_sysfile=''
6e1038e0
MB
868html1dir=''
869html1direxp=''
870installhtml1dir=''
871html3dir=''
872html3direxp=''
873installhtml3dir=''
b4eb6b3d 874i_arpainet=''
c0bacbef 875i_assert=''
10bc17b6 876i_crypt=''
b4eb6b3d
JH
877db_hashtype=''
878db_prefixtype=''
640374d0
JH
879db_version_major=''
880db_version_minor=''
881db_version_patch=''
b4eb6b3d
JH
882i_db=''
883i_dbm=''
884i_rpcsvcdbm=''
885d_dirnamlen=''
886direntrytype=''
887i_dirent=''
a0d0e21e 888i_dld=''
b4eb6b3d
JH
889i_dlfcn=''
890i_fcntl=''
891i_float=''
758a5d79
JH
892i_fp=''
893i_fp_class=''
b4eb6b3d
JH
894i_gdbm=''
895d_grpasswd=''
896i_grp=''
b4eb6b3d
JH
897i_ieeefp=''
898i_inttypes=''
2765b840 899i_langinfo=''
b4eb6b3d
JH
900i_libutil=''
901i_limits=''
902i_locale=''
903i_machcthr=''
904i_malloc=''
1cd66f7c 905i_mallocmalloc=''
b4eb6b3d
JH
906i_math=''
907i_memory=''
908i_mntent=''
e74475c7
MHM
909d_gdbm_ndbm_h_uses_prototypes=''
910d_gdbmndbm_h_uses_prototypes=''
a33f2d9f 911d_ndbm=''
e74475c7 912d_ndbm_h_uses_prototypes=''
a33f2d9f
AD
913i_gdbm_ndbm=''
914i_gdbmndbm=''
b4eb6b3d
JH
915i_ndbm=''
916i_netdb=''
917i_neterrno=''
918i_netinettcp=''
919i_niin=''
920i_sysin=''
921i_poll=''
922i_prot=''
923i_pthread=''
924d_pwage=''
925d_pwchange=''
926d_pwclass=''
927d_pwcomment=''
928d_pwexpire=''
929d_pwgecos=''
930d_pwpasswd=''
931d_pwquota=''
932i_pwd=''
933i_sfio=''
934i_shadow=''
935i_socks=''
bd31be4b 936i_stdbool=''
b4eb6b3d
JH
937i_stddef=''
938i_stdlib=''
939i_string=''
940strings=''
941i_sunmath=''
942i_sysaccess=''
943i_sysdir=''
944i_sysfile=''
945d_voidtty=''
946i_bsdioctl=''
947i_sysfilio=''
948i_sysioctl=''
949i_syssockio=''
950i_syslog=''
951i_sysmman=''
952i_sysmode=''
953i_sysmount=''
954i_sysndir=''
955i_sysparam=''
216dac04 956i_syspoll=''
b4eb6b3d
JH
957i_sysresrc=''
958i_syssecrt=''
959i_sysselct=''
960i_sysstat=''
961i_sysstatfs=''
962i_sysstatvfs=''
963i_systimes=''
964i_systypes=''
965i_sysuio=''
966i_sysun=''
967i_sysutsname=''
968i_sysvfs=''
969i_syswait=''
970i_sgtty=''
971i_termio=''
972i_termios=''
14b90194
JH
973d_tm_tm_gmtoff=''
974d_tm_tm_zone=''
b4eb6b3d
JH
975i_systime=''
976i_systimek=''
977i_time=''
978timeincl=''
979i_unistd=''
980i_ustat=''
981i_utime=''
982i_values=''
983i_stdarg=''
984i_varargs=''
985i_varhdr=''
986i_vfork=''
f3f1a2d8 987d_inc_version_list=''
b4eb6b3d
JH
988inc_version_list=''
989inc_version_list_init=''
990installprefix=''
991installprefixexp=''
992installstyle=''
993installusrbinperl=''
994intsize=''
995longsize=''
996shortsize=''
4b661809 997issymlink=''
2304df62 998libc=''
b4eb6b3d
JH
999ldlibpthname=''
1000libperl=''
1001shrpenv=''
1002useshrplib=''
a0d0e21e 1003glibpth=''
2304df62 1004libpth=''
8e07c86e 1005loclibpth=''
2304df62
AD
1006plibpth=''
1007xlibpth=''
1cfa4ec7 1008ignore_versioned_solibs=''
2304df62 1009libs=''
43999f95
JH
1010libsdirs=''
1011libsfiles=''
1012libsfound=''
13b3f787 1013libspath=''
85e6fe83 1014lns=''
b4eb6b3d
JH
1015d_PRIEUldbl=''
1016d_PRIFUldbl=''
1017d_PRIGUldbl=''
1018d_PRIeldbl=''
1019d_PRIfldbl=''
1020d_PRIgldbl=''
1021d_SCNfldbl=''
1022sPRIEUldbl=''
1023sPRIFUldbl=''
1024sPRIGUldbl=''
1025sPRIeldbl=''
1026sPRIfldbl=''
1027sPRIgldbl=''
1028sSCNfldbl=''
1029lseeksize=''
1030lseektype=''
d620c7b3 1031mad=''
00e74f14
NC
1032madlyh=''
1033madlyobj=''
1034madlysrc=''
f3f1a2d8
MB
1035make_set_make=''
1036d_mymalloc=''
1037freetype=''
b4eb6b3d
JH
1038mallocobj=''
1039mallocsrc=''
1040malloctype=''
9df442c2 1041usemallocwrap=''
b4eb6b3d
JH
1042usemymalloc=''
1043installman1dir=''
1044man1dir=''
1045man1direxp=''
1046man1ext=''
1047installman3dir=''
1048man3dir=''
1049man3direxp=''
1050man3ext=''
1051modetype=''
1052multiarch=''
1053mydomain=''
1054myhostname=''
1055phostname=''
2304df62
AD
1056c=''
1057n=''
b4eb6b3d
JH
1058d_eofnblk=''
1059eagain=''
1060o_nonblock=''
1061rd_nodata=''
2cc61e15 1062need_va_copy=''
b4eb6b3d
JH
1063netdb_hlen_type=''
1064netdb_host_type=''
1065netdb_name_type=''
1066netdb_net_type=''
1067groupcat=''
1068hostcat=''
1069passcat=''
1070orderlib=''
1071ranlib=''
1072d_perl_otherlibdirs=''
1073otherlibdirs=''
2304df62
AD
1074package=''
1075spackage=''
b4eb6b3d
JH
1076pager=''
1077api_revision=''
1078api_subversion=''
1079api_version=''
1080api_versionstring=''
1081patchlevel=''
151e6568 1082perl_patchlevel=''
b4eb6b3d
JH
1083revision=''
1084subversion=''
1085version=''
861eb78d 1086version_patchlevel_string=''
b4eb6b3d
JH
1087perl5=''
1088perladmin=''
91f55cc7 1089perlpath=''
b4eb6b3d 1090d_nv_preserves_uv=''
f607920a 1091d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1092i16size=''
1093i16type=''
1094i32size=''
1095i32type=''
1096i64size=''
1097i64type=''
1098i8size=''
1099i8type=''
1100ivsize=''
1101ivtype=''
b68c599a 1102nv_overflows_integers_at=''
4137585d 1103nv_preserves_uv_bits=''
b4eb6b3d
JH
1104nvsize=''
1105nvtype=''
1106u16size=''
1107u16type=''
1108u32size=''
1109u32type=''
1110u64size=''
1111u64type=''
1112u8size=''
1113u8type=''
1114uvsize=''
1115uvtype=''
1116ivdformat=''
1117nvEUformat=''
1118nvFUformat=''
1119nvGUformat=''
1120nveformat=''
1121nvfformat=''
1122nvgformat=''
1123uvXUformat=''
1124uvoformat=''
1125uvuformat=''
1126uvxformat=''
1127pidtype=''
1128prefix=''
1129prefixexp=''
1130installprivlib=''
1131privlib=''
1132privlibexp=''
1133prototype=''
1134ptrsize=''
1135d_PRIXU64=''
1136d_PRId64=''
1137d_PRIi64=''
1138d_PRIo64=''
1139d_PRIu64=''
1140d_PRIx64=''
1141sPRIXU64=''
1142sPRId64=''
1143sPRIi64=''
1144sPRIo64=''
1145sPRIu64=''
1146sPRIx64=''
1147d_quad=''
1148quadkind=''
1149quadtype=''
1150uquadtype=''
1151drand01=''
1152randbits=''
1153randfunc=''
1154randseedtype=''
1155seedfunc=''
1156installscript=''
1157scriptdir=''
1158scriptdirexp=''
1159selectminbits=''
1160selecttype=''
8ff267be 1161sh=''
b4eb6b3d
JH
1162sig_count=''
1163sig_name=''
1164sig_name_init=''
1165sig_num=''
1166sig_num_init=''
76d3c696 1167sig_size=''
f3f1a2d8 1168d_sitearch=''
b4eb6b3d
JH
1169installsitearch=''
1170sitearch=''
1171sitearchexp=''
1172installsitebin=''
1173sitebin=''
1174sitebinexp=''
8d2cbf27
JH
1175installsitehtml1dir=''
1176sitehtml1dir=''
1177sitehtml1direxp=''
1178installsitehtml3dir=''
1179sitehtml3dir=''
1180sitehtml3direxp=''
b4eb6b3d
JH
1181installsitelib=''
1182sitelib=''
1183sitelib_stem=''
1184sitelibexp=''
91e123a8
JH
1185installsiteman1dir=''
1186siteman1dir=''
1187siteman1direxp=''
1188installsiteman3dir=''
1189siteman3dir=''
1190siteman3direxp=''
b4eb6b3d
JH
1191siteprefix=''
1192siteprefixexp=''
6e1038e0
MB
1193installsitescript=''
1194sitescript=''
1195sitescriptexp=''
b4eb6b3d
JH
1196sizesize=''
1197sizetype=''
a0d0e21e 1198so=''
b4eb6b3d 1199socksizetype=''
2304df62
AD
1200sharpbang=''
1201shsharp=''
1202spitshell=''
dfe9444c 1203src=''
b4eb6b3d 1204ssizetype=''
668fdbe1
MB
1205st_ino_sign=''
1206st_ino_size=''
b4eb6b3d 1207startperl=''
2304df62 1208startsh=''
b4eb6b3d
JH
1209stdchar=''
1210d_stdio_stream_array=''
1211stdio_stream_array=''
1212sysman=''
81c4fd9e
MB
1213sGMTIME_max=''
1214sGMTIME_min=''
73e6e416
MB
1215sLOCALTIME_max=''
1216sLOCALTIME_min=''
5ff3f7a4 1217trnl=''
b4eb6b3d
JH
1218uidformat=''
1219uidsign=''
1220uidsize=''
1221uidtype=''
1222archname64=''
1223use64bitall=''
1224use64bitint=''
34f1896b
MB
1225dtrace=''
1226usedtrace=''
15b61c98 1227usefaststdio=''
d78f9ffa 1228usekernprocpathname=''
b4eb6b3d
JH
1229ccflags_uselargefiles=''
1230ldflags_uselargefiles=''
1231libswanted_uselargefiles=''
1232uselargefiles=''
1233uselongdouble=''
1234usemorebits=''
1235usemultiplicity=''
2304df62 1236nm_opt=''
40a7a20a 1237nm_so_opt=''
2304df62
AD
1238runnm=''
1239usenm=''
ae60cb46 1240usensgetexecutablepath=''
b4eb6b3d 1241useperlio=''
29209bc5 1242usesocks=''
b4eb6b3d
JH
1243d_oldpthreads=''
1244use5005threads=''
1245useithreads=''
9514c62b 1246usereentrant=''
b4eb6b3d 1247usethreads=''
2304df62 1248incpath=''
2304df62
AD
1249mips_type=''
1250usrinc=''
d03b3b00 1251vaproto=''
b4eb6b3d
JH
1252d_vendorarch=''
1253installvendorarch=''
1254vendorarch=''
1255vendorarchexp=''
1256d_vendorbin=''
1257installvendorbin=''
1258vendorbin=''
1259vendorbinexp=''
8d2cbf27
JH
1260installvendorhtml1dir=''
1261vendorhtml1dir=''
1262vendorhtml1direxp=''
1263installvendorhtml3dir=''
1264vendorhtml3dir=''
1265vendorhtml3direxp=''
b4eb6b3d
JH
1266d_vendorlib=''
1267installvendorlib=''
1268vendorlib=''
1269vendorlib_stem=''
1270vendorlibexp=''
91e123a8
JH
1271installvendorman1dir=''
1272vendorman1dir=''
1273vendorman1direxp=''
1274installvendorman3dir=''
1275vendorman3dir=''
1276vendorman3direxp=''
b4eb6b3d
JH
1277usevendorprefix=''
1278vendorprefix=''
1279vendorprefixexp=''
6e1038e0
MB
1280d_vendorscript=''
1281installvendorscript=''
1282vendorscript=''
1283vendorscriptexp=''
d56c5707 1284versiononly=''
b4eb6b3d
JH
1285defvoidused=''
1286voidflags=''
3659ebf1
JH
1287yacc=''
1288yaccflags=''
2304df62
AD
1289CONFIG=''
1290
34f1896b 1291: Detect odd OSs
ecfc5424
AD
1292define='define'
1293undef='undef'
1294smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1295rmlist=''
1296
1297: We must find out about Eunice early
1298eunicefix=':'
1299if test -f /etc/unixtovms; then
1300 eunicefix=/etc/unixtovms
1301fi
1302if test -f /etc/unixtovms.exe; then
1303 eunicefix=/etc/unixtovms.exe
1304fi
1305
cfb04860 1306: Set executable suffix now -- needed before hints available
6153ba32
PG
1307if test -f "/libs/version.library"; then
1308: Amiga OS
1309 _exe=""
1310elif test -f "/system/gnu_library/bin/ar.pm"; then
1311: Stratus VOS
cfb04860 1312 _exe=".pm"
6153ba32
PG
1313elif test -n "$DJGPP"; then
1314: DOS DJGPP
cfb04860 1315 _exe=".exe"
5c728af0 1316elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1317: OS/2 or cygwin
ba863942
JH
1318 _exe=".exe"
1319fi
868439a2 1320
1d8eaf8c 1321groupstype=''
b4eb6b3d 1322i_whoami=''
06501368
MB
1323: Trailing extension. Override this in a hint file, if needed.
1324: Extra object files, if any, needed on this platform.
1325archobjs=''
b8677e3b
MB
1326archname=''
1327: Possible local include directories to search.
1328: Set locincpth to "" in a hint file to defeat local include searches.
1329locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1330locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1331:
1332: no include file wanted by default
1333inclwanted=''
1334
1335: Enable -DEBUGGING and -DDEBUGGING from the command line
1336EBUGGING=''
356123f1 1337DEBUGGING=''
b8677e3b 1338
64615a5e 1339libnames=''
732c9516
JH
1340: change the next line if compiling for Xenix/286 on Xenix/386
1341xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1342: Possible local library directories to search.
1343loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1344loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1345
1346: general looking path for locating libraries
5869b1f1 1347glibpth="/lib /usr/lib $xlibpth"
732c9516 1348glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1349test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1350test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1351test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1352
1353: Private path used by Configure to find libraries. Its value
1354: is prepended to libpth. This variable takes care of special
1355: machines, like the mips. Usually, it should be empty.
1356plibpth=''
1357
1cfa4ec7
GS
1358: default library list
1359libswanted=''
921b2963 1360: some systems want to use only the non-versioned libso:s
1cfa4ec7 1361ignore_versioned_solibs=''
06501368
MB
1362: set usethreads on the Configure command line to enable threads.
1363usereentrant='undef'
ed140128
AD
1364: full support for void wanted by default
1365defvoidused=15
1366
ed140128
AD
1367ccname=''
1368ccversion=''
1369perllibs=''
1370: set useposix=false in your hint file to disable the POSIX extension.
1371useposix=true
1372: set useopcode=false in your hint file to disable the Opcode extension.
1373useopcode=true
b4eb6b3d
JH
1374archname64=''
1375ccflags_uselargefiles=''
1376ldflags_uselargefiles=''
1377libswanted_uselargefiles=''
1378: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1379: set usesocks on the Configure command line to enable socks.
ecfc5424 1380: List of libraries we want.
15431986 1381: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef 1382libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8119684f 1383libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1384: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1385: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1386glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1387glibpth="/usr/shlib $glibpth"
1388: Do not use vfork unless overridden by a hint file.
1389usevfork=false
1390
8ff267be 1391: Find the basic shell for Bourne shell scripts
1392case "$sh" in
1393'')
8ff267be 1394 case "$SYSTYPE" in
1395 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1396 *) xxx='/bin/sh';;
1397 esac
1398 if test -f "$xxx"; then
1399 sh="$xxx"
1400 else
1401 : Build up a list and do a single loop so we can 'break' out.
1402 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1403 for xxx in sh bash ksh pdksh ash; do
1404 for p in $pth; do
1405 try="$try ${p}/${xxx}"
1406 done
1407 done
1408 for xxx in $try; do
1409 if test -f "$xxx"; then
1410 sh="$xxx";
8ff267be 1411 break
a5a94ea5
JH
1412 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1413 sh="$xxx";
1414 break
8ff267be 1415 elif test -f "$xxx.exe"; then
1416 sh="$xxx";
8ff267be 1417 break
1418 fi
1419 done
1420 fi
1421 ;;
1422esac
1423
1424case "$sh" in
a33c94aa 1425'') cat >&2 <<EOM
8ff267be 1426$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1427
8ff267be 1428Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1429Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1430we'll try to straighten this all out.
8ff267be 1431EOM
1432 exit 1
1433 ;;
1434esac
1435
760ac839 1436: see if sh knows # comments
73614538 1437if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1438 shsharp=true
1439 spitshell=cat
760ac839 1440 xcat=/bin/cat
a931254c
JH
1441 test -f $xcat$_exe || xcat=/usr/bin/cat
1442 if test ! -f $xcat$_exe; then
4bdb8fb5 1443 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1444 if test -f $p/cat$_exe; then
1deb0a86 1445 xcat=$p/cat
3c728e00
JH
1446 break
1447 fi
1448 done
1deb0a86
JH
1449 if test ! -f $xcat$_exe; then
1450 echo "Can't find cat anywhere!"
3c728e00
JH
1451 exit 1
1452 fi
1453 fi
5440bc8e
JH
1454 echo "#!$xcat" >sharp
1455 $eunicefix sharp
1456 chmod +x sharp
1d8eaf8c 1457 ./sharp > today 2>/dev/null
760ac839 1458 if test -s today; then
760ac839
LW
1459 sharpbang='#!'
1460 else
5440bc8e
JH
1461 echo "#! $xcat" > sharp
1462 $eunicefix sharp
1463 chmod +x sharp
1d8eaf8c 1464 ./sharp > today 2>/dev/null
760ac839 1465 if test -s today; then
760ac839
LW
1466 sharpbang='#! '
1467 else
760ac839
LW
1468 sharpbang=': use '
1469 fi
1470 fi
1471else
dfe9444c 1472 echo " "
8ff267be 1473 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1474 shsharp=false
1475 cd ..
1476 echo "exec grep -v '^[ ]*#'" >spitshell
1477 chmod +x spitshell
1478 $eunicefix spitshell
1479 spitshell=`pwd`/spitshell
1480 cd UU
1481 echo "I presume that if # doesn't work, #! won't work either!"
1482 sharpbang=': use '
1483fi
5440bc8e 1484rm -f sharp today
760ac839
LW
1485
1486: figure out how to guarantee sh startup
8ff267be 1487case "$startsh" in
1488'') startsh=${sharpbang}${sh} ;;
1489*)
760ac839 1490esac
5440bc8e 1491cat >sharp <<EOSS
760ac839
LW
1492$startsh
1493set abc
1494test "$?abc" != 1
1495EOSS
1496
5440bc8e
JH
1497chmod +x sharp
1498$eunicefix sharp
1499if ./sharp; then
8ff267be 1500 : echo "Yup, it does."
760ac839 1501else
dfe9444c
AD
1502 echo "Hmm... '$startsh' does not guarantee sh startup..."
1503 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1504fi
5440bc8e 1505rm -f sharp
760ac839 1506
aebf16e7
AD
1507: Save command line options in file UU/cmdline.opt for later use in
1508: generating config.sh.
1509cat > cmdline.opt <<EOSH
613d6c3e 1510: Configure command line arguments.
aebf16e7
AD
1511config_arg0='$0'
1512config_args='$*'
1513config_argc=$#
1514EOSH
1515argn=1
ee45ea83
IZ
1516args_exp=''
1517args_sep=''
aebf16e7
AD
1518for arg in "$@"; do
1519 cat >>cmdline.opt <<EOSH
1520config_arg$argn='$arg'
1521EOSH
ee45ea83
IZ
1522 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1523$arg
1524EOC
1525 arg_exp=`cat cmdl.opt`
1526 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1527 argn=`expr $argn + 1`
ee45ea83 1528 args_sep=' '
aebf16e7 1529done
ee45ea83 1530rm -f cmdl.opt
aebf16e7 1531
2304df62
AD
1532: produce awk script to parse command line options
1533cat >options.awk <<'EOF'
1534BEGIN {
02e93a22 1535 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1536
1537 len = length(optstr);
1538 for (i = 1; i <= len; i++) {
1539 c = substr(optstr, i, 1);
1540 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1541 if (a == ":") {
1542 arg[c] = 1;
1543 i++;
1544 }
1545 opt[c] = 1;
1546 }
1547}
1548{
1549 expect = 0;
1550 str = $0;
1551 if (substr(str, 1, 1) != "-") {
1552 printf("'%s'\n", str);
1553 next;
1554 }
1555 len = length($0);
1556 for (i = 2; i <= len; i++) {
1557 c = substr(str, i, 1);
1558 if (!opt[c]) {
1559 printf("-%s\n", substr(str, i));
1560 next;
1561 }
1562 printf("-%s\n", c);
1563 if (arg[c]) {
1564 if (i < len)
1565 printf("'%s'\n", substr(str, i + 1));
1566 else
1567 expect = 1;
1568 next;
1569 }
1570 }
1571}
1572END {
1573 if (expect)
1574 print "?";
1575}
1576EOF
1577
1578: process the command line options
4633a7c4
LW
1579set X `for arg in "$@"; do echo "X$arg"; done |
1580 sed -e s/X// | awk -f options.awk`
2304df62
AD
1581eval "set $*"
1582shift
1583rm -f options.awk
1584
1585: set up default values
1586fastread=''
1587reuseval=false
1588config_sh=''
1589alldone=''
1590error=''
1591silent=''
1592extractsh=''
ecfc5424 1593override=''
16d20bd9 1594knowitall=''
02e93a22 1595rm -f optdef.sh posthint.sh
28757baa 1596cat >optdef.sh <<EOS
1597$startsh
1598EOS
2304df62 1599
dfe9444c 1600
2304df62
AD
1601: option parsing
1602while test $# -gt 0; do
1603 case "$1" in
1604 -d) shift; fastread=yes;;
1605 -e) shift; alldone=cont;;
1606 -f)
1607 shift
1608 cd ..
1609 if test -r "$1"; then
1610 config_sh="$1"
1611 else
a0d0e21e 1612 echo "$me: cannot read config file $1." >&2
2304df62
AD
1613 error=true
1614 fi
1615 cd UU
1616 shift;;
3f30fabf 1617 --help|\
2304df62
AD
1618 -h) shift; error=true;;
1619 -r) shift; reuseval=true;;
dfe9444c 1620 -s) shift; silent=true; realsilent=true;;
2304df62 1621 -E) shift; alldone=exit;;
16d20bd9 1622 -K) shift; knowitall=true;;
ecfc5424 1623 -O) shift; override=true;;
dfe9444c 1624 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1625 -D)
1626 shift
1627 case "$1" in
1628 *=)
1629 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1630 echo "$me: ignoring -D $1" >&2
1631 ;;
ecfc5424 1632 *=*) echo "$1" | \
1aef975c
AD
1633 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1634 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1635 esac
1636 shift
1637 ;;
1638 -U)
1639 shift
1640 case "$1" in
1aef975c 1641 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1642 *=*)
1643 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1644 echo "$me: ignoring -U $1" >&2
1645 ;;
1aef975c 1646 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1647 esac
1648 shift
1649 ;;
02e93a22
JH
1650 -A)
1651 shift
1652 xxx=''
1653 yyy="$1"
02e93a22 1654 zzz=''
5f83a3e9 1655 uuu=undef
02e93a22 1656 case "$yyy" in
f7c31117 1657 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1658 case "$zzz" in
1659 *:*) zzz='' ;;
1660 *) xxx=append
613d6c3e 1661 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
f7c31117 1662 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1663 esac
1664 ;;
1665 esac
1666 case "$xxx" in
1667 '') case "$yyy" in
f7c31117
JH
1668 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1669 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1670 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1671 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1672 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1673 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9 1674 esac
613d6c3e 1675 ;;
5f83a3e9 1676 esac
02e93a22
JH
1677 case "$xxx" in
1678 append)
5f83a3e9 1679 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1680 clear)
5f83a3e9 1681 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1682 define)
1683 case "$zzz" in
1684 '') zzz=define ;;
1685 esac
5f83a3e9 1686 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1687 eval)
5f83a3e9 1688 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1689 prepend)
5f83a3e9 1690 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1691 undef)
1692 case "$zzz" in
1693 '') zzz="$uuu" ;;
1694 esac
5f83a3e9
JH
1695 echo "$yyy=$zzz" >> posthint.sh ;;
1696 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1697 esac
bde6b06b 1698 shift
02e93a22 1699 ;;
216dac04 1700 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
5f83a3e9 1701 exit 0;;
2304df62 1702 --) break;;
a0d0e21e 1703 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1704 *) break;;
1705 esac
1706done
1707
1708case "$error" in
1709true)
1710 cat >&2 <<EOM
2afac517 1711Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1712 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1713 -d : use defaults for all answers.
1714 -e : go on without questioning past the production of config.sh.
1715 -f : specify an alternate default configuration file.
1716 -h : print this help message and exit (with an error status).
1717 -r : reuse C symbols value if possible (skips costly nm extraction).
1718 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1719 -D : define symbol to have some value:
1720 -D symbol symbol gets the value 'define'
1721 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1722 common used examples (see INSTALL for more info):
1723 -Duse64bitint use 64bit integers
b79e0b55 1724 -Duse64bitall use 64bit integers and pointers
3f30fabf 1725 -Dusethreads use thread support
b79e0b55 1726 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1727 -DEBUGGING=none DEBUGGING options
1728 -Dcc=gcc choose your compiler
1729 -Dprefix=/opt/perl5 choose your destination
2304df62 1730 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1731 -K : do not use unless you know what you are doing.
ecfc5424 1732 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1733 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1734 -U : undefine symbol:
1735 -U symbol symbol gets the value 'undef'
1736 -U symbol= symbol gets completely empty
3f30fabf 1737 e.g.: -Uversiononly
02e93a22 1738 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1739 -A append:symbol=value append value to symbol
1740 -A symbol=value like append:, but with a separating space
1741 -A define:symbol=value define symbol to have value
1742 -A clear:symbol define symbol to be ''
1743 -A define:symbol define symbol to be 'define'
1744 -A eval:symbol=value define symbol to be eval of value
1745 -A prepend:symbol=value prepend value to symbol
1746 -A undef:symbol define symbol to be 'undef'
1747 -A undef:symbol= define symbol to be ''
3f30fabf 1748 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1749 -A ccflags=-DSOME_MACRO
2304df62
AD
1750 -V : print version number and exit (with a zero status).
1751EOM
1752 exit 1
1753 ;;
1754esac
1755
dfe9444c
AD
1756: Sanity checks
1757case "$fastread$alldone" in
1758yescont|yesexit) ;;
1759*)
aaeb8e51
GS
1760 case "$extractsh" in
1761 true) ;;
1762 *)
1763 if test ! -t 0; then
1764 echo "Say 'sh Configure', not 'sh <Configure'"
1765 exit 1
1766 fi
1767 ;;
1768 esac
dfe9444c
AD
1769 ;;
1770esac
1771
2304df62
AD
1772exec 4>&1
1773case "$silent" in
1774true) exec 1>/dev/null;;
1775esac
1776
ecfc5424 1777: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1778touch optdef.sh
1779. ./optdef.sh
02e93a22
JH
1780: create the posthint manipulation script and leave the file out there...
1781touch posthint.sh
a0d0e21e 1782
2304df62 1783: set package name
34f1896b 1784package='perl5'
b4eb6b3d
JH
1785first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1786last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1787case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1788ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1789*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1790esac
2304df62 1791
2304df62
AD
1792: Some greps do not return status, grrr.
1793echo "grimblepritz" >grimble
1794if grep blurfldyick grimble >/dev/null 2>&1 ; then
1795 contains=contains
1796elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1797 contains=grep
1798else
1799 contains=contains
1800fi
1801rm -f grimble
1802: the following should work in any shell
1803case "$contains" in
1804contains*)
1805 echo " "
1806 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1807 cat >contains <<'EOSS'
1808grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1809EOSS
1810chmod +x contains
1811esac
1812
dfe9444c
AD
1813: Find the path to the source tree
1814case "$src" in
1815'') case "$0" in
b233458b
JH
1816 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1817 case "$src" in
1818 /*) ;;
8504afb7 1819 .) ;;
b233458b
JH
1820 *) src=`cd ../$src && pwd` ;;
1821 esac
1822 ;;
dfe9444c
AD
1823 *) src='.';;
1824 esac;;
1825esac
1826case "$src" in
1827'') src=/
1828 rsrc=/
1829 ;;
34f1896b
MB
1830/*) rsrc="$src";;
1831*) rsrc="../$src";;
dfe9444c
AD
1832esac
1833if test -f $rsrc/Configure && \
34f1896b 1834 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
dfe9444c
AD
1835then
1836 : found it, so we are ok.
1837else
1838 rsrc=''
1839 for src in . .. ../.. ../../.. ../../../..; do
1840 if test -f ../$src/Configure && \
1841 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1842 then
1843 rsrc=../$src
1844 break
1845 fi
1846 done
1847fi
1848case "$rsrc" in
1849'')
1850 cat <<EOM >&4
1851
1852Sorry, I can't seem to locate the source dir for $package. Please start
1853Configure with an explicit path -- i.e. /some/path/Configure.
1854
1855EOM
1856 exit 1
1857 ;;
1858../.) rsrc='..';;
1859*)
1860 echo " "
1861 echo "Sources for $package found in \"$src\"." >&4
1862 ;;
1863esac
1864
1865: script used to extract .SH files with variable substitutions
1866cat >extract <<'EOS'
a02608de 1867PERL_CONFIG_SH=true
dfe9444c 1868echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1869if test -f MANIFEST; then
1870 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1871else
1872 echo "(Looking for .SH files under the source directory.)"
6904989c 1873 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1874fi
1875shift
1876case $# in
6904989c 18770) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1878esac
6904989c 1879if test ! -f "$src/$1"; then
dfe9444c
AD
1880 shift
1881fi
1882mkdir_p='
1883name=$1;
1884create="";
1885while test $name; do
1886 if test ! -d "$name"; then
1887 create="$name $create";
1888 name=`echo $name | sed -e "s|^[^/]*$||"`;
1889 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1890 else
1891 name="";
1892 fi;
1893done;
1894for file in $create; do
1895 mkdir $file;
1896done
1897'
1898for file in $*; do
1899 case "$src" in
1900 ".")
1901 case "$file" in
1902 */*)
1903 dir=`expr X$file : 'X\(.*\)/'`
1904 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1905 (cd "$dir" && . ./$file)
dfe9444c
AD
1906 ;;
1907 *)
1908 . ./$file
1909 ;;
1910 esac
1911 ;;
1912 *)
1913 case "$file" in
1914 */*)
1915 dir=`expr X$file : 'X\(.*\)/'`
1916 file=`expr X$file : 'X.*/\(.*\)'`
1917 (set x $dir; shift; eval $mkdir_p)
6904989c 1918 sh <"$src/$dir/$file"
dfe9444c
AD
1919 ;;
1920 *)
6904989c 1921 sh <"$src/$file"
dfe9444c
AD
1922 ;;
1923 esac
1924 ;;
1925 esac
1926done
6904989c 1927if test -f "$src/config_h.SH"; then
dfe9444c
AD
1928 if test ! -f config.h; then
1929 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1930 . "$src/config_h.SH"
dfe9444c
AD
1931 fi
1932fi
1933EOS
1934
1935: extract files and exit if asked to do so
1936case "$extractsh" in
1937true)
1938 case "$realsilent" in
1939 true) ;;
1940 *) exec 1>&4;;
1941 esac
1942 case "$config_sh" in
1943 '') config_sh='config.sh';;
1944 esac
1945 echo " "
1946 echo "Fetching answers from $config_sh..."
1947 cd ..
1948 . $config_sh
1949 test "$override" && . ./optdef.sh
1950 echo " "
1951 . UU/extract
1952 rm -rf UU
24ccb310 1953 echo "Extraction done."
dfe9444c
AD
1954 exit 0
1955 ;;
1956esac
1957
1958: Eunice requires " " instead of "", can you believe it
1959echo " "
1960: Here we go...
1961echo "Beginning of configuration questions for $package."
1962
1963trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1964
2304df62
AD
1965: first determine how to suppress newline on echo command
1966echo " "
1967echo "Checking echo to see how to suppress newlines..."
1968(echo "hi there\c" ; echo " ") >.echotmp
1969if $contains c .echotmp >/dev/null 2>&1 ; then
1970 echo "...using -n."
1971 n='-n'
1972 c=''
1973else
1974 cat <<'EOM'
1975...using \c
1976EOM
1977 n=''
1978 c='\c'
1979fi
1980echo $n "The star should be here-->$c"
1981echo '*'
1982rm -f .echotmp
1983
1984: Now test for existence of everything in MANIFEST
1985echo " "
6904989c 1986if test -f "$rsrc/MANIFEST"; then
2304df62 1987 echo "First let's make sure your kit is complete. Checking..." >&4
1d8eaf8c 1988 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
776a38e3 1989 (split -l 50 2>/dev/null || split -50)
2304df62 1990 rm -f missing
dfe9444c 1991 tmppwd=`pwd`
2304df62 1992 for filelist in x??; do
776a38e3
MB
1993 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1994 >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1995 done
1996 if test -s missing; then
1997 cat missing >&4
1998 cat >&4 <<'EOM'
1999
2000THIS PACKAGE SEEMS TO BE INCOMPLETE.
2001
2002You have the option of continuing the configuration process, despite the
2003distinct possibility that your kit is damaged, by typing 'y'es. If you
2004do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 2005and contact the author (perlbug@perl.org).
2304df62
AD
2006
2007EOM
2008 echo $n "Continue? [n] $c" >&4
2009 read ans
2010 case "$ans" in
2011 y*)
2012 echo "Continuing..." >&4
2013 rm -f missing
2014 ;;
2015 *)
2016 echo "ABORTING..." >&4
2017 kill $$
2018 ;;
2019 esac
2020 else
dfe9444c 2021 echo "Looks good..."
2304df62
AD
2022 fi
2023else
2024 echo "There is no MANIFEST file. I hope your kit is complete !"
2025fi
2026rm -f missing x??
2027
5ff3f7a4 2028: Find the appropriate value for a newline for tr
613d6c3e 2029echo " "
5ff3f7a4
GS
2030if test -n "$DJGPP"; then
2031 trnl='\012'
2032fi
2033if test X"$trnl" = X; then
2034 case "`echo foo|tr '\n' x 2>/dev/null`" in
2035 foox) trnl='\n' ;;
2036 esac
2037fi
2038if test X"$trnl" = X; then
2039 case "`echo foo|tr '\012' x 2>/dev/null`" in
2040 foox) trnl='\012' ;;
2041 esac
2042fi
2043if test X"$trnl" = X; then
8be2c24c
JH
2044 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2045 fooxy) trnl='\n\r' ;;
2046 esac
2047fi
2048if test X"$trnl" = X; then
5ff3f7a4
GS
2049 cat <<EOM >&2
2050
2051$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2052
2053EOM
2054 exit 1
2055fi
2056
2304df62
AD
2057: compute the number of columns on the terminal for proper question formatting
2058case "$COLUMNS" in
2059'') COLUMNS='80';;
2060esac
2061
2062: set up the echo used in my read
2063myecho="case \"\$xxxm\" in
2064'') echo $n \"\$rp $c\" >&4;;
2065*) case \"\$rp\" in
2066 '') echo $n \"[\$xxxm] $c\";;
2067 *)
2068 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2069 echo \"\$rp\" >&4
2070 echo $n \"[\$xxxm] $c\" >&4
2071 else
2072 echo $n \"\$rp [\$xxxm] $c\" >&4
2073 fi
2074 ;;
2075 esac;;
2076esac"
2077
2078: now set up to do reads with possible shell escape and default assignment
2079cat <<EOSC >myread
28757baa 2080$startsh
2304df62
AD
2081xxxm=\$dflt
2082$myecho
2083ans='!'
2084case "\$fastread" in
2085yes) case "\$dflt" in
2086 '') ;;
2087 *) ans='';
2088 case "\$silent-\$rp" in
2089 true-) ;;
2090 *) echo " " >&4;;
2091 esac;;
2092 esac;;
2093*) case "\$silent" in
2094 true) case "\$rp" in
2095 '') ans='';;
2096 esac;;
2097 esac;;
2098esac
2099while expr "X\$ans" : "X!" >/dev/null; do
2100 read answ
2101 set x \$xxxm
2102 shift
dfe9444c 2103 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2104 case "\$answ" in
dfe9444c
AD
2105 "!")
2106 sh 1>&4
2107 echo " "
2108 $myecho
2109 ;;
2110 !*)
2111 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2112 shift
2113 sh 1>&4 -c "\$*"
2114 echo " "
2115 $myecho
2116 ;;
2304df62
AD
2117 "\$ans")
2118 case "\$ans" in
ecfc5424
AD
2119 \\&*)
2120 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2121 shift
2122 case "\$1" in
2123 -d)
2124 fastread=yes
40a7a20a 2125 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2126 ;;
2127 -*)
40a7a20a 2128 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2129 ;;
2130 esac
2131 $myecho
2132 ans=!
2133 ;;
2304df62
AD
2134 esac;;
2135 *)
2136 case "\$aok" in
2137 y)
2138 echo "*** Substitution done -- please confirm."
2139 xxxm="\$ans"
c9795ab7 2140 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2141 xxxm="\$ans"
2142 ans=!
2143 ;;
2144 *)
2145 echo "*** Error -- try again."
2146 ans=!
2147 ;;
2148 esac
2149 $myecho
2150 ;;
2151 esac
2152 case "\$ans\$xxxm\$nostick" in
2153 '')
2154 ans=!
2155 $myecho
2156 ;;
2157 esac
2158done
2159case "\$ans" in
2160'') ans="\$xxxm";;
2161esac
2162EOSC
2163
2164: create .config dir to save info across Configure sessions
2165test -d ../.config || mkdir ../.config
2166cat >../.config/README <<EOF
2167This directory created by Configure to save information that should
dfe9444c 2168persist across sessions for $package.
2304df62
AD
2169
2170You may safely delete it if you wish.
2171EOF
2172
613d6c3e 2173: See if we are using a devel version and want that
9507cadf 2174xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2175case "$usedevel" in
1be1b388
MB
2176$define|true|[yY]*)
2177 usedevel="$define" ;;
9507cadf 2178*) case "$xversion" in
0107c034
JH
2179 *[13579])
2180 cat >&4 <<EOH
2181*** WHOA THERE!!! ***
2182
2183 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2184 The version of this $package distribution is $xversion, that is, odd,
2185 (as opposed to even) and that signifies a development release.
3d5d58b1 2186 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2187
2188 Do ***NOT*** install this into production use.
2189 Data corruption and crashes are possible.
2190
2191 It is most seriously suggested that you do not continue any further
2192 unless you want to help in developing and debugging Perl.
2193
6adc6a45
JH
2194 If you *still* want to build perl, you can answer 'y' now,
2195 or pass -Dusedevel to Configure.
2196
0107c034
JH
2197EOH
2198 rp='Do you really want to continue?'
2199 dflt='n'
2200 . ./myread
2201 case "$ans" in
8feeef0e
JH
2202 [yY]) echo >&4 "Okay, continuing."
2203 usedevel="$define" ;;
0107c034
JH
2204 *) echo >&4 "Okay, bye."
2205 exit 1
2206 ;;
2207 esac
2208 ;;
2209 esac
1be1b388 2210 usedevel="$undef"
0107c034
JH
2211 ;;
2212esac
8feeef0e
JH
2213case "$usedevel" in
2214$define|true|[yY]*)
2215 case "$versiononly" in
2216 '') versiononly="$define" ;;
2217 esac
2218 case "$installusrbinperl" in
2219 '') installusrbinperl="$undef" ;;
2220 esac
2221 ;;
2222esac
0107c034 2223
2304df62
AD
2224: general instructions
2225needman=true
2226firsttime=true
760ac839 2227user=`(logname) 2>/dev/null`
dfe9444c
AD
2228case "$user" in
2229'') user=`whoami 2>&1`;;
760ac839 2230esac
2304df62
AD
2231if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2232 firsttime=false
2233 echo " "
2234 rp='Would you like to see the instructions?'
2235 dflt=n
2236 . ./myread
2237 case "$ans" in
2238 [yY]*) ;;
2239 *) needman=false;;
2240 esac
2241fi
2242if $needman; then
2243 cat <<EOH
4e2a5f63 2244
2304df62 2245This installation shell script will examine your system and ask you questions
a0d0e21e 2246to determine how the perl5 package should be installed. If you get
2304df62
AD
2247stuck on a question, you may use a ! shell escape to start a subshell or
2248execute a command. Many of the questions will have default answers in square
2249brackets; typing carriage return will give you the default.
2250
2251On some of the questions which ask for file or directory names you are allowed
2252to use the ~name construct to specify the login directory belonging to "name",
2253even if you don't have a shell which knows about that. Questions where this is
2254allowed will be marked "(~name ok)".
2255
2256EOH
2257 rp=''
2258 dflt='Type carriage return to continue'
2259 . ./myread
2260 cat <<'EOH'
2261
2262The prompter used in this script allows you to use shell variables and
2263backticks in your answers. You may use $1, $2, etc... to refer to the words
2264in the default answer, as if the default line was a set of arguments given to a
2265script shell. This means you may also use $* to repeat the whole default line,
2266so you do not have to re-type everything to add something to the default.
2267
cd95ead5 2268Every time there is a substitution, you will have to confirm. If there is an
2304df62
AD
2269error (e.g. an unmatched backtick), the default answer will remain unchanged
2270and you will be prompted again.
2271
2272If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2273the questions and use the computed defaults (or the previous answers if there
2274was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2275You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2276on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2277
2278EOH
2279 . ./myread
2280 cat <<EOH
2281
2282Much effort has been expended to ensure that this shell script will run on any
2283Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2284Configure and run it again. If you can't run Configure for some reason,
2285you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2286have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2287
2288This installation script affects things in two ways:
2289
22901) it may do direct variable substitutions on some of the files included
2291 in this kit.
22922) it builds a config.h file for inclusion in C programs. You may edit
2293 any of these files as the need arises after running this script.
2294
2295If you make a mistake on a question, there is no easy way to back up to it
2296currently. The easiest thing to do is to edit config.sh and rerun all the SH
2297files. Configure will offer to let you do this before it runs the SH files.
2298
2299EOH
2300 dflt='Type carriage return to continue'
2301 . ./myread
2302 case "$firsttime" in
2303 true) echo $user >>../.config/instruct;;
2304 esac
2305fi
2306
2304df62
AD
2307: find out where common programs are
2308echo " "
2309echo "Locating common programs..." >&4
2310cat <<EOSC >loc
2311$startsh
2312case \$# in
23130) exit 1;;
2314esac
2315thing=\$1
2316shift
2317dflt=\$1
2318shift
2319for dir in \$*; do
2320 case "\$thing" in
2321 .)
2322 if test -d \$dir/\$thing; then
2323 echo \$dir
2324 exit 0
2325 fi
2326 ;;
2327 *)
a0d0e21e 2328 for thisthing in \$dir/\$thing; do
ecfc5424 2329 : just loop through to pick last item
a0d0e21e 2330 done
25f94b33 2331 if test -f \$thisthing; then
a0d0e21e 2332 echo \$thisthing
2304df62 2333 exit 0
a5a94ea5
JH
2334 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2335 echo \$thisthing
776a38e3 2336 exit 0
2304df62 2337 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2338 if test -n "$DJGPP"; then
2339 echo \$dir/\$thing.exe
b921d661 2340 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2341 : on Eunice apparently
2342 echo \$dir/\$thing
2343 fi
2d736872 2344 exit 0
2304df62
AD
2345 fi
2346 ;;
2347 esac
2348done
2349echo \$dflt
2350exit 1
2351EOSC
2352chmod +x loc
2353$eunicefix loc
2354loclist="
2355awk
2356cat
f8006fac 2357chmod
b4eb6b3d
JH
2358comm
2359cp
2304df62
AD
2360echo
2361expr
2362grep
a0d0e21e 2363ls
b4eb6b3d 2364mkdir
2304df62
AD
2365rm
2366sed
b4eb6b3d 2367sort
85e6fe83 2368touch
2304df62 2369tr
b4eb6b3d 2370uniq
2304df62
AD
2371"
2372trylist="
dfe9444c 2373ar
3659ebf1 2374bison
b4eb6b3d 2375byacc
2304df62 2376cpp
b4eb6b3d 2377csh
2304df62
AD
2378date
2379egrep
1fef16b3 2380gmake
8ff267be 2381gzip
b4eb6b3d 2382less
8ff267be 2383ln
3c728e00 2384make
b4eb6b3d 2385more
693762b4 2386nm
b4eb6b3d 2387nroff
b8677e3b 2388perl
b4eb6b3d 2389pg
2304df62
AD
2390test
2391uname
8ff267be 2392zip
2304df62 2393"
8e07c86e 2394pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2395pth="$pth /lib /usr/lib"
2396for file in $loclist; do
dfe9444c
AD
2397 eval xxx=\$$file
2398 case "$xxx" in
2399 /*|?:[\\/]*)
2400 if test -f "$xxx"; then
2401 : ok
2402 else
2403 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2404 xxx=`./loc $file $file $pth`
2405 fi
2406 ;;
2407 '') xxx=`./loc $file $file $pth`;;
2408 *) xxx=`./loc $xxx $xxx $pth`;;
2409 esac
a5a94ea5 2410 eval $file=$xxx$_exe
2304df62
AD
2411 eval _$file=$xxx
2412 case "$xxx" in
2413 /*)
2414 echo $file is in $xxx.
2415 ;;
8e07c86e
AD
2416 ?:[\\/]*)
2417 echo $file is in $xxx.
2418 ;;
2304df62 2419 *)
25f94b33
AD
2420 echo "I don't know where '$file' is, and my life depends on it." >&4
2421 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2422 exit 1
2304df62
AD
2423 ;;
2424 esac
2425done
2426echo " "
2427echo "Don't worry if any of the following aren't found..."
2428say=offhand
2429for file in $trylist; do
dfe9444c
AD
2430 eval xxx=\$$file
2431 case "$xxx" in
2432 /*|?:[\\/]*)
2433 if test -f "$xxx"; then
2434 : ok
2435 else
2436 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2437 xxx=`./loc $file $file $pth`
2438 fi
2439 ;;
2440 '') xxx=`./loc $file $file $pth`;;
2441 *) xxx=`./loc $xxx $xxx $pth`;;
2442 esac
306a8474 2443 eval $file=$xxx$_exe
2304df62
AD
2444 eval _$file=$xxx
2445 case "$xxx" in
2446 /*)
2447 echo $file is in $xxx.
2448 ;;
8e07c86e
AD
2449 ?:[\\/]*)
2450 echo $file is in $xxx.
2451 ;;
2304df62
AD
2452 *)
2453 echo "I don't see $file out there, $say."
2454 say=either
2455 ;;
2456 esac
2457done
2458case "$egrep" in
1fef16b3 2459egrep)
2304df62
AD
2460 echo "Substituting grep for egrep."
2461 egrep=$grep
868439a2 2462 _egrep=$grep
2304df62
AD
2463 ;;
2464esac
3141af47
MB
2465case "$less" in
2466'') ;;
2467*) if $less -R </dev/null >/dev/null; then
2468 echo "Substituting less -R for less."
2469 less="$less -R"
2470 _less=$less
2471 fi
2472 ;;
2473esac
8ff267be 2474case "$ln" in
1fef16b3 2475ln)
8ff267be 2476 echo "Substituting cp for ln."
2477 ln=$cp
868439a2 2478 _ln=$cp
8ff267be 2479 ;;
2480esac
2e26f1d5 2481case "$make" in
613d6c3e 2482make)
2e26f1d5
JH
2483 case "$gmake" in
2484 gmake)
2485 echo "I can't find make or gmake, and my life depends on it." >&4
2486 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2487 exit 1
2488 ;;
2489 esac
2490 ;;
613d6c3e 2491esac
2e26f1d5
JH
2492case "$gmake" in
2493gmake) ;;
2494*) # We can't have osname yet.
1fef16b3
JH
2495 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2496 # Assume that gmake, if found, is definitely GNU make
2497 # and prefer it over the system make.
2498 echo "Substituting gmake for make."
2499 make=$gmake
868439a2 2500 _make=$gmake
1fef16b3
JH
2501 fi
2502 ;;
a5a94ea5 2503esac
2304df62
AD
2504case "$test" in
2505test)
2506 echo "Hopefully test is built into your sh."
2507 ;;
2508*)
73614538 2509 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2510 echo "Using the test built into your sh."
2304df62
AD
2511 test=test
2512 _test=test
2513 fi
2514 ;;
2515esac
2516case "$echo" in
2517echo)
2518 echo "Hopefully echo is built into your sh."
2519 ;;
2520'') ;;
2521*)
2522 echo " "
2523echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2524 $echo $n "hi there$c" >foo1
2525 echo $n "hi there$c" >foo2
2526 if cmp foo1 foo2 >/dev/null 2>&1; then
2527 echo "They are compatible. In fact, they may be identical."
2528 else
2529 case "$n" in
2530 '-n') n='' c='\c';;
2531 *) n='-n' c='';;
2532 esac
2533 cat <<FOO
2534They are not compatible! You are probably running ksh on a non-USG system.
2535I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2536have echo built in and we may have to run some Bourne shell scripts. That
2537means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2538
2539FOO
2540 $echo $n "The star should be here-->$c"
2541 $echo "*"
2542 fi
2543 $rm -f foo1 foo2
2544 ;;
2545esac
2546
2f88d857
MB
2547# This question was auctioned at YAPC::Europe-2007 in Vienna
2548# I never promised you could answer it. I only auctioned the question.
2549cat <<FOO
2550The following message is sponsored by
2551
2552 Dresden.pm<--The stars should be here.
2553
2554Dear Perl user, system administrator or package
2555maintainer, the Perl community sends greetings to
2556you. Do you (emblematical) greet back [Y/n]? n
2557
2558FOO
2559
613d6c3e 2560: Check what type of C compiler we use
6b769f8f 2561cat <<EOS >trygcc
2573c5f9
JH
2562$startsh
2563EOS
6b769f8f 2564cat <<'EOSC' >>trygcc
2573c5f9
JH
2565case "$cc" in
2566'') ;;
2567*) $rm -f try try.*
2568 $cat >try.c <<EOM
2569int main(int argc, char *argv[]) {
2570 return 0;
2571}
2572EOM
e4778687 2573 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2574 :
2575 else
2576 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2577 despair=yes
2578 trygcc=yes
2579 case "$cc" in
2580 *gcc*) trygcc=no ;;
2581 esac
dce40316
AD
2582 # Skip this test because it gives a false match on output like:
2583 # ./trygcc: line 23: cc: command not found
2584 # case "`$cc -v -c try.c 2>&1`" in
2585 # *gcc*) trygcc=no ;;
2586 # esac
2573c5f9
JH
2587 if $test X"$trygcc" = Xyes; then
2588 if gcc -o try -c try.c; then
2589 echo " "
2590 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2591 # Switching compilers may undo the work of hints files.
2592 # The most common problem is -D_REENTRANT for threads.
2593 # This heuristic catches that case, but gets false positives
2594 # if -Dusethreads was not actually specified. Better to
2595 # bail out here with a useful message than fail
2596 # mysteriously later. Should we perhaps just try to
2597 # re-invoke Configure -Dcc=gcc config_args ?
2598 if $test -f usethreads.cbu; then
2599 $cat >&4 <<EOM
2600
2601*** However, any setting of the C compiler flags (e.g. for thread support)
2602*** will be lost. It may be necessary for you to restart Configure and
2603*** add -Dcc=gcc to your Configure command line.
2604
2605EOM
2606 rp="Would you like to go ahead and try gcc anyway?"
2607 dflt=n
2608 else
2609 rp="Would you like to use it?"
2610 dflt=y
2611 fi
2573c5f9
JH
2612 if $test -f myread; then
2613 . ./myread
2614 else
2615 if $test -f UU/myread; then
2616 . ./UU/myread
2617 else
2618 echo "Cannot find myread, sorry. Aborting." >&2
2619 exit 1
2620 fi
2621 fi
2622 case "$ans" in
6371411c 2623 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2624 esac
2625 fi
2626 fi
6b769f8f
RB
2627 fi
2628 $rm -f try try.*
2629 ;;
2630esac
2631EOSC
2632
2633cat <<EOS >checkcc
2634$startsh
2635EOS
2636cat <<'EOSC' >>checkcc
2637case "$cc" in
2638'') ;;
2639*) $rm -f try try.*
2640 $cat >try.c <<EOM
2641int main(int argc, char *argv[]) {
2642 return 0;
2643}
2644EOM
2645 if $cc -o try $ccflags $ldflags try.c; then
2646 :
2647 else
2573c5f9 2648 if $test X"$despair" = Xyes; then
6b769f8f
RB
2649 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2650 fi
2651 $cat >&4 <<EOM
5dd4fbdf
MB
2652You need to find a working C compiler.
2653Either (purchase and) install the C compiler supplied by your OS vendor,
2654or for a free C compiler try http://gcc.gnu.org/
2655I cannot continue any further, aborting.
2656EOM
6b769f8f 2657 exit 1
2573c5f9
JH
2658 fi
2659 $rm -f try try.*
2660 ;;
2661esac
2662EOSC
2663
a0d0e21e
LW
2664: determine whether symbolic links are supported
2665echo " "
2666$touch blurfl
2667if $ln -s blurfl sym > /dev/null 2>&1 ; then
2668 echo "Symbolic links are supported." >&4
818f00be 2669 lns="$ln -s"
a0d0e21e
LW
2670else
2671 echo "Symbolic links are NOT supported." >&4
2672 lns="$ln"
2673fi
2674$rm -f blurfl sym
2675
dafca956
JH
2676: determine whether symbolic links are supported
2677echo " "
2678case "$lns" in
18ea2752 2679*"ln"*" -s")
dafca956
JH
2680 echo "Checking how to test for symbolic links..." >&4
2681 $lns blurfl sym
4b661809 2682 if $test "X$issymlink" = X; then
2e2a97a6
JH
2683 case "$newsh" in
2684 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2685 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2686 esac
5d644a95
MB
2687 if test $? = 0; then
2688 issymlink="test -h"
2e2a97a6
JH
2689 else
2690 echo "Your builtin 'test -h' may be broken." >&4
2691 case "$test" in
2692 /*) ;;
2693 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2694 for p in $pth
2695 do
2696 if test -f "$p/$test"; then
2697 test="$p/$test"
2698 break
2699 fi
2700 done
2701 ;;
2702 esac
2703 case "$test" in
2704 /*)
2705 echo "Trying external '$test -h'." >&4
2706 issymlink="$test -h"
2707 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2708 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2709 issymlink=''
2710 fi
2711 ;;
2712 *) issymlink='' ;;
2713 esac
5d644a95
MB
2714 fi
2715 fi
4b661809 2716 if $test "X$issymlink" = X; then
dafca956 2717 if $test -L sym 2>/dev/null; then
5d644a95 2718 issymlink="$test -L"
2e2a97a6 2719 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2720 fi
2721 fi
4b661809 2722 if $test "X$issymlink" != X; then
5d644a95 2723 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2724 else
2725 echo "I do not know how you can test for symbolic links." >&4
2726 fi
2727 $rm -f blurfl sym
2728 ;;
2729*) echo "No symbolic links, so not testing for their testing..." >&4
2730 ;;
2731esac
2732echo " "
2733
34f1896b 2734: Make symlinks util
dafca956
JH
2735case "$mksymlinks" in
2736$define|true|[yY]*)
2737 case "$src" in
2738 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2739 exit 1
2740 ;;
4b661809 2741 *) case "$lns:$issymlink" in
f314eb9f 2742 *"ln"*" -s:"*"test -"?)
dafca956
JH
2743 echo "Creating the symbolic links..." >&4
2744 echo "(First creating the subdirectories...)" >&4
2745 cd ..
2746 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2747 read directory
2748 test -z "$directory" && break
2749 mkdir -p $directory
2750 done
2751 # Sanity check 1.
2752 if test ! -d t/base; then
2753 echo "Failed to create the subdirectories. Aborting." >&4
2754 exit 1
2755 fi
2756 echo "(Then creating the symlinks...)" >&4
2757 awk '{print $1}' $src/MANIFEST | while true; do
2758 read filename
2759 test -z "$filename" && break
2760 if test -f $filename; then
5d644a95 2761 if $issymlink $filename; then
dafca956
JH
2762 rm -f $filename
2763 fi
2764 fi
2765 if test -f $filename; then
2766 echo "$filename already exists, not symlinking."
2767 else
2768 ln -s $src/$filename $filename
2769 fi
2770 done
2771 # Sanity check 2.
a0d24b8a
JH
2772 if test ! -f t/base/lex.t; then
2773 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2774 exit 1
2775 fi
2776 cd UU
2777 ;;
2778 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2779 ;;
2780 esac
2781 ;;
2782 esac
2783 ;;
2784esac
2785
613d6c3e 2786: Check for Cross-Compilation
5440bc8e
JH
2787case "$usecrosscompile" in
2788$define|true|[yY]*)
93bc48fa 2789 $echo "Cross-compiling..."
5440bc8e
JH
2790 croak=''
2791 case "$cc" in
2792 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2793 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2794 ar=$targetarch-ar
2795 # leave out ld, choosing it is more complex
2796 nm=$targetarch-nm
2797 ranlib=$targetarch-ranlib
93bc48fa 2798 $echo 'extern int foo;' > try.c
f8006fac 2799 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2800 shift
2801 if $test $# -gt 0; then
2802 incpth="$incpth $*"
f8006fac
JH
2803 incpth="`$echo $incpth|$sed 's/^ //'`"
2804 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2805 for i in $*; do
f8006fac 2806 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2807 if $test -d $j; then
2808 libpth="$libpth $j"
2809 fi
2810 done
f8006fac
JH
2811 libpth="`$echo $libpth|$sed 's/^ //'`"
2812 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2813 fi
2814 $rm -f try.c
5440bc8e
JH
2815 ;;
2816 esac
2817 case "$targetarch" in
93bc48fa
JH
2818 '') echo "Targetarch not defined." >&4; croak=y ;;
2819 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2820 esac
2821 case "$incpth" in
93bc48fa 2822 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2823 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2824 esac
2825 case "$libpth" in
93bc48fa 2826 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2827 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2828 esac
93bc48fa
JH
2829 case "$usrinc" in
2830 '') for i in $incpth; do
2831 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2832 usrinc=$i
2833 echo "Guessing usrinc $usrinc." >&4
2834 break
2835 fi
2836 done
2837 case "$usrinc" in
2838 '') echo "Usrinc not defined." >&4; croak=y ;;
2839 esac
2840 ;;
2841 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2842 esac
93bc48fa
JH
2843 case "$targethost" in
2844 '') echo "Targethost not defined." >&4; croak=y ;;
2845 *) echo "Using targethost $targethost." >&4
5440bc8e 2846 esac
93bc48fa
JH
2847 locincpth=' '
2848 loclibpth=' '
5440bc8e 2849 case "$croak" in
93bc48fa 2850 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2851 esac
2852 case "$src" in
2853 /*) run=$src/Cross/run
93c0359c 2854 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2855 to=$src/Cross/to
2856 from=$src/Cross/from
2857 ;;
93bc48fa 2858 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2859 run=$pwd/Cross/run
f8006fac 2860 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2861 to=$pwd/Cross/to
2862 from=$pwd/Cross/from
2863 ;;
2864 esac
2865 case "$targetrun" in
2866 '') targetrun=ssh ;;
2867 esac
2868 case "$targetto" in
2869 '') targetto=scp ;;
2870 esac
2871 case "$targetfrom" in
2872 '') targetfrom=scp ;;
2873 esac
2874 run=$run-$targetrun
2875 to=$to-$targetto
2876 from=$from-$targetfrom
93bc48fa
JH
2877 case "$targetdir" in
2878 '') targetdir=/tmp
2879 echo "Guessing targetdir $targetdir." >&4
2880 ;;
2881 esac
5440bc8e 2882 case "$targetuser" in
93bc48fa
JH
2883 '') targetuser=root
2884 echo "Guessing targetuser $targetuser." >&4
2885 ;;
5440bc8e
JH
2886 esac
2887 case "$targetfrom" in
2888 scp) q=-q ;;
2889 *) q='' ;;
2890 esac
2891 case "$targetrun" in
2892 ssh|rsh)
2893 cat >$run <<EOF
2894#!/bin/sh
93c0359c
JH
2895case "\$1" in
2896-cwd)
2897 shift
2898 cwd=\$1
2899 shift
2900 ;;
2901esac
2902case "\$cwd" in
2903'') cwd=$targetdir ;;
2904esac
5440bc8e
JH
2905exe=\$1
2906shift
93c0359c
JH
2907if $test ! -f \$exe.xok; then
2908 $to \$exe
2909 $touch \$exe.xok
2910fi
2911$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2912EOF
2913 ;;
93bc48fa 2914 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2915 exit 1
2916 ;;
2917 esac
93c0359c
JH
2918 case "$targetmkdir" in
2919 */Cross/mkdir)
2920 cat >$targetmkdir <<EOF
2921#!/bin/sh
2922$targetrun -l $targetuser $targethost "mkdir -p \$@"
2923EOF
f8006fac 2924 $chmod a+rx $targetmkdir
93c0359c
JH
2925 ;;
2926 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2927 exit 1
2928 ;;
2929 esac
5440bc8e
JH
2930 case "$targetto" in
2931 scp|rcp)
2932 cat >$to <<EOF
2933#!/bin/sh
2934for f in \$@
2935do
93c0359c
JH
2936 case "\$f" in
2937 /*)
2938 $targetmkdir \`dirname \$f\`
2939 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2940 ;;
2941 *)
2942 $targetmkdir $targetdir/\`dirname \$f\`
2943 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2944 ;;
2945 esac
5440bc8e
JH
2946done
2947exit 0
2948EOF
2949 ;;
2950 cp) cat >$to <<EOF
2951#!/bin/sh
93c0359c
JH
2952for f in \$@
2953do
2954 case "\$f" in
2955 /*)
2956 $mkdir -p $targetdir/\`dirname \$f\`
2957 $cp \$f $targetdir/\$f || exit 1
2958 ;;
2959 *)
2960 $targetmkdir $targetdir/\`dirname \$f\`
2961 $cp \$f $targetdir/\$f || exit 1
2962 ;;
2963 esac
2964done
2965exit 0
5440bc8e
JH
2966EOF
2967 ;;
93bc48fa 2968 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2969 exit 1
2970 ;;
2971 esac
2972 case "$targetfrom" in
2973 scp|rcp)
2974 cat >$from <<EOF
2975#!/bin/sh
2976for f in \$@
2977do
93c0359c 2978 $rm -f \$f
5440bc8e
JH
2979 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2980done
2981exit 0
2982EOF
2983 ;;
2984 cp) cat >$from <<EOF
2985#!/bin/sh
2986for f in \$@
2987do
93c0359c 2988 $rm -f \$f
5440bc8e
JH
2989 cp $targetdir/\$f . || exit 1
2990done
2991exit 0
2992EOF
2993 ;;
93bc48fa 2994 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2995 exit 1
2996 ;;
2997 esac
93bc48fa
JH
2998 if $test ! -f $run; then
2999 echo "Target 'run' script '$run' not found." >&4
5440bc8e 3000 else
f8006fac 3001 $chmod a+rx $run
5440bc8e 3002 fi
93bc48fa
JH
3003 if $test ! -f $to; then
3004 echo "Target 'to' script '$to' not found." >&4
5440bc8e 3005 else
f8006fac 3006 $chmod a+rx $to
5440bc8e 3007 fi
93bc48fa
JH
3008 if $test ! -f $from; then
3009 echo "Target 'from' script '$from' not found." >&4
5440bc8e 3010 else
f8006fac 3011 $chmod a+rx $from
5440bc8e 3012 fi
93bc48fa 3013 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
3014 exit 1
3015 fi
3016 cat >&4 <<EOF
f8006fac
JH
3017Using '$run' for remote execution,
3018and '$from' and '$to'
93bc48fa 3019for remote file transfer.
5440bc8e
JH
3020EOF
3021 ;;
3022*) run=''
3023 to=:
3024 from=:
3025 usecrosscompile='undef'
3026 targetarch=''
3027 ;;
3028esac
3029
ecfc5424
AD
3030: see whether [:lower:] and [:upper:] are supported character classes
3031echo " "
ecfc5424
AD
3032case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3033ABYZ)
3034 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3035 up='[:upper:]'
3036 low='[:lower:]'
3037 ;;
416d0bea
MB
3038*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3039 # (0xd9 and 0xe2), therefore that is a nice testing point.
3040 if test "X$up" = X -o "X$low" = X; then
3041 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3042 rs) up='[A-Z]'
3043 low='[a-z]'
28e8609d
JH
3044 ;;
3045 esac
416d0bea 3046 fi
28e8609d 3047 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3048 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3049 rs) up='A-Z'
28e8609d
JH
3050 low='a-z'
3051 ;;
3052 esac
416d0bea 3053 fi
28e8609d 3054 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3055 case "`echo RS | od -x 2>/dev/null`" in
3056 *D9E2*|*d9e2*)
28e8609d
JH
3057 echo "Hey, this might be EBCDIC." >&4
3058 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3059 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3060 rs) up='[A-IJ-RS-Z]'
3061 low='[a-ij-rs-z]'
28e8609d
JH
3062 ;;
3063 esac
3064 fi
3065 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3066 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3067 rs) up='A-IJ-RS-Z'
3068 low='a-ij-rs-z'
28e8609d
JH
3069 ;;
3070 esac
3071 fi
3072 ;;
3073 esac
3074 fi
3075esac
416d0bea
MB
3076case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3077rs)
28e8609d
JH
3078 echo "Using $up and $low to convert case." >&4
3079 ;;
ecfc5424 3080*)
28e8609d
JH
3081 echo "I don't know how to translate letters from upper to lower case." >&4
3082 echo "Your tr is not acting any way I know of." >&4
3083 exit 1
3084 ;;
ecfc5424
AD
3085esac
3086: set up the translation script tr, must be called with ./tr of course
3087cat >tr <<EOSC
3088$startsh
3089case "\$1\$2" in
3090'[A-Z][a-z]') exec $tr '$up' '$low';;
3091'[a-z][A-Z]') exec $tr '$low' '$up';;
3092esac
3093exec $tr "\$@"
3094EOSC
3095chmod +x tr
3096$eunicefix tr
3097
2304df62
AD
3098: Try to determine whether config.sh was made on this system
3099case "$config_sh" in
3100'')
43999f95
JH
3101myuname=`$uname -a 2>/dev/null`
3102$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3103# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3104# because the A-Z/a-z are not consecutive.
34e09935 3105myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3eaeeeae 3106 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3107newmyuname="$myuname"
2304df62 3108dflt=n
16d20bd9
AD
3109case "$knowitall" in
3110'')
3111 if test -f ../config.sh; then
3112 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3113 eval "`grep myuname= ../config.sh`"
3114 fi
3115 if test "X$myuname" = "X$newmyuname"; then
3116 dflt=y
3117 fi
2304df62 3118 fi
16d20bd9
AD
3119 ;;
3120*) dflt=y;;
3121esac
2304df62
AD
3122
3123: Get old answers from old config file if Configure was run on the
3124: same system, otherwise use the hints.
3125hint=default
3126cd ..
3127if test -f config.sh; then
16d20bd9
AD
3128 echo " "
3129 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3130 . UU/myread
3131 case "$ans" in
f83701cd
AD
3132 n*|N*) echo "OK, I'll ignore it."
3133 mv config.sh config.sh.old
3134 myuname="$newmyuname"
3135 ;;
2304df62 3136 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3137 tmp_n="$n"
3138 tmp_c="$c"
85cad39c 3139 tmp_sh="$sh"
2304df62
AD
3140 . ./config.sh
3141 cp config.sh UU
ecfc5424
AD
3142 n="$tmp_n"
3143 c="$tmp_c"
85cad39c 3144 : Older versions did not always set $sh. Catch re-use of such
3145 : an old config.sh.
3146 case "$sh" in
3147 '') sh="$tmp_sh" ;;
3148 esac
2304df62
AD
3149 hint=previous
3150 ;;
3151 esac
3152fi
2573c5f9 3153. ./UU/checkcc
2304df62
AD
3154if test ! -f config.sh; then
3155 $cat <<EOM
3156
4e2a5f63
AD
3157First time through, eh? I have some defaults handy for some systems
3158that need some extra help getting the Configure answers right:
2304df62
AD
3159
3160EOM
dfe9444c 3161 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3162 dflt=''
3163 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3164 : tests or hints, please send them to perlbug@perl.org
2304df62 3165 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3166 $test -f /irix && osname=irix
85e6fe83
LW
3167 $test -f /xenix && osname=sco_xenix
3168 $test -f /dynix && osname=dynix
3169 $test -f /dnix && osname=dnix
5f05dabc 3170 $test -f /lynx.os && osname=lynxos
3171 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3172 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3173 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3174 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3175 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3176 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3177 $test -d /usr/apollo/bin && osname=apollo
3178 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3179 $test -d /usr/include/minix && osname=minix
d54344fc 3180 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3181 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3182 osname=machten
4633a7c4 3183 if $test -x /sbin/version; then
dfe9444c 3184 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3185 $sed -e 's/[A-Za-z]$//'`
3186 elif $test -x /usr/etc/version; then
dfe9444c 3187 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3188 $sed -e 's/[A-Za-z]$//'`
3189 else
3190 osvers="$2.$3"
3191 fi
3192 fi
aaacdc8b
GS
3193
3194 $test -f /sys/posix.dll &&
3195 $test -f /usr/bin/what &&
3196 set X `/usr/bin/what /sys/posix.dll` &&
3197 $test "$3" = UWIN &&
3198 osname=uwin &&
3199 osvers="$5"
3200
2304df62
AD
3201 if $test -f $uname; then
3202 set X $myuname
3203 shift
3204
2304df62 3205 case "$5" in
85e6fe83 3206 fps*) osname=fps ;;
2304df62
AD
3207 mips*)
3208 case "$4" in
85e6fe83
LW
3209 umips) osname=umips ;;
3210 *) osname=mips ;;
2304df62 3211 esac;;
85e6fe83
LW
3212 [23]100) osname=mips ;;
3213 next*) osname=next ;;
ecfc5424 3214 i386*)
c6912327
JH
3215 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3216 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3217 osname='sco'
3218 osvers=$tmp
3219 elif $test -f /etc/kconfig; then
ecfc5424 3220 osname=isc
bd628c73 3221 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3222 osvers=4
3223 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3224 osvers=3
2304df62 3225 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3226 osvers=2
ecfc5424
AD
3227 fi
3228 fi
2000072c 3229 tmp=''
ecfc5424 3230 ;;
c4f23d77
AD
3231 pc*)
3232 if test -n "$DJGPP"; then
3233 osname=dos
3234 osvers=djgpp
3235 fi
3236 ;;
2304df62
AD
3237 esac
3238
3239 case "$1" in
a0d0e21e
LW
3240 aix) osname=aix
3241 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3242 case "$tmp" in
e81c5c2a
NC
3243 # oslevel can fail with:
3244 # oslevel: Unable to acquire lock.
3245 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3246 '<3240'|'<>3240') osvers=3.2.0 ;;
3247 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3248 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3249 *) osvers=$tmp;;
a0d0e21e
LW
3250 esac
3251 ;;
aaacdc8b
GS
3252 bsd386) osname=bsd386
3253 osvers=`$uname -r`
3254 ;;
3255 cygwin*) osname=cygwin
3256 osvers="$3"
3257 ;;
23f87696
SZ
3258 *dc.osx) osname=dcosx
3259 osvers="$3"
3260 ;;
a0d0e21e
LW
3261 dnix) osname=dnix
3262 osvers="$3"
3263 ;;
3264 domainos) osname=apollo
3265 osvers="$3"
3266 ;;
a774dfe6
RSG
3267 dgux) osname=dgux
3268 osvers="$3"
3269 ;;
3270 dragonfly) osname=dragonfly
a0d0e21e
LW
3271 osvers="$3"
3272 ;;
760ac839 3273 dynixptx*) osname=dynixptx
e58e581d 3274 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3275 ;;
a774dfe6 3276 freebsd) osname=freebsd
a0d0e21e 3277 osvers="$3" ;;
761ee4e8
BD
3278 genix) osname=genix ;;
3279 gnu) osname=gnu
3280 osvers="$3" ;;
a774dfe6 3281 hp*) osname=hpux
bfb7748a 3282 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3283 ;;
761ee4e8 3284 irix*) osname=irix
a0d0e21e
LW
3285 case "$3" in
3286 4*) osvers=4 ;;
3287 5*) osvers=5 ;;
ecfc5424 3288 *) osvers="$3" ;;
a0d0e21e
LW
3289 esac
3290 ;;
761ee4e8 3291 linux) osname=linux
a0d0e21e 3292 case "$3" in
a0d0e21e
LW
3293 *) osvers="$3" ;;
3294 esac
3295 ;;
761ee4e8 3296 MiNT) osname=mint
28e8609d
JH
3297 ;;
3298 netbsd*) osname=netbsd
ecfc5424
AD
3299 osvers="$3"
3300 ;;
4e81affe
MM
3301 news-os) osvers="$3"
3302 case "$3" in
3303 4*) osname=newsos4 ;;
3304 *) osname=newsos ;;
3305 esac
3306 ;;
aaacdc8b 3307 next*) osname=next ;;
28bb1e2c 3308 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3309 openbsd) osname=openbsd
3310 osvers="$3"
3311 ;;
5c728af0
IZ
3312 os2) osname=os2
3313 osvers="$4"
3314 ;;
aaacdc8b
GS
3315 POSIX-BC | posix-bc ) osname=posix-bc
3316 osvers="$3"
a0d0e21e 3317 ;;
ae3afa4e
TH
3318 powerux | power_ux | powermax_os | powermaxos | \
3319 powerunix | power_unix) osname=powerux
3320 osvers="$3"
3321 ;;
aaacdc8b
GS
3322 qnx) osname=qnx
3323 osvers="$4"
3324 ;;
a0d0e21e
LW
3325 solaris) osname=solaris
3326 case "$3" in
3327 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3328 *) osvers="$3" ;;
a0d0e21e
LW
3329 esac
3330 ;;
85e6fe83
LW
3331 sunos) osname=sunos
3332 case "$3" in
85e6fe83
LW
3333 5*) osname=solaris
3334 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3335 *) osvers="$3" ;;
2304df62
AD
3336 esac
3337 ;;
a0d0e21e 3338 titanos) osname=titanos
85e6fe83 3339 case "$3" in
a0d0e21e
LW
3340 1*) osvers=1 ;;
3341 2*) osvers=2 ;;
3342 3*) osvers=3 ;;
3343 4*) osvers=4 ;;
ecfc5424 3344 *) osvers="$3" ;;
2304df62
AD
3345 esac
3346 ;;
85e6fe83 3347 ultrix) osname=ultrix
ecfc5424 3348 osvers="$3"
2304df62 3349 ;;
28757baa 3350 osf1|mls+) case "$5" in
fed7345c
AD
3351 alpha)
3352 osname=dec_osf
fdd85a03 3353 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3354 case "$osvers" in
3355 [1-9].[0-9]*) ;;
3356 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3357 esac
ecfc5424
AD
3358 ;;
3359 hp*) osname=hp_osf1 ;;
3360 mips) osname=mips_osf1 ;;
85e6fe83
LW
3361 esac
3362 ;;
af1ff193 3363 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3364 openunix|unixware) osname=svr5
0337d152
BG
3365 osvers="$4"
3366 ;;
3c728e00 3367 uts) osname=uts
a0d0e21e
LW
3368 osvers="$3"
3369 ;;
3c728e00
JH
3370 vos) osvers="$3"
3371 ;;
85e6fe83 3372 $2) case "$osname" in
2304df62 3373 *isc*) ;;
a0d0e21e 3374 *freebsd*) ;;
5f05dabc 3375 svr*)
a0d0e21e 3376 : svr4.x or possibly later
a774dfe6 3377 case "svr$3" in
a0d0e21e
LW
3378 ${osname}*)
3379 osname=svr$3
3380 osvers=$4
3381 ;;
3382 esac
3383 case "$osname" in
3384 svr4.0)
3385 : Check for ESIX
3386 if test -f /stand/boot ; then
3387 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3388 if test -n "$INITPROG" -a -f "$INITPROG"; then
3389 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3390 if test -n "$isesix"; then
a0d0e21e
LW
3391 osname=esix4
3392 fi
3393 fi
3394 fi
3395 ;;
3396 esac
3397 ;;
2304df62 3398 *) if test -f /etc/systemid; then
a0d0e21e
LW
3399 osname=sco
3400 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3401 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3402 osvers=$1.$2.$3
c4f23d77 3403 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3404 osvers=$1.$2
c4f23d77 3405 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3406 osvers=$1
2304df62 3407 fi
a0d0e21e
LW
3408 else
3409 case "$osname" in
3410 '') : Still unknown. Probably a generic Sys V.
3411 osname="sysv"
3412 osvers="$3"
3413 ;;
3414 esac
2304df62
AD
3415 fi
3416 ;;
3417 esac
3418 ;;
a0d0e21e
LW
3419 *) case "$osname" in
3420 '') : Still unknown. Probably a generic BSD.
3421 osname="$1"
3422 osvers="$3"
3423 ;;
3424 esac
3425 ;;
2304df62
AD
3426 esac
3427 else
dfe9444c
AD
3428 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3429 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3430 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3431 osname=news_os
2304df62 3432 fi
dfe9444c 3433 $rm -f UU/kernel.what
5c728af0 3434 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3435 set X $myuname
3436 osname=os2
3437 osvers="$5"
2304df62
AD
3438 fi
3439 fi
a774dfe6 3440
5440bc8e
JH
3441 case "$targetarch" in
3442 '') ;;
3443 *) hostarch=$osname
3444 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3445 osvers=''
3446 ;;
3447 esac
3448
a0d0e21e
LW
3449 : Now look for a hint file osname_osvers, unless one has been
3450 : specified already.
3451 case "$hintfile" in
3452 ''|' ')
1e127011 3453 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3454 : Also try without trailing minor version numbers.
1e127011
DD
3455 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3456 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3457 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3458 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3459 case "$file" in
3460 '') dflt=none ;;
3461 *) case "$osvers" in
3462 '') dflt=$file
3463 ;;
dfe9444c 3464 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3465 dflt=$file
dfe9444c 3466 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3467 dflt=$xfile
dfe9444c 3468 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3469 dflt=$xxfile
dfe9444c 3470 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3471 dflt=$xxxfile
dfe9444c 3472 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3473 dflt=$xxxxfile
dfe9444c 3474 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3475 dflt="${osname}"
3476 else
3477 dflt=none
3478 fi
3479 ;;
3480 esac
85e6fe83
LW
3481 ;;
3482 esac
4e2a5f63
AD
3483 if $test -f Policy.sh ; then
3484 case "$dflt" in
3485 *Policy*) ;;
3486 none) dflt="Policy" ;;
3487 *) dflt="Policy $dflt" ;;
3488 esac
3489 fi
85e6fe83 3490 ;;
a0d0e21e 3491 *)
ecfc5424 3492 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3493 ;;
2304df62 3494 esac
1aef975c 3495
4e2a5f63
AD
3496 if $test -f Policy.sh ; then
3497 $cat <<EOM
3498
3499There's also a Policy hint file available, which should make the
3500site-specific (policy) questions easier to answer.
3501EOM
3502
3503 fi
3504
2304df62
AD
3505 $cat <<EOM
3506
3507You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3508If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3509previous run of Configure, you may specify it as well as or instead of
3510OS-specific hints. If hints are provided for your OS, you should use them:
3511although Perl can probably be built without hints on many platforms, using
3512hints often improve performance and may enable features that Configure can't
3513set up on its own. If there are no hints that match your OS, specify "none";
3514DO NOT give a wrong version or a wrong OS.
2304df62
AD
3515
3516EOM
4e2a5f63 3517
2304df62 3518 rp="Which of these apply, if any?"
dfe9444c 3519 . UU/myread
85e6fe83
LW
3520 tans=$ans
3521 for file in $tans; do
4e2a5f63
AD
3522 if $test X$file = XPolicy -a -f Policy.sh; then
3523 . Policy.sh
3524 $cat Policy.sh >> UU/config.sh
3525 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3526 . $src/hints/$file.sh
3527 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3528 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3529 : nothing
3530 else
85e6fe83
LW
3531 : Give one chance to correct a possible typo.
3532 echo "$file.sh does not exist"
3533 dflt=$file
3534 rp="hint to use instead?"
dfe9444c 3535 . UU/myread
85e6fe83 3536 for file in $ans; do
dfe9444c
AD
3537 if $test -f "$src/hints/$file.sh"; then
3538 . $src/hints/$file.sh
3539 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3540 elif $test X$ans = X -o X$ans = Xnone ; then
3541 : nothing
3542 else
3543 echo "$file.sh does not exist -- ignored."
3544 fi
3545 done
2304df62
AD
3546 fi
3547 done
85e6fe83 3548
2304df62 3549 hint=recommended
85e6fe83 3550 : Remember our hint file for later.
dfe9444c 3551 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3552 hintfile="$file"
85e6fe83 3553 else
a0d0e21e 3554 hintfile=''
85e6fe83 3555 fi
2304df62
AD
3556fi
3557cd UU
3558;;
3559*)
3560 echo " "
3561 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3562 tmp_n="$n"
3563 tmp_c="$c"
2304df62
AD
3564 cd ..
3565 cp $config_sh config.sh 2>/dev/null
a78b0d02 3566 chmod +w config.sh
2304df62
AD
3567 . ./config.sh
3568 cd UU
3569 cp ../config.sh .
ecfc5424
AD
3570 n="$tmp_n"
3571 c="$tmp_c"
2304df62
AD
3572 hint=previous
3573 ;;
3574esac
1aef975c 3575test "$override" && . ./optdef.sh
2304df62
AD
3576
3577: Restore computed paths
3578for file in $loclist $trylist; do
3579 eval $file="\$_$file"
3580done
3581
85e6fe83 3582cat << EOM
a0d0e21e 3583
85e6fe83 3584Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3585The default value is probably right if the name rings a bell. Otherwise,
3586since spelling matters for me, either accept the default or answer "none"
3587to leave it blank.
a0d0e21e 3588
85e6fe83 3589EOM
85e6fe83 3590case "$osname" in
a0d0e21e 3591 ''|' ')
85e6fe83 3592 case "$hintfile" in
a0d0e21e 3593 ''|' '|none) dflt=none ;;
ecfc5424 3594 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3595 esac
3596 ;;
3597 *) dflt="$osname" ;;
3598esac
3599rp="Operating system name?"
3600. ./myread
3601case "$ans" in
ecfc5424
AD
3602none) osname='' ;;
3603*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3604esac
8ff267be 3605echo " "
3606case "$osvers" in
3607 ''|' ')
3608 case "$hintfile" in
3609 ''|' '|none) dflt=none ;;
3610 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3611 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3612 case "$dflt" in
3613 ''|' ') dflt=none ;;
3614 esac
3615 ;;
3616 esac
3617 ;;
3618 *) dflt="$osvers" ;;
3619esac
3620rp="Operating system version?"
3621. ./myread
3622case "$ans" in
3623none) osvers='' ;;
3624*) osvers="$ans" ;;
3625esac
3626
02e93a22
JH
3627
3628. ./posthint.sh
3629
2304df62 3630: who configured the system
59b83a6f 3631cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3632case "$cf_by" in
3633"")
7c04078e 3634 cf_by=`(logname) 2>/dev/null`
dfe9444c 3635 case "$cf_by" in
7c04078e
GA
3636 "")
3637 cf_by=`(whoami) 2>/dev/null`
3638 case "$cf_by" in
3639 "") cf_by=unknown ;;
3640 esac ;;
8ff267be 3641 esac ;;
3642esac
2304df62 3643
f3f1a2d8
MB
3644: decide how portable to be. Allow command line overrides.
3645case "$d_portable" in
3646"$undef") ;;
3647*) d_portable="$define" ;;
b4eb6b3d 3648esac
b4eb6b3d 3649
f3f1a2d8
MB
3650: set up shell script to do ~ expansion
3651cat >filexp <<EOSS
3652$startsh
3653: expand filename
3654case "\$1" in
f16e9d76 3655 \~/*|\~)
f3f1a2d8
MB
3656 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3657 ;;
4137585d 3658 \~*)
f3f1a2d8
MB
3659 if $test -f /bin/csh; then
3660 /bin/csh -f -c "glob \$1"
3661 failed=\$?
3662 echo ""
3663 exit \$failed
3664 else
3665 name=\`$expr x\$1 : '..\([^/]*\)'\`
3666 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3667 if $test ! -d "\$dir"; then
3668 me=\`basename \$0\`
3669 echo "\$me: can't locate home directory for: \$name" >&2
3670 exit 1
3671 fi
3672 case "\$1" in
3673 */*)
3674 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3675 ;;
3676 *)
3677 echo \$dir
3678 ;;
3679 esac
3680 fi
3681 ;;
3682*)
3683 echo \$1
3684 ;;
b29b105d 3685esac
f3f1a2d8
MB
3686EOSS
3687chmod +x filexp
3688$eunicefix filexp
b29b105d 3689
f3f1a2d8
MB
3690: now set up to get a file name
3691cat <<EOS >getfile
3692$startsh
3693EOS
3694cat <<'EOSC' >>getfile
3695tilde=''
3696fullpath=''
3697already=''
3698skip=''
3699none_ok=''
3700exp_file=''
3701nopath_ok=''
3702orig_rp="$rp"
3703orig_dflt="$dflt"
3704case "$gfpth" in
3705'') gfpth='.' ;;
b29b105d 3706esac
b29b105d 3707
f3f1a2d8
MB
3708case "$fn" in
3709*\(*)
3710 : getfile will accept an answer from the comma-separated list
3711 : enclosed in parentheses even if it does not meet other criteria.
3712 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3713 fn=`echo $fn | sed 's/(.*)//'`
3714 ;;
b29b105d
JH
3715esac
3716
f3f1a2d8
MB
3717case "$fn" in
3718*:*)
3719 loc_file=`expr $fn : '.*:\(.*\)'`
3720 fn=`expr $fn : '\(.*\):.*'`
3721 ;;
b29b105d 3722esac
b29b105d 3723
f3f1a2d8
MB
3724case "$fn" in
3725*~*) tilde=true;;
3726esac
3727case "$fn" in
3728*/*) fullpath=true;;
3729esac
3730case "$fn" in
3731*+*) skip=true;;
3732esac
3733case "$fn" in
3734*n*) none_ok=true;;
3735esac
3736case "$fn" in
3737*e*) exp_file=true;;
3738esac
3739case "$fn" in
3740*p*) nopath_ok=true;;
b29b105d 3741esac
b29b105d 3742
f3f1a2d8
MB
3743case "$fn" in
3744*f*) type='File';;
3745*d*) type='Directory';;
3746*l*) type='Locate';;
3747esac
b29b105d 3748
f3f1a2d8
MB
3749what="$type"
3750case "$what" in
3751Locate) what='File';;
3752esac
b29b105d 3753
f3f1a2d8
MB
3754case "$exp_file" in
3755'')
3756 case "$d_portable" in
3757 "$define") ;;
3758 *) exp_file=true;;
b29b105d
JH
3759 esac
3760 ;;
3761esac
3762
f3f1a2d8
MB
3763cd ..
3764while test "$type"; do
3765 redo=''
3766 rp="$orig_rp"
3767 dflt="$orig_dflt"
3768 case "$tilde" in
3769 true) rp="$rp (~name ok)";;
3770 esac
3771 . UU/myread
3772 if test -f UU/getfile.ok && \
3773 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3774 then
3775 value="$ans"
3776 ansexp="$ans"
3777 break
3778 fi
3779 case "$ans" in
3780 none)
3781 value=''
3782 ansexp=''
3783 case "$none_ok" in
3784 true) type='';;
b29b105d
JH
3785 esac
3786 ;;
f3f1a2d8
MB
3787 *)
3788 case "$tilde" in
3789 '') value="$ans"
3790 ansexp="$ans";;
3791 *)
3792 value=`UU/filexp $ans`
3793 case $? in
3794 0)
3795 if test "$ans" != "$value"; then
3796 echo "(That expands to $value on this system.)"
3797 fi
3798 ;;
3799 *) value="$ans";;
3800 esac
3801 ansexp="$value"
3802 case "$exp_file" in
3803 '') value="$ans";;
3804 esac
3805 ;;
3806 esac
3807 case "$fullpath" in
3808 true)
3809 case "$ansexp" in
3810 /*) value="$ansexp" ;;
3811 [a-zA-Z]:/*) value="$ansexp" ;;
3812 *)
3813 redo=true
3814 case "$already" in
3815 true)
3816 echo "I shall only accept a full path name, as in /bin/ls." >&4
3817 echo "Use a ! shell escape if you wish to check pathnames." >&4
3818 ;;
3819 *)
3820 echo "Please give a full path name, starting with slash." >&4
3821 case "$tilde" in
3822 true)
3823 echo "Note that using ~name is ok provided it expands well." >&4
3824 already=true
3825 ;;
3826 esac
3827 esac
3828 ;;
3829 esac
3830 ;;
3831 esac
3832 case "$redo" in
3833 '')
3834 case "$type" in
3835 File)
3836 for fp in $gfpth; do
3837 if test "X$fp" = X.; then
3838 pf="$ansexp"
3839 else
3840 pf="$fp/$ansexp"
3841 fi
3842 if test -f "$pf"; then
3843 type=''
3844 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3845 then
3846 echo "($value is not a plain file, but that's ok.)"
3847 type=''
3848 fi
3849 if test X"$type" = X; then
3850 value="$pf"
3851 break
3852 fi
3853 done
3854 ;;
3855 Directory)
3856 for fp in $gfpth; do
3857 if test "X$fp" = X.; then
3858 dir="$ans"
3859 direxp="$ansexp"
3860 else
3861 dir="$fp/$ansexp"
3862 direxp="$fp/$ansexp"
3863 fi
3864 if test -d "$direxp"; then
3865 type=''
3866 value="$dir"
3867 break
3868 fi
3869 done
3870 ;;
3871 Locate)
3872 if test -d "$ansexp"; then
3873 echo "(Looking for $loc_file in directory $value.)"
3874 value="$value/$loc_file"
3875 ansexp="$ansexp/$loc_file"
3876 fi
3877 if test -f "$ansexp"; then
3878 type=''
3879 fi
3880 case "$nopath_ok" in
3881 true) case "$value" in
3882 */*) ;;
3883 *) echo "Assuming $value will be in people's path."
3884 type=''
3885 ;;
3886 esac
3887 ;;
3888 esac
3889 ;;
3890 esac
b4eb6b3d 3891
f3f1a2d8
MB
3892 case "$skip" in
3893 true) type='';
3894 esac
3895
3896 case "$type" in
3897 '') ;;
3898 *)
3899 if test "$fastread" = yes; then
3900 dflt=y
3901 else
3902 dflt=n
3903 fi
3904 rp="$what $value doesn't exist. Use that name anyway?"
3905 . UU/myread
3906 dflt=''
3907 case "$ans" in
3908 y*) type='';;
3909 *) echo " ";;
3910 esac
3911 ;;
3912 esac
3913 ;;
3914 esac
3915 ;;
b4eb6b3d 3916 esac
f3f1a2d8
MB
3917done
3918cd UU
3919ans="$value"
3920rp="$orig_rp"
3921dflt="$orig_dflt"
3922rm -f getfile.ok
3923test "X$gfpthkeep" != Xy && gfpth=""
3924EOSC
3925
3926: determine root of directory hierarchy where package will be installed.
3927case "$prefix" in
3928'')
3929 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3930 ;;
3931*?/)
3932 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3933 ;;
3934*)
f3f1a2d8 3935 dflt="$prefix"
b4eb6b3d
JH
3936 ;;
3937esac
f3f1a2d8 3938$cat <<EOM
b4eb6b3d 3939
f3f1a2d8
MB
3940By default, $package will be installed in $dflt/bin, manual pages
3941under $dflt/man, etc..., i.e. with $dflt as prefix for all
3942installation directories. Typically this is something like /usr/local.
3943If you wish to have binaries under /usr/bin but other parts of the
3944installation under /usr/local, that's ok: you will be prompted
3945separately for each of the installation directories, the prefix being
3946only used to set the defaults.
c915ce7f
JH
3947
3948EOM
f3f1a2d8
MB
3949fn=d~
3950rp='Installation prefix to use?'
3951. ./getfile
3952oldprefix=''
3953case "$prefix" in
3954'') ;;
3955*)
3956 case "$ans" in
3957 "$prefix") ;;
3958 *) oldprefix="$prefix";;
3959 esac
c915ce7f
JH
3960 ;;
3961esac
f3f1a2d8
MB
3962prefix="$ans"
3963prefixexp="$ansexp"
c915ce7f 3964
776a38e3 3965: allow them to override the AFS root
f3f1a2d8
MB
3966case "$afsroot" in
3967'') afsroot=/afs ;;
3968*) afsroot=$afsroot ;;
b4eb6b3d 3969esac
b4eb6b3d 3970
776a38e3 3971: is AFS running?
f3f1a2d8
MB
3972echo " "
3973case "$afs" in
3974$define|true) afs=true ;;
3975$undef|false) afs=false ;;
776a38e3 3976*) if $test -d $afsroot; then
f3f1a2d8
MB
3977 afs=true
3978 else
3979 afs=false
3980 fi
b4eb6b3d 3981 ;;
f3f1a2d8
MB
3982esac
3983if $afs; then
3984 echo "AFS may be running... I'll be extra cautious then..." >&4
3985else
3986 echo "AFS does not seem to be running..." >&4
9da7673b 3987fi
b4eb6b3d 3988
f3f1a2d8
MB
3989: determine installation prefix for where package is to be installed.
3990if $afs; then
3991$cat <<EOM
3992
3993Since you are running AFS, I need to distinguish the directory in which
3994files will reside from the directory in which they are installed (and from
3995which they are presumably copied to the former directory by occult means).
b4eb6b3d 3996
b4eb6b3d 3997EOM
f3f1a2d8
MB
3998 case "$installprefix" in
3999 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4000 *) dflt="$installprefix";;
4001 esac
4002else
4003$cat <<EOM
b4eb6b3d 4004
f3f1a2d8
MB
4005In some special cases, particularly when building $package for distribution,
4006it is convenient to distinguish the directory in which files should be
4007installed from the directory ($prefix) in which they will
4008eventually reside. For most users, these two directories are the same.
4009
4010EOM
4011 case "$installprefix" in
4012 '') dflt=$prefix ;;
4013 *) dflt=$installprefix;;
4014 esac
4015fi
4016fn=d~
4017rp='What installation prefix should I use for installing files?'
4018. ./getfile
4019installprefix="$ans"
4020installprefixexp="$ansexp"
4021
4022: Perform the prefixexp/installprefixexp correction if necessary
4023cat <<EOS >installprefix
4024$startsh
4025EOS
4026cat <<'EOSC' >>installprefix
4027: Change installation prefix, if necessary.
4028if $test X"$prefix" != X"$installprefix"; then
4029 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4030else
4031 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4032fi
4033EOSC
4034chmod +x installprefix
4035$eunicefix installprefix
4036
4037: Set variables such as privlib and privlibexp from the output of ./getfile
4038: performing the prefixexp/installprefixexp correction if necessary.
4039cat <<EOS >setprefixvar
4040$startsh
4041EOS
4042cat <<'EOSC' >>setprefixvar
4043eval "${prefixvar}=\"\$ans\""
4044eval "${prefixvar}exp=\"\$ansexp\""
4045. ./installprefix
4046EOSC
4047chmod +x setprefixvar
4048$eunicefix setprefixvar
4049
4050: set up the script used to warn in case of inconsistency
4051cat <<EOS >whoa
4052$startsh
4053EOS
4054cat <<'EOSC' >>whoa
4055dflt=y
dcb594bc
MB
4056case "$hint" in
4057 recommended)
4058 case "$hintfile" in
4059 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4060 ;;
4061 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4062 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4063 ;;
4064 esac
4065 ;;
4066 *) echo " "
4067 echo "*** WHOA THERE!!! ***" >&4
4068 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4069 ;;
4070esac
f3f1a2d8
MB
4071rp=" Keep the $hint value?"
4072. ./myread
4073case "$ans" in
4074y) td=$was; tu=$was;;
4075esac
4076EOSC
4077
216dac04 4078: function used to set '$1' to '$val'
f3f1a2d8
MB
4079setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4080case "$val$was" in
4081$define$undef) . ./whoa; eval "$var=\$td";;
4082$undef$define) . ./whoa; eval "$var=\$tu";;
4083*) eval "$var=$val";;
4084esac'
4085
5c40187f
MB
4086: get the patchlevel
4087echo " "
4088echo "Getting the current patchlevel..." >&4
4089if $test -r $rsrc/patchlevel.h;then
4090 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4091 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4092 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4093 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4094 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4095 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4096 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4097else
4098 revision=0
4099 patchlevel=0
4100 subversion=0
4101 api_revision=0
4102 api_version=0
4103 api_subversion=0
4104 perl_patchlevel=0
4105 $echo "(You do not have patchlevel.h. Eek.)"
4106fi
5c40187f
MB
4107: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4108version_patchlevel_string="version $patchlevel subversion $subversion"
4109case "$perl_patchlevel" in
41100|'') ;;
0f04e85f
MB
4111*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4112 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4113 ;;
5c40187f
MB
4114esac
4115
4116$echo "(You have $package $version_patchlevel_string.)"
4117
4118case "$osname" in
4119dos|vms)
4120 : XXX Should be a Configure test for double-dots in filenames.
4121 version=`echo $revision $patchlevel $subversion | \
4122 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4123 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4124 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4125 ;;
4126*)
4127 version=`echo $revision $patchlevel $subversion | \
4128 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4129 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4130 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4131 ;;
4132esac
4133: Special case the 5.005_xx maintenance series, which used 5.005
4134: without any subversion label as a subdirectory in $sitelib
4135if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4136 api_versionstring='5.005'
4137fi
4138
613d6c3e 4139: Do we want threads support and if so, what type
f3f1a2d8
MB
4140case "$usethreads" in
4141$define|true|[yY]*) dflt='y';;
4142*) # Catch case where user specified ithreads or 5005threads but
4143 # forgot -Dusethreads (A.D. 4/2002)
4144 case "$useithreads$use5005threads" in
dd35fa16
MB
4145 *$define*) dflt='y';;
4146 *) dflt='n';;
f3f1a2d8
MB
4147 esac
4148 ;;
4149esac
4150cat <<EOM
4151
4152Perl can be built to take advantage of threads on some systems.
4153To do so, Configure can be run with -Dusethreads.
4154
4155Note that Perl built with threading support runs slightly slower
4156and uses more memory than plain Perl. The current implementation
4157is believed to be stable, but it is fairly new, and so should be
4158treated with caution.
4159
4160If this doesn't make any sense to you, just accept the default '$dflt'.
4161EOM
4162rp='Build a threading Perl?'
4163. ./myread
4164case "$ans" in
4165y|Y) val="$define" ;;
4166*) val="$undef" ;;
4167esac
4168set usethreads
4169eval $setvar
4170
5c40187f
MB
4171if $test $patchlevel -lt 9; then
4172 case "$usethreads" in
4173 $define)
f3f1a2d8
MB
4174 $cat <<EOM
4175
4176Since release 5.6, Perl has had two different threading implementations,
4177the newer interpreter-based version (ithreads) with one interpreter per
4178thread, and the older 5.005 version (5005threads).
4179The 5005threads version is effectively unmaintained and will probably be
4180removed in Perl 5.10, so there should be no need to build a Perl using it
4181unless needed for backwards compatibility with some existing 5.005threads
4182code.
4183
4184EOM
4185 : Default to ithreads unless overridden on command line or with
4186 : old config.sh
4187 dflt='y'
4188 case "$use5005threads" in
4189 $define|true|[yY]*) dflt='n';;
4190 esac
4191 case "$useithreads" in
4192 $undef|false|[nN]*) dflt='n';;
4193 esac
4194 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4195 . ./myread
4196 case "$ans" in
f3f1a2d8 4197 y|Y) val="$define" ;;
b4eb6b3d
JH
4198 *) val="$undef" ;;
4199 esac
f3f1a2d8
MB
4200 set useithreads
4201 eval $setvar
4202 : Now set use5005threads to the opposite value.
4203 case "$useithreads" in
4204 $define) val="$undef" ;;
4205 *) val="$define" ;;
4206 esac
4207 set use5005threads
4208 eval $setvar
4209 ;;
5c40187f 4210 *)
f3f1a2d8
MB
4211 useithreads="$undef"
4212 use5005threads="$undef"
b4eb6b3d 4213 ;;
5c40187f 4214 esac
b4eb6b3d 4215
5c40187f
MB
4216 case "$useithreads$use5005threads" in
4217 "$define$define")
f3f1a2d8 4218 $cat >&4 <<EOM
96056487 4219
f3f1a2d8
MB
4220You cannot have both the ithreads and the 5.005 threads enabled
4221at the same time. Disabling the 5.005 threads since they are
4222much less stable than the ithreads.
4223
4224EOM
4225 use5005threads="$undef"
96056487 4226 ;;
5c40187f
MB
4227 esac
4228
4229else
4230: perl-5.9.x and later
4231
47f9f84c 4232 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4233 case "$use5005threads" in
4234 $define|true|[yY]*)
4235 $cat >&4 <<EOM
47f9f84c
JH
4236
42375.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4238
47f9f84c 4239EOM
3f30fabf
MB
4240 ;;
4241 esac
47f9f84c 4242 fi
3f30fabf 4243
47f9f84c
JH
4244 use5005threads="$undef"
4245 useithreads="$usethreads"
5c40187f 4246fi
96056487 4247
f3f1a2d8
MB
4248case "$d_oldpthreads" in
4249'') : Configure tests would be welcome here. For now, assume undef.
4250 val="$undef" ;;
4251*) val="$d_oldpthreads" ;;
4252esac
4253set d_oldpthreads
4254eval $setvar
4255
4256
4257: Look for a hint-file generated 'call-back-unit'. If the
4258: user has specified that a threading perl is to be built,
4259: we may need to set or change some other defaults.
4260if $test -f usethreads.cbu; then
4261 echo "Your platform has some specific hints regarding threaded builds, using them..."
4262 . ./usethreads.cbu
4263else
4264 case "$usethreads" in
4265 "$define"|true|[yY]*)
4266 $cat <<EOM
4267(Your platform does not have any specific hints for threaded builds.
4268 Assuming POSIX threads, then.)
4269EOM
4270 ;;
4271 esac
4272fi
4273
34f1896b 4274: Check if multiplicity is required
f3f1a2d8
MB
4275cat <<EOM
4276
4277Perl can be built so that multiple Perl interpreters can coexist
4278within the same Perl executable.
4279EOM
4280
4281case "$useithreads" in
4282$define)
4283 cat <<EOM
4284This multiple interpreter support is required for interpreter-based threads.
4285EOM
4286 val="$define"
4287 ;;
4288*) case "$usemultiplicity" in
4289 $define|true|[yY]*) dflt='y';;
4290 *) dflt='n';;
4291 esac
4292 echo " "
4293 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4294 rp='Build Perl for multiplicity?'
4295 . ./myread
4296 case "$ans" in
4297 y|Y) val="$define" ;;
4298 *) val="$undef" ;;
4299 esac
4300 ;;
4301esac
4302set usemultiplicity
4303eval $setvar
4304
34f1896b 4305: Check if morebits is requested
f3f1a2d8
MB
4306case "$usemorebits" in
4307"$define"|true|[yY]*)
4308 use64bitint="$define"
4309 uselongdouble="$define"
4310 usemorebits="$define"
4311 ;;
4312*) usemorebits="$undef"
4313 ;;
4314esac
4315
776a38e3
MB
4316: Determine the C compiler to be used
4317echo " "
4318case "$cc" in
4319'') dflt=cc;;
4320*) dflt="$cc";;
4321esac
4322rp="Use which C compiler?"
4323. ./myread
4324cc="$ans"
4325
4326: See whether they have no cc but they do have gcc
4327. ./trygcc
4328if $test -f cc.cbu; then
4329 . ./cc.cbu
4330fi
4331. ./checkcc
4332
f3f1a2d8
MB
4333: make some quick guesses about what we are up against
4334echo " "
4335$echo $n "Hmm... $c"
4336echo exit 1 >bsd
4337echo exit 1 >usg
4338echo exit 1 >v7
4339echo exit 1 >osf1
4340echo exit 1 >eunice
4341echo exit 1 >xenix
4342echo exit 1 >venix
4343echo exit 1 >os2
4344d_bsd="$undef"
4345$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4346if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4347then
4348 echo "Looks kind of like an OSF/1 system, but we'll see..."
4349 echo exit 0 >osf1
381aa1ff 4350elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4351 xxx=`./loc addbib blurfl $pth`
4352 if $test -f $xxx; then
4353 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4354 echo exit 0 >bsd
4355 echo exit 0 >usg
4356 else
4357 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4358 echo "Looks kind of like an extended USG system, but we'll see..."
4359 else
4360 echo "Looks kind of like a USG system, but we'll see..."
4361 fi
4362 echo exit 0 >usg
4363 fi
4364elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4365 echo "Looks kind of like a BSD system, but we'll see..."
4366 d_bsd="$define"
4367 echo exit 0 >bsd
4368else
4369 echo "Looks kind of like a Version 7 system, but we'll see..."
4370 echo exit 0 >v7
4371fi
4372case "$eunicefix" in
4373*unixtovms*)
4374 $cat <<'EOI'
4375There is, however, a strange, musty smell in the air that reminds me of
4376something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4377EOI
4378 echo exit 0 >eunice
4379 d_eunice="$define"
4380: it so happens the Eunice I know will not run shell scripts in Unix format
4381 ;;
4382*)
4383 echo " "
4384 echo "Congratulations. You aren't running Eunice."
4385 d_eunice="$undef"
4386 ;;
4387esac
4388: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4389: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4390: semicolon as a patch separator
e5e20432
JH
4391case "$p_" in
4392:) ;;
4393*)
4394 $cat <<'EOI'
4395I have the feeling something is not exactly right, however...don't tell me...
4396lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4397(Or you may be running DOS with DJGPP.)
e5e20432
JH
4398EOI
4399 echo exit 0 >os2
4400 ;;
4401esac
4402if test -f /xenix; then
4403 echo "Actually, this looks more like a XENIX system..."
4404 echo exit 0 >xenix
4405 d_xenix="$define"
4406else
4407 echo " "
4408 echo "It's not Xenix..."
4409 d_xenix="$undef"
4410fi
4411chmod +x xenix
4412$eunicefix xenix
4413if test -f /venix; then
4414 echo "Actually, this looks more like a VENIX system..."
4415 echo exit 0 >venix
4416else
4417 echo " "
4418 if ./xenix; then
4419 : null
4420 else
4421 echo "Nor is it Venix..."
4422 fi
4423fi
4424chmod +x bsd usg v7 osf1 eunice xenix venix os2
4425$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4426$rm -f foo
4427
613d6c3e 4428: Check if we are using GNU gcc and what its version is
e5e20432
JH
4429echo " "
4430echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4431$cat >try.c <<EOM
e5e20432
JH
4432#include <stdio.h>
4433int main() {
7686528e 4434#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4435#ifdef __VERSION__
4436 printf("%s\n", __VERSION__);
4437#else
4438 printf("%s\n", "1");
4439#endif
4440#endif
073b6de5 4441 return(0);
e5e20432
JH
4442}
4443EOM
5440bc8e
JH
4444if $cc -o try $ccflags $ldflags try.c; then
4445 gccversion=`$run ./try`
f3f1a2d8
MB
4446 case "$gccversion" in
4447 '') echo "You are not using GNU cc." ;;
4448 *) echo "You are using GNU cc $gccversion."
4449 ccname=gcc
4450 ;;
4451 esac
4452else
4453 echo " "
4454 echo "*** WHOA THERE!!! ***" >&4
4455 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4456 case "$knowitall" in
4457 '')
4458 echo " You'd better start hunting for one and let me know about it." >&4
4459 exit 1
2304df62
AD
4460 ;;
4461 esac
f3f1a2d8
MB
4462fi
4463$rm -f try try.*
4464case "$gccversion" in
44651*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4466esac
4467case "$gccversion" in
4468'') gccosandvers='' ;;
4469*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4470 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4471 gccshortvers=''
4472 case "$gccosandvers" in
4473 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4474 $osname$osvers) ;; # looking good
4475 $osname*) cat <<EOM >&4
4476
4477*** WHOA THERE!!! ***
4478
4479 Your gcc has not been compiled for the exact release of
4480 your operating system ($gccosandvers versus $osname$osvers).
4481
4482 In general it is a good idea to keep gcc synchronized with
4483 the operating system because otherwise serious problems
4484 may ensue when trying to compile software, like Perl.
4485
4486 I'm trying to be optimistic here, though, and will continue.
4487 If later during the configuration and build icky compilation
4488 problems appear (headerfile conflicts being the most common
4489 manifestation), I suggest reinstalling the gcc to match
4490 your operating system release.
4491
4492EOM
4493 ;;
4494 *) gccosandvers='' ;; # failed to parse, better be silent
4495 esac
4496 ;;
4497esac
4498case "$ccname" in
4499'') ccname="$cc" ;;
4500esac
4501
4502# gcc 3.* complain about adding -Idirectories that they already know about,
4503# so we will take those off from locincpth.
4504case "$gccversion" in
45053*)
4506 echo "main(){}">try.c
4507 for incdir in $locincpth; do
4508 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4509 grep '^c[cp]p*[01]: warning: changing search order '`
4510 if test "X$warn" != X; then
4511 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4512 fi
4513 done
4514 $rm -f try try.*
4515esac
2304df62 4516
bd9b35c9
JH
4517: What should the include directory be ?
4518echo " "
4519$echo $n "Hmm... $c"
4520dflt='/usr/include'
4521incpath=''
4522mips_type=''
4523if $test -f /bin/mips && /bin/mips; then
4524 echo "Looks like a MIPS system..."
4525 $cat >usr.c <<'EOCP'
4526#ifdef SYSTYPE_BSD43
4527/bsd43
4528#endif
4529EOCP
8a27cf78 4530 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4531 dflt='/bsd43/usr/include'
4532 incpath='/bsd43'
4533 mips_type='BSD 4.3'
4534 else
4535 mips_type='System V'
4536 fi
4537 $rm -f usr.c usr.out
4538 echo "and you're compiling with the $mips_type compiler and libraries."
4539 xxx_prompt=y
4540 echo "exit 0" >mips
4541else
4542 echo "Doesn't look like a MIPS system."
4543 xxx_prompt=n
4544 echo "exit 1" >mips
4545fi
4546chmod +x mips
4547$eunicefix mips
4548case "$usrinc" in
4549'') ;;
4550*) dflt="$usrinc";;
4551esac
4552case "$xxx_prompt" in
4553y) fn=d/
4554 echo " "
4555 rp='Where are the include files you want to use?'
4556 . ./getfile
4557 usrinc="$ans"
8e07c86e 4558 ;;
bd9b35c9 4559*) usrinc="$dflt"
8e07c86e
AD
4560 ;;
4561esac
2304df62 4562
96056487
JH
4563: see how we invoke the C preprocessor
4564echo " "
4565echo "Now, how can we feed standard input to your C preprocessor..." >&4
4566cat <<'EOT' >testcpp.c
4567#define ABC abc
4568#define XYZ xyz
4569ABC.XYZ
4570EOT
4571cd ..
4572if test ! -f cppstdin; then
4573 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4574 # AIX cc -E doesn't show the absolute headerfile
4575 # locations but we'll cheat by using the -M flag.
4576 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
4577 else
4578 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4579 fi
4580else
4581 echo "Keeping your $hint cppstdin wrapper."
4582fi
4583chmod 755 cppstdin
4584wrapper=`pwd`/cppstdin
4585ok='false'
4586cd UU
4587
4588if $test "X$cppstdin" != "X" && \
4589 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4590 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4591then
4592 echo "You used to use $cppstdin $cppminus so we'll use that again."
4593 case "$cpprun" in
4594 '') echo "But let's see if we can live without a wrapper..." ;;
4595 *)
4596 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4597 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4598 then
4599 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4600 ok='true'
4601 else
4602 echo "(However, $cpprun $cpplast does not work, let's see...)"
4603 fi
4604 ;;
4605 esac
4606else
4607 case "$cppstdin" in
4608 '') ;;
4609 *)
4610 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4611 ;;
4612 esac
4613fi
4614
4615if $ok; then
4616 : nothing
4617elif echo 'Maybe "'"$cc"' -E" will work...'; \
4618 $cc -E <testcpp.c >testcpp.out 2>&1; \
4619 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4620 echo "Yup, it does."
4621 x_cpp="$cc -E"
4622 x_minus='';
4623elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4624 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4625 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626 echo "Yup, it does."
4627 x_cpp="$cc -E"
4628 x_minus='-';
4629elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4630 $cc -P <testcpp.c >testcpp.out 2>&1; \
4631 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632 echo "Yipee, that works!"
4633 x_cpp="$cc -P"
4634 x_minus='';
4635elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4636 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4637 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638 echo "At long last!"
4639 x_cpp="$cc -P"
4640 x_minus='-';
4641elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4642 $cpp <testcpp.c >testcpp.out 2>&1; \
4643 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644 echo "It works!"
4645 x_cpp="$cpp"
4646 x_minus='';
4647elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4648 $cpp - <testcpp.c >testcpp.out 2>&1; \
4649 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650 echo "Hooray, it works! I was beginning to wonder."
4651 x_cpp="$cpp"
4652 x_minus='-';
4653elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4654 $wrapper <testcpp.c >testcpp.out 2>&1; \
4655 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4656 x_cpp="$wrapper"
4657 x_minus=''
4658 echo "Eureka!"
4659else
4660 dflt=''
4661 rp="No dice. I can't find a C preprocessor. Name one:"
4662 . ./myread
4663 x_cpp="$ans"
4664 x_minus=''
4665 $x_cpp <testcpp.c >testcpp.out 2>&1
4666 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4667 echo "OK, that will do." >&4
4668 else
4669echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4670 exit 1
4671 fi
4672fi
4673
4674case "$ok" in
4675false)
4676 cppstdin="$x_cpp"
4677 cppminus="$x_minus"
4678 cpprun="$x_cpp"
4679 cpplast="$x_minus"
4680 set X $x_cpp
4681 shift
4682 case "$1" in
4683 "$cpp")
4684 echo "Perhaps can we force $cc -E using a wrapper..."
4685 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4686 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4687 then
4688 echo "Yup, we can."
4689 cppstdin="$wrapper"
4690 cppminus='';
4691 else
4692 echo "Nope, we'll have to live without it..."
4693 fi
4694 ;;
4695 esac
4696 case "$cpprun" in
4697 "$wrapper")
4698 cpprun=''
4699 cpplast=''
4700 ;;
4701 esac
4702 ;;
4703esac
4704
4705case "$cppstdin" in
4706"$wrapper"|'cppstdin') ;;
4707*) $rm -f $wrapper;;
4708esac
4709$rm -f testcpp.c testcpp.out
4710
bd9b35c9
JH
4711: Set private lib path
4712case "$plibpth" in
4713'') if ./mips; then
4714 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4715 fi;;
4716esac
4717case "$libpth" in
4718' ') dlist='';;
4719'') dlist="$loclibpth $plibpth $glibpth";;
4720*) dlist="$libpth";;
4721esac
4722
4723: Now check and see which directories actually exist, avoiding duplicates
4724libpth=''
4725for xxx in $dlist
4726do
4727 if $test -d $xxx; then
4728 case " $libpth " in
4729 *" $xxx "*) ;;
4730 *) libpth="$libpth $xxx";;
4731 esac
4732 fi
4733done
4734$cat <<'EOM'
4735
4736Some systems have incompatible or broken versions of libraries. Among
4737the directories listed in the question below, please remove any you
4738know not to be holding relevant libraries, and add any that are needed.
4739Say "none" for none.
8e07c86e
AD
4740
4741EOM
bd9b35c9
JH
4742case "$libpth" in
4743'') dflt='none';;
8e07c86e 4744*)
bd9b35c9
JH
4745 set X $libpth
4746 shift
4747 dflt=${1+"$@"}
8e07c86e 4748 ;;
a0d0e21e 4749esac
bd9b35c9
JH
4750rp="Directories to use for library searches?"
4751. ./myread
4752case "$ans" in
4753none) libpth=' ';;
4754*) libpth="$ans";;
4755esac
a0d0e21e 4756
bd9b35c9
JH
4757: compute shared library extension
4758case "$so" in
4759'')
4760 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4761 dflt='sl'
dd4e71fd 4762 else
bd9b35c9 4763 dflt='so'
dd4e71fd
JH
4764 fi
4765 ;;
bd9b35c9 4766*) dflt="$so";;
dd4e71fd 4767esac
dd4e71fd
JH
4768$cat <<EOM
4769
bd9b35c9 4770On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4771you want to suppress searching of shared libraries for the remainder
bd9b35c9 4772of this configuration.
dd4e71fd
JH
4773
4774EOM
bd9b35c9
JH
4775rp='What is the file extension used for shared libraries?'
4776. ./myread
4777so="$ans"
dd4e71fd 4778
bd9b35c9
JH
4779: Define several unixisms.
4780: Hints files or command line option can be used to override them.
4781: The convoluted testing is in case hints files set either the old
4782: or the new name.
4783case "$_exe" in
4784'') case "$exe_ext" in
1fef16b3 4785 '') ;;
bd9b35c9 4786 *) _exe="$exe_ext" ;;
dd4e71fd 4787 esac
bd9b35c9 4788 ;;
bfb7748a 4789esac
bd9b35c9
JH
4790case "$_a" in
4791'') case "$lib_ext" in
4792 '') _a='.a';;
4793 *) _a="$lib_ext" ;;
dd4e71fd
JH
4794 esac
4795 ;;
dd4e71fd 4796esac
bd9b35c9
JH
4797case "$_o" in
4798'') case "$obj_ext" in
4799 '') _o='.o';;
4800 *) _o="$obj_ext";;
4801 esac
4802 ;;
4803esac
4804case "$p_" in
4805'') case "$path_sep" in
4806 '') p_=':';;
4807 *) p_="$path_sep";;
4808 esac
4809 ;;
4810esac
4811exe_ext=$_exe
4812lib_ext=$_a
4813obj_ext=$_o
4814path_sep=$p_
dd4e71fd 4815
5b813a60
MB
4816rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4817
b4eb6b3d
JH
4818: Which makefile gets called first. This is used by make depend.
4819case "$firstmakefile" in
4820'') firstmakefile='makefile';;
4633a7c4 4821esac
4633a7c4 4822
dd35fa16
MB
4823: Check is we will use socks
4824case "$usesocks" in
4825$define|true|[yY]*) dflt='y';;
4826*) dflt='n';;
4827esac
4828cat <<EOM
4829
4830Perl can be built to use the SOCKS proxy protocol library. To do so,
4831Configure must be run with -Dusesocks. If you use SOCKS you also need
4832to use the PerlIO abstraction layer, this will be implicitly selected.
4833
4834If this doesn't make any sense to you, just accept the default '$dflt'.
4835EOM
4836rp='Build Perl for SOCKS?'
4837. ./myread
4838case "$ans" in
4839y|Y) val="$define" ;;
4840*) val="$undef" ;;
4841esac
4842set usesocks
4843eval $setvar
4844
34f1896b 4845: Check for uselongdouble support
1f603089
JH
4846case "$ccflags" in
4847*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4848esac
4849
4850case "$uselongdouble" in
4851$define|true|[yY]*) dflt='y';;
4852*) dflt='n';;
4853esac
4854cat <<EOM
4855
4856Perl can be built to take advantage of long doubles which
4857(if available) may give more accuracy and range for floating point numbers.
4858
4859If this doesn't make any sense to you, just accept the default '$dflt'.
4860EOM
4861rp='Try to use long doubles if available?'
4862. ./myread
4863case "$ans" in
4864y|Y) val="$define" ;;
4865*) val="$undef" ;;
4866esac
4867set uselongdouble
4868eval $setvar
4869
4870case "$uselongdouble" in
4871true|[yY]*) uselongdouble="$define" ;;
4872esac
4873
1f603089
JH
4874: Look for a hint-file generated 'call-back-unit'. If the
4875: user has specified that long doubles should be used,
4876: we may need to set or change some other defaults.
9da7673b
MB
4877if $test -f uselongdouble.cbu; then
4878 echo "Your platform has some specific hints regarding long doubles, using them..."
4879 . ./uselongdouble.cbu
4880else
4881 case "$uselongdouble" in
4882 $define)
1f603089 4883 $cat <<EOM
9da7673b 4884(Your platform does not have any specific hints for long doubles.)
1f603089 4885EOM
1f603089 4886 ;;
9da7673b
MB
4887 esac
4888fi
1f603089 4889
bd9b35c9
JH
4890: Looking for optional libraries
4891echo " "
4892echo "Checking for optional libraries..." >&4
4893case "$libs" in
4894' '|'') dflt='';;
4895*) dflt="$libs";;
4896esac
4897case "$libswanted" in
4898'') libswanted='c_s';;
4899esac
4900case "$usesocks" in
923fc586 4901"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4902esac
68435ea7
JH
4903libsfound=''
4904libsfiles=''
4905libsdirs=''
13b3f787
JH
4906libspath=''
4907for thisdir in $libpth $xlibpth; do
4908 test -d $thisdir && libspath="$libspath $thisdir"
4909done
bd9b35c9 4910for thislib in $libswanted; do
13b3f787 4911 for thisdir in $libspath; do
f7dd4e7f
JH
4912 xxx=''
4913 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4914 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4915 $test -f "$xxx" && eval $libscheck
4916 $test -f "$xxx" && libstyle=shared
4917 fi
4918 if test ! -f "$xxx"; then
4919 xxx=$thisdir/lib$thislib.$so
4920 $test -f "$xxx" && eval $libscheck
4921 $test -f "$xxx" && libstyle=shared
613d6c3e 4922 fi
f7dd4e7f
JH
4923 if test ! -f "$xxx"; then
4924 xxx=$thisdir/lib$thislib$_a
4925 $test -f "$xxx" && eval $libscheck
4926 $test -f "$xxx" && libstyle=static
4927 fi
4928 if test ! -f "$xxx"; then
4929 xxx=$thisdir/$thislib$_a
4930 $test -f "$xxx" && eval $libscheck
4931 $test -f "$xxx" && libstyle=static
4932 fi
4933 if test ! -f "$xxx"; then
4934 xxx=$thisdir/lib${thislib}_s$_a
4935 $test -f "$xxx" && eval $libscheck
4936 $test -f "$xxx" && libstyle=static
09ea5ba9 4937 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4938 fi
4939 if test ! -f "$xxx"; then
4940 xxx=$thisdir/Slib$thislib$_a
4941 $test -f "$xxx" && eval $libscheck
4942 $test -f "$xxx" && libstyle=static
4943 fi
4944 if $test -f "$xxx"; then
43999f95 4945 case "$libstyle" in
f7dd4e7f
JH
4946 shared) echo "Found -l$thislib (shared)." ;;
4947 static) echo "Found -l$thislib." ;;
4948 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4949 esac
bd9b35c9
JH
4950 case " $dflt " in
4951 *"-l$thislib "*);;
f7dd4e7f 4952 *) dflt="$dflt -l$thislib"
43999f95
JH
4953 libsfound="$libsfound $xxx"
4954 yyy=`basename $xxx`
4955 libsfiles="$libsfiles $yyy"
1e127011 4956 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4957 case " $libsdirs " in
4958 *" $yyy "*) ;;
4959 *) libsdirs="$libsdirs $yyy" ;;
4960 esac
4961 ;;
bd9b35c9 4962 esac
f7dd4e7f 4963 break
613d6c3e 4964 fi
f7dd4e7f
JH
4965 done
4966 if $test ! -f "$xxx"; then
4967 echo "No -l$thislib."
bd9b35c9
JH
4968 fi
4969done
4970set X $dflt
4971shift
4972dflt="$*"
4973case "$libs" in
4974'') dflt="$dflt";;
4975*) dflt="$libs";;
4976esac
4977case "$dflt" in
4978' '|'') dflt='none';;
4979esac
4633a7c4 4980
bd9b35c9 4981$cat <<EOM
4633a7c4 4982
bd9b35c9
JH
4983In order to compile $package on your machine, a number of libraries
4984are usually needed. Include any other special libraries here as well.
4985Say "none" for none. The default list is almost always right.
8e07c86e 4986EOM
8e07c86e 4987
bd9b35c9
JH
4988echo " "
4989rp="What libraries to use?"
4990. ./myread
4991case "$ans" in
4992none) libs=' ';;
4993*) libs="$ans";;
4994esac
d71b2b6b 4995
bd9b35c9
JH
4996: determine optimization, if desired, or use for debug flag also
4997case "$optimize" in
4998' '|$undef) dflt='none';;
4999'') dflt='-O';;
5000*) dflt="$optimize";;
5001esac
5002$cat <<EOH
d71b2b6b 5003
bd9b35c9
JH
5004By default, $package compiles with the -O flag to use the optimizer.
5005Alternately, you might want to use the symbolic debugger, which uses
5006the -g flag (on traditional Unix systems). Either flag can be
5007specified here. To use neither flag, specify the word "none".
d71b2b6b 5008
bd9b35c9
JH
5009EOH
5010rp="What optimizer/debugger flag should be used?"
5011. ./myread
5012optimize="$ans"
5013case "$optimize" in
5014'none') optimize=" ";;
5015esac
5016
eaf812ae
MB
5017: Check what DEBUGGING is required from the command line
5018: -DEBUGGING or -DDEBUGGING or
5019: -DEBUGGING=both = -g + -DDEBUGGING
5020: -DEBUGGING=-g or -Doptimize=-g = -g
5021: -DEBUGGING=none or -UDEBUGGING =
5022: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5023case "$EBUGGING" in
5024'') ;;
5025*) DEBUGGING=$EBUGGING ;;
5026esac
5027
5028case "$DEBUGGING" in
5a7c70d6 5029-g|both|$define)
eaf812ae
MB
5030 case "$optimize" in
5031 *-g*) ;;
5032 *) optimize="$optimize -g" ;;
5033 esac ;;
5034none|$undef)
5035 case "$optimize" in
5036 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5037 shift
5038 optimize="$*"
5039 ;;
5040 esac ;;
5041esac
5042
bd9b35c9 5043dflt=''
eaf812ae
MB
5044case "$DEBUGGING" in
5045both|$define) dflt='-DDEBUGGING'
5046esac
5047
c34316b3
NC
5048: argument order is deliberate, as the flag will start with - which set could
5049: think is an option
6682be1c 5050checkccflag='check=$1; flag=$2; callback=$3;
c34316b3
NC
5051echo " ";
5052echo "Checking if your compiler accepts $flag" 2>&1;
5053echo "int main(void) { return 0; }" > gcctest.c;
04b62921 5054if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
c34316b3 5055 echo "Yes, it does." 2>&1;
580e570e 5056 if $test -s gcctest.out ; then
04b62921
MB
5057 echo "But your platform does not like it:";
5058 cat gcctest.out;
5059 else
5060 case "$ccflags" in
5061 *$check*)
5062 echo "Leaving current flags $ccflags alone." 2>&1
5063 ;;
5064 *) dflt="$dflt $flag";
5065 eval $callback
5066 ;;
5067 esac
5068 fi
c34316b3
NC
5069else
5070 echo "Nope, it does not, but that is ok." 2>&1;
5071fi
5072'
5073
bd9b35c9
JH
5074: We will not override a previous value, but we might want to
5075: augment a hint file
5076case "$hint" in
5077default|recommended)
5078 case "$gccversion" in
eaf812ae 5079 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5080 esac
eaf812ae
MB
5081 case "$optimize:$DEBUGGING" in
5082 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5083 esac
bd9b35c9 5084 case "$gccversion" in
580e570e 5085 2*) if $test -d /etc/conf/kconfig.d &&
bd9b35c9
JH
5086 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5087 then
00e89ad4 5088 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5089 dflt="$dflt -posix"
5090 fi
f0d04425 5091 ;;
bd9b35c9
JH
5092 esac
5093 case "$gccversion" in
5094 1*) ;;
5095 2.[0-8]*) ;;
c0bacbef 5096 ?*) set strict-aliasing -fno-strict-aliasing
c34316b3 5097 eval $checkccflag
f0d04425 5098 ;;
e5e20432 5099 esac
00e89ad4
AD
5100 # For gcc, adding -pipe speeds up compilations for some, but apparently
5101 # some assemblers can't read from stdin. (It also slows down compilations
5102 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5103 case "$gccversion" in
c34316b3
NC
5104 ?*) set pipe -pipe
5105 eval $checkccflag
00e89ad4
AD
5106 ;;
5107 esac
6682be1c
NC
5108
5109 # on x86_64 (at least) we require an extra library (libssp) in the
5110 # link command line. This library is not named, so I infer that it is
5111 # an implementation detail that may change. Hence the safest approach
5112 # is to add the flag to the flags passed to the compiler at link time,
5113 # as that way the compiler can do the right implementation dependant
5114 # thing. (NWC)
5115 case "$gccversion" in
8f68b0e6 5116 ?*) set stack-protector -fstack-protector
6682be1c
NC
5117 eval $checkccflag
5118 ;;
5119 esac
e5e20432
JH
5120 ;;
5121esac
5122
bd9b35c9
JH
5123case "$mips_type" in
5124*BSD*|'') inclwanted="$locincpth $usrinc";;
5125*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5126esac
5127for thisincl in $inclwanted; do
5128 if $test -d $thisincl; then
5129 if $test x$thisincl != x$usrinc; then
5130 case "$dflt" in
00e89ad4
AD
5131 *" -I$thisincl "*);;
5132 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5133 esac
5134 fi
5135 fi
5136done
40a7a20a 5137
bd9b35c9
JH
5138inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5139 xxx=true;
5140elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5141 xxx=true;
5142else
5143 xxx=false;
5144fi;
5145if $xxx; then
5146 case "$dflt" in
5147 *$2*);;
5148 *) dflt="$dflt -D$2";;
5149 esac;
5150fi'
40a7a20a 5151
bd9b35c9 5152set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5153
bd9b35c9
JH
5154case "$usesocks" in
5155$define)
5156 ccflags="$ccflags -DSOCKS"
5157 ;;
5158esac
40a7a20a 5159
bd9b35c9
JH
5160case "$hint" in
5161default|recommended) dflt="$ccflags $dflt" ;;
5162*) dflt="$ccflags";;
5163esac
40a7a20a 5164
bd9b35c9
JH
5165case "$dflt" in
5166''|' ') dflt=none;;
5167esac
422af00a 5168
bd9b35c9 5169$cat <<EOH
40a7a20a 5170
bd9b35c9
JH
5171Your C compiler may want other flags. For this question you should include
5172-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5173but you should NOT include libraries or ld flags like -lwhatever. If you
5174want $package to honor its debug switch, you should include -DDEBUGGING here.
5175Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5176
bd9b35c9 5177To use no flags, specify the word "none".
40a7a20a 5178
bd9b35c9
JH
5179EOH
5180set X $dflt
5181shift
5182dflt=${1+"$@"}
5183rp="Any additional cc flags?"
5184. ./myread
5185case "$ans" in
5186none) ccflags='';;
5187*) ccflags="$ans";;
5188esac
8e07c86e 5189
bd9b35c9 5190: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5191case "$cppflags" in
5192'') cppflags="$ccflags" ;;
5193*) cppflags="$cppflags $ccflags" ;;
5194esac
bd9b35c9
JH
5195case "$gccversion" in
51961*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5197esac
bd9b35c9
JH
5198case "$mips_type" in
5199'');;
5200*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5201esac
5202case "$cppflags" in
5203'');;
5204*)
5205 echo " "
5206 echo "Let me guess what the preprocessor flags are..." >&4
5207 set X $cppflags
5208 shift
5209 cppflags=''
5210 $cat >cpp.c <<'EOM'
5211#define BLURFL foo
8e07c86e 5212
bd9b35c9
JH
5213BLURFL xx LFRULB
5214EOM
5215 previous=''
5216 for flag in $*
5217 do
5218 case "$flag" in
5219 -*) ftry="$flag";;
5220 *) ftry="$previous $flag";;
5221 esac
5222 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5223 >cpp1.out 2>/dev/null && \
5224 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5225 >cpp2.out 2>/dev/null && \
5226 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5227 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5228 then
5229 cppflags="$cppflags $ftry"
5230 previous=''
5231 else
5232 previous="$flag"
5233 fi
5234 done
5235 set X $cppflags
5236 shift
5237 cppflags=${1+"$@"}
5238 case "$cppflags" in
5239 *-*) echo "They appear to be: $cppflags";;
5240 esac
5241 $rm -f cpp.c cpp?.out
2afac517 5242 ;;
5243esac
8e07c86e 5244
bd9b35c9
JH
5245: flags used in final linking phase
5246case "$ldflags" in
5247'') if ./venix; then
5248 dflt='-i -z'
10a23457 5249 else
bd9b35c9 5250 dflt=''
10a23457 5251 fi
bd9b35c9
JH
5252 case "$ccflags" in
5253 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5254 esac
bd9b35c9
JH
5255 ;;
5256*) dflt="$ldflags";;
5257esac
b2f871ed
AD
5258# See note above about -fstack-protector
5259case "$ccflags" in
5260*-fstack-protector*)
5261 case "$dflt" in
5262 *-fstack-protector*) ;; # Don't add it again
5263 *) dflt="$dflt -fstack-protector" ;;
5264 esac
5265 ;;
5266esac
bd9b35c9
JH
5267
5268: Try to guess additional flags to pick up local libraries.
5269for thislibdir in $libpth; do
5270 case " $loclibpth " in
5271 *" $thislibdir "*)
00e89ad4 5272 case "$dflt " in
bd9b35c9
JH
5273 *"-L$thislibdir "*) ;;
5274 *) dflt="$dflt -L$thislibdir" ;;
5275 esac
c4f23d77
AD
5276 ;;
5277 esac
bd9b35c9 5278done
c4f23d77 5279
bd9b35c9
JH
5280case "$dflt" in
5281'') dflt='none' ;;
5282esac
c4f23d77 5283
bd9b35c9
JH
5284$cat <<EOH
5285
5286Your C linker may need flags. For this question you should
5287include -L/whatever and any other flags used by the C linker, but you
5288should NOT include libraries like -lwhatever.
5289
5290Make sure you include the appropriate -L/path flags if your C linker
5291does not normally search all of the directories you specified above,
5292namely
5293 $libpth
5294To use no flags, specify the word "none".
5295
5296EOH
5297
5298rp="Any additional ld flags (NOT including libraries)?"
5299. ./myread
5300case "$ans" in
5301none) ldflags='';;
5302*) ldflags="$ans";;
5303esac
5304rmlist="$rmlist pdp11"
5305
5306: coherency check
5307echo " "
5308echo "Checking your choice of C compiler and flags for coherency..." >&4
5309$cat > try.c <<'EOF'
5310#include <stdio.h>
55954f19 5311int main() { printf("Ok\n"); return(0); }
bd9b35c9 5312EOF
7a282f6d 5313set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5314shift
5315$cat >try.msg <<'EOM'
5316I've tried to compile and run the following simple program:
5317
5318EOM
5319$cat try.c >> try.msg
5320
5321$cat >> try.msg <<EOM
5322
5323I used the command:
5324
5325 $*
5440bc8e 5326 $run ./try
bd9b35c9
JH
5327
5328and I got the following output:
5329
5330EOM
5331dflt=y
73614538 5332if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
613d6c3e 5333 if $sh -c "$run ./try " >>try.msg 2>&1; then
5440bc8e 5334 xxx=`$run ./try`
bd9b35c9
JH
5335 case "$xxx" in
5336 "Ok") dflt=n ;;
5337 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5338 case " $libs " in
5339 *" -lsfio "*)
5340 cat >> try.msg <<'EOQS'
5341If $libs contains -lsfio, and sfio is mis-configured, then it
5342sometimes (apparently) runs and exits with a 0 status, but with no
5343output! It may have to do with sfio's use of _exit vs. exit.
5344
5345EOQS
5346 rp="You have a big problem. Shall I abort Configure"
5347 dflt=y
5348 ;;
5349 esac
5350 ;;
5351 esac
5352 else
5353 echo "The program compiled OK, but exited with status $?." >>try.msg
5354 rp="You have a problem. Shall I abort Configure"
5355 dflt=y
5356 fi
5357else
5358 echo "I can't compile the test program." >>try.msg
5359 rp="You have a BIG problem. Shall I abort Configure"
5360 dflt=y
5361fi
5362case "$dflt" in
5363y)
5364 $cat try.msg >&4
5365 case "$knowitall" in
5366 '')
5367 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5368 ;;
bd9b35c9 5369 *) dflt=n;;
c4f23d77 5370 esac
bd9b35c9
JH
5371 echo " "
5372 . ./myread
5373 case "$ans" in
5374 n*|N*) ;;
5375 *) echo "Ok. Stopping Configure." >&4
5376 exit 1
c4f23d77
AD
5377 ;;
5378 esac
5379 ;;
bd9b35c9 5380n) echo "OK, that should do.";;
c4f23d77 5381esac
613d6c3e 5382$rm_try gcctest gcctest.out
c4f23d77 5383
bd9b35c9
JH
5384: define a shorthand compile call
5385compile='
5386mc_file=$1;
5387shift;
08593cf4
NC
5388case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5389echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5390exit 1;
5391fi;
5392esac;
08413ebc 5393$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5394: define a shorthand compile call for compilations that should be ok.
5395compile_ok='
5396mc_file=$1;
5397shift;
7a282f6d 5398$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5399
8dfa8df9
JH
5400: determine filename position in cpp output
5401echo " "
5402echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5403case "$osname" in
5404vos) testaccess=-e ;;
5405*) testaccess=-r ;;
5406esac
8dfa8df9
JH
5407echo '#include <stdio.h>' > foo.c
5408$cat >fieldn <<EOF
5409$startsh
5410$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5411$grep '^[ ]*#.*stdio\.h' | \
5412while read cline; do
5413 pos=1
5414 set \$cline
5415 while $test \$# -gt 0; do
a5a94ea5 5416 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5417 echo "\$pos"
5418 exit 0
5419 fi
5420 shift
5421 pos=\`expr \$pos + 1\`
5422 done
5423done
5424EOF
5425chmod +x fieldn
5426fieldn=`./fieldn`
5427$rm -f foo.c fieldn
5428case $fieldn in
5429'') pos='???';;
54301) pos=first;;
54312) pos=second;;
54323) pos=third;;
5433*) pos="${fieldn}th";;
5434esac
5435echo "Your cpp writes the filename in the $pos field of the line."
5436
3c728e00
JH
5437case "$osname" in
5438vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5439os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5440*) cppfilter='' ;;
5441esac
8dfa8df9
JH
5442: locate header file
5443$cat >findhdr <<EOF
5444$startsh
5445wanted=\$1
5446name=''
5447for usrincdir in $usrinc
5448do
5449 if test -f \$usrincdir/\$wanted; then
5450 echo "\$usrincdir/\$wanted"
5451 exit 0
5452 fi
5453done
5454awkprg='{ print \$$fieldn }'
5455echo "#include <\$wanted>" > foo\$\$.c
5456$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5457$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5458while read cline; do
5459 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5460 case "\$name" in
5461 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5462 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5463 *) exit 2;;
5464 esac;
5465done;
5466#
5467# status = 0: grep returned 0 lines, case statement not executed
5468# status = 1: headerfile found
5469# status = 2: while loop executed, no headerfile found
5470#
5471status=\$?
5472$rm -f foo\$\$.c;
5473if test \$status -eq 1; then
5474 exit 0;
5475fi
5476exit 1
5477EOF
5478chmod +x findhdr
5479
5480: define an alternate in-header-list? function
5481inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5482cont=true; xxf="echo \"<\$1> found.\" >&4";
5483case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5484*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5485esac;
5486case $# in 4) instead=instead;; *) instead="at last";; esac;
5487while $test "$cont"; do
5488 xxx=`./findhdr $1`
5489 var=$2; eval "was=\$$2";
5490 if $test "$xxx" && $test -r "$xxx";
5491 then eval $xxf;
5492 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5493 cont="";
5494 else eval $xxnf;
5495 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5496 set $yyy; shift; shift; yyy=$@;
5497 case $# in 0) cont="";;
5498 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5499 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5500 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5501 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5502 esac;
5503done;
5504while $test "$yyy";
5505do set $yyy; var=$2; eval "was=\$$2";
5506 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5507 set $yyy; shift; shift; yyy=$@;
5508done'
5509
d1daaddf
JH
5510: see if stdlib is available
5511set stdlib.h i_stdlib
5512eval $inhdr
5513
5514: check for lengths of integral types
5515echo " "
5516case "$intsize" in
5517'')
5518 echo "Checking to see how big your integers are..." >&4
c63dfae1 5519 $cat >try.c <<EOCP
d1daaddf
JH
5520#include <stdio.h>
5521#$i_stdlib I_STDLIB
5522#ifdef I_STDLIB
5523#include <stdlib.h>
5524#endif
5525int main()
5526{
5527 printf("intsize=%d;\n", (int)sizeof(int));
5528 printf("longsize=%d;\n", (int)sizeof(long));
5529 printf("shortsize=%d;\n", (int)sizeof(short));
5530 exit(0);
5531}
5532EOCP
5533 set try
5534 if eval $compile_ok && $run ./try > /dev/null; then
5535 eval `$run ./try`
5536 echo "Your integers are $intsize bytes long."
5537 echo "Your long integers are $longsize bytes long."
5538 echo "Your short integers are $shortsize bytes long."
5539 else
5540 $cat >&4 <<EOM
5541!
5542Help! I can't compile and run the intsize test program: please enlighten me!
5543(This is probably a misconfiguration in your system or libraries, and
5544you really ought to fix it. Still, I'll try anyway.)
5545!
5546EOM
5547 dflt=4
5548 rp="What is the size of an integer (in bytes)?"
5549 . ./myread
5550 intsize="$ans"
5551 dflt=$intsize
5552 rp="What is the size of a long integer (in bytes)?"
5553 . ./myread
5554 longsize="$ans"
5555 dflt=2
5556 rp="What is the size of a short integer (in bytes)?"
5557 . ./myread
5558 shortsize="$ans"
5559 fi
5560 ;;
5561esac
5b813a60 5562$rm_try
d1daaddf
JH
5563
5564: check for long long
5565echo " "
5566echo "Checking to see if you have long long..." >&4
5567echo 'int main() { long long x = 7; return 0; }' > try.c
5568set try
5569if eval $compile; then
5570 val="$define"
5571 echo "You have long long."
5572else
5573 val="$undef"
5574 echo "You do not have long long."
5575fi
5b813a60 5576$rm_try
d1daaddf
JH
5577set d_longlong
5578eval $setvar
5579
5580: check for length of long long
5581case "${d_longlong}${longlongsize}" in
5582$define)
5583 echo " "
5584 echo "Checking to see how big your long longs are..." >&4
5585 $cat >try.c <<'EOCP'
5586#include <stdio.h>
5587int main()
5588{
5589 printf("%d\n", (int)sizeof(long long));
5590 return(0);
5591}
5592EOCP
5593 set try
5594 if eval $compile_ok; then
5595 longlongsize=`$run ./try`
5596 echo "Your long longs are $longlongsize bytes long."
5597 else
5598 dflt='8'
5599 echo " "
5600 echo "(I can't seem to compile the test program. Guessing...)"
5601 rp="What is the size of a long long (in bytes)?"
5602 . ./myread
5603 longlongsize="$ans"
5604 fi
5605 if $test "X$longsize" = "X$longlongsize"; then
5606 echo "(That isn't any different from an ordinary long.)"
5b813a60 5607 fi
d1daaddf
JH
5608 ;;
5609esac
5b813a60 5610$rm_try
d1daaddf 5611
8dfa8df9
JH
5612: see if inttypes.h is available
5613: we want a real compile instead of Inhdr because some systems
5614: have an inttypes.h which includes non-existent headers
5615echo " "
5616$cat >try.c <<EOCP
5617#include <inttypes.h>
5618int main() {
5619 static int32_t foo32 = 0x12345678;
5620}
5621EOCP
5622set try
5623if eval $compile; then
5624 echo "<inttypes.h> found." >&4
5625 val="$define"
5626else
5627 echo "<inttypes.h> NOT found." >&4
5628 val="$undef"
5629fi
5b813a60 5630$rm_try
8dfa8df9
JH
5631set i_inttypes
5632eval $setvar
5633
5634: check for int64_t
5635echo " "
5636echo "Checking to see if you have int64_t..." >&4
5637$cat >try.c <<EOCP
5638#include <sys/types.h>
5639#$i_inttypes I_INTTYPES
5640#ifdef I_INTTYPES
5641#include <inttypes.h>
5642#endif
5643int main() { int64_t x = 7; }
5644EOCP
5645set try
5646if eval $compile; then
5647 val="$define"
5648 echo "You have int64_t."
5649else
5650 val="$undef"
5651 echo "You do not have int64_t."
5652fi
5b813a60 5653$rm_try
8dfa8df9
JH
5654set d_int64_t
5655eval $setvar
5656
613d6c3e 5657: Check if 64bit ints have a quad type
8dfa8df9
JH
5658echo " "
5659echo "Checking which 64-bit integer type we could use..." >&4
5660
5661case "$intsize" in
56628) val=int
5663 set quadtype
5664 eval $setvar
5665 val='"unsigned int"'
5666 set uquadtype
5667 eval $setvar
5668 quadkind=1
5669 ;;
5670*) case "$longsize" in
5671 8) val=long
5672 set quadtype
5673 eval $setvar
5674 val='"unsigned long"'
5675 set uquadtype
5676 eval $setvar
5677 quadkind=2
5678 ;;
5679 *) case "$d_longlong:$longlongsize" in
5680 define:8)
5681 val='"long long"'
5682 set quadtype
5683 eval $setvar
5684 val='"unsigned long long"'
5685 set uquadtype
5686 eval $setvar
5687 quadkind=3
5688 ;;
5689 *) case "$d_int64_t" in
5690 define)
5691 val=int64_t
5692 set quadtype
5693 eval $setvar
5694 val=uint64_t
5695 set uquadtype
5696 eval $setvar
5697 quadkind=4
5698 ;;
5699 esac
5700 ;;
5701 esac
5702 ;;
5703 esac
5704 ;;
5705esac
5706
5707case "$quadtype" in
5708'') echo "Alas, no 64-bit integer types in sight." >&4
5709 d_quad="$undef"
5710 ;;
5711*) echo "We could use '$quadtype' for 64-bit integers." >&4
5712 d_quad="$define"
5713 ;;
5714esac
5715
34f1896b 5716: Do we want 64bit support
b4eb6b3d
JH
5717case "$uselonglong" in
5718"$define"|true|[yY]*)
5719 cat <<EOM >&4
5720
5721*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5722EOM
5723 use64bitint="$define"
5724 ;;
613d6c3e 5725esac
b4eb6b3d
JH
5726case "$use64bits" in
5727"$define"|true|[yY]*)
5728 cat <<EOM >&4
5729
5730*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5731EOM
5732 use64bitint="$define"
5733 ;;
613d6c3e 5734esac
b4eb6b3d
JH
5735case "$use64bitints" in
5736"$define"|true|[yY]*)
5737 cat <<EOM >&4
5738
5739*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5740EOM
5741 use64bitint="$define"
5742 ;;
613d6c3e 5743esac
b4eb6b3d
JH
5744case "$use64bitsint" in
5745"$define"|true|[yY]*)
5746 cat <<EOM >&4
5747
5748*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5749EOM
5750 use64bitint="$define"
5751 ;;
613d6c3e 5752esac
b4eb6b3d
JH
5753case "$uselonglongs" in
5754"$define"|true|[yY]*)
5755 cat <<EOM >&4
5756
5757*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5758EOM
5759 use64bitint="$define"
5760 ;;
613d6c3e 5761esac
b4eb6b3d
JH
5762case "$use64bitsall" in
5763"$define"|true|[yY]*)
5764 cat <<EOM >&4
5765
5766*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5767EOM
5768 use64bitall="$define"
5769 ;;
613d6c3e 5770esac
b4eb6b3d
JH
5771
5772case "$ccflags" in
5773*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5774esac
5775case "$use64bitall" in
5776"$define"|true|[yY]*) use64bitint="$define" ;;
5777esac
5778
5779case "$longsize" in
57808) cat <<EOM
5781
5782You have natively 64-bit long integers.
5783EOM
5784 val="$define"
5785 ;;
5786*) case "$use64bitint" in
5787 "$define"|true|[yY]*) dflt='y';;
5788 *) dflt='n';;
5789 esac
8dfa8df9
JH
5790 case "$d_quad" in
5791 "$define") ;;
5792 *) dflt='n' ;;
5793 esac
b4eb6b3d
JH
5794 cat <<EOM
5795
5796Perl can be built to take advantage of 64-bit integer types
5797on some systems. To do so, Configure can be run with -Duse64bitint.
5798Choosing this option will most probably introduce binary incompatibilities.
5799
5800If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5801(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5802EOM
5803 rp='Try to use 64-bit integers, if available?'
5804 . ./myread
5805 case "$ans" in
5806 [yY]*) val="$define" ;;
5807 *) val="$undef" ;;
5808 esac
5809 ;;
5810esac
5811set use64bitint
5812eval $setvar
5813
5814case "$use64bitall" in
5815"$define"|true|[yY]*) dflt='y' ;;
5816*) case "$longsize" in
5817 8) dflt='y' ;;
5818 *) dflt='n' ;;
5819 esac
5820 ;;
613d6c3e 5821esac
b4eb6b3d
JH
5822cat <<EOM
5823
5824You may also choose to try maximal 64-bitness. It means using as much
582564-bitness as possible on the platform. This in turn means even more
5826binary incompatibilities. On the other hand, your platform may not
5827have any more 64-bitness available than what you already have chosen.
5828
5829If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5830(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5831EOM
5832rp='Try to use maximal 64-bit support, if available?'
5833. ./myread
5834case "$ans" in
5835[yY]*) val="$define" ;;
5836*) val="$undef" ;;
5837esac
5838set use64bitall
5839eval $setvar
5840case "$use64bitall" in
5841"$define")
5842 case "$use64bitint" in
5843 "$undef")
5844 cat <<EOM
5845
5846Since you have chosen a maximally 64-bit build, I'm also turning on
5847the use of 64-bit integers.
5848EOM
5849 use64bitint="$define" ;;
5850 esac
5851 ;;
5852esac
5853
b4eb6b3d
JH
5854: Look for a hint-file generated 'call-back-unit'. If the
5855: user has specified that a 64-bit perl is to be built,
5856: we may need to set or change some other defaults.
19a100ff 5857if $test -f use64bitint.cbu; then
9da7673b 5858 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5859 . ./use64bitint.cbu
5860fi
9da7673b
MB
5861case "$use64bitint" in
5862"$define"|true|[yY]*)
b4eb6b3d
JH
5863 case "$longsize" in
5864 4) case "$archname64" in
5865 '') archname64=64int ;;
5866 esac
5867 ;;
5868 esac
5869 ;;
5870esac
5871
b4eb6b3d
JH
5872: Look for a hint-file generated 'call-back-unit'. If the
5873: user has specified that a maximally 64-bit perl is to be built,
5874: we may need to set or change some other defaults.
19a100ff 5875if $test -f use64bitall.cbu; then
9da7673b 5876 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5877 . ./use64bitall.cbu
5878fi
9da7673b
MB
5879case "$use64bitall" in
5880"$define"|true|[yY]*)
b4eb6b3d
JH
5881 case "$longsize" in
5882 4) case "$archname64" in
5883 ''|64int) archname64=64all ;;
5884 esac
5885 ;;
5886 esac
5887 ;;
5888esac
5889
1911a026
JH
5890case "$d_quad:$use64bitint" in
5891$undef:$define)
5892 cat >&4 <<EOF
5893
5894*** You have chosen to use 64-bit integers,
19a100ff 5895*** but none can be found.
09b58c7b 5896*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5897*** Cannot continue, aborting.
5898
5899EOF
5900 exit 1
5901 ;;
5902esac
5903
36adc09b
JH
5904: check for length of double
5905echo " "
5906case "$doublesize" in
5907'')
5908 echo "Checking to see how big your double precision numbers are..." >&4
5909 $cat >try.c <<EOCP
5910#include <stdio.h>
1911a026
JH
5911#$i_stdlib I_STDLIB
5912#ifdef I_STDLIB
5913#include <stdlib.h>
5914#endif
36adc09b
JH
5915int main()
5916{
5917 printf("%d\n", (int)sizeof(double));
1911a026 5918 exit(0);
36adc09b
JH
5919}
5920EOCP
5921 set try
5922 if eval $compile_ok; then
5923 doublesize=`$run ./try`
5924 echo "Your double is $doublesize bytes long."
5925 else
5926 dflt='8'
5927 echo "(I can't seem to compile the test program. Guessing...)"
5928 rp="What is the size of a double precision number (in bytes)?"
5929 . ./myread
5930 doublesize="$ans"
5931 fi
5932 ;;
5933esac
5b813a60 5934$rm_try
36adc09b
JH
5935
5936: check for long doubles
5937echo " "
5938echo "Checking to see if you have long double..." >&4
5939echo 'int main() { long double x = 7.0; }' > try.c
5940set try
5941if eval $compile; then
5942 val="$define"
5943 echo "You have long double."
5944else
5945 val="$undef"
5946 echo "You do not have long double."
5947fi
5b813a60 5948$rm_try
36adc09b
JH
5949set d_longdbl
5950eval $setvar
5951
5952: check for length of long double
5953case "${d_longdbl}${longdblsize}" in
5954$define)
5955 echo " "
5956 echo "Checking to see how big your long doubles are..." >&4
5957 $cat >try.c <<'EOCP'
5958#include <stdio.h>
5959int main()
5960{
5961 printf("%d\n", sizeof(long double));
5962}
5963EOCP
5964 set try
5965 set try
5966 if eval $compile; then
5967 longdblsize=`$run ./try`
5968 echo "Your long doubles are $longdblsize bytes long."
5969 else
5970 dflt='8'
5971 echo " "
5972 echo "(I can't seem to compile the test program. Guessing...)" >&4
5973 rp="What is the size of a long double (in bytes)?"
5974 . ./myread
5975 longdblsize="$ans"
5976 fi
5977 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5978 echo "That isn't any different from an ordinary double."
5979 echo "I'll keep your setting anyway, but you may see some"
5980 echo "harmless compilation warnings."
5b813a60 5981 fi
36adc09b
JH
5982 ;;
5983esac
5b813a60 5984$rm_try
36adc09b 5985
89ce900e 5986: determine the architecture name
b4eb6b3d 5987echo " "
89ce900e
JH
5988if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5989 tarch=`arch`"-$osname"
5990elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5991 if uname -m > tmparch 2>&1 ; then
5992 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5993 -e 's/$/'"-$osname/" tmparch`
5994 else
5995 tarch="$osname"
5996 fi
5997 $rm -f tmparch
b4eb6b3d 5998else
89ce900e 5999 tarch="$osname"
b4eb6b3d 6000fi
89ce900e
JH
6001case "$myarchname" in
6002''|"$tarch") ;;
6003*)
6004 echo "(Your architecture name used to be $myarchname.)"
6005 archname=''
6006 ;;
6007esac
6008case "$targetarch" in
6009'') ;;
6010*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6011esac
6012myarchname="$tarch"
6013case "$archname" in
6014'') dflt="$tarch";;
6015*) dflt="$archname";;
6016esac
6017rp='What is your architecture name'
6018. ./myread
6019archname="$ans"
6020case "$usethreads" in
6021$define)
6022 echo "Threads selected." >&4
6023 case "$archname" in
6024 *-thread*) echo "...and architecture name already has -thread." >&4
6025 ;;
6026 *) archname="$archname-thread"
6027 echo "...setting architecture name to $archname." >&4
6028 ;;
6029 esac
6030 ;;
6031esac
6032case "$usemultiplicity" in
6033$define)
6034 echo "Multiplicity selected." >&4
6035 case "$archname" in
6036 *-multi*) echo "...and architecture name already has -multi." >&4
6037 ;;
6038 *) archname="$archname-multi"
6039 echo "...setting architecture name to $archname." >&4
6040 ;;
6041 esac
6042 ;;
6043esac
6044case "$use64bitint$use64bitall" in
6045*"$define"*)
6046 case "$archname64" in
6047 '')
6048 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6049 ;;
89ce900e
JH
6050 *)
6051 case "$use64bitint" in
6052 "$define") echo "64 bit integers selected." >&4 ;;
6053 esac
6054 case "$use64bitall" in
6055 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6056 esac
6057 case "$archname" in
6058 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6059 ;;
6060 *) archname="$archname-$archname64"
6061 echo "...setting architecture name to $archname." >&4
6062 ;;
6063 esac
c1a7f87b
JH
6064 ;;
6065 esac
89ce900e
JH
6066esac
6067case "$uselongdouble" in
6068$define)
6069 echo "Long doubles selected." >&4
6070 case "$longdblsize" in
6071 $doublesize)
6072 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6073 ;;
6074 *)
6075 case "$archname" in
6076 *-ld*) echo "...and architecture name already has -ld." >&4
6077 ;;
6078 *) archname="$archname-ld"
6079 echo "...setting architecture name to $archname." >&4
6080 ;;
6081 esac
bd9b35c9
JH
6082 ;;
6083 esac
bd9b35c9 6084 ;;
89ce900e 6085esac
d2e0c6f7
JH
6086if $test -f archname.cbu; then
6087 echo "Your platform has some specific hints for architecture name, using them..."
6088 . ./archname.cbu
6089fi
bd9b35c9 6090
b4eb6b3d
JH
6091: set the prefixit variable, to compute a suitable default value
6092prefixit='case "$3" in
6093""|none)
6094 case "$oldprefix" in
6095 "") eval "$1=\"\$$2\"";;
6096 *)
6097 case "$3" in
6098 "") eval "$1=";;
6099 none)
6100 eval "tp=\"\$$2\"";
6101 case "$tp" in
6102 ""|" ") eval "$1=\"\$$2\"";;
6103 *) eval "$1=";;
6104 esac;;
6105 esac;;
6106 esac;;
6107*)
6108 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6109 case "$tp" in
6110 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6111 /*-$oldprefix/*|\~*-$oldprefix/*)
6112 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6113 *) eval "$1=\"\$$2\"";;
6114 esac;;
6115esac'
6116
f3f1a2d8
MB
6117: determine installation style
6118: For now, try to deduce it from prefix unless it is already set.
6119: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6120case "$installstyle" in
6121'') case "$prefix" in
6122 *perl*) dflt='lib';;
6123 *) dflt='lib/perl5' ;;
6124 esac
6125 ;;
6126*) dflt="$installstyle" ;;
4d20abad 6127esac
f3f1a2d8
MB
6128: Probably not worth prompting for this since we prompt for all
6129: the directories individually, and the prompt would be too long and
6130: confusing anyway.
6131installstyle=$dflt
4d20abad 6132
eaf812ae
MB
6133: determine where public executables go
6134echo " "
6135set dflt bin bin
6136eval $prefixit
6137fn=d~
6138rp='Pathname where the public executables will reside?'
6139. ./getfile
6140if $test "X$ansexp" != "X$binexp"; then
6141 installbin=''
6142fi
6143prefixvar=bin
6144: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6145: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6146: this via initialinstalllocation
eaf812ae
MB
6147. ./setprefixvar
6148
6149case "$userelocatableinc" in
6150$define|true|[yY]*) dflt='y' ;;
6151*) dflt='n' ;;
6152esac
6153cat <<EOM
6154
6155Would you like to build Perl so that the installation is relocatable, so that
6156library paths in @INC are determined relative to the path of the perl binary?
6157This is not advised for system Perl installs, or if you need to run setid
6158scripts or scripts under taint mode.
6159
6160If this doesn't make any sense to you, just accept the default '$dflt'.
6161EOM
6162rp='Use relocatable @INC?'
6163. ./myread
6164case "$ans" in
6165y|Y) val="$define" ;;
6166*) val="$undef" ;;
6167esac
6168set userelocatableinc
6169eval $setvar
6170
ea7d701d 6171initialinstalllocation="$binexp"
eaf812ae
MB
6172: Default prefix is now "up one level from where the binaries are"
6173case "$userelocatableinc" in
6174$define|true|[yY]*)
eaf812ae
MB
6175 bin=".../"
6176 binexp=".../"
6177 prefix=".../.."
6178 prefixexp=".../.."
6179 installprefixexp=".../.."
6180 ;;
6181esac
6182
b4eb6b3d
JH
6183: determine where private library files go
6184: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6185: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6186: /opt/perl/lib/perl5... would be redundant.
6187: The default "style" setting is made in installstyle.U
6188case "$installstyle" in
6189*lib/perl5*) set dflt privlib lib/$package/$version ;;
6190*) set dflt privlib lib/$version ;;
6191esac
6192eval $prefixit
6193$cat <<EOM
6194
6195There are some auxiliary files for $package that need to be put into a
6196private library directory that is accessible by everyone.
6197
6198EOM
eaf812ae 6199fn=$binexp
b4eb6b3d
JH
6200fn=d~+
6201rp='Pathname where the private library files will reside?'
6202. ./getfile
79522dd2
NC
6203prefixvar=privlib
6204. ./setprefixvar
b4eb6b3d
JH
6205
6206: set the prefixup variable, to restore leading tilda escape
6207prefixup='case "$prefixexp" in
6208"$prefix") ;;
6209*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6210esac'
6211
6212: determine where public architecture dependent libraries go
6213set archlib archlib
6214eval $prefixit
6215: privlib default is /usr/local/lib/$package/$version
6216: archlib default is /usr/local/lib/$package/$version/$archname
6217: privlib may have an optional trailing /share.
6218tdflt=`echo $privlib | $sed 's,/share$,,'`
6219tdflt=$tdflt/$archname
6220case "$archlib" in
6221'') dflt=$tdflt
6222 ;;
6223*) dflt="$archlib"
6224 ;;
6225esac
6226$cat <<EOM
6227
6228$spackage contains architecture-dependent library files. If you are
6229sharing libraries in a heterogeneous environment, you might store
6230these files in a separate location. Otherwise, you can just include
6231them with the rest of the public library files.
6232
6233EOM
eaf812ae 6234fn=$binexp
b4eb6b3d
JH
6235fn=d+~
6236rp='Where do you want to put the public architecture-dependent libraries?'
6237. ./getfile
79522dd2
NC
6238prefixvar=archlib
6239. ./setprefixvar
b4eb6b3d
JH
6240if $test X"$archlib" = X"$privlib"; then
6241 d_archlib="$undef"
6242else
6243 d_archlib="$define"
6244fi
b4eb6b3d 6245
b4eb6b3d
JH
6246: see if setuid scripts can be secure
6247$cat <<EOM
6248
6249Some kernels have a bug that prevents setuid #! scripts from being
6250secure. Some sites have disabled setuid #! scripts because of this.
6251
6252First let's decide if your kernel supports secure setuid #! scripts.
6253(If setuid #! scripts would be secure but have been disabled anyway,
6254don't say that they are secure if asked.)
6255
6256EOM
6257
6258val="$undef"
6259if $test -d /dev/fd; then
6260 echo "#!$ls" >reflect
6261 chmod +x,u+s reflect
6262 ./reflect >flect 2>&1
6263 if $contains "/dev/fd" flect >/dev/null; then
6264 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6265 val="$define"
6266 else
6267 $cat <<EOM
6268If you are not sure if they are secure, I can check but I'll need a
6269username and password different from the one you are using right now.
6270If you don't have such a username or don't want me to test, simply
6271enter 'none'.
6272
6273EOM
6274 rp='Other username to test security of setuid scripts with?'
6275 dflt='none'
6276 . ./myread
6277 case "$ans" in
6278 n|none)
6279 case "$d_suidsafe" in
6280 '') echo "I'll assume setuid scripts are *not* secure." >&4
6281 dflt=n;;
6282 "$undef")
6283 echo "Well, the $hint value is *not* secure." >&4
6284 dflt=n;;
6285 *) echo "Well, the $hint value *is* secure." >&4
6286 dflt=y;;
6287 esac
c1a7f87b 6288 ;;
b4eb6b3d
JH
6289 *)
6290 $rm -f reflect flect
6291 echo "#!$ls" >reflect
6292 chmod +x,u+s reflect
6293 echo >flect
6294 chmod a+w flect
6295 echo '"su" will (probably) prompt you for '"$ans's password."
6296 su $ans -c './reflect >flect'
6297 if $contains "/dev/fd" flect >/dev/null; then
6298 echo "Okay, it looks like setuid scripts are secure." >&4
6299 dflt=y
6300 else
6301 echo "I don't think setuid scripts are secure." >&4
6302 dflt=n
6303 fi
6304 ;;
6305 esac
6306 rp='Does your kernel have *secure* setuid scripts?'
6307 . ./myread
6308 case "$ans" in
6309 [yY]*) val="$define";;
6310 *) val="$undef";;
6311 esac
6312 fi
6313else
6314 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6315 echo "(That's for file descriptors, not floppy disks.)"
6316 val="$undef"
6317fi
6318set d_suidsafe
6319eval $setvar
6320
6321$rm -f reflect flect
6322
6323: now see if they want to do setuid emulation
01614441 6324if $test $patchlevel -lt 11; then
b4eb6b3d
JH
6325echo " "
6326val="$undef"
6327case "$d_suidsafe" in
6328"$define")
6329 val="$undef"
3c728e00 6330 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6331 ;;
f3f1a2d8
MB
6332*)
6333 $cat <<EOM
6334Some systems have disabled setuid scripts, especially systems where
6335setuid scripts cannot be secure. On systems where setuid scripts have
6336been disabled, the setuid/setgid bits on scripts are currently
6337useless. It is possible for $package to detect those bits and emulate
6338setuid/setgid in a secure fashion. This emulation will only work if
6339setuid scripts have been disabled in your kernel.
6340
6341EOM
6342 case "$d_dosuid" in
6343 "$define") dflt=y ;;
6344 *) dflt=n ;;
6345 esac
6346 rp="Do you want to do setuid/setgid emulation?"
6347 . ./myread
6348 case "$ans" in
6349 [yY]*) val="$define";;
6350 *) val="$undef";;
6351 esac
6352 ;;
6353esac
6354set d_dosuid
6355eval $setvar
01614441
MB
6356else
6357 case "$d_dosuid" in
6358 "$define")
6359 cat >&4 <<EOH
6360
6361SUID emulation has been removed for 5.12
6362Please re-run Configure without -Dd_dosuid
6363
6364EOH
6365 exit 1;
6366 ;;
6367 esac
6368 d_dosuid=undef
6369fi
f3f1a2d8 6370
f3f1a2d8
MB
6371: Find perl5.005 or later.
6372echo "Looking for a previously installed perl5.005 or later... "
6373case "$perl5" in
6374'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6375 : Check if this perl is recent and can load a simple module
6376 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6377 perl5=$tdir/perl
6378 break;
6379 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6380 perl5=$tdir/perl5
6381 break;
6382 fi
6383 done
6384 ;;
6385*) perl5="$perl5"
6386 ;;
6387esac
6388case "$perl5" in
6389'') echo "None found. That's ok.";;
6390*) echo "Using $perl5." ;;
6391esac
6392
613d6c3e 6393: Set the siteprefix variables
f3f1a2d8
MB
6394$cat <<EOM
6395
6396After $package is installed, you may wish to install various
6397add-on modules and utilities. Typically, these add-ons will
6398be installed under $prefix with the rest
6399of this package. However, you may wish to install such add-ons
6400elsewhere under a different prefix.
6401
6402If you do not wish to put everything under a single prefix, that's
6403ok. You will be prompted for the individual locations; this siteprefix
6404is only used to suggest the defaults.
6405
6406The default should be fine for most people.
6407
6408EOM
6409fn=d~+
6410rp='Installation prefix to use for add-on modules and utilities?'
6411: XXX Here might be another good place for an installstyle setting.
6412case "$siteprefix" in
6413'') dflt=$prefix ;;
6414*) dflt=$siteprefix ;;
6415esac
6416. ./getfile
6417: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6418oldsiteprefix=''
6419case "$siteprefix" in
6420'') ;;
6421*) case "$ans" in
6422 "$prefix") ;;
6423 *) oldsiteprefix="$prefix";;
6424 esac
6425 ;;
6426esac
6427siteprefix="$ans"
6428siteprefixexp="$ansexp"
6429
6430: determine where site specific libraries go.
6431: Usual default is /usr/local/lib/perl5/site_perl/$version
6432: The default "style" setting is made in installstyle.U
6433: XXX No longer works with Prefixit stuff.
6434prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6435case "$sitelib" in
6436'') case "$installstyle" in
6437 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6438 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6439 esac
6440 ;;
6441*) dflt="$sitelib"
6442 ;;
6443esac
6444$cat <<EOM
6445
6446The installation process will create a directory for
6447site-specific extensions and modules. Most users find it convenient
6448to place all site-specific files in this directory rather than in the
6449main distribution directory.
6450
6451EOM
6452fn=d~+
6453rp='Pathname for the site-specific library files?'
6454. ./getfile
6455prefixvar=sitelib
6456. ./setprefixvar
6457sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6458
6459: Determine list of previous versions to include in @INC
6460$cat > getverlist <<EOPL
6461#!$perl5 -w
6462use File::Basename;
6463\$api_versionstring = "$api_versionstring";
6464\$version = "$version";
6465\$stem = "$sitelib_stem";
6466\$archname = "$archname";
6467EOPL
6468 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6469# The list found is store twice for each entry: the original name, and
6470# the binary broken down version as pack "sss", so sorting is easy and
6471# unambiguous. This will work for all versions that have a maximum of
6472# three digit groups, separate by '.'s or '_'s. Names are extended with
6473# ".0.0" to ensure at least three elements for the pack.
6474# -- H.Merijn Brand (m)'06 23-10-2006
6475
f3f1a2d8
MB
6476# Can't have leading @ because metaconfig interprets it as a command!
6477;@inc_version_list=();
6478# XXX Redo to do opendir/readdir?
6479if (-d $stem) {
6480 chdir($stem);
13cfc98d
MB
6481 ;@candidates = map {
6482 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
a71f1801 6483 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
f3f1a2d8
MB
6484}
6485else {
6486 ;@candidates = ();
6487}
6488
13cfc98d
MB
6489($pversion, $aversion, $vsn5005) = map {
6490 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6491foreach $d (@candidates) {
13cfc98d
MB
6492 if ($d->[1] lt $pversion) {
6493 if ($d->[1] ge $aversion) {
6494 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6495 }
13cfc98d
MB
6496 elsif ($d->[1] ge $vsn5005) {
6497 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6498 }
6499 }
6500 else {
6501 # Skip newer version. I.e. don't look in
6502 # 5.7.0 if we're installing 5.6.1.
6503 }
6504}
6505
6506if (@inc_version_list) {
6507 print join(' ', @inc_version_list);
6508}
6509else {
6510 # Blank space to preserve value for next Configure run.
6511 print " ";
6512}
6513EOPL
6514chmod +x getverlist
6515case "$inc_version_list" in
6516'') if test -x "$perl5$exe_ext"; then
6517 dflt=`$perl5 getverlist`
6518 else
6519 dflt='none'
6520 fi
6521 ;;
6522$undef) dflt='none' ;;
6523*) eval dflt=\"$inc_version_list\" ;;
6524esac
6525case "$dflt" in
6526''|' ') dflt=none ;;
6527esac
6528case "$dflt" in
65295.005) dflt=none ;;
6530esac
6531$cat <<EOM
6532
6533In order to ease the process of upgrading, this version of perl
6534can be configured to use modules built and installed with earlier
6535versions of perl that were installed under $prefix. Specify here
6536the list of earlier versions that this version of perl should check.
6537If Configure detected no earlier versions of perl installed under
6538$prefix, then the list will be empty. Answer 'none' to tell perl
6539to not search earlier versions.
b4eb6b3d 6540
f3f1a2d8
MB
6541The default should almost always be sensible, so if you're not sure,
6542just accept the default.
b4eb6b3d 6543EOM
f3f1a2d8
MB
6544
6545rp='List of earlier versions to include in @INC?'
6546. ./myread
6547case "$ans" in
6548[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6549*) inc_version_list="$ans" ;;
6550esac
6551case "$inc_version_list" in
6552''|' ')
6553 inc_version_list_init='0'
6554 d_inc_version_list="$undef"
6555 ;;
6556*) inc_version_list_init=`echo $inc_version_list |
6557 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6558 d_inc_version_list="$define"
b4eb6b3d
JH
6559 ;;
6560esac
f3f1a2d8 6561$rm -f getverlist
b4eb6b3d 6562
1cd66f7c
DD
6563: see if malloc/malloc.h has to be included
6564set malloc/malloc.h i_mallocmalloc
6565eval $inhdr
6566
b4eb6b3d 6567: see if this is a malloc.h system
01d07975
YST
6568: we want a real compile instead of Inhdr because some systems have a
6569: malloc.h that just gives a compile error saying to use stdlib.h instead
6570echo " "
6571$cat >try.c <<EOCP
6572#include <stdlib.h>
6573#include <malloc.h>
f25eda10 6574#$i_mallocmalloc I_MALLOCMALLOC
1cd66f7c
DD
6575#ifdef I_MALLOCMALLOC
6576# include <malloc/malloc.h>
6577#endif
6578
01d07975
YST
6579int main () { return 0; }
6580EOCP
6581set try
6582if eval $compile; then
6583 echo "<malloc.h> found." >&4
6584 val="$define"
6585else
6586 echo "<malloc.h> NOT found." >&4
6587 val="$undef"
6588fi
5b813a60 6589$rm_try
01d07975
YST
6590set i_malloc
6591eval $setvar
b4eb6b3d 6592
c8b93cf9
JH
6593: check for void type
6594echo " "
6595echo "Checking to see how well your C compiler groks the void type..." >&4
6596case "$voidflags" in
6597'')
c727eafa 6598 $cat >try.c <<EOCP
d1daaddf
JH
6599#$i_stdlib I_STDLIB
6600#ifdef I_STDLIB
6601#include <stdlib.h>
6602#endif
c8b93cf9
JH
6603#if TRY & 1
6604void sub() {
6605#else
6606sub() {
6607#endif
6608 extern void moo(); /* function returning void */
6609 void (*goo)(); /* ptr to func returning void */
6610#if TRY & 8
6611 void *hue; /* generic ptr */
6612#endif
6613#if TRY & 2
6614 void (*foo[10])();
6615#endif
6616
6617#if TRY & 4
6618 if(goo == moo) {
6619 exit(0);
6620 }
6621#endif
6622 exit(0);
6623}
6624int main() { sub(); }
6625EOCP
6626 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6627 voidflags=$defvoidused
6628 echo "Good. It appears to support void to the level $package wants.">&4
6629 if $contains warning .out >/dev/null 2>&1; then
6630 echo "However, you might get some warnings that look like this:"
6631 $cat .out
6632 fi
6633 else
6634echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6635 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6636 echo "It supports 1..."
6637 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6638 echo "It also supports 2..."
6639 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6640 voidflags=7
6641 echo "And it supports 4 but not 8 definitely."
6642 else
6643 echo "It doesn't support 4..."
6644 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6645 voidflags=11
6646 echo "But it supports 8."
6647 else
6648 voidflags=3
6649 echo "Neither does it support 8."
6650 fi
6651 fi
6652 else
6653 echo "It does not support 2..."
6654 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6655 voidflags=13
6656 echo "But it supports 4 and 8."
6657 else
6658 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6659 voidflags=5
6660 echo "And it supports 4 but has not heard about 8."
6661 else
6662 echo "However it supports 8 but not 4."
6663 fi
6664 fi
6665 fi
6666 else
6667 echo "There is no support at all for void."
6668 voidflags=0
6669 fi
6670 fi
6671esac
6672case "$voidflags" in
6673"$defvoidused") ;;
6674*) $cat >&4 <<'EOM'
6675 Support flag bits are:
6676 1: basic void declarations.
6677 2: arrays of pointers to functions returning void.
6678 4: operations between pointers to and addresses of void functions.
6679 8: generic void pointers.
6680EOM
6681 dflt="$voidflags";
6682 rp="Your void support flags add up to what?"
6683 . ./myread
6684 voidflags="$ans"
6685 ;;
6686esac
5b813a60 6687$rm_try
c8b93cf9
JH
6688
6689: check for length of pointer
6690echo " "
6691case "$ptrsize" in
6692'')
6693 echo "Checking to see how big your pointers are..." >&4
6694 if test "$voidflags" -gt 7; then
6695 echo '#define VOID_PTR char *' > try.c
6696 else
6697 echo '#define VOID_PTR void *' > try.c
6698 fi
74d00865 6699 $cat >>try.c <<EOCP
c8b93cf9 6700#include <stdio.h>
d1daaddf
JH
6701#$i_stdlib I_STDLIB
6702#ifdef I_STDLIB
6703#include <stdlib.h>
6704#endif
c8b93cf9
JH
6705int main()
6706{
6707 printf("%d\n", (int)sizeof(VOID_PTR));
6708 exit(0);
6709}
6710EOCP
6711 set try
6712 if eval $compile_ok; then
6713 ptrsize=`$run ./try`
6714 echo "Your pointers are $ptrsize bytes long."
6715 else
6716 dflt='4'
6717 echo "(I can't seem to compile the test program. Guessing...)" >&4
6718 rp="What is the size of a pointer (in bytes)?"
6719 . ./myread
6720 ptrsize="$ans"
6721 fi
6722 ;;
6723esac
5b813a60 6724$rm_try
c8b93cf9
JH
6725case "$use64bitall" in
6726"$define"|true|[yY]*)
6727 case "$ptrsize" in
6728 4) cat <<EOM >&4
6729
1911a026
JH
6730*** You have chosen a maximally 64-bit build,
6731*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6732*** Please rerun Configure without -Duse64bitall.
6733EOM
6734 case "$d_quad" in
6735 define)
6736 cat <<EOM >&4
6737*** Since you have quads, you could possibly try with -Duse64bitint.
6738EOM
6739 ;;
6740 esac
6741 cat <<EOM >&4
1911a026 6742*** Cannot continue, aborting.
c8b93cf9
JH
6743
6744EOM
09b58c7b 6745
1911a026 6746 exit 1
c8b93cf9
JH
6747 ;;
6748 esac
6749 ;;
6750esac
6751
19a100ff 6752
9df442c2
NC
6753: determine whether to use malloc wrapping
6754echo " "
6755case "$usemallocwrap" in
6756[yY]*|true|$define) dflt='y' ;;
6757[nN]*|false|$undef) dflt='n' ;;
6758*) case "$usedevel" in
6759 [yY]*|true|$define) dflt='y' ;;
6760 *) dflt='n' ;;
6761 esac
6762 ;;
6763esac
6764rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6765. ./myread
6766usemallocwrap="$ans"
6767case "$ans" in
6768y*|true)
6769 usemallocwrap="$define" ;;
6770*)
6771 usemallocwrap="$undef" ;;
6772esac
c8b93cf9 6773
b4eb6b3d
JH
6774: determine which malloc to compile in
6775echo " "
6776case "$usemymalloc" in
c4163172
JH
6777[yY]*|true|$define) dflt='y' ;;
6778[nN]*|false|$undef) dflt='n' ;;
6779*) case "$ptrsize" in
6780 4) dflt='y' ;;
6781 *) dflt='n' ;;
6782 esac
d9298c1a 6783 if test "$useithreads" = "$define"; then dflt='n'; fi
c4163172 6784 ;;
8dfa8df9 6785esac
b4eb6b3d
JH
6786rp="Do you wish to attempt to use the malloc that comes with $package?"
6787. ./myread
6788usemymalloc="$ans"
6789case "$ans" in
6790y*|true)
6791 usemymalloc='y'
6792 mallocsrc='malloc.c'
6793 mallocobj="malloc$_o"
6794 d_mymalloc="$define"
6795 case "$libs" in
6796 *-lmalloc*)
6797 : Remove malloc from list of libraries to use
6798 echo "Removing unneeded -lmalloc from library list" >&4
6799 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6800 shift
6801 libs="$*"
6802 echo "libs = $libs" >&4
6803 ;;
6804 esac
6805 ;;
6806*)
6807 usemymalloc='n'
6808 mallocsrc=''
6809 mallocobj=''
6810 d_mymalloc="$undef"
6811 ;;
6812esac
6813
6814: compute the return types of malloc and free
6815echo " "
6816$cat >malloc.c <<END
6817#$i_malloc I_MALLOC
6818#$i_stdlib I_STDLIB
6819#include <stdio.h>
6820#include <sys/types.h>
6821#ifdef I_MALLOC
6822#include <malloc.h>
6823#endif
6824#ifdef I_STDLIB
6825#include <stdlib.h>
6826#endif
6827#ifdef TRY_MALLOC
6828void *malloc();
6829#endif
6830#ifdef TRY_FREE
6831void free();
6832#endif
6833END
6834case "$malloctype" in
6835'')
6836 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6837 malloctype='void *'
6838 else
6839 malloctype='char *'
6840 fi
6841 ;;
6842esac
6843echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6844
6845case "$freetype" in
6846'')
6847 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6848 freetype='void'
6849 else
6850 freetype='int'
6851 fi
6852 ;;
6853esac
6854echo "Your system uses $freetype free(), it would seem." >&4
6855$rm -f malloc.[co]
b4eb6b3d
JH
6856: determine where site specific architecture-dependent libraries go.
6857: sitelib default is /usr/local/lib/perl5/site_perl/$version
6858: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6859: sitelib may have an optional trailing /share.
6860case "$sitearch" in
6861'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6862 dflt="$dflt/$archname"
6863 ;;
6864*) dflt="$sitearch"
6865 ;;
6866esac
6867set sitearch sitearch none
6868eval $prefixit
6869$cat <<EOM
6870
6871The installation process will also create a directory for
6872architecture-dependent site-specific extensions and modules.
6873
6874EOM
6875fn=d~+
6876rp='Pathname for the site-specific architecture-dependent library files?'
6877. ./getfile
79522dd2
NC
6878prefixvar=sitearch
6879. ./setprefixvar
c95d0e17
GA
6880if $test X"$sitearch" = X"$sitelib"; then
6881 d_sitearch="$undef"
6882else
6883 d_sitearch="$define"
6884fi
b4eb6b3d 6885
613d6c3e 6886: Set the vendorprefix variables
b4eb6b3d
JH
6887$cat <<EOM
6888
6889The installation process will also create a directory for
6890vendor-supplied add-ons. Vendors who supply perl with their system
6891may find it convenient to place all vendor-supplied files in this
6892directory rather than in the main distribution directory. This will
6893ease upgrades between binary-compatible maintenance versions of perl.
6894
6895Of course you may also use these directories in whatever way you see
6896fit. For example, you might use them to access modules shared over a
6897company-wide network.
6898
6899The default answer should be fine for most people.
6900This causes further questions about vendor add-ons to be skipped
6901and no vendor-specific directories will be configured for perl.
6902
6903EOM
6904rp='Do you want to configure vendor-specific add-on directories?'
6905case "$usevendorprefix" in
6906define|true|[yY]*) dflt=y ;;
6907*) : User may have set vendorprefix directly on Configure command line.
6908 case "$vendorprefix" in
6909 ''|' ') dflt=n ;;
6910 *) dflt=y ;;
6911 esac
6912 ;;
6913esac
6914. ./myread
6915case "$ans" in
6916[yY]*) fn=d~+
6917 rp='Installation prefix to use for vendor-supplied add-ons?'
6918 case "$vendorprefix" in
6919 '') dflt='' ;;
6920 *) dflt=$vendorprefix ;;
6921 esac
6922 . ./getfile
6923 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6924 oldvendorprefix=''
6925 case "$vendorprefix" in
6926 '') ;;
6927 *) case "$ans" in
6928 "$prefix") ;;
6929 *) oldvendorprefix="$prefix";;
6930 esac
6931 ;;
6932 esac
6933 usevendorprefix="$define"
6934 vendorprefix="$ans"
6935 vendorprefixexp="$ansexp"
6936 ;;
6937*) usevendorprefix="$undef"
6938 vendorprefix=''
6939 vendorprefixexp=''
6940 ;;
6941esac
6942
613d6c3e 6943: Set the vendorlib variables
b4eb6b3d
JH
6944case "$vendorprefix" in
6945'') d_vendorlib="$undef"
6946 vendorlib=''
6947 vendorlibexp=''
6948 ;;
6949*) d_vendorlib="$define"
6950 : determine where vendor-supplied modules go.
6951 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6952 case "$vendorlib" in
6953 '')
6954 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6955 case "$installstyle" in
6956 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6957 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6958 esac
6959 ;;
6960 *) dflt="$vendorlib"
6961 ;;
6962 esac
6963 fn=d~+
6964 rp='Pathname for the vendor-supplied library files?'
6965 . ./getfile
6966 vendorlib="$ans"
6967 vendorlibexp="$ansexp"
6968 ;;
6969esac
6970vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6971prefixvar=vendorlib
6972. ./installprefix
b4eb6b3d 6973
613d6c3e 6974: Set the vendorarch variables
b4eb6b3d
JH
6975case "$vendorprefix" in
6976'') d_vendorarch="$undef"
6977 vendorarch=''
6978 vendorarchexp=''
6979 ;;
6980*) d_vendorarch="$define"
6981 : determine where vendor-supplied architecture-dependent libraries go.
6982 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6983 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6984 : vendorlib may have an optional trailing /share.
6985 case "$vendorarch" in
6986 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6987 dflt="$dflt/$archname"
6988 ;;
6989 *) dflt="$vendorarch" ;;
6990 esac
6991 fn=d~+
6992 rp='Pathname for vendor-supplied architecture-dependent files?'
6993 . ./getfile
6994 vendorarch="$ans"
6995 vendorarchexp="$ansexp"
6996 ;;
6997esac
a092d240
NC
6998prefixvar=vendorarch
6999. ./installprefix
1be1b388
MB
7000if $test X"$vendorarch" = X"$vendorlib"; then
7001 d_vendorarch="$undef"
7002else
7003 d_vendorarch="$define"
7004fi
b4eb6b3d
JH
7005
7006: Final catch-all directories to search
7007$cat <<EOM
7008
7009Lastly, you can have perl look in other directories for extensions and
7010modules in addition to those already specified.
7011These directories will be searched after
7012 $sitearch
7013 $sitelib
7014EOM
7015test X"$vendorlib" != "X" && echo ' ' $vendorlib
7016test X"$vendorarch" != "X" && echo ' ' $vendorarch
7017echo ' '
7018case "$otherlibdirs" in
7019''|' ') dflt='none' ;;
7020*) dflt="$otherlibdirs" ;;
7021esac
7022$cat <<EOM
7023Enter a colon-separated set of extra paths to include in perl's @INC
7024search path, or enter 'none' for no extra paths.
7025
7026EOM
7027
7028rp='Colon-separated list of additional directories for perl to search?'
7029. ./myread
7030case "$ans" in
7031' '|''|none) otherlibdirs=' ' ;;
7032*) otherlibdirs="$ans" ;;
7033esac
7034case "$otherlibdirs" in
7035' ') val=$undef ;;
7036*) val=$define ;;
7037esac
7038set d_perl_otherlibdirs
7039eval $setvar
7040
7041: Cruising for prototypes
7042echo " "
7043echo "Checking out function prototypes..." >&4
55954f19
JH
7044$cat >prototype.c <<EOCP
7045#$i_stdlib I_STDLIB
7046#ifdef I_STDLIB
7047#include <stdlib.h>
7048#endif
b4eb6b3d
JH
7049int main(int argc, char *argv[]) {
7050 exit(0);}
7051EOCP
7052if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7053 echo "Your C compiler appears to support function prototypes."
7054 val="$define"
7055else
7056 echo "Your C compiler doesn't seem to understand function prototypes."
7057 val="$undef"
7058fi
7059set prototype
7060eval $setvar
7061$rm -f prototype*
7062
613d6c3e 7063: Check if ansi2knr is required
b4eb6b3d
JH
7064case "$prototype" in
7065"$define") ;;
7066*) ansi2knr='ansi2knr'
7067 echo " "
7068 cat <<EOM >&4
7069
7070$me: FATAL ERROR:
7071This version of $package can only be compiled by a compiler that
7072understands function prototypes. Unfortunately, your C compiler
7073 $cc $ccflags
7074doesn't seem to understand them. Sorry about that.
7075
7076If GNU cc is available for your system, perhaps you could try that instead.
7077
7078Eventually, we hope to support building Perl with pre-ANSI compilers.
7079If you would like to help in that effort, please contact <perlbug@perl.org>.
7080
7081Aborting Configure now.
7082EOM
7083 exit 2
7084 ;;
7085esac
7086
34f1896b
MB
7087: DTrace support
7088dflt_dtrace='/usr/sbin/dtrace'
6e3b7bfa
MB
7089$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7090
34f1896b
MB
7091cat <<EOM
7092
7093Perl can be built to support DTrace on platforms that support it.
7094DTrace is a diagnosis and performance analysis tool from Sun.
7095
7096If this doesn't make any sense to you, just accept the default '$dflt'.
7097EOM
7098
7099while $test 1 ; do
7100 case "$usedtrace" in
7101 $define|true|[yY]*)
7102 dflt='y'
7103 ;;
7104 ?*)
7105 dflt='y'
7106 dflt_dtrace=$usedtrace
7107 ;;
7108 *)
7109 dflt='n'
7110 ;;
7111 esac
7112
7113 rp='Support DTrace if available?'
7114 . ./myread
7115 case "$ans" in
7116 y|Y) val="$define" ;;
7117 *) val="$undef" ;;
7118 esac
7119 set usedtrace
7120 eval $setvar
7121
7122 test "X$usedtrace" != "X$define" && break
7123
7124 echo " "
7125 rp='Where is the dtrace executable?'
7126 dflt=$dflt_dtrace
7127 . ./getfile
7128 val="$ans"
7129 set dtrace
7130 eval $setvar
7131
7132 if $test -f $dtrace
7133 then
7134 if $dtrace -h -s ../perldtrace.d \
7135 -o perldtrace.tmp >/dev/null 2>&1 \
7136 && rm -f perldtrace.tmp
7137 then
7138 echo " "
7139 echo "Good: your $dtrace knows about the -h flag."
7140 else
7141 cat >&2 <<EOM
7142
7143*** $me: Fatal Error: $dtrace doesn't support -h flag
7144***
7145*** Your installed dtrace doesn't support the -h switch to compile a D
7146*** program into a C header. Can't continue.
7147
7148EOM
7149 exit 1
7150 fi
7151 break;
7152 fi
7153
7154 case "$fastread" in
7155 yes)
7156 cat >&2 <<EOM
7157
7158*** $me: Fatal Error: $dtrace not found.
7159*** Can't continue.
7160
7161EOM
7162 exit 1
7163 ;;
7164 *)
7165 echo "*** $dtrace was not found."
7166 echo " "
7167 ;;
7168 esac
7169done
7170
613d6c3e 7171: See if we want extra modules installed
6fcddf3b 7172echo " "
6fcddf3b 7173case "$extras" in
bf35c3f6
JH
7174'') dflt='n';;
7175*) dflt='y';;
6fcddf3b
JH
7176esac
7177cat <<EOM
7178Perl can be built with extra modules or bundles of modules which
7179will be fetched from the CPAN and installed alongside Perl.
7180
7181Notice that you will need access to the CPAN; either via the Internet,
7182or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7183be asked later to configure the CPAN.pm module which will in turn do
7184the installation of the rest of the extra modules or bundles.)
7185
7186Notice also that if the modules require any external software such as
dd2de242
JH
7187libraries and headers (the libz library and the zlib.h header for the
7188Compress::Zlib module, for example) you MUST have any such software
7189already installed, this configuration process will NOT install such
7190things for you.
6fcddf3b
JH
7191
7192If this doesn't make any sense to you, just accept the default '$dflt'.
7193EOM
dd2de242 7194rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7195. ./myread
7196case "$ans" in
7197y|Y)
7198 cat <<EOM
7199
7200Please list any extra modules or bundles to be installed from CPAN,
7201with spaces between the names. The names can be in any format the
dd2de242
JH
7202'install' command of CPAN.pm will understand. (Answer 'none',
7203without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7204EOM
7205 rp='Extras?'
7206 dflt="$extras"
7207 . ./myread
7208 extras="$ans"
7209esac
7210case "$extras" in
7211''|'none')
7212 val=''
7213 $rm -f ../extras.lst
7214 ;;
7215*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7216 echo "$extras" > ../extras.lst
7217 val="'$extras'"
6fcddf3b
JH
7218 ;;
7219esac
7220set extras
7221eval $setvar
7222echo " "
7223
6e1038e0
MB
7224: determine where html pages for programs go
7225set html1dir html1dir none
7226eval $prefixit
7227$cat <<EOM
7228
f3f1a2d8 7229If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7230the appropriate directory here. To skip installing html files,
7231answer "none".
7232EOM
7233case "$html1dir" in
7234''|none|$undef|' ') dflt=none ;;
7235*) dflt=$html1dir ;;
7236esac
7237fn=dn+~
7238rp="Directory for the main $spackage html pages?"
7239. ./getfile
79522dd2
NC
7240prefixvar=html1dir
7241. ./setprefixvar
6e1038e0
MB
7242: Use ' ' for none so value is preserved next time through Configure
7243$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7244
7245: determine where html pages for libraries and modules go
7246set html3dir html3dir none
7247eval $prefixit
7248$cat <<EOM
7249
7250If you wish to install html files for modules associated with $spackage,
7251indicate the appropriate directory here. To skip installing html files,
7252answer "none".
7253EOM
7254: There is no obvious default. If they have specified html1dir, then
7255: try to key off that, possibly changing .../html1 into .../html3.
7256case "$html3dir" in
7257'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7258*) dflt=$html3dir ;;
7259esac
7260fn=dn+~
7261rp="Directory for the $spackage module html pages?"
7262. ./getfile
79522dd2
NC
7263prefixvar=html3dir
7264. ./setprefixvar
6e1038e0
MB
7265: Use ' ' for none so value is preserved next time through Configure
7266$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7267
89ce900e
JH
7268: determine whether to install perl also as /usr/bin/perl
7269
7270echo " "
7271if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7272 $cat <<EOM
7273Many scripts expect perl to be installed as /usr/bin/perl.
7274
7275If you want to, I can install the perl you are about to compile
7276as /usr/bin/perl (in addition to $bin/perl).
7277EOM
7278 if test -f /usr/bin/perl; then
7279 $cat <<EOM
7280
7281However, please note that because you already have a /usr/bin/perl,
7282overwriting that with a new Perl would very probably cause problems.
7283Therefore I'm assuming you don't want to do that (unless you insist).
7284
7285EOM
7286 case "$installusrbinperl" in
7287 "$define"|[yY]*) dflt='y';;
7288 *) dflt='n';;
7289 esac
7290 else
7291 $cat <<EOM
7292
7293Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7294
7295EOM
7296 case "$installusrbinperl" in
7297 "$undef"|[nN]*) dflt='n';;
7298 *) dflt='y';;
7299 esac
7300 fi
7301 rp="Do you want to install perl as /usr/bin/perl?"
7302 . ./myread
7303 case "$ans" in
7304 [yY]*) val="$define";;
7305 *) val="$undef" ;;
7306 esac
7307else
7308 val="$undef"
7309fi
7310set installusrbinperl
7311eval $setvar
7312
613d6c3e 7313: Check if we are using the GNU C library
89ce900e
JH
7314echo " "
7315echo "Checking for GNU C Library..." >&4
7316cat >try.c <<'EOCP'
7317/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7318 alone are insufficient to distinguish different versions, such as
7319 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7320 libc version 2.1.0. A. Dougherty, June 3, 2002.
7321*/
7322#include <stdio.h>
7323int main(void)
7324{
7325#ifdef __GLIBC__
7326# ifdef __GLIBC_MINOR__
4fb7dc7d 7327# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7328# include <gnu/libc-version.h>
7329 printf("%s\n", gnu_get_libc_version());
7330# else
7331 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7332# endif
7333# else
7334 printf("%d\n", __GLIBC__);
7335# endif
7336 return 0;
7337#else
7338 return 1;
7339#endif
7340}
7341EOCP
7342set try
7343if eval $compile_ok && $run ./try > glibc.ver; then
7344 val="$define"
7345 gnulibc_version=`$cat glibc.ver`
7346 echo "You are using the GNU C Library version $gnulibc_version"
7347else
7348 val="$undef"
7349 gnulibc_version=''
7350 echo "You are not using the GNU C Library"
7351fi
5b813a60 7352$rm_try glibc.ver
89ce900e
JH
7353set d_gnulibc
7354eval $setvar
7355
7356: see if nm is to be used to determine whether a symbol is defined or not
7357case "$usenm" in
7358'')
7359 dflt=''
7360 case "$d_gnulibc" in
7361 "$define")
7362 echo " "
7363 echo "nm probably won't work on the GNU C Library." >&4
7364 dflt=n
7365 ;;
7366 esac
7367 case "$dflt" in
7368 '')
7369 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7370 echo " "
7371 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7372 echo "'nm' won't be sufficient on this sytem." >&4
7373 dflt=n
7374 fi
7375 ;;
7376 esac
7377 case "$dflt" in
7378 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7379 if $test $dflt -gt 20; then
7380 dflt=y
7381 else
7382 dflt=n
7383 fi
7384 ;;
7385 esac
b4eb6b3d 7386 ;;
89ce900e
JH
7387*)
7388 case "$usenm" in
7389 true|$define) dflt=y;;
7390 *) dflt=n;;
7391 esac
b4eb6b3d
JH
7392 ;;
7393esac
89ce900e 7394$cat <<EOM
b4eb6b3d 7395
89ce900e
JH
7396I can use $nm to extract the symbols from your C libraries. This
7397is a time consuming task which may generate huge output on the disk (up
7398to 3 megabytes) but that should make the symbols extraction faster. The
7399alternative is to skip the 'nm' extraction part and to compile a small
7400test program instead to determine whether each symbol is present. If
7401you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7402this may be the best solution.
b4eb6b3d 7403
89ce900e 7404You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7405
89ce900e
JH
7406EOM
7407rp="Shall I use $nm to extract C symbols from the libraries?"
7408. ./myread
7409case "$ans" in
7410[Nn]*) usenm=false;;
7411*) usenm=true;;
b4eb6b3d 7412esac
89ce900e
JH
7413
7414runnm=$usenm
7415case "$reuseval" in
7416true) runnm=false;;
b4eb6b3d 7417esac
b4eb6b3d 7418
89ce900e
JH
7419: nm options which may be necessary
7420case "$nm_opt" in
7421'') if $test -f /mach_boot; then
7422 nm_opt='' # Mach
7423 elif $test -d /usr/ccs/lib; then
7424 nm_opt='-p' # Solaris (and SunOS?)
7425 elif $test -f /dgux; then
7426 nm_opt='-p' # DG-UX
7427 elif $test -f /lib64/rld; then
7428 nm_opt='-p' # 64-bit Irix
7429 else
7430 nm_opt=''
7431 fi;;
7432esac
b4eb6b3d 7433
89ce900e
JH
7434: nm options which may be necessary for shared libraries but illegal
7435: for archive libraries. Thank you, Linux.
7436case "$nm_so_opt" in
7437'') case "$myuname" in
fb2e1bc0 7438 *linux*|gnu*)
89ce900e
JH
7439 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7440 nm_so_opt='--dynamic'
7441 fi
7442 ;;
7443 esac
7444 ;;
7445esac
b4eb6b3d 7446
1d8eaf8c 7447: Figure out where the libc is located
89ce900e
JH
7448case "$runnm" in
7449true)
1d8eaf8c 7450: get list of predefined functions in a handy place
89ce900e
JH
7451echo " "
7452case "$libc" in
7453'') libc=unknown
7454 case "$libs" in
7455 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7456 esac
7457 ;;
b4eb6b3d 7458esac
89ce900e
JH
7459case "$libs" in
7460'') ;;
7461*) for thislib in $libs; do
7462 case "$thislib" in
7463 -lc|-lc_s)
7464 : Handle C library specially below.
7465 ;;
7466 -l*)
7467 thislib=`echo $thislib | $sed -e 's/^-l//'`
7468 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7469 :
7470 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7471 :
7472 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7473 :
7474 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7475 :
7476 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7477 :
7478 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7479 :
7480 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7481 :
7482 else
7483 try=''
7484 fi
7485 libnames="$libnames $try"
7486 ;;
7487 *) libnames="$libnames $thislib" ;;
7488 esac
7489 done
b4eb6b3d
JH
7490 ;;
7491esac
89ce900e
JH
7492xxx=normal
7493case "$libc" in
7494unknown)
7495 set /lib/libc.$so
7496 for xxx in $libpth; do
7497 $test -r $1 || set $xxx/libc.$so
7498 : The messy sed command sorts on library version numbers.
7499 $test -r $1 || \
7500 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7501 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7502 h
7503 s/[0-9][0-9]*/0000&/g
7504 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7505 G
7506 s/\n/ /' | \
7507 $sort | $sed -e 's/^.* //'`
7508 eval set \$$#
7509 done
7510 $test -r $1 || set /usr/ccs/lib/libc.$so
7511 $test -r $1 || set /lib/libsys_s$_a
7512 ;;
7513*)
7514 set blurfl
7515 ;;
7516esac
7517if $test -r "$1"; then
7518 echo "Your (shared) C library seems to be in $1."
7519 libc="$1"
7520elif $test -r /lib/libc && $test -r /lib/clib; then
7521 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7522 xxx=apollo
7523 libc='/lib/clib /lib/libc'
7524 if $test -r /lib/syslib; then
7525 echo "(Your math library is in /lib/syslib.)"
7526 libc="$libc /lib/syslib"
7527 fi
7528elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7529 echo "Your C library seems to be in $libc, as you said before."
7530elif $test -r $incpath/usr/lib/libc$_a; then
7531 libc=$incpath/usr/lib/libc$_a;
7532 echo "Your C library seems to be in $libc. That's fine."
7533elif $test -r /lib/libc$_a; then
7534 libc=/lib/libc$_a;
7535 echo "Your C library seems to be in $libc. You're normal."
7536else
7537 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7538 :
7539 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7540 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7541 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7542 :
7543 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7544 :
7545 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7546 :
7547 else
7548 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7549 fi
7550 if $test -r "$tans"; then
7551 echo "Your C library seems to be in $tans, of all places."
7552 libc=$tans
7553 else
7554 libc='blurfl'
7555 fi
7556fi
7557if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7558 dflt="$libc"
7559 cat <<EOM
b4eb6b3d 7560
89ce900e
JH
7561If the guess above is wrong (which it might be if you're using a strange
7562compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7563
89ce900e
JH
7564EOM
7565else
7566 dflt=''
7567 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7568 cat >&4 <<EOM
7569I can't seem to find your C library. I've looked in the following places:
5e366f65 7570
b4eb6b3d 7571EOM
89ce900e
JH
7572 $sed 's/^/ /' libpath
7573 cat <<EOM
5e366f65 7574
89ce900e 7575None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7576
7577EOM
89ce900e
JH
7578fi
7579fn=f
7580rp='Where is your C library?'
7581. ./getfile
7582libc="$ans"
5e366f65 7583
89ce900e
JH
7584echo " "
7585echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7586set X `cat libnames`
7587shift
7588xxx=files
7589case $# in 1) xxx=file; esac
7590echo "Extracting names from the following $xxx for later perusal:" >&4
7591echo " "
7592$sed 's/^/ /' libnames >&4
7593echo " "
7594$echo $n "This may take a while...$c" >&4
5e366f65 7595
89ce900e
JH
7596for file in $*; do
7597 case $file in
7598 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7599 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7600 esac
89ce900e
JH
7601done >libc.tmp
7602
7603$echo $n ".$c"
7604$grep fprintf libc.tmp > libc.ptf
7605xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7606xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
9e08e8f0 7607xxx='[ADTSIWi]'
ab900c53 7608if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7609 eval $xscan;\
7610 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7611 eval $xrun
7612elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7613 eval $xscan;\
7614 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7615 eval $xrun
7616elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7617 eval $xscan;\
7618 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7619 eval $xrun
7620elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7621 eval $xscan;\
7622 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7623 eval $xrun
7624elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7625 eval $xscan;\
7626 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627 eval $xrun
7628elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7629 eval $xscan;\
7630 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7631 eval $xrun
7632elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7633 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7634 eval $xscan;\
7635 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7636 eval $xrun
7637elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7638 eval $xscan;\
7639 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7640 eval $xrun
7641elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7642 eval $xscan;\
7643 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7644 eval $xrun
7645elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7646 eval $xscan;\
7647 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7648 eval $xrun
7649elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7650 eval $xscan;\
7651 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7652 eval $xrun
7653elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7654 eval $xscan;\
7655 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656 eval $xrun
7657elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7658 eval $xscan;\
7659 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7660 eval $xrun
7661elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7662 eval $xscan;\
7663 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7664 eval $xrun
b4eb6b3d 7665else
89ce900e
JH
7666 $nm -p $* 2>/dev/null >libc.tmp
7667 $grep fprintf libc.tmp > libc.ptf
7668 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7669 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7670 then
7671 nm_opt='-p'
7672 eval $xrun
7673 else
7674 echo " "
7675 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7676 com=''
1d8eaf8c
MB
7677 if $ar t $libc > libc.tmp && \
7678 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7679 then
89ce900e
JH
7680 for thisname in $libnames $libc; do
7681 $ar t $thisname >>libc.tmp
7682 done
7683 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7684 echo "Ok." >&4
7685 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
89ce900e
JH
7686 for thisname in $libnames $libc; do
7687 $ar tv $thisname >>libc.tmp
89ce900e
JH
7688 emximp -o tmp.imp $thisname \
7689 2>/dev/null && \
7690 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7691 < tmp.imp >>libc.tmp
1d8eaf8c 7692 $rm -f tmp.imp
89ce900e
JH
7693 done
7694 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7695 echo "Ok." >&4
7696 else
7697 echo "$ar didn't seem to work right." >&4
7698 echo "Maybe this is a Cray...trying bld instead..." >&4
1d8eaf8c
MB
7699 if bld t $libc | \
7700 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7701 $test -s libc.list
89ce900e
JH
7702 then
7703 for thisname in $libnames; do
7704 bld t $libnames | \
7705 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7706 $ar t $thisname >>libc.tmp
7707 done
7708 echo "Ok." >&4
7709 else
7710 echo "That didn't work either. Giving up." >&4
7711 exit 1
7712 fi
7713 fi
7714 fi
b4eb6b3d 7715fi
89ce900e
JH
7716nm_extract="$com"
7717case "$PASE" in
7718define)
7719 echo " "
7720 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7721 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7722 ;;
7723*) if $test -f /lib/syscalls.exp; then
7724 echo " "
7725 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
1d8eaf8c
MB
7726 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7727 /lib/syscalls.exp >>libc.list
89ce900e
JH
7728 fi
7729 ;;
7730esac
7731;;
7732esac
7733$rm -f libnames libpath
b4eb6b3d
JH
7734
7735: see if dld is available
7736set dld.h i_dld
7737eval $inhdr
7738
613d6c3e 7739: Check if we are using C++
43dddb59
MB
7740echo " "
7741echo "Checking for C++..." >&4
20e87299 7742$cat >try.c <<'EOCP'
43dddb59
MB
7743#include <stdio.h>
7744int main(void)
7745{
7746#ifdef __cplusplus
20e87299 7747 return 0;
43dddb59 7748#else
20e87299 7749 return 1;
43dddb59 7750#endif
43dddb59
MB
7751}
7752EOCP
7753set try
20e87299
AD
7754if eval $compile_ok && $run ./try; then
7755 val="$define"
43dddb59
MB
7756 echo "You are using a C++ compiler."
7757else
7758 val="$undef"
7759 echo "You are not using a C++ compiler."
7760fi
5b813a60 7761$rm_try cplusplus$$
43dddb59
MB
7762set d_cplusplus
7763eval $setvar
7764
89ce900e
JH
7765: is a C symbol defined?
7766csym='tlook=$1;
7767case "$3" in
373dfab3
JH
7768-v) tf=libc.tmp; tdc="";;
7769-a) tf=libc.tmp; tdc="[]";;
7770*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e 7771esac;
61c26d18
MHM
7772case "$d_cplusplus" in
7773 $define) extern_C="extern \"C\"" ;;
7774 *) extern_C="extern" ;;
7775esac;
89ce900e
JH
7776tx=yes;
7777case "$reuseval-$4" in
7778true-) ;;
7779true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7780esac;
7781case "$tx" in
7782yes)
43dddb59 7783 tval=false;
5129fff4
JH
7784 if $test "$runnm" = true; then
7785 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7786 tval=true;
5129fff4 7787 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
9945eb56 7788 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7789 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7790 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7791 $rm_try;
89ce900e 7792 fi;
5129fff4 7793 else
9945eb56 7794 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7795 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5b813a60 7796 $rm_try;
ab900c53
AB
7797 fi;
7798 ;;
89ce900e
JH
7799*)
7800 case "$tval" in
7801 $define) tval=true;;
7802 *) tval=false;;
ab900c53
AB
7803 esac;
7804 ;;
89ce900e
JH
7805esac;
7806eval "$2=$tval"'
7807
7808: define an is-in-libc? function
7809inlibc='echo " "; td=$define; tu=$undef;
7810sym=$1; var=$2; eval "was=\$$2";
7811tx=yes;
7812case "$reuseval$was" in
7813true) ;;
7814true*) tx=no;;
7815esac;
7816case "$tx" in
7817yes)
7818 set $sym tres -f;
7819 eval $csym;
7820 case "$tres" in
7821 true)
7822 echo "$sym() found." >&4;
7823 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7824 *)
7825 echo "$sym() NOT found." >&4;
7826 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7827 esac;;
7828*)
7829 case "$was" in
7830 $define) echo "$sym() found." >&4;;
7831 *) echo "$sym() NOT found." >&4;;
7832 esac;;
7833esac'
7834
b4eb6b3d
JH
7835: see if dlopen exists
7836xxx_runnm="$runnm"
666ea192 7837xxx_ccflags="$ccflags"
b4eb6b3d 7838runnm=false
666ea192
JH
7839: with g++ one needs -shared to get is-in-libc to work for dlopen
7840case "$gccversion" in
7841'') ;;
7842*) case "$d_cplusplus" in
7843 "$define") ccflags="$ccflags -shared" ;;
7844 esac
7845 ;;
7846esac
b4eb6b3d
JH
7847set dlopen d_dlopen
7848eval $inlibc
7849runnm="$xxx_runnm"
666ea192 7850ccflags="$xxx_ccflags"
b4eb6b3d 7851
4fb7dc7d
JH
7852: see if this is a unistd.h system
7853set unistd.h i_unistd
7854eval $inhdr
7855
b4eb6b3d
JH
7856: determine which dynamic loading, if any, to compile in
7857echo " "
7858dldir="ext/DynaLoader"
7859case "$usedl" in
7860$define|y|true)
7861 dflt='y'
7862 usedl="$define"
7863 ;;
7864$undef|n|false)
7865 dflt='n'
7866 usedl="$undef"
7867 ;;
5b813a60 7868*)
b4eb6b3d
JH
7869 dflt='n'
7870 case "$d_dlopen" in
7871 $define) dflt='y' ;;
7872 esac
7873 case "$i_dld" in
7874 $define) dflt='y' ;;
7875 esac
7876 : Does a dl_xxx.xs file exist for this operating system
7877 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7878 ;;
7879esac
7880rp="Do you wish to use dynamic loading?"
7881. ./myread
7882usedl="$ans"
f1ce3bf1 7883bin_ELF="$undef"
b4eb6b3d
JH
7884case "$ans" in
7885y*) usedl="$define"
7886 case "$dlsrc" in
7887 '')
7888 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7889 dflt="$dldir/dl_${osname}.xs"
7890 elif $test "$d_dlopen" = "$define" ; then
7891 dflt="$dldir/dl_dlopen.xs"
7892 elif $test "$i_dld" = "$define" ; then
7893 dflt="$dldir/dl_dld.xs"
7894 else
7895 dflt=''
7896 fi
7897 ;;
7898 *) dflt="$dldir/$dlsrc"
7899 ;;
7900 esac
7901 echo "The following dynamic loading files are available:"
7902 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7903 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7904 rp="Source file to use for dynamic loading"
7905 fn="fne"
7906 gfpth="$src"
7907 . ./getfile
7908 usedl="$define"
7909 : emulate basename
7910 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7911
7912 $cat << EOM
7913
7914Some systems may require passing special flags to $cc -c to
7915compile modules that will be used to create a shared library.
7916To use no flags, say "none".
7917
7918EOM
7919 case "$cccdlflags" in
7920 '') case "$gccversion" in
7921 '') case "$osname" in
7922 hpux) dflt='+z' ;;
7923 next) dflt='none' ;;
7924 irix*) dflt='-KPIC' ;;
48bcfe03 7925 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7926 sunos) dflt='-pic' ;;
7927 *) dflt='none' ;;
7928 esac
7929 ;;
7930 *) case "$osname" in
b6cc0f4c 7931 darwin) dflt='none' ;;
15fcae63 7932 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7933 *) dflt='-fpic' ;;
7934 esac ;;
7935 esac ;;
7936 ' ') dflt='none' ;;
7937 *) dflt="$cccdlflags" ;;
7938 esac
7939 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7940 . ./myread
7941 case "$ans" in
7942 none) cccdlflags=' ' ;;
7943 *) cccdlflags="$ans" ;;
7944 esac
7945
7946 cat << EOM
7947
7948Some systems use ld to create libraries that can be dynamically loaded,
7949while other systems (such as those using ELF) use $cc.
7950
7951EOM
8928fb82
MB
7952
7953: Determine if this is ELF
7954 $cat >try.c <<EOM
b4eb6b3d
JH
7955/* Test for whether ELF binaries are produced */
7956#include <fcntl.h>
55954f19
JH
7957#$i_stdlib I_STDLIB
7958#ifdef I_STDLIB
b4eb6b3d 7959#include <stdlib.h>
55954f19 7960#endif
4fb7dc7d
JH
7961#$i_unistd I_UNISTD
7962#ifdef I_UNISTD
7963#include <unistd.h>
7964#endif
b4eb6b3d
JH
7965int main() {
7966 char b[4];
7967 int i = open("a.out",O_RDONLY);
5b813a60 7968 if(i == -1)
b4eb6b3d
JH
7969 exit(1); /* fail */
7970 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8928fb82 7971 exit(0); /* succeed (yes, it is ELF) */
b4eb6b3d
JH
7972 else
7973 exit(1); /* fail */
7974}
7975EOM
8928fb82
MB
7976 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7977 bin_ELF="$define"
7978 fi
7979 $rm_try
7980
7981 case "$ld" in
7982 '') if $test $bin_ELF = "$define"; then
b4eb6b3d
JH
7983 cat <<EOM
7984You appear to have ELF support. I'll use $cc to build dynamic libraries.
7985EOM
7986 dflt="$cc"
7987 else
7988 echo "I'll use ld to build dynamic libraries."
7989 dflt='ld'
7990 fi
b4eb6b3d
JH
7991 ;;
7992 *) dflt="$ld"
7993 ;;
7994 esac
7995
7996 rp="What command should be used to create dynamic libraries?"
7997 . ./myread
7998 ld="$ans"
7999
8000 cat << EOM
8001
8002Some systems may require passing special flags to $ld to create a
8003library that can be dynamically loaded. If your ld flags include
8004-L/other/path options to locate libraries outside your loader's normal
8005search path, you may need to specify those -L options here as well. To
8006use no flags, say "none".
8007
8008EOM
8009 case "$lddlflags" in
8010 '') case "$osname" in
df00ff3b 8011 haiku) dflt='-shared' ;;
b4eb6b3d
JH
8012 hpux) dflt='-b';
8013 case "$gccversion" in
8014 '') dflt="$dflt +vnocompatwarnings" ;;
8015 esac
5b813a60 8016 ;;
15fcae63 8017 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
8018 next) dflt='none' ;;
8019 solaris) dflt='-G' ;;
8020 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 8021 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
8022 *) dflt='none' ;;
8023 esac
8024 ;;
8025 *) dflt="$lddlflags" ;;
8026 esac
8027
8028 : Try to guess additional flags to pick up local libraries.
8029 : Be careful not to append to a plain 'none'
8030 case "$dflt" in
8031 none) dflt='' ;;
8032 esac
8033 for thisflag in $ldflags; do
8034 case "$thisflag" in
b5b9f165 8035 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
8036 case " $dflt " in
8037 *" $thisflag "*) ;;
8038 *) dflt="$dflt $thisflag" ;;
8039 esac
8040 ;;
8041 esac
8042 done
8043
8044 case "$dflt" in
8045 ''|' ') dflt='none' ;;
8046 esac
8047
8f68b0e6
AD
8048 case "$ldflags" in
8049 *-fstack-protector*)
8050 case "$dflt" in
8051 *-fstack-protector*) ;; # Don't add it again
8052 *) dflt="$dflt -fstack-protector" ;;
8053 esac
8054 ;;
8055 esac
8056
8057
b4eb6b3d
JH
8058 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8059 . ./myread
8060 case "$ans" in
8061 none) lddlflags=' ' ;;
8062 *) lddlflags="$ans" ;;
8063 esac
8064
8065 cat <<EOM
8066
8067Some systems may require passing special flags to $cc to indicate that
8068the resulting executable will use dynamic linking. To use no flags,
8069say "none".
8070
8071EOM
8072 case "$ccdlflags" in
8073 '') case "$osname" in
fb2e1bc0 8074 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
8075 next|sunos) dflt='none' ;;
8076 *) dflt='none' ;;
b4eb6b3d
JH
8077 esac ;;
8078 ' ') dflt='none' ;;
8079 *) dflt="$ccdlflags" ;;
8080 esac
8081 rp="Any special flags to pass to $cc to use dynamic linking?"
8082 . ./myread
8083 case "$ans" in
8084 none) ccdlflags=' ' ;;
8085 *) ccdlflags="$ans" ;;
8086 esac
8087 ;;
8088*) usedl="$undef"
8089 ld='ld'
8090 dlsrc='dl_none.xs'
8091 lddlflags=''
8092 ccdlflags=''
8093 ;;
8094esac
8095
9ec4dadf
MB
8096ld_can_script="$undef"
8097case "$bin_ELF$usedl" in
8098$define$define)
8099 # Abuse try.h and a.out names for neat cleanup
8100 $cat >try.c <<EOM
8101void foo() {}
8102void bar() {}
8103EOM
8104 $cat >try.h <<EOM
8105LIBTEST_42 {
8106 global:
8107 foo;
8108 local: *;
8109 };
8110EOM
8111 if $cc $cccdlflags $ccdlflags $ccflags \
8112 $ldflags $lddlflags -o a.out try.c \
8113 -Wl,--version-script=try.h >/dev/null 2>&1 \
8114 && $test -s a.out ; then
8115 echo "ld supports scripting" >&4
8116 ld_can_script="$define"
8117 else
8118 echo "ld does not support scripting" >&4
8119 fi
8120 $rm_try
8121 ;;
8122esac
8123
34f1896b 8124: Do we want a shared libperl?
b4eb6b3d
JH
8125also=''
8126case "$usedl" in
8127$undef)
8128 # No dynamic loading being used, so don't bother even to prompt.
8129 useshrplib='false'
8130 ;;
8131*) case "$useshrplib" in
8132 '') case "$osname" in
232083c0 8133 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
b4eb6b3d
JH
8134 dflt=y
8135 also='Building a shared libperl is required for dynamic loading to work on your system.'
8136 ;;
8137 next*)
8138 case "$osvers" in
8139 4*) dflt=y
8140 also='Building a shared libperl is needed for MAB support.'
8141 ;;
8142 *) dflt=n
8143 ;;
8144 esac
8145 ;;
8146 *) dflt=n
8147 ;;
8148 esac
8149 ;;
8150 $define|true|[Yy]*)
8151 dflt=y
8152 ;;
8153 *) dflt=n
8154 ;;
8155 esac
8156 $cat << EOM
8157
8158The perl executable is normally obtained by linking perlmain.c with
8159libperl${_a}, any static extensions (usually just DynaLoader), and
8160any other libraries needed on this system (such as -lm, etc.). Since
8161your system supports dynamic loading, it is probably possible to build
8162a shared libperl.$so. If you will have more than one executable linked
8163to libperl.$so, this will significantly reduce the size of each
5cadb3f3 8164executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
8165default is probably sensible for your system.
8166$also
8167
8168EOM
8169 rp="Build a shared libperl.$so (y/n)"
8170 . ./myread
8171 case "$ans" in
8172 true|$define|[Yy]*)
8173 useshrplib='true' ;;
8174 *) useshrplib='false' ;;
8175 esac
8176 ;;
8177esac
8178
8179case "$useshrplib" in
8180true)
df31f9b1
MB
8181 case "$userelocatableinc" in
8182 true|define)
8183 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8184 echo "See INSTALL for an explanation why that won't work." >&4
8185 exit 4
8186 ;;
8187 esac
b4eb6b3d
JH
8188 case "$libperl" in
8189 '')
8190 # Figure out a good name for libperl.so. Since it gets stored in
8191 # a version-specific architecture-dependent library, the version
8192 # number isn't really that important, except for making cc/ld happy.
8193 #
56e771c1 8194 # A name such as libperl.so.10.1
b4eb6b3d 8195 majmin="libperl.$so.$patchlevel.$subversion"
56e771c1 8196 # A name such as libperl.so.100
b4eb6b3d
JH
8197 majonly=`echo $patchlevel $subversion |
8198 $awk '{printf "%d%02d", $1, $2}'`
8199 majonly=libperl.$so.$majonly
8200 # I'd prefer to keep the os-specific stuff here to a minimum, and
8201 # rely on figuring it out from the naming of libc.
8202 case "${osname}${osvers}" in
8203 next4*)
8204 dflt=libperl.5.$so
8205 # XXX How handle the --version stuff for MAB?
8206 ;;
fb2e1bc0 8207 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8208 dflt=libperl.$so
8209 ;;
56e771c1
RU
8210 cygwin*) # ld links now against the dll directly
8211 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8212 majonly=`echo $patchlevel $subversion |
8213 $awk '{printf "%03d%03d", $1, $2}'`
8214 majonly=cygperl5.$majonly.$so
8215 dflt=$majmin
b4eb6b3d
JH
8216 ;;
8217 *) # Try to guess based on whether libc has major.minor.
8218 case "$libc" in
8219 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8220 *libc.$so.[0-9]*) dflt=$majonly ;;
8221 *) dflt=libperl.$so ;;
8222 esac
8223 ;;
8224 esac
8225 ;;
8226 *) dflt=$libperl
8227 ;;
8228 esac
8229 cat << EOM
8230
8231I need to select a good name for the shared libperl. If your system uses
8232library names with major and minor numbers, then you might want something
8233like $majmin. Alternatively, if your system uses a single version
8234number for shared libraries, then you might want to use $majonly.
8235Or, your system might be quite happy with a simple libperl.$so.
8236
8237Since the shared libperl will get installed into a version-specific
8238architecture-dependent directory, the version number of the shared perl
8239library probably isn't important, so the default should be o.k.
8240
8241EOM
8242 rp='What name do you want to give to the shared libperl?'
8243 . ./myread
8244 libperl=$ans
8245 echo "Ok, I'll use $libperl"
8246 ;;
8247*)
8248 libperl="libperl${_a}"
8249 ;;
8250esac
8251
8252# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8253case "$shrpdir" in
8254'') ;;
8255*) $cat >&4 <<EOM
8256WARNING: Use of the shrpdir variable for the installation location of
8257the shared $libperl is not supported. It was never documented and
8258will not work in this version. Let me (perlbug@perl.org)
8259know of any problems this may cause.
8260
8261EOM
8262 case "$shrpdir" in
8263 "$archlibexp/CORE")
8264 $cat >&4 <<EOM
8265But your current setting of $shrpdir is
8266the default anyway, so it's harmless.
8267EOM
8268 ;;
8269 *)
8270 $cat >&4 <<EOM
8271Further, your current attempted setting of $shrpdir
8272conflicts with the value of $archlibexp/CORE
8273that installperl will use.
8274EOM
8275 ;;
8276 esac
8277 ;;
8278esac
8279
8280# How will the perl executable find the installed shared $libperl?
8281# Add $xxx to ccdlflags.
8282# If we can't figure out a command-line option, use $shrpenv to
8283# set env LD_RUN_PATH. The main perl makefile uses this.
8284shrpdir=$archlibexp/CORE
8285xxx=''
8286tmp_shrpenv=''
8287if "$useshrplib"; then
34f1896b 8288 case "$osname" in
b4eb6b3d
JH
8289 aix)
8290 # We'll set it in Makefile.SH...
8291 ;;
b5b9f165 8292 solaris)
b4eb6b3d
JH
8293 xxx="-R $shrpdir"
8294 ;;
c5f63f38 8295 freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8296 xxx="-Wl,-R$shrpdir"
8297 ;;
fb2e1bc0 8298 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8299 xxx="-Wl,-rpath,$shrpdir"
8300 ;;
8301 next)
8302 # next doesn't like the default...
8303 ;;
df00ff3b
IW
8304 haiku)
8305 # Haiku doesn't like the default, either.
8306 ;;
b4eb6b3d
JH
8307 hpux*)
8308 # hpux doesn't like the default, either.
8309 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8310 ;;
56e771c1
RU
8311 cygwin)
8312 # cygwin needs only ldlibpth
8313 ;;
b4eb6b3d
JH
8314 *)
8315 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8316 ;;
8317 esac
8318 case "$xxx" in
8319 '') ;;
34f1896b 8320 *)
b4eb6b3d
JH
8321 # Only add $xxx if it isn't already in ccdlflags.
8322 case " $ccdlflags " in
8323 *" $xxx "*) ;;
8324 *) ccdlflags="$ccdlflags $xxx"
8325 cat <<EOM >&4
8326
8327Adding $xxx to the flags
34f1896b 8328passed to $ld so that the perl executable will find the
b4eb6b3d
JH
8329installed shared $libperl.
8330
8331EOM
8332 ;;
8333 esac
8334 ;;
8335 esac
8336fi
8337# Fix ccdlflags in AIX for building external extensions.
8338# (For building Perl itself bare -bE:perl.exp is needed,
8339# Makefile.SH takes care of this.)
8340case "$osname" in
8341aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8342esac
8343# Respect a hint or command-line value.
8344case "$shrpenv" in
8345'') shrpenv="$tmp_shrpenv" ;;
8346esac
8347case "$ldlibpthname" in
8348'') ldlibpthname=LD_LIBRARY_PATH ;;
8349none) ldlibpthname='' ;;
8350esac
8351
8352: determine where manual pages are on this system
8353echo " "
8354case "$sysman" in
8355'')
4a0a3829
SD
8356 syspath='/usr/share/man/man1 /usr/man/man1'
8357 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8358 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8359 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8360 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8361 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8362 sysman=`./loc . /usr/man/man1 $syspath`
8363 ;;
8364esac
8365if $test -d "$sysman"; then
8366 echo "System manual is in $sysman." >&4
8367else
8368 echo "Could not find manual pages in source form." >&4
8369fi
8370
8371: determine where manual pages go
8372set man1dir man1dir none
8373eval $prefixit
8374$cat <<EOM
8375
8376$spackage has manual pages available in source form.
8377EOM
8378case "$nroff" in
8379nroff)
8380 echo "However, you don't have nroff, so they're probably useless to you."
8381 case "$man1dir" in
8382 '') man1dir="none";;
8383 esac;;
8384esac
8385echo "If you don't want the manual sources installed, answer 'none'."
8386case "$man1dir" in
8387' ') dflt=none
8388 ;;
8389'')
4a0a3829
SD
8390 lookpath="$prefixexp/share/man/man1"
8391 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8392 lookpath="$lookpath $prefixexp/man/p_man/man1"
8393 lookpath="$lookpath $prefixexp/man/u_man/man1"
8394 lookpath="$lookpath $prefixexp/man/man.1"
8395 case "$sysman" in
8396 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8397 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8398 esac
8399 set dflt
8400 eval $prefixup
8401 ;;
8402*) dflt="$man1dir"
8403 ;;
8404esac
8405echo " "
8406fn=dn+~
8407rp="Where do the main $spackage manual pages (source) go?"
8408. ./getfile
8409if $test "X$man1direxp" != "X$ansexp"; then
8410 installman1dir=''
8411fi
79522dd2
NC
8412prefixvar=man1dir
8413. ./setprefixvar
8414
477140ee
NC
8415case "$man1dir" in
8416'') man1dir=' '
8417 installman1dir='';;
8418esac
b4eb6b3d
JH
8419
8420: What suffix to use on installed man pages
8421
8422case "$man1dir" in
8423' ')
8424 man1ext='0'
8425 ;;
8426*)
8427 rp="What suffix should be used for the main $spackage man pages?"
8428 case "$man1ext" in
8429 '') case "$man1dir" in
8430 *1) dflt=1 ;;
8431 *1p) dflt=1p ;;
8432 *1pm) dflt=1pm ;;
8433 *l) dflt=l;;
8434 *n) dflt=n;;
8435 *o) dflt=o;;
8436 *p) dflt=p;;
8437 *C) dflt=C;;
8438 *L) dflt=L;;
8439 *L1) dflt=L1;;
8440 *) dflt=1;;
8441 esac
8442 ;;
8443 *) dflt="$man1ext";;
8444 esac
8445 . ./myread
8446 man1ext="$ans"
8447 ;;
8448esac
8449
8450: see if we can have long filenames
8451echo " "
8452first=123456789abcdef
8453$rm -f $first
8454if (echo hi >$first) 2>/dev/null; then
8455 if $test -f 123456789abcde; then
8456 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8457 val="$undef"
8458 else
8459 echo 'You can have filenames longer than 14 characters.'>&4
8460 val="$define"
8461 fi
8462else
8463 $cat <<'EOM'
8464You can't have filenames longer than 14 chars.
8465You can't even think about them!
8466EOM
8467 val="$undef"
776a38e3 8468fi
b4eb6b3d
JH
8469set d_flexfnam
8470eval $setvar
8471$rm -rf 123456789abcde*
8472
8473: determine where library module manual pages go
8474set man3dir man3dir none
8475eval $prefixit
8476$cat <<EOM
8477
8478$spackage has manual pages for many of the library modules.
8479EOM
8480
8481case "$nroff" in
8482nroff)
8483 $cat <<'EOM'
8484However, you don't have nroff, so they're probably useless to you.
8485EOM
8486 case "$man3dir" in
8487 '') man3dir="none";;
8488 esac;;
8489esac
8490
8491case "$d_flexfnam" in
8492undef)
8493 $cat <<'EOM'
f3f1a2d8 8494However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8495EOM
8496 case "$man3dir" in
8497 '') man3dir="none";;
8498 esac;;
8499esac
8500
8501echo "If you don't want the manual sources installed, answer 'none'."
8502prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8503case "$man3dir" in
8504'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8505 if $test -d "$privlib/man/man3"; then
8506 cat <<EOM >&4
8507
8508WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8509$privlib/man/man3. This version will suggest a
8510new default of $dflt.
b4eb6b3d
JH
8511EOM
8512 tdflt=$dflt
8513 dflt='n'
8514 rp='Do you wish to preserve the old behavior?(y/n)'
8515 . ./myread
8516 case "$ans" in
8517 y*) dflt="$privlib/man/man3" ;;
8518 *) dflt=$tdflt ;;
8519 esac
8520 fi
8521 ;;
8522*) dflt="$man3dir" ;;
8523esac
8524case "$dflt" in
8525' ') dflt=none ;;
8526esac
8527echo " "
8528fn=dn+~
8529rp="Where do the $package library man pages (source) go?"
8530. ./getfile
79522dd2
NC
8531prefixvar=man3dir
8532. ./setprefixvar
8533
477140ee
NC
8534case "$man3dir" in
8535'') man3dir=' '
8536 installman3dir='';;
8537esac
b4eb6b3d
JH
8538
8539: What suffix to use on installed man pages
8540case "$man3dir" in
8541' ')
8542 man3ext='0'
8543 ;;
8544*)
8545 rp="What suffix should be used for the $package library man pages?"
8546 case "$man3ext" in
8547 '') case "$man3dir" in
8548 *3) dflt=3 ;;
8549 *3p) dflt=3p ;;
8550 *3pm) dflt=3pm ;;
8551 *l) dflt=l;;
8552 *n) dflt=n;;
8553 *o) dflt=o;;
8554 *p) dflt=p;;
8555 *C) dflt=C;;
8556 *L) dflt=L;;
8557 *L3) dflt=L3;;
8558 *) dflt=3;;
8559 esac
8560 ;;
8561 *) dflt="$man3ext";;
8562 esac
8563 . ./myread
8564 man3ext="$ans"
8565 ;;
8566esac
8567
8568: see if we have to deal with yellow pages, now NIS.
0384a54a 8569if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8570 if $test -f /usr/etc/nibindd; then
8571 echo " "
8572 echo "I'm fairly confident you're on a NeXT."
8573 echo " "
8574 rp='Do you get the hosts file via NetInfo?'
8575 dflt=y
8576 case "$hostcat" in
8577 nidump*) ;;
8578 '') ;;
8579 *) dflt=n;;
8580 esac
8581 . ./myread
8582 case "$ans" in
8583 y*) hostcat='nidump hosts .';;
8584 *) case "$hostcat" in
8585 nidump*) hostcat='';;
8586 esac
8587 ;;
8588 esac
8589 fi
8590 case "$hostcat" in
8591 nidump*) ;;
8592 *)
8593 case "$hostcat" in
8594 *ypcat*) dflt=y;;
8595 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8596 dflt=y
8597 else
8598 dflt=n
8599 fi;;
8600 *) dflt=n;;
8601 esac
8602 echo " "
8603 rp='Are you getting the hosts file via yellow pages?'
8604 . ./myread
8605 case "$ans" in
8606 y*) hostcat='ypcat hosts';;
8607 *) hostcat='cat /etc/hosts';;
8608 esac
8609 ;;
8610 esac
8611fi
8612case "$hostcat" in
8613'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8614esac
8615case "$groupcat" in
8616'') test -f /etc/group && groupcat='cat /etc/group';;
8617esac
8618case "$passcat" in
8619'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8620esac
8621
8622: now get the host name
8623echo " "
8624echo "Figuring out host name..." >&4
8625case "$myhostname" in
8626'') cont=true
8627 echo 'Maybe "hostname" will work...'
73614538 8628 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8629 myhostname=$tans
8630 phostname=hostname
8631 cont=''
8632 fi
8633 ;;
8634*) cont='';;
8635esac
8636if $test "$cont"; then
8637 if ./xenix; then
8638 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8639 if tans=`cat /etc/systemid 2>&1` ; then
8640 myhostname=$tans
8641 phostname='cat /etc/systemid'
8642 echo "Whadyaknow. Xenix always was a bit strange..."
8643 cont=''
8644 fi
8645 elif $test -r /etc/systemid; then
8646 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8647 fi
8648fi
8649if $test "$cont"; then
8650 echo 'No, maybe "uuname -l" will work...'
73614538 8651 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8652 myhostname=$tans
8653 phostname='uuname -l'
8654 else
8655 echo 'Strange. Maybe "uname -n" will work...'
73614538 8656 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8657 myhostname=$tans
8658 phostname='uname -n'
8659 else
8660 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8661 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8662 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8663 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8664 else
8665 case "$myhostname" in
8666 '') echo "Does this machine have an identity crisis or something?"
8667 phostname='';;
8668 *)
8669 echo "Well, you said $myhostname before..."
8670 phostname='echo $myhostname';;
8671 esac
8672 fi
8673 fi
8674 fi
8675fi
52a549d0
JH
8676case "$myhostname" in
8677'') myhostname=noname ;;
8678esac
b4eb6b3d
JH
8679: you do not want to know about this
8680set $myhostname
8681myhostname=$1
8682
8683: verify guess
8684if $test "$myhostname" ; then
8685 dflt=y
8686 rp='Your host name appears to be "'$myhostname'".'" Right?"
8687 . ./myread
8688 case "$ans" in
8689 y*) ;;
8690 *) myhostname='';;
8691 esac
8692fi
8693
8694: bad guess or no guess
8695while $test "X$myhostname" = X ; do
8696 dflt=''
8697 rp="Please type the (one word) name of your host:"
8698 . ./myread
8699 myhostname="$ans"
8700done
8701
8702: translate upper to lower if necessary
8703case "$myhostname" in
8704*[A-Z]*)
8705 echo "(Normalizing case in your host name)"
8706 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8707 ;;
8708esac
8709
8710case "$myhostname" in
8711*.*)
8712 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8713 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8714 echo "(Trimming domain name from host name--host name is now $myhostname)"
8715 ;;
8716*) case "$mydomain" in
8717 '')
8718 {
8719 test "X$hostcat" = "Xypcat hosts" &&
8720 ypmatch "$myhostname" hosts 2>/dev/null |\
8721 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8722 $test -s hosts
8723 } || {
8724 test "X$hostcat" != "X" &&
8725 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8726 /[ ]$myhostname[ . ]/p" > hosts
8727 }
8728 tmp_re="[ . ]"
f08cbdd1
PP
8729 if $test -f hosts; then
8730 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8731 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8732 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8733 hosts | $sort | $uniq | \
8734 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8735 case `$echo X$dflt` in
8736 X*\ *) echo "(Several hosts in the database matched hostname)"
8737 dflt=.
8738 ;;
8739 X.) echo "(You do not have fully-qualified names in the hosts database)"
8740 ;;
8741 esac
8742 else
8743 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8744 dflt=.
f08cbdd1 8745 fi
b4eb6b3d
JH
8746 case "$dflt" in
8747 .)
8748 tans=`./loc resolv.conf X /etc /usr/etc`
8749 if $test -f "$tans"; then
8750 echo "(Attempting domain name extraction from $tans)"
8751 dflt=.`$sed -n -e 's/ / /g' \
8752 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
1d40d392 8753 -e 1q 2>/dev/null`
b4eb6b3d
JH
8754 case "$dflt" in
8755 .) dflt=.`$sed -n -e 's/ / /g' \
8756 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
1d40d392 8757 -e 1q 2>/dev/null`
b4eb6b3d
JH
8758 ;;
8759 esac
8760 fi
8761 ;;
8762 esac
8763 case "$dflt" in
8764 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8765 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8766 case "$dflt" in
8767 '') dflt='.';;
8768 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8769 esac
8770 ;;
8771 esac
59c9e5d6
PP
8772 case "$dflt$osname" in
8773 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8774 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8775 ;;
8776 esac
b4eb6b3d
JH
8777 case "$dflt" in
8778 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8779 dflt='.nonet'
b4eb6b3d
JH
8780 ;;
8781 esac
8782 $rm -f hosts
8783 ;;
8784 *) dflt="$mydomain";;
8785 esac;;
8786esac
8787echo " "
8788rp="What is your domain name?"
8789. ./myread
8790tans="$ans"
8791case "$ans" in
8792'') ;;
8793.*) ;;
8794*) tans=".$tans";;
8795esac
8796mydomain="$tans"
8797
8798: translate upper to lower if necessary
8799case "$mydomain" in
8800*[A-Z]*)
8801 echo "(Normalizing case in your domain name)"
8802 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8803 ;;
8804esac
8805
8806: a little sanity check here
8807case "$phostname" in
8808'') ;;
8809*)
8810 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8811 $myhostname$mydomain|$myhostname) ;;
8812 *)
8813 case "$phostname" in
8814 sed*)
8815 echo "(That doesn't agree with your whoami.h file, by the way.)"
8816 ;;
8817 *)
8818 echo "(That doesn't agree with your $phostname command, by the way.)"
8819 ;;
8820 esac
8821 ;;
8822 esac
8823 ;;
8824esac
8825
776a38e3 8826: determine the e-mail address of the user who is running us
b4eb6b3d
JH
8827$cat <<EOM
8828
8829I need to get your e-mail address in Internet format if possible, i.e.
8830something like user@host.domain. Please answer accurately since I have
8831no easy means to double check it. The default value provided below
8832is most probably close to reality but may not be valid from outside
8833your organization...
8834
8835EOM
8836cont=x
8837while test "$cont"; do
8838 case "$cf_email" in
8839 '') dflt="$cf_by@$myhostname$mydomain";;
8840 *) dflt="$cf_email";;
8841 esac
8842 rp='What is your e-mail address?'
8843 . ./myread
8844 cf_email="$ans"
8845 case "$cf_email" in
8846 *@*.*) cont='' ;;
8847 *)
8848 rp='Address does not look like an Internet one. Use it anyway?'
8849 case "$fastread" in
8850 yes) dflt=y ;;
8851 *) dflt=n ;;
8852 esac
8853 . ./myread
8854 case "$ans" in
8855 y*) cont='' ;;
8856 *) echo " " ;;
8857 esac
8858 ;;
8859 esac
8860done
8861
34f1896b 8862: Ask e-mail of administrator
b4eb6b3d
JH
8863$cat <<EOM
8864
8865If you or somebody else will be maintaining perl at your site, please
8866fill in the correct e-mail address here so that they may be contacted
8867if necessary. Currently, the "perlbug" program included with perl
8868will send mail to this address in addition to perlbug@perl.org. You may
8869enter "none" for no administrator.
8870
8871EOM
8872case "$perladmin" in
8873'') dflt="$cf_email";;
8874*) dflt="$perladmin";;
8875esac
8876rp='Perl administrator e-mail address'
8877. ./myread
8878perladmin="$ans"
8879
91f55cc7
MB
8880: determine whether to only install version-specific parts.
8881echo " "
8882$cat <<EOM
8883Do you want to install only the version-specific parts of the perl
8884distribution? Usually you do *not* want to do this.
8885EOM
8886case "$versiononly" in
8887"$define"|[Yy]*|true) dflt='y' ;;
8888*) dflt='n';
8889esac
8890rp="Do you want to install only the version-specific parts of perl?"
8891. ./myread
8892case "$ans" in
8893[yY]*) val="$define";;
8894*) val="$undef" ;;
8895esac
8896set versiononly
8897eval $setvar
8898
8899case "$versiononly" in
8900"$define") inc_version_list=''
8901 inc_version_list_init=0
8902 ;;
8903esac
8904
8905: figure out how to guarantee perl startup
8906: XXX Note that this currently takes advantage of the bug that binexp ignores
8907: the Configure -Dinstallprefix setting, which in turn means that under
8908: relocatable @INC, initialinstalllocation is what binexp started as.
8909case "$startperl" in
8910'')
8911 case "$sharpbang" in
8912 *!)
8913 $cat <<EOH
8914
8915I can use the #! construct to start perl on your system. This will
8916make startup of perl scripts faster, but may cause problems if you
8917want to share those scripts and perl is not in a standard place
8918($initialinstalllocation/perl) on all your platforms. The alternative
8919is to force a shell by starting the script with a single ':' character.
8920
8921EOH
8922 case "$versiononly" in
8923 "$define") dflt="$initialinstalllocation/perl$version";;
8924 *) dflt="$initialinstalllocation/perl";;
8925 esac
8926 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8927 . ./myread
8928 case "$ans" in
8929 none) startperl=": # use perl";;
8930 *) startperl="#!$ans"
8931 if $test 30 -lt `echo "$ans" | wc -c`; then
8932 $cat >&4 <<EOM
8933
8934WARNING: Some systems limit the #! command to 32 characters.
8935If you experience difficulty running Perl scripts with #!, try
8936installing Perl in a directory with a shorter pathname.
8937
8938EOM
8939 fi ;;
8940 esac
8941 ;;
8942 *) startperl=": # use perl"
8943 ;;
8944 esac
8945 ;;
8946esac
8947echo "I'll use $startperl to start perl scripts."
8948
8949: figure best path for perl in scripts
8950case "$perlpath" in
8951'')
8952 case "$versiononly" in
8953 "$define") perlpath="$initialinstalllocation/perl$version";;
8954 *) perlpath="$initialinstalllocation/perl";;
8955 esac
8956 case "$startperl" in
8957 *!*) ;;
8958 *)
8959 $cat <<EOH
8960
8961I will use the "eval 'exec'" idiom to start Perl on your system.
8962I can use the full path of your Perl binary for this purpose, but
8963doing so may cause problems if you want to share those scripts and
8964Perl is not always in a standard place ($initialinstalllocation/perl).
8965
8966EOH
8967 dflt="$initialinstalllocation/perl"
8968 rp="What path shall I use in \"eval 'exec'\"?"
8969 . ./myread
8970 perlpath="$ans"
8971 ;;
8972 esac
8973 ;;
8974esac
8975case "$startperl" in
8976*!*) ;;
8977*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8978esac
8979
b4eb6b3d
JH
8980: determine where public executable scripts go
8981set scriptdir scriptdir
8982eval $prefixit
8983case "$scriptdir" in
8984'')
8985 dflt="$bin"
8986 : guess some guesses
8987 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8988 $test -d /usr/share/bin && dflt=/usr/share/bin
8989 $test -d /usr/local/script && dflt=/usr/local/script
8990 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8991 $test -d $prefixexp/script && dflt=$prefixexp/script
8992 set dflt
8993 eval $prefixup
8994 ;;
8995*) dflt="$scriptdir"
8996 ;;
8997esac
8998$cat <<EOM
f3f1a2d8 8999
b4eb6b3d
JH
9000Some installations have a separate directory just for executable scripts so
9001that they can mount it across multiple architectures but keep the scripts in
9002one spot. You might, for example, have a subdirectory of /usr/share for this.
9003Or you might just lump your scripts in with all your other executables.
f3f1a2d8 9004
b4eb6b3d
JH
9005EOM
9006fn=d~
9007rp='Where do you keep publicly executable scripts?'
9008. ./getfile
9009if $test "X$ansexp" != "X$scriptdirexp"; then
9010 installscript=''
9011fi
f3f1a2d8 9012installscriptdir=''
79522dd2
NC
9013prefixvar=scriptdir
9014. ./setprefixvar
9015: A little fix up for an irregularly named variable.
9016installscript="$installscriptdir"
9017
b4eb6b3d
JH
9018: determine where add-on public executables go
9019case "$sitebin" in
9020'') dflt=$siteprefix/bin ;;
9021*) dflt=$sitebin ;;
9022esac
9023fn=d~
9024rp='Pathname where the add-on public executables should be installed?'
9025. ./getfile
79522dd2
NC
9026prefixvar=sitebin
9027. ./setprefixvar
b4eb6b3d 9028
6e1038e0 9029: determine where add-on html pages go
8d2cbf27 9030: There is no standard location, so try to copy the previously-selected
6e1038e0 9031: directory structure for the core html pages.
8d2cbf27
JH
9032case "$sitehtml1dir" in
9033'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9034*) dflt=$sitehtml1dir ;;
6e1038e0
MB
9035esac
9036case "$dflt" in
9037''|' ') dflt=none ;;
9038esac
9039fn=dn+~
9040rp='Pathname where the site-specific html pages should be installed?'
9041. ./getfile
79522dd2
NC
9042prefixvar=sitehtml1dir
9043. ./setprefixvar
6e1038e0
MB
9044
9045: determine where add-on library html pages go
9046: There is no standard location, so try to copy the previously-selected
9047: directory structure for the core html pages.
8d2cbf27
JH
9048case "$sitehtml3dir" in
9049'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9050*) dflt=$sitehtml3dir ;;
6e1038e0
MB
9051esac
9052case "$dflt" in
9053''|' ') dflt=none ;;
9054esac
9055fn=dn+~
9056rp='Pathname where the site-specific library html pages should be installed?'
9057. ./getfile
79522dd2
NC
9058prefixvar=sitehtml3dir
9059. ./setprefixvar
6e1038e0
MB
9060
9061: determine where add-on manual pages go
91e123a8
JH
9062case "$siteman1dir" in
9063'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9064*) dflt=$siteman1dir ;;
6e1038e0 9065esac
257059b5
JH
9066case "$dflt" in
9067''|' ') dflt=none ;;
9068esac
6e1038e0
MB
9069fn=dn+~
9070rp='Pathname where the site-specific manual pages should be installed?'
9071. ./getfile
79522dd2
NC
9072prefixvar=siteman1dir
9073. ./setprefixvar
6e1038e0
MB
9074
9075: determine where add-on library man pages go
91e123a8
JH
9076case "$siteman3dir" in
9077'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9078*) dflt=$siteman3dir ;;
6e1038e0 9079esac
257059b5
JH
9080case "$dflt" in
9081''|' ') dflt=none ;;
9082esac
6e1038e0
MB
9083fn=dn+~
9084rp='Pathname where the site-specific library manual pages should be installed?'
9085. ./getfile
79522dd2
NC
9086prefixvar=siteman3dir
9087. ./setprefixvar
6e1038e0
MB
9088
9089: determine where add-on public executable scripts go
9090case "$sitescript" in
9091'') dflt=$siteprefix/script
9092 $test -d $dflt || dflt=$sitebin ;;
9093*) dflt="$sitescript" ;;
9094esac
9095fn=d~+
9096rp='Pathname where add-on public executable scripts should be installed?'
9097. ./getfile
79522dd2
NC
9098prefixvar=sitescript
9099. ./setprefixvar
6e1038e0 9100
34f1896b 9101: Check if faststdio is requested and available
15b61c98
JH
9102case "$usefaststdio" in
9103$define|true|[yY]*|'')
9104 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9105 case "$xversion" in
9106 [68]) dflt='y' ;;
9107 *) dflt='n' ;;
9108 esac
9109 ;;
9110*) dflt='n';;
9111esac
9112cat <<EOM
9113
9114Perl can be built to use 'fast stdio', which means using the stdio
9115library but also directly manipulating the stdio buffers to enable
9116faster I/O. Using stdio is better for backward compatibility (especially
9117for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9118interface has been preferred instead of stdio.
9119
9120If this doesn't make any sense to you, just accept the default '$dflt'.
9121EOM
9122rp='Use the "fast stdio" if available?'
9123. ./myread
9124case "$ans" in
34f1896b 9125y|Y) val="$define" ;;
15b61c98
JH
9126*) val="$undef" ;;
9127esac
9128set usefaststdio
9129eval $setvar
9130
9131
96056487
JH
9132: define an is-a-typedef? function
9133typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9134case "$inclist" in
9135"") inclist="sys/types.h";;
9136esac;
9137eval "varval=\$$var";
9138case "$varval" in
9139"")
9140 $rm -f temp.c;
9141 for inc in $inclist; do
9142 echo "#include <$inc>" >>temp.c;
9143 done;
9144 echo "#ifdef $type" >> temp.c;
9145 echo "printf(\"We have $type\");" >> temp.c;
9146 echo "#endif" >> temp.c;
9147 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9148 if $contains $type temp.E >/dev/null 2>&1; then
9149 eval "$var=\$type";
9150 else
9151 eval "$var=\$def";
9152 fi;
9153 $rm -f temp.?;;
9154*) eval "$var=\$varval";;
9155esac'
9156
9157: define an is-a-typedef? function that prompts if the type is not available.
9158typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9159case "$inclist" in
9160"") inclist="sys/types.h";;
9161esac;
9162eval "varval=\$$var";
9163case "$varval" in
9164"")
9165 $rm -f temp.c;
9166 for inc in $inclist; do
9167 echo "#include <$inc>" >>temp.c;
9168 done;
9169 echo "#ifdef $type" >> temp.c;
9170 echo "printf(\"We have $type\");" >> temp.c;
9171 echo "#endif" >> temp.c;
9172 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9173 echo " " ;
9174 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9175 if $contains $type temp.E >/dev/null 2>&1; then
9176 echo "$type found." >&4;
9177 eval "$var=\$type";
9178 else
9179 echo "$type NOT found." >&4;
9180 dflt="$def";
9181 . ./myread ;
9182 eval "$var=\$ans";
9183 fi;
9184 $rm -f temp.?;;
9185*) eval "$var=\$varval";;
9186esac'
9187
9188: see what type lseek is declared as in the kernel
9189rp="What is the type used for lseek's offset on this system?"
9190set off_t lseektype long stdio.h sys/types.h
9191eval $typedef_ask
9192
9193echo " "
9194echo "Checking to see how big your file offsets are..." >&4
9195$cat >try.c <<EOCP
9196#include <sys/types.h>
9197#include <stdio.h>
9198int main()
9199{
9200 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9201 return(0);
96056487
JH
9202}
9203EOCP
9204set try
9205if eval $compile_ok; then
9206 lseeksize=`$run ./try`
9207 echo "Your file offsets are $lseeksize bytes long."
9208else
9209 dflt=$longsize
9210 echo " "
9211 echo "(I can't seem to compile the test program. Guessing...)"
9212 rp="What is the size of your file offsets (in bytes)?"
9213 . ./myread
9214 lseeksize="$ans"
9215fi
5b813a60 9216$rm_try
96056487
JH
9217
9218: see what type file positions are declared as in the library
9219rp="What is the type for file position used by fsetpos()?"
9220set fpos_t fpostype long stdio.h sys/types.h
9221eval $typedef_ask
9222
613d6c3e 9223: Check size for Fpos_t
96056487
JH
9224echo " "
9225case "$fpostype" in
9226*_t) zzz="$fpostype" ;;
9227*) zzz="fpos_t" ;;
9228esac
613d6c3e 9229echo "Checking the size of $zzz..." >&4
96056487
JH
9230cat > try.c <<EOCP
9231#include <sys/types.h>
9232#include <stdio.h>
d1daaddf
JH
9233#$i_stdlib I_STDLIB
9234#ifdef I_STDLIB
9235#include <stdlib.h>
9236#endif
96056487
JH
9237int main() {
9238 printf("%d\n", (int)sizeof($fpostype));
9239 exit(0);
9240}
9241EOCP
9242set try
9243if eval $compile_ok; then
9244 yyy=`$run ./try`
9245 case "$yyy" in
9246 '') fpossize=4
9247 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9248 ;;
9249 *) fpossize=$yyy
9250 echo "Your $zzz is $fpossize bytes long."
9251 ;;
9252 esac
9253else
9254 dflt="$longsize"
9255 echo " " >&4
9256 echo "(I can't compile the test program. Guessing...)" >&4
9257 rp="What is the size of your file positions (in bytes)?"
9258 . ./myread
9259 fpossize="$ans"
9260fi
9261
613d6c3e 9262: Check for large file support
96056487
JH
9263# Backward compatibility (uselfs is deprecated).
9264case "$uselfs" in
9265"$define"|true|[yY]*)
9266 cat <<EOM >&4
9267
9268*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9269EOM
9270 uselargefiles="$define"
9271 ;;
5b813a60 9272esac
96056487
JH
9273
9274case "$lseeksize:$fpossize" in
92758:8) cat <<EOM
9276
9277You can have files larger than 2 gigabytes.
9278EOM
9279 val="$define" ;;
9280*) case "$uselargefiles" in
9281 "$undef"|false|[nN]*) dflt='n' ;;
9282 *) dflt='y' ;;
9283 esac
9284 cat <<EOM
9285
9286Perl can be built to understand large files (files larger than 2 gigabytes)
9287on some systems. To do so, Configure can be run with -Duselargefiles.
9288
9289If this doesn't make any sense to you, just accept the default '$dflt'.
9290EOM
9291 rp='Try to understand large files, if available?'
9292 . ./myread
9293 case "$ans" in
9294 y|Y) val="$define" ;;
9295 *) val="$undef" ;;
9296 esac
9297 ;;
9298esac
9299set uselargefiles
9300eval $setvar
96056487
JH
9301: Look for a hint-file generated 'call-back-unit'. If the
9302: user has specified that a large files perl is to be built,
9303: we may need to set or change some other defaults.
9da7673b
MB
9304if $test -f uselargefiles.cbu; then
9305 echo "Your platform has some specific hints regarding large file builds, using them..."
9306 . ./uselargefiles.cbu
9307fi
9308case "$uselargefiles" in
9309"$define")
96056487 9310 if $test -f uselargefiles.cbu; then
96056487
JH
9311 echo " "
9312 echo "Rechecking to see how big your file offsets are..." >&4
9313 $cat >try.c <<EOCP
9314#include <sys/types.h>
9315#include <stdio.h>
9316int main()
9317{
9318 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9319 return(0);
96056487
JH
9320}
9321EOCP
9322 set try
9323 if eval $compile_ok; then
9324 lseeksize=`$run ./try`
9325 $echo "Your file offsets are now $lseeksize bytes long."
9326 else
9327 dflt="$lseeksize"
9328 echo " "
9329 echo "(I can't seem to compile the test program. Guessing...)"
9330 rp="What is the size of your file offsets (in bytes)?"
9331 . ./myread
9332 lseeksize="$ans"
9333 fi
9334 case "$fpostype" in
9335 *_t) zzz="$fpostype" ;;
9336 *) zzz="fpos_t" ;;
9337 esac
5b813a60 9338 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9339 $cat > try.c <<EOCP
9340#include <sys/types.h>
9341#include <stdio.h>
55954f19
JH
9342#$i_stdlib I_STDLIB
9343#ifdef I_STDLIB
9344#include <stdlib.h>
9345#endif
96056487
JH
9346int main() {
9347 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9348 return(0);
96056487
JH
9349}
9350EOCP
9351 set try
9352 if eval $compile_ok; then
9353 yyy=`$run ./try`
9354 dflt="$lseeksize"
9355 case "$yyy" in
9356 '') echo " "
9357 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9358 ;;
9359 *) fpossize=$yyy
9360 echo " $fpossize bytes." >&4
9361 ;;
9362 esac
9363 else
9364 dflt="$fpossize"
9365 echo " "
9366 echo "(I can't compile the test program. Guessing...)" >&4
9367 rp="What is the size of your file positions (in bytes)?"
9368 . ./myread
9369 fpossize="$ans"
9370 fi
5b813a60 9371 $rm_try
96056487
JH
9372 fi
9373 ;;
9374esac
9375
dd35fa16
MB
9376: Check if we want perlio
9377useperlio="$define"
9378
613d6c3e 9379: Set the vendorbin variables
b4eb6b3d
JH
9380case "$vendorprefix" in
9381'') d_vendorbin="$undef"
9382 vendorbin=''
9383 vendorbinexp=''
9384 ;;
9385*) d_vendorbin="$define"
9386 : determine where vendor-supplied executables go.
9387 case "$vendorbin" in
9388 '') dflt=$vendorprefix/bin ;;
9389 *) dflt="$vendorbin" ;;
9390 esac
9391 fn=d~+
9392 rp='Pathname for the vendor-supplied executables directory?'
9393 . ./getfile
9394 vendorbin="$ans"
9395 vendorbinexp="$ansexp"
9396 ;;
9397esac
a092d240
NC
9398prefixvar=vendorbin
9399. ./installprefix
b4eb6b3d 9400
613d6c3e 9401: Set the vendorhtml1dir variables
6e1038e0 9402case "$vendorprefix" in
8d2cbf27
JH
9403'') vendorhtml1dir=''
9404 vendorhtml1direxp=''
6e1038e0
MB
9405 ;;
9406*) : determine where vendor-supplied html pages go.
9407 : There is no standard location, so try to copy the previously-selected
9408 : directory structure for the core html pages.
9409 : XXX Better default suggestions would be welcome.
8d2cbf27 9410 case "$vendorhtml1dir" in
6e1038e0 9411 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9412 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9413 esac
9414 case "$dflt" in
9415 ''|' ') dflt=none ;;
9416 esac
9417 fn=dn+~
9418 rp='Pathname for the vendor-supplied html pages?'
9419 . ./getfile
8d2cbf27
JH
9420 vendorhtml1dir="$ans"
9421 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9422 ;;
9423esac
9424: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9425$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9426prefixvar=vendorhtml1dir
9427. ./installprefix
6e1038e0 9428
613d6c3e 9429: Set the vendorhtml3dir variables
6e1038e0 9430case "$vendorprefix" in
8d2cbf27
JH
9431'') vendorhtml3dir=''
9432 vendorhtml3direxp=''
6e1038e0
MB
9433 ;;
9434*) : determine where vendor-supplied module html pages go.
9435 : There is no standard location, so try to copy the previously-selected
9436 : directory structure for the core html pages.
9437 : XXX Better default suggestions would be welcome.
8d2cbf27 9438 case "$vendorhtml3dir" in
6e1038e0 9439 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9440 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9441 esac
9442 case "$dflt" in
9443 ''|' ') dflt=none ;;
9444 esac
9445 fn=dn+~
9446 rp='Pathname for the vendor-supplied html pages?'
9447 . ./getfile
8d2cbf27
JH
9448 vendorhtml3dir="$ans"
9449 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9450 ;;
9451esac
9452: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9453$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9454prefixvar=vendorhtml3dir
9455. ./installprefix
6e1038e0 9456
613d6c3e 9457: Set the vendorman1dir variables
6e1038e0 9458case "$vendorprefix" in
91e123a8
JH
9459'') vendorman1dir=''
9460 vendorman1direxp=''
6e1038e0
MB
9461 ;;
9462*) : determine where vendor-supplied manual pages go.
91e123a8 9463 case "$vendorman1dir" in
6e1038e0 9464 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9465 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9466 esac
9467 case "$dflt" in
9468 ''|' ') dflt=none ;;
9469 esac
9470 fn=nd~+
9471 rp='Pathname for the vendor-supplied manual section 1 pages?'
9472 . ./getfile
91e123a8
JH
9473 vendorman1dir="$ans"
9474 vendorman1direxp="$ansexp"
6e1038e0
MB
9475 ;;
9476esac
9477: Use ' ' for none so value is preserved next time through Configure
91e123a8 9478$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9479prefixvar=vendorman1dir
9480. ./installprefix
6e1038e0 9481
613d6c3e 9482: Set the vendorman3dir variables
6e1038e0 9483case "$vendorprefix" in
91e123a8
JH
9484'') vendorman3dir=''
9485 vendorman3direxp=''
6e1038e0
MB
9486 ;;
9487*) : determine where vendor-supplied module manual pages go.
91e123a8 9488 case "$vendorman3dir" in
6e1038e0 9489 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9490 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9491 esac
9492 case "$dflt" in
9493 ''|' ') dflt=none ;;
9494 esac
9495 fn=nd~+
9496 rp='Pathname for the vendor-supplied manual section 3 pages?'
9497 . ./getfile
91e123a8
JH
9498 vendorman3dir="$ans"
9499 vendorman3direxp="$ansexp"
6e1038e0
MB
9500 ;;
9501esac
9502: Use ' ' for none so value is preserved next time through Configure
91e123a8 9503$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9504prefixvar=vendorman3dir
9505. ./installprefix
6e1038e0 9506
613d6c3e 9507: Set the vendorscript variables
6e1038e0
MB
9508case "$vendorprefix" in
9509'') d_vendorscript="$undef"
9510 vendorscript=''
9511 vendorscriptexp=''
9512 ;;
9513*) d_vendorscript="$define"
9514 : determine where vendor-supplied scripts go.
9515 case "$vendorscript" in
9516 '') dflt=$vendorprefix/script
9517 $test -d $dflt || dflt=$vendorbin ;;
9518 *) dflt="$vendorscript" ;;
9519 esac
9520 $cat <<EOM
9521
f3f1a2d8 9522The installation process will create a directory for
6e1038e0
MB
9523vendor-supplied scripts.
9524
9525EOM
9526 fn=d~+
9527 rp='Pathname for the vendor-supplied scripts directory?'
9528 . ./getfile
9529 vendorscript="$ans"
9530 vendorscriptexp="$ansexp"
9531 ;;
9532esac
a092d240
NC
9533prefixvar=vendorscript
9534. ./installprefix
6e1038e0 9535
f47f1645
TC
9536: script used to emit important warnings
9537cat >warn <<EOS
9538$startsh
9539if test \$# -gt 0; then
9540 echo "\$@" >msg
9541else
9542 cat >msg
9543fi
9544echo "*** WARNING:" >&4
9545sed -e 's/^/*** /' <msg >&4
9546echo "*** " >&4
9547cat msg >>config.msg
9548echo " " >>config.msg
9549rm -f msg
9550EOS
9551chmod +x warn
9552$eunicefix warn
9553
9554: see which of string.h or strings.h is needed
9555echo " "
9556strings=`./findhdr string.h`
9557if $test "$strings" && $test -r "$strings"; then
9558 echo "Using <string.h> instead of <strings.h>." >&4
9559 val="$define"
9560else
9561 val="$undef"
9562 strings=`./findhdr strings.h`
9563 if $test "$strings" && $test -r "$strings"; then
9564 echo "Using <strings.h> instead of <string.h>." >&4
9565 else
9566 ./warn "No string header found -- You'll surely have problems."
9567 fi
9568fi
9569set i_string
9570eval $setvar
9571case "$i_string" in
9572"$undef") strings=`./findhdr strings.h`;;
9573*) strings=`./findhdr string.h`;;
9574esac
9575
b4eb6b3d
JH
9576: see if qgcvt exists
9577set qgcvt d_qgcvt
9578eval $inlibc
9579
613d6c3e 9580: Check print/scan long double stuff
89ce900e
JH
9581echo " "
9582
9583if $test X"$d_longdbl" = X"$define"; then
9584
9585echo "Checking how to print long doubles..." >&4
9586
9587if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9588 $cat >try.c <<'EOCP'
9589#include <sys/types.h>
9590#include <stdio.h>
9591int main() {
9592 double d = 123.456;
9593 printf("%.3f\n", d);
9594}
9595EOCP
9596 set try
9597 if eval $compile; then
9598 yyy=`$run ./try`
9599 case "$yyy" in
9600 123.456)
9601 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9602 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9603 echo "We will use %f."
9604 ;;
9605 esac
9606 fi
9607fi
9608
9609if $test X"$sPRIfldbl" = X; then
9610 $cat >try.c <<'EOCP'
9611#include <sys/types.h>
9612#include <stdio.h>
9613int main() {
9614 long double d = 123.456;
9615 printf("%.3Lf\n", d);
9616}
9617EOCP
9618 set try
9619 if eval $compile; then
9620 yyy=`$run ./try`
9621 case "$yyy" in
9622 123.456)
9623 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9624 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9625 echo "We will use %Lf."
9626 ;;
9627 esac
9628 fi
9629fi
9630
9631if $test X"$sPRIfldbl" = X; then
9632 $cat >try.c <<'EOCP'
9633#include <sys/types.h>
9634#include <stdio.h>
9635int main() {
9636 long double d = 123.456;
9637 printf("%.3llf\n", d);
9638}
9639EOCP
9640 set try
9641 if eval $compile; then
9642 yyy=`$run ./try`
9643 case "$yyy" in
9644 123.456)
9645 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9646 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9647 echo "We will use %llf."
9648 ;;
9649 esac
9650 fi
9651fi
9652
9653if $test X"$sPRIfldbl" = X; then
9654 $cat >try.c <<'EOCP'
9655#include <sys/types.h>
9656#include <stdio.h>
9657int main() {
9658 long double d = 123.456;
9659 printf("%.3lf\n", d);
9660}
9661EOCP
9662 set try
9663 if eval $compile; then
9664 yyy=`$run ./try`
9665 case "$yyy" in
9666 123.456)
9667 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9668 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9669 echo "We will use %lf."
9670 ;;
9671 esac
9672 fi
9673fi
9674
9675if $test X"$sPRIfldbl" = X; then
9676 echo "Cannot figure out how to print long doubles." >&4
9677else
9678 sSCNfldbl=$sPRIfldbl # expect consistency
9679fi
9680
5b813a60 9681$rm_try
89ce900e
JH
9682
9683fi # d_longdbl
9684
9685case "$sPRIfldbl" in
5b813a60
MB
9686'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9687 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9688 d_SCNfldbl="$undef";
9689 ;;
5b813a60
MB
9690*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9691 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9692 d_SCNfldbl="$define";
9693 ;;
9694esac
9695
b4eb6b3d 9696: Check how to convert floats to strings.
a5b10d80
YST
9697
9698if test "X$d_Gconvert" = X; then
9699
b4eb6b3d
JH
9700echo " "
9701echo "Checking for an efficient way to convert floats to strings."
9702echo " " > try.c
9703case "$uselongdouble" in
9704"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9705esac
9706case "$d_longdbl" in
9707"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9708esac
9709case "$d_PRIgldbl" in
9710"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9711esac
9712$cat >>try.c <<EOP
9713#ifdef TRY_gconvert
9714#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9715char *myname = "gconvert";
9716#endif
9717#ifdef TRY_gcvt
9718#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9719char *myname = "gcvt";
9720#endif
9721#ifdef TRY_qgcvt
9722#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9723char *myname = "qgcvt";
9724#define DOUBLETYPE long double
9725#endif
9726#ifdef TRY_sprintf
a5b10d80
YST
9727#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9728#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9729#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9730#else
a5b10d80
YST
9731#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9732#endif
9733#else
b4eb6b3d
JH
9734#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9735#endif
9736char *myname = "sprintf";
9737#endif
9738
9739#ifndef DOUBLETYPE
9740#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9741#define DOUBLETYPE long double
9742#else
9743#define DOUBLETYPE double
9744#endif
9745#endif
9746
9747#include <stdio.h>
9748
f47f1645 9749#$i_stdlib I_STDLIB
b4eb6b3d
JH
9750#ifdef I_STDLIB
9751#include <stdlib.h>
9752#endif
f47f1645
TC
9753#$i_string I_STRING
9754#ifdef I_STRING
9755# include <string.h>
9756#else
9757# include <strings.h>
9758#endif
b4eb6b3d 9759
f47f1645 9760int checkit(char *expect, char *got)
b4eb6b3d
JH
9761{
9762 if (strcmp(expect, got)) {
9763 printf("%s oddity: Expected %s, got %s\n",
9764 myname, expect, got);
9765 exit(1);
9766 }
9767}
9768
9769int main()
5b813a60
MB
9770{
9771 char buf[64];
b4eb6b3d
JH
9772 buf[63] = '\0';
9773
9774 /* This must be 1st test on (which?) platform */
9775 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9776 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9777 checkit("0.1", buf);
9778
5b813a60 9779 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9780 checkit("0.01", buf);
9781
5b813a60 9782 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9783 checkit("0.001", buf);
9784
5b813a60 9785 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9786 checkit("0.0001", buf);
9787
9788 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9789 if (strlen(buf) > 5)
9790 checkit("9e-005", buf); /* for Microsoft ?? */
9791 else
9792 checkit("9e-05", buf);
9793
5b813a60 9794 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9795 checkit("1", buf);
9796
5b813a60 9797 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9798 checkit("1.1", buf);
9799
5b813a60 9800 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9801 checkit("1.01", buf);
9802
5b813a60 9803 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9804 checkit("1.001", buf);
9805
5b813a60 9806 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9807 checkit("1.0001", buf);
9808
5b813a60 9809 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9810 checkit("1.00001", buf);
9811
5b813a60 9812 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9813 checkit("1.000001", buf);
9814
5b813a60 9815 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9816 checkit("0", buf);
9817
5b813a60 9818 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9819 checkit("-1", buf);
9820
9821 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9822 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9823 checkit("100000", buf);
5b813a60 9824
b4eb6b3d 9825 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9826 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9827 checkit("-100000", buf);
9828
5b813a60 9829 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9830 checkit("123.456", buf);
9831
ab6ca9f4 9832 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9833 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9834 /* 34 should be enough to scare even long double
9835 * places into using the e notation. */
ab6ca9f4 9836 if (strlen(buf) > 5)
94b339ad 9837 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9838 else
94b339ad 9839 checkit("1e+34", buf);
8e2a5ede 9840
d1eb8299
YST
9841 /* For Perl, if you add additional tests here, also add them to
9842 * t/base/num.t for benefit of platforms not using Configure or
9843 * overriding d_Gconvert */
9844
b4eb6b3d
JH
9845 exit(0);
9846}
9847EOP
ab6ca9f4 9848: first add preferred functions to our list
a5b10d80 9849xxx_list=""
ab6ca9f4 9850for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9851 case $xxx_convert in
9852 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9853 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9854 esac
a5b10d80
YST
9855done
9856: then add any others
9857for xxx_convert in gconvert gcvt sprintf; do
9858 case "$xxx_list" in
9859 *$xxx_convert*) ;;
9860 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9861 esac
a5b10d80
YST
9862done
9863
9864case "$d_longdbl$uselongdouble" in
9865"$define$define")
cd95ead5 9866 : again, add preferred functions to our list first
a5b10d80 9867 xxx_ld_list=""
ab6ca9f4 9868 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9869 case $xxx_convert in
9870 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9871 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9872 esac
9873 done
9874 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9875 for xxx_convert in qgcvt sprintf $xxx_list; do
9876 case "$xxx_ld_list" in
9877 $xxx_convert*|*" $xxx_convert"*) ;;
9878 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9879 esac
9880 done
9881 : if sprintf cannot do long doubles, move it to the end
9882 if test "$d_PRIgldbl" != "$define"; then
9883 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9884 fi
9885 : if no qgcvt, remove it
9886 if test "$d_qgcvt" != "$define"; then
9887 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9888 fi
9889 : use the ld_list
9890 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9891 ;;
9892esac
9893
9894for xxx_convert in $xxx_list; do
9895 echo "Trying $xxx_convert..."
93451a0d 9896 $rm -f try try$_o core
b4eb6b3d
JH
9897 set try -DTRY_$xxx_convert
9898 if eval $compile; then
9899 echo "$xxx_convert() found." >&4
5440bc8e 9900 if $run ./try; then
b4eb6b3d
JH
9901 echo "I'll use $xxx_convert to convert floats into a string." >&4
9902 break;
9903 else
9904 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9905 xxx_convert=''
b4eb6b3d
JH
9906 fi
9907 else
9908 echo "$xxx_convert NOT found." >&4
9909 fi
9910done
ab6ca9f4 9911
a5b10d80
YST
9912if test X$xxx_convert = X; then
9913 echo "*** WHOA THERE!!! ***" >&4
9914 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9915 xxx_convert=sprintf
9916fi
9917
b4eb6b3d
JH
9918case "$xxx_convert" in
9919gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9920gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9921qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9922*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9923 "$define$define$define")
9924 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9925 "$define$define$undef")
9926 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9927 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9928 esac
5b813a60 9929 ;;
b4eb6b3d
JH
9930esac
9931
a5b10d80 9932fi
93451a0d 9933$rm_try
a5b10d80 9934
74cac757
JH
9935: see if _fwalk exists
9936set fwalk d__fwalk
9937eval $inlibc
9938
b4eb6b3d
JH
9939: Initialize h_fcntl
9940h_fcntl=false
9941
9942: Initialize h_sysfile
9943h_sysfile=false
9944
9945: access call always available on UNIX
9946set access d_access
9947eval $inlibc
9948
9949: locate the flags for 'access()'
9950case "$d_access" in
9951"$define")
9952 echo " "
55954f19 9953 $cat >access.c <<EOCP
b4eb6b3d
JH
9954#include <sys/types.h>
9955#ifdef I_FCNTL
9956#include <fcntl.h>
9957#endif
9958#ifdef I_SYS_FILE
9959#include <sys/file.h>
9960#endif
9961#ifdef I_UNISTD
9962#include <unistd.h>
9963#endif
55954f19
JH
9964#$i_stdlib I_STDLIB
9965#ifdef I_STDLIB
9966#include <stdlib.h>
9967#endif
b4eb6b3d
JH
9968int main() {
9969 exit(R_OK);
9970}
9971EOCP
9972 : check sys/file.h first, no particular reason here
9973 if $test `./findhdr sys/file.h` && \
7a282f6d 9974 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9975 h_sysfile=true;
9976 echo "<sys/file.h> defines the *_OK access constants." >&4
9977 elif $test `./findhdr fcntl.h` && \
7a282f6d 9978 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9979 h_fcntl=true;
9980 echo "<fcntl.h> defines the *_OK access constants." >&4
9981 elif $test `./findhdr unistd.h` && \
7a282f6d 9982 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9983 echo "<unistd.h> defines the *_OK access constants." >&4
9984 else
9985 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9986 fi
9987 ;;
9988esac
9989$rm -f access*
9990
9991: see if accessx exists
9992set accessx d_accessx
9993eval $inlibc
9994
89ce900e
JH
9995: see if aintl exists
9996set aintl d_aintl
9997eval $inlibc
9998
b4eb6b3d
JH
9999: see if alarm exists
10000set alarm d_alarm
10001eval $inlibc
10002
96938616
MB
10003: see if 64bit time functions exists
10004
10005set ctime64 d_ctime64
10006eval $inlibc
10007
10008set localtime64 d_localtime64
10009eval $inlibc
10010
10011set gmtime64 d_gmtime64
10012eval $inlibc
10013
10014set mktime64 d_mktime64
10015eval $inlibc
10016
10017set difftime64 d_difftime64
10018eval $inlibc
10019
10020set asctime64 d_asctime64
10021eval $inlibc
10022
a9dade78
JH
10023: see if POSIX threads are available
10024set pthread.h i_pthread
10025eval $inhdr
10026
cd95ead5 10027: define a function to check prototypes
10bc17b6
JH
10028$cat > protochk <<EOSH
10029$startsh
10030cc="$cc"
10031optimize="$optimize"
10032ccflags="$ccflags"
10033prototype="$prototype"
10034define="$define"
c944cfb9 10035rm_try="$rm_try"
a9dade78
JH
10036usethreads=$usethreads
10037i_pthread=$i_pthread
10038pthread_h_first=$pthread_h_first
10bc17b6
JH
10039EOSH
10040
10041$cat >> protochk <<'EOSH'
10042
5b813a60 10043$rm_try
10bc17b6
JH
10044foo="$1"
10045shift
10046while test $# -ge 2; do
10047 case "$1" in
10048 $define) echo "#include <$2>" >> try.c ;;
10049 literal) echo "$2" >> try.c ;;
10050 esac
cce6a207
MB
10051 # Extra magic for the benefit of systems that need pthread.h
10052 # to be included early to correctly detect threadsafe functions.
10053 # Such functions must guarantee themselves, though, that the usethreads
10054 # and i_pthread have been defined, before calling protochk.
10055 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10056 echo "#include <pthread.h>" >> try.c
10057 pthread_h_done=yes
10058 fi
10bc17b6
JH
10059 shift 2
10060done
10061test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10062cat >> try.c <<'EOCP'
10063#ifdef CAN_PROTOTYPE
10064#define _(args) args
10065#else
10066#define _(args) ()
10067#endif
10068EOCP
10069echo "$foo" >> try.c
10070echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10071$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10072status=$?
5b813a60 10073$rm_try
10bc17b6
JH
10074exit $status
10075EOSH
10076chmod +x protochk
10077$eunicefix protochk
10078
34f1896b 10079: Define hasproto macro for Configure internal use
89ce900e
JH
10080hasproto='varname=$1; func=$2; shift; shift;
10081while $test $# -ge 2; do
10082 case "$1" in
10083 $define) echo "#include <$2>";;
10084 esac ;
10085 shift 2;
10086done > try.c;
10087$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10088if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10089 echo "$func() prototype found.";
10090 val="$define";
10091else
10092 echo "$func() prototype NOT found.";
10093 val="$undef";
10094fi;
10095set $varname;
10096eval $setvar;
5b813a60 10097$rm_try tryout.c'
89ce900e 10098
10bc17b6
JH
10099: see if sys/types.h has to be included
10100set sys/types.h i_systypes
10101eval $inhdr
10102
10103: see if sys/select.h has to be included
10104set sys/select.h i_sysselct
10105eval $inhdr
10106
34f1896b 10107: Define hasfield macro for Configure internal use
10bc17b6
JH
10108hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10109while $test $# -ge 2; do
10110 case "$1" in
10111 $define) echo "#include <$2>";;
10112 esac ;
10113 shift 2;
10114done > try.c;
10115echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10116set try;
10117if eval $compile; then
10118 val="$define";
10119else
10120 val="$undef";
10121fi;
10122set $varname;
10123eval $setvar;
5b813a60 10124$rm_try'
10bc17b6
JH
10125
10126: see if we should include time.h, sys/time.h, or both
10127echo " "
10128if test "X$timeincl" = X; then
10129 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10130 $echo $n "I'm now running the test program...$c"
55954f19 10131 $cat >try.c <<EOCP
10bc17b6
JH
10132#include <sys/types.h>
10133#ifdef I_TIME
10134#include <time.h>
10135#endif
10136#ifdef I_SYSTIME
10137#ifdef SYSTIMEKERNEL
10138#define KERNEL
10139#endif
10140#include <sys/time.h>
10141#endif
10142#ifdef I_SYSSELECT
10143#include <sys/select.h>
10144#endif
55954f19
JH
10145#$i_stdlib I_STDLIB
10146#ifdef I_STDLIB
10147#include <stdlib.h>
10148#endif
10bc17b6
JH
10149int main()
10150{
10151 struct tm foo;
10152#ifdef S_TIMEVAL
10153 struct timeval bar;
10154#endif
10155#ifdef S_TIMEZONE
10156 struct timezone tzp;
10157#endif
10158 if (foo.tm_sec == foo.tm_sec)
10159 exit(0);
10160#ifdef S_TIMEVAL
10161 if (bar.tv_sec == bar.tv_sec)
10162 exit(0);
10163#endif
10164 exit(1);
10165}
10166EOCP
10167 flags=''
10168 for s_timezone in '-DS_TIMEZONE' ''; do
10169 sysselect=''
10170 for s_timeval in '-DS_TIMEVAL' ''; do
10171 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10172 for i_time in '' '-DI_TIME'; do
10173 for i_systime in '-DI_SYSTIME' ''; do
10174 case "$flags" in
10175 '') $echo $n ".$c"
10176 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10177 if eval $compile; then
10178 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10179 shift
10180 flags="$*"
10181 echo " "
10182 $echo $n "Succeeded with $flags$c"
10183 fi
10184 ;;
10185 esac
10186 done
10187 done
10188 done
10189 done
10190 done
10191 timeincl=''
10192 echo " "
10193 case "$flags" in
10194 *SYSTIMEKERNEL*) i_systimek="$define"
10195 timeincl=`./findhdr sys/time.h`
10196 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10197 *) i_systimek="$undef";;
10198 esac
10199 case "$flags" in
10200 *I_TIME*) i_time="$define"
10201 timeincl=`./findhdr time.h`" $timeincl"
10202 echo "We'll include <time.h>." >&4;;
10203 *) i_time="$undef";;
10204 esac
10205 case "$flags" in
10206 *I_SYSTIME*) i_systime="$define"
10207 timeincl=`./findhdr sys/time.h`" $timeincl"
10208 echo "We'll include <sys/time.h>." >&4;;
10209 *) i_systime="$undef";;
10210 esac
5b813a60 10211 $rm_try
10bc17b6
JH
10212fi
10213: see if struct tm knows about tm_zone
10214case "$i_systime$i_time" in
5b813a60 10215*$define*)
10bc17b6
JH
10216 echo " "
10217 echo "Checking to see if your struct tm has tm_zone field..." >&4
10218 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10219 eval $hasfield
10220 ;;
10221*) val="$undef"
10222 set d_tm_tm_zone
10223 eval $setvar
10224 ;;
10225esac
10226case "$d_tm_tm_zone" in
10227"$define") echo "Yes, it does." ;;
10228*) echo "No, it doesn't." ;;
10229esac
10230: see if struct tm knows about tm_gmtoff
10231case "$i_systime$i_time" in
5b813a60 10232*$define*)
10bc17b6
JH
10233 echo " "
10234 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10235 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10236 eval $hasfield
10237 ;;
10238*) val="$undef"
10239 set d_tm_tm_gmtoff
10240 eval $setvar
10241 ;;
10242esac
10243case "$d_tm_tm_gmtoff" in
10244"$define") echo "Yes, it does." ;;
10245*) echo "No, it doesn't." ;;
10246esac
10247
10248: see if asctime_r exists
10249set asctime_r d_asctime_r
10250eval $inlibc
10251case "$d_asctime_r" in
10252"$define")
d63eadf0 10253 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10254 case "$d_asctime_r_proto:$usethreads" in
10255 ":define") d_asctime_r_proto=define
a48ec845
JH
10256 set d_asctime_r_proto asctime_r $hdrs
10257 eval $hasproto ;;
10258 *) ;;
10259 esac
10260 case "$d_asctime_r_proto" in
10261 define)
10bc17b6
JH
10262 case "$asctime_r_proto" in
10263 ''|0) try='char* asctime_r(const struct tm*, char*);'
61c26d18 10264 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10bc17b6
JH
10265 esac
10266 case "$asctime_r_proto" in
10267 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
61c26d18 10268 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10bc17b6
JH
10269 esac
10270 case "$asctime_r_proto" in
10271 ''|0) try='int asctime_r(const struct tm*, char*);'
61c26d18 10272 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10bc17b6
JH
10273 esac
10274 case "$asctime_r_proto" in
10275 ''|0) try='int asctime_r(const struct tm*, char*, int);'
61c26d18 10276 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10bc17b6
JH
10277 esac
10278 case "$asctime_r_proto" in
90e831dc 10279 ''|0) d_asctime_r=undef
10bc17b6 10280 asctime_r_proto=0
a48ec845 10281 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10282 * ) case "$asctime_r_proto" in
10283 REENTRANT_PROTO*) ;;
10284 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10285 esac
10286 echo "Prototype: $try" ;;
10287 esac
10288 ;;
c18e646a
JH
10289 *) case "$usethreads" in
10290 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10291 esac
90e831dc
SB
10292 d_asctime_r=undef
10293 asctime_r_proto=0
c18e646a 10294 ;;
a48ec845
JH
10295 esac
10296 ;;
10bc17b6
JH
10297*) asctime_r_proto=0
10298 ;;
10299esac
10300
b4eb6b3d
JH
10301: see if atolf exists
10302set atolf d_atolf
10303eval $inlibc
10304
10305: see if atoll exists
10306set atoll d_atoll
10307eval $inlibc
10308
0dbb1585
AL
10309: Look for GCC-style attribute format
10310case "$d_attribute_format" in
bde30f85 10311'')
b4eb6b3d 10312echo " "
0dbb1585 10313echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10314$cat >attrib.c <<'EOCP'
10315#include <stdio.h>
0dbb1585 10316void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10317EOCP
10318if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10319 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10320 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10321 val="$undef"
10322 else
0dbb1585 10323 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10324 val="$define"
10325 fi
10326else
10327 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10328 val="$undef"
10329fi
bde30f85 10330;;
0dbb1585 10331*) val="$d_attribute_format" ;;
bde30f85 10332esac
0dbb1585
AL
10333set d_attribute_format
10334eval $setvar
10335$rm -f attrib*
10336
dcb594bc
MB
10337: Look for GCC-style attribute format with null format allowed
10338case "$d_printf_format_null" in
10339'') case "$d_attribute_format" in
10340 $define)
10341 echo " "
10342 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10343$cat >attrib.c <<EOCP
10344#include <stdio.h>
10345#$i_stdlib I_STDLIB
10346#ifdef I_STDLIB
10347#include <stdlib.h>
10348#endif
10349int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10350int null_printf (char* pat,...) { return (int)pat; }
10351int main () { exit(null_printf(NULL)); }
10352EOCP
10353 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10354 : run the executable in case it produces a run-time warning
10355 if $run ./attrib >>attrib.out 2>&1; then
10356 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10357 echo "Your C compiler doesn't allow __printf__ format to be null."
10358 val="$undef"
10359 else
10360 echo "Your C compiler allows __printf__ format to be null."
10361 val="$define"
10362 fi
10363 else
10364 echo "Your C compiler executable failed with __printf__ format null."
10365 val="$undef"
10366 fi
10367 else
10368 echo "Your C compiler fails with __printf__ format null."
10369 val="$undef"
10370 fi
10371 ;;
10372 *) val="$undef" ;;
10373 esac
10374;;
10375*) val="$d_printf_format_null" ;;
10376esac
10377set d_printf_format_null
10378eval $setvar
10379$rm -f attrib*
10380
0dbb1585
AL
10381: Look for GCC-style attribute malloc
10382case "$d_attribute_malloc" in
10383'')
10384echo " "
10385echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10386$cat >attrib.c <<'EOCP'
10387#include <stdio.h>
10388char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10389EOCP
10390if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10391 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10392 echo "Your C compiler doesn't support __attribute__((malloc))."
10393 val="$undef"
10394 else
10395 echo "Your C compiler supports __attribute__((malloc))."
10396 val="$define"
10397 fi
10398else
10399 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10400 val="$undef"
10401fi
10402;;
10403*) val="$d_attribute_malloc" ;;
10404esac
10405set d_attribute_malloc
10406eval $setvar
10407$rm -f attrib*
10408
10409: Look for GCC-style attribute nonnull
10410case "$d_attribute_nonnull" in
10411'')
10412echo " "
10413echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10414$cat >attrib.c <<'EOCP'
10415#include <stdio.h>
10416void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10417EOCP
10418if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10419 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10420 echo "Your C compiler doesn't support __attribute__((nonnull))."
10421 val="$undef"
10422 else
10423 echo "Your C compiler supports __attribute__((nonnull))."
10424 val="$define"
10425 fi
10426else
10427 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10428 val="$undef"
10429fi
10430;;
10431*) val="$d_attribute_nonnull" ;;
10432esac
10433set d_attribute_nonnull
10434eval $setvar
10435$rm -f attrib*
10436
10437: Look for GCC-style attribute noreturn
10438case "$d_attribute_noreturn" in
10439'')
10440echo " "
10441echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10442$cat >attrib.c <<'EOCP'
10443#include <stdio.h>
10444void fall_over_dead( void ) __attribute__((noreturn));
10445EOCP
10446if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10447 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10448 echo "Your C compiler doesn't support __attribute__((noreturn))."
10449 val="$undef"
10450 else
10451 echo "Your C compiler supports __attribute__((noreturn))."
10452 val="$define"
10453 fi
10454else
10455 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10456 val="$undef"
10457fi
10458;;
10459*) val="$d_attribute_noreturn" ;;
10460esac
10461set d_attribute_noreturn
10462eval $setvar
10463$rm -f attrib*
10464
10465: Look for GCC-style attribute pure
10466case "$d_attribute_pure" in
10467'')
10468echo " "
10469echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10470$cat >attrib.c <<'EOCP'
10471#include <stdio.h>
10472int square( int n ) __attribute__((pure));
10473EOCP
10474if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10475 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10476 echo "Your C compiler doesn't support __attribute__((pure))."
10477 val="$undef"
10478 else
10479 echo "Your C compiler supports __attribute__((pure))."
10480 val="$define"
10481 fi
10482else
10483 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10484 val="$undef"
10485fi
10486;;
10487*) val="$d_attribute_pure" ;;
10488esac
10489set d_attribute_pure
10490eval $setvar
10491$rm -f attrib*
10492
10493: Look for GCC-style attribute unused
10494case "$d_attribute_unused" in
10495'')
10496echo " "
10497echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10498$cat >attrib.c <<'EOCP'
10499#include <stdio.h>
10500int do_something( int dummy __attribute__((unused)), int n );
10501EOCP
10502if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10503 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10504 echo "Your C compiler doesn't support __attribute__((unused))."
10505 val="$undef"
10506 else
10507 echo "Your C compiler supports __attribute__((unused))."
10508 val="$define"
10509 fi
10510else
10511 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10512 val="$undef"
10513fi
10514;;
10515*) val="$d_attribute_unused" ;;
10516esac
10517set d_attribute_unused
10518eval $setvar
10519$rm -f attrib*
10520
fcdf39cf
RGS
10521: Look for GCC-style attribute deprecated
10522case "$d_attribute_deprecated" in
10523'')
10524echo " "
10525echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10526$cat >attrib.c <<'EOCP'
10527#include <stdio.h>
10528int I_am_deprecated(void) __attribute__((deprecated));
10529EOCP
10530if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10531 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10532 echo "Your C compiler doesn't support __attribute__((deprecated))."
10533 val="$undef"
10534 else
10535 echo "Your C compiler supports __attribute__((deprecated))."
10536 val="$define"
10537 fi
10538else
10539 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10540 val="$undef"
10541fi
10542;;
10543*) val="$d_attribute_deprecated" ;;
10544esac
10545set d_attribute_deprecated
10546eval $setvar
10547$rm -f attrib*
10548
0dbb1585
AL
10549: Look for GCC-style attribute warn_unused_result
10550case "$d_attribute_warn_unused_result" in
10551'')
10552echo " "
10553echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10554$cat >attrib.c <<'EOCP'
10555#include <stdio.h>
10556int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10557EOCP
10558if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10559 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10560 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10561 val="$undef"
10562 else
10563 echo "Your C compiler supports __attribute__((warn_unused_result))."
10564 val="$define"
10565 fi
10566else
10567 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10568 val="$undef"
10569fi
10570;;
10571*) val="$d_attribute_warn_unused_result" ;;
10572esac
10573set d_attribute_warn_unused_result
b4eb6b3d
JH
10574eval $setvar
10575$rm -f attrib*
10576
10577: see if bcmp exists
10578set bcmp d_bcmp
10579eval $inlibc
10580
10581: see if bcopy exists
10582set bcopy d_bcopy
10583eval $inlibc
10584
b4eb6b3d
JH
10585: see if getpgrp exists
10586set getpgrp d_getpgrp
10587eval $inlibc
10588
10589case "$d_getpgrp" in
10590"$define")
10591 echo " "
10592 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10593 $cat >try.c <<EOP
b4eb6b3d
JH
10594#$i_unistd I_UNISTD
10595#include <sys/types.h>
10596#ifdef I_UNISTD
10597# include <unistd.h>
10598#endif
55954f19
JH
10599#$i_stdlib I_STDLIB
10600#ifdef I_STDLIB
10601#include <stdlib.h>
10602#endif
b4eb6b3d
JH
10603int main()
10604{
10605 if (getuid() == 0) {
10606 printf("(I see you are running Configure as super-user...)\n");
10607 setuid(1);
10608 }
10609#ifdef TRY_BSD_PGRP
10610 if (getpgrp(1) == 0)
10611 exit(0);
10612#else
10613 if (getpgrp() > 0)
10614 exit(0);
10615#endif
10616 exit(1);
10617}
10618EOP
5440bc8e 10619 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10620 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10621 val="$define"
5440bc8e 10622 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10623 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10624 val="$undef"
10625 else
10626 echo "I can't seem to compile and run the test program."
10627 if ./usg; then
10628 xxx="a USG one, i.e. you use getpgrp()."
10629 else
10630 # SVR4 systems can appear rather BSD-ish.
10631 case "$i_unistd" in
10632 $undef)
10633 xxx="a BSD one, i.e. you use getpgrp(pid)."
10634 val="$define"
10635 ;;
10636 $define)
10637 xxx="probably a USG one, i.e. you use getpgrp()."
10638 val="$undef"
10639 ;;
10640 esac
10641 fi
10642 echo "Assuming your getpgrp is $xxx" >&4
10643 fi
10644 ;;
10645*) val="$undef";;
10646esac
10647set d_bsdgetpgrp
10648eval $setvar
5b813a60 10649$rm_try
b4eb6b3d
JH
10650
10651: see if setpgrp exists
10652set setpgrp d_setpgrp
10653eval $inlibc
10654
10655case "$d_setpgrp" in
10656"$define")
10657 echo " "
10658 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10659 $cat >try.c <<EOP
b4eb6b3d
JH
10660#$i_unistd I_UNISTD
10661#include <sys/types.h>
10662#ifdef I_UNISTD
10663# include <unistd.h>
10664#endif
55954f19
JH
10665#$i_stdlib I_STDLIB
10666#ifdef I_STDLIB
10667#include <stdlib.h>
10668#endif
b4eb6b3d
JH
10669int main()
10670{
10671 if (getuid() == 0) {
10672 printf("(I see you are running Configure as super-user...)\n");
10673 setuid(1);
10674 }
10675#ifdef TRY_BSD_PGRP
10676 if (-1 == setpgrp(1, 1))
10677 exit(0);
10678#else
10679 if (setpgrp() != -1)
10680 exit(0);
10681#endif
10682 exit(1);
10683}
10684EOP
5440bc8e 10685 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10686 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10687 val="$define"
5440bc8e 10688 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10689 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10690 val="$undef"
10691 else
10692 echo "(I can't seem to compile and run the test program.)"
10693 if ./usg; then
10694 xxx="a USG one, i.e. you use setpgrp()."
10695 else
10696 # SVR4 systems can appear rather BSD-ish.
10697 case "$i_unistd" in
10698 $undef)
10699 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10700 val="$define"
10701 ;;
10702 $define)
10703 xxx="probably a USG one, i.e. you use setpgrp()."
10704 val="$undef"
10705 ;;
10706 esac
10707 fi
10708 echo "Assuming your setpgrp is $xxx" >&4
10709 fi
10710 ;;
10711*) val="$undef";;
10712esac
10713set d_bsdsetpgrp
10714eval $setvar
5b813a60
MB
10715$rm_try
10716
635aebb7
AL
10717: Look for GCC-style __builtin_choose_expr
10718case "$d_builtin_choose_expr" in
10719'')
10720 echo " "
10721 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10722 $cat >try.c <<'EOCP'
10723#include <assert.h>
10724#include <stdlib.h>
10725#include <stdio.h>
10726
10727#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10728
10729int main(void) {
10730 assert( SYRINX(1) == 2112 );
10731 assert( SYRINX(1) != 5150 );
10732 assert( SYRINX(0) == 5150 );
10733 assert( SYRINX(0) != 2112 );
10734 puts( "All good!" );
10735 exit(0);
10736}
10737
10738EOCP
10739 set try
70ceb34a 10740 if eval $compile && $run ./try; then
635aebb7
AL
10741 echo "Your C compiler supports __builtin_choose_expr."
10742 val="$define"
10743 else
10744 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10745 val="$undef"
10746 fi
10747;;
10748*) val="$d_builtin_choose_expr" ;;
10749esac
10750
10751set d_builtin_choose_expr
10752eval $setvar
5b813a60 10753$rm_try
635aebb7
AL
10754
10755: Look for GCC-style __builtin_expect
10756case "$d_builtin_expect" in
10757'')
10758 echo " "
10759 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
70ceb34a 10760 $cat >try.c <<'EOCP'
635aebb7
AL
10761int main(void) {
10762 int n = 50;
10763 if ( __builtin_expect(n, 0) ) n = 1;
70ceb34a
NC
10764 /* Remember shell exit code truth is 0, C truth is non-zero */
10765 return !(n == 1);
635aebb7
AL
10766}
10767EOCP
10768 set try
70ceb34a
NC
10769 if eval $compile && $run ./try; then
10770 echo "Your C compiler supports __builtin_expect."
635aebb7
AL
10771 val="$define"
10772 else
70ceb34a 10773 echo "Your C compiler doesn't seem to understand __builtin_expect."
635aebb7
AL
10774 val="$undef"
10775 fi
10776 ;;
10777*) val="$d_builtin_expect" ;;
10778esac
10779
10780set d_builtin_expect
10781eval $setvar
5b813a60 10782$rm_try
635aebb7 10783
b4eb6b3d
JH
10784: see if bzero exists
10785set bzero d_bzero
10786eval $inlibc
10787
a2d23ec2
MB
10788: see if stdarg is available
10789echo " "
10790if $test `./findhdr stdarg.h`; then
10791 echo "<stdarg.h> found." >&4
10792 valstd="$define"
10793else
10794 echo "<stdarg.h> NOT found." >&4
10795 valstd="$undef"
10796fi
10797
10798: see if varags is available
10799echo " "
10800if $test `./findhdr varargs.h`; then
10801 echo "<varargs.h> found." >&4
10802else
10803 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10804fi
10805
10806: set up the varargs testing programs
10807$cat > varargs.c <<EOP
10808#ifdef I_STDARG
10809#include <stdarg.h>
10810#endif
10811#ifdef I_VARARGS
10812#include <varargs.h>
10813#endif
10814
10815#ifdef I_STDARG
10816int f(char *p, ...)
10817#else
10818int f(va_alist)
10819va_dcl
10820#endif
10821{
10822 va_list ap;
10823#ifndef I_STDARG
10824 char *p;
10825#endif
10826#ifdef I_STDARG
10827 va_start(ap,p);
10828#else
10829 va_start(ap);
10830 p = va_arg(ap, char *);
10831#endif
10832 va_end(ap);
4fb7dc7d 10833 return 0;
a2d23ec2
MB
10834}
10835EOP
10836$cat > varargs <<EOP
10837$startsh
10838if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10839 echo "true"
10840else
10841 echo "false"
10842fi
10843$rm -f varargs$_o
10844EOP
10845chmod +x varargs
10846
10847: now check which varargs header should be included
10848echo " "
10849i_varhdr=''
10850case "$valstd" in
10851"$define")
10852 if `./varargs I_STDARG`; then
10853 val='stdarg.h'
10854 elif `./varargs I_VARARGS`; then
10855 val='varargs.h'
10856 fi
10857 ;;
10858*)
10859 if `./varargs I_VARARGS`; then
10860 val='varargs.h'
10861 fi
10862 ;;
10863esac
10864case "$val" in
10865'')
10866echo "I could not find the definition for va_dcl... You have problems..." >&4
10867 val="$undef"; set i_stdarg; eval $setvar
10868 val="$undef"; set i_varargs; eval $setvar
10869 ;;
613d6c3e 10870*)
a2d23ec2
MB
10871 set i_varhdr
10872 eval $setvar
10873 case "$i_varhdr" in
10874 stdarg.h)
10875 val="$define"; set i_stdarg; eval $setvar
10876 val="$undef"; set i_varargs; eval $setvar
10877 ;;
10878 varargs.h)
10879 val="$undef"; set i_stdarg; eval $setvar
10880 val="$define"; set i_varargs; eval $setvar
10881 ;;
10882 esac
10883 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10884esac
10885$rm -f varargs*
10886
10887: see if the Compiler supports C99 variadic macros
10888case "$i_stdarg$i_stdlib" in
10889 "$define$define")
10890 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10891 $cat >try.c <<EOCP
10892#include <stdio.h>
10893#include <stdarg.h>
10894
10895#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10896
10897int main() {
10898 char buf[20];
10899 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10900 puts(buf);
10901 return 0;
10902}
10903EOCP
10904 set try
10905 if eval $compile && $run ./try 2>&1 >/dev/null; then
10906 case "`$run ./try`" in
10907 "123 456 789")
10908 echo "You have C99 variadic macros." >&4
10909 d_c99_variadic_macros="$define"
10910 ;;
10911 *)
10912 echo "You don't have functional C99 variadic macros." >&4
10913 d_c99_variadic_macros="$undef"
10914 ;;
10915 esac
10916 else
10917 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10918 d_c99_variadic_macros="$undef"
10919 fi
5b813a60 10920 $rm_try
a2d23ec2
MB
10921 ;;
10922 *)
10923 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10924 d_c99_variadic_macros="$undef"
10925 ;;
10926esac
10927
b4eb6b3d
JH
10928: see if signal is declared as pointer to function returning int or void
10929echo " "
10930xxx=`./findhdr signal.h`
10931$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10932if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10933 echo "You have int (*signal())() instead of void." >&4
10934 val="$undef"
10935elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10936 echo "You have void (*signal())()." >&4
10937 val="$define"
10938elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10939 echo "You have int (*signal())() instead of void." >&4
10940 val="$undef"
10941elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10942 echo "You have void (*signal())()." >&4
10943 val="$define"
10944else
10945 case "$d_voidsig" in
10946 '')
10947 echo "I can't determine whether signal handler returns void or int..." >&4
10948 dflt=void
10949 rp="What type does your signal handler return?"
10950 . ./myread
10951 case "$ans" in
10952 v*) val="$define";;
10953 *) val="$undef";;
10954 esac;;
10955 "$define")
10956 echo "As you already told me, signal handler returns void." >&4
10957 val="$define"
10958 ;;
10959 *) echo "As you already told me, signal handler returns int." >&4
10960 val="$undef"
10961 ;;
10962 esac
10963fi
10964set d_voidsig
10965eval $setvar
10966case "$d_voidsig" in
10967"$define") signal_t="void";;
10968*) signal_t="int";;
10969esac
10970$rm -f $$.tmp
10971
10972: check for ability to cast large floats to 32-bit ints.
10973echo " "
10974echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10975if $test "$intsize" -ge 4; then
10976 xxx=int
10977else
10978 xxx=long
10979fi
10980$cat >try.c <<EOCP
10981#include <stdio.h>
d1daaddf
JH
10982#$i_stdlib I_STDLIB
10983#ifdef I_STDLIB
10984#include <stdlib.h>
10985#endif
b4eb6b3d
JH
10986#include <sys/types.h>
10987#include <signal.h>
7090f861 10988$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10989int main()
10990{
10991 $xxx i32;
10992 double f, g;
10993 int result = 0;
10994 char str[16];
10995 signal(SIGFPE, blech);
10996
5b813a60 10997 /* Don't let compiler optimize the test away. Store the number
e237eb00 10998 in a writable string for gcc to pass to sscanf under HP-UX.
b4eb6b3d
JH
10999 */
11000 sprintf(str, "2147483647");
11001 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11002 g = 10 * f;
11003 i32 = ($xxx) g;
11004
11005 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 11006 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
11007 behavior here, which is to preserve the sign and give
11008 back 0x7fff ffff.
11009 */
11010 if (i32 != ($xxx) f)
11011 result |= 1;
11012 exit(result);
11013}
11014EOCP
11015set try
11016if eval $compile_ok; then
5440bc8e 11017 $run ./try
b4eb6b3d
JH
11018 yyy=$?
11019else
11020 echo "(I can't seem to compile the test program--assuming it can't)"
11021 yyy=1
11022fi
11023case "$yyy" in
110240) val="$define"
11025 echo "Yup, it can."
11026 ;;
11027*) val="$undef"
11028 echo "Nope, it can't."
11029 ;;
11030esac
11031set d_casti32
11032eval $setvar
5b813a60 11033$rm_try
b4eb6b3d
JH
11034
11035: check for ability to cast negative floats to unsigned
11036echo " "
11037echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11038$cat >try.c <<EOCP
11039#include <stdio.h>
d1daaddf
JH
11040#$i_stdlib I_STDLIB
11041#ifdef I_STDLIB
11042#include <stdlib.h>
11043#endif
b4eb6b3d
JH
11044#include <sys/types.h>
11045#include <signal.h>
7090f861
JH
11046$signal_t blech(int s) { exit(7); }
11047$signal_t blech_in_list(int s) { exit(4); }
11048unsigned long dummy_long(unsigned long p) { return p; }
11049unsigned int dummy_int(unsigned int p) { return p; }
11050unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
11051int main()
11052{
11053 double f;
11054 unsigned long along;
11055 unsigned int aint;
11056 unsigned short ashort;
11057 int result = 0;
11058 char str[16];
5b813a60 11059
b4eb6b3d
JH
11060 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11061 a direct f = -123. assignment. gcc-2.8.0 reportedly
11062 optimized the whole file away
11063 */
5b813a60 11064 /* Store the number in a writable string for gcc to pass to
e237eb00 11065 sscanf under HP-UX.
b4eb6b3d
JH
11066 */
11067 sprintf(str, "-123");
11068 sscanf(str, "%lf", &f); /* f = -123.; */
11069
11070 signal(SIGFPE, blech);
11071 along = (unsigned long)f;
11072 aint = (unsigned int)f;
11073 ashort = (unsigned short)f;
11074 if (along != (unsigned long)-123)
11075 result |= 1;
11076 if (aint != (unsigned int)-123)
11077 result |= 1;
11078 if (ashort != (unsigned short)-123)
11079 result |= 1;
11080 sprintf(str, "1073741824.");
11081 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11082 f = f + f;
11083 along = 0;
11084 along = (unsigned long)f;
11085 if (along != 0x80000000)
11086 result |= 2;
11087 f -= 1.;
11088 along = 0;
11089 along = (unsigned long)f;
11090 if (along != 0x7fffffff)
11091 result |= 1;
11092 f += 2.;
11093 along = 0;
11094 along = (unsigned long)f;
11095 if (along != 0x80000001)
11096 result |= 2;
11097 if (result)
11098 exit(result);
11099 signal(SIGFPE, blech_in_list);
11100 sprintf(str, "123.");
11101 sscanf(str, "%lf", &f); /* f = 123.; */
11102 along = dummy_long((unsigned long)f);
11103 aint = dummy_int((unsigned int)f);
11104 ashort = dummy_short((unsigned short)f);
11105 if (along != (unsigned long)123)
11106 result |= 4;
11107 if (aint != (unsigned int)123)
11108 result |= 4;
11109 if (ashort != (unsigned short)123)
11110 result |= 4;
11111 exit(result);
11112
11113}
11114EOCP
11115set try
11116if eval $compile_ok; then
5440bc8e 11117 $run ./try
b4eb6b3d
JH
11118 castflags=$?
11119else
11120 echo "(I can't seem to compile the test program--assuming it can't)"
11121 castflags=7
11122fi
11123case "$castflags" in
111240) val="$define"
11125 echo "Yup, it can."
11126 ;;
11127*) val="$undef"
11128 echo "Nope, it can't."
11129 ;;
11130esac
11131set d_castneg
11132eval $setvar
5b813a60 11133$rm_try
b4eb6b3d
JH
11134
11135: see if vprintf exists
11136echo " "
11137if set vprintf val -f d_vprintf; eval $csym; $val; then
11138 echo 'vprintf() found.' >&4
11139 val="$define"
55954f19 11140 $cat >try.c <<EOF
d0bc9cc8
AD
11141#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11142#$i_varargs I_VARARGS
11143
55954f19 11144#$i_stdlib I_STDLIB
d0bc9cc8
AD
11145#$i_unistd I_UNISTD
11146
11147#ifdef I_STDARG
11148# include <stdarg.h>
11149#else /* I_VARARGS */
11150# include <varargs.h>
11151#endif
11152
11153#ifdef I_UNISTD
11154# include <unistd.h>
11155#endif
11156
55954f19 11157#ifdef I_STDLIB
d0bc9cc8 11158# include <stdlib.h>
55954f19 11159#endif
b4eb6b3d 11160
d0bc9cc8
AD
11161#include <stdio.h> /* vsprintf prototype */
11162
11163#ifdef I_STDARG
11164void xxx(int n, ...)
11165{
11166 va_list args;
11167 char buf[10];
11168 va_start(args, n);
11169 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11170}
11171int main() { xxx(1, "foo"); }
11172
11173#else /* I_VARARGS */
b4eb6b3d
JH
11174
11175xxx(va_alist)
11176va_dcl
11177{
d0bc9cc8
AD
11178 va_list args;
11179 char buf[10];
11180 va_start(args);
11181 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 11182}
d0bc9cc8
AD
11183int main() { xxx("foo"); }
11184
11185#endif
11186
b4eb6b3d 11187EOF
5440bc8e 11188 set try
d0bc9cc8
AD
11189 if eval $compile_ok; then
11190 if $run ./try; then
11191 echo "Your vsprintf() returns (int)." >&4
11192 val2="$undef"
11193 else
11194 echo "Your vsprintf() returns (char*)." >&4
11195 val2="$define"
11196 fi
b4eb6b3d 11197 else
d0bc9cc8
AD
11198 echo 'I am unable to compile the vsprintf() test program.' >&4
11199 # We shouldn't get here. If we do, assume the standard signature,
11200 # not the old BSD one.
11201 echo 'Guessing that vsprintf() returns (int).' >&4
11202 val2="$undef"
b4eb6b3d
JH
11203 fi
11204else
11205 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
11206 val="$undef"
11207 val2="$undef"
b4eb6b3d 11208fi
5b813a60 11209$rm_try
b4eb6b3d
JH
11210set d_vprintf
11211eval $setvar
11212val=$val2
11213set d_charvspr
11214eval $setvar
11215
11216: see if chown exists
11217set chown d_chown
11218eval $inlibc
11219
11220: see if chroot exists
11221set chroot d_chroot
11222eval $inlibc
11223
11224: see if chsize exists
11225set chsize d_chsize
11226eval $inlibc
11227
758a5d79
JH
11228: see if class exists
11229set class d_class
11230eval $inlibc
11231
b0a2e8e6
MB
11232: see if clearenv exists
11233set clearenv d_clearenv
11234eval $inlibc
11235
34f1896b 11236: Define hasstruct macro for Configure internal use
4e0554ec
JH
11237hasstruct='varname=$1; struct=$2; shift; shift;
11238while $test $# -ge 2; do
11239 case "$1" in
11240 $define) echo "#include <$2>";;
11241 esac ;
11242 shift 2;
11243done > try.c;
11244echo "int main () { struct $struct foo; }" >> try.c;
11245set try;
11246if eval $compile; then
11247 val="$define";
11248else
11249 val="$undef";
11250fi;
11251set $varname;
11252eval $setvar;
5b813a60 11253$rm_try'
4e0554ec 11254
34f1896b 11255: see whether socket exists
4e0554ec
JH
11256socketlib=''
11257sockethdr=''
4e0554ec
JH
11258echo " "
11259$echo $n "Hmm... $c" >&4
11260if set socket val -f d_socket; eval $csym; $val; then
11261 echo "Looks like you have Berkeley networking support." >&4
11262 d_socket="$define"
11263 if set setsockopt val -f; eval $csym; $val; then
11264 d_oldsock="$undef"
11265 else
11266 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11267 d_oldsock="$define"
11268 fi
11269else
11270 if $contains socklib libc.list >/dev/null 2>&1; then
11271 echo "Looks like you have Berkeley networking support." >&4
11272 d_socket="$define"
11273 : we will have to assume that it supports the 4.2 BSD interface
11274 d_oldsock="$undef"
11275 else
11276 echo "You don't have Berkeley networking in libc$_a..." >&4
11277 if test "X$d_socket" = "X$define"; then
11278 echo "...but you seem to believe that you have sockets." >&4
11279 else
11280 for net in net socket
11281 do
11282 if test -f /usr/lib/lib$net$_a; then
11283 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
11284 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11285 if $contains socket libc.list >/dev/null 2>&1; then
11286 d_socket="$define"
11287 socketlib="-l$net"
11288 case "$net" in
11289 net)
11290 echo "...but the Wollongong group seems to have hacked it in." >&4
11291 sockethdr="-I/usr/netinclude"
11292 ;;
11293 esac
5b813a60 11294 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
11295 if $contains setsockopt libc.list >/dev/null 2>&1; then
11296 d_oldsock="$undef"
11297 else
11298 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11299 d_oldsock="$define"
11300 fi
11301 break
11302 fi
11303 fi
11304 done
11305 if test "X$d_socket" != "X$define"; then
11306 echo "or anywhere else I see." >&4
11307 d_socket="$undef"
11308 d_oldsock="$undef"
11309 fi
11310 fi
11311 fi
11312fi
11313
11314: see if socketpair exists
11315set socketpair d_sockpair
11316eval $inlibc
11317
11318
11319echo " "
b8677e3b
MB
11320echo "Checking the availability sa_len in the sock struct ..." >&4
11321$cat >try.c <<EOF
11322#include <sys/types.h>
11323#include <sys/socket.h>
11324int main() {
11325struct sockaddr sa;
11326return (sa.sa_len);
11327}
11328EOF
11329val="$undef"
11330set try; if eval $compile; then
11331 val="$define"
11332fi
11333set d_sockaddr_sa_len; eval $setvar
11334$rm_try
11335
11336echo " "
18126d98
MB
11337echo "Checking the availability struct sockaddr_in6 ..." >&4
11338$cat >try.c <<EOF
11339#include <sys/types.h>
11340#include <sys/socket.h>
11341#include <netinet/in.h>
11342int main() {
11343struct sockaddr_in6 sin6;
11344return (sin6.sin6_family);
11345}
11346EOF
11347val="$undef"
11348set try; if eval $compile; then
11349 val="$define"
11350fi
11351set d_sockaddr_in6; eval $setvar
11352$rm_try
11353
11354echo " "
f53580fe
MB
11355echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11356$cat >try.c <<EOF
11357#include <sys/types.h>
11358#include <sys/socket.h>
11359#include <netinet/in.h>
11360int main() {
11361struct sockaddr_in6 sin6;
11362return (sin6.sin6_scope_id);
11363}
11364EOF
11365val="$undef"
11366set try; if eval $compile; then
11367 val="$define"
11368fi
11369set d_sin6_scope_id; eval $setvar
11370$rm_try
11371
11372echo " "
122b9bf4
MB
11373echo "Checking the availability struct ip_mreq ..." >&4
11374$cat >try.c <<EOF
11375#include <sys/types.h>
11376#include <sys/socket.h>
11377#include <netinet/in.h>
11378int main() {
11379struct ip_mreq mreq;
11380return (mreq.imr_multiaddr.s_addr);
11381}
11382EOF
11383val="$undef"
11384set try; if eval $compile; then
11385 val="$define"
11386fi
11387set d_ip_mreq; eval $setvar
11388$rm_try
11389
11390echo " "
3e06601f
MB
11391echo "Checking the availability struct ip_mreq_source ..." >&4
11392$cat >try.c <<EOF
11393#include <sys/types.h>
11394#include <sys/socket.h>
11395#include <netinet/in.h>
11396int main() {
11397struct ip_mreq_source mreq;
11398return (mreq.imr_multiaddr.s_addr);
11399}
11400EOF
11401val="$undef"
11402set try; if eval $compile; then
11403 val="$define"
11404fi
11405set d_ip_mreq_source; eval $setvar
11406$rm_try
11407
11408echo " "
18126d98
MB
11409echo "Checking the availability struct ipv6_mreq ..." >&4
11410$cat >try.c <<EOF
11411#include <sys/types.h>
11412#include <sys/socket.h>
11413#include <netinet/in.h>
11414int main() {
11415struct ipv6_mreq mreq;
11416return (mreq.ipv6mr_interface);
11417}
11418EOF
11419val="$undef"
11420set try; if eval $compile; then
11421 val="$define"
11422fi
11423set d_ipv6_mreq; eval $setvar
11424$rm_try
11425
11426echo " "
3e06601f
MB
11427echo "Checking the availability struct ipv6_mreq_source ..." >&4
11428$cat >try.c <<EOF
11429#include <sys/types.h>
11430#include <sys/socket.h>
11431#include <netinet/in.h>
11432int main() {
11433struct ipv6_mreq_source mreq;
11434return (mreq.imr_multiaddr.s_addr);
11435}
11436EOF
11437val="$undef"
11438set try; if eval $compile; then
11439 val="$define"
11440fi
11441set d_ipv6_mreq_source; eval $setvar
11442$rm_try
11443
11444echo " "
3c728e00 11445echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11446for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11447 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11448 $cat >try.c <<EOF
11449#include <sys/types.h>
11450#include <sys/socket.h>
11451int main() {
11452 int i = $ENUM;
11453}
11454EOF
11455 val="$undef"
11456 set try; if eval $compile; then
11457 val="$define"
11458 fi
11459 set d_${enum}; eval $setvar
5b813a60 11460 $rm_try
4e0554ec
JH
11461done
11462
11463: see if this is a sys/uio.h system
11464set sys/uio.h i_sysuio
11465eval $inhdr
11466
34f1896b 11467: Check for cmsghdr support
4e0554ec
JH
11468echo " "
11469echo "Checking to see if your system supports struct cmsghdr..." >&4
11470set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11471eval $hasstruct
11472case "$d_cmsghdr_s" in
11473"$define") echo "Yes, it does." ;;
11474*) echo "No, it doesn't." ;;
11475esac
11476
11477
b4eb6b3d
JH
11478: check for const keyword
11479echo " "
11480echo 'Checking to see if your C compiler knows about "const"...' >&4
11481$cat >const.c <<'EOCP'
11482typedef struct spug { int drokk; } spug;
76f47787 11483int main()
b4eb6b3d
JH
11484{
11485 const char *foo;
666ea192 11486 const spug y = { 0 };
b4eb6b3d
JH
11487}
11488EOCP
11489if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11490 val="$define"
11491 echo "Yup, it does."
11492else
11493 val="$undef"
11494 echo "Nope, it doesn't."
11495fi
11496set d_const
11497eval $setvar
11498
89ce900e
JH
11499: see if copysignl exists
11500set copysignl d_copysignl
11501eval $inlibc
11502
b4eb6b3d
JH
11503: see if crypt exists
11504echo " "
a5a94ea5
JH
11505set crypt d_crypt
11506eval $inlibc
11507case "$d_crypt" in
11508$define) cryptlib='' ;;
11509*) if set crypt val -f d_crypt; eval $csym; $val; then
11510 echo 'crypt() found.' >&4
b4eb6b3d 11511 val="$define"
a5a94ea5
JH
11512 cryptlib=''
11513 else
11514 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11515 if $test -z "$cryptlib"; then
11516 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11517 else
11518 cryptlib=-lcrypt
11519 fi
11520 if $test -z "$cryptlib"; then
11521 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11522 else
11523 cryptlib=-lcrypt
11524 fi
11525 if $test -z "$cryptlib"; then
11526 cryptlib=`./loc libcrypt$_a "" $libpth`
11527 else
11528 cryptlib=-lcrypt
11529 fi
11530 if $test -z "$cryptlib"; then
11531 echo 'crypt() NOT found.' >&4
11532 val="$undef"
11533 else
11534 val="$define"
11535 fi
b4eb6b3d 11536 fi
a5a94ea5
JH
11537 set d_crypt
11538 eval $setvar
11539 ;;
11540esac
b4eb6b3d 11541
10bc17b6
JH
11542: see if this is a crypt.h system
11543set crypt.h i_crypt
11544eval $inhdr
11545
11546: see if crypt_r exists
11547set crypt_r d_crypt_r
11548eval $inlibc
11549case "$d_crypt_r" in
11550"$define")
11551 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11552 case "$d_crypt_r_proto:$usethreads" in
11553 ":define") d_crypt_r_proto=define
a48ec845
JH
11554 set d_crypt_r_proto crypt_r $hdrs
11555 eval $hasproto ;;
11556 *) ;;
11557 esac
11558 case "$d_crypt_r_proto" in
11559 define)
10bc17b6
JH
11560 case "$crypt_r_proto" in
11561 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
61c26d18 11562 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
10bc17b6
JH
11563 esac
11564 case "$crypt_r_proto" in
b430fd04 11565 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
61c26d18 11566 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
b430fd04
JH
11567 esac
11568 case "$crypt_r_proto" in
90e831dc 11569 ''|0) d_crypt_r=undef
10bc17b6 11570 crypt_r_proto=0
a48ec845 11571 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11572 * ) case "$crypt_r_proto" in
11573 REENTRANT_PROTO*) ;;
11574 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11575 esac
11576 echo "Prototype: $try" ;;
11577 esac
11578 ;;
c18e646a
JH
11579 *) case "$usethreads" in
11580 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11581 esac
90e831dc
SB
11582 d_crypt_r=undef
11583 crypt_r_proto=0
c18e646a 11584 ;;
a48ec845
JH
11585 esac
11586 ;;
10bc17b6
JH
11587*) crypt_r_proto=0
11588 ;;
11589esac
11590
b4eb6b3d
JH
11591: get csh whereabouts
11592case "$csh" in
11593'csh') val="$undef" ;;
11594*) val="$define" ;;
11595esac
11596set d_csh
11597eval $setvar
11598: Respect a hint or command line value for full_csh.
11599case "$full_csh" in
11600'') full_csh=$csh ;;
11601esac
11602
13cfc98d
MB
11603: see if ctermid exists
11604set ctermid d_ctermid
11605eval $inlibc
11606
10bc17b6
JH
11607: see if ctermid_r exists
11608set ctermid_r d_ctermid_r
11609eval $inlibc
11610case "$d_ctermid_r" in
11611"$define")
31ee0cb7 11612 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11613 case "$d_ctermid_r_proto:$usethreads" in
11614 ":define") d_ctermid_r_proto=define
a48ec845
JH
11615 set d_ctermid_r_proto ctermid_r $hdrs
11616 eval $hasproto ;;
11617 *) ;;
11618 esac
11619 case "$d_ctermid_r_proto" in
11620 define)
10bc17b6
JH
11621 case "$ctermid_r_proto" in
11622 ''|0) try='char* ctermid_r(char*);'
61c26d18 11623 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
10bc17b6
JH
11624 esac
11625 case "$ctermid_r_proto" in
90e831dc 11626 ''|0) d_ctermid_r=undef
10bc17b6 11627 ctermid_r_proto=0
a48ec845 11628 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11629 * ) case "$ctermid_r_proto" in
11630 REENTRANT_PROTO*) ;;
11631 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11632 esac
11633 echo "Prototype: $try" ;;
11634 esac
11635 ;;
c18e646a
JH
11636 *) case "$usethreads" in
11637 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11638 esac
90e831dc
SB
11639 d_ctermid_r=undef
11640 ctermid_r_proto=0
c18e646a 11641 ;;
a48ec845
JH
11642 esac
11643 ;;
10bc17b6
JH
11644*) ctermid_r_proto=0
11645 ;;
11646esac
11647
11648: see if ctime_r exists
11649set ctime_r d_ctime_r
11650eval $inlibc
11651case "$d_ctime_r" in
11652"$define")
d63eadf0 11653 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11654 case "$d_ctime_r_proto:$usethreads" in
11655 ":define") d_ctime_r_proto=define
a48ec845
JH
11656 set d_ctime_r_proto ctime_r $hdrs
11657 eval $hasproto ;;
11658 *) ;;
11659 esac
11660 case "$d_ctime_r_proto" in
11661 define)
10bc17b6
JH
11662 case "$ctime_r_proto" in
11663 ''|0) try='char* ctime_r(const time_t*, char*);'
61c26d18 11664 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
10bc17b6
JH
11665 esac
11666 case "$ctime_r_proto" in
11667 ''|0) try='char* ctime_r(const time_t*, char*, int);'
61c26d18 11668 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
10bc17b6
JH
11669 esac
11670 case "$ctime_r_proto" in
11671 ''|0) try='int ctime_r(const time_t*, char*);'
61c26d18 11672 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
10bc17b6
JH
11673 esac
11674 case "$ctime_r_proto" in
11675 ''|0) try='int ctime_r(const time_t*, char*, int);'
61c26d18 11676 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
10bc17b6
JH
11677 esac
11678 case "$ctime_r_proto" in
90e831dc 11679 ''|0) d_ctime_r=undef
10bc17b6 11680 ctime_r_proto=0
a48ec845 11681 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11682 * ) case "$ctime_r_proto" in
11683 REENTRANT_PROTO*) ;;
11684 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11685 esac
11686 echo "Prototype: $try" ;;
11687 esac
11688 ;;
c18e646a
JH
11689 *) case "$usethreads" in
11690 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11691 esac
90e831dc
SB
11692 d_ctime_r=undef
11693 ctime_r_proto=0
c18e646a 11694 ;;
a48ec845
JH
11695 esac
11696 ;;
10bc17b6
JH
11697*) ctime_r_proto=0
11698 ;;
11699esac
11700
b4eb6b3d
JH
11701: see if cuserid exists
11702set cuserid d_cuserid
11703eval $inlibc
11704
11705: see if this is a limits.h system
11706set limits.h i_limits
11707eval $inhdr
11708
11709: see if this is a float.h system
11710set float.h i_float
11711eval $inhdr
11712
11713: See if number of significant digits in a double precision number is known
11714echo " "
11715$cat >dbl_dig.c <<EOM
11716#$i_limits I_LIMITS
11717#$i_float I_FLOAT
11718#ifdef I_LIMITS
11719#include <limits.h>
11720#endif
11721#ifdef I_FLOAT
11722#include <float.h>
11723#endif
11724#ifdef DBL_DIG
11725printf("Contains DBL_DIG");
11726#endif
11727EOM
11728$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11729if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11730 echo "DBL_DIG found." >&4
11731 val="$define"
11732else
11733 echo "DBL_DIG NOT found." >&4
11734 val="$undef"
11735fi
11736$rm -f dbl_dig.?
11737set d_dbl_dig
11738eval $setvar
11739
2ef53570
JH
11740: see if dbm.h is available
11741: see if dbmclose exists
11742set dbmclose d_dbmclose
11743eval $inlibc
11744
11745case "$d_dbmclose" in
11746$define)
11747 set dbm.h i_dbm
11748 eval $inhdr
11749 case "$i_dbm" in
11750 $define)
11751 val="$undef"
11752 set i_rpcsvcdbm
11753 eval $setvar
11754 ;;
11755 *) set rpcsvc/dbm.h i_rpcsvcdbm
11756 eval $inhdr
11757 ;;
11758 esac
11759 ;;
11760*) echo "We won't be including <dbm.h>"
11761 val="$undef"
11762 set i_dbm
11763 eval $setvar
11764 val="$undef"
11765 set i_rpcsvcdbm
11766 eval $setvar
11767 ;;
11768esac
11769
11770: see if prototype for dbminit is available
11771echo " "
11772set d_dbminitproto dbminit $i_dbm dbm.h
11773eval $hasproto
11774
b4eb6b3d
JH
11775: see if difftime exists
11776set difftime d_difftime
11777eval $inlibc
11778
11779: see if this is a dirent system
11780echo " "
11781if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11782 val="$define"
11783 echo "<dirent.h> found." >&4
11784else
11785 val="$undef"
11786 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11787 echo "<sys/dir.h> found." >&4
11788 echo " "
11789 else
11790 xinc=`./findhdr sys/ndir.h`
11791 fi
11792 echo "<dirent.h> NOT found." >&4
11793fi
11794set i_dirent
11795eval $setvar
11796
11797: Look for type of directory structure.
11798echo " "
11799$cppstdin $cppflags $cppminus < "$xinc" > try.c
11800
11801case "$direntrytype" in
11802''|' ')
11803 case "$i_dirent" in
11804 $define) guess1='struct dirent' ;;
11805 *) guess1='struct direct' ;;
11806 esac
11807 ;;
11808*) guess1="$direntrytype"
11809 ;;
11810esac
11811
11812case "$guess1" in
11813'struct dirent') guess2='struct direct' ;;
11814*) guess2='struct dirent' ;;
11815esac
5b813a60 11816
b4eb6b3d
JH
11817if $contains "$guess1" try.c >/dev/null 2>&1; then
11818 direntrytype="$guess1"
11819 echo "Your directory entries are $direntrytype." >&4
11820elif $contains "$guess2" try.c >/dev/null 2>&1; then
11821 direntrytype="$guess2"
11822 echo "Your directory entries seem to be $direntrytype." >&4
11823else
11824 echo "I don't recognize your system's directory entries." >&4
11825 rp="What type is used for directory entries on this system?"
11826 dflt="$guess1"
11827 . ./myread
11828 direntrytype="$ans"
11829fi
5b813a60 11830$rm_try
b4eb6b3d
JH
11831
11832: see if the directory entry stores field length
11833echo " "
11834$cppstdin $cppflags $cppminus < "$xinc" > try.c
11835if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11836 echo "Good, your directory entry keeps length information in d_namlen." >&4
11837 val="$define"
11838else
11839 echo "Your directory entry does not know about the d_namlen field." >&4
11840 val="$undef"
11841fi
11842set d_dirnamlen
11843eval $setvar
5b813a60 11844$rm_try
b4eb6b3d 11845
de52168c
SP
11846: Look for DIR.dd_fd
11847case "$i_dirent" in
11848"$define")
11849 echo "Checking to see if DIR has a dd_fd member variable" >&4
11850 $cat >try.c <<EOCP
11851#$i_stdlib I_STDLIB
11852#ifdef I_STDLIB
11853#include <stdlib.h>
11854#endif
11855#include <dirent.h>
11856
11857int main() {
11858 DIR dir;
11859 dir.dd_fd = 1;
11860 return 0;
11861}
11862EOCP
11863 val=$undef
11864 set try
11865 if eval $compile; then
11866 echo "Yes, it does."
11867 val="$define"
11868 else
11869 echo "No, it does not."
11870 val="$undef"
11871 fi
11872 ;;
11873*)
11874 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11875 val="$undef"
11876 ;;
11877esac
11878set d_dir_dd_fd
11879eval $setvar
5b813a60 11880$rm_try
de52168c 11881
ae0e3d3b
JH
11882: see if this is an sysdir system
11883set sys/dir.h i_sysdir
11884eval $inhdr
11885
11886: see if this is an sysndir system
11887set sys/ndir.h i_sysndir
11888eval $inhdr
11889
11890: Look for dirfd
11891echo " "
11892$cat >dirfd.c <<EOM
11893#include <stdio.h>
55954f19
JH
11894#$i_stdlib I_STDLIB
11895#ifdef I_STDLIB
11896#include <stdlib.h>
11897#endif
ae0e3d3b
JH
11898#$i_dirent I_DIRENT /**/
11899#$i_sysdir I_SYS_DIR /**/
11900#$i_sysndir I_SYS_NDIR /**/
11901#$i_systypes I_SYS_TYPES /**/
11902#if defined(I_SYS_TYPES)
11903#include <sys/types.h>
11904#endif
11905#if defined(I_DIRENT)
11906#include <dirent.h>
11907#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11908#include <sys/dir.h>
11909#endif
11910#else
11911#ifdef I_SYS_NDIR
11912#include <sys/ndir.h>
11913#else
11914#ifdef I_SYS_DIR
11915#ifdef hp9000s500
11916#include <ndir.h> /* may be wrong in the future */
11917#else
11918#include <sys/dir.h>
11919#endif
11920#endif
11921#endif
11922#endif
11923int main() {
11924 DIR *dirp = opendir(".");
11925 if (dirfd(dirp) >= 0)
11926 exit(0);
11927 else
11928 exit(1);
11929}
11930EOM
5cadb3f3 11931val=$undef
ae0e3d3b
JH
11932set dirfd
11933if eval $compile; then
11934 val="$define"
11935fi
11936case "$val" in
11937$define) echo "dirfd() found." >&4 ;;
11938*) echo "dirfd() NOT found." >&4 ;;
11939esac
11940set d_dirfd
11941eval $setvar
11942$rm -f dirfd*
11943
b4eb6b3d
JH
11944: see if dlerror exists
11945xxx_runnm="$runnm"
11946runnm=false
11947set dlerror d_dlerror
11948eval $inlibc
11949runnm="$xxx_runnm"
11950
11951: see if dlfcn is available
11952set dlfcn.h i_dlfcn
11953eval $inhdr
11954
34f1896b 11955: Check what extension to use for shared libs
b4eb6b3d
JH
11956case "$usedl" in
11957$define|y|true)
11958 $cat << EOM
11959
11960On a few systems, the dynamically loaded modules that perl generates and uses
11961will need a different extension than shared libs. The default will probably
11962be appropriate.
11963
11964EOM
11965 case "$dlext" in
11966 '') dflt="$so" ;;
11967 *) dflt="$dlext" ;;
11968 esac
11969 rp='What is the extension of dynamically loaded modules'
11970 . ./myread
11971 dlext="$ans"
11972 ;;
11973*)
11974 dlext="none"
11975 ;;
11976esac
11977
11978: Check if dlsym need a leading underscore
11979echo " "
11980val="$undef"
11981
11982case "$dlsrc" in
11983dl_dlopen.xs)
11984 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11985 $cat >dyna.c <<'EOM'
11986fred () { }
11987EOM
11988
11989$cat >fred.c<<EOM
11990
11991#include <stdio.h>
55954f19
JH
11992#$i_stdlib I_STDLIB
11993#ifdef I_STDLIB
11994#include <stdlib.h>
11995#endif
b4eb6b3d
JH
11996#$i_dlfcn I_DLFCN
11997#ifdef I_DLFCN
5440bc8e 11998#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11999#else
12000#include <sys/types.h>
12001#include <nlist.h>
12002#include <link.h>
12003#endif
12004
12005extern int fred() ;
12006
12007int main()
12008{
12009 void * handle ;
12010 void * symbol ;
12011#ifndef RTLD_LAZY
12012 int mode = 1 ;
12013#else
12014 int mode = RTLD_LAZY ;
12015#endif
12016 handle = dlopen("./dyna.$dlext", mode) ;
12017 if (handle == NULL) {
12018 printf ("1\n") ;
12019 fflush (stdout) ;
12020 exit(0);
12021 }
12022 symbol = dlsym(handle, "fred") ;
12023 if (symbol == NULL) {
12024 /* try putting a leading underscore */
12025 symbol = dlsym(handle, "_fred") ;
12026 if (symbol == NULL) {
12027 printf ("2\n") ;
12028 fflush (stdout) ;
12029 exit(0);
12030 }
12031 printf ("3\n") ;
12032 }
12033 else
12034 printf ("4\n") ;
12035 fflush (stdout) ;
12036 exit(0);
12037}
12038EOM
12039 : Call the object file tmp-dyna.o in case dlext=o.
613d6c3e
MB
12040 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12041 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12042 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
12043 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12044 xxx=`$run ./fred`
b4eb6b3d
JH
12045 case $xxx in
12046 1) echo "Test program failed using dlopen." >&4
12047 echo "Perhaps you should not use dynamic loading." >&4;;
12048 2) echo "Test program failed using dlsym." >&4
12049 echo "Perhaps you should not use dynamic loading." >&4;;
12050 3) echo "dlsym needs a leading underscore" >&4
12051 val="$define" ;;
12052 4) echo "dlsym doesn't need a leading underscore." >&4;;
12053 esac
12054 else
12055 echo "I can't compile and run the test program." >&4
12056 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12057 fi
12058 ;;
12059esac
613d6c3e 12060
3c728e00 12061$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
12062
12063set d_dlsymun
12064eval $setvar
12065
10bc17b6
JH
12066: see if drand48_r exists
12067set drand48_r d_drand48_r
12068eval $inlibc
12069case "$d_drand48_r" in
12070"$define")
12071 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
12072 case "$d_drand48_r_proto:$usethreads" in
12073 ":define") d_drand48_r_proto=define
a48ec845
JH
12074 set d_drand48_r_proto drand48_r $hdrs
12075 eval $hasproto ;;
12076 *) ;;
12077 esac
12078 case "$d_drand48_r_proto" in
12079 define)
10bc17b6
JH
12080 case "$drand48_r_proto" in
12081 ''|0) try='int drand48_r(struct drand48_data*, double*);'
61c26d18 12082 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
10bc17b6
JH
12083 esac
12084 case "$drand48_r_proto" in
90e831dc 12085 ''|0) d_drand48_r=undef
10bc17b6 12086 drand48_r_proto=0
a48ec845 12087 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12088 * ) case "$drand48_r_proto" in
12089 REENTRANT_PROTO*) ;;
12090 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12091 esac
12092 echo "Prototype: $try" ;;
12093 esac
12094 ;;
c18e646a
JH
12095 *) case "$usethreads" in
12096 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12097 esac
90e831dc
SB
12098 d_drand48_r=undef
12099 drand48_r_proto=0
c18e646a 12100 ;;
a48ec845
JH
12101 esac
12102 ;;
10bc17b6
JH
12103*) drand48_r_proto=0
12104 ;;
12105esac
12106
12107: see if prototype for drand48 is available
12108echo " "
12109set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12110eval $hasproto
12111
b4eb6b3d
JH
12112: see if dup2 exists
12113set dup2 d_dup2
12114eval $inlibc
12115
12116: see if eaccess exists
12117set eaccess d_eaccess
12118eval $inlibc
12119
12120: see if endgrent exists
12121set endgrent d_endgrent
12122eval $inlibc
12123
10bc17b6
JH
12124: see if this is an grp system
12125set grp.h i_grp
12126eval $inhdr
12127
12128case "$i_grp" in
12129$define)
12130 xxx=`./findhdr grp.h`
12131 $cppstdin $cppflags $cppminus < $xxx >$$.h
12132
12133 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12134 val="$define"
12135 else
12136 val="$undef"
12137 fi
12138 set d_grpasswd
12139 eval $setvar
12140
12141 $rm -f $$.h
12142 ;;
12143*)
12144 val="$undef";
12145 set d_grpasswd; eval $setvar
12146 ;;
12147esac
12148
12149: see if endgrent_r exists
12150set endgrent_r d_endgrent_r
12151eval $inlibc
12152case "$d_endgrent_r" in
12153"$define")
12154 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12155 case "$d_endgrent_r_proto:$usethreads" in
12156 ":define") d_endgrent_r_proto=define
a48ec845
JH
12157 set d_endgrent_r_proto endgrent_r $hdrs
12158 eval $hasproto ;;
12159 *) ;;
12160 esac
12161 case "$d_endgrent_r_proto" in
12162 define)
10bc17b6
JH
12163 case "$endgrent_r_proto" in
12164 ''|0) try='int endgrent_r(FILE**);'
61c26d18 12165 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
10bc17b6
JH
12166 esac
12167 case "$endgrent_r_proto" in
12168 ''|0) try='void endgrent_r(FILE**);'
61c26d18 12169 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
10bc17b6
JH
12170 esac
12171 case "$endgrent_r_proto" in
90e831dc 12172 ''|0) d_endgrent_r=undef
10bc17b6 12173 endgrent_r_proto=0
a48ec845 12174 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12175 * ) case "$endgrent_r_proto" in
12176 REENTRANT_PROTO*) ;;
12177 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12178 esac
12179 echo "Prototype: $try" ;;
12180 esac
12181 ;;
c18e646a
JH
12182 *) case "$usethreads" in
12183 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12184 esac
90e831dc
SB
12185 d_endgrent_r=undef
12186 endgrent_r_proto=0
c18e646a 12187 ;;
a48ec845
JH
12188 esac
12189 ;;
10bc17b6
JH
12190*) endgrent_r_proto=0
12191 ;;
12192esac
12193
b4eb6b3d
JH
12194: see if endhostent exists
12195set endhostent d_endhent
12196eval $inlibc
12197
10bc17b6
JH
12198: see if this is a netdb.h system
12199set netdb.h i_netdb
12200eval $inhdr
12201
12202: see if endhostent_r exists
12203set endhostent_r d_endhostent_r
12204eval $inlibc
12205case "$d_endhostent_r" in
12206"$define")
12207 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12208 case "$d_endhostent_r_proto:$usethreads" in
12209 ":define") d_endhostent_r_proto=define
a48ec845
JH
12210 set d_endhostent_r_proto endhostent_r $hdrs
12211 eval $hasproto ;;
12212 *) ;;
12213 esac
12214 case "$d_endhostent_r_proto" in
12215 define)
10bc17b6
JH
12216 case "$endhostent_r_proto" in
12217 ''|0) try='int endhostent_r(struct hostent_data*);'
61c26d18 12218 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
12219 esac
12220 case "$endhostent_r_proto" in
12221 ''|0) try='void endhostent_r(struct hostent_data*);'
61c26d18 12222 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
12223 esac
12224 case "$endhostent_r_proto" in
90e831dc 12225 ''|0) d_endhostent_r=undef
10bc17b6 12226 endhostent_r_proto=0
a48ec845 12227 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12228 * ) case "$endhostent_r_proto" in
12229 REENTRANT_PROTO*) ;;
12230 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12231 esac
12232 echo "Prototype: $try" ;;
12233 esac
12234 ;;
c18e646a
JH
12235 *) case "$usethreads" in
12236 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12237 esac
90e831dc
SB
12238 d_endhostent_r=undef
12239 endhostent_r_proto=0
c18e646a 12240 ;;
a48ec845
JH
12241 esac
12242 ;;
10bc17b6
JH
12243*) endhostent_r_proto=0
12244 ;;
12245esac
12246
b4eb6b3d
JH
12247: see if endnetent exists
12248set endnetent d_endnent
12249eval $inlibc
12250
10bc17b6
JH
12251: see if endnetent_r exists
12252set endnetent_r d_endnetent_r
12253eval $inlibc
12254case "$d_endnetent_r" in
12255"$define")
12256 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12257 case "$d_endnetent_r_proto:$usethreads" in
12258 ":define") d_endnetent_r_proto=define
a48ec845
JH
12259 set d_endnetent_r_proto endnetent_r $hdrs
12260 eval $hasproto ;;
12261 *) ;;
12262 esac
12263 case "$d_endnetent_r_proto" in
12264 define)
10bc17b6
JH
12265 case "$endnetent_r_proto" in
12266 ''|0) try='int endnetent_r(struct netent_data*);'
61c26d18 12267 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
12268 esac
12269 case "$endnetent_r_proto" in
12270 ''|0) try='void endnetent_r(struct netent_data*);'
61c26d18 12271 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
12272 esac
12273 case "$endnetent_r_proto" in
90e831dc 12274 ''|0) d_endnetent_r=undef
10bc17b6 12275 endnetent_r_proto=0
a48ec845 12276 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12277 * ) case "$endnetent_r_proto" in
12278 REENTRANT_PROTO*) ;;
12279 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12280 esac
12281 echo "Prototype: $try" ;;
12282 esac
12283 ;;
c18e646a
JH
12284 *) case "$usethreads" in
12285 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12286 esac
90e831dc
SB
12287 d_endnetent_r=undef
12288 endnetent_r_proto=0
c18e646a 12289 ;;
a48ec845
JH
12290 esac
12291 ;;
10bc17b6
JH
12292*) endnetent_r_proto=0
12293 ;;
12294esac
12295
b4eb6b3d
JH
12296: see if endprotoent exists
12297set endprotoent d_endpent
12298eval $inlibc
12299
10bc17b6
JH
12300: see if endprotoent_r exists
12301set endprotoent_r d_endprotoent_r
12302eval $inlibc
12303case "$d_endprotoent_r" in
12304"$define")
12305 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12306 case "$d_endprotoent_r_proto:$usethreads" in
12307 ":define") d_endprotoent_r_proto=define
a48ec845
JH
12308 set d_endprotoent_r_proto endprotoent_r $hdrs
12309 eval $hasproto ;;
12310 *) ;;
12311 esac
12312 case "$d_endprotoent_r_proto" in
12313 define)
10bc17b6
JH
12314 case "$endprotoent_r_proto" in
12315 ''|0) try='int endprotoent_r(struct protoent_data*);'
61c26d18 12316 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
12317 esac
12318 case "$endprotoent_r_proto" in
12319 ''|0) try='void endprotoent_r(struct protoent_data*);'
61c26d18 12320 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
12321 esac
12322 case "$endprotoent_r_proto" in
90e831dc 12323 ''|0) d_endprotoent_r=undef
10bc17b6 12324 endprotoent_r_proto=0
a48ec845 12325 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12326 * ) case "$endprotoent_r_proto" in
12327 REENTRANT_PROTO*) ;;
12328 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12329 esac
12330 echo "Prototype: $try" ;;
12331 esac
12332 ;;
c18e646a
JH
12333 *) case "$usethreads" in
12334 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12335 esac
90e831dc
SB
12336 d_endprotoent_r=undef
12337 endprotoent_r_proto=0
c18e646a 12338 ;;
a48ec845
JH
12339 esac
12340 ;;
10bc17b6
JH
12341*) endprotoent_r_proto=0
12342 ;;
12343esac
12344
b4eb6b3d
JH
12345: see if endpwent exists
12346set endpwent d_endpwent
12347eval $inlibc
12348
10bc17b6
JH
12349: see if this is a pwd.h system
12350set pwd.h i_pwd
12351eval $inhdr
12352
12353case "$i_pwd" in
12354$define)
12355 xxx=`./findhdr pwd.h`
12356 $cppstdin $cppflags $cppminus < $xxx >$$.h
12357
12358 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12359 val="$define"
12360 else
12361 val="$undef"
12362 fi
12363 set d_pwquota
12364 eval $setvar
12365
12366 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12367 val="$define"
12368 else
12369 val="$undef"
12370 fi
12371 set d_pwage
12372 eval $setvar
12373
12374 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12375 val="$define"
12376 else
12377 val="$undef"
12378 fi
12379 set d_pwchange
12380 eval $setvar
12381
12382 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12383 val="$define"
12384 else
12385 val="$undef"
12386 fi
12387 set d_pwclass
12388 eval $setvar
12389
12390 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12391 val="$define"
12392 else
12393 val="$undef"
12394 fi
12395 set d_pwexpire
12396 eval $setvar
12397
12398 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12399 val="$define"
12400 else
12401 val="$undef"
12402 fi
12403 set d_pwcomment
12404 eval $setvar
12405
12406 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12407 val="$define"
12408 else
12409 val="$undef"
12410 fi
12411 set d_pwgecos
12412 eval $setvar
12413
12414 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12415 val="$define"
12416 else
12417 val="$undef"
12418 fi
12419 set d_pwpasswd
12420 eval $setvar
12421
12422 $rm -f $$.h
12423 ;;
12424*)
12425 val="$undef";
12426 set d_pwquota; eval $setvar
12427 set d_pwage; eval $setvar
12428 set d_pwchange; eval $setvar
12429 set d_pwclass; eval $setvar
12430 set d_pwexpire; eval $setvar
12431 set d_pwcomment; eval $setvar
12432 set d_pwgecos; eval $setvar
12433 set d_pwpasswd; eval $setvar
12434 ;;
12435esac
12436
12437: see if endpwent_r exists
12438set endpwent_r d_endpwent_r
12439eval $inlibc
12440case "$d_endpwent_r" in
12441"$define")
12442 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12443 case "$d_endpwent_r_proto:$usethreads" in
12444 ":define") d_endpwent_r_proto=define
a48ec845
JH
12445 set d_endpwent_r_proto endpwent_r $hdrs
12446 eval $hasproto ;;
12447 *) ;;
12448 esac
12449 case "$d_endpwent_r_proto" in
12450 define)
10bc17b6
JH
12451 case "$endpwent_r_proto" in
12452 ''|0) try='int endpwent_r(FILE**);'
61c26d18 12453 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
10bc17b6
JH
12454 esac
12455 case "$endpwent_r_proto" in
12456 ''|0) try='void endpwent_r(FILE**);'
61c26d18 12457 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
10bc17b6
JH
12458 esac
12459 case "$endpwent_r_proto" in
90e831dc 12460 ''|0) d_endpwent_r=undef
10bc17b6 12461 endpwent_r_proto=0
a48ec845 12462 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12463 * ) case "$endpwent_r_proto" in
12464 REENTRANT_PROTO*) ;;
12465 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12466 esac
12467 echo "Prototype: $try" ;;
12468 esac
12469 ;;
c18e646a
JH
12470 *) case "$usethreads" in
12471 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12472 esac
90e831dc
SB
12473 d_endpwent_r=undef
12474 endpwent_r_proto=0
c18e646a 12475 ;;
a48ec845
JH
12476 esac
12477 ;;
10bc17b6
JH
12478*) endpwent_r_proto=0
12479 ;;
12480esac
12481
b4eb6b3d
JH
12482: see if endservent exists
12483set endservent d_endsent
12484eval $inlibc
12485
10bc17b6
JH
12486: see if endservent_r exists
12487set endservent_r d_endservent_r
12488eval $inlibc
12489case "$d_endservent_r" in
12490"$define")
12491 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12492 case "$d_endservent_r_proto:$usethreads" in
12493 ":define") d_endservent_r_proto=define
a48ec845
JH
12494 set d_endservent_r_proto endservent_r $hdrs
12495 eval $hasproto ;;
12496 *) ;;
12497 esac
12498 case "$d_endservent_r_proto" in
12499 define)
10bc17b6
JH
12500 case "$endservent_r_proto" in
12501 ''|0) try='int endservent_r(struct servent_data*);'
61c26d18 12502 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12503 esac
12504 case "$endservent_r_proto" in
12505 ''|0) try='void endservent_r(struct servent_data*);'
61c26d18 12506 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12507 esac
12508 case "$endservent_r_proto" in
90e831dc 12509 ''|0) d_endservent_r=undef
10bc17b6 12510 endservent_r_proto=0
a48ec845 12511 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12512 * ) case "$endservent_r_proto" in
12513 REENTRANT_PROTO*) ;;
12514 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12515 esac
12516 echo "Prototype: $try" ;;
12517 esac
12518 ;;
c18e646a
JH
12519 *) case "$usethreads" in
12520 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12521 esac
90e831dc
SB
12522 d_endservent_r=undef
12523 endservent_r_proto=0
c18e646a 12524 ;;
a48ec845
JH
12525 esac
12526 ;;
10bc17b6
JH
12527*) endservent_r_proto=0
12528 ;;
12529esac
12530
b4eb6b3d
JH
12531: Locate the flags for 'open()'
12532echo " "
55954f19 12533$cat >try.c <<EOCP
b4eb6b3d
JH
12534#include <sys/types.h>
12535#ifdef I_FCNTL
12536#include <fcntl.h>
12537#endif
12538#ifdef I_SYS_FILE
12539#include <sys/file.h>
12540#endif
55954f19
JH
12541#$i_stdlib I_STDLIB
12542#ifdef I_STDLIB
12543#include <stdlib.h>
12544#endif
b4eb6b3d
JH
12545int main() {
12546 if(O_RDONLY);
12547#ifdef O_TRUNC
12548 exit(0);
12549#else
12550 exit(1);
12551#endif
12552}
12553EOCP
12554: check sys/file.h first to get FREAD on Sun
12555if $test `./findhdr sys/file.h` && \
5440bc8e 12556 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12557 h_sysfile=true;
12558 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12559 if $run ./try; then
b4eb6b3d
JH
12560 echo "and you have the 3 argument form of open()." >&4
12561 val="$define"
12562 else
12563 echo "but not the 3 argument form of open(). Oh, well." >&4
12564 val="$undef"
12565 fi
12566elif $test `./findhdr fcntl.h` && \
5440bc8e 12567 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12568 h_fcntl=true;
12569 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12570 if $run ./try; then
b4eb6b3d
JH
12571 echo "and you have the 3 argument form of open()." >&4
12572 val="$define"
12573 else
12574 echo "but not the 3 argument form of open(). Oh, well." >&4
12575 val="$undef"
12576 fi
12577else
12578 val="$undef"
12579 echo "I can't find the O_* constant definitions! You got problems." >&4
12580fi
12581set d_open3
12582eval $setvar
5b813a60 12583$rm_try
b4eb6b3d 12584
3c728e00
JH
12585: see if this is a sys/file.h system
12586val=''
12587set sys/file.h val
12588eval $inhdr
12589
12590: do we need to include sys/file.h ?
12591case "$val" in
12592"$define")
12593 echo " "
12594 if $h_sysfile; then
12595 val="$define"
12596 echo "We'll be including <sys/file.h>." >&4
12597 else
12598 val="$undef"
12599 echo "We won't be including <sys/file.h>." >&4
12600 fi
12601 ;;
12602*)
12603 h_sysfile=false
12604 ;;
12605esac
12606set i_sysfile
12607eval $setvar
12608
12609: see if fcntl.h is there
12610val=''
12611set fcntl.h val
12612eval $inhdr
12613
12614: see if we can include fcntl.h
12615case "$val" in
12616"$define")
12617 echo " "
12618 if $h_fcntl; then
12619 val="$define"
12620 echo "We'll be including <fcntl.h>." >&4
12621 else
12622 val="$undef"
12623 if $h_sysfile; then
12624 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12625 else
12626 echo "We won't be including <fcntl.h>." >&4
12627 fi
12628 fi
12629 ;;
12630*)
12631 h_fcntl=false
12632 val="$undef"
12633 ;;
12634esac
12635set i_fcntl
12636eval $setvar
12637
4dd8f9b3
JH
12638: see if fork exists
12639set fork d_fork
12640eval $inlibc
12641
12642: see if pipe exists
12643set pipe d_pipe
12644eval $inlibc
12645
b4eb6b3d
JH
12646: check for non-blocking I/O stuff
12647case "$h_sysfile" in
a0acbdc3
JH
12648true) echo "#include <sys/file.h>" > head.c;;
12649*)
12650 case "$h_fcntl" in
12651 true) echo "#include <fcntl.h>" > head.c;;
12652 *) echo "#include <sys/fcntl.h>" > head.c;;
12653 esac
12654 ;;
b4eb6b3d
JH
12655esac
12656echo " "
12657echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12658case "$o_nonblock" in
12659'')
12660 $cat head.c > try.c
3c728e00 12661 $cat >>try.c <<EOCP
b4eb6b3d 12662#include <stdio.h>
55954f19
JH
12663#$i_stdlib I_STDLIB
12664#ifdef I_STDLIB
80b3ef99 12665#include <stdlib.h>
55954f19 12666#endif
3c728e00
JH
12667#$i_fcntl I_FCNTL
12668#ifdef I_FCNTL
12669#include <fcntl.h>
12670#endif
b4eb6b3d
JH
12671int main() {
12672#ifdef O_NONBLOCK
12673 printf("O_NONBLOCK\n");
12674 exit(0);
12675#endif
12676#ifdef O_NDELAY
12677 printf("O_NDELAY\n");
12678 exit(0);
12679#endif
12680#ifdef FNDELAY
12681 printf("FNDELAY\n");
12682 exit(0);
12683#endif
12684 exit(0);
12685}
12686EOCP
12687 set try
12688 if eval $compile_ok; then
5440bc8e 12689 o_nonblock=`$run ./try`
b4eb6b3d
JH
12690 case "$o_nonblock" in
12691 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12692 *) echo "Seems like we can use $o_nonblock.";;
12693 esac
12694 else
12695 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12696 fi
12697 ;;
12698*) echo "Using $hint value $o_nonblock.";;
12699esac
5b813a60 12700$rm_try
b4eb6b3d
JH
12701
12702echo " "
12703echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12704case "$eagain" in
12705'')
4dd8f9b3
JH
12706 case "$d_fork:$d_pipe" in
12707 define:define)
b4eb6b3d
JH
12708 $cat head.c > try.c
12709 $cat >>try.c <<EOCP
12710#include <errno.h>
12711#include <sys/types.h>
12712#include <signal.h>
5b813a60 12713#include <stdio.h>
55954f19
JH
12714#$i_stdlib I_STDLIB
12715#ifdef I_STDLIB
12716#include <stdlib.h>
12717#endif
1deb0a86
JH
12718#$i_fcntl I_FCNTL
12719#ifdef I_FCNTL
12720#include <fcntl.h>
12721#endif
b4eb6b3d
JH
12722#define MY_O_NONBLOCK $o_nonblock
12723#ifndef errno /* XXX need better Configure test */
12724extern int errno;
12725#endif
12726#$i_unistd I_UNISTD
12727#ifdef I_UNISTD
12728#include <unistd.h>
12729#endif
12730#$i_string I_STRING
12731#ifdef I_STRING
12732#include <string.h>
12733#else
12734#include <strings.h>
12735#endif
7090f861 12736$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12737EOCP
12738 $cat >> try.c <<'EOCP'
12739int main()
12740{
12741 int pd[2];
12742 int pu[2];
12743 char buf[1];
12744 char string[100];
12745
12746 pipe(pd); /* Down: child -> parent */
12747 pipe(pu); /* Up: parent -> child */
12748 if (0 != fork()) {
12749 int ret;
12750 close(pd[1]); /* Parent reads from pd[0] */
12751 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12752#ifdef F_SETFL
b4eb6b3d
JH
12753 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12754 exit(1);
a0acbdc3
JH
12755#else
12756 exit(4);
12757#endif
b4eb6b3d
JH
12758 signal(SIGALRM, blech);
12759 alarm(5);
12760 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12761 exit(2);
12762 sprintf(string, "%d\n", ret);
12763 write(2, string, strlen(string));
12764 alarm(0);
12765#ifdef EAGAIN
12766 if (errno == EAGAIN) {
12767 printf("EAGAIN\n");
12768 goto ok;
12769 }
12770#endif
12771#ifdef EWOULDBLOCK
12772 if (errno == EWOULDBLOCK)
12773 printf("EWOULDBLOCK\n");
12774#endif
12775 ok:
12776 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12777 sleep(2); /* Give it time to close our pipe */
12778 alarm(5);
12779 ret = read(pd[0], buf, 1); /* Should read EOF */
12780 alarm(0);
12781 sprintf(string, "%d\n", ret);
868439a2 12782 write(4, string, strlen(string));
b4eb6b3d
JH
12783 exit(0);
12784 }
12785
12786 close(pd[0]); /* We write to pd[1] */
12787 close(pu[1]); /* We read from pu[0] */
12788 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12789 close(pd[1]); /* Pipe pd is now fully closed! */
12790 exit(0); /* Bye bye, thank you for playing! */
12791}
12792EOCP
12793 set try
12794 if eval $compile_ok; then
12795 echo "$startsh" >mtry
868439a2 12796 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12797 chmod +x mtry
12798 ./mtry >/dev/null 2>&1
12799 case $? in
12800 0) eagain=`$cat try.out`;;
12801 1) echo "Could not perform non-blocking setting!";;
12802 2) echo "I did a successful read() for something that was not there!";;
12803 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12804 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12805 *) echo "Something terribly wrong happened during testing.";;
12806 esac
12807 rd_nodata=`$cat try.ret`
12808 echo "A read() system call with no data present returns $rd_nodata."
12809 case "$rd_nodata" in
12810 0|-1) ;;
12811 *)
12812 echo "(That's peculiar, fixing that to be -1.)"
12813 rd_nodata=-1
12814 ;;
12815 esac
12816 case "$eagain" in
12817 '')
12818 echo "Forcing errno EAGAIN on read() with no data available."
12819 eagain=EAGAIN
12820 ;;
12821 *)
12822 echo "Your read() sets errno to $eagain when no data is available."
12823 ;;
12824 esac
12825 status=`$cat try.err`
12826 case "$status" in
12827 0) echo "And it correctly returns 0 to signal EOF.";;
12828 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12829 *) echo "However, your read() returns '$status' on EOF??";;
12830 esac
12831 val="$define"
12832 if test "$status" = "$rd_nodata"; then
12833 echo "WARNING: you can't distinguish between EOF and no data!"
12834 val="$undef"
12835 fi
12836 else
12837 echo "I can't compile the test program--assuming errno EAGAIN will do."
12838 eagain=EAGAIN
12839 fi
4dd8f9b3
JH
12840 ;;
12841 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12842 eagain=EAGAIN
12843 val="$define"
12844 ;;
12845 esac
b4eb6b3d
JH
12846 set d_eofnblk
12847 eval $setvar
12848 ;;
12849*)
12850 echo "Using $hint value $eagain."
12851 echo "Your read() returns $rd_nodata when no data is present."
12852 case "$d_eofnblk" in
12853 "$define") echo "And you can see EOF because read() returns 0.";;
12854 "$undef") echo "But you can't see EOF status from read() returned value.";;
12855 *)
12856 echo "(Assuming you can't see EOF status from read anyway.)"
12857 d_eofnblk=$undef
12858 ;;
12859 esac
12860 ;;
12861esac
5b813a60 12862$rm_try head.c mtry
b4eb6b3d 12863
15b61c98
JH
12864: see if _ptr and _cnt from stdio act std
12865echo " "
b4eb6b3d 12866
15b61c98
JH
12867if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12868 echo "(Looks like you have stdio.h from BSD.)"
12869 case "$stdio_ptr" in
12870 '') stdio_ptr='((fp)->_p)'
12871 ptr_lval=$define
12872 ;;
12873 *) ptr_lval=$d_stdio_ptr_lval;;
12874 esac
12875 case "$stdio_cnt" in
12876 '') stdio_cnt='((fp)->_r)'
12877 cnt_lval=$define
12878 ;;
12879 *) cnt_lval=$d_stdio_cnt_lval;;
12880 esac
12881 case "$stdio_base" in
12882 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12883 esac
12884 case "$stdio_bufsiz" in
12885 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12886 esac
12887elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12888 echo "(Looks like you have stdio.h from Linux.)"
12889 case "$stdio_ptr" in
12890 '') stdio_ptr='((fp)->_IO_read_ptr)'
12891 ptr_lval=$define
12892 ;;
12893 *) ptr_lval=$d_stdio_ptr_lval;;
12894 esac
12895 case "$stdio_cnt" in
12896 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12897 cnt_lval=$undef
12898 ;;
12899 *) cnt_lval=$d_stdio_cnt_lval;;
12900 esac
12901 case "$stdio_base" in
12902 '') stdio_base='((fp)->_IO_read_base)';;
12903 esac
12904 case "$stdio_bufsiz" in
12905 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12906 esac
12907else
12908 case "$stdio_ptr" in
12909 '') stdio_ptr='((fp)->_ptr)'
12910 ptr_lval=$define
12911 ;;
12912 *) ptr_lval=$d_stdio_ptr_lval;;
12913 esac
12914 case "$stdio_cnt" in
12915 '') stdio_cnt='((fp)->_cnt)'
12916 cnt_lval=$define
12917 ;;
12918 *) cnt_lval=$d_stdio_cnt_lval;;
12919 esac
12920 case "$stdio_base" in
12921 '') stdio_base='((fp)->_base)';;
12922 esac
12923 case "$stdio_bufsiz" in
12924 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12925 esac
12926fi
b4eb6b3d 12927
15b61c98
JH
12928: test whether _ptr and _cnt really work
12929echo "Checking how std your stdio is..." >&4
12930$cat >try.c <<EOP
12931#include <stdio.h>
55954f19
JH
12932#$i_stdlib I_STDLIB
12933#ifdef I_STDLIB
9d9004a9 12934#include <stdlib.h>
55954f19 12935#endif
15b61c98
JH
12936#define FILE_ptr(fp) $stdio_ptr
12937#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12938int main() {
15b61c98
JH
12939 FILE *fp = fopen("try.c", "r");
12940 char c = getc(fp);
12941 if (
12942 18 <= FILE_cnt(fp) &&
12943 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12944 )
12945 exit(0);
12946 exit(1);
9d9004a9 12947}
15b61c98
JH
12948EOP
12949val="$undef"
12950set try
12951if eval $compile && $to try.c; then
12952 if $run ./try; then
12953 echo "Your stdio acts pretty std."
12954 val="$define"
9d9004a9 12955 else
15b61c98 12956 echo "Your stdio isn't very std."
9d9004a9 12957 fi
15b61c98
JH
12958else
12959 echo "Your stdio doesn't appear very std."
12960fi
5b813a60 12961$rm_try
15b61c98
JH
12962
12963# glibc 2.2.90 and above apparently change stdio streams so Perl's
12964# direct buffer manipulation no longer works. The Configure tests
12965# should be changed to correctly detect this, but until then,
12966# the following check should at least let perl compile and run.
12967# (This quick fix should be updated before 5.8.1.)
12968# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12969# A. Dougherty, June 3, 2002.
12970case "$d_gnulibc" in
12971$define)
12972 case "$gnulibc_version" in
12973 2.[01]*) ;;
12974 2.2) ;;
12975 2.2.[0-9]) ;;
12976 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12977 val="$undef"
12978 ;;
12979 esac
9d9004a9
AD
12980 ;;
12981esac
15b61c98 12982set d_stdstdio
9d9004a9 12983eval $setvar
9d9004a9 12984
15b61c98
JH
12985: Can _ptr be used as an lvalue?
12986case "$d_stdstdio$ptr_lval" in
12987$define$define) val=$define ;;
12988*) val=$undef ;;
12989esac
12990set d_stdio_ptr_lval
12991eval $setvar
9d9004a9 12992
15b61c98
JH
12993: Can _cnt be used as an lvalue?
12994case "$d_stdstdio$cnt_lval" in
12995$define$define) val=$define ;;
12996*) val=$undef ;;
12997esac
12998set d_stdio_cnt_lval
12999eval $setvar
b4eb6b3d 13000
15b61c98
JH
13001
13002: test whether setting _ptr sets _cnt as a side effect
13003d_stdio_ptr_lval_sets_cnt="$undef"
13004d_stdio_ptr_lval_nochange_cnt="$undef"
13005case "$d_stdio_ptr_lval$d_stdstdio" in
13006$define$define)
13007 echo "Checking to see what happens if we set the stdio ptr..." >&4
13008$cat >try.c <<EOP
13009#include <stdio.h>
13010/* Can we scream? */
13011/* Eat dust sed :-) */
13012/* In the buffer space, no one can hear you scream. */
55954f19
JH
13013#$i_stdlib I_STDLIB
13014#ifdef I_STDLIB
13015#include <stdlib.h>
13016#endif
15b61c98
JH
13017#define FILE_ptr(fp) $stdio_ptr
13018#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 13019#include <sys/types.h>
b4eb6b3d 13020int main() {
15b61c98
JH
13021 FILE *fp = fopen("try.c", "r");
13022 int c;
13023 char *ptr;
13024 size_t cnt;
13025 if (!fp) {
13026 puts("Fail even to read");
13027 exit(1);
13028 }
13029 c = getc(fp); /* Read away the first # */
13030 if (c == EOF) {
13031 puts("Fail even to read");
13032 exit(1);
13033 }
13034 if (!(
13035 18 <= FILE_cnt(fp) &&
13036 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13037 )) {
13038 puts("Fail even to read");
13039 exit (1);
13040 }
13041 ptr = (char*) FILE_ptr(fp);
13042 cnt = (size_t)FILE_cnt(fp);
13043
13044 FILE_ptr(fp) += 42;
13045
13046 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13047 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13048 exit (1);
13049 }
13050 if (FILE_cnt(fp) <= 20) {
13051 printf ("Fail (<20 chars to test)");
13052 exit (1);
13053 }
13054 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13055 puts("Fail compare");
13056 exit (1);
13057 }
13058 if (cnt == FILE_cnt(fp)) {
13059 puts("Pass_unchanged");
13060 exit (0);
5b813a60 13061 }
15b61c98
JH
13062 if (FILE_cnt(fp) == (cnt - 42)) {
13063 puts("Pass_changed");
13064 exit (0);
13065 }
13066 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13067 return 1;
13068
13069}
13070EOP
13071 set try
13072 if eval $compile && $to try.c; then
13073 case `$run ./try` in
13074 Pass_changed)
13075 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
13076 d_stdio_ptr_lval_sets_cnt="$define" ;;
13077 Pass_unchanged)
13078 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
13079 d_stdio_ptr_lval_nochange_cnt="$define" ;;
13080 Fail*)
13081 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
13082 *)
13083 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13084 esac
13085 else
13086 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
13087 fi
5b813a60 13088 $rm_try
15b61c98
JH
13089 ;;
13090esac
13091
13092: see if _base is also standard
13093val="$undef"
13094case "$d_stdstdio" in
13095$define)
13096 $cat >try.c <<EOP
13097#include <stdio.h>
13098#$i_stdlib I_STDLIB
13099#ifdef I_STDLIB
13100#include <stdlib.h>
13101#endif
13102#define FILE_base(fp) $stdio_base
13103#define FILE_bufsiz(fp) $stdio_bufsiz
13104int main() {
13105 FILE *fp = fopen("try.c", "r");
13106 char c = getc(fp);
13107 if (
13108 19 <= FILE_bufsiz(fp) &&
13109 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13110 )
13111 exit(0);
13112 exit(1);
13113}
13114EOP
13115 set try
13116 if eval $compile && $to try.c; then
13117 if $run ./try; then
13118 echo "And its _base field acts std."
13119 val="$define"
13120 else
13121 echo "But its _base field isn't std."
13122 fi
13123 else
13124 echo "However, it seems to be lacking the _base field."
13125 fi
5b813a60 13126 $rm_try
15b61c98
JH
13127 ;;
13128esac
13129set d_stdiobase
13130eval $setvar
13131
13132: see if fast_stdio exists
13133val="$undef"
13134case "$d_stdstdio:$d_stdio_ptr_lval" in
13135"$define:$define")
13136 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13137 *$define*)
13138 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13139 val="$define"
13140 ;;
13141 esac
13142 ;;
13143esac
13144set d_faststdio
13145eval $setvar
13146
13147
13148
13149: see if fchdir exists
13150set fchdir d_fchdir
13151eval $inlibc
13152
13153: see if fchmod exists
13154set fchmod d_fchmod
13155eval $inlibc
13156
13157: see if fchown exists
13158set fchown d_fchown
13159eval $inlibc
13160
13161: see if this is an fcntl system
13162set fcntl d_fcntl
13163eval $inlibc
13164
15b61c98 13165: See if fcntl-based locking works.
613d6c3e 13166echo " "
15b61c98
JH
13167$cat >try.c <<EOCP
13168#$i_stdlib I_STDLIB
13169#ifdef I_STDLIB
13170#include <stdlib.h>
13171#endif
13172#include <unistd.h>
13173#include <fcntl.h>
13174#include <signal.h>
7090f861 13175$signal_t blech(int x) { exit(3); }
15b61c98
JH
13176int main() {
13177#if defined(F_SETLK) && defined(F_SETLKW)
13178 struct flock flock;
13179 int retval, fd;
13180 fd = open("try.c", O_RDONLY);
13181 flock.l_type = F_RDLCK;
13182 flock.l_whence = SEEK_SET;
13183 flock.l_start = flock.l_len = 0;
13184 signal(SIGALRM, blech);
13185 alarm(10);
13186 retval = fcntl(fd, F_SETLK, &flock);
13187 close(fd);
13188 (retval < 0 ? exit(2) : exit(0));
13189#else
13190 exit(2);
13191#endif
13192}
13193EOCP
13194echo "Checking if fcntl-based file locking works... "
13195case "$d_fcntl" in
13196"$define")
13197 set try
13198 if eval $compile_ok; then
13199 if $run ./try; then
13200 echo "Yes, it seems to work."
13201 val="$define"
13202 else
13203 echo "Nope, it didn't work."
13204 val="$undef"
13205 case "$?" in
13206 3) $cat >&4 <<EOM
13207***
13208*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13209*** This is (almost) impossible.
13210*** If your NFS lock daemons are not feeling well, something like
13211*** this may happen, please investigate. Cannot continue, aborting.
13212***
13213EOM
13214 exit 1
13215 ;;
13216 esac
13217 fi
13218 else
13219 echo "I'm unable to compile the test program, so I'll assume not."
13220 val="$undef"
13221 fi
13222 ;;
13223*) val="$undef";
13224 echo "Nope, since you don't even have fcntl()."
13225 ;;
13226esac
13227set d_fcntl_can_lock
13228eval $setvar
5b813a60 13229$rm_try
15b61c98
JH
13230
13231: check for fd_set items
13232$cat <<EOM
13233
13234Checking to see how well your C compiler handles fd_set and friends ...
13235EOM
13236$cat >try.c <<EOCP
13237#$i_stdlib I_STDLIB
13238#ifdef I_STDLIB
13239#include <stdlib.h>
13240#endif
13241#$i_systime I_SYS_TIME
13242#$i_sysselct I_SYS_SELECT
13243#$d_socket HAS_SOCKET
13244#include <sys/types.h>
13245#ifdef HAS_SOCKET
13246#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13247#endif
13248#ifdef I_SYS_TIME
13249#include <sys/time.h>
13250#endif
13251#ifdef I_SYS_SELECT
13252#include <sys/select.h>
13253#endif
13254int main() {
13255 fd_set fds;
13256
13257#ifdef TRYBITS
13258 if(fds.fds_bits);
13259#endif
13260
13261#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13262 exit(0);
13263#else
13264 exit(1);
13265#endif
13266}
13267EOCP
13268set try -DTRYBITS
13269if eval $compile; then
13270 d_fds_bits="$define"
13271 d_fd_set="$define"
13272 echo "Well, your system knows about the normal fd_set typedef..." >&4
13273 if $run ./try; then
b4eb6b3d
JH
13274 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13275 d_fd_macros="$define"
13276 else
13277 $cat >&4 <<'EOM'
13278but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13279EOM
13280 d_fd_macros="$undef"
13281 fi
13282else
13283 $cat <<'EOM'
13284Hmm, your compiler has some difficulty with fd_set. Checking further...
13285EOM
5440bc8e 13286 set try
b4eb6b3d
JH
13287 if eval $compile; then
13288 d_fds_bits="$undef"
13289 d_fd_set="$define"
13290 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 13291 if $run ./try; then
b4eb6b3d
JH
13292 echo "and you have the normal fd_set macros." >&4
13293 d_fd_macros="$define"
13294 else
13295 $cat <<'EOM'
13296but not the normal fd_set macros! Gross! More work for me...
13297EOM
13298 d_fd_macros="$undef"
13299 fi
13300 else
13301 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13302 d_fd_set="$undef"
13303 d_fds_bits="$undef"
13304 d_fd_macros="$undef"
13305 fi
13306fi
5b813a60 13307$rm_try
b4eb6b3d
JH
13308
13309: see if fgetpos exists
13310set fgetpos d_fgetpos
13311eval $inlibc
13312
758a5d79
JH
13313: see if finite exists
13314set finite d_finite
13315eval $inlibc
13316
13317: see if finitel exists
13318set finitel d_finitel
13319eval $inlibc
13320
b4eb6b3d
JH
13321: see if flock exists
13322set flock d_flock
13323eval $inlibc
13324
2ef53570
JH
13325: see if prototype for flock is available
13326echo " "
13327set d_flockproto flock $i_sysfile sys/file.h
13328eval $hasproto
13329
758a5d79
JH
13330: see if fp_class exists
13331set fp_class d_fp_class
13332eval $inlibc
13333
b4eb6b3d
JH
13334: see if pathconf exists
13335set pathconf d_pathconf
13336eval $inlibc
13337
13338: see if fpathconf exists
13339set fpathconf d_fpathconf
13340eval $inlibc
13341
758a5d79
JH
13342: see if fpclass exists
13343set fpclass d_fpclass
13344eval $inlibc
13345
13346: see if fpclassify exists
13347set fpclassify d_fpclassify
13348eval $inlibc
13349
13350: see if fpclassl exists
13351set fpclassl d_fpclassl
13352eval $inlibc
13353
b4eb6b3d
JH
13354: check for fpos64_t
13355echo " "
13356echo "Checking to see if you have fpos64_t..." >&4
13357$cat >try.c <<EOCP
13358#include <stdio.h>
13359int main() { fpos64_t x = 7; }
13360EOCP
13361set try
13362if eval $compile; then
13363 val="$define"
13364 echo "You have fpos64_t."
13365else
13366 val="$undef"
13367 echo "You do not have fpos64_t."
13368 case "$fpossize" in
13369 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13370 esac
13371fi
5b813a60 13372$rm_try
b4eb6b3d
JH
13373set d_fpos64_t
13374eval $setvar
13375
13376: see if frexpl exists
13377set frexpl d_frexpl
13378eval $inlibc
13379
b4eb6b3d
JH
13380: see if this is a sys/param system
13381set sys/param.h i_sysparam
13382eval $inhdr
13383
13384: see if this is a sys/mount.h system
13385set sys/mount.h i_sysmount
13386eval $inhdr
13387
34f1896b 13388: Check for fs_data_s
b4eb6b3d
JH
13389echo " "
13390echo "Checking to see if your system supports struct fs_data..." >&4
13391set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13392eval $hasstruct
13393case "$d_fs_data_s" in
13394"$define") echo "Yes, it does." ;;
13395*) echo "No, it doesn't." ;;
13396esac
13397
13398: see if fseeko exists
13399set fseeko d_fseeko
13400eval $inlibc
13401case "$longsize" in
134028) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13403esac
13404
13405: see if fsetpos exists
13406set fsetpos d_fsetpos
13407eval $inlibc
13408
b4eb6b3d
JH
13409: see if fstatfs exists
13410set fstatfs d_fstatfs
13411eval $inlibc
13412
b4eb6b3d
JH
13413: see if statvfs exists
13414set statvfs d_statvfs
13415eval $inlibc
13416
13417: see if fstatvfs exists
13418set fstatvfs d_fstatvfs
13419eval $inlibc
13420
13421
411ab01c
JH
13422: see if fsync exists
13423set fsync d_fsync
13424eval $inlibc
13425
b4eb6b3d
JH
13426: see if ftello exists
13427set ftello d_ftello
13428eval $inlibc
13429case "$longsize" in
134308) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13431esac
13432
bff98e24 13433: check for a working futimes
613d6c3e 13434d_futimes="$undef"
bff98e24 13435echo " "
5b813a60 13436echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13437$cat >try.c <<EOCP
13438#include <stdio.h>
13439#include <sys/time.h>
13440#include <errno.h>
13441#include <fcntl.h>
13442
13443int main ()
13444{
13445 int fd, rv;
13446 fd = open ("try.c", O_RDWR);
13447 if (-1 == fd) exit (1);
13448 rv = futimes (fd, NULL);
13449 exit (rv == -1 ? errno : 0);
13450}
13451EOCP
13452set try
13453if eval $compile; then
13454 `$run ./try`
13455 rc=$?
13456 case "$rc" in
5b813a60 13457 0) echo "Yes, you have" >&4
bff98e24
SP
13458 d_futimes="$define"
13459 ;;
5b813a60 13460 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13461 ;;
13462 esac
13463else
43dddb59 13464 echo "No, it does not (probably harmless)" >&4
bff98e24 13465fi
5b813a60 13466$rm_try
dc814df1 13467
e74475c7
MHM
13468: see if ndbm.h is available
13469set ndbm.h i_ndbm
13470eval $inhdr
13471: Compatibility location for RedHat 7.1
13472set gdbm/ndbm.h i_gdbmndbm
13473eval $inhdr
13474: Compatibility location for Debian 4.0
13475set gdbm-ndbm.h i_gdbm_ndbm
13476eval $inhdr
13477
13478val="$undef"
13479if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13480 : see if dbm_open exists
13481 set dbm_open d_dbm_open
13482 eval $inlibc
13483 case "$d_dbm_open" in
13484 $undef)
13485 i_ndbm="$undef"
13486 i_gdbmndbm="$undef"
13487 i_gdbm_ndbm="$undef"
13488 echo "We won't be including <ndbm.h>"
13489 val="$undef"
13490 ;;
13491 *) val="$define"
13492 ;;
13493 esac
13494fi
13495set d_ndbm
13496eval $setvar
13497
13498ndbm_hdr_protochk='name=$1; hdr=$2;
13499eval "ihdr=\$""i_$name";
13500val="$undef";
13501if $test "$ihdr" = "$define"; then
13502 $echo "Checking if your <$hdr> uses prototypes..." >&4;
13503 case "$d_cplusplus" in
13504 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13505 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13506 esac;
13507 case "$val" in
13508 $define) $echo "Your <$hdr> seems to have prototypes";;
13509 *) $echo "Your <$hdr> does not seem to have prototypes";;
13510 esac;
13511fi;
13512set "d_${name}_h_uses_prototypes";
13513eval $setvar'
13514
13515set ndbm ndbm.h
13516eval $ndbm_hdr_protochk
13517set gdbmndbm gdbm/ndbm.h
13518eval $ndbm_hdr_protochk
13519set gdbm_ndbm gdbm-ndbm.h
13520eval $ndbm_hdr_protochk
13521
5086dff9
MB
13522: see if getaddrinfo exists
13523set getaddrinfo d_getaddrinfo
13524eval $inlibc
13525
b4eb6b3d
JH
13526: see if getcwd exists
13527set getcwd d_getcwd
13528eval $inlibc
13529
13530: see if getespwnam exists
13531set getespwnam d_getespwnam
13532eval $inlibc
13533
b4eb6b3d
JH
13534: see if getfsstat exists
13535set getfsstat d_getfsstat
13536eval $inlibc
13537
13538: see if getgrent exists
13539set getgrent d_getgrent
13540eval $inlibc
13541
10bc17b6
JH
13542: see if getgrent_r exists
13543set getgrent_r d_getgrent_r
13544eval $inlibc
13545case "$d_getgrent_r" in
13546"$define")
13547 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13548 case "$d_getgrent_r_proto:$usethreads" in
13549 ":define") d_getgrent_r_proto=define
a48ec845
JH
13550 set d_getgrent_r_proto getgrent_r $hdrs
13551 eval $hasproto ;;
13552 *) ;;
13553 esac
13554 case "$d_getgrent_r_proto" in
13555 define)
10bc17b6
JH
13556 case "$getgrent_r_proto" in
13557 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
61c26d18 13558 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
10bc17b6
JH
13559 esac
13560 case "$getgrent_r_proto" in
13561 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
61c26d18 13562 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
10bc17b6
JH
13563 esac
13564 case "$getgrent_r_proto" in
13565 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
61c26d18 13566 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
10bc17b6
JH
13567 esac
13568 case "$getgrent_r_proto" in
13569 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
61c26d18 13570 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
10bc17b6
JH
13571 esac
13572 case "$getgrent_r_proto" in
13573 ''|0) try='int getgrent_r(struct group*, char*, int);'
61c26d18 13574 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
10bc17b6
JH
13575 esac
13576 case "$getgrent_r_proto" in
13577 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
61c26d18 13578 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
10bc17b6
JH
13579 esac
13580 case "$getgrent_r_proto" in
90e831dc 13581 ''|0) d_getgrent_r=undef
10bc17b6 13582 getgrent_r_proto=0
a48ec845 13583 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13584 * ) case "$getgrent_r_proto" in
13585 REENTRANT_PROTO*) ;;
13586 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13587 esac
13588 echo "Prototype: $try" ;;
13589 esac
13590 ;;
c18e646a
JH
13591 *) case "$usethreads" in
13592 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13593 esac
90e831dc
SB
13594 d_getgrent_r=undef
13595 getgrent_r_proto=0
c18e646a 13596 ;;
a48ec845
JH
13597 esac
13598 ;;
10bc17b6
JH
13599*) getgrent_r_proto=0
13600 ;;
13601esac
13602
13603: see if getgrgid_r exists
13604set getgrgid_r d_getgrgid_r
13605eval $inlibc
13606case "$d_getgrgid_r" in
13607"$define")
13608 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13609 case "$d_getgrgid_r_proto:$usethreads" in
13610 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13611 set d_getgrgid_r_proto getgrgid_r $hdrs
13612 eval $hasproto ;;
13613 *) ;;
13614 esac
13615 case "$d_getgrgid_r_proto" in
13616 define)
10bc17b6
JH
13617 case "$getgrgid_r_proto" in
13618 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
61c26d18 13619 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
10bc17b6
JH
13620 esac
13621 case "$getgrgid_r_proto" in
13622 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
61c26d18 13623 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
10bc17b6
JH
13624 esac
13625 case "$getgrgid_r_proto" in
13626 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13627 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
10bc17b6
JH
13628 esac
13629 case "$getgrgid_r_proto" in
13630 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13631 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
10bc17b6
JH
13632 esac
13633 case "$getgrgid_r_proto" in
90e831dc 13634 ''|0) d_getgrgid_r=undef
10bc17b6 13635 getgrgid_r_proto=0
a48ec845 13636 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13637 * ) case "$getgrgid_r_proto" in
13638 REENTRANT_PROTO*) ;;
13639 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13640 esac
13641 echo "Prototype: $try" ;;
13642 esac
13643 ;;
c18e646a
JH
13644 *) case "$usethreads" in
13645 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13646 esac
90e831dc
SB
13647 d_getgrgid_r=undef
13648 getgrgid_r_proto=0
c18e646a 13649 ;;
a48ec845
JH
13650 esac
13651 ;;
10bc17b6
JH
13652*) getgrgid_r_proto=0
13653 ;;
13654esac
13655
13656: see if getgrnam_r exists
13657set getgrnam_r d_getgrnam_r
13658eval $inlibc
13659case "$d_getgrnam_r" in
13660"$define")
13661 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13662 case "$d_getgrnam_r_proto:$usethreads" in
13663 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13664 set d_getgrnam_r_proto getgrnam_r $hdrs
13665 eval $hasproto ;;
13666 *) ;;
13667 esac
13668 case "$d_getgrnam_r_proto" in
13669 define)
10bc17b6
JH
13670 case "$getgrnam_r_proto" in
13671 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
61c26d18 13672 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
10bc17b6
JH
13673 esac
13674 case "$getgrnam_r_proto" in
13675 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
61c26d18 13676 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
10bc17b6
JH
13677 esac
13678 case "$getgrnam_r_proto" in
13679 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
61c26d18 13680 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
10bc17b6
JH
13681 esac
13682 case "$getgrnam_r_proto" in
13683 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13684 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
10bc17b6
JH
13685 esac
13686 case "$getgrnam_r_proto" in
13687 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13688 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
10bc17b6
JH
13689 esac
13690 case "$getgrnam_r_proto" in
90e831dc 13691 ''|0) d_getgrnam_r=undef
10bc17b6 13692 getgrnam_r_proto=0
a48ec845 13693 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13694 * ) case "$getgrnam_r_proto" in
13695 REENTRANT_PROTO*) ;;
13696 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13697 esac
13698 echo "Prototype: $try" ;;
13699 esac
13700 ;;
c18e646a
JH
13701 *) case "$usethreads" in
13702 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13703 esac
90e831dc
SB
13704 d_getgrnam_r=undef
13705 getgrnam_r_proto=0
c18e646a 13706 ;;
a48ec845
JH
13707 esac
13708 ;;
10bc17b6
JH
13709*) getgrnam_r_proto=0
13710 ;;
13711esac
13712
b4eb6b3d
JH
13713: see if gethostbyaddr exists
13714set gethostbyaddr d_gethbyaddr
13715eval $inlibc
13716
13717: see if gethostbyname exists
13718set gethostbyname d_gethbyname
13719eval $inlibc
13720
13721: see if gethostent exists
13722set gethostent d_gethent
13723eval $inlibc
13724
13725: see how we will look up host name
13726echo " "
13727call=''
13728if set gethostname val -f d_gethname; eval $csym; $val; then
13729 echo 'gethostname() found.' >&4
13730 d_gethname="$define"
13731 call=gethostname
13732fi
13733if set uname val -f d_uname; eval $csym; $val; then
13734 if ./xenix; then
13735 $cat <<'EOM'
13736uname() was found, but you're running xenix, and older versions of xenix
13737have a broken uname(). If you don't really know whether your xenix is old
13738enough to have a broken system call, use the default answer.
13739
13740EOM
13741 dflt=y
13742 case "$d_uname" in
13743 "$define") dflt=n;;
13744 esac
13745 rp='Is your uname() broken?'
13746 . ./myread
13747 case "$ans" in
13748 n*) d_uname="$define"; call=uname;;
13749 esac
13750 else
13751 echo 'uname() found.' >&4
13752 d_uname="$define"
13753 case "$call" in
13754 '') call=uname ;;
13755 esac
13756 fi
13757fi
13758case "$d_gethname" in
13759'') d_gethname="$undef";;
13760esac
13761case "$d_uname" in
13762'') d_uname="$undef";;
13763esac
13764case "$d_uname$d_gethname" in
13765*define*)
13766 dflt=n
13767 cat <<EOM
613d6c3e 13768
b4eb6b3d
JH
13769Every now and then someone has a $call() that lies about the hostname
13770but can't be fixed for political or economic reasons. If you wish, I can
13771pretend $call() isn't there and maybe compute hostname at run-time
13772thanks to the '$phostname' command.
13773
13774EOM
13775 rp="Shall I ignore $call() from now on?"
13776 . ./myread
13777 case "$ans" in
13778 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13779 esac;;
13780esac
13781case "$phostname" in
13782'') aphostname='';;
13783*) case "$aphostname" in
13784 /*) ;;
13785 *) set X $phostname
13786 shift
13787 file=$1
13788 shift
13789 file=`./loc $file $file $pth`
13790 aphostname=`echo $file $*`
13791 ;;
13792 esac
13793 ;;
13794esac
13795case "$d_uname$d_gethname" in
13796*define*) ;;
13797*)
13798 case "$phostname" in
13799 '')
13800 echo "There will be no way for $package to get your hostname." >&4;;
13801 *)
13802 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13803 ;;
13804 esac;;
13805esac
13806case "$d_phostname" in
13807'') d_phostname="$undef";;
13808esac
13809
10bc17b6
JH
13810: see if gethostbyaddr_r exists
13811set gethostbyaddr_r d_gethostbyaddr_r
13812eval $inlibc
13813case "$d_gethostbyaddr_r" in
13814"$define")
13815 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13816 case "$d_gethostbyaddr_r_proto:$usethreads" in
13817 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13818 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13819 eval $hasproto ;;
13820 *) ;;
13821 esac
13822 case "$d_gethostbyaddr_r_proto" in
13823 define)
10bc17b6
JH
13824 case "$gethostbyaddr_r_proto" in
13825 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13826 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
10bc17b6
JH
13827 esac
13828 case "$gethostbyaddr_r_proto" in
13829 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
61c26d18 13830 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
10bc17b6
JH
13831 esac
13832 case "$gethostbyaddr_r_proto" in
13833 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13834 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
10bc17b6
JH
13835 esac
13836 case "$gethostbyaddr_r_proto" in
13837 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13838 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
10bc17b6
JH
13839 esac
13840 case "$gethostbyaddr_r_proto" in
13841 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
61c26d18 13842 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
10bc17b6
JH
13843 esac
13844 case "$gethostbyaddr_r_proto" in
13845 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13846 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
10bc17b6
JH
13847 esac
13848 case "$gethostbyaddr_r_proto" in
13849 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
61c26d18 13850 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
10bc17b6
JH
13851 esac
13852 case "$gethostbyaddr_r_proto" in
13853 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
61c26d18 13854 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
10bc17b6
JH
13855 esac
13856 case "$gethostbyaddr_r_proto" in
13857 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
61c26d18 13858 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
10bc17b6
JH
13859 esac
13860 case "$gethostbyaddr_r_proto" in
13861 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
61c26d18 13862 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
10bc17b6
JH
13863 esac
13864 case "$gethostbyaddr_r_proto" in
a845a0d4 13865 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13866 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
a845a0d4
JH
13867 esac
13868 case "$gethostbyaddr_r_proto" in
90e831dc 13869 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13870 gethostbyaddr_r_proto=0
a48ec845 13871 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13872 * ) case "$gethostbyaddr_r_proto" in
13873 REENTRANT_PROTO*) ;;
13874 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13875 esac
13876 echo "Prototype: $try" ;;
13877 esac
13878 ;;
c18e646a
JH
13879 *) case "$usethreads" in
13880 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13881 esac
90e831dc
SB
13882 d_gethostbyaddr_r=undef
13883 gethostbyaddr_r_proto=0
c18e646a 13884 ;;
a48ec845
JH
13885 esac
13886 ;;
10bc17b6
JH
13887*) gethostbyaddr_r_proto=0
13888 ;;
13889esac
13890
13891: see if gethostbyname_r exists
13892set gethostbyname_r d_gethostbyname_r
13893eval $inlibc
13894case "$d_gethostbyname_r" in
13895"$define")
13896 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13897 case "$d_gethostbyname_r_proto:$usethreads" in
13898 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13899 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13900 eval $hasproto ;;
13901 *) ;;
13902 esac
13903 case "$d_gethostbyname_r_proto" in
13904 define)
10bc17b6
JH
13905 case "$gethostbyname_r_proto" in
13906 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13907 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
13908 esac
13909 case "$gethostbyname_r_proto" in
13910 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13911 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
10bc17b6
JH
13912 esac
13913 case "$gethostbyname_r_proto" in
13914 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
61c26d18 13915 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
10bc17b6
JH
13916 esac
13917 case "$gethostbyname_r_proto" in
90e831dc 13918 ''|0) d_gethostbyname_r=undef
10bc17b6 13919 gethostbyname_r_proto=0
a48ec845 13920 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13921 * ) case "$gethostbyname_r_proto" in
13922 REENTRANT_PROTO*) ;;
13923 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13924 esac
13925 echo "Prototype: $try" ;;
13926 esac
13927 ;;
c18e646a
JH
13928 *) case "$usethreads" in
13929 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13930 esac
90e831dc
SB
13931 d_gethostbyname_r=undef
13932 gethostbyname_r_proto=0
c18e646a 13933 ;;
a48ec845
JH
13934 esac
13935 ;;
10bc17b6
JH
13936*) gethostbyname_r_proto=0
13937 ;;
13938esac
13939
13940: see if gethostent_r exists
13941set gethostent_r d_gethostent_r
13942eval $inlibc
13943case "$d_gethostent_r" in
13944"$define")
13945 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13946 case "$d_gethostent_r_proto:$usethreads" in
13947 ":define") d_gethostent_r_proto=define
a48ec845
JH
13948 set d_gethostent_r_proto gethostent_r $hdrs
13949 eval $hasproto ;;
13950 *) ;;
13951 esac
13952 case "$d_gethostent_r_proto" in
13953 define)
10bc17b6
JH
13954 case "$gethostent_r_proto" in
13955 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13956 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
10bc17b6
JH
13957 esac
13958 case "$gethostent_r_proto" in
13959 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13960 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
10bc17b6
JH
13961 esac
13962 case "$gethostent_r_proto" in
13963 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13964 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
10bc17b6
JH
13965 esac
13966 case "$gethostent_r_proto" in
13967 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
61c26d18 13968 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
10bc17b6
JH
13969 esac
13970 case "$gethostent_r_proto" in
13971 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
61c26d18 13972 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
10bc17b6
JH
13973 esac
13974 case "$gethostent_r_proto" in
13975 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
61c26d18 13976 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
10bc17b6
JH
13977 esac
13978 case "$gethostent_r_proto" in
90e831dc 13979 ''|0) d_gethostent_r=undef
10bc17b6 13980 gethostent_r_proto=0
a48ec845 13981 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13982 * ) case "$gethostent_r_proto" in
13983 REENTRANT_PROTO*) ;;
13984 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13985 esac
13986 echo "Prototype: $try" ;;
13987 esac
13988 ;;
c18e646a
JH
13989 *) case "$usethreads" in
13990 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13991 esac
90e831dc
SB
13992 d_gethostent_r=undef
13993 gethostent_r_proto=0
c18e646a 13994 ;;
a48ec845
JH
13995 esac
13996 ;;
10bc17b6
JH
13997*) gethostent_r_proto=0
13998 ;;
13999esac
b4eb6b3d
JH
14000
14001: see if prototypes for various gethostxxx netdb.h functions are available
14002echo " "
14003set d_gethostprotos gethostent $i_netdb netdb.h
14004eval $hasproto
14005
4e0554ec
JH
14006: see if getitimer exists
14007set getitimer d_getitimer
14008eval $inlibc
14009
b4eb6b3d
JH
14010: see if getlogin exists
14011set getlogin d_getlogin
14012eval $inlibc
14013
10bc17b6
JH
14014: see if getlogin_r exists
14015set getlogin_r d_getlogin_r
14016eval $inlibc
14017case "$d_getlogin_r" in
14018"$define")
14019 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
14020 case "$d_getlogin_r_proto:$usethreads" in
14021 ":define") d_getlogin_r_proto=define
a48ec845
JH
14022 set d_getlogin_r_proto getlogin_r $hdrs
14023 eval $hasproto ;;
14024 *) ;;
14025 esac
14026 case "$d_getlogin_r_proto" in
14027 define)
10bc17b6
JH
14028 case "$getlogin_r_proto" in
14029 ''|0) try='int getlogin_r(char*, size_t);'
61c26d18 14030 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
10bc17b6
JH
14031 esac
14032 case "$getlogin_r_proto" in
14033 ''|0) try='int getlogin_r(char*, int);'
61c26d18 14034 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
10bc17b6
JH
14035 esac
14036 case "$getlogin_r_proto" in
14037 ''|0) try='char* getlogin_r(char*, size_t);'
61c26d18 14038 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
10bc17b6
JH
14039 esac
14040 case "$getlogin_r_proto" in
14041 ''|0) try='char* getlogin_r(char*, int);'
61c26d18 14042 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
10bc17b6
JH
14043 esac
14044 case "$getlogin_r_proto" in
90e831dc 14045 ''|0) d_getlogin_r=undef
10bc17b6 14046 getlogin_r_proto=0
a48ec845 14047 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14048 * ) case "$getlogin_r_proto" in
14049 REENTRANT_PROTO*) ;;
14050 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14051 esac
14052 echo "Prototype: $try" ;;
14053 esac
14054 ;;
c18e646a
JH
14055 *) case "$usethreads" in
14056 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14057 esac
90e831dc
SB
14058 d_getlogin_r=undef
14059 getlogin_r_proto=0
c18e646a 14060 ;;
a48ec845
JH
14061 esac
14062 ;;
10bc17b6
JH
14063*) getlogin_r_proto=0
14064 ;;
14065esac
14066
b4eb6b3d
JH
14067: see if getmnt exists
14068set getmnt d_getmnt
14069eval $inlibc
14070
14071: see if getmntent exists
14072set getmntent d_getmntent
14073eval $inlibc
14074
5086dff9
MB
14075: see if getnameinfo exists
14076set getnameinfo d_getnameinfo
14077eval $inlibc
14078
b4eb6b3d
JH
14079: see if getnetbyaddr exists
14080set getnetbyaddr d_getnbyaddr
14081eval $inlibc
14082
14083: see if getnetbyname exists
14084set getnetbyname d_getnbyname
14085eval $inlibc
14086
14087: see if getnetent exists
14088set getnetent d_getnent
14089eval $inlibc
14090
10bc17b6
JH
14091: see if getnetbyaddr_r exists
14092set getnetbyaddr_r d_getnetbyaddr_r
14093eval $inlibc
14094case "$d_getnetbyaddr_r" in
14095"$define")
14096 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14097 case "$d_getnetbyaddr_r_proto:$usethreads" in
14098 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
14099 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14100 eval $hasproto ;;
14101 *) ;;
14102 esac
14103 case "$d_getnetbyaddr_r_proto" in
14104 define)
10bc17b6
JH
14105 case "$getnetbyaddr_r_proto" in
14106 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14107 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
10bc17b6
JH
14108 esac
14109 case "$getnetbyaddr_r_proto" in
14110 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14111 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
10bc17b6
JH
14112 esac
14113 case "$getnetbyaddr_r_proto" in
14114 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
61c26d18 14115 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
10bc17b6
JH
14116 esac
14117 case "$getnetbyaddr_r_proto" in
14118 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14119 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
10bc17b6
JH
14120 esac
14121 case "$getnetbyaddr_r_proto" in
14122 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
61c26d18 14123 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
10bc17b6
JH
14124 esac
14125 case "$getnetbyaddr_r_proto" in
14126 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
61c26d18 14127 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
10bc17b6
JH
14128 esac
14129 case "$getnetbyaddr_r_proto" in
14130 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
61c26d18 14131 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
10bc17b6
JH
14132 esac
14133 case "$getnetbyaddr_r_proto" in
a845a0d4 14134 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14135 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
a845a0d4
JH
14136 esac
14137 case "$getnetbyaddr_r_proto" in
90e831dc 14138 ''|0) d_getnetbyaddr_r=undef
10bc17b6 14139 getnetbyaddr_r_proto=0
a48ec845 14140 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14141 * ) case "$getnetbyaddr_r_proto" in
14142 REENTRANT_PROTO*) ;;
14143 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14144 esac
14145 echo "Prototype: $try" ;;
14146 esac
14147 ;;
c18e646a
JH
14148 *) case "$usethreads" in
14149 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14150 esac
90e831dc
SB
14151 d_getnetbyaddr_r=undef
14152 getnetbyaddr_r_proto=0
c18e646a 14153 ;;
a48ec845
JH
14154 esac
14155 ;;
10bc17b6
JH
14156*) getnetbyaddr_r_proto=0
14157 ;;
14158esac
14159
14160: see if getnetbyname_r exists
14161set getnetbyname_r d_getnetbyname_r
14162eval $inlibc
14163case "$d_getnetbyname_r" in
14164"$define")
14165 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14166 case "$d_getnetbyname_r_proto:$usethreads" in
14167 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
14168 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14169 eval $hasproto ;;
14170 *) ;;
14171 esac
14172 case "$d_getnetbyname_r_proto" in
14173 define)
10bc17b6
JH
14174 case "$getnetbyname_r_proto" in
14175 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14176 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
14177 esac
14178 case "$getnetbyname_r_proto" in
14179 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14180 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
10bc17b6
JH
14181 esac
14182 case "$getnetbyname_r_proto" in
14183 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14184 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
10bc17b6
JH
14185 esac
14186 case "$getnetbyname_r_proto" in
14187 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
61c26d18 14188 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
10bc17b6
JH
14189 esac
14190 case "$getnetbyname_r_proto" in
90e831dc 14191 ''|0) d_getnetbyname_r=undef
10bc17b6 14192 getnetbyname_r_proto=0
a48ec845 14193 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14194 * ) case "$getnetbyname_r_proto" in
14195 REENTRANT_PROTO*) ;;
14196 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14197 esac
14198 echo "Prototype: $try" ;;
14199 esac
14200 ;;
c18e646a
JH
14201 *) case "$usethreads" in
14202 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14203 esac
90e831dc
SB
14204 d_getnetbyname_r=undef
14205 getnetbyname_r_proto=0
c18e646a 14206 ;;
a48ec845
JH
14207 esac
14208 ;;
10bc17b6
JH
14209*) getnetbyname_r_proto=0
14210 ;;
14211esac
14212
14213: see if getnetent_r exists
14214set getnetent_r d_getnetent_r
14215eval $inlibc
14216case "$d_getnetent_r" in
14217"$define")
14218 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14219 case "$d_getnetent_r_proto:$usethreads" in
14220 ":define") d_getnetent_r_proto=define
a48ec845
JH
14221 set d_getnetent_r_proto getnetent_r $hdrs
14222 eval $hasproto ;;
14223 *) ;;
14224 esac
14225 case "$d_getnetent_r_proto" in
14226 define)
10bc17b6
JH
14227 case "$getnetent_r_proto" in
14228 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14229 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
10bc17b6
JH
14230 esac
14231 case "$getnetent_r_proto" in
14232 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14233 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
10bc17b6
JH
14234 esac
14235 case "$getnetent_r_proto" in
14236 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14237 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
10bc17b6
JH
14238 esac
14239 case "$getnetent_r_proto" in
14240 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
61c26d18 14241 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
10bc17b6
JH
14242 esac
14243 case "$getnetent_r_proto" in
14244 ''|0) try='int getnetent_r(struct netent*, char*, int);'
61c26d18 14245 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
10bc17b6
JH
14246 esac
14247 case "$getnetent_r_proto" in
14248 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
61c26d18 14249 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
10bc17b6
JH
14250 esac
14251 case "$getnetent_r_proto" in
90e831dc 14252 ''|0) d_getnetent_r=undef
10bc17b6 14253 getnetent_r_proto=0
a48ec845 14254 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14255 * ) case "$getnetent_r_proto" in
14256 REENTRANT_PROTO*) ;;
14257 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14258 esac
14259 echo "Prototype: $try" ;;
14260 esac
14261 ;;
c18e646a
JH
14262 *) case "$usethreads" in
14263 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14264 esac
90e831dc
SB
14265 d_getnetent_r=undef
14266 getnetent_r_proto=0
c18e646a 14267 ;;
a48ec845
JH
14268 esac
14269 ;;
10bc17b6
JH
14270*) getnetent_r_proto=0
14271 ;;
14272esac
14273
b4eb6b3d
JH
14274: see if prototypes for various getnetxxx netdb.h functions are available
14275echo " "
14276set d_getnetprotos getnetent $i_netdb netdb.h
14277eval $hasproto
14278
0c0643d0
JH
14279: see if getpagesize exists
14280set getpagesize d_getpagsz
14281eval $inlibc
14282
34f1896b 14283: Optional checks for getprotobyname and getprotobynumber
b4eb6b3d
JH
14284
14285: see if getprotobyname exists
14286set getprotobyname d_getpbyname
14287eval $inlibc
14288
14289: see if getprotobynumber exists
14290set getprotobynumber d_getpbynumber
14291eval $inlibc
14292
14293: see if getprotoent exists
14294set getprotoent d_getpent
14295eval $inlibc
14296
14297: see if getpgid exists
14298set getpgid d_getpgid
14299eval $inlibc
14300
14301: see if getpgrp2 exists
14302set getpgrp2 d_getpgrp2
14303eval $inlibc
14304
14305: see if getppid exists
14306set getppid d_getppid
14307eval $inlibc
14308
14309: see if getpriority exists
14310set getpriority d_getprior
14311eval $inlibc
14312
10bc17b6
JH
14313: see if getprotobyname_r exists
14314set getprotobyname_r d_getprotobyname_r
14315eval $inlibc
14316case "$d_getprotobyname_r" in
14317"$define")
14318 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14319 case "$d_getprotobyname_r_proto:$usethreads" in
14320 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
14321 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14322 eval $hasproto ;;
14323 *) ;;
14324 esac
14325 case "$d_getprotobyname_r_proto" in
14326 define)
10bc17b6
JH
14327 case "$getprotobyname_r_proto" in
14328 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14329 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
10bc17b6
JH
14330 esac
14331 case "$getprotobyname_r_proto" in
14332 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
61c26d18 14333 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
10bc17b6
JH
14334 esac
14335 case "$getprotobyname_r_proto" in
14336 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
61c26d18 14337 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
10bc17b6
JH
14338 esac
14339 case "$getprotobyname_r_proto" in
90e831dc 14340 ''|0) d_getprotobyname_r=undef
10bc17b6 14341 getprotobyname_r_proto=0
a48ec845 14342 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14343 * ) case "$getprotobyname_r_proto" in
14344 REENTRANT_PROTO*) ;;
14345 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14346 esac
14347 echo "Prototype: $try" ;;
14348 esac
14349 ;;
c18e646a
JH
14350 *) case "$usethreads" in
14351 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14352 esac
90e831dc
SB
14353 d_getprotobyname_r=undef
14354 getprotobyname_r_proto=0
c18e646a 14355 ;;
a48ec845
JH
14356 esac
14357 ;;
10bc17b6
JH
14358*) getprotobyname_r_proto=0
14359 ;;
14360esac
14361
14362: see if getprotobynumber_r exists
14363set getprotobynumber_r d_getprotobynumber_r
14364eval $inlibc
14365case "$d_getprotobynumber_r" in
14366"$define")
14367 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14368 case "$d_getprotobynumber_r_proto:$usethreads" in
14369 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
14370 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14371 eval $hasproto ;;
14372 *) ;;
14373 esac
14374 case "$d_getprotobynumber_r_proto" in
14375 define)
10bc17b6
JH
14376 case "$getprotobynumber_r_proto" in
14377 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14378 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
10bc17b6
JH
14379 esac
14380 case "$getprotobynumber_r_proto" in
14381 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
61c26d18 14382 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
10bc17b6
JH
14383 esac
14384 case "$getprotobynumber_r_proto" in
14385 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
61c26d18 14386 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
10bc17b6
JH
14387 esac
14388 case "$getprotobynumber_r_proto" in
90e831dc 14389 ''|0) d_getprotobynumber_r=undef
10bc17b6 14390 getprotobynumber_r_proto=0
a48ec845 14391 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14392 * ) case "$getprotobynumber_r_proto" in
14393 REENTRANT_PROTO*) ;;
14394 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14395 esac
14396 echo "Prototype: $try" ;;
14397 esac
14398 ;;
c18e646a
JH
14399 *) case "$usethreads" in
14400 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14401 esac
90e831dc
SB
14402 d_getprotobynumber_r=undef
14403 getprotobynumber_r_proto=0
c18e646a 14404 ;;
a48ec845
JH
14405 esac
14406 ;;
10bc17b6
JH
14407*) getprotobynumber_r_proto=0
14408 ;;
14409esac
14410
14411: see if getprotoent_r exists
14412set getprotoent_r d_getprotoent_r
14413eval $inlibc
14414case "$d_getprotoent_r" in
14415"$define")
14416 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14417 case "$d_getprotoent_r_proto:$usethreads" in
14418 ":define") d_getprotoent_r_proto=define
a48ec845
JH
14419 set d_getprotoent_r_proto getprotoent_r $hdrs
14420 eval $hasproto ;;
14421 *) ;;
14422 esac
14423 case "$d_getprotoent_r_proto" in
14424 define)
10bc17b6
JH
14425 case "$getprotoent_r_proto" in
14426 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14427 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
10bc17b6
JH
14428 esac
14429 case "$getprotoent_r_proto" in
14430 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
61c26d18 14431 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
10bc17b6
JH
14432 esac
14433 case "$getprotoent_r_proto" in
14434 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
61c26d18 14435 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
10bc17b6
JH
14436 esac
14437 case "$getprotoent_r_proto" in
14438 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
61c26d18 14439 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
10bc17b6
JH
14440 esac
14441 case "$getprotoent_r_proto" in
90e831dc 14442 ''|0) d_getprotoent_r=undef
10bc17b6 14443 getprotoent_r_proto=0
a48ec845 14444 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14445 * ) case "$getprotoent_r_proto" in
14446 REENTRANT_PROTO*) ;;
14447 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14448 esac
14449 echo "Prototype: $try" ;;
14450 esac
14451 ;;
c18e646a
JH
14452 *) case "$usethreads" in
14453 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14454 esac
90e831dc
SB
14455 d_getprotoent_r=undef
14456 getprotoent_r_proto=0
c18e646a 14457 ;;
a48ec845
JH
14458 esac
14459 ;;
10bc17b6
JH
14460*) getprotoent_r_proto=0
14461 ;;
14462esac
14463
b4eb6b3d
JH
14464: see if prototypes for various getprotoxxx netdb.h functions are available
14465echo " "
14466set d_getprotoprotos getprotoent $i_netdb netdb.h
14467eval $hasproto
14468
14469: see if getprpwnam exists
14470set getprpwnam d_getprpwnam
14471eval $inlibc
14472
14473: see if getpwent exists
14474set getpwent d_getpwent
14475eval $inlibc
14476
10bc17b6
JH
14477: see if getpwent_r exists
14478set getpwent_r d_getpwent_r
14479eval $inlibc
14480case "$d_getpwent_r" in
14481"$define")
14482 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14483 case "$d_getpwent_r_proto:$usethreads" in
14484 ":define") d_getpwent_r_proto=define
a48ec845
JH
14485 set d_getpwent_r_proto getpwent_r $hdrs
14486 eval $hasproto ;;
14487 *) ;;
14488 esac
14489 case "$d_getpwent_r_proto" in
14490 define)
10bc17b6
JH
14491 case "$getpwent_r_proto" in
14492 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14493 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
10bc17b6
JH
14494 esac
14495 case "$getpwent_r_proto" in
14496 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
61c26d18 14497 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
10bc17b6
JH
14498 esac
14499 case "$getpwent_r_proto" in
14500 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
61c26d18 14501 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
10bc17b6
JH
14502 esac
14503 case "$getpwent_r_proto" in
14504 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
61c26d18 14505 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
10bc17b6
JH
14506 esac
14507 case "$getpwent_r_proto" in
14508 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
61c26d18 14509 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
10bc17b6
JH
14510 esac
14511 case "$getpwent_r_proto" in
14512 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
61c26d18 14513 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
10bc17b6
JH
14514 esac
14515 case "$getpwent_r_proto" in
90e831dc 14516 ''|0) d_getpwent_r=undef
10bc17b6 14517 getpwent_r_proto=0
a48ec845 14518 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14519 * ) case "$getpwent_r_proto" in
14520 REENTRANT_PROTO*) ;;
14521 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14522 esac
14523 echo "Prototype: $try" ;;
14524 esac
14525 ;;
c18e646a
JH
14526 *) case "$usethreads" in
14527 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14528 esac
90e831dc
SB
14529 d_getpwent_r=undef
14530 getpwent_r_proto=0
c18e646a 14531 ;;
a48ec845
JH
14532 esac
14533 ;;
10bc17b6
JH
14534*) getpwent_r_proto=0
14535 ;;
14536esac
14537
14538: see if getpwnam_r exists
14539set getpwnam_r d_getpwnam_r
14540eval $inlibc
14541case "$d_getpwnam_r" in
14542"$define")
14543 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14544 case "$d_getpwnam_r_proto:$usethreads" in
14545 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14546 set d_getpwnam_r_proto getpwnam_r $hdrs
14547 eval $hasproto ;;
14548 *) ;;
14549 esac
14550 case "$d_getpwnam_r_proto" in
14551 define)
10bc17b6
JH
14552 case "$getpwnam_r_proto" in
14553 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14554 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14555 esac
14556 case "$getpwnam_r_proto" in
14557 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
61c26d18 14558 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
10bc17b6
JH
14559 esac
14560 case "$getpwnam_r_proto" in
14561 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14562 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
10bc17b6
JH
14563 esac
14564 case "$getpwnam_r_proto" in
14565 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14566 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
10bc17b6
JH
14567 esac
14568 case "$getpwnam_r_proto" in
90e831dc 14569 ''|0) d_getpwnam_r=undef
10bc17b6 14570 getpwnam_r_proto=0
a48ec845 14571 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14572 * ) case "$getpwnam_r_proto" in
14573 REENTRANT_PROTO*) ;;
14574 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14575 esac
14576 echo "Prototype: $try" ;;
14577 esac
14578 ;;
c18e646a
JH
14579 *) case "$usethreads" in
14580 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14581 esac
90e831dc
SB
14582 d_getpwnam_r=undef
14583 getpwnam_r_proto=0
c18e646a 14584 ;;
a48ec845
JH
14585 esac
14586 ;;
10bc17b6
JH
14587*) getpwnam_r_proto=0
14588 ;;
14589esac
14590
14591: see if getpwuid_r exists
14592set getpwuid_r d_getpwuid_r
14593eval $inlibc
14594case "$d_getpwuid_r" in
14595"$define")
14596 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14597 case "$d_getpwuid_r_proto:$usethreads" in
14598 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14599 set d_getpwuid_r_proto getpwuid_r $hdrs
14600 eval $hasproto ;;
14601 *) ;;
14602 esac
14603 case "$d_getpwuid_r_proto" in
14604 define)
10bc17b6
JH
14605 case "$getpwuid_r_proto" in
14606 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14607 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
10bc17b6
JH
14608 esac
14609 case "$getpwuid_r_proto" in
14610 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
61c26d18 14611 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
10bc17b6
JH
14612 esac
14613 case "$getpwuid_r_proto" in
14614 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14615 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
10bc17b6
JH
14616 esac
14617 case "$getpwuid_r_proto" in
14618 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14619 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
10bc17b6
JH
14620 esac
14621 case "$getpwuid_r_proto" in
90e831dc 14622 ''|0) d_getpwuid_r=undef
10bc17b6 14623 getpwuid_r_proto=0
a48ec845 14624 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14625 * ) case "$getpwuid_r_proto" in
14626 REENTRANT_PROTO*) ;;
14627 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14628 esac
14629 echo "Prototype: $try" ;;
14630 esac
14631 ;;
c18e646a
JH
14632 *) case "$usethreads" in
14633 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14634 esac
90e831dc
SB
14635 d_getpwuid_r=undef
14636 getpwuid_r_proto=0
c18e646a 14637 ;;
a48ec845
JH
14638 esac
14639 ;;
10bc17b6
JH
14640*) getpwuid_r_proto=0
14641 ;;
14642esac
14643
34f1896b 14644: Optional checks for getsbyname and getsbyport
b4eb6b3d
JH
14645
14646: see if getservbyname exists
14647set getservbyname d_getsbyname
14648eval $inlibc
14649
14650: see if getservbyport exists
14651set getservbyport d_getsbyport
14652eval $inlibc
14653
14654: see if getservent exists
14655set getservent d_getsent
14656eval $inlibc
14657
10bc17b6
JH
14658: see if getservbyname_r exists
14659set getservbyname_r d_getservbyname_r
14660eval $inlibc
14661case "$d_getservbyname_r" in
14662"$define")
14663 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14664 case "$d_getservbyname_r_proto:$usethreads" in
14665 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14666 set d_getservbyname_r_proto getservbyname_r $hdrs
14667 eval $hasproto ;;
14668 *) ;;
14669 esac
14670 case "$d_getservbyname_r_proto" in
14671 define)
10bc17b6
JH
14672 case "$getservbyname_r_proto" in
14673 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14674 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
10bc17b6
JH
14675 esac
14676 case "$getservbyname_r_proto" in
14677 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
61c26d18 14678 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
10bc17b6
JH
14679 esac
14680 case "$getservbyname_r_proto" in
14681 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
61c26d18 14682 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
10bc17b6
JH
14683 esac
14684 case "$getservbyname_r_proto" in
90e831dc 14685 ''|0) d_getservbyname_r=undef
10bc17b6 14686 getservbyname_r_proto=0
a48ec845 14687 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14688 * ) case "$getservbyname_r_proto" in
14689 REENTRANT_PROTO*) ;;
14690 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14691 esac
14692 echo "Prototype: $try" ;;
14693 esac
14694 ;;
c18e646a
JH
14695 *) case "$usethreads" in
14696 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14697 esac
90e831dc
SB
14698 d_getservbyname_r=undef
14699 getservbyname_r_proto=0
c18e646a 14700 ;;
a48ec845
JH
14701 esac
14702 ;;
10bc17b6
JH
14703*) getservbyname_r_proto=0
14704 ;;
14705esac
14706
14707: see if getservbyport_r exists
14708set getservbyport_r d_getservbyport_r
14709eval $inlibc
14710case "$d_getservbyport_r" in
14711"$define")
14712 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14713 case "$d_getservbyport_r_proto:$usethreads" in
14714 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14715 set d_getservbyport_r_proto getservbyport_r $hdrs
14716 eval $hasproto ;;
14717 *) ;;
14718 esac
14719 case "$d_getservbyport_r_proto" in
14720 define)
10bc17b6
JH
14721 case "$getservbyport_r_proto" in
14722 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14723 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
10bc17b6
JH
14724 esac
14725 case "$getservbyport_r_proto" in
14726 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
61c26d18 14727 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
10bc17b6
JH
14728 esac
14729 case "$getservbyport_r_proto" in
14730 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
61c26d18 14731 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
10bc17b6
JH
14732 esac
14733 case "$getservbyport_r_proto" in
90e831dc 14734 ''|0) d_getservbyport_r=undef
10bc17b6 14735 getservbyport_r_proto=0
a48ec845 14736 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14737 * ) case "$getservbyport_r_proto" in
14738 REENTRANT_PROTO*) ;;
14739 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14740 esac
14741 echo "Prototype: $try" ;;
14742 esac
14743 ;;
c18e646a
JH
14744 *) case "$usethreads" in
14745 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14746 esac
90e831dc
SB
14747 d_getservbyport_r=undef
14748 getservbyport_r_proto=0
c18e646a 14749 ;;
a48ec845
JH
14750 esac
14751 ;;
10bc17b6
JH
14752*) getservbyport_r_proto=0
14753 ;;
14754esac
14755
14756: see if getservent_r exists
14757set getservent_r d_getservent_r
14758eval $inlibc
14759case "$d_getservent_r" in
14760"$define")
14761 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14762 case "$d_getservent_r_proto:$usethreads" in
14763 ":define") d_getservent_r_proto=define
a48ec845
JH
14764 set d_getservent_r_proto getservent_r $hdrs
14765 eval $hasproto ;;
14766 *) ;;
14767 esac
14768 case "$d_getservent_r_proto" in
14769 define)
10bc17b6
JH
14770 case "$getservent_r_proto" in
14771 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
61c26d18 14772 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
10bc17b6
JH
14773 esac
14774 case "$getservent_r_proto" in
14775 ''|0) try='int getservent_r(struct servent*, char*, int);'
61c26d18 14776 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
10bc17b6
JH
14777 esac
14778 case "$getservent_r_proto" in
14779 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
61c26d18 14780 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
10bc17b6
JH
14781 esac
14782 case "$getservent_r_proto" in
14783 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
61c26d18 14784 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
10bc17b6
JH
14785 esac
14786 case "$getservent_r_proto" in
90e831dc 14787 ''|0) d_getservent_r=undef
10bc17b6 14788 getservent_r_proto=0
a48ec845 14789 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14790 * ) case "$getservent_r_proto" in
14791 REENTRANT_PROTO*) ;;
14792 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14793 esac
14794 echo "Prototype: $try" ;;
14795 esac
14796 ;;
c18e646a
JH
14797 *) case "$usethreads" in
14798 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14799 esac
90e831dc
SB
14800 d_getservent_r=undef
14801 getservent_r_proto=0
c18e646a 14802 ;;
a48ec845
JH
14803 esac
14804 ;;
10bc17b6
JH
14805*) getservent_r_proto=0
14806 ;;
14807esac
14808
b4eb6b3d
JH
14809: see if prototypes for various getservxxx netdb.h functions are available
14810echo " "
14811set d_getservprotos getservent $i_netdb netdb.h
14812eval $hasproto
14813
14814: see if getspnam exists
14815set getspnam d_getspnam
14816eval $inlibc
14817
10bc17b6
JH
14818: see if this is a shadow.h system
14819set shadow.h i_shadow
14820eval $inhdr
14821
14822: see if getspnam_r exists
14823set getspnam_r d_getspnam_r
14824eval $inlibc
14825case "$d_getspnam_r" in
14826"$define")
14827 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14828 case "$d_getspnam_r_proto:$usethreads" in
14829 ":define") d_getspnam_r_proto=define
a48ec845
JH
14830 set d_getspnam_r_proto getspnam_r $hdrs
14831 eval $hasproto ;;
14832 *) ;;
14833 esac
14834 case "$d_getspnam_r_proto" in
14835 define)
10bc17b6
JH
14836 case "$getspnam_r_proto" in
14837 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
61c26d18 14838 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14839 esac
14840 case "$getspnam_r_proto" in
14841 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
61c26d18 14842 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
10bc17b6
JH
14843 esac
14844 case "$getspnam_r_proto" in
90e831dc 14845 ''|0) d_getspnam_r=undef
10bc17b6 14846 getspnam_r_proto=0
a48ec845 14847 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14848 * ) case "$getspnam_r_proto" in
14849 REENTRANT_PROTO*) ;;
14850 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14851 esac
14852 echo "Prototype: $try" ;;
14853 esac
14854 ;;
c18e646a
JH
14855 *) case "$usethreads" in
14856 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14857 esac
90e831dc
SB
14858 d_getspnam_r=undef
14859 getspnam_r_proto=0
c18e646a 14860 ;;
a48ec845
JH
14861 esac
14862 ;;
10bc17b6
JH
14863*) getspnam_r_proto=0
14864 ;;
14865esac
14866
b4eb6b3d
JH
14867: see if gettimeofday or ftime exists
14868set gettimeofday d_gettimeod
14869eval $inlibc
14870case "$d_gettimeod" in
14871"$undef")
14872 set ftime d_ftime
14873 eval $inlibc
14874 ;;
14875*)
14876 val="$undef"; set d_ftime; eval $setvar
14877 ;;
14878esac
14879case "$d_gettimeod$d_ftime" in
14880"$undef$undef")
14881 echo " "
14882 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14883 ;;
14884esac
14885
10bc17b6
JH
14886: see if gmtime_r exists
14887set gmtime_r d_gmtime_r
14888eval $inlibc
14889case "$d_gmtime_r" in
14890"$define")
d63eadf0 14891 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14892 case "$d_gmtime_r_proto:$usethreads" in
14893 ":define") d_gmtime_r_proto=define
a48ec845
JH
14894 set d_gmtime_r_proto gmtime_r $hdrs
14895 eval $hasproto ;;
14896 *) ;;
14897 esac
14898 case "$d_gmtime_r_proto" in
14899 define)
10bc17b6
JH
14900 case "$gmtime_r_proto" in
14901 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
61c26d18 14902 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
10bc17b6
JH
14903 esac
14904 case "$gmtime_r_proto" in
14905 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
61c26d18 14906 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
10bc17b6
JH
14907 esac
14908 case "$gmtime_r_proto" in
90e831dc 14909 ''|0) d_gmtime_r=undef
10bc17b6 14910 gmtime_r_proto=0
a48ec845 14911 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14912 * ) case "$gmtime_r_proto" in
14913 REENTRANT_PROTO*) ;;
14914 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14915 esac
14916 echo "Prototype: $try" ;;
14917 esac
b4eb6b3d 14918 ;;
c18e646a
JH
14919 *) case "$usethreads" in
14920 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14921 esac
90e831dc
SB
14922 d_gmtime_r=undef
14923 gmtime_r_proto=0
c18e646a 14924 ;;
a48ec845
JH
14925 esac
14926 ;;
10bc17b6 14927*) gmtime_r_proto=0
b4eb6b3d
JH
14928 ;;
14929esac
14930
14931: see if hasmntopt exists
14932set hasmntopt d_hasmntopt
14933eval $inlibc
14934
14935: see if this is a netinet/in.h or sys/in.h system
14936set netinet/in.h i_niin sys/in.h i_sysin
14937eval $inhdr
14938
14939: see if arpa/inet.h has to be included
14940set arpa/inet.h i_arpainet
14941eval $inhdr
14942
14943: see if htonl --and friends-- exists
14944val=''
14945set htonl val
14946eval $inlibc
14947
14948: Maybe they are macros.
14949case "$val" in
14950$undef)
14951 $cat >htonl.c <<EOM
14952#include <stdio.h>
14953#include <sys/types.h>
14954#$i_niin I_NETINET_IN
14955#$i_sysin I_SYS_IN
14956#$i_arpainet I_ARPA_INET
14957#ifdef I_NETINET_IN
14958#include <netinet/in.h>
14959#endif
14960#ifdef I_SYS_IN
14961#include <sys/in.h>
14962#endif
14963#ifdef I_ARPA_INET
14964#include <arpa/inet.h>
14965#endif
14966#ifdef htonl
14967printf("Defined as a macro.");
14968#endif
14969EOM
14970 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14971 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14972 val="$define"
14973 echo "But it seems to be defined as a macro." >&4
14974 fi
14975 $rm -f htonl.?
14976 ;;
14977esac
14978set d_htonl
14979eval $setvar
14980
36adc09b
JH
14981: see if ilogbl exists
14982set ilogbl d_ilogbl
14983eval $inlibc
14984
b4eb6b3d
JH
14985: index or strchr
14986echo " "
14987if set index val -f; eval $csym; $val; then
14988 if set strchr val -f d_strchr; eval $csym; $val; then
14989 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14990 val="$define"
14991 vali="$undef"
14992 echo "strchr() found." >&4
14993 else
14994 val="$undef"
14995 vali="$define"
14996 echo "index() found." >&4
14997 fi
14998 else
14999 val="$undef"
15000 vali="$define"
8dfa8df9
JH
15001 echo "index() found." >&4
15002 fi
b4eb6b3d 15003else
8dfa8df9
JH
15004 if set strchr val -f d_strchr; eval $csym; $val; then
15005 val="$define"
15006 vali="$undef"
15007 echo "strchr() found." >&4
15008 else
15009 echo "No index() or strchr() found!" >&4
15010 val="$undef"
15011 vali="$undef"
15012 fi
b4eb6b3d 15013fi
8dfa8df9
JH
15014set d_strchr; eval $setvar
15015val="$vali"
15016set d_index; eval $setvar
15017
15018: check whether inet_aton exists
15019set inet_aton d_inetaton
15020eval $inlibc
b4eb6b3d 15021
5086dff9
MB
15022: see if inet_ntop exists
15023set inet_ntop d_inetntop
15024eval $inlibc
15025
15026: see if inet_pton exists
15027set inet_pton d_inetpton
15028eval $inlibc
15029
b4eb6b3d
JH
15030: Look for isascii
15031echo " "
36adc09b 15032$cat >isascii.c <<EOCP
b4eb6b3d
JH
15033#include <stdio.h>
15034#include <ctype.h>
55954f19
JH
15035#$i_stdlib I_STDLIB
15036#ifdef I_STDLIB
15037#include <stdlib.h>
15038#endif
b4eb6b3d
JH
15039int main() {
15040 int c = 'A';
15041 if (isascii(c))
15042 exit(0);
15043 else
15044 exit(1);
15045}
15046EOCP
15047set isascii
15048if eval $compile; then
15049 echo "isascii() found." >&4
15050 val="$define"
15051else
15052 echo "isascii() NOT found." >&4
15053 val="$undef"
15054fi
15055set d_isascii
15056eval $setvar
15057$rm -f isascii*
15058
269a7913
MB
15059: Look for isblank
15060echo " "
15061$cat >isblank.c <<'EOCP'
15062#include <stdio.h>
15063#include <ctype.h>
15064int main() {
9f791ac6 15065 int c = ' ';
269a7913 15066 if (isblank(c))
1c6eef9a 15067 return 0 ;
269a7913 15068 else
1c6eef9a 15069 return 1 ;
269a7913
MB
15070}
15071EOCP
15072if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15073 echo "isblank() found." >&4
15074 val="$define"
15075else
15076 echo "isblank() NOT found." >&4
15077 val="$undef"
15078fi
15079set d_isblank
15080eval $setvar
15081$rm -f isblank*
15082
758a5d79
JH
15083: see if isfinite exists
15084set isfinite d_isfinite
15085eval $inlibc
15086
15087: see if isinf exists
15088set isinf d_isinf
15089eval $inlibc
15090
b4eb6b3d
JH
15091: see if isnan exists
15092set isnan d_isnan
15093eval $inlibc
15094
15095: see if isnanl exists
15096set isnanl d_isnanl
15097eval $inlibc
15098
15099: see if killpg exists
15100set killpg d_killpg
15101eval $inlibc
15102
15103: see if lchown exists
15104echo " "
15105$cat > try.c <<'EOCP'
15106/* System header to define __stub macros and hopefully few prototypes,
15107 which can conflict with char lchown(); below. */
15108#include <assert.h>
15109/* Override any gcc2 internal prototype to avoid an error. */
15110/* We use char because int might match the return type of a gcc2
15111 builtin and then its argument prototype would still apply. */
15112char lchown();
15113int main() {
15114 /* The GNU C library defines this for functions which it implements
15115 to always fail with ENOSYS. Some functions are actually named
15116 something starting with __ and the normal name is an alias. */
15117#if defined (__stub_lchown) || defined (__stub___lchown)
15118choke me
15119#else
15120lchown();
15121#endif
15122; return 0; }
15123EOCP
15124set try
15125if eval $compile; then
15126 $echo "lchown() found." >&4
15127 val="$define"
15128else
15129 $echo "lchown() NOT found." >&4
15130 val="$undef"
15131fi
15132set d_lchown
15133eval $setvar
15134
15135: See if number of significant digits in a double precision number is known
15136echo " "
15137$cat >ldbl_dig.c <<EOM
15138#$i_limits I_LIMITS
15139#$i_float I_FLOAT
15140#ifdef I_LIMITS
15141#include <limits.h>
15142#endif
15143#ifdef I_FLOAT
15144#include <float.h>
15145#endif
15146#ifdef LDBL_DIG
15147printf("Contains LDBL_DIG");
15148#endif
15149EOM
15150$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15151if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15152 echo "LDBL_DIG found." >&4
15153 val="$define"
15154else
15155 echo "LDBL_DIG NOT found." >&4
15156 val="$undef"
15157fi
15158$rm -f ldbl_dig.?
15159set d_ldbl_dig
15160eval $setvar
15161
0a0abfba
MB
15162: see if this is a math.h system
15163set math.h i_math
15164eval $inhdr
15165
613d6c3e 15166: check to see if math.h defines _LIB_VERSION
0a0abfba
MB
15167d_libm_lib_version="$undef"
15168case $i_math in
15169 $define)
0a0abfba
MB
15170 echo " "
15171 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15172 $cat >try.c <<EOCP
15173#include <unistd.h>
15174#include <math.h>
15175int main (int argc, char *argv[])
15176{
15177 printf ("%d\n", _LIB_VERSION);
15178 return (0);
15179 } /* main */
15180EOCP
15181 set try
15182 if eval $compile; then
15183 foo=`$run ./try`
15184 echo "Yes, it does ($foo)" >&4
15185 d_libm_lib_version="$define"
15186 else
4dd8f9b3 15187 echo "No, it does not (probably harmless)" >&4
0a0abfba 15188 fi
5b813a60 15189 $rm_try
0a0abfba
MB
15190 ;;
15191
15192 esac
15193
b4eb6b3d
JH
15194: see if link exists
15195set link d_link
15196eval $inlibc
15197
10bc17b6
JH
15198: see if localtime_r exists
15199set localtime_r d_localtime_r
15200eval $inlibc
15201case "$d_localtime_r" in
15202"$define")
d63eadf0 15203 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
15204 case "$d_localtime_r_proto:$usethreads" in
15205 ":define") d_localtime_r_proto=define
a48ec845
JH
15206 set d_localtime_r_proto localtime_r $hdrs
15207 eval $hasproto ;;
15208 *) ;;
15209 esac
15210 case "$d_localtime_r_proto" in
15211 define)
10bc17b6
JH
15212 case "$localtime_r_proto" in
15213 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
61c26d18 15214 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
10bc17b6
JH
15215 esac
15216 case "$localtime_r_proto" in
15217 ''|0) try='int localtime_r(const time_t*, struct tm*);'
61c26d18 15218 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
10bc17b6
JH
15219 esac
15220 case "$localtime_r_proto" in
90e831dc 15221 ''|0) d_localtime_r=undef
10bc17b6 15222 localtime_r_proto=0
a48ec845 15223 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15224 * ) case "$localtime_r_proto" in
15225 REENTRANT_PROTO*) ;;
15226 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15227 esac
15228 echo "Prototype: $try" ;;
15229 esac
15230 ;;
c18e646a
JH
15231 *) case "$usethreads" in
15232 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15233 esac
90e831dc
SB
15234 d_localtime_r=undef
15235 localtime_r_proto=0
c18e646a 15236 ;;
a48ec845
JH
15237 esac
15238 ;;
10bc17b6
JH
15239*) localtime_r_proto=0
15240 ;;
15241esac
15242
8572b25d
BH
15243: see if localtime_r calls tzset
15244case "$localtime_r_proto" in
15245REENTRANT_PROTO*)
15246 $cat >try.c <<EOCP
15247/* Does our libc's localtime_r call tzset ?
15248 * return 0 if so, 1 otherwise.
15249 */
61c26d18
MHM
15250#$i_systypes I_SYS_TYPES
15251#$i_unistd I_UNISTD
15252#$i_time I_TIME
15253#$i_stdlib I_STDLIB
15254#$i_string I_STRING
15255#$i_malloc I_MALLOC
15256#ifdef I_SYS_TYPES
15257# include <sys/types.h>
15258#endif
15259#ifdef I_UNISTD
15260# include <unistd.h>
15261#endif
15262#ifdef I_TIME
15263# include <time.h>
15264#endif
15265#ifdef I_STDLIB
15266#include <stdlib.h>
15267#endif
15268#ifdef I_STRING
15269# include <string.h>
15270#else
15271# include <strings.h>
15272#endif
15273#ifdef I_MALLOC
15274# include <malloc.h>
15275#endif
8572b25d
BH
15276int main()
15277{
15278 time_t t = time(0L);
15279 char w_tz[]="TZ" "=GMT+5",
15280 e_tz[]="TZ" "=GMT-5",
15281 *tz_e = (char*)malloc(16),
15282 *tz_w = (char*)malloc(16);
15283 struct tm tm_e, tm_w;
15284 memset(&tm_e,'\0',sizeof(struct tm));
15285 memset(&tm_w,'\0',sizeof(struct tm));
15286 strcpy(tz_e,e_tz);
15287 strcpy(tz_w,w_tz);
15288
15289 putenv(tz_e);
15290 localtime_r(&t, &tm_e);
15291
15292 putenv(tz_w);
15293 localtime_r(&t, &tm_w);
15294
15295 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15296 return 1;
15297 return 0;
15298}
15299EOCP
15300 set try
15301 if eval $compile; then
43dddb59 15302 if $run ./try; then
8572b25d
BH
15303 d_localtime_r_needs_tzset=undef;
15304 else
15305 d_localtime_r_needs_tzset=define;
15306 fi;
15307 else
15308 d_localtime_r_needs_tzset=undef;
15309 fi;
15310 ;;
15311 *)
15312 d_localtime_r_needs_tzset=undef;
15313 ;;
15314esac
5b813a60 15315$rm_try
8572b25d 15316
b4eb6b3d
JH
15317: see if localeconv exists
15318set localeconv d_locconv
15319eval $inlibc
15320
15321: see if lockf exists
15322set lockf d_lockf
15323eval $inlibc
15324
b4eb6b3d
JH
15325: see if prototype for lseek is available
15326echo " "
4786929f 15327set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
15328eval $hasproto
15329
15330: see if lstat exists
15331set lstat d_lstat
15332eval $inlibc
15333
15334: see if madvise exists
15335set madvise d_madvise
15336eval $inlibc
15337
7dd121ae
MB
15338: see if malloc_size exists
15339set malloc_size d_malloc_size
15340eval $inlibc
15341
15342: see if malloc_size_good exists
15343set malloc_good_size d_malloc_good_size
15344eval $inlibc
15345
b4eb6b3d
JH
15346: see if mblen exists
15347set mblen d_mblen
15348eval $inlibc
15349
15350: see if mbstowcs exists
15351set mbstowcs d_mbstowcs
15352eval $inlibc
15353
15354: see if mbtowc exists
15355set mbtowc d_mbtowc
15356eval $inlibc
15357
15358: see if memchr exists
15359set memchr d_memchr
15360eval $inlibc
15361
15362: see if memcmp exists
15363set memcmp d_memcmp
15364eval $inlibc
15365
15366: see if memcpy exists
15367set memcpy d_memcpy
15368eval $inlibc
15369
15370: see if memmove exists
15371set memmove d_memmove
15372eval $inlibc
15373
15374: see if memset exists
15375set memset d_memset
15376eval $inlibc
15377
15378: see if mkdir exists
15379set mkdir d_mkdir
15380eval $inlibc
15381
15382: see if mkdtemp exists
15383set mkdtemp d_mkdtemp
15384eval $inlibc
15385
15386: see if mkfifo exists
15387set mkfifo d_mkfifo
15388eval $inlibc
15389
15390: see if mkstemp exists
15391set mkstemp d_mkstemp
15392eval $inlibc
15393
15394: see if mkstemps exists
15395set mkstemps d_mkstemps
15396eval $inlibc
15397
15398: see if mktime exists
15399set mktime d_mktime
15400eval $inlibc
15401
15402: see if this is a sys/mman.h system
15403set sys/mman.h i_sysmman
15404eval $inhdr
15405
15406: see if mmap exists
15407set mmap d_mmap
15408eval $inlibc
15409: see what shmat returns
15410: default to something harmless
15411mmaptype='void *'
15412case "$i_sysmman$d_mmap" in
15413"$define$define")
15414 $cat >mmap.c <<'END'
15415#include <sys/mman.h>
15416void *mmap();
15417END
15418 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15419 mmaptype='void *'
15420 else
15421 mmaptype='caddr_t'
15422 fi
15423 echo "and it returns ($mmaptype)." >&4
15424 ;;
15425esac
15426
15427
15428
89ce900e
JH
15429: see if sqrtl exists
15430set sqrtl d_sqrtl
15431eval $inlibc
15432
af1ff193
JH
15433: see if scalbnl exists
15434set scalbnl d_scalbnl
15435eval $inlibc
15436
89ce900e
JH
15437: see if modfl exists
15438set modfl d_modfl
15439eval $inlibc
15440
15441: see if prototype for modfl is available
15442echo " "
3a794506 15443set d_modflproto modfl $i_math math.h
89ce900e
JH
15444eval $hasproto
15445
15446d_modfl_pow32_bug="$undef"
15447
15448case "$d_longdbl$d_modfl" in
15449$define$define)
15450 $cat <<EOM
15451Checking to see whether your modfl() is okay for large values...
15452EOM
15453$cat >try.c <<EOCP
5b813a60 15454#include <math.h>
89ce900e
JH
15455#include <stdio.h>
15456EOCP
15457if $test "X$d_modflproto" != "X$define"; then
15458 $cat >>try.c <<EOCP
5b813a60 15459/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
15460long double modfl (long double, long double *);
15461EOCP
15462fi
15463$cat >>try.c <<EOCP
15464int main() {
15465 long double nv = 4294967303.15;
15466 long double v, w;
5b813a60 15467 v = modfl(nv, &w);
89ce900e
JH
15468#ifdef __GLIBC__
15469 printf("glibc");
15470#endif
15471 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15472 return 0;
15473}
15474EOCP
15475 case "$osname:$gccversion" in
15476 aix:) saveccflags="$ccflags"
15477 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15478 esac
15479 set try
15480 if eval $compile; then
15481 foo=`$run ./try`
15482 case "$foo" in
15483 *" 4294967303.150000 1.150000 4294967302.000000")
15484 echo >&4 "Your modfl() is broken for large values."
15485 d_modfl_pow32_bug="$define"
15486 case "$foo" in
15487 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15488 ;;
15489 esac
15490 ;;
15491 *" 4294967303.150000 0.150000 4294967303.000000")
15492 echo >&4 "Your modfl() seems okay for large values."
15493 ;;
15494 *) echo >&4 "I don't understand your modfl() at all."
15495 d_modfl="$undef"
15496 ;;
15497 esac
5b813a60 15498 $rm_try
89ce900e
JH
15499 else
15500 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15501 d_modfl="$undef"
15502 fi
15503 case "$osname:$gccversion" in
15504 aix:) ccflags="$saveccflags" ;; # restore
15505 esac
15506 ;;
15507esac
15508
15509if $test "$uselongdouble" = "$define"; then
af1ff193
JH
15510 message=""
15511 if $test "$d_sqrtl" != "$define"; then
15512 message="$message sqrtl"
15513 fi
15514 if $test "$d_modfl" != "$define"; then
89ce900e
JH
15515 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15516 echo "You have both aintl and copysignl, so I can emulate modfl."
15517 else
af1ff193 15518 message="$message modfl"
89ce900e 15519 fi
af1ff193
JH
15520 fi
15521 if $test "$d_frexpl" != "$define"; then
15522 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15523 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15524 else
15525 message="$message frexpl"
15526 fi
15527 fi
89ce900e 15528
af1ff193 15529 if $test "$message" != ""; then
89ce900e
JH
15530 $cat <<EOM >&4
15531
15532*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15533*** the following mathematical functions needed for long double support:
15534*** $message
fe63a0b4
JH
15535*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15536*** Cannot continue, aborting.
89ce900e
JH
15537
15538EOM
15539
fe63a0b4 15540 exit 1
89ce900e
JH
15541 fi
15542fi
15543
b4eb6b3d
JH
15544: see if mprotect exists
15545set mprotect d_mprotect
15546eval $inlibc
15547
15548: see if msgctl exists
15549set msgctl d_msgctl
15550eval $inlibc
15551
15552: see if msgget exists
15553set msgget d_msgget
15554eval $inlibc
15555
15556: see if msgsnd exists
15557set msgsnd d_msgsnd
15558eval $inlibc
15559
15560: see if msgrcv exists
15561set msgrcv d_msgrcv
15562eval $inlibc
15563
15564: see how much of the 'msg*(2)' library is present.
15565h_msg=true
15566echo " "
15567case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15568*"$undef"*) h_msg=false;;
15569esac
15570case "$osname" in
15571freebsd)
15572 case "`ipcs 2>&1`" in
15573 "SVID messages"*"not configured"*)
15574 echo "Your $osname does not have the msg*(2) configured." >&4
15575 h_msg=false
15576 val="$undef"
15577 set msgctl d_msgctl
15578 eval $setvar
15579 set msgget d_msgget
15580 eval $setvar
15581 set msgsnd d_msgsnd
15582 eval $setvar
15583 set msgrcv d_msgrcv
15584 eval $setvar
15585 ;;
15586 esac
15587 ;;
15588esac
15589: we could also check for sys/ipc.h ...
15590if $h_msg && $test `./findhdr sys/msg.h`; then
15591 echo "You have the full msg*(2) library." >&4
15592 val="$define"
15593else
15594 echo "You don't have the full msg*(2) library." >&4
15595 val="$undef"
15596fi
15597set d_msg
15598eval $setvar
15599
34f1896b 15600: Check for msghdr_s
4e0554ec
JH
15601echo " "
15602echo "Checking to see if your system supports struct msghdr..." >&4
15603set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15604eval $hasstruct
15605case "$d_msghdr_s" in
15606"$define") echo "Yes, it does." ;;
15607*) echo "No, it doesn't." ;;
15608esac
15609
15610
b4eb6b3d
JH
15611: see if msync exists
15612set msync d_msync
15613eval $inlibc
15614
15615: see if munmap exists
15616set munmap d_munmap
15617eval $inlibc
15618
15619: see if nice exists
15620set nice d_nice
15621eval $inlibc
15622
2765b840
JH
15623: see if this is a langinfo.h system
15624set langinfo.h i_langinfo
15625eval $inhdr
15626
15627: see if nl_langinfo exists
15628set nl_langinfo d_nl_langinfo
15629eval $inlibc
15630
1d1be0dc
NC
15631: check for volatile keyword
15632echo " "
15633echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15634$cat >try.c <<'EOCP'
76f47787 15635int main()
1d1be0dc
NC
15636{
15637 typedef struct _goo_struct goo_struct;
15638 goo_struct * volatile goo = ((goo_struct *)0);
15639 struct _goo_struct {
15640 long long_int;
15641 int reg_int;
15642 char char_var;
15643 };
15644 typedef unsigned short foo_t;
15645 char *volatile foo;
15646 volatile int bar;
15647 volatile foo_t blech;
15648 foo = foo;
15649}
15650EOCP
15651if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15652 val="$define"
15653 echo "Yup, it does."
15654else
15655 val="$undef"
15656 echo "Nope, it doesn't."
15657fi
15658set d_volatile
15659eval $setvar
5b813a60 15660$rm_try
1d1be0dc 15661
613d6c3e 15662: Check basic sizes
b4eb6b3d
JH
15663echo " "
15664$echo "Choosing the C types to be used for Perl's internal types..." >&4
15665
15666case "$use64bitint:$d_quad:$quadtype" in
15667define:define:?*)
15668 ivtype="$quadtype"
15669 uvtype="$uquadtype"
15670 ivsize=8
15671 uvsize=8
15672 ;;
15673*) ivtype="long"
15674 uvtype="unsigned long"
15675 ivsize=$longsize
15676 uvsize=$longsize
15677 ;;
15678esac
15679
15680case "$uselongdouble:$d_longdbl" in
15681define:define)
15682 nvtype="long double"
15683 nvsize=$longdblsize
15684 ;;
15685*) nvtype=double
15686 nvsize=$doublesize
15687 ;;
15688esac
15689
15690$echo "(IV will be "$ivtype", $ivsize bytes)"
15691$echo "(UV will be "$uvtype", $uvsize bytes)"
15692$echo "(NV will be "$nvtype", $nvsize bytes)"
15693
15694$cat >try.c <<EOCP
15695#$i_inttypes I_INTTYPES
15696#ifdef I_INTTYPES
15697#include <inttypes.h>
15698#endif
15699#include <stdio.h>
15700int main() {
15701#ifdef INT8
15702 int8_t i = INT8_MAX;
15703 uint8_t u = UINT8_MAX;
15704 printf("int8_t\n");
15705#endif
15706#ifdef INT16
15707 int16_t i = INT16_MAX;
15708 uint16_t i = UINT16_MAX;
15709 printf("int16_t\n");
15710#endif
15711#ifdef INT32
15712 int32_t i = INT32_MAX;
15713 uint32_t u = UINT32_MAX;
15714 printf("int32_t\n");
15715#endif
15716}
15717EOCP
15718
13187456 15719i8type="signed char"
0ab0821a
MB
15720u8type="unsigned char"
15721i8size=1
15722u8size=1
b4eb6b3d
JH
15723
15724case "$i16type" in
15725'') case "$shortsize" in
15726 2) i16type=short
15727 u16type="unsigned short"
15728 i16size=$shortsize
15729 u16size=$shortsize
15730 ;;
15731 esac
15732 ;;
15733esac
15734case "$i16type" in
15735'') set try -DINT16
15736 if eval $compile; then
5440bc8e 15737 case "`$run ./try`" in
b4eb6b3d
JH
15738 int16_t)
15739 i16type=int16_t
15740 u16type=uint16_t
15741 i16size=2
15742 u16size=2
15743 ;;
15744 esac
15745 fi
15746 ;;
15747esac
15748case "$i16type" in
15749'') if $test $shortsize -ge 2; then
15750 i16type=short
15751 u16type="unsigned short"
15752 i16size=$shortsize
15753 u16size=$shortsize
15754 fi
15755 ;;
15756esac
15757
15758case "$i32type" in
15759'') case "$longsize" in
15760 4) i32type=long
15761 u32type="unsigned long"
15762 i32size=$longsize
15763 u32size=$longsize
15764 ;;
15765 *) case "$intsize" in
15766 4) i32type=int
15767 u32type="unsigned int"
15768 i32size=$intsize
15769 u32size=$intsize
15770 ;;
15771 esac
15772 ;;
15773 esac
15774 ;;
15775esac
15776case "$i32type" in
15777'') set try -DINT32
15778 if eval $compile; then
5440bc8e 15779 case "`$run ./try`" in
b4eb6b3d
JH
15780 int32_t)
15781 i32type=int32_t
15782 u32type=uint32_t
15783 i32size=4
15784 u32size=4
15785 ;;
15786 esac
15787 fi
15788 ;;
15789esac
15790case "$i32type" in
15791'') if $test $intsize -ge 4; then
15792 i32type=int
15793 u32type="unsigned int"
15794 i32size=$intsize
15795 u32size=$intsize
15796 fi
15797 ;;
15798esac
15799
15800case "$i64type" in
15801'') case "$d_quad:$quadtype" in
15802 define:?*)
15803 i64type="$quadtype"
15804 u64type="$uquadtype"
15805 i64size=8
15806 u64size=8
15807 ;;
15808 esac
15809 ;;
15810esac
15811
1d1be0dc
NC
15812$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15813: volatile so that the compiler has to store it out to memory.
15814if test X"$d_volatile" = X"$define"; then
15815 volatile=volatile
15816fi
b4eb6b3d
JH
15817$cat <<EOP >try.c
15818#include <stdio.h>
55954f19
JH
15819#$i_stdlib I_STDLIB
15820#ifdef I_STDLIB
15821#include <stdlib.h>
15822#endif
1d1be0dc
NC
15823#include <sys/types.h>
15824#include <signal.h>
15825#ifdef SIGFPE
15826$volatile int bletched = 0;
7090f861 15827$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15828#endif
b4eb6b3d
JH
15829int main() {
15830 $uvtype u = 0;
1d1be0dc 15831 $nvtype d;
b4eb6b3d
JH
15832 int n = 8 * $uvsize;
15833 int i;
1d1be0dc
NC
15834#ifdef SIGFPE
15835 signal(SIGFPE, blech);
15836#endif
15837
b4eb6b3d
JH
15838 for (i = 0; i < n; i++) {
15839 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15840 d = ($nvtype)u;
15841 if (($uvtype)d != u)
b4eb6b3d 15842 break;
1d1be0dc
NC
15843 if (d <= 0)
15844 break;
15845 d = ($nvtype)(u - 1);
15846 if (($uvtype)d != (u - 1))
15847 break;
15848#ifdef SIGFPE
22676560 15849 if (bletched)
1d1be0dc
NC
15850 break;
15851#endif
b4eb6b3d 15852 }
efd1522b 15853 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15854 exit(0);
15855}
15856EOP
1d1be0dc
NC
15857set try
15858
15859d_nv_preserves_uv="$undef"
15860if eval $compile; then
53133ed1 15861 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15862fi
53133ed1 15863case "$nv_preserves_uv_bits" in
5b813a60 15864\-[1-9]*)
53133ed1
NC
15865 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15866 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15867 d_nv_preserves_uv="$define"
b4eb6b3d 15868 ;;
53133ed1 15869[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15870 d_nv_preserves_uv="$undef" ;;
15871*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15872 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15873esac
5b813a60 15874$rm_try
1d1be0dc 15875
b68c599a
NC
15876$echo "Checking to find the largest integer value your NVs can hold..." >&4
15877: volatile so that the compiler has to store it out to memory.
15878if test X"$d_volatile" = X"$define"; then
15879 volatile=volatile
15880fi
15881$cat <<EOP >try.c
15882#include <stdio.h>
15883
15884typedef $nvtype NV;
15885
15886int
15887main() {
15888 NV value = 2;
15889 int count = 1;
15890
15891 while(count < 256) {
15892 $volatile NV up = value + 1.0;
15893 $volatile NV negated = -value;
15894 $volatile NV down = negated - 1.0;
15895 $volatile NV got_up = up - value;
15896 int up_good = got_up == 1.0;
15897 int got_down = down - negated;
15898 int down_good = got_down == -1.0;
15899
15900 if (down_good != up_good) {
15901 fprintf(stderr,
15902 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15903 up_good, (double) got_up, down_good, (double) got_down,
15904 count, (double) value);
15905 return 1;
15906 }
15907 if (!up_good) {
15908 while (1) {
15909 if (count > 8) {
15910 count -= 8;
15911 fputs("256.0", stdout);
15912 } else {
15913 count--;
15914 fputs("2.0", stdout);
15915 }
15916 if (!count) {
15917 puts("");
15918 return 0;
15919 }
15920 fputs("*", stdout);
15921 }
15922 }
15923 value *= 2;
15924 ++count;
15925 }
15926 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15927 count, (double) value);
15928 return 1;
15929}
15930EOP
15931set try
15932
15933nv_overflows_integers_at='0'
15934if eval $compile; then
15935 xxx="`$run ./try`"
15936 case "$?" in
15937 0)
15938 case "$xxx" in
15939 2*) cat >&4 <<EOM
15940The largest integer your NVs can preserve is equal to $xxx
15941EOM
15942 nv_overflows_integers_at="$xxx"
15943 ;;
15944 *) cat >&4 <<EOM
15945Cannot determine the largest integer value your NVs can hold, unexpected output
15946'$xxx'
15947EOM
15948 ;;
15949 esac
15950 ;;
15951 *) cat >&4 <<EOM
15952Cannot determine the largest integer value your NVs can hold
15953EOM
15954 ;;
15955 esac
15956fi
15957$rm_try
15958
f607920a
CB
15959$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15960: volatile so that the compiler has to store it out to memory.
15961if test X"$d_volatile" = X"$define"; then
15962 volatile=volatile
15963fi
15964$cat <<EOP >try.c
15965#include <stdio.h>
15966#$i_stdlib I_STDLIB
15967#ifdef I_STDLIB
15968#include <stdlib.h>
15969#endif
15970#$i_string I_STRING
15971#ifdef I_STRING
15972# include <string.h>
15973#else
15974# include <strings.h>
15975#endif
15976#include <sys/types.h>
15977#include <signal.h>
15978#ifdef SIGFPE
15979$volatile int bletched = 0;
7090f861 15980$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15981#endif
15982
15983int checkit($nvtype d, char *where) {
15984 unsigned char *p = (char *)&d;
15985 unsigned char *end = p + sizeof(d);
15986 int fail = 0;
15987
15988 while (p < end)
15989 fail += *p++;
15990
15991 if (!fail)
17f6277d 15992 return 0;
f607920a
CB
15993
15994 p = (char *)&d;
15995 printf("No - %s: 0x", where);
15996 while (p < end)
15997 printf ("%02X", *p++);
15998 printf("\n");
15999 return 1;
16000}
16001
16002int main(int argc, char **argv) {
16003 $nvtype d = 0.0;
16004 int fail = 0;
16005 fail += checkit(d, "0.0");
16006
16007 /* The compiler shouldn't be assuming that bletched is 0 */
16008 d = bletched;
16009
16010 fail += checkit(d, "bleched");
16011
16012#ifdef SIGFPE
16013 signal(SIGFPE, blech);
16014#endif
16015
16016 /* Paranoia - the compiler should have no way of knowing that ANSI says
16017 that argv[argc] will always be NULL. Actually, if it did assume this it
16018 would be buggy, as this is C and main() can be called from elsewhere in
16019 the program. */
16020 d = argv[argc] ? 1 : 0;
16021
16022 if (d) {
16023 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16024 }
16025
16026 fail += checkit(d, "ternary");
16027
16028 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16029
16030 if (d != 0.0) {
16031 printf("No - memset doesn't give 0.0\n");
16032 /* This might just blow up: */
16033 printf("(gives %g)\n", d);
16034 return 1;
16035 }
5b813a60 16036
f607920a
CB
16037#ifdef SIGFPE
16038 if (bletched) {
16039 printf("No - something bleched\n");
16040 return 1;
16041 }
16042#endif
16043 if (fail) {
16044 printf("No - %d fail(s)\n", fail);
16045 return 1;
16046 }
16047 printf("Yes\n");
16048 return 0;
16049}
16050EOP
16051set try
16052
16053d_nv_zero_is_allbits_zero="$undef"
16054if eval $compile; then
16055 xxx="`$run ./try`"
16056 case "$?" in
16057 0)
16058 case "$xxx" in
16059 Yes) cat >&4 <<EOM
160600.0 is represented as all bits zero in memory
16061EOM
16062 d_nv_zero_is_allbits_zero="$define"
16063 ;;
16064 *) cat >&4 <<EOM
160650.0 is not represented as all bits zero in memory
16066EOM
16067 d_nv_zero_is_allbits_zero="$undef"
16068 ;;
16069 esac
16070 ;;
16071 *) cat >&4 <<EOM
160720.0 is not represented as all bits zero in memory
16073EOM
16074 d_nv_zero_is_allbits_zero="$undef"
16075 ;;
16076 esac
16077fi
5b813a60 16078$rm_try
b4eb6b3d
JH
16079
16080: check for off64_t
16081echo " "
16082echo "Checking to see if you have off64_t..." >&4
16083$cat >try.c <<EOCP
16084#include <sys/types.h>
16085#include <unistd.h>
16086int main() { off64_t x = 7; }
16087EOCP
16088set try
16089if eval $compile; then
16090 val="$define"
16091 echo "You have off64_t."
16092else
16093 val="$undef"
16094 echo "You do not have off64_t."
16095 case "$lseeksize" in
16096 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16097 esac
16098fi
5b813a60 16099$rm_try
b4eb6b3d
JH
16100set d_off64_t
16101eval $setvar
16102
b4eb6b3d
JH
16103: how to create joinable pthreads
16104if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16105 echo " "
5b813a60 16106 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
16107 $cat >try.c <<'EOCP'
16108#include <pthread.h>
16109int main() {
16110 int detachstate = JOINABLE;
16111}
16112EOCP
16113 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16114 if eval $compile; then
16115 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16116 val="$undef" # Yes, undef.
16117 set d_old_pthread_create_joinable
16118 eval $setvar
16119 val=""
16120 set old_pthread_create_joinable
16121 eval $setvar
16122 else
16123 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16124 if eval $compile; then
16125 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16126 val="$define"
16127 set d_old_pthread_create_joinable
16128 eval $setvar
16129 val=PTHREAD_CREATE_UNDETACHED
16130 set old_pthread_create_joinable
16131 eval $setvar
5b813a60 16132 else
b4eb6b3d
JH
16133 set try -DJOINABLE=__UNDETACHED
16134 if eval $compile; then
16135 echo "You seem to use __UNDETACHED." >&4
16136 val="$define"
16137 set d_old_pthread_create_joinable
16138 eval $setvar
16139 val=__UNDETACHED
16140 set old_pthread_create_joinable
16141 eval $setvar
16142 else
16143 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
16144 val="$define"
16145 set d_old_pthread_create_joinable
16146 eval $setvar
16147 val=0
16148 set old_pthread_create_joinable
16149 eval $setvar
16150 fi
16151 fi
16152 fi
5b813a60 16153 $rm_try
b4eb6b3d
JH
16154else
16155 d_old_pthread_create_joinable="$undef"
16156 old_pthread_create_joinable=""
16157fi
16158
16159: see if pause exists
16160set pause d_pause
16161eval $inlibc
16162
b4eb6b3d
JH
16163: see if poll exists
16164set poll d_poll
16165eval $inlibc
16166
c796e3db
MB
16167: see if prctl exists
16168set prctl d_prctl
16169eval $inlibc
16170
16171: see if prctl supports PR_SET_NAME
16172d_prctl_set_name=$undef
16173case $d_prctl in
16174 $define)
16175 $cat >try.c <<EOM
16176#include <sys/prctl.h>
16177
16178int main (int argc, char *argv[])
16179{
16180 return (prctl (PR_SET_NAME, "Test"));
16181 } /* main */
16182EOM
16183 set try
16184 if eval $compile_ok && $run ./try; then
16185 echo "Your prctl (PR_SET_NAME, ...) works"
16186 d_prctl_set_name=$define
16187 fi
16188 $rm_try
16189 ;;
16190 esac
16191
c7aff470
NIS
16192: see if readlink exists
16193set readlink d_readlink
16194eval $inlibc
16195
613d6c3e 16196: Check if exe is symlink to abs path of executing program
c7aff470 16197echo " "
f24dbf84 16198procselfexe=''
c7aff470 16199val="$undef"
a33c94aa 16200case "$d_readlink" in
698ca84c 16201 "$define")
9e68546f
NC
16202 : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16203 : more tidy to avoid an extra level of symlink
16204 set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
698ca84c
NC
16205 while test $# -gt 0; do
16206 type=$1; try=$2
16207 shift; shift
16208 if $issymlink $try; then
16209 $ls -l $try > reflect
f24dbf84 16210 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
698ca84c
NC
16211 echo "You have $type-like $try."
16212 procselfexe='"'$try'"'
16213 val="$define"
16214 : This will break out of the loop
16215 set X; shift
c7aff470 16216 fi
698ca84c
NC
16217 fi
16218 done
a33c94aa
JH
16219 ;;
16220esac
428dc699 16221$rm -f reflect
c7aff470
NIS
16222set d_procselfexe
16223eval $setvar
16224
233e16ce
MB
16225: backward compatibility for d_hvfork
16226if test X$d_hvfork != X; then
16227 d_vfork="$d_hvfork"
16228 d_hvfork=''
16229fi
16230: see if there is a vfork
16231val=''
16232set vfork val
16233eval $inlibc
16234
16235d_pseudofork=$undef
16236
16237: Ok, but do we want to use it. vfork is reportedly unreliable in
16238: perl on Solaris 2.x, and probably elsewhere.
16239case "$val" in
16240$define)
16241 echo " "
16242 case "$usevfork" in
16243 false) dflt='n';;
16244 *) dflt='y';;
16245 esac
16246 cat <<'EOM'
16247
16248Perl can only use a vfork() that doesn't suffer from strict
16249restrictions on calling functions or modifying global data in
16250the child. For example, glibc-2.1 contains such a vfork()
16251that is unsuitable. If your system provides a proper fork()
16252call, chances are that you do NOT want perl to use vfork().
16253
16254EOM
16255 rp="Do you still want to use vfork()?"
16256 . ./myread
16257 case "$ans" in
16258 y|Y) ;;
16259 *)
16260 echo "Ok, we won't use vfork()."
16261 val="$undef"
16262 ;;
16263 esac
16264 ;;
16265esac
16266set d_vfork
16267eval $setvar
16268case "$d_vfork" in
16269$define) usevfork='true';;
16270*) usevfork='false';;
16271esac
16272
263fee3f
JH
16273: see whether the pthread_atfork exists
16274$cat >try.c <<EOP
16275#include <pthread.h>
16276#include <stdio.h>
16277int main() {
16278#ifdef PTHREAD_ATFORK
16279 pthread_atfork(NULL,NULL,NULL);
16280#endif
16281}
16282EOP
16283
d6483fcc 16284: see if pthread_atfork exists
263fee3f
JH
16285set try -DPTHREAD_ATFORK
16286if eval $compile; then
16287 val="$define"
16288else
16289 val="$undef"
16290fi
16291case "$usethreads" in
16292$define)
16293 case "$val" in
16294 $define) echo 'pthread_atfork found.' >&4 ;;
16295 *) echo 'pthread_atfork NOT found.' >&4 ;;
16296 esac
16297esac
16298set d_pthread_atfork
16299eval $setvar
d6483fcc 16300
58d975c3
JH
16301: see if pthread_attr_setscope exists
16302set pthread_attr_setscope d_pthread_attr_setscope
16303eval $inlibc
16304
b4eb6b3d
JH
16305: see whether the various POSIXish _yields exist
16306$cat >try.c <<EOP
16307#include <pthread.h>
16308#include <stdio.h>
16309int main() {
16310#ifdef SCHED_YIELD
16311 sched_yield();
16312#else
16313#ifdef PTHREAD_YIELD
16314 pthread_yield();
16315#else
16316#ifdef PTHREAD_YIELD_NULL
16317 pthread_yield(NULL);
16318#endif
16319#endif
16320#endif
16321}
16322EOP
16323: see if sched_yield exists
16324set try -DSCHED_YIELD
16325if eval $compile; then
16326 val="$define"
16327 sched_yield='sched_yield()'
16328else
16329 val="$undef"
16330fi
16331case "$usethreads" in
16332$define)
16333 case "$val" in
16334 $define) echo 'sched_yield() found.' >&4 ;;
16335 *) echo 'sched_yield() NOT found.' >&4 ;;
16336 esac
16337esac
10bc17b6
JH
16338set d_sched_yield
16339eval $setvar
b4eb6b3d 16340
10bc17b6
JH
16341: see if pthread_yield exists
16342set try -DPTHREAD_YIELD
16343if eval $compile; then
16344 val="$define"
16345 case "$sched_yield" in
16346 '') sched_yield='pthread_yield()' ;;
16347 esac
16348else
16349 set try -DPTHREAD_YIELD_NULL
16350 if eval $compile; then
16351 val="$define"
16352 case "$sched_yield" in
16353 '') sched_yield='pthread_yield(NULL)' ;;
16354 esac
16355 else
16356 val="$undef"
16357 fi
16358fi
16359case "$usethreads" in
16360$define)
16361 case "$val" in
16362 $define) echo 'pthread_yield() found.' >&4 ;;
16363 *) echo 'pthread_yield() NOT found.' >&4 ;;
16364 esac
16365 ;;
16366esac
16367set d_pthread_yield
16368eval $setvar
10bc17b6
JH
16369case "$sched_yield" in
16370'') sched_yield=undef ;;
16371esac
5b813a60 16372$rm_try
10bc17b6
JH
16373
16374: see if random_r exists
16375set random_r d_random_r
16376eval $inlibc
16377case "$d_random_r" in
16378"$define")
16379 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16380 case "$d_random_r_proto:$usethreads" in
16381 ":define") d_random_r_proto=define
a48ec845
JH
16382 set d_random_r_proto random_r $hdrs
16383 eval $hasproto ;;
16384 *) ;;
16385 esac
16386 case "$d_random_r_proto" in
16387 define)
10bc17b6
JH
16388 case "$random_r_proto" in
16389 ''|0) try='int random_r(int*, struct random_data*);'
61c26d18 16390 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
a845a0d4
JH
16391 esac
16392 case "$random_r_proto" in
16393 ''|0) try='int random_r(long*, struct random_data*);'
61c26d18 16394 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
a845a0d4
JH
16395 esac
16396 case "$random_r_proto" in
16397 ''|0) try='int random_r(struct random_data*, int32_t*);'
61c26d18 16398 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
16399 esac
16400 case "$random_r_proto" in
90e831dc 16401 ''|0) d_random_r=undef
10bc17b6 16402 random_r_proto=0
a48ec845 16403 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16404 * ) case "$random_r_proto" in
16405 REENTRANT_PROTO*) ;;
16406 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16407 esac
16408 echo "Prototype: $try" ;;
16409 esac
b4eb6b3d 16410 ;;
c18e646a
JH
16411 *) case "$usethreads" in
16412 define) echo "random_r has no prototype, not using it." >&4 ;;
16413 esac
90e831dc
SB
16414 d_random_r=undef
16415 random_r_proto=0
c18e646a 16416 ;;
a48ec845
JH
16417 esac
16418 ;;
10bc17b6 16419*) random_r_proto=0
b4eb6b3d
JH
16420 ;;
16421esac
16422
16423: see if readdir and friends exist
16424set readdir d_readdir
16425eval $inlibc
16426set seekdir d_seekdir
16427eval $inlibc
16428set telldir d_telldir
16429eval $inlibc
16430set rewinddir d_rewinddir
16431eval $inlibc
16432
10bc17b6
JH
16433: see if readdir64_r exists
16434set readdir64_r d_readdir64_r
16435eval $inlibc
16436case "$d_readdir64_r" in
16437"$define")
16438 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16439 case "$d_readdir64_r_proto:$usethreads" in
16440 ":define") d_readdir64_r_proto=define
a48ec845
JH
16441 set d_readdir64_r_proto readdir64_r $hdrs
16442 eval $hasproto ;;
16443 *) ;;
16444 esac
16445 case "$d_readdir64_r_proto" in
16446 define)
10bc17b6
JH
16447 case "$readdir64_r_proto" in
16448 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
61c26d18 16449 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
10bc17b6
JH
16450 esac
16451 case "$readdir64_r_proto" in
16452 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
61c26d18 16453 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
10bc17b6
JH
16454 esac
16455 case "$readdir64_r_proto" in
90e831dc 16456 ''|0) d_readdir64_r=undef
10bc17b6 16457 readdir64_r_proto=0
a48ec845 16458 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16459 * ) case "$readdir64_r_proto" in
16460 REENTRANT_PROTO*) ;;
16461 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16462 esac
16463 echo "Prototype: $try" ;;
16464 esac
16465 ;;
c18e646a
JH
16466 *) case "$usethreads" in
16467 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16468 esac
90e831dc
SB
16469 d_readdir64_r=undef
16470 readdir64_r_proto=0
c18e646a 16471 ;;
a48ec845
JH
16472 esac
16473 ;;
10bc17b6
JH
16474*) readdir64_r_proto=0
16475 ;;
16476esac
16477
16478: see if readdir_r exists
16479set readdir_r d_readdir_r
16480eval $inlibc
16481case "$d_readdir_r" in
16482"$define")
16483 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16484 case "$d_readdir_r_proto:$usethreads" in
16485 ":define") d_readdir_r_proto=define
a48ec845
JH
16486 set d_readdir_r_proto readdir_r $hdrs
16487 eval $hasproto ;;
16488 *) ;;
16489 esac
16490 case "$d_readdir_r_proto" in
16491 define)
10bc17b6
JH
16492 case "$readdir_r_proto" in
16493 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
61c26d18 16494 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
10bc17b6
JH
16495 esac
16496 case "$readdir_r_proto" in
16497 ''|0) try='int readdir_r(DIR*, struct dirent*);'
61c26d18 16498 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
10bc17b6
JH
16499 esac
16500 case "$readdir_r_proto" in
90e831dc 16501 ''|0) d_readdir_r=undef
10bc17b6 16502 readdir_r_proto=0
a48ec845 16503 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16504 * ) case "$readdir_r_proto" in
16505 REENTRANT_PROTO*) ;;
16506 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16507 esac
16508 echo "Prototype: $try" ;;
16509 esac
16510 ;;
c18e646a
JH
16511 *) case "$usethreads" in
16512 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16513 esac
90e831dc
SB
16514 d_readdir_r=undef
16515 readdir_r_proto=0
c18e646a 16516 ;;
a48ec845
JH
16517 esac
16518 ;;
10bc17b6
JH
16519*) readdir_r_proto=0
16520 ;;
16521esac
16522
4e0554ec
JH
16523: see if readv exists
16524set readv d_readv
16525eval $inlibc
16526
16527: see if recvmsg exists
16528set recvmsg d_recvmsg
16529eval $inlibc
16530
b4eb6b3d
JH
16531: see if rename exists
16532set rename d_rename
16533eval $inlibc
16534
16535: see if rmdir exists
16536set rmdir d_rmdir
16537eval $inlibc
16538
16539: see if memory.h is available.
16540val=''
16541set memory.h val
16542eval $inhdr
16543
16544: See if it conflicts with string.h
16545case "$val" in
16546$define)
16547 case "$strings" in
16548 '') ;;
16549 *)
16550 $cppstdin $cppflags $cppminus < $strings > mem.h
16551 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16552 echo " "
16553 echo "We won't be including <memory.h>."
16554 val="$undef"
16555 fi
16556 $rm -f mem.h
16557 ;;
16558 esac
16559esac
16560set i_memory
16561eval $setvar
16562
16563: can bcopy handle overlapping blocks?
b6cc3bc4 16564echo " "
b4eb6b3d 16565val="$undef"
b6cc3bc4
AD
16566case "$d_memmove" in
16567"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16568*) case "$d_bcopy" in
16569 "$define")
16570 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16571 $cat >try.c <<EOCP
b4eb6b3d
JH
16572#$i_memory I_MEMORY
16573#$i_stdlib I_STDLIB
16574#$i_string I_STRING
16575#$i_unistd I_UNISTD
16576EOCP
16577 $cat >>try.c <<'EOCP'
16578#include <stdio.h>
16579#ifdef I_MEMORY
16580# include <memory.h>
16581#endif
16582#ifdef I_STDLIB
16583# include <stdlib.h>
16584#endif
16585#ifdef I_STRING
16586# include <string.h>
16587#else
16588# include <strings.h>
16589#endif
16590#ifdef I_UNISTD
16591# include <unistd.h> /* Needed for NetBSD */
16592#endif
16593int main()
16594{
16595char buf[128], abc[128];
16596char *b;
16597int len;
16598int off;
16599int align;
16600
b6cc3bc4
AD
16601/* Copy "abcde..." string to char abc[] so that gcc doesn't
16602 try to store the string in read-only memory. */
b4eb6b3d
JH
16603bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16604
16605for (align = 7; align >= 0; align--) {
16606 for (len = 36; len; len--) {
16607 b = buf+align;
16608 bcopy(abc, b, len);
16609 for (off = 1; off <= len; off++) {
16610 bcopy(b, b+off, len);
16611 bcopy(b+off, b, len);
16612 if (bcmp(b, abc, len))
16613 exit(1);
16614 }
16615 }
16616}
16617exit(0);
16618}
16619EOCP
b6cc3bc4
AD
16620 set try
16621 if eval $compile_ok; then
43dddb59 16622 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16623 echo "Yes, it can."
16624 val="$define"
16625 else
16626 echo "It can't, sorry."
16627 fi
b4eb6b3d 16628 else
b6cc3bc4 16629 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16630 fi
b6cc3bc4
AD
16631 ;;
16632 esac
5b813a60 16633 $rm_try
b4eb6b3d
JH
16634 ;;
16635esac
b4eb6b3d
JH
16636set d_safebcpy
16637eval $setvar
16638
16639: can memcpy handle overlapping blocks?
b6cc3bc4 16640echo " "
b4eb6b3d 16641val="$undef"
b6cc3bc4
AD
16642case "$d_memmove" in
16643"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16644*) case "$d_memcpy" in
16645 "$define")
16646 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16647 $cat >try.c <<EOCP
b4eb6b3d
JH
16648#$i_memory I_MEMORY
16649#$i_stdlib I_STDLIB
16650#$i_string I_STRING
16651#$i_unistd I_UNISTD
16652EOCP
16653 $cat >>try.c <<'EOCP'
16654#include <stdio.h>
16655#ifdef I_MEMORY
16656# include <memory.h>
16657#endif
16658#ifdef I_STDLIB
16659# include <stdlib.h>
16660#endif
16661#ifdef I_STRING
16662# include <string.h>
16663#else
16664# include <strings.h>
16665#endif
16666#ifdef I_UNISTD
16667# include <unistd.h> /* Needed for NetBSD */
16668#endif
16669int main()
16670{
16671char buf[128], abc[128];
16672char *b;
16673int len;
16674int off;
16675int align;
16676
16677/* Copy "abcde..." string to char abc[] so that gcc doesn't
16678 try to store the string in read-only memory. */
16679memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16680
16681for (align = 7; align >= 0; align--) {
16682 for (len = 36; len; len--) {
16683 b = buf+align;
16684 memcpy(b, abc, len);
16685 for (off = 1; off <= len; off++) {
16686 memcpy(b+off, b, len);
16687 memcpy(b, b+off, len);
16688 if (memcmp(b, abc, len))
16689 exit(1);
16690 }
16691 }
16692}
16693exit(0);
16694}
16695EOCP
b6cc3bc4
AD
16696 set try
16697 if eval $compile_ok; then
43dddb59 16698 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16699 echo "Yes, it can."
16700 val="$define"
16701 else
16702 echo "It can't, sorry."
16703 fi
b4eb6b3d 16704 else
b6cc3bc4 16705 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16706 fi
b6cc3bc4
AD
16707 ;;
16708 esac
5b813a60 16709 $rm_try
b4eb6b3d
JH
16710 ;;
16711esac
b4eb6b3d
JH
16712set d_safemcpy
16713eval $setvar
16714
16715: can memcmp be trusted to compare relative magnitude?
16716val="$undef"
16717case "$d_memcmp" in
16718"$define")
16719 echo " "
16720 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16721 $cat >try.c <<EOCP
16722#$i_memory I_MEMORY
16723#$i_stdlib I_STDLIB
16724#$i_string I_STRING
16725#$i_unistd I_UNISTD
16726EOCP
16727 $cat >>try.c <<'EOCP'
16728#include <stdio.h>
16729#ifdef I_MEMORY
16730# include <memory.h>
16731#endif
16732#ifdef I_STDLIB
36adc09b 16733# include <stdlib.h>
b4eb6b3d
JH
16734#endif
16735#ifdef I_STRING
16736# include <string.h>
16737#else
16738# include <strings.h>
16739#endif
16740#ifdef I_UNISTD
16741# include <unistd.h> /* Needed for NetBSD */
16742#endif
16743int main()
16744{
16745char a = -1;
16746char b = 0;
16747if ((a < b) && memcmp(&a, &b, 1) < 0)
16748 exit(1);
16749exit(0);
16750}
16751EOCP
16752 set try
16753 if eval $compile_ok; then
5440bc8e 16754 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16755 echo "Yes, it can."
16756 val="$define"
16757 else
16758 echo "No, it can't (it uses signed chars)."
16759 fi
16760 else
16761 echo "(I can't compile the test program, so we'll assume not...)"
16762 fi
16763 ;;
16764esac
5b813a60 16765$rm_try
b4eb6b3d
JH
16766set d_sanemcmp
16767eval $setvar
16768
ef9f17be
JH
16769: see if prototype for sbrk is available
16770echo " "
16771set d_sbrkproto sbrk $i_unistd unistd.h
16772eval $hasproto
16773
b4eb6b3d
JH
16774: see if select exists
16775set select d_select
16776eval $inlibc
16777
16778: see if semctl exists
16779set semctl d_semctl
16780eval $inlibc
16781
16782: see if semget exists
16783set semget d_semget
16784eval $inlibc
16785
16786: see if semop exists
16787set semop d_semop
16788eval $inlibc
16789
16790: see how much of the 'sem*(2)' library is present.
16791h_sem=true
16792echo " "
16793case "$d_semctl$d_semget$d_semop" in
16794*"$undef"*) h_sem=false;;
16795esac
16796case "$osname" in
16797freebsd)
16798 case "`ipcs 2>&1`" in
16799 "SVID messages"*"not configured"*)
16800 echo "Your $osname does not have the sem*(2) configured." >&4
16801 h_sem=false
16802 val="$undef"
16803 set semctl d_semctl
16804 eval $setvar
16805 set semget d_semget
16806 eval $setvar
16807 set semop d_semop
16808 eval $setvar
16809 ;;
16810 esac
16811 ;;
16812esac
16813: we could also check for sys/ipc.h ...
16814if $h_sem && $test `./findhdr sys/sem.h`; then
16815 echo "You have the full sem*(2) library." >&4
16816 val="$define"
16817else
16818 echo "You don't have the full sem*(2) library." >&4
16819 val="$undef"
16820fi
16821set d_sem
16822eval $setvar
16823
16824: see whether sys/sem.h defines union semun
16825echo " "
16826$cat > try.c <<'END'
16827#include <sys/types.h>
16828#include <sys/ipc.h>
16829#include <sys/sem.h>
16830int main () { union semun semun; semun.buf = 0; }
16831END
16832set try
16833if eval $compile; then
16834 echo "You have union semun in <sys/sem.h>." >&4
16835 val="$define"
16836else
16837 echo "You do not have union semun in <sys/sem.h>." >&4
16838 val="$undef"
16839fi
5b813a60 16840$rm_try
b4eb6b3d
JH
16841set d_union_semun
16842eval $setvar
16843
16844: see how to do semctl IPC_STAT
16845case "$d_sem" in
16846$define)
b4eb6b3d 16847 echo " "
93451a0d 16848 $cat > tryh.h <<END
b4eb6b3d
JH
16849#ifndef S_IRUSR
16850# ifdef S_IREAD
16851# define S_IRUSR S_IREAD
16852# define S_IWUSR S_IWRITE
16853# define S_IXUSR S_IEXEC
16854# else
16855# define S_IRUSR 0400
16856# define S_IWUSR 0200
16857# define S_IXUSR 0100
16858# endif
16859# define S_IRGRP (S_IRUSR>>3)
16860# define S_IWGRP (S_IWUSR>>3)
16861# define S_IXGRP (S_IXUSR>>3)
16862# define S_IROTH (S_IRUSR>>6)
16863# define S_IWOTH (S_IWUSR>>6)
16864# define S_IXOTH (S_IXUSR>>6)
16865#endif
16866#ifndef S_IRWXU
16867# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16868# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16869# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16870#endif
16871END
2fad75a1 16872 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16873 case "$d_semctl_semun" in
16874 '')
35918792 16875 val="$undef"
2fad75a1 16876 $cat > try.c <<END
b4eb6b3d
JH
16877#include <sys/types.h>
16878#include <sys/ipc.h>
16879#include <sys/sem.h>
16880#include <sys/stat.h>
16881#include <stdio.h>
16882#include <errno.h>
93451a0d 16883#include "tryh.h"
b4eb6b3d
JH
16884#ifndef errno
16885extern int errno;
16886#endif
16887#$d_union_semun HAS_UNION_SEMUN
16888int main() {
16889 union semun
16890#ifndef HAS_UNION_SEMUN
16891 {
16892 int val;
16893 struct semid_ds *buf;
16894 unsigned short *array;
16895 }
16896#endif
16897 arg;
16898 int sem, st;
16899
16900#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16901 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16902 if (sem > -1) {
16903 struct semid_ds argbuf;
16904 arg.buf = &argbuf;
16905# ifdef IPC_STAT
16906 st = semctl(sem, 0, IPC_STAT, arg);
16907 if (st == 0)
16908 printf("semun\n");
16909 else
16910# endif /* IPC_STAT */
16911 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16912# ifdef IPC_RMID
16913 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16914# endif /* IPC_RMID */
b4eb6b3d
JH
16915 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16916 } else
16917#endif /* IPC_PRIVATE && ... */
16918 printf("semget failed: errno = %d\n", errno);
16919 return 0;
16920}
16921END
2fad75a1
JH
16922 set try
16923 if eval $compile; then
16924 xxx=`$run ./try`
16925 case "$xxx" in
16926 semun) val="$define" ;;
16927 esac
16928 fi
5b813a60 16929 $rm_try
35918792
YST
16930 set d_semctl_semun
16931 eval $setvar
2fad75a1
JH
16932 ;;
16933 esac
b4eb6b3d
JH
16934 case "$d_semctl_semun" in
16935 $define)
16936 echo "You can use union semun for semctl IPC_STAT." >&4
16937 also='also'
16938 ;;
16939 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16940 also=''
16941 ;;
16942 esac
16943
16944 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16945 case "$d_semctl_semid_ds" in
16946 '')
35918792 16947 val="$undef"
2fad75a1 16948 $cat > try.c <<'END'
b4eb6b3d
JH
16949#include <sys/types.h>
16950#include <sys/ipc.h>
16951#include <sys/sem.h>
16952#include <sys/stat.h>
93451a0d 16953#include "tryh.h"
b4eb6b3d
JH
16954#include <stdio.h>
16955#include <errno.h>
16956#ifndef errno
16957extern int errno;
16958#endif
16959int main() {
16960 struct semid_ds arg;
16961 int sem, st;
16962
16963#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16964 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16965 if (sem > -1) {
16966# ifdef IPC_STAT
16967 st = semctl(sem, 0, IPC_STAT, &arg);
16968 if (st == 0)
16969 printf("semid_ds\n");
16970 else
16971# endif /* IPC_STAT */
16972 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16973# ifdef IPC_RMID
16974 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16975# endif /* IPC_RMID */
16976 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16977 } else
16978#endif /* IPC_PRIVATE && ... */
16979 printf("semget failed: errno = %d\n", errno);
16980
16981 return 0;
16982}
16983END
2fad75a1
JH
16984 set try
16985 if eval $compile; then
16986 xxx=`$run ./try`
16987 case "$xxx" in
16988 semid_ds) val="$define" ;;
16989 esac
16990 fi
5b813a60 16991 $rm_try
35918792
YST
16992 set d_semctl_semid_ds
16993 eval $setvar
2fad75a1
JH
16994 ;;
16995 esac
b4eb6b3d
JH
16996 case "$d_semctl_semid_ds" in
16997 $define)
16998 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16999 ;;
17000 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17001 ;;
17002 esac
b4eb6b3d
JH
17003 ;;
17004*) val="$undef"
17005
17006 # We do not have the full sem*(2) library, so assume we can not
17007 # use either.
17008
17009 set d_semctl_semun
17010 eval $setvar
17011
17012 set d_semctl_semid_ds
17013 eval $setvar
17014 ;;
17015esac
93451a0d 17016$rm_try tryh.h
b4eb6b3d 17017
4e0554ec
JH
17018: see if sendmsg exists
17019set sendmsg d_sendmsg
17020eval $inlibc
17021
b4eb6b3d
JH
17022: see if setegid exists
17023set setegid d_setegid
17024eval $inlibc
17025
17026: see if seteuid exists
17027set seteuid d_seteuid
17028eval $inlibc
17029
17030: see if setgrent exists
17031set setgrent d_setgrent
17032eval $inlibc
17033
10bc17b6
JH
17034: see if setgrent_r exists
17035set setgrent_r d_setgrent_r
17036eval $inlibc
17037case "$d_setgrent_r" in
17038"$define")
17039 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
17040 case "$d_setgrent_r_proto:$usethreads" in
17041 ":define") d_setgrent_r_proto=define
a48ec845
JH
17042 set d_setgrent_r_proto setgrent_r $hdrs
17043 eval $hasproto ;;
17044 *) ;;
17045 esac
17046 case "$d_setgrent_r_proto" in
17047 define)
10bc17b6
JH
17048 case "$setgrent_r_proto" in
17049 ''|0) try='int setgrent_r(FILE**);'
61c26d18 17050 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
10bc17b6
JH
17051 esac
17052 case "$setgrent_r_proto" in
17053 ''|0) try='void setgrent_r(FILE**);'
61c26d18 17054 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
10bc17b6
JH
17055 esac
17056 case "$setgrent_r_proto" in
90e831dc 17057 ''|0) d_setgrent_r=undef
10bc17b6 17058 setgrent_r_proto=0
a48ec845 17059 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17060 * ) case "$setgrent_r_proto" in
17061 REENTRANT_PROTO*) ;;
17062 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17063 esac
17064 echo "Prototype: $try" ;;
17065 esac
17066 ;;
c18e646a
JH
17067 *) case "$usethreads" in
17068 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17069 esac
90e831dc
SB
17070 d_setgrent_r=undef
17071 setgrent_r_proto=0
c18e646a 17072 ;;
a48ec845
JH
17073 esac
17074 ;;
10bc17b6
JH
17075*) setgrent_r_proto=0
17076 ;;
17077esac
17078
b4eb6b3d
JH
17079: see if sethostent exists
17080set sethostent d_sethent
17081eval $inlibc
17082
10bc17b6
JH
17083: see if sethostent_r exists
17084set sethostent_r d_sethostent_r
17085eval $inlibc
17086case "$d_sethostent_r" in
17087"$define")
17088 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17089 case "$d_sethostent_r_proto:$usethreads" in
17090 ":define") d_sethostent_r_proto=define
a48ec845
JH
17091 set d_sethostent_r_proto sethostent_r $hdrs
17092 eval $hasproto ;;
17093 *) ;;
17094 esac
17095 case "$d_sethostent_r_proto" in
17096 define)
10bc17b6
JH
17097 case "$sethostent_r_proto" in
17098 ''|0) try='int sethostent_r(int, struct hostent_data*);'
61c26d18 17099 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
10bc17b6
JH
17100 esac
17101 case "$sethostent_r_proto" in
17102 ''|0) try='void sethostent_r(int, struct hostent_data*);'
61c26d18 17103 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
10bc17b6
JH
17104 esac
17105 case "$sethostent_r_proto" in
90e831dc 17106 ''|0) d_sethostent_r=undef
10bc17b6 17107 sethostent_r_proto=0
a48ec845 17108 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17109 * ) case "$sethostent_r_proto" in
17110 REENTRANT_PROTO*) ;;
17111 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17112 esac
17113 echo "Prototype: $try" ;;
17114 esac
17115 ;;
c18e646a
JH
17116 *) case "$usethreads" in
17117 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17118 esac
90e831dc
SB
17119 d_sethostent_r=undef
17120 sethostent_r_proto=0
c18e646a 17121 ;;
a48ec845
JH
17122 esac
17123 ;;
10bc17b6
JH
17124*) sethostent_r_proto=0
17125 ;;
17126esac
17127
4e0554ec
JH
17128: see if setitimer exists
17129set setitimer d_setitimer
17130eval $inlibc
17131
b4eb6b3d
JH
17132: see if setlinebuf exists
17133set setlinebuf d_setlinebuf
17134eval $inlibc
17135
17136: see if setlocale exists
17137set setlocale d_setlocale
17138eval $inlibc
17139
10bc17b6
JH
17140: see if locale.h is available
17141set locale.h i_locale
17142eval $inhdr
17143
17144: see if setlocale_r exists
17145set setlocale_r d_setlocale_r
17146eval $inlibc
17147case "$d_setlocale_r" in
17148"$define")
17149 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
17150 case "$d_setlocale_r_proto:$usethreads" in
17151 ":define") d_setlocale_r_proto=define
a48ec845
JH
17152 set d_setlocale_r_proto setlocale_r $hdrs
17153 eval $hasproto ;;
17154 *) ;;
17155 esac
17156 case "$d_setlocale_r_proto" in
17157 define)
10bc17b6
JH
17158 case "$setlocale_r_proto" in
17159 ''|0) try='int setlocale_r(int, const char*, char*, int);'
61c26d18 17160 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
10bc17b6
JH
17161 esac
17162 case "$setlocale_r_proto" in
90e831dc 17163 ''|0) d_setlocale_r=undef
10bc17b6 17164 setlocale_r_proto=0
a48ec845 17165 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17166 * ) case "$setlocale_r_proto" in
17167 REENTRANT_PROTO*) ;;
17168 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17169 esac
17170 echo "Prototype: $try" ;;
17171 esac
17172 ;;
c18e646a
JH
17173 *) case "$usethreads" in
17174 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17175 esac
90e831dc
SB
17176 d_setlocale_r=undef
17177 setlocale_r_proto=0
c18e646a 17178 ;;
a48ec845
JH
17179 esac
17180 ;;
10bc17b6
JH
17181*) setlocale_r_proto=0
17182 ;;
17183esac
17184
b4eb6b3d
JH
17185: see if setnetent exists
17186set setnetent d_setnent
17187eval $inlibc
17188
10bc17b6
JH
17189: see if setnetent_r exists
17190set setnetent_r d_setnetent_r
17191eval $inlibc
17192case "$d_setnetent_r" in
17193"$define")
17194 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17195 case "$d_setnetent_r_proto:$usethreads" in
17196 ":define") d_setnetent_r_proto=define
a48ec845
JH
17197 set d_setnetent_r_proto setnetent_r $hdrs
17198 eval $hasproto ;;
17199 *) ;;
17200 esac
17201 case "$d_setnetent_r_proto" in
17202 define)
10bc17b6
JH
17203 case "$setnetent_r_proto" in
17204 ''|0) try='int setnetent_r(int, struct netent_data*);'
61c26d18 17205 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
10bc17b6
JH
17206 esac
17207 case "$setnetent_r_proto" in
17208 ''|0) try='void setnetent_r(int, struct netent_data*);'
61c26d18 17209 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
10bc17b6
JH
17210 esac
17211 case "$setnetent_r_proto" in
90e831dc 17212 ''|0) d_setnetent_r=undef
10bc17b6 17213 setnetent_r_proto=0
a48ec845 17214 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17215 * ) case "$setnetent_r_proto" in
17216 REENTRANT_PROTO*) ;;
17217 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17218 esac
17219 echo "Prototype: $try" ;;
17220 esac
17221 ;;
c18e646a
JH
17222 *) case "$usethreads" in
17223 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17224 esac
90e831dc
SB
17225 d_setnetent_r=undef
17226 setnetent_r_proto=0
c18e646a 17227 ;;
a48ec845
JH
17228 esac
17229 ;;
10bc17b6
JH
17230*) setnetent_r_proto=0
17231 ;;
17232esac
17233
b4eb6b3d
JH
17234: see if setprotoent exists
17235set setprotoent d_setpent
17236eval $inlibc
17237
17238: see if setpgid exists
17239set setpgid d_setpgid
17240eval $inlibc
17241
17242: see if setpgrp2 exists
17243set setpgrp2 d_setpgrp2
17244eval $inlibc
17245
17246: see if setpriority exists
17247set setpriority d_setprior
17248eval $inlibc
17249
17250: see if setproctitle exists
17251set setproctitle d_setproctitle
17252eval $inlibc
17253
10bc17b6
JH
17254: see if setprotoent_r exists
17255set setprotoent_r d_setprotoent_r
17256eval $inlibc
17257case "$d_setprotoent_r" in
17258"$define")
17259 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17260 case "$d_setprotoent_r_proto:$usethreads" in
17261 ":define") d_setprotoent_r_proto=define
a48ec845
JH
17262 set d_setprotoent_r_proto setprotoent_r $hdrs
17263 eval $hasproto ;;
17264 *) ;;
17265 esac
17266 case "$d_setprotoent_r_proto" in
17267 define)
10bc17b6
JH
17268 case "$setprotoent_r_proto" in
17269 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
61c26d18 17270 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
10bc17b6
JH
17271 esac
17272 case "$setprotoent_r_proto" in
17273 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
61c26d18 17274 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
10bc17b6
JH
17275 esac
17276 case "$setprotoent_r_proto" in
90e831dc 17277 ''|0) d_setprotoent_r=undef
10bc17b6 17278 setprotoent_r_proto=0
a48ec845 17279 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17280 * ) case "$setprotoent_r_proto" in
17281 REENTRANT_PROTO*) ;;
17282 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17283 esac
17284 echo "Prototype: $try" ;;
17285 esac
17286 ;;
c18e646a
JH
17287 *) case "$usethreads" in
17288 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17289 esac
90e831dc
SB
17290 d_setprotoent_r=undef
17291 setprotoent_r_proto=0
c18e646a 17292 ;;
a48ec845
JH
17293 esac
17294 ;;
10bc17b6
JH
17295*) setprotoent_r_proto=0
17296 ;;
17297esac
17298
b4eb6b3d
JH
17299: see if setpwent exists
17300set setpwent d_setpwent
17301eval $inlibc
17302
10bc17b6
JH
17303: see if setpwent_r exists
17304set setpwent_r d_setpwent_r
17305eval $inlibc
17306case "$d_setpwent_r" in
17307"$define")
17308 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
17309 case "$d_setpwent_r_proto:$usethreads" in
17310 ":define") d_setpwent_r_proto=define
a48ec845
JH
17311 set d_setpwent_r_proto setpwent_r $hdrs
17312 eval $hasproto ;;
17313 *) ;;
17314 esac
17315 case "$d_setpwent_r_proto" in
17316 define)
10bc17b6
JH
17317 case "$setpwent_r_proto" in
17318 ''|0) try='int setpwent_r(FILE**);'
61c26d18 17319 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
10bc17b6
JH
17320 esac
17321 case "$setpwent_r_proto" in
17322 ''|0) try='void setpwent_r(FILE**);'
61c26d18 17323 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
10bc17b6
JH
17324 esac
17325 case "$setpwent_r_proto" in
90e831dc 17326 ''|0) d_setpwent_r=undef
10bc17b6 17327 setpwent_r_proto=0
a48ec845 17328 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17329 * ) case "$setpwent_r_proto" in
17330 REENTRANT_PROTO*) ;;
17331 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17332 esac
17333 echo "Prototype: $try" ;;
17334 esac
17335 ;;
c18e646a
JH
17336 *) case "$usethreads" in
17337 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17338 esac
90e831dc
SB
17339 d_setpwent_r=undef
17340 setpwent_r_proto=0
c18e646a 17341 ;;
a48ec845
JH
17342 esac
17343 ;;
10bc17b6
JH
17344*) setpwent_r_proto=0
17345 ;;
17346esac
17347
b4eb6b3d
JH
17348: see if setregid exists
17349set setregid d_setregid
17350eval $inlibc
17351set setresgid d_setresgid
17352eval $inlibc
17353
17354: see if setreuid exists
17355set setreuid d_setreuid
17356eval $inlibc
17357set setresuid d_setresuid
17358eval $inlibc
17359
17360: see if setrgid exists
17361set setrgid d_setrgid
17362eval $inlibc
17363
17364: see if setruid exists
17365set setruid d_setruid
17366eval $inlibc
17367
17368: see if setservent exists
17369set setservent d_setsent
17370eval $inlibc
17371
10bc17b6
JH
17372: see if setservent_r exists
17373set setservent_r d_setservent_r
17374eval $inlibc
17375case "$d_setservent_r" in
17376"$define")
17377 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17378 case "$d_setservent_r_proto:$usethreads" in
17379 ":define") d_setservent_r_proto=define
a48ec845
JH
17380 set d_setservent_r_proto setservent_r $hdrs
17381 eval $hasproto ;;
17382 *) ;;
17383 esac
17384 case "$d_setservent_r_proto" in
17385 define)
10bc17b6
JH
17386 case "$setservent_r_proto" in
17387 ''|0) try='int setservent_r(int, struct servent_data*);'
61c26d18 17388 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
10bc17b6
JH
17389 esac
17390 case "$setservent_r_proto" in
17391 ''|0) try='void setservent_r(int, struct servent_data*);'
61c26d18 17392 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
10bc17b6
JH
17393 esac
17394 case "$setservent_r_proto" in
90e831dc 17395 ''|0) d_setservent_r=undef
10bc17b6 17396 setservent_r_proto=0
a48ec845 17397 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17398 * ) case "$setservent_r_proto" in
17399 REENTRANT_PROTO*) ;;
17400 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17401 esac
17402 echo "Prototype: $try" ;;
17403 esac
17404 ;;
c18e646a
JH
17405 *) case "$usethreads" in
17406 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17407 esac
90e831dc
SB
17408 d_setservent_r=undef
17409 setservent_r_proto=0
c18e646a 17410 ;;
a48ec845
JH
17411 esac
17412 ;;
10bc17b6
JH
17413*) setservent_r_proto=0
17414 ;;
17415esac
17416
b4eb6b3d
JH
17417: see if setsid exists
17418set setsid d_setsid
17419eval $inlibc
17420
17421: see if setvbuf exists
17422set setvbuf d_setvbuf
17423eval $inlibc
17424
17425: see if sfio.h is available
17426set sfio.h i_sfio
17427eval $inhdr
17428
b4eb6b3d
JH
17429: see if sfio library is available
17430case "$i_sfio" in
17431$define)
17432 val=''
17433 set sfreserve val
17434 eval $inlibc
17435 ;;
17436*)
17437 val="$undef"
17438 ;;
17439esac
17440: Ok, but do we want to use it.
17441case "$val" in
17442$define)
17443 case "$usesfio" in
17444 true|$define|[yY]*) dflt='y';;
17445 *) dflt='n';;
17446 esac
17447 echo "$package can use the sfio library, but it is experimental."
b4eb6b3d
JH
17448 rp="You seem to have sfio available, do you want to try using it?"
17449 . ./myread
17450 case "$ans" in
dd35fa16 17451 y|Y) echo "Ok, turning on sfio then."
b4eb6b3d
JH
17452 val="$define"
17453 ;;
17454 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
17455 val="$undef"
b4eb6b3d
JH
17456 ;;
17457 esac
17458 ;;
17459*) case "$usesfio" in
17460 true|$define|[yY]*)
17461 echo "Sorry, cannot find sfio on this machine." >&4
17462 echo "Ignoring your setting of usesfio=$usesfio." >&4
17463 val="$undef"
17464 ;;
17465 esac
17466 ;;
17467esac
17468set d_sfio
17469eval $setvar
17470case "$d_sfio" in
17471$define) usesfio='true';;
17472*) usesfio='false';;
17473esac
3659ebf1
JH
17474case "$d_sfio" in
17475$define) ;;
17476*) : Remove sfio from list of libraries to use
7483f793
JH
17477 case "$libs" in
17478 *-lsfio*)
17479 echo "Removing unneeded -lsfio from library list" >&4
17480 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17481 shift
17482 libs="$*"
17483 echo "libs = $libs" >&4
17484 ;;
17485 esac
3659ebf1
JH
17486;;
17487esac
17488
b4eb6b3d
JH
17489
17490: see if shmctl exists
17491set shmctl d_shmctl
17492eval $inlibc
17493
17494: see if shmget exists
17495set shmget d_shmget
17496eval $inlibc
17497
17498: see if shmat exists
17499set shmat d_shmat
17500eval $inlibc
17501: see what shmat returns
17502case "$d_shmat" in
17503"$define")
17504 $cat >shmat.c <<'END'
17505#include <sys/shm.h>
17506void *shmat();
17507END
17508 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17509 shmattype='void *'
17510 else
17511 shmattype='char *'
17512 fi
17513 echo "and it returns ($shmattype)." >&4
17514 : see if a prototype for shmat is available
17515 xxx=`./findhdr sys/shm.h`
17516 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17517 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17518 val="$define"
17519 else
17520 val="$undef"
17521 fi
17522 $rm -f shmat.[co]
17523 ;;
17524*)
17525 val="$undef"
17526 ;;
17527esac
17528set d_shmatprototype
17529eval $setvar
17530
17531: see if shmdt exists
17532set shmdt d_shmdt
17533eval $inlibc
17534
17535: see how much of the 'shm*(2)' library is present.
17536h_shm=true
17537echo " "
17538case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17539*"$undef"*) h_shm=false;;
17540esac
17541case "$osname" in
17542freebsd)
17543 case "`ipcs 2>&1`" in
17544 "SVID shared memory"*"not configured"*)
17545 echo "Your $osname does not have the shm*(2) configured." >&4
17546 h_shm=false
17547 val="$undef"
17548 set shmctl d_shmctl
17549 evat $setvar
17550 set shmget d_shmget
17551 evat $setvar
17552 set shmat d_shmat
17553 evat $setvar
17554 set shmdt d_shmdt
17555 evat $setvar
17556 ;;
17557 esac
17558 ;;
17559esac
17560: we could also check for sys/ipc.h ...
17561if $h_shm && $test `./findhdr sys/shm.h`; then
17562 echo "You have the full shm*(2) library." >&4
17563 val="$define"
17564else
17565 echo "You don't have the full shm*(2) library." >&4
17566 val="$undef"
17567fi
17568set d_shm
17569eval $setvar
17570
b4eb6b3d 17571: see if we have sigaction
613d6c3e 17572echo " "
b4eb6b3d
JH
17573if set sigaction val -f d_sigaction; eval $csym; $val; then
17574 echo 'sigaction() found.' >&4
073b6de5 17575 $cat > try.c <<EOP
b4eb6b3d
JH
17576#include <stdio.h>
17577#include <sys/types.h>
17578#include <signal.h>
073b6de5
JH
17579#$i_stdlib I_STDLIB
17580#ifdef I_STDLIB
17581#include <stdlib.h>
17582#endif
b4eb6b3d
JH
17583int main()
17584{
17585 struct sigaction act, oact;
17586 act.sa_flags = 0;
17587 oact.sa_handler = 0;
17588 /* so that act and oact are used */
17589 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17590}
17591EOP
17592 set try
17593 if eval $compile_ok; then
17594 val="$define"
17595 else
17596 echo "But you don't seem to have a useable struct sigaction." >&4
17597 val="$undef"
17598 fi
17599else
17600 echo 'sigaction NOT found.' >&4
17601 val="$undef"
17602fi
17603set d_sigaction; eval $setvar
5b813a60 17604$rm_try
b4eb6b3d 17605
ed140128
AD
17606: see if this is a sunmath.h system
17607set sunmath.h i_sunmath
17608eval $inhdr
17609
17610: see if signbit exists
17611$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17612$cat >try.c <<EOCP
17613#$i_math I_MATH
17614#$i_sunmath I_SUNMATH
17615#ifdef I_MATH
17616# include <math.h>
17617#endif
17618#ifdef I_SUNMATH /* Solaris special math library */
17619# include <sunmath.h>
17620#endif
17621#define NV $nvtype
17622int main(int argc, char **argv)
17623{
17624 NV x = 0.0;
17625 NV y = -0.0;
17626 if ((signbit(x) == 0) && (signbit(y) != 0))
17627 return 0;
17628 else
17629 return 1;
17630}
17631EOCP
17632val="$undef"
17633set try
17634if eval $compile; then
17635 if $run ./try; then
17636 $echo "Yes." >&4
17637 val="$define"
17638 else
17639 $echo "Signbit seems to be available, but doesn't work as I expected."
17640 $echo "I won't use it." >&4
17641 val="$undef"
17642 fi
17643else
17644 $echo "Nope." >&4
17645 dflt="$undef"
17646fi
17647set d_signbit
17648eval $setvar
5b813a60 17649$rm_try
ed140128 17650
983dbef6
JH
17651: see if sigprocmask exists
17652set sigprocmask d_sigprocmask
17653eval $inlibc
17654
b4eb6b3d
JH
17655: see if sigsetjmp exists
17656echo " "
17657case "$d_sigsetjmp" in
17658'')
c727eafa 17659 $cat >try.c <<EOP
b4eb6b3d 17660#include <setjmp.h>
d1daaddf
JH
17661#$i_stdlib I_STDLIB
17662#ifdef I_STDLIB
17663#include <stdlib.h>
17664#endif
b4eb6b3d
JH
17665sigjmp_buf env;
17666int set = 1;
17667int main()
17668{
17669 if (sigsetjmp(env,1))
17670 exit(set);
17671 set = 0;
17672 siglongjmp(env, 1);
17673 exit(1);
17674}
17675EOP
17676 set try
17677 if eval $compile; then
5440bc8e 17678 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17679 echo "POSIX sigsetjmp found." >&4
17680 val="$define"
17681 else
17682 $cat >&4 <<EOM
17683Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17684I'll ignore them.
17685EOM
17686 val="$undef"
17687 fi
17688 else
17689 echo "sigsetjmp not found." >&4
17690 val="$undef"
17691 fi
17692 ;;
17693*) val="$d_sigsetjmp"
17694 case "$d_sigsetjmp" in
17695 $define) echo "POSIX sigsetjmp found." >&4;;
17696 $undef) echo "sigsetjmp not found." >&4;;
17697 esac
17698 ;;
17699esac
17700set d_sigsetjmp
17701eval $setvar
5b813a60 17702$rm_try
b4eb6b3d 17703
4f5da3e9
SP
17704: see if snprintf exists
17705set snprintf d_snprintf
17706eval $inlibc
17707
17708: see if vsnprintf exists
17709set vsnprintf d_vsnprintf
17710eval $inlibc
17711
2478f7a0
MB
17712case "$d_snprintf-$d_vsnprintf" in
17713"$define-$define")
17714 $cat <<EOM
17715Checking whether your snprintf() and vsnprintf() work okay...
17716EOM
17717 $cat >try.c <<'EOCP'
17718/* v?snprintf testing logic courtesy of Russ Allbery.
17719 * According to C99:
17720 * - if the buffer is too short it still must be \0-terminated
17721 * - if the buffer is too short the potentially required length
17722 * must be returned and not -1
17723 * - if the buffer is NULL the potentially required length
17724 * must be returned and not -1 or core dump
17725 */
17726#include <stdio.h>
17727#include <stdarg.h>
17728
17729char buf[2];
17730
17731int test (char *format, ...)
17732{
17733 va_list args;
17734 int count;
17735
17736 va_start (args, format);
17737 count = vsnprintf (buf, sizeof buf, format, args);
17738 va_end (args);
17739 return count;
17740}
17741
17742int main ()
17743{
17744 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17745 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17746}
17747EOCP
17748 set try
17749 if eval $compile; then
17750 `$run ./try`
17751 case "$?" in
17752 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17753 *) cat <<EOM >&4
17754Your snprintf() and snprintf() don't seem to be working okay.
17755EOM
17756 d_snprintf="$undef"
17757 d_vsnprintf="$undef"
17758 ;;
17759 esac
17760 else
17761 echo "(I can't seem to compile the test program--assuming they don't)"
17762 d_snprintf="$undef"
17763 d_vsnprintf="$undef"
17764 fi
5b813a60 17765 $rm_try
2478f7a0
MB
17766 ;;
17767esac
17768
49a78c82
JH
17769: see if sockatmark exists
17770set sockatmark d_sockatmark
17771eval $inlibc
17772
2ef53570
JH
17773: see if prototype for sockatmark is available
17774echo " "
17775set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17776eval $hasproto
17777
b4eb6b3d
JH
17778: see if socks5_init exists
17779set socks5_init d_socks5_init
17780eval $inlibc
17781
360321b3
YST
17782: see if sprintf returns the length of the string in the buffer as per ANSI
17783$echo "Checking whether sprintf returns the length of the string..." >&4
17784$cat <<EOP >try.c
17785#include <stdio.h>
17786#$i_stdlib I_STDLIB
17787#ifdef I_STDLIB
17788#include <stdlib.h>
17789#endif
17790#$i_string I_STRING
17791#ifdef I_STRING
17792# include <string.h>
17793#else
17794# include <strings.h>
17795#endif
17796#$i_math I_MATH
17797#ifdef I_MATH
17798#include <math.h>
17799#endif
17800
17801char buffer[256];
17802
17803int check (size_t expect, int test) {
17804 size_t got = strlen(buffer);
17805 if (expect == got)
17806 return 0;
17807
17808 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17809 test, buffer);
17810 exit (test);
17811}
17812
17813int main(int argc, char **argv) {
17814 int test = 0;
17815
17816 check(sprintf(buffer, ""), ++test);
17817 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17818 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17819
17820 return 0;
17821}
17822EOP
17823set try
17824
360321b3
YST
17825if eval $compile; then
17826 xxx="`$run ./try`"
17827 case "$?" in
17828 0) cat >&4 <<EOM
17829sprintf returns the length of the string (as ANSI says it should)
17830EOM
17831 d_sprintf_returns_strlen="$define"
17832 ;;
17833 *) cat >&4 <<EOM
17834sprintf does not return the length of the string (how old is this system?)
17835EOM
17836 d_sprintf_returns_strlen="$undef"
17837 ;;
17838 esac
d2821e72 17839else
36a30365
JH
17840 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17841 d_sprintf_returns_strlen="$undef"
360321b3 17842fi
5b813a60 17843$rm_try
360321b3 17844
10bc17b6
JH
17845: see if srand48_r exists
17846set srand48_r d_srand48_r
17847eval $inlibc
17848case "$d_srand48_r" in
17849"$define")
17850 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17851 case "$d_srand48_r_proto:$usethreads" in
17852 ":define") d_srand48_r_proto=define
a48ec845
JH
17853 set d_srand48_r_proto srand48_r $hdrs
17854 eval $hasproto ;;
17855 *) ;;
17856 esac
17857 case "$d_srand48_r_proto" in
17858 define)
10bc17b6
JH
17859 case "$srand48_r_proto" in
17860 ''|0) try='int srand48_r(long, struct drand48_data*);'
61c26d18 17861 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
10bc17b6
JH
17862 esac
17863 case "$srand48_r_proto" in
90e831dc 17864 ''|0) d_srand48_r=undef
10bc17b6 17865 srand48_r_proto=0
a48ec845 17866 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17867 * ) case "$srand48_r_proto" in
17868 REENTRANT_PROTO*) ;;
17869 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17870 esac
17871 echo "Prototype: $try" ;;
17872 esac
17873 ;;
c18e646a
JH
17874 *) case "$usethreads" in
17875 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17876 esac
90e831dc
SB
17877 d_srand48_r=undef
17878 srand48_r_proto=0
c18e646a 17879 ;;
a48ec845
JH
17880 esac
17881 ;;
10bc17b6
JH
17882*) srand48_r_proto=0
17883 ;;
17884esac
17885
17886: see if srandom_r exists
17887set srandom_r d_srandom_r
17888eval $inlibc
17889case "$d_srandom_r" in
17890"$define")
17891 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17892 case "$d_srandom_r_proto:$usethreads" in
17893 ":define") d_srandom_r_proto=define
a48ec845
JH
17894 set d_srandom_r_proto srandom_r $hdrs
17895 eval $hasproto ;;
17896 *) ;;
17897 esac
17898 case "$d_srandom_r_proto" in
17899 define)
10bc17b6
JH
17900 case "$srandom_r_proto" in
17901 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
61c26d18 17902 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
10bc17b6
JH
17903 esac
17904 case "$srandom_r_proto" in
90e831dc 17905 ''|0) d_srandom_r=undef
10bc17b6 17906 srandom_r_proto=0
a48ec845 17907 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17908 * ) case "$srandom_r_proto" in
17909 REENTRANT_PROTO*) ;;
17910 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17911 esac
17912 echo "Prototype: $try" ;;
17913 esac
17914 ;;
c18e646a
JH
17915 *) case "$usethreads" in
17916 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17917 esac
90e831dc
SB
17918 d_srandom_r=undef
17919 srandom_r_proto=0
c18e646a 17920 ;;
a48ec845
JH
17921 esac
17922 ;;
10bc17b6
JH
17923*) srandom_r_proto=0
17924 ;;
17925esac
17926
eef837ea
JH
17927: see if prototype for setresgid is available
17928echo " "
17929set d_sresgproto setresgid $i_unistd unistd.h
17930eval $hasproto
17931
640374d0
JH
17932: see if prototype for setresuid is available
17933echo " "
17934set d_sresuproto setresuid $i_unistd unistd.h
17935eval $hasproto
17936
b4eb6b3d
JH
17937: see if sys/stat.h is available
17938set sys/stat.h i_sysstat
17939eval $inhdr
17940
b4eb6b3d
JH
17941: see if stat knows about block sizes
17942echo " "
17943echo "Checking to see if your struct stat has st_blocks field..." >&4
17944set d_statblks stat st_blocks $i_sysstat sys/stat.h
17945eval $hasfield
17946
b4eb6b3d
JH
17947: see if this is a sys/vfs.h system
17948set sys/vfs.h i_sysvfs
17949eval $inhdr
17950
b4eb6b3d
JH
17951: see if this is a sys/statfs.h system
17952set sys/statfs.h i_sysstatfs
17953eval $inhdr
17954
34f1896b 17955: Check for statfs_s
b4eb6b3d
JH
17956echo " "
17957echo "Checking to see if your system supports struct statfs..." >&4
17958set 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
17959eval $hasstruct
17960case "$d_statfs_s" in
17961"$define") echo "Yes, it does." ;;
17962*) echo "No, it doesn't." ;;
17963esac
17964
17965
b4eb6b3d
JH
17966: see if struct statfs knows about f_flags
17967case "$d_statfs_s" in
34f1896b 17968define)
b4eb6b3d
JH
17969 echo " "
17970 echo "Checking to see if your struct statfs has f_flags field..." >&4
17971 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
17972 eval $hasfield
17973 ;;
17974*) val="$undef"
17975 set d_statfs_f_flags
17976 eval $setvar
17977 ;;
17978esac
17979case "$d_statfs_f_flags" in
17980"$define") echo "Yes, it does." ;;
17981*) echo "No, it doesn't." ;;
17982esac
17983
17a6c8e3
AD
17984: see what flavor, if any, of static inline is supported
17985echo " "
17986echo "Checking to see if your system supports static inline..."
17987$cat > try.c <<'EOCP'
17988#include <stdlib.h>
17989extern int f_via_a(int x);
17990extern int f_via_b(int x);
17991int main(int argc, char **argv)
17992{
17993 int y;
17994
17995 y = f_via_a(0);
17996#ifdef USE_B
17997 y = f_via_b(0);
17998#endif
17999 if (y == 42) {
18000 return EXIT_SUCCESS;
18001 }
18002 else {
18003 return EXIT_FAILURE;
18004 }
18005}
18006EOCP
18007$cat > a.c <<'EOCP'
18008static INLINE int f(int x) {
18009 int y;
18010 y = x + 42;
18011 return y;
18012}
18013
18014int f_via_a(int x)
18015{
18016 return f(x);
18017}
18018EOCP
18019$cat > b.c <<'EOCP'
18020extern int f(int x);
18021
18022int f_via_b(int x)
18023{
18024 return f(x);
18025}
18026EOCP
18027
18028# Respect a hint (or previous) value for perl_static_inline, if there is one.
18029case "$perl_static_inline" in
18030'') # Check the various possibilities, and break out on success.
18031 # For gcc, prefer __inline__, which will still permit
18032 # cflags.SH to add in -ansi.
18033 case "$gccversion" in
18034 '') xxx="inline __inline__ __inline _inline";;
18035 *) xxx="__inline__ inline __inline _inline";;
18036 esac
18037 for inline in $xxx; do
18038 set try -DINLINE=$inline a.c
18039 if eval $compile && $run ./try; then
18040 # Now make sure there is no external linkage of static
18041 # functions
18042 set try -DINLINE=$inline -DUSE_B a.c b.c
18043 if eval $compile && $run ./try; then
18044 $echo "Your compiler supports static $inline, " >&4
18045 $echo "but it also creates an external definition," >&4
18046 $echo "so I won't use it." >&4
18047 val=$undef
18048 else
18049 $echo "Your compiler supports static $inline." >&4
18050 val=$define
18051 perl_static_inline="static $inline";
18052 break;
18053 fi
18054 else
18055 $echo "Your compiler does NOT support static $inline." >&4
18056 val="$undef"
18057 fi
18058 done
18059 ;;
18060*inline*) # Some variant of inline exists.
18061 echo "Keeping your $hint value of $perl_static_inline."
18062 val=$define
18063 ;;
18064static) # No inline capabilities
18065 echo "Keeping your $hint value of $perl_static_inline."
18066 val=$undef
18067 ;;
18068*) # Unrecognized previous value -- blindly trust the supplied
18069 # value and hope it makes sense. Use old value for
18070 # d_static_inline, if there is one.
18071 echo "Keeping your $hint value of $perl_static_inline."
18072 case "$d_static_inline" in
18073 '') val=$define ;;
18074 *) val=$d_static_inline ;;
18075 esac
18076 ;;
18077esac
18078# Fallback to plain 'static' if nothing worked.
18079case "$perl_static_inline" in
18080'')
18081 perl_static_inline="static"
18082 val=$undef
18083 ;;
18084esac
18085set d_static_inline
18086eval $setvar
18087$rm -f a.[co] b.[co]
18088$rm_try
18089
613d6c3e 18090: Check stream access
b4eb6b3d
JH
18091$cat >&4 <<EOM
18092Checking how to access stdio streams by file descriptor number...
18093EOM
18094case "$stdio_stream_array" in
18095'') $cat >try.c <<EOCP
18096#include <stdio.h>
18097int main() {
18098 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18099 printf("yes\n");
18100}
18101EOCP
18102 for s in _iob __iob __sF
18103 do
18104 set try -DSTDIO_STREAM_ARRAY=$s
18105 if eval $compile; then
5440bc8e 18106 case "`$run ./try`" in
b4eb6b3d
JH
18107 yes) stdio_stream_array=$s; break ;;
18108 esac
18109 fi
18110 done
5b813a60 18111 $rm_try
b4eb6b3d
JH
18112esac
18113case "$stdio_stream_array" in
18114'') $cat >&4 <<EOM
18115I can't figure out how to access stdio streams by file descriptor number.
18116EOM
18117 d_stdio_stream_array="$undef"
18118 ;;
18119*) $cat >&4 <<EOM
18120You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18121EOM
18122 d_stdio_stream_array="$define"
18123 ;;
18124esac
18125
18126: see if strcoll exists
18127set strcoll d_strcoll
18128eval $inlibc
18129
18130: check for structure copying
18131echo " "
18132echo "Checking to see if your C compiler can copy structs..." >&4
18133$cat >try.c <<'EOCP'
76f47787 18134int main()
b4eb6b3d
JH
18135{
18136 struct blurfl {
18137 int dyick;
18138 } foo, bar;
18139
18140 foo = bar;
18141}
18142EOCP
18143if $cc -c try.c >/dev/null 2>&1 ; then
18144 val="$define"
18145 echo "Yup, it can."
18146else
18147 val="$undef"
18148 echo "Nope, it can't."
18149fi
18150set d_strctcpy
18151eval $setvar
5b813a60 18152$rm_try
b4eb6b3d
JH
18153
18154: see if strerror and/or sys_errlist[] exist
18155echo " "
18156if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18157 if set strerror val -f d_strerror; eval $csym; $val; then
18158 echo 'strerror() found.' >&4
18159 d_strerror="$define"
18160 d_strerrm='strerror(e)'
18161 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18162 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18163 d_syserrlst="$define"
18164 else
18165 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18166 d_syserrlst="$undef"
18167 fi
18168 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18169 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18170 echo 'strerror() found in string header.' >&4
18171 d_strerror="$define"
18172 d_strerrm='strerror(e)'
18173 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18174 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18175 d_syserrlst="$define"
18176 else
18177 echo "(You don't appear to have any sys_errlist[], how can this be?)"
18178 d_syserrlst="$undef"
18179 fi
18180 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18181 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18182 d_strerror="$undef"
18183 d_syserrlst="$define"
18184 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18185 else
18186 echo 'strerror() and sys_errlist[] NOT found.' >&4
18187 d_strerror="$undef"
18188 d_syserrlst="$undef"
18189 d_strerrm='"unknown"'
18190 fi
18191fi
18192
10bc17b6
JH
18193: see if strerror_r exists
18194set strerror_r d_strerror_r
18195eval $inlibc
18196case "$d_strerror_r" in
18197"$define")
18198 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
18199 case "$d_strerror_r_proto:$usethreads" in
18200 ":define") d_strerror_r_proto=define
a48ec845
JH
18201 set d_strerror_r_proto strerror_r $hdrs
18202 eval $hasproto ;;
18203 *) ;;
18204 esac
18205 case "$d_strerror_r_proto" in
18206 define)
10bc17b6
JH
18207 case "$strerror_r_proto" in
18208 ''|0) try='int strerror_r(int, char*, size_t);'
61c26d18 18209 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
10bc17b6
JH
18210 esac
18211 case "$strerror_r_proto" in
18212 ''|0) try='int strerror_r(int, char*, int);'
61c26d18 18213 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
10bc17b6
JH
18214 esac
18215 case "$strerror_r_proto" in
18216 ''|0) try='char* strerror_r(int, char*, size_t);'
61c26d18 18217 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
10bc17b6
JH
18218 esac
18219 case "$strerror_r_proto" in
90e831dc 18220 ''|0) d_strerror_r=undef
10bc17b6 18221 strerror_r_proto=0
a48ec845 18222 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18223 * ) case "$strerror_r_proto" in
18224 REENTRANT_PROTO*) ;;
18225 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18226 esac
18227 echo "Prototype: $try" ;;
18228 esac
18229 ;;
c18e646a
JH
18230 *) case "$usethreads" in
18231 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18232 esac
90e831dc
SB
18233 d_strerror_r=undef
18234 strerror_r_proto=0
c18e646a 18235 ;;
a48ec845
JH
18236 esac
18237 ;;
10bc17b6
JH
18238*) strerror_r_proto=0
18239 ;;
18240esac
18241
b3c85772
JH
18242: see if strftime exists
18243set strftime d_strftime
18244eval $inlibc
18245
08c92000
MB
18246: see if strlcat exists
18247set strlcat d_strlcat
18248eval $inlibc
18249
18250: see if strlcpy exists
18251set strlcpy d_strlcpy
18252eval $inlibc
18253
b4eb6b3d
JH
18254: see if strtod exists
18255set strtod d_strtod
18256eval $inlibc
18257
18258: see if strtol exists
18259set strtol d_strtol
18260eval $inlibc
18261
18262: see if strtold exists
18263set strtold d_strtold
18264eval $inlibc
18265
18266: see if strtoll exists
18267set strtoll d_strtoll
18268eval $inlibc
18269
18270case "$d_longlong-$d_strtoll" in
18271"$define-$define")
18272 $cat <<EOM
18273Checking whether your strtoll() works okay...
18274EOM
18275 $cat >try.c <<'EOCP'
18276#include <errno.h>
18277#ifdef __hpux
18278#define strtoll __strtoll
18279#endif
e75931a7
YST
18280#ifdef __EMX__
18281#define strtoll _strtoll
18282#endif
b4eb6b3d 18283#include <stdio.h>
613d6c3e 18284extern long long int strtoll(char *s, char **, int);
b4eb6b3d
JH
18285static int bad = 0;
18286int check(char *s, long long ell, int een) {
18287 long long gll;
18288 errno = 0;
18289 gll = strtoll(s, 0, 10);
18290 if (!((gll == ell) && (errno == een)))
18291 bad++;
18292}
18293int main() {
18294 check(" 1", 1LL, 0);
18295 check(" 0", 0LL, 0);
18296 check("-1", -1LL, 0);
18297 check("-9223372036854775808", -9223372036854775808LL, 0);
18298 check("-9223372036854775808", -9223372036854775808LL, 0);
18299 check(" 9223372036854775807", 9223372036854775807LL, 0);
18300 check("-9223372036854775808", -9223372036854775808LL, 0);
18301 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
18302 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18303 if (!bad)
18304 printf("ok\n");
18305}
18306EOCP
18307 set try
18308 if eval $compile; then
5440bc8e 18309 yyy=`$run ./try`
e75931a7 18310 case "$yyy" in
b4eb6b3d
JH
18311 ok) echo "Your strtoll() seems to be working okay." ;;
18312 *) cat <<EOM >&4
18313Your strtoll() doesn't seem to be working okay.
18314EOM
18315 d_strtoll="$undef"
18316 ;;
69eadf66 18317 esac
e75931a7
YST
18318 else
18319 echo "(I can't seem to compile the test program--assuming it doesn't)"
18320 d_strtoll="$undef"
b4eb6b3d
JH
18321 fi
18322 ;;
18323esac
18324
28e5dec8
JH
18325: see if strtoq exists
18326set strtoq d_strtoq
18327eval $inlibc
18328
b4eb6b3d
JH
18329: see if strtoul exists
18330set strtoul d_strtoul
18331eval $inlibc
18332
d0e6d399
NC
18333case "$d_strtoul" in
18334"$define")
18335 $cat <<EOM
18336Checking whether your strtoul() works okay...
18337EOM
18338 $cat >try.c <<'EOCP'
18339#include <errno.h>
18340#include <stdio.h>
613d6c3e 18341extern unsigned long int strtoul(char *s, char **, int);
d0e6d399
NC
18342static int bad = 0;
18343void check(char *s, unsigned long eul, int een) {
18344 unsigned long gul;
18345 errno = 0;
18346 gul = strtoul(s, 0, 10);
18347 if (!((gul == eul) && (errno == een)))
18348 bad++;
18349}
18350int main() {
18351 check(" 1", 1L, 0);
18352 check(" 0", 0L, 0);
18353EOCP
18354 case "$longsize" in
18355 8)
18356 $cat >>try.c <<'EOCP'
09c0d2c4
JH
18357 check("18446744073709551615", 18446744073709551615UL, 0);
18358 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 18359#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 18360 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
18361 check("-18446744073709551614", 2, 0);
18362 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
18363 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18364 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 18365#endif
d0e6d399
NC
18366EOCP
18367 ;;
18368 4)
18369 $cat >>try.c <<'EOCP'
18370 check("4294967295", 4294967295UL, 0);
18371 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 18372#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
18373 check("-1", 4294967295UL, 0);
18374 check("-4294967294", 2, 0);
18375 check("-4294967295", 1, 0);
18376 check("-4294967296", 4294967295UL, ERANGE);
18377 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 18378#endif
d0e6d399
NC
18379EOCP
18380 ;;
18381 *)
18382: Should we write these tests to be more portable by sprintf-ing
18383: ~0 and then manipulating that char string as input for strtol?
18384 ;;
18385 esac
18386 $cat >>try.c <<'EOCP'
18387 if (!bad)
18388 printf("ok\n");
18389 return 0;
18390}
18391EOCP
18392 set try
18393 if eval $compile; then
5440bc8e 18394 case "`$run ./try`" in
d0e6d399
NC
18395 ok) echo "Your strtoul() seems to be working okay." ;;
18396 *) cat <<EOM >&4
18397Your strtoul() doesn't seem to be working okay.
18398EOM
18399 d_strtoul="$undef"
18400 ;;
18401 esac
9597a80f
NC
18402 else
18403 echo "(I can't seem to compile the test program--assuming it doesn't)"
18404 d_strtoul="$undef"
d0e6d399
NC
18405 fi
18406 ;;
18407esac
18408
b4eb6b3d
JH
18409: see if strtoull exists
18410set strtoull d_strtoull
18411eval $inlibc
18412
18413case "$d_longlong-$d_strtoull" in
18414"$define-$define")
18415 $cat <<EOM
18416Checking whether your strtoull() works okay...
18417EOM
18418 $cat >try.c <<'EOCP'
18419#include <errno.h>
18420#ifdef __hpux
18421#define strtoull __strtoull
18422#endif
18423#include <stdio.h>
613d6c3e 18424extern unsigned long long int strtoull(char *s, char **, int);
b4eb6b3d
JH
18425static int bad = 0;
18426int check(char *s, long long eull, int een) {
18427 long long gull;
18428 errno = 0;
18429 gull = strtoull(s, 0, 10);
18430 if (!((gull == eull) && (errno == een)))
18431 bad++;
18432}
18433int main() {
d0e6d399
NC
18434 check(" 1", 1LL, 0);
18435 check(" 0", 0LL, 0);
18436 check("18446744073709551615", 18446744073709551615ULL, 0);
18437 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18438#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
18439 check("-1", 18446744073709551615ULL, 0);
18440 check("-18446744073709551614", 2LL, 0);
18441 check("-18446744073709551615", 1LL, 0);
18442 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18443 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18444#endif
b4eb6b3d
JH
18445 if (!bad)
18446 printf("ok\n");
18447}
18448EOCP
18449 set try
18450 if eval $compile; then
5440bc8e 18451 case "`$run ./try`" in
b4eb6b3d
JH
18452 ok) echo "Your strtoull() seems to be working okay." ;;
18453 *) cat <<EOM >&4
18454Your strtoull() doesn't seem to be working okay.
18455EOM
18456 d_strtoull="$undef"
18457 ;;
18458 esac
9597a80f
NC
18459 else
18460 echo "(I can't seem to compile the test program--assuming it doesn't)"
18461 d_strtoull="$undef"
b4eb6b3d
JH
18462 fi
18463 ;;
18464esac
18465
18466: see if strtouq exists
18467set strtouq d_strtouq
18468eval $inlibc
18469
d0e6d399
NC
18470case "$d_strtouq" in
18471"$define")
18472 $cat <<EOM
18473Checking whether your strtouq() works okay...
18474EOM
18475 $cat >try.c <<'EOCP'
18476#include <errno.h>
18477#include <stdio.h>
613d6c3e 18478extern unsigned long long int strtouq(char *s, char **, int);
d0e6d399
NC
18479static int bad = 0;
18480void check(char *s, unsigned long long eull, int een) {
18481 unsigned long long gull;
18482 errno = 0;
18483 gull = strtouq(s, 0, 10);
18484 if (!((gull == eull) && (errno == een)))
18485 bad++;
18486}
18487int main() {
18488 check(" 1", 1LL, 0);
18489 check(" 0", 0LL, 0);
18490 check("18446744073709551615", 18446744073709551615ULL, 0);
18491 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18492#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
18493 check("-1", 18446744073709551615ULL, 0);
18494 check("-18446744073709551614", 2LL, 0);
18495 check("-18446744073709551615", 1LL, 0);
18496 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18497 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18498#endif
d0e6d399
NC
18499 if (!bad)
18500 printf("ok\n");
18501 return 0;
18502}
18503EOCP
18504 set try
18505 if eval $compile; then
5440bc8e 18506 case "`$run ./try`" in
d0e6d399
NC
18507 ok) echo "Your strtouq() seems to be working okay." ;;
18508 *) cat <<EOM >&4
18509Your strtouq() doesn't seem to be working okay.
18510EOM
18511 d_strtouq="$undef"
18512 ;;
18513 esac
9597a80f
NC
18514 else
18515 echo "(I can't seem to compile the test program--assuming it doesn't)"
18516 d_strtouq="$undef"
d0e6d399
NC
18517 fi
18518 ;;
18519esac
18520
b4eb6b3d
JH
18521: see if strxfrm exists
18522set strxfrm d_strxfrm
18523eval $inlibc
18524
18525: see if symlink exists
18526set symlink d_symlink
18527eval $inlibc
18528
18529: see if syscall exists
18530set syscall d_syscall
18531eval $inlibc
18532
2ef53570
JH
18533: see if prototype for syscall is available
18534echo " "
18535set d_syscallproto syscall $i_unistd unistd.h
18536eval $hasproto
18537
b4eb6b3d
JH
18538: see if sysconf exists
18539set sysconf d_sysconf
18540eval $inlibc
18541
18542: see if system exists
18543set system d_system
18544eval $inlibc
18545
18546: see if tcgetpgrp exists
18547set tcgetpgrp d_tcgetpgrp
18548eval $inlibc
18549
18550: see if tcsetpgrp exists
18551set tcsetpgrp d_tcsetpgrp
18552eval $inlibc
18553
18554: see if prototype for telldir is available
18555echo " "
18556set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18557eval $hasproto
18558
ad493445
MB
18559: see if time exists
18560echo " "
18561if test "X$d_time" = X -o X"$timetype" = X; then
18562 if set time val -f d_time; eval $csym; $val; then
18563 echo 'time() found.' >&4
18564 val="$define"
18565 rp="What is the type returned by time() on this system?"
18566 set time_t timetype long stdio.h sys/types.h
18567 eval $typedef_ask
18568 else
18569 echo 'time() not found, hope that will do.' >&4
18570 val="$undef"
18571 timetype='int';
18572 fi
18573 set d_time
18574 eval $setvar
18575fi
18576
cbb9e8a7
MB
18577: see if timegm exists
18578set timegm d_timegm
18579eval $inlibc
18580
b4eb6b3d
JH
18581: see if this is a sys/times.h system
18582set sys/times.h i_systimes
18583eval $inhdr
18584
18585: see if times exists
18586echo " "
18587if set times val -f d_times; eval $csym; $val; then
18588 echo 'times() found.' >&4
18589 d_times="$define"
18590 inc=''
18591 case "$i_systimes" in
18592 "$define") inc='sys/times.h';;
18593 esac
18594 rp="What is the type returned by times() on this system?"
18595 set clock_t clocktype long stdio.h sys/types.h $inc
18596 eval $typedef_ask
18597else
18598 echo 'times() NOT found, hope that will do.' >&4
18599 d_times="$undef"
18600 clocktype='int'
18601fi
18602
10bc17b6
JH
18603: see if tmpnam_r exists
18604set tmpnam_r d_tmpnam_r
18605eval $inlibc
18606case "$d_tmpnam_r" in
18607"$define")
31ee0cb7 18608 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
18609 case "$d_tmpnam_r_proto:$usethreads" in
18610 ":define") d_tmpnam_r_proto=define
a48ec845
JH
18611 set d_tmpnam_r_proto tmpnam_r $hdrs
18612 eval $hasproto ;;
18613 *) ;;
18614 esac
18615 case "$d_tmpnam_r_proto" in
18616 define)
10bc17b6
JH
18617 case "$tmpnam_r_proto" in
18618 ''|0) try='char* tmpnam_r(char*);'
61c26d18 18619 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
10bc17b6
JH
18620 esac
18621 case "$tmpnam_r_proto" in
90e831dc 18622 ''|0) d_tmpnam_r=undef
10bc17b6 18623 tmpnam_r_proto=0
a48ec845 18624 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18625 * ) case "$tmpnam_r_proto" in
18626 REENTRANT_PROTO*) ;;
18627 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18628 esac
18629 echo "Prototype: $try" ;;
18630 esac
18631 ;;
c18e646a
JH
18632 *) case "$usethreads" in
18633 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18634 esac
90e831dc
SB
18635 d_tmpnam_r=undef
18636 tmpnam_r_proto=0
c18e646a 18637 ;;
a48ec845
JH
18638 esac
18639 ;;
10bc17b6
JH
18640*) tmpnam_r_proto=0
18641 ;;
18642esac
18643
b4eb6b3d
JH
18644: see if truncate exists
18645set truncate d_truncate
18646eval $inlibc
18647
10bc17b6
JH
18648: see if ttyname_r exists
18649set ttyname_r d_ttyname_r
18650eval $inlibc
18651case "$d_ttyname_r" in
18652"$define")
18653 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
18654 case "$d_ttyname_r_proto:$usethreads" in
18655 ":define") d_ttyname_r_proto=define
a48ec845
JH
18656 set d_ttyname_r_proto ttyname_r $hdrs
18657 eval $hasproto ;;
18658 *) ;;
18659 esac
18660 case "$d_ttyname_r_proto" in
18661 define)
10bc17b6
JH
18662 case "$ttyname_r_proto" in
18663 ''|0) try='int ttyname_r(int, char*, size_t);'
61c26d18 18664 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
10bc17b6
JH
18665 esac
18666 case "$ttyname_r_proto" in
18667 ''|0) try='int ttyname_r(int, char*, int);'
61c26d18 18668 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
10bc17b6
JH
18669 esac
18670 case "$ttyname_r_proto" in
18671 ''|0) try='char* ttyname_r(int, char*, int);'
61c26d18 18672 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
10bc17b6
JH
18673 esac
18674 case "$ttyname_r_proto" in
90e831dc 18675 ''|0) d_ttyname_r=undef
10bc17b6 18676 ttyname_r_proto=0
a48ec845 18677 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18678 * ) case "$ttyname_r_proto" in
18679 REENTRANT_PROTO*) ;;
18680 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18681 esac
18682 echo "Prototype: $try" ;;
18683 esac
18684 ;;
c18e646a
JH
18685 *) case "$usethreads" in
18686 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18687 esac
90e831dc
SB
18688 d_ttyname_r=undef
18689 ttyname_r_proto=0
c18e646a 18690 ;;
a48ec845
JH
18691 esac
18692 ;;
10bc17b6
JH
18693*) ttyname_r_proto=0
18694 ;;
18695esac
18696
b4eb6b3d
JH
18697: see if tzname[] exists
18698echo " "
18699if set tzname val -a d_tzname; eval $csym; $val; then
18700 val="$define"
18701 echo 'tzname[] found.' >&4
18702else
18703 val="$undef"
18704 echo 'tzname[] NOT found.' >&4
18705fi
18706set d_tzname
18707eval $setvar
18708
613d6c3e 18709: Check if is a multiplatform env
4e0554ec
JH
18710case "$osname" in
18711next|rhapsody|darwin) multiarch="$define" ;;
18712esac
18713case "$multiarch" in
18714''|[nN]*) multiarch="$undef" ;;
18715esac
18716
24412007 18717: check for ordering of bytes in a UV
4e0554ec 18718echo " "
5440bc8e 18719case "$usecrosscompile$multiarch" in
4e0554ec
JH
18720*$define*)
18721 $cat <<EOM
18722You seem to be either cross-compiling or doing a multiarchitecture build,
18723skipping the byteorder check.
18724
18725EOM
5440bc8e 18726 byteorder='ffff'
4e0554ec
JH
18727 ;;
18728*)
18729 case "$byteorder" in
18730 '')
18731 $cat <<'EOM'
18732In the following, larger digits indicate more significance. A big-endian
18733machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18734little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18735machines may have weird orders like 3412. A Cray will report 87654321,
18736an Alpha will report 12345678. If the test program works the default is
18737probably right.
18738I'm now running the test program...
18739EOM
24412007 18740 $cat >try.c <<EOCP
4e0554ec 18741#include <stdio.h>
55954f19
JH
18742#$i_stdlib I_STDLIB
18743#ifdef I_STDLIB
18744#include <stdlib.h>
18745#endif
24412007
JH
18746#include <sys/types.h>
18747typedef $uvtype UV;
4e0554ec
JH
18748int main()
18749{
18750 int i;
18751 union {
24412007
JH
18752 UV l;
18753 char c[$uvsize];
4e0554ec
JH
18754 } u;
18755
24412007 18756 if ($uvsize > 4)
b5ded3e5 18757 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18758 else
a4c53327 18759 u.l = (UV)0x04030201;
24412007 18760 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18761 printf("%c", u.c[i]+'0');
18762 printf("\n");
18763 exit(0);
18764}
18765EOCP
18766 xxx_prompt=y
18767 set try
43dddb59 18768 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18769 dflt=`$run ./try`
4e0554ec
JH
18770 case "$dflt" in
18771 [1-4][1-4][1-4][1-4]|12345678|87654321)
18772 echo "(The test program ran ok.)"
18773 echo "byteorder=$dflt"
18774 xxx_prompt=n
18775 ;;
18776 ????|????????) echo "(The test program ran ok.)" ;;
18777 *) echo "(The test program didn't run right for some reason.)" ;;
18778 esac
18779 else
18780 dflt='4321'
18781 cat <<'EOM'
18782(I can't seem to compile the test program. Guessing big-endian...)
18783EOM
18784 fi
18785 case "$xxx_prompt" in
18786 y)
24412007 18787 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18788 . ./myread
18789 byteorder="$ans"
18790 ;;
18791 *) byteorder=$dflt
18792 ;;
18793 esac
18794 ;;
18795 esac
5b813a60 18796 $rm_try
4e0554ec
JH
18797 ;;
18798esac
18799
cd95ead5 18800: Checking 32bit alignedness
4e0554ec
JH
18801$cat <<EOM
18802
18803Checking to see whether you can access character data unalignedly...
18804EOM
dc7b0a4f
JH
18805case "$d_u32align" in
18806'') $cat >try.c <<EOCP
4e0554ec 18807#include <stdio.h>
d1daaddf
JH
18808#$i_stdlib I_STDLIB
18809#ifdef I_STDLIB
18810#include <stdlib.h>
18811#endif
4e0554ec 18812#define U32 $u32type
d308175a
JH
18813#define BYTEORDER 0x$byteorder
18814#define U8 $u8type
9958dc3c
JH
18815#include <signal.h>
18816#ifdef SIGBUS
7090f861 18817$signal_t bletch(int s) { exit(4); }
9958dc3c 18818#endif
4e0554ec
JH
18819int main() {
18820#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
f1c7503b
MB
18821 volatile U8 buf[8];
18822 volatile U32 *up;
4e0554ec
JH
18823 int i;
18824
18825 if (sizeof(U32) != 4) {
18826 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18827 exit(1);
18828 }
18829
18830 fflush(stdout);
18831
9958dc3c
JH
18832#ifdef SIGBUS
18833 signal(SIGBUS, bletch);
18834#endif
18835
8906a23e
JH
18836 buf[0] = 0;
18837 buf[1] = 0;
18838 buf[2] = 0;
18839 buf[3] = 1;
7eac3fd6 18840 buf[4] = 0;
8906a23e
JH
18841 buf[5] = 0;
18842 buf[6] = 0;
7eac3fd6 18843 buf[7] = 1;
8906a23e 18844
4e0554ec
JH
18845 for (i = 0; i < 4; i++) {
18846 up = (U32*)(buf + i);
18847 if (! ((*up == 1 << (8*i)) || /* big-endian */
18848 (*up == 1 << (8*(3-i))) /* little-endian */
18849 )
18850 )
18851 {
18852 printf("read failed (%x)\n", *up);
18853 exit(2);
18854 }
18855 }
18856
18857 /* write test */
18858 for (i = 0; i < 4; i++) {
18859 up = (U32*)(buf + i);
18860 *up = 0xBeef;
18861 if (*up != 0xBeef) {
18862 printf("write failed (%x)\n", *up);
18863 exit(3);
18864 }
18865 }
18866
18867 exit(0);
18868#else
18869 printf("1\n");
18870 exit(1);
18871#endif
18872 return 0;
18873}
18874EOCP
18875set try
18876if eval $compile_ok; then
d308175a 18877 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18878 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18879 case "$?" in
18880 0) cat >&4 <<EOM
18881You can access character data pretty unalignedly.
18882EOM
18883 d_u32align="$undef"
18884 ;;
18885 *) cat >&4 <<EOM
18886It seems that you must access character data in an aligned manner.
18887EOM
18888 d_u32align="$define"
18889 ;;
18890 esac
4e0554ec
JH
18891else
18892 rp='Can you access character data at unaligned addresses?'
18893 dflt='n'
18894 . ./myread
18895 case "$ans" in
18896 [yY]*) d_u32align="$undef" ;;
18897 *) d_u32align="$define" ;;
18898 esac
18899fi
5b813a60 18900$rm_try
dc7b0a4f
JH
18901;;
18902esac
4e0554ec
JH
18903
18904: see if ualarm exists
18905set ualarm d_ualarm
18906eval $inlibc
18907
b4eb6b3d
JH
18908: see if umask exists
18909set umask d_umask
18910eval $inlibc
18911
758a5d79
JH
18912: see if unordered exists
18913set unordered d_unordered
18914eval $inlibc
18915
bdf33aa7
SP
18916: see if unsetenv exists
18917set unsetenv d_unsetenv
18918eval $inlibc
18919
4e0554ec
JH
18920: see if usleep exists
18921set usleep d_usleep
18922eval $inlibc
18923
2ef53570
JH
18924: see if prototype for usleep is available
18925echo " "
18926set d_usleepproto usleep $i_unistd unistd.h
18927eval $hasproto
18928
b4eb6b3d
JH
18929: see if ustat exists
18930set ustat d_ustat
18931eval $inlibc
18932
b4eb6b3d
JH
18933: see if closedir exists
18934set closedir d_closedir
18935eval $inlibc
18936
18937case "$d_closedir" in
18938"$define")
18939 echo " "
18940 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18941 cat > try.c <<EOM
b4eb6b3d
JH
18942#$i_dirent I_DIRENT /**/
18943#$i_sysdir I_SYS_DIR /**/
18944#$i_sysndir I_SYS_NDIR /**/
18945#$i_systypes I_SYS_TYPES /**/
18946
18947#if defined(I_SYS_TYPES)
18948#include <sys/types.h>
18949#endif
18950#if defined(I_DIRENT)
18951#include <dirent.h>
18952#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18953#include <sys/dir.h>
18954#endif
18955#else
18956#ifdef I_SYS_NDIR
18957#include <sys/ndir.h>
18958#else
18959#ifdef I_SYS_DIR
18960#ifdef hp9000s500
18961#include <ndir.h> /* may be wrong in the future */
18962#else
18963#include <sys/dir.h>
18964#endif
18965#endif
18966#endif
5b813a60 18967#endif
b4eb6b3d
JH
18968int main() { return closedir(opendir(".")); }
18969EOM
5440bc8e 18970 set try
b4eb6b3d 18971 if eval $compile_ok; then
5440bc8e 18972 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18973 echo "Yes, it does."
18974 val="$undef"
18975 else
18976 echo "No, it doesn't."
18977 val="$define"
18978 fi
18979 else
18980 echo "(I can't seem to compile the test program--assuming it doesn't)"
18981 val="$define"
18982 fi
18983 ;;
18984*)
18985 val="$undef";
18986 ;;
18987esac
18988set d_void_closedir
18989eval $setvar
5b813a60
MB
18990$rm_try
18991
b4eb6b3d
JH
18992: see if there is a wait4
18993set wait4 d_wait4
18994eval $inlibc
18995
18996: see if waitpid exists
18997set waitpid d_waitpid
18998eval $inlibc
18999
19000: see if wcstombs exists
19001set wcstombs d_wcstombs
19002eval $inlibc
19003
19004: see if wctomb exists
19005set wctomb d_wctomb
19006eval $inlibc
19007
4e0554ec
JH
19008: see if writev exists
19009set writev d_writev
19010eval $inlibc
19011
b4eb6b3d
JH
19012: preserve RCS keywords in files with variable substitution, grrr
19013Date='$Date'
19014Id='$Id'
19015Log='$Log'
19016RCSfile='$RCSfile'
19017Revision='$Revision'
19018
b4eb6b3d
JH
19019: check for alignment requirements
19020echo " "
588c1107 19021case "$usecrosscompile" in
b4eb6b3d
JH
19022*$define*)
19023 $cat <<EOM
588c1107 19024You seem to be cross-compiling. Skipping the memory alignment check.
b4eb6b3d
JH
19025
19026EOM
19027 case "$alignbytes" in
19028 '') alignbytes=8 ;;
19029 esac
19030 ;;
19031*)
19032 case "$alignbytes" in
19033 '') echo "Checking alignment constraints..." >&4
19034 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19035 $cat >try.c <<'EOCP'
19036typedef long double NV;
19037EOCP
19038 else
19039 $cat >try.c <<'EOCP'
19040typedef double NV;
19041EOCP
19042 fi
19043 $cat >>try.c <<'EOCP'
19044#include <stdio.h>
19045struct foobar {
19046 char foo;
19047 NV bar;
19048} try_algn;
19049int main()
19050{
19051 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19052 return(0);
19053}
19054EOCP
19055 set try
19056 if eval $compile_ok; then
5440bc8e 19057 dflt=`$run ./try`
b4eb6b3d
JH
19058 else
19059 dflt='8'
19060 echo "(I can't seem to compile the test program...)"
19061 fi
588c1107
AD
19062 case "$multiarch" in
19063 *$define*)
19064 : The usual safe value is 8, but Darwin with -Duselongdouble
19065 : needs 16. Hence, we will take 8 as a minimum, but allow
19066 : Configure to pick a larger value if needed.
19067 if $test "$dflt" -lt 8; then
19068 dflt='8'
19069 echo "Setting alignment to 8 for multiarch support.">&4
19070 fi
19071 ;;
19072 esac
b4eb6b3d
JH
19073 ;;
19074 *) dflt="$alignbytes"
19075 ;;
19076 esac
19077 rp="Doubles must be aligned on a how-many-byte boundary?"
19078 . ./myread
19079 alignbytes="$ans"
5b813a60 19080 $rm_try
b4eb6b3d
JH
19081 ;;
19082esac
19083
19084
19085: set the base revision
19086baserev=5.0
19087
89c1d914
MB
19088: length of character in bytes. Is always 1, otherwise it isnt C
19089: This used to be a test using sizeof
19090charsize=1
c193ef60
MB
19091
19092: Check for the number of bits in a character
19093case "$charbits" in
19094'') echo "Checking how long a character is (in bits)..." >&4
19095 $cat >try.c <<EOCP
19096#include <stdio.h>
19097int main ()
19098{
19099 int n;
19100 unsigned char c;
19101 for (c = 1, n = 0; c; c <<= 1, n++) ;
19102 printf ("%d\n", n);
19103 return (0);
19104 }
19105EOCP
19106 set try
19107 if eval $compile_ok; then
19108 dflt=`$run ./try`
19109 else
19110 dflt='8'
19111 echo "(I can't seem to compile the test program. Guessing...)"
19112 fi
19113 ;;
19114*)
19115 dflt="$charbits"
19116 ;;
19117esac
19118rp="What is the length of a character (in bits)?"
19119. ./myread
19120charbits="$ans"
19121$rm_try
19122case "$charbits" in
191238) ;;
19124*) cat >&4 << EOM
19125Your system has an unsigned character size of $charbits bits, which
19126is rather unusual (normally it is 8 bits). Perl likely will not work
19127correctly on your system, with subtle bugs in various places.
19128EOM
19129 rp='Do you really want to continue?'
19130 dflt='n'
19131 . ./myread
19132 case "$ans" in
19133 [yY]) echo >&4 "Okay, continuing." ;;
19134 *) exit 1 ;;
19135 esac
19136esac
19137
3099fc99 19138: how do we concatenate cpp tokens here?
b4eb6b3d 19139echo " "
3099fc99 19140echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
19141$cat >cpp_stuff.c <<'EOCP'
19142#define RCAT(a,b)a/**/b
19143#define ACAT(a,b)a ## b
19144RCAT(Rei,ser)
19145ACAT(Cir,cus)
19146EOCP
19147$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19148if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19149 echo "Oh! Smells like ANSI's been here." >&4
19150 echo "We can catify or stringify, separately or together!"
19151 cpp_stuff=42
19152elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19153 echo "Ah, yes! The good old days!" >&4
19154 echo "However, in the good old days we don't know how to stringify and"
19155 echo "catify at the same time."
19156 cpp_stuff=1
19157else
19158 $cat >&4 <<EOM
3099fc99
CW
19159Hmm, I don't seem to be able to concatenate tokens with your cpp.
19160You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
19161EOM
19162 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19163fi
19164$rm -f cpp_stuff.*
19165
19166: see if this is a db.h system
19167set db.h i_db
19168eval $inhdr
19169
19170case "$i_db" in
19171$define)
19172 : Check db version.
19173 echo " "
19174 echo "Checking Berkeley DB version ..." >&4
19175 $cat >try.c <<EOCP
19176#$d_const HASCONST
19177#ifndef HASCONST
19178#define const
19179#endif
19180#include <sys/types.h>
19181#include <stdio.h>
55954f19
JH
19182#$i_stdlib I_STDLIB
19183#ifdef I_STDLIB
19184#include <stdlib.h>
19185#endif
b4eb6b3d 19186#include <db.h>
640374d0 19187int main(int argc, char *argv[])
b4eb6b3d
JH
19188{
19189#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19190 int Major, Minor, Patch ;
19191 unsigned long Version ;
19192 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
19193 if (argc == 2) {
19194 printf("%d %d %d %d %d %d\n",
19195 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19196 Major, Minor, Patch);
19197 exit(0);
19198 }
19199 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
19200
19201 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19202 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19203 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19204 Major, Minor, Patch) ;
19205
19206 /* check that db.h & libdb are compatible */
19207 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 19208 printf("db.h and libdb are incompatible.\n") ;
5b813a60 19209 exit(3);
b4eb6b3d
JH
19210 }
19211
640374d0 19212 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
19213
19214 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19215 + DB_VERSION_PATCH ;
19216
19217 /* needs to be >= 2.3.4 */
19218 if (Version < 2003004) {
19219 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 19220 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 19221 exit(2);
b4eb6b3d
JH
19222 }
19223
19224 exit(0);
19225#else
19226#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
19227 if (argc == 2) {
19228 printf("1 0 0\n");
19229 exit(0);
19230 }
19231 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
19232 exit(0); /* DB version < 2: the coast is clear. */
19233#else
19234 exit(1); /* <db.h> not Berkeley DB? */
19235#endif
19236#endif
19237}
19238EOCP
19239 set try
5440bc8e 19240 if eval $compile_ok && $run ./try; then
b4eb6b3d 19241 echo 'Looks OK.' >&4
5440bc8e 19242 set `$run ./try 1`
640374d0
JH
19243 db_version_major=$1
19244 db_version_minor=$2
19245 db_version_patch=$3
b4eb6b3d
JH
19246 else
19247 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
19248 i_db=$undef
19249 case " $libs " in
19250 *"-ldb "*)
19251 : Remove db from list of libraries to use
19252 echo "Removing unusable -ldb from library list" >&4
19253 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19254 shift
19255 libs="$*"
19256 echo "libs = $libs" >&4
19257 ;;
19258 esac
19259 fi
5b813a60 19260 $rm_try
b4eb6b3d
JH
19261 ;;
19262esac
19263
19264case "$i_db" in
19265define)
5b813a60 19266 : Check the return type needed for hash
b4eb6b3d
JH
19267 echo " "
19268 echo "Checking return type needed for hash for Berkeley DB ..." >&4
19269 $cat >try.c <<EOCP
19270#$d_const HASCONST
19271#ifndef HASCONST
19272#define const
19273#endif
19274#include <sys/types.h>
19275#include <db.h>
19276
19277#ifndef DB_VERSION_MAJOR
19278u_int32_t hash_cb (ptr, size)
19279const void *ptr;
19280size_t size;
19281{
19282}
19283HASHINFO info;
19284int main()
19285{
19286 info.hash = hash_cb;
19287}
19288#endif
19289EOCP
19290 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19291 if $contains warning try.out >>/dev/null 2>&1 ; then
19292 db_hashtype='int'
19293 else
19294 db_hashtype='u_int32_t'
19295 fi
19296 else
19297 : XXX Maybe we should just give up here.
19298 db_hashtype=u_int32_t
19299 $cat try.out >&4
19300 echo "Help: I can't seem to compile the db test program." >&4
19301 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19302 fi
5b813a60 19303 $rm_try
b4eb6b3d
JH
19304 echo "Your version of Berkeley DB uses $db_hashtype for hash."
19305 ;;
19306*) db_hashtype=u_int32_t
19307 ;;
19308esac
19309case "$i_db" in
19310define)
5b813a60 19311 : Check the return type needed for prefix
b4eb6b3d
JH
19312 echo " "
19313 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19314 cat >try.c <<EOCP
19315#$d_const HASCONST
19316#ifndef HASCONST
19317#define const
19318#endif
19319#include <sys/types.h>
19320#include <db.h>
19321
19322#ifndef DB_VERSION_MAJOR
19323size_t prefix_cb (key1, key2)
19324const DBT *key1;
19325const DBT *key2;
19326{
19327}
19328BTREEINFO info;
19329int main()
19330{
19331 info.prefix = prefix_cb;
19332}
19333#endif
19334EOCP
19335 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19336 if $contains warning try.out >>/dev/null 2>&1 ; then
19337 db_prefixtype='int'
19338 else
19339 db_prefixtype='size_t'
19340 fi
19341 else
19342 db_prefixtype='size_t'
19343 : XXX Maybe we should just give up here.
19344 $cat try.out >&4
19345 echo "Help: I can't seem to compile the db test program." >&4
19346 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19347 fi
5b813a60 19348 $rm_try
b4eb6b3d
JH
19349 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19350 ;;
19351*) db_prefixtype='size_t'
19352 ;;
19353esac
19354
b4eb6b3d
JH
19355: How can we generate normalized random numbers ?
19356echo " "
19357echo "Looking for a random number function..." >&4
19358case "$randfunc" in
19359'')
19360 if set drand48 val -f; eval $csym; $val; then
19361 dflt="drand48"
19362 echo "Good, found drand48()." >&4
19363 elif set random val -f; eval $csym; $val; then
19364 dflt="random"
19365 echo "OK, found random()." >&4
19366 else
19367 dflt="rand"
19368 echo "Yick, looks like I have to use rand()." >&4
19369 fi
19370 echo " "
19371 ;;
19372*)
19373 dflt="$randfunc"
19374 ;;
19375esac
19376cont=true
19377
19378case "$ccflags" in
19379*-Dmy_rand=*|*-Dmy_srand=*)
19380 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19381 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19382 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19383 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19384 ;;
19385esac
19386
19387while $test "$cont"; do
19388 rp="Use which function to generate random numbers?"
19389 . ./myread
19390 if $test "$ans" = "$dflt"; then
19391 : null
19392 else
19393 randbits=''
19394 fi
19395 randfunc="$ans"
19396 if set $ans val -f; eval $csym; $val; then
19397 cont=''
19398 else
19399 dflt=y
19400 rp="I cannot find function $ans. Use that name anyway?"
19401 . ./myread
19402 dflt=rand
19403 case "$ans" in
19404 [yY]*) cont='';;
19405 esac
19406 fi
19407 case "$cont" in
19408 '')
19409 case "$randfunc" in
19410 drand48)
19411 drand01="drand48()"
19412 seedfunc="srand48"
19413 randbits=48
19414 randseedtype=long
19415 ;;
19416 rand|random)
19417 case "$randbits" in
19418 '')
19419echo "Checking to see how many bits your $randfunc() function produces..." >&4
19420 $cat >try.c <<EOCP
19421#$i_unistd I_UNISTD
19422#$i_stdlib I_STDLIB
19423#include <stdio.h>
19424#ifdef I_UNISTD
19425# include <unistd.h>
19426#endif
19427#ifdef I_STDLIB
19428# include <stdlib.h>
19429#endif
19430int main()
19431{
19432 register int i;
19433 register unsigned long tmp;
19434 register unsigned long max = 0L;
19435
19436 for (i = 1000; i; i--) {
19437 tmp = (unsigned long) $randfunc();
19438 if (tmp > max) max = tmp;
19439 }
19440 for (i = 0; max; i++)
19441 max /= 2;
19442 printf("%d\n",i);
19443}
19444EOCP
19445 set try
19446 if eval $compile_ok; then
19447 dflt=`try`
19448 else
19449 dflt='?'
19450 echo "(I can't seem to compile the test program...)"
19451 fi
19452 ;;
19453 *)
19454 dflt="$randbits"
19455 ;;
19456 esac
19457 rp="How many bits does your $randfunc() function produce?"
19458 . ./myread
19459 randbits="$ans"
5b813a60 19460 $rm_try
b4eb6b3d
JH
19461 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19462 seedfunc="s$randfunc"
19463 randseedtype=unsigned
19464 ;;
19465 *)
19466 dflt="31"
19467 rp="How many bits does your $randfunc() function produce?"
19468 . ./myread
19469 randbits="$ans"
19470 seedfunc="s$randfunc"
19471 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19472 if set $seedfunc val -f; eval $csym; $val; then
19473 echo "(Using $seedfunc() to seed random generator)"
19474 else
19475 echo "(Warning: no $seedfunc() to seed random generator)"
19476 seedfunc=rand
19477 fi
19478 randseedtype=unsigned
19479 ;;
19480 esac
19481 ;;
19482 esac
19483done
19484
613d6c3e 19485: Determine if this is an EBCDIC system
b4eb6b3d
JH
19486echo " "
19487echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 19488$cat >try.c <<'EOM'
b4eb6b3d
JH
19489int main()
19490{
19491 if ('M'==0xd4) return 0;
19492 return 1;
19493}
19494EOM
19495
19496val=$undef
5440bc8e 19497set try
b4eb6b3d 19498if eval $compile_ok; then
5440bc8e 19499 if $run ./try; then
b4eb6b3d
JH
19500 echo "You seem to speak EBCDIC." >&4
19501 val="$define"
19502 else
5440bc8e 19503 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
19504 fi
19505else
19506 echo "I'm unable to compile the test program." >&4
19507 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19508fi
5b813a60 19509$rm_try
b4eb6b3d
JH
19510set ebcdic
19511eval $setvar
19512
613d6c3e 19513: Check how to flush
b4eb6b3d
JH
19514echo " "
19515$cat >&4 <<EOM
19516Checking how to flush all pending stdio output...
19517EOM
19518# I only know how to find the first 32 possibly open files on SunOS.
19519# See also hints/sunos_4_1.sh and util.c --AD
19520case "$osname" in
19521sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19522esac
19523$cat >>try.c <<EOCP
19524#include <stdio.h>
55954f19
JH
19525#$i_stdlib I_STDLIB
19526#ifdef I_STDLIB
19527#include <stdlib.h>
19528#endif
b4eb6b3d
JH
19529#$i_unistd I_UNISTD
19530#ifdef I_UNISTD
19531# include <unistd.h>
19532#endif
19533#$d_sysconf HAS_SYSCONF
19534#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19535#ifdef HAS_STDIO_STREAM_ARRAY
19536# define STDIO_STREAM_ARRAY $stdio_stream_array
19537#endif
19538int main() {
5440bc8e
JH
19539 FILE* p;
19540 unlink("try.out");
19541 p = fopen("try.out", "w");
b4eb6b3d
JH
19542#ifdef TRY_FPUTC
19543 fputc('x', p);
19544#else
19545# ifdef TRY_FPRINTF
19546 fprintf(p, "x");
19547# endif
19548#endif
19549#ifdef TRY_FFLUSH_NULL
19550 fflush(NULL);
19551#endif
19552#ifdef TRY_FFLUSH_ALL
19553 {
19554 long open_max = -1;
19555# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19556 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19557# else
19558# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19559 open_max = sysconf(_SC_OPEN_MAX);
19560# else
19561# ifdef FOPEN_MAX
19562 open_max = FOPEN_MAX;
19563# else
19564# ifdef OPEN_MAX
19565 open_max = OPEN_MAX;
19566# else
19567# ifdef _NFILE
19568 open_max = _NFILE;
19569# endif
19570# endif
19571# endif
19572# endif
5b813a60 19573# endif
b4eb6b3d
JH
19574# ifdef HAS_STDIO_STREAM_ARRAY
19575 if (open_max > 0) {
19576 long i;
19577 for (i = 0; i < open_max; i++)
19578 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19579 STDIO_STREAM_ARRAY[i]._file < open_max &&
19580 STDIO_STREAM_ARRAY[i]._flag)
19581 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 19582 }
b4eb6b3d
JH
19583 }
19584# endif
19585#endif
19586 _exit(42);
19587}
19588EOCP
19589: first we have to find out how _not_ to flush
5440bc8e 19590$to try.c
b4eb6b3d
JH
19591if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19592 output=''
19593 set try -DTRY_FPUTC
19594 if eval $compile; then
fbe73d74 19595 $run ./try 2>/dev/null
28f5ac64 19596 code="$?"
5440bc8e 19597 $from try.out
28f5ac64 19598 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19599 output=-DTRY_FPUTC
19600 fi
19601 fi
19602 case "$output" in
19603 '')
19604 set try -DTRY_FPRINTF
b4eb6b3d 19605 if eval $compile; then
fbe73d74 19606 $run ./try 2>/dev/null
28f5ac64 19607 code="$?"
5440bc8e 19608 $from try.out
28f5ac64 19609 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19610 output=-DTRY_FPRINTF
19611 fi
19612 fi
19613 ;;
19614 esac
19615fi
19616: check for fflush NULL behaviour
19617case "$fflushNULL" in
19618'') set try -DTRY_FFLUSH_NULL $output
19619 if eval $compile; then
5440bc8e 19620 $run ./try 2>/dev/null
b4eb6b3d 19621 code="$?"
5440bc8e 19622 $from try.out
b4eb6b3d
JH
19623 if $test -s try.out -a "X$code" = X42; then
19624 fflushNULL="`$cat try.out`"
19625 else
19626 if $test "X$code" != X42; then
19627 $cat >&4 <<EOM
19628(If this test failed, don't worry, we'll try another method shortly.)
19629EOM
19630 fi
19631 fi
19632 fi
2c476adc 19633 $rm -f core try.core core.try.*
b4eb6b3d
JH
19634 case "$fflushNULL" in
19635 x) $cat >&4 <<EOM
19636Your fflush(NULL) works okay for output streams.
19637Let's see if it clobbers input pipes...
19638EOM
19639# As of mid-March 2000 all versions of Solaris appear to have a stdio
19640# bug that improperly flushes the input end of pipes. So we avoid the
19641# autoflush on fork/system/exec support for now. :-(
19642$cat >tryp.c <<EOCP
19643#include <stdio.h>
19644int
19645main(int argc, char **argv)
19646{
19647 char buf[1024];
19648 int i;
19649 char *bp = buf;
19650 while (1) {
19651 while ((i = getc(stdin)) != -1
19652 && (*bp++ = i) != '\n'
19653 && bp < &buf[1024])
19654 /* DO NOTHING */ ;
19655 *bp = '\0';
19656 fprintf(stdout, "%s", buf);
19657 fflush(NULL);
19658 if (i == -1)
19659 return 0;
19660 bp = buf;
19661 }
19662}
19663EOCP
19664 fflushNULL="$define"
19665 set tryp
19666 if eval $compile; then
19667 $rm -f tryp.out
5440bc8e 19668 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19669 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19670 $cat >&4 <<EOM
19671fflush(NULL) seems to behave okay with input streams.
19672EOM
19673 fflushNULL="$define"
19674 else
19675 $cat >&4 <<EOM
19676Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19677EOM
19678 fflushNULL="$undef"
19679 fi
19680 fi
19681 $rm -f core tryp.c tryp.core core.tryp.*
19682 ;;
19683 '') $cat >&4 <<EOM
19684Your fflush(NULL) isn't working (contrary to ANSI C).
19685EOM
19686 fflushNULL="$undef"
19687 ;;
19688 *) $cat >&4 <<EOM
19689Cannot figure out whether your fflush(NULL) works or not.
19690I'm assuming it doesn't (contrary to ANSI C).
19691EOM
19692 fflushNULL="$undef"
19693 ;;
19694 esac
19695 ;;
19696$define|true|[yY]*)
19697 fflushNULL="$define"
19698 ;;
19699*)
19700 fflushNULL="$undef"
19701 ;;
19702esac
19703: check explicit looping only if NULL did not work, and if the pipe
19704: bug does not show up on an explicit flush too
19705case "$fflushNULL" in
19706"$undef")
19707 $cat >tryp.c <<EOCP
19708#include <stdio.h>
19709int
19710main(int argc, char **argv)
19711{
19712 char buf[1024];
19713 int i;
19714 char *bp = buf;
19715 while (1) {
19716 while ((i = getc(stdin)) != -1
19717 && (*bp++ = i) != '\n'
19718 && bp < &buf[1024])
19719 /* DO NOTHING */ ;
19720 *bp = '\0';
19721 fprintf(stdout, "%s", buf);
19722 fflush(stdin);
19723 if (i == -1)
19724 return 0;
19725 bp = buf;
19726 }
19727}
19728EOCP
19729 set tryp
19730 if eval $compile; then
19731 $rm -f tryp.out
5440bc8e 19732 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19733 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19734 $cat >&4 <<EOM
19735Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19736EOM
19737 : now check for fflushall behaviour
19738 case "$fflushall" in
19739 '') set try -DTRY_FFLUSH_ALL $output
19740 if eval $compile; then
19741 $cat >&4 <<EOM
19742(Now testing the other method--but note that this also may fail.)
19743EOM
5440bc8e 19744 $run ./try 2>/dev/null
28f5ac64 19745 code=$?
fbe73d74 19746 $from try.out
28f5ac64 19747 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19748 fflushall="`$cat try.out`"
19749 fi
19750 fi
5b813a60 19751 $rm_try
b4eb6b3d
JH
19752 case "$fflushall" in
19753 x) $cat >&4 <<EOM
19754Whew. Flushing explicitly all the stdio streams works.
19755EOM
19756 fflushall="$define"
19757 ;;
19758 '') $cat >&4 <<EOM
19759Sigh. Flushing explicitly all the stdio streams doesn't work.
19760EOM
19761 fflushall="$undef"
19762 ;;
19763 *) $cat >&4 <<EOM
19764Cannot figure out whether flushing stdio streams explicitly works or not.
19765I'm assuming it doesn't.
19766EOM
19767 fflushall="$undef"
19768 ;;
19769 esac
19770 ;;
19771 "$define"|true|[yY]*)
19772 fflushall="$define"
19773 ;;
19774 *)
19775 fflushall="$undef"
19776 ;;
19777 esac
19778 else
19779 $cat >&4 <<EOM
19780All is futile. Even fflush(stdin) clobbers input pipes!
19781EOM
19782 fflushall="$undef"
19783 fi
19784 else
19785 fflushall="$undef"
19786 fi
19787 $rm -f core tryp.c tryp.core core.tryp.*
19788 ;;
19789*) fflushall="$undef"
19790 ;;
19791esac
19792
19793case "$fflushNULL$fflushall" in
19794undefundef)
19795 $cat <<EOM
19796OK, I give up. I cannot figure out how to flush pending stdio output.
19797We won't be flushing handles at all before fork/exec/popen.
19798EOM
19799 ;;
19800esac
34f1896b 19801$rm_try tryp
b4eb6b3d
JH
19802
19803: Store the full pathname to the ar program for use in the C program
19804: Respect a hint or command line value for full_ar.
19805case "$full_ar" in
19806'') full_ar=$ar ;;
19807esac
19808
19809: Store the full pathname to the sed program for use in the C program
19810full_sed=$sed
19811
19812: see what type gids are declared as in the kernel
19813echo " "
19814echo "Looking for the type for group ids returned by getgid()."
19815set gid_t gidtype xxx stdio.h sys/types.h
19816eval $typedef
19817case "$gidtype" in
19818xxx)
19819 xxx=`./findhdr sys/user.h`
19820 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19821 case $1 in
19822 unsigned) dflt="$1 $2" ;;
19823 *) dflt="$1" ;;
19824 esac
19825 ;;
19826*) dflt="$gidtype";;
19827esac
19828case "$gidtype" in
19829gid_t) echo "gid_t found." ;;
19830*) rp="What is the type for group ids returned by getgid()?"
19831 . ./myread
19832 gidtype="$ans"
19833 ;;
19834esac
19835
613d6c3e 19836: Check the size of GID
b4eb6b3d
JH
19837echo " "
19838case "$gidtype" in
19839*_t) zzz="$gidtype" ;;
19840*) zzz="gid" ;;
19841esac
613d6c3e 19842echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
19843cat > try.c <<EOCP
19844#include <sys/types.h>
19845#include <stdio.h>
d1daaddf
JH
19846#$i_stdlib I_STDLIB
19847#ifdef I_STDLIB
19848#include <stdlib.h>
19849#endif
b4eb6b3d
JH
19850int main() {
19851 printf("%d\n", (int)sizeof($gidtype));
19852 exit(0);
19853}
19854EOCP
19855set try
19856if eval $compile_ok; then
5440bc8e 19857 yyy=`$run ./try`
b4eb6b3d
JH
19858 case "$yyy" in
19859 '') gidsize=4
19860 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19861 ;;
19862 *) gidsize=$yyy
19863 echo "Your $zzz is $gidsize bytes long."
19864 ;;
19865 esac
19866else
19867 gidsize=4
19868 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19869fi
19870
19871
613d6c3e 19872: Check if GID is signed
b4eb6b3d
JH
19873echo " "
19874case "$gidtype" in
19875*_t) zzz="$gidtype" ;;
19876*) zzz="gid" ;;
19877esac
613d6c3e 19878echo "Checking the sign of $zzz..." >&4
b4eb6b3d
JH
19879cat > try.c <<EOCP
19880#include <sys/types.h>
19881#include <stdio.h>
19882int main() {
19883 $gidtype foo = -1;
19884 if (foo < 0)
19885 printf("-1\n");
19886 else
19887 printf("1\n");
19888}
19889EOCP
19890set try
19891if eval $compile; then
5440bc8e 19892 yyy=`$run ./try`
b4eb6b3d
JH
19893 case "$yyy" in
19894 '') gidsign=1
19895 echo "(I can't execute the test program--guessing unsigned.)" >&4
19896 ;;
19897 *) gidsign=$yyy
19898 case "$gidsign" in
19899 1) echo "Your $zzz is unsigned." ;;
19900 -1) echo "Your $zzz is signed." ;;
19901 esac
19902 ;;
19903 esac
19904else
19905 gidsign=1
19906 echo "(I can't compile the test program--guessing unsigned.)" >&4
19907fi
19908
19909
613d6c3e 19910: Check 64bit sizes
b4eb6b3d
JH
19911echo " "
19912
19913if $test X"$quadtype" != X; then
19914
19915echo "Checking how to print 64-bit integers..." >&4
19916
19917if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19918 $cat >try.c <<'EOCP'
19919#include <sys/types.h>
19920#include <stdio.h>
19921int main() {
19922 int q = 12345678901;
19923 printf("%ld\n", q);
19924}
19925EOCP
19926 set try
19927 if eval $compile; then
5440bc8e 19928 yyy=`$run ./try`
b4eb6b3d
JH
19929 case "$yyy" in
19930 12345678901)
19931 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19932 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19933 echo "We will use %d."
19934 ;;
19935 esac
19936 fi
19937fi
19938
19939if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19940 $cat >try.c <<'EOCP'
19941#include <sys/types.h>
19942#include <stdio.h>
19943int main() {
19944 long q = 12345678901;
19945 printf("%ld\n", q);
19946}
19947EOCP
19948 set try
19949 if eval $compile; then
5440bc8e 19950 yyy=`$run ./try`
b4eb6b3d
JH
19951 case "$yyy" in
19952 12345678901)
19953 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19954 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19955 echo "We will use %ld."
19956 ;;
19957 esac
19958 fi
19959fi
19960
19961if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19962 $cat >try.c <<'EOCP'
19963#include <sys/types.h>
19964#include <inttypes.h>
19965#include <stdio.h>
19966int main() {
19967 int64_t q = 12345678901;
19968 printf("%" PRId64 "\n", q);
19969}
19970EOCP
19971 set try
19972 if eval $compile; then
5440bc8e 19973 yyy=`$run ./try`
b4eb6b3d
JH
19974 case "$yyy" in
19975 12345678901)
19976 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19977 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19978 echo "We will use the C9X style."
19979 ;;
19980 esac
19981 fi
19982fi
19983
2ef53570
JH
19984if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19985 $cat >try.c <<EOCP
b4eb6b3d
JH
19986#include <sys/types.h>
19987#include <stdio.h>
19988int main() {
2ef53570
JH
19989 $quadtype q = 12345678901;
19990 printf("%Ld\n", q);
b4eb6b3d
JH
19991}
19992EOCP
19993 set try
19994 if eval $compile; then
5440bc8e 19995 yyy=`$run ./try`
b4eb6b3d
JH
19996 case "$yyy" in
19997 12345678901)
2ef53570
JH
19998 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19999 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20000 echo "We will use %Ld."
b4eb6b3d
JH
20001 ;;
20002 esac
20003 fi
20004fi
20005
2ef53570
JH
20006if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20007 $cat >try.c <<'EOCP'
b4eb6b3d
JH
20008#include <sys/types.h>
20009#include <stdio.h>
20010int main() {
2ef53570
JH
20011 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20012 printf("%lld\n", q);
b4eb6b3d
JH
20013}
20014EOCP
20015 set try
20016 if eval $compile; then
5440bc8e 20017 yyy=`$run ./try`
b4eb6b3d
JH
20018 case "$yyy" in
20019 12345678901)
2ef53570
JH
20020 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20021 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20022 echo "We will use the %lld style."
b4eb6b3d
JH
20023 ;;
20024 esac
20025 fi
20026fi
20027
20028if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20029 $cat >try.c <<EOCP
20030#include <sys/types.h>
20031#include <stdio.h>
20032int main() {
20033 $quadtype q = 12345678901;
20034 printf("%qd\n", q);
20035}
20036EOCP
20037 set try
20038 if eval $compile; then
5440bc8e 20039 yyy=`$run ./try`
b4eb6b3d
JH
20040 case "$yyy" in
20041 12345678901)
20042 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20043 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20044 echo "We will use %qd."
20045 ;;
20046 esac
20047 fi
20048fi
20049
20050if $test X"$sPRId64" = X; then
20051 echo "Cannot figure out how to print 64-bit integers." >&4
20052fi
5b813a60 20053$rm_try
b4eb6b3d
JH
20054
20055fi
20056
20057case "$sPRId64" in
5b813a60
MB
20058'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20059 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 20060 ;;
5b813a60
MB
20061*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20062 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
20063 ;;
20064esac
20065
34f1896b 20066: Check format strings for internal types
b4eb6b3d
JH
20067echo " "
20068$echo "Checking the format strings to be used for Perl's internal types..." >&4
20069
20070if $test X"$ivsize" = X8; then
20071 ivdformat="$sPRId64"
20072 uvuformat="$sPRIu64"
20073 uvoformat="$sPRIo64"
20074 uvxformat="$sPRIx64"
20075 uvXUformat="$sPRIXU64"
20076else
20077 if $test X"$ivsize" = X"$longsize"; then
20078 ivdformat='"ld"'
20079 uvuformat='"lu"'
20080 uvoformat='"lo"'
20081 uvxformat='"lx"'
20082 uvXUformat='"lX"'
20083 else
20084 if $test X"$ivsize" = X"$intsize"; then
20085 ivdformat='"d"'
20086 uvuformat='"u"'
20087 uvoformat='"o"'
20088 uvxformat='"x"'
20089 uvXUformat='"X"'
20090 else
20091 : far out
20092 if $test X"$ivsize" = X"$shortsize"; then
20093 ivdformat='"hd"'
20094 uvuformat='"hu"'
20095 uvoformat='"ho"'
20096 uvxformat='"hx"'
20097 uvXUformat='"hX"'
20098 fi
20099 fi
20100 fi
20101fi
20102
20103if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20104 nveformat="$sPRIeldbl"
20105 nvfformat="$sPRIfldbl"
20106 nvgformat="$sPRIgldbl"
20107 nvEUformat="$sPRIEUldbl"
20108 nvFUformat="$sPRIFUldbl"
20109 nvGUformat="$sPRIGUldbl"
20110else
20111 nveformat='"e"'
20112 nvfformat='"f"'
20113 nvgformat='"g"'
20114 nvEUformat='"E"'
20115 nvFUformat='"F"'
20116 nvGUformat='"G"'
20117fi
20118
20119case "$ivdformat" in
3c728e00 20120'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
20121 exit 1
20122 ;;
20123esac
20124
34f1896b 20125: Check format string for GID
b4eb6b3d
JH
20126
20127echo " "
20128$echo "Checking the format string to be used for gids..." >&4
20129
20130case "$gidsign" in
20131-1) if $test X"$gidsize" = X"$ivsize"; then
20132 gidformat="$ivdformat"
20133 else
20134 if $test X"$gidsize" = X"$longsize"; then
20135 gidformat='"ld"'
20136 else
20137 if $test X"$gidsize" = X"$intsize"; then
20138 gidformat='"d"'
20139 else
20140 if $test X"$gidsize" = X"$shortsize"; then
20141 gidformat='"hd"'
20142 fi
20143 fi
20144 fi
20145 fi
20146 ;;
20147*) if $test X"$gidsize" = X"$uvsize"; then
20148 gidformat="$uvuformat"
20149 else
20150 if $test X"$gidsize" = X"$longsize"; then
20151 gidformat='"lu"'
20152 else
20153 if $test X"$gidsize" = X"$intsize"; then
20154 gidformat='"u"'
20155 else
20156 if $test X"$gidsize" = X"$shortsize"; then
20157 gidformat='"hu"'
20158 fi
20159 fi
20160 fi
20161 fi
20162 ;;
20163esac
20164
20165: see if getgroups exists
20166set getgroups d_getgrps
20167eval $inlibc
20168
20169: see if setgroups exists
20170set setgroups d_setgrps
20171eval $inlibc
20172
b4eb6b3d
JH
20173: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20174echo " "
20175case "$d_getgrps$d_setgrps" in
20176*define*)
20177 case "$groupstype" in
20178 '') dflt="$gidtype" ;;
20179 *) dflt="$groupstype" ;;
20180 esac
20181 $cat <<EOM
20182What type of pointer is the second argument to getgroups() and setgroups()?
20183Usually this is the same as group ids, $gidtype, but not always.
20184
20185EOM
20186 rp='What type pointer is the second argument to getgroups() and setgroups()?'
20187 . ./myread
20188 groupstype="$ans"
20189 ;;
20190*) groupstype="$gidtype";;
20191esac
20192
613d6c3e 20193: MAD = Misc Attribute Definition
d620c7b3 20194
fd655d33
NC
20195if $test $patchlevel -lt 9; then
20196: MAD is not available in 5.8.x or earlier.
20197 ans=n;
20198else
20199 case "$mad" in
20200 $define|true|[yY]*) dflt='y' ;;
20201 *) dflt='n' ;;
20202 esac
20203 cat <<EOM
d620c7b3
MB
20204
20205Would you like to build with Misc Attribute Decoration? This is development
20206work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20207overhead on the interpreter.
20208
20209If this doesn't make any sense to you, just accept the default '$dflt'.
20210EOM
fd655d33
NC
20211 rp='Build Perl with MAD?'
20212 . ./myread
20213fi
d620c7b3 20214case "$ans" in
00e74f14
NC
20215y|Y) val="$define"
20216 madlyh='madly.h madly.act madly.tab'
20217 madlysrc='madly.c'
20218 madlyobj="madly$_o" ;;
20219*) val="$undef"
20220 madlyh=''
20221 madlysrc=''
20222 madlyobj='' ;;
d620c7b3
MB
20223esac
20224set mad
20225eval $setvar
20226
216dac04 20227: check whether make sets MAKE
b4eb6b3d
JH
20228echo " "
20229echo "Checking if your $make program sets \$(MAKE)..." >&4
20230case "$make_set_make" in
20231'')
20232 $sed 's/^X //' > testmake.mak << 'EOF'
20233Xall:
20234X @echo 'maketemp="$(MAKE)"'
20235EOF
20236 case "`$make -f testmake.mak 2>/dev/null`" in
20237 *maketemp=*) make_set_make='#' ;;
20238 *) make_set_make="MAKE=$make" ;;
20239 esac
20240 $rm -f testmake.mak
20241 ;;
20242esac
20243case "$make_set_make" in
20244'#') echo "Yup, it does.";;
20245*) echo "Nope, it doesn't.";;
20246esac
20247
20248: see what type is used for mode_t
20249rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20250set mode_t modetype int stdio.h sys/types.h
20251eval $typedef_ask
20252
2cc61e15
DD
20253: see if we need va_copy
20254echo " "
20255case "$i_stdarg" in
20256"$define")
20257 $cat >try.c <<EOCP
20258#include <stdarg.h>
20259#include <stdio.h>
85c8a686
DD
20260#$i_stdlib I_STDLIB
20261#ifdef I_STDLIB
20262#include <stdlib.h>
20263#endif
20264#include <signal.h>
2cc61e15
DD
20265
20266int
20267ivfprintf(FILE *f, const char *fmt, va_list *valp)
20268{
20269 return vfprintf(f, fmt, *valp);
20270}
5b813a60
MB
20271
20272int
2cc61e15
DD
20273myvfprintf(FILE *f, const char *fmt, va_list val)
20274{
20275 return ivfprintf(f, fmt, &val);
20276}
5b813a60 20277
2cc61e15 20278int
5b813a60 20279myprintf(char *fmt, ...)
2cc61e15
DD
20280{
20281 va_list val;
20282 va_start(val, fmt);
5b813a60
MB
20283 return myvfprintf(stdout, fmt, val);
20284}
2cc61e15
DD
20285
20286int
20287main(int ac, char **av)
20288{
85c8a686
DD
20289 signal(SIGSEGV, exit);
20290
5b813a60
MB
20291 myprintf("%s%cs all right, then\n", "that", '\'');
20292 exit(0);
2cc61e15
DD
20293}
20294EOCP
20295 set try
5440bc8e
JH
20296 if eval $compile && $run ./try 2>&1 >/dev/null; then
20297 case "`$run ./try`" in
2cc61e15
DD
20298 "that's all right, then")
20299 okay=yes
20300 ;;
20301 esac
20302 fi
20303 case "$okay" in
20304 yes) echo "It seems that you don't need va_copy()." >&4
20305 need_va_copy="$undef"
20306 ;;
20307 *) echo "It seems that va_copy() or similar will be needed." >&4
20308 need_va_copy="$define"
20309 ;;
20310 esac
5b813a60 20311 $rm_try
2cc61e15
DD
20312 ;;
20313*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20314 ;;
20315esac
20316
b4eb6b3d
JH
20317: see what type is used for size_t
20318rp="What is the type used for the length parameter for string functions?"
20319set size_t sizetype 'unsigned int' stdio.h sys/types.h
20320eval $typedef_ask
20321
20322: check for type of arguments to gethostbyaddr.
20323if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20324 case "$d_gethbyaddr" in
20325 $define)
20326 $cat <<EOM
20327
20328Checking to see what type of arguments are accepted by gethostbyaddr().
20329EOM
20330 hdrs="$define sys/types.h
20331 $d_socket sys/socket.h
20332 $i_niin netinet/in.h
20333 $i_netdb netdb.h
20334 $i_unistd unistd.h"
20335 : The first arg can 'char *' or 'void *'
20336 : The second arg is some of integral type
20337 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20338 for yyy in size_t long int; do
20339 case "$netdb_host_type" in
61c26d18 20340 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
b4eb6b3d
JH
20341 if ./protochk "$try" $hdrs; then
20342 echo "Your system accepts $xxx for the first arg."
20343 echo "...and $yyy for the second arg."
20344 netdb_host_type="$xxx"
20345 netdb_hlen_type="$yyy"
20346 fi
20347 ;;
20348 esac
20349 done
20350 done
20351 : In case none of those worked, prompt the user.
20352 case "$netdb_host_type" in
20353 '') rp='What is the type for the 1st argument to gethostbyaddr?'
20354 dflt='char *'
20355 . ./myread
20356 netdb_host_type=$ans
20357 rp='What is the type for the 2nd argument to gethostbyaddr?'
20358 dflt="$sizetype"
20359 . ./myread
20360 netdb_hlen_type=$ans
20361 ;;
20362 esac
20363 ;;
20364 *) : no gethostbyaddr, so pick harmless defaults
20365 netdb_host_type='char *'
20366 netdb_hlen_type="$sizetype"
20367 ;;
20368 esac
20369 # Remove the "const" if needed. -- but then we'll have a
20370 # prototype clash!
20371 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20372fi
20373
20374: check for type of argument to gethostbyname.
20375if test "X$netdb_name_type" = X ; then
20376 case "$d_gethbyname" in
20377 $define)
20378 $cat <<EOM
20379
20380Checking to see what type of argument is accepted by gethostbyname().
20381EOM
20382 hdrs="$define sys/types.h
20383 $d_socket sys/socket.h
20384 $i_niin netinet/in.h
20385 $i_netdb netdb.h
20386 $i_unistd unistd.h"
20387 for xxx in "const char *" "char *"; do
20388 case "$netdb_name_type" in
61c26d18 20389 '') try="$extern_C struct hostent *gethostbyname($xxx);"
b4eb6b3d
JH
20390 if ./protochk "$try" $hdrs; then
20391 echo "Your system accepts $xxx."
20392 netdb_name_type="$xxx"
20393 fi
20394 ;;
20395 esac
20396 done
20397 : In case none of those worked, prompt the user.
20398 case "$netdb_name_type" in
20399 '') rp='What is the type for the 1st argument to gethostbyname?'
20400 dflt='char *'
20401 . ./myread
20402 netdb_name_type=$ans
20403 ;;
20404 esac
20405 ;;
20406 *) : no gethostbyname, so pick harmless default
20407 netdb_name_type='char *'
20408 ;;
20409 esac
20410fi
20411
20412: check for type of 1st argument to getnetbyaddr.
20413if test "X$netdb_net_type" = X ; then
20414 case "$d_getnbyaddr" in
20415 $define)
20416 $cat <<EOM
20417
20418Checking to see what type of 1st argument is accepted by getnetbyaddr().
20419EOM
20420 hdrs="$define sys/types.h
20421 $d_socket sys/socket.h
20422 $i_niin netinet/in.h
20423 $i_netdb netdb.h
20424 $i_unistd unistd.h"
20425 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20426 case "$netdb_net_type" in
61c26d18 20427 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
b4eb6b3d
JH
20428 if ./protochk "$try" $hdrs; then
20429 echo "Your system accepts $xxx."
20430 netdb_net_type="$xxx"
20431 fi
20432 ;;
20433 esac
20434 done
20435 : In case none of those worked, prompt the user.
20436 case "$netdb_net_type" in
20437 '') rp='What is the type for the 1st argument to getnetbyaddr?'
20438 dflt='long'
20439 . ./myread
20440 netdb_net_type=$ans
20441 ;;
20442 esac
20443 ;;
20444 *) : no getnetbyaddr, so pick harmless default
20445 netdb_net_type='long'
20446 ;;
20447 esac
20448fi
20449: locate the preferred pager for this system
d604bb53 20450fn=f/
b4eb6b3d
JH
20451case "$pager" in
20452'')
20453 dflt=''
20454 case "$pg" in
20455 /*) dflt=$pg;;
20456 [a-zA-Z]:/*) dflt=$pg;;
20457 esac
20458 case "$more" in
20459 /*) dflt=$more;;
20460 [a-zA-Z]:/*) dflt=$more;;
20461 esac
20462 case "$less" in
20463 /*) dflt=$less;;
20464 [a-zA-Z]:/*) dflt=$less;;
20465 esac
20466 case "$dflt" in
20467 '') dflt=/usr/ucb/more;;
20468 esac
20469 ;;
d604bb53 20470*) dflt="$pager"
d604bb53 20471 ;;
b4eb6b3d 20472esac
38ab64ac 20473fn="f/($dflt)"
b4eb6b3d 20474echo " "
b4eb6b3d
JH
20475rp='What pager is used on your system?'
20476. ./getfile
20477pager="$ans"
20478
20479: see what type pids are declared as in the kernel
20480rp="What is the type of process ids on this system?"
20481set pid_t pidtype int stdio.h sys/types.h
20482eval $typedef_ask
20483
b4eb6b3d
JH
20484: see if ar generates random libraries by itself
20485echo " "
20486echo "Checking how to generate random libraries on your machine..." >&4
20487echo 'int bar1() { return bar2(); }' > bar1.c
20488echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
20489$cat > foo.c <<EOP
20490#$i_stdlib I_STDLIB
20491#ifdef I_STDLIB
20492#include <stdlib.h>
20493#endif
b4eb6b3d
JH
20494int main() { printf("%d\n", bar1()); exit(0); }
20495EOP
20496$cc $ccflags -c bar1.c >/dev/null 2>&1
20497$cc $ccflags -c bar2.c >/dev/null 2>&1
20498$cc $ccflags -c foo.c >/dev/null 2>&1
20499$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 20500if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20501 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20502 echo "$ar appears to generate random libraries itself."
20503 orderlib=false
e39a9d84
LC
20504 if [ "X$ranlib" = "X" ]; then
20505 ranlib=":"
20506 fi
88d4d47b
PC
20507elif $ar s bar$_a >/dev/null 2>&1 &&
20508 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20509 $run ./foobar >/dev/null 2>&1; then
20510 echo "a table of contents needs to be added with '$ar s'."
20511 orderlib=false
20512 ranlib="$ar s"
b4eb6b3d 20513elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 20514 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20515 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20516 echo "a table of contents needs to be added with '$ar ts'."
20517 orderlib=false
20518 ranlib="$ar ts"
20519else
20520 case "$ranlib" in
20521 :) ranlib='';;
20522 '')
20523 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20524 $test -f $ranlib || ranlib=''
20525 ;;
20526 esac
20527 if $test -n "$ranlib"; then
20528 echo "your system has '$ranlib'; we'll use that."
20529 orderlib=false
20530 else
20531 echo "your system doesn't seem to support random libraries"
20532 echo "so we'll use lorder and tsort to order the libraries."
20533 orderlib=true
20534 ranlib=":"
20535 fi
20536fi
88d4d47b 20537$rm -f foo* bar*
b4eb6b3d 20538
92a3ac59
MB
20539: see if this is a values.h system
20540set values.h i_values
20541eval $inhdr
20542
73e6e416 20543: Check the max offset that gmtime and localtime accept
92a3ac59 20544echo "Checking max offsets that gmtime () accepts"
81c4fd9e 20545
92a3ac59
MB
20546case $i_values in
20547 define) yyy="#include <values.h>" ;;
20548 *) yyy="" ;;
20549 esac
20550
690aedd1
MB
20551case "$sGMTIME_min/$sGMTIME_max" in
20552 0/0|/)
20553 $cat >try.c <<EOCP
81c4fd9e
MB
20554#include <sys/types.h>
20555#include <stdio.h>
20556#include <time.h>
92a3ac59 20557$yyy
81c4fd9e 20558
92a3ac59
MB
20559int i;
20560struct tm *tmp;
20561time_t pt;
20562
1b289682 20563void gm_check (time_t t, int min_year, int max_year)
92a3ac59 20564{
81c4fd9e 20565 tmp = gmtime (&t);
1b289682
MB
20566 if ( tmp == NULL ||
20567 /* Check tm_year overflow */
20568 tmp->tm_year < min_year || tmp->tm_year > max_year)
92a3ac59
MB
20569 tmp = NULL;
20570 else
20571 pt = t;
20572 } /* gm_check */
81c4fd9e 20573
92a3ac59
MB
20574int check_max ()
20575{
73e6e416
MB
20576 tmp = NULL;
20577 pt = 0;
92a3ac59 20578#ifdef MAXLONG
1b289682 20579 gm_check (MAXLONG, 69, 0x7fffffff);
92a3ac59 20580#endif
73e6e416
MB
20581 if (tmp == NULL || tmp->tm_year < 0) {
20582 for (i = 63; i >= 0; i--) {
20583 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20584 if (x < 0 || x < pt) continue;
20585 gm_check (x, 69, 0x7fffffff);
73e6e416
MB
20586 }
20587 }
20588 printf ("sGMTIME_max=%ld\n", pt);
20589 return (0);
1b289682 20590 } /* check_max */
81c4fd9e 20591
92a3ac59
MB
20592int check_min ()
20593{
73e6e416
MB
20594 tmp = NULL;
20595 pt = 0;
92a3ac59 20596#ifdef MINLONG
1b289682 20597 gm_check (MINLONG, -1900, 70);
92a3ac59 20598#endif
73e6e416
MB
20599 if (tmp == NULL) {
20600 for (i = 36; i >= 0; i--) {
20601 time_t x = pt - ((time_t)1 << i);
20602 if (x > 0) continue;
1b289682 20603 gm_check (x, -1900, 70);
73e6e416
MB
20604 }
20605 }
20606 printf ("sGMTIME_min=%ld\n", pt);
20607 return (0);
20608 } /* check_min */
92a3ac59
MB
20609
20610int main (int argc, char *argv[])
20611{
73e6e416
MB
20612 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20613 check_max ();
20614 check_min ();
20615 return (0);
20616 } /* main */
81c4fd9e 20617EOCP
690aedd1
MB
20618 set try
20619 if eval $compile; then
20620 eval `$run ./try`
20621 else
20622 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20623 fi
20624 $rm_try
20625 ;;
20626 esac
81c4fd9e 20627
73e6e416
MB
20628echo "Checking max offsets that localtime () accepts"
20629
690aedd1
MB
20630case "$sLOCALTIME_min/$sLOCALTIME_max" in
20631 0/0|/)
20632 $cat >try.c <<EOCP
73e6e416
MB
20633#include <sys/types.h>
20634#include <stdio.h>
20635#include <time.h>
20636$yyy
20637
20638int i;
20639struct tm *tmp;
20640time_t pt;
20641
1b289682 20642void local_check (time_t t, int min_year, int max_year)
73e6e416 20643{
5bca5c48
MB
20644 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20645 tmp = NULL;
20646 else
20647 tmp = localtime (&t);
1b289682
MB
20648 if ( tmp == NULL ||
20649 /* Check tm_year overflow */
20650 tmp->tm_year < min_year || tmp->tm_year > max_year)
73e6e416
MB
20651 tmp = NULL;
20652 else
20653 pt = t;
20654 } /* local_check */
20655
20656int check_max ()
20657{
20658 tmp = NULL;
20659 pt = 0;
20660#ifdef MAXLONG
1b289682 20661 local_check (MAXLONG, 69, 0x7fffffff);
73e6e416
MB
20662#endif
20663 if (tmp == NULL || tmp->tm_year < 0) {
20664 for (i = 63; i >= 0; i--) {
20665 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20666 if (x < 0 || x < pt) continue;
20667 local_check (x, 69, 0x7fffffff);
73e6e416
MB
20668 }
20669 }
20670 printf ("sLOCALTIME_max=%ld\n", pt);
20671 return (0);
1b289682 20672 } /* check_max */
73e6e416
MB
20673
20674int check_min ()
20675{
20676 tmp = NULL;
20677 pt = 0;
20678#ifdef MINLONG
1b289682 20679 local_check (MINLONG, -1900, 70);
73e6e416
MB
20680#endif
20681 if (tmp == NULL) {
20682 for (i = 36; i >= 0; i--) {
20683 time_t x = pt - ((time_t)1 << i);
20684 if (x > 0) continue;
1b289682 20685 local_check (x, -1900, 70);
73e6e416
MB
20686 }
20687 }
20688 printf ("sLOCALTIME_min=%ld\n", pt);
20689 return (0);
20690 } /* check_min */
20691
20692int main (int argc, char *argv[])
20693{
20694 check_max ();
20695 check_min ();
20696 return (0);
20697 } /* main */
20698EOCP
690aedd1
MB
20699 set try
20700 if eval $compile; then
20701 eval `$run ./try`
20702 else
20703 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20704 fi
20705 $rm_try
20706 ;;
20707 esac
73e6e416 20708
c0bacbef 20709: check for type of arguments to select.
b4eb6b3d
JH
20710case "$selecttype" in
20711'') case "$d_select" in
20712 $define)
20713 echo " "
20714 $cat <<EOM
20715Checking to see what type of arguments are accepted by select().
20716EOM
20717 hdrs="$define sys/types.h
c0bacbef 20718 $i_systime sys/time.h
b4eb6b3d
JH
20719 $i_sysselct sys/select.h
20720 $d_socket sys/socket.h"
20721 : The first arg can be int, unsigned, or size_t
20722 : The last arg may or may not be 'const'
20723 val=''
20724 : void pointer has been seen but using that
20725 : breaks the selectminbits test
20726 for xxx in 'fd_set *' 'int *'; do
20727 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20728 for tmo in 'struct timeval *' 'const struct timeval *'; do
20729 case "$val" in
61c26d18 20730 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
b4eb6b3d
JH
20731 if ./protochk "$try" $hdrs; then
20732 echo "Your system accepts $xxx."
20733 val="$xxx"
20734 fi
20735 ;;
20736 esac
20737 done
20738 done
20739 done
20740 case "$val" in
20741 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20742 case "$d_fd_set" in
20743 $define) dflt="fd_set *" ;;
20744 *) dflt="int *" ;;
20745 esac
20746 . ./myread
20747 val=$ans
20748 ;;
20749 esac
20750 selecttype="$val"
20751 ;;
20752 *) : no select, so pick a harmless default
20753 selecttype='int *'
20754 ;;
20755 esac
20756 ;;
20757esac
20758
20759: check for the select 'width'
20760case "$selectminbits" in
e6e7e605
JH
20761'') safebits=`expr $ptrsize \* 8`
20762 case "$d_select" in
b4eb6b3d
JH
20763 $define)
20764 $cat <<EOM
20765
20766Checking to see on how many bits at a time your select() operates...
20767EOM
20768 $cat >try.c <<EOCP
20769#include <sys/types.h>
20770#$i_time I_TIME
20771#$i_systime I_SYS_TIME
20772#$i_systimek I_SYS_TIME_KERNEL
20773#ifdef I_TIME
20774# include <time.h>
20775#endif
20776#ifdef I_SYS_TIME
20777# ifdef I_SYS_TIME_KERNEL
20778# define KERNEL
20779# endif
20780# include <sys/time.h>
20781# ifdef I_SYS_TIME_KERNEL
20782# undef KERNEL
20783# endif
20784#endif
20785#$i_sysselct I_SYS_SELECT
20786#ifdef I_SYS_SELECT
20787#include <sys/select.h>
20788#endif
20789#$d_socket HAS_SOCKET
20790#ifdef HAS_SOCKET
20791# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20792#endif
20793#include <stdio.h>
d1daaddf
JH
20794#$i_stdlib I_STDLIB
20795#ifdef I_STDLIB
20796#include <stdlib.h>
20797#endif
b4eb6b3d
JH
20798$selecttype b;
20799#define S sizeof(*(b))
20800#define MINBITS 64
20801#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20802#define NBITS (NBYTES * 8)
20803int main() {
7090f861 20804 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
20805 struct timeval t;
20806 int i;
20807 FILE* fp;
20808 int fd;
20809
e6e7e605
JH
20810 if (!s)
20811 exit(1);
b4eb6b3d
JH
20812 fclose(stdin);
20813 fp = fopen("try.c", "r");
20814 if (fp == 0)
e6e7e605 20815 exit(2);
b4eb6b3d
JH
20816 fd = fileno(fp);
20817 if (fd < 0)
e6e7e605 20818 exit(3);
b4eb6b3d
JH
20819 b = ($selecttype)s;
20820 for (i = 0; i < NBITS; i++)
20821 FD_SET(i, b);
20822 t.tv_sec = 0;
20823 t.tv_usec = 0;
20824 select(fd + 1, b, 0, 0, &t);
20825 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 20826 free(s);
b4eb6b3d
JH
20827 printf("%d\n", i + 1);
20828 return 0;
20829}
20830EOCP
20831 set try
20832 if eval $compile_ok; then
5440bc8e 20833 selectminbits=`$run ./try`
b4eb6b3d
JH
20834 case "$selectminbits" in
20835 '') cat >&4 <<EOM
20836Cannot figure out on how many bits at a time your select() operates.
e6e7e605 20837I'll play safe and guess it is $safebits bits.
b4eb6b3d 20838EOM
e6e7e605
JH
20839 selectminbits=$safebits
20840 bits="$safebits bits"
b4eb6b3d
JH
20841 ;;
20842 1) bits="1 bit" ;;
20843 *) bits="$selectminbits bits" ;;
20844 esac
20845 echo "Your select() operates on $bits at a time." >&4
20846 else
20847 rp='What is the minimum number of bits your select() operates on?'
20848 case "$byteorder" in
e6e7e605
JH
20849 12345678) dflt=64 ;;
20850 1234) dflt=32 ;;
b4eb6b3d
JH
20851 *) dflt=1 ;;
20852 esac
20853 . ./myread
20854 val=$ans
20855 selectminbits="$val"
20856 fi
5b813a60 20857 $rm_try
b4eb6b3d
JH
20858 ;;
20859 *) : no select, so pick a harmless default
e6e7e605 20860 selectminbits=$safebits
b4eb6b3d
JH
20861 ;;
20862 esac
20863 ;;
20864esac
20865
20866: Trace out the files included by signal.h, then look for SIGxxx names.
b4eb6b3d
JH
20867if [ "X$fieldn" = X ]; then
20868 : Just make some guesses. We check them later.
20869 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20870else
20871 xxx=`echo '#include <signal.h>' |
20872 $cppstdin $cppminus $cppflags 2>/dev/null |
613d6c3e 20873 $grep '^[ ]*#.*include' |
776a38e3
MB
20874 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20875 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d 20876fi
b4eb6b3d
JH
20877xxxfiles=''
20878for xx in $xxx /dev/null ; do
20879 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20880done
b4eb6b3d
JH
20881case "$xxxfiles" in
20882'') xxxfiles=`./findhdr signal.h` ;;
20883esac
20884xxx=`awk '
20885$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20886 print substr($2, 4, 20)
20887}
20888$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20889 print substr($3, 4, 20)
20890}' $xxxfiles`
20891: Append some common names just in case the awk scan failed.
20892xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20893xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20894xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20895xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20896xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20897
20898: generate a few handy files for later
55954f19 20899$cat > signal.c <<EOCP
b4eb6b3d
JH
20900#include <sys/types.h>
20901#include <signal.h>
55954f19
JH
20902#$i_stdlib I_STDLIB
20903#ifdef I_STDLIB
20904#include <stdlib.h>
20905#endif
b4eb6b3d
JH
20906#include <stdio.h>
20907int main() {
20908
20909/* Strange style to avoid deeply-nested #if/#else/#endif */
20910#ifndef NSIG
20911# ifdef _NSIG
20912# define NSIG (_NSIG)
20913# endif
20914#endif
20915
20916#ifndef NSIG
20917# ifdef SIGMAX
20918# define NSIG (SIGMAX+1)
20919# endif
20920#endif
20921
20922#ifndef NSIG
20923# ifdef SIG_MAX
20924# define NSIG (SIG_MAX+1)
20925# endif
20926#endif
20927
20928#ifndef NSIG
3609ea0d
JH
20929# ifdef _SIG_MAX
20930# define NSIG (_SIG_MAX+1)
20931# endif
20932#endif
20933
20934#ifndef NSIG
b4eb6b3d
JH
20935# ifdef MAXSIG
20936# define NSIG (MAXSIG+1)
20937# endif
20938#endif
20939
20940#ifndef NSIG
20941# ifdef MAX_SIG
20942# define NSIG (MAX_SIG+1)
20943# endif
20944#endif
20945
20946#ifndef NSIG
20947# ifdef SIGARRAYSIZE
3609ea0d 20948# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
20949# endif
20950#endif
20951
20952#ifndef NSIG
20953# ifdef _sys_nsig
20954# define NSIG (_sys_nsig) /* Solaris 2.5 */
20955# endif
20956#endif
20957
20958/* Default to some arbitrary number that's big enough to get most
20959 of the common signals.
20960*/
20961#ifndef NSIG
20962# define NSIG 50
20963#endif
20964
20965printf("NSIG %d\n", NSIG);
20966
20967#ifndef JUST_NSIG
20968
20969EOCP
20970
20971echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20972{
20973 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 20974 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
20975 printf $1; printf ");\n"
20976 printf "#endif\n"
20977}
20978END {
20979 printf "#endif /* JUST_NSIG */\n";
20980 printf "exit(0);\n}\n";
20981}
20982' >>signal.c
20983$cat >signal.awk <<'EOP'
20984BEGIN { ndups = 0 }
65197d93 20985$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20986($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20987 if ($2 > maxsig) { maxsig = $2 }
20988 if (sig_name[$2]) {
20989 dup_name[ndups] = $1
20990 dup_num[ndups] = $2
613d6c3e 20991 ndups++
b4eb6b3d 20992 }
1ebe1ffb 20993 else {
65197d93
JH
20994 sig_name[$2] = $1
20995 sig_num[$2] = $2
b4eb6b3d
JH
20996 }
20997}
613d6c3e 20998END {
b4eb6b3d
JH
20999 if (nsig == 0) {
21000 nsig = maxsig + 1
21001 }
21002 printf("NSIG %d\n", nsig);
21003 for (n = 1; n < nsig; n++) {
21004 if (sig_name[n]) {
21005 printf("%s %d\n", sig_name[n], sig_num[n])
21006 }
21007 else {
613d6c3e 21008 printf("NUM%d %d\n", n, n)
b4eb6b3d
JH
21009 }
21010 }
21011 for (n = 0; n < ndups; n++) {
21012 printf("%s %d\n", dup_name[n], dup_num[n])
21013 }
21014}
21015EOP
21016$cat >signal_cmd <<EOS
21017$startsh
21018if $test -s signal.lst; then
21019 echo "Using your existing signal.lst file"
21020 exit 0
21021fi
21022xxx="$xxx"
21023EOS
21024$cat >>signal_cmd <<'EOS'
21025
21026set signal
21027if eval $compile_ok; then
776a38e3
MB
21028 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21029 $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
21030else
21031 echo "(I can't seem be able to compile the whole test program)" >&4
21032 echo "(I'll try it in little pieces.)" >&4
21033 set signal -DJUST_NSIG
21034 if eval $compile_ok; then
5440bc8e 21035 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
21036 $cat signal.nsg
21037 else
21038 echo "I can't seem to figure out how many signals you have." >&4
21039 echo "Guessing 50." >&4
21040 echo 'NSIG 50' > signal.nsg
21041 fi
21042 : Now look at all the signal names, one at a time.
21043 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21044 $cat > signal.c <<EOCP
21045#include <sys/types.h>
21046#include <signal.h>
21047#include <stdio.h>
21048int main() {
21049printf("$xx %d\n", SIG${xx});
21050return 0;
21051}
21052EOCP
21053 set signal
21054 if eval $compile; then
21055 echo "SIG${xx} found."
5440bc8e 21056 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
21057 else
21058 echo "SIG${xx} NOT found."
21059 fi
21060 done
21061 if $test -s signal.ls1; then
21062 $cat signal.nsg signal.ls1 |
65197d93 21063 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
21064 fi
21065
21066fi
21067if $test -s signal.lst; then
21068 :
21069else
21070 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21071 echo 'kill -l' >signal
21072 set X `csh -f <signal`
21073 $rm -f signal
21074 shift
21075 case $# in
21076 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21077 esac
21078 echo $@ | $tr ' ' $trnl | \
21079 $awk '{ printf "%s %d\n", $1, ++s; }
21080 END { printf "NSIG %d\n", ++s }' >signal.lst
21081fi
21082$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21083EOS
21084chmod a+x signal_cmd
21085$eunicefix signal_cmd
21086
21087: generate list of signal names
21088echo " "
21089case "$sig_name_init" in
21090'') doinit=yes ;;
21091*) case "$sig_num_init" in
21092 ''|*,*) doinit=yes ;;
21093 esac ;;
21094esac
21095case "$doinit" in
21096yes)
21097 echo "Generating a list of signal names and numbers..." >&4
21098 . ./signal_cmd
21099 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21100 sig_name=`$awk 'BEGIN { printf "ZERO " }
21101 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21102 sig_num=`$awk 'BEGIN { printf "0 " }
21103 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21104 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
21105 !/^NSIG/ { printf "\"%s\", ", $1 }
21106 END { printf "0\n" }' signal.lst`
21107 sig_num_init=`$awk 'BEGIN { printf "0, " }
21108 !/^NSIG/ { printf "%d, ", $2}
21109 END { printf "0\n"}' signal.lst`
21110 ;;
21111esac
21112echo "The following $sig_count signals are available:"
21113echo " "
21114echo $sig_name | $awk \
21115'BEGIN { linelen = 0 }
21116{
21117 for (i = 1; i <= NF; i++) {
21118 name = "SIG" $i " "
21119 linelen = linelen + length(name)
21120 if (linelen > 70) {
21121 printf "\n"
21122 linelen = length(name)
21123 }
21124 printf "%s", name
21125 }
21126 printf "\n"
21127}'
76d3c696 21128sig_size=`echo $sig_name | awk '{print NF}'`
c0bacbef 21129$rm -f signal signal.c signal.awk signal.lst signal_cmd
b4eb6b3d 21130
613d6c3e 21131: Check size of size
b4eb6b3d
JH
21132echo " "
21133case "$sizetype" in
21134*_t) zzz="$sizetype" ;;
21135*) zzz="filesize" ;;
21136esac
613d6c3e 21137echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21138cat > try.c <<EOCP
21139#include <sys/types.h>
21140#include <stdio.h>
d1daaddf
JH
21141#$i_stdlib I_STDLIB
21142#ifdef I_STDLIB
21143#include <stdlib.h>
21144#endif
b4eb6b3d
JH
21145int main() {
21146 printf("%d\n", (int)sizeof($sizetype));
21147 exit(0);
21148}
21149EOCP
21150set try
21151if eval $compile_ok; then
5440bc8e 21152 yyy=`$run ./try`
b4eb6b3d
JH
21153 case "$yyy" in
21154 '') sizesize=4
21155 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21156 ;;
21157 *) sizesize=$yyy
21158 echo "Your $zzz size is $sizesize bytes."
21159 ;;
21160 esac
21161else
21162 sizesize=4
21163 echo "(I can't compile the test program--guessing $sizesize.)" >&4
21164fi
21165
21166
21167: check for socklen_t
21168echo " "
21169echo "Checking to see if you have socklen_t..." >&4
21170$cat >try.c <<EOCP
21171#include <sys/types.h>
21172#$d_socket HAS_SOCKET
21173#ifdef HAS_SOCKET
21174#include <sys/socket.h>
21175#endif
21176int main() { socklen_t x = 16; }
21177EOCP
21178set try
21179if eval $compile; then
21180 val="$define"
21181 echo "You have socklen_t."
21182else
21183 val="$undef"
21184 echo "You do not have socklen_t."
21185 case "$sizetype" in
21186 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21187 esac
21188fi
5b813a60 21189$rm_try
b4eb6b3d
JH
21190set d_socklen_t
21191eval $setvar
21192
a7710f8d
JH
21193: see if this is a socks.h system
21194set socks.h i_socks
21195eval $inhdr
21196
b4eb6b3d
JH
21197: check for type of the size argument to socket calls
21198case "$d_socket" in
21199"$define")
21200 $cat <<EOM
21201
21202Checking to see what type is the last argument of accept().
21203EOM
b4eb6b3d
JH
21204 yyy=''
21205 case "$d_socklen_t" in
21206 "$define") yyy="$yyy socklen_t"
21207 esac
21208 yyy="$yyy $sizetype int long unsigned"
21209 for xxx in $yyy; do
21210 case "$socksizetype" in
61c26d18 21211 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
21212 case "$usesocks" in
21213 "$define")
21214 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21215 echo "Your system accepts '$xxx *' for the last argument of accept()."
21216 socksizetype="$xxx"
21217 fi
21218 ;;
21219 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
21220 echo "Your system accepts '$xxx *' for the last argument of accept()."
21221 socksizetype="$xxx"
21222 fi
21223 ;;
21224 esac
b4eb6b3d
JH
21225 ;;
21226 esac
21227 done
21228: In case none of those worked, prompt the user.
21229 case "$socksizetype" in
21230 '') rp='What is the type for socket address structure sizes?'
21231 dflt='int'
21232 . ./myread
21233 socksizetype=$ans
21234 ;;
21235 esac
21236 ;;
21237*) : no sockets, so pick relatively harmless default
21238 socksizetype='int'
21239 ;;
21240esac
21241
21242: see what type is used for signed size_t
21243set ssize_t ssizetype int stdio.h sys/types.h
21244eval $typedef
21245dflt="$ssizetype"
5440bc8e 21246$cat > try.c <<EOM
b4eb6b3d 21247#include <stdio.h>
d1daaddf
JH
21248#$i_stdlib I_STDLIB
21249#ifdef I_STDLIB
21250#include <stdlib.h>
21251#endif
b4eb6b3d
JH
21252#include <sys/types.h>
21253#define Size_t $sizetype
21254#define SSize_t $dflt
21255int main()
21256{
21257 if (sizeof(Size_t) == sizeof(SSize_t))
21258 printf("$dflt\n");
21259 else if (sizeof(Size_t) == sizeof(int))
21260 printf("int\n");
5b813a60 21261 else
b4eb6b3d
JH
21262 printf("long\n");
21263 exit(0);
21264}
21265EOM
21266echo " "
5440bc8e
JH
21267set try
21268if eval $compile_ok && $run ./try > /dev/null; then
21269 ssizetype=`$run ./try`
b4eb6b3d
JH
21270 echo "I'll be using $ssizetype for functions returning a byte count." >&4
21271else
21272 $cat >&4 <<EOM
21273Help! I can't compile and run the ssize_t test program: please enlighten me!
21274(This is probably a misconfiguration in your system or libraries, and
21275you really ought to fix it. Still, I'll try anyway.)
21276
21277I need a type that is the same size as $sizetype, but is guaranteed to
21278be signed. Common values are ssize_t, int and long.
21279
21280EOM
21281 rp="What signed type is the same size as $sizetype?"
21282 . ./myread
21283 ssizetype="$ans"
21284fi
5b813a60 21285$rm_try
b4eb6b3d 21286
668fdbe1
MB
21287: Check the size of st_ino
21288$echo " "
21289$echo "Checking the size of st_ino..." >&4
21290$cat > try.c <<EOCP
21291#include <sys/stat.h>
21292#include <stdio.h>
21293#$i_stdlib I_STDLIB
21294#ifdef I_STDLIB
21295#include <stdlib.h>
21296#endif
21297int main() {
21298 struct stat st;
21299 printf("%d\n", (int)sizeof(st.st_ino));
21300 exit(0);
21301}
21302EOCP
21303set try
21304if eval $compile_ok; then
21305 val=`$run ./try`
21306 case "$val" in
21307 '') st_ino_size=4
21308 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21309 ;;
21310 *) st_ino_size=$val
21311 $echo "Your st_ino is $st_ino_size bytes long."
21312 ;;
21313 esac
21314else
21315 st_ino_size=4
21316 $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21317fi
21318$rm_try
21319
21320: Check if st_ino is signed
21321$echo " "
21322$echo "Checking the sign of st_ino..." >&4
21323$cat > try.c <<EOCP
21324#include <sys/stat.h>
21325#include <stdio.h>
21326int main() {
21327 struct stat foo;
21328 foo.st_ino = -1;
21329 if (foo.st_ino < 0)
21330 printf("-1\n");
21331 else
21332 printf("1\n");
21333}
21334EOCP
21335set try
21336if eval $compile; then
21337 val=`$run ./try`
21338 case "$val" in
21339 '') st_ino_sign=1
21340 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21341 ;;
21342 *) st_ino_sign=$val
21343 case "$st_ino_sign" in
21344 1) $echo "Your st_ino is unsigned." ;;
21345 -1) $echo "Your st_ino is signed." ;;
21346 esac
21347 ;;
21348 esac
21349else
21350 st_ino_sign=1
21351 $echo "(I can't compile the test program--guessing unsigned.)" >&4
21352fi
21353$rm_try
21354
b4eb6b3d
JH
21355: see what type of char stdio uses.
21356echo " "
1d8eaf8c 21357echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
aa517f50 21358if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
21359 echo "Your stdio uses unsigned chars." >&4
21360 stdchar="unsigned char"
21361else
aa517f50
JH
21362 echo "Your stdio uses signed chars." >&4
21363 stdchar="char"
b4eb6b3d 21364fi
1d8eaf8c 21365$rm -f stdioh
b4eb6b3d 21366
b4eb6b3d
JH
21367: see what type uids are declared as in the kernel
21368echo " "
21369echo "Looking for the type for user ids returned by getuid()."
21370set uid_t uidtype xxx stdio.h sys/types.h
21371eval $typedef
21372case "$uidtype" in
21373xxx)
21374 xxx=`./findhdr sys/user.h`
21375 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21376 case $1 in
21377 unsigned) dflt="$1 $2" ;;
21378 *) dflt="$1" ;;
21379 esac
21380 ;;
21381*) dflt="$uidtype";;
21382esac
21383case "$uidtype" in
21384uid_t) echo "uid_t found." ;;
21385*) rp="What is the type for user ids returned by getuid()?"
21386 . ./myread
21387 uidtype="$ans"
21388 ;;
21389esac
21390
613d6c3e 21391: Check size of UID
b4eb6b3d
JH
21392echo " "
21393case "$uidtype" in
21394*_t) zzz="$uidtype" ;;
21395*) zzz="uid" ;;
21396esac
613d6c3e 21397echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21398cat > try.c <<EOCP
21399#include <sys/types.h>
21400#include <stdio.h>
d1daaddf
JH
21401#$i_stdlib I_STDLIB
21402#ifdef I_STDLIB
21403#include <stdlib.h>
21404#endif
b4eb6b3d
JH
21405int main() {
21406 printf("%d\n", (int)sizeof($uidtype));
21407 exit(0);
21408}
21409EOCP
21410set try
21411if eval $compile_ok; then
5440bc8e 21412 yyy=`$run ./try`
b4eb6b3d
JH
21413 case "$yyy" in
21414 '') uidsize=4
21415 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21416 ;;
21417 *) uidsize=$yyy
21418 echo "Your $zzz is $uidsize bytes long."
21419 ;;
21420 esac
21421else
21422 uidsize=4
21423 echo "(I can't compile the test program--guessing $uidsize.)" >&4
21424fi
21425
613d6c3e 21426: Check if UID is signed
b4eb6b3d
JH
21427echo " "
21428case "$uidtype" in
21429*_t) zzz="$uidtype" ;;
21430*) zzz="uid" ;;
21431esac
21432echo "Checking the sign of $zzz..." >&4
21433cat > try.c <<EOCP
21434#include <sys/types.h>
21435#include <stdio.h>
21436int main() {
21437 $uidtype foo = -1;
21438 if (foo < 0)
21439 printf("-1\n");
21440 else
21441 printf("1\n");
21442}
21443EOCP
21444set try
21445if eval $compile; then
5440bc8e 21446 yyy=`$run ./try`
b4eb6b3d
JH
21447 case "$yyy" in
21448 '') uidsign=1
21449 echo "(I can't execute the test program--guessing unsigned.)" >&4
21450 ;;
21451 *) uidsign=$yyy
21452 case "$uidsign" in
21453 1) echo "Your $zzz is unsigned." ;;
21454 -1) echo "Your $zzz is signed." ;;
21455 esac
21456 ;;
21457 esac
21458else
21459 uidsign=1
21460 echo "(I can't compile the test program--guessing unsigned.)" >&4
21461fi
21462
21463
34f1896b 21464: Check format string for UID
b4eb6b3d
JH
21465echo " "
21466$echo "Checking the format string to be used for uids..." >&4
21467
21468case "$uidsign" in
21469-1) if $test X"$uidsize" = X"$ivsize"; then
21470 uidformat="$ivdformat"
21471 else
21472 if $test X"$uidsize" = X"$longsize"; then
21473 uidformat='"ld"'
21474 else
21475 if $test X"$uidsize" = X"$intsize"; then
21476 uidformat='"d"'
21477 else
21478 if $test X"$uidsize" = X"$shortsize"; then
21479 uidformat='"hd"'
21480 fi
21481 fi
21482 fi
21483 fi
21484 ;;
21485*) if $test X"$uidsize" = X"$uvsize"; then
21486 uidformat="$uvuformat"
21487 else
21488 if $test X"$uidsize" = X"$longsize"; then
21489 uidformat='"lu"'
21490 else
21491 if $test X"$uidsize" = X"$intsize"; then
21492 uidformat='"u"'
21493 else
21494 if $test X"$uidsize" = X"$shortsize"; then
21495 uidformat='"hu"'
21496 fi
21497 fi
21498 fi
21499 fi
21500 ;;
21501esac
21502
d78f9ffa
MB
21503: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21504echo " "
21505echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21506$cat >try.c <<'EOM'
21507/* Intentionally a long probe as I'd like to sanity check that the exact
21508 approach is going to work, as thinking it will work, but only having it
21509 part working at runtime is worse than not having it. */
21510
21511#include <sys/types.h>
21512#include <sys/sysctl.h>
21513#include <sys/param.h>
21514#include <stdio.h>
21515#include <string.h>
21516#include <stdlib.h>
21517#include <unistd.h>
21518
21519int
21520main(int argc, char **argv) {
21521 char *buffer;
21522 char *argv_leaf = strrchr(argv[0], '/');
21523 char *buffer_leaf;
21524 size_t size = 0;
21525 int mib[4];
21526
21527 mib[0] = CTL_KERN;
21528 mib[1] = KERN_PROC;
21529 mib[2] = KERN_PROC_PATHNAME;
21530 mib[3] = -1;
21531
21532 if (!argv_leaf) {
21533 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21534 return 1;
21535 }
21536
21537 if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21538 perror("sysctl");
21539 return 2;
21540 }
21541
21542 if (size < strlen(argv_leaf) + 1) {
21543 fprintf(stderr, "size %lu is too short for a path\n",
21544 (unsigned long) size);
21545 return 3;
21546 }
21547
21548 if (size > MAXPATHLEN * MAXPATHLEN) {
21549 fprintf(stderr, "size %lu is too long for a path\n",
21550 (unsigned long) size);
21551 return 4;
21552 }
21553
21554 buffer = malloc(size);
21555 if (!buffer) {
21556 perror("malloc");
21557 return 5;
21558 }
21559
21560 if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21561 perror("sysctl");
21562 return 6;
21563 }
21564
21565 if (strlen(buffer) + 1 != size) {
21566 fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21567 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21568 return 7;
21569 }
21570
21571
21572 if (*buffer != '/') {
21573 fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21574 return 8;
21575 }
21576
21577 if (strstr(buffer, "/./")) {
21578 fprintf(stderr, "Contains /./: '%s'\n", buffer);
21579 return 9;
21580 }
21581
21582 if (strstr(buffer, "/../")) {
21583 fprintf(stderr, "Contains /../: '%s'\n", buffer);
21584 return 10;
21585 }
21586
21587 buffer_leaf = strrchr(buffer, '/');
21588 if (strcmp(buffer_leaf, argv_leaf) != 0) {
21589 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21590 return 11;
21591 }
21592
21593 free(buffer);
21594
21595 return 0;
21596}
21597EOM
21598
21599val=$undef
21600set try
9e477c13 21601if eval $compile; then
d78f9ffa
MB
21602 if $run ./try; then
21603 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21604 val="$define"
21605 else
21606 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21607 val="$undef"
21608 fi
21609else
21610 echo "I'm unable to compile the test program." >&4
21611 echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21612 val="$undef"
21613fi
21614$rm_try
21615set usekernprocpathname
21616eval $setvar
21617
21618: Determine if we can use _NSGetExecutablePath to find executing program
21619echo " "
21620echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21621$cat >try.c <<'EOM'
21622/* Intentionally a long probe as I'd like to sanity check that the exact
21623 approach is going to work, as thinking it will work, but only having it
21624 part working at runtime is worse than not having it. */
21625#include <mach-o/dyld.h>
21626#include <stdio.h>
21627#include <stdlib.h>
21628#include <sys/param.h>
21629#include <string.h>
21630
21631int
21632main(int argc, char **argv) {
21633 char buf[1];
21634 uint32_t size = sizeof(buf);
21635 int result;
21636 char *buffer;
21637 char *tidied;
21638 char *argv_leaf = strrchr(argv[0], '/');
21639 char *tidied_leaf;
21640
21641 if (!argv_leaf) {
21642 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21643 return 1;
21644 }
21645
21646 _NSGetExecutablePath(buf, &size);
21647 if (size > MAXPATHLEN * MAXPATHLEN) {
21648 fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21649 (unsigned int) size);
21650 return 2;
21651 }
21652
21653 buffer = malloc(size);
21654 if (!buffer) {
21655 perror("malloc");
21656 return 3;
21657 }
21658
21659 result = _NSGetExecutablePath(buffer, &size);
21660 if (result != 0) {
21661 fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21662 result, (unsigned int) size);
21663 return 4;
21664 }
21665
21666 tidied = realpath(buffer, NULL);
21667 if (!tidied) {
21668 perror("realpath");
21669 return 5;
21670 }
21671
21672 free(buffer);
21673
21674 if (*tidied != '/') {
21675 fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21676 return 6;
21677 }
21678
21679 if (strstr(tidied, "/./")) {
21680 fprintf(stderr, "Contains /./: '%s'\n", tidied);
21681 return 7;
21682 }
21683
21684 if (strstr(tidied, "/../")) {
21685 fprintf(stderr, "Contains /../: '%s'\n", tidied);
21686 return 8;
21687 }
21688
21689 tidied_leaf = strrchr(tidied, '/');
21690 if (strcmp(tidied_leaf, argv_leaf) != 0) {
21691 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21692 return 9;
21693 }
21694
21695 free(tidied);
21696
21697 return 0;
21698}
21699EOM
21700
21701val=$undef
21702set try
9e477c13 21703if eval $compile; then
d78f9ffa
MB
21704 if $run ./try; then
21705 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21706 val="$define"
21707 else
21708 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21709 fi
21710else
21711 echo "I'm unable to compile the test program." >&4
21712 echo "I'll assume no _NSGetExecutablePath here." >&4
21713fi
21714$rm_try
21715set usensgetexecutablepath
21716eval $setvar
21717
34f1896b 21718: Check if site customization support was requested
4afd418c
MB
21719case "$usesitecustomize" in
21720 $define|true|[Yy]*)
21721 usesitecustomize="$define"
21722 ;;
21723 *)
21724 usesitecustomize="$undef"
21725 ;;
21726 esac
21727
d03b3b00
MB
21728: see if prototypes support variable argument declarations
21729echo " "
21730case "$prototype$i_stdarg" in
21731$define$define)
21732 echo "It appears we'll be able to prototype varargs functions." >&4
21733 val="$define"
21734 ;;
21735*)
21736 echo "Too bad... We won't be using prototyped varargs functions..." >&4
21737 val="$undef"
21738 ;;
21739esac
21740set vaproto
21741eval $setvar
21742
3659ebf1
JH
21743: determine compiler compiler
21744case "$yacc" in
21745'')
21746 dflt=yacc;;
21747*)
21748 dflt="$yacc";;
21749esac
21750echo " "
21751comp='yacc'
3c728e00 21752if $test -f "$byacc$_exe"; then
3659ebf1
JH
21753 dflt="$byacc"
21754 comp="byacc or $comp"
21755fi
3c728e00 21756if $test -f "$bison$_exe"; then
3659ebf1
JH
21757 comp="$comp or bison -y"
21758fi
21759rp="Which compiler compiler ($comp) shall I use?"
21760. ./myread
21761yacc="$ans"
21762case "$yacc" in
21763*bis*)
21764 case "$yacc" in
21765 *-y*) ;;
21766 *)
21767 yacc="$yacc -y"
21768 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21769 ;;
21770 esac
21771 ;;
21772esac
21773
c0bacbef
MB
21774: see if this is a assert.h system
21775set assert.h i_assert
21776eval $inhdr
21777
758a5d79
JH
21778: see if this is a fp.h system
21779set fp.h i_fp
21780eval $inhdr
21781
21782: see if this is a fp_class.h system
21783set fp_class.h i_fp_class
21784eval $inhdr
21785
13cfc98d
MB
21786: see if gdbm.h is available
21787set gdbm.h t_gdbm
21788eval $inhdr
21789case "$t_gdbm" in
21790$define)
21791 : see if gdbm_open exists
21792 set gdbm_open d_gdbm_open
21793 eval $inlibc
21794 case "$d_gdbm_open" in
21795 $undef)
21796 t_gdbm="$undef"
21797 echo "We won't be including <gdbm.h>"
21798 ;;
21799 esac
21800 ;;
21801esac
21802val="$t_gdbm"
21803set i_gdbm
21804eval $setvar
21805
b2f871ed
AD
21806: see if this is a ieeefp.h system
21807case "$i_ieeefp" in
21808'' ) set ieeefp.h i_ieeefp
21809 eval $inhdr
21810 ;;
21811esac
21812
21813: see if this is a libutil.h system
21814set libutil.h i_libutil
21815eval $inhdr
21816
21817: see if mach cthreads are available
21818if test "X$usethreads" = "X$define"; then
21819 set mach/cthreads.h i_machcthr
21820 eval $inhdr
21821else
21822 i_machcthr="$undef"
21823fi
21824
21825: see if this is a mntent.h system
21826set mntent.h i_mntent
21827eval $inhdr
21828
b4eb6b3d
JH
21829: see if net/errno.h is available
21830val=''
21831set net/errno.h val
21832eval $inhdr
21833
21834: Unfortunately, it causes problems on some systems. Arrgh.
21835case "$val" in
21836$define)
21837 cat > try.c <<'EOM'
21838#include <stdio.h>
21839#include <errno.h>
21840#include <net/errno.h>
21841int func()
21842{
21843 return ENOTSOCK;
21844}
21845EOM
21846 if $cc $ccflags -c try.c >/dev/null 2>&1; then
21847 echo "We'll be including <net/errno.h>." >&4
21848 else
21849 echo "We won't be including <net/errno.h>." >&4
21850 val="$undef"
21851 fi
5b813a60 21852 $rm_try
b4eb6b3d
JH
21853 ;;
21854esac
21855set i_neterrno
21856eval $setvar
21857
21858: see if netinet/tcp.h is available
21859set netinet/tcp.h i_netinettcp
21860eval $inhdr
21861
21862: see if this is a poll.h system
21863set poll.h i_poll
21864eval $inhdr
21865
21866: see if this is a prot.h system
21867set prot.h i_prot
21868eval $inhdr
21869
613d6c3e 21870: Preprocessor symbols
b4eb6b3d 21871echo " "
ddfca5da 21872$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
21873$cat <<'EOSH' > Cppsym.know
21874a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21875AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 21876alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
21877ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21878BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
21879BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21880bull c cadmus clipper CMU COFF COMPILER_VERSION
21881concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 21882CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
21883Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21884FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21885GLIBC GLIBC_MINOR
21886GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
21887H3050R H3050RX hbullx20 hcx host_mips
21888hp200 hp300 hp700 HP700 hp800 hp9000
21889hp9000s200 hp9000s300 hp9000s400 hp9000s500
21890hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21891i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 21892IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
21893INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21894LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21895LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 21896LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
21897LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21898M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21899M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21900M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21901MATH_HAS_NO_SIDE_EFFECTS
21902mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21903mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21904mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21905MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21906mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21907NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 21908news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
21909ns32016 ns32332 ns32k nsc32000
21910OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21911pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21912pc532 pdp11 PGC PIC plexus PORTAR posix
21913POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21914POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 21915PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 21916riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
21917SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21918sony sony_news sonyrisc sparc sparclite spectrum
21919stardent stdc STDC_EXT stratos sun sun3 sun386
21920Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21921SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21922SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21923sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 21924TM3200 TM5400 TM5600
b4eb6b3d
JH
21925tower tower32 tower32_200 tower32_600 tower32_700
21926tower32_800 tower32_850 tss
21927u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21928ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
21929unix UNIX95 UNIX99 unixpc unos
21930USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21931USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21932USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21933USGr4 USGr4_2
44c87379 21934Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
21935XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21936XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21937z8000
21938EOSH
21939# Maybe put other stuff here too.
21940cat <<EOSH >>Cppsym.know
21941$osname
21942EOSH
21943./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21944./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21945$cat Cppsym.know > Cppsym.c
381aa1ff 21946$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
21947$rm -f Cppsym.a Cppsym.b Cppsym.c
21948cat <<EOSH > Cppsym
21949$startsh
21950if $test \$# -gt 0; then
21951 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21952 if $test -s Cppsym.got; then
21953 $rm -f Cppsym.got
21954 exit 0
21955 fi
21956 $rm -f Cppsym.got
21957 exit 1
21958else
21959 $tr " " "$trnl" | ./Cppsym.try
21960 exit 0
21961fi
21962EOSH
21963chmod +x Cppsym
21964$eunicefix Cppsym
21965cat <<EOSH > Cppsym.try
21966$startsh
21967cat <<'EOCP' > try.c
21968#include <stdio.h>
360321b3
YST
21969#if cpp_stuff == 1
21970#define STRINGIFY(a) "a"
21971#endif
21972#if cpp_stuff == 42
21973#define StGiFy(a) #a
21974#define STRINGIFY(a) StGiFy(a)
21975#endif
21976#if $cpp_stuff != 1 && $cpp_stuff != 42
21977# include "Bletch: How does this C preprocessor stringify macros?"
21978#endif
b4eb6b3d
JH
21979int main() {
21980EOCP
21981$awk \\
21982EOSH
21983cat <<'EOSH' >> Cppsym.try
21984'length($1) > 0 {
360321b3
YST
21985 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21986 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21987 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21988 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 21989}' >> try.c
2ef53570 21990echo 'return 0;}' >> try.c
b4eb6b3d
JH
21991EOSH
21992cat <<EOSH >> Cppsym.try
21993ccflags="$ccflags"
21994case "$osname-$gccversion" in
21995irix-) ccflags="\$ccflags -woff 1178" ;;
21996os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21997esac
360321b3 21998$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
21999EOSH
22000chmod +x Cppsym.try
22001$eunicefix Cppsym.try
6f87f404 22002./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
ddfca5da 22003: Add in any linux cpp "predefined macros":
b6a7163e 22004case "$osname::$gccversion" in
eeb92b76 22005 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
b6a7163e
MB
22006 tHdrH=_tmpHdr
22007 rm -f $tHdrH'.h' $tHdrH
22008 touch $tHdrH'.h'
6f87f404 22009 # Filter out macro arguments, such as Linux's __INT8_C(c)
6f5be6d1 22010 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
6f87f404 22011 sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
b6a7163e
MB
22012 if [ -s $tHdrH'_cppsym.real' ]; then
22013 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22014 fi
22015 fi
22016 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22017 ;;
22018esac
b4eb6b3d
JH
22019: now check the C compiler for additional symbols
22020postprocess_cc_v=''
22021case "$osname" in
22022aix) postprocess_cc_v="|$tr , ' '" ;;
22023esac
22024$cat >ccsym <<EOS
22025$startsh
22026$cat >tmp.c <<EOF
22027extern int foo;
22028EOF
22029for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22030do
22031 case "\$i" in
22032 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 22033 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
22034 esac
22035done
5b813a60 22036$rm_try
b4eb6b3d
JH
22037EOS
22038postprocess_cc_v=''
22039chmod +x ccsym
22040$eunicefix ccsym
22041./ccsym > ccsym1.raw
22042if $test -s ccsym1.raw; then
22043 $sort ccsym1.raw | $uniq >ccsym.raw
22044else
22045 mv ccsym1.raw ccsym.raw
22046fi
22047
22048$awk '/\=/ { print $0; next }
22049 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
22050$comm -13 Cppsym.true ccsym.list >ccsym.own
22051$comm -12 Cppsym.true ccsym.list >ccsym.com
22052$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
22053also=''
22054if $test -z ccsym.raw; then
22055 echo "Your C compiler doesn't seem to define any symbols!" >&4
22056 echo " "
22057 echo "However, your C preprocessor defines the following symbols:"
22058 $cat Cppsym.true
22059 ccsymbols=''
22060 cppsymbols=`$cat Cppsym.true`
22061 cppsymbols=`echo $cppsymbols`
22062 cppccsymbols="$cppsymbols"
22063else
22064 if $test -s ccsym.com; then
22065 echo "Your C compiler and pre-processor define these symbols:"
22066 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22067 also='also '
22068 symbols='ones'
22069 cppccsymbols=`$cat ccsym.com`
22070 cppccsymbols=`echo $cppccsymbols`
22071 $test "$silent" || sleep 1
22072 fi
22073 if $test -s ccsym.cpp; then
22074 $test "$also" && echo " "
22075 echo "Your C pre-processor ${also}defines the following symbols:"
22076 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22077 also='further '
22078 cppsymbols=`$cat ccsym.cpp`
22079 cppsymbols=`echo $cppsymbols`
22080 $test "$silent" || sleep 1
22081 fi
22082 if $test -s ccsym.own; then
22083 $test "$also" && echo " "
22084 echo "Your C compiler ${also}defines the following cpp symbols:"
22085 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22086 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22087 ccsymbols=`$cat ccsym.own`
22088 ccsymbols=`echo $ccsymbols`
22089 $test "$silent" || sleep 1
22090 fi
22091fi
b4eb6b3d
JH
22092
22093: see if this is a termio system
22094val="$undef"
22095val2="$undef"
22096val3="$undef"
22097if $test `./findhdr termios.h`; then
22098 set tcsetattr i_termios
22099 eval $inlibc
22100 val3="$i_termios"
22101fi
22102echo " "
22103case "$val3" in
22104"$define") echo "You have POSIX termios.h... good!" >&4;;
22105*) if ./Cppsym pyr; then
22106 case "`/bin/universe`" in
22107 ucb) if $test `./findhdr sgtty.h`; then
22108 val2="$define"
22109 echo "<sgtty.h> found." >&4
22110 else
22111 echo "System is pyramid with BSD universe."
216dac04 22112 ./warn "<sgtty.h> not found--you could have problems."
b4eb6b3d
JH
22113 fi;;
22114 *) if $test `./findhdr termio.h`; then
22115 val="$define"
22116 echo "<termio.h> found." >&4
22117 else
22118 echo "System is pyramid with USG universe."
216dac04 22119 ./warn "<termio.h> not found--you could have problems."
b4eb6b3d
JH
22120 fi;;
22121 esac
22122 elif ./usg; then
22123 if $test `./findhdr termio.h`; then
22124 echo "<termio.h> found." >&4
22125 val="$define"
22126 elif $test `./findhdr sgtty.h`; then
22127 echo "<sgtty.h> found." >&4
22128 val2="$define"
22129 else
216dac04 22130 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
b4eb6b3d
JH
22131 fi
22132 else
22133 if $test `./findhdr sgtty.h`; then
22134 echo "<sgtty.h> found." >&4
22135 val2="$define"
22136 elif $test `./findhdr termio.h`; then
22137 echo "<termio.h> found." >&4
22138 val="$define"
22139 else
216dac04 22140 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
b4eb6b3d
JH
22141 fi
22142 fi;;
22143esac
22144set i_termio; eval $setvar
22145val=$val2; set i_sgtty; eval $setvar
22146val=$val3; set i_termios; eval $setvar
22147
bd31be4b 22148: see if stdbool is available
0dcb3d88
MB
22149: we want a real compile instead of Inhdr because some Solaris systems
22150: have stdbool.h, but it can only be used if the compiler indicates it
22151: is sufficiently c99-compliant.
22152echo " "
22153$cat >try.c <<EOCP
22154#include <stdio.h>
22155#include <stdbool.h>
22156int func(bool x)
22157{
22158 return x ? 1 : 0;
22159}
22160int main(int argc, char **argv)
22161{
22162 return func(0);
22163}
22164EOCP
22165set try
22166if eval $compile; then
22167 echo "<stdbool.h> found." >&4
22168 val="$define"
22169else
22170 echo "<stdbool.h> NOT found." >&4
22171 val="$undef"
22172fi
22173$rm_try
22174set i_stdbool
22175eval $setvar
bd31be4b 22176
b4eb6b3d
JH
22177: see if stddef is available
22178set stddef.h i_stddef
22179eval $inhdr
923fc586 22180
b4eb6b3d
JH
22181: see if sys/access.h is available
22182set sys/access.h i_sysaccess
22183eval $inhdr
22184
22185: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22186set sys/filio.h i_sysfilio
22187eval $inhdr
22188echo " "
22189if $test `./findhdr sys/ioctl.h`; then
22190 val="$define"
22191 echo '<sys/ioctl.h> found.' >&4
22192else
22193 val="$undef"
22194 if $test $i_sysfilio = "$define"; then
22195 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 22196 else
b4eb6b3d
JH
22197 $test $i_sgtty = "$define" && xxx="sgtty.h"
22198 $test $i_termio = "$define" && xxx="termio.h"
22199 $test $i_termios = "$define" && xxx="termios.h"
22200echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22201 fi
22202fi
22203set i_sysioctl
22204eval $setvar
22205
49a78c82
JH
22206: see if socket ioctl defs are in sys/sockio.h
22207echo " "
22208xxx=`./findhdr sys/sockio.h`
22209if $test "$xxx"; then
22210 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22211 val="$define"
22212 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22213 else
22214 val="$undef"
22215 echo "No socket ioctls found in <sys/sockio.h>." >&4
22216 fi
22217else
22218 val="$undef"
22219 $cat <<EOM
22220<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22221EOM
22222fi
22223set i_syssockio
22224eval $setvar
22225
b4eb6b3d
JH
22226: see if this is a syslog.h system
22227set syslog.h i_syslog
22228eval $inhdr
22229
b4eb6b3d
JH
22230: see if this is a sys/mode.h system
22231set sys/mode.h i_sysmode
22232eval $inhdr
22233
216dac04
MB
22234: see if there is a sys/poll.h file
22235set sys/poll.h i_syspoll
22236eval $inhdr
22237
b4eb6b3d
JH
22238: see if sys/resource.h has to be included
22239set sys/resource.h i_sysresrc
22240eval $inhdr
22241
22242: see if sys/security.h is available
22243set sys/security.h i_syssecrt
22244eval $inhdr
22245
22246: see if this is a sys/statvfs.h system
22247set sys/statvfs.h i_sysstatvfs
22248eval $inhdr
22249
b4eb6b3d
JH
22250: see if this is a sys/un.h system
22251set sys/un.h i_sysun
22252eval $inhdr
22253
b4eb6b3d
JH
22254: see if this is a sys/utsname.h system
22255set sys/utsname.h i_sysutsname
22256eval $inhdr
22257
22258: see if this is a syswait system
22259set sys/wait.h i_syswait
22260eval $inhdr
22261
22262: see if this is a ustat.h system
22263set ustat.h i_ustat
22264eval $inhdr
22265
22266: see if this is an utime system
22267set utime.h i_utime
22268eval $inhdr
22269
b4eb6b3d
JH
22270: see if this is a vfork system
22271case "$d_vfork" in
22272"$define")
22273 set vfork.h i_vfork
22274 eval $inhdr
22275 ;;
22276*)
22277 i_vfork="$undef"
22278 ;;
22279esac
22280
613d6c3e 22281: Check extensions
b4eb6b3d
JH
22282echo " "
22283echo "Looking for extensions..." >&4
22284: If we are using the old config.sh, known_extensions may contain
22285: old or inaccurate or duplicate values.
22286known_extensions=''
22287nonxs_extensions=''
22288: We do not use find because it might not be available.
22289: We do not just use MANIFEST because the user may have dropped
22290: some additional extensions into the source tree and expect them
22291: to be built.
22292
38fddf8b
MB
22293: Function to recursively find available extensions, ignoring DynaLoader
22294: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
4cc80fc4 22295: In 5.10.1 and later, extensions are stored in directories
88a6f4fc 22296: like File-Glob instead of the older File/Glob/.
b4eb6b3d
JH
22297find_extensions='
22298 for xxx in *; do
822a6ee0
MB
22299 case "$xxx" in
22300 DynaLoader|dynaload) ;;
22301 *)
238a6851
NC
22302 this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22303 leaf=`echo $xxx | $sed -e s/.*-//`;
dd6c21be 22304 if $test -d File; then
38fddf8b
MB
22305 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22306 known_extensions="$known_extensions $1$this_ext";
22307 elif $test -f $xxx/Makefile.PL; then
22308 nonxs_extensions="$nonxs_extensions $1$this_ext";
22309 else
22310 if $test -d $xxx -a $# -lt 10; then
22311 set $1$xxx/ $*;
22312 cd "$xxx";
22313 eval $find_extensions;
22314 cd ..;
22315 shift;
22316 fi;
22317 fi;
dd6c21be 22318 else
86429348
NC
22319 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22320 if $contains " $this_ext " $$.tmp; then
01db32e2 22321 echo >&4;
86429348
NC
22322 echo "Duplicate directories detected for extension $xxx" >&4;
22323 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22324 case "$knowitall" in
22325 "") dflt=y;;
22326 *) dflt=n;;
22327 esac;
22328 . ../UU/myread;
22329 case "$ans" in
22330 n*|N*) ;;
01db32e2
NC
22331 *) echo >&4;
22332 echo "Ok. Stopping Configure." >&4;
86429348
NC
22333 echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22334 exit 1;;
22335 esac;
22336 echo "Ok. You will need to correct config.sh before running make." >&4;
22337 fi;
dd6c21be
NC
22338 $ls -1 $xxx > $$.tmp;
22339 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22340 known_extensions="$known_extensions $this_ext";
22341 elif $contains "\.c$" $$.tmp > /dev/null 2>&1; then
22342 known_extensions="$known_extensions $this_ext";
dd6c21be
NC
22343 elif $test -d $xxx; then
22344 nonxs_extensions="$nonxs_extensions $this_ext";
22345 fi;
22346 $rm -f $$.tmp;
822a6ee0
MB
22347 fi
22348 ;;
22349 esac;
b4eb6b3d
JH
22350 done'
22351tdir=`pwd`
dd6c21be
NC
22352cd "$rsrc/cpan"
22353set X
22354shift
22355eval $find_extensions
a193a2db
NC
22356cd "$rsrc/dist"
22357set X
22358shift
22359eval $find_extensions
6904989c 22360cd "$rsrc/ext"
b4eb6b3d
JH
22361set X
22362shift
22363eval $find_extensions
38fddf8b
MB
22364if $test -d File-Glob; then
22365 : All ext/ flattened
22366else
22367 # Special case: Add in modules that nest beyond the first level.
22368 # Currently threads/shared and Hash/Util/FieldHash, since they are
22369 # not picked up by the recursive find above (and adding in general
22370 # recursive finding breaks SDBM_File/sdbm).
22371 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22372 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22373fi
faae14e6
MB
22374set X $known_extensions
22375shift
a32b3e13 22376known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
b4eb6b3d
JH
22377set X $nonxs_extensions
22378shift
a32b3e13 22379nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
6904989c 22380cd "$tdir"
b4eb6b3d
JH
22381
22382: Now see which are supported on this system.
22383avail_ext=''
22384for xxx in $known_extensions ; do
22385 case "$xxx" in
22386 DB_File|db_file)
22387 case "$i_db" in
22388 $define) avail_ext="$avail_ext $xxx" ;;
22389 esac
22390 ;;
22391 GDBM_File|gdbm_fil)
7c345082 22392 case "$i_gdbm" in
b4eb6b3d
JH
22393 $define) avail_ext="$avail_ext $xxx" ;;
22394 esac
22395 ;;
1d59c593 22396 I18N/Langinfo|i18n_lan)
7c345082 22397 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
22398 $define$define) avail_ext="$avail_ext $xxx" ;;
22399 esac
22400 ;;
7978b0db
JH
22401 IPC/SysV|ipc/sysv)
22402 : XXX Do we need a useipcsysv variable here
22403 case "${d_msg}${d_sem}${d_shm}" in
22404 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22405 esac
22406 ;;
b4eb6b3d 22407 NDBM_File|ndbm_fil)
7894ad66 22408 case "$d_ndbm" in
b4eb6b3d
JH
22409 $define)
22410 case "$osname-$use64bitint" in
0be9fa5d 22411 hpux-define)
b4eb6b3d
JH
22412 case "$libs" in
22413 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22414 esac
22415 ;;
22416 *) avail_ext="$avail_ext $xxx" ;;
22417 esac
22418 ;;
22419 esac
22420 ;;
7c345082 22421 ODBM_File|odbm_fil)
b4eb6b3d
JH
22422 case "${i_dbm}${i_rpcsvcdbm}" in
22423 *"${define}"*)
7978b0db
JH
22424 case "$d_cplusplus" in
22425 define) ;; # delete as a function name will not work
22426 *) case "$osname-$use64bitint" in
22427 hpux-define)
22428 case "$libs" in
22429 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22430 esac
22431 ;;
22432 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
22433 esac
22434 ;;
b4eb6b3d
JH
22435 esac
22436 ;;
22437 esac
22438 ;;
7978b0db
JH
22439 Opcode|opcode)
22440 case "$useopcode" in
b4eb6b3d
JH
22441 true|define|y) avail_ext="$avail_ext $xxx" ;;
22442 esac
22443 ;;
7978b0db
JH
22444 POSIX|posix)
22445 case "$useposix" in
b4eb6b3d
JH
22446 true|define|y) avail_ext="$avail_ext $xxx" ;;
22447 esac
22448 ;;
22449 Socket|socket)
7c345082 22450 case "$d_socket" in
232083c0 22451 true|$define|y) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
22452 esac
22453 ;;
22454 Sys/Syslog|sys/syslog)
22455 : XXX syslog requires socket
7c345082 22456 case "$d_socket" in
b4eb6b3d
JH
22457 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22458 esac
22459 ;;
22460 Thread|thread)
b00ec89b
AB
22461 case "$usethreads" in
22462 true|$define|y)
47f9f84c 22463 case "$use5005threads" in
3f30fabf 22464 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 22465 esac
b4eb6b3d
JH
22466 esac
22467 ;;
7978b0db
JH
22468 threads|threads/shared)
22469 # threads and threads::shared are special cases.
22470 # To stop people from asking "Perl 5.8.0 was supposed
22471 # to have this new fancy threads implementation but my
22472 # perl doesn't have it" and from people trying to
22473 # (re)install the threads module using CPAN.pm and
22474 # CPAN.pm then offering to reinstall Perl 5.8.0,
22475 # the threads.pm and threads/shared.pm will always be
22476 # there, croaking informatively ("you need to rebuild
22477 # all of Perl with threads, sorry") when threads haven't
22478 # been compiled in.
22479 # --jhi
22480 avail_ext="$avail_ext $xxx"
22481 ;;
aefe3e7e
NC
22482 VMS*)
22483 ;;
78ff2d7b 22484 Win32*)
b149d92d
JD
22485 case "$osname" in
22486 cygwin) avail_ext="$avail_ext $xxx" ;;
22487 esac
22488 ;;
f9b6ed1c
AD
22489 XS/APItest|xs/apitest)
22490 # This is just for testing. Skip it unless we have dynamic loading.
88e1f1a2
JV
22491
22492 case "$usedl" in
22493 $define) avail_ext="$avail_ext $xxx" ;;
22494 esac
22495 ;;
f9b6ed1c
AD
22496 XS/Typemap|xs/typemap)
22497 # This is just for testing. Skip it unless we have dynamic loading.
22498 case "$usedl" in
22499 $define) avail_ext="$avail_ext $xxx" ;;
22500 esac
22501 ;;
b4eb6b3d 22502 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
22503 ;;
22504 esac
b4eb6b3d 22505done
5f80c64f 22506
b4eb6b3d
JH
22507set X $avail_ext
22508shift
22509avail_ext="$*"
5f80c64f 22510
ef0c5be8
JH
22511case "$onlyextensions" in
22512'') ;;
22513*) keepextensions=''
cd95ead5 22514 echo "You have requested that only certain extensions be included..." >&4
ef0c5be8
JH
22515 for i in $onlyextensions; do
22516 case " $avail_ext " in
22517 *" $i "*)
22518 echo "Keeping extension $i."
22519 keepextensions="$keepextensions $i"
22520 ;;
22521 *) echo "Ignoring extension $i." ;;
22522 esac
22523 done
22524 avail_ext="$keepextensions"
22525 ;;
22526esac
22527
22528case "$noextensions" in
22529'') ;;
22530*) keepextensions=''
22531 echo "You have requested that certain extensions be ignored..." >&4
22532 for i in $avail_ext; do
c3dadc13
AD
22533 case " $noextensions " in
22534 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
22535 *) echo "Keeping extension $i.";
22536 keepextensions="$keepextensions $i"
22537 ;;
22538 esac
22539 done
22540 avail_ext="$keepextensions"
22541 ;;
22542esac
22543
b4eb6b3d
JH
22544: Now see which nonxs extensions are supported on this system.
22545: For now assume all are.
22546nonxs_ext=''
22547for xxx in $nonxs_extensions ; do
22548 case "$xxx" in
22549 *) nonxs_ext="$nonxs_ext $xxx"
22550 ;;
22551 esac
22552done
5f80c64f 22553
b4eb6b3d
JH
22554set X $nonxs_ext
22555shift
22556nonxs_ext="$*"
22557
22558case $usedl in
22559$define)
22560 $cat <<EOM
22561A number of extensions are supplied with $package. You may choose to
22562compile these extensions for dynamic loading (the default), compile
22563them into the $package executable (static loading), or not include
22564them at all. Answer "none" to include no extensions.
22565Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
22566
22567EOM
b4eb6b3d 22568 case "$dynamic_ext" in
736accd3
YST
22569 '')
22570 : Exclude those listed in static_ext
22571 dflt=''
22572 for xxx in $avail_ext; do
22573 case " $static_ext " in
22574 *" $xxx "*) ;;
22575 *) dflt="$dflt $xxx" ;;
22576 esac
22577 done
22578 set X $dflt
22579 shift
22580 dflt="$*"
22581 ;;
b4eb6b3d
JH
22582 *) dflt="$dynamic_ext"
22583 # Perhaps we are reusing an old out-of-date config.sh.
22584 case "$hint" in
22585 previous)
22586 if test X"$dynamic_ext" != X"$avail_ext"; then
22587 $cat <<EOM
7c345082
RGS
22588NOTICE: Your previous config.sh list may be incorrect.
22589The extensions now available to you are
b4eb6b3d
JH
22590 ${avail_ext}
22591but the default list from your previous config.sh is
7c345082 22592 ${dynamic_ext}
9c839522 22593
b4eb6b3d
JH
22594EOM
22595 fi
9c839522
PM
22596 ;;
22597 esac
b4eb6b3d
JH
22598 ;;
22599 esac
5f80c64f 22600 case "$dflt" in
b4eb6b3d
JH
22601 '') dflt=none;;
22602 esac
22603 rp="What extensions do you wish to load dynamically?"
22604 . ./myread
22605 case "$ans" in
22606 none) dynamic_ext=' ' ;;
22607 *) dynamic_ext="$ans" ;;
5f80c64f 22608 esac
5f80c64f 22609
b4eb6b3d
JH
22610 case "$static_ext" in
22611 '')
22612 : Exclude those already listed in dynamic linking
22613 dflt=''
22614 for xxx in $avail_ext; do
22615 case " $dynamic_ext " in
22616 *" $xxx "*) ;;
22617 *) dflt="$dflt $xxx" ;;
22618 esac
22619 done
22620 set X $dflt
22621 shift
22622 dflt="$*"
22623 ;;
7c345082 22624 *) dflt="$static_ext"
b4eb6b3d
JH
22625 ;;
22626 esac
9c839522 22627
b4eb6b3d
JH
22628 case "$dflt" in
22629 '') dflt=none;;
22630 esac
22631 rp="What extensions do you wish to load statically?"
22632 . ./myread
22633 case "$ans" in
22634 none) static_ext=' ' ;;
22635 *) static_ext="$ans" ;;
22636 esac
22637 ;;
22638*)
22639 $cat <<EOM
7c345082
RGS
22640A number of extensions are supplied with $package. Answer "none"
22641to include no extensions.
b4eb6b3d 22642Note that DynaLoader is always built and need not be mentioned here.
9c839522 22643
b4eb6b3d
JH
22644EOM
22645 case "$static_ext" in
22646 '') dflt="$avail_ext" ;;
22647 *) dflt="$static_ext"
22648 # Perhaps we are reusing an old out-of-date config.sh.
22649 case "$hint" in
22650 previous)
22651 if test X"$static_ext" != X"$avail_ext"; then
22652 $cat <<EOM
7c345082
RGS
22653NOTICE: Your previous config.sh list may be incorrect.
22654The extensions now available to you are
b4eb6b3d
JH
22655 ${avail_ext}
22656but the default list from your previous config.sh is
7c345082 22657 ${static_ext}
5f80c64f
JH
22658
22659EOM
b4eb6b3d
JH
22660 fi
22661 ;;
22662 esac
22663 ;;
22664 esac
22665 : Exclude those that are not xs extensions
22666 case "$dflt" in
22667 '') dflt=none;;
22668 esac
22669 rp="What extensions do you wish to include?"
22670 . ./myread
22671 case "$ans" in
22672 none) static_ext=' ' ;;
22673 *) static_ext="$ans" ;;
22674 esac
22675 ;;
5f80c64f 22676esac
7c345082 22677#
f1f6834f
AD
22678# Encode is a special case. If we are building Encode as a static
22679# extension, we need to explicitly list its subextensions as well.
22680# For other nested extensions, this is handled automatically by
22681# the appropriate Makefile.PL.
22682case " $static_ext " in
22683 *" Encode "*) # Add the subextensions of Encode
d9a4b459 22684 cd "$rsrc/cpan"
f1f6834f
AD
22685 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22686 static_ext="$static_ext Encode/$xxx"
22687 done
22688 cd "$tdir"
22689 ;;
22690esac
5f80c64f 22691
b4eb6b3d
JH
22692set X $dynamic_ext $static_ext $nonxs_ext
22693shift
22694extensions="$*"
22695
93a2cd18
AD
22696# Sanity check: We require an extension suitable for use with
22697# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
22698# should show up as failures in the test suite, but it's helpful to
22699# catch them now.) The 'extensions' list is normally sorted
22700# alphabetically, so we need to accept either
22701# DB_File ... Fcntl ... IO ....
22702# or something like
22703# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
22704case " $extensions" in
22705*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22706*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22707*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
22708*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22709 echo "WARNING: The Perl you are building will be quite crippled." >& 4
22710 ;;
22711esac
22712
9c839522
PM
22713: Remove libraries needed only for extensions
22714: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
22715: The exception is SunOS 4.x, which needs them.
22716case "${osname}X${osvers}" in
22717sunos*X4*)
22718 perllibs="$libs"
22719 ;;
22720*) case "$usedl" in
22721 $define|true|[yY]*)
a33f2d9f 22722 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
eedaba54
PM
22723 shift
22724 perllibs="$*"
22725 ;;
22726 *) perllibs="$libs"
22727 ;;
22728 esac
22729 ;;
9c839522 22730esac
5f80c64f
JH
22731
22732: Remove build directory name from cppstdin so it can be used from
22733: either the present location or the final installed location.
22734echo " "
22735: Get out of the UU directory to get correct path name.
22736cd ..
22737case "$cppstdin" in
22738`pwd`/cppstdin)
22739 echo "Stripping down cppstdin path name"
22740 cppstdin=cppstdin
22741 ;;
22742esac
22743cd UU
22744
22745: end of configuration questions
22746echo " "
22747echo "End of configuration questions."
22748echo " "
22749
22750: back to where it started
22751if test -d ../UU; then
22752 cd ..
22753fi
22754
776a38e3 22755: configuration may be unconditionally patched via a 'config.arch' file
48370efc 22756if $test -f config.arch; then
776a38e3 22757 echo "I see a config.arch file, loading it." >&4
48370efc
JH
22758 . ./config.arch
22759fi
22760
5f80c64f
JH
22761: configuration may be patched via a 'config.over' file
22762if $test -f config.over; then
22763 echo " "
22764 dflt=y
22765 rp='I see a config.over file. Do you wish to load it?'
22766 . UU/myread
22767 case "$ans" in
22768 n*) echo "OK, I'll ignore it.";;
22769 *) . ./config.over
22770 echo "Configuration override changes have been loaded."
22771 ;;
22772 esac
22773fi
22774
22775: in case they want portability, strip down executable paths
22776case "$d_portable" in
22777"$define")
22778 echo " "
22779 echo "Stripping down executable paths..." >&4
22780 for file in $loclist $trylist; do
534ac15a
JH
22781 eval temp=\$$file
22782 eval $file=`basename $temp`
5f80c64f
JH
22783 done
22784 ;;
22785esac
22786
22787: create config.sh file
22788echo " "
22789echo "Creating config.sh..." >&4
22790$spitshell <<EOT >config.sh
22791$startsh
22792#
22793# This file was produced by running the Configure script. It holds all the
22794# definitions figured out by Configure. Should you modify one of these values,
22795# do not forget to propagate your changes by running "Configure -der". You may
22796# instead choose to run each of the .SH files by yourself, or "Configure -S".
22797#
22798
22799# Package name : $package
22800# Source directory : $src
22801# Configuration time: $cf_time
22802# Configured by : $cf_by
22803# Target system : $myuname
22804
776a38e3 22805EOT
94a9a4bc 22806: Add in command line options if available
776a38e3 22807$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
94a9a4bc 22808
776a38e3
MB
22809$spitshell <<EOT >>config.sh
22810
5f80c64f
JH
22811Author='$Author'
22812Date='$Date'
22813Header='$Header'
22814Id='$Id'
22815Locker='$Locker'
22816Log='$Log'
5f80c64f
JH
22817RCSfile='$RCSfile'
22818Revision='$Revision'
22819Source='$Source'
22820State='$State'
22821_a='$_a'
22822_exe='$_exe'
22823_o='$_o'
b4eb6b3d 22824afs='$afs'
a6d26a0d 22825afsroot='$afsroot'
b4eb6b3d
JH
22826alignbytes='$alignbytes'
22827ansi2knr='$ansi2knr'
22828aphostname='$aphostname'
22829api_revision='$api_revision'
22830api_subversion='$api_subversion'
22831api_version='$api_version'
22832api_versionstring='$api_versionstring'
5f80c64f 22833ar='$ar'
b4eb6b3d
JH
22834archlib='$archlib'
22835archlibexp='$archlibexp'
22836archname64='$archname64'
22837archname='$archname'
5f80c64f 22838archobjs='$archobjs'
10bc17b6 22839asctime_r_proto='$asctime_r_proto'
5f80c64f 22840awk='$awk'
b4eb6b3d 22841baserev='$baserev'
5f80c64f 22842bash='$bash'
b4eb6b3d 22843bin='$bin'
f1ce3bf1 22844bin_ELF='$bin_ELF'
b4eb6b3d 22845binexp='$binexp'
5f80c64f
JH
22846bison='$bison'
22847byacc='$byacc'
b4eb6b3d 22848byteorder='$byteorder'
5f80c64f 22849c='$c'
b4eb6b3d 22850castflags='$castflags'
5f80c64f
JH
22851cat='$cat'
22852cc='$cc'
22853cccdlflags='$cccdlflags'
22854ccdlflags='$ccdlflags'
22855ccflags='$ccflags'
b4eb6b3d 22856ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 22857ccname='$ccname'
b4eb6b3d 22858ccsymbols='$ccsymbols'
6b356c8e 22859ccversion='$ccversion'
5f80c64f 22860cf_by='$cf_by'
b4eb6b3d 22861cf_email='$cf_email'
5f80c64f 22862cf_time='$cf_time'
c193ef60
MB
22863charbits='$charbits'
22864charsize='$charsize'
5f80c64f
JH
22865chgrp='$chgrp'
22866chmod='$chmod'
22867chown='$chown'
b4eb6b3d 22868clocktype='$clocktype'
5f80c64f
JH
22869comm='$comm'
22870compress='$compress'
22871contains='$contains'
22872cp='$cp'
22873cpio='$cpio'
22874cpp='$cpp'
b4eb6b3d
JH
22875cpp_stuff='$cpp_stuff'
22876cppccsymbols='$cppccsymbols'
5f80c64f
JH
22877cppflags='$cppflags'
22878cpplast='$cpplast'
22879cppminus='$cppminus'
22880cpprun='$cpprun'
22881cppstdin='$cppstdin'
b4eb6b3d 22882cppsymbols='$cppsymbols'
10bc17b6 22883crypt_r_proto='$crypt_r_proto'
b4eb6b3d 22884cryptlib='$cryptlib'
5f80c64f 22885csh='$csh'
10bc17b6
JH
22886ctermid_r_proto='$ctermid_r_proto'
22887ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
22888d_Gconvert='$d_Gconvert'
22889d_PRIEUldbl='$d_PRIEUldbl'
22890d_PRIFUldbl='$d_PRIFUldbl'
22891d_PRIGUldbl='$d_PRIGUldbl'
22892d_PRIXU64='$d_PRIXU64'
22893d_PRId64='$d_PRId64'
22894d_PRIeldbl='$d_PRIeldbl'
22895d_PRIfldbl='$d_PRIfldbl'
22896d_PRIgldbl='$d_PRIgldbl'
22897d_PRIi64='$d_PRIi64'
22898d_PRIo64='$d_PRIo64'
22899d_PRIu64='$d_PRIu64'
22900d_PRIx64='$d_PRIx64'
22901d_SCNfldbl='$d_SCNfldbl'
74cac757 22902d__fwalk='$d__fwalk'
b4eb6b3d
JH
22903d_access='$d_access'
22904d_accessx='$d_accessx'
55954f19 22905d_aintl='$d_aintl'
b4eb6b3d
JH
22906d_alarm='$d_alarm'
22907d_archlib='$d_archlib'
96938616 22908d_asctime64='$d_asctime64'
10bc17b6 22909d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
22910d_atolf='$d_atolf'
22911d_atoll='$d_atoll'
fcdf39cf 22912d_attribute_deprecated='$d_attribute_deprecated'
0dbb1585
AL
22913d_attribute_format='$d_attribute_format'
22914d_attribute_malloc='$d_attribute_malloc'
22915d_attribute_nonnull='$d_attribute_nonnull'
22916d_attribute_noreturn='$d_attribute_noreturn'
22917d_attribute_pure='$d_attribute_pure'
22918d_attribute_unused='$d_attribute_unused'
22919d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
22920d_bcmp='$d_bcmp'
22921d_bcopy='$d_bcopy'
5f80c64f 22922d_bsd='$d_bsd'
b4eb6b3d
JH
22923d_bsdgetpgrp='$d_bsdgetpgrp'
22924d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
22925d_builtin_choose_expr='$d_builtin_choose_expr'
22926d_builtin_expect='$d_builtin_expect'
b4eb6b3d 22927d_bzero='$d_bzero'
a2d23ec2 22928d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
22929d_casti32='$d_casti32'
22930d_castneg='$d_castneg'
22931d_charvspr='$d_charvspr'
22932d_chown='$d_chown'
22933d_chroot='$d_chroot'
22934d_chsize='$d_chsize'
758a5d79 22935d_class='$d_class'
b0a2e8e6 22936d_clearenv='$d_clearenv'
b4eb6b3d 22937d_closedir='$d_closedir'
4e0554ec 22938d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 22939d_const='$d_const'
55954f19 22940d_copysignl='$d_copysignl'
666ea192 22941d_cplusplus='$d_cplusplus'
b4eb6b3d 22942d_crypt='$d_crypt'
10bc17b6 22943d_crypt_r='$d_crypt_r'
b4eb6b3d 22944d_csh='$d_csh'
13cfc98d 22945d_ctermid='$d_ctermid'
10bc17b6 22946d_ctermid_r='$d_ctermid_r'
96938616 22947d_ctime64='$d_ctime64'
10bc17b6 22948d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
22949d_cuserid='$d_cuserid'
22950d_dbl_dig='$d_dbl_dig'
2ef53570 22951d_dbminitproto='$d_dbminitproto'
96938616 22952d_difftime64='$d_difftime64'
b4eb6b3d 22953d_difftime='$d_difftime'
de52168c 22954d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 22955d_dirfd='$d_dirfd'
b4eb6b3d
JH
22956d_dirnamlen='$d_dirnamlen'
22957d_dlerror='$d_dlerror'
5f80c64f 22958d_dlopen='$d_dlopen'
b4eb6b3d
JH
22959d_dlsymun='$d_dlsymun'
22960d_dosuid='$d_dosuid'
10bc17b6 22961d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
22962d_drand48proto='$d_drand48proto'
22963d_dup2='$d_dup2'
22964d_eaccess='$d_eaccess'
22965d_endgrent='$d_endgrent'
10bc17b6 22966d_endgrent_r='$d_endgrent_r'
b4eb6b3d 22967d_endhent='$d_endhent'
10bc17b6 22968d_endhostent_r='$d_endhostent_r'
b4eb6b3d 22969d_endnent='$d_endnent'
10bc17b6 22970d_endnetent_r='$d_endnetent_r'
b4eb6b3d 22971d_endpent='$d_endpent'
10bc17b6 22972d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 22973d_endpwent='$d_endpwent'
10bc17b6 22974d_endpwent_r='$d_endpwent_r'
b4eb6b3d 22975d_endsent='$d_endsent'
10bc17b6 22976d_endservent_r='$d_endservent_r'
b4eb6b3d 22977d_eofnblk='$d_eofnblk'
5f80c64f 22978d_eunice='$d_eunice'
15b61c98 22979d_faststdio='$d_faststdio'
b363b713 22980d_fchdir='$d_fchdir'
b4eb6b3d
JH
22981d_fchmod='$d_fchmod'
22982d_fchown='$d_fchown'
22983d_fcntl='$d_fcntl'
9d9004a9 22984d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
22985d_fd_macros='$d_fd_macros'
22986d_fd_set='$d_fd_set'
22987d_fds_bits='$d_fds_bits'
22988d_fgetpos='$d_fgetpos'
758a5d79
JH
22989d_finite='$d_finite'
22990d_finitel='$d_finitel'
b4eb6b3d
JH
22991d_flexfnam='$d_flexfnam'
22992d_flock='$d_flock'
2ef53570 22993d_flockproto='$d_flockproto'
b4eb6b3d 22994d_fork='$d_fork'
758a5d79 22995d_fp_class='$d_fp_class'
b4eb6b3d 22996d_fpathconf='$d_fpathconf'
758a5d79
JH
22997d_fpclass='$d_fpclass'
22998d_fpclassify='$d_fpclassify'
22999d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
23000d_fpos64_t='$d_fpos64_t'
23001d_frexpl='$d_frexpl'
23002d_fs_data_s='$d_fs_data_s'
23003d_fseeko='$d_fseeko'
23004d_fsetpos='$d_fsetpos'
23005d_fstatfs='$d_fstatfs'
23006d_fstatvfs='$d_fstatvfs'
411ab01c 23007d_fsync='$d_fsync'
b4eb6b3d
JH
23008d_ftello='$d_ftello'
23009d_ftime='$d_ftime'
dc814df1 23010d_futimes='$d_futimes'
e74475c7
MHM
23011d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23012d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
5086dff9 23013d_getaddrinfo='$d_getaddrinfo'
b4eb6b3d
JH
23014d_getcwd='$d_getcwd'
23015d_getespwnam='$d_getespwnam'
23016d_getfsstat='$d_getfsstat'
23017d_getgrent='$d_getgrent'
10bc17b6
JH
23018d_getgrent_r='$d_getgrent_r'
23019d_getgrgid_r='$d_getgrgid_r'
23020d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
23021d_getgrps='$d_getgrps'
23022d_gethbyaddr='$d_gethbyaddr'
23023d_gethbyname='$d_gethbyname'
23024d_gethent='$d_gethent'
23025d_gethname='$d_gethname'
10bc17b6
JH
23026d_gethostbyaddr_r='$d_gethostbyaddr_r'
23027d_gethostbyname_r='$d_gethostbyname_r'
23028d_gethostent_r='$d_gethostent_r'
b4eb6b3d 23029d_gethostprotos='$d_gethostprotos'
4e0554ec 23030d_getitimer='$d_getitimer'
b4eb6b3d 23031d_getlogin='$d_getlogin'
10bc17b6 23032d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
23033d_getmnt='$d_getmnt'
23034d_getmntent='$d_getmntent'
5086dff9 23035d_getnameinfo='$d_getnameinfo'
b4eb6b3d
JH
23036d_getnbyaddr='$d_getnbyaddr'
23037d_getnbyname='$d_getnbyname'
23038d_getnent='$d_getnent'
10bc17b6
JH
23039d_getnetbyaddr_r='$d_getnetbyaddr_r'
23040d_getnetbyname_r='$d_getnetbyname_r'
23041d_getnetent_r='$d_getnetent_r'
b4eb6b3d 23042d_getnetprotos='$d_getnetprotos'
0c0643d0 23043d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
23044d_getpbyname='$d_getpbyname'
23045d_getpbynumber='$d_getpbynumber'
23046d_getpent='$d_getpent'
23047d_getpgid='$d_getpgid'
23048d_getpgrp2='$d_getpgrp2'
23049d_getpgrp='$d_getpgrp'
23050d_getppid='$d_getppid'
23051d_getprior='$d_getprior'
10bc17b6
JH
23052d_getprotobyname_r='$d_getprotobyname_r'
23053d_getprotobynumber_r='$d_getprotobynumber_r'
23054d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
23055d_getprotoprotos='$d_getprotoprotos'
23056d_getprpwnam='$d_getprpwnam'
23057d_getpwent='$d_getpwent'
10bc17b6
JH
23058d_getpwent_r='$d_getpwent_r'
23059d_getpwnam_r='$d_getpwnam_r'
23060d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
23061d_getsbyname='$d_getsbyname'
23062d_getsbyport='$d_getsbyport'
23063d_getsent='$d_getsent'
10bc17b6
JH
23064d_getservbyname_r='$d_getservbyname_r'
23065d_getservbyport_r='$d_getservbyport_r'
23066d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
23067d_getservprotos='$d_getservprotos'
23068d_getspnam='$d_getspnam'
10bc17b6 23069d_getspnam_r='$d_getspnam_r'
b4eb6b3d 23070d_gettimeod='$d_gettimeod'
96938616 23071d_gmtime64='$d_gmtime64'
10bc17b6 23072d_gmtime_r='$d_gmtime_r'
5f80c64f 23073d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
23074d_grpasswd='$d_grpasswd'
23075d_hasmntopt='$d_hasmntopt'
23076d_htonl='$d_htonl'
55954f19 23077d_ilogbl='$d_ilogbl'
f3f1a2d8 23078d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
23079d_index='$d_index'
23080d_inetaton='$d_inetaton'
5086dff9
MB
23081d_inetntop='$d_inetntop'
23082d_inetpton='$d_inetpton'
b4eb6b3d 23083d_int64_t='$d_int64_t'
122b9bf4 23084d_ip_mreq='$d_ip_mreq'
3e06601f 23085d_ip_mreq_source='$d_ip_mreq_source'
18126d98 23086d_ipv6_mreq='$d_ipv6_mreq'
3e06601f 23087d_ipv6_mreq_source='$d_ipv6_mreq_source'
b4eb6b3d 23088d_isascii='$d_isascii'
269a7913 23089d_isblank='$d_isblank'
758a5d79
JH
23090d_isfinite='$d_isfinite'
23091d_isinf='$d_isinf'
b4eb6b3d
JH
23092d_isnan='$d_isnan'
23093d_isnanl='$d_isnanl'
23094d_killpg='$d_killpg'
23095d_lchown='$d_lchown'
23096d_ldbl_dig='$d_ldbl_dig'
0a0abfba 23097d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 23098d_link='$d_link'
96938616 23099d_localtime64='$d_localtime64'
10bc17b6 23100d_localtime_r='$d_localtime_r'
8572b25d 23101d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
23102d_locconv='$d_locconv'
23103d_lockf='$d_lockf'
23104d_longdbl='$d_longdbl'
23105d_longlong='$d_longlong'
23106d_lseekproto='$d_lseekproto'
23107d_lstat='$d_lstat'
23108d_madvise='$d_madvise'
7dd121ae
MB
23109d_malloc_good_size='$d_malloc_good_size'
23110d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
23111d_mblen='$d_mblen'
23112d_mbstowcs='$d_mbstowcs'
23113d_mbtowc='$d_mbtowc'
23114d_memchr='$d_memchr'
23115d_memcmp='$d_memcmp'
23116d_memcpy='$d_memcpy'
23117d_memmove='$d_memmove'
23118d_memset='$d_memset'
23119d_mkdir='$d_mkdir'
23120d_mkdtemp='$d_mkdtemp'
23121d_mkfifo='$d_mkfifo'
23122d_mkstemp='$d_mkstemp'
23123d_mkstemps='$d_mkstemps'
96938616 23124d_mktime64='$d_mktime64'
b4eb6b3d
JH
23125d_mktime='$d_mktime'
23126d_mmap='$d_mmap'
23127d_modfl='$d_modfl'
e67aeab1 23128d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 23129d_modflproto='$d_modflproto'
b4eb6b3d
JH
23130d_mprotect='$d_mprotect'
23131d_msg='$d_msg'
23132d_msg_ctrunc='$d_msg_ctrunc'
23133d_msg_dontroute='$d_msg_dontroute'
23134d_msg_oob='$d_msg_oob'
23135d_msg_peek='$d_msg_peek'
23136d_msg_proxy='$d_msg_proxy'
23137d_msgctl='$d_msgctl'
23138d_msgget='$d_msgget'
4e0554ec 23139d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
23140d_msgrcv='$d_msgrcv'
23141d_msgsnd='$d_msgsnd'
23142d_msync='$d_msync'
23143d_munmap='$d_munmap'
23144d_mymalloc='$d_mymalloc'
a33f2d9f 23145d_ndbm='$d_ndbm'
e74475c7 23146d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
b4eb6b3d 23147d_nice='$d_nice'
2765b840 23148d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 23149d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 23150d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
23151d_off64_t='$d_off64_t'
23152d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23153d_oldpthreads='$d_oldpthreads'
23154d_oldsock='$d_oldsock'
23155d_open3='$d_open3'
23156d_pathconf='$d_pathconf'
23157d_pause='$d_pause'
23158d_perl_otherlibdirs='$d_perl_otherlibdirs'
23159d_phostname='$d_phostname'
23160d_pipe='$d_pipe'
23161d_poll='$d_poll'
5f80c64f 23162d_portable='$d_portable'
c796e3db
MB
23163d_prctl='$d_prctl'
23164d_prctl_set_name='$d_prctl_set_name'
dcb594bc 23165d_printf_format_null='$d_printf_format_null'
c7aff470 23166d_procselfexe='$d_procselfexe'
233e16ce 23167d_pseudofork='$d_pseudofork'
d6483fcc 23168d_pthread_atfork='$d_pthread_atfork'
58d975c3 23169d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
23170d_pthread_yield='$d_pthread_yield'
23171d_pwage='$d_pwage'
23172d_pwchange='$d_pwchange'
23173d_pwclass='$d_pwclass'
23174d_pwcomment='$d_pwcomment'
23175d_pwexpire='$d_pwexpire'
23176d_pwgecos='$d_pwgecos'
23177d_pwpasswd='$d_pwpasswd'
23178d_pwquota='$d_pwquota'
23179d_qgcvt='$d_qgcvt'
23180d_quad='$d_quad'
10bc17b6
JH
23181d_random_r='$d_random_r'
23182d_readdir64_r='$d_readdir64_r'
b4eb6b3d 23183d_readdir='$d_readdir'
10bc17b6 23184d_readdir_r='$d_readdir_r'
b4eb6b3d 23185d_readlink='$d_readlink'
4e0554ec
JH
23186d_readv='$d_readv'
23187d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
23188d_rename='$d_rename'
23189d_rewinddir='$d_rewinddir'
23190d_rmdir='$d_rmdir'
23191d_safebcpy='$d_safebcpy'
23192d_safemcpy='$d_safemcpy'
23193d_sanemcmp='$d_sanemcmp'
ef9f17be 23194d_sbrkproto='$d_sbrkproto'
55954f19 23195d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
23196d_sched_yield='$d_sched_yield'
23197d_scm_rights='$d_scm_rights'
23198d_seekdir='$d_seekdir'
23199d_select='$d_select'
23200d_sem='$d_sem'
23201d_semctl='$d_semctl'
23202d_semctl_semid_ds='$d_semctl_semid_ds'
23203d_semctl_semun='$d_semctl_semun'
23204d_semget='$d_semget'
23205d_semop='$d_semop'
4e0554ec 23206d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
23207d_setegid='$d_setegid'
23208d_seteuid='$d_seteuid'
23209d_setgrent='$d_setgrent'
10bc17b6 23210d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
23211d_setgrps='$d_setgrps'
23212d_sethent='$d_sethent'
10bc17b6 23213d_sethostent_r='$d_sethostent_r'
4e0554ec 23214d_setitimer='$d_setitimer'
b4eb6b3d
JH
23215d_setlinebuf='$d_setlinebuf'
23216d_setlocale='$d_setlocale'
10bc17b6 23217d_setlocale_r='$d_setlocale_r'
b4eb6b3d 23218d_setnent='$d_setnent'
10bc17b6 23219d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
23220d_setpent='$d_setpent'
23221d_setpgid='$d_setpgid'
23222d_setpgrp2='$d_setpgrp2'
23223d_setpgrp='$d_setpgrp'
23224d_setprior='$d_setprior'
23225d_setproctitle='$d_setproctitle'
10bc17b6 23226d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 23227d_setpwent='$d_setpwent'
10bc17b6 23228d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
23229d_setregid='$d_setregid'
23230d_setresgid='$d_setresgid'
23231d_setresuid='$d_setresuid'
23232d_setreuid='$d_setreuid'
23233d_setrgid='$d_setrgid'
23234d_setruid='$d_setruid'
23235d_setsent='$d_setsent'
10bc17b6 23236d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
23237d_setsid='$d_setsid'
23238d_setvbuf='$d_setvbuf'
23239d_sfio='$d_sfio'
23240d_shm='$d_shm'
23241d_shmat='$d_shmat'
23242d_shmatprototype='$d_shmatprototype'
23243d_shmctl='$d_shmctl'
23244d_shmdt='$d_shmdt'
23245d_shmget='$d_shmget'
23246d_sigaction='$d_sigaction'
ed140128 23247d_signbit='$d_signbit'
983dbef6 23248d_sigprocmask='$d_sigprocmask'
b4eb6b3d 23249d_sigsetjmp='$d_sigsetjmp'
f53580fe 23250d_sin6_scope_id='$d_sin6_scope_id'
c95d0e17 23251d_sitearch='$d_sitearch'
4f5da3e9 23252d_snprintf='$d_snprintf'
18126d98 23253d_sockaddr_in6='$d_sockaddr_in6'
b8677e3b 23254d_sockaddr_sa_len='$d_sockaddr_sa_len'
49a78c82 23255d_sockatmark='$d_sockatmark'
2ef53570 23256d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
23257d_socket='$d_socket'
23258d_socklen_t='$d_socklen_t'
23259d_sockpair='$d_sockpair'
23260d_socks5_init='$d_socks5_init'
360321b3 23261d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 23262d_sqrtl='$d_sqrtl'
10bc17b6
JH
23263d_srand48_r='$d_srand48_r'
23264d_srandom_r='$d_srandom_r'
eef837ea 23265d_sresgproto='$d_sresgproto'
640374d0 23266d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
23267d_statblks='$d_statblks'
23268d_statfs_f_flags='$d_statfs_f_flags'
23269d_statfs_s='$d_statfs_s'
17a6c8e3 23270d_static_inline='$d_static_inline'
b4eb6b3d
JH
23271d_statvfs='$d_statvfs'
23272d_stdio_cnt_lval='$d_stdio_cnt_lval'
23273d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
23274d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23275d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
23276d_stdio_stream_array='$d_stdio_stream_array'
23277d_stdiobase='$d_stdiobase'
23278d_stdstdio='$d_stdstdio'
23279d_strchr='$d_strchr'
23280d_strcoll='$d_strcoll'
23281d_strctcpy='$d_strctcpy'
23282d_strerrm='$d_strerrm'
23283d_strerror='$d_strerror'
10bc17b6 23284d_strerror_r='$d_strerror_r'
b3c85772 23285d_strftime='$d_strftime'
08c92000
MB
23286d_strlcat='$d_strlcat'
23287d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
23288d_strtod='$d_strtod'
23289d_strtol='$d_strtol'
23290d_strtold='$d_strtold'
23291d_strtoll='$d_strtoll'
28e5dec8 23292d_strtoq='$d_strtoq'
b4eb6b3d
JH
23293d_strtoul='$d_strtoul'
23294d_strtoull='$d_strtoull'
23295d_strtouq='$d_strtouq'
23296d_strxfrm='$d_strxfrm'
23297d_suidsafe='$d_suidsafe'
23298d_symlink='$d_symlink'
23299d_syscall='$d_syscall'
2ef53570 23300d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
23301d_sysconf='$d_sysconf'
23302d_sysernlst='$d_sysernlst'
23303d_syserrlst='$d_syserrlst'
23304d_system='$d_system'
23305d_tcgetpgrp='$d_tcgetpgrp'
23306d_tcsetpgrp='$d_tcsetpgrp'
23307d_telldir='$d_telldir'
23308d_telldirproto='$d_telldirproto'
23309d_time='$d_time'
cbb9e8a7 23310d_timegm='$d_timegm'
b4eb6b3d 23311d_times='$d_times'
14b90194
JH
23312d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23313d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 23314d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 23315d_truncate='$d_truncate'
10bc17b6 23316d_ttyname_r='$d_ttyname_r'
b4eb6b3d 23317d_tzname='$d_tzname'
4e0554ec
JH
23318d_u32align='$d_u32align'
23319d_ualarm='$d_ualarm'
b4eb6b3d
JH
23320d_umask='$d_umask'
23321d_uname='$d_uname'
23322d_union_semun='$d_union_semun'
758a5d79 23323d_unordered='$d_unordered'
bdf33aa7 23324d_unsetenv='$d_unsetenv'
4e0554ec 23325d_usleep='$d_usleep'
2ef53570 23326d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
23327d_ustat='$d_ustat'
23328d_vendorarch='$d_vendorarch'
23329d_vendorbin='$d_vendorbin'
23330d_vendorlib='$d_vendorlib'
6e1038e0 23331d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
23332d_vfork='$d_vfork'
23333d_void_closedir='$d_void_closedir'
23334d_voidsig='$d_voidsig'
23335d_voidtty='$d_voidtty'
23336d_volatile='$d_volatile'
23337d_vprintf='$d_vprintf'
4f5da3e9 23338d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
23339d_wait4='$d_wait4'
23340d_waitpid='$d_waitpid'
23341d_wcstombs='$d_wcstombs'
23342d_wctomb='$d_wctomb'
4e0554ec 23343d_writev='$d_writev'
5f80c64f
JH
23344d_xenix='$d_xenix'
23345date='$date'
b4eb6b3d
JH
23346db_hashtype='$db_hashtype'
23347db_prefixtype='$db_prefixtype'
640374d0
JH
23348db_version_major='$db_version_major'
23349db_version_minor='$db_version_minor'
23350db_version_patch='$db_version_patch'
b4eb6b3d
JH
23351defvoidused='$defvoidused'
23352direntrytype='$direntrytype'
23353dlext='$dlext'
5f80c64f 23354dlsrc='$dlsrc'
b4eb6b3d
JH
23355doublesize='$doublesize'
23356drand01='$drand01'
10bc17b6 23357drand48_r_proto='$drand48_r_proto'
5ac1e9b2 23358dtrace='$dtrace'
b4eb6b3d
JH
23359dynamic_ext='$dynamic_ext'
23360eagain='$eagain'
23361ebcdic='$ebcdic'
5f80c64f
JH
23362echo='$echo'
23363egrep='$egrep'
23364emacs='$emacs'
10bc17b6
JH
23365endgrent_r_proto='$endgrent_r_proto'
23366endhostent_r_proto='$endhostent_r_proto'
23367endnetent_r_proto='$endnetent_r_proto'
23368endprotoent_r_proto='$endprotoent_r_proto'
23369endpwent_r_proto='$endpwent_r_proto'
23370endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
23371eunicefix='$eunicefix'
23372exe_ext='$exe_ext'
23373expr='$expr'
b4eb6b3d 23374extensions='$extensions'
61c26d18 23375extern_C='$extern_C'
6fcddf3b 23376extras='$extras'
b4eb6b3d
JH
23377fflushNULL='$fflushNULL'
23378fflushall='$fflushall'
5f80c64f
JH
23379find='$find'
23380firstmakefile='$firstmakefile'
23381flex='$flex'
b4eb6b3d
JH
23382fpossize='$fpossize'
23383fpostype='$fpostype'
23384freetype='$freetype'
5440bc8e 23385from='$from'
b4eb6b3d
JH
23386full_ar='$full_ar'
23387full_csh='$full_csh'
23388full_sed='$full_sed'
2d736872 23389gccansipedantic='$gccansipedantic'
5b463ca7 23390gccosandvers='$gccosandvers'
5f80c64f 23391gccversion='$gccversion'
10bc17b6
JH
23392getgrent_r_proto='$getgrent_r_proto'
23393getgrgid_r_proto='$getgrgid_r_proto'
23394getgrnam_r_proto='$getgrnam_r_proto'
23395gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23396gethostbyname_r_proto='$gethostbyname_r_proto'
23397gethostent_r_proto='$gethostent_r_proto'
23398getlogin_r_proto='$getlogin_r_proto'
23399getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23400getnetbyname_r_proto='$getnetbyname_r_proto'
23401getnetent_r_proto='$getnetent_r_proto'
23402getprotobyname_r_proto='$getprotobyname_r_proto'
23403getprotobynumber_r_proto='$getprotobynumber_r_proto'
23404getprotoent_r_proto='$getprotoent_r_proto'
23405getpwent_r_proto='$getpwent_r_proto'
23406getpwnam_r_proto='$getpwnam_r_proto'
23407getpwuid_r_proto='$getpwuid_r_proto'
23408getservbyname_r_proto='$getservbyname_r_proto'
23409getservbyport_r_proto='$getservbyport_r_proto'
23410getservent_r_proto='$getservent_r_proto'
23411getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
23412gidformat='$gidformat'
23413gidsign='$gidsign'
23414gidsize='$gidsize'
23415gidtype='$gidtype'
5f80c64f 23416glibpth='$glibpth'
3c728e00 23417gmake='$gmake'
10bc17b6 23418gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 23419gnulibc_version='$gnulibc_version'
5f80c64f 23420grep='$grep'
b4eb6b3d
JH
23421groupcat='$groupcat'
23422groupstype='$groupstype'
5f80c64f 23423gzip='$gzip'
b4eb6b3d
JH
23424h_fcntl='$h_fcntl'
23425h_sysfile='$h_sysfile'
5f80c64f 23426hint='$hint'
b4eb6b3d 23427hostcat='$hostcat'
6e1038e0
MB
23428html1dir='$html1dir'
23429html1direxp='$html1direxp'
23430html3dir='$html3dir'
23431html3direxp='$html3direxp'
b4eb6b3d
JH
23432i16size='$i16size'
23433i16type='$i16type'
23434i32size='$i32size'
23435i32type='$i32type'
23436i64size='$i64size'
23437i64type='$i64type'
23438i8size='$i8size'
23439i8type='$i8type'
23440i_arpainet='$i_arpainet'
2a0de2c5 23441i_assert='$i_assert'
b4eb6b3d 23442i_bsdioctl='$i_bsdioctl'
10bc17b6 23443i_crypt='$i_crypt'
b4eb6b3d
JH
23444i_db='$i_db'
23445i_dbm='$i_dbm'
23446i_dirent='$i_dirent'
5f80c64f 23447i_dld='$i_dld'
b4eb6b3d
JH
23448i_dlfcn='$i_dlfcn'
23449i_fcntl='$i_fcntl'
23450i_float='$i_float'
758a5d79
JH
23451i_fp='$i_fp'
23452i_fp_class='$i_fp_class'
b4eb6b3d 23453i_gdbm='$i_gdbm'
a33f2d9f
AD
23454i_gdbm_ndbm='$i_gdbm_ndbm'
23455i_gdbmndbm='$i_gdbmndbm'
b4eb6b3d 23456i_grp='$i_grp'
b4eb6b3d
JH
23457i_ieeefp='$i_ieeefp'
23458i_inttypes='$i_inttypes'
2765b840 23459i_langinfo='$i_langinfo'
b4eb6b3d
JH
23460i_libutil='$i_libutil'
23461i_limits='$i_limits'
23462i_locale='$i_locale'
23463i_machcthr='$i_machcthr'
23464i_malloc='$i_malloc'
1cd66f7c 23465i_mallocmalloc='$i_mallocmalloc'
b4eb6b3d
JH
23466i_math='$i_math'
23467i_memory='$i_memory'
23468i_mntent='$i_mntent'
23469i_ndbm='$i_ndbm'
23470i_netdb='$i_netdb'
23471i_neterrno='$i_neterrno'
23472i_netinettcp='$i_netinettcp'
23473i_niin='$i_niin'
23474i_poll='$i_poll'
23475i_prot='$i_prot'
23476i_pthread='$i_pthread'
23477i_pwd='$i_pwd'
23478i_rpcsvcdbm='$i_rpcsvcdbm'
23479i_sfio='$i_sfio'
23480i_sgtty='$i_sgtty'
23481i_shadow='$i_shadow'
23482i_socks='$i_socks'
23483i_stdarg='$i_stdarg'
bd31be4b 23484i_stdbool='$i_stdbool'
b4eb6b3d
JH
23485i_stddef='$i_stddef'
23486i_stdlib='$i_stdlib'
23487i_string='$i_string'
23488i_sunmath='$i_sunmath'
23489i_sysaccess='$i_sysaccess'
23490i_sysdir='$i_sysdir'
23491i_sysfile='$i_sysfile'
23492i_sysfilio='$i_sysfilio'
23493i_sysin='$i_sysin'
23494i_sysioctl='$i_sysioctl'
23495i_syslog='$i_syslog'
23496i_sysmman='$i_sysmman'
23497i_sysmode='$i_sysmode'
23498i_sysmount='$i_sysmount'
23499i_sysndir='$i_sysndir'
23500i_sysparam='$i_sysparam'
216dac04 23501i_syspoll='$i_syspoll'
b4eb6b3d
JH
23502i_sysresrc='$i_sysresrc'
23503i_syssecrt='$i_syssecrt'
23504i_sysselct='$i_sysselct'
23505i_syssockio='$i_syssockio'
23506i_sysstat='$i_sysstat'
23507i_sysstatfs='$i_sysstatfs'
23508i_sysstatvfs='$i_sysstatvfs'
23509i_systime='$i_systime'
23510i_systimek='$i_systimek'
23511i_systimes='$i_systimes'
23512i_systypes='$i_systypes'
23513i_sysuio='$i_sysuio'
23514i_sysun='$i_sysun'
23515i_sysutsname='$i_sysutsname'
23516i_sysvfs='$i_sysvfs'
23517i_syswait='$i_syswait'
23518i_termio='$i_termio'
23519i_termios='$i_termios'
23520i_time='$i_time'
23521i_unistd='$i_unistd'
23522i_ustat='$i_ustat'
23523i_utime='$i_utime'
23524i_values='$i_values'
23525i_varargs='$i_varargs'
23526i_varhdr='$i_varhdr'
23527i_vfork='$i_vfork'
5f80c64f 23528ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
23529inc_version_list='$inc_version_list'
23530inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
23531incpath='$incpath'
23532inews='$inews'
f3f1a2d8 23533initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
23534installarchlib='$installarchlib'
23535installbin='$installbin'
6e1038e0
MB
23536installhtml1dir='$installhtml1dir'
23537installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
23538installman1dir='$installman1dir'
23539installman3dir='$installman3dir'
23540installprefix='$installprefix'
23541installprefixexp='$installprefixexp'
23542installprivlib='$installprivlib'
23543installscript='$installscript'
23544installsitearch='$installsitearch'
23545installsitebin='$installsitebin'
8d2cbf27
JH
23546installsitehtml1dir='$installsitehtml1dir'
23547installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 23548installsitelib='$installsitelib'
91e123a8
JH
23549installsiteman1dir='$installsiteman1dir'
23550installsiteman3dir='$installsiteman3dir'
6e1038e0 23551installsitescript='$installsitescript'
b4eb6b3d
JH
23552installstyle='$installstyle'
23553installusrbinperl='$installusrbinperl'
23554installvendorarch='$installvendorarch'
23555installvendorbin='$installvendorbin'
8d2cbf27
JH
23556installvendorhtml1dir='$installvendorhtml1dir'
23557installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 23558installvendorlib='$installvendorlib'
91e123a8
JH
23559installvendorman1dir='$installvendorman1dir'
23560installvendorman3dir='$installvendorman3dir'
6e1038e0 23561installvendorscript='$installvendorscript'
b4eb6b3d 23562intsize='$intsize'
4b661809 23563issymlink='$issymlink'
b4eb6b3d
JH
23564ivdformat='$ivdformat'
23565ivsize='$ivsize'
23566ivtype='$ivtype'
23567known_extensions='$known_extensions'
5f80c64f 23568ksh='$ksh'
5f80c64f 23569ld='$ld'
9ec4dadf 23570ld_can_script='$ld_can_script'
5f80c64f
JH
23571lddlflags='$lddlflags'
23572ldflags='$ldflags'
b4eb6b3d
JH
23573ldflags_uselargefiles='$ldflags_uselargefiles'
23574ldlibpthname='$ldlibpthname'
5f80c64f
JH
23575less='$less'
23576lib_ext='$lib_ext'
23577libc='$libc'
b4eb6b3d 23578libperl='$libperl'
5f80c64f
JH
23579libpth='$libpth'
23580libs='$libs'
43999f95
JH
23581libsdirs='$libsdirs'
23582libsfiles='$libsfiles'
23583libsfound='$libsfound'
13b3f787 23584libspath='$libspath'
5f80c64f 23585libswanted='$libswanted'
b4eb6b3d 23586libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
23587line='$line'
23588lint='$lint'
23589lkflags='$lkflags'
23590ln='$ln'
23591lns='$lns'
10bc17b6 23592localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
23593locincpth='$locincpth'
23594loclibpth='$loclibpth'
b4eb6b3d
JH
23595longdblsize='$longdblsize'
23596longlongsize='$longlongsize'
23597longsize='$longsize'
5f80c64f
JH
23598lp='$lp'
23599lpr='$lpr'
23600ls='$ls'
b4eb6b3d
JH
23601lseeksize='$lseeksize'
23602lseektype='$lseektype'
a724edfe 23603mad='$mad'
f3f1a2d8
MB
23604madlyh='$madlyh'
23605madlyobj='$madlyobj'
23606madlysrc='$madlysrc'
5f80c64f
JH
23607mail='$mail'
23608mailx='$mailx'
23609make='$make'
23610make_set_make='$make_set_make'
b4eb6b3d
JH
23611mallocobj='$mallocobj'
23612mallocsrc='$mallocsrc'
23613malloctype='$malloctype'
23614man1dir='$man1dir'
23615man1direxp='$man1direxp'
23616man1ext='$man1ext'
23617man3dir='$man3dir'
23618man3direxp='$man3direxp'
23619man3ext='$man3ext'
5f80c64f 23620mips_type='$mips_type'
5129fff4 23621mistrustnm='$mistrustnm'
5f80c64f 23622mkdir='$mkdir'
b4eb6b3d
JH
23623mmaptype='$mmaptype'
23624modetype='$modetype'
5f80c64f 23625more='$more'
b4eb6b3d 23626multiarch='$multiarch'
5f80c64f 23627mv='$mv'
b4eb6b3d
JH
23628myarchname='$myarchname'
23629mydomain='$mydomain'
23630myhostname='$myhostname'
5f80c64f
JH
23631myuname='$myuname'
23632n='$n'
2cc61e15 23633need_va_copy='$need_va_copy'
b4eb6b3d
JH
23634netdb_hlen_type='$netdb_hlen_type'
23635netdb_host_type='$netdb_host_type'
23636netdb_name_type='$netdb_name_type'
23637netdb_net_type='$netdb_net_type'
5f80c64f
JH
23638nm='$nm'
23639nm_opt='$nm_opt'
23640nm_so_opt='$nm_so_opt'
b4eb6b3d 23641nonxs_ext='$nonxs_ext'
5f80c64f 23642nroff='$nroff'
b4eb6b3d
JH
23643nvEUformat='$nvEUformat'
23644nvFUformat='$nvFUformat'
23645nvGUformat='$nvGUformat'
b68c599a 23646nv_overflows_integers_at='$nv_overflows_integers_at'
53133ed1 23647nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
23648nveformat='$nveformat'
23649nvfformat='$nvfformat'
23650nvgformat='$nvgformat'
23651nvsize='$nvsize'
23652nvtype='$nvtype'
23653o_nonblock='$o_nonblock'
5f80c64f 23654obj_ext='$obj_ext'
b4eb6b3d 23655old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 23656optimize='$optimize'
b4eb6b3d 23657orderlib='$orderlib'
5f80c64f
JH
23658osname='$osname'
23659osvers='$osvers'
b4eb6b3d 23660otherlibdirs='$otherlibdirs'
5f80c64f 23661package='$package'
b4eb6b3d
JH
23662pager='$pager'
23663passcat='$passcat'
23664patchlevel='$patchlevel'
5f80c64f 23665path_sep='$path_sep'
b4eb6b3d 23666perl5='$perl5'
5f80c64f 23667perl='$perl'
151e6568 23668perl_patchlevel='$perl_patchlevel'
17a6c8e3 23669perl_static_inline='$perl_static_inline'
b4eb6b3d 23670perladmin='$perladmin'
9c839522 23671perllibs='$perllibs'
91f55cc7 23672perlpath='$perlpath'
5f80c64f 23673pg='$pg'
b4eb6b3d
JH
23674phostname='$phostname'
23675pidtype='$pidtype'
5f80c64f
JH
23676plibpth='$plibpth'
23677pmake='$pmake'
23678pr='$pr'
b4eb6b3d
JH
23679prefix='$prefix'
23680prefixexp='$prefixexp'
23681privlib='$privlib'
23682privlibexp='$privlibexp'
f24dbf84 23683procselfexe='$procselfexe'
b4eb6b3d
JH
23684prototype='$prototype'
23685ptrsize='$ptrsize'
23686quadkind='$quadkind'
23687quadtype='$quadtype'
23688randbits='$randbits'
23689randfunc='$randfunc'
10bc17b6 23690random_r_proto='$random_r_proto'
b4eb6b3d
JH
23691randseedtype='$randseedtype'
23692ranlib='$ranlib'
23693rd_nodata='$rd_nodata'
10bc17b6
JH
23694readdir64_r_proto='$readdir64_r_proto'
23695readdir_r_proto='$readdir_r_proto'
b4eb6b3d 23696revision='$revision'
5f80c64f 23697rm='$rm'
5b813a60 23698rm_try='$rm_try'
5f80c64f 23699rmail='$rmail'
5440bc8e 23700run='$run'
5f80c64f 23701runnm='$runnm'
81c4fd9e
MB
23702sGMTIME_max='$sGMTIME_max'
23703sGMTIME_min='$sGMTIME_min'
73e6e416
MB
23704sLOCALTIME_max='$sLOCALTIME_max'
23705sLOCALTIME_min='$sLOCALTIME_min'
b4eb6b3d
JH
23706sPRIEUldbl='$sPRIEUldbl'
23707sPRIFUldbl='$sPRIFUldbl'
23708sPRIGUldbl='$sPRIGUldbl'
23709sPRIXU64='$sPRIXU64'
23710sPRId64='$sPRId64'
23711sPRIeldbl='$sPRIeldbl'
23712sPRIfldbl='$sPRIfldbl'
23713sPRIgldbl='$sPRIgldbl'
23714sPRIi64='$sPRIi64'
23715sPRIo64='$sPRIo64'
23716sPRIu64='$sPRIu64'
23717sPRIx64='$sPRIx64'
23718sSCNfldbl='$sSCNfldbl'
23719sched_yield='$sched_yield'
23720scriptdir='$scriptdir'
23721scriptdirexp='$scriptdirexp'
5f80c64f 23722sed='$sed'
b4eb6b3d
JH
23723seedfunc='$seedfunc'
23724selectminbits='$selectminbits'
23725selecttype='$selecttype'
5f80c64f 23726sendmail='$sendmail'
10bc17b6
JH
23727setgrent_r_proto='$setgrent_r_proto'
23728sethostent_r_proto='$sethostent_r_proto'
23729setlocale_r_proto='$setlocale_r_proto'
23730setnetent_r_proto='$setnetent_r_proto'
23731setprotoent_r_proto='$setprotoent_r_proto'
23732setpwent_r_proto='$setpwent_r_proto'
23733setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
23734sh='$sh'
23735shar='$shar'
23736sharpbang='$sharpbang'
b4eb6b3d
JH
23737shmattype='$shmattype'
23738shortsize='$shortsize'
23739shrpenv='$shrpenv'
5f80c64f 23740shsharp='$shsharp'
b4eb6b3d
JH
23741sig_count='$sig_count'
23742sig_name='$sig_name'
23743sig_name_init='$sig_name_init'
23744sig_num='$sig_num'
23745sig_num_init='$sig_num_init'
76d3c696 23746sig_size='$sig_size'
b4eb6b3d
JH
23747signal_t='$signal_t'
23748sitearch='$sitearch'
23749sitearchexp='$sitearchexp'
23750sitebin='$sitebin'
23751sitebinexp='$sitebinexp'
8d2cbf27
JH
23752sitehtml1dir='$sitehtml1dir'
23753sitehtml1direxp='$sitehtml1direxp'
23754sitehtml3dir='$sitehtml3dir'
23755sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
23756sitelib='$sitelib'
23757sitelib_stem='$sitelib_stem'
23758sitelibexp='$sitelibexp'
91e123a8
JH
23759siteman1dir='$siteman1dir'
23760siteman1direxp='$siteman1direxp'
23761siteman3dir='$siteman3dir'
23762siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
23763siteprefix='$siteprefix'
23764siteprefixexp='$siteprefixexp'
6e1038e0
MB
23765sitescript='$sitescript'
23766sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
23767sizesize='$sizesize'
23768sizetype='$sizetype'
5f80c64f
JH
23769sleep='$sleep'
23770smail='$smail'
5f80c64f 23771so='$so'
b4eb6b3d
JH
23772sockethdr='$sockethdr'
23773socketlib='$socketlib'
23774socksizetype='$socksizetype'
5f80c64f
JH
23775sort='$sort'
23776spackage='$spackage'
23777spitshell='$spitshell'
10bc17b6
JH
23778srand48_r_proto='$srand48_r_proto'
23779srandom_r_proto='$srandom_r_proto'
5f80c64f 23780src='$src'
b4eb6b3d 23781ssizetype='$ssizetype'
668fdbe1
MB
23782st_ino_sign='$st_ino_sign'
23783st_ino_size='$st_ino_size'
b4eb6b3d 23784startperl='$startperl'
5f80c64f 23785startsh='$startsh'
b4eb6b3d
JH
23786static_ext='$static_ext'
23787stdchar='$stdchar'
23788stdio_base='$stdio_base'
23789stdio_bufsiz='$stdio_bufsiz'
23790stdio_cnt='$stdio_cnt'
23791stdio_filbuf='$stdio_filbuf'
23792stdio_ptr='$stdio_ptr'
23793stdio_stream_array='$stdio_stream_array'
10bc17b6 23794strerror_r_proto='$strerror_r_proto'
b4eb6b3d 23795strings='$strings'
5f80c64f 23796submit='$submit'
b4eb6b3d
JH
23797subversion='$subversion'
23798sysman='$sysman'
5f80c64f
JH
23799tail='$tail'
23800tar='$tar'
5440bc8e 23801targetarch='$targetarch'
5f80c64f
JH
23802tbl='$tbl'
23803tee='$tee'
23804test='$test'
b4eb6b3d
JH
23805timeincl='$timeincl'
23806timetype='$timetype'
10bc17b6 23807tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 23808to='$to'
5f80c64f
JH
23809touch='$touch'
23810tr='$tr'
23811trnl='$trnl'
23812troff='$troff'
10bc17b6 23813ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
23814u16size='$u16size'
23815u16type='$u16type'
23816u32size='$u32size'
23817u32type='$u32type'
23818u64size='$u64size'
23819u64type='$u64type'
23820u8size='$u8size'
23821u8type='$u8type'
23822uidformat='$uidformat'
23823uidsign='$uidsign'
23824uidsize='$uidsize'
23825uidtype='$uidtype'
5f80c64f
JH
23826uname='$uname'
23827uniq='$uniq'
b4eb6b3d
JH
23828uquadtype='$uquadtype'
23829use5005threads='$use5005threads'
23830use64bitall='$use64bitall'
23831use64bitint='$use64bitint'
5440bc8e 23832usecrosscompile='$usecrosscompile'
1be1b388 23833usedevel='$usedevel'
5f80c64f 23834usedl='$usedl'
5ac1e9b2 23835usedtrace='$usedtrace'
15b61c98 23836usefaststdio='$usefaststdio'
b4eb6b3d 23837useithreads='$useithreads'
2982a345 23838usekernprocpathname='$usekernprocpathname'
b4eb6b3d
JH
23839uselargefiles='$uselargefiles'
23840uselongdouble='$uselongdouble'
19a100ff 23841usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
23842usemorebits='$usemorebits'
23843usemultiplicity='$usemultiplicity'
23844usemymalloc='$usemymalloc'
5f80c64f 23845usenm='$usenm'
ae60cb46 23846usensgetexecutablepath='$usensgetexecutablepath'
b4eb6b3d
JH
23847useopcode='$useopcode'
23848useperlio='$useperlio'
23849useposix='$useposix'
9514c62b 23850usereentrant='$usereentrant'
d51aaa9d 23851userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
23852usesfio='$usesfio'
23853useshrplib='$useshrplib'
5f106f9c 23854usesitecustomize='$usesitecustomize'
29209bc5 23855usesocks='$usesocks'
b4eb6b3d
JH
23856usethreads='$usethreads'
23857usevendorprefix='$usevendorprefix'
23858usevfork='$usevfork'
5f80c64f
JH
23859usrinc='$usrinc'
23860uuname='$uuname'
b4eb6b3d
JH
23861uvXUformat='$uvXUformat'
23862uvoformat='$uvoformat'
23863uvsize='$uvsize'
23864uvtype='$uvtype'
23865uvuformat='$uvuformat'
23866uvxformat='$uvxformat'
d03b3b00 23867vaproto='$vaproto'
b4eb6b3d
JH
23868vendorarch='$vendorarch'
23869vendorarchexp='$vendorarchexp'
23870vendorbin='$vendorbin'
23871vendorbinexp='$vendorbinexp'
8d2cbf27
JH
23872vendorhtml1dir='$vendorhtml1dir'
23873vendorhtml1direxp='$vendorhtml1direxp'
23874vendorhtml3dir='$vendorhtml3dir'
23875vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
23876vendorlib='$vendorlib'
23877vendorlib_stem='$vendorlib_stem'
23878vendorlibexp='$vendorlibexp'
91e123a8
JH
23879vendorman1dir='$vendorman1dir'
23880vendorman1direxp='$vendorman1direxp'
23881vendorman3dir='$vendorman3dir'
23882vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
23883vendorprefix='$vendorprefix'
23884vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
23885vendorscript='$vendorscript'
23886vendorscriptexp='$vendorscriptexp'
b4eb6b3d 23887version='$version'
861eb78d 23888version_patchlevel_string='$version_patchlevel_string'
d56c5707 23889versiononly='$versiononly'
5f80c64f 23890vi='$vi'
b4eb6b3d 23891voidflags='$voidflags'
5f80c64f 23892xlibpth='$xlibpth'
3659ebf1
JH
23893yacc='$yacc'
23894yaccflags='$yaccflags'
5f80c64f
JH
23895zcat='$zcat'
23896zip='$zip'
23897EOT
23898
5f80c64f
JH
23899: add special variables
23900$test -f $src/patchlevel.h && \
d9421656 23901awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
0f04e85f 23902echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
a02608de 23903echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
23904
23905: propagate old symbols
23906if $test -f UU/config.sh; then
381aa1ff 23907 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
776a38e3
MB
23908 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23909 config.sh config.sh UU/oldconfig.sh |\
23910 $sort | $uniq -u >UU/oldsyms
dd35fa16 23911 set X `$cat UU/oldsyms`
5f80c64f
JH
23912 shift
23913 case $# in
23914 0) ;;
23915 *)
dd35fa16 23916 $cat <<EOM
5f80c64f
JH
23917Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23918EOM
776a38e3 23919 echo ": Variables propagated from previous config.sh file." >>config.sh
dd35fa16 23920 for sym in `$cat UU/oldsyms`; do
5f80c64f
JH
23921 echo " Propagating $hint variable "'$'"$sym..."
23922 eval 'tmp="$'"${sym}"'"'
23923 echo "$tmp" | \
23924 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23925 done
23926 ;;
23927 esac
23928fi
23929
23930: Finish up by extracting the .SH files
23931case "$alldone" in
23932exit)
23933 $rm -rf UU
24ccb310 23934 echo "Extraction done."
5f80c64f
JH
23935 exit 0
23936 ;;
23937cont)
23938 ;;
23939'')
23940 dflt=''
23941 nostick=true
23942 $cat <<EOM
23943
23944If you'd like to make any changes to the config.sh file before I begin
23945to configure things, do it as a shell escape now (e.g. !vi config.sh).
23946
23947EOM
23948 rp="Press return or use a shell escape to edit config.sh:"
23949 . UU/myread
23950 nostick=''
23951 case "$ans" in
23952 '') ;;
23953 *) : in case they cannot read
23954 sh 1>&4 -c "$ans";;
23955 esac
23956 ;;
23957esac
23958
23959: if this fails, just run all the .SH files by hand
23960. ./config.sh
23961
23962echo " "
23963exec 1>&4
a43e8593 23964pwd=`pwd`
5f80c64f 23965. ./UU/extract
6904989c 23966cd "$pwd"
5f80c64f
JH
23967
23968if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23969 dflt=y
23970 case "$silent" in
23971 true) ;;
23972 *)
23973 $cat <<EOM
23974
23975Now you need to generate make dependencies by running "$make depend".
23976You might prefer to run it in background: "$make depend > makedepend.out &"
23977It can take a while, so you might not want to run it right now.
23978
23979EOM
23980 ;;
23981 esac
23982 rp="Run $make depend now?"
23983 . UU/myread
23984 case "$ans" in
23985 y*)
3d5d58b1 23986 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
23987 ;;
23988 *)
23989 echo "You must run '$make depend' then '$make'."
23990 ;;
23991 esac
23992elif test -f [Mm]akefile; then
23993 echo " "
23994 echo "Now you must run a $make."
23995else
24ccb310 23996 echo "Configure done."
5f80c64f
JH
23997fi
23998
23999if $test -f Policy.sh; then
24000 $cat <<EOM
24001
24002If you compile $package on a different machine or from a different object
24003directory, copy the Policy.sh file from this object directory to the
24004new one before you run Configure -- this will help you with most of
24005the policy defaults.
24006
24007EOM
24008fi
24009if $test -f config.msg; then
24010 echo "Hmm. I also noted the following information while running:"
24011 echo " "
24012 $cat config.msg >&4
24013 $rm -f config.msg
24014fi
24015$rm -f kit*isdone ark*isdone
24016$rm -rf UU
24017
24018: End of Configure
24019