This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.c: Use the new compact case mapping tables
[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
d9298c1a 31# Generated on Fri Jan 27 15:48:54 CET 2012 [metaconfig 3.5 PL0]
7f2de2d2 32# (with additional metaconfig patches by perlbug@perl.org)
2304df62 33
283fdd21 34cat >c1$$ <<EOF
2304df62
AD
35ARGGGHHHH!!!!!
36
37SCO csh still thinks true is false. Write to SCO today and tell them that next
38year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
41we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43[End of diatribe. We now return you to your regularly scheduled programming...]
44EOF
283fdd21 45cat >c2$$ <<EOF
2304df62
AD
46
47OOPS! You naughty creature! You didn't run Configure with sh!
48I will attempt to remedy the situation by running sh for you...
49EOF
50
283fdd21 51true || cat c1$$ c2$$
2304df62
AD
52true || exec sh $0 $argv:q
53
283fdd21 54(exit $?0) || cat c2$$
2304df62 55(exit $?0) || exec sh $0 $argv:q
283fdd21 56rm -f c1$$ c2$$
2304df62 57
f6538904 58if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
d03b3b00 59 cat <<EOF
cbee2ce6
JH
60***
61*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
63*** Please read the README.plan9 for further instructions.
64*** Cannot continue, aborting.
65***
66EOF
67 exit 1
68fi
69
f8e2af1d 70if test ! -c /dev/null ; then
d03b3b00 71 cat <<EOF
f8e2af1d
MC
72***
73*** I'm sorry, but /dev/null appears to be a file rather than a device.
74*** Please consult your operating sytem's notes for making a device
75*** in /dev.
76*** Cannot continue, aborting.
77***
78EOF
79 exit 1
80fi
81
a0d0e21e
LW
82: compute my invocation name
83me=$0
84case "$0" in
85*/*)
86 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87 test "$me" || me=$0
88 ;;
89esac
90
dfe9444c 91: Proper separator for the PATH environment variable
8e07c86e 92p_=:
613d6c3e 93: On OS/2 this directory should exist if this is not floppy only system ":-]"
5c728af0 94if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
613d6c3e 95 if test -n "$OS2_SHELL"; then
dfe9444c
AD
96 p_=\;
97 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 99 is_os2=yes
c4f23d77 100 elif test -n "$DJGPP"; then
495e2cbe
MB
101 case "X${MACHTYPE:-nonesuchmach}" in
102 *cygwin) ;;
103 *) p_=\; ;;
104 esac
dfe9444c 105 fi
39e571d4 106fi
a0d0e21e
LW
107
108: Proper PATH setting
109paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 110paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 111paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 112paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 113paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 114paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
115paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 117paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
118
119for p in $paths
120do
8e07c86e
AD
121 case "$p_$PATH$p_" in
122 *$p_$p$p_*) ;;
123 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
124 esac
125done
126
8e07c86e 127PATH=.$p_$PATH
2304df62
AD
128export PATH
129
dfe9444c
AD
130: shall we be using ksh?
131inksh=''
132needksh=''
133avoidksh=''
134newsh=/bin/ksh
135changesh=''
ff0cee69 136if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
137 inksh=true
138fi
139if test -f /hp-ux -a -f /bin/ksh; then
140 needksh='to avoid sh bug in "here document" expansion'
141fi
142if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143 if test X`/usr/bin/uname -v` = X4; then
144 avoidksh="to avoid AIX 4's /bin/sh"
145 newsh=/usr/bin/bsh
2304df62 146 fi
dfe9444c 147fi
cf04f91f
JH
148if test -f /osf_boot -a -f /usr/sbin/setld; then
149 if test X`/usr/bin/uname -s` = XOSF1; then
613d6c3e
MB
150 avoidksh="to avoid Digital UNIX' ksh"
151 newsh=/bin/sh
152 unset BIN_SH
cf04f91f
JH
153 fi
154fi
dfe9444c
AD
155case "$inksh/$needksh" in
156/[a-z]*)
c4f23d77 157 ENV=''
dfe9444c
AD
158 changesh=true
159 reason="$needksh"
160 ;;
161esac
162case "$inksh/$avoidksh" in
163true/[a-z]*)
164 changesh=true
165 reason="$avoidksh"
166 ;;
167esac
168case "$inksh/$needksh-$avoidksh-" in
169true/--)
a0d0e21e
LW
170 cat <<EOM
171(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 172mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 173EOM
dfe9444c
AD
174 ;;
175esac
176case "$changesh" in
177true)
2e2a97a6 178 export newsh
dfe9444c
AD
179 echo "(Feeding myself to $newsh $reason.)"
180 case "$0" in
181 Configure|*/Configure) exec $newsh $0 "$@";;
182 *) exec $newsh Configure "$@";;
183 esac
184 ;;
185esac
7730b9f4 186test -x "${newsh}" || unset newsh
2304df62 187
613d6c3e 188: if needed, set CDPATH to a harmless value that is not chatty
bfb7748a
AD
189: avoid bash 2.02 problems with empty CDPATH.
190case "$CDPATH" in
191'') ;;
192*) case "$SHELL" in
613d6c3e
MB
193 *bash*) CDPATH='.' ;;
194 *) CDPATH='' ;;
bfb7748a
AD
195 esac
196 ;;
197esac
613d6c3e 198
2304df62
AD
199: Configure runs within the UU subdirectory
200test -d UU || mkdir UU
8e07c86e 201cd UU && rm -f ./*
2304df62 202
6b356c8e
JH
203ccname=''
204ccversion=''
b4eb6b3d
JH
205ccsymbols=''
206cppccsymbols=''
207cppsymbols=''
5440bc8e
JH
208from=''
209run=''
210targetarch=''
211to=''
212usecrosscompile=''
61c26d18 213extern_C=''
6b34ded5 214mistrustnm=''
1be1b388 215usedevel=''
9c839522 216perllibs=''
b4eb6b3d
JH
217dynamic_ext=''
218extensions=''
219known_extensions=''
220nonxs_ext=''
221static_ext=''
222useopcode=''
223useposix=''
6fcddf3b 224extras=''
ecfc5424 225d_bsd=''
40a7a20a 226d_eunice=''
2304df62
AD
227d_xenix=''
228eunicefix=''
dfe9444c 229ar=''
2304df62
AD
230awk=''
231bash=''
232bison=''
233byacc=''
234cat=''
235chgrp=''
236chmod=''
237chown=''
ecfc5424 238comm=''
2304df62
AD
239compress=''
240cp=''
241cpio=''
242cpp=''
243csh=''
244date=''
245echo=''
246egrep=''
247emacs=''
248expr=''
249find=''
250flex=''
3c728e00 251gmake=''
2304df62 252grep=''
8ff267be 253gzip=''
2304df62
AD
254inews=''
255ksh=''
256less=''
257line=''
258lint=''
259ln=''
260lp=''
261lpr=''
262ls=''
263mail=''
264mailx=''
dfe9444c 265make=''
2304df62
AD
266mkdir=''
267more=''
268mv=''
693762b4 269nm=''
2304df62
AD
270nroff=''
271perl=''
272pg=''
273pmake=''
274pr=''
275rm=''
276rmail=''
277sed=''
278sendmail=''
2304df62
AD
279shar=''
280sleep=''
281smail=''
282sort=''
283submit=''
284tail=''
285tar=''
286tbl=''
693762b4 287tee=''
2304df62
AD
288test=''
289touch=''
290tr=''
291troff=''
292uname=''
293uniq=''
294uuname=''
295vi=''
296zcat=''
8ff267be 297zip=''
b4eb6b3d
JH
298full_ar=''
299full_sed=''
a0d0e21e 300libswanted=''
2304df62
AD
301hint=''
302myuname=''
85e6fe83
LW
303osname=''
304osvers=''
2304df62
AD
305Author=''
306Date=''
307Header=''
308Id=''
309Locker=''
310Log=''
311RCSfile=''
312Revision=''
313Source=''
314State=''
dfe9444c
AD
315_a=''
316_exe=''
317_o=''
4633a7c4
LW
318archobjs=''
319exe_ext=''
320firstmakefile=''
321lib_ext=''
322obj_ext=''
323path_sep=''
5b813a60 324rm_try=''
b4eb6b3d 325afs=''
a6d26a0d 326afsroot=''
b4eb6b3d
JH
327alignbytes=''
328ansi2knr=''
329archlib=''
330archlibexp=''
331d_archlib=''
332installarchlib=''
333archname=''
334myarchname=''
335d_atolf=''
336d_atoll=''
337baserev=''
338bin=''
339binexp=''
f3f1a2d8 340initialinstalllocation=''
b4eb6b3d 341installbin=''
f3f1a2d8 342userelocatableinc=''
b4eb6b3d 343byteorder=''
2304df62 344cc=''
2304df62
AD
345ccflags=''
346cppflags=''
347ldflags=''
348lkflags=''
8e07c86e 349locincpth=''
2304df62 350optimize=''
b4eb6b3d 351cf_email=''
2304df62
AD
352cf_by=''
353cf_time=''
c193ef60
MB
354charbits=''
355charsize=''
2304df62 356contains=''
b4eb6b3d 357cpp_stuff=''
2304df62
AD
358cpplast=''
359cppminus=''
360cpprun=''
361cppstdin=''
74cac757 362d__fwalk=''
b4eb6b3d
JH
363d_access=''
364d_accessx=''
55954f19 365d_aintl=''
b4eb6b3d 366d_alarm=''
10bc17b6
JH
367asctime_r_proto=''
368d_asctime_r=''
fcdf39cf 369d_attribute_deprecated=''
0dbb1585
AL
370d_attribute_format=''
371d_attribute_malloc=''
372d_attribute_nonnull=''
373d_attribute_noreturn=''
374d_attribute_pure=''
375d_attribute_unused=''
376d_attribute_warn_unused_result=''
dcb594bc 377d_printf_format_null=''
b4eb6b3d
JH
378d_bcmp=''
379d_bcopy=''
635aebb7
AL
380d_builtin_choose_expr=''
381d_builtin_expect=''
b4eb6b3d 382d_bzero=''
a2d23ec2 383d_c99_variadic_macros=''
b4eb6b3d
JH
384d_casti32=''
385castflags=''
386d_castneg=''
387d_chown=''
388d_chroot=''
389d_chsize=''
758a5d79 390d_class=''
b0a2e8e6 391d_clearenv=''
b4eb6b3d
JH
392d_closedir=''
393d_void_closedir=''
4e0554ec 394d_cmsghdr_s=''
b4eb6b3d 395d_const=''
36adc09b 396d_copysignl=''
666ea192 397d_cplusplus=''
b4eb6b3d
JH
398cryptlib=''
399d_crypt=''
10bc17b6
JH
400crypt_r_proto=''
401d_crypt_r=''
b4eb6b3d
JH
402d_csh=''
403full_csh=''
13cfc98d 404d_ctermid=''
10bc17b6
JH
405ctermid_r_proto=''
406d_ctermid_r=''
407ctime_r_proto=''
408d_ctime_r=''
b4eb6b3d
JH
409d_cuserid=''
410d_dbl_dig=''
2ef53570 411d_dbminitproto=''
b4eb6b3d 412d_difftime=''
de52168c 413d_dir_dd_fd=''
ae0e3d3b 414d_dirfd=''
b4eb6b3d 415d_dlerror=''
a0d0e21e 416d_dlopen=''
b4eb6b3d
JH
417d_dlsymun=''
418d_dosuid=''
419d_suidsafe=''
10bc17b6
JH
420d_drand48_r=''
421drand48_r_proto=''
b4eb6b3d
JH
422d_drand48proto=''
423d_dup2=''
424d_eaccess=''
425d_endgrent=''
10bc17b6
JH
426d_endgrent_r=''
427endgrent_r_proto=''
b4eb6b3d 428d_endhent=''
10bc17b6
JH
429d_endhostent_r=''
430endhostent_r_proto=''
b4eb6b3d 431d_endnent=''
10bc17b6
JH
432d_endnetent_r=''
433endnetent_r_proto=''
b4eb6b3d 434d_endpent=''
10bc17b6
JH
435d_endprotoent_r=''
436endprotoent_r_proto=''
b4eb6b3d 437d_endpwent=''
10bc17b6
JH
438d_endpwent_r=''
439endpwent_r_proto=''
b4eb6b3d 440d_endsent=''
10bc17b6
JH
441d_endservent_r=''
442endservent_r_proto=''
15b61c98 443d_faststdio=''
b363b713 444d_fchdir=''
b4eb6b3d
JH
445d_fchmod=''
446d_fchown=''
447d_fcntl=''
9d9004a9 448d_fcntl_can_lock=''
b4eb6b3d
JH
449d_fd_macros=''
450d_fd_set=''
451d_fds_bits=''
452d_fgetpos=''
758a5d79
JH
453d_finite=''
454d_finitel=''
b4eb6b3d
JH
455d_flexfnam=''
456d_flock=''
2ef53570 457d_flockproto=''
b4eb6b3d 458d_fork=''
758a5d79
JH
459d_fp_class=''
460d_fpclass=''
461d_fpclassify=''
462d_fpclassl=''
b4eb6b3d
JH
463d_fpos64_t=''
464d_frexpl=''
465d_fs_data_s=''
466d_fseeko=''
467d_fsetpos=''
468d_fstatfs=''
411ab01c 469d_fsync=''
b4eb6b3d
JH
470d_ftello=''
471d_ftime=''
472d_gettimeod=''
dc814df1 473d_futimes=''
b4eb6b3d 474d_Gconvert=''
5086dff9 475d_getaddrinfo=''
b4eb6b3d
JH
476d_getcwd=''
477d_getespwnam=''
478d_getfsstat=''
479d_getgrent=''
10bc17b6
JH
480d_getgrent_r=''
481getgrent_r_proto=''
482d_getgrgid_r=''
483getgrgid_r_proto=''
484d_getgrnam_r=''
485getgrnam_r_proto=''
b4eb6b3d
JH
486d_getgrps=''
487d_gethbyaddr=''
488d_gethbyname=''
489d_gethent=''
490aphostname=''
491d_gethname=''
492d_phostname=''
493d_uname=''
10bc17b6
JH
494d_gethostbyaddr_r=''
495gethostbyaddr_r_proto=''
496d_gethostbyname_r=''
497gethostbyname_r_proto=''
498d_gethostent_r=''
499gethostent_r_proto=''
b4eb6b3d 500d_gethostprotos=''
4e0554ec 501d_getitimer=''
b4eb6b3d 502d_getlogin=''
10bc17b6
JH
503d_getlogin_r=''
504getlogin_r_proto=''
b4eb6b3d
JH
505d_getmnt=''
506d_getmntent=''
5086dff9 507d_getnameinfo=''
b4eb6b3d
JH
508d_getnbyaddr=''
509d_getnbyname=''
510d_getnent=''
10bc17b6
JH
511d_getnetbyaddr_r=''
512getnetbyaddr_r_proto=''
513d_getnetbyname_r=''
514getnetbyname_r_proto=''
515d_getnetent_r=''
516getnetent_r_proto=''
b4eb6b3d 517d_getnetprotos=''
0c0643d0 518d_getpagsz=''
b4eb6b3d
JH
519d_getpent=''
520d_getpgid=''
521d_getpgrp2=''
522d_bsdgetpgrp=''
523d_getpgrp=''
524d_getppid=''
525d_getprior=''
526d_getpbyname=''
527d_getpbynumber=''
10bc17b6
JH
528d_getprotobyname_r=''
529getprotobyname_r_proto=''
530d_getprotobynumber_r=''
531getprotobynumber_r_proto=''
532d_getprotoent_r=''
533getprotoent_r_proto=''
b4eb6b3d
JH
534d_getprotoprotos=''
535d_getprpwnam=''
536d_getpwent=''
10bc17b6
JH
537d_getpwent_r=''
538getpwent_r_proto=''
539d_getpwnam_r=''
540getpwnam_r_proto=''
541d_getpwuid_r=''
542getpwuid_r_proto=''
b4eb6b3d 543d_getsent=''
10bc17b6
JH
544d_getservbyname_r=''
545getservbyname_r_proto=''
546d_getservbyport_r=''
547getservbyport_r_proto=''
548d_getservent_r=''
549getservent_r_proto=''
b4eb6b3d
JH
550d_getservprotos=''
551d_getspnam=''
10bc17b6
JH
552d_getspnam_r=''
553getspnam_r_proto=''
b4eb6b3d
JH
554d_getsbyname=''
555d_getsbyport=''
10bc17b6
JH
556d_gmtime_r=''
557gmtime_r_proto=''
a4f3eea9 558d_gnulibc=''
5f6e0ee4 559gnulibc_version=''
b4eb6b3d
JH
560d_hasmntopt=''
561d_htonl=''
55954f19 562d_ilogbl=''
b4eb6b3d 563d_inetaton=''
5086dff9
MB
564d_inetntop=''
565d_inetpton=''
b4eb6b3d
JH
566d_int64_t=''
567d_isascii=''
269a7913 568d_isblank=''
758a5d79
JH
569d_isfinite=''
570d_isinf=''
b4eb6b3d
JH
571d_isnan=''
572d_isnanl=''
573d_killpg=''
574d_lchown=''
575d_ldbl_dig=''
0a0abfba 576d_libm_lib_version=''
b4eb6b3d 577d_link=''
10bc17b6 578d_localtime_r=''
8572b25d 579d_localtime_r_needs_tzset=''
10bc17b6 580localtime_r_proto=''
b4eb6b3d
JH
581d_locconv=''
582d_lockf=''
583d_longdbl=''
584longdblsize=''
585d_longlong=''
586longlongsize=''
587d_lseekproto=''
588d_lstat=''
589d_madvise=''
7dd121ae
MB
590d_malloc_good_size=''
591d_malloc_size=''
b4eb6b3d
JH
592d_mblen=''
593d_mbstowcs=''
594d_mbtowc=''
595d_memchr=''
596d_memcmp=''
597d_memcpy=''
598d_memmove=''
599d_memset=''
600d_mkdir=''
601d_mkdtemp=''
602d_mkfifo=''
603d_mkstemp=''
604d_mkstemps=''
605d_mktime=''
606d_mmap=''
607mmaptype=''
608d_modfl=''
e67aeab1 609d_modfl_pow32_bug=''
bc9a1b2c 610d_modflproto=''
b4eb6b3d
JH
611d_mprotect=''
612d_msg=''
613d_msgctl=''
614d_msgget=''
4e0554ec 615d_msghdr_s=''
b4eb6b3d
JH
616d_msgrcv=''
617d_msgsnd=''
618d_msync=''
619d_munmap=''
620d_nice=''
2765b840 621d_nl_langinfo=''
b4eb6b3d
JH
622d_off64_t=''
623d_open3=''
624d_fpathconf=''
625d_pathconf=''
626d_pause=''
627d_pipe=''
628d_poll=''
2304df62 629d_portable=''
c796e3db
MB
630d_prctl=''
631d_prctl_set_name=''
a33c94aa 632d_procselfexe=''
f24dbf84 633procselfexe=''
b4eb6b3d
JH
634d_old_pthread_create_joinable=''
635old_pthread_create_joinable=''
d6483fcc 636d_pthread_atfork=''
58d975c3 637d_pthread_attr_setscope=''
b4eb6b3d
JH
638d_pthread_yield=''
639d_sched_yield=''
640sched_yield=''
641d_qgcvt=''
10bc17b6
JH
642d_random_r=''
643random_r_proto=''
644d_readdir64_r=''
645readdir64_r_proto=''
b4eb6b3d
JH
646d_readdir=''
647d_rewinddir=''
648d_seekdir=''
649d_telldir=''
10bc17b6
JH
650d_readdir_r=''
651readdir_r_proto=''
b4eb6b3d 652d_readlink=''
4e0554ec
JH
653d_readv=''
654d_recvmsg=''
b4eb6b3d
JH
655d_rename=''
656d_rmdir=''
657d_safebcpy=''
658d_safemcpy=''
659d_sanemcmp=''
ef9f17be 660d_sbrkproto=''
55954f19 661d_scalbnl=''
b4eb6b3d
JH
662d_select=''
663d_sem=''
664d_semctl=''
665d_semget=''
666d_semop=''
4e0554ec 667d_sendmsg=''
b4eb6b3d
JH
668d_setegid=''
669d_seteuid=''
670d_setgrent=''
10bc17b6
JH
671d_setgrent_r=''
672setgrent_r_proto=''
b4eb6b3d
JH
673d_setgrps=''
674d_sethent=''
10bc17b6
JH
675d_sethostent_r=''
676sethostent_r_proto=''
4e0554ec 677d_setitimer=''
b4eb6b3d
JH
678d_setlinebuf=''
679d_setlocale=''
10bc17b6
JH
680d_setlocale_r=''
681setlocale_r_proto=''
b4eb6b3d 682d_setnent=''
10bc17b6
JH
683d_setnetent_r=''
684setnetent_r_proto=''
b4eb6b3d
JH
685d_setpent=''
686d_setpgid=''
687d_setpgrp2=''
688d_bsdsetpgrp=''
689d_setpgrp=''
690d_setprior=''
691d_setproctitle=''
10bc17b6
JH
692d_setprotoent_r=''
693setprotoent_r_proto=''
b4eb6b3d 694d_setpwent=''
10bc17b6
JH
695d_setpwent_r=''
696setpwent_r_proto=''
b4eb6b3d
JH
697d_setregid=''
698d_setresgid=''
699d_setresuid=''
700d_setreuid=''
701d_setrgid=''
702d_setruid=''
703d_setsent=''
10bc17b6
JH
704d_setservent_r=''
705setservent_r_proto=''
b4eb6b3d
JH
706d_setsid=''
707d_setvbuf=''
708d_sfio=''
709usesfio=''
710d_shm=''
711d_shmat=''
712d_shmatprototype=''
713shmattype=''
714d_shmctl=''
715d_shmdt=''
716d_shmget=''
717d_sigaction=''
ed140128 718d_signbit=''
983dbef6 719d_sigprocmask=''
b4eb6b3d 720d_sigsetjmp=''
5f106f9c 721usesitecustomize=''
4f5da3e9
SP
722d_snprintf=''
723d_vsnprintf=''
49a78c82 724d_sockatmark=''
2ef53570 725d_sockatmarkproto=''
b4eb6b3d
JH
726d_msg_ctrunc=''
727d_msg_dontroute=''
728d_msg_oob=''
729d_msg_peek=''
730d_msg_proxy=''
731d_oldsock=''
732d_scm_rights=''
f53580fe 733d_sin6_scope_id=''
b8677e3b 734d_sockaddr_sa_len=''
b4eb6b3d
JH
735d_socket=''
736d_sockpair=''
737sockethdr=''
738socketlib=''
739d_socklen_t=''
740d_socks5_init=''
360321b3 741d_sprintf_returns_strlen=''
b4eb6b3d 742d_sqrtl=''
10bc17b6
JH
743d_srand48_r=''
744srand48_r_proto=''
745d_srandom_r=''
746srandom_r_proto=''
eef837ea 747d_sresgproto=''
640374d0 748d_sresuproto=''
b4eb6b3d
JH
749d_statblks=''
750d_statfs_f_flags=''
751d_statfs_s=''
17a6c8e3
AD
752d_static_inline=''
753perl_static_inline=''
b4eb6b3d
JH
754d_fstatvfs=''
755d_statvfs=''
756d_stdio_cnt_lval=''
757d_stdio_ptr_lval=''
a7ffa9b9
NC
758d_stdio_ptr_lval_nochange_cnt=''
759d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
760d_stdiobase=''
761d_stdstdio=''
762stdio_base=''
763stdio_bufsiz=''
764stdio_cnt=''
765stdio_filbuf=''
766stdio_ptr=''
767d_index=''
768d_strchr=''
769d_strcoll=''
770d_strctcpy=''
771d_strerrm=''
772d_strerror=''
773d_sysernlst=''
774d_syserrlst=''
10bc17b6
JH
775d_strerror_r=''
776strerror_r_proto=''
b3c85772 777d_strftime=''
08c92000
MB
778d_strlcat=''
779d_strlcpy=''
b4eb6b3d
JH
780d_strtod=''
781d_strtol=''
782d_strtold=''
783d_strtoll=''
28e5dec8 784d_strtoq=''
b4eb6b3d
JH
785d_strtoul=''
786d_strtoull=''
787d_strtouq=''
788d_strxfrm=''
789d_symlink=''
790d_syscall=''
2ef53570 791d_syscallproto=''
b4eb6b3d
JH
792d_sysconf=''
793d_system=''
794d_tcgetpgrp=''
795d_tcsetpgrp=''
796d_telldirproto=''
797d_time=''
798timetype=''
96938616
MB
799d_asctime64=''
800d_ctime64=''
801d_difftime64=''
802d_gmtime64=''
803d_localtime64=''
804d_mktime64=''
cbb9e8a7 805d_timegm=''
b4eb6b3d
JH
806clocktype=''
807d_times=''
10bc17b6
JH
808d_tmpnam_r=''
809tmpnam_r_proto=''
b4eb6b3d 810d_truncate=''
10bc17b6
JH
811d_ttyname_r=''
812ttyname_r_proto=''
b4eb6b3d 813d_tzname=''
4e0554ec
JH
814d_u32align=''
815d_ualarm=''
b4eb6b3d
JH
816d_umask=''
817d_semctl_semid_ds=''
818d_semctl_semun=''
819d_union_semun=''
758a5d79 820d_unordered=''
bdf33aa7 821d_unsetenv=''
4e0554ec 822d_usleep=''
2ef53570 823d_usleepproto=''
b4eb6b3d 824d_ustat=''
233e16ce 825d_pseudofork=''
b4eb6b3d
JH
826d_vfork=''
827usevfork=''
828d_voidsig=''
829signal_t=''
830d_volatile=''
831d_charvspr=''
832d_vprintf=''
833d_wait4=''
834d_waitpid=''
835d_wcstombs=''
836d_wctomb=''
4e0554ec 837d_writev=''
b4eb6b3d 838dlext=''
f1ce3bf1 839bin_ELF=''
85e6fe83
LW
840cccdlflags=''
841ccdlflags=''
2304df62 842dlsrc=''
232e078e 843ld=''
85e6fe83 844lddlflags=''
2304df62 845usedl=''
b4eb6b3d
JH
846doublesize=''
847ebcdic=''
848fflushNULL=''
849fflushall=''
850fpossize=''
851fpostype=''
2d736872 852gccansipedantic=''
5b463ca7 853gccosandvers=''
8a27cf78 854gccversion=''
b4eb6b3d
JH
855gidformat=''
856gidsign=''
857gidsize=''
858gidtype=''
859groupstype=''
860h_fcntl=''
861h_sysfile=''
6e1038e0
MB
862html1dir=''
863html1direxp=''
864installhtml1dir=''
865html3dir=''
866html3direxp=''
867installhtml3dir=''
b4eb6b3d 868i_arpainet=''
c0bacbef 869i_assert=''
10bc17b6 870i_crypt=''
b4eb6b3d
JH
871db_hashtype=''
872db_prefixtype=''
640374d0
JH
873db_version_major=''
874db_version_minor=''
875db_version_patch=''
b4eb6b3d
JH
876i_db=''
877i_dbm=''
878i_rpcsvcdbm=''
879d_dirnamlen=''
880direntrytype=''
881i_dirent=''
a0d0e21e 882i_dld=''
b4eb6b3d
JH
883i_dlfcn=''
884i_fcntl=''
885i_float=''
758a5d79
JH
886i_fp=''
887i_fp_class=''
b4eb6b3d
JH
888i_gdbm=''
889d_grpasswd=''
890i_grp=''
b4eb6b3d
JH
891i_ieeefp=''
892i_inttypes=''
2765b840 893i_langinfo=''
b4eb6b3d
JH
894i_libutil=''
895i_limits=''
896i_locale=''
897i_machcthr=''
898i_malloc=''
1cd66f7c 899i_mallocmalloc=''
b4eb6b3d
JH
900i_math=''
901i_memory=''
902i_mntent=''
e74475c7
MHM
903d_gdbm_ndbm_h_uses_prototypes=''
904d_gdbmndbm_h_uses_prototypes=''
a33f2d9f 905d_ndbm=''
e74475c7 906d_ndbm_h_uses_prototypes=''
a33f2d9f
AD
907i_gdbm_ndbm=''
908i_gdbmndbm=''
b4eb6b3d
JH
909i_ndbm=''
910i_netdb=''
911i_neterrno=''
912i_netinettcp=''
913i_niin=''
914i_sysin=''
915i_poll=''
916i_prot=''
917i_pthread=''
918d_pwage=''
919d_pwchange=''
920d_pwclass=''
921d_pwcomment=''
922d_pwexpire=''
923d_pwgecos=''
924d_pwpasswd=''
925d_pwquota=''
926i_pwd=''
927i_sfio=''
928i_shadow=''
929i_socks=''
bd31be4b 930i_stdbool=''
b4eb6b3d
JH
931i_stddef=''
932i_stdlib=''
933i_string=''
934strings=''
935i_sunmath=''
936i_sysaccess=''
937i_sysdir=''
938i_sysfile=''
939d_voidtty=''
940i_bsdioctl=''
941i_sysfilio=''
942i_sysioctl=''
943i_syssockio=''
944i_syslog=''
945i_sysmman=''
946i_sysmode=''
947i_sysmount=''
948i_sysndir=''
949i_sysparam=''
216dac04 950i_syspoll=''
b4eb6b3d
JH
951i_sysresrc=''
952i_syssecrt=''
953i_sysselct=''
954i_sysstat=''
955i_sysstatfs=''
956i_sysstatvfs=''
957i_systimes=''
958i_systypes=''
959i_sysuio=''
960i_sysun=''
961i_sysutsname=''
962i_sysvfs=''
963i_syswait=''
964i_sgtty=''
965i_termio=''
966i_termios=''
14b90194
JH
967d_tm_tm_gmtoff=''
968d_tm_tm_zone=''
b4eb6b3d
JH
969i_systime=''
970i_systimek=''
971i_time=''
972timeincl=''
973i_unistd=''
974i_ustat=''
975i_utime=''
976i_values=''
977i_stdarg=''
978i_varargs=''
979i_varhdr=''
980i_vfork=''
f3f1a2d8 981d_inc_version_list=''
b4eb6b3d
JH
982inc_version_list=''
983inc_version_list_init=''
984installprefix=''
985installprefixexp=''
986installstyle=''
987installusrbinperl=''
988intsize=''
989longsize=''
990shortsize=''
4b661809 991issymlink=''
2304df62 992libc=''
b4eb6b3d
JH
993ldlibpthname=''
994libperl=''
995shrpenv=''
996useshrplib=''
a0d0e21e 997glibpth=''
2304df62 998libpth=''
8e07c86e 999loclibpth=''
2304df62
AD
1000plibpth=''
1001xlibpth=''
1cfa4ec7 1002ignore_versioned_solibs=''
2304df62 1003libs=''
43999f95
JH
1004libsdirs=''
1005libsfiles=''
1006libsfound=''
13b3f787 1007libspath=''
85e6fe83 1008lns=''
b4eb6b3d
JH
1009d_PRIEUldbl=''
1010d_PRIFUldbl=''
1011d_PRIGUldbl=''
1012d_PRIeldbl=''
1013d_PRIfldbl=''
1014d_PRIgldbl=''
1015d_SCNfldbl=''
1016sPRIEUldbl=''
1017sPRIFUldbl=''
1018sPRIGUldbl=''
1019sPRIeldbl=''
1020sPRIfldbl=''
1021sPRIgldbl=''
1022sSCNfldbl=''
1023lseeksize=''
1024lseektype=''
d620c7b3 1025mad=''
00e74f14
NC
1026madlyh=''
1027madlyobj=''
1028madlysrc=''
f3f1a2d8
MB
1029make_set_make=''
1030d_mymalloc=''
1031freetype=''
b4eb6b3d
JH
1032mallocobj=''
1033mallocsrc=''
1034malloctype=''
9df442c2 1035usemallocwrap=''
b4eb6b3d
JH
1036usemymalloc=''
1037installman1dir=''
1038man1dir=''
1039man1direxp=''
1040man1ext=''
1041installman3dir=''
1042man3dir=''
1043man3direxp=''
1044man3ext=''
1045modetype=''
1046multiarch=''
1047mydomain=''
1048myhostname=''
1049phostname=''
2304df62
AD
1050c=''
1051n=''
b4eb6b3d
JH
1052d_eofnblk=''
1053eagain=''
1054o_nonblock=''
1055rd_nodata=''
2cc61e15 1056need_va_copy=''
b4eb6b3d
JH
1057netdb_hlen_type=''
1058netdb_host_type=''
1059netdb_name_type=''
1060netdb_net_type=''
1061groupcat=''
1062hostcat=''
1063passcat=''
1064orderlib=''
1065ranlib=''
1066d_perl_otherlibdirs=''
1067otherlibdirs=''
2304df62
AD
1068package=''
1069spackage=''
b4eb6b3d
JH
1070pager=''
1071api_revision=''
1072api_subversion=''
1073api_version=''
1074api_versionstring=''
1075patchlevel=''
151e6568 1076perl_patchlevel=''
b4eb6b3d
JH
1077revision=''
1078subversion=''
1079version=''
861eb78d 1080version_patchlevel_string=''
b4eb6b3d
JH
1081perl5=''
1082perladmin=''
91f55cc7 1083perlpath=''
b4eb6b3d 1084d_nv_preserves_uv=''
f607920a 1085d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1086i16size=''
1087i16type=''
1088i32size=''
1089i32type=''
1090i64size=''
1091i64type=''
1092i8size=''
1093i8type=''
1094ivsize=''
1095ivtype=''
b68c599a 1096nv_overflows_integers_at=''
4137585d 1097nv_preserves_uv_bits=''
b4eb6b3d
JH
1098nvsize=''
1099nvtype=''
1100u16size=''
1101u16type=''
1102u32size=''
1103u32type=''
1104u64size=''
1105u64type=''
1106u8size=''
1107u8type=''
1108uvsize=''
1109uvtype=''
1110ivdformat=''
1111nvEUformat=''
1112nvFUformat=''
1113nvGUformat=''
1114nveformat=''
1115nvfformat=''
1116nvgformat=''
1117uvXUformat=''
1118uvoformat=''
1119uvuformat=''
1120uvxformat=''
1121pidtype=''
1122prefix=''
1123prefixexp=''
1124installprivlib=''
1125privlib=''
1126privlibexp=''
1127prototype=''
1128ptrsize=''
1129d_PRIXU64=''
1130d_PRId64=''
1131d_PRIi64=''
1132d_PRIo64=''
1133d_PRIu64=''
1134d_PRIx64=''
1135sPRIXU64=''
1136sPRId64=''
1137sPRIi64=''
1138sPRIo64=''
1139sPRIu64=''
1140sPRIx64=''
1141d_quad=''
1142quadkind=''
1143quadtype=''
1144uquadtype=''
1145drand01=''
1146randbits=''
1147randfunc=''
1148randseedtype=''
1149seedfunc=''
1150installscript=''
1151scriptdir=''
1152scriptdirexp=''
1153selectminbits=''
1154selecttype=''
8ff267be 1155sh=''
b4eb6b3d
JH
1156sig_count=''
1157sig_name=''
1158sig_name_init=''
1159sig_num=''
1160sig_num_init=''
76d3c696 1161sig_size=''
f3f1a2d8 1162d_sitearch=''
b4eb6b3d
JH
1163installsitearch=''
1164sitearch=''
1165sitearchexp=''
1166installsitebin=''
1167sitebin=''
1168sitebinexp=''
8d2cbf27
JH
1169installsitehtml1dir=''
1170sitehtml1dir=''
1171sitehtml1direxp=''
1172installsitehtml3dir=''
1173sitehtml3dir=''
1174sitehtml3direxp=''
b4eb6b3d
JH
1175installsitelib=''
1176sitelib=''
1177sitelib_stem=''
1178sitelibexp=''
91e123a8
JH
1179installsiteman1dir=''
1180siteman1dir=''
1181siteman1direxp=''
1182installsiteman3dir=''
1183siteman3dir=''
1184siteman3direxp=''
b4eb6b3d
JH
1185siteprefix=''
1186siteprefixexp=''
6e1038e0
MB
1187installsitescript=''
1188sitescript=''
1189sitescriptexp=''
b4eb6b3d
JH
1190sizesize=''
1191sizetype=''
a0d0e21e 1192so=''
b4eb6b3d 1193socksizetype=''
2304df62
AD
1194sharpbang=''
1195shsharp=''
1196spitshell=''
dfe9444c 1197src=''
b4eb6b3d 1198ssizetype=''
668fdbe1
MB
1199st_ino_sign=''
1200st_ino_size=''
b4eb6b3d 1201startperl=''
2304df62 1202startsh=''
b4eb6b3d
JH
1203stdchar=''
1204d_stdio_stream_array=''
1205stdio_stream_array=''
1206sysman=''
81c4fd9e
MB
1207sGMTIME_max=''
1208sGMTIME_min=''
73e6e416
MB
1209sLOCALTIME_max=''
1210sLOCALTIME_min=''
5ff3f7a4 1211trnl=''
b4eb6b3d
JH
1212uidformat=''
1213uidsign=''
1214uidsize=''
1215uidtype=''
1216archname64=''
1217use64bitall=''
1218use64bitint=''
34f1896b
MB
1219dtrace=''
1220usedtrace=''
15b61c98 1221usefaststdio=''
d78f9ffa 1222usekernprocpathname=''
b4eb6b3d
JH
1223ccflags_uselargefiles=''
1224ldflags_uselargefiles=''
1225libswanted_uselargefiles=''
1226uselargefiles=''
1227uselongdouble=''
1228usemorebits=''
1229usemultiplicity=''
2304df62 1230nm_opt=''
40a7a20a 1231nm_so_opt=''
2304df62
AD
1232runnm=''
1233usenm=''
ae60cb46 1234usensgetexecutablepath=''
b4eb6b3d 1235useperlio=''
29209bc5 1236usesocks=''
b4eb6b3d
JH
1237d_oldpthreads=''
1238use5005threads=''
1239useithreads=''
9514c62b 1240usereentrant=''
b4eb6b3d 1241usethreads=''
2304df62 1242incpath=''
2304df62
AD
1243mips_type=''
1244usrinc=''
d03b3b00 1245vaproto=''
b4eb6b3d
JH
1246d_vendorarch=''
1247installvendorarch=''
1248vendorarch=''
1249vendorarchexp=''
1250d_vendorbin=''
1251installvendorbin=''
1252vendorbin=''
1253vendorbinexp=''
8d2cbf27
JH
1254installvendorhtml1dir=''
1255vendorhtml1dir=''
1256vendorhtml1direxp=''
1257installvendorhtml3dir=''
1258vendorhtml3dir=''
1259vendorhtml3direxp=''
b4eb6b3d
JH
1260d_vendorlib=''
1261installvendorlib=''
1262vendorlib=''
1263vendorlib_stem=''
1264vendorlibexp=''
91e123a8
JH
1265installvendorman1dir=''
1266vendorman1dir=''
1267vendorman1direxp=''
1268installvendorman3dir=''
1269vendorman3dir=''
1270vendorman3direxp=''
b4eb6b3d
JH
1271usevendorprefix=''
1272vendorprefix=''
1273vendorprefixexp=''
6e1038e0
MB
1274d_vendorscript=''
1275installvendorscript=''
1276vendorscript=''
1277vendorscriptexp=''
d56c5707 1278versiononly=''
b4eb6b3d
JH
1279defvoidused=''
1280voidflags=''
3659ebf1
JH
1281yacc=''
1282yaccflags=''
2304df62
AD
1283CONFIG=''
1284
34f1896b 1285: Detect odd OSs
ecfc5424
AD
1286define='define'
1287undef='undef'
1288smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1289rmlist=''
1290
1291: We must find out about Eunice early
1292eunicefix=':'
1293if test -f /etc/unixtovms; then
1294 eunicefix=/etc/unixtovms
1295fi
1296if test -f /etc/unixtovms.exe; then
1297 eunicefix=/etc/unixtovms.exe
1298fi
1299
cfb04860 1300: Set executable suffix now -- needed before hints available
6153ba32
PG
1301if test -f "/libs/version.library"; then
1302: Amiga OS
1303 _exe=""
1304elif test -f "/system/gnu_library/bin/ar.pm"; then
1305: Stratus VOS
cfb04860 1306 _exe=".pm"
6153ba32
PG
1307elif test -n "$DJGPP"; then
1308: DOS DJGPP
cfb04860 1309 _exe=".exe"
5c728af0 1310elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1311: OS/2 or cygwin
ba863942
JH
1312 _exe=".exe"
1313fi
868439a2 1314
1d8eaf8c 1315groupstype=''
b4eb6b3d 1316i_whoami=''
06501368
MB
1317: Trailing extension. Override this in a hint file, if needed.
1318: Extra object files, if any, needed on this platform.
1319archobjs=''
b8677e3b
MB
1320archname=''
1321: Possible local include directories to search.
1322: Set locincpth to "" in a hint file to defeat local include searches.
1323locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1324locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1325:
1326: no include file wanted by default
1327inclwanted=''
1328
1329: Enable -DEBUGGING and -DDEBUGGING from the command line
1330EBUGGING=''
356123f1 1331DEBUGGING=''
b8677e3b 1332
64615a5e 1333libnames=''
732c9516
JH
1334: change the next line if compiling for Xenix/286 on Xenix/386
1335xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1336: Possible local library directories to search.
1337loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1338loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1339
1340: general looking path for locating libraries
5869b1f1 1341glibpth="/lib /usr/lib $xlibpth"
732c9516 1342glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1343test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1344test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1345test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1346
1347: Private path used by Configure to find libraries. Its value
1348: is prepended to libpth. This variable takes care of special
1349: machines, like the mips. Usually, it should be empty.
1350plibpth=''
1351
1cfa4ec7
GS
1352: default library list
1353libswanted=''
921b2963 1354: some systems want to use only the non-versioned libso:s
1cfa4ec7 1355ignore_versioned_solibs=''
06501368
MB
1356: set usethreads on the Configure command line to enable threads.
1357usereentrant='undef'
ed140128
AD
1358: full support for void wanted by default
1359defvoidused=15
1360
ed140128
AD
1361ccname=''
1362ccversion=''
1363perllibs=''
1364: set useposix=false in your hint file to disable the POSIX extension.
1365useposix=true
1366: set useopcode=false in your hint file to disable the Opcode extension.
1367useopcode=true
b4eb6b3d
JH
1368archname64=''
1369ccflags_uselargefiles=''
1370ldflags_uselargefiles=''
1371libswanted_uselargefiles=''
1372: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1373: set usesocks on the Configure command line to enable socks.
ecfc5424 1374: List of libraries we want.
15431986 1375: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef 1376libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8119684f 1377libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1378: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1379: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1380glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1381glibpth="/usr/shlib $glibpth"
1382: Do not use vfork unless overridden by a hint file.
1383usevfork=false
1384
8ff267be 1385: Find the basic shell for Bourne shell scripts
1386case "$sh" in
1387'')
8ff267be 1388 case "$SYSTYPE" in
1389 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1390 *) xxx='/bin/sh';;
1391 esac
1392 if test -f "$xxx"; then
1393 sh="$xxx"
1394 else
1395 : Build up a list and do a single loop so we can 'break' out.
1396 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1397 for xxx in sh bash ksh pdksh ash; do
1398 for p in $pth; do
1399 try="$try ${p}/${xxx}"
1400 done
1401 done
1402 for xxx in $try; do
1403 if test -f "$xxx"; then
1404 sh="$xxx";
8ff267be 1405 break
a5a94ea5
JH
1406 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1407 sh="$xxx";
1408 break
8ff267be 1409 elif test -f "$xxx.exe"; then
1410 sh="$xxx";
8ff267be 1411 break
1412 fi
1413 done
1414 fi
1415 ;;
1416esac
1417
1418case "$sh" in
a33c94aa 1419'') cat >&2 <<EOM
8ff267be 1420$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1421
8ff267be 1422Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1423Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1424we'll try to straighten this all out.
8ff267be 1425EOM
1426 exit 1
1427 ;;
1428esac
1429
760ac839 1430: see if sh knows # comments
73614538 1431if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1432 shsharp=true
1433 spitshell=cat
760ac839 1434 xcat=/bin/cat
a931254c
JH
1435 test -f $xcat$_exe || xcat=/usr/bin/cat
1436 if test ! -f $xcat$_exe; then
4bdb8fb5 1437 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1438 if test -f $p/cat$_exe; then
1deb0a86 1439 xcat=$p/cat
3c728e00
JH
1440 break
1441 fi
1442 done
1deb0a86
JH
1443 if test ! -f $xcat$_exe; then
1444 echo "Can't find cat anywhere!"
3c728e00
JH
1445 exit 1
1446 fi
1447 fi
5440bc8e
JH
1448 echo "#!$xcat" >sharp
1449 $eunicefix sharp
1450 chmod +x sharp
1d8eaf8c 1451 ./sharp > today 2>/dev/null
760ac839 1452 if test -s today; then
760ac839
LW
1453 sharpbang='#!'
1454 else
5440bc8e
JH
1455 echo "#! $xcat" > sharp
1456 $eunicefix sharp
1457 chmod +x sharp
1d8eaf8c 1458 ./sharp > today 2>/dev/null
760ac839 1459 if test -s today; then
760ac839
LW
1460 sharpbang='#! '
1461 else
760ac839
LW
1462 sharpbang=': use '
1463 fi
1464 fi
1465else
dfe9444c 1466 echo " "
8ff267be 1467 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1468 shsharp=false
1469 cd ..
1470 echo "exec grep -v '^[ ]*#'" >spitshell
1471 chmod +x spitshell
1472 $eunicefix spitshell
1473 spitshell=`pwd`/spitshell
1474 cd UU
1475 echo "I presume that if # doesn't work, #! won't work either!"
1476 sharpbang=': use '
1477fi
5440bc8e 1478rm -f sharp today
760ac839
LW
1479
1480: figure out how to guarantee sh startup
8ff267be 1481case "$startsh" in
1482'') startsh=${sharpbang}${sh} ;;
1483*)
760ac839 1484esac
5440bc8e 1485cat >sharp <<EOSS
760ac839
LW
1486$startsh
1487set abc
1488test "$?abc" != 1
1489EOSS
1490
5440bc8e
JH
1491chmod +x sharp
1492$eunicefix sharp
1493if ./sharp; then
8ff267be 1494 : echo "Yup, it does."
760ac839 1495else
dfe9444c
AD
1496 echo "Hmm... '$startsh' does not guarantee sh startup..."
1497 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1498fi
5440bc8e 1499rm -f sharp
760ac839 1500
aebf16e7
AD
1501: Save command line options in file UU/cmdline.opt for later use in
1502: generating config.sh.
1503cat > cmdline.opt <<EOSH
613d6c3e 1504: Configure command line arguments.
aebf16e7
AD
1505config_arg0='$0'
1506config_args='$*'
1507config_argc=$#
1508EOSH
1509argn=1
ee45ea83
IZ
1510args_exp=''
1511args_sep=''
aebf16e7
AD
1512for arg in "$@"; do
1513 cat >>cmdline.opt <<EOSH
1514config_arg$argn='$arg'
1515EOSH
ee45ea83
IZ
1516 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1517$arg
1518EOC
1519 arg_exp=`cat cmdl.opt`
1520 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1521 argn=`expr $argn + 1`
ee45ea83 1522 args_sep=' '
aebf16e7 1523done
ee45ea83 1524rm -f cmdl.opt
aebf16e7 1525
2304df62
AD
1526: produce awk script to parse command line options
1527cat >options.awk <<'EOF'
1528BEGIN {
02e93a22 1529 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1530
1531 len = length(optstr);
1532 for (i = 1; i <= len; i++) {
1533 c = substr(optstr, i, 1);
1534 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1535 if (a == ":") {
1536 arg[c] = 1;
1537 i++;
1538 }
1539 opt[c] = 1;
1540 }
1541}
1542{
1543 expect = 0;
1544 str = $0;
1545 if (substr(str, 1, 1) != "-") {
1546 printf("'%s'\n", str);
1547 next;
1548 }
1549 len = length($0);
1550 for (i = 2; i <= len; i++) {
1551 c = substr(str, i, 1);
1552 if (!opt[c]) {
1553 printf("-%s\n", substr(str, i));
1554 next;
1555 }
1556 printf("-%s\n", c);
1557 if (arg[c]) {
1558 if (i < len)
1559 printf("'%s'\n", substr(str, i + 1));
1560 else
1561 expect = 1;
1562 next;
1563 }
1564 }
1565}
1566END {
1567 if (expect)
1568 print "?";
1569}
1570EOF
1571
1572: process the command line options
4633a7c4
LW
1573set X `for arg in "$@"; do echo "X$arg"; done |
1574 sed -e s/X// | awk -f options.awk`
2304df62
AD
1575eval "set $*"
1576shift
1577rm -f options.awk
1578
1579: set up default values
1580fastread=''
1581reuseval=false
1582config_sh=''
1583alldone=''
1584error=''
1585silent=''
1586extractsh=''
ecfc5424 1587override=''
16d20bd9 1588knowitall=''
02e93a22 1589rm -f optdef.sh posthint.sh
28757baa 1590cat >optdef.sh <<EOS
1591$startsh
1592EOS
2304df62 1593
dfe9444c 1594
2304df62
AD
1595: option parsing
1596while test $# -gt 0; do
1597 case "$1" in
1598 -d) shift; fastread=yes;;
1599 -e) shift; alldone=cont;;
1600 -f)
1601 shift
1602 cd ..
1603 if test -r "$1"; then
1604 config_sh="$1"
1605 else
a0d0e21e 1606 echo "$me: cannot read config file $1." >&2
2304df62
AD
1607 error=true
1608 fi
1609 cd UU
1610 shift;;
3f30fabf 1611 --help|\
2304df62
AD
1612 -h) shift; error=true;;
1613 -r) shift; reuseval=true;;
dfe9444c 1614 -s) shift; silent=true; realsilent=true;;
2304df62 1615 -E) shift; alldone=exit;;
16d20bd9 1616 -K) shift; knowitall=true;;
ecfc5424 1617 -O) shift; override=true;;
dfe9444c 1618 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1619 -D)
1620 shift
1621 case "$1" in
1622 *=)
1623 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1624 echo "$me: ignoring -D $1" >&2
1625 ;;
ecfc5424 1626 *=*) echo "$1" | \
1aef975c
AD
1627 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1628 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1629 esac
1630 shift
1631 ;;
1632 -U)
1633 shift
1634 case "$1" in
1aef975c 1635 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1636 *=*)
1637 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1638 echo "$me: ignoring -U $1" >&2
1639 ;;
1aef975c 1640 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1641 esac
1642 shift
1643 ;;
02e93a22
JH
1644 -A)
1645 shift
1646 xxx=''
1647 yyy="$1"
02e93a22 1648 zzz=''
5f83a3e9 1649 uuu=undef
02e93a22 1650 case "$yyy" in
f7c31117 1651 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1652 case "$zzz" in
1653 *:*) zzz='' ;;
1654 *) xxx=append
613d6c3e 1655 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
f7c31117 1656 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1657 esac
1658 ;;
1659 esac
1660 case "$xxx" in
1661 '') case "$yyy" in
f7c31117
JH
1662 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1663 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1664 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1665 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1666 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1667 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9 1668 esac
613d6c3e 1669 ;;
5f83a3e9 1670 esac
02e93a22
JH
1671 case "$xxx" in
1672 append)
5f83a3e9 1673 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1674 clear)
5f83a3e9 1675 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1676 define)
1677 case "$zzz" in
1678 '') zzz=define ;;
1679 esac
5f83a3e9 1680 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1681 eval)
5f83a3e9 1682 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1683 prepend)
5f83a3e9 1684 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1685 undef)
1686 case "$zzz" in
1687 '') zzz="$uuu" ;;
1688 esac
5f83a3e9
JH
1689 echo "$yyy=$zzz" >> posthint.sh ;;
1690 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1691 esac
bde6b06b 1692 shift
02e93a22 1693 ;;
216dac04 1694 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
5f83a3e9 1695 exit 0;;
2304df62 1696 --) break;;
a0d0e21e 1697 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1698 *) break;;
1699 esac
1700done
1701
1702case "$error" in
1703true)
1704 cat >&2 <<EOM
2afac517 1705Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1706 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1707 -d : use defaults for all answers.
1708 -e : go on without questioning past the production of config.sh.
1709 -f : specify an alternate default configuration file.
1710 -h : print this help message and exit (with an error status).
1711 -r : reuse C symbols value if possible (skips costly nm extraction).
1712 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1713 -D : define symbol to have some value:
1714 -D symbol symbol gets the value 'define'
1715 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1716 common used examples (see INSTALL for more info):
1717 -Duse64bitint use 64bit integers
b79e0b55 1718 -Duse64bitall use 64bit integers and pointers
3f30fabf 1719 -Dusethreads use thread support
b79e0b55 1720 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1721 -DEBUGGING=none DEBUGGING options
1722 -Dcc=gcc choose your compiler
1723 -Dprefix=/opt/perl5 choose your destination
2304df62 1724 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1725 -K : do not use unless you know what you are doing.
ecfc5424 1726 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1727 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1728 -U : undefine symbol:
1729 -U symbol symbol gets the value 'undef'
1730 -U symbol= symbol gets completely empty
3f30fabf 1731 e.g.: -Uversiononly
02e93a22 1732 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1733 -A append:symbol=value append value to symbol
1734 -A symbol=value like append:, but with a separating space
1735 -A define:symbol=value define symbol to have value
1736 -A clear:symbol define symbol to be ''
1737 -A define:symbol define symbol to be 'define'
1738 -A eval:symbol=value define symbol to be eval of value
1739 -A prepend:symbol=value prepend value to symbol
1740 -A undef:symbol define symbol to be 'undef'
1741 -A undef:symbol= define symbol to be ''
3f30fabf 1742 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1743 -A ccflags=-DSOME_MACRO
2304df62
AD
1744 -V : print version number and exit (with a zero status).
1745EOM
1746 exit 1
1747 ;;
1748esac
1749
dfe9444c
AD
1750: Sanity checks
1751case "$fastread$alldone" in
1752yescont|yesexit) ;;
1753*)
aaeb8e51
GS
1754 case "$extractsh" in
1755 true) ;;
1756 *)
1757 if test ! -t 0; then
1758 echo "Say 'sh Configure', not 'sh <Configure'"
1759 exit 1
1760 fi
1761 ;;
1762 esac
dfe9444c
AD
1763 ;;
1764esac
1765
2304df62
AD
1766exec 4>&1
1767case "$silent" in
1768true) exec 1>/dev/null;;
1769esac
1770
ecfc5424 1771: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1772touch optdef.sh
1773. ./optdef.sh
02e93a22
JH
1774: create the posthint manipulation script and leave the file out there...
1775touch posthint.sh
a0d0e21e 1776
2304df62 1777: set package name
34f1896b 1778package='perl5'
b4eb6b3d
JH
1779first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1780last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1781case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1782ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1783*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1784esac
2304df62 1785
2304df62
AD
1786: Some greps do not return status, grrr.
1787echo "grimblepritz" >grimble
1788if grep blurfldyick grimble >/dev/null 2>&1 ; then
1789 contains=contains
1790elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1791 contains=grep
1792else
1793 contains=contains
1794fi
1795rm -f grimble
1796: the following should work in any shell
1797case "$contains" in
1798contains*)
1799 echo " "
1800 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1801 cat >contains <<'EOSS'
1802grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1803EOSS
1804chmod +x contains
1805esac
1806
dfe9444c
AD
1807: Find the path to the source tree
1808case "$src" in
1809'') case "$0" in
b233458b
JH
1810 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1811 case "$src" in
1812 /*) ;;
8504afb7 1813 .) ;;
b233458b
JH
1814 *) src=`cd ../$src && pwd` ;;
1815 esac
1816 ;;
dfe9444c
AD
1817 *) src='.';;
1818 esac;;
1819esac
1820case "$src" in
1821'') src=/
1822 rsrc=/
1823 ;;
34f1896b
MB
1824/*) rsrc="$src";;
1825*) rsrc="../$src";;
dfe9444c
AD
1826esac
1827if test -f $rsrc/Configure && \
34f1896b 1828 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
dfe9444c
AD
1829then
1830 : found it, so we are ok.
1831else
1832 rsrc=''
1833 for src in . .. ../.. ../../.. ../../../..; do
1834 if test -f ../$src/Configure && \
1835 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1836 then
1837 rsrc=../$src
1838 break
1839 fi
1840 done
1841fi
1842case "$rsrc" in
1843'')
1844 cat <<EOM >&4
1845
1846Sorry, I can't seem to locate the source dir for $package. Please start
1847Configure with an explicit path -- i.e. /some/path/Configure.
1848
1849EOM
1850 exit 1
1851 ;;
1852../.) rsrc='..';;
1853*)
1854 echo " "
1855 echo "Sources for $package found in \"$src\"." >&4
1856 ;;
1857esac
1858
1859: script used to extract .SH files with variable substitutions
1860cat >extract <<'EOS'
a02608de 1861PERL_CONFIG_SH=true
dfe9444c 1862echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1863if test -f MANIFEST; then
1864 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1865else
1866 echo "(Looking for .SH files under the source directory.)"
6904989c 1867 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1868fi
1869shift
1870case $# in
6904989c 18710) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1872esac
6904989c 1873if test ! -f "$src/$1"; then
dfe9444c
AD
1874 shift
1875fi
1876mkdir_p='
1877name=$1;
1878create="";
1879while test $name; do
1880 if test ! -d "$name"; then
1881 create="$name $create";
1882 name=`echo $name | sed -e "s|^[^/]*$||"`;
1883 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1884 else
1885 name="";
1886 fi;
1887done;
1888for file in $create; do
1889 mkdir $file;
1890done
1891'
1892for file in $*; do
1893 case "$src" in
1894 ".")
1895 case "$file" in
1896 */*)
1897 dir=`expr X$file : 'X\(.*\)/'`
1898 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1899 (cd "$dir" && . ./$file)
dfe9444c
AD
1900 ;;
1901 *)
1902 . ./$file
1903 ;;
1904 esac
1905 ;;
1906 *)
1907 case "$file" in
1908 */*)
1909 dir=`expr X$file : 'X\(.*\)/'`
1910 file=`expr X$file : 'X.*/\(.*\)'`
1911 (set x $dir; shift; eval $mkdir_p)
6904989c 1912 sh <"$src/$dir/$file"
dfe9444c
AD
1913 ;;
1914 *)
6904989c 1915 sh <"$src/$file"
dfe9444c
AD
1916 ;;
1917 esac
1918 ;;
1919 esac
1920done
6904989c 1921if test -f "$src/config_h.SH"; then
dfe9444c
AD
1922 if test ! -f config.h; then
1923 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1924 . "$src/config_h.SH"
dfe9444c
AD
1925 fi
1926fi
1927EOS
1928
1929: extract files and exit if asked to do so
1930case "$extractsh" in
1931true)
1932 case "$realsilent" in
1933 true) ;;
1934 *) exec 1>&4;;
1935 esac
1936 case "$config_sh" in
1937 '') config_sh='config.sh';;
1938 esac
1939 echo " "
1940 echo "Fetching answers from $config_sh..."
1941 cd ..
1942 . $config_sh
1943 test "$override" && . ./optdef.sh
1944 echo " "
1945 . UU/extract
1946 rm -rf UU
24ccb310 1947 echo "Extraction done."
dfe9444c
AD
1948 exit 0
1949 ;;
1950esac
1951
1952: Eunice requires " " instead of "", can you believe it
1953echo " "
1954: Here we go...
1955echo "Beginning of configuration questions for $package."
1956
1957trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1958
2304df62
AD
1959: first determine how to suppress newline on echo command
1960echo " "
1961echo "Checking echo to see how to suppress newlines..."
1962(echo "hi there\c" ; echo " ") >.echotmp
1963if $contains c .echotmp >/dev/null 2>&1 ; then
1964 echo "...using -n."
1965 n='-n'
1966 c=''
1967else
1968 cat <<'EOM'
1969...using \c
1970EOM
1971 n=''
1972 c='\c'
1973fi
1974echo $n "The star should be here-->$c"
1975echo '*'
1976rm -f .echotmp
1977
1978: Now test for existence of everything in MANIFEST
1979echo " "
6904989c 1980if test -f "$rsrc/MANIFEST"; then
2304df62 1981 echo "First let's make sure your kit is complete. Checking..." >&4
1d8eaf8c 1982 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
776a38e3 1983 (split -l 50 2>/dev/null || split -50)
2304df62 1984 rm -f missing
dfe9444c 1985 tmppwd=`pwd`
2304df62 1986 for filelist in x??; do
776a38e3
MB
1987 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1988 >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1989 done
1990 if test -s missing; then
1991 cat missing >&4
1992 cat >&4 <<'EOM'
1993
1994THIS PACKAGE SEEMS TO BE INCOMPLETE.
1995
1996You have the option of continuing the configuration process, despite the
1997distinct possibility that your kit is damaged, by typing 'y'es. If you
1998do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1999and contact the author (perlbug@perl.org).
2304df62
AD
2000
2001EOM
2002 echo $n "Continue? [n] $c" >&4
2003 read ans
2004 case "$ans" in
2005 y*)
2006 echo "Continuing..." >&4
2007 rm -f missing
2008 ;;
2009 *)
2010 echo "ABORTING..." >&4
2011 kill $$
2012 ;;
2013 esac
2014 else
dfe9444c 2015 echo "Looks good..."
2304df62
AD
2016 fi
2017else
2018 echo "There is no MANIFEST file. I hope your kit is complete !"
2019fi
2020rm -f missing x??
2021
5ff3f7a4 2022: Find the appropriate value for a newline for tr
613d6c3e 2023echo " "
5ff3f7a4
GS
2024if test -n "$DJGPP"; then
2025 trnl='\012'
2026fi
2027if test X"$trnl" = X; then
2028 case "`echo foo|tr '\n' x 2>/dev/null`" in
2029 foox) trnl='\n' ;;
2030 esac
2031fi
2032if test X"$trnl" = X; then
2033 case "`echo foo|tr '\012' x 2>/dev/null`" in
2034 foox) trnl='\012' ;;
2035 esac
2036fi
2037if test X"$trnl" = X; then
8be2c24c
JH
2038 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2039 fooxy) trnl='\n\r' ;;
2040 esac
2041fi
2042if test X"$trnl" = X; then
5ff3f7a4
GS
2043 cat <<EOM >&2
2044
2045$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2046
2047EOM
2048 exit 1
2049fi
2050
2304df62
AD
2051: compute the number of columns on the terminal for proper question formatting
2052case "$COLUMNS" in
2053'') COLUMNS='80';;
2054esac
2055
2056: set up the echo used in my read
2057myecho="case \"\$xxxm\" in
2058'') echo $n \"\$rp $c\" >&4;;
2059*) case \"\$rp\" in
2060 '') echo $n \"[\$xxxm] $c\";;
2061 *)
2062 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2063 echo \"\$rp\" >&4
2064 echo $n \"[\$xxxm] $c\" >&4
2065 else
2066 echo $n \"\$rp [\$xxxm] $c\" >&4
2067 fi
2068 ;;
2069 esac;;
2070esac"
2071
2072: now set up to do reads with possible shell escape and default assignment
2073cat <<EOSC >myread
28757baa 2074$startsh
2304df62
AD
2075xxxm=\$dflt
2076$myecho
2077ans='!'
2078case "\$fastread" in
2079yes) case "\$dflt" in
2080 '') ;;
2081 *) ans='';
2082 case "\$silent-\$rp" in
2083 true-) ;;
2084 *) echo " " >&4;;
2085 esac;;
2086 esac;;
2087*) case "\$silent" in
2088 true) case "\$rp" in
2089 '') ans='';;
2090 esac;;
2091 esac;;
2092esac
2093while expr "X\$ans" : "X!" >/dev/null; do
2094 read answ
2095 set x \$xxxm
2096 shift
dfe9444c 2097 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2098 case "\$answ" in
dfe9444c
AD
2099 "!")
2100 sh 1>&4
2101 echo " "
2102 $myecho
2103 ;;
2104 !*)
2105 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2106 shift
2107 sh 1>&4 -c "\$*"
2108 echo " "
2109 $myecho
2110 ;;
2304df62
AD
2111 "\$ans")
2112 case "\$ans" in
ecfc5424
AD
2113 \\&*)
2114 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2115 shift
2116 case "\$1" in
2117 -d)
2118 fastread=yes
40a7a20a 2119 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2120 ;;
2121 -*)
40a7a20a 2122 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2123 ;;
2124 esac
2125 $myecho
2126 ans=!
2127 ;;
2304df62
AD
2128 esac;;
2129 *)
2130 case "\$aok" in
2131 y)
2132 echo "*** Substitution done -- please confirm."
2133 xxxm="\$ans"
c9795ab7 2134 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2135 xxxm="\$ans"
2136 ans=!
2137 ;;
2138 *)
2139 echo "*** Error -- try again."
2140 ans=!
2141 ;;
2142 esac
2143 $myecho
2144 ;;
2145 esac
2146 case "\$ans\$xxxm\$nostick" in
2147 '')
2148 ans=!
2149 $myecho
2150 ;;
2151 esac
2152done
2153case "\$ans" in
2154'') ans="\$xxxm";;
2155esac
2156EOSC
2157
2158: create .config dir to save info across Configure sessions
2159test -d ../.config || mkdir ../.config
2160cat >../.config/README <<EOF
2161This directory created by Configure to save information that should
dfe9444c 2162persist across sessions for $package.
2304df62
AD
2163
2164You may safely delete it if you wish.
2165EOF
2166
613d6c3e 2167: See if we are using a devel version and want that
9507cadf 2168xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2169case "$usedevel" in
1be1b388
MB
2170$define|true|[yY]*)
2171 usedevel="$define" ;;
9507cadf 2172*) case "$xversion" in
0107c034
JH
2173 *[13579])
2174 cat >&4 <<EOH
2175*** WHOA THERE!!! ***
2176
2177 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2178 The version of this $package distribution is $xversion, that is, odd,
2179 (as opposed to even) and that signifies a development release.
3d5d58b1 2180 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2181
2182 Do ***NOT*** install this into production use.
2183 Data corruption and crashes are possible.
2184
2185 It is most seriously suggested that you do not continue any further
2186 unless you want to help in developing and debugging Perl.
2187
6adc6a45
JH
2188 If you *still* want to build perl, you can answer 'y' now,
2189 or pass -Dusedevel to Configure.
2190
0107c034
JH
2191EOH
2192 rp='Do you really want to continue?'
2193 dflt='n'
2194 . ./myread
2195 case "$ans" in
8feeef0e
JH
2196 [yY]) echo >&4 "Okay, continuing."
2197 usedevel="$define" ;;
0107c034
JH
2198 *) echo >&4 "Okay, bye."
2199 exit 1
2200 ;;
2201 esac
2202 ;;
2203 esac
1be1b388 2204 usedevel="$undef"
0107c034
JH
2205 ;;
2206esac
8feeef0e
JH
2207case "$usedevel" in
2208$define|true|[yY]*)
2209 case "$versiononly" in
2210 '') versiononly="$define" ;;
2211 esac
2212 case "$installusrbinperl" in
2213 '') installusrbinperl="$undef" ;;
2214 esac
2215 ;;
2216esac
0107c034 2217
2304df62
AD
2218: general instructions
2219needman=true
2220firsttime=true
760ac839 2221user=`(logname) 2>/dev/null`
dfe9444c
AD
2222case "$user" in
2223'') user=`whoami 2>&1`;;
760ac839 2224esac
2304df62
AD
2225if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2226 firsttime=false
2227 echo " "
2228 rp='Would you like to see the instructions?'
2229 dflt=n
2230 . ./myread
2231 case "$ans" in
2232 [yY]*) ;;
2233 *) needman=false;;
2234 esac
2235fi
2236if $needman; then
2237 cat <<EOH
4e2a5f63 2238
2304df62 2239This installation shell script will examine your system and ask you questions
a0d0e21e 2240to determine how the perl5 package should be installed. If you get
2304df62
AD
2241stuck on a question, you may use a ! shell escape to start a subshell or
2242execute a command. Many of the questions will have default answers in square
2243brackets; typing carriage return will give you the default.
2244
2245On some of the questions which ask for file or directory names you are allowed
2246to use the ~name construct to specify the login directory belonging to "name",
2247even if you don't have a shell which knows about that. Questions where this is
2248allowed will be marked "(~name ok)".
2249
2250EOH
2251 rp=''
2252 dflt='Type carriage return to continue'
2253 . ./myread
2254 cat <<'EOH'
2255
2256The prompter used in this script allows you to use shell variables and
2257backticks in your answers. You may use $1, $2, etc... to refer to the words
2258in the default answer, as if the default line was a set of arguments given to a
2259script shell. This means you may also use $* to repeat the whole default line,
2260so you do not have to re-type everything to add something to the default.
2261
cd95ead5 2262Every time there is a substitution, you will have to confirm. If there is an
2304df62
AD
2263error (e.g. an unmatched backtick), the default answer will remain unchanged
2264and you will be prompted again.
2265
2266If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2267the questions and use the computed defaults (or the previous answers if there
2268was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2269You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2270on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2271
2272EOH
2273 . ./myread
2274 cat <<EOH
2275
2276Much effort has been expended to ensure that this shell script will run on any
2277Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2278Configure and run it again. If you can't run Configure for some reason,
2279you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2280have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2281
2282This installation script affects things in two ways:
2283
22841) it may do direct variable substitutions on some of the files included
2285 in this kit.
22862) it builds a config.h file for inclusion in C programs. You may edit
2287 any of these files as the need arises after running this script.
2288
2289If you make a mistake on a question, there is no easy way to back up to it
2290currently. The easiest thing to do is to edit config.sh and rerun all the SH
2291files. Configure will offer to let you do this before it runs the SH files.
2292
2293EOH
2294 dflt='Type carriage return to continue'
2295 . ./myread
2296 case "$firsttime" in
2297 true) echo $user >>../.config/instruct;;
2298 esac
2299fi
2300
2304df62
AD
2301: find out where common programs are
2302echo " "
2303echo "Locating common programs..." >&4
2304cat <<EOSC >loc
2305$startsh
2306case \$# in
23070) exit 1;;
2308esac
2309thing=\$1
2310shift
2311dflt=\$1
2312shift
2313for dir in \$*; do
2314 case "\$thing" in
2315 .)
2316 if test -d \$dir/\$thing; then
2317 echo \$dir
2318 exit 0
2319 fi
2320 ;;
2321 *)
a0d0e21e 2322 for thisthing in \$dir/\$thing; do
ecfc5424 2323 : just loop through to pick last item
a0d0e21e 2324 done
25f94b33 2325 if test -f \$thisthing; then
a0d0e21e 2326 echo \$thisthing
2304df62 2327 exit 0
a5a94ea5
JH
2328 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2329 echo \$thisthing
776a38e3 2330 exit 0
2304df62 2331 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2332 if test -n "$DJGPP"; then
2333 echo \$dir/\$thing.exe
b921d661 2334 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2335 : on Eunice apparently
2336 echo \$dir/\$thing
2337 fi
2d736872 2338 exit 0
2304df62
AD
2339 fi
2340 ;;
2341 esac
2342done
2343echo \$dflt
2344exit 1
2345EOSC
2346chmod +x loc
2347$eunicefix loc
2348loclist="
2349awk
2350cat
f8006fac 2351chmod
b4eb6b3d
JH
2352comm
2353cp
2304df62
AD
2354echo
2355expr
2356grep
a0d0e21e 2357ls
b4eb6b3d 2358mkdir
2304df62
AD
2359rm
2360sed
b4eb6b3d 2361sort
85e6fe83 2362touch
2304df62 2363tr
b4eb6b3d 2364uniq
2304df62
AD
2365"
2366trylist="
dfe9444c 2367ar
3659ebf1 2368bison
b4eb6b3d 2369byacc
2304df62 2370cpp
b4eb6b3d 2371csh
2304df62
AD
2372date
2373egrep
1fef16b3 2374gmake
8ff267be 2375gzip
b4eb6b3d 2376less
8ff267be 2377ln
3c728e00 2378make
b4eb6b3d 2379more
693762b4 2380nm
b4eb6b3d 2381nroff
b8677e3b 2382perl
b4eb6b3d 2383pg
2304df62
AD
2384test
2385uname
8ff267be 2386zip
2304df62 2387"
8e07c86e 2388pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2389pth="$pth /lib /usr/lib"
2390for file in $loclist; do
dfe9444c
AD
2391 eval xxx=\$$file
2392 case "$xxx" in
2393 /*|?:[\\/]*)
2394 if test -f "$xxx"; then
2395 : ok
2396 else
2397 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2398 xxx=`./loc $file $file $pth`
2399 fi
2400 ;;
2401 '') xxx=`./loc $file $file $pth`;;
2402 *) xxx=`./loc $xxx $xxx $pth`;;
2403 esac
a5a94ea5 2404 eval $file=$xxx$_exe
2304df62
AD
2405 eval _$file=$xxx
2406 case "$xxx" in
2407 /*)
2408 echo $file is in $xxx.
2409 ;;
8e07c86e
AD
2410 ?:[\\/]*)
2411 echo $file is in $xxx.
2412 ;;
2304df62 2413 *)
25f94b33
AD
2414 echo "I don't know where '$file' is, and my life depends on it." >&4
2415 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2416 exit 1
2304df62
AD
2417 ;;
2418 esac
2419done
2420echo " "
2421echo "Don't worry if any of the following aren't found..."
2422say=offhand
2423for file in $trylist; do
dfe9444c
AD
2424 eval xxx=\$$file
2425 case "$xxx" in
2426 /*|?:[\\/]*)
2427 if test -f "$xxx"; then
2428 : ok
2429 else
2430 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2431 xxx=`./loc $file $file $pth`
2432 fi
2433 ;;
2434 '') xxx=`./loc $file $file $pth`;;
2435 *) xxx=`./loc $xxx $xxx $pth`;;
2436 esac
306a8474 2437 eval $file=$xxx$_exe
2304df62
AD
2438 eval _$file=$xxx
2439 case "$xxx" in
2440 /*)
2441 echo $file is in $xxx.
2442 ;;
8e07c86e
AD
2443 ?:[\\/]*)
2444 echo $file is in $xxx.
2445 ;;
2304df62
AD
2446 *)
2447 echo "I don't see $file out there, $say."
2448 say=either
2449 ;;
2450 esac
2451done
2452case "$egrep" in
1fef16b3 2453egrep)
2304df62
AD
2454 echo "Substituting grep for egrep."
2455 egrep=$grep
868439a2 2456 _egrep=$grep
2304df62
AD
2457 ;;
2458esac
3141af47
MB
2459case "$less" in
2460'') ;;
2461*) if $less -R </dev/null >/dev/null; then
2462 echo "Substituting less -R for less."
2463 less="$less -R"
2464 _less=$less
2465 fi
2466 ;;
2467esac
8ff267be 2468case "$ln" in
1fef16b3 2469ln)
8ff267be 2470 echo "Substituting cp for ln."
2471 ln=$cp
868439a2 2472 _ln=$cp
8ff267be 2473 ;;
2474esac
2e26f1d5 2475case "$make" in
613d6c3e 2476make)
2e26f1d5
JH
2477 case "$gmake" in
2478 gmake)
2479 echo "I can't find make or gmake, and my life depends on it." >&4
2480 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2481 exit 1
2482 ;;
2483 esac
2484 ;;
613d6c3e 2485esac
2e26f1d5
JH
2486case "$gmake" in
2487gmake) ;;
2488*) # We can't have osname yet.
1fef16b3
JH
2489 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2490 # Assume that gmake, if found, is definitely GNU make
2491 # and prefer it over the system make.
2492 echo "Substituting gmake for make."
2493 make=$gmake
868439a2 2494 _make=$gmake
1fef16b3
JH
2495 fi
2496 ;;
a5a94ea5 2497esac
2304df62
AD
2498case "$test" in
2499test)
2500 echo "Hopefully test is built into your sh."
2501 ;;
2502*)
73614538 2503 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2504 echo "Using the test built into your sh."
2304df62
AD
2505 test=test
2506 _test=test
2507 fi
2508 ;;
2509esac
2510case "$echo" in
2511echo)
2512 echo "Hopefully echo is built into your sh."
2513 ;;
2514'') ;;
2515*)
2516 echo " "
2517echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2518 $echo $n "hi there$c" >foo1
2519 echo $n "hi there$c" >foo2
2520 if cmp foo1 foo2 >/dev/null 2>&1; then
2521 echo "They are compatible. In fact, they may be identical."
2522 else
2523 case "$n" in
2524 '-n') n='' c='\c';;
2525 *) n='-n' c='';;
2526 esac
2527 cat <<FOO
2528They are not compatible! You are probably running ksh on a non-USG system.
2529I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2530have echo built in and we may have to run some Bourne shell scripts. That
2531means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2532
2533FOO
2534 $echo $n "The star should be here-->$c"
2535 $echo "*"
2536 fi
2537 $rm -f foo1 foo2
2538 ;;
2539esac
2540
2f88d857
MB
2541# This question was auctioned at YAPC::Europe-2007 in Vienna
2542# I never promised you could answer it. I only auctioned the question.
2543cat <<FOO
2544The following message is sponsored by
2545
2546 Dresden.pm<--The stars should be here.
2547
2548Dear Perl user, system administrator or package
2549maintainer, the Perl community sends greetings to
2550you. Do you (emblematical) greet back [Y/n]? n
2551
2552FOO
2553
613d6c3e 2554: Check what type of C compiler we use
6b769f8f 2555cat <<EOS >trygcc
2573c5f9
JH
2556$startsh
2557EOS
6b769f8f 2558cat <<'EOSC' >>trygcc
2573c5f9
JH
2559case "$cc" in
2560'') ;;
2561*) $rm -f try try.*
2562 $cat >try.c <<EOM
2563int main(int argc, char *argv[]) {
2564 return 0;
2565}
2566EOM
e4778687 2567 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2568 :
2569 else
2570 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2571 despair=yes
2572 trygcc=yes
2573 case "$cc" in
2574 *gcc*) trygcc=no ;;
2575 esac
dce40316
AD
2576 # Skip this test because it gives a false match on output like:
2577 # ./trygcc: line 23: cc: command not found
2578 # case "`$cc -v -c try.c 2>&1`" in
2579 # *gcc*) trygcc=no ;;
2580 # esac
2573c5f9
JH
2581 if $test X"$trygcc" = Xyes; then
2582 if gcc -o try -c try.c; then
2583 echo " "
2584 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2585 # Switching compilers may undo the work of hints files.
2586 # The most common problem is -D_REENTRANT for threads.
2587 # This heuristic catches that case, but gets false positives
2588 # if -Dusethreads was not actually specified. Better to
2589 # bail out here with a useful message than fail
2590 # mysteriously later. Should we perhaps just try to
2591 # re-invoke Configure -Dcc=gcc config_args ?
2592 if $test -f usethreads.cbu; then
2593 $cat >&4 <<EOM
2594
2595*** However, any setting of the C compiler flags (e.g. for thread support)
2596*** will be lost. It may be necessary for you to restart Configure and
2597*** add -Dcc=gcc to your Configure command line.
2598
2599EOM
2600 rp="Would you like to go ahead and try gcc anyway?"
2601 dflt=n
2602 else
2603 rp="Would you like to use it?"
2604 dflt=y
2605 fi
2573c5f9
JH
2606 if $test -f myread; then
2607 . ./myread
2608 else
2609 if $test -f UU/myread; then
2610 . ./UU/myread
2611 else
2612 echo "Cannot find myread, sorry. Aborting." >&2
2613 exit 1
2614 fi
2615 fi
2616 case "$ans" in
6371411c 2617 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2618 esac
2619 fi
2620 fi
6b769f8f
RB
2621 fi
2622 $rm -f try try.*
2623 ;;
2624esac
2625EOSC
2626
2627cat <<EOS >checkcc
2628$startsh
2629EOS
2630cat <<'EOSC' >>checkcc
2631case "$cc" in
2632'') ;;
2633*) $rm -f try try.*
2634 $cat >try.c <<EOM
2635int main(int argc, char *argv[]) {
2636 return 0;
2637}
2638EOM
2639 if $cc -o try $ccflags $ldflags try.c; then
2640 :
2641 else
2573c5f9 2642 if $test X"$despair" = Xyes; then
6b769f8f
RB
2643 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2644 fi
2645 $cat >&4 <<EOM
5dd4fbdf
MB
2646You need to find a working C compiler.
2647Either (purchase and) install the C compiler supplied by your OS vendor,
2648or for a free C compiler try http://gcc.gnu.org/
2649I cannot continue any further, aborting.
2650EOM
6b769f8f 2651 exit 1
2573c5f9
JH
2652 fi
2653 $rm -f try try.*
2654 ;;
2655esac
2656EOSC
2657
a0d0e21e
LW
2658: determine whether symbolic links are supported
2659echo " "
2660$touch blurfl
2661if $ln -s blurfl sym > /dev/null 2>&1 ; then
2662 echo "Symbolic links are supported." >&4
818f00be 2663 lns="$ln -s"
a0d0e21e
LW
2664else
2665 echo "Symbolic links are NOT supported." >&4
2666 lns="$ln"
2667fi
2668$rm -f blurfl sym
2669
dafca956
JH
2670: determine whether symbolic links are supported
2671echo " "
2672case "$lns" in
18ea2752 2673*"ln"*" -s")
dafca956
JH
2674 echo "Checking how to test for symbolic links..." >&4
2675 $lns blurfl sym
4b661809 2676 if $test "X$issymlink" = X; then
2e2a97a6
JH
2677 case "$newsh" in
2678 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2679 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2680 esac
5d644a95
MB
2681 if test $? = 0; then
2682 issymlink="test -h"
2e2a97a6
JH
2683 else
2684 echo "Your builtin 'test -h' may be broken." >&4
2685 case "$test" in
2686 /*) ;;
2687 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2688 for p in $pth
2689 do
2690 if test -f "$p/$test"; then
2691 test="$p/$test"
2692 break
2693 fi
2694 done
2695 ;;
2696 esac
2697 case "$test" in
2698 /*)
2699 echo "Trying external '$test -h'." >&4
2700 issymlink="$test -h"
2701 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2702 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2703 issymlink=''
2704 fi
2705 ;;
2706 *) issymlink='' ;;
2707 esac
5d644a95
MB
2708 fi
2709 fi
4b661809 2710 if $test "X$issymlink" = X; then
dafca956 2711 if $test -L sym 2>/dev/null; then
5d644a95 2712 issymlink="$test -L"
2e2a97a6 2713 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2714 fi
2715 fi
4b661809 2716 if $test "X$issymlink" != X; then
5d644a95 2717 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2718 else
2719 echo "I do not know how you can test for symbolic links." >&4
2720 fi
2721 $rm -f blurfl sym
2722 ;;
2723*) echo "No symbolic links, so not testing for their testing..." >&4
2724 ;;
2725esac
2726echo " "
2727
34f1896b 2728: Make symlinks util
dafca956
JH
2729case "$mksymlinks" in
2730$define|true|[yY]*)
2731 case "$src" in
2732 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2733 exit 1
2734 ;;
4b661809 2735 *) case "$lns:$issymlink" in
f314eb9f 2736 *"ln"*" -s:"*"test -"?)
dafca956
JH
2737 echo "Creating the symbolic links..." >&4
2738 echo "(First creating the subdirectories...)" >&4
2739 cd ..
2740 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2741 read directory
2742 test -z "$directory" && break
2743 mkdir -p $directory
2744 done
2745 # Sanity check 1.
2746 if test ! -d t/base; then
2747 echo "Failed to create the subdirectories. Aborting." >&4
2748 exit 1
2749 fi
2750 echo "(Then creating the symlinks...)" >&4
2751 awk '{print $1}' $src/MANIFEST | while true; do
2752 read filename
2753 test -z "$filename" && break
2754 if test -f $filename; then
5d644a95 2755 if $issymlink $filename; then
dafca956
JH
2756 rm -f $filename
2757 fi
2758 fi
2759 if test -f $filename; then
2760 echo "$filename already exists, not symlinking."
2761 else
2762 ln -s $src/$filename $filename
2763 fi
2764 done
2765 # Sanity check 2.
a0d24b8a
JH
2766 if test ! -f t/base/lex.t; then
2767 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2768 exit 1
2769 fi
2770 cd UU
2771 ;;
2772 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2773 ;;
2774 esac
2775 ;;
2776 esac
2777 ;;
2778esac
2779
613d6c3e 2780: Check for Cross-Compilation
5440bc8e
JH
2781case "$usecrosscompile" in
2782$define|true|[yY]*)
93bc48fa 2783 $echo "Cross-compiling..."
5440bc8e
JH
2784 croak=''
2785 case "$cc" in
2786 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2787 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2788 ar=$targetarch-ar
2789 # leave out ld, choosing it is more complex
2790 nm=$targetarch-nm
2791 ranlib=$targetarch-ranlib
93bc48fa 2792 $echo 'extern int foo;' > try.c
f8006fac 2793 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2794 shift
2795 if $test $# -gt 0; then
2796 incpth="$incpth $*"
f8006fac
JH
2797 incpth="`$echo $incpth|$sed 's/^ //'`"
2798 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2799 for i in $*; do
f8006fac 2800 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2801 if $test -d $j; then
2802 libpth="$libpth $j"
2803 fi
2804 done
f8006fac
JH
2805 libpth="`$echo $libpth|$sed 's/^ //'`"
2806 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2807 fi
2808 $rm -f try.c
5440bc8e
JH
2809 ;;
2810 esac
2811 case "$targetarch" in
93bc48fa
JH
2812 '') echo "Targetarch not defined." >&4; croak=y ;;
2813 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2814 esac
2815 case "$incpth" in
93bc48fa 2816 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2817 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2818 esac
2819 case "$libpth" in
93bc48fa 2820 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2821 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2822 esac
93bc48fa
JH
2823 case "$usrinc" in
2824 '') for i in $incpth; do
2825 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2826 usrinc=$i
2827 echo "Guessing usrinc $usrinc." >&4
2828 break
2829 fi
2830 done
2831 case "$usrinc" in
2832 '') echo "Usrinc not defined." >&4; croak=y ;;
2833 esac
2834 ;;
2835 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2836 esac
93bc48fa
JH
2837 case "$targethost" in
2838 '') echo "Targethost not defined." >&4; croak=y ;;
2839 *) echo "Using targethost $targethost." >&4
5440bc8e 2840 esac
93bc48fa
JH
2841 locincpth=' '
2842 loclibpth=' '
5440bc8e 2843 case "$croak" in
93bc48fa 2844 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2845 esac
2846 case "$src" in
2847 /*) run=$src/Cross/run
93c0359c 2848 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2849 to=$src/Cross/to
2850 from=$src/Cross/from
2851 ;;
93bc48fa 2852 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2853 run=$pwd/Cross/run
f8006fac 2854 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2855 to=$pwd/Cross/to
2856 from=$pwd/Cross/from
2857 ;;
2858 esac
2859 case "$targetrun" in
2860 '') targetrun=ssh ;;
2861 esac
2862 case "$targetto" in
2863 '') targetto=scp ;;
2864 esac
2865 case "$targetfrom" in
2866 '') targetfrom=scp ;;
2867 esac
2868 run=$run-$targetrun
2869 to=$to-$targetto
2870 from=$from-$targetfrom
93bc48fa
JH
2871 case "$targetdir" in
2872 '') targetdir=/tmp
2873 echo "Guessing targetdir $targetdir." >&4
2874 ;;
2875 esac
5440bc8e 2876 case "$targetuser" in
93bc48fa
JH
2877 '') targetuser=root
2878 echo "Guessing targetuser $targetuser." >&4
2879 ;;
5440bc8e
JH
2880 esac
2881 case "$targetfrom" in
2882 scp) q=-q ;;
2883 *) q='' ;;
2884 esac
2885 case "$targetrun" in
2886 ssh|rsh)
2887 cat >$run <<EOF
2888#!/bin/sh
93c0359c
JH
2889case "\$1" in
2890-cwd)
2891 shift
2892 cwd=\$1
2893 shift
2894 ;;
2895esac
2896case "\$cwd" in
2897'') cwd=$targetdir ;;
2898esac
5440bc8e
JH
2899exe=\$1
2900shift
93c0359c
JH
2901if $test ! -f \$exe.xok; then
2902 $to \$exe
2903 $touch \$exe.xok
2904fi
2905$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2906EOF
2907 ;;
93bc48fa 2908 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2909 exit 1
2910 ;;
2911 esac
93c0359c
JH
2912 case "$targetmkdir" in
2913 */Cross/mkdir)
2914 cat >$targetmkdir <<EOF
2915#!/bin/sh
2916$targetrun -l $targetuser $targethost "mkdir -p \$@"
2917EOF
f8006fac 2918 $chmod a+rx $targetmkdir
93c0359c
JH
2919 ;;
2920 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2921 exit 1
2922 ;;
2923 esac
5440bc8e
JH
2924 case "$targetto" in
2925 scp|rcp)
2926 cat >$to <<EOF
2927#!/bin/sh
2928for f in \$@
2929do
93c0359c
JH
2930 case "\$f" in
2931 /*)
2932 $targetmkdir \`dirname \$f\`
2933 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2934 ;;
2935 *)
2936 $targetmkdir $targetdir/\`dirname \$f\`
2937 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2938 ;;
2939 esac
5440bc8e
JH
2940done
2941exit 0
2942EOF
2943 ;;
2944 cp) cat >$to <<EOF
2945#!/bin/sh
93c0359c
JH
2946for f in \$@
2947do
2948 case "\$f" in
2949 /*)
2950 $mkdir -p $targetdir/\`dirname \$f\`
2951 $cp \$f $targetdir/\$f || exit 1
2952 ;;
2953 *)
2954 $targetmkdir $targetdir/\`dirname \$f\`
2955 $cp \$f $targetdir/\$f || exit 1
2956 ;;
2957 esac
2958done
2959exit 0
5440bc8e
JH
2960EOF
2961 ;;
93bc48fa 2962 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2963 exit 1
2964 ;;
2965 esac
2966 case "$targetfrom" in
2967 scp|rcp)
2968 cat >$from <<EOF
2969#!/bin/sh
2970for f in \$@
2971do
93c0359c 2972 $rm -f \$f
5440bc8e
JH
2973 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2974done
2975exit 0
2976EOF
2977 ;;
2978 cp) cat >$from <<EOF
2979#!/bin/sh
2980for f in \$@
2981do
93c0359c 2982 $rm -f \$f
5440bc8e
JH
2983 cp $targetdir/\$f . || exit 1
2984done
2985exit 0
2986EOF
2987 ;;
93bc48fa 2988 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2989 exit 1
2990 ;;
2991 esac
93bc48fa
JH
2992 if $test ! -f $run; then
2993 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2994 else
f8006fac 2995 $chmod a+rx $run
5440bc8e 2996 fi
93bc48fa
JH
2997 if $test ! -f $to; then
2998 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2999 else
f8006fac 3000 $chmod a+rx $to
5440bc8e 3001 fi
93bc48fa
JH
3002 if $test ! -f $from; then
3003 echo "Target 'from' script '$from' not found." >&4
5440bc8e 3004 else
f8006fac 3005 $chmod a+rx $from
5440bc8e 3006 fi
93bc48fa 3007 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
3008 exit 1
3009 fi
3010 cat >&4 <<EOF
f8006fac
JH
3011Using '$run' for remote execution,
3012and '$from' and '$to'
93bc48fa 3013for remote file transfer.
5440bc8e
JH
3014EOF
3015 ;;
3016*) run=''
3017 to=:
3018 from=:
3019 usecrosscompile='undef'
3020 targetarch=''
3021 ;;
3022esac
3023
ecfc5424
AD
3024: see whether [:lower:] and [:upper:] are supported character classes
3025echo " "
ecfc5424
AD
3026case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3027ABYZ)
3028 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3029 up='[:upper:]'
3030 low='[:lower:]'
3031 ;;
416d0bea
MB
3032*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3033 # (0xd9 and 0xe2), therefore that is a nice testing point.
3034 if test "X$up" = X -o "X$low" = X; then
3035 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3036 rs) up='[A-Z]'
3037 low='[a-z]'
28e8609d
JH
3038 ;;
3039 esac
416d0bea 3040 fi
28e8609d 3041 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3042 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3043 rs) up='A-Z'
28e8609d
JH
3044 low='a-z'
3045 ;;
3046 esac
416d0bea 3047 fi
28e8609d 3048 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3049 case "`echo RS | od -x 2>/dev/null`" in
3050 *D9E2*|*d9e2*)
28e8609d
JH
3051 echo "Hey, this might be EBCDIC." >&4
3052 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3053 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3054 rs) up='[A-IJ-RS-Z]'
3055 low='[a-ij-rs-z]'
28e8609d
JH
3056 ;;
3057 esac
3058 fi
3059 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3060 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3061 rs) up='A-IJ-RS-Z'
3062 low='a-ij-rs-z'
28e8609d
JH
3063 ;;
3064 esac
3065 fi
3066 ;;
3067 esac
3068 fi
3069esac
416d0bea
MB
3070case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3071rs)
28e8609d
JH
3072 echo "Using $up and $low to convert case." >&4
3073 ;;
ecfc5424 3074*)
28e8609d
JH
3075 echo "I don't know how to translate letters from upper to lower case." >&4
3076 echo "Your tr is not acting any way I know of." >&4
3077 exit 1
3078 ;;
ecfc5424
AD
3079esac
3080: set up the translation script tr, must be called with ./tr of course
3081cat >tr <<EOSC
3082$startsh
3083case "\$1\$2" in
3084'[A-Z][a-z]') exec $tr '$up' '$low';;
3085'[a-z][A-Z]') exec $tr '$low' '$up';;
3086esac
3087exec $tr "\$@"
3088EOSC
3089chmod +x tr
3090$eunicefix tr
3091
2304df62
AD
3092: Try to determine whether config.sh was made on this system
3093case "$config_sh" in
3094'')
43999f95
JH
3095myuname=`$uname -a 2>/dev/null`
3096$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3097# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3098# because the A-Z/a-z are not consecutive.
34e09935 3099myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3eaeeeae 3100 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3101newmyuname="$myuname"
2304df62 3102dflt=n
16d20bd9
AD
3103case "$knowitall" in
3104'')
3105 if test -f ../config.sh; then
3106 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3107 eval "`grep myuname= ../config.sh`"
3108 fi
3109 if test "X$myuname" = "X$newmyuname"; then
3110 dflt=y
3111 fi
2304df62 3112 fi
16d20bd9
AD
3113 ;;
3114*) dflt=y;;
3115esac
2304df62
AD
3116
3117: Get old answers from old config file if Configure was run on the
3118: same system, otherwise use the hints.
3119hint=default
3120cd ..
3121if test -f config.sh; then
16d20bd9
AD
3122 echo " "
3123 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3124 . UU/myread
3125 case "$ans" in
f83701cd
AD
3126 n*|N*) echo "OK, I'll ignore it."
3127 mv config.sh config.sh.old
3128 myuname="$newmyuname"
3129 ;;
2304df62 3130 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3131 tmp_n="$n"
3132 tmp_c="$c"
85cad39c 3133 tmp_sh="$sh"
2304df62
AD
3134 . ./config.sh
3135 cp config.sh UU
ecfc5424
AD
3136 n="$tmp_n"
3137 c="$tmp_c"
85cad39c 3138 : Older versions did not always set $sh. Catch re-use of such
3139 : an old config.sh.
3140 case "$sh" in
3141 '') sh="$tmp_sh" ;;
3142 esac
2304df62
AD
3143 hint=previous
3144 ;;
3145 esac
3146fi
2573c5f9 3147. ./UU/checkcc
2304df62
AD
3148if test ! -f config.sh; then
3149 $cat <<EOM
3150
4e2a5f63
AD
3151First time through, eh? I have some defaults handy for some systems
3152that need some extra help getting the Configure answers right:
2304df62
AD
3153
3154EOM
dfe9444c 3155 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3156 dflt=''
3157 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3158 : tests or hints, please send them to perlbug@perl.org
2304df62 3159 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3160 $test -f /irix && osname=irix
85e6fe83
LW
3161 $test -f /xenix && osname=sco_xenix
3162 $test -f /dynix && osname=dynix
3163 $test -f /dnix && osname=dnix
5f05dabc 3164 $test -f /lynx.os && osname=lynxos
3165 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3166 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3167 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3168 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3169 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3170 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3171 $test -d /usr/apollo/bin && osname=apollo
3172 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3173 $test -d /usr/include/minix && osname=minix
d54344fc 3174 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3175 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3176 osname=machten
4633a7c4 3177 if $test -x /sbin/version; then
dfe9444c 3178 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3179 $sed -e 's/[A-Za-z]$//'`
3180 elif $test -x /usr/etc/version; then
dfe9444c 3181 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3182 $sed -e 's/[A-Za-z]$//'`
3183 else
3184 osvers="$2.$3"
3185 fi
3186 fi
aaacdc8b
GS
3187
3188 $test -f /sys/posix.dll &&
3189 $test -f /usr/bin/what &&
3190 set X `/usr/bin/what /sys/posix.dll` &&
3191 $test "$3" = UWIN &&
3192 osname=uwin &&
3193 osvers="$5"
3194
2304df62
AD
3195 if $test -f $uname; then
3196 set X $myuname
3197 shift
3198
2304df62 3199 case "$5" in
85e6fe83 3200 fps*) osname=fps ;;
2304df62
AD
3201 mips*)
3202 case "$4" in
85e6fe83
LW
3203 umips) osname=umips ;;
3204 *) osname=mips ;;
2304df62 3205 esac;;
85e6fe83
LW
3206 [23]100) osname=mips ;;
3207 next*) osname=next ;;
ecfc5424 3208 i386*)
c6912327
JH
3209 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3210 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3211 osname='sco'
3212 osvers=$tmp
3213 elif $test -f /etc/kconfig; then
ecfc5424 3214 osname=isc
bd628c73 3215 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3216 osvers=4
3217 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3218 osvers=3
2304df62 3219 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3220 osvers=2
ecfc5424
AD
3221 fi
3222 fi
2000072c 3223 tmp=''
ecfc5424 3224 ;;
c4f23d77
AD
3225 pc*)
3226 if test -n "$DJGPP"; then
3227 osname=dos
3228 osvers=djgpp
3229 fi
3230 ;;
2304df62
AD
3231 esac
3232
3233 case "$1" in
a0d0e21e
LW
3234 aix) osname=aix
3235 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3236 case "$tmp" in
e81c5c2a
NC
3237 # oslevel can fail with:
3238 # oslevel: Unable to acquire lock.
3239 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3240 '<3240'|'<>3240') osvers=3.2.0 ;;
3241 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3242 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3243 *) osvers=$tmp;;
a0d0e21e
LW
3244 esac
3245 ;;
aaacdc8b
GS
3246 bsd386) osname=bsd386
3247 osvers=`$uname -r`
3248 ;;
3249 cygwin*) osname=cygwin
3250 osvers="$3"
3251 ;;
23f87696
SZ
3252 *dc.osx) osname=dcosx
3253 osvers="$3"
3254 ;;
a0d0e21e
LW
3255 dnix) osname=dnix
3256 osvers="$3"
3257 ;;
3258 domainos) osname=apollo
3259 osvers="$3"
3260 ;;
a774dfe6
RSG
3261 dgux) osname=dgux
3262 osvers="$3"
3263 ;;
3264 dragonfly) osname=dragonfly
a0d0e21e
LW
3265 osvers="$3"
3266 ;;
760ac839 3267 dynixptx*) osname=dynixptx
e58e581d 3268 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3269 ;;
a774dfe6 3270 freebsd) osname=freebsd
a0d0e21e 3271 osvers="$3" ;;
761ee4e8
BD
3272 genix) osname=genix ;;
3273 gnu) osname=gnu
3274 osvers="$3" ;;
a774dfe6 3275 hp*) osname=hpux
bfb7748a 3276 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3277 ;;
761ee4e8 3278 irix*) osname=irix
a0d0e21e
LW
3279 case "$3" in
3280 4*) osvers=4 ;;
3281 5*) osvers=5 ;;
ecfc5424 3282 *) osvers="$3" ;;
a0d0e21e
LW
3283 esac
3284 ;;
761ee4e8 3285 linux) osname=linux
a0d0e21e 3286 case "$3" in
a0d0e21e
LW
3287 *) osvers="$3" ;;
3288 esac
3289 ;;
761ee4e8 3290 MiNT) osname=mint
28e8609d
JH
3291 ;;
3292 netbsd*) osname=netbsd
ecfc5424
AD
3293 osvers="$3"
3294 ;;
4e81affe
MM
3295 news-os) osvers="$3"
3296 case "$3" in
3297 4*) osname=newsos4 ;;
3298 *) osname=newsos ;;
3299 esac
3300 ;;
aaacdc8b 3301 next*) osname=next ;;
28bb1e2c 3302 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3303 openbsd) osname=openbsd
3304 osvers="$3"
3305 ;;
5c728af0
IZ
3306 os2) osname=os2
3307 osvers="$4"
3308 ;;
aaacdc8b
GS
3309 POSIX-BC | posix-bc ) osname=posix-bc
3310 osvers="$3"
a0d0e21e 3311 ;;
ae3afa4e
TH
3312 powerux | power_ux | powermax_os | powermaxos | \
3313 powerunix | power_unix) osname=powerux
3314 osvers="$3"
3315 ;;
aaacdc8b
GS
3316 qnx) osname=qnx
3317 osvers="$4"
3318 ;;
a0d0e21e
LW
3319 solaris) osname=solaris
3320 case "$3" in
3321 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3322 *) osvers="$3" ;;
a0d0e21e
LW
3323 esac
3324 ;;
85e6fe83
LW
3325 sunos) osname=sunos
3326 case "$3" in
85e6fe83
LW
3327 5*) osname=solaris
3328 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3329 *) osvers="$3" ;;
2304df62
AD
3330 esac
3331 ;;
a0d0e21e 3332 titanos) osname=titanos
85e6fe83 3333 case "$3" in
a0d0e21e
LW
3334 1*) osvers=1 ;;
3335 2*) osvers=2 ;;
3336 3*) osvers=3 ;;
3337 4*) osvers=4 ;;
ecfc5424 3338 *) osvers="$3" ;;
2304df62
AD
3339 esac
3340 ;;
85e6fe83 3341 ultrix) osname=ultrix
ecfc5424 3342 osvers="$3"
2304df62 3343 ;;
28757baa 3344 osf1|mls+) case "$5" in
fed7345c
AD
3345 alpha)
3346 osname=dec_osf
fdd85a03 3347 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3348 case "$osvers" in
3349 [1-9].[0-9]*) ;;
3350 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3351 esac
ecfc5424
AD
3352 ;;
3353 hp*) osname=hp_osf1 ;;
3354 mips) osname=mips_osf1 ;;
85e6fe83
LW
3355 esac
3356 ;;
af1ff193 3357 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3358 openunix|unixware) osname=svr5
0337d152
BG
3359 osvers="$4"
3360 ;;
3c728e00 3361 uts) osname=uts
a0d0e21e
LW
3362 osvers="$3"
3363 ;;
3c728e00
JH
3364 vos) osvers="$3"
3365 ;;
85e6fe83 3366 $2) case "$osname" in
2304df62 3367 *isc*) ;;
a0d0e21e 3368 *freebsd*) ;;
5f05dabc 3369 svr*)
a0d0e21e 3370 : svr4.x or possibly later
a774dfe6 3371 case "svr$3" in
a0d0e21e
LW
3372 ${osname}*)
3373 osname=svr$3
3374 osvers=$4
3375 ;;
3376 esac
3377 case "$osname" in
3378 svr4.0)
3379 : Check for ESIX
3380 if test -f /stand/boot ; then
3381 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3382 if test -n "$INITPROG" -a -f "$INITPROG"; then
3383 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3384 if test -n "$isesix"; then
a0d0e21e
LW
3385 osname=esix4
3386 fi
3387 fi
3388 fi
3389 ;;
3390 esac
3391 ;;
2304df62 3392 *) if test -f /etc/systemid; then
a0d0e21e
LW
3393 osname=sco
3394 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3395 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3396 osvers=$1.$2.$3
c4f23d77 3397 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3398 osvers=$1.$2
c4f23d77 3399 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3400 osvers=$1
2304df62 3401 fi
a0d0e21e
LW
3402 else
3403 case "$osname" in
3404 '') : Still unknown. Probably a generic Sys V.
3405 osname="sysv"
3406 osvers="$3"
3407 ;;
3408 esac
2304df62
AD
3409 fi
3410 ;;
3411 esac
3412 ;;
a0d0e21e
LW
3413 *) case "$osname" in
3414 '') : Still unknown. Probably a generic BSD.
3415 osname="$1"
3416 osvers="$3"
3417 ;;
3418 esac
3419 ;;
2304df62
AD
3420 esac
3421 else
dfe9444c
AD
3422 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3423 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3424 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3425 osname=news_os
2304df62 3426 fi
dfe9444c 3427 $rm -f UU/kernel.what
5c728af0 3428 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3429 set X $myuname
3430 osname=os2
3431 osvers="$5"
2304df62
AD
3432 fi
3433 fi
a774dfe6 3434
5440bc8e
JH
3435 case "$targetarch" in
3436 '') ;;
3437 *) hostarch=$osname
3438 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3439 osvers=''
3440 ;;
3441 esac
3442
a0d0e21e
LW
3443 : Now look for a hint file osname_osvers, unless one has been
3444 : specified already.
3445 case "$hintfile" in
3446 ''|' ')
1e127011 3447 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3448 : Also try without trailing minor version numbers.
1e127011
DD
3449 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3450 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3451 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3452 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3453 case "$file" in
3454 '') dflt=none ;;
3455 *) case "$osvers" in
3456 '') dflt=$file
3457 ;;
dfe9444c 3458 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3459 dflt=$file
dfe9444c 3460 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3461 dflt=$xfile
dfe9444c 3462 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3463 dflt=$xxfile
dfe9444c 3464 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3465 dflt=$xxxfile
dfe9444c 3466 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3467 dflt=$xxxxfile
dfe9444c 3468 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3469 dflt="${osname}"
3470 else
3471 dflt=none
3472 fi
3473 ;;
3474 esac
85e6fe83
LW
3475 ;;
3476 esac
4e2a5f63
AD
3477 if $test -f Policy.sh ; then
3478 case "$dflt" in
3479 *Policy*) ;;
3480 none) dflt="Policy" ;;
3481 *) dflt="Policy $dflt" ;;
3482 esac
3483 fi
85e6fe83 3484 ;;
a0d0e21e 3485 *)
ecfc5424 3486 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3487 ;;
2304df62 3488 esac
1aef975c 3489
4e2a5f63
AD
3490 if $test -f Policy.sh ; then
3491 $cat <<EOM
3492
3493There's also a Policy hint file available, which should make the
3494site-specific (policy) questions easier to answer.
3495EOM
3496
3497 fi
3498
2304df62
AD
3499 $cat <<EOM
3500
3501You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3502If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3503previous run of Configure, you may specify it as well as or instead of
3504OS-specific hints. If hints are provided for your OS, you should use them:
3505although Perl can probably be built without hints on many platforms, using
3506hints often improve performance and may enable features that Configure can't
3507set up on its own. If there are no hints that match your OS, specify "none";
3508DO NOT give a wrong version or a wrong OS.
2304df62
AD
3509
3510EOM
4e2a5f63 3511
2304df62 3512 rp="Which of these apply, if any?"
dfe9444c 3513 . UU/myread
85e6fe83
LW
3514 tans=$ans
3515 for file in $tans; do
4e2a5f63
AD
3516 if $test X$file = XPolicy -a -f Policy.sh; then
3517 . Policy.sh
3518 $cat Policy.sh >> UU/config.sh
3519 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3520 . $src/hints/$file.sh
3521 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3522 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3523 : nothing
3524 else
85e6fe83
LW
3525 : Give one chance to correct a possible typo.
3526 echo "$file.sh does not exist"
3527 dflt=$file
3528 rp="hint to use instead?"
dfe9444c 3529 . UU/myread
85e6fe83 3530 for file in $ans; do
dfe9444c
AD
3531 if $test -f "$src/hints/$file.sh"; then
3532 . $src/hints/$file.sh
3533 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3534 elif $test X$ans = X -o X$ans = Xnone ; then
3535 : nothing
3536 else
3537 echo "$file.sh does not exist -- ignored."
3538 fi
3539 done
2304df62
AD
3540 fi
3541 done
85e6fe83 3542
2304df62 3543 hint=recommended
85e6fe83 3544 : Remember our hint file for later.
dfe9444c 3545 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3546 hintfile="$file"
85e6fe83 3547 else
a0d0e21e 3548 hintfile=''
85e6fe83 3549 fi
2304df62
AD
3550fi
3551cd UU
3552;;
3553*)
3554 echo " "
3555 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3556 tmp_n="$n"
3557 tmp_c="$c"
2304df62
AD
3558 cd ..
3559 cp $config_sh config.sh 2>/dev/null
a78b0d02 3560 chmod +w config.sh
2304df62
AD
3561 . ./config.sh
3562 cd UU
3563 cp ../config.sh .
ecfc5424
AD
3564 n="$tmp_n"
3565 c="$tmp_c"
2304df62
AD
3566 hint=previous
3567 ;;
3568esac
1aef975c 3569test "$override" && . ./optdef.sh
2304df62
AD
3570
3571: Restore computed paths
3572for file in $loclist $trylist; do
3573 eval $file="\$_$file"
3574done
3575
85e6fe83 3576cat << EOM
a0d0e21e 3577
85e6fe83 3578Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3579The default value is probably right if the name rings a bell. Otherwise,
3580since spelling matters for me, either accept the default or answer "none"
3581to leave it blank.
a0d0e21e 3582
85e6fe83 3583EOM
85e6fe83 3584case "$osname" in
a0d0e21e 3585 ''|' ')
85e6fe83 3586 case "$hintfile" in
a0d0e21e 3587 ''|' '|none) dflt=none ;;
ecfc5424 3588 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3589 esac
3590 ;;
3591 *) dflt="$osname" ;;
3592esac
3593rp="Operating system name?"
3594. ./myread
3595case "$ans" in
ecfc5424
AD
3596none) osname='' ;;
3597*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3598esac
8ff267be 3599echo " "
3600case "$osvers" in
3601 ''|' ')
3602 case "$hintfile" in
3603 ''|' '|none) dflt=none ;;
3604 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3605 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3606 case "$dflt" in
3607 ''|' ') dflt=none ;;
3608 esac
3609 ;;
3610 esac
3611 ;;
3612 *) dflt="$osvers" ;;
3613esac
3614rp="Operating system version?"
3615. ./myread
3616case "$ans" in
3617none) osvers='' ;;
3618*) osvers="$ans" ;;
3619esac
3620
02e93a22
JH
3621
3622. ./posthint.sh
3623
2304df62 3624: who configured the system
59b83a6f 3625cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3626case "$cf_by" in
3627"")
7c04078e 3628 cf_by=`(logname) 2>/dev/null`
dfe9444c 3629 case "$cf_by" in
7c04078e
GA
3630 "")
3631 cf_by=`(whoami) 2>/dev/null`
3632 case "$cf_by" in
3633 "") cf_by=unknown ;;
3634 esac ;;
8ff267be 3635 esac ;;
3636esac
2304df62 3637
f3f1a2d8
MB
3638: decide how portable to be. Allow command line overrides.
3639case "$d_portable" in
3640"$undef") ;;
3641*) d_portable="$define" ;;
b4eb6b3d 3642esac
b4eb6b3d 3643
f3f1a2d8
MB
3644: set up shell script to do ~ expansion
3645cat >filexp <<EOSS
3646$startsh
3647: expand filename
3648case "\$1" in
f16e9d76 3649 \~/*|\~)
f3f1a2d8
MB
3650 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3651 ;;
4137585d 3652 \~*)
f3f1a2d8
MB
3653 if $test -f /bin/csh; then
3654 /bin/csh -f -c "glob \$1"
3655 failed=\$?
3656 echo ""
3657 exit \$failed
3658 else
3659 name=\`$expr x\$1 : '..\([^/]*\)'\`
3660 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3661 if $test ! -d "\$dir"; then
3662 me=\`basename \$0\`
3663 echo "\$me: can't locate home directory for: \$name" >&2
3664 exit 1
3665 fi
3666 case "\$1" in
3667 */*)
3668 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3669 ;;
3670 *)
3671 echo \$dir
3672 ;;
3673 esac
3674 fi
3675 ;;
3676*)
3677 echo \$1
3678 ;;
b29b105d 3679esac
f3f1a2d8
MB
3680EOSS
3681chmod +x filexp
3682$eunicefix filexp
b29b105d 3683
f3f1a2d8
MB
3684: now set up to get a file name
3685cat <<EOS >getfile
3686$startsh
3687EOS
3688cat <<'EOSC' >>getfile
3689tilde=''
3690fullpath=''
3691already=''
3692skip=''
3693none_ok=''
3694exp_file=''
3695nopath_ok=''
3696orig_rp="$rp"
3697orig_dflt="$dflt"
3698case "$gfpth" in
3699'') gfpth='.' ;;
b29b105d 3700esac
b29b105d 3701
f3f1a2d8
MB
3702case "$fn" in
3703*\(*)
3704 : getfile will accept an answer from the comma-separated list
3705 : enclosed in parentheses even if it does not meet other criteria.
3706 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3707 fn=`echo $fn | sed 's/(.*)//'`
3708 ;;
b29b105d
JH
3709esac
3710
f3f1a2d8
MB
3711case "$fn" in
3712*:*)
3713 loc_file=`expr $fn : '.*:\(.*\)'`
3714 fn=`expr $fn : '\(.*\):.*'`
3715 ;;
b29b105d 3716esac
b29b105d 3717
f3f1a2d8
MB
3718case "$fn" in
3719*~*) tilde=true;;
3720esac
3721case "$fn" in
3722*/*) fullpath=true;;
3723esac
3724case "$fn" in
3725*+*) skip=true;;
3726esac
3727case "$fn" in
3728*n*) none_ok=true;;
3729esac
3730case "$fn" in
3731*e*) exp_file=true;;
3732esac
3733case "$fn" in
3734*p*) nopath_ok=true;;
b29b105d 3735esac
b29b105d 3736
f3f1a2d8
MB
3737case "$fn" in
3738*f*) type='File';;
3739*d*) type='Directory';;
3740*l*) type='Locate';;
3741esac
b29b105d 3742
f3f1a2d8
MB
3743what="$type"
3744case "$what" in
3745Locate) what='File';;
3746esac
b29b105d 3747
f3f1a2d8
MB
3748case "$exp_file" in
3749'')
3750 case "$d_portable" in
3751 "$define") ;;
3752 *) exp_file=true;;
b29b105d
JH
3753 esac
3754 ;;
3755esac
3756
f3f1a2d8
MB
3757cd ..
3758while test "$type"; do
3759 redo=''
3760 rp="$orig_rp"
3761 dflt="$orig_dflt"
3762 case "$tilde" in
3763 true) rp="$rp (~name ok)";;
3764 esac
3765 . UU/myread
3766 if test -f UU/getfile.ok && \
3767 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3768 then
3769 value="$ans"
3770 ansexp="$ans"
3771 break
3772 fi
3773 case "$ans" in
3774 none)
3775 value=''
3776 ansexp=''
3777 case "$none_ok" in
3778 true) type='';;
b29b105d
JH
3779 esac
3780 ;;
f3f1a2d8
MB
3781 *)
3782 case "$tilde" in
3783 '') value="$ans"
3784 ansexp="$ans";;
3785 *)
3786 value=`UU/filexp $ans`
3787 case $? in
3788 0)
3789 if test "$ans" != "$value"; then
3790 echo "(That expands to $value on this system.)"
3791 fi
3792 ;;
3793 *) value="$ans";;
3794 esac
3795 ansexp="$value"
3796 case "$exp_file" in
3797 '') value="$ans";;
3798 esac
3799 ;;
3800 esac
3801 case "$fullpath" in
3802 true)
3803 case "$ansexp" in
3804 /*) value="$ansexp" ;;
3805 [a-zA-Z]:/*) value="$ansexp" ;;
3806 *)
3807 redo=true
3808 case "$already" in
3809 true)
3810 echo "I shall only accept a full path name, as in /bin/ls." >&4
3811 echo "Use a ! shell escape if you wish to check pathnames." >&4
3812 ;;
3813 *)
3814 echo "Please give a full path name, starting with slash." >&4
3815 case "$tilde" in
3816 true)
3817 echo "Note that using ~name is ok provided it expands well." >&4
3818 already=true
3819 ;;
3820 esac
3821 esac
3822 ;;
3823 esac
3824 ;;
3825 esac
3826 case "$redo" in
3827 '')
3828 case "$type" in
3829 File)
3830 for fp in $gfpth; do
3831 if test "X$fp" = X.; then
3832 pf="$ansexp"
3833 else
3834 pf="$fp/$ansexp"
3835 fi
3836 if test -f "$pf"; then
3837 type=''
3838 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3839 then
3840 echo "($value is not a plain file, but that's ok.)"
3841 type=''
3842 fi
3843 if test X"$type" = X; then
3844 value="$pf"
3845 break
3846 fi
3847 done
3848 ;;
3849 Directory)
3850 for fp in $gfpth; do
3851 if test "X$fp" = X.; then
3852 dir="$ans"
3853 direxp="$ansexp"
3854 else
3855 dir="$fp/$ansexp"
3856 direxp="$fp/$ansexp"
3857 fi
3858 if test -d "$direxp"; then
3859 type=''
3860 value="$dir"
3861 break
3862 fi
3863 done
3864 ;;
3865 Locate)
3866 if test -d "$ansexp"; then
3867 echo "(Looking for $loc_file in directory $value.)"
3868 value="$value/$loc_file"
3869 ansexp="$ansexp/$loc_file"
3870 fi
3871 if test -f "$ansexp"; then
3872 type=''
3873 fi
3874 case "$nopath_ok" in
3875 true) case "$value" in
3876 */*) ;;
3877 *) echo "Assuming $value will be in people's path."
3878 type=''
3879 ;;
3880 esac
3881 ;;
3882 esac
3883 ;;
3884 esac
b4eb6b3d 3885
f3f1a2d8
MB
3886 case "$skip" in
3887 true) type='';
3888 esac
3889
3890 case "$type" in
3891 '') ;;
3892 *)
3893 if test "$fastread" = yes; then
3894 dflt=y
3895 else
3896 dflt=n
3897 fi
3898 rp="$what $value doesn't exist. Use that name anyway?"
3899 . UU/myread
3900 dflt=''
3901 case "$ans" in
3902 y*) type='';;
3903 *) echo " ";;
3904 esac
3905 ;;
3906 esac
3907 ;;
3908 esac
3909 ;;
b4eb6b3d 3910 esac
f3f1a2d8
MB
3911done
3912cd UU
3913ans="$value"
3914rp="$orig_rp"
3915dflt="$orig_dflt"
3916rm -f getfile.ok
3917test "X$gfpthkeep" != Xy && gfpth=""
3918EOSC
3919
3920: determine root of directory hierarchy where package will be installed.
3921case "$prefix" in
3922'')
3923 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3924 ;;
3925*?/)
3926 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3927 ;;
3928*)
f3f1a2d8 3929 dflt="$prefix"
b4eb6b3d
JH
3930 ;;
3931esac
f3f1a2d8 3932$cat <<EOM
b4eb6b3d 3933
f3f1a2d8
MB
3934By default, $package will be installed in $dflt/bin, manual pages
3935under $dflt/man, etc..., i.e. with $dflt as prefix for all
3936installation directories. Typically this is something like /usr/local.
3937If you wish to have binaries under /usr/bin but other parts of the
3938installation under /usr/local, that's ok: you will be prompted
3939separately for each of the installation directories, the prefix being
3940only used to set the defaults.
c915ce7f
JH
3941
3942EOM
f3f1a2d8
MB
3943fn=d~
3944rp='Installation prefix to use?'
3945. ./getfile
3946oldprefix=''
3947case "$prefix" in
3948'') ;;
3949*)
3950 case "$ans" in
3951 "$prefix") ;;
3952 *) oldprefix="$prefix";;
3953 esac
c915ce7f
JH
3954 ;;
3955esac
f3f1a2d8
MB
3956prefix="$ans"
3957prefixexp="$ansexp"
c915ce7f 3958
776a38e3 3959: allow them to override the AFS root
f3f1a2d8
MB
3960case "$afsroot" in
3961'') afsroot=/afs ;;
3962*) afsroot=$afsroot ;;
b4eb6b3d 3963esac
b4eb6b3d 3964
776a38e3 3965: is AFS running?
f3f1a2d8
MB
3966echo " "
3967case "$afs" in
3968$define|true) afs=true ;;
3969$undef|false) afs=false ;;
776a38e3 3970*) if $test -d $afsroot; then
f3f1a2d8
MB
3971 afs=true
3972 else
3973 afs=false
3974 fi
b4eb6b3d 3975 ;;
f3f1a2d8
MB
3976esac
3977if $afs; then
3978 echo "AFS may be running... I'll be extra cautious then..." >&4
3979else
3980 echo "AFS does not seem to be running..." >&4
9da7673b 3981fi
b4eb6b3d 3982
f3f1a2d8
MB
3983: determine installation prefix for where package is to be installed.
3984if $afs; then
3985$cat <<EOM
3986
3987Since you are running AFS, I need to distinguish the directory in which
3988files will reside from the directory in which they are installed (and from
3989which they are presumably copied to the former directory by occult means).
b4eb6b3d 3990
b4eb6b3d 3991EOM
f3f1a2d8
MB
3992 case "$installprefix" in
3993 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3994 *) dflt="$installprefix";;
3995 esac
3996else
3997$cat <<EOM
b4eb6b3d 3998
f3f1a2d8
MB
3999In some special cases, particularly when building $package for distribution,
4000it is convenient to distinguish the directory in which files should be
4001installed from the directory ($prefix) in which they will
4002eventually reside. For most users, these two directories are the same.
4003
4004EOM
4005 case "$installprefix" in
4006 '') dflt=$prefix ;;
4007 *) dflt=$installprefix;;
4008 esac
4009fi
4010fn=d~
4011rp='What installation prefix should I use for installing files?'
4012. ./getfile
4013installprefix="$ans"
4014installprefixexp="$ansexp"
4015
4016: Perform the prefixexp/installprefixexp correction if necessary
4017cat <<EOS >installprefix
4018$startsh
4019EOS
4020cat <<'EOSC' >>installprefix
4021: Change installation prefix, if necessary.
4022if $test X"$prefix" != X"$installprefix"; then
4023 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4024else
4025 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4026fi
4027EOSC
4028chmod +x installprefix
4029$eunicefix installprefix
4030
4031: Set variables such as privlib and privlibexp from the output of ./getfile
4032: performing the prefixexp/installprefixexp correction if necessary.
4033cat <<EOS >setprefixvar
4034$startsh
4035EOS
4036cat <<'EOSC' >>setprefixvar
4037eval "${prefixvar}=\"\$ans\""
4038eval "${prefixvar}exp=\"\$ansexp\""
4039. ./installprefix
4040EOSC
4041chmod +x setprefixvar
4042$eunicefix setprefixvar
4043
4044: set up the script used to warn in case of inconsistency
4045cat <<EOS >whoa
4046$startsh
4047EOS
4048cat <<'EOSC' >>whoa
4049dflt=y
dcb594bc
MB
4050case "$hint" in
4051 recommended)
4052 case "$hintfile" in
4053 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4054 ;;
4055 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4056 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4057 ;;
4058 esac
4059 ;;
4060 *) echo " "
4061 echo "*** WHOA THERE!!! ***" >&4
4062 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4063 ;;
4064esac
f3f1a2d8
MB
4065rp=" Keep the $hint value?"
4066. ./myread
4067case "$ans" in
4068y) td=$was; tu=$was;;
4069esac
4070EOSC
4071
216dac04 4072: function used to set '$1' to '$val'
f3f1a2d8
MB
4073setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4074case "$val$was" in
4075$define$undef) . ./whoa; eval "$var=\$td";;
4076$undef$define) . ./whoa; eval "$var=\$tu";;
4077*) eval "$var=$val";;
4078esac'
4079
5c40187f
MB
4080: get the patchlevel
4081echo " "
4082echo "Getting the current patchlevel..." >&4
4083if $test -r $rsrc/patchlevel.h;then
4084 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4085 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4086 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4087 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4088 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4089 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4090 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4091else
4092 revision=0
4093 patchlevel=0
4094 subversion=0
4095 api_revision=0
4096 api_version=0
4097 api_subversion=0
4098 perl_patchlevel=0
4099 $echo "(You do not have patchlevel.h. Eek.)"
4100fi
5c40187f
MB
4101: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4102version_patchlevel_string="version $patchlevel subversion $subversion"
4103case "$perl_patchlevel" in
41040|'') ;;
0f04e85f
MB
4105*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4106 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4107 ;;
5c40187f
MB
4108esac
4109
4110$echo "(You have $package $version_patchlevel_string.)"
4111
4112case "$osname" in
4113dos|vms)
4114 : XXX Should be a Configure test for double-dots in filenames.
4115 version=`echo $revision $patchlevel $subversion | \
4116 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4117 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4118 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4119 ;;
4120*)
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 ;;
4126esac
4127: Special case the 5.005_xx maintenance series, which used 5.005
4128: without any subversion label as a subdirectory in $sitelib
4129if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4130 api_versionstring='5.005'
4131fi
4132
613d6c3e 4133: Do we want threads support and if so, what type
f3f1a2d8
MB
4134case "$usethreads" in
4135$define|true|[yY]*) dflt='y';;
4136*) # Catch case where user specified ithreads or 5005threads but
4137 # forgot -Dusethreads (A.D. 4/2002)
4138 case "$useithreads$use5005threads" in
dd35fa16
MB
4139 *$define*) dflt='y';;
4140 *) dflt='n';;
f3f1a2d8
MB
4141 esac
4142 ;;
4143esac
4144cat <<EOM
4145
4146Perl can be built to take advantage of threads on some systems.
4147To do so, Configure can be run with -Dusethreads.
4148
4149Note that Perl built with threading support runs slightly slower
4150and uses more memory than plain Perl. The current implementation
4151is believed to be stable, but it is fairly new, and so should be
4152treated with caution.
4153
4154If this doesn't make any sense to you, just accept the default '$dflt'.
4155EOM
4156rp='Build a threading Perl?'
4157. ./myread
4158case "$ans" in
4159y|Y) val="$define" ;;
4160*) val="$undef" ;;
4161esac
4162set usethreads
4163eval $setvar
4164
5c40187f
MB
4165if $test $patchlevel -lt 9; then
4166 case "$usethreads" in
4167 $define)
f3f1a2d8
MB
4168 $cat <<EOM
4169
4170Since release 5.6, Perl has had two different threading implementations,
4171the newer interpreter-based version (ithreads) with one interpreter per
4172thread, and the older 5.005 version (5005threads).
4173The 5005threads version is effectively unmaintained and will probably be
4174removed in Perl 5.10, so there should be no need to build a Perl using it
4175unless needed for backwards compatibility with some existing 5.005threads
4176code.
4177
4178EOM
4179 : Default to ithreads unless overridden on command line or with
4180 : old config.sh
4181 dflt='y'
4182 case "$use5005threads" in
4183 $define|true|[yY]*) dflt='n';;
4184 esac
4185 case "$useithreads" in
4186 $undef|false|[nN]*) dflt='n';;
4187 esac
4188 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4189 . ./myread
4190 case "$ans" in
f3f1a2d8 4191 y|Y) val="$define" ;;
b4eb6b3d
JH
4192 *) val="$undef" ;;
4193 esac
f3f1a2d8
MB
4194 set useithreads
4195 eval $setvar
4196 : Now set use5005threads to the opposite value.
4197 case "$useithreads" in
4198 $define) val="$undef" ;;
4199 *) val="$define" ;;
4200 esac
4201 set use5005threads
4202 eval $setvar
4203 ;;
5c40187f 4204 *)
f3f1a2d8
MB
4205 useithreads="$undef"
4206 use5005threads="$undef"
b4eb6b3d 4207 ;;
5c40187f 4208 esac
b4eb6b3d 4209
5c40187f
MB
4210 case "$useithreads$use5005threads" in
4211 "$define$define")
f3f1a2d8 4212 $cat >&4 <<EOM
96056487 4213
f3f1a2d8
MB
4214You cannot have both the ithreads and the 5.005 threads enabled
4215at the same time. Disabling the 5.005 threads since they are
4216much less stable than the ithreads.
4217
4218EOM
4219 use5005threads="$undef"
96056487 4220 ;;
5c40187f
MB
4221 esac
4222
4223else
4224: perl-5.9.x and later
4225
47f9f84c 4226 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4227 case "$use5005threads" in
4228 $define|true|[yY]*)
4229 $cat >&4 <<EOM
47f9f84c
JH
4230
42315.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4232
47f9f84c 4233EOM
3f30fabf
MB
4234 ;;
4235 esac
47f9f84c 4236 fi
3f30fabf 4237
47f9f84c
JH
4238 use5005threads="$undef"
4239 useithreads="$usethreads"
5c40187f 4240fi
96056487 4241
f3f1a2d8
MB
4242case "$d_oldpthreads" in
4243'') : Configure tests would be welcome here. For now, assume undef.
4244 val="$undef" ;;
4245*) val="$d_oldpthreads" ;;
4246esac
4247set d_oldpthreads
4248eval $setvar
4249
4250
4251: Look for a hint-file generated 'call-back-unit'. If the
4252: user has specified that a threading perl is to be built,
4253: we may need to set or change some other defaults.
4254if $test -f usethreads.cbu; then
4255 echo "Your platform has some specific hints regarding threaded builds, using them..."
4256 . ./usethreads.cbu
4257else
4258 case "$usethreads" in
4259 "$define"|true|[yY]*)
4260 $cat <<EOM
4261(Your platform does not have any specific hints for threaded builds.
4262 Assuming POSIX threads, then.)
4263EOM
4264 ;;
4265 esac
4266fi
4267
34f1896b 4268: Check if multiplicity is required
f3f1a2d8
MB
4269cat <<EOM
4270
4271Perl can be built so that multiple Perl interpreters can coexist
4272within the same Perl executable.
4273EOM
4274
4275case "$useithreads" in
4276$define)
4277 cat <<EOM
4278This multiple interpreter support is required for interpreter-based threads.
4279EOM
4280 val="$define"
4281 ;;
4282*) case "$usemultiplicity" in
4283 $define|true|[yY]*) dflt='y';;
4284 *) dflt='n';;
4285 esac
4286 echo " "
4287 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4288 rp='Build Perl for multiplicity?'
4289 . ./myread
4290 case "$ans" in
4291 y|Y) val="$define" ;;
4292 *) val="$undef" ;;
4293 esac
4294 ;;
4295esac
4296set usemultiplicity
4297eval $setvar
4298
34f1896b 4299: Check if morebits is requested
f3f1a2d8
MB
4300case "$usemorebits" in
4301"$define"|true|[yY]*)
4302 use64bitint="$define"
4303 uselongdouble="$define"
4304 usemorebits="$define"
4305 ;;
4306*) usemorebits="$undef"
4307 ;;
4308esac
4309
776a38e3
MB
4310: Determine the C compiler to be used
4311echo " "
4312case "$cc" in
4313'') dflt=cc;;
4314*) dflt="$cc";;
4315esac
4316rp="Use which C compiler?"
4317. ./myread
4318cc="$ans"
4319
4320: See whether they have no cc but they do have gcc
4321. ./trygcc
4322if $test -f cc.cbu; then
4323 . ./cc.cbu
4324fi
4325. ./checkcc
4326
f3f1a2d8
MB
4327: make some quick guesses about what we are up against
4328echo " "
4329$echo $n "Hmm... $c"
4330echo exit 1 >bsd
4331echo exit 1 >usg
4332echo exit 1 >v7
4333echo exit 1 >osf1
4334echo exit 1 >eunice
4335echo exit 1 >xenix
4336echo exit 1 >venix
4337echo exit 1 >os2
4338d_bsd="$undef"
4339$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4340if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4341then
4342 echo "Looks kind of like an OSF/1 system, but we'll see..."
4343 echo exit 0 >osf1
381aa1ff 4344elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4345 xxx=`./loc addbib blurfl $pth`
4346 if $test -f $xxx; then
4347 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4348 echo exit 0 >bsd
4349 echo exit 0 >usg
4350 else
4351 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4352 echo "Looks kind of like an extended USG system, but we'll see..."
4353 else
4354 echo "Looks kind of like a USG system, but we'll see..."
4355 fi
4356 echo exit 0 >usg
4357 fi
4358elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4359 echo "Looks kind of like a BSD system, but we'll see..."
4360 d_bsd="$define"
4361 echo exit 0 >bsd
4362else
4363 echo "Looks kind of like a Version 7 system, but we'll see..."
4364 echo exit 0 >v7
4365fi
4366case "$eunicefix" in
4367*unixtovms*)
4368 $cat <<'EOI'
4369There is, however, a strange, musty smell in the air that reminds me of
4370something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4371EOI
4372 echo exit 0 >eunice
4373 d_eunice="$define"
4374: it so happens the Eunice I know will not run shell scripts in Unix format
4375 ;;
4376*)
4377 echo " "
4378 echo "Congratulations. You aren't running Eunice."
4379 d_eunice="$undef"
4380 ;;
4381esac
4382: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4383: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4384: semicolon as a patch separator
e5e20432
JH
4385case "$p_" in
4386:) ;;
4387*)
4388 $cat <<'EOI'
4389I have the feeling something is not exactly right, however...don't tell me...
4390lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4391(Or you may be running DOS with DJGPP.)
e5e20432
JH
4392EOI
4393 echo exit 0 >os2
4394 ;;
4395esac
4396if test -f /xenix; then
4397 echo "Actually, this looks more like a XENIX system..."
4398 echo exit 0 >xenix
4399 d_xenix="$define"
4400else
4401 echo " "
4402 echo "It's not Xenix..."
4403 d_xenix="$undef"
4404fi
4405chmod +x xenix
4406$eunicefix xenix
4407if test -f /venix; then
4408 echo "Actually, this looks more like a VENIX system..."
4409 echo exit 0 >venix
4410else
4411 echo " "
4412 if ./xenix; then
4413 : null
4414 else
4415 echo "Nor is it Venix..."
4416 fi
4417fi
4418chmod +x bsd usg v7 osf1 eunice xenix venix os2
4419$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4420$rm -f foo
4421
613d6c3e 4422: Check if we are using GNU gcc and what its version is
e5e20432
JH
4423echo " "
4424echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4425$cat >try.c <<EOM
e5e20432
JH
4426#include <stdio.h>
4427int main() {
7686528e 4428#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4429#ifdef __VERSION__
4430 printf("%s\n", __VERSION__);
4431#else
4432 printf("%s\n", "1");
4433#endif
4434#endif
073b6de5 4435 return(0);
e5e20432
JH
4436}
4437EOM
5440bc8e
JH
4438if $cc -o try $ccflags $ldflags try.c; then
4439 gccversion=`$run ./try`
f3f1a2d8
MB
4440 case "$gccversion" in
4441 '') echo "You are not using GNU cc." ;;
4442 *) echo "You are using GNU cc $gccversion."
4443 ccname=gcc
4444 ;;
4445 esac
4446else
4447 echo " "
4448 echo "*** WHOA THERE!!! ***" >&4
4449 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4450 case "$knowitall" in
4451 '')
4452 echo " You'd better start hunting for one and let me know about it." >&4
4453 exit 1
2304df62
AD
4454 ;;
4455 esac
f3f1a2d8
MB
4456fi
4457$rm -f try try.*
4458case "$gccversion" in
44591*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4460esac
4461case "$gccversion" in
4462'') gccosandvers='' ;;
4463*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4464 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4465 gccshortvers=''
4466 case "$gccosandvers" in
4467 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4468 $osname$osvers) ;; # looking good
4469 $osname*) cat <<EOM >&4
4470
4471*** WHOA THERE!!! ***
4472
4473 Your gcc has not been compiled for the exact release of
4474 your operating system ($gccosandvers versus $osname$osvers).
4475
4476 In general it is a good idea to keep gcc synchronized with
4477 the operating system because otherwise serious problems
4478 may ensue when trying to compile software, like Perl.
4479
4480 I'm trying to be optimistic here, though, and will continue.
4481 If later during the configuration and build icky compilation
4482 problems appear (headerfile conflicts being the most common
4483 manifestation), I suggest reinstalling the gcc to match
4484 your operating system release.
4485
4486EOM
4487 ;;
4488 *) gccosandvers='' ;; # failed to parse, better be silent
4489 esac
4490 ;;
4491esac
4492case "$ccname" in
4493'') ccname="$cc" ;;
4494esac
4495
4496# gcc 3.* complain about adding -Idirectories that they already know about,
4497# so we will take those off from locincpth.
4498case "$gccversion" in
44993*)
4500 echo "main(){}">try.c
4501 for incdir in $locincpth; do
4502 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4503 grep '^c[cp]p*[01]: warning: changing search order '`
4504 if test "X$warn" != X; then
4505 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4506 fi
4507 done
4508 $rm -f try try.*
4509esac
2304df62 4510
bd9b35c9
JH
4511: What should the include directory be ?
4512echo " "
4513$echo $n "Hmm... $c"
4514dflt='/usr/include'
4515incpath=''
4516mips_type=''
4517if $test -f /bin/mips && /bin/mips; then
4518 echo "Looks like a MIPS system..."
4519 $cat >usr.c <<'EOCP'
4520#ifdef SYSTYPE_BSD43
4521/bsd43
4522#endif
4523EOCP
8a27cf78 4524 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4525 dflt='/bsd43/usr/include'
4526 incpath='/bsd43'
4527 mips_type='BSD 4.3'
4528 else
4529 mips_type='System V'
4530 fi
4531 $rm -f usr.c usr.out
4532 echo "and you're compiling with the $mips_type compiler and libraries."
4533 xxx_prompt=y
4534 echo "exit 0" >mips
4535else
4536 echo "Doesn't look like a MIPS system."
4537 xxx_prompt=n
4538 echo "exit 1" >mips
4539fi
4540chmod +x mips
4541$eunicefix mips
4542case "$usrinc" in
4543'') ;;
4544*) dflt="$usrinc";;
4545esac
4546case "$xxx_prompt" in
4547y) fn=d/
4548 echo " "
4549 rp='Where are the include files you want to use?'
4550 . ./getfile
4551 usrinc="$ans"
8e07c86e 4552 ;;
bd9b35c9 4553*) usrinc="$dflt"
8e07c86e
AD
4554 ;;
4555esac
2304df62 4556
96056487
JH
4557: see how we invoke the C preprocessor
4558echo " "
4559echo "Now, how can we feed standard input to your C preprocessor..." >&4
4560cat <<'EOT' >testcpp.c
4561#define ABC abc
4562#define XYZ xyz
4563ABC.XYZ
4564EOT
4565cd ..
4566if test ! -f cppstdin; then
4567 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4568 # AIX cc -E doesn't show the absolute headerfile
4569 # locations but we'll cheat by using the -M flag.
4570 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4571 else
4572 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4573 fi
4574else
4575 echo "Keeping your $hint cppstdin wrapper."
4576fi
4577chmod 755 cppstdin
4578wrapper=`pwd`/cppstdin
4579ok='false'
4580cd UU
4581
4582if $test "X$cppstdin" != "X" && \
4583 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4584 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4585then
4586 echo "You used to use $cppstdin $cppminus so we'll use that again."
4587 case "$cpprun" in
4588 '') echo "But let's see if we can live without a wrapper..." ;;
4589 *)
4590 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4591 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4592 then
4593 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4594 ok='true'
4595 else
4596 echo "(However, $cpprun $cpplast does not work, let's see...)"
4597 fi
4598 ;;
4599 esac
4600else
4601 case "$cppstdin" in
4602 '') ;;
4603 *)
4604 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4605 ;;
4606 esac
4607fi
4608
4609if $ok; then
4610 : nothing
4611elif echo 'Maybe "'"$cc"' -E" will work...'; \
4612 $cc -E <testcpp.c >testcpp.out 2>&1; \
4613 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4614 echo "Yup, it does."
4615 x_cpp="$cc -E"
4616 x_minus='';
4617elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4618 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4619 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4620 echo "Yup, it does."
4621 x_cpp="$cc -E"
4622 x_minus='-';
4623elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4624 $cc -P <testcpp.c >testcpp.out 2>&1; \
4625 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626 echo "Yipee, that works!"
4627 x_cpp="$cc -P"
4628 x_minus='';
4629elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4630 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4631 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632 echo "At long last!"
4633 x_cpp="$cc -P"
4634 x_minus='-';
4635elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4636 $cpp <testcpp.c >testcpp.out 2>&1; \
4637 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638 echo "It works!"
4639 x_cpp="$cpp"
4640 x_minus='';
4641elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4642 $cpp - <testcpp.c >testcpp.out 2>&1; \
4643 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644 echo "Hooray, it works! I was beginning to wonder."
4645 x_cpp="$cpp"
4646 x_minus='-';
4647elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4648 $wrapper <testcpp.c >testcpp.out 2>&1; \
4649 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650 x_cpp="$wrapper"
4651 x_minus=''
4652 echo "Eureka!"
4653else
4654 dflt=''
4655 rp="No dice. I can't find a C preprocessor. Name one:"
4656 . ./myread
4657 x_cpp="$ans"
4658 x_minus=''
4659 $x_cpp <testcpp.c >testcpp.out 2>&1
4660 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661 echo "OK, that will do." >&4
4662 else
4663echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4664 exit 1
4665 fi
4666fi
4667
4668case "$ok" in
4669false)
4670 cppstdin="$x_cpp"
4671 cppminus="$x_minus"
4672 cpprun="$x_cpp"
4673 cpplast="$x_minus"
4674 set X $x_cpp
4675 shift
4676 case "$1" in
4677 "$cpp")
4678 echo "Perhaps can we force $cc -E using a wrapper..."
4679 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4680 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4681 then
4682 echo "Yup, we can."
4683 cppstdin="$wrapper"
4684 cppminus='';
4685 else
4686 echo "Nope, we'll have to live without it..."
4687 fi
4688 ;;
4689 esac
4690 case "$cpprun" in
4691 "$wrapper")
4692 cpprun=''
4693 cpplast=''
4694 ;;
4695 esac
4696 ;;
4697esac
4698
4699case "$cppstdin" in
4700"$wrapper"|'cppstdin') ;;
4701*) $rm -f $wrapper;;
4702esac
4703$rm -f testcpp.c testcpp.out
4704
bd9b35c9
JH
4705: Set private lib path
4706case "$plibpth" in
4707'') if ./mips; then
4708 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4709 fi;;
4710esac
4711case "$libpth" in
4712' ') dlist='';;
4713'') dlist="$loclibpth $plibpth $glibpth";;
4714*) dlist="$libpth";;
4715esac
4716
4717: Now check and see which directories actually exist, avoiding duplicates
4718libpth=''
4719for xxx in $dlist
4720do
4721 if $test -d $xxx; then
4722 case " $libpth " in
4723 *" $xxx "*) ;;
4724 *) libpth="$libpth $xxx";;
4725 esac
4726 fi
4727done
4728$cat <<'EOM'
4729
4730Some systems have incompatible or broken versions of libraries. Among
4731the directories listed in the question below, please remove any you
4732know not to be holding relevant libraries, and add any that are needed.
4733Say "none" for none.
8e07c86e
AD
4734
4735EOM
bd9b35c9
JH
4736case "$libpth" in
4737'') dflt='none';;
8e07c86e 4738*)
bd9b35c9
JH
4739 set X $libpth
4740 shift
4741 dflt=${1+"$@"}
8e07c86e 4742 ;;
a0d0e21e 4743esac
bd9b35c9
JH
4744rp="Directories to use for library searches?"
4745. ./myread
4746case "$ans" in
4747none) libpth=' ';;
4748*) libpth="$ans";;
4749esac
a0d0e21e 4750
bd9b35c9
JH
4751: compute shared library extension
4752case "$so" in
4753'')
4754 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4755 dflt='sl'
dd4e71fd 4756 else
bd9b35c9 4757 dflt='so'
dd4e71fd
JH
4758 fi
4759 ;;
bd9b35c9 4760*) dflt="$so";;
dd4e71fd 4761esac
dd4e71fd
JH
4762$cat <<EOM
4763
bd9b35c9 4764On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4765you want to suppress searching of shared libraries for the remainder
bd9b35c9 4766of this configuration.
dd4e71fd
JH
4767
4768EOM
bd9b35c9
JH
4769rp='What is the file extension used for shared libraries?'
4770. ./myread
4771so="$ans"
dd4e71fd 4772
bd9b35c9
JH
4773: Define several unixisms.
4774: Hints files or command line option can be used to override them.
4775: The convoluted testing is in case hints files set either the old
4776: or the new name.
4777case "$_exe" in
4778'') case "$exe_ext" in
1fef16b3 4779 '') ;;
bd9b35c9 4780 *) _exe="$exe_ext" ;;
dd4e71fd 4781 esac
bd9b35c9 4782 ;;
bfb7748a 4783esac
bd9b35c9
JH
4784case "$_a" in
4785'') case "$lib_ext" in
4786 '') _a='.a';;
4787 *) _a="$lib_ext" ;;
dd4e71fd
JH
4788 esac
4789 ;;
dd4e71fd 4790esac
bd9b35c9
JH
4791case "$_o" in
4792'') case "$obj_ext" in
4793 '') _o='.o';;
4794 *) _o="$obj_ext";;
4795 esac
4796 ;;
4797esac
4798case "$p_" in
4799'') case "$path_sep" in
4800 '') p_=':';;
4801 *) p_="$path_sep";;
4802 esac
4803 ;;
4804esac
4805exe_ext=$_exe
4806lib_ext=$_a
4807obj_ext=$_o
4808path_sep=$p_
dd4e71fd 4809
5b813a60
MB
4810rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4811
b4eb6b3d
JH
4812: Which makefile gets called first. This is used by make depend.
4813case "$firstmakefile" in
4814'') firstmakefile='makefile';;
4633a7c4 4815esac
4633a7c4 4816
dd35fa16
MB
4817: Check is we will use socks
4818case "$usesocks" in
4819$define|true|[yY]*) dflt='y';;
4820*) dflt='n';;
4821esac
4822cat <<EOM
4823
4824Perl can be built to use the SOCKS proxy protocol library. To do so,
4825Configure must be run with -Dusesocks. If you use SOCKS you also need
4826to use the PerlIO abstraction layer, this will be implicitly selected.
4827
4828If this doesn't make any sense to you, just accept the default '$dflt'.
4829EOM
4830rp='Build Perl for SOCKS?'
4831. ./myread
4832case "$ans" in
4833y|Y) val="$define" ;;
4834*) val="$undef" ;;
4835esac
4836set usesocks
4837eval $setvar
4838
34f1896b 4839: Check for uselongdouble support
1f603089
JH
4840case "$ccflags" in
4841*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4842esac
4843
4844case "$uselongdouble" in
4845$define|true|[yY]*) dflt='y';;
4846*) dflt='n';;
4847esac
4848cat <<EOM
4849
4850Perl can be built to take advantage of long doubles which
4851(if available) may give more accuracy and range for floating point numbers.
4852
4853If this doesn't make any sense to you, just accept the default '$dflt'.
4854EOM
4855rp='Try to use long doubles if available?'
4856. ./myread
4857case "$ans" in
4858y|Y) val="$define" ;;
4859*) val="$undef" ;;
4860esac
4861set uselongdouble
4862eval $setvar
4863
4864case "$uselongdouble" in
4865true|[yY]*) uselongdouble="$define" ;;
4866esac
4867
1f603089
JH
4868: Look for a hint-file generated 'call-back-unit'. If the
4869: user has specified that long doubles should be used,
4870: we may need to set or change some other defaults.
9da7673b
MB
4871if $test -f uselongdouble.cbu; then
4872 echo "Your platform has some specific hints regarding long doubles, using them..."
4873 . ./uselongdouble.cbu
4874else
4875 case "$uselongdouble" in
4876 $define)
1f603089 4877 $cat <<EOM
9da7673b 4878(Your platform does not have any specific hints for long doubles.)
1f603089 4879EOM
1f603089 4880 ;;
9da7673b
MB
4881 esac
4882fi
1f603089 4883
bd9b35c9
JH
4884: Looking for optional libraries
4885echo " "
4886echo "Checking for optional libraries..." >&4
4887case "$libs" in
4888' '|'') dflt='';;
4889*) dflt="$libs";;
4890esac
4891case "$libswanted" in
4892'') libswanted='c_s';;
4893esac
4894case "$usesocks" in
923fc586 4895"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4896esac
68435ea7
JH
4897libsfound=''
4898libsfiles=''
4899libsdirs=''
13b3f787
JH
4900libspath=''
4901for thisdir in $libpth $xlibpth; do
4902 test -d $thisdir && libspath="$libspath $thisdir"
4903done
bd9b35c9 4904for thislib in $libswanted; do
13b3f787 4905 for thisdir in $libspath; do
f7dd4e7f
JH
4906 xxx=''
4907 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4908 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4909 $test -f "$xxx" && eval $libscheck
4910 $test -f "$xxx" && libstyle=shared
4911 fi
4912 if test ! -f "$xxx"; then
4913 xxx=$thisdir/lib$thislib.$so
4914 $test -f "$xxx" && eval $libscheck
4915 $test -f "$xxx" && libstyle=shared
613d6c3e 4916 fi
f7dd4e7f
JH
4917 if test ! -f "$xxx"; then
4918 xxx=$thisdir/lib$thislib$_a
4919 $test -f "$xxx" && eval $libscheck
4920 $test -f "$xxx" && libstyle=static
4921 fi
4922 if test ! -f "$xxx"; then
4923 xxx=$thisdir/$thislib$_a
4924 $test -f "$xxx" && eval $libscheck
4925 $test -f "$xxx" && libstyle=static
4926 fi
4927 if test ! -f "$xxx"; then
4928 xxx=$thisdir/lib${thislib}_s$_a
4929 $test -f "$xxx" && eval $libscheck
4930 $test -f "$xxx" && libstyle=static
09ea5ba9 4931 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4932 fi
4933 if test ! -f "$xxx"; then
4934 xxx=$thisdir/Slib$thislib$_a
4935 $test -f "$xxx" && eval $libscheck
4936 $test -f "$xxx" && libstyle=static
4937 fi
4938 if $test -f "$xxx"; then
43999f95 4939 case "$libstyle" in
f7dd4e7f
JH
4940 shared) echo "Found -l$thislib (shared)." ;;
4941 static) echo "Found -l$thislib." ;;
4942 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4943 esac
bd9b35c9
JH
4944 case " $dflt " in
4945 *"-l$thislib "*);;
f7dd4e7f 4946 *) dflt="$dflt -l$thislib"
43999f95
JH
4947 libsfound="$libsfound $xxx"
4948 yyy=`basename $xxx`
4949 libsfiles="$libsfiles $yyy"
1e127011 4950 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4951 case " $libsdirs " in
4952 *" $yyy "*) ;;
4953 *) libsdirs="$libsdirs $yyy" ;;
4954 esac
4955 ;;
bd9b35c9 4956 esac
f7dd4e7f 4957 break
613d6c3e 4958 fi
f7dd4e7f
JH
4959 done
4960 if $test ! -f "$xxx"; then
4961 echo "No -l$thislib."
bd9b35c9
JH
4962 fi
4963done
4964set X $dflt
4965shift
4966dflt="$*"
4967case "$libs" in
4968'') dflt="$dflt";;
4969*) dflt="$libs";;
4970esac
4971case "$dflt" in
4972' '|'') dflt='none';;
4973esac
4633a7c4 4974
bd9b35c9 4975$cat <<EOM
4633a7c4 4976
bd9b35c9
JH
4977In order to compile $package on your machine, a number of libraries
4978are usually needed. Include any other special libraries here as well.
4979Say "none" for none. The default list is almost always right.
8e07c86e 4980EOM
8e07c86e 4981
bd9b35c9
JH
4982echo " "
4983rp="What libraries to use?"
4984. ./myread
4985case "$ans" in
4986none) libs=' ';;
4987*) libs="$ans";;
4988esac
d71b2b6b 4989
bd9b35c9
JH
4990: determine optimization, if desired, or use for debug flag also
4991case "$optimize" in
4992' '|$undef) dflt='none';;
4993'') dflt='-O';;
4994*) dflt="$optimize";;
4995esac
4996$cat <<EOH
d71b2b6b 4997
bd9b35c9
JH
4998By default, $package compiles with the -O flag to use the optimizer.
4999Alternately, you might want to use the symbolic debugger, which uses
5000the -g flag (on traditional Unix systems). Either flag can be
5001specified here. To use neither flag, specify the word "none".
d71b2b6b 5002
bd9b35c9
JH
5003EOH
5004rp="What optimizer/debugger flag should be used?"
5005. ./myread
5006optimize="$ans"
5007case "$optimize" in
5008'none') optimize=" ";;
5009esac
5010
eaf812ae
MB
5011: Check what DEBUGGING is required from the command line
5012: -DEBUGGING or -DDEBUGGING or
5013: -DEBUGGING=both = -g + -DDEBUGGING
5014: -DEBUGGING=-g or -Doptimize=-g = -g
5015: -DEBUGGING=none or -UDEBUGGING =
5016: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5017case "$EBUGGING" in
5018'') ;;
5019*) DEBUGGING=$EBUGGING ;;
5020esac
5021
5022case "$DEBUGGING" in
5a7c70d6 5023-g|both|$define)
eaf812ae
MB
5024 case "$optimize" in
5025 *-g*) ;;
5026 *) optimize="$optimize -g" ;;
5027 esac ;;
5028none|$undef)
5029 case "$optimize" in
5030 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5031 shift
5032 optimize="$*"
5033 ;;
5034 esac ;;
5035esac
5036
bd9b35c9 5037dflt=''
eaf812ae
MB
5038case "$DEBUGGING" in
5039both|$define) dflt='-DDEBUGGING'
5040esac
5041
c34316b3
NC
5042: argument order is deliberate, as the flag will start with - which set could
5043: think is an option
6682be1c 5044checkccflag='check=$1; flag=$2; callback=$3;
c34316b3
NC
5045echo " ";
5046echo "Checking if your compiler accepts $flag" 2>&1;
5047echo "int main(void) { return 0; }" > gcctest.c;
04b62921 5048if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
c34316b3 5049 echo "Yes, it does." 2>&1;
580e570e 5050 if $test -s gcctest.out ; then
04b62921
MB
5051 echo "But your platform does not like it:";
5052 cat gcctest.out;
5053 else
5054 case "$ccflags" in
5055 *$check*)
5056 echo "Leaving current flags $ccflags alone." 2>&1
5057 ;;
5058 *) dflt="$dflt $flag";
5059 eval $callback
5060 ;;
5061 esac
5062 fi
c34316b3
NC
5063else
5064 echo "Nope, it does not, but that is ok." 2>&1;
5065fi
5066'
5067
bd9b35c9
JH
5068: We will not override a previous value, but we might want to
5069: augment a hint file
5070case "$hint" in
5071default|recommended)
5072 case "$gccversion" in
eaf812ae 5073 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5074 esac
eaf812ae
MB
5075 case "$optimize:$DEBUGGING" in
5076 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5077 esac
bd9b35c9 5078 case "$gccversion" in
580e570e 5079 2*) if $test -d /etc/conf/kconfig.d &&
bd9b35c9
JH
5080 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5081 then
00e89ad4 5082 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5083 dflt="$dflt -posix"
5084 fi
f0d04425 5085 ;;
bd9b35c9
JH
5086 esac
5087 case "$gccversion" in
5088 1*) ;;
5089 2.[0-8]*) ;;
c0bacbef 5090 ?*) set strict-aliasing -fno-strict-aliasing
c34316b3 5091 eval $checkccflag
f0d04425 5092 ;;
e5e20432 5093 esac
00e89ad4
AD
5094 # For gcc, adding -pipe speeds up compilations for some, but apparently
5095 # some assemblers can't read from stdin. (It also slows down compilations
5096 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5097 case "$gccversion" in
c34316b3
NC
5098 ?*) set pipe -pipe
5099 eval $checkccflag
00e89ad4
AD
5100 ;;
5101 esac
6682be1c
NC
5102
5103 # on x86_64 (at least) we require an extra library (libssp) in the
5104 # link command line. This library is not named, so I infer that it is
5105 # an implementation detail that may change. Hence the safest approach
5106 # is to add the flag to the flags passed to the compiler at link time,
5107 # as that way the compiler can do the right implementation dependant
5108 # thing. (NWC)
5109 case "$gccversion" in
8f68b0e6 5110 ?*) set stack-protector -fstack-protector
6682be1c
NC
5111 eval $checkccflag
5112 ;;
5113 esac
e5e20432
JH
5114 ;;
5115esac
5116
bd9b35c9
JH
5117case "$mips_type" in
5118*BSD*|'') inclwanted="$locincpth $usrinc";;
5119*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5120esac
5121for thisincl in $inclwanted; do
5122 if $test -d $thisincl; then
5123 if $test x$thisincl != x$usrinc; then
5124 case "$dflt" in
00e89ad4
AD
5125 *" -I$thisincl "*);;
5126 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5127 esac
5128 fi
5129 fi
5130done
40a7a20a 5131
bd9b35c9
JH
5132inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5133 xxx=true;
5134elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5135 xxx=true;
5136else
5137 xxx=false;
5138fi;
5139if $xxx; then
5140 case "$dflt" in
5141 *$2*);;
5142 *) dflt="$dflt -D$2";;
5143 esac;
5144fi'
40a7a20a 5145
bd9b35c9 5146set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5147
bd9b35c9
JH
5148case "$usesocks" in
5149$define)
5150 ccflags="$ccflags -DSOCKS"
5151 ;;
5152esac
40a7a20a 5153
bd9b35c9
JH
5154case "$hint" in
5155default|recommended) dflt="$ccflags $dflt" ;;
5156*) dflt="$ccflags";;
5157esac
40a7a20a 5158
bd9b35c9
JH
5159case "$dflt" in
5160''|' ') dflt=none;;
5161esac
422af00a 5162
bd9b35c9 5163$cat <<EOH
40a7a20a 5164
bd9b35c9
JH
5165Your C compiler may want other flags. For this question you should include
5166-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5167but you should NOT include libraries or ld flags like -lwhatever. If you
5168want $package to honor its debug switch, you should include -DDEBUGGING here.
5169Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5170
bd9b35c9 5171To use no flags, specify the word "none".
40a7a20a 5172
bd9b35c9
JH
5173EOH
5174set X $dflt
5175shift
5176dflt=${1+"$@"}
5177rp="Any additional cc flags?"
5178. ./myread
5179case "$ans" in
5180none) ccflags='';;
5181*) ccflags="$ans";;
5182esac
8e07c86e 5183
bd9b35c9 5184: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5185case "$cppflags" in
5186'') cppflags="$ccflags" ;;
5187*) cppflags="$cppflags $ccflags" ;;
5188esac
bd9b35c9
JH
5189case "$gccversion" in
51901*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5191esac
bd9b35c9
JH
5192case "$mips_type" in
5193'');;
5194*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5195esac
5196case "$cppflags" in
5197'');;
5198*)
5199 echo " "
5200 echo "Let me guess what the preprocessor flags are..." >&4
5201 set X $cppflags
5202 shift
5203 cppflags=''
5204 $cat >cpp.c <<'EOM'
5205#define BLURFL foo
8e07c86e 5206
bd9b35c9
JH
5207BLURFL xx LFRULB
5208EOM
5209 previous=''
5210 for flag in $*
5211 do
5212 case "$flag" in
5213 -*) ftry="$flag";;
5214 *) ftry="$previous $flag";;
5215 esac
5216 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5217 >cpp1.out 2>/dev/null && \
5218 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5219 >cpp2.out 2>/dev/null && \
5220 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5221 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5222 then
5223 cppflags="$cppflags $ftry"
5224 previous=''
5225 else
5226 previous="$flag"
5227 fi
5228 done
5229 set X $cppflags
5230 shift
5231 cppflags=${1+"$@"}
5232 case "$cppflags" in
5233 *-*) echo "They appear to be: $cppflags";;
5234 esac
5235 $rm -f cpp.c cpp?.out
2afac517 5236 ;;
5237esac
8e07c86e 5238
bd9b35c9
JH
5239: flags used in final linking phase
5240case "$ldflags" in
5241'') if ./venix; then
5242 dflt='-i -z'
10a23457 5243 else
bd9b35c9 5244 dflt=''
10a23457 5245 fi
bd9b35c9
JH
5246 case "$ccflags" in
5247 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5248 esac
bd9b35c9
JH
5249 ;;
5250*) dflt="$ldflags";;
5251esac
b2f871ed
AD
5252# See note above about -fstack-protector
5253case "$ccflags" in
5254*-fstack-protector*)
5255 case "$dflt" in
5256 *-fstack-protector*) ;; # Don't add it again
5257 *) dflt="$dflt -fstack-protector" ;;
5258 esac
5259 ;;
5260esac
bd9b35c9
JH
5261
5262: Try to guess additional flags to pick up local libraries.
5263for thislibdir in $libpth; do
5264 case " $loclibpth " in
5265 *" $thislibdir "*)
00e89ad4 5266 case "$dflt " in
bd9b35c9
JH
5267 *"-L$thislibdir "*) ;;
5268 *) dflt="$dflt -L$thislibdir" ;;
5269 esac
c4f23d77
AD
5270 ;;
5271 esac
bd9b35c9 5272done
c4f23d77 5273
bd9b35c9
JH
5274case "$dflt" in
5275'') dflt='none' ;;
5276esac
c4f23d77 5277
bd9b35c9
JH
5278$cat <<EOH
5279
5280Your C linker may need flags. For this question you should
5281include -L/whatever and any other flags used by the C linker, but you
5282should NOT include libraries like -lwhatever.
5283
5284Make sure you include the appropriate -L/path flags if your C linker
5285does not normally search all of the directories you specified above,
5286namely
5287 $libpth
5288To use no flags, specify the word "none".
5289
5290EOH
5291
5292rp="Any additional ld flags (NOT including libraries)?"
5293. ./myread
5294case "$ans" in
5295none) ldflags='';;
5296*) ldflags="$ans";;
5297esac
5298rmlist="$rmlist pdp11"
5299
5300: coherency check
5301echo " "
5302echo "Checking your choice of C compiler and flags for coherency..." >&4
5303$cat > try.c <<'EOF'
5304#include <stdio.h>
55954f19 5305int main() { printf("Ok\n"); return(0); }
bd9b35c9 5306EOF
7a282f6d 5307set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5308shift
5309$cat >try.msg <<'EOM'
5310I've tried to compile and run the following simple program:
5311
5312EOM
5313$cat try.c >> try.msg
5314
5315$cat >> try.msg <<EOM
5316
5317I used the command:
5318
5319 $*
5440bc8e 5320 $run ./try
bd9b35c9
JH
5321
5322and I got the following output:
5323
5324EOM
5325dflt=y
73614538 5326if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
613d6c3e 5327 if $sh -c "$run ./try " >>try.msg 2>&1; then
5440bc8e 5328 xxx=`$run ./try`
bd9b35c9
JH
5329 case "$xxx" in
5330 "Ok") dflt=n ;;
5331 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5332 case " $libs " in
5333 *" -lsfio "*)
5334 cat >> try.msg <<'EOQS'
5335If $libs contains -lsfio, and sfio is mis-configured, then it
5336sometimes (apparently) runs and exits with a 0 status, but with no
5337output! It may have to do with sfio's use of _exit vs. exit.
5338
5339EOQS
5340 rp="You have a big problem. Shall I abort Configure"
5341 dflt=y
5342 ;;
5343 esac
5344 ;;
5345 esac
5346 else
5347 echo "The program compiled OK, but exited with status $?." >>try.msg
5348 rp="You have a problem. Shall I abort Configure"
5349 dflt=y
5350 fi
5351else
5352 echo "I can't compile the test program." >>try.msg
5353 rp="You have a BIG problem. Shall I abort Configure"
5354 dflt=y
5355fi
5356case "$dflt" in
5357y)
5358 $cat try.msg >&4
5359 case "$knowitall" in
5360 '')
5361 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5362 ;;
bd9b35c9 5363 *) dflt=n;;
c4f23d77 5364 esac
bd9b35c9
JH
5365 echo " "
5366 . ./myread
5367 case "$ans" in
5368 n*|N*) ;;
5369 *) echo "Ok. Stopping Configure." >&4
5370 exit 1
c4f23d77
AD
5371 ;;
5372 esac
5373 ;;
bd9b35c9 5374n) echo "OK, that should do.";;
c4f23d77 5375esac
613d6c3e 5376$rm_try gcctest gcctest.out
c4f23d77 5377
bd9b35c9
JH
5378: define a shorthand compile call
5379compile='
5380mc_file=$1;
5381shift;
08593cf4
NC
5382case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5383echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5384exit 1;
5385fi;
5386esac;
08413ebc 5387$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5388: define a shorthand compile call for compilations that should be ok.
5389compile_ok='
5390mc_file=$1;
5391shift;
7a282f6d 5392$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5393
8dfa8df9
JH
5394: determine filename position in cpp output
5395echo " "
5396echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5397case "$osname" in
5398vos) testaccess=-e ;;
5399*) testaccess=-r ;;
5400esac
8dfa8df9
JH
5401echo '#include <stdio.h>' > foo.c
5402$cat >fieldn <<EOF
5403$startsh
5404$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5405$grep '^[ ]*#.*stdio\.h' | \
5406while read cline; do
5407 pos=1
5408 set \$cline
5409 while $test \$# -gt 0; do
a5a94ea5 5410 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5411 echo "\$pos"
5412 exit 0
5413 fi
5414 shift
5415 pos=\`expr \$pos + 1\`
5416 done
5417done
5418EOF
5419chmod +x fieldn
5420fieldn=`./fieldn`
5421$rm -f foo.c fieldn
5422case $fieldn in
5423'') pos='???';;
54241) pos=first;;
54252) pos=second;;
54263) pos=third;;
5427*) pos="${fieldn}th";;
5428esac
5429echo "Your cpp writes the filename in the $pos field of the line."
5430
3c728e00
JH
5431case "$osname" in
5432vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5433os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5434*) cppfilter='' ;;
5435esac
8dfa8df9
JH
5436: locate header file
5437$cat >findhdr <<EOF
5438$startsh
5439wanted=\$1
5440name=''
5441for usrincdir in $usrinc
5442do
5443 if test -f \$usrincdir/\$wanted; then
5444 echo "\$usrincdir/\$wanted"
5445 exit 0
5446 fi
5447done
5448awkprg='{ print \$$fieldn }'
5449echo "#include <\$wanted>" > foo\$\$.c
5450$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5451$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5452while read cline; do
5453 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5454 case "\$name" in
5455 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5456 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5457 *) exit 2;;
5458 esac;
5459done;
5460#
5461# status = 0: grep returned 0 lines, case statement not executed
5462# status = 1: headerfile found
5463# status = 2: while loop executed, no headerfile found
5464#
5465status=\$?
5466$rm -f foo\$\$.c;
5467if test \$status -eq 1; then
5468 exit 0;
5469fi
5470exit 1
5471EOF
5472chmod +x findhdr
5473
5474: define an alternate in-header-list? function
5475inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5476cont=true; xxf="echo \"<\$1> found.\" >&4";
5477case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5478*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5479esac;
5480case $# in 4) instead=instead;; *) instead="at last";; esac;
5481while $test "$cont"; do
5482 xxx=`./findhdr $1`
5483 var=$2; eval "was=\$$2";
5484 if $test "$xxx" && $test -r "$xxx";
5485 then eval $xxf;
5486 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5487 cont="";
5488 else eval $xxnf;
5489 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5490 set $yyy; shift; shift; yyy=$@;
5491 case $# in 0) cont="";;
5492 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5493 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5494 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5495 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5496 esac;
5497done;
5498while $test "$yyy";
5499do set $yyy; var=$2; eval "was=\$$2";
5500 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5501 set $yyy; shift; shift; yyy=$@;
5502done'
5503
d1daaddf
JH
5504: see if stdlib is available
5505set stdlib.h i_stdlib
5506eval $inhdr
5507
5508: check for lengths of integral types
5509echo " "
5510case "$intsize" in
5511'')
5512 echo "Checking to see how big your integers are..." >&4
c63dfae1 5513 $cat >try.c <<EOCP
d1daaddf
JH
5514#include <stdio.h>
5515#$i_stdlib I_STDLIB
5516#ifdef I_STDLIB
5517#include <stdlib.h>
5518#endif
5519int main()
5520{
5521 printf("intsize=%d;\n", (int)sizeof(int));
5522 printf("longsize=%d;\n", (int)sizeof(long));
5523 printf("shortsize=%d;\n", (int)sizeof(short));
5524 exit(0);
5525}
5526EOCP
5527 set try
5528 if eval $compile_ok && $run ./try > /dev/null; then
5529 eval `$run ./try`
5530 echo "Your integers are $intsize bytes long."
5531 echo "Your long integers are $longsize bytes long."
5532 echo "Your short integers are $shortsize bytes long."
5533 else
5534 $cat >&4 <<EOM
5535!
5536Help! I can't compile and run the intsize test program: please enlighten me!
5537(This is probably a misconfiguration in your system or libraries, and
5538you really ought to fix it. Still, I'll try anyway.)
5539!
5540EOM
5541 dflt=4
5542 rp="What is the size of an integer (in bytes)?"
5543 . ./myread
5544 intsize="$ans"
5545 dflt=$intsize
5546 rp="What is the size of a long integer (in bytes)?"
5547 . ./myread
5548 longsize="$ans"
5549 dflt=2
5550 rp="What is the size of a short integer (in bytes)?"
5551 . ./myread
5552 shortsize="$ans"
5553 fi
5554 ;;
5555esac
5b813a60 5556$rm_try
d1daaddf
JH
5557
5558: check for long long
5559echo " "
5560echo "Checking to see if you have long long..." >&4
5561echo 'int main() { long long x = 7; return 0; }' > try.c
5562set try
5563if eval $compile; then
5564 val="$define"
5565 echo "You have long long."
5566else
5567 val="$undef"
5568 echo "You do not have long long."
5569fi
5b813a60 5570$rm_try
d1daaddf
JH
5571set d_longlong
5572eval $setvar
5573
5574: check for length of long long
5575case "${d_longlong}${longlongsize}" in
5576$define)
5577 echo " "
5578 echo "Checking to see how big your long longs are..." >&4
5579 $cat >try.c <<'EOCP'
5580#include <stdio.h>
5581int main()
5582{
5583 printf("%d\n", (int)sizeof(long long));
5584 return(0);
5585}
5586EOCP
5587 set try
5588 if eval $compile_ok; then
5589 longlongsize=`$run ./try`
5590 echo "Your long longs are $longlongsize bytes long."
5591 else
5592 dflt='8'
5593 echo " "
5594 echo "(I can't seem to compile the test program. Guessing...)"
5595 rp="What is the size of a long long (in bytes)?"
5596 . ./myread
5597 longlongsize="$ans"
5598 fi
5599 if $test "X$longsize" = "X$longlongsize"; then
5600 echo "(That isn't any different from an ordinary long.)"
5b813a60 5601 fi
d1daaddf
JH
5602 ;;
5603esac
5b813a60 5604$rm_try
d1daaddf 5605
8dfa8df9
JH
5606: see if inttypes.h is available
5607: we want a real compile instead of Inhdr because some systems
5608: have an inttypes.h which includes non-existent headers
5609echo " "
5610$cat >try.c <<EOCP
5611#include <inttypes.h>
5612int main() {
5613 static int32_t foo32 = 0x12345678;
5614}
5615EOCP
5616set try
5617if eval $compile; then
5618 echo "<inttypes.h> found." >&4
5619 val="$define"
5620else
5621 echo "<inttypes.h> NOT found." >&4
5622 val="$undef"
5623fi
5b813a60 5624$rm_try
8dfa8df9
JH
5625set i_inttypes
5626eval $setvar
5627
5628: check for int64_t
5629echo " "
5630echo "Checking to see if you have int64_t..." >&4
5631$cat >try.c <<EOCP
5632#include <sys/types.h>
5633#$i_inttypes I_INTTYPES
5634#ifdef I_INTTYPES
5635#include <inttypes.h>
5636#endif
5637int main() { int64_t x = 7; }
5638EOCP
5639set try
5640if eval $compile; then
5641 val="$define"
5642 echo "You have int64_t."
5643else
5644 val="$undef"
5645 echo "You do not have int64_t."
5646fi
5b813a60 5647$rm_try
8dfa8df9
JH
5648set d_int64_t
5649eval $setvar
5650
613d6c3e 5651: Check if 64bit ints have a quad type
8dfa8df9
JH
5652echo " "
5653echo "Checking which 64-bit integer type we could use..." >&4
5654
5655case "$intsize" in
56568) val=int
5657 set quadtype
5658 eval $setvar
5659 val='"unsigned int"'
5660 set uquadtype
5661 eval $setvar
5662 quadkind=1
5663 ;;
5664*) case "$longsize" in
5665 8) val=long
5666 set quadtype
5667 eval $setvar
5668 val='"unsigned long"'
5669 set uquadtype
5670 eval $setvar
5671 quadkind=2
5672 ;;
5673 *) case "$d_longlong:$longlongsize" in
5674 define:8)
5675 val='"long long"'
5676 set quadtype
5677 eval $setvar
5678 val='"unsigned long long"'
5679 set uquadtype
5680 eval $setvar
5681 quadkind=3
5682 ;;
5683 *) case "$d_int64_t" in
5684 define)
5685 val=int64_t
5686 set quadtype
5687 eval $setvar
5688 val=uint64_t
5689 set uquadtype
5690 eval $setvar
5691 quadkind=4
5692 ;;
5693 esac
5694 ;;
5695 esac
5696 ;;
5697 esac
5698 ;;
5699esac
5700
5701case "$quadtype" in
5702'') echo "Alas, no 64-bit integer types in sight." >&4
5703 d_quad="$undef"
5704 ;;
5705*) echo "We could use '$quadtype' for 64-bit integers." >&4
5706 d_quad="$define"
5707 ;;
5708esac
5709
34f1896b 5710: Do we want 64bit support
b4eb6b3d
JH
5711case "$uselonglong" in
5712"$define"|true|[yY]*)
5713 cat <<EOM >&4
5714
5715*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5716EOM
5717 use64bitint="$define"
5718 ;;
613d6c3e 5719esac
b4eb6b3d
JH
5720case "$use64bits" in
5721"$define"|true|[yY]*)
5722 cat <<EOM >&4
5723
5724*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5725EOM
5726 use64bitint="$define"
5727 ;;
613d6c3e 5728esac
b4eb6b3d
JH
5729case "$use64bitints" in
5730"$define"|true|[yY]*)
5731 cat <<EOM >&4
5732
5733*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5734EOM
5735 use64bitint="$define"
5736 ;;
613d6c3e 5737esac
b4eb6b3d
JH
5738case "$use64bitsint" in
5739"$define"|true|[yY]*)
5740 cat <<EOM >&4
5741
5742*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5743EOM
5744 use64bitint="$define"
5745 ;;
613d6c3e 5746esac
b4eb6b3d
JH
5747case "$uselonglongs" in
5748"$define"|true|[yY]*)
5749 cat <<EOM >&4
5750
5751*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5752EOM
5753 use64bitint="$define"
5754 ;;
613d6c3e 5755esac
b4eb6b3d
JH
5756case "$use64bitsall" in
5757"$define"|true|[yY]*)
5758 cat <<EOM >&4
5759
5760*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5761EOM
5762 use64bitall="$define"
5763 ;;
613d6c3e 5764esac
b4eb6b3d
JH
5765
5766case "$ccflags" in
5767*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5768esac
5769case "$use64bitall" in
5770"$define"|true|[yY]*) use64bitint="$define" ;;
5771esac
5772
5773case "$longsize" in
57748) cat <<EOM
5775
5776You have natively 64-bit long integers.
5777EOM
5778 val="$define"
5779 ;;
5780*) case "$use64bitint" in
5781 "$define"|true|[yY]*) dflt='y';;
5782 *) dflt='n';;
5783 esac
8dfa8df9
JH
5784 case "$d_quad" in
5785 "$define") ;;
5786 *) dflt='n' ;;
5787 esac
b4eb6b3d
JH
5788 cat <<EOM
5789
5790Perl can be built to take advantage of 64-bit integer types
5791on some systems. To do so, Configure can be run with -Duse64bitint.
5792Choosing this option will most probably introduce binary incompatibilities.
5793
5794If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5795(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5796EOM
5797 rp='Try to use 64-bit integers, if available?'
5798 . ./myread
5799 case "$ans" in
5800 [yY]*) val="$define" ;;
5801 *) val="$undef" ;;
5802 esac
5803 ;;
5804esac
5805set use64bitint
5806eval $setvar
5807
5808case "$use64bitall" in
5809"$define"|true|[yY]*) dflt='y' ;;
5810*) case "$longsize" in
5811 8) dflt='y' ;;
5812 *) dflt='n' ;;
5813 esac
5814 ;;
613d6c3e 5815esac
b4eb6b3d
JH
5816cat <<EOM
5817
5818You may also choose to try maximal 64-bitness. It means using as much
581964-bitness as possible on the platform. This in turn means even more
5820binary incompatibilities. On the other hand, your platform may not
5821have any more 64-bitness available than what you already have chosen.
5822
5823If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5824(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5825EOM
5826rp='Try to use maximal 64-bit support, if available?'
5827. ./myread
5828case "$ans" in
5829[yY]*) val="$define" ;;
5830*) val="$undef" ;;
5831esac
5832set use64bitall
5833eval $setvar
5834case "$use64bitall" in
5835"$define")
5836 case "$use64bitint" in
5837 "$undef")
5838 cat <<EOM
5839
5840Since you have chosen a maximally 64-bit build, I'm also turning on
5841the use of 64-bit integers.
5842EOM
5843 use64bitint="$define" ;;
5844 esac
5845 ;;
5846esac
5847
b4eb6b3d
JH
5848: Look for a hint-file generated 'call-back-unit'. If the
5849: user has specified that a 64-bit perl is to be built,
5850: we may need to set or change some other defaults.
19a100ff 5851if $test -f use64bitint.cbu; then
9da7673b 5852 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5853 . ./use64bitint.cbu
5854fi
9da7673b
MB
5855case "$use64bitint" in
5856"$define"|true|[yY]*)
b4eb6b3d
JH
5857 case "$longsize" in
5858 4) case "$archname64" in
5859 '') archname64=64int ;;
5860 esac
5861 ;;
5862 esac
5863 ;;
5864esac
5865
b4eb6b3d
JH
5866: Look for a hint-file generated 'call-back-unit'. If the
5867: user has specified that a maximally 64-bit perl is to be built,
5868: we may need to set or change some other defaults.
19a100ff 5869if $test -f use64bitall.cbu; then
9da7673b 5870 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5871 . ./use64bitall.cbu
5872fi
9da7673b
MB
5873case "$use64bitall" in
5874"$define"|true|[yY]*)
b4eb6b3d
JH
5875 case "$longsize" in
5876 4) case "$archname64" in
5877 ''|64int) archname64=64all ;;
5878 esac
5879 ;;
5880 esac
5881 ;;
5882esac
5883
1911a026
JH
5884case "$d_quad:$use64bitint" in
5885$undef:$define)
5886 cat >&4 <<EOF
5887
5888*** You have chosen to use 64-bit integers,
19a100ff 5889*** but none can be found.
09b58c7b 5890*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5891*** Cannot continue, aborting.
5892
5893EOF
5894 exit 1
5895 ;;
5896esac
5897
36adc09b
JH
5898: check for length of double
5899echo " "
5900case "$doublesize" in
5901'')
5902 echo "Checking to see how big your double precision numbers are..." >&4
5903 $cat >try.c <<EOCP
5904#include <stdio.h>
1911a026
JH
5905#$i_stdlib I_STDLIB
5906#ifdef I_STDLIB
5907#include <stdlib.h>
5908#endif
36adc09b
JH
5909int main()
5910{
5911 printf("%d\n", (int)sizeof(double));
1911a026 5912 exit(0);
36adc09b
JH
5913}
5914EOCP
5915 set try
5916 if eval $compile_ok; then
5917 doublesize=`$run ./try`
5918 echo "Your double is $doublesize bytes long."
5919 else
5920 dflt='8'
5921 echo "(I can't seem to compile the test program. Guessing...)"
5922 rp="What is the size of a double precision number (in bytes)?"
5923 . ./myread
5924 doublesize="$ans"
5925 fi
5926 ;;
5927esac
5b813a60 5928$rm_try
36adc09b
JH
5929
5930: check for long doubles
5931echo " "
5932echo "Checking to see if you have long double..." >&4
5933echo 'int main() { long double x = 7.0; }' > try.c
5934set try
5935if eval $compile; then
5936 val="$define"
5937 echo "You have long double."
5938else
5939 val="$undef"
5940 echo "You do not have long double."
5941fi
5b813a60 5942$rm_try
36adc09b
JH
5943set d_longdbl
5944eval $setvar
5945
5946: check for length of long double
5947case "${d_longdbl}${longdblsize}" in
5948$define)
5949 echo " "
5950 echo "Checking to see how big your long doubles are..." >&4
5951 $cat >try.c <<'EOCP'
5952#include <stdio.h>
5953int main()
5954{
5955 printf("%d\n", sizeof(long double));
5956}
5957EOCP
5958 set try
5959 set try
5960 if eval $compile; then
5961 longdblsize=`$run ./try`
5962 echo "Your long doubles are $longdblsize bytes long."
5963 else
5964 dflt='8'
5965 echo " "
5966 echo "(I can't seem to compile the test program. Guessing...)" >&4
5967 rp="What is the size of a long double (in bytes)?"
5968 . ./myread
5969 longdblsize="$ans"
5970 fi
5971 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5972 echo "That isn't any different from an ordinary double."
5973 echo "I'll keep your setting anyway, but you may see some"
5974 echo "harmless compilation warnings."
5b813a60 5975 fi
36adc09b
JH
5976 ;;
5977esac
5b813a60 5978$rm_try
36adc09b 5979
89ce900e 5980: determine the architecture name
b4eb6b3d 5981echo " "
89ce900e
JH
5982if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5983 tarch=`arch`"-$osname"
5984elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5985 if uname -m > tmparch 2>&1 ; then
5986 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5987 -e 's/$/'"-$osname/" tmparch`
5988 else
5989 tarch="$osname"
5990 fi
5991 $rm -f tmparch
b4eb6b3d 5992else
89ce900e 5993 tarch="$osname"
b4eb6b3d 5994fi
89ce900e
JH
5995case "$myarchname" in
5996''|"$tarch") ;;
5997*)
5998 echo "(Your architecture name used to be $myarchname.)"
5999 archname=''
6000 ;;
6001esac
6002case "$targetarch" in
6003'') ;;
6004*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6005esac
6006myarchname="$tarch"
6007case "$archname" in
6008'') dflt="$tarch";;
6009*) dflt="$archname";;
6010esac
6011rp='What is your architecture name'
6012. ./myread
6013archname="$ans"
6014case "$usethreads" in
6015$define)
6016 echo "Threads selected." >&4
6017 case "$archname" in
6018 *-thread*) echo "...and architecture name already has -thread." >&4
6019 ;;
6020 *) archname="$archname-thread"
6021 echo "...setting architecture name to $archname." >&4
6022 ;;
6023 esac
6024 ;;
6025esac
6026case "$usemultiplicity" in
6027$define)
6028 echo "Multiplicity selected." >&4
6029 case "$archname" in
6030 *-multi*) echo "...and architecture name already has -multi." >&4
6031 ;;
6032 *) archname="$archname-multi"
6033 echo "...setting architecture name to $archname." >&4
6034 ;;
6035 esac
6036 ;;
6037esac
6038case "$use64bitint$use64bitall" in
6039*"$define"*)
6040 case "$archname64" in
6041 '')
6042 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6043 ;;
89ce900e
JH
6044 *)
6045 case "$use64bitint" in
6046 "$define") echo "64 bit integers selected." >&4 ;;
6047 esac
6048 case "$use64bitall" in
6049 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6050 esac
6051 case "$archname" in
6052 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6053 ;;
6054 *) archname="$archname-$archname64"
6055 echo "...setting architecture name to $archname." >&4
6056 ;;
6057 esac
c1a7f87b
JH
6058 ;;
6059 esac
89ce900e
JH
6060esac
6061case "$uselongdouble" in
6062$define)
6063 echo "Long doubles selected." >&4
6064 case "$longdblsize" in
6065 $doublesize)
6066 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6067 ;;
6068 *)
6069 case "$archname" in
6070 *-ld*) echo "...and architecture name already has -ld." >&4
6071 ;;
6072 *) archname="$archname-ld"
6073 echo "...setting architecture name to $archname." >&4
6074 ;;
6075 esac
bd9b35c9
JH
6076 ;;
6077 esac
bd9b35c9 6078 ;;
89ce900e 6079esac
d2e0c6f7
JH
6080if $test -f archname.cbu; then
6081 echo "Your platform has some specific hints for architecture name, using them..."
6082 . ./archname.cbu
6083fi
bd9b35c9 6084
b4eb6b3d
JH
6085: set the prefixit variable, to compute a suitable default value
6086prefixit='case "$3" in
6087""|none)
6088 case "$oldprefix" in
6089 "") eval "$1=\"\$$2\"";;
6090 *)
6091 case "$3" in
6092 "") eval "$1=";;
6093 none)
6094 eval "tp=\"\$$2\"";
6095 case "$tp" in
6096 ""|" ") eval "$1=\"\$$2\"";;
6097 *) eval "$1=";;
6098 esac;;
6099 esac;;
6100 esac;;
6101*)
6102 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6103 case "$tp" in
6104 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6105 /*-$oldprefix/*|\~*-$oldprefix/*)
6106 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6107 *) eval "$1=\"\$$2\"";;
6108 esac;;
6109esac'
6110
f3f1a2d8
MB
6111: determine installation style
6112: For now, try to deduce it from prefix unless it is already set.
6113: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6114case "$installstyle" in
6115'') case "$prefix" in
6116 *perl*) dflt='lib';;
6117 *) dflt='lib/perl5' ;;
6118 esac
6119 ;;
6120*) dflt="$installstyle" ;;
4d20abad 6121esac
f3f1a2d8
MB
6122: Probably not worth prompting for this since we prompt for all
6123: the directories individually, and the prompt would be too long and
6124: confusing anyway.
6125installstyle=$dflt
4d20abad 6126
eaf812ae
MB
6127: determine where public executables go
6128echo " "
6129set dflt bin bin
6130eval $prefixit
6131fn=d~
6132rp='Pathname where the public executables will reside?'
6133. ./getfile
6134if $test "X$ansexp" != "X$binexp"; then
6135 installbin=''
6136fi
6137prefixvar=bin
6138: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6139: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6140: this via initialinstalllocation
eaf812ae
MB
6141. ./setprefixvar
6142
6143case "$userelocatableinc" in
6144$define|true|[yY]*) dflt='y' ;;
6145*) dflt='n' ;;
6146esac
6147cat <<EOM
6148
6149Would you like to build Perl so that the installation is relocatable, so that
6150library paths in @INC are determined relative to the path of the perl binary?
6151This is not advised for system Perl installs, or if you need to run setid
6152scripts or scripts under taint mode.
6153
6154If this doesn't make any sense to you, just accept the default '$dflt'.
6155EOM
6156rp='Use relocatable @INC?'
6157. ./myread
6158case "$ans" in
6159y|Y) val="$define" ;;
6160*) val="$undef" ;;
6161esac
6162set userelocatableinc
6163eval $setvar
6164
ea7d701d 6165initialinstalllocation="$binexp"
eaf812ae
MB
6166: Default prefix is now "up one level from where the binaries are"
6167case "$userelocatableinc" in
6168$define|true|[yY]*)
eaf812ae
MB
6169 bin=".../"
6170 binexp=".../"
6171 prefix=".../.."
6172 prefixexp=".../.."
6173 installprefixexp=".../.."
6174 ;;
6175esac
6176
b4eb6b3d
JH
6177: determine where private library files go
6178: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6179: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6180: /opt/perl/lib/perl5... would be redundant.
6181: The default "style" setting is made in installstyle.U
6182case "$installstyle" in
6183*lib/perl5*) set dflt privlib lib/$package/$version ;;
6184*) set dflt privlib lib/$version ;;
6185esac
6186eval $prefixit
6187$cat <<EOM
6188
6189There are some auxiliary files for $package that need to be put into a
6190private library directory that is accessible by everyone.
6191
6192EOM
eaf812ae 6193fn=$binexp
b4eb6b3d
JH
6194fn=d~+
6195rp='Pathname where the private library files will reside?'
6196. ./getfile
79522dd2
NC
6197prefixvar=privlib
6198. ./setprefixvar
b4eb6b3d
JH
6199
6200: set the prefixup variable, to restore leading tilda escape
6201prefixup='case "$prefixexp" in
6202"$prefix") ;;
6203*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6204esac'
6205
6206: determine where public architecture dependent libraries go
6207set archlib archlib
6208eval $prefixit
6209: privlib default is /usr/local/lib/$package/$version
6210: archlib default is /usr/local/lib/$package/$version/$archname
6211: privlib may have an optional trailing /share.
6212tdflt=`echo $privlib | $sed 's,/share$,,'`
6213tdflt=$tdflt/$archname
6214case "$archlib" in
6215'') dflt=$tdflt
6216 ;;
6217*) dflt="$archlib"
6218 ;;
6219esac
6220$cat <<EOM
6221
6222$spackage contains architecture-dependent library files. If you are
6223sharing libraries in a heterogeneous environment, you might store
6224these files in a separate location. Otherwise, you can just include
6225them with the rest of the public library files.
6226
6227EOM
eaf812ae 6228fn=$binexp
b4eb6b3d
JH
6229fn=d+~
6230rp='Where do you want to put the public architecture-dependent libraries?'
6231. ./getfile
79522dd2
NC
6232prefixvar=archlib
6233. ./setprefixvar
b4eb6b3d
JH
6234if $test X"$archlib" = X"$privlib"; then
6235 d_archlib="$undef"
6236else
6237 d_archlib="$define"
6238fi
b4eb6b3d 6239
b4eb6b3d
JH
6240: see if setuid scripts can be secure
6241$cat <<EOM
6242
6243Some kernels have a bug that prevents setuid #! scripts from being
6244secure. Some sites have disabled setuid #! scripts because of this.
6245
6246First let's decide if your kernel supports secure setuid #! scripts.
6247(If setuid #! scripts would be secure but have been disabled anyway,
6248don't say that they are secure if asked.)
6249
6250EOM
6251
6252val="$undef"
6253if $test -d /dev/fd; then
6254 echo "#!$ls" >reflect
6255 chmod +x,u+s reflect
6256 ./reflect >flect 2>&1
6257 if $contains "/dev/fd" flect >/dev/null; then
6258 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6259 val="$define"
6260 else
6261 $cat <<EOM
6262If you are not sure if they are secure, I can check but I'll need a
6263username and password different from the one you are using right now.
6264If you don't have such a username or don't want me to test, simply
6265enter 'none'.
6266
6267EOM
6268 rp='Other username to test security of setuid scripts with?'
6269 dflt='none'
6270 . ./myread
6271 case "$ans" in
6272 n|none)
6273 case "$d_suidsafe" in
6274 '') echo "I'll assume setuid scripts are *not* secure." >&4
6275 dflt=n;;
6276 "$undef")
6277 echo "Well, the $hint value is *not* secure." >&4
6278 dflt=n;;
6279 *) echo "Well, the $hint value *is* secure." >&4
6280 dflt=y;;
6281 esac
c1a7f87b 6282 ;;
b4eb6b3d
JH
6283 *)
6284 $rm -f reflect flect
6285 echo "#!$ls" >reflect
6286 chmod +x,u+s reflect
6287 echo >flect
6288 chmod a+w flect
6289 echo '"su" will (probably) prompt you for '"$ans's password."
6290 su $ans -c './reflect >flect'
6291 if $contains "/dev/fd" flect >/dev/null; then
6292 echo "Okay, it looks like setuid scripts are secure." >&4
6293 dflt=y
6294 else
6295 echo "I don't think setuid scripts are secure." >&4
6296 dflt=n
6297 fi
6298 ;;
6299 esac
6300 rp='Does your kernel have *secure* setuid scripts?'
6301 . ./myread
6302 case "$ans" in
6303 [yY]*) val="$define";;
6304 *) val="$undef";;
6305 esac
6306 fi
6307else
6308 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6309 echo "(That's for file descriptors, not floppy disks.)"
6310 val="$undef"
6311fi
6312set d_suidsafe
6313eval $setvar
6314
6315$rm -f reflect flect
6316
6317: now see if they want to do setuid emulation
01614441 6318if $test $patchlevel -lt 11; then
b4eb6b3d
JH
6319echo " "
6320val="$undef"
6321case "$d_suidsafe" in
6322"$define")
6323 val="$undef"
3c728e00 6324 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6325 ;;
f3f1a2d8
MB
6326*)
6327 $cat <<EOM
6328Some systems have disabled setuid scripts, especially systems where
6329setuid scripts cannot be secure. On systems where setuid scripts have
6330been disabled, the setuid/setgid bits on scripts are currently
6331useless. It is possible for $package to detect those bits and emulate
6332setuid/setgid in a secure fashion. This emulation will only work if
6333setuid scripts have been disabled in your kernel.
6334
6335EOM
6336 case "$d_dosuid" in
6337 "$define") dflt=y ;;
6338 *) dflt=n ;;
6339 esac
6340 rp="Do you want to do setuid/setgid emulation?"
6341 . ./myread
6342 case "$ans" in
6343 [yY]*) val="$define";;
6344 *) val="$undef";;
6345 esac
6346 ;;
6347esac
6348set d_dosuid
6349eval $setvar
01614441
MB
6350else
6351 case "$d_dosuid" in
6352 "$define")
6353 cat >&4 <<EOH
6354
6355SUID emulation has been removed for 5.12
6356Please re-run Configure without -Dd_dosuid
6357
6358EOH
6359 exit 1;
6360 ;;
6361 esac
6362 d_dosuid=undef
6363fi
f3f1a2d8 6364
f3f1a2d8
MB
6365: Find perl5.005 or later.
6366echo "Looking for a previously installed perl5.005 or later... "
6367case "$perl5" in
6368'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6369 : Check if this perl is recent and can load a simple module
6370 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6371 perl5=$tdir/perl
6372 break;
6373 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6374 perl5=$tdir/perl5
6375 break;
6376 fi
6377 done
6378 ;;
6379*) perl5="$perl5"
6380 ;;
6381esac
6382case "$perl5" in
6383'') echo "None found. That's ok.";;
6384*) echo "Using $perl5." ;;
6385esac
6386
613d6c3e 6387: Set the siteprefix variables
f3f1a2d8
MB
6388$cat <<EOM
6389
6390After $package is installed, you may wish to install various
6391add-on modules and utilities. Typically, these add-ons will
6392be installed under $prefix with the rest
6393of this package. However, you may wish to install such add-ons
6394elsewhere under a different prefix.
6395
6396If you do not wish to put everything under a single prefix, that's
6397ok. You will be prompted for the individual locations; this siteprefix
6398is only used to suggest the defaults.
6399
6400The default should be fine for most people.
6401
6402EOM
6403fn=d~+
6404rp='Installation prefix to use for add-on modules and utilities?'
6405: XXX Here might be another good place for an installstyle setting.
6406case "$siteprefix" in
6407'') dflt=$prefix ;;
6408*) dflt=$siteprefix ;;
6409esac
6410. ./getfile
6411: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6412oldsiteprefix=''
6413case "$siteprefix" in
6414'') ;;
6415*) case "$ans" in
6416 "$prefix") ;;
6417 *) oldsiteprefix="$prefix";;
6418 esac
6419 ;;
6420esac
6421siteprefix="$ans"
6422siteprefixexp="$ansexp"
6423
6424: determine where site specific libraries go.
6425: Usual default is /usr/local/lib/perl5/site_perl/$version
6426: The default "style" setting is made in installstyle.U
6427: XXX No longer works with Prefixit stuff.
6428prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6429case "$sitelib" in
6430'') case "$installstyle" in
6431 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6432 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6433 esac
6434 ;;
6435*) dflt="$sitelib"
6436 ;;
6437esac
6438$cat <<EOM
6439
6440The installation process will create a directory for
6441site-specific extensions and modules. Most users find it convenient
6442to place all site-specific files in this directory rather than in the
6443main distribution directory.
6444
6445EOM
6446fn=d~+
6447rp='Pathname for the site-specific library files?'
6448. ./getfile
6449prefixvar=sitelib
6450. ./setprefixvar
6451sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6452
6453: Determine list of previous versions to include in @INC
6454$cat > getverlist <<EOPL
6455#!$perl5 -w
6456use File::Basename;
6457\$api_versionstring = "$api_versionstring";
6458\$version = "$version";
6459\$stem = "$sitelib_stem";
6460\$archname = "$archname";
6461EOPL
6462 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6463# The list found is store twice for each entry: the original name, and
6464# the binary broken down version as pack "sss", so sorting is easy and
6465# unambiguous. This will work for all versions that have a maximum of
6466# three digit groups, separate by '.'s or '_'s. Names are extended with
6467# ".0.0" to ensure at least three elements for the pack.
6468# -- H.Merijn Brand (m)'06 23-10-2006
6469
f3f1a2d8
MB
6470# Can't have leading @ because metaconfig interprets it as a command!
6471;@inc_version_list=();
6472# XXX Redo to do opendir/readdir?
6473if (-d $stem) {
6474 chdir($stem);
13cfc98d
MB
6475 ;@candidates = map {
6476 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
a71f1801 6477 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
f3f1a2d8
MB
6478}
6479else {
6480 ;@candidates = ();
6481}
6482
13cfc98d
MB
6483($pversion, $aversion, $vsn5005) = map {
6484 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6485foreach $d (@candidates) {
13cfc98d
MB
6486 if ($d->[1] lt $pversion) {
6487 if ($d->[1] ge $aversion) {
6488 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6489 }
13cfc98d
MB
6490 elsif ($d->[1] ge $vsn5005) {
6491 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6492 }
6493 }
6494 else {
6495 # Skip newer version. I.e. don't look in
6496 # 5.7.0 if we're installing 5.6.1.
6497 }
6498}
6499
6500if (@inc_version_list) {
6501 print join(' ', @inc_version_list);
6502}
6503else {
6504 # Blank space to preserve value for next Configure run.
6505 print " ";
6506}
6507EOPL
6508chmod +x getverlist
6509case "$inc_version_list" in
6510'') if test -x "$perl5$exe_ext"; then
6511 dflt=`$perl5 getverlist`
6512 else
6513 dflt='none'
6514 fi
6515 ;;
6516$undef) dflt='none' ;;
6517*) eval dflt=\"$inc_version_list\" ;;
6518esac
6519case "$dflt" in
6520''|' ') dflt=none ;;
6521esac
6522case "$dflt" in
65235.005) dflt=none ;;
6524esac
6525$cat <<EOM
6526
6527In order to ease the process of upgrading, this version of perl
6528can be configured to use modules built and installed with earlier
6529versions of perl that were installed under $prefix. Specify here
6530the list of earlier versions that this version of perl should check.
6531If Configure detected no earlier versions of perl installed under
6532$prefix, then the list will be empty. Answer 'none' to tell perl
6533to not search earlier versions.
b4eb6b3d 6534
f3f1a2d8
MB
6535The default should almost always be sensible, so if you're not sure,
6536just accept the default.
b4eb6b3d 6537EOM
f3f1a2d8
MB
6538
6539rp='List of earlier versions to include in @INC?'
6540. ./myread
6541case "$ans" in
6542[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6543*) inc_version_list="$ans" ;;
6544esac
6545case "$inc_version_list" in
6546''|' ')
6547 inc_version_list_init='0'
6548 d_inc_version_list="$undef"
6549 ;;
6550*) inc_version_list_init=`echo $inc_version_list |
6551 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6552 d_inc_version_list="$define"
b4eb6b3d
JH
6553 ;;
6554esac
f3f1a2d8 6555$rm -f getverlist
b4eb6b3d 6556
1cd66f7c
DD
6557: see if malloc/malloc.h has to be included
6558set malloc/malloc.h i_mallocmalloc
6559eval $inhdr
6560
b4eb6b3d 6561: see if this is a malloc.h system
01d07975
YST
6562: we want a real compile instead of Inhdr because some systems have a
6563: malloc.h that just gives a compile error saying to use stdlib.h instead
6564echo " "
6565$cat >try.c <<EOCP
6566#include <stdlib.h>
6567#include <malloc.h>
f25eda10 6568#$i_mallocmalloc I_MALLOCMALLOC
1cd66f7c
DD
6569#ifdef I_MALLOCMALLOC
6570# include <malloc/malloc.h>
6571#endif
6572
01d07975
YST
6573int main () { return 0; }
6574EOCP
6575set try
6576if eval $compile; then
6577 echo "<malloc.h> found." >&4
6578 val="$define"
6579else
6580 echo "<malloc.h> NOT found." >&4
6581 val="$undef"
6582fi
5b813a60 6583$rm_try
01d07975
YST
6584set i_malloc
6585eval $setvar
b4eb6b3d 6586
c8b93cf9
JH
6587: check for void type
6588echo " "
6589echo "Checking to see how well your C compiler groks the void type..." >&4
6590case "$voidflags" in
6591'')
c727eafa 6592 $cat >try.c <<EOCP
d1daaddf
JH
6593#$i_stdlib I_STDLIB
6594#ifdef I_STDLIB
6595#include <stdlib.h>
6596#endif
c8b93cf9
JH
6597#if TRY & 1
6598void sub() {
6599#else
6600sub() {
6601#endif
6602 extern void moo(); /* function returning void */
6603 void (*goo)(); /* ptr to func returning void */
6604#if TRY & 8
6605 void *hue; /* generic ptr */
6606#endif
6607#if TRY & 2
6608 void (*foo[10])();
6609#endif
6610
6611#if TRY & 4
6612 if(goo == moo) {
6613 exit(0);
6614 }
6615#endif
6616 exit(0);
6617}
6618int main() { sub(); }
6619EOCP
6620 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6621 voidflags=$defvoidused
6622 echo "Good. It appears to support void to the level $package wants.">&4
6623 if $contains warning .out >/dev/null 2>&1; then
6624 echo "However, you might get some warnings that look like this:"
6625 $cat .out
6626 fi
6627 else
6628echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6629 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6630 echo "It supports 1..."
6631 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6632 echo "It also supports 2..."
6633 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6634 voidflags=7
6635 echo "And it supports 4 but not 8 definitely."
6636 else
6637 echo "It doesn't support 4..."
6638 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6639 voidflags=11
6640 echo "But it supports 8."
6641 else
6642 voidflags=3
6643 echo "Neither does it support 8."
6644 fi
6645 fi
6646 else
6647 echo "It does not support 2..."
6648 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6649 voidflags=13
6650 echo "But it supports 4 and 8."
6651 else
6652 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6653 voidflags=5
6654 echo "And it supports 4 but has not heard about 8."
6655 else
6656 echo "However it supports 8 but not 4."
6657 fi
6658 fi
6659 fi
6660 else
6661 echo "There is no support at all for void."
6662 voidflags=0
6663 fi
6664 fi
6665esac
6666case "$voidflags" in
6667"$defvoidused") ;;
6668*) $cat >&4 <<'EOM'
6669 Support flag bits are:
6670 1: basic void declarations.
6671 2: arrays of pointers to functions returning void.
6672 4: operations between pointers to and addresses of void functions.
6673 8: generic void pointers.
6674EOM
6675 dflt="$voidflags";
6676 rp="Your void support flags add up to what?"
6677 . ./myread
6678 voidflags="$ans"
6679 ;;
6680esac
5b813a60 6681$rm_try
c8b93cf9
JH
6682
6683: check for length of pointer
6684echo " "
6685case "$ptrsize" in
6686'')
6687 echo "Checking to see how big your pointers are..." >&4
6688 if test "$voidflags" -gt 7; then
6689 echo '#define VOID_PTR char *' > try.c
6690 else
6691 echo '#define VOID_PTR void *' > try.c
6692 fi
74d00865 6693 $cat >>try.c <<EOCP
c8b93cf9 6694#include <stdio.h>
d1daaddf
JH
6695#$i_stdlib I_STDLIB
6696#ifdef I_STDLIB
6697#include <stdlib.h>
6698#endif
c8b93cf9
JH
6699int main()
6700{
6701 printf("%d\n", (int)sizeof(VOID_PTR));
6702 exit(0);
6703}
6704EOCP
6705 set try
6706 if eval $compile_ok; then
6707 ptrsize=`$run ./try`
6708 echo "Your pointers are $ptrsize bytes long."
6709 else
6710 dflt='4'
6711 echo "(I can't seem to compile the test program. Guessing...)" >&4
6712 rp="What is the size of a pointer (in bytes)?"
6713 . ./myread
6714 ptrsize="$ans"
6715 fi
6716 ;;
6717esac
5b813a60 6718$rm_try
c8b93cf9
JH
6719case "$use64bitall" in
6720"$define"|true|[yY]*)
6721 case "$ptrsize" in
6722 4) cat <<EOM >&4
6723
1911a026
JH
6724*** You have chosen a maximally 64-bit build,
6725*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6726*** Please rerun Configure without -Duse64bitall.
6727EOM
6728 case "$d_quad" in
6729 define)
6730 cat <<EOM >&4
6731*** Since you have quads, you could possibly try with -Duse64bitint.
6732EOM
6733 ;;
6734 esac
6735 cat <<EOM >&4
1911a026 6736*** Cannot continue, aborting.
c8b93cf9
JH
6737
6738EOM
09b58c7b 6739
1911a026 6740 exit 1
c8b93cf9
JH
6741 ;;
6742 esac
6743 ;;
6744esac
6745
19a100ff 6746
9df442c2
NC
6747: determine whether to use malloc wrapping
6748echo " "
6749case "$usemallocwrap" in
6750[yY]*|true|$define) dflt='y' ;;
6751[nN]*|false|$undef) dflt='n' ;;
6752*) case "$usedevel" in
6753 [yY]*|true|$define) dflt='y' ;;
6754 *) dflt='n' ;;
6755 esac
6756 ;;
6757esac
6758rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6759. ./myread
6760usemallocwrap="$ans"
6761case "$ans" in
6762y*|true)
6763 usemallocwrap="$define" ;;
6764*)
6765 usemallocwrap="$undef" ;;
6766esac
c8b93cf9 6767
b4eb6b3d
JH
6768: determine which malloc to compile in
6769echo " "
6770case "$usemymalloc" in
c4163172
JH
6771[yY]*|true|$define) dflt='y' ;;
6772[nN]*|false|$undef) dflt='n' ;;
6773*) case "$ptrsize" in
6774 4) dflt='y' ;;
6775 *) dflt='n' ;;
6776 esac
d9298c1a 6777 if test "$useithreads" = "$define"; then dflt='n'; fi
c4163172 6778 ;;
8dfa8df9 6779esac
b4eb6b3d
JH
6780rp="Do you wish to attempt to use the malloc that comes with $package?"
6781. ./myread
6782usemymalloc="$ans"
6783case "$ans" in
6784y*|true)
6785 usemymalloc='y'
6786 mallocsrc='malloc.c'
6787 mallocobj="malloc$_o"
6788 d_mymalloc="$define"
6789 case "$libs" in
6790 *-lmalloc*)
6791 : Remove malloc from list of libraries to use
6792 echo "Removing unneeded -lmalloc from library list" >&4
6793 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6794 shift
6795 libs="$*"
6796 echo "libs = $libs" >&4
6797 ;;
6798 esac
6799 ;;
6800*)
6801 usemymalloc='n'
6802 mallocsrc=''
6803 mallocobj=''
6804 d_mymalloc="$undef"
6805 ;;
6806esac
6807
6808: compute the return types of malloc and free
6809echo " "
6810$cat >malloc.c <<END
6811#$i_malloc I_MALLOC
6812#$i_stdlib I_STDLIB
6813#include <stdio.h>
6814#include <sys/types.h>
6815#ifdef I_MALLOC
6816#include <malloc.h>
6817#endif
6818#ifdef I_STDLIB
6819#include <stdlib.h>
6820#endif
6821#ifdef TRY_MALLOC
6822void *malloc();
6823#endif
6824#ifdef TRY_FREE
6825void free();
6826#endif
6827END
6828case "$malloctype" in
6829'')
6830 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6831 malloctype='void *'
6832 else
6833 malloctype='char *'
6834 fi
6835 ;;
6836esac
6837echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6838
6839case "$freetype" in
6840'')
6841 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6842 freetype='void'
6843 else
6844 freetype='int'
6845 fi
6846 ;;
6847esac
6848echo "Your system uses $freetype free(), it would seem." >&4
6849$rm -f malloc.[co]
b4eb6b3d
JH
6850: determine where site specific architecture-dependent libraries go.
6851: sitelib default is /usr/local/lib/perl5/site_perl/$version
6852: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6853: sitelib may have an optional trailing /share.
6854case "$sitearch" in
6855'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6856 dflt="$dflt/$archname"
6857 ;;
6858*) dflt="$sitearch"
6859 ;;
6860esac
6861set sitearch sitearch none
6862eval $prefixit
6863$cat <<EOM
6864
6865The installation process will also create a directory for
6866architecture-dependent site-specific extensions and modules.
6867
6868EOM
6869fn=d~+
6870rp='Pathname for the site-specific architecture-dependent library files?'
6871. ./getfile
79522dd2
NC
6872prefixvar=sitearch
6873. ./setprefixvar
c95d0e17
GA
6874if $test X"$sitearch" = X"$sitelib"; then
6875 d_sitearch="$undef"
6876else
6877 d_sitearch="$define"
6878fi
b4eb6b3d 6879
613d6c3e 6880: Set the vendorprefix variables
b4eb6b3d
JH
6881$cat <<EOM
6882
6883The installation process will also create a directory for
6884vendor-supplied add-ons. Vendors who supply perl with their system
6885may find it convenient to place all vendor-supplied files in this
6886directory rather than in the main distribution directory. This will
6887ease upgrades between binary-compatible maintenance versions of perl.
6888
6889Of course you may also use these directories in whatever way you see
6890fit. For example, you might use them to access modules shared over a
6891company-wide network.
6892
6893The default answer should be fine for most people.
6894This causes further questions about vendor add-ons to be skipped
6895and no vendor-specific directories will be configured for perl.
6896
6897EOM
6898rp='Do you want to configure vendor-specific add-on directories?'
6899case "$usevendorprefix" in
6900define|true|[yY]*) dflt=y ;;
6901*) : User may have set vendorprefix directly on Configure command line.
6902 case "$vendorprefix" in
6903 ''|' ') dflt=n ;;
6904 *) dflt=y ;;
6905 esac
6906 ;;
6907esac
6908. ./myread
6909case "$ans" in
6910[yY]*) fn=d~+
6911 rp='Installation prefix to use for vendor-supplied add-ons?'
6912 case "$vendorprefix" in
6913 '') dflt='' ;;
6914 *) dflt=$vendorprefix ;;
6915 esac
6916 . ./getfile
6917 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6918 oldvendorprefix=''
6919 case "$vendorprefix" in
6920 '') ;;
6921 *) case "$ans" in
6922 "$prefix") ;;
6923 *) oldvendorprefix="$prefix";;
6924 esac
6925 ;;
6926 esac
6927 usevendorprefix="$define"
6928 vendorprefix="$ans"
6929 vendorprefixexp="$ansexp"
6930 ;;
6931*) usevendorprefix="$undef"
6932 vendorprefix=''
6933 vendorprefixexp=''
6934 ;;
6935esac
6936
613d6c3e 6937: Set the vendorlib variables
b4eb6b3d
JH
6938case "$vendorprefix" in
6939'') d_vendorlib="$undef"
6940 vendorlib=''
6941 vendorlibexp=''
6942 ;;
6943*) d_vendorlib="$define"
6944 : determine where vendor-supplied modules go.
6945 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6946 case "$vendorlib" in
6947 '')
6948 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6949 case "$installstyle" in
6950 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6951 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6952 esac
6953 ;;
6954 *) dflt="$vendorlib"
6955 ;;
6956 esac
6957 fn=d~+
6958 rp='Pathname for the vendor-supplied library files?'
6959 . ./getfile
6960 vendorlib="$ans"
6961 vendorlibexp="$ansexp"
6962 ;;
6963esac
6964vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6965prefixvar=vendorlib
6966. ./installprefix
b4eb6b3d 6967
613d6c3e 6968: Set the vendorarch variables
b4eb6b3d
JH
6969case "$vendorprefix" in
6970'') d_vendorarch="$undef"
6971 vendorarch=''
6972 vendorarchexp=''
6973 ;;
6974*) d_vendorarch="$define"
6975 : determine where vendor-supplied architecture-dependent libraries go.
6976 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6977 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6978 : vendorlib may have an optional trailing /share.
6979 case "$vendorarch" in
6980 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6981 dflt="$dflt/$archname"
6982 ;;
6983 *) dflt="$vendorarch" ;;
6984 esac
6985 fn=d~+
6986 rp='Pathname for vendor-supplied architecture-dependent files?'
6987 . ./getfile
6988 vendorarch="$ans"
6989 vendorarchexp="$ansexp"
6990 ;;
6991esac
a092d240
NC
6992prefixvar=vendorarch
6993. ./installprefix
1be1b388
MB
6994if $test X"$vendorarch" = X"$vendorlib"; then
6995 d_vendorarch="$undef"
6996else
6997 d_vendorarch="$define"
6998fi
b4eb6b3d
JH
6999
7000: Final catch-all directories to search
7001$cat <<EOM
7002
7003Lastly, you can have perl look in other directories for extensions and
7004modules in addition to those already specified.
7005These directories will be searched after
7006 $sitearch
7007 $sitelib
7008EOM
7009test X"$vendorlib" != "X" && echo ' ' $vendorlib
7010test X"$vendorarch" != "X" && echo ' ' $vendorarch
7011echo ' '
7012case "$otherlibdirs" in
7013''|' ') dflt='none' ;;
7014*) dflt="$otherlibdirs" ;;
7015esac
7016$cat <<EOM
7017Enter a colon-separated set of extra paths to include in perl's @INC
7018search path, or enter 'none' for no extra paths.
7019
7020EOM
7021
7022rp='Colon-separated list of additional directories for perl to search?'
7023. ./myread
7024case "$ans" in
7025' '|''|none) otherlibdirs=' ' ;;
7026*) otherlibdirs="$ans" ;;
7027esac
7028case "$otherlibdirs" in
7029' ') val=$undef ;;
7030*) val=$define ;;
7031esac
7032set d_perl_otherlibdirs
7033eval $setvar
7034
7035: Cruising for prototypes
7036echo " "
7037echo "Checking out function prototypes..." >&4
55954f19
JH
7038$cat >prototype.c <<EOCP
7039#$i_stdlib I_STDLIB
7040#ifdef I_STDLIB
7041#include <stdlib.h>
7042#endif
b4eb6b3d
JH
7043int main(int argc, char *argv[]) {
7044 exit(0);}
7045EOCP
7046if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7047 echo "Your C compiler appears to support function prototypes."
7048 val="$define"
7049else
7050 echo "Your C compiler doesn't seem to understand function prototypes."
7051 val="$undef"
7052fi
7053set prototype
7054eval $setvar
7055$rm -f prototype*
7056
613d6c3e 7057: Check if ansi2knr is required
b4eb6b3d
JH
7058case "$prototype" in
7059"$define") ;;
7060*) ansi2knr='ansi2knr'
7061 echo " "
7062 cat <<EOM >&4
7063
7064$me: FATAL ERROR:
7065This version of $package can only be compiled by a compiler that
7066understands function prototypes. Unfortunately, your C compiler
7067 $cc $ccflags
7068doesn't seem to understand them. Sorry about that.
7069
7070If GNU cc is available for your system, perhaps you could try that instead.
7071
7072Eventually, we hope to support building Perl with pre-ANSI compilers.
7073If you would like to help in that effort, please contact <perlbug@perl.org>.
7074
7075Aborting Configure now.
7076EOM
7077 exit 2
7078 ;;
7079esac
7080
34f1896b
MB
7081: DTrace support
7082dflt_dtrace='/usr/sbin/dtrace'
6e3b7bfa
MB
7083$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7084
34f1896b
MB
7085cat <<EOM
7086
7087Perl can be built to support DTrace on platforms that support it.
7088DTrace is a diagnosis and performance analysis tool from Sun.
7089
7090If this doesn't make any sense to you, just accept the default '$dflt'.
7091EOM
7092
7093while $test 1 ; do
7094 case "$usedtrace" in
7095 $define|true|[yY]*)
7096 dflt='y'
7097 ;;
7098 ?*)
7099 dflt='y'
7100 dflt_dtrace=$usedtrace
7101 ;;
7102 *)
7103 dflt='n'
7104 ;;
7105 esac
7106
7107 rp='Support DTrace if available?'
7108 . ./myread
7109 case "$ans" in
7110 y|Y) val="$define" ;;
7111 *) val="$undef" ;;
7112 esac
7113 set usedtrace
7114 eval $setvar
7115
7116 test "X$usedtrace" != "X$define" && break
7117
7118 echo " "
7119 rp='Where is the dtrace executable?'
7120 dflt=$dflt_dtrace
7121 . ./getfile
7122 val="$ans"
7123 set dtrace
7124 eval $setvar
7125
7126 if $test -f $dtrace
7127 then
7128 if $dtrace -h -s ../perldtrace.d \
7129 -o perldtrace.tmp >/dev/null 2>&1 \
7130 && rm -f perldtrace.tmp
7131 then
7132 echo " "
7133 echo "Good: your $dtrace knows about the -h flag."
7134 else
7135 cat >&2 <<EOM
7136
7137*** $me: Fatal Error: $dtrace doesn't support -h flag
7138***
7139*** Your installed dtrace doesn't support the -h switch to compile a D
7140*** program into a C header. Can't continue.
7141
7142EOM
7143 exit 1
7144 fi
7145 break;
7146 fi
7147
7148 case "$fastread" in
7149 yes)
7150 cat >&2 <<EOM
7151
7152*** $me: Fatal Error: $dtrace not found.
7153*** Can't continue.
7154
7155EOM
7156 exit 1
7157 ;;
7158 *)
7159 echo "*** $dtrace was not found."
7160 echo " "
7161 ;;
7162 esac
7163done
7164
613d6c3e 7165: See if we want extra modules installed
6fcddf3b 7166echo " "
6fcddf3b 7167case "$extras" in
bf35c3f6
JH
7168'') dflt='n';;
7169*) dflt='y';;
6fcddf3b
JH
7170esac
7171cat <<EOM
7172Perl can be built with extra modules or bundles of modules which
7173will be fetched from the CPAN and installed alongside Perl.
7174
7175Notice that you will need access to the CPAN; either via the Internet,
7176or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7177be asked later to configure the CPAN.pm module which will in turn do
7178the installation of the rest of the extra modules or bundles.)
7179
7180Notice also that if the modules require any external software such as
dd2de242
JH
7181libraries and headers (the libz library and the zlib.h header for the
7182Compress::Zlib module, for example) you MUST have any such software
7183already installed, this configuration process will NOT install such
7184things for you.
6fcddf3b
JH
7185
7186If this doesn't make any sense to you, just accept the default '$dflt'.
7187EOM
dd2de242 7188rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7189. ./myread
7190case "$ans" in
7191y|Y)
7192 cat <<EOM
7193
7194Please list any extra modules or bundles to be installed from CPAN,
7195with spaces between the names. The names can be in any format the
dd2de242
JH
7196'install' command of CPAN.pm will understand. (Answer 'none',
7197without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7198EOM
7199 rp='Extras?'
7200 dflt="$extras"
7201 . ./myread
7202 extras="$ans"
7203esac
7204case "$extras" in
7205''|'none')
7206 val=''
7207 $rm -f ../extras.lst
7208 ;;
7209*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7210 echo "$extras" > ../extras.lst
7211 val="'$extras'"
6fcddf3b
JH
7212 ;;
7213esac
7214set extras
7215eval $setvar
7216echo " "
7217
6e1038e0
MB
7218: determine where html pages for programs go
7219set html1dir html1dir none
7220eval $prefixit
7221$cat <<EOM
7222
f3f1a2d8 7223If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7224the appropriate directory here. To skip installing html files,
7225answer "none".
7226EOM
7227case "$html1dir" in
7228''|none|$undef|' ') dflt=none ;;
7229*) dflt=$html1dir ;;
7230esac
7231fn=dn+~
7232rp="Directory for the main $spackage html pages?"
7233. ./getfile
79522dd2
NC
7234prefixvar=html1dir
7235. ./setprefixvar
6e1038e0
MB
7236: Use ' ' for none so value is preserved next time through Configure
7237$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7238
7239: determine where html pages for libraries and modules go
7240set html3dir html3dir none
7241eval $prefixit
7242$cat <<EOM
7243
7244If you wish to install html files for modules associated with $spackage,
7245indicate the appropriate directory here. To skip installing html files,
7246answer "none".
7247EOM
7248: There is no obvious default. If they have specified html1dir, then
7249: try to key off that, possibly changing .../html1 into .../html3.
7250case "$html3dir" in
7251'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7252*) dflt=$html3dir ;;
7253esac
7254fn=dn+~
7255rp="Directory for the $spackage module html pages?"
7256. ./getfile
79522dd2
NC
7257prefixvar=html3dir
7258. ./setprefixvar
6e1038e0
MB
7259: Use ' ' for none so value is preserved next time through Configure
7260$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7261
89ce900e
JH
7262: determine whether to install perl also as /usr/bin/perl
7263
7264echo " "
7265if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7266 $cat <<EOM
7267Many scripts expect perl to be installed as /usr/bin/perl.
7268
7269If you want to, I can install the perl you are about to compile
7270as /usr/bin/perl (in addition to $bin/perl).
7271EOM
7272 if test -f /usr/bin/perl; then
7273 $cat <<EOM
7274
7275However, please note that because you already have a /usr/bin/perl,
7276overwriting that with a new Perl would very probably cause problems.
7277Therefore I'm assuming you don't want to do that (unless you insist).
7278
7279EOM
7280 case "$installusrbinperl" in
7281 "$define"|[yY]*) dflt='y';;
7282 *) dflt='n';;
7283 esac
7284 else
7285 $cat <<EOM
7286
7287Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7288
7289EOM
7290 case "$installusrbinperl" in
7291 "$undef"|[nN]*) dflt='n';;
7292 *) dflt='y';;
7293 esac
7294 fi
7295 rp="Do you want to install perl as /usr/bin/perl?"
7296 . ./myread
7297 case "$ans" in
7298 [yY]*) val="$define";;
7299 *) val="$undef" ;;
7300 esac
7301else
7302 val="$undef"
7303fi
7304set installusrbinperl
7305eval $setvar
7306
613d6c3e 7307: Check if we are using the GNU C library
89ce900e
JH
7308echo " "
7309echo "Checking for GNU C Library..." >&4
7310cat >try.c <<'EOCP'
7311/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7312 alone are insufficient to distinguish different versions, such as
7313 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7314 libc version 2.1.0. A. Dougherty, June 3, 2002.
7315*/
7316#include <stdio.h>
7317int main(void)
7318{
7319#ifdef __GLIBC__
7320# ifdef __GLIBC_MINOR__
4fb7dc7d 7321# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7322# include <gnu/libc-version.h>
7323 printf("%s\n", gnu_get_libc_version());
7324# else
7325 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7326# endif
7327# else
7328 printf("%d\n", __GLIBC__);
7329# endif
7330 return 0;
7331#else
7332 return 1;
7333#endif
7334}
7335EOCP
7336set try
7337if eval $compile_ok && $run ./try > glibc.ver; then
7338 val="$define"
7339 gnulibc_version=`$cat glibc.ver`
7340 echo "You are using the GNU C Library version $gnulibc_version"
7341else
7342 val="$undef"
7343 gnulibc_version=''
7344 echo "You are not using the GNU C Library"
7345fi
5b813a60 7346$rm_try glibc.ver
89ce900e
JH
7347set d_gnulibc
7348eval $setvar
7349
7350: see if nm is to be used to determine whether a symbol is defined or not
7351case "$usenm" in
7352'')
7353 dflt=''
7354 case "$d_gnulibc" in
7355 "$define")
7356 echo " "
7357 echo "nm probably won't work on the GNU C Library." >&4
7358 dflt=n
7359 ;;
7360 esac
7361 case "$dflt" in
7362 '')
7363 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7364 echo " "
7365 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7366 echo "'nm' won't be sufficient on this sytem." >&4
7367 dflt=n
7368 fi
7369 ;;
7370 esac
7371 case "$dflt" in
7372 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7373 if $test $dflt -gt 20; then
7374 dflt=y
7375 else
7376 dflt=n
7377 fi
7378 ;;
7379 esac
b4eb6b3d 7380 ;;
89ce900e
JH
7381*)
7382 case "$usenm" in
7383 true|$define) dflt=y;;
7384 *) dflt=n;;
7385 esac
b4eb6b3d
JH
7386 ;;
7387esac
89ce900e 7388$cat <<EOM
b4eb6b3d 7389
89ce900e
JH
7390I can use $nm to extract the symbols from your C libraries. This
7391is a time consuming task which may generate huge output on the disk (up
7392to 3 megabytes) but that should make the symbols extraction faster. The
7393alternative is to skip the 'nm' extraction part and to compile a small
7394test program instead to determine whether each symbol is present. If
7395you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7396this may be the best solution.
b4eb6b3d 7397
89ce900e 7398You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7399
89ce900e
JH
7400EOM
7401rp="Shall I use $nm to extract C symbols from the libraries?"
7402. ./myread
7403case "$ans" in
7404[Nn]*) usenm=false;;
7405*) usenm=true;;
b4eb6b3d 7406esac
89ce900e
JH
7407
7408runnm=$usenm
7409case "$reuseval" in
7410true) runnm=false;;
b4eb6b3d 7411esac
b4eb6b3d 7412
89ce900e
JH
7413: nm options which may be necessary
7414case "$nm_opt" in
7415'') if $test -f /mach_boot; then
7416 nm_opt='' # Mach
7417 elif $test -d /usr/ccs/lib; then
7418 nm_opt='-p' # Solaris (and SunOS?)
7419 elif $test -f /dgux; then
7420 nm_opt='-p' # DG-UX
7421 elif $test -f /lib64/rld; then
7422 nm_opt='-p' # 64-bit Irix
7423 else
7424 nm_opt=''
7425 fi;;
7426esac
b4eb6b3d 7427
89ce900e
JH
7428: nm options which may be necessary for shared libraries but illegal
7429: for archive libraries. Thank you, Linux.
7430case "$nm_so_opt" in
7431'') case "$myuname" in
fb2e1bc0 7432 *linux*|gnu*)
89ce900e
JH
7433 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7434 nm_so_opt='--dynamic'
7435 fi
7436 ;;
7437 esac
7438 ;;
7439esac
b4eb6b3d 7440
1d8eaf8c 7441: Figure out where the libc is located
89ce900e
JH
7442case "$runnm" in
7443true)
1d8eaf8c 7444: get list of predefined functions in a handy place
89ce900e
JH
7445echo " "
7446case "$libc" in
7447'') libc=unknown
7448 case "$libs" in
7449 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7450 esac
7451 ;;
b4eb6b3d 7452esac
89ce900e
JH
7453case "$libs" in
7454'') ;;
7455*) for thislib in $libs; do
7456 case "$thislib" in
7457 -lc|-lc_s)
7458 : Handle C library specially below.
7459 ;;
7460 -l*)
7461 thislib=`echo $thislib | $sed -e 's/^-l//'`
7462 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7463 :
7464 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7465 :
7466 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7467 :
7468 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7469 :
7470 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7471 :
7472 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7473 :
7474 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7475 :
7476 else
7477 try=''
7478 fi
7479 libnames="$libnames $try"
7480 ;;
7481 *) libnames="$libnames $thislib" ;;
7482 esac
7483 done
b4eb6b3d
JH
7484 ;;
7485esac
89ce900e
JH
7486xxx=normal
7487case "$libc" in
7488unknown)
7489 set /lib/libc.$so
7490 for xxx in $libpth; do
7491 $test -r $1 || set $xxx/libc.$so
7492 : The messy sed command sorts on library version numbers.
7493 $test -r $1 || \
7494 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7495 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7496 h
7497 s/[0-9][0-9]*/0000&/g
7498 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7499 G
7500 s/\n/ /' | \
7501 $sort | $sed -e 's/^.* //'`
7502 eval set \$$#
7503 done
7504 $test -r $1 || set /usr/ccs/lib/libc.$so
7505 $test -r $1 || set /lib/libsys_s$_a
7506 ;;
7507*)
7508 set blurfl
7509 ;;
7510esac
7511if $test -r "$1"; then
7512 echo "Your (shared) C library seems to be in $1."
7513 libc="$1"
7514elif $test -r /lib/libc && $test -r /lib/clib; then
7515 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7516 xxx=apollo
7517 libc='/lib/clib /lib/libc'
7518 if $test -r /lib/syslib; then
7519 echo "(Your math library is in /lib/syslib.)"
7520 libc="$libc /lib/syslib"
7521 fi
7522elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7523 echo "Your C library seems to be in $libc, as you said before."
7524elif $test -r $incpath/usr/lib/libc$_a; then
7525 libc=$incpath/usr/lib/libc$_a;
7526 echo "Your C library seems to be in $libc. That's fine."
7527elif $test -r /lib/libc$_a; then
7528 libc=/lib/libc$_a;
7529 echo "Your C library seems to be in $libc. You're normal."
7530else
7531 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7532 :
7533 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7534 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7535 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7536 :
7537 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7538 :
7539 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7540 :
7541 else
7542 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7543 fi
7544 if $test -r "$tans"; then
7545 echo "Your C library seems to be in $tans, of all places."
7546 libc=$tans
7547 else
7548 libc='blurfl'
7549 fi
7550fi
7551if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7552 dflt="$libc"
7553 cat <<EOM
b4eb6b3d 7554
89ce900e
JH
7555If the guess above is wrong (which it might be if you're using a strange
7556compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7557
89ce900e
JH
7558EOM
7559else
7560 dflt=''
7561 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7562 cat >&4 <<EOM
7563I can't seem to find your C library. I've looked in the following places:
5e366f65 7564
b4eb6b3d 7565EOM
89ce900e
JH
7566 $sed 's/^/ /' libpath
7567 cat <<EOM
5e366f65 7568
89ce900e 7569None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7570
7571EOM
89ce900e
JH
7572fi
7573fn=f
7574rp='Where is your C library?'
7575. ./getfile
7576libc="$ans"
5e366f65 7577
89ce900e
JH
7578echo " "
7579echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7580set X `cat libnames`
7581shift
7582xxx=files
7583case $# in 1) xxx=file; esac
7584echo "Extracting names from the following $xxx for later perusal:" >&4
7585echo " "
7586$sed 's/^/ /' libnames >&4
7587echo " "
7588$echo $n "This may take a while...$c" >&4
5e366f65 7589
89ce900e
JH
7590for file in $*; do
7591 case $file in
7592 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7593 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7594 esac
89ce900e
JH
7595done >libc.tmp
7596
7597$echo $n ".$c"
7598$grep fprintf libc.tmp > libc.ptf
7599xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7600xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
9e08e8f0 7601xxx='[ADTSIWi]'
ab900c53 7602if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7603 eval $xscan;\
7604 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7605 eval $xrun
7606elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7607 eval $xscan;\
7608 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7609 eval $xrun
7610elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7611 eval $xscan;\
7612 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7613 eval $xrun
7614elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7615 eval $xscan;\
7616 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7617 eval $xrun
7618elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7619 eval $xscan;\
7620 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7621 eval $xrun
7622elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7623 eval $xscan;\
7624 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7625 eval $xrun
7626elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7627 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7628 eval $xscan;\
7629 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630 eval $xrun
7631elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7632 eval $xscan;\
7633 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634 eval $xrun
7635elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7636 eval $xscan;\
7637 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7638 eval $xrun
7639elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7640 eval $xscan;\
7641 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7642 eval $xrun
7643elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7644 eval $xscan;\
7645 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7646 eval $xrun
7647elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7648 eval $xscan;\
7649 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7650 eval $xrun
7651elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7652 eval $xscan;\
7653 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7654 eval $xrun
7655elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7656 eval $xscan;\
7657 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7658 eval $xrun
b4eb6b3d 7659else
89ce900e
JH
7660 $nm -p $* 2>/dev/null >libc.tmp
7661 $grep fprintf libc.tmp > libc.ptf
7662 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7663 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7664 then
7665 nm_opt='-p'
7666 eval $xrun
7667 else
7668 echo " "
7669 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7670 com=''
1d8eaf8c
MB
7671 if $ar t $libc > libc.tmp && \
7672 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7673 then
89ce900e
JH
7674 for thisname in $libnames $libc; do
7675 $ar t $thisname >>libc.tmp
7676 done
7677 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7678 echo "Ok." >&4
7679 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
89ce900e
JH
7680 for thisname in $libnames $libc; do
7681 $ar tv $thisname >>libc.tmp
89ce900e
JH
7682 emximp -o tmp.imp $thisname \
7683 2>/dev/null && \
7684 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7685 < tmp.imp >>libc.tmp
1d8eaf8c 7686 $rm -f tmp.imp
89ce900e
JH
7687 done
7688 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7689 echo "Ok." >&4
7690 else
7691 echo "$ar didn't seem to work right." >&4
7692 echo "Maybe this is a Cray...trying bld instead..." >&4
1d8eaf8c
MB
7693 if bld t $libc | \
7694 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7695 $test -s libc.list
89ce900e
JH
7696 then
7697 for thisname in $libnames; do
7698 bld t $libnames | \
7699 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7700 $ar t $thisname >>libc.tmp
7701 done
7702 echo "Ok." >&4
7703 else
7704 echo "That didn't work either. Giving up." >&4
7705 exit 1
7706 fi
7707 fi
7708 fi
b4eb6b3d 7709fi
89ce900e
JH
7710nm_extract="$com"
7711case "$PASE" in
7712define)
7713 echo " "
7714 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7715 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7716 ;;
7717*) if $test -f /lib/syscalls.exp; then
7718 echo " "
7719 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
1d8eaf8c
MB
7720 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7721 /lib/syscalls.exp >>libc.list
89ce900e
JH
7722 fi
7723 ;;
7724esac
7725;;
7726esac
7727$rm -f libnames libpath
b4eb6b3d
JH
7728
7729: see if dld is available
7730set dld.h i_dld
7731eval $inhdr
7732
613d6c3e 7733: Check if we are using C++
43dddb59
MB
7734echo " "
7735echo "Checking for C++..." >&4
20e87299 7736$cat >try.c <<'EOCP'
43dddb59
MB
7737#include <stdio.h>
7738int main(void)
7739{
7740#ifdef __cplusplus
20e87299 7741 return 0;
43dddb59 7742#else
20e87299 7743 return 1;
43dddb59 7744#endif
43dddb59
MB
7745}
7746EOCP
7747set try
20e87299
AD
7748if eval $compile_ok && $run ./try; then
7749 val="$define"
43dddb59
MB
7750 echo "You are using a C++ compiler."
7751else
7752 val="$undef"
7753 echo "You are not using a C++ compiler."
7754fi
5b813a60 7755$rm_try cplusplus$$
43dddb59
MB
7756set d_cplusplus
7757eval $setvar
7758
89ce900e
JH
7759: is a C symbol defined?
7760csym='tlook=$1;
7761case "$3" in
373dfab3
JH
7762-v) tf=libc.tmp; tdc="";;
7763-a) tf=libc.tmp; tdc="[]";;
7764*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e 7765esac;
61c26d18
MHM
7766case "$d_cplusplus" in
7767 $define) extern_C="extern \"C\"" ;;
7768 *) extern_C="extern" ;;
7769esac;
89ce900e
JH
7770tx=yes;
7771case "$reuseval-$4" in
7772true-) ;;
7773true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7774esac;
7775case "$tx" in
7776yes)
43dddb59 7777 tval=false;
5129fff4
JH
7778 if $test "$runnm" = true; then
7779 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7780 tval=true;
5129fff4 7781 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
9945eb56 7782 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7783 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7784 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7785 $rm_try;
89ce900e 7786 fi;
5129fff4 7787 else
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 $libs >/dev/null 2>&1 && tval=true;
5b813a60 7790 $rm_try;
ab900c53
AB
7791 fi;
7792 ;;
89ce900e
JH
7793*)
7794 case "$tval" in
7795 $define) tval=true;;
7796 *) tval=false;;
ab900c53
AB
7797 esac;
7798 ;;
89ce900e
JH
7799esac;
7800eval "$2=$tval"'
7801
7802: define an is-in-libc? function
7803inlibc='echo " "; td=$define; tu=$undef;
7804sym=$1; var=$2; eval "was=\$$2";
7805tx=yes;
7806case "$reuseval$was" in
7807true) ;;
7808true*) tx=no;;
7809esac;
7810case "$tx" in
7811yes)
7812 set $sym tres -f;
7813 eval $csym;
7814 case "$tres" in
7815 true)
7816 echo "$sym() found." >&4;
7817 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7818 *)
7819 echo "$sym() NOT found." >&4;
7820 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7821 esac;;
7822*)
7823 case "$was" in
7824 $define) echo "$sym() found." >&4;;
7825 *) echo "$sym() NOT found." >&4;;
7826 esac;;
7827esac'
7828
b4eb6b3d
JH
7829: see if dlopen exists
7830xxx_runnm="$runnm"
666ea192 7831xxx_ccflags="$ccflags"
b4eb6b3d 7832runnm=false
666ea192
JH
7833: with g++ one needs -shared to get is-in-libc to work for dlopen
7834case "$gccversion" in
7835'') ;;
7836*) case "$d_cplusplus" in
7837 "$define") ccflags="$ccflags -shared" ;;
7838 esac
7839 ;;
7840esac
b4eb6b3d
JH
7841set dlopen d_dlopen
7842eval $inlibc
7843runnm="$xxx_runnm"
666ea192 7844ccflags="$xxx_ccflags"
b4eb6b3d 7845
4fb7dc7d
JH
7846: see if this is a unistd.h system
7847set unistd.h i_unistd
7848eval $inhdr
7849
b4eb6b3d
JH
7850: determine which dynamic loading, if any, to compile in
7851echo " "
7852dldir="ext/DynaLoader"
7853case "$usedl" in
7854$define|y|true)
7855 dflt='y'
7856 usedl="$define"
7857 ;;
7858$undef|n|false)
7859 dflt='n'
7860 usedl="$undef"
7861 ;;
5b813a60 7862*)
b4eb6b3d
JH
7863 dflt='n'
7864 case "$d_dlopen" in
7865 $define) dflt='y' ;;
7866 esac
7867 case "$i_dld" in
7868 $define) dflt='y' ;;
7869 esac
7870 : Does a dl_xxx.xs file exist for this operating system
7871 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7872 ;;
7873esac
7874rp="Do you wish to use dynamic loading?"
7875. ./myread
7876usedl="$ans"
f1ce3bf1 7877bin_ELF="$undef"
b4eb6b3d
JH
7878case "$ans" in
7879y*) usedl="$define"
7880 case "$dlsrc" in
7881 '')
7882 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7883 dflt="$dldir/dl_${osname}.xs"
7884 elif $test "$d_dlopen" = "$define" ; then
7885 dflt="$dldir/dl_dlopen.xs"
7886 elif $test "$i_dld" = "$define" ; then
7887 dflt="$dldir/dl_dld.xs"
7888 else
7889 dflt=''
7890 fi
7891 ;;
7892 *) dflt="$dldir/$dlsrc"
7893 ;;
7894 esac
7895 echo "The following dynamic loading files are available:"
7896 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7897 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7898 rp="Source file to use for dynamic loading"
7899 fn="fne"
7900 gfpth="$src"
7901 . ./getfile
7902 usedl="$define"
7903 : emulate basename
7904 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7905
7906 $cat << EOM
7907
7908Some systems may require passing special flags to $cc -c to
7909compile modules that will be used to create a shared library.
7910To use no flags, say "none".
7911
7912EOM
7913 case "$cccdlflags" in
7914 '') case "$gccversion" in
7915 '') case "$osname" in
7916 hpux) dflt='+z' ;;
7917 next) dflt='none' ;;
7918 irix*) dflt='-KPIC' ;;
48bcfe03 7919 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7920 sunos) dflt='-pic' ;;
7921 *) dflt='none' ;;
7922 esac
7923 ;;
7924 *) case "$osname" in
b6cc0f4c 7925 darwin) dflt='none' ;;
15fcae63 7926 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7927 *) dflt='-fpic' ;;
7928 esac ;;
7929 esac ;;
7930 ' ') dflt='none' ;;
7931 *) dflt="$cccdlflags" ;;
7932 esac
7933 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7934 . ./myread
7935 case "$ans" in
7936 none) cccdlflags=' ' ;;
7937 *) cccdlflags="$ans" ;;
7938 esac
7939
7940 cat << EOM
7941
7942Some systems use ld to create libraries that can be dynamically loaded,
7943while other systems (such as those using ELF) use $cc.
7944
7945EOM
7946 case "$ld" in
55954f19 7947 '') $cat >try.c <<EOM
b4eb6b3d
JH
7948/* Test for whether ELF binaries are produced */
7949#include <fcntl.h>
55954f19
JH
7950#$i_stdlib I_STDLIB
7951#ifdef I_STDLIB
b4eb6b3d 7952#include <stdlib.h>
55954f19 7953#endif
4fb7dc7d
JH
7954#$i_unistd I_UNISTD
7955#ifdef I_UNISTD
7956#include <unistd.h>
7957#endif
b4eb6b3d
JH
7958int main() {
7959 char b[4];
7960 int i = open("a.out",O_RDONLY);
5b813a60 7961 if(i == -1)
b4eb6b3d
JH
7962 exit(1); /* fail */
7963 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7964 exit(0); /* succeed (yes, it's ELF) */
7965 else
7966 exit(1); /* fail */
7967}
7968EOM
5440bc8e 7969 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7970 cat <<EOM
7971You appear to have ELF support. I'll use $cc to build dynamic libraries.
7972EOM
7973 dflt="$cc"
f1ce3bf1 7974 bin_ELF="$define"
b4eb6b3d
JH
7975 else
7976 echo "I'll use ld to build dynamic libraries."
7977 dflt='ld'
7978 fi
5b813a60 7979 $rm_try
b4eb6b3d
JH
7980 ;;
7981 *) dflt="$ld"
7982 ;;
7983 esac
7984
7985 rp="What command should be used to create dynamic libraries?"
7986 . ./myread
7987 ld="$ans"
7988
7989 cat << EOM
7990
7991Some systems may require passing special flags to $ld to create a
7992library that can be dynamically loaded. If your ld flags include
7993-L/other/path options to locate libraries outside your loader's normal
7994search path, you may need to specify those -L options here as well. To
7995use no flags, say "none".
7996
7997EOM
7998 case "$lddlflags" in
7999 '') case "$osname" in
8000 beos) dflt='-nostart' ;;
df00ff3b 8001 haiku) dflt='-shared' ;;
b4eb6b3d
JH
8002 hpux) dflt='-b';
8003 case "$gccversion" in
8004 '') dflt="$dflt +vnocompatwarnings" ;;
8005 esac
5b813a60 8006 ;;
15fcae63 8007 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
8008 next) dflt='none' ;;
8009 solaris) dflt='-G' ;;
8010 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 8011 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
8012 *) dflt='none' ;;
8013 esac
8014 ;;
8015 *) dflt="$lddlflags" ;;
8016 esac
8017
8018 : Try to guess additional flags to pick up local libraries.
8019 : Be careful not to append to a plain 'none'
8020 case "$dflt" in
8021 none) dflt='' ;;
8022 esac
8023 for thisflag in $ldflags; do
8024 case "$thisflag" in
b5b9f165 8025 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
8026 case " $dflt " in
8027 *" $thisflag "*) ;;
8028 *) dflt="$dflt $thisflag" ;;
8029 esac
8030 ;;
8031 esac
8032 done
8033
8034 case "$dflt" in
8035 ''|' ') dflt='none' ;;
8036 esac
8037
8f68b0e6
AD
8038 case "$ldflags" in
8039 *-fstack-protector*)
8040 case "$dflt" in
8041 *-fstack-protector*) ;; # Don't add it again
8042 *) dflt="$dflt -fstack-protector" ;;
8043 esac
8044 ;;
8045 esac
8046
8047
b4eb6b3d
JH
8048 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8049 . ./myread
8050 case "$ans" in
8051 none) lddlflags=' ' ;;
8052 *) lddlflags="$ans" ;;
8053 esac
8054
8055 cat <<EOM
8056
8057Some systems may require passing special flags to $cc to indicate that
8058the resulting executable will use dynamic linking. To use no flags,
8059say "none".
8060
8061EOM
8062 case "$ccdlflags" in
8063 '') case "$osname" in
fb2e1bc0 8064 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
8065 next|sunos) dflt='none' ;;
8066 *) dflt='none' ;;
b4eb6b3d
JH
8067 esac ;;
8068 ' ') dflt='none' ;;
8069 *) dflt="$ccdlflags" ;;
8070 esac
8071 rp="Any special flags to pass to $cc to use dynamic linking?"
8072 . ./myread
8073 case "$ans" in
8074 none) ccdlflags=' ' ;;
8075 *) ccdlflags="$ans" ;;
8076 esac
8077 ;;
8078*) usedl="$undef"
8079 ld='ld'
8080 dlsrc='dl_none.xs'
8081 lddlflags=''
8082 ccdlflags=''
8083 ;;
8084esac
8085
34f1896b 8086: Do we want a shared libperl?
b4eb6b3d
JH
8087also=''
8088case "$usedl" in
8089$undef)
8090 # No dynamic loading being used, so don't bother even to prompt.
8091 useshrplib='false'
8092 ;;
8093*) case "$useshrplib" in
8094 '') case "$osname" in
df00ff3b 8095 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
b4eb6b3d
JH
8096 dflt=y
8097 also='Building a shared libperl is required for dynamic loading to work on your system.'
8098 ;;
8099 next*)
8100 case "$osvers" in
8101 4*) dflt=y
8102 also='Building a shared libperl is needed for MAB support.'
8103 ;;
8104 *) dflt=n
8105 ;;
8106 esac
8107 ;;
8108 *) dflt=n
8109 ;;
8110 esac
8111 ;;
8112 $define|true|[Yy]*)
8113 dflt=y
8114 ;;
8115 *) dflt=n
8116 ;;
8117 esac
8118 $cat << EOM
8119
8120The perl executable is normally obtained by linking perlmain.c with
8121libperl${_a}, any static extensions (usually just DynaLoader), and
8122any other libraries needed on this system (such as -lm, etc.). Since
8123your system supports dynamic loading, it is probably possible to build
8124a shared libperl.$so. If you will have more than one executable linked
8125to libperl.$so, this will significantly reduce the size of each
5cadb3f3 8126executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
8127default is probably sensible for your system.
8128$also
8129
8130EOM
8131 rp="Build a shared libperl.$so (y/n)"
8132 . ./myread
8133 case "$ans" in
8134 true|$define|[Yy]*)
8135 useshrplib='true' ;;
8136 *) useshrplib='false' ;;
8137 esac
8138 ;;
8139esac
8140
8141case "$useshrplib" in
8142true)
df31f9b1
MB
8143 case "$userelocatableinc" in
8144 true|define)
8145 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8146 echo "See INSTALL for an explanation why that won't work." >&4
8147 exit 4
8148 ;;
8149 esac
b4eb6b3d
JH
8150 case "$libperl" in
8151 '')
8152 # Figure out a good name for libperl.so. Since it gets stored in
8153 # a version-specific architecture-dependent library, the version
8154 # number isn't really that important, except for making cc/ld happy.
8155 #
56e771c1 8156 # A name such as libperl.so.10.1
b4eb6b3d 8157 majmin="libperl.$so.$patchlevel.$subversion"
56e771c1 8158 # A name such as libperl.so.100
b4eb6b3d
JH
8159 majonly=`echo $patchlevel $subversion |
8160 $awk '{printf "%d%02d", $1, $2}'`
8161 majonly=libperl.$so.$majonly
8162 # I'd prefer to keep the os-specific stuff here to a minimum, and
8163 # rely on figuring it out from the naming of libc.
8164 case "${osname}${osvers}" in
8165 next4*)
8166 dflt=libperl.5.$so
8167 # XXX How handle the --version stuff for MAB?
8168 ;;
fb2e1bc0 8169 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8170 dflt=libperl.$so
8171 ;;
56e771c1
RU
8172 cygwin*) # ld links now against the dll directly
8173 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8174 majonly=`echo $patchlevel $subversion |
8175 $awk '{printf "%03d%03d", $1, $2}'`
8176 majonly=cygperl5.$majonly.$so
8177 dflt=$majmin
b4eb6b3d
JH
8178 ;;
8179 *) # Try to guess based on whether libc has major.minor.
8180 case "$libc" in
8181 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8182 *libc.$so.[0-9]*) dflt=$majonly ;;
8183 *) dflt=libperl.$so ;;
8184 esac
8185 ;;
8186 esac
8187 ;;
8188 *) dflt=$libperl
8189 ;;
8190 esac
8191 cat << EOM
8192
8193I need to select a good name for the shared libperl. If your system uses
8194library names with major and minor numbers, then you might want something
8195like $majmin. Alternatively, if your system uses a single version
8196number for shared libraries, then you might want to use $majonly.
8197Or, your system might be quite happy with a simple libperl.$so.
8198
8199Since the shared libperl will get installed into a version-specific
8200architecture-dependent directory, the version number of the shared perl
8201library probably isn't important, so the default should be o.k.
8202
8203EOM
8204 rp='What name do you want to give to the shared libperl?'
8205 . ./myread
8206 libperl=$ans
8207 echo "Ok, I'll use $libperl"
8208 ;;
8209*)
8210 libperl="libperl${_a}"
8211 ;;
8212esac
8213
8214# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8215case "$shrpdir" in
8216'') ;;
8217*) $cat >&4 <<EOM
8218WARNING: Use of the shrpdir variable for the installation location of
8219the shared $libperl is not supported. It was never documented and
8220will not work in this version. Let me (perlbug@perl.org)
8221know of any problems this may cause.
8222
8223EOM
8224 case "$shrpdir" in
8225 "$archlibexp/CORE")
8226 $cat >&4 <<EOM
8227But your current setting of $shrpdir is
8228the default anyway, so it's harmless.
8229EOM
8230 ;;
8231 *)
8232 $cat >&4 <<EOM
8233Further, your current attempted setting of $shrpdir
8234conflicts with the value of $archlibexp/CORE
8235that installperl will use.
8236EOM
8237 ;;
8238 esac
8239 ;;
8240esac
8241
8242# How will the perl executable find the installed shared $libperl?
8243# Add $xxx to ccdlflags.
8244# If we can't figure out a command-line option, use $shrpenv to
8245# set env LD_RUN_PATH. The main perl makefile uses this.
8246shrpdir=$archlibexp/CORE
8247xxx=''
8248tmp_shrpenv=''
8249if "$useshrplib"; then
34f1896b 8250 case "$osname" in
b4eb6b3d
JH
8251 aix)
8252 # We'll set it in Makefile.SH...
8253 ;;
b5b9f165 8254 solaris)
b4eb6b3d
JH
8255 xxx="-R $shrpdir"
8256 ;;
c5f63f38 8257 freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8258 xxx="-Wl,-R$shrpdir"
8259 ;;
fb2e1bc0 8260 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8261 xxx="-Wl,-rpath,$shrpdir"
8262 ;;
8263 next)
8264 # next doesn't like the default...
8265 ;;
8266 beos)
8267 # beos doesn't like the default, either.
8268 ;;
df00ff3b
IW
8269 haiku)
8270 # Haiku doesn't like the default, either.
8271 ;;
b4eb6b3d
JH
8272 hpux*)
8273 # hpux doesn't like the default, either.
8274 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8275 ;;
56e771c1
RU
8276 cygwin)
8277 # cygwin needs only ldlibpth
8278 ;;
b4eb6b3d
JH
8279 *)
8280 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8281 ;;
8282 esac
8283 case "$xxx" in
8284 '') ;;
34f1896b 8285 *)
b4eb6b3d
JH
8286 # Only add $xxx if it isn't already in ccdlflags.
8287 case " $ccdlflags " in
8288 *" $xxx "*) ;;
8289 *) ccdlflags="$ccdlflags $xxx"
8290 cat <<EOM >&4
8291
8292Adding $xxx to the flags
34f1896b 8293passed to $ld so that the perl executable will find the
b4eb6b3d
JH
8294installed shared $libperl.
8295
8296EOM
8297 ;;
8298 esac
8299 ;;
8300 esac
8301fi
8302# Fix ccdlflags in AIX for building external extensions.
8303# (For building Perl itself bare -bE:perl.exp is needed,
8304# Makefile.SH takes care of this.)
8305case "$osname" in
8306aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8307esac
8308# Respect a hint or command-line value.
8309case "$shrpenv" in
8310'') shrpenv="$tmp_shrpenv" ;;
8311esac
8312case "$ldlibpthname" in
8313'') ldlibpthname=LD_LIBRARY_PATH ;;
8314none) ldlibpthname='' ;;
8315esac
8316
8317: determine where manual pages are on this system
8318echo " "
8319case "$sysman" in
8320'')
4a0a3829
SD
8321 syspath='/usr/share/man/man1 /usr/man/man1'
8322 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8323 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8324 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8325 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8326 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8327 sysman=`./loc . /usr/man/man1 $syspath`
8328 ;;
8329esac
8330if $test -d "$sysman"; then
8331 echo "System manual is in $sysman." >&4
8332else
8333 echo "Could not find manual pages in source form." >&4
8334fi
8335
8336: determine where manual pages go
8337set man1dir man1dir none
8338eval $prefixit
8339$cat <<EOM
8340
8341$spackage has manual pages available in source form.
8342EOM
8343case "$nroff" in
8344nroff)
8345 echo "However, you don't have nroff, so they're probably useless to you."
8346 case "$man1dir" in
8347 '') man1dir="none";;
8348 esac;;
8349esac
8350echo "If you don't want the manual sources installed, answer 'none'."
8351case "$man1dir" in
8352' ') dflt=none
8353 ;;
8354'')
4a0a3829
SD
8355 lookpath="$prefixexp/share/man/man1"
8356 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8357 lookpath="$lookpath $prefixexp/man/p_man/man1"
8358 lookpath="$lookpath $prefixexp/man/u_man/man1"
8359 lookpath="$lookpath $prefixexp/man/man.1"
8360 case "$sysman" in
8361 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8362 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8363 esac
8364 set dflt
8365 eval $prefixup
8366 ;;
8367*) dflt="$man1dir"
8368 ;;
8369esac
8370echo " "
8371fn=dn+~
8372rp="Where do the main $spackage manual pages (source) go?"
8373. ./getfile
8374if $test "X$man1direxp" != "X$ansexp"; then
8375 installman1dir=''
8376fi
79522dd2
NC
8377prefixvar=man1dir
8378. ./setprefixvar
8379
477140ee
NC
8380case "$man1dir" in
8381'') man1dir=' '
8382 installman1dir='';;
8383esac
b4eb6b3d
JH
8384
8385: What suffix to use on installed man pages
8386
8387case "$man1dir" in
8388' ')
8389 man1ext='0'
8390 ;;
8391*)
8392 rp="What suffix should be used for the main $spackage man pages?"
8393 case "$man1ext" in
8394 '') case "$man1dir" in
8395 *1) dflt=1 ;;
8396 *1p) dflt=1p ;;
8397 *1pm) dflt=1pm ;;
8398 *l) dflt=l;;
8399 *n) dflt=n;;
8400 *o) dflt=o;;
8401 *p) dflt=p;;
8402 *C) dflt=C;;
8403 *L) dflt=L;;
8404 *L1) dflt=L1;;
8405 *) dflt=1;;
8406 esac
8407 ;;
8408 *) dflt="$man1ext";;
8409 esac
8410 . ./myread
8411 man1ext="$ans"
8412 ;;
8413esac
8414
8415: see if we can have long filenames
8416echo " "
8417first=123456789abcdef
8418$rm -f $first
8419if (echo hi >$first) 2>/dev/null; then
8420 if $test -f 123456789abcde; then
8421 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8422 val="$undef"
8423 else
8424 echo 'You can have filenames longer than 14 characters.'>&4
8425 val="$define"
8426 fi
8427else
8428 $cat <<'EOM'
8429You can't have filenames longer than 14 chars.
8430You can't even think about them!
8431EOM
8432 val="$undef"
776a38e3 8433fi
b4eb6b3d
JH
8434set d_flexfnam
8435eval $setvar
8436$rm -rf 123456789abcde*
8437
8438: determine where library module manual pages go
8439set man3dir man3dir none
8440eval $prefixit
8441$cat <<EOM
8442
8443$spackage has manual pages for many of the library modules.
8444EOM
8445
8446case "$nroff" in
8447nroff)
8448 $cat <<'EOM'
8449However, you don't have nroff, so they're probably useless to you.
8450EOM
8451 case "$man3dir" in
8452 '') man3dir="none";;
8453 esac;;
8454esac
8455
8456case "$d_flexfnam" in
8457undef)
8458 $cat <<'EOM'
f3f1a2d8 8459However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8460EOM
8461 case "$man3dir" in
8462 '') man3dir="none";;
8463 esac;;
8464esac
8465
8466echo "If you don't want the manual sources installed, answer 'none'."
8467prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8468case "$man3dir" in
8469'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8470 if $test -d "$privlib/man/man3"; then
8471 cat <<EOM >&4
8472
8473WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8474$privlib/man/man3. This version will suggest a
8475new default of $dflt.
b4eb6b3d
JH
8476EOM
8477 tdflt=$dflt
8478 dflt='n'
8479 rp='Do you wish to preserve the old behavior?(y/n)'
8480 . ./myread
8481 case "$ans" in
8482 y*) dflt="$privlib/man/man3" ;;
8483 *) dflt=$tdflt ;;
8484 esac
8485 fi
8486 ;;
8487*) dflt="$man3dir" ;;
8488esac
8489case "$dflt" in
8490' ') dflt=none ;;
8491esac
8492echo " "
8493fn=dn+~
8494rp="Where do the $package library man pages (source) go?"
8495. ./getfile
79522dd2
NC
8496prefixvar=man3dir
8497. ./setprefixvar
8498
477140ee
NC
8499case "$man3dir" in
8500'') man3dir=' '
8501 installman3dir='';;
8502esac
b4eb6b3d
JH
8503
8504: What suffix to use on installed man pages
8505case "$man3dir" in
8506' ')
8507 man3ext='0'
8508 ;;
8509*)
8510 rp="What suffix should be used for the $package library man pages?"
8511 case "$man3ext" in
8512 '') case "$man3dir" in
8513 *3) dflt=3 ;;
8514 *3p) dflt=3p ;;
8515 *3pm) dflt=3pm ;;
8516 *l) dflt=l;;
8517 *n) dflt=n;;
8518 *o) dflt=o;;
8519 *p) dflt=p;;
8520 *C) dflt=C;;
8521 *L) dflt=L;;
8522 *L3) dflt=L3;;
8523 *) dflt=3;;
8524 esac
8525 ;;
8526 *) dflt="$man3ext";;
8527 esac
8528 . ./myread
8529 man3ext="$ans"
8530 ;;
8531esac
8532
8533: see if we have to deal with yellow pages, now NIS.
0384a54a 8534if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8535 if $test -f /usr/etc/nibindd; then
8536 echo " "
8537 echo "I'm fairly confident you're on a NeXT."
8538 echo " "
8539 rp='Do you get the hosts file via NetInfo?'
8540 dflt=y
8541 case "$hostcat" in
8542 nidump*) ;;
8543 '') ;;
8544 *) dflt=n;;
8545 esac
8546 . ./myread
8547 case "$ans" in
8548 y*) hostcat='nidump hosts .';;
8549 *) case "$hostcat" in
8550 nidump*) hostcat='';;
8551 esac
8552 ;;
8553 esac
8554 fi
8555 case "$hostcat" in
8556 nidump*) ;;
8557 *)
8558 case "$hostcat" in
8559 *ypcat*) dflt=y;;
8560 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8561 dflt=y
8562 else
8563 dflt=n
8564 fi;;
8565 *) dflt=n;;
8566 esac
8567 echo " "
8568 rp='Are you getting the hosts file via yellow pages?'
8569 . ./myread
8570 case "$ans" in
8571 y*) hostcat='ypcat hosts';;
8572 *) hostcat='cat /etc/hosts';;
8573 esac
8574 ;;
8575 esac
8576fi
8577case "$hostcat" in
8578'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8579esac
8580case "$groupcat" in
8581'') test -f /etc/group && groupcat='cat /etc/group';;
8582esac
8583case "$passcat" in
8584'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8585esac
8586
8587: now get the host name
8588echo " "
8589echo "Figuring out host name..." >&4
8590case "$myhostname" in
8591'') cont=true
8592 echo 'Maybe "hostname" will work...'
73614538 8593 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8594 myhostname=$tans
8595 phostname=hostname
8596 cont=''
8597 fi
8598 ;;
8599*) cont='';;
8600esac
8601if $test "$cont"; then
8602 if ./xenix; then
8603 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8604 if tans=`cat /etc/systemid 2>&1` ; then
8605 myhostname=$tans
8606 phostname='cat /etc/systemid'
8607 echo "Whadyaknow. Xenix always was a bit strange..."
8608 cont=''
8609 fi
8610 elif $test -r /etc/systemid; then
8611 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8612 fi
8613fi
8614if $test "$cont"; then
8615 echo 'No, maybe "uuname -l" will work...'
73614538 8616 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8617 myhostname=$tans
8618 phostname='uuname -l'
8619 else
8620 echo 'Strange. Maybe "uname -n" will work...'
73614538 8621 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8622 myhostname=$tans
8623 phostname='uname -n'
8624 else
8625 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8626 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8627 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8628 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8629 else
8630 case "$myhostname" in
8631 '') echo "Does this machine have an identity crisis or something?"
8632 phostname='';;
8633 *)
8634 echo "Well, you said $myhostname before..."
8635 phostname='echo $myhostname';;
8636 esac
8637 fi
8638 fi
8639 fi
8640fi
52a549d0
JH
8641case "$myhostname" in
8642'') myhostname=noname ;;
8643esac
b4eb6b3d
JH
8644: you do not want to know about this
8645set $myhostname
8646myhostname=$1
8647
8648: verify guess
8649if $test "$myhostname" ; then
8650 dflt=y
8651 rp='Your host name appears to be "'$myhostname'".'" Right?"
8652 . ./myread
8653 case "$ans" in
8654 y*) ;;
8655 *) myhostname='';;
8656 esac
8657fi
8658
8659: bad guess or no guess
8660while $test "X$myhostname" = X ; do
8661 dflt=''
8662 rp="Please type the (one word) name of your host:"
8663 . ./myread
8664 myhostname="$ans"
8665done
8666
8667: translate upper to lower if necessary
8668case "$myhostname" in
8669*[A-Z]*)
8670 echo "(Normalizing case in your host name)"
8671 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8672 ;;
8673esac
8674
8675case "$myhostname" in
8676*.*)
8677 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8678 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8679 echo "(Trimming domain name from host name--host name is now $myhostname)"
8680 ;;
8681*) case "$mydomain" in
8682 '')
8683 {
8684 test "X$hostcat" = "Xypcat hosts" &&
8685 ypmatch "$myhostname" hosts 2>/dev/null |\
8686 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8687 $test -s hosts
8688 } || {
8689 test "X$hostcat" != "X" &&
8690 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8691 /[ ]$myhostname[ . ]/p" > hosts
8692 }
8693 tmp_re="[ . ]"
f08cbdd1
PP
8694 if $test -f hosts; then
8695 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8696 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8697 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8698 hosts | $sort | $uniq | \
8699 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8700 case `$echo X$dflt` in
8701 X*\ *) echo "(Several hosts in the database matched hostname)"
8702 dflt=.
8703 ;;
8704 X.) echo "(You do not have fully-qualified names in the hosts database)"
8705 ;;
8706 esac
8707 else
8708 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8709 dflt=.
f08cbdd1 8710 fi
b4eb6b3d
JH
8711 case "$dflt" in
8712 .)
8713 tans=`./loc resolv.conf X /etc /usr/etc`
8714 if $test -f "$tans"; then
8715 echo "(Attempting domain name extraction from $tans)"
8716 dflt=.`$sed -n -e 's/ / /g' \
8717 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
1d40d392 8718 -e 1q 2>/dev/null`
b4eb6b3d
JH
8719 case "$dflt" in
8720 .) dflt=.`$sed -n -e 's/ / /g' \
8721 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
1d40d392 8722 -e 1q 2>/dev/null`
b4eb6b3d
JH
8723 ;;
8724 esac
8725 fi
8726 ;;
8727 esac
8728 case "$dflt" in
8729 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8730 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8731 case "$dflt" in
8732 '') dflt='.';;
8733 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8734 esac
8735 ;;
8736 esac
59c9e5d6
PP
8737 case "$dflt$osname" in
8738 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8739 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8740 ;;
8741 esac
b4eb6b3d
JH
8742 case "$dflt" in
8743 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8744 dflt='.nonet'
b4eb6b3d
JH
8745 ;;
8746 esac
8747 $rm -f hosts
8748 ;;
8749 *) dflt="$mydomain";;
8750 esac;;
8751esac
8752echo " "
8753rp="What is your domain name?"
8754. ./myread
8755tans="$ans"
8756case "$ans" in
8757'') ;;
8758.*) ;;
8759*) tans=".$tans";;
8760esac
8761mydomain="$tans"
8762
8763: translate upper to lower if necessary
8764case "$mydomain" in
8765*[A-Z]*)
8766 echo "(Normalizing case in your domain name)"
8767 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8768 ;;
8769esac
8770
8771: a little sanity check here
8772case "$phostname" in
8773'') ;;
8774*)
8775 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8776 $myhostname$mydomain|$myhostname) ;;
8777 *)
8778 case "$phostname" in
8779 sed*)
8780 echo "(That doesn't agree with your whoami.h file, by the way.)"
8781 ;;
8782 *)
8783 echo "(That doesn't agree with your $phostname command, by the way.)"
8784 ;;
8785 esac
8786 ;;
8787 esac
8788 ;;
8789esac
8790
776a38e3 8791: determine the e-mail address of the user who is running us
b4eb6b3d
JH
8792$cat <<EOM
8793
8794I need to get your e-mail address in Internet format if possible, i.e.
8795something like user@host.domain. Please answer accurately since I have
8796no easy means to double check it. The default value provided below
8797is most probably close to reality but may not be valid from outside
8798your organization...
8799
8800EOM
8801cont=x
8802while test "$cont"; do
8803 case "$cf_email" in
8804 '') dflt="$cf_by@$myhostname$mydomain";;
8805 *) dflt="$cf_email";;
8806 esac
8807 rp='What is your e-mail address?'
8808 . ./myread
8809 cf_email="$ans"
8810 case "$cf_email" in
8811 *@*.*) cont='' ;;
8812 *)
8813 rp='Address does not look like an Internet one. Use it anyway?'
8814 case "$fastread" in
8815 yes) dflt=y ;;
8816 *) dflt=n ;;
8817 esac
8818 . ./myread
8819 case "$ans" in
8820 y*) cont='' ;;
8821 *) echo " " ;;
8822 esac
8823 ;;
8824 esac
8825done
8826
34f1896b 8827: Ask e-mail of administrator
b4eb6b3d
JH
8828$cat <<EOM
8829
8830If you or somebody else will be maintaining perl at your site, please
8831fill in the correct e-mail address here so that they may be contacted
8832if necessary. Currently, the "perlbug" program included with perl
8833will send mail to this address in addition to perlbug@perl.org. You may
8834enter "none" for no administrator.
8835
8836EOM
8837case "$perladmin" in
8838'') dflt="$cf_email";;
8839*) dflt="$perladmin";;
8840esac
8841rp='Perl administrator e-mail address'
8842. ./myread
8843perladmin="$ans"
8844
91f55cc7
MB
8845: determine whether to only install version-specific parts.
8846echo " "
8847$cat <<EOM
8848Do you want to install only the version-specific parts of the perl
8849distribution? Usually you do *not* want to do this.
8850EOM
8851case "$versiononly" in
8852"$define"|[Yy]*|true) dflt='y' ;;
8853*) dflt='n';
8854esac
8855rp="Do you want to install only the version-specific parts of perl?"
8856. ./myread
8857case "$ans" in
8858[yY]*) val="$define";;
8859*) val="$undef" ;;
8860esac
8861set versiononly
8862eval $setvar
8863
8864case "$versiononly" in
8865"$define") inc_version_list=''
8866 inc_version_list_init=0
8867 ;;
8868esac
8869
8870: figure out how to guarantee perl startup
8871: XXX Note that this currently takes advantage of the bug that binexp ignores
8872: the Configure -Dinstallprefix setting, which in turn means that under
8873: relocatable @INC, initialinstalllocation is what binexp started as.
8874case "$startperl" in
8875'')
8876 case "$sharpbang" in
8877 *!)
8878 $cat <<EOH
8879
8880I can use the #! construct to start perl on your system. This will
8881make startup of perl scripts faster, but may cause problems if you
8882want to share those scripts and perl is not in a standard place
8883($initialinstalllocation/perl) on all your platforms. The alternative
8884is to force a shell by starting the script with a single ':' character.
8885
8886EOH
8887 case "$versiononly" in
8888 "$define") dflt="$initialinstalllocation/perl$version";;
8889 *) dflt="$initialinstalllocation/perl";;
8890 esac
8891 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8892 . ./myread
8893 case "$ans" in
8894 none) startperl=": # use perl";;
8895 *) startperl="#!$ans"
8896 if $test 30 -lt `echo "$ans" | wc -c`; then
8897 $cat >&4 <<EOM
8898
8899WARNING: Some systems limit the #! command to 32 characters.
8900If you experience difficulty running Perl scripts with #!, try
8901installing Perl in a directory with a shorter pathname.
8902
8903EOM
8904 fi ;;
8905 esac
8906 ;;
8907 *) startperl=": # use perl"
8908 ;;
8909 esac
8910 ;;
8911esac
8912echo "I'll use $startperl to start perl scripts."
8913
8914: figure best path for perl in scripts
8915case "$perlpath" in
8916'')
8917 case "$versiononly" in
8918 "$define") perlpath="$initialinstalllocation/perl$version";;
8919 *) perlpath="$initialinstalllocation/perl";;
8920 esac
8921 case "$startperl" in
8922 *!*) ;;
8923 *)
8924 $cat <<EOH
8925
8926I will use the "eval 'exec'" idiom to start Perl on your system.
8927I can use the full path of your Perl binary for this purpose, but
8928doing so may cause problems if you want to share those scripts and
8929Perl is not always in a standard place ($initialinstalllocation/perl).
8930
8931EOH
8932 dflt="$initialinstalllocation/perl"
8933 rp="What path shall I use in \"eval 'exec'\"?"
8934 . ./myread
8935 perlpath="$ans"
8936 ;;
8937 esac
8938 ;;
8939esac
8940case "$startperl" in
8941*!*) ;;
8942*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8943esac
8944
b4eb6b3d
JH
8945: determine where public executable scripts go
8946set scriptdir scriptdir
8947eval $prefixit
8948case "$scriptdir" in
8949'')
8950 dflt="$bin"
8951 : guess some guesses
8952 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8953 $test -d /usr/share/bin && dflt=/usr/share/bin
8954 $test -d /usr/local/script && dflt=/usr/local/script
8955 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8956 $test -d $prefixexp/script && dflt=$prefixexp/script
8957 set dflt
8958 eval $prefixup
8959 ;;
8960*) dflt="$scriptdir"
8961 ;;
8962esac
8963$cat <<EOM
f3f1a2d8 8964
b4eb6b3d
JH
8965Some installations have a separate directory just for executable scripts so
8966that they can mount it across multiple architectures but keep the scripts in
8967one spot. You might, for example, have a subdirectory of /usr/share for this.
8968Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8969
b4eb6b3d
JH
8970EOM
8971fn=d~
8972rp='Where do you keep publicly executable scripts?'
8973. ./getfile
8974if $test "X$ansexp" != "X$scriptdirexp"; then
8975 installscript=''
8976fi
f3f1a2d8 8977installscriptdir=''
79522dd2
NC
8978prefixvar=scriptdir
8979. ./setprefixvar
8980: A little fix up for an irregularly named variable.
8981installscript="$installscriptdir"
8982
b4eb6b3d
JH
8983: determine where add-on public executables go
8984case "$sitebin" in
8985'') dflt=$siteprefix/bin ;;
8986*) dflt=$sitebin ;;
8987esac
8988fn=d~
8989rp='Pathname where the add-on public executables should be installed?'
8990. ./getfile
79522dd2
NC
8991prefixvar=sitebin
8992. ./setprefixvar
b4eb6b3d 8993
6e1038e0 8994: determine where add-on html pages go
8d2cbf27 8995: There is no standard location, so try to copy the previously-selected
6e1038e0 8996: directory structure for the core html pages.
8d2cbf27
JH
8997case "$sitehtml1dir" in
8998'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8999*) dflt=$sitehtml1dir ;;
6e1038e0
MB
9000esac
9001case "$dflt" in
9002''|' ') dflt=none ;;
9003esac
9004fn=dn+~
9005rp='Pathname where the site-specific html pages should be installed?'
9006. ./getfile
79522dd2
NC
9007prefixvar=sitehtml1dir
9008. ./setprefixvar
6e1038e0
MB
9009
9010: determine where add-on library html pages go
9011: There is no standard location, so try to copy the previously-selected
9012: directory structure for the core html pages.
8d2cbf27
JH
9013case "$sitehtml3dir" in
9014'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9015*) dflt=$sitehtml3dir ;;
6e1038e0
MB
9016esac
9017case "$dflt" in
9018''|' ') dflt=none ;;
9019esac
9020fn=dn+~
9021rp='Pathname where the site-specific library html pages should be installed?'
9022. ./getfile
79522dd2
NC
9023prefixvar=sitehtml3dir
9024. ./setprefixvar
6e1038e0
MB
9025
9026: determine where add-on manual pages go
91e123a8
JH
9027case "$siteman1dir" in
9028'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9029*) dflt=$siteman1dir ;;
6e1038e0 9030esac
257059b5
JH
9031case "$dflt" in
9032''|' ') dflt=none ;;
9033esac
6e1038e0
MB
9034fn=dn+~
9035rp='Pathname where the site-specific manual pages should be installed?'
9036. ./getfile
79522dd2
NC
9037prefixvar=siteman1dir
9038. ./setprefixvar
6e1038e0
MB
9039
9040: determine where add-on library man pages go
91e123a8
JH
9041case "$siteman3dir" in
9042'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9043*) dflt=$siteman3dir ;;
6e1038e0 9044esac
257059b5
JH
9045case "$dflt" in
9046''|' ') dflt=none ;;
9047esac
6e1038e0
MB
9048fn=dn+~
9049rp='Pathname where the site-specific library manual pages should be installed?'
9050. ./getfile
79522dd2
NC
9051prefixvar=siteman3dir
9052. ./setprefixvar
6e1038e0
MB
9053
9054: determine where add-on public executable scripts go
9055case "$sitescript" in
9056'') dflt=$siteprefix/script
9057 $test -d $dflt || dflt=$sitebin ;;
9058*) dflt="$sitescript" ;;
9059esac
9060fn=d~+
9061rp='Pathname where add-on public executable scripts should be installed?'
9062. ./getfile
79522dd2
NC
9063prefixvar=sitescript
9064. ./setprefixvar
6e1038e0 9065
34f1896b 9066: Check if faststdio is requested and available
15b61c98
JH
9067case "$usefaststdio" in
9068$define|true|[yY]*|'')
9069 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9070 case "$xversion" in
9071 [68]) dflt='y' ;;
9072 *) dflt='n' ;;
9073 esac
9074 ;;
9075*) dflt='n';;
9076esac
9077cat <<EOM
9078
9079Perl can be built to use 'fast stdio', which means using the stdio
9080library but also directly manipulating the stdio buffers to enable
9081faster I/O. Using stdio is better for backward compatibility (especially
9082for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9083interface has been preferred instead of stdio.
9084
9085If this doesn't make any sense to you, just accept the default '$dflt'.
9086EOM
9087rp='Use the "fast stdio" if available?'
9088. ./myread
9089case "$ans" in
34f1896b 9090y|Y) val="$define" ;;
15b61c98
JH
9091*) val="$undef" ;;
9092esac
9093set usefaststdio
9094eval $setvar
9095
9096
96056487
JH
9097: define an is-a-typedef? function
9098typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9099case "$inclist" in
9100"") inclist="sys/types.h";;
9101esac;
9102eval "varval=\$$var";
9103case "$varval" in
9104"")
9105 $rm -f temp.c;
9106 for inc in $inclist; do
9107 echo "#include <$inc>" >>temp.c;
9108 done;
9109 echo "#ifdef $type" >> temp.c;
9110 echo "printf(\"We have $type\");" >> temp.c;
9111 echo "#endif" >> temp.c;
9112 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9113 if $contains $type temp.E >/dev/null 2>&1; then
9114 eval "$var=\$type";
9115 else
9116 eval "$var=\$def";
9117 fi;
9118 $rm -f temp.?;;
9119*) eval "$var=\$varval";;
9120esac'
9121
9122: define an is-a-typedef? function that prompts if the type is not available.
9123typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9124case "$inclist" in
9125"") inclist="sys/types.h";;
9126esac;
9127eval "varval=\$$var";
9128case "$varval" in
9129"")
9130 $rm -f temp.c;
9131 for inc in $inclist; do
9132 echo "#include <$inc>" >>temp.c;
9133 done;
9134 echo "#ifdef $type" >> temp.c;
9135 echo "printf(\"We have $type\");" >> temp.c;
9136 echo "#endif" >> temp.c;
9137 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9138 echo " " ;
9139 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9140 if $contains $type temp.E >/dev/null 2>&1; then
9141 echo "$type found." >&4;
9142 eval "$var=\$type";
9143 else
9144 echo "$type NOT found." >&4;
9145 dflt="$def";
9146 . ./myread ;
9147 eval "$var=\$ans";
9148 fi;
9149 $rm -f temp.?;;
9150*) eval "$var=\$varval";;
9151esac'
9152
9153: see what type lseek is declared as in the kernel
9154rp="What is the type used for lseek's offset on this system?"
9155set off_t lseektype long stdio.h sys/types.h
9156eval $typedef_ask
9157
9158echo " "
9159echo "Checking to see how big your file offsets are..." >&4
9160$cat >try.c <<EOCP
9161#include <sys/types.h>
9162#include <stdio.h>
9163int main()
9164{
9165 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9166 return(0);
96056487
JH
9167}
9168EOCP
9169set try
9170if eval $compile_ok; then
9171 lseeksize=`$run ./try`
9172 echo "Your file offsets are $lseeksize bytes long."
9173else
9174 dflt=$longsize
9175 echo " "
9176 echo "(I can't seem to compile the test program. Guessing...)"
9177 rp="What is the size of your file offsets (in bytes)?"
9178 . ./myread
9179 lseeksize="$ans"
9180fi
5b813a60 9181$rm_try
96056487
JH
9182
9183: see what type file positions are declared as in the library
9184rp="What is the type for file position used by fsetpos()?"
9185set fpos_t fpostype long stdio.h sys/types.h
9186eval $typedef_ask
9187
613d6c3e 9188: Check size for Fpos_t
96056487
JH
9189echo " "
9190case "$fpostype" in
9191*_t) zzz="$fpostype" ;;
9192*) zzz="fpos_t" ;;
9193esac
613d6c3e 9194echo "Checking the size of $zzz..." >&4
96056487
JH
9195cat > try.c <<EOCP
9196#include <sys/types.h>
9197#include <stdio.h>
d1daaddf
JH
9198#$i_stdlib I_STDLIB
9199#ifdef I_STDLIB
9200#include <stdlib.h>
9201#endif
96056487
JH
9202int main() {
9203 printf("%d\n", (int)sizeof($fpostype));
9204 exit(0);
9205}
9206EOCP
9207set try
9208if eval $compile_ok; then
9209 yyy=`$run ./try`
9210 case "$yyy" in
9211 '') fpossize=4
9212 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9213 ;;
9214 *) fpossize=$yyy
9215 echo "Your $zzz is $fpossize bytes long."
9216 ;;
9217 esac
9218else
9219 dflt="$longsize"
9220 echo " " >&4
9221 echo "(I can't compile the test program. Guessing...)" >&4
9222 rp="What is the size of your file positions (in bytes)?"
9223 . ./myread
9224 fpossize="$ans"
9225fi
9226
613d6c3e 9227: Check for large file support
96056487
JH
9228# Backward compatibility (uselfs is deprecated).
9229case "$uselfs" in
9230"$define"|true|[yY]*)
9231 cat <<EOM >&4
9232
9233*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9234EOM
9235 uselargefiles="$define"
9236 ;;
5b813a60 9237esac
96056487
JH
9238
9239case "$lseeksize:$fpossize" in
92408:8) cat <<EOM
9241
9242You can have files larger than 2 gigabytes.
9243EOM
9244 val="$define" ;;
9245*) case "$uselargefiles" in
9246 "$undef"|false|[nN]*) dflt='n' ;;
9247 *) dflt='y' ;;
9248 esac
9249 cat <<EOM
9250
9251Perl can be built to understand large files (files larger than 2 gigabytes)
9252on some systems. To do so, Configure can be run with -Duselargefiles.
9253
9254If this doesn't make any sense to you, just accept the default '$dflt'.
9255EOM
9256 rp='Try to understand large files, if available?'
9257 . ./myread
9258 case "$ans" in
9259 y|Y) val="$define" ;;
9260 *) val="$undef" ;;
9261 esac
9262 ;;
9263esac
9264set uselargefiles
9265eval $setvar
96056487
JH
9266: Look for a hint-file generated 'call-back-unit'. If the
9267: user has specified that a large files perl is to be built,
9268: we may need to set or change some other defaults.
9da7673b
MB
9269if $test -f uselargefiles.cbu; then
9270 echo "Your platform has some specific hints regarding large file builds, using them..."
9271 . ./uselargefiles.cbu
9272fi
9273case "$uselargefiles" in
9274"$define")
96056487 9275 if $test -f uselargefiles.cbu; then
96056487
JH
9276 echo " "
9277 echo "Rechecking to see how big your file offsets are..." >&4
9278 $cat >try.c <<EOCP
9279#include <sys/types.h>
9280#include <stdio.h>
9281int main()
9282{
9283 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9284 return(0);
96056487
JH
9285}
9286EOCP
9287 set try
9288 if eval $compile_ok; then
9289 lseeksize=`$run ./try`
9290 $echo "Your file offsets are now $lseeksize bytes long."
9291 else
9292 dflt="$lseeksize"
9293 echo " "
9294 echo "(I can't seem to compile the test program. Guessing...)"
9295 rp="What is the size of your file offsets (in bytes)?"
9296 . ./myread
9297 lseeksize="$ans"
9298 fi
9299 case "$fpostype" in
9300 *_t) zzz="$fpostype" ;;
9301 *) zzz="fpos_t" ;;
9302 esac
5b813a60 9303 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9304 $cat > try.c <<EOCP
9305#include <sys/types.h>
9306#include <stdio.h>
55954f19
JH
9307#$i_stdlib I_STDLIB
9308#ifdef I_STDLIB
9309#include <stdlib.h>
9310#endif
96056487
JH
9311int main() {
9312 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9313 return(0);
96056487
JH
9314}
9315EOCP
9316 set try
9317 if eval $compile_ok; then
9318 yyy=`$run ./try`
9319 dflt="$lseeksize"
9320 case "$yyy" in
9321 '') echo " "
9322 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9323 ;;
9324 *) fpossize=$yyy
9325 echo " $fpossize bytes." >&4
9326 ;;
9327 esac
9328 else
9329 dflt="$fpossize"
9330 echo " "
9331 echo "(I can't compile the test program. Guessing...)" >&4
9332 rp="What is the size of your file positions (in bytes)?"
9333 . ./myread
9334 fpossize="$ans"
9335 fi
5b813a60 9336 $rm_try
96056487
JH
9337 fi
9338 ;;
9339esac
9340
dd35fa16
MB
9341: Check if we want perlio
9342useperlio="$define"
9343
613d6c3e 9344: Set the vendorbin variables
b4eb6b3d
JH
9345case "$vendorprefix" in
9346'') d_vendorbin="$undef"
9347 vendorbin=''
9348 vendorbinexp=''
9349 ;;
9350*) d_vendorbin="$define"
9351 : determine where vendor-supplied executables go.
9352 case "$vendorbin" in
9353 '') dflt=$vendorprefix/bin ;;
9354 *) dflt="$vendorbin" ;;
9355 esac
9356 fn=d~+
9357 rp='Pathname for the vendor-supplied executables directory?'
9358 . ./getfile
9359 vendorbin="$ans"
9360 vendorbinexp="$ansexp"
9361 ;;
9362esac
a092d240
NC
9363prefixvar=vendorbin
9364. ./installprefix
b4eb6b3d 9365
613d6c3e 9366: Set the vendorhtml1dir variables
6e1038e0 9367case "$vendorprefix" in
8d2cbf27
JH
9368'') vendorhtml1dir=''
9369 vendorhtml1direxp=''
6e1038e0
MB
9370 ;;
9371*) : determine where vendor-supplied html pages go.
9372 : There is no standard location, so try to copy the previously-selected
9373 : directory structure for the core html pages.
9374 : XXX Better default suggestions would be welcome.
8d2cbf27 9375 case "$vendorhtml1dir" in
6e1038e0 9376 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9377 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9378 esac
9379 case "$dflt" in
9380 ''|' ') dflt=none ;;
9381 esac
9382 fn=dn+~
9383 rp='Pathname for the vendor-supplied html pages?'
9384 . ./getfile
8d2cbf27
JH
9385 vendorhtml1dir="$ans"
9386 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9387 ;;
9388esac
9389: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9390$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9391prefixvar=vendorhtml1dir
9392. ./installprefix
6e1038e0 9393
613d6c3e 9394: Set the vendorhtml3dir variables
6e1038e0 9395case "$vendorprefix" in
8d2cbf27
JH
9396'') vendorhtml3dir=''
9397 vendorhtml3direxp=''
6e1038e0
MB
9398 ;;
9399*) : determine where vendor-supplied module html pages go.
9400 : There is no standard location, so try to copy the previously-selected
9401 : directory structure for the core html pages.
9402 : XXX Better default suggestions would be welcome.
8d2cbf27 9403 case "$vendorhtml3dir" in
6e1038e0 9404 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9405 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9406 esac
9407 case "$dflt" in
9408 ''|' ') dflt=none ;;
9409 esac
9410 fn=dn+~
9411 rp='Pathname for the vendor-supplied html pages?'
9412 . ./getfile
8d2cbf27
JH
9413 vendorhtml3dir="$ans"
9414 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9415 ;;
9416esac
9417: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9418$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9419prefixvar=vendorhtml3dir
9420. ./installprefix
6e1038e0 9421
613d6c3e 9422: Set the vendorman1dir variables
6e1038e0 9423case "$vendorprefix" in
91e123a8
JH
9424'') vendorman1dir=''
9425 vendorman1direxp=''
6e1038e0
MB
9426 ;;
9427*) : determine where vendor-supplied manual pages go.
91e123a8 9428 case "$vendorman1dir" in
6e1038e0 9429 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9430 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9431 esac
9432 case "$dflt" in
9433 ''|' ') dflt=none ;;
9434 esac
9435 fn=nd~+
9436 rp='Pathname for the vendor-supplied manual section 1 pages?'
9437 . ./getfile
91e123a8
JH
9438 vendorman1dir="$ans"
9439 vendorman1direxp="$ansexp"
6e1038e0
MB
9440 ;;
9441esac
9442: Use ' ' for none so value is preserved next time through Configure
91e123a8 9443$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9444prefixvar=vendorman1dir
9445. ./installprefix
6e1038e0 9446
613d6c3e 9447: Set the vendorman3dir variables
6e1038e0 9448case "$vendorprefix" in
91e123a8
JH
9449'') vendorman3dir=''
9450 vendorman3direxp=''
6e1038e0
MB
9451 ;;
9452*) : determine where vendor-supplied module manual pages go.
91e123a8 9453 case "$vendorman3dir" in
6e1038e0 9454 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9455 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9456 esac
9457 case "$dflt" in
9458 ''|' ') dflt=none ;;
9459 esac
9460 fn=nd~+
9461 rp='Pathname for the vendor-supplied manual section 3 pages?'
9462 . ./getfile
91e123a8
JH
9463 vendorman3dir="$ans"
9464 vendorman3direxp="$ansexp"
6e1038e0
MB
9465 ;;
9466esac
9467: Use ' ' for none so value is preserved next time through Configure
91e123a8 9468$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9469prefixvar=vendorman3dir
9470. ./installprefix
6e1038e0 9471
613d6c3e 9472: Set the vendorscript variables
6e1038e0
MB
9473case "$vendorprefix" in
9474'') d_vendorscript="$undef"
9475 vendorscript=''
9476 vendorscriptexp=''
9477 ;;
9478*) d_vendorscript="$define"
9479 : determine where vendor-supplied scripts go.
9480 case "$vendorscript" in
9481 '') dflt=$vendorprefix/script
9482 $test -d $dflt || dflt=$vendorbin ;;
9483 *) dflt="$vendorscript" ;;
9484 esac
9485 $cat <<EOM
9486
f3f1a2d8 9487The installation process will create a directory for
6e1038e0
MB
9488vendor-supplied scripts.
9489
9490EOM
9491 fn=d~+
9492 rp='Pathname for the vendor-supplied scripts directory?'
9493 . ./getfile
9494 vendorscript="$ans"
9495 vendorscriptexp="$ansexp"
9496 ;;
9497esac
a092d240
NC
9498prefixvar=vendorscript
9499. ./installprefix
6e1038e0 9500
f47f1645
TC
9501: script used to emit important warnings
9502cat >warn <<EOS
9503$startsh
9504if test \$# -gt 0; then
9505 echo "\$@" >msg
9506else
9507 cat >msg
9508fi
9509echo "*** WARNING:" >&4
9510sed -e 's/^/*** /' <msg >&4
9511echo "*** " >&4
9512cat msg >>config.msg
9513echo " " >>config.msg
9514rm -f msg
9515EOS
9516chmod +x warn
9517$eunicefix warn
9518
9519: see which of string.h or strings.h is needed
9520echo " "
9521strings=`./findhdr string.h`
9522if $test "$strings" && $test -r "$strings"; then
9523 echo "Using <string.h> instead of <strings.h>." >&4
9524 val="$define"
9525else
9526 val="$undef"
9527 strings=`./findhdr strings.h`
9528 if $test "$strings" && $test -r "$strings"; then
9529 echo "Using <strings.h> instead of <string.h>." >&4
9530 else
9531 ./warn "No string header found -- You'll surely have problems."
9532 fi
9533fi
9534set i_string
9535eval $setvar
9536case "$i_string" in
9537"$undef") strings=`./findhdr strings.h`;;
9538*) strings=`./findhdr string.h`;;
9539esac
9540
b4eb6b3d
JH
9541: see if qgcvt exists
9542set qgcvt d_qgcvt
9543eval $inlibc
9544
613d6c3e 9545: Check print/scan long double stuff
89ce900e
JH
9546echo " "
9547
9548if $test X"$d_longdbl" = X"$define"; then
9549
9550echo "Checking how to print long doubles..." >&4
9551
9552if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9553 $cat >try.c <<'EOCP'
9554#include <sys/types.h>
9555#include <stdio.h>
9556int main() {
9557 double d = 123.456;
9558 printf("%.3f\n", d);
9559}
9560EOCP
9561 set try
9562 if eval $compile; then
9563 yyy=`$run ./try`
9564 case "$yyy" in
9565 123.456)
9566 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9567 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9568 echo "We will use %f."
9569 ;;
9570 esac
9571 fi
9572fi
9573
9574if $test X"$sPRIfldbl" = X; then
9575 $cat >try.c <<'EOCP'
9576#include <sys/types.h>
9577#include <stdio.h>
9578int main() {
9579 long double d = 123.456;
9580 printf("%.3Lf\n", d);
9581}
9582EOCP
9583 set try
9584 if eval $compile; then
9585 yyy=`$run ./try`
9586 case "$yyy" in
9587 123.456)
9588 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9589 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9590 echo "We will use %Lf."
9591 ;;
9592 esac
9593 fi
9594fi
9595
9596if $test X"$sPRIfldbl" = X; then
9597 $cat >try.c <<'EOCP'
9598#include <sys/types.h>
9599#include <stdio.h>
9600int main() {
9601 long double d = 123.456;
9602 printf("%.3llf\n", d);
9603}
9604EOCP
9605 set try
9606 if eval $compile; then
9607 yyy=`$run ./try`
9608 case "$yyy" in
9609 123.456)
9610 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9611 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9612 echo "We will use %llf."
9613 ;;
9614 esac
9615 fi
9616fi
9617
9618if $test X"$sPRIfldbl" = X; then
9619 $cat >try.c <<'EOCP'
9620#include <sys/types.h>
9621#include <stdio.h>
9622int main() {
9623 long double d = 123.456;
9624 printf("%.3lf\n", d);
9625}
9626EOCP
9627 set try
9628 if eval $compile; then
9629 yyy=`$run ./try`
9630 case "$yyy" in
9631 123.456)
9632 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9633 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9634 echo "We will use %lf."
9635 ;;
9636 esac
9637 fi
9638fi
9639
9640if $test X"$sPRIfldbl" = X; then
9641 echo "Cannot figure out how to print long doubles." >&4
9642else
9643 sSCNfldbl=$sPRIfldbl # expect consistency
9644fi
9645
5b813a60 9646$rm_try
89ce900e
JH
9647
9648fi # d_longdbl
9649
9650case "$sPRIfldbl" in
5b813a60
MB
9651'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9652 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9653 d_SCNfldbl="$undef";
9654 ;;
5b813a60
MB
9655*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9656 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9657 d_SCNfldbl="$define";
9658 ;;
9659esac
9660
b4eb6b3d 9661: Check how to convert floats to strings.
a5b10d80
YST
9662
9663if test "X$d_Gconvert" = X; then
9664
b4eb6b3d
JH
9665echo " "
9666echo "Checking for an efficient way to convert floats to strings."
9667echo " " > try.c
9668case "$uselongdouble" in
9669"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9670esac
9671case "$d_longdbl" in
9672"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9673esac
9674case "$d_PRIgldbl" in
9675"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9676esac
9677$cat >>try.c <<EOP
9678#ifdef TRY_gconvert
9679#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9680char *myname = "gconvert";
9681#endif
9682#ifdef TRY_gcvt
9683#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9684char *myname = "gcvt";
9685#endif
9686#ifdef TRY_qgcvt
9687#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9688char *myname = "qgcvt";
9689#define DOUBLETYPE long double
9690#endif
9691#ifdef TRY_sprintf
a5b10d80
YST
9692#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9693#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9694#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9695#else
a5b10d80
YST
9696#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9697#endif
9698#else
b4eb6b3d
JH
9699#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9700#endif
9701char *myname = "sprintf";
9702#endif
9703
9704#ifndef DOUBLETYPE
9705#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9706#define DOUBLETYPE long double
9707#else
9708#define DOUBLETYPE double
9709#endif
9710#endif
9711
9712#include <stdio.h>
9713
f47f1645 9714#$i_stdlib I_STDLIB
b4eb6b3d
JH
9715#ifdef I_STDLIB
9716#include <stdlib.h>
9717#endif
f47f1645
TC
9718#$i_string I_STRING
9719#ifdef I_STRING
9720# include <string.h>
9721#else
9722# include <strings.h>
9723#endif
b4eb6b3d 9724
f47f1645 9725int checkit(char *expect, char *got)
b4eb6b3d
JH
9726{
9727 if (strcmp(expect, got)) {
9728 printf("%s oddity: Expected %s, got %s\n",
9729 myname, expect, got);
9730 exit(1);
9731 }
9732}
9733
9734int main()
5b813a60
MB
9735{
9736 char buf[64];
b4eb6b3d
JH
9737 buf[63] = '\0';
9738
9739 /* This must be 1st test on (which?) platform */
9740 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9741 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9742 checkit("0.1", buf);
9743
5b813a60 9744 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9745 checkit("0.01", buf);
9746
5b813a60 9747 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9748 checkit("0.001", buf);
9749
5b813a60 9750 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9751 checkit("0.0001", buf);
9752
9753 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9754 if (strlen(buf) > 5)
9755 checkit("9e-005", buf); /* for Microsoft ?? */
9756 else
9757 checkit("9e-05", buf);
9758
5b813a60 9759 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9760 checkit("1", buf);
9761
5b813a60 9762 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9763 checkit("1.1", buf);
9764
5b813a60 9765 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9766 checkit("1.01", buf);
9767
5b813a60 9768 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9769 checkit("1.001", buf);
9770
5b813a60 9771 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9772 checkit("1.0001", buf);
9773
5b813a60 9774 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9775 checkit("1.00001", buf);
9776
5b813a60 9777 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9778 checkit("1.000001", buf);
9779
5b813a60 9780 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9781 checkit("0", buf);
9782
5b813a60 9783 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9784 checkit("-1", buf);
9785
9786 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9787 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9788 checkit("100000", buf);
5b813a60 9789
b4eb6b3d 9790 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9791 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9792 checkit("-100000", buf);
9793
5b813a60 9794 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9795 checkit("123.456", buf);
9796
ab6ca9f4 9797 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9798 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9799 /* 34 should be enough to scare even long double
9800 * places into using the e notation. */
ab6ca9f4 9801 if (strlen(buf) > 5)
94b339ad 9802 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9803 else
94b339ad 9804 checkit("1e+34", buf);
8e2a5ede 9805
d1eb8299
YST
9806 /* For Perl, if you add additional tests here, also add them to
9807 * t/base/num.t for benefit of platforms not using Configure or
9808 * overriding d_Gconvert */
9809
b4eb6b3d
JH
9810 exit(0);
9811}
9812EOP
ab6ca9f4 9813: first add preferred functions to our list
a5b10d80 9814xxx_list=""
ab6ca9f4 9815for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9816 case $xxx_convert in
9817 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9818 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9819 esac
a5b10d80
YST
9820done
9821: then add any others
9822for xxx_convert in gconvert gcvt sprintf; do
9823 case "$xxx_list" in
9824 *$xxx_convert*) ;;
9825 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9826 esac
a5b10d80
YST
9827done
9828
9829case "$d_longdbl$uselongdouble" in
9830"$define$define")
cd95ead5 9831 : again, add preferred functions to our list first
a5b10d80 9832 xxx_ld_list=""
ab6ca9f4 9833 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9834 case $xxx_convert in
9835 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9836 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9837 esac
9838 done
9839 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9840 for xxx_convert in qgcvt sprintf $xxx_list; do
9841 case "$xxx_ld_list" in
9842 $xxx_convert*|*" $xxx_convert"*) ;;
9843 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9844 esac
9845 done
9846 : if sprintf cannot do long doubles, move it to the end
9847 if test "$d_PRIgldbl" != "$define"; then
9848 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9849 fi
9850 : if no qgcvt, remove it
9851 if test "$d_qgcvt" != "$define"; then
9852 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9853 fi
9854 : use the ld_list
9855 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9856 ;;
9857esac
9858
9859for xxx_convert in $xxx_list; do
9860 echo "Trying $xxx_convert..."
93451a0d 9861 $rm -f try try$_o core
b4eb6b3d
JH
9862 set try -DTRY_$xxx_convert
9863 if eval $compile; then
9864 echo "$xxx_convert() found." >&4
5440bc8e 9865 if $run ./try; then
b4eb6b3d
JH
9866 echo "I'll use $xxx_convert to convert floats into a string." >&4
9867 break;
9868 else
9869 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9870 xxx_convert=''
b4eb6b3d
JH
9871 fi
9872 else
9873 echo "$xxx_convert NOT found." >&4
9874 fi
9875done
ab6ca9f4 9876
a5b10d80
YST
9877if test X$xxx_convert = X; then
9878 echo "*** WHOA THERE!!! ***" >&4
9879 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9880 xxx_convert=sprintf
9881fi
9882
b4eb6b3d
JH
9883case "$xxx_convert" in
9884gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9885gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9886qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9887*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9888 "$define$define$define")
9889 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9890 "$define$define$undef")
9891 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9892 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9893 esac
5b813a60 9894 ;;
b4eb6b3d
JH
9895esac
9896
a5b10d80 9897fi
93451a0d 9898$rm_try
a5b10d80 9899
74cac757
JH
9900: see if _fwalk exists
9901set fwalk d__fwalk
9902eval $inlibc
9903
b4eb6b3d
JH
9904: Initialize h_fcntl
9905h_fcntl=false
9906
9907: Initialize h_sysfile
9908h_sysfile=false
9909
9910: access call always available on UNIX
9911set access d_access
9912eval $inlibc
9913
9914: locate the flags for 'access()'
9915case "$d_access" in
9916"$define")
9917 echo " "
55954f19 9918 $cat >access.c <<EOCP
b4eb6b3d
JH
9919#include <sys/types.h>
9920#ifdef I_FCNTL
9921#include <fcntl.h>
9922#endif
9923#ifdef I_SYS_FILE
9924#include <sys/file.h>
9925#endif
9926#ifdef I_UNISTD
9927#include <unistd.h>
9928#endif
55954f19
JH
9929#$i_stdlib I_STDLIB
9930#ifdef I_STDLIB
9931#include <stdlib.h>
9932#endif
b4eb6b3d
JH
9933int main() {
9934 exit(R_OK);
9935}
9936EOCP
9937 : check sys/file.h first, no particular reason here
9938 if $test `./findhdr sys/file.h` && \
7a282f6d 9939 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9940 h_sysfile=true;
9941 echo "<sys/file.h> defines the *_OK access constants." >&4
9942 elif $test `./findhdr fcntl.h` && \
7a282f6d 9943 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9944 h_fcntl=true;
9945 echo "<fcntl.h> defines the *_OK access constants." >&4
9946 elif $test `./findhdr unistd.h` && \
7a282f6d 9947 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9948 echo "<unistd.h> defines the *_OK access constants." >&4
9949 else
9950 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9951 fi
9952 ;;
9953esac
9954$rm -f access*
9955
9956: see if accessx exists
9957set accessx d_accessx
9958eval $inlibc
9959
89ce900e
JH
9960: see if aintl exists
9961set aintl d_aintl
9962eval $inlibc
9963
b4eb6b3d
JH
9964: see if alarm exists
9965set alarm d_alarm
9966eval $inlibc
9967
96938616
MB
9968: see if 64bit time functions exists
9969
9970set ctime64 d_ctime64
9971eval $inlibc
9972
9973set localtime64 d_localtime64
9974eval $inlibc
9975
9976set gmtime64 d_gmtime64
9977eval $inlibc
9978
9979set mktime64 d_mktime64
9980eval $inlibc
9981
9982set difftime64 d_difftime64
9983eval $inlibc
9984
9985set asctime64 d_asctime64
9986eval $inlibc
9987
a9dade78
JH
9988: see if POSIX threads are available
9989set pthread.h i_pthread
9990eval $inhdr
9991
cd95ead5 9992: define a function to check prototypes
10bc17b6
JH
9993$cat > protochk <<EOSH
9994$startsh
9995cc="$cc"
9996optimize="$optimize"
9997ccflags="$ccflags"
9998prototype="$prototype"
9999define="$define"
c944cfb9 10000rm_try="$rm_try"
a9dade78
JH
10001usethreads=$usethreads
10002i_pthread=$i_pthread
10003pthread_h_first=$pthread_h_first
10bc17b6
JH
10004EOSH
10005
10006$cat >> protochk <<'EOSH'
10007
5b813a60 10008$rm_try
10bc17b6
JH
10009foo="$1"
10010shift
10011while test $# -ge 2; do
10012 case "$1" in
10013 $define) echo "#include <$2>" >> try.c ;;
10014 literal) echo "$2" >> try.c ;;
10015 esac
cce6a207
MB
10016 # Extra magic for the benefit of systems that need pthread.h
10017 # to be included early to correctly detect threadsafe functions.
10018 # Such functions must guarantee themselves, though, that the usethreads
10019 # and i_pthread have been defined, before calling protochk.
10020 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10021 echo "#include <pthread.h>" >> try.c
10022 pthread_h_done=yes
10023 fi
10bc17b6
JH
10024 shift 2
10025done
10026test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10027cat >> try.c <<'EOCP'
10028#ifdef CAN_PROTOTYPE
10029#define _(args) args
10030#else
10031#define _(args) ()
10032#endif
10033EOCP
10034echo "$foo" >> try.c
10035echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10036$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10037status=$?
5b813a60 10038$rm_try
10bc17b6
JH
10039exit $status
10040EOSH
10041chmod +x protochk
10042$eunicefix protochk
10043
34f1896b 10044: Define hasproto macro for Configure internal use
89ce900e
JH
10045hasproto='varname=$1; func=$2; shift; shift;
10046while $test $# -ge 2; do
10047 case "$1" in
10048 $define) echo "#include <$2>";;
10049 esac ;
10050 shift 2;
10051done > try.c;
10052$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10053if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10054 echo "$func() prototype found.";
10055 val="$define";
10056else
10057 echo "$func() prototype NOT found.";
10058 val="$undef";
10059fi;
10060set $varname;
10061eval $setvar;
5b813a60 10062$rm_try tryout.c'
89ce900e 10063
10bc17b6
JH
10064: see if sys/types.h has to be included
10065set sys/types.h i_systypes
10066eval $inhdr
10067
10068: see if sys/select.h has to be included
10069set sys/select.h i_sysselct
10070eval $inhdr
10071
34f1896b 10072: Define hasfield macro for Configure internal use
10bc17b6
JH
10073hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10074while $test $# -ge 2; do
10075 case "$1" in
10076 $define) echo "#include <$2>";;
10077 esac ;
10078 shift 2;
10079done > try.c;
10080echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10081set try;
10082if eval $compile; then
10083 val="$define";
10084else
10085 val="$undef";
10086fi;
10087set $varname;
10088eval $setvar;
5b813a60 10089$rm_try'
10bc17b6
JH
10090
10091: see if we should include time.h, sys/time.h, or both
10092echo " "
10093if test "X$timeincl" = X; then
10094 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10095 $echo $n "I'm now running the test program...$c"
55954f19 10096 $cat >try.c <<EOCP
10bc17b6
JH
10097#include <sys/types.h>
10098#ifdef I_TIME
10099#include <time.h>
10100#endif
10101#ifdef I_SYSTIME
10102#ifdef SYSTIMEKERNEL
10103#define KERNEL
10104#endif
10105#include <sys/time.h>
10106#endif
10107#ifdef I_SYSSELECT
10108#include <sys/select.h>
10109#endif
55954f19
JH
10110#$i_stdlib I_STDLIB
10111#ifdef I_STDLIB
10112#include <stdlib.h>
10113#endif
10bc17b6
JH
10114int main()
10115{
10116 struct tm foo;
10117#ifdef S_TIMEVAL
10118 struct timeval bar;
10119#endif
10120#ifdef S_TIMEZONE
10121 struct timezone tzp;
10122#endif
10123 if (foo.tm_sec == foo.tm_sec)
10124 exit(0);
10125#ifdef S_TIMEVAL
10126 if (bar.tv_sec == bar.tv_sec)
10127 exit(0);
10128#endif
10129 exit(1);
10130}
10131EOCP
10132 flags=''
10133 for s_timezone in '-DS_TIMEZONE' ''; do
10134 sysselect=''
10135 for s_timeval in '-DS_TIMEVAL' ''; do
10136 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10137 for i_time in '' '-DI_TIME'; do
10138 for i_systime in '-DI_SYSTIME' ''; do
10139 case "$flags" in
10140 '') $echo $n ".$c"
10141 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10142 if eval $compile; then
10143 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10144 shift
10145 flags="$*"
10146 echo " "
10147 $echo $n "Succeeded with $flags$c"
10148 fi
10149 ;;
10150 esac
10151 done
10152 done
10153 done
10154 done
10155 done
10156 timeincl=''
10157 echo " "
10158 case "$flags" in
10159 *SYSTIMEKERNEL*) i_systimek="$define"
10160 timeincl=`./findhdr sys/time.h`
10161 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10162 *) i_systimek="$undef";;
10163 esac
10164 case "$flags" in
10165 *I_TIME*) i_time="$define"
10166 timeincl=`./findhdr time.h`" $timeincl"
10167 echo "We'll include <time.h>." >&4;;
10168 *) i_time="$undef";;
10169 esac
10170 case "$flags" in
10171 *I_SYSTIME*) i_systime="$define"
10172 timeincl=`./findhdr sys/time.h`" $timeincl"
10173 echo "We'll include <sys/time.h>." >&4;;
10174 *) i_systime="$undef";;
10175 esac
5b813a60 10176 $rm_try
10bc17b6
JH
10177fi
10178: see if struct tm knows about tm_zone
10179case "$i_systime$i_time" in
5b813a60 10180*$define*)
10bc17b6
JH
10181 echo " "
10182 echo "Checking to see if your struct tm has tm_zone field..." >&4
10183 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10184 eval $hasfield
10185 ;;
10186*) val="$undef"
10187 set d_tm_tm_zone
10188 eval $setvar
10189 ;;
10190esac
10191case "$d_tm_tm_zone" in
10192"$define") echo "Yes, it does." ;;
10193*) echo "No, it doesn't." ;;
10194esac
10195: see if struct tm knows about tm_gmtoff
10196case "$i_systime$i_time" in
5b813a60 10197*$define*)
10bc17b6
JH
10198 echo " "
10199 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10200 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10201 eval $hasfield
10202 ;;
10203*) val="$undef"
10204 set d_tm_tm_gmtoff
10205 eval $setvar
10206 ;;
10207esac
10208case "$d_tm_tm_gmtoff" in
10209"$define") echo "Yes, it does." ;;
10210*) echo "No, it doesn't." ;;
10211esac
10212
10213: see if asctime_r exists
10214set asctime_r d_asctime_r
10215eval $inlibc
10216case "$d_asctime_r" in
10217"$define")
d63eadf0 10218 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10219 case "$d_asctime_r_proto:$usethreads" in
10220 ":define") d_asctime_r_proto=define
a48ec845
JH
10221 set d_asctime_r_proto asctime_r $hdrs
10222 eval $hasproto ;;
10223 *) ;;
10224 esac
10225 case "$d_asctime_r_proto" in
10226 define)
10bc17b6
JH
10227 case "$asctime_r_proto" in
10228 ''|0) try='char* asctime_r(const struct tm*, char*);'
61c26d18 10229 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10bc17b6
JH
10230 esac
10231 case "$asctime_r_proto" in
10232 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
61c26d18 10233 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10bc17b6
JH
10234 esac
10235 case "$asctime_r_proto" in
10236 ''|0) try='int asctime_r(const struct tm*, char*);'
61c26d18 10237 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10bc17b6
JH
10238 esac
10239 case "$asctime_r_proto" in
10240 ''|0) try='int asctime_r(const struct tm*, char*, int);'
61c26d18 10241 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10bc17b6
JH
10242 esac
10243 case "$asctime_r_proto" in
90e831dc 10244 ''|0) d_asctime_r=undef
10bc17b6 10245 asctime_r_proto=0
a48ec845 10246 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10247 * ) case "$asctime_r_proto" in
10248 REENTRANT_PROTO*) ;;
10249 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10250 esac
10251 echo "Prototype: $try" ;;
10252 esac
10253 ;;
c18e646a
JH
10254 *) case "$usethreads" in
10255 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10256 esac
90e831dc
SB
10257 d_asctime_r=undef
10258 asctime_r_proto=0
c18e646a 10259 ;;
a48ec845
JH
10260 esac
10261 ;;
10bc17b6
JH
10262*) asctime_r_proto=0
10263 ;;
10264esac
10265
b4eb6b3d
JH
10266: see if atolf exists
10267set atolf d_atolf
10268eval $inlibc
10269
10270: see if atoll exists
10271set atoll d_atoll
10272eval $inlibc
10273
0dbb1585
AL
10274: Look for GCC-style attribute format
10275case "$d_attribute_format" in
bde30f85 10276'')
b4eb6b3d 10277echo " "
0dbb1585 10278echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10279$cat >attrib.c <<'EOCP'
10280#include <stdio.h>
0dbb1585 10281void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10282EOCP
10283if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10284 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10285 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10286 val="$undef"
10287 else
0dbb1585 10288 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10289 val="$define"
10290 fi
10291else
10292 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10293 val="$undef"
10294fi
bde30f85 10295;;
0dbb1585 10296*) val="$d_attribute_format" ;;
bde30f85 10297esac
0dbb1585
AL
10298set d_attribute_format
10299eval $setvar
10300$rm -f attrib*
10301
dcb594bc
MB
10302: Look for GCC-style attribute format with null format allowed
10303case "$d_printf_format_null" in
10304'') case "$d_attribute_format" in
10305 $define)
10306 echo " "
10307 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10308$cat >attrib.c <<EOCP
10309#include <stdio.h>
10310#$i_stdlib I_STDLIB
10311#ifdef I_STDLIB
10312#include <stdlib.h>
10313#endif
10314int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10315int null_printf (char* pat,...) { return (int)pat; }
10316int main () { exit(null_printf(NULL)); }
10317EOCP
10318 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10319 : run the executable in case it produces a run-time warning
10320 if $run ./attrib >>attrib.out 2>&1; then
10321 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10322 echo "Your C compiler doesn't allow __printf__ format to be null."
10323 val="$undef"
10324 else
10325 echo "Your C compiler allows __printf__ format to be null."
10326 val="$define"
10327 fi
10328 else
10329 echo "Your C compiler executable failed with __printf__ format null."
10330 val="$undef"
10331 fi
10332 else
10333 echo "Your C compiler fails with __printf__ format null."
10334 val="$undef"
10335 fi
10336 ;;
10337 *) val="$undef" ;;
10338 esac
10339;;
10340*) val="$d_printf_format_null" ;;
10341esac
10342set d_printf_format_null
10343eval $setvar
10344$rm -f attrib*
10345
0dbb1585
AL
10346: Look for GCC-style attribute malloc
10347case "$d_attribute_malloc" in
10348'')
10349echo " "
10350echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10351$cat >attrib.c <<'EOCP'
10352#include <stdio.h>
10353char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10354EOCP
10355if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10356 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10357 echo "Your C compiler doesn't support __attribute__((malloc))."
10358 val="$undef"
10359 else
10360 echo "Your C compiler supports __attribute__((malloc))."
10361 val="$define"
10362 fi
10363else
10364 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10365 val="$undef"
10366fi
10367;;
10368*) val="$d_attribute_malloc" ;;
10369esac
10370set d_attribute_malloc
10371eval $setvar
10372$rm -f attrib*
10373
10374: Look for GCC-style attribute nonnull
10375case "$d_attribute_nonnull" in
10376'')
10377echo " "
10378echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10379$cat >attrib.c <<'EOCP'
10380#include <stdio.h>
10381void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10382EOCP
10383if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10384 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10385 echo "Your C compiler doesn't support __attribute__((nonnull))."
10386 val="$undef"
10387 else
10388 echo "Your C compiler supports __attribute__((nonnull))."
10389 val="$define"
10390 fi
10391else
10392 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10393 val="$undef"
10394fi
10395;;
10396*) val="$d_attribute_nonnull" ;;
10397esac
10398set d_attribute_nonnull
10399eval $setvar
10400$rm -f attrib*
10401
10402: Look for GCC-style attribute noreturn
10403case "$d_attribute_noreturn" in
10404'')
10405echo " "
10406echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10407$cat >attrib.c <<'EOCP'
10408#include <stdio.h>
10409void fall_over_dead( void ) __attribute__((noreturn));
10410EOCP
10411if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10412 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10413 echo "Your C compiler doesn't support __attribute__((noreturn))."
10414 val="$undef"
10415 else
10416 echo "Your C compiler supports __attribute__((noreturn))."
10417 val="$define"
10418 fi
10419else
10420 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10421 val="$undef"
10422fi
10423;;
10424*) val="$d_attribute_noreturn" ;;
10425esac
10426set d_attribute_noreturn
10427eval $setvar
10428$rm -f attrib*
10429
10430: Look for GCC-style attribute pure
10431case "$d_attribute_pure" in
10432'')
10433echo " "
10434echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10435$cat >attrib.c <<'EOCP'
10436#include <stdio.h>
10437int square( int n ) __attribute__((pure));
10438EOCP
10439if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10440 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10441 echo "Your C compiler doesn't support __attribute__((pure))."
10442 val="$undef"
10443 else
10444 echo "Your C compiler supports __attribute__((pure))."
10445 val="$define"
10446 fi
10447else
10448 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10449 val="$undef"
10450fi
10451;;
10452*) val="$d_attribute_pure" ;;
10453esac
10454set d_attribute_pure
10455eval $setvar
10456$rm -f attrib*
10457
10458: Look for GCC-style attribute unused
10459case "$d_attribute_unused" in
10460'')
10461echo " "
10462echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10463$cat >attrib.c <<'EOCP'
10464#include <stdio.h>
10465int do_something( int dummy __attribute__((unused)), int n );
10466EOCP
10467if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10468 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10469 echo "Your C compiler doesn't support __attribute__((unused))."
10470 val="$undef"
10471 else
10472 echo "Your C compiler supports __attribute__((unused))."
10473 val="$define"
10474 fi
10475else
10476 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10477 val="$undef"
10478fi
10479;;
10480*) val="$d_attribute_unused" ;;
10481esac
10482set d_attribute_unused
10483eval $setvar
10484$rm -f attrib*
10485
fcdf39cf
RGS
10486: Look for GCC-style attribute deprecated
10487case "$d_attribute_deprecated" in
10488'')
10489echo " "
10490echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10491$cat >attrib.c <<'EOCP'
10492#include <stdio.h>
10493int I_am_deprecated(void) __attribute__((deprecated));
10494EOCP
10495if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10496 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10497 echo "Your C compiler doesn't support __attribute__((deprecated))."
10498 val="$undef"
10499 else
10500 echo "Your C compiler supports __attribute__((deprecated))."
10501 val="$define"
10502 fi
10503else
10504 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10505 val="$undef"
10506fi
10507;;
10508*) val="$d_attribute_deprecated" ;;
10509esac
10510set d_attribute_deprecated
10511eval $setvar
10512$rm -f attrib*
10513
0dbb1585
AL
10514: Look for GCC-style attribute warn_unused_result
10515case "$d_attribute_warn_unused_result" in
10516'')
10517echo " "
10518echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10519$cat >attrib.c <<'EOCP'
10520#include <stdio.h>
10521int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10522EOCP
10523if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10524 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10525 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10526 val="$undef"
10527 else
10528 echo "Your C compiler supports __attribute__((warn_unused_result))."
10529 val="$define"
10530 fi
10531else
10532 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10533 val="$undef"
10534fi
10535;;
10536*) val="$d_attribute_warn_unused_result" ;;
10537esac
10538set d_attribute_warn_unused_result
b4eb6b3d
JH
10539eval $setvar
10540$rm -f attrib*
10541
10542: see if bcmp exists
10543set bcmp d_bcmp
10544eval $inlibc
10545
10546: see if bcopy exists
10547set bcopy d_bcopy
10548eval $inlibc
10549
b4eb6b3d
JH
10550: see if getpgrp exists
10551set getpgrp d_getpgrp
10552eval $inlibc
10553
10554case "$d_getpgrp" in
10555"$define")
10556 echo " "
10557 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10558 $cat >try.c <<EOP
b4eb6b3d
JH
10559#$i_unistd I_UNISTD
10560#include <sys/types.h>
10561#ifdef I_UNISTD
10562# include <unistd.h>
10563#endif
55954f19
JH
10564#$i_stdlib I_STDLIB
10565#ifdef I_STDLIB
10566#include <stdlib.h>
10567#endif
b4eb6b3d
JH
10568int main()
10569{
10570 if (getuid() == 0) {
10571 printf("(I see you are running Configure as super-user...)\n");
10572 setuid(1);
10573 }
10574#ifdef TRY_BSD_PGRP
10575 if (getpgrp(1) == 0)
10576 exit(0);
10577#else
10578 if (getpgrp() > 0)
10579 exit(0);
10580#endif
10581 exit(1);
10582}
10583EOP
5440bc8e 10584 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10585 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10586 val="$define"
5440bc8e 10587 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10588 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10589 val="$undef"
10590 else
10591 echo "I can't seem to compile and run the test program."
10592 if ./usg; then
10593 xxx="a USG one, i.e. you use getpgrp()."
10594 else
10595 # SVR4 systems can appear rather BSD-ish.
10596 case "$i_unistd" in
10597 $undef)
10598 xxx="a BSD one, i.e. you use getpgrp(pid)."
10599 val="$define"
10600 ;;
10601 $define)
10602 xxx="probably a USG one, i.e. you use getpgrp()."
10603 val="$undef"
10604 ;;
10605 esac
10606 fi
10607 echo "Assuming your getpgrp is $xxx" >&4
10608 fi
10609 ;;
10610*) val="$undef";;
10611esac
10612set d_bsdgetpgrp
10613eval $setvar
5b813a60 10614$rm_try
b4eb6b3d
JH
10615
10616: see if setpgrp exists
10617set setpgrp d_setpgrp
10618eval $inlibc
10619
10620case "$d_setpgrp" in
10621"$define")
10622 echo " "
10623 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10624 $cat >try.c <<EOP
b4eb6b3d
JH
10625#$i_unistd I_UNISTD
10626#include <sys/types.h>
10627#ifdef I_UNISTD
10628# include <unistd.h>
10629#endif
55954f19
JH
10630#$i_stdlib I_STDLIB
10631#ifdef I_STDLIB
10632#include <stdlib.h>
10633#endif
b4eb6b3d
JH
10634int main()
10635{
10636 if (getuid() == 0) {
10637 printf("(I see you are running Configure as super-user...)\n");
10638 setuid(1);
10639 }
10640#ifdef TRY_BSD_PGRP
10641 if (-1 == setpgrp(1, 1))
10642 exit(0);
10643#else
10644 if (setpgrp() != -1)
10645 exit(0);
10646#endif
10647 exit(1);
10648}
10649EOP
5440bc8e 10650 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10651 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10652 val="$define"
5440bc8e 10653 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10654 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10655 val="$undef"
10656 else
10657 echo "(I can't seem to compile and run the test program.)"
10658 if ./usg; then
10659 xxx="a USG one, i.e. you use setpgrp()."
10660 else
10661 # SVR4 systems can appear rather BSD-ish.
10662 case "$i_unistd" in
10663 $undef)
10664 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10665 val="$define"
10666 ;;
10667 $define)
10668 xxx="probably a USG one, i.e. you use setpgrp()."
10669 val="$undef"
10670 ;;
10671 esac
10672 fi
10673 echo "Assuming your setpgrp is $xxx" >&4
10674 fi
10675 ;;
10676*) val="$undef";;
10677esac
10678set d_bsdsetpgrp
10679eval $setvar
5b813a60
MB
10680$rm_try
10681
635aebb7
AL
10682: Look for GCC-style __builtin_choose_expr
10683case "$d_builtin_choose_expr" in
10684'')
10685 echo " "
10686 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10687 $cat >try.c <<'EOCP'
10688#include <assert.h>
10689#include <stdlib.h>
10690#include <stdio.h>
10691
10692#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10693
10694int main(void) {
10695 assert( SYRINX(1) == 2112 );
10696 assert( SYRINX(1) != 5150 );
10697 assert( SYRINX(0) == 5150 );
10698 assert( SYRINX(0) != 2112 );
10699 puts( "All good!" );
10700 exit(0);
10701}
10702
10703EOCP
10704 set try
70ceb34a 10705 if eval $compile && $run ./try; then
635aebb7
AL
10706 echo "Your C compiler supports __builtin_choose_expr."
10707 val="$define"
10708 else
10709 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10710 val="$undef"
10711 fi
10712;;
10713*) val="$d_builtin_choose_expr" ;;
10714esac
10715
10716set d_builtin_choose_expr
10717eval $setvar
5b813a60 10718$rm_try
635aebb7
AL
10719
10720: Look for GCC-style __builtin_expect
10721case "$d_builtin_expect" in
10722'')
10723 echo " "
10724 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
70ceb34a 10725 $cat >try.c <<'EOCP'
635aebb7
AL
10726int main(void) {
10727 int n = 50;
10728 if ( __builtin_expect(n, 0) ) n = 1;
70ceb34a
NC
10729 /* Remember shell exit code truth is 0, C truth is non-zero */
10730 return !(n == 1);
635aebb7
AL
10731}
10732EOCP
10733 set try
70ceb34a
NC
10734 if eval $compile && $run ./try; then
10735 echo "Your C compiler supports __builtin_expect."
635aebb7
AL
10736 val="$define"
10737 else
70ceb34a 10738 echo "Your C compiler doesn't seem to understand __builtin_expect."
635aebb7
AL
10739 val="$undef"
10740 fi
10741 ;;
10742*) val="$d_builtin_expect" ;;
10743esac
10744
10745set d_builtin_expect
10746eval $setvar
5b813a60 10747$rm_try
635aebb7 10748
b4eb6b3d
JH
10749: see if bzero exists
10750set bzero d_bzero
10751eval $inlibc
10752
a2d23ec2
MB
10753: see if stdarg is available
10754echo " "
10755if $test `./findhdr stdarg.h`; then
10756 echo "<stdarg.h> found." >&4
10757 valstd="$define"
10758else
10759 echo "<stdarg.h> NOT found." >&4
10760 valstd="$undef"
10761fi
10762
10763: see if varags is available
10764echo " "
10765if $test `./findhdr varargs.h`; then
10766 echo "<varargs.h> found." >&4
10767else
10768 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10769fi
10770
10771: set up the varargs testing programs
10772$cat > varargs.c <<EOP
10773#ifdef I_STDARG
10774#include <stdarg.h>
10775#endif
10776#ifdef I_VARARGS
10777#include <varargs.h>
10778#endif
10779
10780#ifdef I_STDARG
10781int f(char *p, ...)
10782#else
10783int f(va_alist)
10784va_dcl
10785#endif
10786{
10787 va_list ap;
10788#ifndef I_STDARG
10789 char *p;
10790#endif
10791#ifdef I_STDARG
10792 va_start(ap,p);
10793#else
10794 va_start(ap);
10795 p = va_arg(ap, char *);
10796#endif
10797 va_end(ap);
4fb7dc7d 10798 return 0;
a2d23ec2
MB
10799}
10800EOP
10801$cat > varargs <<EOP
10802$startsh
10803if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10804 echo "true"
10805else
10806 echo "false"
10807fi
10808$rm -f varargs$_o
10809EOP
10810chmod +x varargs
10811
10812: now check which varargs header should be included
10813echo " "
10814i_varhdr=''
10815case "$valstd" in
10816"$define")
10817 if `./varargs I_STDARG`; then
10818 val='stdarg.h'
10819 elif `./varargs I_VARARGS`; then
10820 val='varargs.h'
10821 fi
10822 ;;
10823*)
10824 if `./varargs I_VARARGS`; then
10825 val='varargs.h'
10826 fi
10827 ;;
10828esac
10829case "$val" in
10830'')
10831echo "I could not find the definition for va_dcl... You have problems..." >&4
10832 val="$undef"; set i_stdarg; eval $setvar
10833 val="$undef"; set i_varargs; eval $setvar
10834 ;;
613d6c3e 10835*)
a2d23ec2
MB
10836 set i_varhdr
10837 eval $setvar
10838 case "$i_varhdr" in
10839 stdarg.h)
10840 val="$define"; set i_stdarg; eval $setvar
10841 val="$undef"; set i_varargs; eval $setvar
10842 ;;
10843 varargs.h)
10844 val="$undef"; set i_stdarg; eval $setvar
10845 val="$define"; set i_varargs; eval $setvar
10846 ;;
10847 esac
10848 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10849esac
10850$rm -f varargs*
10851
10852: see if the Compiler supports C99 variadic macros
10853case "$i_stdarg$i_stdlib" in
10854 "$define$define")
10855 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10856 $cat >try.c <<EOCP
10857#include <stdio.h>
10858#include <stdarg.h>
10859
10860#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10861
10862int main() {
10863 char buf[20];
10864 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10865 puts(buf);
10866 return 0;
10867}
10868EOCP
10869 set try
10870 if eval $compile && $run ./try 2>&1 >/dev/null; then
10871 case "`$run ./try`" in
10872 "123 456 789")
10873 echo "You have C99 variadic macros." >&4
10874 d_c99_variadic_macros="$define"
10875 ;;
10876 *)
10877 echo "You don't have functional C99 variadic macros." >&4
10878 d_c99_variadic_macros="$undef"
10879 ;;
10880 esac
10881 else
10882 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10883 d_c99_variadic_macros="$undef"
10884 fi
5b813a60 10885 $rm_try
a2d23ec2
MB
10886 ;;
10887 *)
10888 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10889 d_c99_variadic_macros="$undef"
10890 ;;
10891esac
10892
b4eb6b3d
JH
10893: see if signal is declared as pointer to function returning int or void
10894echo " "
10895xxx=`./findhdr signal.h`
10896$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10897if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10898 echo "You have int (*signal())() instead of void." >&4
10899 val="$undef"
10900elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10901 echo "You have void (*signal())()." >&4
10902 val="$define"
10903elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10904 echo "You have int (*signal())() instead of void." >&4
10905 val="$undef"
10906elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10907 echo "You have void (*signal())()." >&4
10908 val="$define"
10909else
10910 case "$d_voidsig" in
10911 '')
10912 echo "I can't determine whether signal handler returns void or int..." >&4
10913 dflt=void
10914 rp="What type does your signal handler return?"
10915 . ./myread
10916 case "$ans" in
10917 v*) val="$define";;
10918 *) val="$undef";;
10919 esac;;
10920 "$define")
10921 echo "As you already told me, signal handler returns void." >&4
10922 val="$define"
10923 ;;
10924 *) echo "As you already told me, signal handler returns int." >&4
10925 val="$undef"
10926 ;;
10927 esac
10928fi
10929set d_voidsig
10930eval $setvar
10931case "$d_voidsig" in
10932"$define") signal_t="void";;
10933*) signal_t="int";;
10934esac
10935$rm -f $$.tmp
10936
10937: check for ability to cast large floats to 32-bit ints.
10938echo " "
10939echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10940if $test "$intsize" -ge 4; then
10941 xxx=int
10942else
10943 xxx=long
10944fi
10945$cat >try.c <<EOCP
10946#include <stdio.h>
d1daaddf
JH
10947#$i_stdlib I_STDLIB
10948#ifdef I_STDLIB
10949#include <stdlib.h>
10950#endif
b4eb6b3d
JH
10951#include <sys/types.h>
10952#include <signal.h>
7090f861 10953$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10954int main()
10955{
10956 $xxx i32;
10957 double f, g;
10958 int result = 0;
10959 char str[16];
10960 signal(SIGFPE, blech);
10961
5b813a60 10962 /* Don't let compiler optimize the test away. Store the number
e237eb00 10963 in a writable string for gcc to pass to sscanf under HP-UX.
b4eb6b3d
JH
10964 */
10965 sprintf(str, "2147483647");
10966 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10967 g = 10 * f;
10968 i32 = ($xxx) g;
10969
10970 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10971 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10972 behavior here, which is to preserve the sign and give
10973 back 0x7fff ffff.
10974 */
10975 if (i32 != ($xxx) f)
10976 result |= 1;
10977 exit(result);
10978}
10979EOCP
10980set try
10981if eval $compile_ok; then
5440bc8e 10982 $run ./try
b4eb6b3d
JH
10983 yyy=$?
10984else
10985 echo "(I can't seem to compile the test program--assuming it can't)"
10986 yyy=1
10987fi
10988case "$yyy" in
109890) val="$define"
10990 echo "Yup, it can."
10991 ;;
10992*) val="$undef"
10993 echo "Nope, it can't."
10994 ;;
10995esac
10996set d_casti32
10997eval $setvar
5b813a60 10998$rm_try
b4eb6b3d
JH
10999
11000: check for ability to cast negative floats to unsigned
11001echo " "
11002echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11003$cat >try.c <<EOCP
11004#include <stdio.h>
d1daaddf
JH
11005#$i_stdlib I_STDLIB
11006#ifdef I_STDLIB
11007#include <stdlib.h>
11008#endif
b4eb6b3d
JH
11009#include <sys/types.h>
11010#include <signal.h>
7090f861
JH
11011$signal_t blech(int s) { exit(7); }
11012$signal_t blech_in_list(int s) { exit(4); }
11013unsigned long dummy_long(unsigned long p) { return p; }
11014unsigned int dummy_int(unsigned int p) { return p; }
11015unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
11016int main()
11017{
11018 double f;
11019 unsigned long along;
11020 unsigned int aint;
11021 unsigned short ashort;
11022 int result = 0;
11023 char str[16];
5b813a60 11024
b4eb6b3d
JH
11025 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11026 a direct f = -123. assignment. gcc-2.8.0 reportedly
11027 optimized the whole file away
11028 */
5b813a60 11029 /* Store the number in a writable string for gcc to pass to
e237eb00 11030 sscanf under HP-UX.
b4eb6b3d
JH
11031 */
11032 sprintf(str, "-123");
11033 sscanf(str, "%lf", &f); /* f = -123.; */
11034
11035 signal(SIGFPE, blech);
11036 along = (unsigned long)f;
11037 aint = (unsigned int)f;
11038 ashort = (unsigned short)f;
11039 if (along != (unsigned long)-123)
11040 result |= 1;
11041 if (aint != (unsigned int)-123)
11042 result |= 1;
11043 if (ashort != (unsigned short)-123)
11044 result |= 1;
11045 sprintf(str, "1073741824.");
11046 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11047 f = f + f;
11048 along = 0;
11049 along = (unsigned long)f;
11050 if (along != 0x80000000)
11051 result |= 2;
11052 f -= 1.;
11053 along = 0;
11054 along = (unsigned long)f;
11055 if (along != 0x7fffffff)
11056 result |= 1;
11057 f += 2.;
11058 along = 0;
11059 along = (unsigned long)f;
11060 if (along != 0x80000001)
11061 result |= 2;
11062 if (result)
11063 exit(result);
11064 signal(SIGFPE, blech_in_list);
11065 sprintf(str, "123.");
11066 sscanf(str, "%lf", &f); /* f = 123.; */
11067 along = dummy_long((unsigned long)f);
11068 aint = dummy_int((unsigned int)f);
11069 ashort = dummy_short((unsigned short)f);
11070 if (along != (unsigned long)123)
11071 result |= 4;
11072 if (aint != (unsigned int)123)
11073 result |= 4;
11074 if (ashort != (unsigned short)123)
11075 result |= 4;
11076 exit(result);
11077
11078}
11079EOCP
11080set try
11081if eval $compile_ok; then
5440bc8e 11082 $run ./try
b4eb6b3d
JH
11083 castflags=$?
11084else
11085 echo "(I can't seem to compile the test program--assuming it can't)"
11086 castflags=7
11087fi
11088case "$castflags" in
110890) val="$define"
11090 echo "Yup, it can."
11091 ;;
11092*) val="$undef"
11093 echo "Nope, it can't."
11094 ;;
11095esac
11096set d_castneg
11097eval $setvar
5b813a60 11098$rm_try
b4eb6b3d
JH
11099
11100: see if vprintf exists
11101echo " "
11102if set vprintf val -f d_vprintf; eval $csym; $val; then
11103 echo 'vprintf() found.' >&4
11104 val="$define"
55954f19 11105 $cat >try.c <<EOF
d0bc9cc8
AD
11106#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11107#$i_varargs I_VARARGS
11108
55954f19 11109#$i_stdlib I_STDLIB
d0bc9cc8
AD
11110#$i_unistd I_UNISTD
11111
11112#ifdef I_STDARG
11113# include <stdarg.h>
11114#else /* I_VARARGS */
11115# include <varargs.h>
11116#endif
11117
11118#ifdef I_UNISTD
11119# include <unistd.h>
11120#endif
11121
55954f19 11122#ifdef I_STDLIB
d0bc9cc8 11123# include <stdlib.h>
55954f19 11124#endif
b4eb6b3d 11125
d0bc9cc8
AD
11126#include <stdio.h> /* vsprintf prototype */
11127
11128#ifdef I_STDARG
11129void xxx(int n, ...)
11130{
11131 va_list args;
11132 char buf[10];
11133 va_start(args, n);
11134 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11135}
11136int main() { xxx(1, "foo"); }
11137
11138#else /* I_VARARGS */
b4eb6b3d
JH
11139
11140xxx(va_alist)
11141va_dcl
11142{
d0bc9cc8
AD
11143 va_list args;
11144 char buf[10];
11145 va_start(args);
11146 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 11147}
d0bc9cc8
AD
11148int main() { xxx("foo"); }
11149
11150#endif
11151
b4eb6b3d 11152EOF
5440bc8e 11153 set try
d0bc9cc8
AD
11154 if eval $compile_ok; then
11155 if $run ./try; then
11156 echo "Your vsprintf() returns (int)." >&4
11157 val2="$undef"
11158 else
11159 echo "Your vsprintf() returns (char*)." >&4
11160 val2="$define"
11161 fi
b4eb6b3d 11162 else
d0bc9cc8
AD
11163 echo 'I am unable to compile the vsprintf() test program.' >&4
11164 # We shouldn't get here. If we do, assume the standard signature,
11165 # not the old BSD one.
11166 echo 'Guessing that vsprintf() returns (int).' >&4
11167 val2="$undef"
b4eb6b3d
JH
11168 fi
11169else
11170 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
11171 val="$undef"
11172 val2="$undef"
b4eb6b3d 11173fi
5b813a60 11174$rm_try
b4eb6b3d
JH
11175set d_vprintf
11176eval $setvar
11177val=$val2
11178set d_charvspr
11179eval $setvar
11180
11181: see if chown exists
11182set chown d_chown
11183eval $inlibc
11184
11185: see if chroot exists
11186set chroot d_chroot
11187eval $inlibc
11188
11189: see if chsize exists
11190set chsize d_chsize
11191eval $inlibc
11192
758a5d79
JH
11193: see if class exists
11194set class d_class
11195eval $inlibc
11196
b0a2e8e6
MB
11197: see if clearenv exists
11198set clearenv d_clearenv
11199eval $inlibc
11200
34f1896b 11201: Define hasstruct macro for Configure internal use
4e0554ec
JH
11202hasstruct='varname=$1; struct=$2; shift; shift;
11203while $test $# -ge 2; do
11204 case "$1" in
11205 $define) echo "#include <$2>";;
11206 esac ;
11207 shift 2;
11208done > try.c;
11209echo "int main () { struct $struct foo; }" >> try.c;
11210set try;
11211if eval $compile; then
11212 val="$define";
11213else
11214 val="$undef";
11215fi;
11216set $varname;
11217eval $setvar;
5b813a60 11218$rm_try'
4e0554ec 11219
34f1896b 11220: see whether socket exists
4e0554ec
JH
11221socketlib=''
11222sockethdr=''
4e0554ec
JH
11223echo " "
11224$echo $n "Hmm... $c" >&4
11225if set socket val -f d_socket; eval $csym; $val; then
11226 echo "Looks like you have Berkeley networking support." >&4
11227 d_socket="$define"
11228 if set setsockopt val -f; eval $csym; $val; then
11229 d_oldsock="$undef"
11230 else
11231 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11232 d_oldsock="$define"
11233 fi
11234else
11235 if $contains socklib libc.list >/dev/null 2>&1; then
11236 echo "Looks like you have Berkeley networking support." >&4
11237 d_socket="$define"
11238 : we will have to assume that it supports the 4.2 BSD interface
11239 d_oldsock="$undef"
11240 else
11241 echo "You don't have Berkeley networking in libc$_a..." >&4
11242 if test "X$d_socket" = "X$define"; then
11243 echo "...but you seem to believe that you have sockets." >&4
11244 else
11245 for net in net socket
11246 do
11247 if test -f /usr/lib/lib$net$_a; then
11248 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
11249 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11250 if $contains socket libc.list >/dev/null 2>&1; then
11251 d_socket="$define"
11252 socketlib="-l$net"
11253 case "$net" in
11254 net)
11255 echo "...but the Wollongong group seems to have hacked it in." >&4
11256 sockethdr="-I/usr/netinclude"
11257 ;;
11258 esac
5b813a60 11259 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
11260 if $contains setsockopt libc.list >/dev/null 2>&1; then
11261 d_oldsock="$undef"
11262 else
11263 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11264 d_oldsock="$define"
11265 fi
11266 break
11267 fi
11268 fi
11269 done
11270 if test "X$d_socket" != "X$define"; then
11271 echo "or anywhere else I see." >&4
11272 d_socket="$undef"
11273 d_oldsock="$undef"
11274 fi
11275 fi
11276 fi
11277fi
11278
11279: see if socketpair exists
11280set socketpair d_sockpair
11281eval $inlibc
11282
11283
11284echo " "
b8677e3b
MB
11285echo "Checking the availability sa_len in the sock struct ..." >&4
11286$cat >try.c <<EOF
11287#include <sys/types.h>
11288#include <sys/socket.h>
11289int main() {
11290struct sockaddr sa;
11291return (sa.sa_len);
11292}
11293EOF
11294val="$undef"
11295set try; if eval $compile; then
11296 val="$define"
11297fi
11298set d_sockaddr_sa_len; eval $setvar
11299$rm_try
11300
11301echo " "
f53580fe
MB
11302echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11303$cat >try.c <<EOF
11304#include <sys/types.h>
11305#include <sys/socket.h>
11306#include <netinet/in.h>
11307int main() {
11308struct sockaddr_in6 sin6;
11309return (sin6.sin6_scope_id);
11310}
11311EOF
11312val="$undef"
11313set try; if eval $compile; then
11314 val="$define"
11315fi
11316set d_sin6_scope_id; eval $setvar
11317$rm_try
11318
11319echo " "
3c728e00 11320echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11321for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11322 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11323 $cat >try.c <<EOF
11324#include <sys/types.h>
11325#include <sys/socket.h>
11326int main() {
11327 int i = $ENUM;
11328}
11329EOF
11330 val="$undef"
11331 set try; if eval $compile; then
11332 val="$define"
11333 fi
11334 set d_${enum}; eval $setvar
5b813a60 11335 $rm_try
4e0554ec
JH
11336done
11337
11338: see if this is a sys/uio.h system
11339set sys/uio.h i_sysuio
11340eval $inhdr
11341
34f1896b 11342: Check for cmsghdr support
4e0554ec
JH
11343echo " "
11344echo "Checking to see if your system supports struct cmsghdr..." >&4
11345set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11346eval $hasstruct
11347case "$d_cmsghdr_s" in
11348"$define") echo "Yes, it does." ;;
11349*) echo "No, it doesn't." ;;
11350esac
11351
11352
b4eb6b3d
JH
11353: check for const keyword
11354echo " "
11355echo 'Checking to see if your C compiler knows about "const"...' >&4
11356$cat >const.c <<'EOCP'
11357typedef struct spug { int drokk; } spug;
76f47787 11358int main()
b4eb6b3d
JH
11359{
11360 const char *foo;
666ea192 11361 const spug y = { 0 };
b4eb6b3d
JH
11362}
11363EOCP
11364if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11365 val="$define"
11366 echo "Yup, it does."
11367else
11368 val="$undef"
11369 echo "Nope, it doesn't."
11370fi
11371set d_const
11372eval $setvar
11373
89ce900e
JH
11374: see if copysignl exists
11375set copysignl d_copysignl
11376eval $inlibc
11377
b4eb6b3d
JH
11378: see if crypt exists
11379echo " "
a5a94ea5
JH
11380set crypt d_crypt
11381eval $inlibc
11382case "$d_crypt" in
11383$define) cryptlib='' ;;
11384*) if set crypt val -f d_crypt; eval $csym; $val; then
11385 echo 'crypt() found.' >&4
b4eb6b3d 11386 val="$define"
a5a94ea5
JH
11387 cryptlib=''
11388 else
11389 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11390 if $test -z "$cryptlib"; then
11391 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11392 else
11393 cryptlib=-lcrypt
11394 fi
11395 if $test -z "$cryptlib"; then
11396 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11397 else
11398 cryptlib=-lcrypt
11399 fi
11400 if $test -z "$cryptlib"; then
11401 cryptlib=`./loc libcrypt$_a "" $libpth`
11402 else
11403 cryptlib=-lcrypt
11404 fi
11405 if $test -z "$cryptlib"; then
11406 echo 'crypt() NOT found.' >&4
11407 val="$undef"
11408 else
11409 val="$define"
11410 fi
b4eb6b3d 11411 fi
a5a94ea5
JH
11412 set d_crypt
11413 eval $setvar
11414 ;;
11415esac
b4eb6b3d 11416
10bc17b6
JH
11417: see if this is a crypt.h system
11418set crypt.h i_crypt
11419eval $inhdr
11420
11421: see if crypt_r exists
11422set crypt_r d_crypt_r
11423eval $inlibc
11424case "$d_crypt_r" in
11425"$define")
11426 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11427 case "$d_crypt_r_proto:$usethreads" in
11428 ":define") d_crypt_r_proto=define
a48ec845
JH
11429 set d_crypt_r_proto crypt_r $hdrs
11430 eval $hasproto ;;
11431 *) ;;
11432 esac
11433 case "$d_crypt_r_proto" in
11434 define)
10bc17b6
JH
11435 case "$crypt_r_proto" in
11436 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
61c26d18 11437 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
10bc17b6
JH
11438 esac
11439 case "$crypt_r_proto" in
b430fd04 11440 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
61c26d18 11441 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
b430fd04
JH
11442 esac
11443 case "$crypt_r_proto" in
90e831dc 11444 ''|0) d_crypt_r=undef
10bc17b6 11445 crypt_r_proto=0
a48ec845 11446 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11447 * ) case "$crypt_r_proto" in
11448 REENTRANT_PROTO*) ;;
11449 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11450 esac
11451 echo "Prototype: $try" ;;
11452 esac
11453 ;;
c18e646a
JH
11454 *) case "$usethreads" in
11455 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11456 esac
90e831dc
SB
11457 d_crypt_r=undef
11458 crypt_r_proto=0
c18e646a 11459 ;;
a48ec845
JH
11460 esac
11461 ;;
10bc17b6
JH
11462*) crypt_r_proto=0
11463 ;;
11464esac
11465
b4eb6b3d
JH
11466: get csh whereabouts
11467case "$csh" in
11468'csh') val="$undef" ;;
11469*) val="$define" ;;
11470esac
11471set d_csh
11472eval $setvar
11473: Respect a hint or command line value for full_csh.
11474case "$full_csh" in
11475'') full_csh=$csh ;;
11476esac
11477
13cfc98d
MB
11478: see if ctermid exists
11479set ctermid d_ctermid
11480eval $inlibc
11481
10bc17b6
JH
11482: see if ctermid_r exists
11483set ctermid_r d_ctermid_r
11484eval $inlibc
11485case "$d_ctermid_r" in
11486"$define")
31ee0cb7 11487 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11488 case "$d_ctermid_r_proto:$usethreads" in
11489 ":define") d_ctermid_r_proto=define
a48ec845
JH
11490 set d_ctermid_r_proto ctermid_r $hdrs
11491 eval $hasproto ;;
11492 *) ;;
11493 esac
11494 case "$d_ctermid_r_proto" in
11495 define)
10bc17b6
JH
11496 case "$ctermid_r_proto" in
11497 ''|0) try='char* ctermid_r(char*);'
61c26d18 11498 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
10bc17b6
JH
11499 esac
11500 case "$ctermid_r_proto" in
90e831dc 11501 ''|0) d_ctermid_r=undef
10bc17b6 11502 ctermid_r_proto=0
a48ec845 11503 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11504 * ) case "$ctermid_r_proto" in
11505 REENTRANT_PROTO*) ;;
11506 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11507 esac
11508 echo "Prototype: $try" ;;
11509 esac
11510 ;;
c18e646a
JH
11511 *) case "$usethreads" in
11512 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11513 esac
90e831dc
SB
11514 d_ctermid_r=undef
11515 ctermid_r_proto=0
c18e646a 11516 ;;
a48ec845
JH
11517 esac
11518 ;;
10bc17b6
JH
11519*) ctermid_r_proto=0
11520 ;;
11521esac
11522
11523: see if ctime_r exists
11524set ctime_r d_ctime_r
11525eval $inlibc
11526case "$d_ctime_r" in
11527"$define")
d63eadf0 11528 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11529 case "$d_ctime_r_proto:$usethreads" in
11530 ":define") d_ctime_r_proto=define
a48ec845
JH
11531 set d_ctime_r_proto ctime_r $hdrs
11532 eval $hasproto ;;
11533 *) ;;
11534 esac
11535 case "$d_ctime_r_proto" in
11536 define)
10bc17b6
JH
11537 case "$ctime_r_proto" in
11538 ''|0) try='char* ctime_r(const time_t*, char*);'
61c26d18 11539 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
10bc17b6
JH
11540 esac
11541 case "$ctime_r_proto" in
11542 ''|0) try='char* ctime_r(const time_t*, char*, int);'
61c26d18 11543 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
10bc17b6
JH
11544 esac
11545 case "$ctime_r_proto" in
11546 ''|0) try='int ctime_r(const time_t*, char*);'
61c26d18 11547 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
10bc17b6
JH
11548 esac
11549 case "$ctime_r_proto" in
11550 ''|0) try='int ctime_r(const time_t*, char*, int);'
61c26d18 11551 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
10bc17b6
JH
11552 esac
11553 case "$ctime_r_proto" in
90e831dc 11554 ''|0) d_ctime_r=undef
10bc17b6 11555 ctime_r_proto=0
a48ec845 11556 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11557 * ) case "$ctime_r_proto" in
11558 REENTRANT_PROTO*) ;;
11559 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11560 esac
11561 echo "Prototype: $try" ;;
11562 esac
11563 ;;
c18e646a
JH
11564 *) case "$usethreads" in
11565 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11566 esac
90e831dc
SB
11567 d_ctime_r=undef
11568 ctime_r_proto=0
c18e646a 11569 ;;
a48ec845
JH
11570 esac
11571 ;;
10bc17b6
JH
11572*) ctime_r_proto=0
11573 ;;
11574esac
11575
b4eb6b3d
JH
11576: see if cuserid exists
11577set cuserid d_cuserid
11578eval $inlibc
11579
11580: see if this is a limits.h system
11581set limits.h i_limits
11582eval $inhdr
11583
11584: see if this is a float.h system
11585set float.h i_float
11586eval $inhdr
11587
11588: See if number of significant digits in a double precision number is known
11589echo " "
11590$cat >dbl_dig.c <<EOM
11591#$i_limits I_LIMITS
11592#$i_float I_FLOAT
11593#ifdef I_LIMITS
11594#include <limits.h>
11595#endif
11596#ifdef I_FLOAT
11597#include <float.h>
11598#endif
11599#ifdef DBL_DIG
11600printf("Contains DBL_DIG");
11601#endif
11602EOM
11603$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11604if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11605 echo "DBL_DIG found." >&4
11606 val="$define"
11607else
11608 echo "DBL_DIG NOT found." >&4
11609 val="$undef"
11610fi
11611$rm -f dbl_dig.?
11612set d_dbl_dig
11613eval $setvar
11614
2ef53570
JH
11615: see if dbm.h is available
11616: see if dbmclose exists
11617set dbmclose d_dbmclose
11618eval $inlibc
11619
11620case "$d_dbmclose" in
11621$define)
11622 set dbm.h i_dbm
11623 eval $inhdr
11624 case "$i_dbm" in
11625 $define)
11626 val="$undef"
11627 set i_rpcsvcdbm
11628 eval $setvar
11629 ;;
11630 *) set rpcsvc/dbm.h i_rpcsvcdbm
11631 eval $inhdr
11632 ;;
11633 esac
11634 ;;
11635*) echo "We won't be including <dbm.h>"
11636 val="$undef"
11637 set i_dbm
11638 eval $setvar
11639 val="$undef"
11640 set i_rpcsvcdbm
11641 eval $setvar
11642 ;;
11643esac
11644
11645: see if prototype for dbminit is available
11646echo " "
11647set d_dbminitproto dbminit $i_dbm dbm.h
11648eval $hasproto
11649
b4eb6b3d
JH
11650: see if difftime exists
11651set difftime d_difftime
11652eval $inlibc
11653
11654: see if this is a dirent system
11655echo " "
11656if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11657 val="$define"
11658 echo "<dirent.h> found." >&4
11659else
11660 val="$undef"
11661 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11662 echo "<sys/dir.h> found." >&4
11663 echo " "
11664 else
11665 xinc=`./findhdr sys/ndir.h`
11666 fi
11667 echo "<dirent.h> NOT found." >&4
11668fi
11669set i_dirent
11670eval $setvar
11671
11672: Look for type of directory structure.
11673echo " "
11674$cppstdin $cppflags $cppminus < "$xinc" > try.c
11675
11676case "$direntrytype" in
11677''|' ')
11678 case "$i_dirent" in
11679 $define) guess1='struct dirent' ;;
11680 *) guess1='struct direct' ;;
11681 esac
11682 ;;
11683*) guess1="$direntrytype"
11684 ;;
11685esac
11686
11687case "$guess1" in
11688'struct dirent') guess2='struct direct' ;;
11689*) guess2='struct dirent' ;;
11690esac
5b813a60 11691
b4eb6b3d
JH
11692if $contains "$guess1" try.c >/dev/null 2>&1; then
11693 direntrytype="$guess1"
11694 echo "Your directory entries are $direntrytype." >&4
11695elif $contains "$guess2" try.c >/dev/null 2>&1; then
11696 direntrytype="$guess2"
11697 echo "Your directory entries seem to be $direntrytype." >&4
11698else
11699 echo "I don't recognize your system's directory entries." >&4
11700 rp="What type is used for directory entries on this system?"
11701 dflt="$guess1"
11702 . ./myread
11703 direntrytype="$ans"
11704fi
5b813a60 11705$rm_try
b4eb6b3d
JH
11706
11707: see if the directory entry stores field length
11708echo " "
11709$cppstdin $cppflags $cppminus < "$xinc" > try.c
11710if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11711 echo "Good, your directory entry keeps length information in d_namlen." >&4
11712 val="$define"
11713else
11714 echo "Your directory entry does not know about the d_namlen field." >&4
11715 val="$undef"
11716fi
11717set d_dirnamlen
11718eval $setvar
5b813a60 11719$rm_try
b4eb6b3d 11720
de52168c
SP
11721: Look for DIR.dd_fd
11722case "$i_dirent" in
11723"$define")
11724 echo "Checking to see if DIR has a dd_fd member variable" >&4
11725 $cat >try.c <<EOCP
11726#$i_stdlib I_STDLIB
11727#ifdef I_STDLIB
11728#include <stdlib.h>
11729#endif
11730#include <dirent.h>
11731
11732int main() {
11733 DIR dir;
11734 dir.dd_fd = 1;
11735 return 0;
11736}
11737EOCP
11738 val=$undef
11739 set try
11740 if eval $compile; then
11741 echo "Yes, it does."
11742 val="$define"
11743 else
11744 echo "No, it does not."
11745 val="$undef"
11746 fi
11747 ;;
11748*)
11749 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11750 val="$undef"
11751 ;;
11752esac
11753set d_dir_dd_fd
11754eval $setvar
5b813a60 11755$rm_try
de52168c 11756
ae0e3d3b
JH
11757: see if this is an sysdir system
11758set sys/dir.h i_sysdir
11759eval $inhdr
11760
11761: see if this is an sysndir system
11762set sys/ndir.h i_sysndir
11763eval $inhdr
11764
11765: Look for dirfd
11766echo " "
11767$cat >dirfd.c <<EOM
11768#include <stdio.h>
55954f19
JH
11769#$i_stdlib I_STDLIB
11770#ifdef I_STDLIB
11771#include <stdlib.h>
11772#endif
ae0e3d3b
JH
11773#$i_dirent I_DIRENT /**/
11774#$i_sysdir I_SYS_DIR /**/
11775#$i_sysndir I_SYS_NDIR /**/
11776#$i_systypes I_SYS_TYPES /**/
11777#if defined(I_SYS_TYPES)
11778#include <sys/types.h>
11779#endif
11780#if defined(I_DIRENT)
11781#include <dirent.h>
11782#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11783#include <sys/dir.h>
11784#endif
11785#else
11786#ifdef I_SYS_NDIR
11787#include <sys/ndir.h>
11788#else
11789#ifdef I_SYS_DIR
11790#ifdef hp9000s500
11791#include <ndir.h> /* may be wrong in the future */
11792#else
11793#include <sys/dir.h>
11794#endif
11795#endif
11796#endif
11797#endif
11798int main() {
11799 DIR *dirp = opendir(".");
11800 if (dirfd(dirp) >= 0)
11801 exit(0);
11802 else
11803 exit(1);
11804}
11805EOM
5cadb3f3 11806val=$undef
ae0e3d3b
JH
11807set dirfd
11808if eval $compile; then
11809 val="$define"
11810fi
11811case "$val" in
11812$define) echo "dirfd() found." >&4 ;;
11813*) echo "dirfd() NOT found." >&4 ;;
11814esac
11815set d_dirfd
11816eval $setvar
11817$rm -f dirfd*
11818
b4eb6b3d
JH
11819: see if dlerror exists
11820xxx_runnm="$runnm"
11821runnm=false
11822set dlerror d_dlerror
11823eval $inlibc
11824runnm="$xxx_runnm"
11825
11826: see if dlfcn is available
11827set dlfcn.h i_dlfcn
11828eval $inhdr
11829
34f1896b 11830: Check what extension to use for shared libs
b4eb6b3d
JH
11831case "$usedl" in
11832$define|y|true)
11833 $cat << EOM
11834
11835On a few systems, the dynamically loaded modules that perl generates and uses
11836will need a different extension than shared libs. The default will probably
11837be appropriate.
11838
11839EOM
11840 case "$dlext" in
11841 '') dflt="$so" ;;
11842 *) dflt="$dlext" ;;
11843 esac
11844 rp='What is the extension of dynamically loaded modules'
11845 . ./myread
11846 dlext="$ans"
11847 ;;
11848*)
11849 dlext="none"
11850 ;;
11851esac
11852
11853: Check if dlsym need a leading underscore
11854echo " "
11855val="$undef"
11856
11857case "$dlsrc" in
11858dl_dlopen.xs)
11859 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11860 $cat >dyna.c <<'EOM'
11861fred () { }
11862EOM
11863
11864$cat >fred.c<<EOM
11865
11866#include <stdio.h>
55954f19
JH
11867#$i_stdlib I_STDLIB
11868#ifdef I_STDLIB
11869#include <stdlib.h>
11870#endif
b4eb6b3d
JH
11871#$i_dlfcn I_DLFCN
11872#ifdef I_DLFCN
5440bc8e 11873#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11874#else
11875#include <sys/types.h>
11876#include <nlist.h>
11877#include <link.h>
11878#endif
11879
11880extern int fred() ;
11881
11882int main()
11883{
11884 void * handle ;
11885 void * symbol ;
11886#ifndef RTLD_LAZY
11887 int mode = 1 ;
11888#else
11889 int mode = RTLD_LAZY ;
11890#endif
11891 handle = dlopen("./dyna.$dlext", mode) ;
11892 if (handle == NULL) {
11893 printf ("1\n") ;
11894 fflush (stdout) ;
11895 exit(0);
11896 }
11897 symbol = dlsym(handle, "fred") ;
11898 if (symbol == NULL) {
11899 /* try putting a leading underscore */
11900 symbol = dlsym(handle, "_fred") ;
11901 if (symbol == NULL) {
11902 printf ("2\n") ;
11903 fflush (stdout) ;
11904 exit(0);
11905 }
11906 printf ("3\n") ;
11907 }
11908 else
11909 printf ("4\n") ;
11910 fflush (stdout) ;
11911 exit(0);
11912}
11913EOM
11914 : Call the object file tmp-dyna.o in case dlext=o.
613d6c3e
MB
11915 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11916 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11917 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11918 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11919 xxx=`$run ./fred`
b4eb6b3d
JH
11920 case $xxx in
11921 1) echo "Test program failed using dlopen." >&4
11922 echo "Perhaps you should not use dynamic loading." >&4;;
11923 2) echo "Test program failed using dlsym." >&4
11924 echo "Perhaps you should not use dynamic loading." >&4;;
11925 3) echo "dlsym needs a leading underscore" >&4
11926 val="$define" ;;
11927 4) echo "dlsym doesn't need a leading underscore." >&4;;
11928 esac
11929 else
11930 echo "I can't compile and run the test program." >&4
11931 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11932 fi
11933 ;;
11934esac
613d6c3e 11935
3c728e00 11936$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11937
11938set d_dlsymun
11939eval $setvar
11940
10bc17b6
JH
11941: see if drand48_r exists
11942set drand48_r d_drand48_r
11943eval $inlibc
11944case "$d_drand48_r" in
11945"$define")
11946 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11947 case "$d_drand48_r_proto:$usethreads" in
11948 ":define") d_drand48_r_proto=define
a48ec845
JH
11949 set d_drand48_r_proto drand48_r $hdrs
11950 eval $hasproto ;;
11951 *) ;;
11952 esac
11953 case "$d_drand48_r_proto" in
11954 define)
10bc17b6
JH
11955 case "$drand48_r_proto" in
11956 ''|0) try='int drand48_r(struct drand48_data*, double*);'
61c26d18 11957 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
10bc17b6
JH
11958 esac
11959 case "$drand48_r_proto" in
90e831dc 11960 ''|0) d_drand48_r=undef
10bc17b6 11961 drand48_r_proto=0
a48ec845 11962 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11963 * ) case "$drand48_r_proto" in
11964 REENTRANT_PROTO*) ;;
11965 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11966 esac
11967 echo "Prototype: $try" ;;
11968 esac
11969 ;;
c18e646a
JH
11970 *) case "$usethreads" in
11971 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11972 esac
90e831dc
SB
11973 d_drand48_r=undef
11974 drand48_r_proto=0
c18e646a 11975 ;;
a48ec845
JH
11976 esac
11977 ;;
10bc17b6
JH
11978*) drand48_r_proto=0
11979 ;;
11980esac
11981
11982: see if prototype for drand48 is available
11983echo " "
11984set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11985eval $hasproto
11986
b4eb6b3d
JH
11987: see if dup2 exists
11988set dup2 d_dup2
11989eval $inlibc
11990
11991: see if eaccess exists
11992set eaccess d_eaccess
11993eval $inlibc
11994
11995: see if endgrent exists
11996set endgrent d_endgrent
11997eval $inlibc
11998
10bc17b6
JH
11999: see if this is an grp system
12000set grp.h i_grp
12001eval $inhdr
12002
12003case "$i_grp" in
12004$define)
12005 xxx=`./findhdr grp.h`
12006 $cppstdin $cppflags $cppminus < $xxx >$$.h
12007
12008 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12009 val="$define"
12010 else
12011 val="$undef"
12012 fi
12013 set d_grpasswd
12014 eval $setvar
12015
12016 $rm -f $$.h
12017 ;;
12018*)
12019 val="$undef";
12020 set d_grpasswd; eval $setvar
12021 ;;
12022esac
12023
12024: see if endgrent_r exists
12025set endgrent_r d_endgrent_r
12026eval $inlibc
12027case "$d_endgrent_r" in
12028"$define")
12029 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12030 case "$d_endgrent_r_proto:$usethreads" in
12031 ":define") d_endgrent_r_proto=define
a48ec845
JH
12032 set d_endgrent_r_proto endgrent_r $hdrs
12033 eval $hasproto ;;
12034 *) ;;
12035 esac
12036 case "$d_endgrent_r_proto" in
12037 define)
10bc17b6
JH
12038 case "$endgrent_r_proto" in
12039 ''|0) try='int endgrent_r(FILE**);'
61c26d18 12040 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
10bc17b6
JH
12041 esac
12042 case "$endgrent_r_proto" in
12043 ''|0) try='void endgrent_r(FILE**);'
61c26d18 12044 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
10bc17b6
JH
12045 esac
12046 case "$endgrent_r_proto" in
90e831dc 12047 ''|0) d_endgrent_r=undef
10bc17b6 12048 endgrent_r_proto=0
a48ec845 12049 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12050 * ) case "$endgrent_r_proto" in
12051 REENTRANT_PROTO*) ;;
12052 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12053 esac
12054 echo "Prototype: $try" ;;
12055 esac
12056 ;;
c18e646a
JH
12057 *) case "$usethreads" in
12058 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12059 esac
90e831dc
SB
12060 d_endgrent_r=undef
12061 endgrent_r_proto=0
c18e646a 12062 ;;
a48ec845
JH
12063 esac
12064 ;;
10bc17b6
JH
12065*) endgrent_r_proto=0
12066 ;;
12067esac
12068
b4eb6b3d
JH
12069: see if endhostent exists
12070set endhostent d_endhent
12071eval $inlibc
12072
10bc17b6
JH
12073: see if this is a netdb.h system
12074set netdb.h i_netdb
12075eval $inhdr
12076
12077: see if endhostent_r exists
12078set endhostent_r d_endhostent_r
12079eval $inlibc
12080case "$d_endhostent_r" in
12081"$define")
12082 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12083 case "$d_endhostent_r_proto:$usethreads" in
12084 ":define") d_endhostent_r_proto=define
a48ec845
JH
12085 set d_endhostent_r_proto endhostent_r $hdrs
12086 eval $hasproto ;;
12087 *) ;;
12088 esac
12089 case "$d_endhostent_r_proto" in
12090 define)
10bc17b6
JH
12091 case "$endhostent_r_proto" in
12092 ''|0) try='int endhostent_r(struct hostent_data*);'
61c26d18 12093 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
12094 esac
12095 case "$endhostent_r_proto" in
12096 ''|0) try='void endhostent_r(struct hostent_data*);'
61c26d18 12097 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
12098 esac
12099 case "$endhostent_r_proto" in
90e831dc 12100 ''|0) d_endhostent_r=undef
10bc17b6 12101 endhostent_r_proto=0
a48ec845 12102 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12103 * ) case "$endhostent_r_proto" in
12104 REENTRANT_PROTO*) ;;
12105 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12106 esac
12107 echo "Prototype: $try" ;;
12108 esac
12109 ;;
c18e646a
JH
12110 *) case "$usethreads" in
12111 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12112 esac
90e831dc
SB
12113 d_endhostent_r=undef
12114 endhostent_r_proto=0
c18e646a 12115 ;;
a48ec845
JH
12116 esac
12117 ;;
10bc17b6
JH
12118*) endhostent_r_proto=0
12119 ;;
12120esac
12121
b4eb6b3d
JH
12122: see if endnetent exists
12123set endnetent d_endnent
12124eval $inlibc
12125
10bc17b6
JH
12126: see if endnetent_r exists
12127set endnetent_r d_endnetent_r
12128eval $inlibc
12129case "$d_endnetent_r" in
12130"$define")
12131 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12132 case "$d_endnetent_r_proto:$usethreads" in
12133 ":define") d_endnetent_r_proto=define
a48ec845
JH
12134 set d_endnetent_r_proto endnetent_r $hdrs
12135 eval $hasproto ;;
12136 *) ;;
12137 esac
12138 case "$d_endnetent_r_proto" in
12139 define)
10bc17b6
JH
12140 case "$endnetent_r_proto" in
12141 ''|0) try='int endnetent_r(struct netent_data*);'
61c26d18 12142 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
12143 esac
12144 case "$endnetent_r_proto" in
12145 ''|0) try='void endnetent_r(struct netent_data*);'
61c26d18 12146 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
12147 esac
12148 case "$endnetent_r_proto" in
90e831dc 12149 ''|0) d_endnetent_r=undef
10bc17b6 12150 endnetent_r_proto=0
a48ec845 12151 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12152 * ) case "$endnetent_r_proto" in
12153 REENTRANT_PROTO*) ;;
12154 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12155 esac
12156 echo "Prototype: $try" ;;
12157 esac
12158 ;;
c18e646a
JH
12159 *) case "$usethreads" in
12160 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12161 esac
90e831dc
SB
12162 d_endnetent_r=undef
12163 endnetent_r_proto=0
c18e646a 12164 ;;
a48ec845
JH
12165 esac
12166 ;;
10bc17b6
JH
12167*) endnetent_r_proto=0
12168 ;;
12169esac
12170
b4eb6b3d
JH
12171: see if endprotoent exists
12172set endprotoent d_endpent
12173eval $inlibc
12174
10bc17b6
JH
12175: see if endprotoent_r exists
12176set endprotoent_r d_endprotoent_r
12177eval $inlibc
12178case "$d_endprotoent_r" in
12179"$define")
12180 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12181 case "$d_endprotoent_r_proto:$usethreads" in
12182 ":define") d_endprotoent_r_proto=define
a48ec845
JH
12183 set d_endprotoent_r_proto endprotoent_r $hdrs
12184 eval $hasproto ;;
12185 *) ;;
12186 esac
12187 case "$d_endprotoent_r_proto" in
12188 define)
10bc17b6
JH
12189 case "$endprotoent_r_proto" in
12190 ''|0) try='int endprotoent_r(struct protoent_data*);'
61c26d18 12191 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
12192 esac
12193 case "$endprotoent_r_proto" in
12194 ''|0) try='void endprotoent_r(struct protoent_data*);'
61c26d18 12195 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
12196 esac
12197 case "$endprotoent_r_proto" in
90e831dc 12198 ''|0) d_endprotoent_r=undef
10bc17b6 12199 endprotoent_r_proto=0
a48ec845 12200 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12201 * ) case "$endprotoent_r_proto" in
12202 REENTRANT_PROTO*) ;;
12203 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12204 esac
12205 echo "Prototype: $try" ;;
12206 esac
12207 ;;
c18e646a
JH
12208 *) case "$usethreads" in
12209 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12210 esac
90e831dc
SB
12211 d_endprotoent_r=undef
12212 endprotoent_r_proto=0
c18e646a 12213 ;;
a48ec845
JH
12214 esac
12215 ;;
10bc17b6
JH
12216*) endprotoent_r_proto=0
12217 ;;
12218esac
12219
b4eb6b3d
JH
12220: see if endpwent exists
12221set endpwent d_endpwent
12222eval $inlibc
12223
10bc17b6
JH
12224: see if this is a pwd.h system
12225set pwd.h i_pwd
12226eval $inhdr
12227
12228case "$i_pwd" in
12229$define)
12230 xxx=`./findhdr pwd.h`
12231 $cppstdin $cppflags $cppminus < $xxx >$$.h
12232
12233 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12234 val="$define"
12235 else
12236 val="$undef"
12237 fi
12238 set d_pwquota
12239 eval $setvar
12240
12241 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12242 val="$define"
12243 else
12244 val="$undef"
12245 fi
12246 set d_pwage
12247 eval $setvar
12248
12249 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12250 val="$define"
12251 else
12252 val="$undef"
12253 fi
12254 set d_pwchange
12255 eval $setvar
12256
12257 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12258 val="$define"
12259 else
12260 val="$undef"
12261 fi
12262 set d_pwclass
12263 eval $setvar
12264
12265 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12266 val="$define"
12267 else
12268 val="$undef"
12269 fi
12270 set d_pwexpire
12271 eval $setvar
12272
12273 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12274 val="$define"
12275 else
12276 val="$undef"
12277 fi
12278 set d_pwcomment
12279 eval $setvar
12280
12281 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12282 val="$define"
12283 else
12284 val="$undef"
12285 fi
12286 set d_pwgecos
12287 eval $setvar
12288
12289 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12290 val="$define"
12291 else
12292 val="$undef"
12293 fi
12294 set d_pwpasswd
12295 eval $setvar
12296
12297 $rm -f $$.h
12298 ;;
12299*)
12300 val="$undef";
12301 set d_pwquota; eval $setvar
12302 set d_pwage; eval $setvar
12303 set d_pwchange; eval $setvar
12304 set d_pwclass; eval $setvar
12305 set d_pwexpire; eval $setvar
12306 set d_pwcomment; eval $setvar
12307 set d_pwgecos; eval $setvar
12308 set d_pwpasswd; eval $setvar
12309 ;;
12310esac
12311
12312: see if endpwent_r exists
12313set endpwent_r d_endpwent_r
12314eval $inlibc
12315case "$d_endpwent_r" in
12316"$define")
12317 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12318 case "$d_endpwent_r_proto:$usethreads" in
12319 ":define") d_endpwent_r_proto=define
a48ec845
JH
12320 set d_endpwent_r_proto endpwent_r $hdrs
12321 eval $hasproto ;;
12322 *) ;;
12323 esac
12324 case "$d_endpwent_r_proto" in
12325 define)
10bc17b6
JH
12326 case "$endpwent_r_proto" in
12327 ''|0) try='int endpwent_r(FILE**);'
61c26d18 12328 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
10bc17b6
JH
12329 esac
12330 case "$endpwent_r_proto" in
12331 ''|0) try='void endpwent_r(FILE**);'
61c26d18 12332 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
10bc17b6
JH
12333 esac
12334 case "$endpwent_r_proto" in
90e831dc 12335 ''|0) d_endpwent_r=undef
10bc17b6 12336 endpwent_r_proto=0
a48ec845 12337 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12338 * ) case "$endpwent_r_proto" in
12339 REENTRANT_PROTO*) ;;
12340 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12341 esac
12342 echo "Prototype: $try" ;;
12343 esac
12344 ;;
c18e646a
JH
12345 *) case "$usethreads" in
12346 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12347 esac
90e831dc
SB
12348 d_endpwent_r=undef
12349 endpwent_r_proto=0
c18e646a 12350 ;;
a48ec845
JH
12351 esac
12352 ;;
10bc17b6
JH
12353*) endpwent_r_proto=0
12354 ;;
12355esac
12356
b4eb6b3d
JH
12357: see if endservent exists
12358set endservent d_endsent
12359eval $inlibc
12360
10bc17b6
JH
12361: see if endservent_r exists
12362set endservent_r d_endservent_r
12363eval $inlibc
12364case "$d_endservent_r" in
12365"$define")
12366 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12367 case "$d_endservent_r_proto:$usethreads" in
12368 ":define") d_endservent_r_proto=define
a48ec845
JH
12369 set d_endservent_r_proto endservent_r $hdrs
12370 eval $hasproto ;;
12371 *) ;;
12372 esac
12373 case "$d_endservent_r_proto" in
12374 define)
10bc17b6
JH
12375 case "$endservent_r_proto" in
12376 ''|0) try='int endservent_r(struct servent_data*);'
61c26d18 12377 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12378 esac
12379 case "$endservent_r_proto" in
12380 ''|0) try='void endservent_r(struct servent_data*);'
61c26d18 12381 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12382 esac
12383 case "$endservent_r_proto" in
90e831dc 12384 ''|0) d_endservent_r=undef
10bc17b6 12385 endservent_r_proto=0
a48ec845 12386 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12387 * ) case "$endservent_r_proto" in
12388 REENTRANT_PROTO*) ;;
12389 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12390 esac
12391 echo "Prototype: $try" ;;
12392 esac
12393 ;;
c18e646a
JH
12394 *) case "$usethreads" in
12395 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12396 esac
90e831dc
SB
12397 d_endservent_r=undef
12398 endservent_r_proto=0
c18e646a 12399 ;;
a48ec845
JH
12400 esac
12401 ;;
10bc17b6
JH
12402*) endservent_r_proto=0
12403 ;;
12404esac
12405
b4eb6b3d
JH
12406: Locate the flags for 'open()'
12407echo " "
55954f19 12408$cat >try.c <<EOCP
b4eb6b3d
JH
12409#include <sys/types.h>
12410#ifdef I_FCNTL
12411#include <fcntl.h>
12412#endif
12413#ifdef I_SYS_FILE
12414#include <sys/file.h>
12415#endif
55954f19
JH
12416#$i_stdlib I_STDLIB
12417#ifdef I_STDLIB
12418#include <stdlib.h>
12419#endif
b4eb6b3d
JH
12420int main() {
12421 if(O_RDONLY);
12422#ifdef O_TRUNC
12423 exit(0);
12424#else
12425 exit(1);
12426#endif
12427}
12428EOCP
12429: check sys/file.h first to get FREAD on Sun
12430if $test `./findhdr sys/file.h` && \
5440bc8e 12431 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12432 h_sysfile=true;
12433 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12434 if $run ./try; then
b4eb6b3d
JH
12435 echo "and you have the 3 argument form of open()." >&4
12436 val="$define"
12437 else
12438 echo "but not the 3 argument form of open(). Oh, well." >&4
12439 val="$undef"
12440 fi
12441elif $test `./findhdr fcntl.h` && \
5440bc8e 12442 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12443 h_fcntl=true;
12444 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12445 if $run ./try; then
b4eb6b3d
JH
12446 echo "and you have the 3 argument form of open()." >&4
12447 val="$define"
12448 else
12449 echo "but not the 3 argument form of open(). Oh, well." >&4
12450 val="$undef"
12451 fi
12452else
12453 val="$undef"
12454 echo "I can't find the O_* constant definitions! You got problems." >&4
12455fi
12456set d_open3
12457eval $setvar
5b813a60 12458$rm_try
b4eb6b3d 12459
3c728e00
JH
12460: see if this is a sys/file.h system
12461val=''
12462set sys/file.h val
12463eval $inhdr
12464
12465: do we need to include sys/file.h ?
12466case "$val" in
12467"$define")
12468 echo " "
12469 if $h_sysfile; then
12470 val="$define"
12471 echo "We'll be including <sys/file.h>." >&4
12472 else
12473 val="$undef"
12474 echo "We won't be including <sys/file.h>." >&4
12475 fi
12476 ;;
12477*)
12478 h_sysfile=false
12479 ;;
12480esac
12481set i_sysfile
12482eval $setvar
12483
12484: see if fcntl.h is there
12485val=''
12486set fcntl.h val
12487eval $inhdr
12488
12489: see if we can include fcntl.h
12490case "$val" in
12491"$define")
12492 echo " "
12493 if $h_fcntl; then
12494 val="$define"
12495 echo "We'll be including <fcntl.h>." >&4
12496 else
12497 val="$undef"
12498 if $h_sysfile; then
12499 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12500 else
12501 echo "We won't be including <fcntl.h>." >&4
12502 fi
12503 fi
12504 ;;
12505*)
12506 h_fcntl=false
12507 val="$undef"
12508 ;;
12509esac
12510set i_fcntl
12511eval $setvar
12512
4dd8f9b3
JH
12513: see if fork exists
12514set fork d_fork
12515eval $inlibc
12516
12517: see if pipe exists
12518set pipe d_pipe
12519eval $inlibc
12520
b4eb6b3d
JH
12521: check for non-blocking I/O stuff
12522case "$h_sysfile" in
a0acbdc3
JH
12523true) echo "#include <sys/file.h>" > head.c;;
12524*)
12525 case "$h_fcntl" in
12526 true) echo "#include <fcntl.h>" > head.c;;
12527 *) echo "#include <sys/fcntl.h>" > head.c;;
12528 esac
12529 ;;
b4eb6b3d
JH
12530esac
12531echo " "
12532echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12533case "$o_nonblock" in
12534'')
12535 $cat head.c > try.c
3c728e00 12536 $cat >>try.c <<EOCP
b4eb6b3d 12537#include <stdio.h>
55954f19
JH
12538#$i_stdlib I_STDLIB
12539#ifdef I_STDLIB
80b3ef99 12540#include <stdlib.h>
55954f19 12541#endif
3c728e00
JH
12542#$i_fcntl I_FCNTL
12543#ifdef I_FCNTL
12544#include <fcntl.h>
12545#endif
b4eb6b3d
JH
12546int main() {
12547#ifdef O_NONBLOCK
12548 printf("O_NONBLOCK\n");
12549 exit(0);
12550#endif
12551#ifdef O_NDELAY
12552 printf("O_NDELAY\n");
12553 exit(0);
12554#endif
12555#ifdef FNDELAY
12556 printf("FNDELAY\n");
12557 exit(0);
12558#endif
12559 exit(0);
12560}
12561EOCP
12562 set try
12563 if eval $compile_ok; then
5440bc8e 12564 o_nonblock=`$run ./try`
b4eb6b3d
JH
12565 case "$o_nonblock" in
12566 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12567 *) echo "Seems like we can use $o_nonblock.";;
12568 esac
12569 else
12570 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12571 fi
12572 ;;
12573*) echo "Using $hint value $o_nonblock.";;
12574esac
5b813a60 12575$rm_try
b4eb6b3d
JH
12576
12577echo " "
12578echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12579case "$eagain" in
12580'')
4dd8f9b3
JH
12581 case "$d_fork:$d_pipe" in
12582 define:define)
b4eb6b3d
JH
12583 $cat head.c > try.c
12584 $cat >>try.c <<EOCP
12585#include <errno.h>
12586#include <sys/types.h>
12587#include <signal.h>
5b813a60 12588#include <stdio.h>
55954f19
JH
12589#$i_stdlib I_STDLIB
12590#ifdef I_STDLIB
12591#include <stdlib.h>
12592#endif
1deb0a86
JH
12593#$i_fcntl I_FCNTL
12594#ifdef I_FCNTL
12595#include <fcntl.h>
12596#endif
b4eb6b3d
JH
12597#define MY_O_NONBLOCK $o_nonblock
12598#ifndef errno /* XXX need better Configure test */
12599extern int errno;
12600#endif
12601#$i_unistd I_UNISTD
12602#ifdef I_UNISTD
12603#include <unistd.h>
12604#endif
12605#$i_string I_STRING
12606#ifdef I_STRING
12607#include <string.h>
12608#else
12609#include <strings.h>
12610#endif
7090f861 12611$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12612EOCP
12613 $cat >> try.c <<'EOCP'
12614int main()
12615{
12616 int pd[2];
12617 int pu[2];
12618 char buf[1];
12619 char string[100];
12620
12621 pipe(pd); /* Down: child -> parent */
12622 pipe(pu); /* Up: parent -> child */
12623 if (0 != fork()) {
12624 int ret;
12625 close(pd[1]); /* Parent reads from pd[0] */
12626 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12627#ifdef F_SETFL
b4eb6b3d
JH
12628 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12629 exit(1);
a0acbdc3
JH
12630#else
12631 exit(4);
12632#endif
b4eb6b3d
JH
12633 signal(SIGALRM, blech);
12634 alarm(5);
12635 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12636 exit(2);
12637 sprintf(string, "%d\n", ret);
12638 write(2, string, strlen(string));
12639 alarm(0);
12640#ifdef EAGAIN
12641 if (errno == EAGAIN) {
12642 printf("EAGAIN\n");
12643 goto ok;
12644 }
12645#endif
12646#ifdef EWOULDBLOCK
12647 if (errno == EWOULDBLOCK)
12648 printf("EWOULDBLOCK\n");
12649#endif
12650 ok:
12651 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12652 sleep(2); /* Give it time to close our pipe */
12653 alarm(5);
12654 ret = read(pd[0], buf, 1); /* Should read EOF */
12655 alarm(0);
12656 sprintf(string, "%d\n", ret);
868439a2 12657 write(4, string, strlen(string));
b4eb6b3d
JH
12658 exit(0);
12659 }
12660
12661 close(pd[0]); /* We write to pd[1] */
12662 close(pu[1]); /* We read from pu[0] */
12663 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12664 close(pd[1]); /* Pipe pd is now fully closed! */
12665 exit(0); /* Bye bye, thank you for playing! */
12666}
12667EOCP
12668 set try
12669 if eval $compile_ok; then
12670 echo "$startsh" >mtry
868439a2 12671 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12672 chmod +x mtry
12673 ./mtry >/dev/null 2>&1
12674 case $? in
12675 0) eagain=`$cat try.out`;;
12676 1) echo "Could not perform non-blocking setting!";;
12677 2) echo "I did a successful read() for something that was not there!";;
12678 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12679 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12680 *) echo "Something terribly wrong happened during testing.";;
12681 esac
12682 rd_nodata=`$cat try.ret`
12683 echo "A read() system call with no data present returns $rd_nodata."
12684 case "$rd_nodata" in
12685 0|-1) ;;
12686 *)
12687 echo "(That's peculiar, fixing that to be -1.)"
12688 rd_nodata=-1
12689 ;;
12690 esac
12691 case "$eagain" in
12692 '')
12693 echo "Forcing errno EAGAIN on read() with no data available."
12694 eagain=EAGAIN
12695 ;;
12696 *)
12697 echo "Your read() sets errno to $eagain when no data is available."
12698 ;;
12699 esac
12700 status=`$cat try.err`
12701 case "$status" in
12702 0) echo "And it correctly returns 0 to signal EOF.";;
12703 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12704 *) echo "However, your read() returns '$status' on EOF??";;
12705 esac
12706 val="$define"
12707 if test "$status" = "$rd_nodata"; then
12708 echo "WARNING: you can't distinguish between EOF and no data!"
12709 val="$undef"
12710 fi
12711 else
12712 echo "I can't compile the test program--assuming errno EAGAIN will do."
12713 eagain=EAGAIN
12714 fi
4dd8f9b3
JH
12715 ;;
12716 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12717 eagain=EAGAIN
12718 val="$define"
12719 ;;
12720 esac
b4eb6b3d
JH
12721 set d_eofnblk
12722 eval $setvar
12723 ;;
12724*)
12725 echo "Using $hint value $eagain."
12726 echo "Your read() returns $rd_nodata when no data is present."
12727 case "$d_eofnblk" in
12728 "$define") echo "And you can see EOF because read() returns 0.";;
12729 "$undef") echo "But you can't see EOF status from read() returned value.";;
12730 *)
12731 echo "(Assuming you can't see EOF status from read anyway.)"
12732 d_eofnblk=$undef
12733 ;;
12734 esac
12735 ;;
12736esac
5b813a60 12737$rm_try head.c mtry
b4eb6b3d 12738
15b61c98
JH
12739: see if _ptr and _cnt from stdio act std
12740echo " "
b4eb6b3d 12741
15b61c98
JH
12742if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12743 echo "(Looks like you have stdio.h from BSD.)"
12744 case "$stdio_ptr" in
12745 '') stdio_ptr='((fp)->_p)'
12746 ptr_lval=$define
12747 ;;
12748 *) ptr_lval=$d_stdio_ptr_lval;;
12749 esac
12750 case "$stdio_cnt" in
12751 '') stdio_cnt='((fp)->_r)'
12752 cnt_lval=$define
12753 ;;
12754 *) cnt_lval=$d_stdio_cnt_lval;;
12755 esac
12756 case "$stdio_base" in
12757 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12758 esac
12759 case "$stdio_bufsiz" in
12760 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12761 esac
12762elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12763 echo "(Looks like you have stdio.h from Linux.)"
12764 case "$stdio_ptr" in
12765 '') stdio_ptr='((fp)->_IO_read_ptr)'
12766 ptr_lval=$define
12767 ;;
12768 *) ptr_lval=$d_stdio_ptr_lval;;
12769 esac
12770 case "$stdio_cnt" in
12771 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12772 cnt_lval=$undef
12773 ;;
12774 *) cnt_lval=$d_stdio_cnt_lval;;
12775 esac
12776 case "$stdio_base" in
12777 '') stdio_base='((fp)->_IO_read_base)';;
12778 esac
12779 case "$stdio_bufsiz" in
12780 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12781 esac
12782else
12783 case "$stdio_ptr" in
12784 '') stdio_ptr='((fp)->_ptr)'
12785 ptr_lval=$define
12786 ;;
12787 *) ptr_lval=$d_stdio_ptr_lval;;
12788 esac
12789 case "$stdio_cnt" in
12790 '') stdio_cnt='((fp)->_cnt)'
12791 cnt_lval=$define
12792 ;;
12793 *) cnt_lval=$d_stdio_cnt_lval;;
12794 esac
12795 case "$stdio_base" in
12796 '') stdio_base='((fp)->_base)';;
12797 esac
12798 case "$stdio_bufsiz" in
12799 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12800 esac
12801fi
b4eb6b3d 12802
15b61c98
JH
12803: test whether _ptr and _cnt really work
12804echo "Checking how std your stdio is..." >&4
12805$cat >try.c <<EOP
12806#include <stdio.h>
55954f19
JH
12807#$i_stdlib I_STDLIB
12808#ifdef I_STDLIB
9d9004a9 12809#include <stdlib.h>
55954f19 12810#endif
15b61c98
JH
12811#define FILE_ptr(fp) $stdio_ptr
12812#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12813int main() {
15b61c98
JH
12814 FILE *fp = fopen("try.c", "r");
12815 char c = getc(fp);
12816 if (
12817 18 <= FILE_cnt(fp) &&
12818 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12819 )
12820 exit(0);
12821 exit(1);
9d9004a9 12822}
15b61c98
JH
12823EOP
12824val="$undef"
12825set try
12826if eval $compile && $to try.c; then
12827 if $run ./try; then
12828 echo "Your stdio acts pretty std."
12829 val="$define"
9d9004a9 12830 else
15b61c98 12831 echo "Your stdio isn't very std."
9d9004a9 12832 fi
15b61c98
JH
12833else
12834 echo "Your stdio doesn't appear very std."
12835fi
5b813a60 12836$rm_try
15b61c98
JH
12837
12838# glibc 2.2.90 and above apparently change stdio streams so Perl's
12839# direct buffer manipulation no longer works. The Configure tests
12840# should be changed to correctly detect this, but until then,
12841# the following check should at least let perl compile and run.
12842# (This quick fix should be updated before 5.8.1.)
12843# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12844# A. Dougherty, June 3, 2002.
12845case "$d_gnulibc" in
12846$define)
12847 case "$gnulibc_version" in
12848 2.[01]*) ;;
12849 2.2) ;;
12850 2.2.[0-9]) ;;
12851 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12852 val="$undef"
12853 ;;
12854 esac
9d9004a9
AD
12855 ;;
12856esac
15b61c98 12857set d_stdstdio
9d9004a9 12858eval $setvar
9d9004a9 12859
15b61c98
JH
12860: Can _ptr be used as an lvalue?
12861case "$d_stdstdio$ptr_lval" in
12862$define$define) val=$define ;;
12863*) val=$undef ;;
12864esac
12865set d_stdio_ptr_lval
12866eval $setvar
9d9004a9 12867
15b61c98
JH
12868: Can _cnt be used as an lvalue?
12869case "$d_stdstdio$cnt_lval" in
12870$define$define) val=$define ;;
12871*) val=$undef ;;
12872esac
12873set d_stdio_cnt_lval
12874eval $setvar
b4eb6b3d 12875
15b61c98
JH
12876
12877: test whether setting _ptr sets _cnt as a side effect
12878d_stdio_ptr_lval_sets_cnt="$undef"
12879d_stdio_ptr_lval_nochange_cnt="$undef"
12880case "$d_stdio_ptr_lval$d_stdstdio" in
12881$define$define)
12882 echo "Checking to see what happens if we set the stdio ptr..." >&4
12883$cat >try.c <<EOP
12884#include <stdio.h>
12885/* Can we scream? */
12886/* Eat dust sed :-) */
12887/* In the buffer space, no one can hear you scream. */
55954f19
JH
12888#$i_stdlib I_STDLIB
12889#ifdef I_STDLIB
12890#include <stdlib.h>
12891#endif
15b61c98
JH
12892#define FILE_ptr(fp) $stdio_ptr
12893#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12894#include <sys/types.h>
b4eb6b3d 12895int main() {
15b61c98
JH
12896 FILE *fp = fopen("try.c", "r");
12897 int c;
12898 char *ptr;
12899 size_t cnt;
12900 if (!fp) {
12901 puts("Fail even to read");
12902 exit(1);
12903 }
12904 c = getc(fp); /* Read away the first # */
12905 if (c == EOF) {
12906 puts("Fail even to read");
12907 exit(1);
12908 }
12909 if (!(
12910 18 <= FILE_cnt(fp) &&
12911 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12912 )) {
12913 puts("Fail even to read");
12914 exit (1);
12915 }
12916 ptr = (char*) FILE_ptr(fp);
12917 cnt = (size_t)FILE_cnt(fp);
12918
12919 FILE_ptr(fp) += 42;
12920
12921 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12922 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12923 exit (1);
12924 }
12925 if (FILE_cnt(fp) <= 20) {
12926 printf ("Fail (<20 chars to test)");
12927 exit (1);
12928 }
12929 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12930 puts("Fail compare");
12931 exit (1);
12932 }
12933 if (cnt == FILE_cnt(fp)) {
12934 puts("Pass_unchanged");
12935 exit (0);
5b813a60 12936 }
15b61c98
JH
12937 if (FILE_cnt(fp) == (cnt - 42)) {
12938 puts("Pass_changed");
12939 exit (0);
12940 }
12941 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12942 return 1;
12943
12944}
12945EOP
12946 set try
12947 if eval $compile && $to try.c; then
12948 case `$run ./try` in
12949 Pass_changed)
12950 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12951 d_stdio_ptr_lval_sets_cnt="$define" ;;
12952 Pass_unchanged)
12953 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12954 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12955 Fail*)
12956 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12957 *)
12958 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12959 esac
12960 else
12961 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12962 fi
5b813a60 12963 $rm_try
15b61c98
JH
12964 ;;
12965esac
12966
12967: see if _base is also standard
12968val="$undef"
12969case "$d_stdstdio" in
12970$define)
12971 $cat >try.c <<EOP
12972#include <stdio.h>
12973#$i_stdlib I_STDLIB
12974#ifdef I_STDLIB
12975#include <stdlib.h>
12976#endif
12977#define FILE_base(fp) $stdio_base
12978#define FILE_bufsiz(fp) $stdio_bufsiz
12979int main() {
12980 FILE *fp = fopen("try.c", "r");
12981 char c = getc(fp);
12982 if (
12983 19 <= FILE_bufsiz(fp) &&
12984 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12985 )
12986 exit(0);
12987 exit(1);
12988}
12989EOP
12990 set try
12991 if eval $compile && $to try.c; then
12992 if $run ./try; then
12993 echo "And its _base field acts std."
12994 val="$define"
12995 else
12996 echo "But its _base field isn't std."
12997 fi
12998 else
12999 echo "However, it seems to be lacking the _base field."
13000 fi
5b813a60 13001 $rm_try
15b61c98
JH
13002 ;;
13003esac
13004set d_stdiobase
13005eval $setvar
13006
13007: see if fast_stdio exists
13008val="$undef"
13009case "$d_stdstdio:$d_stdio_ptr_lval" in
13010"$define:$define")
13011 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13012 *$define*)
13013 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13014 val="$define"
13015 ;;
13016 esac
13017 ;;
13018esac
13019set d_faststdio
13020eval $setvar
13021
13022
13023
13024: see if fchdir exists
13025set fchdir d_fchdir
13026eval $inlibc
13027
13028: see if fchmod exists
13029set fchmod d_fchmod
13030eval $inlibc
13031
13032: see if fchown exists
13033set fchown d_fchown
13034eval $inlibc
13035
13036: see if this is an fcntl system
13037set fcntl d_fcntl
13038eval $inlibc
13039
15b61c98 13040: See if fcntl-based locking works.
613d6c3e 13041echo " "
15b61c98
JH
13042$cat >try.c <<EOCP
13043#$i_stdlib I_STDLIB
13044#ifdef I_STDLIB
13045#include <stdlib.h>
13046#endif
13047#include <unistd.h>
13048#include <fcntl.h>
13049#include <signal.h>
7090f861 13050$signal_t blech(int x) { exit(3); }
15b61c98
JH
13051int main() {
13052#if defined(F_SETLK) && defined(F_SETLKW)
13053 struct flock flock;
13054 int retval, fd;
13055 fd = open("try.c", O_RDONLY);
13056 flock.l_type = F_RDLCK;
13057 flock.l_whence = SEEK_SET;
13058 flock.l_start = flock.l_len = 0;
13059 signal(SIGALRM, blech);
13060 alarm(10);
13061 retval = fcntl(fd, F_SETLK, &flock);
13062 close(fd);
13063 (retval < 0 ? exit(2) : exit(0));
13064#else
13065 exit(2);
13066#endif
13067}
13068EOCP
13069echo "Checking if fcntl-based file locking works... "
13070case "$d_fcntl" in
13071"$define")
13072 set try
13073 if eval $compile_ok; then
13074 if $run ./try; then
13075 echo "Yes, it seems to work."
13076 val="$define"
13077 else
13078 echo "Nope, it didn't work."
13079 val="$undef"
13080 case "$?" in
13081 3) $cat >&4 <<EOM
13082***
13083*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13084*** This is (almost) impossible.
13085*** If your NFS lock daemons are not feeling well, something like
13086*** this may happen, please investigate. Cannot continue, aborting.
13087***
13088EOM
13089 exit 1
13090 ;;
13091 esac
13092 fi
13093 else
13094 echo "I'm unable to compile the test program, so I'll assume not."
13095 val="$undef"
13096 fi
13097 ;;
13098*) val="$undef";
13099 echo "Nope, since you don't even have fcntl()."
13100 ;;
13101esac
13102set d_fcntl_can_lock
13103eval $setvar
5b813a60 13104$rm_try
15b61c98
JH
13105
13106: check for fd_set items
13107$cat <<EOM
13108
13109Checking to see how well your C compiler handles fd_set and friends ...
13110EOM
13111$cat >try.c <<EOCP
13112#$i_stdlib I_STDLIB
13113#ifdef I_STDLIB
13114#include <stdlib.h>
13115#endif
13116#$i_systime I_SYS_TIME
13117#$i_sysselct I_SYS_SELECT
13118#$d_socket HAS_SOCKET
13119#include <sys/types.h>
13120#ifdef HAS_SOCKET
13121#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13122#endif
13123#ifdef I_SYS_TIME
13124#include <sys/time.h>
13125#endif
13126#ifdef I_SYS_SELECT
13127#include <sys/select.h>
13128#endif
13129int main() {
13130 fd_set fds;
13131
13132#ifdef TRYBITS
13133 if(fds.fds_bits);
13134#endif
13135
13136#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13137 exit(0);
13138#else
13139 exit(1);
13140#endif
13141}
13142EOCP
13143set try -DTRYBITS
13144if eval $compile; then
13145 d_fds_bits="$define"
13146 d_fd_set="$define"
13147 echo "Well, your system knows about the normal fd_set typedef..." >&4
13148 if $run ./try; then
b4eb6b3d
JH
13149 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13150 d_fd_macros="$define"
13151 else
13152 $cat >&4 <<'EOM'
13153but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13154EOM
13155 d_fd_macros="$undef"
13156 fi
13157else
13158 $cat <<'EOM'
13159Hmm, your compiler has some difficulty with fd_set. Checking further...
13160EOM
5440bc8e 13161 set try
b4eb6b3d
JH
13162 if eval $compile; then
13163 d_fds_bits="$undef"
13164 d_fd_set="$define"
13165 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 13166 if $run ./try; then
b4eb6b3d
JH
13167 echo "and you have the normal fd_set macros." >&4
13168 d_fd_macros="$define"
13169 else
13170 $cat <<'EOM'
13171but not the normal fd_set macros! Gross! More work for me...
13172EOM
13173 d_fd_macros="$undef"
13174 fi
13175 else
13176 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13177 d_fd_set="$undef"
13178 d_fds_bits="$undef"
13179 d_fd_macros="$undef"
13180 fi
13181fi
5b813a60 13182$rm_try
b4eb6b3d
JH
13183
13184: see if fgetpos exists
13185set fgetpos d_fgetpos
13186eval $inlibc
13187
758a5d79
JH
13188: see if finite exists
13189set finite d_finite
13190eval $inlibc
13191
13192: see if finitel exists
13193set finitel d_finitel
13194eval $inlibc
13195
b4eb6b3d
JH
13196: see if flock exists
13197set flock d_flock
13198eval $inlibc
13199
2ef53570
JH
13200: see if prototype for flock is available
13201echo " "
13202set d_flockproto flock $i_sysfile sys/file.h
13203eval $hasproto
13204
758a5d79
JH
13205: see if fp_class exists
13206set fp_class d_fp_class
13207eval $inlibc
13208
b4eb6b3d
JH
13209: see if pathconf exists
13210set pathconf d_pathconf
13211eval $inlibc
13212
13213: see if fpathconf exists
13214set fpathconf d_fpathconf
13215eval $inlibc
13216
758a5d79
JH
13217: see if fpclass exists
13218set fpclass d_fpclass
13219eval $inlibc
13220
13221: see if fpclassify exists
13222set fpclassify d_fpclassify
13223eval $inlibc
13224
13225: see if fpclassl exists
13226set fpclassl d_fpclassl
13227eval $inlibc
13228
b4eb6b3d
JH
13229: check for fpos64_t
13230echo " "
13231echo "Checking to see if you have fpos64_t..." >&4
13232$cat >try.c <<EOCP
13233#include <stdio.h>
13234int main() { fpos64_t x = 7; }
13235EOCP
13236set try
13237if eval $compile; then
13238 val="$define"
13239 echo "You have fpos64_t."
13240else
13241 val="$undef"
13242 echo "You do not have fpos64_t."
13243 case "$fpossize" in
13244 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13245 esac
13246fi
5b813a60 13247$rm_try
b4eb6b3d
JH
13248set d_fpos64_t
13249eval $setvar
13250
13251: see if frexpl exists
13252set frexpl d_frexpl
13253eval $inlibc
13254
b4eb6b3d
JH
13255: see if this is a sys/param system
13256set sys/param.h i_sysparam
13257eval $inhdr
13258
13259: see if this is a sys/mount.h system
13260set sys/mount.h i_sysmount
13261eval $inhdr
13262
34f1896b 13263: Check for fs_data_s
b4eb6b3d
JH
13264echo " "
13265echo "Checking to see if your system supports struct fs_data..." >&4
13266set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13267eval $hasstruct
13268case "$d_fs_data_s" in
13269"$define") echo "Yes, it does." ;;
13270*) echo "No, it doesn't." ;;
13271esac
13272
13273: see if fseeko exists
13274set fseeko d_fseeko
13275eval $inlibc
13276case "$longsize" in
132778) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13278esac
13279
13280: see if fsetpos exists
13281set fsetpos d_fsetpos
13282eval $inlibc
13283
b4eb6b3d
JH
13284: see if fstatfs exists
13285set fstatfs d_fstatfs
13286eval $inlibc
13287
b4eb6b3d
JH
13288: see if statvfs exists
13289set statvfs d_statvfs
13290eval $inlibc
13291
13292: see if fstatvfs exists
13293set fstatvfs d_fstatvfs
13294eval $inlibc
13295
13296
411ab01c
JH
13297: see if fsync exists
13298set fsync d_fsync
13299eval $inlibc
13300
b4eb6b3d
JH
13301: see if ftello exists
13302set ftello d_ftello
13303eval $inlibc
13304case "$longsize" in
133058) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13306esac
13307
bff98e24 13308: check for a working futimes
613d6c3e 13309d_futimes="$undef"
bff98e24 13310echo " "
5b813a60 13311echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13312$cat >try.c <<EOCP
13313#include <stdio.h>
13314#include <sys/time.h>
13315#include <errno.h>
13316#include <fcntl.h>
13317
13318int main ()
13319{
13320 int fd, rv;
13321 fd = open ("try.c", O_RDWR);
13322 if (-1 == fd) exit (1);
13323 rv = futimes (fd, NULL);
13324 exit (rv == -1 ? errno : 0);
13325}
13326EOCP
13327set try
13328if eval $compile; then
13329 `$run ./try`
13330 rc=$?
13331 case "$rc" in
5b813a60 13332 0) echo "Yes, you have" >&4
bff98e24
SP
13333 d_futimes="$define"
13334 ;;
5b813a60 13335 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13336 ;;
13337 esac
13338else
43dddb59 13339 echo "No, it does not (probably harmless)" >&4
bff98e24 13340fi
5b813a60 13341$rm_try
dc814df1 13342
e74475c7
MHM
13343: see if ndbm.h is available
13344set ndbm.h i_ndbm
13345eval $inhdr
13346: Compatibility location for RedHat 7.1
13347set gdbm/ndbm.h i_gdbmndbm
13348eval $inhdr
13349: Compatibility location for Debian 4.0
13350set gdbm-ndbm.h i_gdbm_ndbm
13351eval $inhdr
13352
13353val="$undef"
13354if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13355 : see if dbm_open exists
13356 set dbm_open d_dbm_open
13357 eval $inlibc
13358 case "$d_dbm_open" in
13359 $undef)
13360 i_ndbm="$undef"
13361 i_gdbmndbm="$undef"
13362 i_gdbm_ndbm="$undef"
13363 echo "We won't be including <ndbm.h>"
13364 val="$undef"
13365 ;;
13366 *) val="$define"
13367 ;;
13368 esac
13369fi
13370set d_ndbm
13371eval $setvar
13372
13373ndbm_hdr_protochk='name=$1; hdr=$2;
13374eval "ihdr=\$""i_$name";
13375val="$undef";
13376if $test "$ihdr" = "$define"; then
13377 $echo "Checking if your <$hdr> uses prototypes..." >&4;
13378 case "$d_cplusplus" in
13379 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13380 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13381 esac;
13382 case "$val" in
13383 $define) $echo "Your <$hdr> seems to have prototypes";;
13384 *) $echo "Your <$hdr> does not seem to have prototypes";;
13385 esac;
13386fi;
13387set "d_${name}_h_uses_prototypes";
13388eval $setvar'
13389
13390set ndbm ndbm.h
13391eval $ndbm_hdr_protochk
13392set gdbmndbm gdbm/ndbm.h
13393eval $ndbm_hdr_protochk
13394set gdbm_ndbm gdbm-ndbm.h
13395eval $ndbm_hdr_protochk
13396
5086dff9
MB
13397: see if getaddrinfo exists
13398set getaddrinfo d_getaddrinfo
13399eval $inlibc
13400
b4eb6b3d
JH
13401: see if getcwd exists
13402set getcwd d_getcwd
13403eval $inlibc
13404
13405: see if getespwnam exists
13406set getespwnam d_getespwnam
13407eval $inlibc
13408
b4eb6b3d
JH
13409: see if getfsstat exists
13410set getfsstat d_getfsstat
13411eval $inlibc
13412
13413: see if getgrent exists
13414set getgrent d_getgrent
13415eval $inlibc
13416
10bc17b6
JH
13417: see if getgrent_r exists
13418set getgrent_r d_getgrent_r
13419eval $inlibc
13420case "$d_getgrent_r" in
13421"$define")
13422 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13423 case "$d_getgrent_r_proto:$usethreads" in
13424 ":define") d_getgrent_r_proto=define
a48ec845
JH
13425 set d_getgrent_r_proto getgrent_r $hdrs
13426 eval $hasproto ;;
13427 *) ;;
13428 esac
13429 case "$d_getgrent_r_proto" in
13430 define)
10bc17b6
JH
13431 case "$getgrent_r_proto" in
13432 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
61c26d18 13433 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
10bc17b6
JH
13434 esac
13435 case "$getgrent_r_proto" in
13436 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
61c26d18 13437 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
10bc17b6
JH
13438 esac
13439 case "$getgrent_r_proto" in
13440 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
61c26d18 13441 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
10bc17b6
JH
13442 esac
13443 case "$getgrent_r_proto" in
13444 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
61c26d18 13445 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
10bc17b6
JH
13446 esac
13447 case "$getgrent_r_proto" in
13448 ''|0) try='int getgrent_r(struct group*, char*, int);'
61c26d18 13449 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
10bc17b6
JH
13450 esac
13451 case "$getgrent_r_proto" in
13452 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
61c26d18 13453 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
10bc17b6
JH
13454 esac
13455 case "$getgrent_r_proto" in
90e831dc 13456 ''|0) d_getgrent_r=undef
10bc17b6 13457 getgrent_r_proto=0
a48ec845 13458 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13459 * ) case "$getgrent_r_proto" in
13460 REENTRANT_PROTO*) ;;
13461 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13462 esac
13463 echo "Prototype: $try" ;;
13464 esac
13465 ;;
c18e646a
JH
13466 *) case "$usethreads" in
13467 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13468 esac
90e831dc
SB
13469 d_getgrent_r=undef
13470 getgrent_r_proto=0
c18e646a 13471 ;;
a48ec845
JH
13472 esac
13473 ;;
10bc17b6
JH
13474*) getgrent_r_proto=0
13475 ;;
13476esac
13477
13478: see if getgrgid_r exists
13479set getgrgid_r d_getgrgid_r
13480eval $inlibc
13481case "$d_getgrgid_r" in
13482"$define")
13483 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13484 case "$d_getgrgid_r_proto:$usethreads" in
13485 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13486 set d_getgrgid_r_proto getgrgid_r $hdrs
13487 eval $hasproto ;;
13488 *) ;;
13489 esac
13490 case "$d_getgrgid_r_proto" in
13491 define)
10bc17b6
JH
13492 case "$getgrgid_r_proto" in
13493 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
61c26d18 13494 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
10bc17b6
JH
13495 esac
13496 case "$getgrgid_r_proto" in
13497 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
61c26d18 13498 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
10bc17b6
JH
13499 esac
13500 case "$getgrgid_r_proto" in
13501 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13502 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
10bc17b6
JH
13503 esac
13504 case "$getgrgid_r_proto" in
13505 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13506 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
10bc17b6
JH
13507 esac
13508 case "$getgrgid_r_proto" in
90e831dc 13509 ''|0) d_getgrgid_r=undef
10bc17b6 13510 getgrgid_r_proto=0
a48ec845 13511 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13512 * ) case "$getgrgid_r_proto" in
13513 REENTRANT_PROTO*) ;;
13514 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13515 esac
13516 echo "Prototype: $try" ;;
13517 esac
13518 ;;
c18e646a
JH
13519 *) case "$usethreads" in
13520 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13521 esac
90e831dc
SB
13522 d_getgrgid_r=undef
13523 getgrgid_r_proto=0
c18e646a 13524 ;;
a48ec845
JH
13525 esac
13526 ;;
10bc17b6
JH
13527*) getgrgid_r_proto=0
13528 ;;
13529esac
13530
13531: see if getgrnam_r exists
13532set getgrnam_r d_getgrnam_r
13533eval $inlibc
13534case "$d_getgrnam_r" in
13535"$define")
13536 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13537 case "$d_getgrnam_r_proto:$usethreads" in
13538 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13539 set d_getgrnam_r_proto getgrnam_r $hdrs
13540 eval $hasproto ;;
13541 *) ;;
13542 esac
13543 case "$d_getgrnam_r_proto" in
13544 define)
10bc17b6
JH
13545 case "$getgrnam_r_proto" in
13546 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
61c26d18 13547 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
10bc17b6
JH
13548 esac
13549 case "$getgrnam_r_proto" in
13550 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
61c26d18 13551 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
10bc17b6
JH
13552 esac
13553 case "$getgrnam_r_proto" in
13554 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
61c26d18 13555 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
10bc17b6
JH
13556 esac
13557 case "$getgrnam_r_proto" in
13558 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13559 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
10bc17b6
JH
13560 esac
13561 case "$getgrnam_r_proto" in
13562 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13563 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
10bc17b6
JH
13564 esac
13565 case "$getgrnam_r_proto" in
90e831dc 13566 ''|0) d_getgrnam_r=undef
10bc17b6 13567 getgrnam_r_proto=0
a48ec845 13568 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13569 * ) case "$getgrnam_r_proto" in
13570 REENTRANT_PROTO*) ;;
13571 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13572 esac
13573 echo "Prototype: $try" ;;
13574 esac
13575 ;;
c18e646a
JH
13576 *) case "$usethreads" in
13577 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13578 esac
90e831dc
SB
13579 d_getgrnam_r=undef
13580 getgrnam_r_proto=0
c18e646a 13581 ;;
a48ec845
JH
13582 esac
13583 ;;
10bc17b6
JH
13584*) getgrnam_r_proto=0
13585 ;;
13586esac
13587
b4eb6b3d
JH
13588: see if gethostbyaddr exists
13589set gethostbyaddr d_gethbyaddr
13590eval $inlibc
13591
13592: see if gethostbyname exists
13593set gethostbyname d_gethbyname
13594eval $inlibc
13595
13596: see if gethostent exists
13597set gethostent d_gethent
13598eval $inlibc
13599
13600: see how we will look up host name
13601echo " "
13602call=''
13603if set gethostname val -f d_gethname; eval $csym; $val; then
13604 echo 'gethostname() found.' >&4
13605 d_gethname="$define"
13606 call=gethostname
13607fi
13608if set uname val -f d_uname; eval $csym; $val; then
13609 if ./xenix; then
13610 $cat <<'EOM'
13611uname() was found, but you're running xenix, and older versions of xenix
13612have a broken uname(). If you don't really know whether your xenix is old
13613enough to have a broken system call, use the default answer.
13614
13615EOM
13616 dflt=y
13617 case "$d_uname" in
13618 "$define") dflt=n;;
13619 esac
13620 rp='Is your uname() broken?'
13621 . ./myread
13622 case "$ans" in
13623 n*) d_uname="$define"; call=uname;;
13624 esac
13625 else
13626 echo 'uname() found.' >&4
13627 d_uname="$define"
13628 case "$call" in
13629 '') call=uname ;;
13630 esac
13631 fi
13632fi
13633case "$d_gethname" in
13634'') d_gethname="$undef";;
13635esac
13636case "$d_uname" in
13637'') d_uname="$undef";;
13638esac
13639case "$d_uname$d_gethname" in
13640*define*)
13641 dflt=n
13642 cat <<EOM
613d6c3e 13643
b4eb6b3d
JH
13644Every now and then someone has a $call() that lies about the hostname
13645but can't be fixed for political or economic reasons. If you wish, I can
13646pretend $call() isn't there and maybe compute hostname at run-time
13647thanks to the '$phostname' command.
13648
13649EOM
13650 rp="Shall I ignore $call() from now on?"
13651 . ./myread
13652 case "$ans" in
13653 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13654 esac;;
13655esac
13656case "$phostname" in
13657'') aphostname='';;
13658*) case "$aphostname" in
13659 /*) ;;
13660 *) set X $phostname
13661 shift
13662 file=$1
13663 shift
13664 file=`./loc $file $file $pth`
13665 aphostname=`echo $file $*`
13666 ;;
13667 esac
13668 ;;
13669esac
13670case "$d_uname$d_gethname" in
13671*define*) ;;
13672*)
13673 case "$phostname" in
13674 '')
13675 echo "There will be no way for $package to get your hostname." >&4;;
13676 *)
13677 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13678 ;;
13679 esac;;
13680esac
13681case "$d_phostname" in
13682'') d_phostname="$undef";;
13683esac
13684
10bc17b6
JH
13685: see if gethostbyaddr_r exists
13686set gethostbyaddr_r d_gethostbyaddr_r
13687eval $inlibc
13688case "$d_gethostbyaddr_r" in
13689"$define")
13690 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13691 case "$d_gethostbyaddr_r_proto:$usethreads" in
13692 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13693 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13694 eval $hasproto ;;
13695 *) ;;
13696 esac
13697 case "$d_gethostbyaddr_r_proto" in
13698 define)
10bc17b6
JH
13699 case "$gethostbyaddr_r_proto" in
13700 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13701 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
10bc17b6
JH
13702 esac
13703 case "$gethostbyaddr_r_proto" in
13704 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
61c26d18 13705 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
10bc17b6
JH
13706 esac
13707 case "$gethostbyaddr_r_proto" in
13708 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13709 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
10bc17b6
JH
13710 esac
13711 case "$gethostbyaddr_r_proto" in
13712 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13713 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
10bc17b6
JH
13714 esac
13715 case "$gethostbyaddr_r_proto" in
13716 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
61c26d18 13717 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
10bc17b6
JH
13718 esac
13719 case "$gethostbyaddr_r_proto" in
13720 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13721 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
10bc17b6
JH
13722 esac
13723 case "$gethostbyaddr_r_proto" in
13724 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
61c26d18 13725 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
10bc17b6
JH
13726 esac
13727 case "$gethostbyaddr_r_proto" in
13728 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
61c26d18 13729 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
10bc17b6
JH
13730 esac
13731 case "$gethostbyaddr_r_proto" in
13732 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
61c26d18 13733 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
10bc17b6
JH
13734 esac
13735 case "$gethostbyaddr_r_proto" in
13736 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
61c26d18 13737 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
10bc17b6
JH
13738 esac
13739 case "$gethostbyaddr_r_proto" in
a845a0d4 13740 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13741 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
a845a0d4
JH
13742 esac
13743 case "$gethostbyaddr_r_proto" in
90e831dc 13744 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13745 gethostbyaddr_r_proto=0
a48ec845 13746 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13747 * ) case "$gethostbyaddr_r_proto" in
13748 REENTRANT_PROTO*) ;;
13749 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13750 esac
13751 echo "Prototype: $try" ;;
13752 esac
13753 ;;
c18e646a
JH
13754 *) case "$usethreads" in
13755 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13756 esac
90e831dc
SB
13757 d_gethostbyaddr_r=undef
13758 gethostbyaddr_r_proto=0
c18e646a 13759 ;;
a48ec845
JH
13760 esac
13761 ;;
10bc17b6
JH
13762*) gethostbyaddr_r_proto=0
13763 ;;
13764esac
13765
13766: see if gethostbyname_r exists
13767set gethostbyname_r d_gethostbyname_r
13768eval $inlibc
13769case "$d_gethostbyname_r" in
13770"$define")
13771 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13772 case "$d_gethostbyname_r_proto:$usethreads" in
13773 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13774 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13775 eval $hasproto ;;
13776 *) ;;
13777 esac
13778 case "$d_gethostbyname_r_proto" in
13779 define)
10bc17b6
JH
13780 case "$gethostbyname_r_proto" in
13781 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13782 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
13783 esac
13784 case "$gethostbyname_r_proto" in
13785 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13786 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
10bc17b6
JH
13787 esac
13788 case "$gethostbyname_r_proto" in
13789 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
61c26d18 13790 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
10bc17b6
JH
13791 esac
13792 case "$gethostbyname_r_proto" in
90e831dc 13793 ''|0) d_gethostbyname_r=undef
10bc17b6 13794 gethostbyname_r_proto=0
a48ec845 13795 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13796 * ) case "$gethostbyname_r_proto" in
13797 REENTRANT_PROTO*) ;;
13798 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13799 esac
13800 echo "Prototype: $try" ;;
13801 esac
13802 ;;
c18e646a
JH
13803 *) case "$usethreads" in
13804 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13805 esac
90e831dc
SB
13806 d_gethostbyname_r=undef
13807 gethostbyname_r_proto=0
c18e646a 13808 ;;
a48ec845
JH
13809 esac
13810 ;;
10bc17b6
JH
13811*) gethostbyname_r_proto=0
13812 ;;
13813esac
13814
13815: see if gethostent_r exists
13816set gethostent_r d_gethostent_r
13817eval $inlibc
13818case "$d_gethostent_r" in
13819"$define")
13820 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13821 case "$d_gethostent_r_proto:$usethreads" in
13822 ":define") d_gethostent_r_proto=define
a48ec845
JH
13823 set d_gethostent_r_proto gethostent_r $hdrs
13824 eval $hasproto ;;
13825 *) ;;
13826 esac
13827 case "$d_gethostent_r_proto" in
13828 define)
10bc17b6
JH
13829 case "$gethostent_r_proto" in
13830 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13831 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
10bc17b6
JH
13832 esac
13833 case "$gethostent_r_proto" in
13834 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13835 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
10bc17b6
JH
13836 esac
13837 case "$gethostent_r_proto" in
13838 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13839 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
10bc17b6
JH
13840 esac
13841 case "$gethostent_r_proto" in
13842 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
61c26d18 13843 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
10bc17b6
JH
13844 esac
13845 case "$gethostent_r_proto" in
13846 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
61c26d18 13847 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
10bc17b6
JH
13848 esac
13849 case "$gethostent_r_proto" in
13850 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
61c26d18 13851 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
10bc17b6
JH
13852 esac
13853 case "$gethostent_r_proto" in
90e831dc 13854 ''|0) d_gethostent_r=undef
10bc17b6 13855 gethostent_r_proto=0
a48ec845 13856 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13857 * ) case "$gethostent_r_proto" in
13858 REENTRANT_PROTO*) ;;
13859 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13860 esac
13861 echo "Prototype: $try" ;;
13862 esac
13863 ;;
c18e646a
JH
13864 *) case "$usethreads" in
13865 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13866 esac
90e831dc
SB
13867 d_gethostent_r=undef
13868 gethostent_r_proto=0
c18e646a 13869 ;;
a48ec845
JH
13870 esac
13871 ;;
10bc17b6
JH
13872*) gethostent_r_proto=0
13873 ;;
13874esac
b4eb6b3d
JH
13875
13876: see if prototypes for various gethostxxx netdb.h functions are available
13877echo " "
13878set d_gethostprotos gethostent $i_netdb netdb.h
13879eval $hasproto
13880
4e0554ec
JH
13881: see if getitimer exists
13882set getitimer d_getitimer
13883eval $inlibc
13884
b4eb6b3d
JH
13885: see if getlogin exists
13886set getlogin d_getlogin
13887eval $inlibc
13888
10bc17b6
JH
13889: see if getlogin_r exists
13890set getlogin_r d_getlogin_r
13891eval $inlibc
13892case "$d_getlogin_r" in
13893"$define")
13894 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13895 case "$d_getlogin_r_proto:$usethreads" in
13896 ":define") d_getlogin_r_proto=define
a48ec845
JH
13897 set d_getlogin_r_proto getlogin_r $hdrs
13898 eval $hasproto ;;
13899 *) ;;
13900 esac
13901 case "$d_getlogin_r_proto" in
13902 define)
10bc17b6
JH
13903 case "$getlogin_r_proto" in
13904 ''|0) try='int getlogin_r(char*, size_t);'
61c26d18 13905 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
10bc17b6
JH
13906 esac
13907 case "$getlogin_r_proto" in
13908 ''|0) try='int getlogin_r(char*, int);'
61c26d18 13909 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
10bc17b6
JH
13910 esac
13911 case "$getlogin_r_proto" in
13912 ''|0) try='char* getlogin_r(char*, size_t);'
61c26d18 13913 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
10bc17b6
JH
13914 esac
13915 case "$getlogin_r_proto" in
13916 ''|0) try='char* getlogin_r(char*, int);'
61c26d18 13917 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
10bc17b6
JH
13918 esac
13919 case "$getlogin_r_proto" in
90e831dc 13920 ''|0) d_getlogin_r=undef
10bc17b6 13921 getlogin_r_proto=0
a48ec845 13922 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13923 * ) case "$getlogin_r_proto" in
13924 REENTRANT_PROTO*) ;;
13925 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13926 esac
13927 echo "Prototype: $try" ;;
13928 esac
13929 ;;
c18e646a
JH
13930 *) case "$usethreads" in
13931 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13932 esac
90e831dc
SB
13933 d_getlogin_r=undef
13934 getlogin_r_proto=0
c18e646a 13935 ;;
a48ec845
JH
13936 esac
13937 ;;
10bc17b6
JH
13938*) getlogin_r_proto=0
13939 ;;
13940esac
13941
b4eb6b3d
JH
13942: see if getmnt exists
13943set getmnt d_getmnt
13944eval $inlibc
13945
13946: see if getmntent exists
13947set getmntent d_getmntent
13948eval $inlibc
13949
5086dff9
MB
13950: see if getnameinfo exists
13951set getnameinfo d_getnameinfo
13952eval $inlibc
13953
b4eb6b3d
JH
13954: see if getnetbyaddr exists
13955set getnetbyaddr d_getnbyaddr
13956eval $inlibc
13957
13958: see if getnetbyname exists
13959set getnetbyname d_getnbyname
13960eval $inlibc
13961
13962: see if getnetent exists
13963set getnetent d_getnent
13964eval $inlibc
13965
10bc17b6
JH
13966: see if getnetbyaddr_r exists
13967set getnetbyaddr_r d_getnetbyaddr_r
13968eval $inlibc
13969case "$d_getnetbyaddr_r" in
13970"$define")
13971 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13972 case "$d_getnetbyaddr_r_proto:$usethreads" in
13973 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13974 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13975 eval $hasproto ;;
13976 *) ;;
13977 esac
13978 case "$d_getnetbyaddr_r_proto" in
13979 define)
10bc17b6
JH
13980 case "$getnetbyaddr_r_proto" in
13981 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 13982 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
10bc17b6
JH
13983 esac
13984 case "$getnetbyaddr_r_proto" in
13985 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 13986 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
10bc17b6
JH
13987 esac
13988 case "$getnetbyaddr_r_proto" in
13989 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
61c26d18 13990 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
10bc17b6
JH
13991 esac
13992 case "$getnetbyaddr_r_proto" in
13993 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 13994 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
10bc17b6
JH
13995 esac
13996 case "$getnetbyaddr_r_proto" in
13997 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
61c26d18 13998 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
10bc17b6
JH
13999 esac
14000 case "$getnetbyaddr_r_proto" in
14001 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
61c26d18 14002 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
10bc17b6
JH
14003 esac
14004 case "$getnetbyaddr_r_proto" in
14005 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
61c26d18 14006 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
10bc17b6
JH
14007 esac
14008 case "$getnetbyaddr_r_proto" in
a845a0d4 14009 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14010 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
a845a0d4
JH
14011 esac
14012 case "$getnetbyaddr_r_proto" in
90e831dc 14013 ''|0) d_getnetbyaddr_r=undef
10bc17b6 14014 getnetbyaddr_r_proto=0
a48ec845 14015 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14016 * ) case "$getnetbyaddr_r_proto" in
14017 REENTRANT_PROTO*) ;;
14018 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14019 esac
14020 echo "Prototype: $try" ;;
14021 esac
14022 ;;
c18e646a
JH
14023 *) case "$usethreads" in
14024 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14025 esac
90e831dc
SB
14026 d_getnetbyaddr_r=undef
14027 getnetbyaddr_r_proto=0
c18e646a 14028 ;;
a48ec845
JH
14029 esac
14030 ;;
10bc17b6
JH
14031*) getnetbyaddr_r_proto=0
14032 ;;
14033esac
14034
14035: see if getnetbyname_r exists
14036set getnetbyname_r d_getnetbyname_r
14037eval $inlibc
14038case "$d_getnetbyname_r" in
14039"$define")
14040 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14041 case "$d_getnetbyname_r_proto:$usethreads" in
14042 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
14043 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14044 eval $hasproto ;;
14045 *) ;;
14046 esac
14047 case "$d_getnetbyname_r_proto" in
14048 define)
10bc17b6
JH
14049 case "$getnetbyname_r_proto" in
14050 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14051 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
14052 esac
14053 case "$getnetbyname_r_proto" in
14054 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14055 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
10bc17b6
JH
14056 esac
14057 case "$getnetbyname_r_proto" in
14058 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14059 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
10bc17b6
JH
14060 esac
14061 case "$getnetbyname_r_proto" in
14062 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
61c26d18 14063 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
10bc17b6
JH
14064 esac
14065 case "$getnetbyname_r_proto" in
90e831dc 14066 ''|0) d_getnetbyname_r=undef
10bc17b6 14067 getnetbyname_r_proto=0
a48ec845 14068 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14069 * ) case "$getnetbyname_r_proto" in
14070 REENTRANT_PROTO*) ;;
14071 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14072 esac
14073 echo "Prototype: $try" ;;
14074 esac
14075 ;;
c18e646a
JH
14076 *) case "$usethreads" in
14077 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14078 esac
90e831dc
SB
14079 d_getnetbyname_r=undef
14080 getnetbyname_r_proto=0
c18e646a 14081 ;;
a48ec845
JH
14082 esac
14083 ;;
10bc17b6
JH
14084*) getnetbyname_r_proto=0
14085 ;;
14086esac
14087
14088: see if getnetent_r exists
14089set getnetent_r d_getnetent_r
14090eval $inlibc
14091case "$d_getnetent_r" in
14092"$define")
14093 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14094 case "$d_getnetent_r_proto:$usethreads" in
14095 ":define") d_getnetent_r_proto=define
a48ec845
JH
14096 set d_getnetent_r_proto getnetent_r $hdrs
14097 eval $hasproto ;;
14098 *) ;;
14099 esac
14100 case "$d_getnetent_r_proto" in
14101 define)
10bc17b6
JH
14102 case "$getnetent_r_proto" in
14103 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14104 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
10bc17b6
JH
14105 esac
14106 case "$getnetent_r_proto" in
14107 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14108 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
10bc17b6
JH
14109 esac
14110 case "$getnetent_r_proto" in
14111 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14112 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
10bc17b6
JH
14113 esac
14114 case "$getnetent_r_proto" in
14115 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
61c26d18 14116 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
10bc17b6
JH
14117 esac
14118 case "$getnetent_r_proto" in
14119 ''|0) try='int getnetent_r(struct netent*, char*, int);'
61c26d18 14120 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
10bc17b6
JH
14121 esac
14122 case "$getnetent_r_proto" in
14123 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
61c26d18 14124 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
10bc17b6
JH
14125 esac
14126 case "$getnetent_r_proto" in
90e831dc 14127 ''|0) d_getnetent_r=undef
10bc17b6 14128 getnetent_r_proto=0
a48ec845 14129 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14130 * ) case "$getnetent_r_proto" in
14131 REENTRANT_PROTO*) ;;
14132 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14133 esac
14134 echo "Prototype: $try" ;;
14135 esac
14136 ;;
c18e646a
JH
14137 *) case "$usethreads" in
14138 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14139 esac
90e831dc
SB
14140 d_getnetent_r=undef
14141 getnetent_r_proto=0
c18e646a 14142 ;;
a48ec845
JH
14143 esac
14144 ;;
10bc17b6
JH
14145*) getnetent_r_proto=0
14146 ;;
14147esac
14148
b4eb6b3d
JH
14149: see if prototypes for various getnetxxx netdb.h functions are available
14150echo " "
14151set d_getnetprotos getnetent $i_netdb netdb.h
14152eval $hasproto
14153
0c0643d0
JH
14154: see if getpagesize exists
14155set getpagesize d_getpagsz
14156eval $inlibc
14157
34f1896b 14158: Optional checks for getprotobyname and getprotobynumber
b4eb6b3d
JH
14159
14160: see if getprotobyname exists
14161set getprotobyname d_getpbyname
14162eval $inlibc
14163
14164: see if getprotobynumber exists
14165set getprotobynumber d_getpbynumber
14166eval $inlibc
14167
14168: see if getprotoent exists
14169set getprotoent d_getpent
14170eval $inlibc
14171
14172: see if getpgid exists
14173set getpgid d_getpgid
14174eval $inlibc
14175
14176: see if getpgrp2 exists
14177set getpgrp2 d_getpgrp2
14178eval $inlibc
14179
14180: see if getppid exists
14181set getppid d_getppid
14182eval $inlibc
14183
14184: see if getpriority exists
14185set getpriority d_getprior
14186eval $inlibc
14187
10bc17b6
JH
14188: see if getprotobyname_r exists
14189set getprotobyname_r d_getprotobyname_r
14190eval $inlibc
14191case "$d_getprotobyname_r" in
14192"$define")
14193 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14194 case "$d_getprotobyname_r_proto:$usethreads" in
14195 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
14196 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14197 eval $hasproto ;;
14198 *) ;;
14199 esac
14200 case "$d_getprotobyname_r_proto" in
14201 define)
10bc17b6
JH
14202 case "$getprotobyname_r_proto" in
14203 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14204 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
10bc17b6
JH
14205 esac
14206 case "$getprotobyname_r_proto" in
14207 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
61c26d18 14208 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
10bc17b6
JH
14209 esac
14210 case "$getprotobyname_r_proto" in
14211 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
61c26d18 14212 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
10bc17b6
JH
14213 esac
14214 case "$getprotobyname_r_proto" in
90e831dc 14215 ''|0) d_getprotobyname_r=undef
10bc17b6 14216 getprotobyname_r_proto=0
a48ec845 14217 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14218 * ) case "$getprotobyname_r_proto" in
14219 REENTRANT_PROTO*) ;;
14220 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14221 esac
14222 echo "Prototype: $try" ;;
14223 esac
14224 ;;
c18e646a
JH
14225 *) case "$usethreads" in
14226 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14227 esac
90e831dc
SB
14228 d_getprotobyname_r=undef
14229 getprotobyname_r_proto=0
c18e646a 14230 ;;
a48ec845
JH
14231 esac
14232 ;;
10bc17b6
JH
14233*) getprotobyname_r_proto=0
14234 ;;
14235esac
14236
14237: see if getprotobynumber_r exists
14238set getprotobynumber_r d_getprotobynumber_r
14239eval $inlibc
14240case "$d_getprotobynumber_r" in
14241"$define")
14242 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14243 case "$d_getprotobynumber_r_proto:$usethreads" in
14244 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
14245 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14246 eval $hasproto ;;
14247 *) ;;
14248 esac
14249 case "$d_getprotobynumber_r_proto" in
14250 define)
10bc17b6
JH
14251 case "$getprotobynumber_r_proto" in
14252 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14253 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
10bc17b6
JH
14254 esac
14255 case "$getprotobynumber_r_proto" in
14256 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
61c26d18 14257 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
10bc17b6
JH
14258 esac
14259 case "$getprotobynumber_r_proto" in
14260 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
61c26d18 14261 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
10bc17b6
JH
14262 esac
14263 case "$getprotobynumber_r_proto" in
90e831dc 14264 ''|0) d_getprotobynumber_r=undef
10bc17b6 14265 getprotobynumber_r_proto=0
a48ec845 14266 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14267 * ) case "$getprotobynumber_r_proto" in
14268 REENTRANT_PROTO*) ;;
14269 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14270 esac
14271 echo "Prototype: $try" ;;
14272 esac
14273 ;;
c18e646a
JH
14274 *) case "$usethreads" in
14275 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14276 esac
90e831dc
SB
14277 d_getprotobynumber_r=undef
14278 getprotobynumber_r_proto=0
c18e646a 14279 ;;
a48ec845
JH
14280 esac
14281 ;;
10bc17b6
JH
14282*) getprotobynumber_r_proto=0
14283 ;;
14284esac
14285
14286: see if getprotoent_r exists
14287set getprotoent_r d_getprotoent_r
14288eval $inlibc
14289case "$d_getprotoent_r" in
14290"$define")
14291 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14292 case "$d_getprotoent_r_proto:$usethreads" in
14293 ":define") d_getprotoent_r_proto=define
a48ec845
JH
14294 set d_getprotoent_r_proto getprotoent_r $hdrs
14295 eval $hasproto ;;
14296 *) ;;
14297 esac
14298 case "$d_getprotoent_r_proto" in
14299 define)
10bc17b6
JH
14300 case "$getprotoent_r_proto" in
14301 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14302 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
10bc17b6
JH
14303 esac
14304 case "$getprotoent_r_proto" in
14305 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
61c26d18 14306 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
10bc17b6
JH
14307 esac
14308 case "$getprotoent_r_proto" in
14309 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
61c26d18 14310 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
10bc17b6
JH
14311 esac
14312 case "$getprotoent_r_proto" in
14313 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
61c26d18 14314 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
10bc17b6
JH
14315 esac
14316 case "$getprotoent_r_proto" in
90e831dc 14317 ''|0) d_getprotoent_r=undef
10bc17b6 14318 getprotoent_r_proto=0
a48ec845 14319 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14320 * ) case "$getprotoent_r_proto" in
14321 REENTRANT_PROTO*) ;;
14322 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14323 esac
14324 echo "Prototype: $try" ;;
14325 esac
14326 ;;
c18e646a
JH
14327 *) case "$usethreads" in
14328 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14329 esac
90e831dc
SB
14330 d_getprotoent_r=undef
14331 getprotoent_r_proto=0
c18e646a 14332 ;;
a48ec845
JH
14333 esac
14334 ;;
10bc17b6
JH
14335*) getprotoent_r_proto=0
14336 ;;
14337esac
14338
b4eb6b3d
JH
14339: see if prototypes for various getprotoxxx netdb.h functions are available
14340echo " "
14341set d_getprotoprotos getprotoent $i_netdb netdb.h
14342eval $hasproto
14343
14344: see if getprpwnam exists
14345set getprpwnam d_getprpwnam
14346eval $inlibc
14347
14348: see if getpwent exists
14349set getpwent d_getpwent
14350eval $inlibc
14351
10bc17b6
JH
14352: see if getpwent_r exists
14353set getpwent_r d_getpwent_r
14354eval $inlibc
14355case "$d_getpwent_r" in
14356"$define")
14357 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14358 case "$d_getpwent_r_proto:$usethreads" in
14359 ":define") d_getpwent_r_proto=define
a48ec845
JH
14360 set d_getpwent_r_proto getpwent_r $hdrs
14361 eval $hasproto ;;
14362 *) ;;
14363 esac
14364 case "$d_getpwent_r_proto" in
14365 define)
10bc17b6
JH
14366 case "$getpwent_r_proto" in
14367 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14368 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
10bc17b6
JH
14369 esac
14370 case "$getpwent_r_proto" in
14371 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
61c26d18 14372 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
10bc17b6
JH
14373 esac
14374 case "$getpwent_r_proto" in
14375 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
61c26d18 14376 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
10bc17b6
JH
14377 esac
14378 case "$getpwent_r_proto" in
14379 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
61c26d18 14380 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
10bc17b6
JH
14381 esac
14382 case "$getpwent_r_proto" in
14383 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
61c26d18 14384 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
10bc17b6
JH
14385 esac
14386 case "$getpwent_r_proto" in
14387 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
61c26d18 14388 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
10bc17b6
JH
14389 esac
14390 case "$getpwent_r_proto" in
90e831dc 14391 ''|0) d_getpwent_r=undef
10bc17b6 14392 getpwent_r_proto=0
a48ec845 14393 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14394 * ) case "$getpwent_r_proto" in
14395 REENTRANT_PROTO*) ;;
14396 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14397 esac
14398 echo "Prototype: $try" ;;
14399 esac
14400 ;;
c18e646a
JH
14401 *) case "$usethreads" in
14402 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14403 esac
90e831dc
SB
14404 d_getpwent_r=undef
14405 getpwent_r_proto=0
c18e646a 14406 ;;
a48ec845
JH
14407 esac
14408 ;;
10bc17b6
JH
14409*) getpwent_r_proto=0
14410 ;;
14411esac
14412
14413: see if getpwnam_r exists
14414set getpwnam_r d_getpwnam_r
14415eval $inlibc
14416case "$d_getpwnam_r" in
14417"$define")
14418 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14419 case "$d_getpwnam_r_proto:$usethreads" in
14420 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14421 set d_getpwnam_r_proto getpwnam_r $hdrs
14422 eval $hasproto ;;
14423 *) ;;
14424 esac
14425 case "$d_getpwnam_r_proto" in
14426 define)
10bc17b6
JH
14427 case "$getpwnam_r_proto" in
14428 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14429 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14430 esac
14431 case "$getpwnam_r_proto" in
14432 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
61c26d18 14433 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
10bc17b6
JH
14434 esac
14435 case "$getpwnam_r_proto" in
14436 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14437 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
10bc17b6
JH
14438 esac
14439 case "$getpwnam_r_proto" in
14440 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14441 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
10bc17b6
JH
14442 esac
14443 case "$getpwnam_r_proto" in
90e831dc 14444 ''|0) d_getpwnam_r=undef
10bc17b6 14445 getpwnam_r_proto=0
a48ec845 14446 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14447 * ) case "$getpwnam_r_proto" in
14448 REENTRANT_PROTO*) ;;
14449 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14450 esac
14451 echo "Prototype: $try" ;;
14452 esac
14453 ;;
c18e646a
JH
14454 *) case "$usethreads" in
14455 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14456 esac
90e831dc
SB
14457 d_getpwnam_r=undef
14458 getpwnam_r_proto=0
c18e646a 14459 ;;
a48ec845
JH
14460 esac
14461 ;;
10bc17b6
JH
14462*) getpwnam_r_proto=0
14463 ;;
14464esac
14465
14466: see if getpwuid_r exists
14467set getpwuid_r d_getpwuid_r
14468eval $inlibc
14469case "$d_getpwuid_r" in
14470"$define")
14471 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14472 case "$d_getpwuid_r_proto:$usethreads" in
14473 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14474 set d_getpwuid_r_proto getpwuid_r $hdrs
14475 eval $hasproto ;;
14476 *) ;;
14477 esac
14478 case "$d_getpwuid_r_proto" in
14479 define)
10bc17b6
JH
14480 case "$getpwuid_r_proto" in
14481 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14482 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
10bc17b6
JH
14483 esac
14484 case "$getpwuid_r_proto" in
14485 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
61c26d18 14486 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
10bc17b6
JH
14487 esac
14488 case "$getpwuid_r_proto" in
14489 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14490 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
10bc17b6
JH
14491 esac
14492 case "$getpwuid_r_proto" in
14493 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14494 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
10bc17b6
JH
14495 esac
14496 case "$getpwuid_r_proto" in
90e831dc 14497 ''|0) d_getpwuid_r=undef
10bc17b6 14498 getpwuid_r_proto=0
a48ec845 14499 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14500 * ) case "$getpwuid_r_proto" in
14501 REENTRANT_PROTO*) ;;
14502 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14503 esac
14504 echo "Prototype: $try" ;;
14505 esac
14506 ;;
c18e646a
JH
14507 *) case "$usethreads" in
14508 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14509 esac
90e831dc
SB
14510 d_getpwuid_r=undef
14511 getpwuid_r_proto=0
c18e646a 14512 ;;
a48ec845
JH
14513 esac
14514 ;;
10bc17b6
JH
14515*) getpwuid_r_proto=0
14516 ;;
14517esac
14518
34f1896b 14519: Optional checks for getsbyname and getsbyport
b4eb6b3d
JH
14520
14521: see if getservbyname exists
14522set getservbyname d_getsbyname
14523eval $inlibc
14524
14525: see if getservbyport exists
14526set getservbyport d_getsbyport
14527eval $inlibc
14528
14529: see if getservent exists
14530set getservent d_getsent
14531eval $inlibc
14532
10bc17b6
JH
14533: see if getservbyname_r exists
14534set getservbyname_r d_getservbyname_r
14535eval $inlibc
14536case "$d_getservbyname_r" in
14537"$define")
14538 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14539 case "$d_getservbyname_r_proto:$usethreads" in
14540 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14541 set d_getservbyname_r_proto getservbyname_r $hdrs
14542 eval $hasproto ;;
14543 *) ;;
14544 esac
14545 case "$d_getservbyname_r_proto" in
14546 define)
10bc17b6
JH
14547 case "$getservbyname_r_proto" in
14548 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14549 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
10bc17b6
JH
14550 esac
14551 case "$getservbyname_r_proto" in
14552 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
61c26d18 14553 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
10bc17b6
JH
14554 esac
14555 case "$getservbyname_r_proto" in
14556 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
61c26d18 14557 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
10bc17b6
JH
14558 esac
14559 case "$getservbyname_r_proto" in
90e831dc 14560 ''|0) d_getservbyname_r=undef
10bc17b6 14561 getservbyname_r_proto=0
a48ec845 14562 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14563 * ) case "$getservbyname_r_proto" in
14564 REENTRANT_PROTO*) ;;
14565 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14566 esac
14567 echo "Prototype: $try" ;;
14568 esac
14569 ;;
c18e646a
JH
14570 *) case "$usethreads" in
14571 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14572 esac
90e831dc
SB
14573 d_getservbyname_r=undef
14574 getservbyname_r_proto=0
c18e646a 14575 ;;
a48ec845
JH
14576 esac
14577 ;;
10bc17b6
JH
14578*) getservbyname_r_proto=0
14579 ;;
14580esac
14581
14582: see if getservbyport_r exists
14583set getservbyport_r d_getservbyport_r
14584eval $inlibc
14585case "$d_getservbyport_r" in
14586"$define")
14587 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14588 case "$d_getservbyport_r_proto:$usethreads" in
14589 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14590 set d_getservbyport_r_proto getservbyport_r $hdrs
14591 eval $hasproto ;;
14592 *) ;;
14593 esac
14594 case "$d_getservbyport_r_proto" in
14595 define)
10bc17b6
JH
14596 case "$getservbyport_r_proto" in
14597 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14598 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
10bc17b6
JH
14599 esac
14600 case "$getservbyport_r_proto" in
14601 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
61c26d18 14602 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
10bc17b6
JH
14603 esac
14604 case "$getservbyport_r_proto" in
14605 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
61c26d18 14606 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
10bc17b6
JH
14607 esac
14608 case "$getservbyport_r_proto" in
90e831dc 14609 ''|0) d_getservbyport_r=undef
10bc17b6 14610 getservbyport_r_proto=0
a48ec845 14611 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14612 * ) case "$getservbyport_r_proto" in
14613 REENTRANT_PROTO*) ;;
14614 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14615 esac
14616 echo "Prototype: $try" ;;
14617 esac
14618 ;;
c18e646a
JH
14619 *) case "$usethreads" in
14620 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14621 esac
90e831dc
SB
14622 d_getservbyport_r=undef
14623 getservbyport_r_proto=0
c18e646a 14624 ;;
a48ec845
JH
14625 esac
14626 ;;
10bc17b6
JH
14627*) getservbyport_r_proto=0
14628 ;;
14629esac
14630
14631: see if getservent_r exists
14632set getservent_r d_getservent_r
14633eval $inlibc
14634case "$d_getservent_r" in
14635"$define")
14636 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14637 case "$d_getservent_r_proto:$usethreads" in
14638 ":define") d_getservent_r_proto=define
a48ec845
JH
14639 set d_getservent_r_proto getservent_r $hdrs
14640 eval $hasproto ;;
14641 *) ;;
14642 esac
14643 case "$d_getservent_r_proto" in
14644 define)
10bc17b6
JH
14645 case "$getservent_r_proto" in
14646 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
61c26d18 14647 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
10bc17b6
JH
14648 esac
14649 case "$getservent_r_proto" in
14650 ''|0) try='int getservent_r(struct servent*, char*, int);'
61c26d18 14651 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
10bc17b6
JH
14652 esac
14653 case "$getservent_r_proto" in
14654 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
61c26d18 14655 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
10bc17b6
JH
14656 esac
14657 case "$getservent_r_proto" in
14658 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
61c26d18 14659 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
10bc17b6
JH
14660 esac
14661 case "$getservent_r_proto" in
90e831dc 14662 ''|0) d_getservent_r=undef
10bc17b6 14663 getservent_r_proto=0
a48ec845 14664 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14665 * ) case "$getservent_r_proto" in
14666 REENTRANT_PROTO*) ;;
14667 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14668 esac
14669 echo "Prototype: $try" ;;
14670 esac
14671 ;;
c18e646a
JH
14672 *) case "$usethreads" in
14673 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14674 esac
90e831dc
SB
14675 d_getservent_r=undef
14676 getservent_r_proto=0
c18e646a 14677 ;;
a48ec845
JH
14678 esac
14679 ;;
10bc17b6
JH
14680*) getservent_r_proto=0
14681 ;;
14682esac
14683
b4eb6b3d
JH
14684: see if prototypes for various getservxxx netdb.h functions are available
14685echo " "
14686set d_getservprotos getservent $i_netdb netdb.h
14687eval $hasproto
14688
14689: see if getspnam exists
14690set getspnam d_getspnam
14691eval $inlibc
14692
10bc17b6
JH
14693: see if this is a shadow.h system
14694set shadow.h i_shadow
14695eval $inhdr
14696
14697: see if getspnam_r exists
14698set getspnam_r d_getspnam_r
14699eval $inlibc
14700case "$d_getspnam_r" in
14701"$define")
14702 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14703 case "$d_getspnam_r_proto:$usethreads" in
14704 ":define") d_getspnam_r_proto=define
a48ec845
JH
14705 set d_getspnam_r_proto getspnam_r $hdrs
14706 eval $hasproto ;;
14707 *) ;;
14708 esac
14709 case "$d_getspnam_r_proto" in
14710 define)
10bc17b6
JH
14711 case "$getspnam_r_proto" in
14712 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
61c26d18 14713 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14714 esac
14715 case "$getspnam_r_proto" in
14716 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
61c26d18 14717 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
10bc17b6
JH
14718 esac
14719 case "$getspnam_r_proto" in
90e831dc 14720 ''|0) d_getspnam_r=undef
10bc17b6 14721 getspnam_r_proto=0
a48ec845 14722 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14723 * ) case "$getspnam_r_proto" in
14724 REENTRANT_PROTO*) ;;
14725 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14726 esac
14727 echo "Prototype: $try" ;;
14728 esac
14729 ;;
c18e646a
JH
14730 *) case "$usethreads" in
14731 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14732 esac
90e831dc
SB
14733 d_getspnam_r=undef
14734 getspnam_r_proto=0
c18e646a 14735 ;;
a48ec845
JH
14736 esac
14737 ;;
10bc17b6
JH
14738*) getspnam_r_proto=0
14739 ;;
14740esac
14741
b4eb6b3d
JH
14742: see if gettimeofday or ftime exists
14743set gettimeofday d_gettimeod
14744eval $inlibc
14745case "$d_gettimeod" in
14746"$undef")
14747 set ftime d_ftime
14748 eval $inlibc
14749 ;;
14750*)
14751 val="$undef"; set d_ftime; eval $setvar
14752 ;;
14753esac
14754case "$d_gettimeod$d_ftime" in
14755"$undef$undef")
14756 echo " "
14757 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14758 ;;
14759esac
14760
10bc17b6
JH
14761: see if gmtime_r exists
14762set gmtime_r d_gmtime_r
14763eval $inlibc
14764case "$d_gmtime_r" in
14765"$define")
d63eadf0 14766 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14767 case "$d_gmtime_r_proto:$usethreads" in
14768 ":define") d_gmtime_r_proto=define
a48ec845
JH
14769 set d_gmtime_r_proto gmtime_r $hdrs
14770 eval $hasproto ;;
14771 *) ;;
14772 esac
14773 case "$d_gmtime_r_proto" in
14774 define)
10bc17b6
JH
14775 case "$gmtime_r_proto" in
14776 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
61c26d18 14777 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
10bc17b6
JH
14778 esac
14779 case "$gmtime_r_proto" in
14780 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
61c26d18 14781 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
10bc17b6
JH
14782 esac
14783 case "$gmtime_r_proto" in
90e831dc 14784 ''|0) d_gmtime_r=undef
10bc17b6 14785 gmtime_r_proto=0
a48ec845 14786 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14787 * ) case "$gmtime_r_proto" in
14788 REENTRANT_PROTO*) ;;
14789 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14790 esac
14791 echo "Prototype: $try" ;;
14792 esac
b4eb6b3d 14793 ;;
c18e646a
JH
14794 *) case "$usethreads" in
14795 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14796 esac
90e831dc
SB
14797 d_gmtime_r=undef
14798 gmtime_r_proto=0
c18e646a 14799 ;;
a48ec845
JH
14800 esac
14801 ;;
10bc17b6 14802*) gmtime_r_proto=0
b4eb6b3d
JH
14803 ;;
14804esac
14805
14806: see if hasmntopt exists
14807set hasmntopt d_hasmntopt
14808eval $inlibc
14809
14810: see if this is a netinet/in.h or sys/in.h system
14811set netinet/in.h i_niin sys/in.h i_sysin
14812eval $inhdr
14813
14814: see if arpa/inet.h has to be included
14815set arpa/inet.h i_arpainet
14816eval $inhdr
14817
14818: see if htonl --and friends-- exists
14819val=''
14820set htonl val
14821eval $inlibc
14822
14823: Maybe they are macros.
14824case "$val" in
14825$undef)
14826 $cat >htonl.c <<EOM
14827#include <stdio.h>
14828#include <sys/types.h>
14829#$i_niin I_NETINET_IN
14830#$i_sysin I_SYS_IN
14831#$i_arpainet I_ARPA_INET
14832#ifdef I_NETINET_IN
14833#include <netinet/in.h>
14834#endif
14835#ifdef I_SYS_IN
14836#include <sys/in.h>
14837#endif
14838#ifdef I_ARPA_INET
14839#include <arpa/inet.h>
14840#endif
14841#ifdef htonl
14842printf("Defined as a macro.");
14843#endif
14844EOM
14845 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14846 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14847 val="$define"
14848 echo "But it seems to be defined as a macro." >&4
14849 fi
14850 $rm -f htonl.?
14851 ;;
14852esac
14853set d_htonl
14854eval $setvar
14855
36adc09b
JH
14856: see if ilogbl exists
14857set ilogbl d_ilogbl
14858eval $inlibc
14859
b4eb6b3d
JH
14860: index or strchr
14861echo " "
14862if set index val -f; eval $csym; $val; then
14863 if set strchr val -f d_strchr; eval $csym; $val; then
14864 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14865 val="$define"
14866 vali="$undef"
14867 echo "strchr() found." >&4
14868 else
14869 val="$undef"
14870 vali="$define"
14871 echo "index() found." >&4
14872 fi
14873 else
14874 val="$undef"
14875 vali="$define"
8dfa8df9
JH
14876 echo "index() found." >&4
14877 fi
b4eb6b3d 14878else
8dfa8df9
JH
14879 if set strchr val -f d_strchr; eval $csym; $val; then
14880 val="$define"
14881 vali="$undef"
14882 echo "strchr() found." >&4
14883 else
14884 echo "No index() or strchr() found!" >&4
14885 val="$undef"
14886 vali="$undef"
14887 fi
b4eb6b3d 14888fi
8dfa8df9
JH
14889set d_strchr; eval $setvar
14890val="$vali"
14891set d_index; eval $setvar
14892
14893: check whether inet_aton exists
14894set inet_aton d_inetaton
14895eval $inlibc
b4eb6b3d 14896
5086dff9
MB
14897: see if inet_ntop exists
14898set inet_ntop d_inetntop
14899eval $inlibc
14900
14901: see if inet_pton exists
14902set inet_pton d_inetpton
14903eval $inlibc
14904
b4eb6b3d
JH
14905: Look for isascii
14906echo " "
36adc09b 14907$cat >isascii.c <<EOCP
b4eb6b3d
JH
14908#include <stdio.h>
14909#include <ctype.h>
55954f19
JH
14910#$i_stdlib I_STDLIB
14911#ifdef I_STDLIB
14912#include <stdlib.h>
14913#endif
b4eb6b3d
JH
14914int main() {
14915 int c = 'A';
14916 if (isascii(c))
14917 exit(0);
14918 else
14919 exit(1);
14920}
14921EOCP
14922set isascii
14923if eval $compile; then
14924 echo "isascii() found." >&4
14925 val="$define"
14926else
14927 echo "isascii() NOT found." >&4
14928 val="$undef"
14929fi
14930set d_isascii
14931eval $setvar
14932$rm -f isascii*
14933
269a7913
MB
14934: Look for isblank
14935echo " "
14936$cat >isblank.c <<'EOCP'
14937#include <stdio.h>
14938#include <ctype.h>
14939int main() {
9f791ac6 14940 int c = ' ';
269a7913
MB
14941 if (isblank(c))
14942 exit(0);
14943 else
14944 exit(1);
14945}
14946EOCP
14947if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
14948 echo "isblank() found." >&4
14949 val="$define"
14950else
14951 echo "isblank() NOT found." >&4
14952 val="$undef"
14953fi
14954set d_isblank
14955eval $setvar
14956$rm -f isblank*
14957
758a5d79
JH
14958: see if isfinite exists
14959set isfinite d_isfinite
14960eval $inlibc
14961
14962: see if isinf exists
14963set isinf d_isinf
14964eval $inlibc
14965
b4eb6b3d
JH
14966: see if isnan exists
14967set isnan d_isnan
14968eval $inlibc
14969
14970: see if isnanl exists
14971set isnanl d_isnanl
14972eval $inlibc
14973
14974: see if killpg exists
14975set killpg d_killpg
14976eval $inlibc
14977
14978: see if lchown exists
14979echo " "
14980$cat > try.c <<'EOCP'
14981/* System header to define __stub macros and hopefully few prototypes,
14982 which can conflict with char lchown(); below. */
14983#include <assert.h>
14984/* Override any gcc2 internal prototype to avoid an error. */
14985/* We use char because int might match the return type of a gcc2
14986 builtin and then its argument prototype would still apply. */
14987char lchown();
14988int main() {
14989 /* The GNU C library defines this for functions which it implements
14990 to always fail with ENOSYS. Some functions are actually named
14991 something starting with __ and the normal name is an alias. */
14992#if defined (__stub_lchown) || defined (__stub___lchown)
14993choke me
14994#else
14995lchown();
14996#endif
14997; return 0; }
14998EOCP
14999set try
15000if eval $compile; then
15001 $echo "lchown() found." >&4
15002 val="$define"
15003else
15004 $echo "lchown() NOT found." >&4
15005 val="$undef"
15006fi
15007set d_lchown
15008eval $setvar
15009
15010: See if number of significant digits in a double precision number is known
15011echo " "
15012$cat >ldbl_dig.c <<EOM
15013#$i_limits I_LIMITS
15014#$i_float I_FLOAT
15015#ifdef I_LIMITS
15016#include <limits.h>
15017#endif
15018#ifdef I_FLOAT
15019#include <float.h>
15020#endif
15021#ifdef LDBL_DIG
15022printf("Contains LDBL_DIG");
15023#endif
15024EOM
15025$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15026if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15027 echo "LDBL_DIG found." >&4
15028 val="$define"
15029else
15030 echo "LDBL_DIG NOT found." >&4
15031 val="$undef"
15032fi
15033$rm -f ldbl_dig.?
15034set d_ldbl_dig
15035eval $setvar
15036
0a0abfba
MB
15037: see if this is a math.h system
15038set math.h i_math
15039eval $inhdr
15040
613d6c3e 15041: check to see if math.h defines _LIB_VERSION
0a0abfba
MB
15042d_libm_lib_version="$undef"
15043case $i_math in
15044 $define)
0a0abfba
MB
15045 echo " "
15046 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15047 $cat >try.c <<EOCP
15048#include <unistd.h>
15049#include <math.h>
15050int main (int argc, char *argv[])
15051{
15052 printf ("%d\n", _LIB_VERSION);
15053 return (0);
15054 } /* main */
15055EOCP
15056 set try
15057 if eval $compile; then
15058 foo=`$run ./try`
15059 echo "Yes, it does ($foo)" >&4
15060 d_libm_lib_version="$define"
15061 else
4dd8f9b3 15062 echo "No, it does not (probably harmless)" >&4
0a0abfba 15063 fi
5b813a60 15064 $rm_try
0a0abfba
MB
15065 ;;
15066
15067 esac
15068
b4eb6b3d
JH
15069: see if link exists
15070set link d_link
15071eval $inlibc
15072
10bc17b6
JH
15073: see if localtime_r exists
15074set localtime_r d_localtime_r
15075eval $inlibc
15076case "$d_localtime_r" in
15077"$define")
d63eadf0 15078 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
15079 case "$d_localtime_r_proto:$usethreads" in
15080 ":define") d_localtime_r_proto=define
a48ec845
JH
15081 set d_localtime_r_proto localtime_r $hdrs
15082 eval $hasproto ;;
15083 *) ;;
15084 esac
15085 case "$d_localtime_r_proto" in
15086 define)
10bc17b6
JH
15087 case "$localtime_r_proto" in
15088 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
61c26d18 15089 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
10bc17b6
JH
15090 esac
15091 case "$localtime_r_proto" in
15092 ''|0) try='int localtime_r(const time_t*, struct tm*);'
61c26d18 15093 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
10bc17b6
JH
15094 esac
15095 case "$localtime_r_proto" in
90e831dc 15096 ''|0) d_localtime_r=undef
10bc17b6 15097 localtime_r_proto=0
a48ec845 15098 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15099 * ) case "$localtime_r_proto" in
15100 REENTRANT_PROTO*) ;;
15101 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15102 esac
15103 echo "Prototype: $try" ;;
15104 esac
15105 ;;
c18e646a
JH
15106 *) case "$usethreads" in
15107 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15108 esac
90e831dc
SB
15109 d_localtime_r=undef
15110 localtime_r_proto=0
c18e646a 15111 ;;
a48ec845
JH
15112 esac
15113 ;;
10bc17b6
JH
15114*) localtime_r_proto=0
15115 ;;
15116esac
15117
8572b25d
BH
15118: see if localtime_r calls tzset
15119case "$localtime_r_proto" in
15120REENTRANT_PROTO*)
15121 $cat >try.c <<EOCP
15122/* Does our libc's localtime_r call tzset ?
15123 * return 0 if so, 1 otherwise.
15124 */
61c26d18
MHM
15125#$i_systypes I_SYS_TYPES
15126#$i_unistd I_UNISTD
15127#$i_time I_TIME
15128#$i_stdlib I_STDLIB
15129#$i_string I_STRING
15130#$i_malloc I_MALLOC
15131#ifdef I_SYS_TYPES
15132# include <sys/types.h>
15133#endif
15134#ifdef I_UNISTD
15135# include <unistd.h>
15136#endif
15137#ifdef I_TIME
15138# include <time.h>
15139#endif
15140#ifdef I_STDLIB
15141#include <stdlib.h>
15142#endif
15143#ifdef I_STRING
15144# include <string.h>
15145#else
15146# include <strings.h>
15147#endif
15148#ifdef I_MALLOC
15149# include <malloc.h>
15150#endif
8572b25d
BH
15151int main()
15152{
15153 time_t t = time(0L);
15154 char w_tz[]="TZ" "=GMT+5",
15155 e_tz[]="TZ" "=GMT-5",
15156 *tz_e = (char*)malloc(16),
15157 *tz_w = (char*)malloc(16);
15158 struct tm tm_e, tm_w;
15159 memset(&tm_e,'\0',sizeof(struct tm));
15160 memset(&tm_w,'\0',sizeof(struct tm));
15161 strcpy(tz_e,e_tz);
15162 strcpy(tz_w,w_tz);
15163
15164 putenv(tz_e);
15165 localtime_r(&t, &tm_e);
15166
15167 putenv(tz_w);
15168 localtime_r(&t, &tm_w);
15169
15170 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15171 return 1;
15172 return 0;
15173}
15174EOCP
15175 set try
15176 if eval $compile; then
43dddb59 15177 if $run ./try; then
8572b25d
BH
15178 d_localtime_r_needs_tzset=undef;
15179 else
15180 d_localtime_r_needs_tzset=define;
15181 fi;
15182 else
15183 d_localtime_r_needs_tzset=undef;
15184 fi;
15185 ;;
15186 *)
15187 d_localtime_r_needs_tzset=undef;
15188 ;;
15189esac
5b813a60 15190$rm_try
8572b25d 15191
b4eb6b3d
JH
15192: see if localeconv exists
15193set localeconv d_locconv
15194eval $inlibc
15195
15196: see if lockf exists
15197set lockf d_lockf
15198eval $inlibc
15199
b4eb6b3d
JH
15200: see if prototype for lseek is available
15201echo " "
4786929f 15202set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
15203eval $hasproto
15204
15205: see if lstat exists
15206set lstat d_lstat
15207eval $inlibc
15208
15209: see if madvise exists
15210set madvise d_madvise
15211eval $inlibc
15212
7dd121ae
MB
15213: see if malloc_size exists
15214set malloc_size d_malloc_size
15215eval $inlibc
15216
15217: see if malloc_size_good exists
15218set malloc_good_size d_malloc_good_size
15219eval $inlibc
15220
b4eb6b3d
JH
15221: see if mblen exists
15222set mblen d_mblen
15223eval $inlibc
15224
15225: see if mbstowcs exists
15226set mbstowcs d_mbstowcs
15227eval $inlibc
15228
15229: see if mbtowc exists
15230set mbtowc d_mbtowc
15231eval $inlibc
15232
15233: see if memchr exists
15234set memchr d_memchr
15235eval $inlibc
15236
15237: see if memcmp exists
15238set memcmp d_memcmp
15239eval $inlibc
15240
15241: see if memcpy exists
15242set memcpy d_memcpy
15243eval $inlibc
15244
15245: see if memmove exists
15246set memmove d_memmove
15247eval $inlibc
15248
15249: see if memset exists
15250set memset d_memset
15251eval $inlibc
15252
15253: see if mkdir exists
15254set mkdir d_mkdir
15255eval $inlibc
15256
15257: see if mkdtemp exists
15258set mkdtemp d_mkdtemp
15259eval $inlibc
15260
15261: see if mkfifo exists
15262set mkfifo d_mkfifo
15263eval $inlibc
15264
15265: see if mkstemp exists
15266set mkstemp d_mkstemp
15267eval $inlibc
15268
15269: see if mkstemps exists
15270set mkstemps d_mkstemps
15271eval $inlibc
15272
15273: see if mktime exists
15274set mktime d_mktime
15275eval $inlibc
15276
15277: see if this is a sys/mman.h system
15278set sys/mman.h i_sysmman
15279eval $inhdr
15280
15281: see if mmap exists
15282set mmap d_mmap
15283eval $inlibc
15284: see what shmat returns
15285: default to something harmless
15286mmaptype='void *'
15287case "$i_sysmman$d_mmap" in
15288"$define$define")
15289 $cat >mmap.c <<'END'
15290#include <sys/mman.h>
15291void *mmap();
15292END
15293 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15294 mmaptype='void *'
15295 else
15296 mmaptype='caddr_t'
15297 fi
15298 echo "and it returns ($mmaptype)." >&4
15299 ;;
15300esac
15301
15302
15303
89ce900e
JH
15304: see if sqrtl exists
15305set sqrtl d_sqrtl
15306eval $inlibc
15307
af1ff193
JH
15308: see if scalbnl exists
15309set scalbnl d_scalbnl
15310eval $inlibc
15311
89ce900e
JH
15312: see if modfl exists
15313set modfl d_modfl
15314eval $inlibc
15315
15316: see if prototype for modfl is available
15317echo " "
3a794506 15318set d_modflproto modfl $i_math math.h
89ce900e
JH
15319eval $hasproto
15320
15321d_modfl_pow32_bug="$undef"
15322
15323case "$d_longdbl$d_modfl" in
15324$define$define)
15325 $cat <<EOM
15326Checking to see whether your modfl() is okay for large values...
15327EOM
15328$cat >try.c <<EOCP
5b813a60 15329#include <math.h>
89ce900e
JH
15330#include <stdio.h>
15331EOCP
15332if $test "X$d_modflproto" != "X$define"; then
15333 $cat >>try.c <<EOCP
5b813a60 15334/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
15335long double modfl (long double, long double *);
15336EOCP
15337fi
15338$cat >>try.c <<EOCP
15339int main() {
15340 long double nv = 4294967303.15;
15341 long double v, w;
5b813a60 15342 v = modfl(nv, &w);
89ce900e
JH
15343#ifdef __GLIBC__
15344 printf("glibc");
15345#endif
15346 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15347 return 0;
15348}
15349EOCP
15350 case "$osname:$gccversion" in
15351 aix:) saveccflags="$ccflags"
15352 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15353 esac
15354 set try
15355 if eval $compile; then
15356 foo=`$run ./try`
15357 case "$foo" in
15358 *" 4294967303.150000 1.150000 4294967302.000000")
15359 echo >&4 "Your modfl() is broken for large values."
15360 d_modfl_pow32_bug="$define"
15361 case "$foo" in
15362 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15363 ;;
15364 esac
15365 ;;
15366 *" 4294967303.150000 0.150000 4294967303.000000")
15367 echo >&4 "Your modfl() seems okay for large values."
15368 ;;
15369 *) echo >&4 "I don't understand your modfl() at all."
15370 d_modfl="$undef"
15371 ;;
15372 esac
5b813a60 15373 $rm_try
89ce900e
JH
15374 else
15375 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15376 d_modfl="$undef"
15377 fi
15378 case "$osname:$gccversion" in
15379 aix:) ccflags="$saveccflags" ;; # restore
15380 esac
15381 ;;
15382esac
15383
15384if $test "$uselongdouble" = "$define"; then
af1ff193
JH
15385 message=""
15386 if $test "$d_sqrtl" != "$define"; then
15387 message="$message sqrtl"
15388 fi
15389 if $test "$d_modfl" != "$define"; then
89ce900e
JH
15390 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15391 echo "You have both aintl and copysignl, so I can emulate modfl."
15392 else
af1ff193 15393 message="$message modfl"
89ce900e 15394 fi
af1ff193
JH
15395 fi
15396 if $test "$d_frexpl" != "$define"; then
15397 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15398 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15399 else
15400 message="$message frexpl"
15401 fi
15402 fi
89ce900e 15403
af1ff193 15404 if $test "$message" != ""; then
89ce900e
JH
15405 $cat <<EOM >&4
15406
15407*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15408*** the following mathematical functions needed for long double support:
15409*** $message
fe63a0b4
JH
15410*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15411*** Cannot continue, aborting.
89ce900e
JH
15412
15413EOM
15414
fe63a0b4 15415 exit 1
89ce900e
JH
15416 fi
15417fi
15418
b4eb6b3d
JH
15419: see if mprotect exists
15420set mprotect d_mprotect
15421eval $inlibc
15422
15423: see if msgctl exists
15424set msgctl d_msgctl
15425eval $inlibc
15426
15427: see if msgget exists
15428set msgget d_msgget
15429eval $inlibc
15430
15431: see if msgsnd exists
15432set msgsnd d_msgsnd
15433eval $inlibc
15434
15435: see if msgrcv exists
15436set msgrcv d_msgrcv
15437eval $inlibc
15438
15439: see how much of the 'msg*(2)' library is present.
15440h_msg=true
15441echo " "
15442case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15443*"$undef"*) h_msg=false;;
15444esac
15445case "$osname" in
15446freebsd)
15447 case "`ipcs 2>&1`" in
15448 "SVID messages"*"not configured"*)
15449 echo "Your $osname does not have the msg*(2) configured." >&4
15450 h_msg=false
15451 val="$undef"
15452 set msgctl d_msgctl
15453 eval $setvar
15454 set msgget d_msgget
15455 eval $setvar
15456 set msgsnd d_msgsnd
15457 eval $setvar
15458 set msgrcv d_msgrcv
15459 eval $setvar
15460 ;;
15461 esac
15462 ;;
15463esac
15464: we could also check for sys/ipc.h ...
15465if $h_msg && $test `./findhdr sys/msg.h`; then
15466 echo "You have the full msg*(2) library." >&4
15467 val="$define"
15468else
15469 echo "You don't have the full msg*(2) library." >&4
15470 val="$undef"
15471fi
15472set d_msg
15473eval $setvar
15474
34f1896b 15475: Check for msghdr_s
4e0554ec
JH
15476echo " "
15477echo "Checking to see if your system supports struct msghdr..." >&4
15478set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15479eval $hasstruct
15480case "$d_msghdr_s" in
15481"$define") echo "Yes, it does." ;;
15482*) echo "No, it doesn't." ;;
15483esac
15484
15485
b4eb6b3d
JH
15486: see if msync exists
15487set msync d_msync
15488eval $inlibc
15489
15490: see if munmap exists
15491set munmap d_munmap
15492eval $inlibc
15493
15494: see if nice exists
15495set nice d_nice
15496eval $inlibc
15497
2765b840
JH
15498: see if this is a langinfo.h system
15499set langinfo.h i_langinfo
15500eval $inhdr
15501
15502: see if nl_langinfo exists
15503set nl_langinfo d_nl_langinfo
15504eval $inlibc
15505
1d1be0dc
NC
15506: check for volatile keyword
15507echo " "
15508echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15509$cat >try.c <<'EOCP'
76f47787 15510int main()
1d1be0dc
NC
15511{
15512 typedef struct _goo_struct goo_struct;
15513 goo_struct * volatile goo = ((goo_struct *)0);
15514 struct _goo_struct {
15515 long long_int;
15516 int reg_int;
15517 char char_var;
15518 };
15519 typedef unsigned short foo_t;
15520 char *volatile foo;
15521 volatile int bar;
15522 volatile foo_t blech;
15523 foo = foo;
15524}
15525EOCP
15526if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15527 val="$define"
15528 echo "Yup, it does."
15529else
15530 val="$undef"
15531 echo "Nope, it doesn't."
15532fi
15533set d_volatile
15534eval $setvar
5b813a60 15535$rm_try
1d1be0dc 15536
613d6c3e 15537: Check basic sizes
b4eb6b3d
JH
15538echo " "
15539$echo "Choosing the C types to be used for Perl's internal types..." >&4
15540
15541case "$use64bitint:$d_quad:$quadtype" in
15542define:define:?*)
15543 ivtype="$quadtype"
15544 uvtype="$uquadtype"
15545 ivsize=8
15546 uvsize=8
15547 ;;
15548*) ivtype="long"
15549 uvtype="unsigned long"
15550 ivsize=$longsize
15551 uvsize=$longsize
15552 ;;
15553esac
15554
15555case "$uselongdouble:$d_longdbl" in
15556define:define)
15557 nvtype="long double"
15558 nvsize=$longdblsize
15559 ;;
15560*) nvtype=double
15561 nvsize=$doublesize
15562 ;;
15563esac
15564
15565$echo "(IV will be "$ivtype", $ivsize bytes)"
15566$echo "(UV will be "$uvtype", $uvsize bytes)"
15567$echo "(NV will be "$nvtype", $nvsize bytes)"
15568
15569$cat >try.c <<EOCP
15570#$i_inttypes I_INTTYPES
15571#ifdef I_INTTYPES
15572#include <inttypes.h>
15573#endif
15574#include <stdio.h>
15575int main() {
15576#ifdef INT8
15577 int8_t i = INT8_MAX;
15578 uint8_t u = UINT8_MAX;
15579 printf("int8_t\n");
15580#endif
15581#ifdef INT16
15582 int16_t i = INT16_MAX;
15583 uint16_t i = UINT16_MAX;
15584 printf("int16_t\n");
15585#endif
15586#ifdef INT32
15587 int32_t i = INT32_MAX;
15588 uint32_t u = UINT32_MAX;
15589 printf("int32_t\n");
15590#endif
15591}
15592EOCP
15593
13187456 15594i8type="signed char"
0ab0821a
MB
15595u8type="unsigned char"
15596i8size=1
15597u8size=1
b4eb6b3d
JH
15598
15599case "$i16type" in
15600'') case "$shortsize" in
15601 2) i16type=short
15602 u16type="unsigned short"
15603 i16size=$shortsize
15604 u16size=$shortsize
15605 ;;
15606 esac
15607 ;;
15608esac
15609case "$i16type" in
15610'') set try -DINT16
15611 if eval $compile; then
5440bc8e 15612 case "`$run ./try`" in
b4eb6b3d
JH
15613 int16_t)
15614 i16type=int16_t
15615 u16type=uint16_t
15616 i16size=2
15617 u16size=2
15618 ;;
15619 esac
15620 fi
15621 ;;
15622esac
15623case "$i16type" in
15624'') if $test $shortsize -ge 2; then
15625 i16type=short
15626 u16type="unsigned short"
15627 i16size=$shortsize
15628 u16size=$shortsize
15629 fi
15630 ;;
15631esac
15632
15633case "$i32type" in
15634'') case "$longsize" in
15635 4) i32type=long
15636 u32type="unsigned long"
15637 i32size=$longsize
15638 u32size=$longsize
15639 ;;
15640 *) case "$intsize" in
15641 4) i32type=int
15642 u32type="unsigned int"
15643 i32size=$intsize
15644 u32size=$intsize
15645 ;;
15646 esac
15647 ;;
15648 esac
15649 ;;
15650esac
15651case "$i32type" in
15652'') set try -DINT32
15653 if eval $compile; then
5440bc8e 15654 case "`$run ./try`" in
b4eb6b3d
JH
15655 int32_t)
15656 i32type=int32_t
15657 u32type=uint32_t
15658 i32size=4
15659 u32size=4
15660 ;;
15661 esac
15662 fi
15663 ;;
15664esac
15665case "$i32type" in
15666'') if $test $intsize -ge 4; then
15667 i32type=int
15668 u32type="unsigned int"
15669 i32size=$intsize
15670 u32size=$intsize
15671 fi
15672 ;;
15673esac
15674
15675case "$i64type" in
15676'') case "$d_quad:$quadtype" in
15677 define:?*)
15678 i64type="$quadtype"
15679 u64type="$uquadtype"
15680 i64size=8
15681 u64size=8
15682 ;;
15683 esac
15684 ;;
15685esac
15686
1d1be0dc
NC
15687$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15688: volatile so that the compiler has to store it out to memory.
15689if test X"$d_volatile" = X"$define"; then
15690 volatile=volatile
15691fi
b4eb6b3d
JH
15692$cat <<EOP >try.c
15693#include <stdio.h>
55954f19
JH
15694#$i_stdlib I_STDLIB
15695#ifdef I_STDLIB
15696#include <stdlib.h>
15697#endif
1d1be0dc
NC
15698#include <sys/types.h>
15699#include <signal.h>
15700#ifdef SIGFPE
15701$volatile int bletched = 0;
7090f861 15702$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15703#endif
b4eb6b3d
JH
15704int main() {
15705 $uvtype u = 0;
1d1be0dc 15706 $nvtype d;
b4eb6b3d
JH
15707 int n = 8 * $uvsize;
15708 int i;
1d1be0dc
NC
15709#ifdef SIGFPE
15710 signal(SIGFPE, blech);
15711#endif
15712
b4eb6b3d
JH
15713 for (i = 0; i < n; i++) {
15714 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15715 d = ($nvtype)u;
15716 if (($uvtype)d != u)
b4eb6b3d 15717 break;
1d1be0dc
NC
15718 if (d <= 0)
15719 break;
15720 d = ($nvtype)(u - 1);
15721 if (($uvtype)d != (u - 1))
15722 break;
15723#ifdef SIGFPE
22676560 15724 if (bletched)
1d1be0dc
NC
15725 break;
15726#endif
b4eb6b3d 15727 }
efd1522b 15728 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15729 exit(0);
15730}
15731EOP
1d1be0dc
NC
15732set try
15733
15734d_nv_preserves_uv="$undef"
15735if eval $compile; then
53133ed1 15736 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15737fi
53133ed1 15738case "$nv_preserves_uv_bits" in
5b813a60 15739\-[1-9]*)
53133ed1
NC
15740 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15741 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15742 d_nv_preserves_uv="$define"
b4eb6b3d 15743 ;;
53133ed1 15744[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15745 d_nv_preserves_uv="$undef" ;;
15746*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15747 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15748esac
5b813a60 15749$rm_try
1d1be0dc 15750
b68c599a
NC
15751$echo "Checking to find the largest integer value your NVs can hold..." >&4
15752: volatile so that the compiler has to store it out to memory.
15753if test X"$d_volatile" = X"$define"; then
15754 volatile=volatile
15755fi
15756$cat <<EOP >try.c
15757#include <stdio.h>
15758
15759typedef $nvtype NV;
15760
15761int
15762main() {
15763 NV value = 2;
15764 int count = 1;
15765
15766 while(count < 256) {
15767 $volatile NV up = value + 1.0;
15768 $volatile NV negated = -value;
15769 $volatile NV down = negated - 1.0;
15770 $volatile NV got_up = up - value;
15771 int up_good = got_up == 1.0;
15772 int got_down = down - negated;
15773 int down_good = got_down == -1.0;
15774
15775 if (down_good != up_good) {
15776 fprintf(stderr,
15777 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15778 up_good, (double) got_up, down_good, (double) got_down,
15779 count, (double) value);
15780 return 1;
15781 }
15782 if (!up_good) {
15783 while (1) {
15784 if (count > 8) {
15785 count -= 8;
15786 fputs("256.0", stdout);
15787 } else {
15788 count--;
15789 fputs("2.0", stdout);
15790 }
15791 if (!count) {
15792 puts("");
15793 return 0;
15794 }
15795 fputs("*", stdout);
15796 }
15797 }
15798 value *= 2;
15799 ++count;
15800 }
15801 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15802 count, (double) value);
15803 return 1;
15804}
15805EOP
15806set try
15807
15808nv_overflows_integers_at='0'
15809if eval $compile; then
15810 xxx="`$run ./try`"
15811 case "$?" in
15812 0)
15813 case "$xxx" in
15814 2*) cat >&4 <<EOM
15815The largest integer your NVs can preserve is equal to $xxx
15816EOM
15817 nv_overflows_integers_at="$xxx"
15818 ;;
15819 *) cat >&4 <<EOM
15820Cannot determine the largest integer value your NVs can hold, unexpected output
15821'$xxx'
15822EOM
15823 ;;
15824 esac
15825 ;;
15826 *) cat >&4 <<EOM
15827Cannot determine the largest integer value your NVs can hold
15828EOM
15829 ;;
15830 esac
15831fi
15832$rm_try
15833
f607920a
CB
15834$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15835: volatile so that the compiler has to store it out to memory.
15836if test X"$d_volatile" = X"$define"; then
15837 volatile=volatile
15838fi
15839$cat <<EOP >try.c
15840#include <stdio.h>
15841#$i_stdlib I_STDLIB
15842#ifdef I_STDLIB
15843#include <stdlib.h>
15844#endif
15845#$i_string I_STRING
15846#ifdef I_STRING
15847# include <string.h>
15848#else
15849# include <strings.h>
15850#endif
15851#include <sys/types.h>
15852#include <signal.h>
15853#ifdef SIGFPE
15854$volatile int bletched = 0;
7090f861 15855$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15856#endif
15857
15858int checkit($nvtype d, char *where) {
15859 unsigned char *p = (char *)&d;
15860 unsigned char *end = p + sizeof(d);
15861 int fail = 0;
15862
15863 while (p < end)
15864 fail += *p++;
15865
15866 if (!fail)
17f6277d 15867 return 0;
f607920a
CB
15868
15869 p = (char *)&d;
15870 printf("No - %s: 0x", where);
15871 while (p < end)
15872 printf ("%02X", *p++);
15873 printf("\n");
15874 return 1;
15875}
15876
15877int main(int argc, char **argv) {
15878 $nvtype d = 0.0;
15879 int fail = 0;
15880 fail += checkit(d, "0.0");
15881
15882 /* The compiler shouldn't be assuming that bletched is 0 */
15883 d = bletched;
15884
15885 fail += checkit(d, "bleched");
15886
15887#ifdef SIGFPE
15888 signal(SIGFPE, blech);
15889#endif
15890
15891 /* Paranoia - the compiler should have no way of knowing that ANSI says
15892 that argv[argc] will always be NULL. Actually, if it did assume this it
15893 would be buggy, as this is C and main() can be called from elsewhere in
15894 the program. */
15895 d = argv[argc] ? 1 : 0;
15896
15897 if (d) {
15898 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15899 }
15900
15901 fail += checkit(d, "ternary");
15902
15903 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15904
15905 if (d != 0.0) {
15906 printf("No - memset doesn't give 0.0\n");
15907 /* This might just blow up: */
15908 printf("(gives %g)\n", d);
15909 return 1;
15910 }
5b813a60 15911
f607920a
CB
15912#ifdef SIGFPE
15913 if (bletched) {
15914 printf("No - something bleched\n");
15915 return 1;
15916 }
15917#endif
15918 if (fail) {
15919 printf("No - %d fail(s)\n", fail);
15920 return 1;
15921 }
15922 printf("Yes\n");
15923 return 0;
15924}
15925EOP
15926set try
15927
15928d_nv_zero_is_allbits_zero="$undef"
15929if eval $compile; then
15930 xxx="`$run ./try`"
15931 case "$?" in
15932 0)
15933 case "$xxx" in
15934 Yes) cat >&4 <<EOM
159350.0 is represented as all bits zero in memory
15936EOM
15937 d_nv_zero_is_allbits_zero="$define"
15938 ;;
15939 *) cat >&4 <<EOM
159400.0 is not represented as all bits zero in memory
15941EOM
15942 d_nv_zero_is_allbits_zero="$undef"
15943 ;;
15944 esac
15945 ;;
15946 *) cat >&4 <<EOM
159470.0 is not represented as all bits zero in memory
15948EOM
15949 d_nv_zero_is_allbits_zero="$undef"
15950 ;;
15951 esac
15952fi
5b813a60 15953$rm_try
b4eb6b3d
JH
15954
15955: check for off64_t
15956echo " "
15957echo "Checking to see if you have off64_t..." >&4
15958$cat >try.c <<EOCP
15959#include <sys/types.h>
15960#include <unistd.h>
15961int main() { off64_t x = 7; }
15962EOCP
15963set try
15964if eval $compile; then
15965 val="$define"
15966 echo "You have off64_t."
15967else
15968 val="$undef"
15969 echo "You do not have off64_t."
15970 case "$lseeksize" in
15971 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15972 esac
15973fi
5b813a60 15974$rm_try
b4eb6b3d
JH
15975set d_off64_t
15976eval $setvar
15977
b4eb6b3d
JH
15978: how to create joinable pthreads
15979if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15980 echo " "
5b813a60 15981 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
15982 $cat >try.c <<'EOCP'
15983#include <pthread.h>
15984int main() {
15985 int detachstate = JOINABLE;
15986}
15987EOCP
15988 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15989 if eval $compile; then
15990 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15991 val="$undef" # Yes, undef.
15992 set d_old_pthread_create_joinable
15993 eval $setvar
15994 val=""
15995 set old_pthread_create_joinable
15996 eval $setvar
15997 else
15998 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15999 if eval $compile; then
16000 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16001 val="$define"
16002 set d_old_pthread_create_joinable
16003 eval $setvar
16004 val=PTHREAD_CREATE_UNDETACHED
16005 set old_pthread_create_joinable
16006 eval $setvar
5b813a60 16007 else
b4eb6b3d
JH
16008 set try -DJOINABLE=__UNDETACHED
16009 if eval $compile; then
16010 echo "You seem to use __UNDETACHED." >&4
16011 val="$define"
16012 set d_old_pthread_create_joinable
16013 eval $setvar
16014 val=__UNDETACHED
16015 set old_pthread_create_joinable
16016 eval $setvar
16017 else
16018 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
16019 val="$define"
16020 set d_old_pthread_create_joinable
16021 eval $setvar
16022 val=0
16023 set old_pthread_create_joinable
16024 eval $setvar
16025 fi
16026 fi
16027 fi
5b813a60 16028 $rm_try
b4eb6b3d
JH
16029else
16030 d_old_pthread_create_joinable="$undef"
16031 old_pthread_create_joinable=""
16032fi
16033
16034: see if pause exists
16035set pause d_pause
16036eval $inlibc
16037
b4eb6b3d
JH
16038: see if poll exists
16039set poll d_poll
16040eval $inlibc
16041
c796e3db
MB
16042: see if prctl exists
16043set prctl d_prctl
16044eval $inlibc
16045
16046: see if prctl supports PR_SET_NAME
16047d_prctl_set_name=$undef
16048case $d_prctl in
16049 $define)
16050 $cat >try.c <<EOM
16051#include <sys/prctl.h>
16052
16053int main (int argc, char *argv[])
16054{
16055 return (prctl (PR_SET_NAME, "Test"));
16056 } /* main */
16057EOM
16058 set try
16059 if eval $compile_ok && $run ./try; then
16060 echo "Your prctl (PR_SET_NAME, ...) works"
16061 d_prctl_set_name=$define
16062 fi
16063 $rm_try
16064 ;;
16065 esac
16066
c7aff470
NIS
16067: see if readlink exists
16068set readlink d_readlink
16069eval $inlibc
16070
613d6c3e 16071: Check if exe is symlink to abs path of executing program
c7aff470 16072echo " "
f24dbf84 16073procselfexe=''
c7aff470 16074val="$undef"
a33c94aa 16075case "$d_readlink" in
698ca84c 16076 "$define")
9e68546f
NC
16077 : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16078 : more tidy to avoid an extra level of symlink
16079 set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
698ca84c
NC
16080 while test $# -gt 0; do
16081 type=$1; try=$2
16082 shift; shift
16083 if $issymlink $try; then
16084 $ls -l $try > reflect
f24dbf84 16085 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
698ca84c
NC
16086 echo "You have $type-like $try."
16087 procselfexe='"'$try'"'
16088 val="$define"
16089 : This will break out of the loop
16090 set X; shift
c7aff470 16091 fi
698ca84c
NC
16092 fi
16093 done
a33c94aa
JH
16094 ;;
16095esac
428dc699 16096$rm -f reflect
c7aff470
NIS
16097set d_procselfexe
16098eval $setvar
16099
233e16ce
MB
16100: backward compatibility for d_hvfork
16101if test X$d_hvfork != X; then
16102 d_vfork="$d_hvfork"
16103 d_hvfork=''
16104fi
16105: see if there is a vfork
16106val=''
16107set vfork val
16108eval $inlibc
16109
16110d_pseudofork=$undef
16111
16112: Ok, but do we want to use it. vfork is reportedly unreliable in
16113: perl on Solaris 2.x, and probably elsewhere.
16114case "$val" in
16115$define)
16116 echo " "
16117 case "$usevfork" in
16118 false) dflt='n';;
16119 *) dflt='y';;
16120 esac
16121 cat <<'EOM'
16122
16123Perl can only use a vfork() that doesn't suffer from strict
16124restrictions on calling functions or modifying global data in
16125the child. For example, glibc-2.1 contains such a vfork()
16126that is unsuitable. If your system provides a proper fork()
16127call, chances are that you do NOT want perl to use vfork().
16128
16129EOM
16130 rp="Do you still want to use vfork()?"
16131 . ./myread
16132 case "$ans" in
16133 y|Y) ;;
16134 *)
16135 echo "Ok, we won't use vfork()."
16136 val="$undef"
16137 ;;
16138 esac
16139 ;;
16140esac
16141set d_vfork
16142eval $setvar
16143case "$d_vfork" in
16144$define) usevfork='true';;
16145*) usevfork='false';;
16146esac
16147
263fee3f
JH
16148: see whether the pthread_atfork exists
16149$cat >try.c <<EOP
16150#include <pthread.h>
16151#include <stdio.h>
16152int main() {
16153#ifdef PTHREAD_ATFORK
16154 pthread_atfork(NULL,NULL,NULL);
16155#endif
16156}
16157EOP
16158
d6483fcc 16159: see if pthread_atfork exists
263fee3f
JH
16160set try -DPTHREAD_ATFORK
16161if eval $compile; then
16162 val="$define"
16163else
16164 val="$undef"
16165fi
16166case "$usethreads" in
16167$define)
16168 case "$val" in
16169 $define) echo 'pthread_atfork found.' >&4 ;;
16170 *) echo 'pthread_atfork NOT found.' >&4 ;;
16171 esac
16172esac
16173set d_pthread_atfork
16174eval $setvar
d6483fcc 16175
58d975c3
JH
16176: see if pthread_attr_setscope exists
16177set pthread_attr_setscope d_pthread_attr_setscope
16178eval $inlibc
16179
b4eb6b3d
JH
16180: see whether the various POSIXish _yields exist
16181$cat >try.c <<EOP
16182#include <pthread.h>
16183#include <stdio.h>
16184int main() {
16185#ifdef SCHED_YIELD
16186 sched_yield();
16187#else
16188#ifdef PTHREAD_YIELD
16189 pthread_yield();
16190#else
16191#ifdef PTHREAD_YIELD_NULL
16192 pthread_yield(NULL);
16193#endif
16194#endif
16195#endif
16196}
16197EOP
16198: see if sched_yield exists
16199set try -DSCHED_YIELD
16200if eval $compile; then
16201 val="$define"
16202 sched_yield='sched_yield()'
16203else
16204 val="$undef"
16205fi
16206case "$usethreads" in
16207$define)
16208 case "$val" in
16209 $define) echo 'sched_yield() found.' >&4 ;;
16210 *) echo 'sched_yield() NOT found.' >&4 ;;
16211 esac
16212esac
10bc17b6
JH
16213set d_sched_yield
16214eval $setvar
b4eb6b3d 16215
10bc17b6
JH
16216: see if pthread_yield exists
16217set try -DPTHREAD_YIELD
16218if eval $compile; then
16219 val="$define"
16220 case "$sched_yield" in
16221 '') sched_yield='pthread_yield()' ;;
16222 esac
16223else
16224 set try -DPTHREAD_YIELD_NULL
16225 if eval $compile; then
16226 val="$define"
16227 case "$sched_yield" in
16228 '') sched_yield='pthread_yield(NULL)' ;;
16229 esac
16230 else
16231 val="$undef"
16232 fi
16233fi
16234case "$usethreads" in
16235$define)
16236 case "$val" in
16237 $define) echo 'pthread_yield() found.' >&4 ;;
16238 *) echo 'pthread_yield() NOT found.' >&4 ;;
16239 esac
16240 ;;
16241esac
16242set d_pthread_yield
16243eval $setvar
10bc17b6
JH
16244case "$sched_yield" in
16245'') sched_yield=undef ;;
16246esac
5b813a60 16247$rm_try
10bc17b6
JH
16248
16249: see if random_r exists
16250set random_r d_random_r
16251eval $inlibc
16252case "$d_random_r" in
16253"$define")
16254 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16255 case "$d_random_r_proto:$usethreads" in
16256 ":define") d_random_r_proto=define
a48ec845
JH
16257 set d_random_r_proto random_r $hdrs
16258 eval $hasproto ;;
16259 *) ;;
16260 esac
16261 case "$d_random_r_proto" in
16262 define)
10bc17b6
JH
16263 case "$random_r_proto" in
16264 ''|0) try='int random_r(int*, struct random_data*);'
61c26d18 16265 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
a845a0d4
JH
16266 esac
16267 case "$random_r_proto" in
16268 ''|0) try='int random_r(long*, struct random_data*);'
61c26d18 16269 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
a845a0d4
JH
16270 esac
16271 case "$random_r_proto" in
16272 ''|0) try='int random_r(struct random_data*, int32_t*);'
61c26d18 16273 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
16274 esac
16275 case "$random_r_proto" in
90e831dc 16276 ''|0) d_random_r=undef
10bc17b6 16277 random_r_proto=0
a48ec845 16278 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16279 * ) case "$random_r_proto" in
16280 REENTRANT_PROTO*) ;;
16281 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16282 esac
16283 echo "Prototype: $try" ;;
16284 esac
b4eb6b3d 16285 ;;
c18e646a
JH
16286 *) case "$usethreads" in
16287 define) echo "random_r has no prototype, not using it." >&4 ;;
16288 esac
90e831dc
SB
16289 d_random_r=undef
16290 random_r_proto=0
c18e646a 16291 ;;
a48ec845
JH
16292 esac
16293 ;;
10bc17b6 16294*) random_r_proto=0
b4eb6b3d
JH
16295 ;;
16296esac
16297
16298: see if readdir and friends exist
16299set readdir d_readdir
16300eval $inlibc
16301set seekdir d_seekdir
16302eval $inlibc
16303set telldir d_telldir
16304eval $inlibc
16305set rewinddir d_rewinddir
16306eval $inlibc
16307
10bc17b6
JH
16308: see if readdir64_r exists
16309set readdir64_r d_readdir64_r
16310eval $inlibc
16311case "$d_readdir64_r" in
16312"$define")
16313 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16314 case "$d_readdir64_r_proto:$usethreads" in
16315 ":define") d_readdir64_r_proto=define
a48ec845
JH
16316 set d_readdir64_r_proto readdir64_r $hdrs
16317 eval $hasproto ;;
16318 *) ;;
16319 esac
16320 case "$d_readdir64_r_proto" in
16321 define)
10bc17b6
JH
16322 case "$readdir64_r_proto" in
16323 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
61c26d18 16324 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
10bc17b6
JH
16325 esac
16326 case "$readdir64_r_proto" in
16327 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
61c26d18 16328 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
10bc17b6
JH
16329 esac
16330 case "$readdir64_r_proto" in
90e831dc 16331 ''|0) d_readdir64_r=undef
10bc17b6 16332 readdir64_r_proto=0
a48ec845 16333 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16334 * ) case "$readdir64_r_proto" in
16335 REENTRANT_PROTO*) ;;
16336 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16337 esac
16338 echo "Prototype: $try" ;;
16339 esac
16340 ;;
c18e646a
JH
16341 *) case "$usethreads" in
16342 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16343 esac
90e831dc
SB
16344 d_readdir64_r=undef
16345 readdir64_r_proto=0
c18e646a 16346 ;;
a48ec845
JH
16347 esac
16348 ;;
10bc17b6
JH
16349*) readdir64_r_proto=0
16350 ;;
16351esac
16352
16353: see if readdir_r exists
16354set readdir_r d_readdir_r
16355eval $inlibc
16356case "$d_readdir_r" in
16357"$define")
16358 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16359 case "$d_readdir_r_proto:$usethreads" in
16360 ":define") d_readdir_r_proto=define
a48ec845
JH
16361 set d_readdir_r_proto readdir_r $hdrs
16362 eval $hasproto ;;
16363 *) ;;
16364 esac
16365 case "$d_readdir_r_proto" in
16366 define)
10bc17b6
JH
16367 case "$readdir_r_proto" in
16368 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
61c26d18 16369 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
10bc17b6
JH
16370 esac
16371 case "$readdir_r_proto" in
16372 ''|0) try='int readdir_r(DIR*, struct dirent*);'
61c26d18 16373 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
10bc17b6
JH
16374 esac
16375 case "$readdir_r_proto" in
90e831dc 16376 ''|0) d_readdir_r=undef
10bc17b6 16377 readdir_r_proto=0
a48ec845 16378 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16379 * ) case "$readdir_r_proto" in
16380 REENTRANT_PROTO*) ;;
16381 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16382 esac
16383 echo "Prototype: $try" ;;
16384 esac
16385 ;;
c18e646a
JH
16386 *) case "$usethreads" in
16387 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16388 esac
90e831dc
SB
16389 d_readdir_r=undef
16390 readdir_r_proto=0
c18e646a 16391 ;;
a48ec845
JH
16392 esac
16393 ;;
10bc17b6
JH
16394*) readdir_r_proto=0
16395 ;;
16396esac
16397
4e0554ec
JH
16398: see if readv exists
16399set readv d_readv
16400eval $inlibc
16401
16402: see if recvmsg exists
16403set recvmsg d_recvmsg
16404eval $inlibc
16405
b4eb6b3d
JH
16406: see if rename exists
16407set rename d_rename
16408eval $inlibc
16409
16410: see if rmdir exists
16411set rmdir d_rmdir
16412eval $inlibc
16413
16414: see if memory.h is available.
16415val=''
16416set memory.h val
16417eval $inhdr
16418
16419: See if it conflicts with string.h
16420case "$val" in
16421$define)
16422 case "$strings" in
16423 '') ;;
16424 *)
16425 $cppstdin $cppflags $cppminus < $strings > mem.h
16426 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16427 echo " "
16428 echo "We won't be including <memory.h>."
16429 val="$undef"
16430 fi
16431 $rm -f mem.h
16432 ;;
16433 esac
16434esac
16435set i_memory
16436eval $setvar
16437
16438: can bcopy handle overlapping blocks?
b6cc3bc4 16439echo " "
b4eb6b3d 16440val="$undef"
b6cc3bc4
AD
16441case "$d_memmove" in
16442"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16443*) case "$d_bcopy" in
16444 "$define")
16445 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16446 $cat >try.c <<EOCP
b4eb6b3d
JH
16447#$i_memory I_MEMORY
16448#$i_stdlib I_STDLIB
16449#$i_string I_STRING
16450#$i_unistd I_UNISTD
16451EOCP
16452 $cat >>try.c <<'EOCP'
16453#include <stdio.h>
16454#ifdef I_MEMORY
16455# include <memory.h>
16456#endif
16457#ifdef I_STDLIB
16458# include <stdlib.h>
16459#endif
16460#ifdef I_STRING
16461# include <string.h>
16462#else
16463# include <strings.h>
16464#endif
16465#ifdef I_UNISTD
16466# include <unistd.h> /* Needed for NetBSD */
16467#endif
16468int main()
16469{
16470char buf[128], abc[128];
16471char *b;
16472int len;
16473int off;
16474int align;
16475
b6cc3bc4
AD
16476/* Copy "abcde..." string to char abc[] so that gcc doesn't
16477 try to store the string in read-only memory. */
b4eb6b3d
JH
16478bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16479
16480for (align = 7; align >= 0; align--) {
16481 for (len = 36; len; len--) {
16482 b = buf+align;
16483 bcopy(abc, b, len);
16484 for (off = 1; off <= len; off++) {
16485 bcopy(b, b+off, len);
16486 bcopy(b+off, b, len);
16487 if (bcmp(b, abc, len))
16488 exit(1);
16489 }
16490 }
16491}
16492exit(0);
16493}
16494EOCP
b6cc3bc4
AD
16495 set try
16496 if eval $compile_ok; then
43dddb59 16497 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16498 echo "Yes, it can."
16499 val="$define"
16500 else
16501 echo "It can't, sorry."
16502 fi
b4eb6b3d 16503 else
b6cc3bc4 16504 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16505 fi
b6cc3bc4
AD
16506 ;;
16507 esac
5b813a60 16508 $rm_try
b4eb6b3d
JH
16509 ;;
16510esac
b4eb6b3d
JH
16511set d_safebcpy
16512eval $setvar
16513
16514: can memcpy handle overlapping blocks?
b6cc3bc4 16515echo " "
b4eb6b3d 16516val="$undef"
b6cc3bc4
AD
16517case "$d_memmove" in
16518"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16519*) case "$d_memcpy" in
16520 "$define")
16521 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16522 $cat >try.c <<EOCP
b4eb6b3d
JH
16523#$i_memory I_MEMORY
16524#$i_stdlib I_STDLIB
16525#$i_string I_STRING
16526#$i_unistd I_UNISTD
16527EOCP
16528 $cat >>try.c <<'EOCP'
16529#include <stdio.h>
16530#ifdef I_MEMORY
16531# include <memory.h>
16532#endif
16533#ifdef I_STDLIB
16534# include <stdlib.h>
16535#endif
16536#ifdef I_STRING
16537# include <string.h>
16538#else
16539# include <strings.h>
16540#endif
16541#ifdef I_UNISTD
16542# include <unistd.h> /* Needed for NetBSD */
16543#endif
16544int main()
16545{
16546char buf[128], abc[128];
16547char *b;
16548int len;
16549int off;
16550int align;
16551
16552/* Copy "abcde..." string to char abc[] so that gcc doesn't
16553 try to store the string in read-only memory. */
16554memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16555
16556for (align = 7; align >= 0; align--) {
16557 for (len = 36; len; len--) {
16558 b = buf+align;
16559 memcpy(b, abc, len);
16560 for (off = 1; off <= len; off++) {
16561 memcpy(b+off, b, len);
16562 memcpy(b, b+off, len);
16563 if (memcmp(b, abc, len))
16564 exit(1);
16565 }
16566 }
16567}
16568exit(0);
16569}
16570EOCP
b6cc3bc4
AD
16571 set try
16572 if eval $compile_ok; then
43dddb59 16573 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16574 echo "Yes, it can."
16575 val="$define"
16576 else
16577 echo "It can't, sorry."
16578 fi
b4eb6b3d 16579 else
b6cc3bc4 16580 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16581 fi
b6cc3bc4
AD
16582 ;;
16583 esac
5b813a60 16584 $rm_try
b4eb6b3d
JH
16585 ;;
16586esac
b4eb6b3d
JH
16587set d_safemcpy
16588eval $setvar
16589
16590: can memcmp be trusted to compare relative magnitude?
16591val="$undef"
16592case "$d_memcmp" in
16593"$define")
16594 echo " "
16595 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16596 $cat >try.c <<EOCP
16597#$i_memory I_MEMORY
16598#$i_stdlib I_STDLIB
16599#$i_string I_STRING
16600#$i_unistd I_UNISTD
16601EOCP
16602 $cat >>try.c <<'EOCP'
16603#include <stdio.h>
16604#ifdef I_MEMORY
16605# include <memory.h>
16606#endif
16607#ifdef I_STDLIB
36adc09b 16608# include <stdlib.h>
b4eb6b3d
JH
16609#endif
16610#ifdef I_STRING
16611# include <string.h>
16612#else
16613# include <strings.h>
16614#endif
16615#ifdef I_UNISTD
16616# include <unistd.h> /* Needed for NetBSD */
16617#endif
16618int main()
16619{
16620char a = -1;
16621char b = 0;
16622if ((a < b) && memcmp(&a, &b, 1) < 0)
16623 exit(1);
16624exit(0);
16625}
16626EOCP
16627 set try
16628 if eval $compile_ok; then
5440bc8e 16629 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16630 echo "Yes, it can."
16631 val="$define"
16632 else
16633 echo "No, it can't (it uses signed chars)."
16634 fi
16635 else
16636 echo "(I can't compile the test program, so we'll assume not...)"
16637 fi
16638 ;;
16639esac
5b813a60 16640$rm_try
b4eb6b3d
JH
16641set d_sanemcmp
16642eval $setvar
16643
ef9f17be
JH
16644: see if prototype for sbrk is available
16645echo " "
16646set d_sbrkproto sbrk $i_unistd unistd.h
16647eval $hasproto
16648
b4eb6b3d
JH
16649: see if select exists
16650set select d_select
16651eval $inlibc
16652
16653: see if semctl exists
16654set semctl d_semctl
16655eval $inlibc
16656
16657: see if semget exists
16658set semget d_semget
16659eval $inlibc
16660
16661: see if semop exists
16662set semop d_semop
16663eval $inlibc
16664
16665: see how much of the 'sem*(2)' library is present.
16666h_sem=true
16667echo " "
16668case "$d_semctl$d_semget$d_semop" in
16669*"$undef"*) h_sem=false;;
16670esac
16671case "$osname" in
16672freebsd)
16673 case "`ipcs 2>&1`" in
16674 "SVID messages"*"not configured"*)
16675 echo "Your $osname does not have the sem*(2) configured." >&4
16676 h_sem=false
16677 val="$undef"
16678 set semctl d_semctl
16679 eval $setvar
16680 set semget d_semget
16681 eval $setvar
16682 set semop d_semop
16683 eval $setvar
16684 ;;
16685 esac
16686 ;;
16687esac
16688: we could also check for sys/ipc.h ...
16689if $h_sem && $test `./findhdr sys/sem.h`; then
16690 echo "You have the full sem*(2) library." >&4
16691 val="$define"
16692else
16693 echo "You don't have the full sem*(2) library." >&4
16694 val="$undef"
16695fi
16696set d_sem
16697eval $setvar
16698
16699: see whether sys/sem.h defines union semun
16700echo " "
16701$cat > try.c <<'END'
16702#include <sys/types.h>
16703#include <sys/ipc.h>
16704#include <sys/sem.h>
16705int main () { union semun semun; semun.buf = 0; }
16706END
16707set try
16708if eval $compile; then
16709 echo "You have union semun in <sys/sem.h>." >&4
16710 val="$define"
16711else
16712 echo "You do not have union semun in <sys/sem.h>." >&4
16713 val="$undef"
16714fi
5b813a60 16715$rm_try
b4eb6b3d
JH
16716set d_union_semun
16717eval $setvar
16718
16719: see how to do semctl IPC_STAT
16720case "$d_sem" in
16721$define)
b4eb6b3d 16722 echo " "
93451a0d 16723 $cat > tryh.h <<END
b4eb6b3d
JH
16724#ifndef S_IRUSR
16725# ifdef S_IREAD
16726# define S_IRUSR S_IREAD
16727# define S_IWUSR S_IWRITE
16728# define S_IXUSR S_IEXEC
16729# else
16730# define S_IRUSR 0400
16731# define S_IWUSR 0200
16732# define S_IXUSR 0100
16733# endif
16734# define S_IRGRP (S_IRUSR>>3)
16735# define S_IWGRP (S_IWUSR>>3)
16736# define S_IXGRP (S_IXUSR>>3)
16737# define S_IROTH (S_IRUSR>>6)
16738# define S_IWOTH (S_IWUSR>>6)
16739# define S_IXOTH (S_IXUSR>>6)
16740#endif
16741#ifndef S_IRWXU
16742# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16743# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16744# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16745#endif
16746END
2fad75a1 16747 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16748 case "$d_semctl_semun" in
16749 '')
35918792 16750 val="$undef"
2fad75a1 16751 $cat > try.c <<END
b4eb6b3d
JH
16752#include <sys/types.h>
16753#include <sys/ipc.h>
16754#include <sys/sem.h>
16755#include <sys/stat.h>
16756#include <stdio.h>
16757#include <errno.h>
93451a0d 16758#include "tryh.h"
b4eb6b3d
JH
16759#ifndef errno
16760extern int errno;
16761#endif
16762#$d_union_semun HAS_UNION_SEMUN
16763int main() {
16764 union semun
16765#ifndef HAS_UNION_SEMUN
16766 {
16767 int val;
16768 struct semid_ds *buf;
16769 unsigned short *array;
16770 }
16771#endif
16772 arg;
16773 int sem, st;
16774
16775#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16776 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16777 if (sem > -1) {
16778 struct semid_ds argbuf;
16779 arg.buf = &argbuf;
16780# ifdef IPC_STAT
16781 st = semctl(sem, 0, IPC_STAT, arg);
16782 if (st == 0)
16783 printf("semun\n");
16784 else
16785# endif /* IPC_STAT */
16786 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16787# ifdef IPC_RMID
16788 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16789# endif /* IPC_RMID */
b4eb6b3d
JH
16790 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16791 } else
16792#endif /* IPC_PRIVATE && ... */
16793 printf("semget failed: errno = %d\n", errno);
16794 return 0;
16795}
16796END
2fad75a1
JH
16797 set try
16798 if eval $compile; then
16799 xxx=`$run ./try`
16800 case "$xxx" in
16801 semun) val="$define" ;;
16802 esac
16803 fi
5b813a60 16804 $rm_try
35918792
YST
16805 set d_semctl_semun
16806 eval $setvar
2fad75a1
JH
16807 ;;
16808 esac
b4eb6b3d
JH
16809 case "$d_semctl_semun" in
16810 $define)
16811 echo "You can use union semun for semctl IPC_STAT." >&4
16812 also='also'
16813 ;;
16814 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16815 also=''
16816 ;;
16817 esac
16818
16819 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16820 case "$d_semctl_semid_ds" in
16821 '')
35918792 16822 val="$undef"
2fad75a1 16823 $cat > try.c <<'END'
b4eb6b3d
JH
16824#include <sys/types.h>
16825#include <sys/ipc.h>
16826#include <sys/sem.h>
16827#include <sys/stat.h>
93451a0d 16828#include "tryh.h"
b4eb6b3d
JH
16829#include <stdio.h>
16830#include <errno.h>
16831#ifndef errno
16832extern int errno;
16833#endif
16834int main() {
16835 struct semid_ds arg;
16836 int sem, st;
16837
16838#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16839 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16840 if (sem > -1) {
16841# ifdef IPC_STAT
16842 st = semctl(sem, 0, IPC_STAT, &arg);
16843 if (st == 0)
16844 printf("semid_ds\n");
16845 else
16846# endif /* IPC_STAT */
16847 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16848# ifdef IPC_RMID
16849 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16850# endif /* IPC_RMID */
16851 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16852 } else
16853#endif /* IPC_PRIVATE && ... */
16854 printf("semget failed: errno = %d\n", errno);
16855
16856 return 0;
16857}
16858END
2fad75a1
JH
16859 set try
16860 if eval $compile; then
16861 xxx=`$run ./try`
16862 case "$xxx" in
16863 semid_ds) val="$define" ;;
16864 esac
16865 fi
5b813a60 16866 $rm_try
35918792
YST
16867 set d_semctl_semid_ds
16868 eval $setvar
2fad75a1
JH
16869 ;;
16870 esac
b4eb6b3d
JH
16871 case "$d_semctl_semid_ds" in
16872 $define)
16873 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16874 ;;
16875 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16876 ;;
16877 esac
b4eb6b3d
JH
16878 ;;
16879*) val="$undef"
16880
16881 # We do not have the full sem*(2) library, so assume we can not
16882 # use either.
16883
16884 set d_semctl_semun
16885 eval $setvar
16886
16887 set d_semctl_semid_ds
16888 eval $setvar
16889 ;;
16890esac
93451a0d 16891$rm_try tryh.h
b4eb6b3d 16892
4e0554ec
JH
16893: see if sendmsg exists
16894set sendmsg d_sendmsg
16895eval $inlibc
16896
b4eb6b3d
JH
16897: see if setegid exists
16898set setegid d_setegid
16899eval $inlibc
16900
16901: see if seteuid exists
16902set seteuid d_seteuid
16903eval $inlibc
16904
16905: see if setgrent exists
16906set setgrent d_setgrent
16907eval $inlibc
16908
10bc17b6
JH
16909: see if setgrent_r exists
16910set setgrent_r d_setgrent_r
16911eval $inlibc
16912case "$d_setgrent_r" in
16913"$define")
16914 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16915 case "$d_setgrent_r_proto:$usethreads" in
16916 ":define") d_setgrent_r_proto=define
a48ec845
JH
16917 set d_setgrent_r_proto setgrent_r $hdrs
16918 eval $hasproto ;;
16919 *) ;;
16920 esac
16921 case "$d_setgrent_r_proto" in
16922 define)
10bc17b6
JH
16923 case "$setgrent_r_proto" in
16924 ''|0) try='int setgrent_r(FILE**);'
61c26d18 16925 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
10bc17b6
JH
16926 esac
16927 case "$setgrent_r_proto" in
16928 ''|0) try='void setgrent_r(FILE**);'
61c26d18 16929 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
10bc17b6
JH
16930 esac
16931 case "$setgrent_r_proto" in
90e831dc 16932 ''|0) d_setgrent_r=undef
10bc17b6 16933 setgrent_r_proto=0
a48ec845 16934 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16935 * ) case "$setgrent_r_proto" in
16936 REENTRANT_PROTO*) ;;
16937 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16938 esac
16939 echo "Prototype: $try" ;;
16940 esac
16941 ;;
c18e646a
JH
16942 *) case "$usethreads" in
16943 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16944 esac
90e831dc
SB
16945 d_setgrent_r=undef
16946 setgrent_r_proto=0
c18e646a 16947 ;;
a48ec845
JH
16948 esac
16949 ;;
10bc17b6
JH
16950*) setgrent_r_proto=0
16951 ;;
16952esac
16953
b4eb6b3d
JH
16954: see if sethostent exists
16955set sethostent d_sethent
16956eval $inlibc
16957
10bc17b6
JH
16958: see if sethostent_r exists
16959set sethostent_r d_sethostent_r
16960eval $inlibc
16961case "$d_sethostent_r" in
16962"$define")
16963 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16964 case "$d_sethostent_r_proto:$usethreads" in
16965 ":define") d_sethostent_r_proto=define
a48ec845
JH
16966 set d_sethostent_r_proto sethostent_r $hdrs
16967 eval $hasproto ;;
16968 *) ;;
16969 esac
16970 case "$d_sethostent_r_proto" in
16971 define)
10bc17b6
JH
16972 case "$sethostent_r_proto" in
16973 ''|0) try='int sethostent_r(int, struct hostent_data*);'
61c26d18 16974 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
10bc17b6
JH
16975 esac
16976 case "$sethostent_r_proto" in
16977 ''|0) try='void sethostent_r(int, struct hostent_data*);'
61c26d18 16978 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
10bc17b6
JH
16979 esac
16980 case "$sethostent_r_proto" in
90e831dc 16981 ''|0) d_sethostent_r=undef
10bc17b6 16982 sethostent_r_proto=0
a48ec845 16983 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16984 * ) case "$sethostent_r_proto" in
16985 REENTRANT_PROTO*) ;;
16986 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16987 esac
16988 echo "Prototype: $try" ;;
16989 esac
16990 ;;
c18e646a
JH
16991 *) case "$usethreads" in
16992 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16993 esac
90e831dc
SB
16994 d_sethostent_r=undef
16995 sethostent_r_proto=0
c18e646a 16996 ;;
a48ec845
JH
16997 esac
16998 ;;
10bc17b6
JH
16999*) sethostent_r_proto=0
17000 ;;
17001esac
17002
4e0554ec
JH
17003: see if setitimer exists
17004set setitimer d_setitimer
17005eval $inlibc
17006
b4eb6b3d
JH
17007: see if setlinebuf exists
17008set setlinebuf d_setlinebuf
17009eval $inlibc
17010
17011: see if setlocale exists
17012set setlocale d_setlocale
17013eval $inlibc
17014
10bc17b6
JH
17015: see if locale.h is available
17016set locale.h i_locale
17017eval $inhdr
17018
17019: see if setlocale_r exists
17020set setlocale_r d_setlocale_r
17021eval $inlibc
17022case "$d_setlocale_r" in
17023"$define")
17024 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
17025 case "$d_setlocale_r_proto:$usethreads" in
17026 ":define") d_setlocale_r_proto=define
a48ec845
JH
17027 set d_setlocale_r_proto setlocale_r $hdrs
17028 eval $hasproto ;;
17029 *) ;;
17030 esac
17031 case "$d_setlocale_r_proto" in
17032 define)
10bc17b6
JH
17033 case "$setlocale_r_proto" in
17034 ''|0) try='int setlocale_r(int, const char*, char*, int);'
61c26d18 17035 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
10bc17b6
JH
17036 esac
17037 case "$setlocale_r_proto" in
90e831dc 17038 ''|0) d_setlocale_r=undef
10bc17b6 17039 setlocale_r_proto=0
a48ec845 17040 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17041 * ) case "$setlocale_r_proto" in
17042 REENTRANT_PROTO*) ;;
17043 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17044 esac
17045 echo "Prototype: $try" ;;
17046 esac
17047 ;;
c18e646a
JH
17048 *) case "$usethreads" in
17049 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17050 esac
90e831dc
SB
17051 d_setlocale_r=undef
17052 setlocale_r_proto=0
c18e646a 17053 ;;
a48ec845
JH
17054 esac
17055 ;;
10bc17b6
JH
17056*) setlocale_r_proto=0
17057 ;;
17058esac
17059
b4eb6b3d
JH
17060: see if setnetent exists
17061set setnetent d_setnent
17062eval $inlibc
17063
10bc17b6
JH
17064: see if setnetent_r exists
17065set setnetent_r d_setnetent_r
17066eval $inlibc
17067case "$d_setnetent_r" in
17068"$define")
17069 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17070 case "$d_setnetent_r_proto:$usethreads" in
17071 ":define") d_setnetent_r_proto=define
a48ec845
JH
17072 set d_setnetent_r_proto setnetent_r $hdrs
17073 eval $hasproto ;;
17074 *) ;;
17075 esac
17076 case "$d_setnetent_r_proto" in
17077 define)
10bc17b6
JH
17078 case "$setnetent_r_proto" in
17079 ''|0) try='int setnetent_r(int, struct netent_data*);'
61c26d18 17080 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
10bc17b6
JH
17081 esac
17082 case "$setnetent_r_proto" in
17083 ''|0) try='void setnetent_r(int, struct netent_data*);'
61c26d18 17084 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
10bc17b6
JH
17085 esac
17086 case "$setnetent_r_proto" in
90e831dc 17087 ''|0) d_setnetent_r=undef
10bc17b6 17088 setnetent_r_proto=0
a48ec845 17089 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17090 * ) case "$setnetent_r_proto" in
17091 REENTRANT_PROTO*) ;;
17092 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17093 esac
17094 echo "Prototype: $try" ;;
17095 esac
17096 ;;
c18e646a
JH
17097 *) case "$usethreads" in
17098 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17099 esac
90e831dc
SB
17100 d_setnetent_r=undef
17101 setnetent_r_proto=0
c18e646a 17102 ;;
a48ec845
JH
17103 esac
17104 ;;
10bc17b6
JH
17105*) setnetent_r_proto=0
17106 ;;
17107esac
17108
b4eb6b3d
JH
17109: see if setprotoent exists
17110set setprotoent d_setpent
17111eval $inlibc
17112
17113: see if setpgid exists
17114set setpgid d_setpgid
17115eval $inlibc
17116
17117: see if setpgrp2 exists
17118set setpgrp2 d_setpgrp2
17119eval $inlibc
17120
17121: see if setpriority exists
17122set setpriority d_setprior
17123eval $inlibc
17124
17125: see if setproctitle exists
17126set setproctitle d_setproctitle
17127eval $inlibc
17128
10bc17b6
JH
17129: see if setprotoent_r exists
17130set setprotoent_r d_setprotoent_r
17131eval $inlibc
17132case "$d_setprotoent_r" in
17133"$define")
17134 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17135 case "$d_setprotoent_r_proto:$usethreads" in
17136 ":define") d_setprotoent_r_proto=define
a48ec845
JH
17137 set d_setprotoent_r_proto setprotoent_r $hdrs
17138 eval $hasproto ;;
17139 *) ;;
17140 esac
17141 case "$d_setprotoent_r_proto" in
17142 define)
10bc17b6
JH
17143 case "$setprotoent_r_proto" in
17144 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
61c26d18 17145 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
10bc17b6
JH
17146 esac
17147 case "$setprotoent_r_proto" in
17148 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
61c26d18 17149 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
10bc17b6
JH
17150 esac
17151 case "$setprotoent_r_proto" in
90e831dc 17152 ''|0) d_setprotoent_r=undef
10bc17b6 17153 setprotoent_r_proto=0
a48ec845 17154 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17155 * ) case "$setprotoent_r_proto" in
17156 REENTRANT_PROTO*) ;;
17157 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17158 esac
17159 echo "Prototype: $try" ;;
17160 esac
17161 ;;
c18e646a
JH
17162 *) case "$usethreads" in
17163 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17164 esac
90e831dc
SB
17165 d_setprotoent_r=undef
17166 setprotoent_r_proto=0
c18e646a 17167 ;;
a48ec845
JH
17168 esac
17169 ;;
10bc17b6
JH
17170*) setprotoent_r_proto=0
17171 ;;
17172esac
17173
b4eb6b3d
JH
17174: see if setpwent exists
17175set setpwent d_setpwent
17176eval $inlibc
17177
10bc17b6
JH
17178: see if setpwent_r exists
17179set setpwent_r d_setpwent_r
17180eval $inlibc
17181case "$d_setpwent_r" in
17182"$define")
17183 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
17184 case "$d_setpwent_r_proto:$usethreads" in
17185 ":define") d_setpwent_r_proto=define
a48ec845
JH
17186 set d_setpwent_r_proto setpwent_r $hdrs
17187 eval $hasproto ;;
17188 *) ;;
17189 esac
17190 case "$d_setpwent_r_proto" in
17191 define)
10bc17b6
JH
17192 case "$setpwent_r_proto" in
17193 ''|0) try='int setpwent_r(FILE**);'
61c26d18 17194 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
10bc17b6
JH
17195 esac
17196 case "$setpwent_r_proto" in
17197 ''|0) try='void setpwent_r(FILE**);'
61c26d18 17198 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
10bc17b6
JH
17199 esac
17200 case "$setpwent_r_proto" in
90e831dc 17201 ''|0) d_setpwent_r=undef
10bc17b6 17202 setpwent_r_proto=0
a48ec845 17203 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17204 * ) case "$setpwent_r_proto" in
17205 REENTRANT_PROTO*) ;;
17206 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17207 esac
17208 echo "Prototype: $try" ;;
17209 esac
17210 ;;
c18e646a
JH
17211 *) case "$usethreads" in
17212 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17213 esac
90e831dc
SB
17214 d_setpwent_r=undef
17215 setpwent_r_proto=0
c18e646a 17216 ;;
a48ec845
JH
17217 esac
17218 ;;
10bc17b6
JH
17219*) setpwent_r_proto=0
17220 ;;
17221esac
17222
b4eb6b3d
JH
17223: see if setregid exists
17224set setregid d_setregid
17225eval $inlibc
17226set setresgid d_setresgid
17227eval $inlibc
17228
17229: see if setreuid exists
17230set setreuid d_setreuid
17231eval $inlibc
17232set setresuid d_setresuid
17233eval $inlibc
17234
17235: see if setrgid exists
17236set setrgid d_setrgid
17237eval $inlibc
17238
17239: see if setruid exists
17240set setruid d_setruid
17241eval $inlibc
17242
17243: see if setservent exists
17244set setservent d_setsent
17245eval $inlibc
17246
10bc17b6
JH
17247: see if setservent_r exists
17248set setservent_r d_setservent_r
17249eval $inlibc
17250case "$d_setservent_r" in
17251"$define")
17252 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17253 case "$d_setservent_r_proto:$usethreads" in
17254 ":define") d_setservent_r_proto=define
a48ec845
JH
17255 set d_setservent_r_proto setservent_r $hdrs
17256 eval $hasproto ;;
17257 *) ;;
17258 esac
17259 case "$d_setservent_r_proto" in
17260 define)
10bc17b6
JH
17261 case "$setservent_r_proto" in
17262 ''|0) try='int setservent_r(int, struct servent_data*);'
61c26d18 17263 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
10bc17b6
JH
17264 esac
17265 case "$setservent_r_proto" in
17266 ''|0) try='void setservent_r(int, struct servent_data*);'
61c26d18 17267 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
10bc17b6
JH
17268 esac
17269 case "$setservent_r_proto" in
90e831dc 17270 ''|0) d_setservent_r=undef
10bc17b6 17271 setservent_r_proto=0
a48ec845 17272 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17273 * ) case "$setservent_r_proto" in
17274 REENTRANT_PROTO*) ;;
17275 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17276 esac
17277 echo "Prototype: $try" ;;
17278 esac
17279 ;;
c18e646a
JH
17280 *) case "$usethreads" in
17281 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17282 esac
90e831dc
SB
17283 d_setservent_r=undef
17284 setservent_r_proto=0
c18e646a 17285 ;;
a48ec845
JH
17286 esac
17287 ;;
10bc17b6
JH
17288*) setservent_r_proto=0
17289 ;;
17290esac
17291
b4eb6b3d
JH
17292: see if setsid exists
17293set setsid d_setsid
17294eval $inlibc
17295
17296: see if setvbuf exists
17297set setvbuf d_setvbuf
17298eval $inlibc
17299
17300: see if sfio.h is available
17301set sfio.h i_sfio
17302eval $inhdr
17303
b4eb6b3d
JH
17304: see if sfio library is available
17305case "$i_sfio" in
17306$define)
17307 val=''
17308 set sfreserve val
17309 eval $inlibc
17310 ;;
17311*)
17312 val="$undef"
17313 ;;
17314esac
17315: Ok, but do we want to use it.
17316case "$val" in
17317$define)
17318 case "$usesfio" in
17319 true|$define|[yY]*) dflt='y';;
17320 *) dflt='n';;
17321 esac
17322 echo "$package can use the sfio library, but it is experimental."
b4eb6b3d
JH
17323 rp="You seem to have sfio available, do you want to try using it?"
17324 . ./myread
17325 case "$ans" in
dd35fa16 17326 y|Y) echo "Ok, turning on sfio then."
b4eb6b3d
JH
17327 val="$define"
17328 ;;
17329 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
17330 val="$undef"
b4eb6b3d
JH
17331 ;;
17332 esac
17333 ;;
17334*) case "$usesfio" in
17335 true|$define|[yY]*)
17336 echo "Sorry, cannot find sfio on this machine." >&4
17337 echo "Ignoring your setting of usesfio=$usesfio." >&4
17338 val="$undef"
17339 ;;
17340 esac
17341 ;;
17342esac
17343set d_sfio
17344eval $setvar
17345case "$d_sfio" in
17346$define) usesfio='true';;
17347*) usesfio='false';;
17348esac
3659ebf1
JH
17349case "$d_sfio" in
17350$define) ;;
17351*) : Remove sfio from list of libraries to use
7483f793
JH
17352 case "$libs" in
17353 *-lsfio*)
17354 echo "Removing unneeded -lsfio from library list" >&4
17355 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17356 shift
17357 libs="$*"
17358 echo "libs = $libs" >&4
17359 ;;
17360 esac
3659ebf1
JH
17361;;
17362esac
17363
b4eb6b3d
JH
17364
17365: see if shmctl exists
17366set shmctl d_shmctl
17367eval $inlibc
17368
17369: see if shmget exists
17370set shmget d_shmget
17371eval $inlibc
17372
17373: see if shmat exists
17374set shmat d_shmat
17375eval $inlibc
17376: see what shmat returns
17377case "$d_shmat" in
17378"$define")
17379 $cat >shmat.c <<'END'
17380#include <sys/shm.h>
17381void *shmat();
17382END
17383 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17384 shmattype='void *'
17385 else
17386 shmattype='char *'
17387 fi
17388 echo "and it returns ($shmattype)." >&4
17389 : see if a prototype for shmat is available
17390 xxx=`./findhdr sys/shm.h`
17391 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17392 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17393 val="$define"
17394 else
17395 val="$undef"
17396 fi
17397 $rm -f shmat.[co]
17398 ;;
17399*)
17400 val="$undef"
17401 ;;
17402esac
17403set d_shmatprototype
17404eval $setvar
17405
17406: see if shmdt exists
17407set shmdt d_shmdt
17408eval $inlibc
17409
17410: see how much of the 'shm*(2)' library is present.
17411h_shm=true
17412echo " "
17413case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17414*"$undef"*) h_shm=false;;
17415esac
17416case "$osname" in
17417freebsd)
17418 case "`ipcs 2>&1`" in
17419 "SVID shared memory"*"not configured"*)
17420 echo "Your $osname does not have the shm*(2) configured." >&4
17421 h_shm=false
17422 val="$undef"
17423 set shmctl d_shmctl
17424 evat $setvar
17425 set shmget d_shmget
17426 evat $setvar
17427 set shmat d_shmat
17428 evat $setvar
17429 set shmdt d_shmdt
17430 evat $setvar
17431 ;;
17432 esac
17433 ;;
17434esac
17435: we could also check for sys/ipc.h ...
17436if $h_shm && $test `./findhdr sys/shm.h`; then
17437 echo "You have the full shm*(2) library." >&4
17438 val="$define"
17439else
17440 echo "You don't have the full shm*(2) library." >&4
17441 val="$undef"
17442fi
17443set d_shm
17444eval $setvar
17445
b4eb6b3d 17446: see if we have sigaction
613d6c3e 17447echo " "
b4eb6b3d
JH
17448if set sigaction val -f d_sigaction; eval $csym; $val; then
17449 echo 'sigaction() found.' >&4
073b6de5 17450 $cat > try.c <<EOP
b4eb6b3d
JH
17451#include <stdio.h>
17452#include <sys/types.h>
17453#include <signal.h>
073b6de5
JH
17454#$i_stdlib I_STDLIB
17455#ifdef I_STDLIB
17456#include <stdlib.h>
17457#endif
b4eb6b3d
JH
17458int main()
17459{
17460 struct sigaction act, oact;
17461 act.sa_flags = 0;
17462 oact.sa_handler = 0;
17463 /* so that act and oact are used */
17464 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17465}
17466EOP
17467 set try
17468 if eval $compile_ok; then
17469 val="$define"
17470 else
17471 echo "But you don't seem to have a useable struct sigaction." >&4
17472 val="$undef"
17473 fi
17474else
17475 echo 'sigaction NOT found.' >&4
17476 val="$undef"
17477fi
17478set d_sigaction; eval $setvar
5b813a60 17479$rm_try
b4eb6b3d 17480
ed140128
AD
17481: see if this is a sunmath.h system
17482set sunmath.h i_sunmath
17483eval $inhdr
17484
17485: see if signbit exists
17486$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17487$cat >try.c <<EOCP
17488#$i_math I_MATH
17489#$i_sunmath I_SUNMATH
17490#ifdef I_MATH
17491# include <math.h>
17492#endif
17493#ifdef I_SUNMATH /* Solaris special math library */
17494# include <sunmath.h>
17495#endif
17496#define NV $nvtype
17497int main(int argc, char **argv)
17498{
17499 NV x = 0.0;
17500 NV y = -0.0;
17501 if ((signbit(x) == 0) && (signbit(y) != 0))
17502 return 0;
17503 else
17504 return 1;
17505}
17506EOCP
17507val="$undef"
17508set try
17509if eval $compile; then
17510 if $run ./try; then
17511 $echo "Yes." >&4
17512 val="$define"
17513 else
17514 $echo "Signbit seems to be available, but doesn't work as I expected."
17515 $echo "I won't use it." >&4
17516 val="$undef"
17517 fi
17518else
17519 $echo "Nope." >&4
17520 dflt="$undef"
17521fi
17522set d_signbit
17523eval $setvar
5b813a60 17524$rm_try
ed140128 17525
983dbef6
JH
17526: see if sigprocmask exists
17527set sigprocmask d_sigprocmask
17528eval $inlibc
17529
b4eb6b3d
JH
17530: see if sigsetjmp exists
17531echo " "
17532case "$d_sigsetjmp" in
17533'')
c727eafa 17534 $cat >try.c <<EOP
b4eb6b3d 17535#include <setjmp.h>
d1daaddf
JH
17536#$i_stdlib I_STDLIB
17537#ifdef I_STDLIB
17538#include <stdlib.h>
17539#endif
b4eb6b3d
JH
17540sigjmp_buf env;
17541int set = 1;
17542int main()
17543{
17544 if (sigsetjmp(env,1))
17545 exit(set);
17546 set = 0;
17547 siglongjmp(env, 1);
17548 exit(1);
17549}
17550EOP
17551 set try
17552 if eval $compile; then
5440bc8e 17553 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17554 echo "POSIX sigsetjmp found." >&4
17555 val="$define"
17556 else
17557 $cat >&4 <<EOM
17558Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17559I'll ignore them.
17560EOM
17561 val="$undef"
17562 fi
17563 else
17564 echo "sigsetjmp not found." >&4
17565 val="$undef"
17566 fi
17567 ;;
17568*) val="$d_sigsetjmp"
17569 case "$d_sigsetjmp" in
17570 $define) echo "POSIX sigsetjmp found." >&4;;
17571 $undef) echo "sigsetjmp not found." >&4;;
17572 esac
17573 ;;
17574esac
17575set d_sigsetjmp
17576eval $setvar
5b813a60 17577$rm_try
b4eb6b3d 17578
4f5da3e9
SP
17579: see if snprintf exists
17580set snprintf d_snprintf
17581eval $inlibc
17582
17583: see if vsnprintf exists
17584set vsnprintf d_vsnprintf
17585eval $inlibc
17586
2478f7a0
MB
17587case "$d_snprintf-$d_vsnprintf" in
17588"$define-$define")
17589 $cat <<EOM
17590Checking whether your snprintf() and vsnprintf() work okay...
17591EOM
17592 $cat >try.c <<'EOCP'
17593/* v?snprintf testing logic courtesy of Russ Allbery.
17594 * According to C99:
17595 * - if the buffer is too short it still must be \0-terminated
17596 * - if the buffer is too short the potentially required length
17597 * must be returned and not -1
17598 * - if the buffer is NULL the potentially required length
17599 * must be returned and not -1 or core dump
17600 */
17601#include <stdio.h>
17602#include <stdarg.h>
17603
17604char buf[2];
17605
17606int test (char *format, ...)
17607{
17608 va_list args;
17609 int count;
17610
17611 va_start (args, format);
17612 count = vsnprintf (buf, sizeof buf, format, args);
17613 va_end (args);
17614 return count;
17615}
17616
17617int main ()
17618{
17619 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17620 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17621}
17622EOCP
17623 set try
17624 if eval $compile; then
17625 `$run ./try`
17626 case "$?" in
17627 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17628 *) cat <<EOM >&4
17629Your snprintf() and snprintf() don't seem to be working okay.
17630EOM
17631 d_snprintf="$undef"
17632 d_vsnprintf="$undef"
17633 ;;
17634 esac
17635 else
17636 echo "(I can't seem to compile the test program--assuming they don't)"
17637 d_snprintf="$undef"
17638 d_vsnprintf="$undef"
17639 fi
5b813a60 17640 $rm_try
2478f7a0
MB
17641 ;;
17642esac
17643
49a78c82
JH
17644: see if sockatmark exists
17645set sockatmark d_sockatmark
17646eval $inlibc
17647
2ef53570
JH
17648: see if prototype for sockatmark is available
17649echo " "
17650set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17651eval $hasproto
17652
b4eb6b3d
JH
17653: see if socks5_init exists
17654set socks5_init d_socks5_init
17655eval $inlibc
17656
360321b3
YST
17657: see if sprintf returns the length of the string in the buffer as per ANSI
17658$echo "Checking whether sprintf returns the length of the string..." >&4
17659$cat <<EOP >try.c
17660#include <stdio.h>
17661#$i_stdlib I_STDLIB
17662#ifdef I_STDLIB
17663#include <stdlib.h>
17664#endif
17665#$i_string I_STRING
17666#ifdef I_STRING
17667# include <string.h>
17668#else
17669# include <strings.h>
17670#endif
17671#$i_math I_MATH
17672#ifdef I_MATH
17673#include <math.h>
17674#endif
17675
17676char buffer[256];
17677
17678int check (size_t expect, int test) {
17679 size_t got = strlen(buffer);
17680 if (expect == got)
17681 return 0;
17682
17683 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17684 test, buffer);
17685 exit (test);
17686}
17687
17688int main(int argc, char **argv) {
17689 int test = 0;
17690
17691 check(sprintf(buffer, ""), ++test);
17692 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17693 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17694
17695 return 0;
17696}
17697EOP
17698set try
17699
360321b3
YST
17700if eval $compile; then
17701 xxx="`$run ./try`"
17702 case "$?" in
17703 0) cat >&4 <<EOM
17704sprintf returns the length of the string (as ANSI says it should)
17705EOM
17706 d_sprintf_returns_strlen="$define"
17707 ;;
17708 *) cat >&4 <<EOM
17709sprintf does not return the length of the string (how old is this system?)
17710EOM
17711 d_sprintf_returns_strlen="$undef"
17712 ;;
17713 esac
d2821e72 17714else
36a30365
JH
17715 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17716 d_sprintf_returns_strlen="$undef"
360321b3 17717fi
5b813a60 17718$rm_try
360321b3 17719
10bc17b6
JH
17720: see if srand48_r exists
17721set srand48_r d_srand48_r
17722eval $inlibc
17723case "$d_srand48_r" in
17724"$define")
17725 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17726 case "$d_srand48_r_proto:$usethreads" in
17727 ":define") d_srand48_r_proto=define
a48ec845
JH
17728 set d_srand48_r_proto srand48_r $hdrs
17729 eval $hasproto ;;
17730 *) ;;
17731 esac
17732 case "$d_srand48_r_proto" in
17733 define)
10bc17b6
JH
17734 case "$srand48_r_proto" in
17735 ''|0) try='int srand48_r(long, struct drand48_data*);'
61c26d18 17736 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
10bc17b6
JH
17737 esac
17738 case "$srand48_r_proto" in
90e831dc 17739 ''|0) d_srand48_r=undef
10bc17b6 17740 srand48_r_proto=0
a48ec845 17741 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17742 * ) case "$srand48_r_proto" in
17743 REENTRANT_PROTO*) ;;
17744 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17745 esac
17746 echo "Prototype: $try" ;;
17747 esac
17748 ;;
c18e646a
JH
17749 *) case "$usethreads" in
17750 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17751 esac
90e831dc
SB
17752 d_srand48_r=undef
17753 srand48_r_proto=0
c18e646a 17754 ;;
a48ec845
JH
17755 esac
17756 ;;
10bc17b6
JH
17757*) srand48_r_proto=0
17758 ;;
17759esac
17760
17761: see if srandom_r exists
17762set srandom_r d_srandom_r
17763eval $inlibc
17764case "$d_srandom_r" in
17765"$define")
17766 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17767 case "$d_srandom_r_proto:$usethreads" in
17768 ":define") d_srandom_r_proto=define
a48ec845
JH
17769 set d_srandom_r_proto srandom_r $hdrs
17770 eval $hasproto ;;
17771 *) ;;
17772 esac
17773 case "$d_srandom_r_proto" in
17774 define)
10bc17b6
JH
17775 case "$srandom_r_proto" in
17776 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
61c26d18 17777 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
10bc17b6
JH
17778 esac
17779 case "$srandom_r_proto" in
90e831dc 17780 ''|0) d_srandom_r=undef
10bc17b6 17781 srandom_r_proto=0
a48ec845 17782 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17783 * ) case "$srandom_r_proto" in
17784 REENTRANT_PROTO*) ;;
17785 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17786 esac
17787 echo "Prototype: $try" ;;
17788 esac
17789 ;;
c18e646a
JH
17790 *) case "$usethreads" in
17791 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17792 esac
90e831dc
SB
17793 d_srandom_r=undef
17794 srandom_r_proto=0
c18e646a 17795 ;;
a48ec845
JH
17796 esac
17797 ;;
10bc17b6
JH
17798*) srandom_r_proto=0
17799 ;;
17800esac
17801
eef837ea
JH
17802: see if prototype for setresgid is available
17803echo " "
17804set d_sresgproto setresgid $i_unistd unistd.h
17805eval $hasproto
17806
640374d0
JH
17807: see if prototype for setresuid is available
17808echo " "
17809set d_sresuproto setresuid $i_unistd unistd.h
17810eval $hasproto
17811
b4eb6b3d
JH
17812: see if sys/stat.h is available
17813set sys/stat.h i_sysstat
17814eval $inhdr
17815
b4eb6b3d
JH
17816: see if stat knows about block sizes
17817echo " "
17818echo "Checking to see if your struct stat has st_blocks field..." >&4
17819set d_statblks stat st_blocks $i_sysstat sys/stat.h
17820eval $hasfield
17821
b4eb6b3d
JH
17822: see if this is a sys/vfs.h system
17823set sys/vfs.h i_sysvfs
17824eval $inhdr
17825
b4eb6b3d
JH
17826: see if this is a sys/statfs.h system
17827set sys/statfs.h i_sysstatfs
17828eval $inhdr
17829
34f1896b 17830: Check for statfs_s
b4eb6b3d
JH
17831echo " "
17832echo "Checking to see if your system supports struct statfs..." >&4
17833set 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
17834eval $hasstruct
17835case "$d_statfs_s" in
17836"$define") echo "Yes, it does." ;;
17837*) echo "No, it doesn't." ;;
17838esac
17839
17840
b4eb6b3d
JH
17841: see if struct statfs knows about f_flags
17842case "$d_statfs_s" in
34f1896b 17843define)
b4eb6b3d
JH
17844 echo " "
17845 echo "Checking to see if your struct statfs has f_flags field..." >&4
17846 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
17847 eval $hasfield
17848 ;;
17849*) val="$undef"
17850 set d_statfs_f_flags
17851 eval $setvar
17852 ;;
17853esac
17854case "$d_statfs_f_flags" in
17855"$define") echo "Yes, it does." ;;
17856*) echo "No, it doesn't." ;;
17857esac
17858
17a6c8e3
AD
17859: see what flavor, if any, of static inline is supported
17860echo " "
17861echo "Checking to see if your system supports static inline..."
17862$cat > try.c <<'EOCP'
17863#include <stdlib.h>
17864extern int f_via_a(int x);
17865extern int f_via_b(int x);
17866int main(int argc, char **argv)
17867{
17868 int y;
17869
17870 y = f_via_a(0);
17871#ifdef USE_B
17872 y = f_via_b(0);
17873#endif
17874 if (y == 42) {
17875 return EXIT_SUCCESS;
17876 }
17877 else {
17878 return EXIT_FAILURE;
17879 }
17880}
17881EOCP
17882$cat > a.c <<'EOCP'
17883static INLINE int f(int x) {
17884 int y;
17885 y = x + 42;
17886 return y;
17887}
17888
17889int f_via_a(int x)
17890{
17891 return f(x);
17892}
17893EOCP
17894$cat > b.c <<'EOCP'
17895extern int f(int x);
17896
17897int f_via_b(int x)
17898{
17899 return f(x);
17900}
17901EOCP
17902
17903# Respect a hint (or previous) value for perl_static_inline, if there is one.
17904case "$perl_static_inline" in
17905'') # Check the various possibilities, and break out on success.
17906 # For gcc, prefer __inline__, which will still permit
17907 # cflags.SH to add in -ansi.
17908 case "$gccversion" in
17909 '') xxx="inline __inline__ __inline _inline";;
17910 *) xxx="__inline__ inline __inline _inline";;
17911 esac
17912 for inline in $xxx; do
17913 set try -DINLINE=$inline a.c
17914 if eval $compile && $run ./try; then
17915 # Now make sure there is no external linkage of static
17916 # functions
17917 set try -DINLINE=$inline -DUSE_B a.c b.c
17918 if eval $compile && $run ./try; then
17919 $echo "Your compiler supports static $inline, " >&4
17920 $echo "but it also creates an external definition," >&4
17921 $echo "so I won't use it." >&4
17922 val=$undef
17923 else
17924 $echo "Your compiler supports static $inline." >&4
17925 val=$define
17926 perl_static_inline="static $inline";
17927 break;
17928 fi
17929 else
17930 $echo "Your compiler does NOT support static $inline." >&4
17931 val="$undef"
17932 fi
17933 done
17934 ;;
17935*inline*) # Some variant of inline exists.
17936 echo "Keeping your $hint value of $perl_static_inline."
17937 val=$define
17938 ;;
17939static) # No inline capabilities
17940 echo "Keeping your $hint value of $perl_static_inline."
17941 val=$undef
17942 ;;
17943*) # Unrecognized previous value -- blindly trust the supplied
17944 # value and hope it makes sense. Use old value for
17945 # d_static_inline, if there is one.
17946 echo "Keeping your $hint value of $perl_static_inline."
17947 case "$d_static_inline" in
17948 '') val=$define ;;
17949 *) val=$d_static_inline ;;
17950 esac
17951 ;;
17952esac
17953# Fallback to plain 'static' if nothing worked.
17954case "$perl_static_inline" in
17955'')
17956 perl_static_inline="static"
17957 val=$undef
17958 ;;
17959esac
17960set d_static_inline
17961eval $setvar
17962$rm -f a.[co] b.[co]
17963$rm_try
17964
613d6c3e 17965: Check stream access
b4eb6b3d
JH
17966$cat >&4 <<EOM
17967Checking how to access stdio streams by file descriptor number...
17968EOM
17969case "$stdio_stream_array" in
17970'') $cat >try.c <<EOCP
17971#include <stdio.h>
17972int main() {
17973 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17974 printf("yes\n");
17975}
17976EOCP
17977 for s in _iob __iob __sF
17978 do
17979 set try -DSTDIO_STREAM_ARRAY=$s
17980 if eval $compile; then
5440bc8e 17981 case "`$run ./try`" in
b4eb6b3d
JH
17982 yes) stdio_stream_array=$s; break ;;
17983 esac
17984 fi
17985 done
5b813a60 17986 $rm_try
b4eb6b3d
JH
17987esac
17988case "$stdio_stream_array" in
17989'') $cat >&4 <<EOM
17990I can't figure out how to access stdio streams by file descriptor number.
17991EOM
17992 d_stdio_stream_array="$undef"
17993 ;;
17994*) $cat >&4 <<EOM
17995You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17996EOM
17997 d_stdio_stream_array="$define"
17998 ;;
17999esac
18000
18001: see if strcoll exists
18002set strcoll d_strcoll
18003eval $inlibc
18004
18005: check for structure copying
18006echo " "
18007echo "Checking to see if your C compiler can copy structs..." >&4
18008$cat >try.c <<'EOCP'
76f47787 18009int main()
b4eb6b3d
JH
18010{
18011 struct blurfl {
18012 int dyick;
18013 } foo, bar;
18014
18015 foo = bar;
18016}
18017EOCP
18018if $cc -c try.c >/dev/null 2>&1 ; then
18019 val="$define"
18020 echo "Yup, it can."
18021else
18022 val="$undef"
18023 echo "Nope, it can't."
18024fi
18025set d_strctcpy
18026eval $setvar
5b813a60 18027$rm_try
b4eb6b3d
JH
18028
18029: see if strerror and/or sys_errlist[] exist
18030echo " "
18031if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18032 if set strerror val -f d_strerror; eval $csym; $val; then
18033 echo 'strerror() found.' >&4
18034 d_strerror="$define"
18035 d_strerrm='strerror(e)'
18036 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18037 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18038 d_syserrlst="$define"
18039 else
18040 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18041 d_syserrlst="$undef"
18042 fi
18043 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18044 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18045 echo 'strerror() found in string header.' >&4
18046 d_strerror="$define"
18047 d_strerrm='strerror(e)'
18048 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18049 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18050 d_syserrlst="$define"
18051 else
18052 echo "(You don't appear to have any sys_errlist[], how can this be?)"
18053 d_syserrlst="$undef"
18054 fi
18055 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18056 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18057 d_strerror="$undef"
18058 d_syserrlst="$define"
18059 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18060 else
18061 echo 'strerror() and sys_errlist[] NOT found.' >&4
18062 d_strerror="$undef"
18063 d_syserrlst="$undef"
18064 d_strerrm='"unknown"'
18065 fi
18066fi
18067
10bc17b6
JH
18068: see if strerror_r exists
18069set strerror_r d_strerror_r
18070eval $inlibc
18071case "$d_strerror_r" in
18072"$define")
18073 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
18074 case "$d_strerror_r_proto:$usethreads" in
18075 ":define") d_strerror_r_proto=define
a48ec845
JH
18076 set d_strerror_r_proto strerror_r $hdrs
18077 eval $hasproto ;;
18078 *) ;;
18079 esac
18080 case "$d_strerror_r_proto" in
18081 define)
10bc17b6
JH
18082 case "$strerror_r_proto" in
18083 ''|0) try='int strerror_r(int, char*, size_t);'
61c26d18 18084 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
10bc17b6
JH
18085 esac
18086 case "$strerror_r_proto" in
18087 ''|0) try='int strerror_r(int, char*, int);'
61c26d18 18088 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
10bc17b6
JH
18089 esac
18090 case "$strerror_r_proto" in
18091 ''|0) try='char* strerror_r(int, char*, size_t);'
61c26d18 18092 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
10bc17b6
JH
18093 esac
18094 case "$strerror_r_proto" in
90e831dc 18095 ''|0) d_strerror_r=undef
10bc17b6 18096 strerror_r_proto=0
a48ec845 18097 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18098 * ) case "$strerror_r_proto" in
18099 REENTRANT_PROTO*) ;;
18100 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18101 esac
18102 echo "Prototype: $try" ;;
18103 esac
18104 ;;
c18e646a
JH
18105 *) case "$usethreads" in
18106 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18107 esac
90e831dc
SB
18108 d_strerror_r=undef
18109 strerror_r_proto=0
c18e646a 18110 ;;
a48ec845
JH
18111 esac
18112 ;;
10bc17b6
JH
18113*) strerror_r_proto=0
18114 ;;
18115esac
18116
b3c85772
JH
18117: see if strftime exists
18118set strftime d_strftime
18119eval $inlibc
18120
08c92000
MB
18121: see if strlcat exists
18122set strlcat d_strlcat
18123eval $inlibc
18124
18125: see if strlcpy exists
18126set strlcpy d_strlcpy
18127eval $inlibc
18128
b4eb6b3d
JH
18129: see if strtod exists
18130set strtod d_strtod
18131eval $inlibc
18132
18133: see if strtol exists
18134set strtol d_strtol
18135eval $inlibc
18136
18137: see if strtold exists
18138set strtold d_strtold
18139eval $inlibc
18140
18141: see if strtoll exists
18142set strtoll d_strtoll
18143eval $inlibc
18144
18145case "$d_longlong-$d_strtoll" in
18146"$define-$define")
18147 $cat <<EOM
18148Checking whether your strtoll() works okay...
18149EOM
18150 $cat >try.c <<'EOCP'
18151#include <errno.h>
18152#ifdef __hpux
18153#define strtoll __strtoll
18154#endif
e75931a7
YST
18155#ifdef __EMX__
18156#define strtoll _strtoll
18157#endif
b4eb6b3d 18158#include <stdio.h>
613d6c3e 18159extern long long int strtoll(char *s, char **, int);
b4eb6b3d
JH
18160static int bad = 0;
18161int check(char *s, long long ell, int een) {
18162 long long gll;
18163 errno = 0;
18164 gll = strtoll(s, 0, 10);
18165 if (!((gll == ell) && (errno == een)))
18166 bad++;
18167}
18168int main() {
18169 check(" 1", 1LL, 0);
18170 check(" 0", 0LL, 0);
18171 check("-1", -1LL, 0);
18172 check("-9223372036854775808", -9223372036854775808LL, 0);
18173 check("-9223372036854775808", -9223372036854775808LL, 0);
18174 check(" 9223372036854775807", 9223372036854775807LL, 0);
18175 check("-9223372036854775808", -9223372036854775808LL, 0);
18176 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
18177 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18178 if (!bad)
18179 printf("ok\n");
18180}
18181EOCP
18182 set try
18183 if eval $compile; then
5440bc8e 18184 yyy=`$run ./try`
e75931a7 18185 case "$yyy" in
b4eb6b3d
JH
18186 ok) echo "Your strtoll() seems to be working okay." ;;
18187 *) cat <<EOM >&4
18188Your strtoll() doesn't seem to be working okay.
18189EOM
18190 d_strtoll="$undef"
18191 ;;
69eadf66 18192 esac
e75931a7
YST
18193 else
18194 echo "(I can't seem to compile the test program--assuming it doesn't)"
18195 d_strtoll="$undef"
b4eb6b3d
JH
18196 fi
18197 ;;
18198esac
18199
28e5dec8
JH
18200: see if strtoq exists
18201set strtoq d_strtoq
18202eval $inlibc
18203
b4eb6b3d
JH
18204: see if strtoul exists
18205set strtoul d_strtoul
18206eval $inlibc
18207
d0e6d399
NC
18208case "$d_strtoul" in
18209"$define")
18210 $cat <<EOM
18211Checking whether your strtoul() works okay...
18212EOM
18213 $cat >try.c <<'EOCP'
18214#include <errno.h>
18215#include <stdio.h>
613d6c3e 18216extern unsigned long int strtoul(char *s, char **, int);
d0e6d399
NC
18217static int bad = 0;
18218void check(char *s, unsigned long eul, int een) {
18219 unsigned long gul;
18220 errno = 0;
18221 gul = strtoul(s, 0, 10);
18222 if (!((gul == eul) && (errno == een)))
18223 bad++;
18224}
18225int main() {
18226 check(" 1", 1L, 0);
18227 check(" 0", 0L, 0);
18228EOCP
18229 case "$longsize" in
18230 8)
18231 $cat >>try.c <<'EOCP'
09c0d2c4
JH
18232 check("18446744073709551615", 18446744073709551615UL, 0);
18233 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 18234#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 18235 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
18236 check("-18446744073709551614", 2, 0);
18237 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
18238 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18239 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 18240#endif
d0e6d399
NC
18241EOCP
18242 ;;
18243 4)
18244 $cat >>try.c <<'EOCP'
18245 check("4294967295", 4294967295UL, 0);
18246 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 18247#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
18248 check("-1", 4294967295UL, 0);
18249 check("-4294967294", 2, 0);
18250 check("-4294967295", 1, 0);
18251 check("-4294967296", 4294967295UL, ERANGE);
18252 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 18253#endif
d0e6d399
NC
18254EOCP
18255 ;;
18256 *)
18257: Should we write these tests to be more portable by sprintf-ing
18258: ~0 and then manipulating that char string as input for strtol?
18259 ;;
18260 esac
18261 $cat >>try.c <<'EOCP'
18262 if (!bad)
18263 printf("ok\n");
18264 return 0;
18265}
18266EOCP
18267 set try
18268 if eval $compile; then
5440bc8e 18269 case "`$run ./try`" in
d0e6d399
NC
18270 ok) echo "Your strtoul() seems to be working okay." ;;
18271 *) cat <<EOM >&4
18272Your strtoul() doesn't seem to be working okay.
18273EOM
18274 d_strtoul="$undef"
18275 ;;
18276 esac
9597a80f
NC
18277 else
18278 echo "(I can't seem to compile the test program--assuming it doesn't)"
18279 d_strtoul="$undef"
d0e6d399
NC
18280 fi
18281 ;;
18282esac
18283
b4eb6b3d
JH
18284: see if strtoull exists
18285set strtoull d_strtoull
18286eval $inlibc
18287
18288case "$d_longlong-$d_strtoull" in
18289"$define-$define")
18290 $cat <<EOM
18291Checking whether your strtoull() works okay...
18292EOM
18293 $cat >try.c <<'EOCP'
18294#include <errno.h>
18295#ifdef __hpux
18296#define strtoull __strtoull
18297#endif
18298#include <stdio.h>
613d6c3e 18299extern unsigned long long int strtoull(char *s, char **, int);
b4eb6b3d
JH
18300static int bad = 0;
18301int check(char *s, long long eull, int een) {
18302 long long gull;
18303 errno = 0;
18304 gull = strtoull(s, 0, 10);
18305 if (!((gull == eull) && (errno == een)))
18306 bad++;
18307}
18308int main() {
d0e6d399
NC
18309 check(" 1", 1LL, 0);
18310 check(" 0", 0LL, 0);
18311 check("18446744073709551615", 18446744073709551615ULL, 0);
18312 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18313#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
18314 check("-1", 18446744073709551615ULL, 0);
18315 check("-18446744073709551614", 2LL, 0);
18316 check("-18446744073709551615", 1LL, 0);
18317 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18318 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18319#endif
b4eb6b3d
JH
18320 if (!bad)
18321 printf("ok\n");
18322}
18323EOCP
18324 set try
18325 if eval $compile; then
5440bc8e 18326 case "`$run ./try`" in
b4eb6b3d
JH
18327 ok) echo "Your strtoull() seems to be working okay." ;;
18328 *) cat <<EOM >&4
18329Your strtoull() doesn't seem to be working okay.
18330EOM
18331 d_strtoull="$undef"
18332 ;;
18333 esac
9597a80f
NC
18334 else
18335 echo "(I can't seem to compile the test program--assuming it doesn't)"
18336 d_strtoull="$undef"
b4eb6b3d
JH
18337 fi
18338 ;;
18339esac
18340
18341: see if strtouq exists
18342set strtouq d_strtouq
18343eval $inlibc
18344
d0e6d399
NC
18345case "$d_strtouq" in
18346"$define")
18347 $cat <<EOM
18348Checking whether your strtouq() works okay...
18349EOM
18350 $cat >try.c <<'EOCP'
18351#include <errno.h>
18352#include <stdio.h>
613d6c3e 18353extern unsigned long long int strtouq(char *s, char **, int);
d0e6d399
NC
18354static int bad = 0;
18355void check(char *s, unsigned long long eull, int een) {
18356 unsigned long long gull;
18357 errno = 0;
18358 gull = strtouq(s, 0, 10);
18359 if (!((gull == eull) && (errno == een)))
18360 bad++;
18361}
18362int main() {
18363 check(" 1", 1LL, 0);
18364 check(" 0", 0LL, 0);
18365 check("18446744073709551615", 18446744073709551615ULL, 0);
18366 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18367#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
18368 check("-1", 18446744073709551615ULL, 0);
18369 check("-18446744073709551614", 2LL, 0);
18370 check("-18446744073709551615", 1LL, 0);
18371 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18372 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18373#endif
d0e6d399
NC
18374 if (!bad)
18375 printf("ok\n");
18376 return 0;
18377}
18378EOCP
18379 set try
18380 if eval $compile; then
5440bc8e 18381 case "`$run ./try`" in
d0e6d399
NC
18382 ok) echo "Your strtouq() seems to be working okay." ;;
18383 *) cat <<EOM >&4
18384Your strtouq() doesn't seem to be working okay.
18385EOM
18386 d_strtouq="$undef"
18387 ;;
18388 esac
9597a80f
NC
18389 else
18390 echo "(I can't seem to compile the test program--assuming it doesn't)"
18391 d_strtouq="$undef"
d0e6d399
NC
18392 fi
18393 ;;
18394esac
18395
b4eb6b3d
JH
18396: see if strxfrm exists
18397set strxfrm d_strxfrm
18398eval $inlibc
18399
18400: see if symlink exists
18401set symlink d_symlink
18402eval $inlibc
18403
18404: see if syscall exists
18405set syscall d_syscall
18406eval $inlibc
18407
2ef53570
JH
18408: see if prototype for syscall is available
18409echo " "
18410set d_syscallproto syscall $i_unistd unistd.h
18411eval $hasproto
18412
b4eb6b3d
JH
18413: see if sysconf exists
18414set sysconf d_sysconf
18415eval $inlibc
18416
18417: see if system exists
18418set system d_system
18419eval $inlibc
18420
18421: see if tcgetpgrp exists
18422set tcgetpgrp d_tcgetpgrp
18423eval $inlibc
18424
18425: see if tcsetpgrp exists
18426set tcsetpgrp d_tcsetpgrp
18427eval $inlibc
18428
18429: see if prototype for telldir is available
18430echo " "
18431set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18432eval $hasproto
18433
ad493445
MB
18434: see if time exists
18435echo " "
18436if test "X$d_time" = X -o X"$timetype" = X; then
18437 if set time val -f d_time; eval $csym; $val; then
18438 echo 'time() found.' >&4
18439 val="$define"
18440 rp="What is the type returned by time() on this system?"
18441 set time_t timetype long stdio.h sys/types.h
18442 eval $typedef_ask
18443 else
18444 echo 'time() not found, hope that will do.' >&4
18445 val="$undef"
18446 timetype='int';
18447 fi
18448 set d_time
18449 eval $setvar
18450fi
18451
cbb9e8a7
MB
18452: see if timegm exists
18453set timegm d_timegm
18454eval $inlibc
18455
b4eb6b3d
JH
18456: see if this is a sys/times.h system
18457set sys/times.h i_systimes
18458eval $inhdr
18459
18460: see if times exists
18461echo " "
18462if set times val -f d_times; eval $csym; $val; then
18463 echo 'times() found.' >&4
18464 d_times="$define"
18465 inc=''
18466 case "$i_systimes" in
18467 "$define") inc='sys/times.h';;
18468 esac
18469 rp="What is the type returned by times() on this system?"
18470 set clock_t clocktype long stdio.h sys/types.h $inc
18471 eval $typedef_ask
18472else
18473 echo 'times() NOT found, hope that will do.' >&4
18474 d_times="$undef"
18475 clocktype='int'
18476fi
18477
10bc17b6
JH
18478: see if tmpnam_r exists
18479set tmpnam_r d_tmpnam_r
18480eval $inlibc
18481case "$d_tmpnam_r" in
18482"$define")
31ee0cb7 18483 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
18484 case "$d_tmpnam_r_proto:$usethreads" in
18485 ":define") d_tmpnam_r_proto=define
a48ec845
JH
18486 set d_tmpnam_r_proto tmpnam_r $hdrs
18487 eval $hasproto ;;
18488 *) ;;
18489 esac
18490 case "$d_tmpnam_r_proto" in
18491 define)
10bc17b6
JH
18492 case "$tmpnam_r_proto" in
18493 ''|0) try='char* tmpnam_r(char*);'
61c26d18 18494 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
10bc17b6
JH
18495 esac
18496 case "$tmpnam_r_proto" in
90e831dc 18497 ''|0) d_tmpnam_r=undef
10bc17b6 18498 tmpnam_r_proto=0
a48ec845 18499 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18500 * ) case "$tmpnam_r_proto" in
18501 REENTRANT_PROTO*) ;;
18502 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18503 esac
18504 echo "Prototype: $try" ;;
18505 esac
18506 ;;
c18e646a
JH
18507 *) case "$usethreads" in
18508 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18509 esac
90e831dc
SB
18510 d_tmpnam_r=undef
18511 tmpnam_r_proto=0
c18e646a 18512 ;;
a48ec845
JH
18513 esac
18514 ;;
10bc17b6
JH
18515*) tmpnam_r_proto=0
18516 ;;
18517esac
18518
b4eb6b3d
JH
18519: see if truncate exists
18520set truncate d_truncate
18521eval $inlibc
18522
10bc17b6
JH
18523: see if ttyname_r exists
18524set ttyname_r d_ttyname_r
18525eval $inlibc
18526case "$d_ttyname_r" in
18527"$define")
18528 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
18529 case "$d_ttyname_r_proto:$usethreads" in
18530 ":define") d_ttyname_r_proto=define
a48ec845
JH
18531 set d_ttyname_r_proto ttyname_r $hdrs
18532 eval $hasproto ;;
18533 *) ;;
18534 esac
18535 case "$d_ttyname_r_proto" in
18536 define)
10bc17b6
JH
18537 case "$ttyname_r_proto" in
18538 ''|0) try='int ttyname_r(int, char*, size_t);'
61c26d18 18539 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
10bc17b6
JH
18540 esac
18541 case "$ttyname_r_proto" in
18542 ''|0) try='int ttyname_r(int, char*, int);'
61c26d18 18543 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
10bc17b6
JH
18544 esac
18545 case "$ttyname_r_proto" in
18546 ''|0) try='char* ttyname_r(int, char*, int);'
61c26d18 18547 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
10bc17b6
JH
18548 esac
18549 case "$ttyname_r_proto" in
90e831dc 18550 ''|0) d_ttyname_r=undef
10bc17b6 18551 ttyname_r_proto=0
a48ec845 18552 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18553 * ) case "$ttyname_r_proto" in
18554 REENTRANT_PROTO*) ;;
18555 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18556 esac
18557 echo "Prototype: $try" ;;
18558 esac
18559 ;;
c18e646a
JH
18560 *) case "$usethreads" in
18561 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18562 esac
90e831dc
SB
18563 d_ttyname_r=undef
18564 ttyname_r_proto=0
c18e646a 18565 ;;
a48ec845
JH
18566 esac
18567 ;;
10bc17b6
JH
18568*) ttyname_r_proto=0
18569 ;;
18570esac
18571
b4eb6b3d
JH
18572: see if tzname[] exists
18573echo " "
18574if set tzname val -a d_tzname; eval $csym; $val; then
18575 val="$define"
18576 echo 'tzname[] found.' >&4
18577else
18578 val="$undef"
18579 echo 'tzname[] NOT found.' >&4
18580fi
18581set d_tzname
18582eval $setvar
18583
613d6c3e 18584: Check if is a multiplatform env
4e0554ec
JH
18585case "$osname" in
18586next|rhapsody|darwin) multiarch="$define" ;;
18587esac
18588case "$multiarch" in
18589''|[nN]*) multiarch="$undef" ;;
18590esac
18591
24412007 18592: check for ordering of bytes in a UV
4e0554ec 18593echo " "
5440bc8e 18594case "$usecrosscompile$multiarch" in
4e0554ec
JH
18595*$define*)
18596 $cat <<EOM
18597You seem to be either cross-compiling or doing a multiarchitecture build,
18598skipping the byteorder check.
18599
18600EOM
5440bc8e 18601 byteorder='ffff'
4e0554ec
JH
18602 ;;
18603*)
18604 case "$byteorder" in
18605 '')
18606 $cat <<'EOM'
18607In the following, larger digits indicate more significance. A big-endian
18608machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18609little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18610machines may have weird orders like 3412. A Cray will report 87654321,
18611an Alpha will report 12345678. If the test program works the default is
18612probably right.
18613I'm now running the test program...
18614EOM
24412007 18615 $cat >try.c <<EOCP
4e0554ec 18616#include <stdio.h>
55954f19
JH
18617#$i_stdlib I_STDLIB
18618#ifdef I_STDLIB
18619#include <stdlib.h>
18620#endif
24412007
JH
18621#include <sys/types.h>
18622typedef $uvtype UV;
4e0554ec
JH
18623int main()
18624{
18625 int i;
18626 union {
24412007
JH
18627 UV l;
18628 char c[$uvsize];
4e0554ec
JH
18629 } u;
18630
24412007 18631 if ($uvsize > 4)
b5ded3e5 18632 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18633 else
a4c53327 18634 u.l = (UV)0x04030201;
24412007 18635 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18636 printf("%c", u.c[i]+'0');
18637 printf("\n");
18638 exit(0);
18639}
18640EOCP
18641 xxx_prompt=y
18642 set try
43dddb59 18643 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18644 dflt=`$run ./try`
4e0554ec
JH
18645 case "$dflt" in
18646 [1-4][1-4][1-4][1-4]|12345678|87654321)
18647 echo "(The test program ran ok.)"
18648 echo "byteorder=$dflt"
18649 xxx_prompt=n
18650 ;;
18651 ????|????????) echo "(The test program ran ok.)" ;;
18652 *) echo "(The test program didn't run right for some reason.)" ;;
18653 esac
18654 else
18655 dflt='4321'
18656 cat <<'EOM'
18657(I can't seem to compile the test program. Guessing big-endian...)
18658EOM
18659 fi
18660 case "$xxx_prompt" in
18661 y)
24412007 18662 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18663 . ./myread
18664 byteorder="$ans"
18665 ;;
18666 *) byteorder=$dflt
18667 ;;
18668 esac
18669 ;;
18670 esac
5b813a60 18671 $rm_try
4e0554ec
JH
18672 ;;
18673esac
18674
cd95ead5 18675: Checking 32bit alignedness
4e0554ec
JH
18676$cat <<EOM
18677
18678Checking to see whether you can access character data unalignedly...
18679EOM
dc7b0a4f
JH
18680case "$d_u32align" in
18681'') $cat >try.c <<EOCP
4e0554ec 18682#include <stdio.h>
d1daaddf
JH
18683#$i_stdlib I_STDLIB
18684#ifdef I_STDLIB
18685#include <stdlib.h>
18686#endif
4e0554ec 18687#define U32 $u32type
d308175a
JH
18688#define BYTEORDER 0x$byteorder
18689#define U8 $u8type
9958dc3c
JH
18690#include <signal.h>
18691#ifdef SIGBUS
7090f861 18692$signal_t bletch(int s) { exit(4); }
9958dc3c 18693#endif
4e0554ec
JH
18694int main() {
18695#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
f1c7503b
MB
18696 volatile U8 buf[8];
18697 volatile U32 *up;
4e0554ec
JH
18698 int i;
18699
18700 if (sizeof(U32) != 4) {
18701 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18702 exit(1);
18703 }
18704
18705 fflush(stdout);
18706
9958dc3c
JH
18707#ifdef SIGBUS
18708 signal(SIGBUS, bletch);
18709#endif
18710
8906a23e
JH
18711 buf[0] = 0;
18712 buf[1] = 0;
18713 buf[2] = 0;
18714 buf[3] = 1;
7eac3fd6 18715 buf[4] = 0;
8906a23e
JH
18716 buf[5] = 0;
18717 buf[6] = 0;
7eac3fd6 18718 buf[7] = 1;
8906a23e 18719
4e0554ec
JH
18720 for (i = 0; i < 4; i++) {
18721 up = (U32*)(buf + i);
18722 if (! ((*up == 1 << (8*i)) || /* big-endian */
18723 (*up == 1 << (8*(3-i))) /* little-endian */
18724 )
18725 )
18726 {
18727 printf("read failed (%x)\n", *up);
18728 exit(2);
18729 }
18730 }
18731
18732 /* write test */
18733 for (i = 0; i < 4; i++) {
18734 up = (U32*)(buf + i);
18735 *up = 0xBeef;
18736 if (*up != 0xBeef) {
18737 printf("write failed (%x)\n", *up);
18738 exit(3);
18739 }
18740 }
18741
18742 exit(0);
18743#else
18744 printf("1\n");
18745 exit(1);
18746#endif
18747 return 0;
18748}
18749EOCP
18750set try
18751if eval $compile_ok; then
d308175a 18752 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18753 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18754 case "$?" in
18755 0) cat >&4 <<EOM
18756You can access character data pretty unalignedly.
18757EOM
18758 d_u32align="$undef"
18759 ;;
18760 *) cat >&4 <<EOM
18761It seems that you must access character data in an aligned manner.
18762EOM
18763 d_u32align="$define"
18764 ;;
18765 esac
4e0554ec
JH
18766else
18767 rp='Can you access character data at unaligned addresses?'
18768 dflt='n'
18769 . ./myread
18770 case "$ans" in
18771 [yY]*) d_u32align="$undef" ;;
18772 *) d_u32align="$define" ;;
18773 esac
18774fi
5b813a60 18775$rm_try
dc7b0a4f
JH
18776;;
18777esac
4e0554ec
JH
18778
18779: see if ualarm exists
18780set ualarm d_ualarm
18781eval $inlibc
18782
b4eb6b3d
JH
18783: see if umask exists
18784set umask d_umask
18785eval $inlibc
18786
758a5d79
JH
18787: see if unordered exists
18788set unordered d_unordered
18789eval $inlibc
18790
bdf33aa7
SP
18791: see if unsetenv exists
18792set unsetenv d_unsetenv
18793eval $inlibc
18794
4e0554ec
JH
18795: see if usleep exists
18796set usleep d_usleep
18797eval $inlibc
18798
2ef53570
JH
18799: see if prototype for usleep is available
18800echo " "
18801set d_usleepproto usleep $i_unistd unistd.h
18802eval $hasproto
18803
b4eb6b3d
JH
18804: see if ustat exists
18805set ustat d_ustat
18806eval $inlibc
18807
b4eb6b3d
JH
18808: see if closedir exists
18809set closedir d_closedir
18810eval $inlibc
18811
18812case "$d_closedir" in
18813"$define")
18814 echo " "
18815 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18816 cat > try.c <<EOM
b4eb6b3d
JH
18817#$i_dirent I_DIRENT /**/
18818#$i_sysdir I_SYS_DIR /**/
18819#$i_sysndir I_SYS_NDIR /**/
18820#$i_systypes I_SYS_TYPES /**/
18821
18822#if defined(I_SYS_TYPES)
18823#include <sys/types.h>
18824#endif
18825#if defined(I_DIRENT)
18826#include <dirent.h>
18827#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18828#include <sys/dir.h>
18829#endif
18830#else
18831#ifdef I_SYS_NDIR
18832#include <sys/ndir.h>
18833#else
18834#ifdef I_SYS_DIR
18835#ifdef hp9000s500
18836#include <ndir.h> /* may be wrong in the future */
18837#else
18838#include <sys/dir.h>
18839#endif
18840#endif
18841#endif
5b813a60 18842#endif
b4eb6b3d
JH
18843int main() { return closedir(opendir(".")); }
18844EOM
5440bc8e 18845 set try
b4eb6b3d 18846 if eval $compile_ok; then
5440bc8e 18847 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18848 echo "Yes, it does."
18849 val="$undef"
18850 else
18851 echo "No, it doesn't."
18852 val="$define"
18853 fi
18854 else
18855 echo "(I can't seem to compile the test program--assuming it doesn't)"
18856 val="$define"
18857 fi
18858 ;;
18859*)
18860 val="$undef";
18861 ;;
18862esac
18863set d_void_closedir
18864eval $setvar
5b813a60
MB
18865$rm_try
18866
b4eb6b3d
JH
18867: see if there is a wait4
18868set wait4 d_wait4
18869eval $inlibc
18870
18871: see if waitpid exists
18872set waitpid d_waitpid
18873eval $inlibc
18874
18875: see if wcstombs exists
18876set wcstombs d_wcstombs
18877eval $inlibc
18878
18879: see if wctomb exists
18880set wctomb d_wctomb
18881eval $inlibc
18882
4e0554ec
JH
18883: see if writev exists
18884set writev d_writev
18885eval $inlibc
18886
b4eb6b3d
JH
18887: preserve RCS keywords in files with variable substitution, grrr
18888Date='$Date'
18889Id='$Id'
18890Log='$Log'
18891RCSfile='$RCSfile'
18892Revision='$Revision'
18893
b4eb6b3d
JH
18894: check for alignment requirements
18895echo " "
5440bc8e 18896case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18897*$define*)
18898 $cat <<EOM
18899You seem to be either cross-compiling or doing a multiarchitecture build,
18900skipping the memory alignment check.
18901
18902EOM
18903 case "$alignbytes" in
18904 '') alignbytes=8 ;;
18905 esac
18906 ;;
18907*)
18908 case "$alignbytes" in
18909 '') echo "Checking alignment constraints..." >&4
18910 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18911 $cat >try.c <<'EOCP'
18912typedef long double NV;
18913EOCP
18914 else
18915 $cat >try.c <<'EOCP'
18916typedef double NV;
18917EOCP
18918 fi
18919 $cat >>try.c <<'EOCP'
18920#include <stdio.h>
18921struct foobar {
18922 char foo;
18923 NV bar;
18924} try_algn;
18925int main()
18926{
18927 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18928 return(0);
18929}
18930EOCP
18931 set try
18932 if eval $compile_ok; then
5440bc8e 18933 dflt=`$run ./try`
b4eb6b3d
JH
18934 else
18935 dflt='8'
18936 echo "(I can't seem to compile the test program...)"
18937 fi
18938 ;;
18939 *) dflt="$alignbytes"
18940 ;;
18941 esac
18942 rp="Doubles must be aligned on a how-many-byte boundary?"
18943 . ./myread
18944 alignbytes="$ans"
5b813a60 18945 $rm_try
b4eb6b3d
JH
18946 ;;
18947esac
18948
18949
18950: set the base revision
18951baserev=5.0
18952
89c1d914
MB
18953: length of character in bytes. Is always 1, otherwise it isnt C
18954: This used to be a test using sizeof
18955charsize=1
c193ef60
MB
18956
18957: Check for the number of bits in a character
18958case "$charbits" in
18959'') echo "Checking how long a character is (in bits)..." >&4
18960 $cat >try.c <<EOCP
18961#include <stdio.h>
18962int main ()
18963{
18964 int n;
18965 unsigned char c;
18966 for (c = 1, n = 0; c; c <<= 1, n++) ;
18967 printf ("%d\n", n);
18968 return (0);
18969 }
18970EOCP
18971 set try
18972 if eval $compile_ok; then
18973 dflt=`$run ./try`
18974 else
18975 dflt='8'
18976 echo "(I can't seem to compile the test program. Guessing...)"
18977 fi
18978 ;;
18979*)
18980 dflt="$charbits"
18981 ;;
18982esac
18983rp="What is the length of a character (in bits)?"
18984. ./myread
18985charbits="$ans"
18986$rm_try
18987case "$charbits" in
189888) ;;
18989*) cat >&4 << EOM
18990Your system has an unsigned character size of $charbits bits, which
18991is rather unusual (normally it is 8 bits). Perl likely will not work
18992correctly on your system, with subtle bugs in various places.
18993EOM
18994 rp='Do you really want to continue?'
18995 dflt='n'
18996 . ./myread
18997 case "$ans" in
18998 [yY]) echo >&4 "Okay, continuing." ;;
18999 *) exit 1 ;;
19000 esac
19001esac
19002
3099fc99 19003: how do we concatenate cpp tokens here?
b4eb6b3d 19004echo " "
3099fc99 19005echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
19006$cat >cpp_stuff.c <<'EOCP'
19007#define RCAT(a,b)a/**/b
19008#define ACAT(a,b)a ## b
19009RCAT(Rei,ser)
19010ACAT(Cir,cus)
19011EOCP
19012$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19013if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19014 echo "Oh! Smells like ANSI's been here." >&4
19015 echo "We can catify or stringify, separately or together!"
19016 cpp_stuff=42
19017elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19018 echo "Ah, yes! The good old days!" >&4
19019 echo "However, in the good old days we don't know how to stringify and"
19020 echo "catify at the same time."
19021 cpp_stuff=1
19022else
19023 $cat >&4 <<EOM
3099fc99
CW
19024Hmm, I don't seem to be able to concatenate tokens with your cpp.
19025You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
19026EOM
19027 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19028fi
19029$rm -f cpp_stuff.*
19030
19031: see if this is a db.h system
19032set db.h i_db
19033eval $inhdr
19034
19035case "$i_db" in
19036$define)
19037 : Check db version.
19038 echo " "
19039 echo "Checking Berkeley DB version ..." >&4
19040 $cat >try.c <<EOCP
19041#$d_const HASCONST
19042#ifndef HASCONST
19043#define const
19044#endif
19045#include <sys/types.h>
19046#include <stdio.h>
55954f19
JH
19047#$i_stdlib I_STDLIB
19048#ifdef I_STDLIB
19049#include <stdlib.h>
19050#endif
b4eb6b3d 19051#include <db.h>
640374d0 19052int main(int argc, char *argv[])
b4eb6b3d
JH
19053{
19054#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19055 int Major, Minor, Patch ;
19056 unsigned long Version ;
19057 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
19058 if (argc == 2) {
19059 printf("%d %d %d %d %d %d\n",
19060 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19061 Major, Minor, Patch);
19062 exit(0);
19063 }
19064 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
19065
19066 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19067 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19068 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19069 Major, Minor, Patch) ;
19070
19071 /* check that db.h & libdb are compatible */
19072 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 19073 printf("db.h and libdb are incompatible.\n") ;
5b813a60 19074 exit(3);
b4eb6b3d
JH
19075 }
19076
640374d0 19077 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
19078
19079 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19080 + DB_VERSION_PATCH ;
19081
19082 /* needs to be >= 2.3.4 */
19083 if (Version < 2003004) {
19084 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 19085 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 19086 exit(2);
b4eb6b3d
JH
19087 }
19088
19089 exit(0);
19090#else
19091#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
19092 if (argc == 2) {
19093 printf("1 0 0\n");
19094 exit(0);
19095 }
19096 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
19097 exit(0); /* DB version < 2: the coast is clear. */
19098#else
19099 exit(1); /* <db.h> not Berkeley DB? */
19100#endif
19101#endif
19102}
19103EOCP
19104 set try
5440bc8e 19105 if eval $compile_ok && $run ./try; then
b4eb6b3d 19106 echo 'Looks OK.' >&4
5440bc8e 19107 set `$run ./try 1`
640374d0
JH
19108 db_version_major=$1
19109 db_version_minor=$2
19110 db_version_patch=$3
b4eb6b3d
JH
19111 else
19112 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
19113 i_db=$undef
19114 case " $libs " in
19115 *"-ldb "*)
19116 : Remove db from list of libraries to use
19117 echo "Removing unusable -ldb from library list" >&4
19118 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19119 shift
19120 libs="$*"
19121 echo "libs = $libs" >&4
19122 ;;
19123 esac
19124 fi
5b813a60 19125 $rm_try
b4eb6b3d
JH
19126 ;;
19127esac
19128
19129case "$i_db" in
19130define)
5b813a60 19131 : Check the return type needed for hash
b4eb6b3d
JH
19132 echo " "
19133 echo "Checking return type needed for hash for Berkeley DB ..." >&4
19134 $cat >try.c <<EOCP
19135#$d_const HASCONST
19136#ifndef HASCONST
19137#define const
19138#endif
19139#include <sys/types.h>
19140#include <db.h>
19141
19142#ifndef DB_VERSION_MAJOR
19143u_int32_t hash_cb (ptr, size)
19144const void *ptr;
19145size_t size;
19146{
19147}
19148HASHINFO info;
19149int main()
19150{
19151 info.hash = hash_cb;
19152}
19153#endif
19154EOCP
19155 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19156 if $contains warning try.out >>/dev/null 2>&1 ; then
19157 db_hashtype='int'
19158 else
19159 db_hashtype='u_int32_t'
19160 fi
19161 else
19162 : XXX Maybe we should just give up here.
19163 db_hashtype=u_int32_t
19164 $cat try.out >&4
19165 echo "Help: I can't seem to compile the db test program." >&4
19166 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19167 fi
5b813a60 19168 $rm_try
b4eb6b3d
JH
19169 echo "Your version of Berkeley DB uses $db_hashtype for hash."
19170 ;;
19171*) db_hashtype=u_int32_t
19172 ;;
19173esac
19174case "$i_db" in
19175define)
5b813a60 19176 : Check the return type needed for prefix
b4eb6b3d
JH
19177 echo " "
19178 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19179 cat >try.c <<EOCP
19180#$d_const HASCONST
19181#ifndef HASCONST
19182#define const
19183#endif
19184#include <sys/types.h>
19185#include <db.h>
19186
19187#ifndef DB_VERSION_MAJOR
19188size_t prefix_cb (key1, key2)
19189const DBT *key1;
19190const DBT *key2;
19191{
19192}
19193BTREEINFO info;
19194int main()
19195{
19196 info.prefix = prefix_cb;
19197}
19198#endif
19199EOCP
19200 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19201 if $contains warning try.out >>/dev/null 2>&1 ; then
19202 db_prefixtype='int'
19203 else
19204 db_prefixtype='size_t'
19205 fi
19206 else
19207 db_prefixtype='size_t'
19208 : XXX Maybe we should just give up here.
19209 $cat try.out >&4
19210 echo "Help: I can't seem to compile the db test program." >&4
19211 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19212 fi
5b813a60 19213 $rm_try
b4eb6b3d
JH
19214 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19215 ;;
19216*) db_prefixtype='size_t'
19217 ;;
19218esac
19219
b4eb6b3d
JH
19220: How can we generate normalized random numbers ?
19221echo " "
19222echo "Looking for a random number function..." >&4
19223case "$randfunc" in
19224'')
19225 if set drand48 val -f; eval $csym; $val; then
19226 dflt="drand48"
19227 echo "Good, found drand48()." >&4
19228 elif set random val -f; eval $csym; $val; then
19229 dflt="random"
19230 echo "OK, found random()." >&4
19231 else
19232 dflt="rand"
19233 echo "Yick, looks like I have to use rand()." >&4
19234 fi
19235 echo " "
19236 ;;
19237*)
19238 dflt="$randfunc"
19239 ;;
19240esac
19241cont=true
19242
19243case "$ccflags" in
19244*-Dmy_rand=*|*-Dmy_srand=*)
19245 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19246 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19247 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19248 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19249 ;;
19250esac
19251
19252while $test "$cont"; do
19253 rp="Use which function to generate random numbers?"
19254 . ./myread
19255 if $test "$ans" = "$dflt"; then
19256 : null
19257 else
19258 randbits=''
19259 fi
19260 randfunc="$ans"
19261 if set $ans val -f; eval $csym; $val; then
19262 cont=''
19263 else
19264 dflt=y
19265 rp="I cannot find function $ans. Use that name anyway?"
19266 . ./myread
19267 dflt=rand
19268 case "$ans" in
19269 [yY]*) cont='';;
19270 esac
19271 fi
19272 case "$cont" in
19273 '')
19274 case "$randfunc" in
19275 drand48)
19276 drand01="drand48()"
19277 seedfunc="srand48"
19278 randbits=48
19279 randseedtype=long
19280 ;;
19281 rand|random)
19282 case "$randbits" in
19283 '')
19284echo "Checking to see how many bits your $randfunc() function produces..." >&4
19285 $cat >try.c <<EOCP
19286#$i_unistd I_UNISTD
19287#$i_stdlib I_STDLIB
19288#include <stdio.h>
19289#ifdef I_UNISTD
19290# include <unistd.h>
19291#endif
19292#ifdef I_STDLIB
19293# include <stdlib.h>
19294#endif
19295int main()
19296{
19297 register int i;
19298 register unsigned long tmp;
19299 register unsigned long max = 0L;
19300
19301 for (i = 1000; i; i--) {
19302 tmp = (unsigned long) $randfunc();
19303 if (tmp > max) max = tmp;
19304 }
19305 for (i = 0; max; i++)
19306 max /= 2;
19307 printf("%d\n",i);
19308}
19309EOCP
19310 set try
19311 if eval $compile_ok; then
19312 dflt=`try`
19313 else
19314 dflt='?'
19315 echo "(I can't seem to compile the test program...)"
19316 fi
19317 ;;
19318 *)
19319 dflt="$randbits"
19320 ;;
19321 esac
19322 rp="How many bits does your $randfunc() function produce?"
19323 . ./myread
19324 randbits="$ans"
5b813a60 19325 $rm_try
b4eb6b3d
JH
19326 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19327 seedfunc="s$randfunc"
19328 randseedtype=unsigned
19329 ;;
19330 *)
19331 dflt="31"
19332 rp="How many bits does your $randfunc() function produce?"
19333 . ./myread
19334 randbits="$ans"
19335 seedfunc="s$randfunc"
19336 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19337 if set $seedfunc val -f; eval $csym; $val; then
19338 echo "(Using $seedfunc() to seed random generator)"
19339 else
19340 echo "(Warning: no $seedfunc() to seed random generator)"
19341 seedfunc=rand
19342 fi
19343 randseedtype=unsigned
19344 ;;
19345 esac
19346 ;;
19347 esac
19348done
19349
613d6c3e 19350: Determine if this is an EBCDIC system
b4eb6b3d
JH
19351echo " "
19352echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 19353$cat >try.c <<'EOM'
b4eb6b3d
JH
19354int main()
19355{
19356 if ('M'==0xd4) return 0;
19357 return 1;
19358}
19359EOM
19360
19361val=$undef
5440bc8e 19362set try
b4eb6b3d 19363if eval $compile_ok; then
5440bc8e 19364 if $run ./try; then
b4eb6b3d
JH
19365 echo "You seem to speak EBCDIC." >&4
19366 val="$define"
19367 else
5440bc8e 19368 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
19369 fi
19370else
19371 echo "I'm unable to compile the test program." >&4
19372 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19373fi
5b813a60 19374$rm_try
b4eb6b3d
JH
19375set ebcdic
19376eval $setvar
19377
613d6c3e 19378: Check how to flush
b4eb6b3d
JH
19379echo " "
19380$cat >&4 <<EOM
19381Checking how to flush all pending stdio output...
19382EOM
19383# I only know how to find the first 32 possibly open files on SunOS.
19384# See also hints/sunos_4_1.sh and util.c --AD
19385case "$osname" in
19386sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19387esac
19388$cat >>try.c <<EOCP
19389#include <stdio.h>
55954f19
JH
19390#$i_stdlib I_STDLIB
19391#ifdef I_STDLIB
19392#include <stdlib.h>
19393#endif
b4eb6b3d
JH
19394#$i_unistd I_UNISTD
19395#ifdef I_UNISTD
19396# include <unistd.h>
19397#endif
19398#$d_sysconf HAS_SYSCONF
19399#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19400#ifdef HAS_STDIO_STREAM_ARRAY
19401# define STDIO_STREAM_ARRAY $stdio_stream_array
19402#endif
19403int main() {
5440bc8e
JH
19404 FILE* p;
19405 unlink("try.out");
19406 p = fopen("try.out", "w");
b4eb6b3d
JH
19407#ifdef TRY_FPUTC
19408 fputc('x', p);
19409#else
19410# ifdef TRY_FPRINTF
19411 fprintf(p, "x");
19412# endif
19413#endif
19414#ifdef TRY_FFLUSH_NULL
19415 fflush(NULL);
19416#endif
19417#ifdef TRY_FFLUSH_ALL
19418 {
19419 long open_max = -1;
19420# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19421 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19422# else
19423# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19424 open_max = sysconf(_SC_OPEN_MAX);
19425# else
19426# ifdef FOPEN_MAX
19427 open_max = FOPEN_MAX;
19428# else
19429# ifdef OPEN_MAX
19430 open_max = OPEN_MAX;
19431# else
19432# ifdef _NFILE
19433 open_max = _NFILE;
19434# endif
19435# endif
19436# endif
19437# endif
5b813a60 19438# endif
b4eb6b3d
JH
19439# ifdef HAS_STDIO_STREAM_ARRAY
19440 if (open_max > 0) {
19441 long i;
19442 for (i = 0; i < open_max; i++)
19443 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19444 STDIO_STREAM_ARRAY[i]._file < open_max &&
19445 STDIO_STREAM_ARRAY[i]._flag)
19446 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 19447 }
b4eb6b3d
JH
19448 }
19449# endif
19450#endif
19451 _exit(42);
19452}
19453EOCP
19454: first we have to find out how _not_ to flush
5440bc8e 19455$to try.c
b4eb6b3d
JH
19456if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19457 output=''
19458 set try -DTRY_FPUTC
19459 if eval $compile; then
fbe73d74 19460 $run ./try 2>/dev/null
28f5ac64 19461 code="$?"
5440bc8e 19462 $from try.out
28f5ac64 19463 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19464 output=-DTRY_FPUTC
19465 fi
19466 fi
19467 case "$output" in
19468 '')
19469 set try -DTRY_FPRINTF
b4eb6b3d 19470 if eval $compile; then
fbe73d74 19471 $run ./try 2>/dev/null
28f5ac64 19472 code="$?"
5440bc8e 19473 $from try.out
28f5ac64 19474 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19475 output=-DTRY_FPRINTF
19476 fi
19477 fi
19478 ;;
19479 esac
19480fi
19481: check for fflush NULL behaviour
19482case "$fflushNULL" in
19483'') set try -DTRY_FFLUSH_NULL $output
19484 if eval $compile; then
5440bc8e 19485 $run ./try 2>/dev/null
b4eb6b3d 19486 code="$?"
5440bc8e 19487 $from try.out
b4eb6b3d
JH
19488 if $test -s try.out -a "X$code" = X42; then
19489 fflushNULL="`$cat try.out`"
19490 else
19491 if $test "X$code" != X42; then
19492 $cat >&4 <<EOM
19493(If this test failed, don't worry, we'll try another method shortly.)
19494EOM
19495 fi
19496 fi
19497 fi
2c476adc 19498 $rm -f core try.core core.try.*
b4eb6b3d
JH
19499 case "$fflushNULL" in
19500 x) $cat >&4 <<EOM
19501Your fflush(NULL) works okay for output streams.
19502Let's see if it clobbers input pipes...
19503EOM
19504# As of mid-March 2000 all versions of Solaris appear to have a stdio
19505# bug that improperly flushes the input end of pipes. So we avoid the
19506# autoflush on fork/system/exec support for now. :-(
19507$cat >tryp.c <<EOCP
19508#include <stdio.h>
19509int
19510main(int argc, char **argv)
19511{
19512 char buf[1024];
19513 int i;
19514 char *bp = buf;
19515 while (1) {
19516 while ((i = getc(stdin)) != -1
19517 && (*bp++ = i) != '\n'
19518 && bp < &buf[1024])
19519 /* DO NOTHING */ ;
19520 *bp = '\0';
19521 fprintf(stdout, "%s", buf);
19522 fflush(NULL);
19523 if (i == -1)
19524 return 0;
19525 bp = buf;
19526 }
19527}
19528EOCP
19529 fflushNULL="$define"
19530 set tryp
19531 if eval $compile; then
19532 $rm -f tryp.out
5440bc8e 19533 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19534 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19535 $cat >&4 <<EOM
19536fflush(NULL) seems to behave okay with input streams.
19537EOM
19538 fflushNULL="$define"
19539 else
19540 $cat >&4 <<EOM
19541Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19542EOM
19543 fflushNULL="$undef"
19544 fi
19545 fi
19546 $rm -f core tryp.c tryp.core core.tryp.*
19547 ;;
19548 '') $cat >&4 <<EOM
19549Your fflush(NULL) isn't working (contrary to ANSI C).
19550EOM
19551 fflushNULL="$undef"
19552 ;;
19553 *) $cat >&4 <<EOM
19554Cannot figure out whether your fflush(NULL) works or not.
19555I'm assuming it doesn't (contrary to ANSI C).
19556EOM
19557 fflushNULL="$undef"
19558 ;;
19559 esac
19560 ;;
19561$define|true|[yY]*)
19562 fflushNULL="$define"
19563 ;;
19564*)
19565 fflushNULL="$undef"
19566 ;;
19567esac
19568: check explicit looping only if NULL did not work, and if the pipe
19569: bug does not show up on an explicit flush too
19570case "$fflushNULL" in
19571"$undef")
19572 $cat >tryp.c <<EOCP
19573#include <stdio.h>
19574int
19575main(int argc, char **argv)
19576{
19577 char buf[1024];
19578 int i;
19579 char *bp = buf;
19580 while (1) {
19581 while ((i = getc(stdin)) != -1
19582 && (*bp++ = i) != '\n'
19583 && bp < &buf[1024])
19584 /* DO NOTHING */ ;
19585 *bp = '\0';
19586 fprintf(stdout, "%s", buf);
19587 fflush(stdin);
19588 if (i == -1)
19589 return 0;
19590 bp = buf;
19591 }
19592}
19593EOCP
19594 set tryp
19595 if eval $compile; then
19596 $rm -f tryp.out
5440bc8e 19597 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19598 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19599 $cat >&4 <<EOM
19600Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19601EOM
19602 : now check for fflushall behaviour
19603 case "$fflushall" in
19604 '') set try -DTRY_FFLUSH_ALL $output
19605 if eval $compile; then
19606 $cat >&4 <<EOM
19607(Now testing the other method--but note that this also may fail.)
19608EOM
5440bc8e 19609 $run ./try 2>/dev/null
28f5ac64 19610 code=$?
fbe73d74 19611 $from try.out
28f5ac64 19612 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19613 fflushall="`$cat try.out`"
19614 fi
19615 fi
5b813a60 19616 $rm_try
b4eb6b3d
JH
19617 case "$fflushall" in
19618 x) $cat >&4 <<EOM
19619Whew. Flushing explicitly all the stdio streams works.
19620EOM
19621 fflushall="$define"
19622 ;;
19623 '') $cat >&4 <<EOM
19624Sigh. Flushing explicitly all the stdio streams doesn't work.
19625EOM
19626 fflushall="$undef"
19627 ;;
19628 *) $cat >&4 <<EOM
19629Cannot figure out whether flushing stdio streams explicitly works or not.
19630I'm assuming it doesn't.
19631EOM
19632 fflushall="$undef"
19633 ;;
19634 esac
19635 ;;
19636 "$define"|true|[yY]*)
19637 fflushall="$define"
19638 ;;
19639 *)
19640 fflushall="$undef"
19641 ;;
19642 esac
19643 else
19644 $cat >&4 <<EOM
19645All is futile. Even fflush(stdin) clobbers input pipes!
19646EOM
19647 fflushall="$undef"
19648 fi
19649 else
19650 fflushall="$undef"
19651 fi
19652 $rm -f core tryp.c tryp.core core.tryp.*
19653 ;;
19654*) fflushall="$undef"
19655 ;;
19656esac
19657
19658case "$fflushNULL$fflushall" in
19659undefundef)
19660 $cat <<EOM
19661OK, I give up. I cannot figure out how to flush pending stdio output.
19662We won't be flushing handles at all before fork/exec/popen.
19663EOM
19664 ;;
19665esac
34f1896b 19666$rm_try tryp
b4eb6b3d
JH
19667
19668: Store the full pathname to the ar program for use in the C program
19669: Respect a hint or command line value for full_ar.
19670case "$full_ar" in
19671'') full_ar=$ar ;;
19672esac
19673
19674: Store the full pathname to the sed program for use in the C program
19675full_sed=$sed
19676
19677: see what type gids are declared as in the kernel
19678echo " "
19679echo "Looking for the type for group ids returned by getgid()."
19680set gid_t gidtype xxx stdio.h sys/types.h
19681eval $typedef
19682case "$gidtype" in
19683xxx)
19684 xxx=`./findhdr sys/user.h`
19685 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19686 case $1 in
19687 unsigned) dflt="$1 $2" ;;
19688 *) dflt="$1" ;;
19689 esac
19690 ;;
19691*) dflt="$gidtype";;
19692esac
19693case "$gidtype" in
19694gid_t) echo "gid_t found." ;;
19695*) rp="What is the type for group ids returned by getgid()?"
19696 . ./myread
19697 gidtype="$ans"
19698 ;;
19699esac
19700
613d6c3e 19701: Check the size of GID
b4eb6b3d
JH
19702echo " "
19703case "$gidtype" in
19704*_t) zzz="$gidtype" ;;
19705*) zzz="gid" ;;
19706esac
613d6c3e 19707echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
19708cat > try.c <<EOCP
19709#include <sys/types.h>
19710#include <stdio.h>
d1daaddf
JH
19711#$i_stdlib I_STDLIB
19712#ifdef I_STDLIB
19713#include <stdlib.h>
19714#endif
b4eb6b3d
JH
19715int main() {
19716 printf("%d\n", (int)sizeof($gidtype));
19717 exit(0);
19718}
19719EOCP
19720set try
19721if eval $compile_ok; then
5440bc8e 19722 yyy=`$run ./try`
b4eb6b3d
JH
19723 case "$yyy" in
19724 '') gidsize=4
19725 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19726 ;;
19727 *) gidsize=$yyy
19728 echo "Your $zzz is $gidsize bytes long."
19729 ;;
19730 esac
19731else
19732 gidsize=4
19733 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19734fi
19735
19736
613d6c3e 19737: Check if GID is signed
b4eb6b3d
JH
19738echo " "
19739case "$gidtype" in
19740*_t) zzz="$gidtype" ;;
19741*) zzz="gid" ;;
19742esac
613d6c3e 19743echo "Checking the sign of $zzz..." >&4
b4eb6b3d
JH
19744cat > try.c <<EOCP
19745#include <sys/types.h>
19746#include <stdio.h>
19747int main() {
19748 $gidtype foo = -1;
19749 if (foo < 0)
19750 printf("-1\n");
19751 else
19752 printf("1\n");
19753}
19754EOCP
19755set try
19756if eval $compile; then
5440bc8e 19757 yyy=`$run ./try`
b4eb6b3d
JH
19758 case "$yyy" in
19759 '') gidsign=1
19760 echo "(I can't execute the test program--guessing unsigned.)" >&4
19761 ;;
19762 *) gidsign=$yyy
19763 case "$gidsign" in
19764 1) echo "Your $zzz is unsigned." ;;
19765 -1) echo "Your $zzz is signed." ;;
19766 esac
19767 ;;
19768 esac
19769else
19770 gidsign=1
19771 echo "(I can't compile the test program--guessing unsigned.)" >&4
19772fi
19773
19774
613d6c3e 19775: Check 64bit sizes
b4eb6b3d
JH
19776echo " "
19777
19778if $test X"$quadtype" != X; then
19779
19780echo "Checking how to print 64-bit integers..." >&4
19781
19782if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19783 $cat >try.c <<'EOCP'
19784#include <sys/types.h>
19785#include <stdio.h>
19786int main() {
19787 int q = 12345678901;
19788 printf("%ld\n", q);
19789}
19790EOCP
19791 set try
19792 if eval $compile; then
5440bc8e 19793 yyy=`$run ./try`
b4eb6b3d
JH
19794 case "$yyy" in
19795 12345678901)
19796 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19797 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19798 echo "We will use %d."
19799 ;;
19800 esac
19801 fi
19802fi
19803
19804if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19805 $cat >try.c <<'EOCP'
19806#include <sys/types.h>
19807#include <stdio.h>
19808int main() {
19809 long q = 12345678901;
19810 printf("%ld\n", q);
19811}
19812EOCP
19813 set try
19814 if eval $compile; then
5440bc8e 19815 yyy=`$run ./try`
b4eb6b3d
JH
19816 case "$yyy" in
19817 12345678901)
19818 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19819 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19820 echo "We will use %ld."
19821 ;;
19822 esac
19823 fi
19824fi
19825
19826if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19827 $cat >try.c <<'EOCP'
19828#include <sys/types.h>
19829#include <inttypes.h>
19830#include <stdio.h>
19831int main() {
19832 int64_t q = 12345678901;
19833 printf("%" PRId64 "\n", q);
19834}
19835EOCP
19836 set try
19837 if eval $compile; then
5440bc8e 19838 yyy=`$run ./try`
b4eb6b3d
JH
19839 case "$yyy" in
19840 12345678901)
19841 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19842 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19843 echo "We will use the C9X style."
19844 ;;
19845 esac
19846 fi
19847fi
19848
2ef53570
JH
19849if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19850 $cat >try.c <<EOCP
b4eb6b3d
JH
19851#include <sys/types.h>
19852#include <stdio.h>
19853int main() {
2ef53570
JH
19854 $quadtype q = 12345678901;
19855 printf("%Ld\n", q);
b4eb6b3d
JH
19856}
19857EOCP
19858 set try
19859 if eval $compile; then
5440bc8e 19860 yyy=`$run ./try`
b4eb6b3d
JH
19861 case "$yyy" in
19862 12345678901)
2ef53570
JH
19863 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19864 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19865 echo "We will use %Ld."
b4eb6b3d
JH
19866 ;;
19867 esac
19868 fi
19869fi
19870
2ef53570
JH
19871if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19872 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19873#include <sys/types.h>
19874#include <stdio.h>
19875int main() {
2ef53570
JH
19876 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19877 printf("%lld\n", q);
b4eb6b3d
JH
19878}
19879EOCP
19880 set try
19881 if eval $compile; then
5440bc8e 19882 yyy=`$run ./try`
b4eb6b3d
JH
19883 case "$yyy" in
19884 12345678901)
2ef53570
JH
19885 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19886 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19887 echo "We will use the %lld style."
b4eb6b3d
JH
19888 ;;
19889 esac
19890 fi
19891fi
19892
19893if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19894 $cat >try.c <<EOCP
19895#include <sys/types.h>
19896#include <stdio.h>
19897int main() {
19898 $quadtype q = 12345678901;
19899 printf("%qd\n", q);
19900}
19901EOCP
19902 set try
19903 if eval $compile; then
5440bc8e 19904 yyy=`$run ./try`
b4eb6b3d
JH
19905 case "$yyy" in
19906 12345678901)
19907 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19908 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19909 echo "We will use %qd."
19910 ;;
19911 esac
19912 fi
19913fi
19914
19915if $test X"$sPRId64" = X; then
19916 echo "Cannot figure out how to print 64-bit integers." >&4
19917fi
5b813a60 19918$rm_try
b4eb6b3d
JH
19919
19920fi
19921
19922case "$sPRId64" in
5b813a60
MB
19923'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19924 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 19925 ;;
5b813a60
MB
19926*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19927 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
19928 ;;
19929esac
19930
34f1896b 19931: Check format strings for internal types
b4eb6b3d
JH
19932echo " "
19933$echo "Checking the format strings to be used for Perl's internal types..." >&4
19934
19935if $test X"$ivsize" = X8; then
19936 ivdformat="$sPRId64"
19937 uvuformat="$sPRIu64"
19938 uvoformat="$sPRIo64"
19939 uvxformat="$sPRIx64"
19940 uvXUformat="$sPRIXU64"
19941else
19942 if $test X"$ivsize" = X"$longsize"; then
19943 ivdformat='"ld"'
19944 uvuformat='"lu"'
19945 uvoformat='"lo"'
19946 uvxformat='"lx"'
19947 uvXUformat='"lX"'
19948 else
19949 if $test X"$ivsize" = X"$intsize"; then
19950 ivdformat='"d"'
19951 uvuformat='"u"'
19952 uvoformat='"o"'
19953 uvxformat='"x"'
19954 uvXUformat='"X"'
19955 else
19956 : far out
19957 if $test X"$ivsize" = X"$shortsize"; then
19958 ivdformat='"hd"'
19959 uvuformat='"hu"'
19960 uvoformat='"ho"'
19961 uvxformat='"hx"'
19962 uvXUformat='"hX"'
19963 fi
19964 fi
19965 fi
19966fi
19967
19968if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19969 nveformat="$sPRIeldbl"
19970 nvfformat="$sPRIfldbl"
19971 nvgformat="$sPRIgldbl"
19972 nvEUformat="$sPRIEUldbl"
19973 nvFUformat="$sPRIFUldbl"
19974 nvGUformat="$sPRIGUldbl"
19975else
19976 nveformat='"e"'
19977 nvfformat='"f"'
19978 nvgformat='"g"'
19979 nvEUformat='"E"'
19980 nvFUformat='"F"'
19981 nvGUformat='"G"'
19982fi
19983
19984case "$ivdformat" in
3c728e00 19985'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19986 exit 1
19987 ;;
19988esac
19989
34f1896b 19990: Check format string for GID
b4eb6b3d
JH
19991
19992echo " "
19993$echo "Checking the format string to be used for gids..." >&4
19994
19995case "$gidsign" in
19996-1) if $test X"$gidsize" = X"$ivsize"; then
19997 gidformat="$ivdformat"
19998 else
19999 if $test X"$gidsize" = X"$longsize"; then
20000 gidformat='"ld"'
20001 else
20002 if $test X"$gidsize" = X"$intsize"; then
20003 gidformat='"d"'
20004 else
20005 if $test X"$gidsize" = X"$shortsize"; then
20006 gidformat='"hd"'
20007 fi
20008 fi
20009 fi
20010 fi
20011 ;;
20012*) if $test X"$gidsize" = X"$uvsize"; then
20013 gidformat="$uvuformat"
20014 else
20015 if $test X"$gidsize" = X"$longsize"; then
20016 gidformat='"lu"'
20017 else
20018 if $test X"$gidsize" = X"$intsize"; then
20019 gidformat='"u"'
20020 else
20021 if $test X"$gidsize" = X"$shortsize"; then
20022 gidformat='"hu"'
20023 fi
20024 fi
20025 fi
20026 fi
20027 ;;
20028esac
20029
20030: see if getgroups exists
20031set getgroups d_getgrps
20032eval $inlibc
20033
20034: see if setgroups exists
20035set setgroups d_setgrps
20036eval $inlibc
20037
b4eb6b3d
JH
20038: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20039echo " "
20040case "$d_getgrps$d_setgrps" in
20041*define*)
20042 case "$groupstype" in
20043 '') dflt="$gidtype" ;;
20044 *) dflt="$groupstype" ;;
20045 esac
20046 $cat <<EOM
20047What type of pointer is the second argument to getgroups() and setgroups()?
20048Usually this is the same as group ids, $gidtype, but not always.
20049
20050EOM
20051 rp='What type pointer is the second argument to getgroups() and setgroups()?'
20052 . ./myread
20053 groupstype="$ans"
20054 ;;
20055*) groupstype="$gidtype";;
20056esac
20057
613d6c3e 20058: MAD = Misc Attribute Definition
d620c7b3 20059
fd655d33
NC
20060if $test $patchlevel -lt 9; then
20061: MAD is not available in 5.8.x or earlier.
20062 ans=n;
20063else
20064 case "$mad" in
20065 $define|true|[yY]*) dflt='y' ;;
20066 *) dflt='n' ;;
20067 esac
20068 cat <<EOM
d620c7b3
MB
20069
20070Would you like to build with Misc Attribute Decoration? This is development
20071work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20072overhead on the interpreter.
20073
20074If this doesn't make any sense to you, just accept the default '$dflt'.
20075EOM
fd655d33
NC
20076 rp='Build Perl with MAD?'
20077 . ./myread
20078fi
d620c7b3 20079case "$ans" in
00e74f14
NC
20080y|Y) val="$define"
20081 madlyh='madly.h madly.act madly.tab'
20082 madlysrc='madly.c'
20083 madlyobj="madly$_o" ;;
20084*) val="$undef"
20085 madlyh=''
20086 madlysrc=''
20087 madlyobj='' ;;
d620c7b3
MB
20088esac
20089set mad
20090eval $setvar
20091
216dac04 20092: check whether make sets MAKE
b4eb6b3d
JH
20093echo " "
20094echo "Checking if your $make program sets \$(MAKE)..." >&4
20095case "$make_set_make" in
20096'')
20097 $sed 's/^X //' > testmake.mak << 'EOF'
20098Xall:
20099X @echo 'maketemp="$(MAKE)"'
20100EOF
20101 case "`$make -f testmake.mak 2>/dev/null`" in
20102 *maketemp=*) make_set_make='#' ;;
20103 *) make_set_make="MAKE=$make" ;;
20104 esac
20105 $rm -f testmake.mak
20106 ;;
20107esac
20108case "$make_set_make" in
20109'#') echo "Yup, it does.";;
20110*) echo "Nope, it doesn't.";;
20111esac
20112
20113: see what type is used for mode_t
20114rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20115set mode_t modetype int stdio.h sys/types.h
20116eval $typedef_ask
20117
2cc61e15
DD
20118: see if we need va_copy
20119echo " "
20120case "$i_stdarg" in
20121"$define")
20122 $cat >try.c <<EOCP
20123#include <stdarg.h>
20124#include <stdio.h>
85c8a686
DD
20125#$i_stdlib I_STDLIB
20126#ifdef I_STDLIB
20127#include <stdlib.h>
20128#endif
20129#include <signal.h>
2cc61e15
DD
20130
20131int
20132ivfprintf(FILE *f, const char *fmt, va_list *valp)
20133{
20134 return vfprintf(f, fmt, *valp);
20135}
5b813a60
MB
20136
20137int
2cc61e15
DD
20138myvfprintf(FILE *f, const char *fmt, va_list val)
20139{
20140 return ivfprintf(f, fmt, &val);
20141}
5b813a60 20142
2cc61e15 20143int
5b813a60 20144myprintf(char *fmt, ...)
2cc61e15
DD
20145{
20146 va_list val;
20147 va_start(val, fmt);
5b813a60
MB
20148 return myvfprintf(stdout, fmt, val);
20149}
2cc61e15
DD
20150
20151int
20152main(int ac, char **av)
20153{
85c8a686
DD
20154 signal(SIGSEGV, exit);
20155
5b813a60
MB
20156 myprintf("%s%cs all right, then\n", "that", '\'');
20157 exit(0);
2cc61e15
DD
20158}
20159EOCP
20160 set try
5440bc8e
JH
20161 if eval $compile && $run ./try 2>&1 >/dev/null; then
20162 case "`$run ./try`" in
2cc61e15
DD
20163 "that's all right, then")
20164 okay=yes
20165 ;;
20166 esac
20167 fi
20168 case "$okay" in
20169 yes) echo "It seems that you don't need va_copy()." >&4
20170 need_va_copy="$undef"
20171 ;;
20172 *) echo "It seems that va_copy() or similar will be needed." >&4
20173 need_va_copy="$define"
20174 ;;
20175 esac
5b813a60 20176 $rm_try
2cc61e15
DD
20177 ;;
20178*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20179 ;;
20180esac
20181
b4eb6b3d
JH
20182: see what type is used for size_t
20183rp="What is the type used for the length parameter for string functions?"
20184set size_t sizetype 'unsigned int' stdio.h sys/types.h
20185eval $typedef_ask
20186
20187: check for type of arguments to gethostbyaddr.
20188if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20189 case "$d_gethbyaddr" in
20190 $define)
20191 $cat <<EOM
20192
20193Checking to see what type of arguments are accepted by gethostbyaddr().
20194EOM
20195 hdrs="$define sys/types.h
20196 $d_socket sys/socket.h
20197 $i_niin netinet/in.h
20198 $i_netdb netdb.h
20199 $i_unistd unistd.h"
20200 : The first arg can 'char *' or 'void *'
20201 : The second arg is some of integral type
20202 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20203 for yyy in size_t long int; do
20204 case "$netdb_host_type" in
61c26d18 20205 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
b4eb6b3d
JH
20206 if ./protochk "$try" $hdrs; then
20207 echo "Your system accepts $xxx for the first arg."
20208 echo "...and $yyy for the second arg."
20209 netdb_host_type="$xxx"
20210 netdb_hlen_type="$yyy"
20211 fi
20212 ;;
20213 esac
20214 done
20215 done
20216 : In case none of those worked, prompt the user.
20217 case "$netdb_host_type" in
20218 '') rp='What is the type for the 1st argument to gethostbyaddr?'
20219 dflt='char *'
20220 . ./myread
20221 netdb_host_type=$ans
20222 rp='What is the type for the 2nd argument to gethostbyaddr?'
20223 dflt="$sizetype"
20224 . ./myread
20225 netdb_hlen_type=$ans
20226 ;;
20227 esac
20228 ;;
20229 *) : no gethostbyaddr, so pick harmless defaults
20230 netdb_host_type='char *'
20231 netdb_hlen_type="$sizetype"
20232 ;;
20233 esac
20234 # Remove the "const" if needed. -- but then we'll have a
20235 # prototype clash!
20236 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20237fi
20238
20239: check for type of argument to gethostbyname.
20240if test "X$netdb_name_type" = X ; then
20241 case "$d_gethbyname" in
20242 $define)
20243 $cat <<EOM
20244
20245Checking to see what type of argument is accepted by gethostbyname().
20246EOM
20247 hdrs="$define sys/types.h
20248 $d_socket sys/socket.h
20249 $i_niin netinet/in.h
20250 $i_netdb netdb.h
20251 $i_unistd unistd.h"
20252 for xxx in "const char *" "char *"; do
20253 case "$netdb_name_type" in
61c26d18 20254 '') try="$extern_C struct hostent *gethostbyname($xxx);"
b4eb6b3d
JH
20255 if ./protochk "$try" $hdrs; then
20256 echo "Your system accepts $xxx."
20257 netdb_name_type="$xxx"
20258 fi
20259 ;;
20260 esac
20261 done
20262 : In case none of those worked, prompt the user.
20263 case "$netdb_name_type" in
20264 '') rp='What is the type for the 1st argument to gethostbyname?'
20265 dflt='char *'
20266 . ./myread
20267 netdb_name_type=$ans
20268 ;;
20269 esac
20270 ;;
20271 *) : no gethostbyname, so pick harmless default
20272 netdb_name_type='char *'
20273 ;;
20274 esac
20275fi
20276
20277: check for type of 1st argument to getnetbyaddr.
20278if test "X$netdb_net_type" = X ; then
20279 case "$d_getnbyaddr" in
20280 $define)
20281 $cat <<EOM
20282
20283Checking to see what type of 1st argument is accepted by getnetbyaddr().
20284EOM
20285 hdrs="$define sys/types.h
20286 $d_socket sys/socket.h
20287 $i_niin netinet/in.h
20288 $i_netdb netdb.h
20289 $i_unistd unistd.h"
20290 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20291 case "$netdb_net_type" in
61c26d18 20292 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
b4eb6b3d
JH
20293 if ./protochk "$try" $hdrs; then
20294 echo "Your system accepts $xxx."
20295 netdb_net_type="$xxx"
20296 fi
20297 ;;
20298 esac
20299 done
20300 : In case none of those worked, prompt the user.
20301 case "$netdb_net_type" in
20302 '') rp='What is the type for the 1st argument to getnetbyaddr?'
20303 dflt='long'
20304 . ./myread
20305 netdb_net_type=$ans
20306 ;;
20307 esac
20308 ;;
20309 *) : no getnetbyaddr, so pick harmless default
20310 netdb_net_type='long'
20311 ;;
20312 esac
20313fi
20314: locate the preferred pager for this system
d604bb53 20315fn=f/
b4eb6b3d
JH
20316case "$pager" in
20317'')
20318 dflt=''
20319 case "$pg" in
20320 /*) dflt=$pg;;
20321 [a-zA-Z]:/*) dflt=$pg;;
20322 esac
20323 case "$more" in
20324 /*) dflt=$more;;
20325 [a-zA-Z]:/*) dflt=$more;;
20326 esac
20327 case "$less" in
20328 /*) dflt=$less;;
20329 [a-zA-Z]:/*) dflt=$less;;
20330 esac
20331 case "$dflt" in
20332 '') dflt=/usr/ucb/more;;
20333 esac
20334 ;;
d604bb53 20335*) dflt="$pager"
d604bb53
JH
20336 fn="f/($pager)"
20337 ;;
b4eb6b3d
JH
20338esac
20339echo " "
b4eb6b3d
JH
20340rp='What pager is used on your system?'
20341. ./getfile
20342pager="$ans"
20343
20344: see what type pids are declared as in the kernel
20345rp="What is the type of process ids on this system?"
20346set pid_t pidtype int stdio.h sys/types.h
20347eval $typedef_ask
20348
b4eb6b3d
JH
20349: see if ar generates random libraries by itself
20350echo " "
20351echo "Checking how to generate random libraries on your machine..." >&4
20352echo 'int bar1() { return bar2(); }' > bar1.c
20353echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
20354$cat > foo.c <<EOP
20355#$i_stdlib I_STDLIB
20356#ifdef I_STDLIB
20357#include <stdlib.h>
20358#endif
b4eb6b3d
JH
20359int main() { printf("%d\n", bar1()); exit(0); }
20360EOP
20361$cc $ccflags -c bar1.c >/dev/null 2>&1
20362$cc $ccflags -c bar2.c >/dev/null 2>&1
20363$cc $ccflags -c foo.c >/dev/null 2>&1
20364$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 20365if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20366 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20367 echo "$ar appears to generate random libraries itself."
20368 orderlib=false
e39a9d84
LC
20369 if [ "X$ranlib" = "X" ]; then
20370 ranlib=":"
20371 fi
88d4d47b
PC
20372elif $ar s bar$_a >/dev/null 2>&1 &&
20373 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20374 $run ./foobar >/dev/null 2>&1; then
20375 echo "a table of contents needs to be added with '$ar s'."
20376 orderlib=false
20377 ranlib="$ar s"
b4eb6b3d 20378elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 20379 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20380 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20381 echo "a table of contents needs to be added with '$ar ts'."
20382 orderlib=false
20383 ranlib="$ar ts"
20384else
20385 case "$ranlib" in
20386 :) ranlib='';;
20387 '')
20388 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20389 $test -f $ranlib || ranlib=''
20390 ;;
20391 esac
20392 if $test -n "$ranlib"; then
20393 echo "your system has '$ranlib'; we'll use that."
20394 orderlib=false
20395 else
20396 echo "your system doesn't seem to support random libraries"
20397 echo "so we'll use lorder and tsort to order the libraries."
20398 orderlib=true
20399 ranlib=":"
20400 fi
20401fi
88d4d47b 20402$rm -f foo* bar*
b4eb6b3d 20403
92a3ac59
MB
20404: see if this is a values.h system
20405set values.h i_values
20406eval $inhdr
20407
73e6e416 20408: Check the max offset that gmtime and localtime accept
92a3ac59 20409echo "Checking max offsets that gmtime () accepts"
81c4fd9e 20410
92a3ac59
MB
20411case $i_values in
20412 define) yyy="#include <values.h>" ;;
20413 *) yyy="" ;;
20414 esac
20415
690aedd1
MB
20416case "$sGMTIME_min/$sGMTIME_max" in
20417 0/0|/)
20418 $cat >try.c <<EOCP
81c4fd9e
MB
20419#include <sys/types.h>
20420#include <stdio.h>
20421#include <time.h>
92a3ac59 20422$yyy
81c4fd9e 20423
92a3ac59
MB
20424int i;
20425struct tm *tmp;
20426time_t pt;
20427
1b289682 20428void gm_check (time_t t, int min_year, int max_year)
92a3ac59 20429{
81c4fd9e 20430 tmp = gmtime (&t);
1b289682
MB
20431 if ( tmp == NULL ||
20432 /* Check tm_year overflow */
20433 tmp->tm_year < min_year || tmp->tm_year > max_year)
92a3ac59
MB
20434 tmp = NULL;
20435 else
20436 pt = t;
20437 } /* gm_check */
81c4fd9e 20438
92a3ac59
MB
20439int check_max ()
20440{
73e6e416
MB
20441 tmp = NULL;
20442 pt = 0;
92a3ac59 20443#ifdef MAXLONG
1b289682 20444 gm_check (MAXLONG, 69, 0x7fffffff);
92a3ac59 20445#endif
73e6e416
MB
20446 if (tmp == NULL || tmp->tm_year < 0) {
20447 for (i = 63; i >= 0; i--) {
20448 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20449 if (x < 0 || x < pt) continue;
20450 gm_check (x, 69, 0x7fffffff);
73e6e416
MB
20451 }
20452 }
20453 printf ("sGMTIME_max=%ld\n", pt);
20454 return (0);
1b289682 20455 } /* check_max */
81c4fd9e 20456
92a3ac59
MB
20457int check_min ()
20458{
73e6e416
MB
20459 tmp = NULL;
20460 pt = 0;
92a3ac59 20461#ifdef MINLONG
1b289682 20462 gm_check (MINLONG, -1900, 70);
92a3ac59 20463#endif
73e6e416
MB
20464 if (tmp == NULL) {
20465 for (i = 36; i >= 0; i--) {
20466 time_t x = pt - ((time_t)1 << i);
20467 if (x > 0) continue;
1b289682 20468 gm_check (x, -1900, 70);
73e6e416
MB
20469 }
20470 }
20471 printf ("sGMTIME_min=%ld\n", pt);
20472 return (0);
20473 } /* check_min */
92a3ac59
MB
20474
20475int main (int argc, char *argv[])
20476{
73e6e416
MB
20477 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20478 check_max ();
20479 check_min ();
20480 return (0);
20481 } /* main */
81c4fd9e 20482EOCP
690aedd1
MB
20483 set try
20484 if eval $compile; then
20485 eval `$run ./try`
20486 else
20487 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20488 fi
20489 $rm_try
20490 ;;
20491 esac
81c4fd9e 20492
73e6e416
MB
20493echo "Checking max offsets that localtime () accepts"
20494
690aedd1
MB
20495case "$sLOCALTIME_min/$sLOCALTIME_max" in
20496 0/0|/)
20497 $cat >try.c <<EOCP
73e6e416
MB
20498#include <sys/types.h>
20499#include <stdio.h>
20500#include <time.h>
20501$yyy
20502
20503int i;
20504struct tm *tmp;
20505time_t pt;
20506
1b289682 20507void local_check (time_t t, int min_year, int max_year)
73e6e416 20508{
5bca5c48
MB
20509 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20510 tmp = NULL;
20511 else
20512 tmp = localtime (&t);
1b289682
MB
20513 if ( tmp == NULL ||
20514 /* Check tm_year overflow */
20515 tmp->tm_year < min_year || tmp->tm_year > max_year)
73e6e416
MB
20516 tmp = NULL;
20517 else
20518 pt = t;
20519 } /* local_check */
20520
20521int check_max ()
20522{
20523 tmp = NULL;
20524 pt = 0;
20525#ifdef MAXLONG
1b289682 20526 local_check (MAXLONG, 69, 0x7fffffff);
73e6e416
MB
20527#endif
20528 if (tmp == NULL || tmp->tm_year < 0) {
20529 for (i = 63; i >= 0; i--) {
20530 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20531 if (x < 0 || x < pt) continue;
20532 local_check (x, 69, 0x7fffffff);
73e6e416
MB
20533 }
20534 }
20535 printf ("sLOCALTIME_max=%ld\n", pt);
20536 return (0);
1b289682 20537 } /* check_max */
73e6e416
MB
20538
20539int check_min ()
20540{
20541 tmp = NULL;
20542 pt = 0;
20543#ifdef MINLONG
1b289682 20544 local_check (MINLONG, -1900, 70);
73e6e416
MB
20545#endif
20546 if (tmp == NULL) {
20547 for (i = 36; i >= 0; i--) {
20548 time_t x = pt - ((time_t)1 << i);
20549 if (x > 0) continue;
1b289682 20550 local_check (x, -1900, 70);
73e6e416
MB
20551 }
20552 }
20553 printf ("sLOCALTIME_min=%ld\n", pt);
20554 return (0);
20555 } /* check_min */
20556
20557int main (int argc, char *argv[])
20558{
20559 check_max ();
20560 check_min ();
20561 return (0);
20562 } /* main */
20563EOCP
690aedd1
MB
20564 set try
20565 if eval $compile; then
20566 eval `$run ./try`
20567 else
20568 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20569 fi
20570 $rm_try
20571 ;;
20572 esac
73e6e416 20573
c0bacbef 20574: check for type of arguments to select.
b4eb6b3d
JH
20575case "$selecttype" in
20576'') case "$d_select" in
20577 $define)
20578 echo " "
20579 $cat <<EOM
20580Checking to see what type of arguments are accepted by select().
20581EOM
20582 hdrs="$define sys/types.h
c0bacbef 20583 $i_systime sys/time.h
b4eb6b3d
JH
20584 $i_sysselct sys/select.h
20585 $d_socket sys/socket.h"
20586 : The first arg can be int, unsigned, or size_t
20587 : The last arg may or may not be 'const'
20588 val=''
20589 : void pointer has been seen but using that
20590 : breaks the selectminbits test
20591 for xxx in 'fd_set *' 'int *'; do
20592 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20593 for tmo in 'struct timeval *' 'const struct timeval *'; do
20594 case "$val" in
61c26d18 20595 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
b4eb6b3d
JH
20596 if ./protochk "$try" $hdrs; then
20597 echo "Your system accepts $xxx."
20598 val="$xxx"
20599 fi
20600 ;;
20601 esac
20602 done
20603 done
20604 done
20605 case "$val" in
20606 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20607 case "$d_fd_set" in
20608 $define) dflt="fd_set *" ;;
20609 *) dflt="int *" ;;
20610 esac
20611 . ./myread
20612 val=$ans
20613 ;;
20614 esac
20615 selecttype="$val"
20616 ;;
20617 *) : no select, so pick a harmless default
20618 selecttype='int *'
20619 ;;
20620 esac
20621 ;;
20622esac
20623
20624: check for the select 'width'
20625case "$selectminbits" in
e6e7e605
JH
20626'') safebits=`expr $ptrsize \* 8`
20627 case "$d_select" in
b4eb6b3d
JH
20628 $define)
20629 $cat <<EOM
20630
20631Checking to see on how many bits at a time your select() operates...
20632EOM
20633 $cat >try.c <<EOCP
20634#include <sys/types.h>
20635#$i_time I_TIME
20636#$i_systime I_SYS_TIME
20637#$i_systimek I_SYS_TIME_KERNEL
20638#ifdef I_TIME
20639# include <time.h>
20640#endif
20641#ifdef I_SYS_TIME
20642# ifdef I_SYS_TIME_KERNEL
20643# define KERNEL
20644# endif
20645# include <sys/time.h>
20646# ifdef I_SYS_TIME_KERNEL
20647# undef KERNEL
20648# endif
20649#endif
20650#$i_sysselct I_SYS_SELECT
20651#ifdef I_SYS_SELECT
20652#include <sys/select.h>
20653#endif
20654#$d_socket HAS_SOCKET
20655#ifdef HAS_SOCKET
20656# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20657#endif
20658#include <stdio.h>
d1daaddf
JH
20659#$i_stdlib I_STDLIB
20660#ifdef I_STDLIB
20661#include <stdlib.h>
20662#endif
b4eb6b3d
JH
20663$selecttype b;
20664#define S sizeof(*(b))
20665#define MINBITS 64
20666#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20667#define NBITS (NBYTES * 8)
20668int main() {
7090f861 20669 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
20670 struct timeval t;
20671 int i;
20672 FILE* fp;
20673 int fd;
20674
e6e7e605
JH
20675 if (!s)
20676 exit(1);
b4eb6b3d
JH
20677 fclose(stdin);
20678 fp = fopen("try.c", "r");
20679 if (fp == 0)
e6e7e605 20680 exit(2);
b4eb6b3d
JH
20681 fd = fileno(fp);
20682 if (fd < 0)
e6e7e605 20683 exit(3);
b4eb6b3d
JH
20684 b = ($selecttype)s;
20685 for (i = 0; i < NBITS; i++)
20686 FD_SET(i, b);
20687 t.tv_sec = 0;
20688 t.tv_usec = 0;
20689 select(fd + 1, b, 0, 0, &t);
20690 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 20691 free(s);
b4eb6b3d
JH
20692 printf("%d\n", i + 1);
20693 return 0;
20694}
20695EOCP
20696 set try
20697 if eval $compile_ok; then
5440bc8e 20698 selectminbits=`$run ./try`
b4eb6b3d
JH
20699 case "$selectminbits" in
20700 '') cat >&4 <<EOM
20701Cannot figure out on how many bits at a time your select() operates.
e6e7e605 20702I'll play safe and guess it is $safebits bits.
b4eb6b3d 20703EOM
e6e7e605
JH
20704 selectminbits=$safebits
20705 bits="$safebits bits"
b4eb6b3d
JH
20706 ;;
20707 1) bits="1 bit" ;;
20708 *) bits="$selectminbits bits" ;;
20709 esac
20710 echo "Your select() operates on $bits at a time." >&4
20711 else
20712 rp='What is the minimum number of bits your select() operates on?'
20713 case "$byteorder" in
e6e7e605
JH
20714 12345678) dflt=64 ;;
20715 1234) dflt=32 ;;
b4eb6b3d
JH
20716 *) dflt=1 ;;
20717 esac
20718 . ./myread
20719 val=$ans
20720 selectminbits="$val"
20721 fi
5b813a60 20722 $rm_try
b4eb6b3d
JH
20723 ;;
20724 *) : no select, so pick a harmless default
e6e7e605 20725 selectminbits=$safebits
b4eb6b3d
JH
20726 ;;
20727 esac
20728 ;;
20729esac
20730
20731: Trace out the files included by signal.h, then look for SIGxxx names.
b4eb6b3d
JH
20732if [ "X$fieldn" = X ]; then
20733 : Just make some guesses. We check them later.
20734 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20735else
20736 xxx=`echo '#include <signal.h>' |
20737 $cppstdin $cppminus $cppflags 2>/dev/null |
613d6c3e 20738 $grep '^[ ]*#.*include' |
776a38e3
MB
20739 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20740 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d 20741fi
b4eb6b3d
JH
20742xxxfiles=''
20743for xx in $xxx /dev/null ; do
20744 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20745done
b4eb6b3d
JH
20746case "$xxxfiles" in
20747'') xxxfiles=`./findhdr signal.h` ;;
20748esac
20749xxx=`awk '
20750$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20751 print substr($2, 4, 20)
20752}
20753$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20754 print substr($3, 4, 20)
20755}' $xxxfiles`
20756: Append some common names just in case the awk scan failed.
20757xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20758xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20759xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20760xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20761xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20762
20763: generate a few handy files for later
55954f19 20764$cat > signal.c <<EOCP
b4eb6b3d
JH
20765#include <sys/types.h>
20766#include <signal.h>
55954f19
JH
20767#$i_stdlib I_STDLIB
20768#ifdef I_STDLIB
20769#include <stdlib.h>
20770#endif
b4eb6b3d
JH
20771#include <stdio.h>
20772int main() {
20773
20774/* Strange style to avoid deeply-nested #if/#else/#endif */
20775#ifndef NSIG
20776# ifdef _NSIG
20777# define NSIG (_NSIG)
20778# endif
20779#endif
20780
20781#ifndef NSIG
20782# ifdef SIGMAX
20783# define NSIG (SIGMAX+1)
20784# endif
20785#endif
20786
20787#ifndef NSIG
20788# ifdef SIG_MAX
20789# define NSIG (SIG_MAX+1)
20790# endif
20791#endif
20792
20793#ifndef NSIG
3609ea0d
JH
20794# ifdef _SIG_MAX
20795# define NSIG (_SIG_MAX+1)
20796# endif
20797#endif
20798
20799#ifndef NSIG
b4eb6b3d
JH
20800# ifdef MAXSIG
20801# define NSIG (MAXSIG+1)
20802# endif
20803#endif
20804
20805#ifndef NSIG
20806# ifdef MAX_SIG
20807# define NSIG (MAX_SIG+1)
20808# endif
20809#endif
20810
20811#ifndef NSIG
20812# ifdef SIGARRAYSIZE
3609ea0d 20813# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
20814# endif
20815#endif
20816
20817#ifndef NSIG
20818# ifdef _sys_nsig
20819# define NSIG (_sys_nsig) /* Solaris 2.5 */
20820# endif
20821#endif
20822
20823/* Default to some arbitrary number that's big enough to get most
20824 of the common signals.
20825*/
20826#ifndef NSIG
20827# define NSIG 50
20828#endif
20829
20830printf("NSIG %d\n", NSIG);
20831
20832#ifndef JUST_NSIG
20833
20834EOCP
20835
20836echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20837{
20838 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 20839 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
20840 printf $1; printf ");\n"
20841 printf "#endif\n"
20842}
20843END {
20844 printf "#endif /* JUST_NSIG */\n";
20845 printf "exit(0);\n}\n";
20846}
20847' >>signal.c
20848$cat >signal.awk <<'EOP'
20849BEGIN { ndups = 0 }
65197d93 20850$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20851($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20852 if ($2 > maxsig) { maxsig = $2 }
20853 if (sig_name[$2]) {
20854 dup_name[ndups] = $1
20855 dup_num[ndups] = $2
613d6c3e 20856 ndups++
b4eb6b3d 20857 }
1ebe1ffb 20858 else {
65197d93
JH
20859 sig_name[$2] = $1
20860 sig_num[$2] = $2
b4eb6b3d
JH
20861 }
20862}
613d6c3e 20863END {
b4eb6b3d
JH
20864 if (nsig == 0) {
20865 nsig = maxsig + 1
20866 }
20867 printf("NSIG %d\n", nsig);
20868 for (n = 1; n < nsig; n++) {
20869 if (sig_name[n]) {
20870 printf("%s %d\n", sig_name[n], sig_num[n])
20871 }
20872 else {
613d6c3e 20873 printf("NUM%d %d\n", n, n)
b4eb6b3d
JH
20874 }
20875 }
20876 for (n = 0; n < ndups; n++) {
20877 printf("%s %d\n", dup_name[n], dup_num[n])
20878 }
20879}
20880EOP
20881$cat >signal_cmd <<EOS
20882$startsh
20883if $test -s signal.lst; then
20884 echo "Using your existing signal.lst file"
20885 exit 0
20886fi
20887xxx="$xxx"
20888EOS
20889$cat >>signal_cmd <<'EOS'
20890
20891set signal
20892if eval $compile_ok; then
776a38e3
MB
20893 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20894 $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20895else
20896 echo "(I can't seem be able to compile the whole test program)" >&4
20897 echo "(I'll try it in little pieces.)" >&4
20898 set signal -DJUST_NSIG
20899 if eval $compile_ok; then
5440bc8e 20900 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20901 $cat signal.nsg
20902 else
20903 echo "I can't seem to figure out how many signals you have." >&4
20904 echo "Guessing 50." >&4
20905 echo 'NSIG 50' > signal.nsg
20906 fi
20907 : Now look at all the signal names, one at a time.
20908 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20909 $cat > signal.c <<EOCP
20910#include <sys/types.h>
20911#include <signal.h>
20912#include <stdio.h>
20913int main() {
20914printf("$xx %d\n", SIG${xx});
20915return 0;
20916}
20917EOCP
20918 set signal
20919 if eval $compile; then
20920 echo "SIG${xx} found."
5440bc8e 20921 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20922 else
20923 echo "SIG${xx} NOT found."
20924 fi
20925 done
20926 if $test -s signal.ls1; then
20927 $cat signal.nsg signal.ls1 |
65197d93 20928 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20929 fi
20930
20931fi
20932if $test -s signal.lst; then
20933 :
20934else
20935 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20936 echo 'kill -l' >signal
20937 set X `csh -f <signal`
20938 $rm -f signal
20939 shift
20940 case $# in
20941 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20942 esac
20943 echo $@ | $tr ' ' $trnl | \
20944 $awk '{ printf "%s %d\n", $1, ++s; }
20945 END { printf "NSIG %d\n", ++s }' >signal.lst
20946fi
20947$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20948EOS
20949chmod a+x signal_cmd
20950$eunicefix signal_cmd
20951
20952: generate list of signal names
20953echo " "
20954case "$sig_name_init" in
20955'') doinit=yes ;;
20956*) case "$sig_num_init" in
20957 ''|*,*) doinit=yes ;;
20958 esac ;;
20959esac
20960case "$doinit" in
20961yes)
20962 echo "Generating a list of signal names and numbers..." >&4
20963 . ./signal_cmd
20964 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20965 sig_name=`$awk 'BEGIN { printf "ZERO " }
20966 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20967 sig_num=`$awk 'BEGIN { printf "0 " }
20968 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20969 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
20970 !/^NSIG/ { printf "\"%s\", ", $1 }
20971 END { printf "0\n" }' signal.lst`
20972 sig_num_init=`$awk 'BEGIN { printf "0, " }
20973 !/^NSIG/ { printf "%d, ", $2}
20974 END { printf "0\n"}' signal.lst`
20975 ;;
20976esac
20977echo "The following $sig_count signals are available:"
20978echo " "
20979echo $sig_name | $awk \
20980'BEGIN { linelen = 0 }
20981{
20982 for (i = 1; i <= NF; i++) {
20983 name = "SIG" $i " "
20984 linelen = linelen + length(name)
20985 if (linelen > 70) {
20986 printf "\n"
20987 linelen = length(name)
20988 }
20989 printf "%s", name
20990 }
20991 printf "\n"
20992}'
76d3c696 20993sig_size=`echo $sig_name | awk '{print NF}'`
c0bacbef 20994$rm -f signal signal.c signal.awk signal.lst signal_cmd
b4eb6b3d 20995
613d6c3e 20996: Check size of size
b4eb6b3d
JH
20997echo " "
20998case "$sizetype" in
20999*_t) zzz="$sizetype" ;;
21000*) zzz="filesize" ;;
21001esac
613d6c3e 21002echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21003cat > try.c <<EOCP
21004#include <sys/types.h>
21005#include <stdio.h>
d1daaddf
JH
21006#$i_stdlib I_STDLIB
21007#ifdef I_STDLIB
21008#include <stdlib.h>
21009#endif
b4eb6b3d
JH
21010int main() {
21011 printf("%d\n", (int)sizeof($sizetype));
21012 exit(0);
21013}
21014EOCP
21015set try
21016if eval $compile_ok; then
5440bc8e 21017 yyy=`$run ./try`
b4eb6b3d
JH
21018 case "$yyy" in
21019 '') sizesize=4
21020 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21021 ;;
21022 *) sizesize=$yyy
21023 echo "Your $zzz size is $sizesize bytes."
21024 ;;
21025 esac
21026else
21027 sizesize=4
21028 echo "(I can't compile the test program--guessing $sizesize.)" >&4
21029fi
21030
21031
21032: check for socklen_t
21033echo " "
21034echo "Checking to see if you have socklen_t..." >&4
21035$cat >try.c <<EOCP
21036#include <sys/types.h>
21037#$d_socket HAS_SOCKET
21038#ifdef HAS_SOCKET
21039#include <sys/socket.h>
21040#endif
21041int main() { socklen_t x = 16; }
21042EOCP
21043set try
21044if eval $compile; then
21045 val="$define"
21046 echo "You have socklen_t."
21047else
21048 val="$undef"
21049 echo "You do not have socklen_t."
21050 case "$sizetype" in
21051 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21052 esac
21053fi
5b813a60 21054$rm_try
b4eb6b3d
JH
21055set d_socklen_t
21056eval $setvar
21057
a7710f8d
JH
21058: see if this is a socks.h system
21059set socks.h i_socks
21060eval $inhdr
21061
b4eb6b3d
JH
21062: check for type of the size argument to socket calls
21063case "$d_socket" in
21064"$define")
21065 $cat <<EOM
21066
21067Checking to see what type is the last argument of accept().
21068EOM
b4eb6b3d
JH
21069 yyy=''
21070 case "$d_socklen_t" in
21071 "$define") yyy="$yyy socklen_t"
21072 esac
21073 yyy="$yyy $sizetype int long unsigned"
21074 for xxx in $yyy; do
21075 case "$socksizetype" in
61c26d18 21076 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
21077 case "$usesocks" in
21078 "$define")
21079 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21080 echo "Your system accepts '$xxx *' for the last argument of accept()."
21081 socksizetype="$xxx"
21082 fi
21083 ;;
21084 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
21085 echo "Your system accepts '$xxx *' for the last argument of accept()."
21086 socksizetype="$xxx"
21087 fi
21088 ;;
21089 esac
b4eb6b3d
JH
21090 ;;
21091 esac
21092 done
21093: In case none of those worked, prompt the user.
21094 case "$socksizetype" in
21095 '') rp='What is the type for socket address structure sizes?'
21096 dflt='int'
21097 . ./myread
21098 socksizetype=$ans
21099 ;;
21100 esac
21101 ;;
21102*) : no sockets, so pick relatively harmless default
21103 socksizetype='int'
21104 ;;
21105esac
21106
21107: see what type is used for signed size_t
21108set ssize_t ssizetype int stdio.h sys/types.h
21109eval $typedef
21110dflt="$ssizetype"
5440bc8e 21111$cat > try.c <<EOM
b4eb6b3d 21112#include <stdio.h>
d1daaddf
JH
21113#$i_stdlib I_STDLIB
21114#ifdef I_STDLIB
21115#include <stdlib.h>
21116#endif
b4eb6b3d
JH
21117#include <sys/types.h>
21118#define Size_t $sizetype
21119#define SSize_t $dflt
21120int main()
21121{
21122 if (sizeof(Size_t) == sizeof(SSize_t))
21123 printf("$dflt\n");
21124 else if (sizeof(Size_t) == sizeof(int))
21125 printf("int\n");
5b813a60 21126 else
b4eb6b3d
JH
21127 printf("long\n");
21128 exit(0);
21129}
21130EOM
21131echo " "
5440bc8e
JH
21132set try
21133if eval $compile_ok && $run ./try > /dev/null; then
21134 ssizetype=`$run ./try`
b4eb6b3d
JH
21135 echo "I'll be using $ssizetype for functions returning a byte count." >&4
21136else
21137 $cat >&4 <<EOM
21138Help! I can't compile and run the ssize_t test program: please enlighten me!
21139(This is probably a misconfiguration in your system or libraries, and
21140you really ought to fix it. Still, I'll try anyway.)
21141
21142I need a type that is the same size as $sizetype, but is guaranteed to
21143be signed. Common values are ssize_t, int and long.
21144
21145EOM
21146 rp="What signed type is the same size as $sizetype?"
21147 . ./myread
21148 ssizetype="$ans"
21149fi
5b813a60 21150$rm_try
b4eb6b3d 21151
668fdbe1
MB
21152: Check the size of st_ino
21153$echo " "
21154$echo "Checking the size of st_ino..." >&4
21155$cat > try.c <<EOCP
21156#include <sys/stat.h>
21157#include <stdio.h>
21158#$i_stdlib I_STDLIB
21159#ifdef I_STDLIB
21160#include <stdlib.h>
21161#endif
21162int main() {
21163 struct stat st;
21164 printf("%d\n", (int)sizeof(st.st_ino));
21165 exit(0);
21166}
21167EOCP
21168set try
21169if eval $compile_ok; then
21170 val=`$run ./try`
21171 case "$val" in
21172 '') st_ino_size=4
21173 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21174 ;;
21175 *) st_ino_size=$val
21176 $echo "Your st_ino is $st_ino_size bytes long."
21177 ;;
21178 esac
21179else
21180 st_ino_size=4
21181 $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21182fi
21183$rm_try
21184
21185: Check if st_ino is signed
21186$echo " "
21187$echo "Checking the sign of st_ino..." >&4
21188$cat > try.c <<EOCP
21189#include <sys/stat.h>
21190#include <stdio.h>
21191int main() {
21192 struct stat foo;
21193 foo.st_ino = -1;
21194 if (foo.st_ino < 0)
21195 printf("-1\n");
21196 else
21197 printf("1\n");
21198}
21199EOCP
21200set try
21201if eval $compile; then
21202 val=`$run ./try`
21203 case "$val" in
21204 '') st_ino_sign=1
21205 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21206 ;;
21207 *) st_ino_sign=$val
21208 case "$st_ino_sign" in
21209 1) $echo "Your st_ino is unsigned." ;;
21210 -1) $echo "Your st_ino is signed." ;;
21211 esac
21212 ;;
21213 esac
21214else
21215 st_ino_sign=1
21216 $echo "(I can't compile the test program--guessing unsigned.)" >&4
21217fi
21218$rm_try
21219
b4eb6b3d
JH
21220: see what type of char stdio uses.
21221echo " "
1d8eaf8c 21222echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
aa517f50 21223if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
21224 echo "Your stdio uses unsigned chars." >&4
21225 stdchar="unsigned char"
21226else
aa517f50
JH
21227 echo "Your stdio uses signed chars." >&4
21228 stdchar="char"
b4eb6b3d 21229fi
1d8eaf8c 21230$rm -f stdioh
b4eb6b3d 21231
b4eb6b3d
JH
21232: see what type uids are declared as in the kernel
21233echo " "
21234echo "Looking for the type for user ids returned by getuid()."
21235set uid_t uidtype xxx stdio.h sys/types.h
21236eval $typedef
21237case "$uidtype" in
21238xxx)
21239 xxx=`./findhdr sys/user.h`
21240 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21241 case $1 in
21242 unsigned) dflt="$1 $2" ;;
21243 *) dflt="$1" ;;
21244 esac
21245 ;;
21246*) dflt="$uidtype";;
21247esac
21248case "$uidtype" in
21249uid_t) echo "uid_t found." ;;
21250*) rp="What is the type for user ids returned by getuid()?"
21251 . ./myread
21252 uidtype="$ans"
21253 ;;
21254esac
21255
613d6c3e 21256: Check size of UID
b4eb6b3d
JH
21257echo " "
21258case "$uidtype" in
21259*_t) zzz="$uidtype" ;;
21260*) zzz="uid" ;;
21261esac
613d6c3e 21262echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21263cat > try.c <<EOCP
21264#include <sys/types.h>
21265#include <stdio.h>
d1daaddf
JH
21266#$i_stdlib I_STDLIB
21267#ifdef I_STDLIB
21268#include <stdlib.h>
21269#endif
b4eb6b3d
JH
21270int main() {
21271 printf("%d\n", (int)sizeof($uidtype));
21272 exit(0);
21273}
21274EOCP
21275set try
21276if eval $compile_ok; then
5440bc8e 21277 yyy=`$run ./try`
b4eb6b3d
JH
21278 case "$yyy" in
21279 '') uidsize=4
21280 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21281 ;;
21282 *) uidsize=$yyy
21283 echo "Your $zzz is $uidsize bytes long."
21284 ;;
21285 esac
21286else
21287 uidsize=4
21288 echo "(I can't compile the test program--guessing $uidsize.)" >&4
21289fi
21290
613d6c3e 21291: Check if UID is signed
b4eb6b3d
JH
21292echo " "
21293case "$uidtype" in
21294*_t) zzz="$uidtype" ;;
21295*) zzz="uid" ;;
21296esac
21297echo "Checking the sign of $zzz..." >&4
21298cat > try.c <<EOCP
21299#include <sys/types.h>
21300#include <stdio.h>
21301int main() {
21302 $uidtype foo = -1;
21303 if (foo < 0)
21304 printf("-1\n");
21305 else
21306 printf("1\n");
21307}
21308EOCP
21309set try
21310if eval $compile; then
5440bc8e 21311 yyy=`$run ./try`
b4eb6b3d
JH
21312 case "$yyy" in
21313 '') uidsign=1
21314 echo "(I can't execute the test program--guessing unsigned.)" >&4
21315 ;;
21316 *) uidsign=$yyy
21317 case "$uidsign" in
21318 1) echo "Your $zzz is unsigned." ;;
21319 -1) echo "Your $zzz is signed." ;;
21320 esac
21321 ;;
21322 esac
21323else
21324 uidsign=1
21325 echo "(I can't compile the test program--guessing unsigned.)" >&4
21326fi
21327
21328
34f1896b 21329: Check format string for UID
b4eb6b3d
JH
21330echo " "
21331$echo "Checking the format string to be used for uids..." >&4
21332
21333case "$uidsign" in
21334-1) if $test X"$uidsize" = X"$ivsize"; then
21335 uidformat="$ivdformat"
21336 else
21337 if $test X"$uidsize" = X"$longsize"; then
21338 uidformat='"ld"'
21339 else
21340 if $test X"$uidsize" = X"$intsize"; then
21341 uidformat='"d"'
21342 else
21343 if $test X"$uidsize" = X"$shortsize"; then
21344 uidformat='"hd"'
21345 fi
21346 fi
21347 fi
21348 fi
21349 ;;
21350*) if $test X"$uidsize" = X"$uvsize"; then
21351 uidformat="$uvuformat"
21352 else
21353 if $test X"$uidsize" = X"$longsize"; then
21354 uidformat='"lu"'
21355 else
21356 if $test X"$uidsize" = X"$intsize"; then
21357 uidformat='"u"'
21358 else
21359 if $test X"$uidsize" = X"$shortsize"; then
21360 uidformat='"hu"'
21361 fi
21362 fi
21363 fi
21364 fi
21365 ;;
21366esac
21367
d78f9ffa
MB
21368: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21369echo " "
21370echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21371$cat >try.c <<'EOM'
21372/* Intentionally a long probe as I'd like to sanity check that the exact
21373 approach is going to work, as thinking it will work, but only having it
21374 part working at runtime is worse than not having it. */
21375
21376#include <sys/types.h>
21377#include <sys/sysctl.h>
21378#include <sys/param.h>
21379#include <stdio.h>
21380#include <string.h>
21381#include <stdlib.h>
21382#include <unistd.h>
21383
21384int
21385main(int argc, char **argv) {
21386 char *buffer;
21387 char *argv_leaf = strrchr(argv[0], '/');
21388 char *buffer_leaf;
21389 size_t size = 0;
21390 int mib[4];
21391
21392 mib[0] = CTL_KERN;
21393 mib[1] = KERN_PROC;
21394 mib[2] = KERN_PROC_PATHNAME;
21395 mib[3] = -1;
21396
21397 if (!argv_leaf) {
21398 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21399 return 1;
21400 }
21401
21402 if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21403 perror("sysctl");
21404 return 2;
21405 }
21406
21407 if (size < strlen(argv_leaf) + 1) {
21408 fprintf(stderr, "size %lu is too short for a path\n",
21409 (unsigned long) size);
21410 return 3;
21411 }
21412
21413 if (size > MAXPATHLEN * MAXPATHLEN) {
21414 fprintf(stderr, "size %lu is too long for a path\n",
21415 (unsigned long) size);
21416 return 4;
21417 }
21418
21419 buffer = malloc(size);
21420 if (!buffer) {
21421 perror("malloc");
21422 return 5;
21423 }
21424
21425 if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21426 perror("sysctl");
21427 return 6;
21428 }
21429
21430 if (strlen(buffer) + 1 != size) {
21431 fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21432 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21433 return 7;
21434 }
21435
21436
21437 if (*buffer != '/') {
21438 fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21439 return 8;
21440 }
21441
21442 if (strstr(buffer, "/./")) {
21443 fprintf(stderr, "Contains /./: '%s'\n", buffer);
21444 return 9;
21445 }
21446
21447 if (strstr(buffer, "/../")) {
21448 fprintf(stderr, "Contains /../: '%s'\n", buffer);
21449 return 10;
21450 }
21451
21452 buffer_leaf = strrchr(buffer, '/');
21453 if (strcmp(buffer_leaf, argv_leaf) != 0) {
21454 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21455 return 11;
21456 }
21457
21458 free(buffer);
21459
21460 return 0;
21461}
21462EOM
21463
21464val=$undef
21465set try
21466if eval $compile_ok; then
21467 if $run ./try; then
21468 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21469 val="$define"
21470 else
21471 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21472 val="$undef"
21473 fi
21474else
21475 echo "I'm unable to compile the test program." >&4
21476 echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21477 val="$undef"
21478fi
21479$rm_try
21480set usekernprocpathname
21481eval $setvar
21482
21483: Determine if we can use _NSGetExecutablePath to find executing program
21484echo " "
21485echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21486$cat >try.c <<'EOM'
21487/* Intentionally a long probe as I'd like to sanity check that the exact
21488 approach is going to work, as thinking it will work, but only having it
21489 part working at runtime is worse than not having it. */
21490#include <mach-o/dyld.h>
21491#include <stdio.h>
21492#include <stdlib.h>
21493#include <sys/param.h>
21494#include <string.h>
21495
21496int
21497main(int argc, char **argv) {
21498 char buf[1];
21499 uint32_t size = sizeof(buf);
21500 int result;
21501 char *buffer;
21502 char *tidied;
21503 char *argv_leaf = strrchr(argv[0], '/');
21504 char *tidied_leaf;
21505
21506 if (!argv_leaf) {
21507 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21508 return 1;
21509 }
21510
21511 _NSGetExecutablePath(buf, &size);
21512 if (size > MAXPATHLEN * MAXPATHLEN) {
21513 fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21514 (unsigned int) size);
21515 return 2;
21516 }
21517
21518 buffer = malloc(size);
21519 if (!buffer) {
21520 perror("malloc");
21521 return 3;
21522 }
21523
21524 result = _NSGetExecutablePath(buffer, &size);
21525 if (result != 0) {
21526 fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21527 result, (unsigned int) size);
21528 return 4;
21529 }
21530
21531 tidied = realpath(buffer, NULL);
21532 if (!tidied) {
21533 perror("realpath");
21534 return 5;
21535 }
21536
21537 free(buffer);
21538
21539 if (*tidied != '/') {
21540 fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21541 return 6;
21542 }
21543
21544 if (strstr(tidied, "/./")) {
21545 fprintf(stderr, "Contains /./: '%s'\n", tidied);
21546 return 7;
21547 }
21548
21549 if (strstr(tidied, "/../")) {
21550 fprintf(stderr, "Contains /../: '%s'\n", tidied);
21551 return 8;
21552 }
21553
21554 tidied_leaf = strrchr(tidied, '/');
21555 if (strcmp(tidied_leaf, argv_leaf) != 0) {
21556 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21557 return 9;
21558 }
21559
21560 free(tidied);
21561
21562 return 0;
21563}
21564EOM
21565
21566val=$undef
21567set try
21568if eval $compile_ok; then
21569 if $run ./try; then
21570 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21571 val="$define"
21572 else
21573 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21574 fi
21575else
21576 echo "I'm unable to compile the test program." >&4
21577 echo "I'll assume no _NSGetExecutablePath here." >&4
21578fi
21579$rm_try
21580set usensgetexecutablepath
21581eval $setvar
21582
34f1896b 21583: Check if site customization support was requested
4afd418c
MB
21584case "$usesitecustomize" in
21585 $define|true|[Yy]*)
21586 usesitecustomize="$define"
21587 ;;
21588 *)
21589 usesitecustomize="$undef"
21590 ;;
21591 esac
21592
d03b3b00
MB
21593: see if prototypes support variable argument declarations
21594echo " "
21595case "$prototype$i_stdarg" in
21596$define$define)
21597 echo "It appears we'll be able to prototype varargs functions." >&4
21598 val="$define"
21599 ;;
21600*)
21601 echo "Too bad... We won't be using prototyped varargs functions..." >&4
21602 val="$undef"
21603 ;;
21604esac
21605set vaproto
21606eval $setvar
21607
3659ebf1
JH
21608: determine compiler compiler
21609case "$yacc" in
21610'')
21611 dflt=yacc;;
21612*)
21613 dflt="$yacc";;
21614esac
21615echo " "
21616comp='yacc'
3c728e00 21617if $test -f "$byacc$_exe"; then
3659ebf1
JH
21618 dflt="$byacc"
21619 comp="byacc or $comp"
21620fi
3c728e00 21621if $test -f "$bison$_exe"; then
3659ebf1
JH
21622 comp="$comp or bison -y"
21623fi
21624rp="Which compiler compiler ($comp) shall I use?"
21625. ./myread
21626yacc="$ans"
21627case "$yacc" in
21628*bis*)
21629 case "$yacc" in
21630 *-y*) ;;
21631 *)
21632 yacc="$yacc -y"
21633 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21634 ;;
21635 esac
21636 ;;
21637esac
21638
c0bacbef
MB
21639: see if this is a assert.h system
21640set assert.h i_assert
21641eval $inhdr
21642
758a5d79
JH
21643: see if this is a fp.h system
21644set fp.h i_fp
21645eval $inhdr
21646
21647: see if this is a fp_class.h system
21648set fp_class.h i_fp_class
21649eval $inhdr
21650
13cfc98d
MB
21651: see if gdbm.h is available
21652set gdbm.h t_gdbm
21653eval $inhdr
21654case "$t_gdbm" in
21655$define)
21656 : see if gdbm_open exists
21657 set gdbm_open d_gdbm_open
21658 eval $inlibc
21659 case "$d_gdbm_open" in
21660 $undef)
21661 t_gdbm="$undef"
21662 echo "We won't be including <gdbm.h>"
21663 ;;
21664 esac
21665 ;;
21666esac
21667val="$t_gdbm"
21668set i_gdbm
21669eval $setvar
21670
b2f871ed
AD
21671: see if this is a ieeefp.h system
21672case "$i_ieeefp" in
21673'' ) set ieeefp.h i_ieeefp
21674 eval $inhdr
21675 ;;
21676esac
21677
21678: see if this is a libutil.h system
21679set libutil.h i_libutil
21680eval $inhdr
21681
21682: see if mach cthreads are available
21683if test "X$usethreads" = "X$define"; then
21684 set mach/cthreads.h i_machcthr
21685 eval $inhdr
21686else
21687 i_machcthr="$undef"
21688fi
21689
21690: see if this is a mntent.h system
21691set mntent.h i_mntent
21692eval $inhdr
21693
b4eb6b3d
JH
21694: see if net/errno.h is available
21695val=''
21696set net/errno.h val
21697eval $inhdr
21698
21699: Unfortunately, it causes problems on some systems. Arrgh.
21700case "$val" in
21701$define)
21702 cat > try.c <<'EOM'
21703#include <stdio.h>
21704#include <errno.h>
21705#include <net/errno.h>
21706int func()
21707{
21708 return ENOTSOCK;
21709}
21710EOM
21711 if $cc $ccflags -c try.c >/dev/null 2>&1; then
21712 echo "We'll be including <net/errno.h>." >&4
21713 else
21714 echo "We won't be including <net/errno.h>." >&4
21715 val="$undef"
21716 fi
5b813a60 21717 $rm_try
b4eb6b3d
JH
21718 ;;
21719esac
21720set i_neterrno
21721eval $setvar
21722
21723: see if netinet/tcp.h is available
21724set netinet/tcp.h i_netinettcp
21725eval $inhdr
21726
21727: see if this is a poll.h system
21728set poll.h i_poll
21729eval $inhdr
21730
21731: see if this is a prot.h system
21732set prot.h i_prot
21733eval $inhdr
21734
613d6c3e 21735: Preprocessor symbols
b4eb6b3d 21736echo " "
ddfca5da 21737$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
21738$cat <<'EOSH' > Cppsym.know
21739a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21740AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 21741alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
21742ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21743BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
21744BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21745bull c cadmus clipper CMU COFF COMPILER_VERSION
21746concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 21747CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
21748Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21749FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21750GLIBC GLIBC_MINOR
21751GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
21752H3050R H3050RX hbullx20 hcx host_mips
21753hp200 hp300 hp700 HP700 hp800 hp9000
21754hp9000s200 hp9000s300 hp9000s400 hp9000s500
21755hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21756i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 21757IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
21758INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21759LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21760LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 21761LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
21762LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21763M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21764M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21765M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21766MATH_HAS_NO_SIDE_EFFECTS
21767mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21768mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21769mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21770MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21771mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21772NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 21773news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
21774ns32016 ns32332 ns32k nsc32000
21775OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21776pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21777pc532 pdp11 PGC PIC plexus PORTAR posix
21778POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21779POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 21780PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 21781riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
21782SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21783sony sony_news sonyrisc sparc sparclite spectrum
21784stardent stdc STDC_EXT stratos sun sun3 sun386
21785Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21786SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21787SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21788sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 21789TM3200 TM5400 TM5600
b4eb6b3d
JH
21790tower tower32 tower32_200 tower32_600 tower32_700
21791tower32_800 tower32_850 tss
21792u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21793ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
21794unix UNIX95 UNIX99 unixpc unos
21795USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21796USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21797USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21798USGr4 USGr4_2
44c87379 21799Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
21800XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21801XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21802z8000
21803EOSH
21804# Maybe put other stuff here too.
21805cat <<EOSH >>Cppsym.know
21806$osname
21807EOSH
21808./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21809./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21810$cat Cppsym.know > Cppsym.c
381aa1ff 21811$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
21812$rm -f Cppsym.a Cppsym.b Cppsym.c
21813cat <<EOSH > Cppsym
21814$startsh
21815if $test \$# -gt 0; then
21816 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21817 if $test -s Cppsym.got; then
21818 $rm -f Cppsym.got
21819 exit 0
21820 fi
21821 $rm -f Cppsym.got
21822 exit 1
21823else
21824 $tr " " "$trnl" | ./Cppsym.try
21825 exit 0
21826fi
21827EOSH
21828chmod +x Cppsym
21829$eunicefix Cppsym
21830cat <<EOSH > Cppsym.try
21831$startsh
21832cat <<'EOCP' > try.c
21833#include <stdio.h>
360321b3
YST
21834#if cpp_stuff == 1
21835#define STRINGIFY(a) "a"
21836#endif
21837#if cpp_stuff == 42
21838#define StGiFy(a) #a
21839#define STRINGIFY(a) StGiFy(a)
21840#endif
21841#if $cpp_stuff != 1 && $cpp_stuff != 42
21842# include "Bletch: How does this C preprocessor stringify macros?"
21843#endif
b4eb6b3d
JH
21844int main() {
21845EOCP
21846$awk \\
21847EOSH
21848cat <<'EOSH' >> Cppsym.try
21849'length($1) > 0 {
360321b3
YST
21850 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21851 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21852 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21853 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 21854}' >> try.c
2ef53570 21855echo 'return 0;}' >> try.c
b4eb6b3d
JH
21856EOSH
21857cat <<EOSH >> Cppsym.try
21858ccflags="$ccflags"
21859case "$osname-$gccversion" in
21860irix-) ccflags="\$ccflags -woff 1178" ;;
21861os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21862esac
360321b3 21863$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
21864EOSH
21865chmod +x Cppsym.try
21866$eunicefix Cppsym.try
21867./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 21868: Add in any linux cpp "predefined macros":
b6a7163e 21869case "$osname::$gccversion" in
eeb92b76 21870 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
b6a7163e
MB
21871 tHdrH=_tmpHdr
21872 rm -f $tHdrH'.h' $tHdrH
21873 touch $tHdrH'.h'
6f5be6d1 21874 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
b6a7163e
MB
21875 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21876 if [ -s $tHdrH'_cppsym.real' ]; then
21877 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21878 fi
21879 fi
21880 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21881 ;;
21882esac
b4eb6b3d
JH
21883: now check the C compiler for additional symbols
21884postprocess_cc_v=''
21885case "$osname" in
21886aix) postprocess_cc_v="|$tr , ' '" ;;
21887esac
21888$cat >ccsym <<EOS
21889$startsh
21890$cat >tmp.c <<EOF
21891extern int foo;
21892EOF
21893for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21894do
21895 case "\$i" in
21896 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 21897 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
21898 esac
21899done
5b813a60 21900$rm_try
b4eb6b3d
JH
21901EOS
21902postprocess_cc_v=''
21903chmod +x ccsym
21904$eunicefix ccsym
21905./ccsym > ccsym1.raw
21906if $test -s ccsym1.raw; then
21907 $sort ccsym1.raw | $uniq >ccsym.raw
21908else
21909 mv ccsym1.raw ccsym.raw
21910fi
21911
21912$awk '/\=/ { print $0; next }
21913 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
21914$comm -13 Cppsym.true ccsym.list >ccsym.own
21915$comm -12 Cppsym.true ccsym.list >ccsym.com
21916$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
21917also=''
21918if $test -z ccsym.raw; then
21919 echo "Your C compiler doesn't seem to define any symbols!" >&4
21920 echo " "
21921 echo "However, your C preprocessor defines the following symbols:"
21922 $cat Cppsym.true
21923 ccsymbols=''
21924 cppsymbols=`$cat Cppsym.true`
21925 cppsymbols=`echo $cppsymbols`
21926 cppccsymbols="$cppsymbols"
21927else
21928 if $test -s ccsym.com; then
21929 echo "Your C compiler and pre-processor define these symbols:"
21930 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21931 also='also '
21932 symbols='ones'
21933 cppccsymbols=`$cat ccsym.com`
21934 cppccsymbols=`echo $cppccsymbols`
21935 $test "$silent" || sleep 1
21936 fi
21937 if $test -s ccsym.cpp; then
21938 $test "$also" && echo " "
21939 echo "Your C pre-processor ${also}defines the following symbols:"
21940 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21941 also='further '
21942 cppsymbols=`$cat ccsym.cpp`
21943 cppsymbols=`echo $cppsymbols`
21944 $test "$silent" || sleep 1
21945 fi
21946 if $test -s ccsym.own; then
21947 $test "$also" && echo " "
21948 echo "Your C compiler ${also}defines the following cpp symbols:"
21949 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21950 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21951 ccsymbols=`$cat ccsym.own`
21952 ccsymbols=`echo $ccsymbols`
21953 $test "$silent" || sleep 1
21954 fi
21955fi
b4eb6b3d
JH
21956
21957: see if this is a termio system
21958val="$undef"
21959val2="$undef"
21960val3="$undef"
21961if $test `./findhdr termios.h`; then
21962 set tcsetattr i_termios
21963 eval $inlibc
21964 val3="$i_termios"
21965fi
21966echo " "
21967case "$val3" in
21968"$define") echo "You have POSIX termios.h... good!" >&4;;
21969*) if ./Cppsym pyr; then
21970 case "`/bin/universe`" in
21971 ucb) if $test `./findhdr sgtty.h`; then
21972 val2="$define"
21973 echo "<sgtty.h> found." >&4
21974 else
21975 echo "System is pyramid with BSD universe."
216dac04 21976 ./warn "<sgtty.h> not found--you could have problems."
b4eb6b3d
JH
21977 fi;;
21978 *) if $test `./findhdr termio.h`; then
21979 val="$define"
21980 echo "<termio.h> found." >&4
21981 else
21982 echo "System is pyramid with USG universe."
216dac04 21983 ./warn "<termio.h> not found--you could have problems."
b4eb6b3d
JH
21984 fi;;
21985 esac
21986 elif ./usg; then
21987 if $test `./findhdr termio.h`; then
21988 echo "<termio.h> found." >&4
21989 val="$define"
21990 elif $test `./findhdr sgtty.h`; then
21991 echo "<sgtty.h> found." >&4
21992 val2="$define"
21993 else
216dac04 21994 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
b4eb6b3d
JH
21995 fi
21996 else
21997 if $test `./findhdr sgtty.h`; then
21998 echo "<sgtty.h> found." >&4
21999 val2="$define"
22000 elif $test `./findhdr termio.h`; then
22001 echo "<termio.h> found." >&4
22002 val="$define"
22003 else
216dac04 22004 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
b4eb6b3d
JH
22005 fi
22006 fi;;
22007esac
22008set i_termio; eval $setvar
22009val=$val2; set i_sgtty; eval $setvar
22010val=$val3; set i_termios; eval $setvar
22011
bd31be4b 22012: see if stdbool is available
0dcb3d88
MB
22013: we want a real compile instead of Inhdr because some Solaris systems
22014: have stdbool.h, but it can only be used if the compiler indicates it
22015: is sufficiently c99-compliant.
22016echo " "
22017$cat >try.c <<EOCP
22018#include <stdio.h>
22019#include <stdbool.h>
22020int func(bool x)
22021{
22022 return x ? 1 : 0;
22023}
22024int main(int argc, char **argv)
22025{
22026 return func(0);
22027}
22028EOCP
22029set try
22030if eval $compile; then
22031 echo "<stdbool.h> found." >&4
22032 val="$define"
22033else
22034 echo "<stdbool.h> NOT found." >&4
22035 val="$undef"
22036fi
22037$rm_try
22038set i_stdbool
22039eval $setvar
bd31be4b 22040
b4eb6b3d
JH
22041: see if stddef is available
22042set stddef.h i_stddef
22043eval $inhdr
923fc586 22044
b4eb6b3d
JH
22045: see if sys/access.h is available
22046set sys/access.h i_sysaccess
22047eval $inhdr
22048
22049: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22050set sys/filio.h i_sysfilio
22051eval $inhdr
22052echo " "
22053if $test `./findhdr sys/ioctl.h`; then
22054 val="$define"
22055 echo '<sys/ioctl.h> found.' >&4
22056else
22057 val="$undef"
22058 if $test $i_sysfilio = "$define"; then
22059 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 22060 else
b4eb6b3d
JH
22061 $test $i_sgtty = "$define" && xxx="sgtty.h"
22062 $test $i_termio = "$define" && xxx="termio.h"
22063 $test $i_termios = "$define" && xxx="termios.h"
22064echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22065 fi
22066fi
22067set i_sysioctl
22068eval $setvar
22069
49a78c82
JH
22070: see if socket ioctl defs are in sys/sockio.h
22071echo " "
22072xxx=`./findhdr sys/sockio.h`
22073if $test "$xxx"; then
22074 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22075 val="$define"
22076 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22077 else
22078 val="$undef"
22079 echo "No socket ioctls found in <sys/sockio.h>." >&4
22080 fi
22081else
22082 val="$undef"
22083 $cat <<EOM
22084<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22085EOM
22086fi
22087set i_syssockio
22088eval $setvar
22089
b4eb6b3d
JH
22090: see if this is a syslog.h system
22091set syslog.h i_syslog
22092eval $inhdr
22093
b4eb6b3d
JH
22094: see if this is a sys/mode.h system
22095set sys/mode.h i_sysmode
22096eval $inhdr
22097
216dac04
MB
22098: see if there is a sys/poll.h file
22099set sys/poll.h i_syspoll
22100eval $inhdr
22101
b4eb6b3d
JH
22102: see if sys/resource.h has to be included
22103set sys/resource.h i_sysresrc
22104eval $inhdr
22105
22106: see if sys/security.h is available
22107set sys/security.h i_syssecrt
22108eval $inhdr
22109
22110: see if this is a sys/statvfs.h system
22111set sys/statvfs.h i_sysstatvfs
22112eval $inhdr
22113
b4eb6b3d
JH
22114: see if this is a sys/un.h system
22115set sys/un.h i_sysun
22116eval $inhdr
22117
b4eb6b3d
JH
22118: see if this is a sys/utsname.h system
22119set sys/utsname.h i_sysutsname
22120eval $inhdr
22121
22122: see if this is a syswait system
22123set sys/wait.h i_syswait
22124eval $inhdr
22125
22126: see if this is a ustat.h system
22127set ustat.h i_ustat
22128eval $inhdr
22129
22130: see if this is an utime system
22131set utime.h i_utime
22132eval $inhdr
22133
b4eb6b3d
JH
22134: see if this is a vfork system
22135case "$d_vfork" in
22136"$define")
22137 set vfork.h i_vfork
22138 eval $inhdr
22139 ;;
22140*)
22141 i_vfork="$undef"
22142 ;;
22143esac
22144
613d6c3e 22145: Check extensions
b4eb6b3d
JH
22146echo " "
22147echo "Looking for extensions..." >&4
22148: If we are using the old config.sh, known_extensions may contain
22149: old or inaccurate or duplicate values.
22150known_extensions=''
22151nonxs_extensions=''
22152: We do not use find because it might not be available.
22153: We do not just use MANIFEST because the user may have dropped
22154: some additional extensions into the source tree and expect them
22155: to be built.
22156
38fddf8b
MB
22157: Function to recursively find available extensions, ignoring DynaLoader
22158: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
4cc80fc4 22159: In 5.10.1 and later, extensions are stored in directories
88a6f4fc 22160: like File-Glob instead of the older File/Glob/.
b4eb6b3d
JH
22161find_extensions='
22162 for xxx in *; do
822a6ee0
MB
22163 case "$xxx" in
22164 DynaLoader|dynaload) ;;
22165 *)
238a6851
NC
22166 this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22167 leaf=`echo $xxx | $sed -e s/.*-//`;
dd6c21be 22168 if $test -d File; then
38fddf8b
MB
22169 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22170 known_extensions="$known_extensions $1$this_ext";
22171 elif $test -f $xxx/Makefile.PL; then
22172 nonxs_extensions="$nonxs_extensions $1$this_ext";
22173 else
22174 if $test -d $xxx -a $# -lt 10; then
22175 set $1$xxx/ $*;
22176 cd "$xxx";
22177 eval $find_extensions;
22178 cd ..;
22179 shift;
22180 fi;
22181 fi;
dd6c21be 22182 else
86429348
NC
22183 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22184 if $contains " $this_ext " $$.tmp; then
01db32e2 22185 echo >&4;
86429348
NC
22186 echo "Duplicate directories detected for extension $xxx" >&4;
22187 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22188 case "$knowitall" in
22189 "") dflt=y;;
22190 *) dflt=n;;
22191 esac;
22192 . ../UU/myread;
22193 case "$ans" in
22194 n*|N*) ;;
01db32e2
NC
22195 *) echo >&4;
22196 echo "Ok. Stopping Configure." >&4;
86429348
NC
22197 echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22198 exit 1;;
22199 esac;
22200 echo "Ok. You will need to correct config.sh before running make." >&4;
22201 fi;
dd6c21be
NC
22202 $ls -1 $xxx > $$.tmp;
22203 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22204 known_extensions="$known_extensions $this_ext";
22205 elif $contains "\.c$" $$.tmp > /dev/null 2>&1; then
22206 known_extensions="$known_extensions $this_ext";
dd6c21be
NC
22207 elif $test -d $xxx; then
22208 nonxs_extensions="$nonxs_extensions $this_ext";
22209 fi;
22210 $rm -f $$.tmp;
822a6ee0
MB
22211 fi
22212 ;;
22213 esac;
b4eb6b3d
JH
22214 done'
22215tdir=`pwd`
dd6c21be
NC
22216cd "$rsrc/cpan"
22217set X
22218shift
22219eval $find_extensions
a193a2db
NC
22220cd "$rsrc/dist"
22221set X
22222shift
22223eval $find_extensions
6904989c 22224cd "$rsrc/ext"
b4eb6b3d
JH
22225set X
22226shift
22227eval $find_extensions
38fddf8b
MB
22228if $test -d File-Glob; then
22229 : All ext/ flattened
22230else
22231 # Special case: Add in modules that nest beyond the first level.
22232 # Currently threads/shared and Hash/Util/FieldHash, since they are
22233 # not picked up by the recursive find above (and adding in general
22234 # recursive finding breaks SDBM_File/sdbm).
22235 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22236 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22237fi
faae14e6
MB
22238set X $known_extensions
22239shift
a32b3e13 22240known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
b4eb6b3d
JH
22241set X $nonxs_extensions
22242shift
a32b3e13 22243nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
6904989c 22244cd "$tdir"
b4eb6b3d
JH
22245
22246: Now see which are supported on this system.
22247avail_ext=''
22248for xxx in $known_extensions ; do
22249 case "$xxx" in
22250 DB_File|db_file)
22251 case "$i_db" in
22252 $define) avail_ext="$avail_ext $xxx" ;;
22253 esac
22254 ;;
22255 GDBM_File|gdbm_fil)
7c345082 22256 case "$i_gdbm" in
b4eb6b3d
JH
22257 $define) avail_ext="$avail_ext $xxx" ;;
22258 esac
22259 ;;
1d59c593 22260 I18N/Langinfo|i18n_lan)
7c345082 22261 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
22262 $define$define) avail_ext="$avail_ext $xxx" ;;
22263 esac
22264 ;;
7978b0db
JH
22265 IPC/SysV|ipc/sysv)
22266 : XXX Do we need a useipcsysv variable here
22267 case "${d_msg}${d_sem}${d_shm}" in
22268 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22269 esac
22270 ;;
b4eb6b3d 22271 NDBM_File|ndbm_fil)
7894ad66 22272 case "$d_ndbm" in
b4eb6b3d
JH
22273 $define)
22274 case "$osname-$use64bitint" in
0be9fa5d 22275 hpux-define)
b4eb6b3d
JH
22276 case "$libs" in
22277 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22278 esac
22279 ;;
22280 *) avail_ext="$avail_ext $xxx" ;;
22281 esac
22282 ;;
22283 esac
22284 ;;
7c345082 22285 ODBM_File|odbm_fil)
b4eb6b3d
JH
22286 case "${i_dbm}${i_rpcsvcdbm}" in
22287 *"${define}"*)
7978b0db
JH
22288 case "$d_cplusplus" in
22289 define) ;; # delete as a function name will not work
22290 *) case "$osname-$use64bitint" in
22291 hpux-define)
22292 case "$libs" in
22293 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22294 esac
22295 ;;
22296 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
22297 esac
22298 ;;
b4eb6b3d
JH
22299 esac
22300 ;;
22301 esac
22302 ;;
7978b0db
JH
22303 Opcode|opcode)
22304 case "$useopcode" in
b4eb6b3d
JH
22305 true|define|y) avail_ext="$avail_ext $xxx" ;;
22306 esac
22307 ;;
7978b0db
JH
22308 POSIX|posix)
22309 case "$useposix" in
b4eb6b3d
JH
22310 true|define|y) avail_ext="$avail_ext $xxx" ;;
22311 esac
22312 ;;
22313 Socket|socket)
7c345082 22314 case "$d_socket" in
4a9f028c
JH
22315 true|$define|y)
22316 case "$osname" in
22317 beos) ;; # not unless BONE
22318 *) avail_ext="$avail_ext $xxx" ;;
22319 esac
22320 ;;
b4eb6b3d
JH
22321 esac
22322 ;;
22323 Sys/Syslog|sys/syslog)
22324 : XXX syslog requires socket
7c345082 22325 case "$d_socket" in
b4eb6b3d
JH
22326 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22327 esac
22328 ;;
22329 Thread|thread)
b00ec89b
AB
22330 case "$usethreads" in
22331 true|$define|y)
47f9f84c 22332 case "$use5005threads" in
3f30fabf 22333 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 22334 esac
b4eb6b3d
JH
22335 esac
22336 ;;
7978b0db
JH
22337 threads|threads/shared)
22338 # threads and threads::shared are special cases.
22339 # To stop people from asking "Perl 5.8.0 was supposed
22340 # to have this new fancy threads implementation but my
22341 # perl doesn't have it" and from people trying to
22342 # (re)install the threads module using CPAN.pm and
22343 # CPAN.pm then offering to reinstall Perl 5.8.0,
22344 # the threads.pm and threads/shared.pm will always be
22345 # there, croaking informatively ("you need to rebuild
22346 # all of Perl with threads, sorry") when threads haven't
22347 # been compiled in.
22348 # --jhi
22349 avail_ext="$avail_ext $xxx"
22350 ;;
aefe3e7e
NC
22351 VMS*)
22352 ;;
78ff2d7b 22353 Win32*)
b149d92d
JD
22354 case "$osname" in
22355 cygwin) avail_ext="$avail_ext $xxx" ;;
22356 esac
22357 ;;
f9b6ed1c
AD
22358 XS/APItest|xs/apitest)
22359 # This is just for testing. Skip it unless we have dynamic loading.
88e1f1a2
JV
22360
22361 case "$usedl" in
22362 $define) avail_ext="$avail_ext $xxx" ;;
22363 esac
22364 ;;
f9b6ed1c
AD
22365 XS/Typemap|xs/typemap)
22366 # This is just for testing. Skip it unless we have dynamic loading.
22367 case "$usedl" in
22368 $define) avail_ext="$avail_ext $xxx" ;;
22369 esac
22370 ;;
b4eb6b3d 22371 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
22372 ;;
22373 esac
b4eb6b3d 22374done
5f80c64f 22375
b4eb6b3d
JH
22376set X $avail_ext
22377shift
22378avail_ext="$*"
5f80c64f 22379
ef0c5be8
JH
22380case "$onlyextensions" in
22381'') ;;
22382*) keepextensions=''
cd95ead5 22383 echo "You have requested that only certain extensions be included..." >&4
ef0c5be8
JH
22384 for i in $onlyextensions; do
22385 case " $avail_ext " in
22386 *" $i "*)
22387 echo "Keeping extension $i."
22388 keepextensions="$keepextensions $i"
22389 ;;
22390 *) echo "Ignoring extension $i." ;;
22391 esac
22392 done
22393 avail_ext="$keepextensions"
22394 ;;
22395esac
22396
22397case "$noextensions" in
22398'') ;;
22399*) keepextensions=''
22400 echo "You have requested that certain extensions be ignored..." >&4
22401 for i in $avail_ext; do
c3dadc13
AD
22402 case " $noextensions " in
22403 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
22404 *) echo "Keeping extension $i.";
22405 keepextensions="$keepextensions $i"
22406 ;;
22407 esac
22408 done
22409 avail_ext="$keepextensions"
22410 ;;
22411esac
22412
b4eb6b3d
JH
22413: Now see which nonxs extensions are supported on this system.
22414: For now assume all are.
22415nonxs_ext=''
22416for xxx in $nonxs_extensions ; do
22417 case "$xxx" in
22418 *) nonxs_ext="$nonxs_ext $xxx"
22419 ;;
22420 esac
22421done
5f80c64f 22422
b4eb6b3d
JH
22423set X $nonxs_ext
22424shift
22425nonxs_ext="$*"
22426
22427case $usedl in
22428$define)
22429 $cat <<EOM
22430A number of extensions are supplied with $package. You may choose to
22431compile these extensions for dynamic loading (the default), compile
22432them into the $package executable (static loading), or not include
22433them at all. Answer "none" to include no extensions.
22434Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
22435
22436EOM
b4eb6b3d 22437 case "$dynamic_ext" in
736accd3
YST
22438 '')
22439 : Exclude those listed in static_ext
22440 dflt=''
22441 for xxx in $avail_ext; do
22442 case " $static_ext " in
22443 *" $xxx "*) ;;
22444 *) dflt="$dflt $xxx" ;;
22445 esac
22446 done
22447 set X $dflt
22448 shift
22449 dflt="$*"
22450 ;;
b4eb6b3d
JH
22451 *) dflt="$dynamic_ext"
22452 # Perhaps we are reusing an old out-of-date config.sh.
22453 case "$hint" in
22454 previous)
22455 if test X"$dynamic_ext" != X"$avail_ext"; then
22456 $cat <<EOM
7c345082
RGS
22457NOTICE: Your previous config.sh list may be incorrect.
22458The extensions now available to you are
b4eb6b3d
JH
22459 ${avail_ext}
22460but the default list from your previous config.sh is
7c345082 22461 ${dynamic_ext}
9c839522 22462
b4eb6b3d
JH
22463EOM
22464 fi
9c839522
PM
22465 ;;
22466 esac
b4eb6b3d
JH
22467 ;;
22468 esac
5f80c64f 22469 case "$dflt" in
b4eb6b3d
JH
22470 '') dflt=none;;
22471 esac
22472 rp="What extensions do you wish to load dynamically?"
22473 . ./myread
22474 case "$ans" in
22475 none) dynamic_ext=' ' ;;
22476 *) dynamic_ext="$ans" ;;
5f80c64f 22477 esac
5f80c64f 22478
b4eb6b3d
JH
22479 case "$static_ext" in
22480 '')
22481 : Exclude those already listed in dynamic linking
22482 dflt=''
22483 for xxx in $avail_ext; do
22484 case " $dynamic_ext " in
22485 *" $xxx "*) ;;
22486 *) dflt="$dflt $xxx" ;;
22487 esac
22488 done
22489 set X $dflt
22490 shift
22491 dflt="$*"
22492 ;;
7c345082 22493 *) dflt="$static_ext"
b4eb6b3d
JH
22494 ;;
22495 esac
9c839522 22496
b4eb6b3d
JH
22497 case "$dflt" in
22498 '') dflt=none;;
22499 esac
22500 rp="What extensions do you wish to load statically?"
22501 . ./myread
22502 case "$ans" in
22503 none) static_ext=' ' ;;
22504 *) static_ext="$ans" ;;
22505 esac
22506 ;;
22507*)
22508 $cat <<EOM
7c345082
RGS
22509A number of extensions are supplied with $package. Answer "none"
22510to include no extensions.
b4eb6b3d 22511Note that DynaLoader is always built and need not be mentioned here.
9c839522 22512
b4eb6b3d
JH
22513EOM
22514 case "$static_ext" in
22515 '') dflt="$avail_ext" ;;
22516 *) dflt="$static_ext"
22517 # Perhaps we are reusing an old out-of-date config.sh.
22518 case "$hint" in
22519 previous)
22520 if test X"$static_ext" != X"$avail_ext"; then
22521 $cat <<EOM
7c345082
RGS
22522NOTICE: Your previous config.sh list may be incorrect.
22523The extensions now available to you are
b4eb6b3d
JH
22524 ${avail_ext}
22525but the default list from your previous config.sh is
7c345082 22526 ${static_ext}
5f80c64f
JH
22527
22528EOM
b4eb6b3d
JH
22529 fi
22530 ;;
22531 esac
22532 ;;
22533 esac
22534 : Exclude those that are not xs extensions
22535 case "$dflt" in
22536 '') dflt=none;;
22537 esac
22538 rp="What extensions do you wish to include?"
22539 . ./myread
22540 case "$ans" in
22541 none) static_ext=' ' ;;
22542 *) static_ext="$ans" ;;
22543 esac
22544 ;;
5f80c64f 22545esac
7c345082 22546#
f1f6834f
AD
22547# Encode is a special case. If we are building Encode as a static
22548# extension, we need to explicitly list its subextensions as well.
22549# For other nested extensions, this is handled automatically by
22550# the appropriate Makefile.PL.
22551case " $static_ext " in
22552 *" Encode "*) # Add the subextensions of Encode
d9a4b459 22553 cd "$rsrc/cpan"
f1f6834f
AD
22554 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22555 static_ext="$static_ext Encode/$xxx"
22556 done
22557 cd "$tdir"
22558 ;;
22559esac
5f80c64f 22560
b4eb6b3d
JH
22561set X $dynamic_ext $static_ext $nonxs_ext
22562shift
22563extensions="$*"
22564
93a2cd18
AD
22565# Sanity check: We require an extension suitable for use with
22566# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
22567# should show up as failures in the test suite, but it's helpful to
22568# catch them now.) The 'extensions' list is normally sorted
22569# alphabetically, so we need to accept either
22570# DB_File ... Fcntl ... IO ....
22571# or something like
22572# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
22573case " $extensions" in
22574*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22575*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22576*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
22577*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22578 echo "WARNING: The Perl you are building will be quite crippled." >& 4
22579 ;;
22580esac
22581
9c839522
PM
22582: Remove libraries needed only for extensions
22583: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
22584: The exception is SunOS 4.x, which needs them.
22585case "${osname}X${osvers}" in
22586sunos*X4*)
22587 perllibs="$libs"
22588 ;;
22589*) case "$usedl" in
22590 $define|true|[yY]*)
a33f2d9f 22591 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
eedaba54
PM
22592 shift
22593 perllibs="$*"
22594 ;;
22595 *) perllibs="$libs"
22596 ;;
22597 esac
22598 ;;
9c839522 22599esac
5f80c64f
JH
22600
22601: Remove build directory name from cppstdin so it can be used from
22602: either the present location or the final installed location.
22603echo " "
22604: Get out of the UU directory to get correct path name.
22605cd ..
22606case "$cppstdin" in
22607`pwd`/cppstdin)
22608 echo "Stripping down cppstdin path name"
22609 cppstdin=cppstdin
22610 ;;
22611esac
22612cd UU
22613
22614: end of configuration questions
22615echo " "
22616echo "End of configuration questions."
22617echo " "
22618
22619: back to where it started
22620if test -d ../UU; then
22621 cd ..
22622fi
22623
776a38e3 22624: configuration may be unconditionally patched via a 'config.arch' file
48370efc 22625if $test -f config.arch; then
776a38e3 22626 echo "I see a config.arch file, loading it." >&4
48370efc
JH
22627 . ./config.arch
22628fi
22629
5f80c64f
JH
22630: configuration may be patched via a 'config.over' file
22631if $test -f config.over; then
22632 echo " "
22633 dflt=y
22634 rp='I see a config.over file. Do you wish to load it?'
22635 . UU/myread
22636 case "$ans" in
22637 n*) echo "OK, I'll ignore it.";;
22638 *) . ./config.over
22639 echo "Configuration override changes have been loaded."
22640 ;;
22641 esac
22642fi
22643
22644: in case they want portability, strip down executable paths
22645case "$d_portable" in
22646"$define")
22647 echo " "
22648 echo "Stripping down executable paths..." >&4
22649 for file in $loclist $trylist; do
534ac15a
JH
22650 eval temp=\$$file
22651 eval $file=`basename $temp`
5f80c64f
JH
22652 done
22653 ;;
22654esac
22655
22656: create config.sh file
22657echo " "
22658echo "Creating config.sh..." >&4
22659$spitshell <<EOT >config.sh
22660$startsh
22661#
22662# This file was produced by running the Configure script. It holds all the
22663# definitions figured out by Configure. Should you modify one of these values,
22664# do not forget to propagate your changes by running "Configure -der". You may
22665# instead choose to run each of the .SH files by yourself, or "Configure -S".
22666#
22667
22668# Package name : $package
22669# Source directory : $src
22670# Configuration time: $cf_time
22671# Configured by : $cf_by
22672# Target system : $myuname
22673
776a38e3 22674EOT
94a9a4bc 22675: Add in command line options if available
776a38e3 22676$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
94a9a4bc 22677
776a38e3
MB
22678$spitshell <<EOT >>config.sh
22679
5f80c64f
JH
22680Author='$Author'
22681Date='$Date'
22682Header='$Header'
22683Id='$Id'
22684Locker='$Locker'
22685Log='$Log'
5f80c64f
JH
22686RCSfile='$RCSfile'
22687Revision='$Revision'
22688Source='$Source'
22689State='$State'
22690_a='$_a'
22691_exe='$_exe'
22692_o='$_o'
b4eb6b3d 22693afs='$afs'
a6d26a0d 22694afsroot='$afsroot'
b4eb6b3d
JH
22695alignbytes='$alignbytes'
22696ansi2knr='$ansi2knr'
22697aphostname='$aphostname'
22698api_revision='$api_revision'
22699api_subversion='$api_subversion'
22700api_version='$api_version'
22701api_versionstring='$api_versionstring'
5f80c64f 22702ar='$ar'
b4eb6b3d
JH
22703archlib='$archlib'
22704archlibexp='$archlibexp'
22705archname64='$archname64'
22706archname='$archname'
5f80c64f 22707archobjs='$archobjs'
10bc17b6 22708asctime_r_proto='$asctime_r_proto'
5f80c64f 22709awk='$awk'
b4eb6b3d 22710baserev='$baserev'
5f80c64f 22711bash='$bash'
b4eb6b3d 22712bin='$bin'
f1ce3bf1 22713bin_ELF='$bin_ELF'
b4eb6b3d 22714binexp='$binexp'
5f80c64f
JH
22715bison='$bison'
22716byacc='$byacc'
b4eb6b3d 22717byteorder='$byteorder'
5f80c64f 22718c='$c'
b4eb6b3d 22719castflags='$castflags'
5f80c64f
JH
22720cat='$cat'
22721cc='$cc'
22722cccdlflags='$cccdlflags'
22723ccdlflags='$ccdlflags'
22724ccflags='$ccflags'
b4eb6b3d 22725ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 22726ccname='$ccname'
b4eb6b3d 22727ccsymbols='$ccsymbols'
6b356c8e 22728ccversion='$ccversion'
5f80c64f 22729cf_by='$cf_by'
b4eb6b3d 22730cf_email='$cf_email'
5f80c64f 22731cf_time='$cf_time'
c193ef60
MB
22732charbits='$charbits'
22733charsize='$charsize'
5f80c64f
JH
22734chgrp='$chgrp'
22735chmod='$chmod'
22736chown='$chown'
b4eb6b3d 22737clocktype='$clocktype'
5f80c64f
JH
22738comm='$comm'
22739compress='$compress'
22740contains='$contains'
22741cp='$cp'
22742cpio='$cpio'
22743cpp='$cpp'
b4eb6b3d
JH
22744cpp_stuff='$cpp_stuff'
22745cppccsymbols='$cppccsymbols'
5f80c64f
JH
22746cppflags='$cppflags'
22747cpplast='$cpplast'
22748cppminus='$cppminus'
22749cpprun='$cpprun'
22750cppstdin='$cppstdin'
b4eb6b3d 22751cppsymbols='$cppsymbols'
10bc17b6 22752crypt_r_proto='$crypt_r_proto'
b4eb6b3d 22753cryptlib='$cryptlib'
5f80c64f 22754csh='$csh'
10bc17b6
JH
22755ctermid_r_proto='$ctermid_r_proto'
22756ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
22757d_Gconvert='$d_Gconvert'
22758d_PRIEUldbl='$d_PRIEUldbl'
22759d_PRIFUldbl='$d_PRIFUldbl'
22760d_PRIGUldbl='$d_PRIGUldbl'
22761d_PRIXU64='$d_PRIXU64'
22762d_PRId64='$d_PRId64'
22763d_PRIeldbl='$d_PRIeldbl'
22764d_PRIfldbl='$d_PRIfldbl'
22765d_PRIgldbl='$d_PRIgldbl'
22766d_PRIi64='$d_PRIi64'
22767d_PRIo64='$d_PRIo64'
22768d_PRIu64='$d_PRIu64'
22769d_PRIx64='$d_PRIx64'
22770d_SCNfldbl='$d_SCNfldbl'
74cac757 22771d__fwalk='$d__fwalk'
b4eb6b3d
JH
22772d_access='$d_access'
22773d_accessx='$d_accessx'
55954f19 22774d_aintl='$d_aintl'
b4eb6b3d
JH
22775d_alarm='$d_alarm'
22776d_archlib='$d_archlib'
96938616 22777d_asctime64='$d_asctime64'
10bc17b6 22778d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
22779d_atolf='$d_atolf'
22780d_atoll='$d_atoll'
fcdf39cf 22781d_attribute_deprecated='$d_attribute_deprecated'
0dbb1585
AL
22782d_attribute_format='$d_attribute_format'
22783d_attribute_malloc='$d_attribute_malloc'
22784d_attribute_nonnull='$d_attribute_nonnull'
22785d_attribute_noreturn='$d_attribute_noreturn'
22786d_attribute_pure='$d_attribute_pure'
22787d_attribute_unused='$d_attribute_unused'
22788d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
22789d_bcmp='$d_bcmp'
22790d_bcopy='$d_bcopy'
5f80c64f 22791d_bsd='$d_bsd'
b4eb6b3d
JH
22792d_bsdgetpgrp='$d_bsdgetpgrp'
22793d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
22794d_builtin_choose_expr='$d_builtin_choose_expr'
22795d_builtin_expect='$d_builtin_expect'
b4eb6b3d 22796d_bzero='$d_bzero'
a2d23ec2 22797d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
22798d_casti32='$d_casti32'
22799d_castneg='$d_castneg'
22800d_charvspr='$d_charvspr'
22801d_chown='$d_chown'
22802d_chroot='$d_chroot'
22803d_chsize='$d_chsize'
758a5d79 22804d_class='$d_class'
b0a2e8e6 22805d_clearenv='$d_clearenv'
b4eb6b3d 22806d_closedir='$d_closedir'
4e0554ec 22807d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 22808d_const='$d_const'
55954f19 22809d_copysignl='$d_copysignl'
666ea192 22810d_cplusplus='$d_cplusplus'
b4eb6b3d 22811d_crypt='$d_crypt'
10bc17b6 22812d_crypt_r='$d_crypt_r'
b4eb6b3d 22813d_csh='$d_csh'
13cfc98d 22814d_ctermid='$d_ctermid'
10bc17b6 22815d_ctermid_r='$d_ctermid_r'
96938616 22816d_ctime64='$d_ctime64'
10bc17b6 22817d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
22818d_cuserid='$d_cuserid'
22819d_dbl_dig='$d_dbl_dig'
2ef53570 22820d_dbminitproto='$d_dbminitproto'
96938616 22821d_difftime64='$d_difftime64'
b4eb6b3d 22822d_difftime='$d_difftime'
de52168c 22823d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 22824d_dirfd='$d_dirfd'
b4eb6b3d
JH
22825d_dirnamlen='$d_dirnamlen'
22826d_dlerror='$d_dlerror'
5f80c64f 22827d_dlopen='$d_dlopen'
b4eb6b3d
JH
22828d_dlsymun='$d_dlsymun'
22829d_dosuid='$d_dosuid'
10bc17b6 22830d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
22831d_drand48proto='$d_drand48proto'
22832d_dup2='$d_dup2'
22833d_eaccess='$d_eaccess'
22834d_endgrent='$d_endgrent'
10bc17b6 22835d_endgrent_r='$d_endgrent_r'
b4eb6b3d 22836d_endhent='$d_endhent'
10bc17b6 22837d_endhostent_r='$d_endhostent_r'
b4eb6b3d 22838d_endnent='$d_endnent'
10bc17b6 22839d_endnetent_r='$d_endnetent_r'
b4eb6b3d 22840d_endpent='$d_endpent'
10bc17b6 22841d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 22842d_endpwent='$d_endpwent'
10bc17b6 22843d_endpwent_r='$d_endpwent_r'
b4eb6b3d 22844d_endsent='$d_endsent'
10bc17b6 22845d_endservent_r='$d_endservent_r'
b4eb6b3d 22846d_eofnblk='$d_eofnblk'
5f80c64f 22847d_eunice='$d_eunice'
15b61c98 22848d_faststdio='$d_faststdio'
b363b713 22849d_fchdir='$d_fchdir'
b4eb6b3d
JH
22850d_fchmod='$d_fchmod'
22851d_fchown='$d_fchown'
22852d_fcntl='$d_fcntl'
9d9004a9 22853d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
22854d_fd_macros='$d_fd_macros'
22855d_fd_set='$d_fd_set'
22856d_fds_bits='$d_fds_bits'
22857d_fgetpos='$d_fgetpos'
758a5d79
JH
22858d_finite='$d_finite'
22859d_finitel='$d_finitel'
b4eb6b3d
JH
22860d_flexfnam='$d_flexfnam'
22861d_flock='$d_flock'
2ef53570 22862d_flockproto='$d_flockproto'
b4eb6b3d 22863d_fork='$d_fork'
758a5d79 22864d_fp_class='$d_fp_class'
b4eb6b3d 22865d_fpathconf='$d_fpathconf'
758a5d79
JH
22866d_fpclass='$d_fpclass'
22867d_fpclassify='$d_fpclassify'
22868d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
22869d_fpos64_t='$d_fpos64_t'
22870d_frexpl='$d_frexpl'
22871d_fs_data_s='$d_fs_data_s'
22872d_fseeko='$d_fseeko'
22873d_fsetpos='$d_fsetpos'
22874d_fstatfs='$d_fstatfs'
22875d_fstatvfs='$d_fstatvfs'
411ab01c 22876d_fsync='$d_fsync'
b4eb6b3d
JH
22877d_ftello='$d_ftello'
22878d_ftime='$d_ftime'
dc814df1 22879d_futimes='$d_futimes'
e74475c7
MHM
22880d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22881d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
5086dff9 22882d_getaddrinfo='$d_getaddrinfo'
b4eb6b3d
JH
22883d_getcwd='$d_getcwd'
22884d_getespwnam='$d_getespwnam'
22885d_getfsstat='$d_getfsstat'
22886d_getgrent='$d_getgrent'
10bc17b6
JH
22887d_getgrent_r='$d_getgrent_r'
22888d_getgrgid_r='$d_getgrgid_r'
22889d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
22890d_getgrps='$d_getgrps'
22891d_gethbyaddr='$d_gethbyaddr'
22892d_gethbyname='$d_gethbyname'
22893d_gethent='$d_gethent'
22894d_gethname='$d_gethname'
10bc17b6
JH
22895d_gethostbyaddr_r='$d_gethostbyaddr_r'
22896d_gethostbyname_r='$d_gethostbyname_r'
22897d_gethostent_r='$d_gethostent_r'
b4eb6b3d 22898d_gethostprotos='$d_gethostprotos'
4e0554ec 22899d_getitimer='$d_getitimer'
b4eb6b3d 22900d_getlogin='$d_getlogin'
10bc17b6 22901d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
22902d_getmnt='$d_getmnt'
22903d_getmntent='$d_getmntent'
5086dff9 22904d_getnameinfo='$d_getnameinfo'
b4eb6b3d
JH
22905d_getnbyaddr='$d_getnbyaddr'
22906d_getnbyname='$d_getnbyname'
22907d_getnent='$d_getnent'
10bc17b6
JH
22908d_getnetbyaddr_r='$d_getnetbyaddr_r'
22909d_getnetbyname_r='$d_getnetbyname_r'
22910d_getnetent_r='$d_getnetent_r'
b4eb6b3d 22911d_getnetprotos='$d_getnetprotos'
0c0643d0 22912d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
22913d_getpbyname='$d_getpbyname'
22914d_getpbynumber='$d_getpbynumber'
22915d_getpent='$d_getpent'
22916d_getpgid='$d_getpgid'
22917d_getpgrp2='$d_getpgrp2'
22918d_getpgrp='$d_getpgrp'
22919d_getppid='$d_getppid'
22920d_getprior='$d_getprior'
10bc17b6
JH
22921d_getprotobyname_r='$d_getprotobyname_r'
22922d_getprotobynumber_r='$d_getprotobynumber_r'
22923d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
22924d_getprotoprotos='$d_getprotoprotos'
22925d_getprpwnam='$d_getprpwnam'
22926d_getpwent='$d_getpwent'
10bc17b6
JH
22927d_getpwent_r='$d_getpwent_r'
22928d_getpwnam_r='$d_getpwnam_r'
22929d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
22930d_getsbyname='$d_getsbyname'
22931d_getsbyport='$d_getsbyport'
22932d_getsent='$d_getsent'
10bc17b6
JH
22933d_getservbyname_r='$d_getservbyname_r'
22934d_getservbyport_r='$d_getservbyport_r'
22935d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
22936d_getservprotos='$d_getservprotos'
22937d_getspnam='$d_getspnam'
10bc17b6 22938d_getspnam_r='$d_getspnam_r'
b4eb6b3d 22939d_gettimeod='$d_gettimeod'
96938616 22940d_gmtime64='$d_gmtime64'
10bc17b6 22941d_gmtime_r='$d_gmtime_r'
5f80c64f 22942d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
22943d_grpasswd='$d_grpasswd'
22944d_hasmntopt='$d_hasmntopt'
22945d_htonl='$d_htonl'
55954f19 22946d_ilogbl='$d_ilogbl'
f3f1a2d8 22947d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
22948d_index='$d_index'
22949d_inetaton='$d_inetaton'
5086dff9
MB
22950d_inetntop='$d_inetntop'
22951d_inetpton='$d_inetpton'
b4eb6b3d
JH
22952d_int64_t='$d_int64_t'
22953d_isascii='$d_isascii'
269a7913 22954d_isblank='$d_isblank'
758a5d79
JH
22955d_isfinite='$d_isfinite'
22956d_isinf='$d_isinf'
b4eb6b3d
JH
22957d_isnan='$d_isnan'
22958d_isnanl='$d_isnanl'
22959d_killpg='$d_killpg'
22960d_lchown='$d_lchown'
22961d_ldbl_dig='$d_ldbl_dig'
0a0abfba 22962d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 22963d_link='$d_link'
96938616 22964d_localtime64='$d_localtime64'
10bc17b6 22965d_localtime_r='$d_localtime_r'
8572b25d 22966d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
22967d_locconv='$d_locconv'
22968d_lockf='$d_lockf'
22969d_longdbl='$d_longdbl'
22970d_longlong='$d_longlong'
22971d_lseekproto='$d_lseekproto'
22972d_lstat='$d_lstat'
22973d_madvise='$d_madvise'
7dd121ae
MB
22974d_malloc_good_size='$d_malloc_good_size'
22975d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
22976d_mblen='$d_mblen'
22977d_mbstowcs='$d_mbstowcs'
22978d_mbtowc='$d_mbtowc'
22979d_memchr='$d_memchr'
22980d_memcmp='$d_memcmp'
22981d_memcpy='$d_memcpy'
22982d_memmove='$d_memmove'
22983d_memset='$d_memset'
22984d_mkdir='$d_mkdir'
22985d_mkdtemp='$d_mkdtemp'
22986d_mkfifo='$d_mkfifo'
22987d_mkstemp='$d_mkstemp'
22988d_mkstemps='$d_mkstemps'
96938616 22989d_mktime64='$d_mktime64'
b4eb6b3d
JH
22990d_mktime='$d_mktime'
22991d_mmap='$d_mmap'
22992d_modfl='$d_modfl'
e67aeab1 22993d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 22994d_modflproto='$d_modflproto'
b4eb6b3d
JH
22995d_mprotect='$d_mprotect'
22996d_msg='$d_msg'
22997d_msg_ctrunc='$d_msg_ctrunc'
22998d_msg_dontroute='$d_msg_dontroute'
22999d_msg_oob='$d_msg_oob'
23000d_msg_peek='$d_msg_peek'
23001d_msg_proxy='$d_msg_proxy'
23002d_msgctl='$d_msgctl'
23003d_msgget='$d_msgget'
4e0554ec 23004d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
23005d_msgrcv='$d_msgrcv'
23006d_msgsnd='$d_msgsnd'
23007d_msync='$d_msync'
23008d_munmap='$d_munmap'
23009d_mymalloc='$d_mymalloc'
a33f2d9f 23010d_ndbm='$d_ndbm'
e74475c7 23011d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
b4eb6b3d 23012d_nice='$d_nice'
2765b840 23013d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 23014d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 23015d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
23016d_off64_t='$d_off64_t'
23017d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23018d_oldpthreads='$d_oldpthreads'
23019d_oldsock='$d_oldsock'
23020d_open3='$d_open3'
23021d_pathconf='$d_pathconf'
23022d_pause='$d_pause'
23023d_perl_otherlibdirs='$d_perl_otherlibdirs'
23024d_phostname='$d_phostname'
23025d_pipe='$d_pipe'
23026d_poll='$d_poll'
5f80c64f 23027d_portable='$d_portable'
c796e3db
MB
23028d_prctl='$d_prctl'
23029d_prctl_set_name='$d_prctl_set_name'
dcb594bc 23030d_printf_format_null='$d_printf_format_null'
c7aff470 23031d_procselfexe='$d_procselfexe'
233e16ce 23032d_pseudofork='$d_pseudofork'
d6483fcc 23033d_pthread_atfork='$d_pthread_atfork'
58d975c3 23034d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
23035d_pthread_yield='$d_pthread_yield'
23036d_pwage='$d_pwage'
23037d_pwchange='$d_pwchange'
23038d_pwclass='$d_pwclass'
23039d_pwcomment='$d_pwcomment'
23040d_pwexpire='$d_pwexpire'
23041d_pwgecos='$d_pwgecos'
23042d_pwpasswd='$d_pwpasswd'
23043d_pwquota='$d_pwquota'
23044d_qgcvt='$d_qgcvt'
23045d_quad='$d_quad'
10bc17b6
JH
23046d_random_r='$d_random_r'
23047d_readdir64_r='$d_readdir64_r'
b4eb6b3d 23048d_readdir='$d_readdir'
10bc17b6 23049d_readdir_r='$d_readdir_r'
b4eb6b3d 23050d_readlink='$d_readlink'
4e0554ec
JH
23051d_readv='$d_readv'
23052d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
23053d_rename='$d_rename'
23054d_rewinddir='$d_rewinddir'
23055d_rmdir='$d_rmdir'
23056d_safebcpy='$d_safebcpy'
23057d_safemcpy='$d_safemcpy'
23058d_sanemcmp='$d_sanemcmp'
ef9f17be 23059d_sbrkproto='$d_sbrkproto'
55954f19 23060d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
23061d_sched_yield='$d_sched_yield'
23062d_scm_rights='$d_scm_rights'
23063d_seekdir='$d_seekdir'
23064d_select='$d_select'
23065d_sem='$d_sem'
23066d_semctl='$d_semctl'
23067d_semctl_semid_ds='$d_semctl_semid_ds'
23068d_semctl_semun='$d_semctl_semun'
23069d_semget='$d_semget'
23070d_semop='$d_semop'
4e0554ec 23071d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
23072d_setegid='$d_setegid'
23073d_seteuid='$d_seteuid'
23074d_setgrent='$d_setgrent'
10bc17b6 23075d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
23076d_setgrps='$d_setgrps'
23077d_sethent='$d_sethent'
10bc17b6 23078d_sethostent_r='$d_sethostent_r'
4e0554ec 23079d_setitimer='$d_setitimer'
b4eb6b3d
JH
23080d_setlinebuf='$d_setlinebuf'
23081d_setlocale='$d_setlocale'
10bc17b6 23082d_setlocale_r='$d_setlocale_r'
b4eb6b3d 23083d_setnent='$d_setnent'
10bc17b6 23084d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
23085d_setpent='$d_setpent'
23086d_setpgid='$d_setpgid'
23087d_setpgrp2='$d_setpgrp2'
23088d_setpgrp='$d_setpgrp'
23089d_setprior='$d_setprior'
23090d_setproctitle='$d_setproctitle'
10bc17b6 23091d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 23092d_setpwent='$d_setpwent'
10bc17b6 23093d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
23094d_setregid='$d_setregid'
23095d_setresgid='$d_setresgid'
23096d_setresuid='$d_setresuid'
23097d_setreuid='$d_setreuid'
23098d_setrgid='$d_setrgid'
23099d_setruid='$d_setruid'
23100d_setsent='$d_setsent'
10bc17b6 23101d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
23102d_setsid='$d_setsid'
23103d_setvbuf='$d_setvbuf'
23104d_sfio='$d_sfio'
23105d_shm='$d_shm'
23106d_shmat='$d_shmat'
23107d_shmatprototype='$d_shmatprototype'
23108d_shmctl='$d_shmctl'
23109d_shmdt='$d_shmdt'
23110d_shmget='$d_shmget'
23111d_sigaction='$d_sigaction'
ed140128 23112d_signbit='$d_signbit'
983dbef6 23113d_sigprocmask='$d_sigprocmask'
b4eb6b3d 23114d_sigsetjmp='$d_sigsetjmp'
f53580fe 23115d_sin6_scope_id='$d_sin6_scope_id'
c95d0e17 23116d_sitearch='$d_sitearch'
4f5da3e9 23117d_snprintf='$d_snprintf'
b8677e3b 23118d_sockaddr_sa_len='$d_sockaddr_sa_len'
49a78c82 23119d_sockatmark='$d_sockatmark'
2ef53570 23120d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
23121d_socket='$d_socket'
23122d_socklen_t='$d_socklen_t'
23123d_sockpair='$d_sockpair'
23124d_socks5_init='$d_socks5_init'
360321b3 23125d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 23126d_sqrtl='$d_sqrtl'
10bc17b6
JH
23127d_srand48_r='$d_srand48_r'
23128d_srandom_r='$d_srandom_r'
eef837ea 23129d_sresgproto='$d_sresgproto'
640374d0 23130d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
23131d_statblks='$d_statblks'
23132d_statfs_f_flags='$d_statfs_f_flags'
23133d_statfs_s='$d_statfs_s'
17a6c8e3 23134d_static_inline='$d_static_inline'
b4eb6b3d
JH
23135d_statvfs='$d_statvfs'
23136d_stdio_cnt_lval='$d_stdio_cnt_lval'
23137d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
23138d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23139d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
23140d_stdio_stream_array='$d_stdio_stream_array'
23141d_stdiobase='$d_stdiobase'
23142d_stdstdio='$d_stdstdio'
23143d_strchr='$d_strchr'
23144d_strcoll='$d_strcoll'
23145d_strctcpy='$d_strctcpy'
23146d_strerrm='$d_strerrm'
23147d_strerror='$d_strerror'
10bc17b6 23148d_strerror_r='$d_strerror_r'
b3c85772 23149d_strftime='$d_strftime'
08c92000
MB
23150d_strlcat='$d_strlcat'
23151d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
23152d_strtod='$d_strtod'
23153d_strtol='$d_strtol'
23154d_strtold='$d_strtold'
23155d_strtoll='$d_strtoll'
28e5dec8 23156d_strtoq='$d_strtoq'
b4eb6b3d
JH
23157d_strtoul='$d_strtoul'
23158d_strtoull='$d_strtoull'
23159d_strtouq='$d_strtouq'
23160d_strxfrm='$d_strxfrm'
23161d_suidsafe='$d_suidsafe'
23162d_symlink='$d_symlink'
23163d_syscall='$d_syscall'
2ef53570 23164d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
23165d_sysconf='$d_sysconf'
23166d_sysernlst='$d_sysernlst'
23167d_syserrlst='$d_syserrlst'
23168d_system='$d_system'
23169d_tcgetpgrp='$d_tcgetpgrp'
23170d_tcsetpgrp='$d_tcsetpgrp'
23171d_telldir='$d_telldir'
23172d_telldirproto='$d_telldirproto'
23173d_time='$d_time'
cbb9e8a7 23174d_timegm='$d_timegm'
b4eb6b3d 23175d_times='$d_times'
14b90194
JH
23176d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23177d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 23178d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 23179d_truncate='$d_truncate'
10bc17b6 23180d_ttyname_r='$d_ttyname_r'
b4eb6b3d 23181d_tzname='$d_tzname'
4e0554ec
JH
23182d_u32align='$d_u32align'
23183d_ualarm='$d_ualarm'
b4eb6b3d
JH
23184d_umask='$d_umask'
23185d_uname='$d_uname'
23186d_union_semun='$d_union_semun'
758a5d79 23187d_unordered='$d_unordered'
bdf33aa7 23188d_unsetenv='$d_unsetenv'
4e0554ec 23189d_usleep='$d_usleep'
2ef53570 23190d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
23191d_ustat='$d_ustat'
23192d_vendorarch='$d_vendorarch'
23193d_vendorbin='$d_vendorbin'
23194d_vendorlib='$d_vendorlib'
6e1038e0 23195d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
23196d_vfork='$d_vfork'
23197d_void_closedir='$d_void_closedir'
23198d_voidsig='$d_voidsig'
23199d_voidtty='$d_voidtty'
23200d_volatile='$d_volatile'
23201d_vprintf='$d_vprintf'
4f5da3e9 23202d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
23203d_wait4='$d_wait4'
23204d_waitpid='$d_waitpid'
23205d_wcstombs='$d_wcstombs'
23206d_wctomb='$d_wctomb'
4e0554ec 23207d_writev='$d_writev'
5f80c64f
JH
23208d_xenix='$d_xenix'
23209date='$date'
b4eb6b3d
JH
23210db_hashtype='$db_hashtype'
23211db_prefixtype='$db_prefixtype'
640374d0
JH
23212db_version_major='$db_version_major'
23213db_version_minor='$db_version_minor'
23214db_version_patch='$db_version_patch'
b4eb6b3d
JH
23215defvoidused='$defvoidused'
23216direntrytype='$direntrytype'
23217dlext='$dlext'
5f80c64f 23218dlsrc='$dlsrc'
b4eb6b3d
JH
23219doublesize='$doublesize'
23220drand01='$drand01'
10bc17b6 23221drand48_r_proto='$drand48_r_proto'
5ac1e9b2 23222dtrace='$dtrace'
b4eb6b3d
JH
23223dynamic_ext='$dynamic_ext'
23224eagain='$eagain'
23225ebcdic='$ebcdic'
5f80c64f
JH
23226echo='$echo'
23227egrep='$egrep'
23228emacs='$emacs'
10bc17b6
JH
23229endgrent_r_proto='$endgrent_r_proto'
23230endhostent_r_proto='$endhostent_r_proto'
23231endnetent_r_proto='$endnetent_r_proto'
23232endprotoent_r_proto='$endprotoent_r_proto'
23233endpwent_r_proto='$endpwent_r_proto'
23234endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
23235eunicefix='$eunicefix'
23236exe_ext='$exe_ext'
23237expr='$expr'
b4eb6b3d 23238extensions='$extensions'
61c26d18 23239extern_C='$extern_C'
6fcddf3b 23240extras='$extras'
b4eb6b3d
JH
23241fflushNULL='$fflushNULL'
23242fflushall='$fflushall'
5f80c64f
JH
23243find='$find'
23244firstmakefile='$firstmakefile'
23245flex='$flex'
b4eb6b3d
JH
23246fpossize='$fpossize'
23247fpostype='$fpostype'
23248freetype='$freetype'
5440bc8e 23249from='$from'
b4eb6b3d
JH
23250full_ar='$full_ar'
23251full_csh='$full_csh'
23252full_sed='$full_sed'
2d736872 23253gccansipedantic='$gccansipedantic'
5b463ca7 23254gccosandvers='$gccosandvers'
5f80c64f 23255gccversion='$gccversion'
10bc17b6
JH
23256getgrent_r_proto='$getgrent_r_proto'
23257getgrgid_r_proto='$getgrgid_r_proto'
23258getgrnam_r_proto='$getgrnam_r_proto'
23259gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23260gethostbyname_r_proto='$gethostbyname_r_proto'
23261gethostent_r_proto='$gethostent_r_proto'
23262getlogin_r_proto='$getlogin_r_proto'
23263getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23264getnetbyname_r_proto='$getnetbyname_r_proto'
23265getnetent_r_proto='$getnetent_r_proto'
23266getprotobyname_r_proto='$getprotobyname_r_proto'
23267getprotobynumber_r_proto='$getprotobynumber_r_proto'
23268getprotoent_r_proto='$getprotoent_r_proto'
23269getpwent_r_proto='$getpwent_r_proto'
23270getpwnam_r_proto='$getpwnam_r_proto'
23271getpwuid_r_proto='$getpwuid_r_proto'
23272getservbyname_r_proto='$getservbyname_r_proto'
23273getservbyport_r_proto='$getservbyport_r_proto'
23274getservent_r_proto='$getservent_r_proto'
23275getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
23276gidformat='$gidformat'
23277gidsign='$gidsign'
23278gidsize='$gidsize'
23279gidtype='$gidtype'
5f80c64f 23280glibpth='$glibpth'
3c728e00 23281gmake='$gmake'
10bc17b6 23282gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 23283gnulibc_version='$gnulibc_version'
5f80c64f 23284grep='$grep'
b4eb6b3d
JH
23285groupcat='$groupcat'
23286groupstype='$groupstype'
5f80c64f 23287gzip='$gzip'
b4eb6b3d
JH
23288h_fcntl='$h_fcntl'
23289h_sysfile='$h_sysfile'
5f80c64f 23290hint='$hint'
b4eb6b3d 23291hostcat='$hostcat'
6e1038e0
MB
23292html1dir='$html1dir'
23293html1direxp='$html1direxp'
23294html3dir='$html3dir'
23295html3direxp='$html3direxp'
b4eb6b3d
JH
23296i16size='$i16size'
23297i16type='$i16type'
23298i32size='$i32size'
23299i32type='$i32type'
23300i64size='$i64size'
23301i64type='$i64type'
23302i8size='$i8size'
23303i8type='$i8type'
23304i_arpainet='$i_arpainet'
2a0de2c5 23305i_assert='$i_assert'
b4eb6b3d 23306i_bsdioctl='$i_bsdioctl'
10bc17b6 23307i_crypt='$i_crypt'
b4eb6b3d
JH
23308i_db='$i_db'
23309i_dbm='$i_dbm'
23310i_dirent='$i_dirent'
5f80c64f 23311i_dld='$i_dld'
b4eb6b3d
JH
23312i_dlfcn='$i_dlfcn'
23313i_fcntl='$i_fcntl'
23314i_float='$i_float'
758a5d79
JH
23315i_fp='$i_fp'
23316i_fp_class='$i_fp_class'
b4eb6b3d 23317i_gdbm='$i_gdbm'
a33f2d9f
AD
23318i_gdbm_ndbm='$i_gdbm_ndbm'
23319i_gdbmndbm='$i_gdbmndbm'
b4eb6b3d 23320i_grp='$i_grp'
b4eb6b3d
JH
23321i_ieeefp='$i_ieeefp'
23322i_inttypes='$i_inttypes'
2765b840 23323i_langinfo='$i_langinfo'
b4eb6b3d
JH
23324i_libutil='$i_libutil'
23325i_limits='$i_limits'
23326i_locale='$i_locale'
23327i_machcthr='$i_machcthr'
23328i_malloc='$i_malloc'
1cd66f7c 23329i_mallocmalloc='$i_mallocmalloc'
b4eb6b3d
JH
23330i_math='$i_math'
23331i_memory='$i_memory'
23332i_mntent='$i_mntent'
23333i_ndbm='$i_ndbm'
23334i_netdb='$i_netdb'
23335i_neterrno='$i_neterrno'
23336i_netinettcp='$i_netinettcp'
23337i_niin='$i_niin'
23338i_poll='$i_poll'
23339i_prot='$i_prot'
23340i_pthread='$i_pthread'
23341i_pwd='$i_pwd'
23342i_rpcsvcdbm='$i_rpcsvcdbm'
23343i_sfio='$i_sfio'
23344i_sgtty='$i_sgtty'
23345i_shadow='$i_shadow'
23346i_socks='$i_socks'
23347i_stdarg='$i_stdarg'
bd31be4b 23348i_stdbool='$i_stdbool'
b4eb6b3d
JH
23349i_stddef='$i_stddef'
23350i_stdlib='$i_stdlib'
23351i_string='$i_string'
23352i_sunmath='$i_sunmath'
23353i_sysaccess='$i_sysaccess'
23354i_sysdir='$i_sysdir'
23355i_sysfile='$i_sysfile'
23356i_sysfilio='$i_sysfilio'
23357i_sysin='$i_sysin'
23358i_sysioctl='$i_sysioctl'
23359i_syslog='$i_syslog'
23360i_sysmman='$i_sysmman'
23361i_sysmode='$i_sysmode'
23362i_sysmount='$i_sysmount'
23363i_sysndir='$i_sysndir'
23364i_sysparam='$i_sysparam'
216dac04 23365i_syspoll='$i_syspoll'
b4eb6b3d
JH
23366i_sysresrc='$i_sysresrc'
23367i_syssecrt='$i_syssecrt'
23368i_sysselct='$i_sysselct'
23369i_syssockio='$i_syssockio'
23370i_sysstat='$i_sysstat'
23371i_sysstatfs='$i_sysstatfs'
23372i_sysstatvfs='$i_sysstatvfs'
23373i_systime='$i_systime'
23374i_systimek='$i_systimek'
23375i_systimes='$i_systimes'
23376i_systypes='$i_systypes'
23377i_sysuio='$i_sysuio'
23378i_sysun='$i_sysun'
23379i_sysutsname='$i_sysutsname'
23380i_sysvfs='$i_sysvfs'
23381i_syswait='$i_syswait'
23382i_termio='$i_termio'
23383i_termios='$i_termios'
23384i_time='$i_time'
23385i_unistd='$i_unistd'
23386i_ustat='$i_ustat'
23387i_utime='$i_utime'
23388i_values='$i_values'
23389i_varargs='$i_varargs'
23390i_varhdr='$i_varhdr'
23391i_vfork='$i_vfork'
5f80c64f 23392ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
23393inc_version_list='$inc_version_list'
23394inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
23395incpath='$incpath'
23396inews='$inews'
f3f1a2d8 23397initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
23398installarchlib='$installarchlib'
23399installbin='$installbin'
6e1038e0
MB
23400installhtml1dir='$installhtml1dir'
23401installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
23402installman1dir='$installman1dir'
23403installman3dir='$installman3dir'
23404installprefix='$installprefix'
23405installprefixexp='$installprefixexp'
23406installprivlib='$installprivlib'
23407installscript='$installscript'
23408installsitearch='$installsitearch'
23409installsitebin='$installsitebin'
8d2cbf27
JH
23410installsitehtml1dir='$installsitehtml1dir'
23411installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 23412installsitelib='$installsitelib'
91e123a8
JH
23413installsiteman1dir='$installsiteman1dir'
23414installsiteman3dir='$installsiteman3dir'
6e1038e0 23415installsitescript='$installsitescript'
b4eb6b3d
JH
23416installstyle='$installstyle'
23417installusrbinperl='$installusrbinperl'
23418installvendorarch='$installvendorarch'
23419installvendorbin='$installvendorbin'
8d2cbf27
JH
23420installvendorhtml1dir='$installvendorhtml1dir'
23421installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 23422installvendorlib='$installvendorlib'
91e123a8
JH
23423installvendorman1dir='$installvendorman1dir'
23424installvendorman3dir='$installvendorman3dir'
6e1038e0 23425installvendorscript='$installvendorscript'
b4eb6b3d 23426intsize='$intsize'
4b661809 23427issymlink='$issymlink'
b4eb6b3d
JH
23428ivdformat='$ivdformat'
23429ivsize='$ivsize'
23430ivtype='$ivtype'
23431known_extensions='$known_extensions'
5f80c64f 23432ksh='$ksh'
5f80c64f
JH
23433ld='$ld'
23434lddlflags='$lddlflags'
23435ldflags='$ldflags'
b4eb6b3d
JH
23436ldflags_uselargefiles='$ldflags_uselargefiles'
23437ldlibpthname='$ldlibpthname'
5f80c64f
JH
23438less='$less'
23439lib_ext='$lib_ext'
23440libc='$libc'
b4eb6b3d 23441libperl='$libperl'
5f80c64f
JH
23442libpth='$libpth'
23443libs='$libs'
43999f95
JH
23444libsdirs='$libsdirs'
23445libsfiles='$libsfiles'
23446libsfound='$libsfound'
13b3f787 23447libspath='$libspath'
5f80c64f 23448libswanted='$libswanted'
b4eb6b3d 23449libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
23450line='$line'
23451lint='$lint'
23452lkflags='$lkflags'
23453ln='$ln'
23454lns='$lns'
10bc17b6 23455localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
23456locincpth='$locincpth'
23457loclibpth='$loclibpth'
b4eb6b3d
JH
23458longdblsize='$longdblsize'
23459longlongsize='$longlongsize'
23460longsize='$longsize'
5f80c64f
JH
23461lp='$lp'
23462lpr='$lpr'
23463ls='$ls'
b4eb6b3d
JH
23464lseeksize='$lseeksize'
23465lseektype='$lseektype'
a724edfe 23466mad='$mad'
f3f1a2d8
MB
23467madlyh='$madlyh'
23468madlyobj='$madlyobj'
23469madlysrc='$madlysrc'
5f80c64f
JH
23470mail='$mail'
23471mailx='$mailx'
23472make='$make'
23473make_set_make='$make_set_make'
b4eb6b3d
JH
23474mallocobj='$mallocobj'
23475mallocsrc='$mallocsrc'
23476malloctype='$malloctype'
23477man1dir='$man1dir'
23478man1direxp='$man1direxp'
23479man1ext='$man1ext'
23480man3dir='$man3dir'
23481man3direxp='$man3direxp'
23482man3ext='$man3ext'
5f80c64f 23483mips_type='$mips_type'
5129fff4 23484mistrustnm='$mistrustnm'
5f80c64f 23485mkdir='$mkdir'
b4eb6b3d
JH
23486mmaptype='$mmaptype'
23487modetype='$modetype'
5f80c64f 23488more='$more'
b4eb6b3d 23489multiarch='$multiarch'
5f80c64f 23490mv='$mv'
b4eb6b3d
JH
23491myarchname='$myarchname'
23492mydomain='$mydomain'
23493myhostname='$myhostname'
5f80c64f
JH
23494myuname='$myuname'
23495n='$n'
2cc61e15 23496need_va_copy='$need_va_copy'
b4eb6b3d
JH
23497netdb_hlen_type='$netdb_hlen_type'
23498netdb_host_type='$netdb_host_type'
23499netdb_name_type='$netdb_name_type'
23500netdb_net_type='$netdb_net_type'
5f80c64f
JH
23501nm='$nm'
23502nm_opt='$nm_opt'
23503nm_so_opt='$nm_so_opt'
b4eb6b3d 23504nonxs_ext='$nonxs_ext'
5f80c64f 23505nroff='$nroff'
b4eb6b3d
JH
23506nvEUformat='$nvEUformat'
23507nvFUformat='$nvFUformat'
23508nvGUformat='$nvGUformat'
b68c599a 23509nv_overflows_integers_at='$nv_overflows_integers_at'
53133ed1 23510nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
23511nveformat='$nveformat'
23512nvfformat='$nvfformat'
23513nvgformat='$nvgformat'
23514nvsize='$nvsize'
23515nvtype='$nvtype'
23516o_nonblock='$o_nonblock'
5f80c64f 23517obj_ext='$obj_ext'
b4eb6b3d 23518old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 23519optimize='$optimize'
b4eb6b3d 23520orderlib='$orderlib'
5f80c64f
JH
23521osname='$osname'
23522osvers='$osvers'
b4eb6b3d 23523otherlibdirs='$otherlibdirs'
5f80c64f 23524package='$package'
b4eb6b3d
JH
23525pager='$pager'
23526passcat='$passcat'
23527patchlevel='$patchlevel'
5f80c64f 23528path_sep='$path_sep'
b4eb6b3d 23529perl5='$perl5'
5f80c64f 23530perl='$perl'
151e6568 23531perl_patchlevel='$perl_patchlevel'
17a6c8e3 23532perl_static_inline='$perl_static_inline'
b4eb6b3d 23533perladmin='$perladmin'
9c839522 23534perllibs='$perllibs'
91f55cc7 23535perlpath='$perlpath'
5f80c64f 23536pg='$pg'
b4eb6b3d
JH
23537phostname='$phostname'
23538pidtype='$pidtype'
5f80c64f
JH
23539plibpth='$plibpth'
23540pmake='$pmake'
23541pr='$pr'
b4eb6b3d
JH
23542prefix='$prefix'
23543prefixexp='$prefixexp'
23544privlib='$privlib'
23545privlibexp='$privlibexp'
f24dbf84 23546procselfexe='$procselfexe'
b4eb6b3d
JH
23547prototype='$prototype'
23548ptrsize='$ptrsize'
23549quadkind='$quadkind'
23550quadtype='$quadtype'
23551randbits='$randbits'
23552randfunc='$randfunc'
10bc17b6 23553random_r_proto='$random_r_proto'
b4eb6b3d
JH
23554randseedtype='$randseedtype'
23555ranlib='$ranlib'
23556rd_nodata='$rd_nodata'
10bc17b6
JH
23557readdir64_r_proto='$readdir64_r_proto'
23558readdir_r_proto='$readdir_r_proto'
b4eb6b3d 23559revision='$revision'
5f80c64f 23560rm='$rm'
5b813a60 23561rm_try='$rm_try'
5f80c64f 23562rmail='$rmail'
5440bc8e 23563run='$run'
5f80c64f 23564runnm='$runnm'
81c4fd9e
MB
23565sGMTIME_max='$sGMTIME_max'
23566sGMTIME_min='$sGMTIME_min'
73e6e416
MB
23567sLOCALTIME_max='$sLOCALTIME_max'
23568sLOCALTIME_min='$sLOCALTIME_min'
b4eb6b3d
JH
23569sPRIEUldbl='$sPRIEUldbl'
23570sPRIFUldbl='$sPRIFUldbl'
23571sPRIGUldbl='$sPRIGUldbl'
23572sPRIXU64='$sPRIXU64'
23573sPRId64='$sPRId64'
23574sPRIeldbl='$sPRIeldbl'
23575sPRIfldbl='$sPRIfldbl'
23576sPRIgldbl='$sPRIgldbl'
23577sPRIi64='$sPRIi64'
23578sPRIo64='$sPRIo64'
23579sPRIu64='$sPRIu64'
23580sPRIx64='$sPRIx64'
23581sSCNfldbl='$sSCNfldbl'
23582sched_yield='$sched_yield'
23583scriptdir='$scriptdir'
23584scriptdirexp='$scriptdirexp'
5f80c64f 23585sed='$sed'
b4eb6b3d
JH
23586seedfunc='$seedfunc'
23587selectminbits='$selectminbits'
23588selecttype='$selecttype'
5f80c64f 23589sendmail='$sendmail'
10bc17b6
JH
23590setgrent_r_proto='$setgrent_r_proto'
23591sethostent_r_proto='$sethostent_r_proto'
23592setlocale_r_proto='$setlocale_r_proto'
23593setnetent_r_proto='$setnetent_r_proto'
23594setprotoent_r_proto='$setprotoent_r_proto'
23595setpwent_r_proto='$setpwent_r_proto'
23596setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
23597sh='$sh'
23598shar='$shar'
23599sharpbang='$sharpbang'
b4eb6b3d
JH
23600shmattype='$shmattype'
23601shortsize='$shortsize'
23602shrpenv='$shrpenv'
5f80c64f 23603shsharp='$shsharp'
b4eb6b3d
JH
23604sig_count='$sig_count'
23605sig_name='$sig_name'
23606sig_name_init='$sig_name_init'
23607sig_num='$sig_num'
23608sig_num_init='$sig_num_init'
76d3c696 23609sig_size='$sig_size'
b4eb6b3d
JH
23610signal_t='$signal_t'
23611sitearch='$sitearch'
23612sitearchexp='$sitearchexp'
23613sitebin='$sitebin'
23614sitebinexp='$sitebinexp'
8d2cbf27
JH
23615sitehtml1dir='$sitehtml1dir'
23616sitehtml1direxp='$sitehtml1direxp'
23617sitehtml3dir='$sitehtml3dir'
23618sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
23619sitelib='$sitelib'
23620sitelib_stem='$sitelib_stem'
23621sitelibexp='$sitelibexp'
91e123a8
JH
23622siteman1dir='$siteman1dir'
23623siteman1direxp='$siteman1direxp'
23624siteman3dir='$siteman3dir'
23625siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
23626siteprefix='$siteprefix'
23627siteprefixexp='$siteprefixexp'
6e1038e0
MB
23628sitescript='$sitescript'
23629sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
23630sizesize='$sizesize'
23631sizetype='$sizetype'
5f80c64f
JH
23632sleep='$sleep'
23633smail='$smail'
5f80c64f 23634so='$so'
b4eb6b3d
JH
23635sockethdr='$sockethdr'
23636socketlib='$socketlib'
23637socksizetype='$socksizetype'
5f80c64f
JH
23638sort='$sort'
23639spackage='$spackage'
23640spitshell='$spitshell'
10bc17b6
JH
23641srand48_r_proto='$srand48_r_proto'
23642srandom_r_proto='$srandom_r_proto'
5f80c64f 23643src='$src'
b4eb6b3d 23644ssizetype='$ssizetype'
668fdbe1
MB
23645st_ino_sign='$st_ino_sign'
23646st_ino_size='$st_ino_size'
b4eb6b3d 23647startperl='$startperl'
5f80c64f 23648startsh='$startsh'
b4eb6b3d
JH
23649static_ext='$static_ext'
23650stdchar='$stdchar'
23651stdio_base='$stdio_base'
23652stdio_bufsiz='$stdio_bufsiz'
23653stdio_cnt='$stdio_cnt'
23654stdio_filbuf='$stdio_filbuf'
23655stdio_ptr='$stdio_ptr'
23656stdio_stream_array='$stdio_stream_array'
10bc17b6 23657strerror_r_proto='$strerror_r_proto'
b4eb6b3d 23658strings='$strings'
5f80c64f 23659submit='$submit'
b4eb6b3d
JH
23660subversion='$subversion'
23661sysman='$sysman'
5f80c64f
JH
23662tail='$tail'
23663tar='$tar'
5440bc8e 23664targetarch='$targetarch'
5f80c64f
JH
23665tbl='$tbl'
23666tee='$tee'
23667test='$test'
b4eb6b3d
JH
23668timeincl='$timeincl'
23669timetype='$timetype'
10bc17b6 23670tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 23671to='$to'
5f80c64f
JH
23672touch='$touch'
23673tr='$tr'
23674trnl='$trnl'
23675troff='$troff'
10bc17b6 23676ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
23677u16size='$u16size'
23678u16type='$u16type'
23679u32size='$u32size'
23680u32type='$u32type'
23681u64size='$u64size'
23682u64type='$u64type'
23683u8size='$u8size'
23684u8type='$u8type'
23685uidformat='$uidformat'
23686uidsign='$uidsign'
23687uidsize='$uidsize'
23688uidtype='$uidtype'
5f80c64f
JH
23689uname='$uname'
23690uniq='$uniq'
b4eb6b3d
JH
23691uquadtype='$uquadtype'
23692use5005threads='$use5005threads'
23693use64bitall='$use64bitall'
23694use64bitint='$use64bitint'
5440bc8e 23695usecrosscompile='$usecrosscompile'
1be1b388 23696usedevel='$usedevel'
5f80c64f 23697usedl='$usedl'
5ac1e9b2 23698usedtrace='$usedtrace'
15b61c98 23699usefaststdio='$usefaststdio'
b4eb6b3d 23700useithreads='$useithreads'
2982a345 23701usekernprocpathname='$usekernprocpathname'
b4eb6b3d
JH
23702uselargefiles='$uselargefiles'
23703uselongdouble='$uselongdouble'
19a100ff 23704usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
23705usemorebits='$usemorebits'
23706usemultiplicity='$usemultiplicity'
23707usemymalloc='$usemymalloc'
5f80c64f 23708usenm='$usenm'
ae60cb46 23709usensgetexecutablepath='$usensgetexecutablepath'
b4eb6b3d
JH
23710useopcode='$useopcode'
23711useperlio='$useperlio'
23712useposix='$useposix'
9514c62b 23713usereentrant='$usereentrant'
d51aaa9d 23714userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
23715usesfio='$usesfio'
23716useshrplib='$useshrplib'
5f106f9c 23717usesitecustomize='$usesitecustomize'
29209bc5 23718usesocks='$usesocks'
b4eb6b3d
JH
23719usethreads='$usethreads'
23720usevendorprefix='$usevendorprefix'
23721usevfork='$usevfork'
5f80c64f
JH
23722usrinc='$usrinc'
23723uuname='$uuname'
b4eb6b3d
JH
23724uvXUformat='$uvXUformat'
23725uvoformat='$uvoformat'
23726uvsize='$uvsize'
23727uvtype='$uvtype'
23728uvuformat='$uvuformat'
23729uvxformat='$uvxformat'
d03b3b00 23730vaproto='$vaproto'
b4eb6b3d
JH
23731vendorarch='$vendorarch'
23732vendorarchexp='$vendorarchexp'
23733vendorbin='$vendorbin'
23734vendorbinexp='$vendorbinexp'
8d2cbf27
JH
23735vendorhtml1dir='$vendorhtml1dir'
23736vendorhtml1direxp='$vendorhtml1direxp'
23737vendorhtml3dir='$vendorhtml3dir'
23738vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
23739vendorlib='$vendorlib'
23740vendorlib_stem='$vendorlib_stem'
23741vendorlibexp='$vendorlibexp'
91e123a8
JH
23742vendorman1dir='$vendorman1dir'
23743vendorman1direxp='$vendorman1direxp'
23744vendorman3dir='$vendorman3dir'
23745vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
23746vendorprefix='$vendorprefix'
23747vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
23748vendorscript='$vendorscript'
23749vendorscriptexp='$vendorscriptexp'
b4eb6b3d 23750version='$version'
861eb78d 23751version_patchlevel_string='$version_patchlevel_string'
d56c5707 23752versiononly='$versiononly'
5f80c64f 23753vi='$vi'
b4eb6b3d 23754voidflags='$voidflags'
5f80c64f 23755xlibpth='$xlibpth'
3659ebf1
JH
23756yacc='$yacc'
23757yaccflags='$yaccflags'
5f80c64f
JH
23758zcat='$zcat'
23759zip='$zip'
23760EOT
23761
5f80c64f
JH
23762: add special variables
23763$test -f $src/patchlevel.h && \
d9421656 23764awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
0f04e85f 23765echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
a02608de 23766echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
23767
23768: propagate old symbols
23769if $test -f UU/config.sh; then
381aa1ff 23770 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
776a38e3
MB
23771 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23772 config.sh config.sh UU/oldconfig.sh |\
23773 $sort | $uniq -u >UU/oldsyms
dd35fa16 23774 set X `$cat UU/oldsyms`
5f80c64f
JH
23775 shift
23776 case $# in
23777 0) ;;
23778 *)
dd35fa16 23779 $cat <<EOM
5f80c64f
JH
23780Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23781EOM
776a38e3 23782 echo ": Variables propagated from previous config.sh file." >>config.sh
dd35fa16 23783 for sym in `$cat UU/oldsyms`; do
5f80c64f
JH
23784 echo " Propagating $hint variable "'$'"$sym..."
23785 eval 'tmp="$'"${sym}"'"'
23786 echo "$tmp" | \
23787 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23788 done
23789 ;;
23790 esac
23791fi
23792
23793: Finish up by extracting the .SH files
23794case "$alldone" in
23795exit)
23796 $rm -rf UU
24ccb310 23797 echo "Extraction done."
5f80c64f
JH
23798 exit 0
23799 ;;
23800cont)
23801 ;;
23802'')
23803 dflt=''
23804 nostick=true
23805 $cat <<EOM
23806
23807If you'd like to make any changes to the config.sh file before I begin
23808to configure things, do it as a shell escape now (e.g. !vi config.sh).
23809
23810EOM
23811 rp="Press return or use a shell escape to edit config.sh:"
23812 . UU/myread
23813 nostick=''
23814 case "$ans" in
23815 '') ;;
23816 *) : in case they cannot read
23817 sh 1>&4 -c "$ans";;
23818 esac
23819 ;;
23820esac
23821
23822: if this fails, just run all the .SH files by hand
23823. ./config.sh
23824
23825echo " "
23826exec 1>&4
a43e8593 23827pwd=`pwd`
5f80c64f 23828. ./UU/extract
6904989c 23829cd "$pwd"
5f80c64f
JH
23830
23831if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23832 dflt=y
23833 case "$silent" in
23834 true) ;;
23835 *)
23836 $cat <<EOM
23837
23838Now you need to generate make dependencies by running "$make depend".
23839You might prefer to run it in background: "$make depend > makedepend.out &"
23840It can take a while, so you might not want to run it right now.
23841
23842EOM
23843 ;;
23844 esac
23845 rp="Run $make depend now?"
23846 . UU/myread
23847 case "$ans" in
23848 y*)
3d5d58b1 23849 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
23850 ;;
23851 *)
23852 echo "You must run '$make depend' then '$make'."
23853 ;;
23854 esac
23855elif test -f [Mm]akefile; then
23856 echo " "
23857 echo "Now you must run a $make."
23858else
24ccb310 23859 echo "Configure done."
5f80c64f
JH
23860fi
23861
23862if $test -f Policy.sh; then
23863 $cat <<EOM
23864
23865If you compile $package on a different machine or from a different object
23866directory, copy the Policy.sh file from this object directory to the
23867new one before you run Configure -- this will help you with most of
23868the policy defaults.
23869
23870EOM
23871fi
23872if $test -f config.msg; then
23873 echo "Hmm. I also noted the following information while running:"
23874 echo " "
23875 $cat config.msg >&4
23876 $rm -f config.msg
23877fi
23878$rm -f kit*isdone ark*isdone
23879$rm -rf UU
23880
23881: End of Configure
23882