This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Clarify op_lvalue’s docs
[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
613d6c3e 31# $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
2304df62 32#
9e08e8f0 33# Generated on Thu Aug 12 11:38:08 CEST 2010 [metaconfig 3.5 PL0]
7f2de2d2 34# (with additional metaconfig patches by perlbug@perl.org)
2304df62 35
283fdd21 36cat >c1$$ <<EOF
2304df62
AD
37ARGGGHHHH!!!!!
38
39SCO csh still thinks true is false. Write to SCO today and tell them that next
40year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
43we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45[End of diatribe. We now return you to your regularly scheduled programming...]
46EOF
283fdd21 47cat >c2$$ <<EOF
2304df62
AD
48
49OOPS! You naughty creature! You didn't run Configure with sh!
50I will attempt to remedy the situation by running sh for you...
51EOF
52
283fdd21 53true || cat c1$$ c2$$
2304df62
AD
54true || exec sh $0 $argv:q
55
283fdd21 56(exit $?0) || cat c2$$
2304df62 57(exit $?0) || exec sh $0 $argv:q
283fdd21 58rm -f c1$$ c2$$
2304df62 59
f6538904 60if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
d03b3b00 61 cat <<EOF
cbee2ce6
JH
62***
63*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
65*** Please read the README.plan9 for further instructions.
66*** Cannot continue, aborting.
67***
68EOF
69 exit 1
70fi
71
f8e2af1d 72if test ! -c /dev/null ; then
d03b3b00 73 cat <<EOF
f8e2af1d
MC
74***
75*** I'm sorry, but /dev/null appears to be a file rather than a device.
76*** Please consult your operating sytem's notes for making a device
77*** in /dev.
78*** Cannot continue, aborting.
79***
80EOF
81 exit 1
82fi
83
a0d0e21e
LW
84: compute my invocation name
85me=$0
86case "$0" in
87*/*)
88 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89 test "$me" || me=$0
90 ;;
91esac
92
dfe9444c 93: Proper separator for the PATH environment variable
8e07c86e 94p_=:
613d6c3e 95: On OS/2 this directory should exist if this is not floppy only system ":-]"
5c728af0 96if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
613d6c3e 97 if test -n "$OS2_SHELL"; then
dfe9444c
AD
98 p_=\;
99 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 101 is_os2=yes
c4f23d77 102 elif test -n "$DJGPP"; then
495e2cbe
MB
103 case "X${MACHTYPE:-nonesuchmach}" in
104 *cygwin) ;;
105 *) p_=\; ;;
106 esac
dfe9444c 107 fi
39e571d4 108fi
a0d0e21e
LW
109
110: Proper PATH setting
111paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 112paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 113paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 114paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 115paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 116paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
117paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 119paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
120
121for p in $paths
122do
8e07c86e
AD
123 case "$p_$PATH$p_" in
124 *$p_$p$p_*) ;;
125 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
126 esac
127done
128
8e07c86e 129PATH=.$p_$PATH
2304df62
AD
130export PATH
131
dfe9444c
AD
132: shall we be using ksh?
133inksh=''
134needksh=''
135avoidksh=''
136newsh=/bin/ksh
137changesh=''
ff0cee69 138if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
139 inksh=true
140fi
141if test -f /hp-ux -a -f /bin/ksh; then
142 needksh='to avoid sh bug in "here document" expansion'
143fi
144if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145 if test X`/usr/bin/uname -v` = X4; then
146 avoidksh="to avoid AIX 4's /bin/sh"
147 newsh=/usr/bin/bsh
2304df62 148 fi
dfe9444c 149fi
cf04f91f
JH
150if test -f /osf_boot -a -f /usr/sbin/setld; then
151 if test X`/usr/bin/uname -s` = XOSF1; then
613d6c3e
MB
152 avoidksh="to avoid Digital UNIX' ksh"
153 newsh=/bin/sh
154 unset BIN_SH
cf04f91f
JH
155 fi
156fi
dfe9444c
AD
157case "$inksh/$needksh" in
158/[a-z]*)
c4f23d77 159 ENV=''
dfe9444c
AD
160 changesh=true
161 reason="$needksh"
162 ;;
163esac
164case "$inksh/$avoidksh" in
165true/[a-z]*)
166 changesh=true
167 reason="$avoidksh"
168 ;;
169esac
170case "$inksh/$needksh-$avoidksh-" in
171true/--)
a0d0e21e
LW
172 cat <<EOM
173(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 174mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 175EOM
dfe9444c
AD
176 ;;
177esac
178case "$changesh" in
179true)
2e2a97a6 180 export newsh
dfe9444c
AD
181 echo "(Feeding myself to $newsh $reason.)"
182 case "$0" in
183 Configure|*/Configure) exec $newsh $0 "$@";;
184 *) exec $newsh Configure "$@";;
185 esac
186 ;;
187esac
7730b9f4 188test -x "${newsh}" || unset newsh
2304df62 189
613d6c3e 190: if needed, set CDPATH to a harmless value that is not chatty
bfb7748a
AD
191: avoid bash 2.02 problems with empty CDPATH.
192case "$CDPATH" in
193'') ;;
194*) case "$SHELL" in
613d6c3e
MB
195 *bash*) CDPATH='.' ;;
196 *) CDPATH='' ;;
bfb7748a
AD
197 esac
198 ;;
199esac
613d6c3e 200
2304df62
AD
201: Configure runs within the UU subdirectory
202test -d UU || mkdir UU
8e07c86e 203cd UU && rm -f ./*
2304df62 204
6b356c8e
JH
205ccname=''
206ccversion=''
b4eb6b3d
JH
207ccsymbols=''
208cppccsymbols=''
209cppsymbols=''
5440bc8e
JH
210from=''
211run=''
212targetarch=''
213to=''
214usecrosscompile=''
61c26d18 215extern_C=''
6b34ded5 216mistrustnm=''
1be1b388 217usedevel=''
9c839522 218perllibs=''
b4eb6b3d
JH
219dynamic_ext=''
220extensions=''
221known_extensions=''
222nonxs_ext=''
223static_ext=''
224useopcode=''
225useposix=''
6fcddf3b 226extras=''
ecfc5424 227d_bsd=''
40a7a20a 228d_eunice=''
2304df62
AD
229d_xenix=''
230eunicefix=''
dfe9444c 231ar=''
2304df62
AD
232awk=''
233bash=''
234bison=''
235byacc=''
236cat=''
237chgrp=''
238chmod=''
239chown=''
ecfc5424 240comm=''
2304df62
AD
241compress=''
242cp=''
243cpio=''
244cpp=''
245csh=''
246date=''
247echo=''
248egrep=''
249emacs=''
250expr=''
251find=''
252flex=''
3c728e00 253gmake=''
2304df62 254grep=''
8ff267be 255gzip=''
2304df62
AD
256inews=''
257ksh=''
258less=''
259line=''
260lint=''
261ln=''
262lp=''
263lpr=''
264ls=''
265mail=''
266mailx=''
dfe9444c 267make=''
2304df62
AD
268mkdir=''
269more=''
270mv=''
693762b4 271nm=''
2304df62
AD
272nroff=''
273perl=''
274pg=''
275pmake=''
276pr=''
277rm=''
278rmail=''
279sed=''
280sendmail=''
2304df62
AD
281shar=''
282sleep=''
283smail=''
284sort=''
285submit=''
286tail=''
287tar=''
288tbl=''
693762b4 289tee=''
2304df62
AD
290test=''
291touch=''
292tr=''
293troff=''
294uname=''
295uniq=''
296uuname=''
297vi=''
298zcat=''
8ff267be 299zip=''
b4eb6b3d
JH
300full_ar=''
301full_sed=''
a0d0e21e 302libswanted=''
2304df62
AD
303hint=''
304myuname=''
85e6fe83
LW
305osname=''
306osvers=''
2304df62
AD
307Author=''
308Date=''
309Header=''
310Id=''
311Locker=''
312Log=''
313RCSfile=''
314Revision=''
315Source=''
316State=''
dfe9444c
AD
317_a=''
318_exe=''
319_o=''
4633a7c4
LW
320archobjs=''
321exe_ext=''
322firstmakefile=''
323lib_ext=''
324obj_ext=''
325path_sep=''
5b813a60 326rm_try=''
b4eb6b3d 327afs=''
a6d26a0d 328afsroot=''
b4eb6b3d
JH
329alignbytes=''
330ansi2knr=''
331archlib=''
332archlibexp=''
333d_archlib=''
334installarchlib=''
335archname=''
336myarchname=''
337d_atolf=''
338d_atoll=''
339baserev=''
340bin=''
341binexp=''
f3f1a2d8 342initialinstalllocation=''
b4eb6b3d 343installbin=''
f3f1a2d8 344userelocatableinc=''
b4eb6b3d 345byteorder=''
2304df62 346cc=''
2304df62
AD
347ccflags=''
348cppflags=''
349ldflags=''
350lkflags=''
8e07c86e 351locincpth=''
2304df62 352optimize=''
b4eb6b3d 353cf_email=''
2304df62
AD
354cf_by=''
355cf_time=''
c193ef60
MB
356charbits=''
357charsize=''
2304df62 358contains=''
b4eb6b3d 359cpp_stuff=''
2304df62
AD
360cpplast=''
361cppminus=''
362cpprun=''
363cppstdin=''
74cac757 364d__fwalk=''
b4eb6b3d
JH
365d_access=''
366d_accessx=''
55954f19 367d_aintl=''
b4eb6b3d 368d_alarm=''
10bc17b6
JH
369asctime_r_proto=''
370d_asctime_r=''
fcdf39cf 371d_attribute_deprecated=''
0dbb1585
AL
372d_attribute_format=''
373d_attribute_malloc=''
374d_attribute_nonnull=''
375d_attribute_noreturn=''
376d_attribute_pure=''
377d_attribute_unused=''
378d_attribute_warn_unused_result=''
dcb594bc 379d_printf_format_null=''
b4eb6b3d
JH
380d_bcmp=''
381d_bcopy=''
635aebb7
AL
382d_builtin_choose_expr=''
383d_builtin_expect=''
b4eb6b3d 384d_bzero=''
a2d23ec2 385d_c99_variadic_macros=''
b4eb6b3d
JH
386d_casti32=''
387castflags=''
388d_castneg=''
389d_chown=''
390d_chroot=''
391d_chsize=''
758a5d79 392d_class=''
b0a2e8e6 393d_clearenv=''
b4eb6b3d
JH
394d_closedir=''
395d_void_closedir=''
4e0554ec 396d_cmsghdr_s=''
b4eb6b3d 397d_const=''
36adc09b 398d_copysignl=''
666ea192 399d_cplusplus=''
b4eb6b3d
JH
400cryptlib=''
401d_crypt=''
10bc17b6
JH
402crypt_r_proto=''
403d_crypt_r=''
b4eb6b3d
JH
404d_csh=''
405full_csh=''
13cfc98d 406d_ctermid=''
10bc17b6
JH
407ctermid_r_proto=''
408d_ctermid_r=''
409ctime_r_proto=''
410d_ctime_r=''
b4eb6b3d
JH
411d_cuserid=''
412d_dbl_dig=''
2ef53570 413d_dbminitproto=''
b4eb6b3d 414d_difftime=''
de52168c 415d_dir_dd_fd=''
ae0e3d3b 416d_dirfd=''
b4eb6b3d 417d_dlerror=''
a0d0e21e 418d_dlopen=''
b4eb6b3d
JH
419d_dlsymun=''
420d_dosuid=''
421d_suidsafe=''
10bc17b6
JH
422d_drand48_r=''
423drand48_r_proto=''
b4eb6b3d
JH
424d_drand48proto=''
425d_dup2=''
426d_eaccess=''
427d_endgrent=''
10bc17b6
JH
428d_endgrent_r=''
429endgrent_r_proto=''
b4eb6b3d 430d_endhent=''
10bc17b6
JH
431d_endhostent_r=''
432endhostent_r_proto=''
b4eb6b3d 433d_endnent=''
10bc17b6
JH
434d_endnetent_r=''
435endnetent_r_proto=''
b4eb6b3d 436d_endpent=''
10bc17b6
JH
437d_endprotoent_r=''
438endprotoent_r_proto=''
b4eb6b3d 439d_endpwent=''
10bc17b6
JH
440d_endpwent_r=''
441endpwent_r_proto=''
b4eb6b3d 442d_endsent=''
10bc17b6
JH
443d_endservent_r=''
444endservent_r_proto=''
15b61c98 445d_faststdio=''
b363b713 446d_fchdir=''
b4eb6b3d
JH
447d_fchmod=''
448d_fchown=''
449d_fcntl=''
9d9004a9 450d_fcntl_can_lock=''
b4eb6b3d
JH
451d_fd_macros=''
452d_fd_set=''
453d_fds_bits=''
454d_fgetpos=''
758a5d79
JH
455d_finite=''
456d_finitel=''
b4eb6b3d
JH
457d_flexfnam=''
458d_flock=''
2ef53570 459d_flockproto=''
b4eb6b3d 460d_fork=''
758a5d79
JH
461d_fp_class=''
462d_fpclass=''
463d_fpclassify=''
464d_fpclassl=''
b4eb6b3d
JH
465d_fpos64_t=''
466d_frexpl=''
467d_fs_data_s=''
468d_fseeko=''
469d_fsetpos=''
470d_fstatfs=''
411ab01c 471d_fsync=''
b4eb6b3d
JH
472d_ftello=''
473d_ftime=''
474d_gettimeod=''
dc814df1 475d_futimes=''
b4eb6b3d 476d_Gconvert=''
5086dff9 477d_getaddrinfo=''
b4eb6b3d
JH
478d_getcwd=''
479d_getespwnam=''
480d_getfsstat=''
481d_getgrent=''
10bc17b6
JH
482d_getgrent_r=''
483getgrent_r_proto=''
484d_getgrgid_r=''
485getgrgid_r_proto=''
486d_getgrnam_r=''
487getgrnam_r_proto=''
b4eb6b3d
JH
488d_getgrps=''
489d_gethbyaddr=''
490d_gethbyname=''
491d_gethent=''
492aphostname=''
493d_gethname=''
494d_phostname=''
495d_uname=''
10bc17b6
JH
496d_gethostbyaddr_r=''
497gethostbyaddr_r_proto=''
498d_gethostbyname_r=''
499gethostbyname_r_proto=''
500d_gethostent_r=''
501gethostent_r_proto=''
b4eb6b3d 502d_gethostprotos=''
4e0554ec 503d_getitimer=''
b4eb6b3d 504d_getlogin=''
10bc17b6
JH
505d_getlogin_r=''
506getlogin_r_proto=''
b4eb6b3d
JH
507d_getmnt=''
508d_getmntent=''
5086dff9 509d_getnameinfo=''
b4eb6b3d
JH
510d_getnbyaddr=''
511d_getnbyname=''
512d_getnent=''
10bc17b6
JH
513d_getnetbyaddr_r=''
514getnetbyaddr_r_proto=''
515d_getnetbyname_r=''
516getnetbyname_r_proto=''
517d_getnetent_r=''
518getnetent_r_proto=''
b4eb6b3d 519d_getnetprotos=''
0c0643d0 520d_getpagsz=''
b4eb6b3d
JH
521d_getpent=''
522d_getpgid=''
523d_getpgrp2=''
524d_bsdgetpgrp=''
525d_getpgrp=''
526d_getppid=''
527d_getprior=''
528d_getpbyname=''
529d_getpbynumber=''
10bc17b6
JH
530d_getprotobyname_r=''
531getprotobyname_r_proto=''
532d_getprotobynumber_r=''
533getprotobynumber_r_proto=''
534d_getprotoent_r=''
535getprotoent_r_proto=''
b4eb6b3d
JH
536d_getprotoprotos=''
537d_getprpwnam=''
538d_getpwent=''
10bc17b6
JH
539d_getpwent_r=''
540getpwent_r_proto=''
541d_getpwnam_r=''
542getpwnam_r_proto=''
543d_getpwuid_r=''
544getpwuid_r_proto=''
b4eb6b3d 545d_getsent=''
10bc17b6
JH
546d_getservbyname_r=''
547getservbyname_r_proto=''
548d_getservbyport_r=''
549getservbyport_r_proto=''
550d_getservent_r=''
551getservent_r_proto=''
b4eb6b3d
JH
552d_getservprotos=''
553d_getspnam=''
10bc17b6
JH
554d_getspnam_r=''
555getspnam_r_proto=''
b4eb6b3d
JH
556d_getsbyname=''
557d_getsbyport=''
10bc17b6
JH
558d_gmtime_r=''
559gmtime_r_proto=''
a4f3eea9 560d_gnulibc=''
5f6e0ee4 561gnulibc_version=''
b4eb6b3d
JH
562d_hasmntopt=''
563d_htonl=''
55954f19 564d_ilogbl=''
b4eb6b3d 565d_inetaton=''
5086dff9
MB
566d_inetntop=''
567d_inetpton=''
b4eb6b3d
JH
568d_int64_t=''
569d_isascii=''
758a5d79
JH
570d_isfinite=''
571d_isinf=''
b4eb6b3d
JH
572d_isnan=''
573d_isnanl=''
574d_killpg=''
575d_lchown=''
576d_ldbl_dig=''
0a0abfba 577d_libm_lib_version=''
b4eb6b3d 578d_link=''
10bc17b6 579d_localtime_r=''
8572b25d 580d_localtime_r_needs_tzset=''
10bc17b6 581localtime_r_proto=''
b4eb6b3d
JH
582d_locconv=''
583d_lockf=''
584d_longdbl=''
585longdblsize=''
586d_longlong=''
587longlongsize=''
588d_lseekproto=''
589d_lstat=''
590d_madvise=''
7dd121ae
MB
591d_malloc_good_size=''
592d_malloc_size=''
b4eb6b3d
JH
593d_mblen=''
594d_mbstowcs=''
595d_mbtowc=''
596d_memchr=''
597d_memcmp=''
598d_memcpy=''
599d_memmove=''
600d_memset=''
601d_mkdir=''
602d_mkdtemp=''
603d_mkfifo=''
604d_mkstemp=''
605d_mkstemps=''
606d_mktime=''
607d_mmap=''
608mmaptype=''
609d_modfl=''
e67aeab1 610d_modfl_pow32_bug=''
bc9a1b2c 611d_modflproto=''
b4eb6b3d
JH
612d_mprotect=''
613d_msg=''
614d_msgctl=''
615d_msgget=''
4e0554ec 616d_msghdr_s=''
b4eb6b3d
JH
617d_msgrcv=''
618d_msgsnd=''
619d_msync=''
620d_munmap=''
621d_nice=''
2765b840 622d_nl_langinfo=''
b4eb6b3d
JH
623d_off64_t=''
624d_open3=''
625d_fpathconf=''
626d_pathconf=''
627d_pause=''
628d_pipe=''
629d_poll=''
2304df62 630d_portable=''
c796e3db
MB
631d_prctl=''
632d_prctl_set_name=''
a33c94aa 633d_procselfexe=''
f24dbf84 634procselfexe=''
b4eb6b3d
JH
635d_old_pthread_create_joinable=''
636old_pthread_create_joinable=''
d6483fcc 637d_pthread_atfork=''
58d975c3 638d_pthread_attr_setscope=''
b4eb6b3d
JH
639d_pthread_yield=''
640d_sched_yield=''
641sched_yield=''
642d_qgcvt=''
10bc17b6
JH
643d_random_r=''
644random_r_proto=''
645d_readdir64_r=''
646readdir64_r_proto=''
b4eb6b3d
JH
647d_readdir=''
648d_rewinddir=''
649d_seekdir=''
650d_telldir=''
10bc17b6
JH
651d_readdir_r=''
652readdir_r_proto=''
b4eb6b3d 653d_readlink=''
4e0554ec
JH
654d_readv=''
655d_recvmsg=''
b4eb6b3d
JH
656d_rename=''
657d_rmdir=''
658d_safebcpy=''
659d_safemcpy=''
660d_sanemcmp=''
ef9f17be 661d_sbrkproto=''
55954f19 662d_scalbnl=''
b4eb6b3d
JH
663d_select=''
664d_sem=''
665d_semctl=''
666d_semget=''
667d_semop=''
4e0554ec 668d_sendmsg=''
b4eb6b3d
JH
669d_setegid=''
670d_seteuid=''
671d_setgrent=''
10bc17b6
JH
672d_setgrent_r=''
673setgrent_r_proto=''
b4eb6b3d
JH
674d_setgrps=''
675d_sethent=''
10bc17b6
JH
676d_sethostent_r=''
677sethostent_r_proto=''
4e0554ec 678d_setitimer=''
b4eb6b3d
JH
679d_setlinebuf=''
680d_setlocale=''
10bc17b6
JH
681d_setlocale_r=''
682setlocale_r_proto=''
b4eb6b3d 683d_setnent=''
10bc17b6
JH
684d_setnetent_r=''
685setnetent_r_proto=''
b4eb6b3d
JH
686d_setpent=''
687d_setpgid=''
688d_setpgrp2=''
689d_bsdsetpgrp=''
690d_setpgrp=''
691d_setprior=''
692d_setproctitle=''
10bc17b6
JH
693d_setprotoent_r=''
694setprotoent_r_proto=''
b4eb6b3d 695d_setpwent=''
10bc17b6
JH
696d_setpwent_r=''
697setpwent_r_proto=''
b4eb6b3d
JH
698d_setregid=''
699d_setresgid=''
700d_setresuid=''
701d_setreuid=''
702d_setrgid=''
703d_setruid=''
704d_setsent=''
10bc17b6
JH
705d_setservent_r=''
706setservent_r_proto=''
b4eb6b3d
JH
707d_setsid=''
708d_setvbuf=''
709d_sfio=''
710usesfio=''
711d_shm=''
712d_shmat=''
713d_shmatprototype=''
714shmattype=''
715d_shmctl=''
716d_shmdt=''
717d_shmget=''
718d_sigaction=''
ed140128 719d_signbit=''
983dbef6 720d_sigprocmask=''
b4eb6b3d 721d_sigsetjmp=''
5f106f9c 722usesitecustomize=''
4f5da3e9
SP
723d_snprintf=''
724d_vsnprintf=''
49a78c82 725d_sockatmark=''
2ef53570 726d_sockatmarkproto=''
b4eb6b3d
JH
727d_msg_ctrunc=''
728d_msg_dontroute=''
729d_msg_oob=''
730d_msg_peek=''
731d_msg_proxy=''
732d_oldsock=''
733d_scm_rights=''
734d_socket=''
735d_sockpair=''
736sockethdr=''
737socketlib=''
738d_socklen_t=''
739d_socks5_init=''
360321b3 740d_sprintf_returns_strlen=''
b4eb6b3d 741d_sqrtl=''
10bc17b6
JH
742d_srand48_r=''
743srand48_r_proto=''
744d_srandom_r=''
745srandom_r_proto=''
eef837ea 746d_sresgproto=''
640374d0 747d_sresuproto=''
b4eb6b3d
JH
748d_statblks=''
749d_statfs_f_flags=''
750d_statfs_s=''
17a6c8e3
AD
751d_static_inline=''
752perl_static_inline=''
b4eb6b3d
JH
753d_fstatvfs=''
754d_statvfs=''
755d_stdio_cnt_lval=''
756d_stdio_ptr_lval=''
a7ffa9b9
NC
757d_stdio_ptr_lval_nochange_cnt=''
758d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
759d_stdiobase=''
760d_stdstdio=''
761stdio_base=''
762stdio_bufsiz=''
763stdio_cnt=''
764stdio_filbuf=''
765stdio_ptr=''
766d_index=''
767d_strchr=''
768d_strcoll=''
769d_strctcpy=''
770d_strerrm=''
771d_strerror=''
772d_sysernlst=''
773d_syserrlst=''
10bc17b6
JH
774d_strerror_r=''
775strerror_r_proto=''
b3c85772 776d_strftime=''
08c92000
MB
777d_strlcat=''
778d_strlcpy=''
b4eb6b3d
JH
779d_strtod=''
780d_strtol=''
781d_strtold=''
782d_strtoll=''
28e5dec8 783d_strtoq=''
b4eb6b3d
JH
784d_strtoul=''
785d_strtoull=''
786d_strtouq=''
787d_strxfrm=''
788d_symlink=''
789d_syscall=''
2ef53570 790d_syscallproto=''
b4eb6b3d
JH
791d_sysconf=''
792d_system=''
793d_tcgetpgrp=''
794d_tcsetpgrp=''
795d_telldirproto=''
796d_time=''
797timetype=''
96938616
MB
798d_asctime64=''
799d_ctime64=''
800d_difftime64=''
801d_gmtime64=''
802d_localtime64=''
803d_mktime64=''
cbb9e8a7 804d_timegm=''
b4eb6b3d
JH
805clocktype=''
806d_times=''
10bc17b6
JH
807d_tmpnam_r=''
808tmpnam_r_proto=''
b4eb6b3d 809d_truncate=''
10bc17b6
JH
810d_ttyname_r=''
811ttyname_r_proto=''
b4eb6b3d 812d_tzname=''
4e0554ec
JH
813d_u32align=''
814d_ualarm=''
b4eb6b3d
JH
815d_umask=''
816d_semctl_semid_ds=''
817d_semctl_semun=''
818d_union_semun=''
758a5d79 819d_unordered=''
bdf33aa7 820d_unsetenv=''
4e0554ec 821d_usleep=''
2ef53570 822d_usleepproto=''
b4eb6b3d 823d_ustat=''
233e16ce 824d_pseudofork=''
b4eb6b3d
JH
825d_vfork=''
826usevfork=''
827d_voidsig=''
828signal_t=''
829d_volatile=''
830d_charvspr=''
831d_vprintf=''
832d_wait4=''
833d_waitpid=''
834d_wcstombs=''
835d_wctomb=''
4e0554ec 836d_writev=''
b4eb6b3d 837dlext=''
f1ce3bf1 838bin_ELF=''
85e6fe83
LW
839cccdlflags=''
840ccdlflags=''
2304df62 841dlsrc=''
232e078e 842ld=''
85e6fe83 843lddlflags=''
2304df62 844usedl=''
b4eb6b3d
JH
845doublesize=''
846ebcdic=''
847fflushNULL=''
848fflushall=''
849fpossize=''
850fpostype=''
2d736872 851gccansipedantic=''
5b463ca7 852gccosandvers=''
8a27cf78 853gccversion=''
b4eb6b3d
JH
854gidformat=''
855gidsign=''
856gidsize=''
857gidtype=''
858groupstype=''
859h_fcntl=''
860h_sysfile=''
6e1038e0
MB
861html1dir=''
862html1direxp=''
863installhtml1dir=''
864html3dir=''
865html3direxp=''
866installhtml3dir=''
b4eb6b3d 867i_arpainet=''
c0bacbef 868i_assert=''
10bc17b6 869i_crypt=''
b4eb6b3d
JH
870db_hashtype=''
871db_prefixtype=''
640374d0
JH
872db_version_major=''
873db_version_minor=''
874db_version_patch=''
b4eb6b3d
JH
875i_db=''
876i_dbm=''
877i_rpcsvcdbm=''
878d_dirnamlen=''
879direntrytype=''
880i_dirent=''
a0d0e21e 881i_dld=''
b4eb6b3d
JH
882i_dlfcn=''
883i_fcntl=''
884i_float=''
758a5d79
JH
885i_fp=''
886i_fp_class=''
b4eb6b3d
JH
887i_gdbm=''
888d_grpasswd=''
889i_grp=''
b4eb6b3d
JH
890i_ieeefp=''
891i_inttypes=''
2765b840 892i_langinfo=''
b4eb6b3d
JH
893i_libutil=''
894i_limits=''
895i_locale=''
896i_machcthr=''
897i_malloc=''
1cd66f7c 898i_mallocmalloc=''
b4eb6b3d
JH
899i_math=''
900i_memory=''
901i_mntent=''
e74475c7
MHM
902d_gdbm_ndbm_h_uses_prototypes=''
903d_gdbmndbm_h_uses_prototypes=''
a33f2d9f 904d_ndbm=''
e74475c7 905d_ndbm_h_uses_prototypes=''
a33f2d9f
AD
906i_gdbm_ndbm=''
907i_gdbmndbm=''
b4eb6b3d
JH
908i_ndbm=''
909i_netdb=''
910i_neterrno=''
911i_netinettcp=''
912i_niin=''
913i_sysin=''
914i_poll=''
915i_prot=''
916i_pthread=''
917d_pwage=''
918d_pwchange=''
919d_pwclass=''
920d_pwcomment=''
921d_pwexpire=''
922d_pwgecos=''
923d_pwpasswd=''
924d_pwquota=''
925i_pwd=''
926i_sfio=''
927i_shadow=''
928i_socks=''
929i_stddef=''
930i_stdlib=''
931i_string=''
932strings=''
933i_sunmath=''
934i_sysaccess=''
935i_sysdir=''
936i_sysfile=''
937d_voidtty=''
938i_bsdioctl=''
939i_sysfilio=''
940i_sysioctl=''
941i_syssockio=''
942i_syslog=''
943i_sysmman=''
944i_sysmode=''
945i_sysmount=''
946i_sysndir=''
947i_sysparam=''
216dac04 948i_syspoll=''
b4eb6b3d
JH
949i_sysresrc=''
950i_syssecrt=''
951i_sysselct=''
952i_sysstat=''
953i_sysstatfs=''
954i_sysstatvfs=''
955i_systimes=''
956i_systypes=''
957i_sysuio=''
958i_sysun=''
959i_sysutsname=''
960i_sysvfs=''
961i_syswait=''
962i_sgtty=''
963i_termio=''
964i_termios=''
14b90194
JH
965d_tm_tm_gmtoff=''
966d_tm_tm_zone=''
b4eb6b3d
JH
967i_systime=''
968i_systimek=''
969i_time=''
970timeincl=''
971i_unistd=''
972i_ustat=''
973i_utime=''
974i_values=''
975i_stdarg=''
976i_varargs=''
977i_varhdr=''
978i_vfork=''
f3f1a2d8 979d_inc_version_list=''
b4eb6b3d
JH
980inc_version_list=''
981inc_version_list_init=''
982installprefix=''
983installprefixexp=''
984installstyle=''
985installusrbinperl=''
986intsize=''
987longsize=''
988shortsize=''
4b661809 989issymlink=''
2304df62 990libc=''
b4eb6b3d
JH
991ldlibpthname=''
992libperl=''
993shrpenv=''
994useshrplib=''
a0d0e21e 995glibpth=''
2304df62 996libpth=''
8e07c86e 997loclibpth=''
2304df62
AD
998plibpth=''
999xlibpth=''
1cfa4ec7 1000ignore_versioned_solibs=''
2304df62 1001libs=''
43999f95
JH
1002libsdirs=''
1003libsfiles=''
1004libsfound=''
13b3f787 1005libspath=''
85e6fe83 1006lns=''
b4eb6b3d
JH
1007d_PRIEUldbl=''
1008d_PRIFUldbl=''
1009d_PRIGUldbl=''
1010d_PRIeldbl=''
1011d_PRIfldbl=''
1012d_PRIgldbl=''
1013d_SCNfldbl=''
1014sPRIEUldbl=''
1015sPRIFUldbl=''
1016sPRIGUldbl=''
1017sPRIeldbl=''
1018sPRIfldbl=''
1019sPRIgldbl=''
1020sSCNfldbl=''
1021lseeksize=''
1022lseektype=''
d620c7b3 1023mad=''
00e74f14
NC
1024madlyh=''
1025madlyobj=''
1026madlysrc=''
f3f1a2d8
MB
1027make_set_make=''
1028d_mymalloc=''
1029freetype=''
b4eb6b3d
JH
1030mallocobj=''
1031mallocsrc=''
1032malloctype=''
9df442c2 1033usemallocwrap=''
b4eb6b3d
JH
1034usemymalloc=''
1035installman1dir=''
1036man1dir=''
1037man1direxp=''
1038man1ext=''
1039installman3dir=''
1040man3dir=''
1041man3direxp=''
1042man3ext=''
1043modetype=''
1044multiarch=''
1045mydomain=''
1046myhostname=''
1047phostname=''
2304df62
AD
1048c=''
1049n=''
b4eb6b3d
JH
1050d_eofnblk=''
1051eagain=''
1052o_nonblock=''
1053rd_nodata=''
2cc61e15 1054need_va_copy=''
b4eb6b3d
JH
1055netdb_hlen_type=''
1056netdb_host_type=''
1057netdb_name_type=''
1058netdb_net_type=''
1059groupcat=''
1060hostcat=''
1061passcat=''
1062orderlib=''
1063ranlib=''
1064d_perl_otherlibdirs=''
1065otherlibdirs=''
2304df62
AD
1066package=''
1067spackage=''
b4eb6b3d
JH
1068pager=''
1069api_revision=''
1070api_subversion=''
1071api_version=''
1072api_versionstring=''
1073patchlevel=''
151e6568 1074perl_patchlevel=''
b4eb6b3d
JH
1075revision=''
1076subversion=''
1077version=''
861eb78d 1078version_patchlevel_string=''
b4eb6b3d
JH
1079perl5=''
1080perladmin=''
1081perlpath=''
1082d_nv_preserves_uv=''
f607920a 1083d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1084i16size=''
1085i16type=''
1086i32size=''
1087i32type=''
1088i64size=''
1089i64type=''
1090i8size=''
1091i8type=''
1092ivsize=''
1093ivtype=''
b68c599a 1094nv_overflows_integers_at=''
4137585d 1095nv_preserves_uv_bits=''
b4eb6b3d
JH
1096nvsize=''
1097nvtype=''
1098u16size=''
1099u16type=''
1100u32size=''
1101u32type=''
1102u64size=''
1103u64type=''
1104u8size=''
1105u8type=''
1106uvsize=''
1107uvtype=''
1108ivdformat=''
1109nvEUformat=''
1110nvFUformat=''
1111nvGUformat=''
1112nveformat=''
1113nvfformat=''
1114nvgformat=''
1115uvXUformat=''
1116uvoformat=''
1117uvuformat=''
1118uvxformat=''
1119pidtype=''
1120prefix=''
1121prefixexp=''
1122installprivlib=''
1123privlib=''
1124privlibexp=''
1125prototype=''
1126ptrsize=''
1127d_PRIXU64=''
1128d_PRId64=''
1129d_PRIi64=''
1130d_PRIo64=''
1131d_PRIu64=''
1132d_PRIx64=''
1133sPRIXU64=''
1134sPRId64=''
1135sPRIi64=''
1136sPRIo64=''
1137sPRIu64=''
1138sPRIx64=''
1139d_quad=''
1140quadkind=''
1141quadtype=''
1142uquadtype=''
1143drand01=''
1144randbits=''
1145randfunc=''
1146randseedtype=''
1147seedfunc=''
1148installscript=''
1149scriptdir=''
1150scriptdirexp=''
1151selectminbits=''
1152selecttype=''
8ff267be 1153sh=''
b4eb6b3d
JH
1154sig_count=''
1155sig_name=''
1156sig_name_init=''
1157sig_num=''
1158sig_num_init=''
76d3c696 1159sig_size=''
f3f1a2d8 1160d_sitearch=''
b4eb6b3d
JH
1161installsitearch=''
1162sitearch=''
1163sitearchexp=''
1164installsitebin=''
1165sitebin=''
1166sitebinexp=''
8d2cbf27
JH
1167installsitehtml1dir=''
1168sitehtml1dir=''
1169sitehtml1direxp=''
1170installsitehtml3dir=''
1171sitehtml3dir=''
1172sitehtml3direxp=''
b4eb6b3d
JH
1173installsitelib=''
1174sitelib=''
1175sitelib_stem=''
1176sitelibexp=''
91e123a8
JH
1177installsiteman1dir=''
1178siteman1dir=''
1179siteman1direxp=''
1180installsiteman3dir=''
1181siteman3dir=''
1182siteman3direxp=''
b4eb6b3d
JH
1183siteprefix=''
1184siteprefixexp=''
6e1038e0
MB
1185installsitescript=''
1186sitescript=''
1187sitescriptexp=''
b4eb6b3d
JH
1188sizesize=''
1189sizetype=''
a0d0e21e 1190so=''
b4eb6b3d 1191socksizetype=''
2304df62
AD
1192sharpbang=''
1193shsharp=''
1194spitshell=''
dfe9444c 1195src=''
b4eb6b3d
JH
1196ssizetype=''
1197startperl=''
2304df62 1198startsh=''
b4eb6b3d
JH
1199stdchar=''
1200d_stdio_stream_array=''
1201stdio_stream_array=''
1202sysman=''
81c4fd9e
MB
1203sGMTIME_max=''
1204sGMTIME_min=''
73e6e416
MB
1205sLOCALTIME_max=''
1206sLOCALTIME_min=''
5ff3f7a4 1207trnl=''
b4eb6b3d
JH
1208uidformat=''
1209uidsign=''
1210uidsize=''
1211uidtype=''
1212archname64=''
1213use64bitall=''
1214use64bitint=''
34f1896b
MB
1215dtrace=''
1216usedtrace=''
15b61c98 1217usefaststdio=''
b4eb6b3d
JH
1218ccflags_uselargefiles=''
1219ldflags_uselargefiles=''
1220libswanted_uselargefiles=''
1221uselargefiles=''
1222uselongdouble=''
1223usemorebits=''
1224usemultiplicity=''
2304df62 1225nm_opt=''
40a7a20a 1226nm_so_opt=''
2304df62
AD
1227runnm=''
1228usenm=''
b4eb6b3d 1229useperlio=''
29209bc5 1230usesocks=''
b4eb6b3d
JH
1231d_oldpthreads=''
1232use5005threads=''
1233useithreads=''
9514c62b 1234usereentrant=''
b4eb6b3d 1235usethreads=''
2304df62 1236incpath=''
2304df62
AD
1237mips_type=''
1238usrinc=''
d03b3b00 1239vaproto=''
b4eb6b3d
JH
1240d_vendorarch=''
1241installvendorarch=''
1242vendorarch=''
1243vendorarchexp=''
1244d_vendorbin=''
1245installvendorbin=''
1246vendorbin=''
1247vendorbinexp=''
8d2cbf27
JH
1248installvendorhtml1dir=''
1249vendorhtml1dir=''
1250vendorhtml1direxp=''
1251installvendorhtml3dir=''
1252vendorhtml3dir=''
1253vendorhtml3direxp=''
b4eb6b3d
JH
1254d_vendorlib=''
1255installvendorlib=''
1256vendorlib=''
1257vendorlib_stem=''
1258vendorlibexp=''
91e123a8
JH
1259installvendorman1dir=''
1260vendorman1dir=''
1261vendorman1direxp=''
1262installvendorman3dir=''
1263vendorman3dir=''
1264vendorman3direxp=''
b4eb6b3d
JH
1265usevendorprefix=''
1266vendorprefix=''
1267vendorprefixexp=''
6e1038e0
MB
1268d_vendorscript=''
1269installvendorscript=''
1270vendorscript=''
1271vendorscriptexp=''
d56c5707 1272versiononly=''
b4eb6b3d
JH
1273defvoidused=''
1274voidflags=''
3659ebf1
JH
1275yacc=''
1276yaccflags=''
2304df62
AD
1277CONFIG=''
1278
34f1896b 1279: Detect odd OSs
ecfc5424
AD
1280define='define'
1281undef='undef'
1282smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1283rmlist=''
1284
1285: We must find out about Eunice early
1286eunicefix=':'
1287if test -f /etc/unixtovms; then
1288 eunicefix=/etc/unixtovms
1289fi
1290if test -f /etc/unixtovms.exe; then
1291 eunicefix=/etc/unixtovms.exe
1292fi
1293
cfb04860 1294: Set executable suffix now -- needed before hints available
6153ba32
PG
1295if test -f "/libs/version.library"; then
1296: Amiga OS
1297 _exe=""
1298elif test -f "/system/gnu_library/bin/ar.pm"; then
1299: Stratus VOS
cfb04860 1300 _exe=".pm"
6153ba32
PG
1301elif test -n "$DJGPP"; then
1302: DOS DJGPP
cfb04860 1303 _exe=".exe"
5c728af0 1304elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1305: OS/2 or cygwin
ba863942
JH
1306 _exe=".exe"
1307fi
868439a2 1308
1d8eaf8c 1309groupstype=''
b4eb6b3d 1310i_whoami=''
9da7673b
MB
1311: Trailing extension. Override this in a hint file, if needed.
1312: Extra object files, if any, needed on this platform.
1313archobjs=''
1314archname=''
64615a5e 1315libnames=''
732c9516
JH
1316: change the next line if compiling for Xenix/286 on Xenix/386
1317xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1318: Possible local library directories to search.
1319loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1320loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1321
1322: general looking path for locating libraries
5869b1f1 1323glibpth="/lib /usr/lib $xlibpth"
732c9516 1324glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1325test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1326test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1327test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1328
1329: Private path used by Configure to find libraries. Its value
1330: is prepended to libpth. This variable takes care of special
1331: machines, like the mips. Usually, it should be empty.
1332plibpth=''
1333
1cfa4ec7
GS
1334: default library list
1335libswanted=''
921b2963 1336: some systems want to use only the non-versioned libso:s
1cfa4ec7 1337ignore_versioned_solibs=''
ed140128
AD
1338: set usethreads on the Configure command line to enable threads.
1339usereentrant='undef'
1340: full support for void wanted by default
1341defvoidused=15
1342
1343: Possible local include directories to search.
1344: Set locincpth to "" in a hint file to defeat local include searches.
1345locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1346locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1347:
1348: no include file wanted by default
1349inclwanted=''
1350
1351: Enable -DEBUGGING and -DDEBUGGING from the command line
1352EBUGGING=''
1353DEBUGGING=old
1354
1355ccname=''
1356ccversion=''
1357perllibs=''
1358: set useposix=false in your hint file to disable the POSIX extension.
1359useposix=true
1360: set useopcode=false in your hint file to disable the Opcode extension.
1361useopcode=true
b4eb6b3d
JH
1362archname64=''
1363ccflags_uselargefiles=''
1364ldflags_uselargefiles=''
1365libswanted_uselargefiles=''
1366: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1367: set usesocks on the Configure command line to enable socks.
ecfc5424 1368: List of libraries we want.
15431986 1369: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef 1370libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8119684f 1371libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1372: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1373: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1374glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1375glibpth="/usr/shlib $glibpth"
1376: Do not use vfork unless overridden by a hint file.
1377usevfork=false
1378
8ff267be 1379: Find the basic shell for Bourne shell scripts
1380case "$sh" in
1381'')
8ff267be 1382 case "$SYSTYPE" in
1383 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1384 *) xxx='/bin/sh';;
1385 esac
1386 if test -f "$xxx"; then
1387 sh="$xxx"
1388 else
1389 : Build up a list and do a single loop so we can 'break' out.
1390 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1391 for xxx in sh bash ksh pdksh ash; do
1392 for p in $pth; do
1393 try="$try ${p}/${xxx}"
1394 done
1395 done
1396 for xxx in $try; do
1397 if test -f "$xxx"; then
1398 sh="$xxx";
8ff267be 1399 break
a5a94ea5
JH
1400 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1401 sh="$xxx";
1402 break
8ff267be 1403 elif test -f "$xxx.exe"; then
1404 sh="$xxx";
8ff267be 1405 break
1406 fi
1407 done
1408 fi
1409 ;;
1410esac
1411
1412case "$sh" in
a33c94aa 1413'') cat >&2 <<EOM
8ff267be 1414$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1415
8ff267be 1416Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1417Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1418we'll try to straighten this all out.
8ff267be 1419EOM
1420 exit 1
1421 ;;
1422esac
1423
760ac839 1424: see if sh knows # comments
73614538 1425if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1426 shsharp=true
1427 spitshell=cat
760ac839 1428 xcat=/bin/cat
a931254c
JH
1429 test -f $xcat$_exe || xcat=/usr/bin/cat
1430 if test ! -f $xcat$_exe; then
4bdb8fb5 1431 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1432 if test -f $p/cat$_exe; then
1deb0a86 1433 xcat=$p/cat
3c728e00
JH
1434 break
1435 fi
1436 done
1deb0a86
JH
1437 if test ! -f $xcat$_exe; then
1438 echo "Can't find cat anywhere!"
3c728e00
JH
1439 exit 1
1440 fi
1441 fi
5440bc8e
JH
1442 echo "#!$xcat" >sharp
1443 $eunicefix sharp
1444 chmod +x sharp
1d8eaf8c 1445 ./sharp > today 2>/dev/null
760ac839 1446 if test -s today; then
760ac839
LW
1447 sharpbang='#!'
1448 else
5440bc8e
JH
1449 echo "#! $xcat" > sharp
1450 $eunicefix sharp
1451 chmod +x sharp
1d8eaf8c 1452 ./sharp > today 2>/dev/null
760ac839 1453 if test -s today; then
760ac839
LW
1454 sharpbang='#! '
1455 else
760ac839
LW
1456 sharpbang=': use '
1457 fi
1458 fi
1459else
dfe9444c 1460 echo " "
8ff267be 1461 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1462 shsharp=false
1463 cd ..
1464 echo "exec grep -v '^[ ]*#'" >spitshell
1465 chmod +x spitshell
1466 $eunicefix spitshell
1467 spitshell=`pwd`/spitshell
1468 cd UU
1469 echo "I presume that if # doesn't work, #! won't work either!"
1470 sharpbang=': use '
1471fi
5440bc8e 1472rm -f sharp today
760ac839
LW
1473
1474: figure out how to guarantee sh startup
8ff267be 1475case "$startsh" in
1476'') startsh=${sharpbang}${sh} ;;
1477*)
760ac839 1478esac
5440bc8e 1479cat >sharp <<EOSS
760ac839
LW
1480$startsh
1481set abc
1482test "$?abc" != 1
1483EOSS
1484
5440bc8e
JH
1485chmod +x sharp
1486$eunicefix sharp
1487if ./sharp; then
8ff267be 1488 : echo "Yup, it does."
760ac839 1489else
dfe9444c
AD
1490 echo "Hmm... '$startsh' does not guarantee sh startup..."
1491 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1492fi
5440bc8e 1493rm -f sharp
760ac839 1494
aebf16e7
AD
1495: Save command line options in file UU/cmdline.opt for later use in
1496: generating config.sh.
1497cat > cmdline.opt <<EOSH
613d6c3e 1498: Configure command line arguments.
aebf16e7
AD
1499config_arg0='$0'
1500config_args='$*'
1501config_argc=$#
1502EOSH
1503argn=1
ee45ea83
IZ
1504args_exp=''
1505args_sep=''
aebf16e7
AD
1506for arg in "$@"; do
1507 cat >>cmdline.opt <<EOSH
1508config_arg$argn='$arg'
1509EOSH
ee45ea83
IZ
1510 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1511$arg
1512EOC
1513 arg_exp=`cat cmdl.opt`
1514 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1515 argn=`expr $argn + 1`
ee45ea83 1516 args_sep=' '
aebf16e7 1517done
ee45ea83 1518rm -f cmdl.opt
aebf16e7 1519
2304df62
AD
1520: produce awk script to parse command line options
1521cat >options.awk <<'EOF'
1522BEGIN {
02e93a22 1523 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1524
1525 len = length(optstr);
1526 for (i = 1; i <= len; i++) {
1527 c = substr(optstr, i, 1);
1528 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1529 if (a == ":") {
1530 arg[c] = 1;
1531 i++;
1532 }
1533 opt[c] = 1;
1534 }
1535}
1536{
1537 expect = 0;
1538 str = $0;
1539 if (substr(str, 1, 1) != "-") {
1540 printf("'%s'\n", str);
1541 next;
1542 }
1543 len = length($0);
1544 for (i = 2; i <= len; i++) {
1545 c = substr(str, i, 1);
1546 if (!opt[c]) {
1547 printf("-%s\n", substr(str, i));
1548 next;
1549 }
1550 printf("-%s\n", c);
1551 if (arg[c]) {
1552 if (i < len)
1553 printf("'%s'\n", substr(str, i + 1));
1554 else
1555 expect = 1;
1556 next;
1557 }
1558 }
1559}
1560END {
1561 if (expect)
1562 print "?";
1563}
1564EOF
1565
1566: process the command line options
4633a7c4
LW
1567set X `for arg in "$@"; do echo "X$arg"; done |
1568 sed -e s/X// | awk -f options.awk`
2304df62
AD
1569eval "set $*"
1570shift
1571rm -f options.awk
1572
1573: set up default values
1574fastread=''
1575reuseval=false
1576config_sh=''
1577alldone=''
1578error=''
1579silent=''
1580extractsh=''
ecfc5424 1581override=''
16d20bd9 1582knowitall=''
02e93a22 1583rm -f optdef.sh posthint.sh
28757baa 1584cat >optdef.sh <<EOS
1585$startsh
1586EOS
2304df62 1587
dfe9444c 1588
2304df62
AD
1589: option parsing
1590while test $# -gt 0; do
1591 case "$1" in
1592 -d) shift; fastread=yes;;
1593 -e) shift; alldone=cont;;
1594 -f)
1595 shift
1596 cd ..
1597 if test -r "$1"; then
1598 config_sh="$1"
1599 else
a0d0e21e 1600 echo "$me: cannot read config file $1." >&2
2304df62
AD
1601 error=true
1602 fi
1603 cd UU
1604 shift;;
3f30fabf 1605 --help|\
2304df62
AD
1606 -h) shift; error=true;;
1607 -r) shift; reuseval=true;;
dfe9444c 1608 -s) shift; silent=true; realsilent=true;;
2304df62 1609 -E) shift; alldone=exit;;
16d20bd9 1610 -K) shift; knowitall=true;;
ecfc5424 1611 -O) shift; override=true;;
dfe9444c 1612 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1613 -D)
1614 shift
1615 case "$1" in
1616 *=)
1617 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1618 echo "$me: ignoring -D $1" >&2
1619 ;;
ecfc5424 1620 *=*) echo "$1" | \
1aef975c
AD
1621 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1622 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1623 esac
1624 shift
1625 ;;
1626 -U)
1627 shift
1628 case "$1" in
1aef975c 1629 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1630 *=*)
1631 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1632 echo "$me: ignoring -U $1" >&2
1633 ;;
1aef975c 1634 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1635 esac
1636 shift
1637 ;;
02e93a22
JH
1638 -A)
1639 shift
1640 xxx=''
1641 yyy="$1"
02e93a22 1642 zzz=''
5f83a3e9 1643 uuu=undef
02e93a22 1644 case "$yyy" in
f7c31117 1645 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1646 case "$zzz" in
1647 *:*) zzz='' ;;
1648 *) xxx=append
613d6c3e 1649 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
f7c31117 1650 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1651 esac
1652 ;;
1653 esac
1654 case "$xxx" in
1655 '') case "$yyy" in
f7c31117
JH
1656 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1657 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1658 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1659 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1660 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1661 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9 1662 esac
613d6c3e 1663 ;;
5f83a3e9 1664 esac
02e93a22
JH
1665 case "$xxx" in
1666 append)
5f83a3e9 1667 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1668 clear)
5f83a3e9 1669 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1670 define)
1671 case "$zzz" in
1672 '') zzz=define ;;
1673 esac
5f83a3e9 1674 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1675 eval)
5f83a3e9 1676 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1677 prepend)
5f83a3e9 1678 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1679 undef)
1680 case "$zzz" in
1681 '') zzz="$uuu" ;;
1682 esac
5f83a3e9
JH
1683 echo "$yyy=$zzz" >> posthint.sh ;;
1684 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1685 esac
bde6b06b 1686 shift
02e93a22 1687 ;;
216dac04 1688 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
5f83a3e9 1689 exit 0;;
2304df62 1690 --) break;;
a0d0e21e 1691 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1692 *) break;;
1693 esac
1694done
1695
1696case "$error" in
1697true)
1698 cat >&2 <<EOM
2afac517 1699Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1700 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1701 -d : use defaults for all answers.
1702 -e : go on without questioning past the production of config.sh.
1703 -f : specify an alternate default configuration file.
1704 -h : print this help message and exit (with an error status).
1705 -r : reuse C symbols value if possible (skips costly nm extraction).
1706 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1707 -D : define symbol to have some value:
1708 -D symbol symbol gets the value 'define'
1709 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1710 common used examples (see INSTALL for more info):
1711 -Duse64bitint use 64bit integers
b79e0b55 1712 -Duse64bitall use 64bit integers and pointers
3f30fabf 1713 -Dusethreads use thread support
b79e0b55 1714 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1715 -DEBUGGING=none DEBUGGING options
1716 -Dcc=gcc choose your compiler
1717 -Dprefix=/opt/perl5 choose your destination
2304df62 1718 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1719 -K : do not use unless you know what you are doing.
ecfc5424 1720 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1721 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1722 -U : undefine symbol:
1723 -U symbol symbol gets the value 'undef'
1724 -U symbol= symbol gets completely empty
3f30fabf 1725 e.g.: -Uversiononly
02e93a22 1726 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1727 -A append:symbol=value append value to symbol
1728 -A symbol=value like append:, but with a separating space
1729 -A define:symbol=value define symbol to have value
1730 -A clear:symbol define symbol to be ''
1731 -A define:symbol define symbol to be 'define'
1732 -A eval:symbol=value define symbol to be eval of value
1733 -A prepend:symbol=value prepend value to symbol
1734 -A undef:symbol define symbol to be 'undef'
1735 -A undef:symbol= define symbol to be ''
3f30fabf 1736 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1737 -A ccflags=-DSOME_MACRO
2304df62
AD
1738 -V : print version number and exit (with a zero status).
1739EOM
1740 exit 1
1741 ;;
1742esac
1743
dfe9444c
AD
1744: Sanity checks
1745case "$fastread$alldone" in
1746yescont|yesexit) ;;
1747*)
aaeb8e51
GS
1748 case "$extractsh" in
1749 true) ;;
1750 *)
1751 if test ! -t 0; then
1752 echo "Say 'sh Configure', not 'sh <Configure'"
1753 exit 1
1754 fi
1755 ;;
1756 esac
dfe9444c
AD
1757 ;;
1758esac
1759
2304df62
AD
1760exec 4>&1
1761case "$silent" in
1762true) exec 1>/dev/null;;
1763esac
1764
ecfc5424 1765: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1766touch optdef.sh
1767. ./optdef.sh
02e93a22
JH
1768: create the posthint manipulation script and leave the file out there...
1769touch posthint.sh
a0d0e21e 1770
2304df62 1771: set package name
34f1896b 1772package='perl5'
b4eb6b3d
JH
1773first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1774last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1775case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1776ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1777*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1778esac
2304df62 1779
2304df62
AD
1780: Some greps do not return status, grrr.
1781echo "grimblepritz" >grimble
1782if grep blurfldyick grimble >/dev/null 2>&1 ; then
1783 contains=contains
1784elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1785 contains=grep
1786else
1787 contains=contains
1788fi
1789rm -f grimble
1790: the following should work in any shell
1791case "$contains" in
1792contains*)
1793 echo " "
1794 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1795 cat >contains <<'EOSS'
1796grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1797EOSS
1798chmod +x contains
1799esac
1800
dfe9444c
AD
1801: Find the path to the source tree
1802case "$src" in
1803'') case "$0" in
b233458b
JH
1804 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1805 case "$src" in
1806 /*) ;;
8504afb7 1807 .) ;;
b233458b
JH
1808 *) src=`cd ../$src && pwd` ;;
1809 esac
1810 ;;
dfe9444c
AD
1811 *) src='.';;
1812 esac;;
1813esac
1814case "$src" in
1815'') src=/
1816 rsrc=/
1817 ;;
34f1896b
MB
1818/*) rsrc="$src";;
1819*) rsrc="../$src";;
dfe9444c
AD
1820esac
1821if test -f $rsrc/Configure && \
34f1896b 1822 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
dfe9444c
AD
1823then
1824 : found it, so we are ok.
1825else
1826 rsrc=''
1827 for src in . .. ../.. ../../.. ../../../..; do
1828 if test -f ../$src/Configure && \
1829 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1830 then
1831 rsrc=../$src
1832 break
1833 fi
1834 done
1835fi
1836case "$rsrc" in
1837'')
1838 cat <<EOM >&4
1839
1840Sorry, I can't seem to locate the source dir for $package. Please start
1841Configure with an explicit path -- i.e. /some/path/Configure.
1842
1843EOM
1844 exit 1
1845 ;;
1846../.) rsrc='..';;
1847*)
1848 echo " "
1849 echo "Sources for $package found in \"$src\"." >&4
1850 ;;
1851esac
1852
1853: script used to extract .SH files with variable substitutions
1854cat >extract <<'EOS'
a02608de 1855PERL_CONFIG_SH=true
dfe9444c 1856echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1857if test -f MANIFEST; then
1858 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1859else
1860 echo "(Looking for .SH files under the source directory.)"
6904989c 1861 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1862fi
1863shift
1864case $# in
6904989c 18650) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1866esac
6904989c 1867if test ! -f "$src/$1"; then
dfe9444c
AD
1868 shift
1869fi
1870mkdir_p='
1871name=$1;
1872create="";
1873while test $name; do
1874 if test ! -d "$name"; then
1875 create="$name $create";
1876 name=`echo $name | sed -e "s|^[^/]*$||"`;
1877 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1878 else
1879 name="";
1880 fi;
1881done;
1882for file in $create; do
1883 mkdir $file;
1884done
1885'
1886for file in $*; do
1887 case "$src" in
1888 ".")
1889 case "$file" in
1890 */*)
1891 dir=`expr X$file : 'X\(.*\)/'`
1892 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1893 (cd "$dir" && . ./$file)
dfe9444c
AD
1894 ;;
1895 *)
1896 . ./$file
1897 ;;
1898 esac
1899 ;;
1900 *)
1901 case "$file" in
1902 */*)
1903 dir=`expr X$file : 'X\(.*\)/'`
1904 file=`expr X$file : 'X.*/\(.*\)'`
1905 (set x $dir; shift; eval $mkdir_p)
6904989c 1906 sh <"$src/$dir/$file"
dfe9444c
AD
1907 ;;
1908 *)
6904989c 1909 sh <"$src/$file"
dfe9444c
AD
1910 ;;
1911 esac
1912 ;;
1913 esac
1914done
6904989c 1915if test -f "$src/config_h.SH"; then
dfe9444c
AD
1916 if test ! -f config.h; then
1917 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1918 . "$src/config_h.SH"
dfe9444c
AD
1919 fi
1920fi
1921EOS
1922
1923: extract files and exit if asked to do so
1924case "$extractsh" in
1925true)
1926 case "$realsilent" in
1927 true) ;;
1928 *) exec 1>&4;;
1929 esac
1930 case "$config_sh" in
1931 '') config_sh='config.sh';;
1932 esac
1933 echo " "
1934 echo "Fetching answers from $config_sh..."
1935 cd ..
1936 . $config_sh
1937 test "$override" && . ./optdef.sh
1938 echo " "
1939 . UU/extract
1940 rm -rf UU
24ccb310 1941 echo "Extraction done."
dfe9444c
AD
1942 exit 0
1943 ;;
1944esac
1945
1946: Eunice requires " " instead of "", can you believe it
1947echo " "
1948: Here we go...
1949echo "Beginning of configuration questions for $package."
1950
1951trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1952
2304df62
AD
1953: first determine how to suppress newline on echo command
1954echo " "
1955echo "Checking echo to see how to suppress newlines..."
1956(echo "hi there\c" ; echo " ") >.echotmp
1957if $contains c .echotmp >/dev/null 2>&1 ; then
1958 echo "...using -n."
1959 n='-n'
1960 c=''
1961else
1962 cat <<'EOM'
1963...using \c
1964EOM
1965 n=''
1966 c='\c'
1967fi
1968echo $n "The star should be here-->$c"
1969echo '*'
1970rm -f .echotmp
1971
1972: Now test for existence of everything in MANIFEST
1973echo " "
6904989c 1974if test -f "$rsrc/MANIFEST"; then
2304df62 1975 echo "First let's make sure your kit is complete. Checking..." >&4
1d8eaf8c 1976 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
776a38e3 1977 (split -l 50 2>/dev/null || split -50)
2304df62 1978 rm -f missing
dfe9444c 1979 tmppwd=`pwd`
2304df62 1980 for filelist in x??; do
776a38e3
MB
1981 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1982 >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1983 done
1984 if test -s missing; then
1985 cat missing >&4
1986 cat >&4 <<'EOM'
1987
1988THIS PACKAGE SEEMS TO BE INCOMPLETE.
1989
1990You have the option of continuing the configuration process, despite the
1991distinct possibility that your kit is damaged, by typing 'y'es. If you
1992do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1993and contact the author (perlbug@perl.org).
2304df62
AD
1994
1995EOM
1996 echo $n "Continue? [n] $c" >&4
1997 read ans
1998 case "$ans" in
1999 y*)
2000 echo "Continuing..." >&4
2001 rm -f missing
2002 ;;
2003 *)
2004 echo "ABORTING..." >&4
2005 kill $$
2006 ;;
2007 esac
2008 else
dfe9444c 2009 echo "Looks good..."
2304df62
AD
2010 fi
2011else
2012 echo "There is no MANIFEST file. I hope your kit is complete !"
2013fi
2014rm -f missing x??
2015
5ff3f7a4 2016: Find the appropriate value for a newline for tr
613d6c3e 2017echo " "
5ff3f7a4
GS
2018if test -n "$DJGPP"; then
2019 trnl='\012'
2020fi
2021if test X"$trnl" = X; then
2022 case "`echo foo|tr '\n' x 2>/dev/null`" in
2023 foox) trnl='\n' ;;
2024 esac
2025fi
2026if test X"$trnl" = X; then
2027 case "`echo foo|tr '\012' x 2>/dev/null`" in
2028 foox) trnl='\012' ;;
2029 esac
2030fi
2031if test X"$trnl" = X; then
8be2c24c
JH
2032 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2033 fooxy) trnl='\n\r' ;;
2034 esac
2035fi
2036if test X"$trnl" = X; then
5ff3f7a4
GS
2037 cat <<EOM >&2
2038
2039$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2040
2041EOM
2042 exit 1
2043fi
2044
2304df62
AD
2045: compute the number of columns on the terminal for proper question formatting
2046case "$COLUMNS" in
2047'') COLUMNS='80';;
2048esac
2049
2050: set up the echo used in my read
2051myecho="case \"\$xxxm\" in
2052'') echo $n \"\$rp $c\" >&4;;
2053*) case \"\$rp\" in
2054 '') echo $n \"[\$xxxm] $c\";;
2055 *)
2056 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2057 echo \"\$rp\" >&4
2058 echo $n \"[\$xxxm] $c\" >&4
2059 else
2060 echo $n \"\$rp [\$xxxm] $c\" >&4
2061 fi
2062 ;;
2063 esac;;
2064esac"
2065
2066: now set up to do reads with possible shell escape and default assignment
2067cat <<EOSC >myread
28757baa 2068$startsh
2304df62
AD
2069xxxm=\$dflt
2070$myecho
2071ans='!'
2072case "\$fastread" in
2073yes) case "\$dflt" in
2074 '') ;;
2075 *) ans='';
2076 case "\$silent-\$rp" in
2077 true-) ;;
2078 *) echo " " >&4;;
2079 esac;;
2080 esac;;
2081*) case "\$silent" in
2082 true) case "\$rp" in
2083 '') ans='';;
2084 esac;;
2085 esac;;
2086esac
2087while expr "X\$ans" : "X!" >/dev/null; do
2088 read answ
2089 set x \$xxxm
2090 shift
dfe9444c 2091 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2092 case "\$answ" in
dfe9444c
AD
2093 "!")
2094 sh 1>&4
2095 echo " "
2096 $myecho
2097 ;;
2098 !*)
2099 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2100 shift
2101 sh 1>&4 -c "\$*"
2102 echo " "
2103 $myecho
2104 ;;
2304df62
AD
2105 "\$ans")
2106 case "\$ans" in
ecfc5424
AD
2107 \\&*)
2108 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2109 shift
2110 case "\$1" in
2111 -d)
2112 fastread=yes
40a7a20a 2113 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2114 ;;
2115 -*)
40a7a20a 2116 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2117 ;;
2118 esac
2119 $myecho
2120 ans=!
2121 ;;
2304df62
AD
2122 esac;;
2123 *)
2124 case "\$aok" in
2125 y)
2126 echo "*** Substitution done -- please confirm."
2127 xxxm="\$ans"
c9795ab7 2128 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2129 xxxm="\$ans"
2130 ans=!
2131 ;;
2132 *)
2133 echo "*** Error -- try again."
2134 ans=!
2135 ;;
2136 esac
2137 $myecho
2138 ;;
2139 esac
2140 case "\$ans\$xxxm\$nostick" in
2141 '')
2142 ans=!
2143 $myecho
2144 ;;
2145 esac
2146done
2147case "\$ans" in
2148'') ans="\$xxxm";;
2149esac
2150EOSC
2151
2152: create .config dir to save info across Configure sessions
2153test -d ../.config || mkdir ../.config
2154cat >../.config/README <<EOF
2155This directory created by Configure to save information that should
dfe9444c 2156persist across sessions for $package.
2304df62
AD
2157
2158You may safely delete it if you wish.
2159EOF
2160
613d6c3e 2161: See if we are using a devel version and want that
9507cadf 2162xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2163case "$usedevel" in
1be1b388
MB
2164$define|true|[yY]*)
2165 usedevel="$define" ;;
9507cadf 2166*) case "$xversion" in
0107c034
JH
2167 *[13579])
2168 cat >&4 <<EOH
2169*** WHOA THERE!!! ***
2170
2171 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2172 The version of this $package distribution is $xversion, that is, odd,
2173 (as opposed to even) and that signifies a development release.
3d5d58b1 2174 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2175
2176 Do ***NOT*** install this into production use.
2177 Data corruption and crashes are possible.
2178
2179 It is most seriously suggested that you do not continue any further
2180 unless you want to help in developing and debugging Perl.
2181
6adc6a45
JH
2182 If you *still* want to build perl, you can answer 'y' now,
2183 or pass -Dusedevel to Configure.
2184
0107c034
JH
2185EOH
2186 rp='Do you really want to continue?'
2187 dflt='n'
2188 . ./myread
2189 case "$ans" in
8feeef0e
JH
2190 [yY]) echo >&4 "Okay, continuing."
2191 usedevel="$define" ;;
0107c034
JH
2192 *) echo >&4 "Okay, bye."
2193 exit 1
2194 ;;
2195 esac
2196 ;;
2197 esac
1be1b388 2198 usedevel="$undef"
0107c034
JH
2199 ;;
2200esac
8feeef0e
JH
2201case "$usedevel" in
2202$define|true|[yY]*)
2203 case "$versiononly" in
2204 '') versiononly="$define" ;;
2205 esac
2206 case "$installusrbinperl" in
2207 '') installusrbinperl="$undef" ;;
2208 esac
2209 ;;
2210esac
0107c034 2211
2304df62
AD
2212: general instructions
2213needman=true
2214firsttime=true
760ac839 2215user=`(logname) 2>/dev/null`
dfe9444c
AD
2216case "$user" in
2217'') user=`whoami 2>&1`;;
760ac839 2218esac
2304df62
AD
2219if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2220 firsttime=false
2221 echo " "
2222 rp='Would you like to see the instructions?'
2223 dflt=n
2224 . ./myread
2225 case "$ans" in
2226 [yY]*) ;;
2227 *) needman=false;;
2228 esac
2229fi
2230if $needman; then
2231 cat <<EOH
4e2a5f63 2232
2304df62 2233This installation shell script will examine your system and ask you questions
a0d0e21e 2234to determine how the perl5 package should be installed. If you get
2304df62
AD
2235stuck on a question, you may use a ! shell escape to start a subshell or
2236execute a command. Many of the questions will have default answers in square
2237brackets; typing carriage return will give you the default.
2238
2239On some of the questions which ask for file or directory names you are allowed
2240to use the ~name construct to specify the login directory belonging to "name",
2241even if you don't have a shell which knows about that. Questions where this is
2242allowed will be marked "(~name ok)".
2243
2244EOH
2245 rp=''
2246 dflt='Type carriage return to continue'
2247 . ./myread
2248 cat <<'EOH'
2249
2250The prompter used in this script allows you to use shell variables and
2251backticks in your answers. You may use $1, $2, etc... to refer to the words
2252in the default answer, as if the default line was a set of arguments given to a
2253script shell. This means you may also use $* to repeat the whole default line,
2254so you do not have to re-type everything to add something to the default.
2255
2256Everytime there is a substitution, you will have to confirm. If there is an
2257error (e.g. an unmatched backtick), the default answer will remain unchanged
2258and you will be prompted again.
2259
2260If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2261the questions and use the computed defaults (or the previous answers if there
2262was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2263You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2264on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2265
2266EOH
2267 . ./myread
2268 cat <<EOH
2269
2270Much effort has been expended to ensure that this shell script will run on any
2271Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2272Configure and run it again. If you can't run Configure for some reason,
2273you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2274have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2275
2276This installation script affects things in two ways:
2277
22781) it may do direct variable substitutions on some of the files included
2279 in this kit.
22802) it builds a config.h file for inclusion in C programs. You may edit
2281 any of these files as the need arises after running this script.
2282
2283If you make a mistake on a question, there is no easy way to back up to it
2284currently. The easiest thing to do is to edit config.sh and rerun all the SH
2285files. Configure will offer to let you do this before it runs the SH files.
2286
2287EOH
2288 dflt='Type carriage return to continue'
2289 . ./myread
2290 case "$firsttime" in
2291 true) echo $user >>../.config/instruct;;
2292 esac
2293fi
2294
2304df62
AD
2295: find out where common programs are
2296echo " "
2297echo "Locating common programs..." >&4
2298cat <<EOSC >loc
2299$startsh
2300case \$# in
23010) exit 1;;
2302esac
2303thing=\$1
2304shift
2305dflt=\$1
2306shift
2307for dir in \$*; do
2308 case "\$thing" in
2309 .)
2310 if test -d \$dir/\$thing; then
2311 echo \$dir
2312 exit 0
2313 fi
2314 ;;
2315 *)
a0d0e21e 2316 for thisthing in \$dir/\$thing; do
ecfc5424 2317 : just loop through to pick last item
a0d0e21e 2318 done
25f94b33 2319 if test -f \$thisthing; then
a0d0e21e 2320 echo \$thisthing
2304df62 2321 exit 0
a5a94ea5
JH
2322 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2323 echo \$thisthing
776a38e3 2324 exit 0
2304df62 2325 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2326 if test -n "$DJGPP"; then
2327 echo \$dir/\$thing.exe
b921d661 2328 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2329 : on Eunice apparently
2330 echo \$dir/\$thing
2331 fi
2d736872 2332 exit 0
2304df62
AD
2333 fi
2334 ;;
2335 esac
2336done
2337echo \$dflt
2338exit 1
2339EOSC
2340chmod +x loc
2341$eunicefix loc
2342loclist="
2343awk
2344cat
f8006fac 2345chmod
b4eb6b3d
JH
2346comm
2347cp
2304df62
AD
2348echo
2349expr
2350grep
a0d0e21e 2351ls
b4eb6b3d 2352mkdir
2304df62
AD
2353rm
2354sed
b4eb6b3d 2355sort
85e6fe83 2356touch
2304df62 2357tr
b4eb6b3d 2358uniq
2304df62
AD
2359"
2360trylist="
dfe9444c 2361ar
3659ebf1 2362bison
b4eb6b3d 2363byacc
2304df62 2364cpp
b4eb6b3d 2365csh
2304df62
AD
2366date
2367egrep
1fef16b3 2368gmake
8ff267be 2369gzip
b4eb6b3d 2370less
8ff267be 2371ln
3c728e00 2372make
b4eb6b3d 2373more
693762b4 2374nm
b4eb6b3d
JH
2375nroff
2376pg
2304df62
AD
2377test
2378uname
8ff267be 2379zip
2304df62 2380"
8e07c86e 2381pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2382pth="$pth /lib /usr/lib"
2383for file in $loclist; do
dfe9444c
AD
2384 eval xxx=\$$file
2385 case "$xxx" in
2386 /*|?:[\\/]*)
2387 if test -f "$xxx"; then
2388 : ok
2389 else
2390 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2391 xxx=`./loc $file $file $pth`
2392 fi
2393 ;;
2394 '') xxx=`./loc $file $file $pth`;;
2395 *) xxx=`./loc $xxx $xxx $pth`;;
2396 esac
a5a94ea5 2397 eval $file=$xxx$_exe
2304df62
AD
2398 eval _$file=$xxx
2399 case "$xxx" in
2400 /*)
2401 echo $file is in $xxx.
2402 ;;
8e07c86e
AD
2403 ?:[\\/]*)
2404 echo $file is in $xxx.
2405 ;;
2304df62 2406 *)
25f94b33
AD
2407 echo "I don't know where '$file' is, and my life depends on it." >&4
2408 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2409 exit 1
2304df62
AD
2410 ;;
2411 esac
2412done
2413echo " "
2414echo "Don't worry if any of the following aren't found..."
2415say=offhand
2416for file in $trylist; do
dfe9444c
AD
2417 eval xxx=\$$file
2418 case "$xxx" in
2419 /*|?:[\\/]*)
2420 if test -f "$xxx"; then
2421 : ok
2422 else
2423 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2424 xxx=`./loc $file $file $pth`
2425 fi
2426 ;;
2427 '') xxx=`./loc $file $file $pth`;;
2428 *) xxx=`./loc $xxx $xxx $pth`;;
2429 esac
306a8474 2430 eval $file=$xxx$_exe
2304df62
AD
2431 eval _$file=$xxx
2432 case "$xxx" in
2433 /*)
2434 echo $file is in $xxx.
2435 ;;
8e07c86e
AD
2436 ?:[\\/]*)
2437 echo $file is in $xxx.
2438 ;;
2304df62
AD
2439 *)
2440 echo "I don't see $file out there, $say."
2441 say=either
2442 ;;
2443 esac
2444done
2445case "$egrep" in
1fef16b3 2446egrep)
2304df62
AD
2447 echo "Substituting grep for egrep."
2448 egrep=$grep
868439a2 2449 _egrep=$grep
2304df62
AD
2450 ;;
2451esac
3141af47
MB
2452case "$less" in
2453'') ;;
2454*) if $less -R </dev/null >/dev/null; then
2455 echo "Substituting less -R for less."
2456 less="$less -R"
2457 _less=$less
2458 fi
2459 ;;
2460esac
8ff267be 2461case "$ln" in
1fef16b3 2462ln)
8ff267be 2463 echo "Substituting cp for ln."
2464 ln=$cp
868439a2 2465 _ln=$cp
8ff267be 2466 ;;
2467esac
2e26f1d5 2468case "$make" in
613d6c3e 2469make)
2e26f1d5
JH
2470 case "$gmake" in
2471 gmake)
2472 echo "I can't find make or gmake, and my life depends on it." >&4
2473 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2474 exit 1
2475 ;;
2476 esac
2477 ;;
613d6c3e 2478esac
2e26f1d5
JH
2479case "$gmake" in
2480gmake) ;;
2481*) # We can't have osname yet.
1fef16b3
JH
2482 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2483 # Assume that gmake, if found, is definitely GNU make
2484 # and prefer it over the system make.
2485 echo "Substituting gmake for make."
2486 make=$gmake
868439a2 2487 _make=$gmake
1fef16b3
JH
2488 fi
2489 ;;
a5a94ea5 2490esac
2304df62
AD
2491case "$test" in
2492test)
2493 echo "Hopefully test is built into your sh."
2494 ;;
2495*)
73614538 2496 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2497 echo "Using the test built into your sh."
2304df62
AD
2498 test=test
2499 _test=test
2500 fi
2501 ;;
2502esac
2503case "$echo" in
2504echo)
2505 echo "Hopefully echo is built into your sh."
2506 ;;
2507'') ;;
2508*)
2509 echo " "
2510echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2511 $echo $n "hi there$c" >foo1
2512 echo $n "hi there$c" >foo2
2513 if cmp foo1 foo2 >/dev/null 2>&1; then
2514 echo "They are compatible. In fact, they may be identical."
2515 else
2516 case "$n" in
2517 '-n') n='' c='\c';;
2518 *) n='-n' c='';;
2519 esac
2520 cat <<FOO
2521They are not compatible! You are probably running ksh on a non-USG system.
2522I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2523have echo built in and we may have to run some Bourne shell scripts. That
2524means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2525
2526FOO
2527 $echo $n "The star should be here-->$c"
2528 $echo "*"
2529 fi
2530 $rm -f foo1 foo2
2531 ;;
2532esac
2533
2f88d857
MB
2534# This question was auctioned at YAPC::Europe-2007 in Vienna
2535# I never promised you could answer it. I only auctioned the question.
2536cat <<FOO
2537The following message is sponsored by
2538
2539 Dresden.pm<--The stars should be here.
2540
2541Dear Perl user, system administrator or package
2542maintainer, the Perl community sends greetings to
2543you. Do you (emblematical) greet back [Y/n]? n
2544
2545FOO
2546
613d6c3e 2547: Check what type of C compiler we use
6b769f8f 2548cat <<EOS >trygcc
2573c5f9
JH
2549$startsh
2550EOS
6b769f8f 2551cat <<'EOSC' >>trygcc
2573c5f9
JH
2552case "$cc" in
2553'') ;;
2554*) $rm -f try try.*
2555 $cat >try.c <<EOM
2556int main(int argc, char *argv[]) {
2557 return 0;
2558}
2559EOM
e4778687 2560 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2561 :
2562 else
2563 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2564 despair=yes
2565 trygcc=yes
2566 case "$cc" in
2567 *gcc*) trygcc=no ;;
2568 esac
dce40316
AD
2569 # Skip this test because it gives a false match on output like:
2570 # ./trygcc: line 23: cc: command not found
2571 # case "`$cc -v -c try.c 2>&1`" in
2572 # *gcc*) trygcc=no ;;
2573 # esac
2573c5f9
JH
2574 if $test X"$trygcc" = Xyes; then
2575 if gcc -o try -c try.c; then
2576 echo " "
2577 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2578 # Switching compilers may undo the work of hints files.
2579 # The most common problem is -D_REENTRANT for threads.
2580 # This heuristic catches that case, but gets false positives
2581 # if -Dusethreads was not actually specified. Better to
2582 # bail out here with a useful message than fail
2583 # mysteriously later. Should we perhaps just try to
2584 # re-invoke Configure -Dcc=gcc config_args ?
2585 if $test -f usethreads.cbu; then
2586 $cat >&4 <<EOM
2587
2588*** However, any setting of the C compiler flags (e.g. for thread support)
2589*** will be lost. It may be necessary for you to restart Configure and
2590*** add -Dcc=gcc to your Configure command line.
2591
2592EOM
2593 rp="Would you like to go ahead and try gcc anyway?"
2594 dflt=n
2595 else
2596 rp="Would you like to use it?"
2597 dflt=y
2598 fi
2573c5f9
JH
2599 if $test -f myread; then
2600 . ./myread
2601 else
2602 if $test -f UU/myread; then
2603 . ./UU/myread
2604 else
2605 echo "Cannot find myread, sorry. Aborting." >&2
2606 exit 1
2607 fi
2608 fi
2609 case "$ans" in
6371411c 2610 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2611 esac
2612 fi
2613 fi
6b769f8f
RB
2614 fi
2615 $rm -f try try.*
2616 ;;
2617esac
2618EOSC
2619
2620cat <<EOS >checkcc
2621$startsh
2622EOS
2623cat <<'EOSC' >>checkcc
2624case "$cc" in
2625'') ;;
2626*) $rm -f try try.*
2627 $cat >try.c <<EOM
2628int main(int argc, char *argv[]) {
2629 return 0;
2630}
2631EOM
2632 if $cc -o try $ccflags $ldflags try.c; then
2633 :
2634 else
2573c5f9 2635 if $test X"$despair" = Xyes; then
6b769f8f
RB
2636 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2637 fi
2638 $cat >&4 <<EOM
5dd4fbdf
MB
2639You need to find a working C compiler.
2640Either (purchase and) install the C compiler supplied by your OS vendor,
2641or for a free C compiler try http://gcc.gnu.org/
2642I cannot continue any further, aborting.
2643EOM
6b769f8f 2644 exit 1
2573c5f9
JH
2645 fi
2646 $rm -f try try.*
2647 ;;
2648esac
2649EOSC
2650
a0d0e21e
LW
2651: determine whether symbolic links are supported
2652echo " "
2653$touch blurfl
2654if $ln -s blurfl sym > /dev/null 2>&1 ; then
2655 echo "Symbolic links are supported." >&4
818f00be 2656 lns="$ln -s"
a0d0e21e
LW
2657else
2658 echo "Symbolic links are NOT supported." >&4
2659 lns="$ln"
2660fi
2661$rm -f blurfl sym
2662
dafca956
JH
2663: determine whether symbolic links are supported
2664echo " "
2665case "$lns" in
18ea2752 2666*"ln"*" -s")
dafca956
JH
2667 echo "Checking how to test for symbolic links..." >&4
2668 $lns blurfl sym
4b661809 2669 if $test "X$issymlink" = X; then
2e2a97a6
JH
2670 case "$newsh" in
2671 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2672 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2673 esac
5d644a95
MB
2674 if test $? = 0; then
2675 issymlink="test -h"
2e2a97a6
JH
2676 else
2677 echo "Your builtin 'test -h' may be broken." >&4
2678 case "$test" in
2679 /*) ;;
2680 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2681 for p in $pth
2682 do
2683 if test -f "$p/$test"; then
2684 test="$p/$test"
2685 break
2686 fi
2687 done
2688 ;;
2689 esac
2690 case "$test" in
2691 /*)
2692 echo "Trying external '$test -h'." >&4
2693 issymlink="$test -h"
2694 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2695 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2696 issymlink=''
2697 fi
2698 ;;
2699 *) issymlink='' ;;
2700 esac
5d644a95
MB
2701 fi
2702 fi
4b661809 2703 if $test "X$issymlink" = X; then
dafca956 2704 if $test -L sym 2>/dev/null; then
5d644a95 2705 issymlink="$test -L"
2e2a97a6 2706 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2707 fi
2708 fi
4b661809 2709 if $test "X$issymlink" != X; then
5d644a95 2710 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2711 else
2712 echo "I do not know how you can test for symbolic links." >&4
2713 fi
2714 $rm -f blurfl sym
2715 ;;
2716*) echo "No symbolic links, so not testing for their testing..." >&4
2717 ;;
2718esac
2719echo " "
2720
34f1896b 2721: Make symlinks util
dafca956
JH
2722case "$mksymlinks" in
2723$define|true|[yY]*)
2724 case "$src" in
2725 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2726 exit 1
2727 ;;
4b661809 2728 *) case "$lns:$issymlink" in
f314eb9f 2729 *"ln"*" -s:"*"test -"?)
dafca956
JH
2730 echo "Creating the symbolic links..." >&4
2731 echo "(First creating the subdirectories...)" >&4
2732 cd ..
2733 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2734 read directory
2735 test -z "$directory" && break
2736 mkdir -p $directory
2737 done
2738 # Sanity check 1.
2739 if test ! -d t/base; then
2740 echo "Failed to create the subdirectories. Aborting." >&4
2741 exit 1
2742 fi
2743 echo "(Then creating the symlinks...)" >&4
2744 awk '{print $1}' $src/MANIFEST | while true; do
2745 read filename
2746 test -z "$filename" && break
2747 if test -f $filename; then
5d644a95 2748 if $issymlink $filename; then
dafca956
JH
2749 rm -f $filename
2750 fi
2751 fi
2752 if test -f $filename; then
2753 echo "$filename already exists, not symlinking."
2754 else
2755 ln -s $src/$filename $filename
2756 fi
2757 done
2758 # Sanity check 2.
a0d24b8a
JH
2759 if test ! -f t/base/lex.t; then
2760 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2761 exit 1
2762 fi
2763 cd UU
2764 ;;
2765 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2766 ;;
2767 esac
2768 ;;
2769 esac
2770 ;;
2771esac
2772
613d6c3e 2773: Check for Cross-Compilation
5440bc8e
JH
2774case "$usecrosscompile" in
2775$define|true|[yY]*)
93bc48fa 2776 $echo "Cross-compiling..."
5440bc8e
JH
2777 croak=''
2778 case "$cc" in
2779 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2780 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2781 ar=$targetarch-ar
2782 # leave out ld, choosing it is more complex
2783 nm=$targetarch-nm
2784 ranlib=$targetarch-ranlib
93bc48fa 2785 $echo 'extern int foo;' > try.c
f8006fac 2786 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2787 shift
2788 if $test $# -gt 0; then
2789 incpth="$incpth $*"
f8006fac
JH
2790 incpth="`$echo $incpth|$sed 's/^ //'`"
2791 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2792 for i in $*; do
f8006fac 2793 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2794 if $test -d $j; then
2795 libpth="$libpth $j"
2796 fi
2797 done
f8006fac
JH
2798 libpth="`$echo $libpth|$sed 's/^ //'`"
2799 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2800 fi
2801 $rm -f try.c
5440bc8e
JH
2802 ;;
2803 esac
2804 case "$targetarch" in
93bc48fa
JH
2805 '') echo "Targetarch not defined." >&4; croak=y ;;
2806 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2807 esac
2808 case "$incpth" in
93bc48fa 2809 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2810 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2811 esac
2812 case "$libpth" in
93bc48fa 2813 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2814 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2815 esac
93bc48fa
JH
2816 case "$usrinc" in
2817 '') for i in $incpth; do
2818 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2819 usrinc=$i
2820 echo "Guessing usrinc $usrinc." >&4
2821 break
2822 fi
2823 done
2824 case "$usrinc" in
2825 '') echo "Usrinc not defined." >&4; croak=y ;;
2826 esac
2827 ;;
2828 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2829 esac
93bc48fa
JH
2830 case "$targethost" in
2831 '') echo "Targethost not defined." >&4; croak=y ;;
2832 *) echo "Using targethost $targethost." >&4
5440bc8e 2833 esac
93bc48fa
JH
2834 locincpth=' '
2835 loclibpth=' '
5440bc8e 2836 case "$croak" in
93bc48fa 2837 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2838 esac
2839 case "$src" in
2840 /*) run=$src/Cross/run
93c0359c 2841 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2842 to=$src/Cross/to
2843 from=$src/Cross/from
2844 ;;
93bc48fa 2845 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2846 run=$pwd/Cross/run
f8006fac 2847 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2848 to=$pwd/Cross/to
2849 from=$pwd/Cross/from
2850 ;;
2851 esac
2852 case "$targetrun" in
2853 '') targetrun=ssh ;;
2854 esac
2855 case "$targetto" in
2856 '') targetto=scp ;;
2857 esac
2858 case "$targetfrom" in
2859 '') targetfrom=scp ;;
2860 esac
2861 run=$run-$targetrun
2862 to=$to-$targetto
2863 from=$from-$targetfrom
93bc48fa
JH
2864 case "$targetdir" in
2865 '') targetdir=/tmp
2866 echo "Guessing targetdir $targetdir." >&4
2867 ;;
2868 esac
5440bc8e 2869 case "$targetuser" in
93bc48fa
JH
2870 '') targetuser=root
2871 echo "Guessing targetuser $targetuser." >&4
2872 ;;
5440bc8e
JH
2873 esac
2874 case "$targetfrom" in
2875 scp) q=-q ;;
2876 *) q='' ;;
2877 esac
2878 case "$targetrun" in
2879 ssh|rsh)
2880 cat >$run <<EOF
2881#!/bin/sh
93c0359c
JH
2882case "\$1" in
2883-cwd)
2884 shift
2885 cwd=\$1
2886 shift
2887 ;;
2888esac
2889case "\$cwd" in
2890'') cwd=$targetdir ;;
2891esac
5440bc8e
JH
2892exe=\$1
2893shift
93c0359c
JH
2894if $test ! -f \$exe.xok; then
2895 $to \$exe
2896 $touch \$exe.xok
2897fi
2898$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2899EOF
2900 ;;
93bc48fa 2901 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2902 exit 1
2903 ;;
2904 esac
93c0359c
JH
2905 case "$targetmkdir" in
2906 */Cross/mkdir)
2907 cat >$targetmkdir <<EOF
2908#!/bin/sh
2909$targetrun -l $targetuser $targethost "mkdir -p \$@"
2910EOF
f8006fac 2911 $chmod a+rx $targetmkdir
93c0359c
JH
2912 ;;
2913 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2914 exit 1
2915 ;;
2916 esac
5440bc8e
JH
2917 case "$targetto" in
2918 scp|rcp)
2919 cat >$to <<EOF
2920#!/bin/sh
2921for f in \$@
2922do
93c0359c
JH
2923 case "\$f" in
2924 /*)
2925 $targetmkdir \`dirname \$f\`
2926 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2927 ;;
2928 *)
2929 $targetmkdir $targetdir/\`dirname \$f\`
2930 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2931 ;;
2932 esac
5440bc8e
JH
2933done
2934exit 0
2935EOF
2936 ;;
2937 cp) cat >$to <<EOF
2938#!/bin/sh
93c0359c
JH
2939for f in \$@
2940do
2941 case "\$f" in
2942 /*)
2943 $mkdir -p $targetdir/\`dirname \$f\`
2944 $cp \$f $targetdir/\$f || exit 1
2945 ;;
2946 *)
2947 $targetmkdir $targetdir/\`dirname \$f\`
2948 $cp \$f $targetdir/\$f || exit 1
2949 ;;
2950 esac
2951done
2952exit 0
5440bc8e
JH
2953EOF
2954 ;;
93bc48fa 2955 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2956 exit 1
2957 ;;
2958 esac
2959 case "$targetfrom" in
2960 scp|rcp)
2961 cat >$from <<EOF
2962#!/bin/sh
2963for f in \$@
2964do
93c0359c 2965 $rm -f \$f
5440bc8e
JH
2966 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2967done
2968exit 0
2969EOF
2970 ;;
2971 cp) cat >$from <<EOF
2972#!/bin/sh
2973for f in \$@
2974do
93c0359c 2975 $rm -f \$f
5440bc8e
JH
2976 cp $targetdir/\$f . || exit 1
2977done
2978exit 0
2979EOF
2980 ;;
93bc48fa 2981 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2982 exit 1
2983 ;;
2984 esac
93bc48fa
JH
2985 if $test ! -f $run; then
2986 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2987 else
f8006fac 2988 $chmod a+rx $run
5440bc8e 2989 fi
93bc48fa
JH
2990 if $test ! -f $to; then
2991 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2992 else
f8006fac 2993 $chmod a+rx $to
5440bc8e 2994 fi
93bc48fa
JH
2995 if $test ! -f $from; then
2996 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2997 else
f8006fac 2998 $chmod a+rx $from
5440bc8e 2999 fi
93bc48fa 3000 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
3001 exit 1
3002 fi
3003 cat >&4 <<EOF
f8006fac
JH
3004Using '$run' for remote execution,
3005and '$from' and '$to'
93bc48fa 3006for remote file transfer.
5440bc8e
JH
3007EOF
3008 ;;
3009*) run=''
3010 to=:
3011 from=:
3012 usecrosscompile='undef'
3013 targetarch=''
3014 ;;
3015esac
3016
ecfc5424
AD
3017: see whether [:lower:] and [:upper:] are supported character classes
3018echo " "
ecfc5424
AD
3019case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3020ABYZ)
3021 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3022 up='[:upper:]'
3023 low='[:lower:]'
3024 ;;
416d0bea
MB
3025*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3026 # (0xd9 and 0xe2), therefore that is a nice testing point.
3027 if test "X$up" = X -o "X$low" = X; then
3028 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3029 rs) up='[A-Z]'
3030 low='[a-z]'
28e8609d
JH
3031 ;;
3032 esac
416d0bea 3033 fi
28e8609d 3034 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3035 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3036 rs) up='A-Z'
28e8609d
JH
3037 low='a-z'
3038 ;;
3039 esac
416d0bea 3040 fi
28e8609d 3041 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3042 case "`echo RS | od -x 2>/dev/null`" in
3043 *D9E2*|*d9e2*)
28e8609d
JH
3044 echo "Hey, this might be EBCDIC." >&4
3045 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3046 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3047 rs) up='[A-IJ-RS-Z]'
3048 low='[a-ij-rs-z]'
28e8609d
JH
3049 ;;
3050 esac
3051 fi
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 ;;
3060 esac
3061 fi
3062esac
416d0bea
MB
3063case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3064rs)
28e8609d
JH
3065 echo "Using $up and $low to convert case." >&4
3066 ;;
ecfc5424 3067*)
28e8609d
JH
3068 echo "I don't know how to translate letters from upper to lower case." >&4
3069 echo "Your tr is not acting any way I know of." >&4
3070 exit 1
3071 ;;
ecfc5424
AD
3072esac
3073: set up the translation script tr, must be called with ./tr of course
3074cat >tr <<EOSC
3075$startsh
3076case "\$1\$2" in
3077'[A-Z][a-z]') exec $tr '$up' '$low';;
3078'[a-z][A-Z]') exec $tr '$low' '$up';;
3079esac
3080exec $tr "\$@"
3081EOSC
3082chmod +x tr
3083$eunicefix tr
3084
2304df62
AD
3085: Try to determine whether config.sh was made on this system
3086case "$config_sh" in
3087'')
43999f95
JH
3088myuname=`$uname -a 2>/dev/null`
3089$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3090# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3091# because the A-Z/a-z are not consecutive.
34e09935 3092myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3eaeeeae 3093 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3094newmyuname="$myuname"
2304df62 3095dflt=n
16d20bd9
AD
3096case "$knowitall" in
3097'')
3098 if test -f ../config.sh; then
3099 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3100 eval "`grep myuname= ../config.sh`"
3101 fi
3102 if test "X$myuname" = "X$newmyuname"; then
3103 dflt=y
3104 fi
2304df62 3105 fi
16d20bd9
AD
3106 ;;
3107*) dflt=y;;
3108esac
2304df62
AD
3109
3110: Get old answers from old config file if Configure was run on the
3111: same system, otherwise use the hints.
3112hint=default
3113cd ..
3114if test -f config.sh; then
16d20bd9
AD
3115 echo " "
3116 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3117 . UU/myread
3118 case "$ans" in
f83701cd
AD
3119 n*|N*) echo "OK, I'll ignore it."
3120 mv config.sh config.sh.old
3121 myuname="$newmyuname"
3122 ;;
2304df62 3123 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3124 tmp_n="$n"
3125 tmp_c="$c"
85cad39c 3126 tmp_sh="$sh"
2304df62
AD
3127 . ./config.sh
3128 cp config.sh UU
ecfc5424
AD
3129 n="$tmp_n"
3130 c="$tmp_c"
85cad39c 3131 : Older versions did not always set $sh. Catch re-use of such
3132 : an old config.sh.
3133 case "$sh" in
3134 '') sh="$tmp_sh" ;;
3135 esac
2304df62
AD
3136 hint=previous
3137 ;;
3138 esac
3139fi
2573c5f9 3140. ./UU/checkcc
2304df62
AD
3141if test ! -f config.sh; then
3142 $cat <<EOM
3143
4e2a5f63
AD
3144First time through, eh? I have some defaults handy for some systems
3145that need some extra help getting the Configure answers right:
2304df62
AD
3146
3147EOM
dfe9444c 3148 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3149 dflt=''
3150 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3151 : tests or hints, please send them to perlbug@perl.org
2304df62 3152 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3153 $test -f /irix && osname=irix
85e6fe83
LW
3154 $test -f /xenix && osname=sco_xenix
3155 $test -f /dynix && osname=dynix
3156 $test -f /dnix && osname=dnix
5f05dabc 3157 $test -f /lynx.os && osname=lynxos
3158 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3159 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3160 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3161 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3162 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3163 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3164 $test -d /usr/apollo/bin && osname=apollo
3165 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3166 $test -d /usr/include/minix && osname=minix
d54344fc 3167 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3168 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3169 osname=machten
4633a7c4 3170 if $test -x /sbin/version; then
dfe9444c 3171 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3172 $sed -e 's/[A-Za-z]$//'`
3173 elif $test -x /usr/etc/version; then
dfe9444c 3174 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3175 $sed -e 's/[A-Za-z]$//'`
3176 else
3177 osvers="$2.$3"
3178 fi
3179 fi
aaacdc8b
GS
3180
3181 $test -f /sys/posix.dll &&
3182 $test -f /usr/bin/what &&
3183 set X `/usr/bin/what /sys/posix.dll` &&
3184 $test "$3" = UWIN &&
3185 osname=uwin &&
3186 osvers="$5"
3187
2304df62
AD
3188 if $test -f $uname; then
3189 set X $myuname
3190 shift
3191
2304df62 3192 case "$5" in
85e6fe83 3193 fps*) osname=fps ;;
2304df62
AD
3194 mips*)
3195 case "$4" in
85e6fe83
LW
3196 umips) osname=umips ;;
3197 *) osname=mips ;;
2304df62 3198 esac;;
85e6fe83
LW
3199 [23]100) osname=mips ;;
3200 next*) osname=next ;;
ecfc5424 3201 i386*)
c6912327
JH
3202 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3203 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3204 osname='sco'
3205 osvers=$tmp
3206 elif $test -f /etc/kconfig; then
ecfc5424 3207 osname=isc
bd628c73 3208 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3209 osvers=4
3210 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3211 osvers=3
2304df62 3212 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3213 osvers=2
ecfc5424
AD
3214 fi
3215 fi
2000072c 3216 tmp=''
ecfc5424 3217 ;;
c4f23d77
AD
3218 pc*)
3219 if test -n "$DJGPP"; then
3220 osname=dos
3221 osvers=djgpp
3222 fi
3223 ;;
2304df62
AD
3224 esac
3225
3226 case "$1" in
a0d0e21e
LW
3227 aix) osname=aix
3228 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3229 case "$tmp" in
e81c5c2a
NC
3230 # oslevel can fail with:
3231 # oslevel: Unable to acquire lock.
3232 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3233 '<3240'|'<>3240') osvers=3.2.0 ;;
3234 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3235 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3236 *) osvers=$tmp;;
a0d0e21e
LW
3237 esac
3238 ;;
aaacdc8b
GS
3239 bsd386) osname=bsd386
3240 osvers=`$uname -r`
3241 ;;
3242 cygwin*) osname=cygwin
3243 osvers="$3"
3244 ;;
23f87696
SZ
3245 *dc.osx) osname=dcosx
3246 osvers="$3"
3247 ;;
a0d0e21e
LW
3248 dnix) osname=dnix
3249 osvers="$3"
3250 ;;
3251 domainos) osname=apollo
3252 osvers="$3"
3253 ;;
a774dfe6
RSG
3254 dgux) osname=dgux
3255 osvers="$3"
3256 ;;
3257 dragonfly) osname=dragonfly
a0d0e21e
LW
3258 osvers="$3"
3259 ;;
760ac839 3260 dynixptx*) osname=dynixptx
e58e581d 3261 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3262 ;;
a774dfe6 3263 freebsd) osname=freebsd
a0d0e21e 3264 osvers="$3" ;;
761ee4e8
BD
3265 genix) osname=genix ;;
3266 gnu) osname=gnu
3267 osvers="$3" ;;
a774dfe6 3268 hp*) osname=hpux
bfb7748a 3269 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3270 ;;
761ee4e8 3271 irix*) osname=irix
a0d0e21e
LW
3272 case "$3" in
3273 4*) osvers=4 ;;
3274 5*) osvers=5 ;;
ecfc5424 3275 *) osvers="$3" ;;
a0d0e21e
LW
3276 esac
3277 ;;
761ee4e8 3278 linux) osname=linux
a0d0e21e 3279 case "$3" in
a0d0e21e
LW
3280 *) osvers="$3" ;;
3281 esac
3282 ;;
761ee4e8 3283 MiNT) osname=mint
28e8609d
JH
3284 ;;
3285 netbsd*) osname=netbsd
ecfc5424
AD
3286 osvers="$3"
3287 ;;
4e81affe
MM
3288 news-os) osvers="$3"
3289 case "$3" in
3290 4*) osname=newsos4 ;;
3291 *) osname=newsos ;;
3292 esac
3293 ;;
aaacdc8b 3294 next*) osname=next ;;
28bb1e2c 3295 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3296 openbsd) osname=openbsd
3297 osvers="$3"
3298 ;;
5c728af0
IZ
3299 os2) osname=os2
3300 osvers="$4"
3301 ;;
aaacdc8b
GS
3302 POSIX-BC | posix-bc ) osname=posix-bc
3303 osvers="$3"
a0d0e21e 3304 ;;
ae3afa4e
TH
3305 powerux | power_ux | powermax_os | powermaxos | \
3306 powerunix | power_unix) osname=powerux
3307 osvers="$3"
3308 ;;
aaacdc8b
GS
3309 qnx) osname=qnx
3310 osvers="$4"
3311 ;;
a0d0e21e
LW
3312 solaris) osname=solaris
3313 case "$3" in
3314 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3315 *) osvers="$3" ;;
a0d0e21e
LW
3316 esac
3317 ;;
85e6fe83
LW
3318 sunos) osname=sunos
3319 case "$3" in
85e6fe83
LW
3320 5*) osname=solaris
3321 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3322 *) osvers="$3" ;;
2304df62
AD
3323 esac
3324 ;;
a0d0e21e 3325 titanos) osname=titanos
85e6fe83 3326 case "$3" in
a0d0e21e
LW
3327 1*) osvers=1 ;;
3328 2*) osvers=2 ;;
3329 3*) osvers=3 ;;
3330 4*) osvers=4 ;;
ecfc5424 3331 *) osvers="$3" ;;
2304df62
AD
3332 esac
3333 ;;
85e6fe83 3334 ultrix) osname=ultrix
ecfc5424 3335 osvers="$3"
2304df62 3336 ;;
28757baa 3337 osf1|mls+) case "$5" in
fed7345c
AD
3338 alpha)
3339 osname=dec_osf
fdd85a03 3340 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3341 case "$osvers" in
3342 [1-9].[0-9]*) ;;
3343 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3344 esac
ecfc5424
AD
3345 ;;
3346 hp*) osname=hp_osf1 ;;
3347 mips) osname=mips_osf1 ;;
85e6fe83
LW
3348 esac
3349 ;;
af1ff193 3350 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3351 openunix|unixware) osname=svr5
0337d152
BG
3352 osvers="$4"
3353 ;;
3c728e00 3354 uts) osname=uts
a0d0e21e
LW
3355 osvers="$3"
3356 ;;
3c728e00
JH
3357 vos) osvers="$3"
3358 ;;
85e6fe83 3359 $2) case "$osname" in
2304df62 3360 *isc*) ;;
a0d0e21e 3361 *freebsd*) ;;
5f05dabc 3362 svr*)
a0d0e21e 3363 : svr4.x or possibly later
a774dfe6 3364 case "svr$3" in
a0d0e21e
LW
3365 ${osname}*)
3366 osname=svr$3
3367 osvers=$4
3368 ;;
3369 esac
3370 case "$osname" in
3371 svr4.0)
3372 : Check for ESIX
3373 if test -f /stand/boot ; then
3374 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3375 if test -n "$INITPROG" -a -f "$INITPROG"; then
3376 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3377 if test -n "$isesix"; then
a0d0e21e
LW
3378 osname=esix4
3379 fi
3380 fi
3381 fi
3382 ;;
3383 esac
3384 ;;
2304df62 3385 *) if test -f /etc/systemid; then
a0d0e21e
LW
3386 osname=sco
3387 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3388 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3389 osvers=$1.$2.$3
c4f23d77 3390 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3391 osvers=$1.$2
c4f23d77 3392 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3393 osvers=$1
2304df62 3394 fi
a0d0e21e
LW
3395 else
3396 case "$osname" in
3397 '') : Still unknown. Probably a generic Sys V.
3398 osname="sysv"
3399 osvers="$3"
3400 ;;
3401 esac
2304df62
AD
3402 fi
3403 ;;
3404 esac
3405 ;;
a0d0e21e
LW
3406 *) case "$osname" in
3407 '') : Still unknown. Probably a generic BSD.
3408 osname="$1"
3409 osvers="$3"
3410 ;;
3411 esac
3412 ;;
2304df62
AD
3413 esac
3414 else
dfe9444c
AD
3415 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3416 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3417 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3418 osname=news_os
2304df62 3419 fi
dfe9444c 3420 $rm -f UU/kernel.what
5c728af0 3421 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3422 set X $myuname
3423 osname=os2
3424 osvers="$5"
2304df62
AD
3425 fi
3426 fi
a774dfe6 3427
5440bc8e
JH
3428 case "$targetarch" in
3429 '') ;;
3430 *) hostarch=$osname
3431 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3432 osvers=''
3433 ;;
3434 esac
3435
a0d0e21e
LW
3436 : Now look for a hint file osname_osvers, unless one has been
3437 : specified already.
3438 case "$hintfile" in
3439 ''|' ')
1e127011 3440 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3441 : Also try without trailing minor version numbers.
1e127011
DD
3442 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3443 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3444 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3445 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3446 case "$file" in
3447 '') dflt=none ;;
3448 *) case "$osvers" in
3449 '') dflt=$file
3450 ;;
dfe9444c 3451 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3452 dflt=$file
dfe9444c 3453 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3454 dflt=$xfile
dfe9444c 3455 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3456 dflt=$xxfile
dfe9444c 3457 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3458 dflt=$xxxfile
dfe9444c 3459 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3460 dflt=$xxxxfile
dfe9444c 3461 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3462 dflt="${osname}"
3463 else
3464 dflt=none
3465 fi
3466 ;;
3467 esac
85e6fe83
LW
3468 ;;
3469 esac
4e2a5f63
AD
3470 if $test -f Policy.sh ; then
3471 case "$dflt" in
3472 *Policy*) ;;
3473 none) dflt="Policy" ;;
3474 *) dflt="Policy $dflt" ;;
3475 esac
3476 fi
85e6fe83 3477 ;;
a0d0e21e 3478 *)
ecfc5424 3479 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3480 ;;
2304df62 3481 esac
1aef975c 3482
4e2a5f63
AD
3483 if $test -f Policy.sh ; then
3484 $cat <<EOM
3485
3486There's also a Policy hint file available, which should make the
3487site-specific (policy) questions easier to answer.
3488EOM
3489
3490 fi
3491
2304df62
AD
3492 $cat <<EOM
3493
3494You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3495If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3496previous run of Configure, you may specify it as well as or instead of
3497OS-specific hints. If hints are provided for your OS, you should use them:
3498although Perl can probably be built without hints on many platforms, using
3499hints often improve performance and may enable features that Configure can't
3500set up on its own. If there are no hints that match your OS, specify "none";
3501DO NOT give a wrong version or a wrong OS.
2304df62
AD
3502
3503EOM
4e2a5f63 3504
2304df62 3505 rp="Which of these apply, if any?"
dfe9444c 3506 . UU/myread
85e6fe83
LW
3507 tans=$ans
3508 for file in $tans; do
4e2a5f63
AD
3509 if $test X$file = XPolicy -a -f Policy.sh; then
3510 . Policy.sh
3511 $cat Policy.sh >> UU/config.sh
3512 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3513 . $src/hints/$file.sh
3514 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3515 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3516 : nothing
3517 else
85e6fe83
LW
3518 : Give one chance to correct a possible typo.
3519 echo "$file.sh does not exist"
3520 dflt=$file
3521 rp="hint to use instead?"
dfe9444c 3522 . UU/myread
85e6fe83 3523 for file in $ans; do
dfe9444c
AD
3524 if $test -f "$src/hints/$file.sh"; then
3525 . $src/hints/$file.sh
3526 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3527 elif $test X$ans = X -o X$ans = Xnone ; then
3528 : nothing
3529 else
3530 echo "$file.sh does not exist -- ignored."
3531 fi
3532 done
2304df62
AD
3533 fi
3534 done
85e6fe83 3535
2304df62 3536 hint=recommended
85e6fe83 3537 : Remember our hint file for later.
dfe9444c 3538 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3539 hintfile="$file"
85e6fe83 3540 else
a0d0e21e 3541 hintfile=''
85e6fe83 3542 fi
2304df62
AD
3543fi
3544cd UU
3545;;
3546*)
3547 echo " "
3548 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3549 tmp_n="$n"
3550 tmp_c="$c"
2304df62
AD
3551 cd ..
3552 cp $config_sh config.sh 2>/dev/null
a78b0d02 3553 chmod +w config.sh
2304df62
AD
3554 . ./config.sh
3555 cd UU
3556 cp ../config.sh .
ecfc5424
AD
3557 n="$tmp_n"
3558 c="$tmp_c"
2304df62
AD
3559 hint=previous
3560 ;;
3561esac
1aef975c 3562test "$override" && . ./optdef.sh
2304df62
AD
3563
3564: Restore computed paths
3565for file in $loclist $trylist; do
3566 eval $file="\$_$file"
3567done
3568
85e6fe83 3569cat << EOM
a0d0e21e 3570
85e6fe83 3571Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3572The default value is probably right if the name rings a bell. Otherwise,
3573since spelling matters for me, either accept the default or answer "none"
3574to leave it blank.
a0d0e21e 3575
85e6fe83 3576EOM
85e6fe83 3577case "$osname" in
a0d0e21e 3578 ''|' ')
85e6fe83 3579 case "$hintfile" in
a0d0e21e 3580 ''|' '|none) dflt=none ;;
ecfc5424 3581 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3582 esac
3583 ;;
3584 *) dflt="$osname" ;;
3585esac
3586rp="Operating system name?"
3587. ./myread
3588case "$ans" in
ecfc5424
AD
3589none) osname='' ;;
3590*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3591esac
8ff267be 3592echo " "
3593case "$osvers" in
3594 ''|' ')
3595 case "$hintfile" in
3596 ''|' '|none) dflt=none ;;
3597 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3598 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3599 case "$dflt" in
3600 ''|' ') dflt=none ;;
3601 esac
3602 ;;
3603 esac
3604 ;;
3605 *) dflt="$osvers" ;;
3606esac
3607rp="Operating system version?"
3608. ./myread
3609case "$ans" in
3610none) osvers='' ;;
3611*) osvers="$ans" ;;
3612esac
3613
02e93a22
JH
3614
3615. ./posthint.sh
3616
2304df62 3617: who configured the system
59b83a6f 3618cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3619case "$cf_by" in
3620"")
7c04078e 3621 cf_by=`(logname) 2>/dev/null`
dfe9444c 3622 case "$cf_by" in
7c04078e
GA
3623 "")
3624 cf_by=`(whoami) 2>/dev/null`
3625 case "$cf_by" in
3626 "") cf_by=unknown ;;
3627 esac ;;
8ff267be 3628 esac ;;
3629esac
2304df62 3630
f3f1a2d8
MB
3631: decide how portable to be. Allow command line overrides.
3632case "$d_portable" in
3633"$undef") ;;
3634*) d_portable="$define" ;;
b4eb6b3d 3635esac
b4eb6b3d 3636
f3f1a2d8
MB
3637: set up shell script to do ~ expansion
3638cat >filexp <<EOSS
3639$startsh
3640: expand filename
3641case "\$1" in
f16e9d76 3642 \~/*|\~)
f3f1a2d8
MB
3643 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3644 ;;
4137585d 3645 \~*)
f3f1a2d8
MB
3646 if $test -f /bin/csh; then
3647 /bin/csh -f -c "glob \$1"
3648 failed=\$?
3649 echo ""
3650 exit \$failed
3651 else
3652 name=\`$expr x\$1 : '..\([^/]*\)'\`
3653 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3654 if $test ! -d "\$dir"; then
3655 me=\`basename \$0\`
3656 echo "\$me: can't locate home directory for: \$name" >&2
3657 exit 1
3658 fi
3659 case "\$1" in
3660 */*)
3661 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3662 ;;
3663 *)
3664 echo \$dir
3665 ;;
3666 esac
3667 fi
3668 ;;
3669*)
3670 echo \$1
3671 ;;
b29b105d 3672esac
f3f1a2d8
MB
3673EOSS
3674chmod +x filexp
3675$eunicefix filexp
b29b105d 3676
f3f1a2d8
MB
3677: now set up to get a file name
3678cat <<EOS >getfile
3679$startsh
3680EOS
3681cat <<'EOSC' >>getfile
3682tilde=''
3683fullpath=''
3684already=''
3685skip=''
3686none_ok=''
3687exp_file=''
3688nopath_ok=''
3689orig_rp="$rp"
3690orig_dflt="$dflt"
3691case "$gfpth" in
3692'') gfpth='.' ;;
b29b105d 3693esac
b29b105d 3694
f3f1a2d8
MB
3695case "$fn" in
3696*\(*)
3697 : getfile will accept an answer from the comma-separated list
3698 : enclosed in parentheses even if it does not meet other criteria.
3699 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3700 fn=`echo $fn | sed 's/(.*)//'`
3701 ;;
b29b105d
JH
3702esac
3703
f3f1a2d8
MB
3704case "$fn" in
3705*:*)
3706 loc_file=`expr $fn : '.*:\(.*\)'`
3707 fn=`expr $fn : '\(.*\):.*'`
3708 ;;
b29b105d 3709esac
b29b105d 3710
f3f1a2d8
MB
3711case "$fn" in
3712*~*) tilde=true;;
3713esac
3714case "$fn" in
3715*/*) fullpath=true;;
3716esac
3717case "$fn" in
3718*+*) skip=true;;
3719esac
3720case "$fn" in
3721*n*) none_ok=true;;
3722esac
3723case "$fn" in
3724*e*) exp_file=true;;
3725esac
3726case "$fn" in
3727*p*) nopath_ok=true;;
b29b105d 3728esac
b29b105d 3729
f3f1a2d8
MB
3730case "$fn" in
3731*f*) type='File';;
3732*d*) type='Directory';;
3733*l*) type='Locate';;
3734esac
b29b105d 3735
f3f1a2d8
MB
3736what="$type"
3737case "$what" in
3738Locate) what='File';;
3739esac
b29b105d 3740
f3f1a2d8
MB
3741case "$exp_file" in
3742'')
3743 case "$d_portable" in
3744 "$define") ;;
3745 *) exp_file=true;;
b29b105d
JH
3746 esac
3747 ;;
3748esac
3749
f3f1a2d8
MB
3750cd ..
3751while test "$type"; do
3752 redo=''
3753 rp="$orig_rp"
3754 dflt="$orig_dflt"
3755 case "$tilde" in
3756 true) rp="$rp (~name ok)";;
3757 esac
3758 . UU/myread
3759 if test -f UU/getfile.ok && \
3760 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3761 then
3762 value="$ans"
3763 ansexp="$ans"
3764 break
3765 fi
3766 case "$ans" in
3767 none)
3768 value=''
3769 ansexp=''
3770 case "$none_ok" in
3771 true) type='';;
b29b105d
JH
3772 esac
3773 ;;
f3f1a2d8
MB
3774 *)
3775 case "$tilde" in
3776 '') value="$ans"
3777 ansexp="$ans";;
3778 *)
3779 value=`UU/filexp $ans`
3780 case $? in
3781 0)
3782 if test "$ans" != "$value"; then
3783 echo "(That expands to $value on this system.)"
3784 fi
3785 ;;
3786 *) value="$ans";;
3787 esac
3788 ansexp="$value"
3789 case "$exp_file" in
3790 '') value="$ans";;
3791 esac
3792 ;;
3793 esac
3794 case "$fullpath" in
3795 true)
3796 case "$ansexp" in
3797 /*) value="$ansexp" ;;
3798 [a-zA-Z]:/*) value="$ansexp" ;;
3799 *)
3800 redo=true
3801 case "$already" in
3802 true)
3803 echo "I shall only accept a full path name, as in /bin/ls." >&4
3804 echo "Use a ! shell escape if you wish to check pathnames." >&4
3805 ;;
3806 *)
3807 echo "Please give a full path name, starting with slash." >&4
3808 case "$tilde" in
3809 true)
3810 echo "Note that using ~name is ok provided it expands well." >&4
3811 already=true
3812 ;;
3813 esac
3814 esac
3815 ;;
3816 esac
3817 ;;
3818 esac
3819 case "$redo" in
3820 '')
3821 case "$type" in
3822 File)
3823 for fp in $gfpth; do
3824 if test "X$fp" = X.; then
3825 pf="$ansexp"
3826 else
3827 pf="$fp/$ansexp"
3828 fi
3829 if test -f "$pf"; then
3830 type=''
3831 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3832 then
3833 echo "($value is not a plain file, but that's ok.)"
3834 type=''
3835 fi
3836 if test X"$type" = X; then
3837 value="$pf"
3838 break
3839 fi
3840 done
3841 ;;
3842 Directory)
3843 for fp in $gfpth; do
3844 if test "X$fp" = X.; then
3845 dir="$ans"
3846 direxp="$ansexp"
3847 else
3848 dir="$fp/$ansexp"
3849 direxp="$fp/$ansexp"
3850 fi
3851 if test -d "$direxp"; then
3852 type=''
3853 value="$dir"
3854 break
3855 fi
3856 done
3857 ;;
3858 Locate)
3859 if test -d "$ansexp"; then
3860 echo "(Looking for $loc_file in directory $value.)"
3861 value="$value/$loc_file"
3862 ansexp="$ansexp/$loc_file"
3863 fi
3864 if test -f "$ansexp"; then
3865 type=''
3866 fi
3867 case "$nopath_ok" in
3868 true) case "$value" in
3869 */*) ;;
3870 *) echo "Assuming $value will be in people's path."
3871 type=''
3872 ;;
3873 esac
3874 ;;
3875 esac
3876 ;;
3877 esac
b4eb6b3d 3878
f3f1a2d8
MB
3879 case "$skip" in
3880 true) type='';
3881 esac
3882
3883 case "$type" in
3884 '') ;;
3885 *)
3886 if test "$fastread" = yes; then
3887 dflt=y
3888 else
3889 dflt=n
3890 fi
3891 rp="$what $value doesn't exist. Use that name anyway?"
3892 . UU/myread
3893 dflt=''
3894 case "$ans" in
3895 y*) type='';;
3896 *) echo " ";;
3897 esac
3898 ;;
3899 esac
3900 ;;
3901 esac
3902 ;;
b4eb6b3d 3903 esac
f3f1a2d8
MB
3904done
3905cd UU
3906ans="$value"
3907rp="$orig_rp"
3908dflt="$orig_dflt"
3909rm -f getfile.ok
3910test "X$gfpthkeep" != Xy && gfpth=""
3911EOSC
3912
3913: determine root of directory hierarchy where package will be installed.
3914case "$prefix" in
3915'')
3916 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3917 ;;
3918*?/)
3919 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3920 ;;
3921*)
f3f1a2d8 3922 dflt="$prefix"
b4eb6b3d
JH
3923 ;;
3924esac
f3f1a2d8 3925$cat <<EOM
b4eb6b3d 3926
f3f1a2d8
MB
3927By default, $package will be installed in $dflt/bin, manual pages
3928under $dflt/man, etc..., i.e. with $dflt as prefix for all
3929installation directories. Typically this is something like /usr/local.
3930If you wish to have binaries under /usr/bin but other parts of the
3931installation under /usr/local, that's ok: you will be prompted
3932separately for each of the installation directories, the prefix being
3933only used to set the defaults.
c915ce7f
JH
3934
3935EOM
f3f1a2d8
MB
3936fn=d~
3937rp='Installation prefix to use?'
3938. ./getfile
3939oldprefix=''
3940case "$prefix" in
3941'') ;;
3942*)
3943 case "$ans" in
3944 "$prefix") ;;
3945 *) oldprefix="$prefix";;
3946 esac
c915ce7f
JH
3947 ;;
3948esac
f3f1a2d8
MB
3949prefix="$ans"
3950prefixexp="$ansexp"
c915ce7f 3951
776a38e3 3952: allow them to override the AFS root
f3f1a2d8
MB
3953case "$afsroot" in
3954'') afsroot=/afs ;;
3955*) afsroot=$afsroot ;;
b4eb6b3d 3956esac
b4eb6b3d 3957
776a38e3 3958: is AFS running?
f3f1a2d8
MB
3959echo " "
3960case "$afs" in
3961$define|true) afs=true ;;
3962$undef|false) afs=false ;;
776a38e3 3963*) if $test -d $afsroot; then
f3f1a2d8
MB
3964 afs=true
3965 else
3966 afs=false
3967 fi
b4eb6b3d 3968 ;;
f3f1a2d8
MB
3969esac
3970if $afs; then
3971 echo "AFS may be running... I'll be extra cautious then..." >&4
3972else
3973 echo "AFS does not seem to be running..." >&4
9da7673b 3974fi
b4eb6b3d 3975
f3f1a2d8
MB
3976: determine installation prefix for where package is to be installed.
3977if $afs; then
3978$cat <<EOM
3979
3980Since you are running AFS, I need to distinguish the directory in which
3981files will reside from the directory in which they are installed (and from
3982which they are presumably copied to the former directory by occult means).
b4eb6b3d 3983
b4eb6b3d 3984EOM
f3f1a2d8
MB
3985 case "$installprefix" in
3986 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3987 *) dflt="$installprefix";;
3988 esac
3989else
3990$cat <<EOM
b4eb6b3d 3991
f3f1a2d8
MB
3992In some special cases, particularly when building $package for distribution,
3993it is convenient to distinguish the directory in which files should be
3994installed from the directory ($prefix) in which they will
3995eventually reside. For most users, these two directories are the same.
3996
3997EOM
3998 case "$installprefix" in
3999 '') dflt=$prefix ;;
4000 *) dflt=$installprefix;;
4001 esac
4002fi
4003fn=d~
4004rp='What installation prefix should I use for installing files?'
4005. ./getfile
4006installprefix="$ans"
4007installprefixexp="$ansexp"
4008
4009: Perform the prefixexp/installprefixexp correction if necessary
4010cat <<EOS >installprefix
4011$startsh
4012EOS
4013cat <<'EOSC' >>installprefix
4014: Change installation prefix, if necessary.
4015if $test X"$prefix" != X"$installprefix"; then
4016 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4017else
4018 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4019fi
4020EOSC
4021chmod +x installprefix
4022$eunicefix installprefix
4023
4024: Set variables such as privlib and privlibexp from the output of ./getfile
4025: performing the prefixexp/installprefixexp correction if necessary.
4026cat <<EOS >setprefixvar
4027$startsh
4028EOS
4029cat <<'EOSC' >>setprefixvar
4030eval "${prefixvar}=\"\$ans\""
4031eval "${prefixvar}exp=\"\$ansexp\""
4032. ./installprefix
4033EOSC
4034chmod +x setprefixvar
4035$eunicefix setprefixvar
4036
4037: set up the script used to warn in case of inconsistency
4038cat <<EOS >whoa
4039$startsh
4040EOS
4041cat <<'EOSC' >>whoa
4042dflt=y
dcb594bc
MB
4043case "$hint" in
4044 recommended)
4045 case "$hintfile" in
4046 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4047 ;;
4048 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4049 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4050 ;;
4051 esac
4052 ;;
4053 *) echo " "
4054 echo "*** WHOA THERE!!! ***" >&4
4055 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4056 ;;
4057esac
f3f1a2d8
MB
4058rp=" Keep the $hint value?"
4059. ./myread
4060case "$ans" in
4061y) td=$was; tu=$was;;
4062esac
4063EOSC
4064
216dac04 4065: function used to set '$1' to '$val'
f3f1a2d8
MB
4066setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4067case "$val$was" in
4068$define$undef) . ./whoa; eval "$var=\$td";;
4069$undef$define) . ./whoa; eval "$var=\$tu";;
4070*) eval "$var=$val";;
4071esac'
4072
34f1896b 4073: Check is we will use socks
f3f1a2d8
MB
4074case "$usesocks" in
4075$define|true|[yY]*) dflt='y';;
4076*) dflt='n';;
4077esac
4078cat <<EOM
4079
4080Perl can be built to use the SOCKS proxy protocol library. To do so,
4081Configure must be run with -Dusesocks. If you use SOCKS you also need
4082to use the PerlIO abstraction layer, this will be implicitly selected.
4083
4084If this doesn't make any sense to you, just accept the default '$dflt'.
4085EOM
4086rp='Build Perl for SOCKS?'
4087. ./myread
4088case "$ans" in
613d6c3e 4089y|Y) val="$define" ;;
f3f1a2d8
MB
4090*) val="$undef" ;;
4091esac
4092set usesocks
4093eval $setvar
4094
4095case "$usesocks" in
4096$define|true|[yY]*) useperlio="$define";;
4097esac
4098
34f1896b 4099: Check if we want perlio
f3f1a2d8
MB
4100case "$useperlio" in
4101$define|true|[yY]*|'') dflt='y';;
4102*) dflt='n';;
4103esac
4104cat <<EOM
4105
4106Previous version of $package used the standard IO mechanisms as
4107defined in <stdio.h>. Versions 5.003_02 and later of $package allow
4108alternate IO mechanisms via the PerlIO abstraction layer, but the
4109stdio mechanism is still available if needed. The abstraction layer
4110can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4111Using PerlIO with sfio may cause problems with some extension modules.
4112
4113If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 4114EOM
f3f1a2d8
MB
4115rp='Use the PerlIO abstraction layer?'
4116. ./myread
4117case "$ans" in
34f1896b 4118y|Y)
b4eb6b3d
JH
4119 val="$define"
4120 ;;
34f1896b 4121*)
f3f1a2d8
MB
4122 echo "Ok, doing things the stdio way."
4123 val="$undef"
4124 ;;
4125esac
4126set useperlio
34f1896b 4127eval $setvar
f3f1a2d8
MB
4128
4129case "$usesocks" in
4130$define|true|[yY]*)
4131 case "$useperlio" in
4132 $define|true|[yY]*) ;;
4133 *) cat >&4 <<EOM
4134
4135You are using the SOCKS proxy protocol library which means that you
4136should also use the PerlIO layer. You may be headed for trouble.
4137
4138EOM
4139 ;;
b4eb6b3d 4140 esac
f3f1a2d8
MB
4141 ;;
4142esac
4143
5c40187f
MB
4144: get the patchlevel
4145echo " "
4146echo "Getting the current patchlevel..." >&4
4147if $test -r $rsrc/patchlevel.h;then
4148 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4149 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4150 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4151 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4152 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4153 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4154 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4155else
4156 revision=0
4157 patchlevel=0
4158 subversion=0
4159 api_revision=0
4160 api_version=0
4161 api_subversion=0
4162 perl_patchlevel=0
4163 $echo "(You do not have patchlevel.h. Eek.)"
4164fi
5c40187f
MB
4165: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4166version_patchlevel_string="version $patchlevel subversion $subversion"
4167case "$perl_patchlevel" in
41680|'') ;;
0f04e85f
MB
4169*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4170 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4171 ;;
5c40187f
MB
4172esac
4173
4174$echo "(You have $package $version_patchlevel_string.)"
4175
4176case "$osname" in
4177dos|vms)
4178 : XXX Should be a Configure test for double-dots in filenames.
4179 version=`echo $revision $patchlevel $subversion | \
4180 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4181 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4182 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4183 ;;
4184*)
4185 version=`echo $revision $patchlevel $subversion | \
4186 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4187 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4188 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4189 ;;
4190esac
4191: Special case the 5.005_xx maintenance series, which used 5.005
4192: without any subversion label as a subdirectory in $sitelib
4193if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4194 api_versionstring='5.005'
4195fi
4196
613d6c3e 4197: Do we want threads support and if so, what type
f3f1a2d8
MB
4198case "$usethreads" in
4199$define|true|[yY]*) dflt='y';;
4200*) # Catch case where user specified ithreads or 5005threads but
4201 # forgot -Dusethreads (A.D. 4/2002)
4202 case "$useithreads$use5005threads" in
613d6c3e 4203 *$define*)
f3f1a2d8
MB
4204 case "$useperlio" in
4205 "$define") dflt='y' ;;
4206 *) dflt='n' ;;
4207 esac
4208 ;;
4209 *) dflt='n';;
4210 esac
4211 ;;
4212esac
4213cat <<EOM
4214
4215Perl can be built to take advantage of threads on some systems.
4216To do so, Configure can be run with -Dusethreads.
4217
4218Note that Perl built with threading support runs slightly slower
4219and uses more memory than plain Perl. The current implementation
4220is believed to be stable, but it is fairly new, and so should be
4221treated with caution.
4222
4223If this doesn't make any sense to you, just accept the default '$dflt'.
4224EOM
4225rp='Build a threading Perl?'
4226. ./myread
4227case "$ans" in
4228y|Y) val="$define" ;;
4229*) val="$undef" ;;
4230esac
4231set usethreads
4232eval $setvar
4233
5c40187f
MB
4234if $test $patchlevel -lt 9; then
4235 case "$usethreads" in
4236 $define)
f3f1a2d8
MB
4237 $cat <<EOM
4238
4239Since release 5.6, Perl has had two different threading implementations,
4240the newer interpreter-based version (ithreads) with one interpreter per
4241thread, and the older 5.005 version (5005threads).
4242The 5005threads version is effectively unmaintained and will probably be
4243removed in Perl 5.10, so there should be no need to build a Perl using it
4244unless needed for backwards compatibility with some existing 5.005threads
4245code.
4246
4247EOM
4248 : Default to ithreads unless overridden on command line or with
4249 : old config.sh
4250 dflt='y'
4251 case "$use5005threads" in
4252 $define|true|[yY]*) dflt='n';;
4253 esac
4254 case "$useithreads" in
4255 $undef|false|[nN]*) dflt='n';;
4256 esac
4257 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4258 . ./myread
4259 case "$ans" in
f3f1a2d8 4260 y|Y) val="$define" ;;
b4eb6b3d
JH
4261 *) val="$undef" ;;
4262 esac
f3f1a2d8
MB
4263 set useithreads
4264 eval $setvar
4265 : Now set use5005threads to the opposite value.
4266 case "$useithreads" in
4267 $define) val="$undef" ;;
4268 *) val="$define" ;;
4269 esac
4270 set use5005threads
4271 eval $setvar
4272 ;;
5c40187f 4273 *)
f3f1a2d8
MB
4274 useithreads="$undef"
4275 use5005threads="$undef"
b4eb6b3d 4276 ;;
5c40187f 4277 esac
b4eb6b3d 4278
5c40187f
MB
4279 case "$useithreads$use5005threads" in
4280 "$define$define")
f3f1a2d8 4281 $cat >&4 <<EOM
96056487 4282
f3f1a2d8
MB
4283You cannot have both the ithreads and the 5.005 threads enabled
4284at the same time. Disabling the 5.005 threads since they are
4285much less stable than the ithreads.
4286
4287EOM
4288 use5005threads="$undef"
96056487 4289 ;;
5c40187f
MB
4290 esac
4291
4292else
4293: perl-5.9.x and later
4294
47f9f84c 4295 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4296 case "$use5005threads" in
4297 $define|true|[yY]*)
4298 $cat >&4 <<EOM
47f9f84c
JH
4299
43005.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4301
47f9f84c 4302EOM
3f30fabf
MB
4303 ;;
4304 esac
47f9f84c 4305 fi
3f30fabf 4306
47f9f84c
JH
4307 use5005threads="$undef"
4308 useithreads="$usethreads"
5c40187f 4309fi
96056487 4310
f3f1a2d8
MB
4311if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4312 cat >&4 <<EOF
4313***
4314*** To build with ithreads you must also use the PerlIO layer.
4315*** Cannot continue, aborting.
4316***
4317EOF
4318 exit 1
4319fi
4320
4321case "$d_oldpthreads" in
4322'') : Configure tests would be welcome here. For now, assume undef.
4323 val="$undef" ;;
4324*) val="$d_oldpthreads" ;;
4325esac
4326set d_oldpthreads
4327eval $setvar
4328
4329
4330: Look for a hint-file generated 'call-back-unit'. If the
4331: user has specified that a threading perl is to be built,
4332: we may need to set or change some other defaults.
4333if $test -f usethreads.cbu; then
4334 echo "Your platform has some specific hints regarding threaded builds, using them..."
4335 . ./usethreads.cbu
4336else
4337 case "$usethreads" in
4338 "$define"|true|[yY]*)
4339 $cat <<EOM
4340(Your platform does not have any specific hints for threaded builds.
4341 Assuming POSIX threads, then.)
4342EOM
4343 ;;
4344 esac
4345fi
4346
34f1896b 4347: Check if multiplicity is required
f3f1a2d8
MB
4348cat <<EOM
4349
4350Perl can be built so that multiple Perl interpreters can coexist
4351within the same Perl executable.
4352EOM
4353
4354case "$useithreads" in
4355$define)
4356 cat <<EOM
4357This multiple interpreter support is required for interpreter-based threads.
4358EOM
4359 val="$define"
4360 ;;
4361*) case "$usemultiplicity" in
4362 $define|true|[yY]*) dflt='y';;
4363 *) dflt='n';;
4364 esac
4365 echo " "
4366 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4367 rp='Build Perl for multiplicity?'
4368 . ./myread
4369 case "$ans" in
4370 y|Y) val="$define" ;;
4371 *) val="$undef" ;;
4372 esac
4373 ;;
4374esac
4375set usemultiplicity
4376eval $setvar
4377
34f1896b 4378: Check if morebits is requested
f3f1a2d8
MB
4379case "$usemorebits" in
4380"$define"|true|[yY]*)
4381 use64bitint="$define"
4382 uselongdouble="$define"
4383 usemorebits="$define"
4384 ;;
4385*) usemorebits="$undef"
4386 ;;
4387esac
4388
776a38e3
MB
4389: Determine the C compiler to be used
4390echo " "
4391case "$cc" in
4392'') dflt=cc;;
4393*) dflt="$cc";;
4394esac
4395rp="Use which C compiler?"
4396. ./myread
4397cc="$ans"
4398
4399: See whether they have no cc but they do have gcc
4400. ./trygcc
4401if $test -f cc.cbu; then
4402 . ./cc.cbu
4403fi
4404. ./checkcc
4405
f3f1a2d8
MB
4406: make some quick guesses about what we are up against
4407echo " "
4408$echo $n "Hmm... $c"
4409echo exit 1 >bsd
4410echo exit 1 >usg
4411echo exit 1 >v7
4412echo exit 1 >osf1
4413echo exit 1 >eunice
4414echo exit 1 >xenix
4415echo exit 1 >venix
4416echo exit 1 >os2
4417d_bsd="$undef"
4418$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4419if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4420then
4421 echo "Looks kind of like an OSF/1 system, but we'll see..."
4422 echo exit 0 >osf1
381aa1ff 4423elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4424 xxx=`./loc addbib blurfl $pth`
4425 if $test -f $xxx; then
4426 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4427 echo exit 0 >bsd
4428 echo exit 0 >usg
4429 else
4430 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4431 echo "Looks kind of like an extended USG system, but we'll see..."
4432 else
4433 echo "Looks kind of like a USG system, but we'll see..."
4434 fi
4435 echo exit 0 >usg
4436 fi
4437elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4438 echo "Looks kind of like a BSD system, but we'll see..."
4439 d_bsd="$define"
4440 echo exit 0 >bsd
4441else
4442 echo "Looks kind of like a Version 7 system, but we'll see..."
4443 echo exit 0 >v7
4444fi
4445case "$eunicefix" in
4446*unixtovms*)
4447 $cat <<'EOI'
4448There is, however, a strange, musty smell in the air that reminds me of
4449something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4450EOI
4451 echo exit 0 >eunice
4452 d_eunice="$define"
4453: it so happens the Eunice I know will not run shell scripts in Unix format
4454 ;;
4455*)
4456 echo " "
4457 echo "Congratulations. You aren't running Eunice."
4458 d_eunice="$undef"
4459 ;;
4460esac
4461: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4462: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4463: semicolon as a patch separator
e5e20432
JH
4464case "$p_" in
4465:) ;;
4466*)
4467 $cat <<'EOI'
4468I have the feeling something is not exactly right, however...don't tell me...
4469lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4470(Or you may be running DOS with DJGPP.)
e5e20432
JH
4471EOI
4472 echo exit 0 >os2
4473 ;;
4474esac
4475if test -f /xenix; then
4476 echo "Actually, this looks more like a XENIX system..."
4477 echo exit 0 >xenix
4478 d_xenix="$define"
4479else
4480 echo " "
4481 echo "It's not Xenix..."
4482 d_xenix="$undef"
4483fi
4484chmod +x xenix
4485$eunicefix xenix
4486if test -f /venix; then
4487 echo "Actually, this looks more like a VENIX system..."
4488 echo exit 0 >venix
4489else
4490 echo " "
4491 if ./xenix; then
4492 : null
4493 else
4494 echo "Nor is it Venix..."
4495 fi
4496fi
4497chmod +x bsd usg v7 osf1 eunice xenix venix os2
4498$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4499$rm -f foo
4500
613d6c3e 4501: Check if we are using GNU gcc and what its version is
e5e20432
JH
4502echo " "
4503echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4504$cat >try.c <<EOM
e5e20432
JH
4505#include <stdio.h>
4506int main() {
7686528e 4507#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4508#ifdef __VERSION__
4509 printf("%s\n", __VERSION__);
4510#else
4511 printf("%s\n", "1");
4512#endif
4513#endif
073b6de5 4514 return(0);
e5e20432
JH
4515}
4516EOM
5440bc8e
JH
4517if $cc -o try $ccflags $ldflags try.c; then
4518 gccversion=`$run ./try`
f3f1a2d8
MB
4519 case "$gccversion" in
4520 '') echo "You are not using GNU cc." ;;
4521 *) echo "You are using GNU cc $gccversion."
4522 ccname=gcc
4523 ;;
4524 esac
4525else
4526 echo " "
4527 echo "*** WHOA THERE!!! ***" >&4
4528 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4529 case "$knowitall" in
4530 '')
4531 echo " You'd better start hunting for one and let me know about it." >&4
4532 exit 1
2304df62
AD
4533 ;;
4534 esac
f3f1a2d8
MB
4535fi
4536$rm -f try try.*
4537case "$gccversion" in
45381*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4539esac
4540case "$gccversion" in
4541'') gccosandvers='' ;;
4542*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4543 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4544 gccshortvers=''
4545 case "$gccosandvers" in
4546 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4547 $osname$osvers) ;; # looking good
4548 $osname*) cat <<EOM >&4
4549
4550*** WHOA THERE!!! ***
4551
4552 Your gcc has not been compiled for the exact release of
4553 your operating system ($gccosandvers versus $osname$osvers).
4554
4555 In general it is a good idea to keep gcc synchronized with
4556 the operating system because otherwise serious problems
4557 may ensue when trying to compile software, like Perl.
4558
4559 I'm trying to be optimistic here, though, and will continue.
4560 If later during the configuration and build icky compilation
4561 problems appear (headerfile conflicts being the most common
4562 manifestation), I suggest reinstalling the gcc to match
4563 your operating system release.
4564
4565EOM
4566 ;;
4567 *) gccosandvers='' ;; # failed to parse, better be silent
4568 esac
4569 ;;
4570esac
4571case "$ccname" in
4572'') ccname="$cc" ;;
4573esac
4574
4575# gcc 3.* complain about adding -Idirectories that they already know about,
4576# so we will take those off from locincpth.
4577case "$gccversion" in
45783*)
4579 echo "main(){}">try.c
4580 for incdir in $locincpth; do
4581 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4582 grep '^c[cp]p*[01]: warning: changing search order '`
4583 if test "X$warn" != X; then
4584 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4585 fi
4586 done
4587 $rm -f try try.*
4588esac
2304df62 4589
bd9b35c9
JH
4590: What should the include directory be ?
4591echo " "
4592$echo $n "Hmm... $c"
4593dflt='/usr/include'
4594incpath=''
4595mips_type=''
4596if $test -f /bin/mips && /bin/mips; then
4597 echo "Looks like a MIPS system..."
4598 $cat >usr.c <<'EOCP'
4599#ifdef SYSTYPE_BSD43
4600/bsd43
4601#endif
4602EOCP
8a27cf78 4603 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4604 dflt='/bsd43/usr/include'
4605 incpath='/bsd43'
4606 mips_type='BSD 4.3'
4607 else
4608 mips_type='System V'
4609 fi
4610 $rm -f usr.c usr.out
4611 echo "and you're compiling with the $mips_type compiler and libraries."
4612 xxx_prompt=y
4613 echo "exit 0" >mips
4614else
4615 echo "Doesn't look like a MIPS system."
4616 xxx_prompt=n
4617 echo "exit 1" >mips
4618fi
4619chmod +x mips
4620$eunicefix mips
4621case "$usrinc" in
4622'') ;;
4623*) dflt="$usrinc";;
4624esac
4625case "$xxx_prompt" in
4626y) fn=d/
4627 echo " "
4628 rp='Where are the include files you want to use?'
4629 . ./getfile
4630 usrinc="$ans"
8e07c86e 4631 ;;
bd9b35c9 4632*) usrinc="$dflt"
8e07c86e
AD
4633 ;;
4634esac
2304df62 4635
96056487
JH
4636: see how we invoke the C preprocessor
4637echo " "
4638echo "Now, how can we feed standard input to your C preprocessor..." >&4
4639cat <<'EOT' >testcpp.c
4640#define ABC abc
4641#define XYZ xyz
4642ABC.XYZ
4643EOT
4644cd ..
4645if test ! -f cppstdin; then
4646 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4647 # AIX cc -E doesn't show the absolute headerfile
4648 # locations but we'll cheat by using the -M flag.
4649 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
4650 else
4651 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4652 fi
4653else
4654 echo "Keeping your $hint cppstdin wrapper."
4655fi
4656chmod 755 cppstdin
4657wrapper=`pwd`/cppstdin
4658ok='false'
4659cd UU
4660
4661if $test "X$cppstdin" != "X" && \
4662 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4663 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4664then
4665 echo "You used to use $cppstdin $cppminus so we'll use that again."
4666 case "$cpprun" in
4667 '') echo "But let's see if we can live without a wrapper..." ;;
4668 *)
4669 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4670 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4671 then
4672 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4673 ok='true'
4674 else
4675 echo "(However, $cpprun $cpplast does not work, let's see...)"
4676 fi
4677 ;;
4678 esac
4679else
4680 case "$cppstdin" in
4681 '') ;;
4682 *)
4683 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4684 ;;
4685 esac
4686fi
4687
4688if $ok; then
4689 : nothing
4690elif echo 'Maybe "'"$cc"' -E" will work...'; \
4691 $cc -E <testcpp.c >testcpp.out 2>&1; \
4692 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4693 echo "Yup, it does."
4694 x_cpp="$cc -E"
4695 x_minus='';
4696elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4697 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4698 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4699 echo "Yup, it does."
4700 x_cpp="$cc -E"
4701 x_minus='-';
4702elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4703 $cc -P <testcpp.c >testcpp.out 2>&1; \
4704 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4705 echo "Yipee, that works!"
4706 x_cpp="$cc -P"
4707 x_minus='';
4708elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4709 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4710 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4711 echo "At long last!"
4712 x_cpp="$cc -P"
4713 x_minus='-';
4714elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4715 $cpp <testcpp.c >testcpp.out 2>&1; \
4716 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4717 echo "It works!"
4718 x_cpp="$cpp"
4719 x_minus='';
4720elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4721 $cpp - <testcpp.c >testcpp.out 2>&1; \
4722 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4723 echo "Hooray, it works! I was beginning to wonder."
4724 x_cpp="$cpp"
4725 x_minus='-';
4726elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4727 $wrapper <testcpp.c >testcpp.out 2>&1; \
4728 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4729 x_cpp="$wrapper"
4730 x_minus=''
4731 echo "Eureka!"
4732else
4733 dflt=''
4734 rp="No dice. I can't find a C preprocessor. Name one:"
4735 . ./myread
4736 x_cpp="$ans"
4737 x_minus=''
4738 $x_cpp <testcpp.c >testcpp.out 2>&1
4739 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4740 echo "OK, that will do." >&4
4741 else
4742echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4743 exit 1
4744 fi
4745fi
4746
4747case "$ok" in
4748false)
4749 cppstdin="$x_cpp"
4750 cppminus="$x_minus"
4751 cpprun="$x_cpp"
4752 cpplast="$x_minus"
4753 set X $x_cpp
4754 shift
4755 case "$1" in
4756 "$cpp")
4757 echo "Perhaps can we force $cc -E using a wrapper..."
4758 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4759 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4760 then
4761 echo "Yup, we can."
4762 cppstdin="$wrapper"
4763 cppminus='';
4764 else
4765 echo "Nope, we'll have to live without it..."
4766 fi
4767 ;;
4768 esac
4769 case "$cpprun" in
4770 "$wrapper")
4771 cpprun=''
4772 cpplast=''
4773 ;;
4774 esac
4775 ;;
4776esac
4777
4778case "$cppstdin" in
4779"$wrapper"|'cppstdin') ;;
4780*) $rm -f $wrapper;;
4781esac
4782$rm -f testcpp.c testcpp.out
4783
bd9b35c9
JH
4784: Set private lib path
4785case "$plibpth" in
4786'') if ./mips; then
4787 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4788 fi;;
4789esac
4790case "$libpth" in
4791' ') dlist='';;
4792'') dlist="$loclibpth $plibpth $glibpth";;
4793*) dlist="$libpth";;
4794esac
4795
4796: Now check and see which directories actually exist, avoiding duplicates
4797libpth=''
4798for xxx in $dlist
4799do
4800 if $test -d $xxx; then
4801 case " $libpth " in
4802 *" $xxx "*) ;;
4803 *) libpth="$libpth $xxx";;
4804 esac
4805 fi
4806done
4807$cat <<'EOM'
4808
4809Some systems have incompatible or broken versions of libraries. Among
4810the directories listed in the question below, please remove any you
4811know not to be holding relevant libraries, and add any that are needed.
4812Say "none" for none.
8e07c86e
AD
4813
4814EOM
bd9b35c9
JH
4815case "$libpth" in
4816'') dflt='none';;
8e07c86e 4817*)
bd9b35c9
JH
4818 set X $libpth
4819 shift
4820 dflt=${1+"$@"}
8e07c86e 4821 ;;
a0d0e21e 4822esac
bd9b35c9
JH
4823rp="Directories to use for library searches?"
4824. ./myread
4825case "$ans" in
4826none) libpth=' ';;
4827*) libpth="$ans";;
4828esac
a0d0e21e 4829
bd9b35c9
JH
4830: compute shared library extension
4831case "$so" in
4832'')
4833 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4834 dflt='sl'
dd4e71fd 4835 else
bd9b35c9 4836 dflt='so'
dd4e71fd
JH
4837 fi
4838 ;;
bd9b35c9 4839*) dflt="$so";;
dd4e71fd 4840esac
dd4e71fd
JH
4841$cat <<EOM
4842
bd9b35c9 4843On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4844you want to suppress searching of shared libraries for the remainder
bd9b35c9 4845of this configuration.
dd4e71fd
JH
4846
4847EOM
bd9b35c9
JH
4848rp='What is the file extension used for shared libraries?'
4849. ./myread
4850so="$ans"
dd4e71fd 4851
bd9b35c9
JH
4852: Define several unixisms.
4853: Hints files or command line option can be used to override them.
4854: The convoluted testing is in case hints files set either the old
4855: or the new name.
4856case "$_exe" in
4857'') case "$exe_ext" in
1fef16b3 4858 '') ;;
bd9b35c9 4859 *) _exe="$exe_ext" ;;
dd4e71fd 4860 esac
bd9b35c9 4861 ;;
bfb7748a 4862esac
bd9b35c9
JH
4863case "$_a" in
4864'') case "$lib_ext" in
4865 '') _a='.a';;
4866 *) _a="$lib_ext" ;;
dd4e71fd
JH
4867 esac
4868 ;;
dd4e71fd 4869esac
bd9b35c9
JH
4870case "$_o" in
4871'') case "$obj_ext" in
4872 '') _o='.o';;
4873 *) _o="$obj_ext";;
4874 esac
4875 ;;
4876esac
4877case "$p_" in
4878'') case "$path_sep" in
4879 '') p_=':';;
4880 *) p_="$path_sep";;
4881 esac
4882 ;;
4883esac
4884exe_ext=$_exe
4885lib_ext=$_a
4886obj_ext=$_o
4887path_sep=$p_
dd4e71fd 4888
5b813a60
MB
4889rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4890
b4eb6b3d
JH
4891: Which makefile gets called first. This is used by make depend.
4892case "$firstmakefile" in
4893'') firstmakefile='makefile';;
4633a7c4 4894esac
4633a7c4 4895
34f1896b 4896: Check for uselongdouble support
1f603089
JH
4897case "$ccflags" in
4898*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4899esac
4900
4901case "$uselongdouble" in
4902$define|true|[yY]*) dflt='y';;
4903*) dflt='n';;
4904esac
4905cat <<EOM
4906
4907Perl can be built to take advantage of long doubles which
4908(if available) may give more accuracy and range for floating point numbers.
4909
4910If this doesn't make any sense to you, just accept the default '$dflt'.
4911EOM
4912rp='Try to use long doubles if available?'
4913. ./myread
4914case "$ans" in
4915y|Y) val="$define" ;;
4916*) val="$undef" ;;
4917esac
4918set uselongdouble
4919eval $setvar
4920
4921case "$uselongdouble" in
4922true|[yY]*) uselongdouble="$define" ;;
4923esac
4924
1f603089
JH
4925: Look for a hint-file generated 'call-back-unit'. If the
4926: user has specified that long doubles should be used,
4927: we may need to set or change some other defaults.
9da7673b
MB
4928if $test -f uselongdouble.cbu; then
4929 echo "Your platform has some specific hints regarding long doubles, using them..."
4930 . ./uselongdouble.cbu
4931else
4932 case "$uselongdouble" in
4933 $define)
1f603089 4934 $cat <<EOM
9da7673b 4935(Your platform does not have any specific hints for long doubles.)
1f603089 4936EOM
1f603089 4937 ;;
9da7673b
MB
4938 esac
4939fi
1f603089 4940
bd9b35c9
JH
4941: Looking for optional libraries
4942echo " "
4943echo "Checking for optional libraries..." >&4
4944case "$libs" in
4945' '|'') dflt='';;
4946*) dflt="$libs";;
4947esac
4948case "$libswanted" in
4949'') libswanted='c_s';;
4950esac
4951case "$usesocks" in
923fc586 4952"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4953esac
68435ea7
JH
4954libsfound=''
4955libsfiles=''
4956libsdirs=''
13b3f787
JH
4957libspath=''
4958for thisdir in $libpth $xlibpth; do
4959 test -d $thisdir && libspath="$libspath $thisdir"
4960done
bd9b35c9 4961for thislib in $libswanted; do
13b3f787 4962 for thisdir in $libspath; do
f7dd4e7f
JH
4963 xxx=''
4964 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4965 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4966 $test -f "$xxx" && eval $libscheck
4967 $test -f "$xxx" && libstyle=shared
4968 fi
4969 if test ! -f "$xxx"; then
4970 xxx=$thisdir/lib$thislib.$so
4971 $test -f "$xxx" && eval $libscheck
4972 $test -f "$xxx" && libstyle=shared
613d6c3e 4973 fi
f7dd4e7f
JH
4974 if test ! -f "$xxx"; then
4975 xxx=$thisdir/lib$thislib$_a
4976 $test -f "$xxx" && eval $libscheck
4977 $test -f "$xxx" && libstyle=static
4978 fi
4979 if test ! -f "$xxx"; then
4980 xxx=$thisdir/$thislib$_a
4981 $test -f "$xxx" && eval $libscheck
4982 $test -f "$xxx" && libstyle=static
4983 fi
4984 if test ! -f "$xxx"; then
4985 xxx=$thisdir/lib${thislib}_s$_a
4986 $test -f "$xxx" && eval $libscheck
4987 $test -f "$xxx" && libstyle=static
09ea5ba9 4988 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4989 fi
4990 if test ! -f "$xxx"; then
4991 xxx=$thisdir/Slib$thislib$_a
4992 $test -f "$xxx" && eval $libscheck
4993 $test -f "$xxx" && libstyle=static
4994 fi
4995 if $test -f "$xxx"; then
43999f95 4996 case "$libstyle" in
f7dd4e7f
JH
4997 shared) echo "Found -l$thislib (shared)." ;;
4998 static) echo "Found -l$thislib." ;;
4999 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 5000 esac
bd9b35c9
JH
5001 case " $dflt " in
5002 *"-l$thislib "*);;
f7dd4e7f 5003 *) dflt="$dflt -l$thislib"
43999f95
JH
5004 libsfound="$libsfound $xxx"
5005 yyy=`basename $xxx`
5006 libsfiles="$libsfiles $yyy"
1e127011 5007 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
5008 case " $libsdirs " in
5009 *" $yyy "*) ;;
5010 *) libsdirs="$libsdirs $yyy" ;;
5011 esac
5012 ;;
bd9b35c9 5013 esac
f7dd4e7f 5014 break
613d6c3e 5015 fi
f7dd4e7f
JH
5016 done
5017 if $test ! -f "$xxx"; then
5018 echo "No -l$thislib."
bd9b35c9
JH
5019 fi
5020done
5021set X $dflt
5022shift
5023dflt="$*"
5024case "$libs" in
5025'') dflt="$dflt";;
5026*) dflt="$libs";;
5027esac
5028case "$dflt" in
5029' '|'') dflt='none';;
5030esac
4633a7c4 5031
bd9b35c9 5032$cat <<EOM
4633a7c4 5033
bd9b35c9
JH
5034In order to compile $package on your machine, a number of libraries
5035are usually needed. Include any other special libraries here as well.
5036Say "none" for none. The default list is almost always right.
8e07c86e 5037EOM
8e07c86e 5038
bd9b35c9
JH
5039echo " "
5040rp="What libraries to use?"
5041. ./myread
5042case "$ans" in
5043none) libs=' ';;
5044*) libs="$ans";;
5045esac
d71b2b6b 5046
bd9b35c9
JH
5047: determine optimization, if desired, or use for debug flag also
5048case "$optimize" in
5049' '|$undef) dflt='none';;
5050'') dflt='-O';;
5051*) dflt="$optimize";;
5052esac
5053$cat <<EOH
d71b2b6b 5054
bd9b35c9
JH
5055By default, $package compiles with the -O flag to use the optimizer.
5056Alternately, you might want to use the symbolic debugger, which uses
5057the -g flag (on traditional Unix systems). Either flag can be
5058specified here. To use neither flag, specify the word "none".
d71b2b6b 5059
bd9b35c9
JH
5060EOH
5061rp="What optimizer/debugger flag should be used?"
5062. ./myread
5063optimize="$ans"
5064case "$optimize" in
5065'none') optimize=" ";;
5066esac
5067
eaf812ae
MB
5068: Check what DEBUGGING is required from the command line
5069: -DEBUGGING or -DDEBUGGING or
5070: -DEBUGGING=both = -g + -DDEBUGGING
5071: -DEBUGGING=-g or -Doptimize=-g = -g
5072: -DEBUGGING=none or -UDEBUGGING =
5073: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5074case "$EBUGGING" in
5075'') ;;
5076*) DEBUGGING=$EBUGGING ;;
5077esac
5078
5079case "$DEBUGGING" in
5a7c70d6 5080-g|both|$define)
eaf812ae
MB
5081 case "$optimize" in
5082 *-g*) ;;
5083 *) optimize="$optimize -g" ;;
5084 esac ;;
5085none|$undef)
5086 case "$optimize" in
5087 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5088 shift
5089 optimize="$*"
5090 ;;
5091 esac ;;
5092esac
5093
bd9b35c9 5094dflt=''
eaf812ae
MB
5095case "$DEBUGGING" in
5096both|$define) dflt='-DDEBUGGING'
5097esac
5098
c34316b3
NC
5099: argument order is deliberate, as the flag will start with - which set could
5100: think is an option
6682be1c 5101checkccflag='check=$1; flag=$2; callback=$3;
c34316b3
NC
5102echo " ";
5103echo "Checking if your compiler accepts $flag" 2>&1;
5104echo "int main(void) { return 0; }" > gcctest.c;
04b62921 5105if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
c34316b3 5106 echo "Yes, it does." 2>&1;
580e570e 5107 if $test -s gcctest.out ; then
04b62921
MB
5108 echo "But your platform does not like it:";
5109 cat gcctest.out;
5110 else
5111 case "$ccflags" in
5112 *$check*)
5113 echo "Leaving current flags $ccflags alone." 2>&1
5114 ;;
5115 *) dflt="$dflt $flag";
5116 eval $callback
5117 ;;
5118 esac
5119 fi
c34316b3
NC
5120else
5121 echo "Nope, it does not, but that is ok." 2>&1;
5122fi
5123'
5124
bd9b35c9
JH
5125: We will not override a previous value, but we might want to
5126: augment a hint file
5127case "$hint" in
5128default|recommended)
5129 case "$gccversion" in
eaf812ae 5130 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5131 esac
eaf812ae
MB
5132 case "$optimize:$DEBUGGING" in
5133 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5134 esac
bd9b35c9 5135 case "$gccversion" in
580e570e 5136 2*) if $test -d /etc/conf/kconfig.d &&
bd9b35c9
JH
5137 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5138 then
00e89ad4 5139 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5140 dflt="$dflt -posix"
5141 fi
f0d04425 5142 ;;
bd9b35c9
JH
5143 esac
5144 case "$gccversion" in
5145 1*) ;;
5146 2.[0-8]*) ;;
c0bacbef 5147 ?*) set strict-aliasing -fno-strict-aliasing
c34316b3 5148 eval $checkccflag
f0d04425 5149 ;;
e5e20432 5150 esac
00e89ad4
AD
5151 # For gcc, adding -pipe speeds up compilations for some, but apparently
5152 # some assemblers can't read from stdin. (It also slows down compilations
5153 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5154 case "$gccversion" in
c34316b3
NC
5155 ?*) set pipe -pipe
5156 eval $checkccflag
00e89ad4
AD
5157 ;;
5158 esac
6682be1c
NC
5159
5160 # on x86_64 (at least) we require an extra library (libssp) in the
5161 # link command line. This library is not named, so I infer that it is
5162 # an implementation detail that may change. Hence the safest approach
5163 # is to add the flag to the flags passed to the compiler at link time,
5164 # as that way the compiler can do the right implementation dependant
5165 # thing. (NWC)
5166 case "$gccversion" in
8f68b0e6 5167 ?*) set stack-protector -fstack-protector
6682be1c
NC
5168 eval $checkccflag
5169 ;;
5170 esac
e5e20432
JH
5171 ;;
5172esac
5173
bd9b35c9
JH
5174case "$mips_type" in
5175*BSD*|'') inclwanted="$locincpth $usrinc";;
5176*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5177esac
5178for thisincl in $inclwanted; do
5179 if $test -d $thisincl; then
5180 if $test x$thisincl != x$usrinc; then
5181 case "$dflt" in
00e89ad4
AD
5182 *" -I$thisincl "*);;
5183 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5184 esac
5185 fi
5186 fi
5187done
40a7a20a 5188
bd9b35c9
JH
5189inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5190 xxx=true;
5191elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5192 xxx=true;
5193else
5194 xxx=false;
5195fi;
5196if $xxx; then
5197 case "$dflt" in
5198 *$2*);;
5199 *) dflt="$dflt -D$2";;
5200 esac;
5201fi'
40a7a20a 5202
bd9b35c9 5203set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5204
bd9b35c9
JH
5205case "$usesocks" in
5206$define)
5207 ccflags="$ccflags -DSOCKS"
5208 ;;
5209esac
40a7a20a 5210
bd9b35c9
JH
5211case "$hint" in
5212default|recommended) dflt="$ccflags $dflt" ;;
5213*) dflt="$ccflags";;
5214esac
40a7a20a 5215
bd9b35c9
JH
5216case "$dflt" in
5217''|' ') dflt=none;;
5218esac
422af00a 5219
bd9b35c9 5220$cat <<EOH
40a7a20a 5221
bd9b35c9
JH
5222Your C compiler may want other flags. For this question you should include
5223-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5224but you should NOT include libraries or ld flags like -lwhatever. If you
5225want $package to honor its debug switch, you should include -DDEBUGGING here.
5226Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5227
bd9b35c9 5228To use no flags, specify the word "none".
40a7a20a 5229
bd9b35c9
JH
5230EOH
5231set X $dflt
5232shift
5233dflt=${1+"$@"}
5234rp="Any additional cc flags?"
5235. ./myread
5236case "$ans" in
5237none) ccflags='';;
5238*) ccflags="$ans";;
5239esac
8e07c86e 5240
bd9b35c9 5241: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5242case "$cppflags" in
5243'') cppflags="$ccflags" ;;
5244*) cppflags="$cppflags $ccflags" ;;
5245esac
bd9b35c9
JH
5246case "$gccversion" in
52471*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5248esac
bd9b35c9
JH
5249case "$mips_type" in
5250'');;
5251*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5252esac
5253case "$cppflags" in
5254'');;
5255*)
5256 echo " "
5257 echo "Let me guess what the preprocessor flags are..." >&4
5258 set X $cppflags
5259 shift
5260 cppflags=''
5261 $cat >cpp.c <<'EOM'
5262#define BLURFL foo
8e07c86e 5263
bd9b35c9
JH
5264BLURFL xx LFRULB
5265EOM
5266 previous=''
5267 for flag in $*
5268 do
5269 case "$flag" in
5270 -*) ftry="$flag";;
5271 *) ftry="$previous $flag";;
5272 esac
5273 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5274 >cpp1.out 2>/dev/null && \
5275 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5276 >cpp2.out 2>/dev/null && \
5277 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5278 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5279 then
5280 cppflags="$cppflags $ftry"
5281 previous=''
5282 else
5283 previous="$flag"
5284 fi
5285 done
5286 set X $cppflags
5287 shift
5288 cppflags=${1+"$@"}
5289 case "$cppflags" in
5290 *-*) echo "They appear to be: $cppflags";;
5291 esac
5292 $rm -f cpp.c cpp?.out
2afac517 5293 ;;
5294esac
8e07c86e 5295
bd9b35c9
JH
5296: flags used in final linking phase
5297case "$ldflags" in
5298'') if ./venix; then
5299 dflt='-i -z'
10a23457 5300 else
bd9b35c9 5301 dflt=''
10a23457 5302 fi
bd9b35c9
JH
5303 case "$ccflags" in
5304 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5305 esac
bd9b35c9
JH
5306 ;;
5307*) dflt="$ldflags";;
5308esac
b2f871ed
AD
5309# See note above about -fstack-protector
5310case "$ccflags" in
5311*-fstack-protector*)
5312 case "$dflt" in
5313 *-fstack-protector*) ;; # Don't add it again
5314 *) dflt="$dflt -fstack-protector" ;;
5315 esac
5316 ;;
5317esac
bd9b35c9
JH
5318
5319: Try to guess additional flags to pick up local libraries.
5320for thislibdir in $libpth; do
5321 case " $loclibpth " in
5322 *" $thislibdir "*)
00e89ad4 5323 case "$dflt " in
bd9b35c9
JH
5324 *"-L$thislibdir "*) ;;
5325 *) dflt="$dflt -L$thislibdir" ;;
5326 esac
c4f23d77
AD
5327 ;;
5328 esac
bd9b35c9 5329done
c4f23d77 5330
bd9b35c9
JH
5331case "$dflt" in
5332'') dflt='none' ;;
5333esac
c4f23d77 5334
bd9b35c9
JH
5335$cat <<EOH
5336
5337Your C linker may need flags. For this question you should
5338include -L/whatever and any other flags used by the C linker, but you
5339should NOT include libraries like -lwhatever.
5340
5341Make sure you include the appropriate -L/path flags if your C linker
5342does not normally search all of the directories you specified above,
5343namely
5344 $libpth
5345To use no flags, specify the word "none".
5346
5347EOH
5348
5349rp="Any additional ld flags (NOT including libraries)?"
5350. ./myread
5351case "$ans" in
5352none) ldflags='';;
5353*) ldflags="$ans";;
5354esac
5355rmlist="$rmlist pdp11"
5356
5357: coherency check
5358echo " "
5359echo "Checking your choice of C compiler and flags for coherency..." >&4
5360$cat > try.c <<'EOF'
5361#include <stdio.h>
55954f19 5362int main() { printf("Ok\n"); return(0); }
bd9b35c9 5363EOF
7a282f6d 5364set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5365shift
5366$cat >try.msg <<'EOM'
5367I've tried to compile and run the following simple program:
5368
5369EOM
5370$cat try.c >> try.msg
5371
5372$cat >> try.msg <<EOM
5373
5374I used the command:
5375
5376 $*
5440bc8e 5377 $run ./try
bd9b35c9
JH
5378
5379and I got the following output:
5380
5381EOM
5382dflt=y
73614538 5383if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
613d6c3e 5384 if $sh -c "$run ./try " >>try.msg 2>&1; then
5440bc8e 5385 xxx=`$run ./try`
bd9b35c9
JH
5386 case "$xxx" in
5387 "Ok") dflt=n ;;
5388 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5389 case " $libs " in
5390 *" -lsfio "*)
5391 cat >> try.msg <<'EOQS'
5392If $libs contains -lsfio, and sfio is mis-configured, then it
5393sometimes (apparently) runs and exits with a 0 status, but with no
5394output! It may have to do with sfio's use of _exit vs. exit.
5395
5396EOQS
5397 rp="You have a big problem. Shall I abort Configure"
5398 dflt=y
5399 ;;
5400 esac
5401 ;;
5402 esac
5403 else
5404 echo "The program compiled OK, but exited with status $?." >>try.msg
5405 rp="You have a problem. Shall I abort Configure"
5406 dflt=y
5407 fi
5408else
5409 echo "I can't compile the test program." >>try.msg
5410 rp="You have a BIG problem. Shall I abort Configure"
5411 dflt=y
5412fi
5413case "$dflt" in
5414y)
5415 $cat try.msg >&4
5416 case "$knowitall" in
5417 '')
5418 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5419 ;;
bd9b35c9 5420 *) dflt=n;;
c4f23d77 5421 esac
bd9b35c9
JH
5422 echo " "
5423 . ./myread
5424 case "$ans" in
5425 n*|N*) ;;
5426 *) echo "Ok. Stopping Configure." >&4
5427 exit 1
c4f23d77
AD
5428 ;;
5429 esac
5430 ;;
bd9b35c9 5431n) echo "OK, that should do.";;
c4f23d77 5432esac
613d6c3e 5433$rm_try gcctest gcctest.out
c4f23d77 5434
bd9b35c9
JH
5435: define a shorthand compile call
5436compile='
5437mc_file=$1;
5438shift;
08593cf4
NC
5439case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5440echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5441exit 1;
5442fi;
5443esac;
08413ebc 5444$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5445: define a shorthand compile call for compilations that should be ok.
5446compile_ok='
5447mc_file=$1;
5448shift;
7a282f6d 5449$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5450
8dfa8df9
JH
5451: determine filename position in cpp output
5452echo " "
5453echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5454case "$osname" in
5455vos) testaccess=-e ;;
5456*) testaccess=-r ;;
5457esac
8dfa8df9
JH
5458echo '#include <stdio.h>' > foo.c
5459$cat >fieldn <<EOF
5460$startsh
5461$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5462$grep '^[ ]*#.*stdio\.h' | \
5463while read cline; do
5464 pos=1
5465 set \$cline
5466 while $test \$# -gt 0; do
a5a94ea5 5467 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5468 echo "\$pos"
5469 exit 0
5470 fi
5471 shift
5472 pos=\`expr \$pos + 1\`
5473 done
5474done
5475EOF
5476chmod +x fieldn
5477fieldn=`./fieldn`
5478$rm -f foo.c fieldn
5479case $fieldn in
5480'') pos='???';;
54811) pos=first;;
54822) pos=second;;
54833) pos=third;;
5484*) pos="${fieldn}th";;
5485esac
5486echo "Your cpp writes the filename in the $pos field of the line."
5487
3c728e00
JH
5488case "$osname" in
5489vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5490os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5491*) cppfilter='' ;;
5492esac
8dfa8df9
JH
5493: locate header file
5494$cat >findhdr <<EOF
5495$startsh
5496wanted=\$1
5497name=''
5498for usrincdir in $usrinc
5499do
5500 if test -f \$usrincdir/\$wanted; then
5501 echo "\$usrincdir/\$wanted"
5502 exit 0
5503 fi
5504done
5505awkprg='{ print \$$fieldn }'
5506echo "#include <\$wanted>" > foo\$\$.c
5507$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5508$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5509while read cline; do
5510 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5511 case "\$name" in
5512 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5513 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5514 *) exit 2;;
5515 esac;
5516done;
5517#
5518# status = 0: grep returned 0 lines, case statement not executed
5519# status = 1: headerfile found
5520# status = 2: while loop executed, no headerfile found
5521#
5522status=\$?
5523$rm -f foo\$\$.c;
5524if test \$status -eq 1; then
5525 exit 0;
5526fi
5527exit 1
5528EOF
5529chmod +x findhdr
5530
5531: define an alternate in-header-list? function
5532inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5533cont=true; xxf="echo \"<\$1> found.\" >&4";
5534case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5535*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5536esac;
5537case $# in 4) instead=instead;; *) instead="at last";; esac;
5538while $test "$cont"; do
5539 xxx=`./findhdr $1`
5540 var=$2; eval "was=\$$2";
5541 if $test "$xxx" && $test -r "$xxx";
5542 then eval $xxf;
5543 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5544 cont="";
5545 else eval $xxnf;
5546 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5547 set $yyy; shift; shift; yyy=$@;
5548 case $# in 0) cont="";;
5549 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5550 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5551 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5552 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5553 esac;
5554done;
5555while $test "$yyy";
5556do set $yyy; var=$2; eval "was=\$$2";
5557 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5558 set $yyy; shift; shift; yyy=$@;
5559done'
5560
d1daaddf
JH
5561: see if stdlib is available
5562set stdlib.h i_stdlib
5563eval $inhdr
5564
5565: check for lengths of integral types
5566echo " "
5567case "$intsize" in
5568'')
5569 echo "Checking to see how big your integers are..." >&4
c63dfae1 5570 $cat >try.c <<EOCP
d1daaddf
JH
5571#include <stdio.h>
5572#$i_stdlib I_STDLIB
5573#ifdef I_STDLIB
5574#include <stdlib.h>
5575#endif
5576int main()
5577{
5578 printf("intsize=%d;\n", (int)sizeof(int));
5579 printf("longsize=%d;\n", (int)sizeof(long));
5580 printf("shortsize=%d;\n", (int)sizeof(short));
5581 exit(0);
5582}
5583EOCP
5584 set try
5585 if eval $compile_ok && $run ./try > /dev/null; then
5586 eval `$run ./try`
5587 echo "Your integers are $intsize bytes long."
5588 echo "Your long integers are $longsize bytes long."
5589 echo "Your short integers are $shortsize bytes long."
5590 else
5591 $cat >&4 <<EOM
5592!
5593Help! I can't compile and run the intsize test program: please enlighten me!
5594(This is probably a misconfiguration in your system or libraries, and
5595you really ought to fix it. Still, I'll try anyway.)
5596!
5597EOM
5598 dflt=4
5599 rp="What is the size of an integer (in bytes)?"
5600 . ./myread
5601 intsize="$ans"
5602 dflt=$intsize
5603 rp="What is the size of a long integer (in bytes)?"
5604 . ./myread
5605 longsize="$ans"
5606 dflt=2
5607 rp="What is the size of a short integer (in bytes)?"
5608 . ./myread
5609 shortsize="$ans"
5610 fi
5611 ;;
5612esac
5b813a60 5613$rm_try
d1daaddf
JH
5614
5615: check for long long
5616echo " "
5617echo "Checking to see if you have long long..." >&4
5618echo 'int main() { long long x = 7; return 0; }' > try.c
5619set try
5620if eval $compile; then
5621 val="$define"
5622 echo "You have long long."
5623else
5624 val="$undef"
5625 echo "You do not have long long."
5626fi
5b813a60 5627$rm_try
d1daaddf
JH
5628set d_longlong
5629eval $setvar
5630
5631: check for length of long long
5632case "${d_longlong}${longlongsize}" in
5633$define)
5634 echo " "
5635 echo "Checking to see how big your long longs are..." >&4
5636 $cat >try.c <<'EOCP'
5637#include <stdio.h>
5638int main()
5639{
5640 printf("%d\n", (int)sizeof(long long));
5641 return(0);
5642}
5643EOCP
5644 set try
5645 if eval $compile_ok; then
5646 longlongsize=`$run ./try`
5647 echo "Your long longs are $longlongsize bytes long."
5648 else
5649 dflt='8'
5650 echo " "
5651 echo "(I can't seem to compile the test program. Guessing...)"
5652 rp="What is the size of a long long (in bytes)?"
5653 . ./myread
5654 longlongsize="$ans"
5655 fi
5656 if $test "X$longsize" = "X$longlongsize"; then
5657 echo "(That isn't any different from an ordinary long.)"
5b813a60 5658 fi
d1daaddf
JH
5659 ;;
5660esac
5b813a60 5661$rm_try
d1daaddf 5662
8dfa8df9
JH
5663: see if inttypes.h is available
5664: we want a real compile instead of Inhdr because some systems
5665: have an inttypes.h which includes non-existent headers
5666echo " "
5667$cat >try.c <<EOCP
5668#include <inttypes.h>
5669int main() {
5670 static int32_t foo32 = 0x12345678;
5671}
5672EOCP
5673set try
5674if eval $compile; then
5675 echo "<inttypes.h> found." >&4
5676 val="$define"
5677else
5678 echo "<inttypes.h> NOT found." >&4
5679 val="$undef"
5680fi
5b813a60 5681$rm_try
8dfa8df9
JH
5682set i_inttypes
5683eval $setvar
5684
5685: check for int64_t
5686echo " "
5687echo "Checking to see if you have int64_t..." >&4
5688$cat >try.c <<EOCP
5689#include <sys/types.h>
5690#$i_inttypes I_INTTYPES
5691#ifdef I_INTTYPES
5692#include <inttypes.h>
5693#endif
5694int main() { int64_t x = 7; }
5695EOCP
5696set try
5697if eval $compile; then
5698 val="$define"
5699 echo "You have int64_t."
5700else
5701 val="$undef"
5702 echo "You do not have int64_t."
5703fi
5b813a60 5704$rm_try
8dfa8df9
JH
5705set d_int64_t
5706eval $setvar
5707
613d6c3e 5708: Check if 64bit ints have a quad type
8dfa8df9
JH
5709echo " "
5710echo "Checking which 64-bit integer type we could use..." >&4
5711
5712case "$intsize" in
57138) val=int
5714 set quadtype
5715 eval $setvar
5716 val='"unsigned int"'
5717 set uquadtype
5718 eval $setvar
5719 quadkind=1
5720 ;;
5721*) case "$longsize" in
5722 8) val=long
5723 set quadtype
5724 eval $setvar
5725 val='"unsigned long"'
5726 set uquadtype
5727 eval $setvar
5728 quadkind=2
5729 ;;
5730 *) case "$d_longlong:$longlongsize" in
5731 define:8)
5732 val='"long long"'
5733 set quadtype
5734 eval $setvar
5735 val='"unsigned long long"'
5736 set uquadtype
5737 eval $setvar
5738 quadkind=3
5739 ;;
5740 *) case "$d_int64_t" in
5741 define)
5742 val=int64_t
5743 set quadtype
5744 eval $setvar
5745 val=uint64_t
5746 set uquadtype
5747 eval $setvar
5748 quadkind=4
5749 ;;
5750 esac
5751 ;;
5752 esac
5753 ;;
5754 esac
5755 ;;
5756esac
5757
5758case "$quadtype" in
5759'') echo "Alas, no 64-bit integer types in sight." >&4
5760 d_quad="$undef"
5761 ;;
5762*) echo "We could use '$quadtype' for 64-bit integers." >&4
5763 d_quad="$define"
5764 ;;
5765esac
5766
34f1896b 5767: Do we want 64bit support
b4eb6b3d
JH
5768case "$uselonglong" in
5769"$define"|true|[yY]*)
5770 cat <<EOM >&4
5771
5772*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5773EOM
5774 use64bitint="$define"
5775 ;;
613d6c3e 5776esac
b4eb6b3d
JH
5777case "$use64bits" in
5778"$define"|true|[yY]*)
5779 cat <<EOM >&4
5780
5781*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5782EOM
5783 use64bitint="$define"
5784 ;;
613d6c3e 5785esac
b4eb6b3d
JH
5786case "$use64bitints" in
5787"$define"|true|[yY]*)
5788 cat <<EOM >&4
5789
5790*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5791EOM
5792 use64bitint="$define"
5793 ;;
613d6c3e 5794esac
b4eb6b3d
JH
5795case "$use64bitsint" in
5796"$define"|true|[yY]*)
5797 cat <<EOM >&4
5798
5799*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5800EOM
5801 use64bitint="$define"
5802 ;;
613d6c3e 5803esac
b4eb6b3d
JH
5804case "$uselonglongs" in
5805"$define"|true|[yY]*)
5806 cat <<EOM >&4
5807
5808*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5809EOM
5810 use64bitint="$define"
5811 ;;
613d6c3e 5812esac
b4eb6b3d
JH
5813case "$use64bitsall" in
5814"$define"|true|[yY]*)
5815 cat <<EOM >&4
5816
5817*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5818EOM
5819 use64bitall="$define"
5820 ;;
613d6c3e 5821esac
b4eb6b3d
JH
5822
5823case "$ccflags" in
5824*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5825esac
5826case "$use64bitall" in
5827"$define"|true|[yY]*) use64bitint="$define" ;;
5828esac
5829
5830case "$longsize" in
58318) cat <<EOM
5832
5833You have natively 64-bit long integers.
5834EOM
5835 val="$define"
5836 ;;
5837*) case "$use64bitint" in
5838 "$define"|true|[yY]*) dflt='y';;
5839 *) dflt='n';;
5840 esac
8dfa8df9
JH
5841 case "$d_quad" in
5842 "$define") ;;
5843 *) dflt='n' ;;
5844 esac
b4eb6b3d
JH
5845 cat <<EOM
5846
5847Perl can be built to take advantage of 64-bit integer types
5848on some systems. To do so, Configure can be run with -Duse64bitint.
5849Choosing this option will most probably introduce binary incompatibilities.
5850
5851If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5852(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5853EOM
5854 rp='Try to use 64-bit integers, if available?'
5855 . ./myread
5856 case "$ans" in
5857 [yY]*) val="$define" ;;
5858 *) val="$undef" ;;
5859 esac
5860 ;;
5861esac
5862set use64bitint
5863eval $setvar
5864
5865case "$use64bitall" in
5866"$define"|true|[yY]*) dflt='y' ;;
5867*) case "$longsize" in
5868 8) dflt='y' ;;
5869 *) dflt='n' ;;
5870 esac
5871 ;;
613d6c3e 5872esac
b4eb6b3d
JH
5873cat <<EOM
5874
5875You may also choose to try maximal 64-bitness. It means using as much
587664-bitness as possible on the platform. This in turn means even more
5877binary incompatibilities. On the other hand, your platform may not
5878have any more 64-bitness available than what you already have chosen.
5879
5880If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5881(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5882EOM
5883rp='Try to use maximal 64-bit support, if available?'
5884. ./myread
5885case "$ans" in
5886[yY]*) val="$define" ;;
5887*) val="$undef" ;;
5888esac
5889set use64bitall
5890eval $setvar
5891case "$use64bitall" in
5892"$define")
5893 case "$use64bitint" in
5894 "$undef")
5895 cat <<EOM
5896
5897Since you have chosen a maximally 64-bit build, I'm also turning on
5898the use of 64-bit integers.
5899EOM
5900 use64bitint="$define" ;;
5901 esac
5902 ;;
5903esac
5904
b4eb6b3d
JH
5905: Look for a hint-file generated 'call-back-unit'. If the
5906: user has specified that a 64-bit perl is to be built,
5907: we may need to set or change some other defaults.
19a100ff 5908if $test -f use64bitint.cbu; then
9da7673b 5909 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5910 . ./use64bitint.cbu
5911fi
9da7673b
MB
5912case "$use64bitint" in
5913"$define"|true|[yY]*)
b4eb6b3d
JH
5914 case "$longsize" in
5915 4) case "$archname64" in
5916 '') archname64=64int ;;
5917 esac
5918 ;;
5919 esac
5920 ;;
5921esac
5922
b4eb6b3d
JH
5923: Look for a hint-file generated 'call-back-unit'. If the
5924: user has specified that a maximally 64-bit perl is to be built,
5925: we may need to set or change some other defaults.
19a100ff 5926if $test -f use64bitall.cbu; then
9da7673b 5927 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5928 . ./use64bitall.cbu
5929fi
9da7673b
MB
5930case "$use64bitall" in
5931"$define"|true|[yY]*)
b4eb6b3d
JH
5932 case "$longsize" in
5933 4) case "$archname64" in
5934 ''|64int) archname64=64all ;;
5935 esac
5936 ;;
5937 esac
5938 ;;
5939esac
5940
1911a026
JH
5941case "$d_quad:$use64bitint" in
5942$undef:$define)
5943 cat >&4 <<EOF
5944
5945*** You have chosen to use 64-bit integers,
19a100ff 5946*** but none can be found.
09b58c7b 5947*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5948*** Cannot continue, aborting.
5949
5950EOF
5951 exit 1
5952 ;;
5953esac
5954
36adc09b
JH
5955: check for length of double
5956echo " "
5957case "$doublesize" in
5958'')
5959 echo "Checking to see how big your double precision numbers are..." >&4
5960 $cat >try.c <<EOCP
5961#include <stdio.h>
1911a026
JH
5962#$i_stdlib I_STDLIB
5963#ifdef I_STDLIB
5964#include <stdlib.h>
5965#endif
36adc09b
JH
5966int main()
5967{
5968 printf("%d\n", (int)sizeof(double));
1911a026 5969 exit(0);
36adc09b
JH
5970}
5971EOCP
5972 set try
5973 if eval $compile_ok; then
5974 doublesize=`$run ./try`
5975 echo "Your double is $doublesize bytes long."
5976 else
5977 dflt='8'
5978 echo "(I can't seem to compile the test program. Guessing...)"
5979 rp="What is the size of a double precision number (in bytes)?"
5980 . ./myread
5981 doublesize="$ans"
5982 fi
5983 ;;
5984esac
5b813a60 5985$rm_try
36adc09b
JH
5986
5987: check for long doubles
5988echo " "
5989echo "Checking to see if you have long double..." >&4
5990echo 'int main() { long double x = 7.0; }' > try.c
5991set try
5992if eval $compile; then
5993 val="$define"
5994 echo "You have long double."
5995else
5996 val="$undef"
5997 echo "You do not have long double."
5998fi
5b813a60 5999$rm_try
36adc09b
JH
6000set d_longdbl
6001eval $setvar
6002
6003: check for length of long double
6004case "${d_longdbl}${longdblsize}" in
6005$define)
6006 echo " "
6007 echo "Checking to see how big your long doubles are..." >&4
6008 $cat >try.c <<'EOCP'
6009#include <stdio.h>
6010int main()
6011{
6012 printf("%d\n", sizeof(long double));
6013}
6014EOCP
6015 set try
6016 set try
6017 if eval $compile; then
6018 longdblsize=`$run ./try`
6019 echo "Your long doubles are $longdblsize bytes long."
6020 else
6021 dflt='8'
6022 echo " "
6023 echo "(I can't seem to compile the test program. Guessing...)" >&4
6024 rp="What is the size of a long double (in bytes)?"
6025 . ./myread
6026 longdblsize="$ans"
6027 fi
6028 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
6029 echo "That isn't any different from an ordinary double."
6030 echo "I'll keep your setting anyway, but you may see some"
6031 echo "harmless compilation warnings."
5b813a60 6032 fi
36adc09b
JH
6033 ;;
6034esac
5b813a60 6035$rm_try
36adc09b 6036
89ce900e 6037: determine the architecture name
b4eb6b3d 6038echo " "
89ce900e
JH
6039if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6040 tarch=`arch`"-$osname"
6041elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6042 if uname -m > tmparch 2>&1 ; then
6043 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6044 -e 's/$/'"-$osname/" tmparch`
6045 else
6046 tarch="$osname"
6047 fi
6048 $rm -f tmparch
b4eb6b3d 6049else
89ce900e 6050 tarch="$osname"
b4eb6b3d 6051fi
89ce900e
JH
6052case "$myarchname" in
6053''|"$tarch") ;;
6054*)
6055 echo "(Your architecture name used to be $myarchname.)"
6056 archname=''
6057 ;;
6058esac
6059case "$targetarch" in
6060'') ;;
6061*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6062esac
6063myarchname="$tarch"
6064case "$archname" in
6065'') dflt="$tarch";;
6066*) dflt="$archname";;
6067esac
6068rp='What is your architecture name'
6069. ./myread
6070archname="$ans"
6071case "$usethreads" in
6072$define)
6073 echo "Threads selected." >&4
6074 case "$archname" in
6075 *-thread*) echo "...and architecture name already has -thread." >&4
6076 ;;
6077 *) archname="$archname-thread"
6078 echo "...setting architecture name to $archname." >&4
6079 ;;
6080 esac
6081 ;;
6082esac
6083case "$usemultiplicity" in
6084$define)
6085 echo "Multiplicity selected." >&4
6086 case "$archname" in
6087 *-multi*) echo "...and architecture name already has -multi." >&4
6088 ;;
6089 *) archname="$archname-multi"
6090 echo "...setting architecture name to $archname." >&4
6091 ;;
6092 esac
6093 ;;
6094esac
6095case "$use64bitint$use64bitall" in
6096*"$define"*)
6097 case "$archname64" in
6098 '')
6099 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6100 ;;
89ce900e
JH
6101 *)
6102 case "$use64bitint" in
6103 "$define") echo "64 bit integers selected." >&4 ;;
6104 esac
6105 case "$use64bitall" in
6106 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6107 esac
6108 case "$archname" in
6109 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6110 ;;
6111 *) archname="$archname-$archname64"
6112 echo "...setting architecture name to $archname." >&4
6113 ;;
6114 esac
c1a7f87b
JH
6115 ;;
6116 esac
89ce900e
JH
6117esac
6118case "$uselongdouble" in
6119$define)
6120 echo "Long doubles selected." >&4
6121 case "$longdblsize" in
6122 $doublesize)
6123 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6124 ;;
6125 *)
6126 case "$archname" in
6127 *-ld*) echo "...and architecture name already has -ld." >&4
6128 ;;
6129 *) archname="$archname-ld"
6130 echo "...setting architecture name to $archname." >&4
6131 ;;
6132 esac
bd9b35c9
JH
6133 ;;
6134 esac
bd9b35c9 6135 ;;
89ce900e
JH
6136esac
6137case "$useperlio" in
6138$define)
6139 echo "Perlio selected." >&4
6140 ;;
bd9b35c9 6141*)
89ce900e
JH
6142 echo "Perlio not selected, using stdio." >&4
6143 case "$archname" in
6144 *-stdio*) echo "...and architecture name already has -stdio." >&4
6145 ;;
6146 *) archname="$archname-stdio"
6147 echo "...setting architecture name to $archname." >&4
6148 ;;
6149 esac
bd9b35c9
JH
6150 ;;
6151esac
d2e0c6f7
JH
6152if $test -f archname.cbu; then
6153 echo "Your platform has some specific hints for architecture name, using them..."
6154 . ./archname.cbu
6155fi
bd9b35c9 6156
b4eb6b3d
JH
6157: set the prefixit variable, to compute a suitable default value
6158prefixit='case "$3" in
6159""|none)
6160 case "$oldprefix" in
6161 "") eval "$1=\"\$$2\"";;
6162 *)
6163 case "$3" in
6164 "") eval "$1=";;
6165 none)
6166 eval "tp=\"\$$2\"";
6167 case "$tp" in
6168 ""|" ") eval "$1=\"\$$2\"";;
6169 *) eval "$1=";;
6170 esac;;
6171 esac;;
6172 esac;;
6173*)
6174 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6175 case "$tp" in
6176 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6177 /*-$oldprefix/*|\~*-$oldprefix/*)
6178 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6179 *) eval "$1=\"\$$2\"";;
6180 esac;;
6181esac'
6182
f3f1a2d8
MB
6183: determine installation style
6184: For now, try to deduce it from prefix unless it is already set.
6185: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6186case "$installstyle" in
6187'') case "$prefix" in
6188 *perl*) dflt='lib';;
6189 *) dflt='lib/perl5' ;;
6190 esac
6191 ;;
6192*) dflt="$installstyle" ;;
4d20abad 6193esac
f3f1a2d8
MB
6194: Probably not worth prompting for this since we prompt for all
6195: the directories individually, and the prompt would be too long and
6196: confusing anyway.
6197installstyle=$dflt
4d20abad 6198
eaf812ae
MB
6199: determine where public executables go
6200echo " "
6201set dflt bin bin
6202eval $prefixit
6203fn=d~
6204rp='Pathname where the public executables will reside?'
6205. ./getfile
6206if $test "X$ansexp" != "X$binexp"; then
6207 installbin=''
6208fi
6209prefixvar=bin
6210: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6211: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6212: this via initialinstalllocation
eaf812ae
MB
6213. ./setprefixvar
6214
6215case "$userelocatableinc" in
6216$define|true|[yY]*) dflt='y' ;;
6217*) dflt='n' ;;
6218esac
6219cat <<EOM
6220
6221Would you like to build Perl so that the installation is relocatable, so that
6222library paths in @INC are determined relative to the path of the perl binary?
6223This is not advised for system Perl installs, or if you need to run setid
6224scripts or scripts under taint mode.
6225
6226If this doesn't make any sense to you, just accept the default '$dflt'.
6227EOM
6228rp='Use relocatable @INC?'
6229. ./myread
6230case "$ans" in
6231y|Y) val="$define" ;;
6232*) val="$undef" ;;
6233esac
6234set userelocatableinc
6235eval $setvar
6236
ea7d701d 6237initialinstalllocation="$binexp"
eaf812ae
MB
6238: Default prefix is now "up one level from where the binaries are"
6239case "$userelocatableinc" in
6240$define|true|[yY]*)
eaf812ae
MB
6241 bin=".../"
6242 binexp=".../"
6243 prefix=".../.."
6244 prefixexp=".../.."
6245 installprefixexp=".../.."
6246 ;;
6247esac
6248
b4eb6b3d
JH
6249: determine where private library files go
6250: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6251: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6252: /opt/perl/lib/perl5... would be redundant.
6253: The default "style" setting is made in installstyle.U
6254case "$installstyle" in
6255*lib/perl5*) set dflt privlib lib/$package/$version ;;
6256*) set dflt privlib lib/$version ;;
6257esac
6258eval $prefixit
6259$cat <<EOM
6260
6261There are some auxiliary files for $package that need to be put into a
6262private library directory that is accessible by everyone.
6263
6264EOM
eaf812ae 6265fn=$binexp
b4eb6b3d
JH
6266fn=d~+
6267rp='Pathname where the private library files will reside?'
6268. ./getfile
79522dd2
NC
6269prefixvar=privlib
6270. ./setprefixvar
b4eb6b3d
JH
6271
6272: set the prefixup variable, to restore leading tilda escape
6273prefixup='case "$prefixexp" in
6274"$prefix") ;;
6275*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6276esac'
6277
6278: determine where public architecture dependent libraries go
6279set archlib archlib
6280eval $prefixit
6281: privlib default is /usr/local/lib/$package/$version
6282: archlib default is /usr/local/lib/$package/$version/$archname
6283: privlib may have an optional trailing /share.
6284tdflt=`echo $privlib | $sed 's,/share$,,'`
6285tdflt=$tdflt/$archname
6286case "$archlib" in
6287'') dflt=$tdflt
6288 ;;
6289*) dflt="$archlib"
6290 ;;
6291esac
6292$cat <<EOM
6293
6294$spackage contains architecture-dependent library files. If you are
6295sharing libraries in a heterogeneous environment, you might store
6296these files in a separate location. Otherwise, you can just include
6297them with the rest of the public library files.
6298
6299EOM
eaf812ae 6300fn=$binexp
b4eb6b3d
JH
6301fn=d+~
6302rp='Where do you want to put the public architecture-dependent libraries?'
6303. ./getfile
79522dd2
NC
6304prefixvar=archlib
6305. ./setprefixvar
b4eb6b3d
JH
6306if $test X"$archlib" = X"$privlib"; then
6307 d_archlib="$undef"
6308else
6309 d_archlib="$define"
6310fi
b4eb6b3d 6311
b4eb6b3d
JH
6312: see if setuid scripts can be secure
6313$cat <<EOM
6314
6315Some kernels have a bug that prevents setuid #! scripts from being
6316secure. Some sites have disabled setuid #! scripts because of this.
6317
6318First let's decide if your kernel supports secure setuid #! scripts.
6319(If setuid #! scripts would be secure but have been disabled anyway,
6320don't say that they are secure if asked.)
6321
6322EOM
6323
6324val="$undef"
6325if $test -d /dev/fd; then
6326 echo "#!$ls" >reflect
6327 chmod +x,u+s reflect
6328 ./reflect >flect 2>&1
6329 if $contains "/dev/fd" flect >/dev/null; then
6330 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6331 val="$define"
6332 else
6333 $cat <<EOM
6334If you are not sure if they are secure, I can check but I'll need a
6335username and password different from the one you are using right now.
6336If you don't have such a username or don't want me to test, simply
6337enter 'none'.
6338
6339EOM
6340 rp='Other username to test security of setuid scripts with?'
6341 dflt='none'
6342 . ./myread
6343 case "$ans" in
6344 n|none)
6345 case "$d_suidsafe" in
6346 '') echo "I'll assume setuid scripts are *not* secure." >&4
6347 dflt=n;;
6348 "$undef")
6349 echo "Well, the $hint value is *not* secure." >&4
6350 dflt=n;;
6351 *) echo "Well, the $hint value *is* secure." >&4
6352 dflt=y;;
6353 esac
c1a7f87b 6354 ;;
b4eb6b3d
JH
6355 *)
6356 $rm -f reflect flect
6357 echo "#!$ls" >reflect
6358 chmod +x,u+s reflect
6359 echo >flect
6360 chmod a+w flect
6361 echo '"su" will (probably) prompt you for '"$ans's password."
6362 su $ans -c './reflect >flect'
6363 if $contains "/dev/fd" flect >/dev/null; then
6364 echo "Okay, it looks like setuid scripts are secure." >&4
6365 dflt=y
6366 else
6367 echo "I don't think setuid scripts are secure." >&4
6368 dflt=n
6369 fi
6370 ;;
6371 esac
6372 rp='Does your kernel have *secure* setuid scripts?'
6373 . ./myread
6374 case "$ans" in
6375 [yY]*) val="$define";;
6376 *) val="$undef";;
6377 esac
6378 fi
6379else
6380 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6381 echo "(That's for file descriptors, not floppy disks.)"
6382 val="$undef"
6383fi
6384set d_suidsafe
6385eval $setvar
6386
6387$rm -f reflect flect
6388
6389: now see if they want to do setuid emulation
01614441 6390if $test $patchlevel -lt 11; then
b4eb6b3d
JH
6391echo " "
6392val="$undef"
6393case "$d_suidsafe" in
6394"$define")
6395 val="$undef"
3c728e00 6396 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6397 ;;
f3f1a2d8
MB
6398*)
6399 $cat <<EOM
6400Some systems have disabled setuid scripts, especially systems where
6401setuid scripts cannot be secure. On systems where setuid scripts have
6402been disabled, the setuid/setgid bits on scripts are currently
6403useless. It is possible for $package to detect those bits and emulate
6404setuid/setgid in a secure fashion. This emulation will only work if
6405setuid scripts have been disabled in your kernel.
6406
6407EOM
6408 case "$d_dosuid" in
6409 "$define") dflt=y ;;
6410 *) dflt=n ;;
6411 esac
6412 rp="Do you want to do setuid/setgid emulation?"
6413 . ./myread
6414 case "$ans" in
6415 [yY]*) val="$define";;
6416 *) val="$undef";;
6417 esac
6418 ;;
6419esac
6420set d_dosuid
6421eval $setvar
01614441
MB
6422else
6423 case "$d_dosuid" in
6424 "$define")
6425 cat >&4 <<EOH
6426
6427SUID emulation has been removed for 5.12
6428Please re-run Configure without -Dd_dosuid
6429
6430EOH
6431 exit 1;
6432 ;;
6433 esac
6434 d_dosuid=undef
6435fi
f3f1a2d8 6436
f3f1a2d8
MB
6437: Find perl5.005 or later.
6438echo "Looking for a previously installed perl5.005 or later... "
6439case "$perl5" in
6440'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6441 : Check if this perl is recent and can load a simple module
6442 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6443 perl5=$tdir/perl
6444 break;
6445 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6446 perl5=$tdir/perl5
6447 break;
6448 fi
6449 done
6450 ;;
6451*) perl5="$perl5"
6452 ;;
6453esac
6454case "$perl5" in
6455'') echo "None found. That's ok.";;
6456*) echo "Using $perl5." ;;
6457esac
6458
613d6c3e 6459: Set the siteprefix variables
f3f1a2d8
MB
6460$cat <<EOM
6461
6462After $package is installed, you may wish to install various
6463add-on modules and utilities. Typically, these add-ons will
6464be installed under $prefix with the rest
6465of this package. However, you may wish to install such add-ons
6466elsewhere under a different prefix.
6467
6468If you do not wish to put everything under a single prefix, that's
6469ok. You will be prompted for the individual locations; this siteprefix
6470is only used to suggest the defaults.
6471
6472The default should be fine for most people.
6473
6474EOM
6475fn=d~+
6476rp='Installation prefix to use for add-on modules and utilities?'
6477: XXX Here might be another good place for an installstyle setting.
6478case "$siteprefix" in
6479'') dflt=$prefix ;;
6480*) dflt=$siteprefix ;;
6481esac
6482. ./getfile
6483: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6484oldsiteprefix=''
6485case "$siteprefix" in
6486'') ;;
6487*) case "$ans" in
6488 "$prefix") ;;
6489 *) oldsiteprefix="$prefix";;
6490 esac
6491 ;;
6492esac
6493siteprefix="$ans"
6494siteprefixexp="$ansexp"
6495
6496: determine where site specific libraries go.
6497: Usual default is /usr/local/lib/perl5/site_perl/$version
6498: The default "style" setting is made in installstyle.U
6499: XXX No longer works with Prefixit stuff.
6500prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6501case "$sitelib" in
6502'') case "$installstyle" in
6503 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6504 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6505 esac
6506 ;;
6507*) dflt="$sitelib"
6508 ;;
6509esac
6510$cat <<EOM
6511
6512The installation process will create a directory for
6513site-specific extensions and modules. Most users find it convenient
6514to place all site-specific files in this directory rather than in the
6515main distribution directory.
6516
6517EOM
6518fn=d~+
6519rp='Pathname for the site-specific library files?'
6520. ./getfile
6521prefixvar=sitelib
6522. ./setprefixvar
6523sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6524
6525: Determine list of previous versions to include in @INC
6526$cat > getverlist <<EOPL
6527#!$perl5 -w
6528use File::Basename;
6529\$api_versionstring = "$api_versionstring";
6530\$version = "$version";
6531\$stem = "$sitelib_stem";
6532\$archname = "$archname";
6533EOPL
6534 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6535# The list found is store twice for each entry: the original name, and
6536# the binary broken down version as pack "sss", so sorting is easy and
6537# unambiguous. This will work for all versions that have a maximum of
6538# three digit groups, separate by '.'s or '_'s. Names are extended with
6539# ".0.0" to ensure at least three elements for the pack.
6540# -- H.Merijn Brand (m)'06 23-10-2006
6541
f3f1a2d8
MB
6542# Can't have leading @ because metaconfig interprets it as a command!
6543;@inc_version_list=();
6544# XXX Redo to do opendir/readdir?
6545if (-d $stem) {
6546 chdir($stem);
13cfc98d
MB
6547 ;@candidates = map {
6548 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
a71f1801 6549 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
f3f1a2d8
MB
6550}
6551else {
6552 ;@candidates = ();
6553}
6554
13cfc98d
MB
6555($pversion, $aversion, $vsn5005) = map {
6556 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6557foreach $d (@candidates) {
13cfc98d
MB
6558 if ($d->[1] lt $pversion) {
6559 if ($d->[1] ge $aversion) {
6560 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6561 }
13cfc98d
MB
6562 elsif ($d->[1] ge $vsn5005) {
6563 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6564 }
6565 }
6566 else {
6567 # Skip newer version. I.e. don't look in
6568 # 5.7.0 if we're installing 5.6.1.
6569 }
6570}
6571
6572if (@inc_version_list) {
6573 print join(' ', @inc_version_list);
6574}
6575else {
6576 # Blank space to preserve value for next Configure run.
6577 print " ";
6578}
6579EOPL
6580chmod +x getverlist
6581case "$inc_version_list" in
6582'') if test -x "$perl5$exe_ext"; then
6583 dflt=`$perl5 getverlist`
6584 else
6585 dflt='none'
6586 fi
6587 ;;
6588$undef) dflt='none' ;;
6589*) eval dflt=\"$inc_version_list\" ;;
6590esac
6591case "$dflt" in
6592''|' ') dflt=none ;;
6593esac
6594case "$dflt" in
65955.005) dflt=none ;;
6596esac
6597$cat <<EOM
6598
6599In order to ease the process of upgrading, this version of perl
6600can be configured to use modules built and installed with earlier
6601versions of perl that were installed under $prefix. Specify here
6602the list of earlier versions that this version of perl should check.
6603If Configure detected no earlier versions of perl installed under
6604$prefix, then the list will be empty. Answer 'none' to tell perl
6605to not search earlier versions.
b4eb6b3d 6606
f3f1a2d8
MB
6607The default should almost always be sensible, so if you're not sure,
6608just accept the default.
b4eb6b3d 6609EOM
f3f1a2d8
MB
6610
6611rp='List of earlier versions to include in @INC?'
6612. ./myread
6613case "$ans" in
6614[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6615*) inc_version_list="$ans" ;;
6616esac
6617case "$inc_version_list" in
6618''|' ')
6619 inc_version_list_init='0'
6620 d_inc_version_list="$undef"
6621 ;;
6622*) inc_version_list_init=`echo $inc_version_list |
6623 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6624 d_inc_version_list="$define"
b4eb6b3d
JH
6625 ;;
6626esac
f3f1a2d8 6627$rm -f getverlist
b4eb6b3d 6628
1cd66f7c
DD
6629: see if malloc/malloc.h has to be included
6630set malloc/malloc.h i_mallocmalloc
6631eval $inhdr
6632
b4eb6b3d 6633: see if this is a malloc.h system
01d07975
YST
6634: we want a real compile instead of Inhdr because some systems have a
6635: malloc.h that just gives a compile error saying to use stdlib.h instead
6636echo " "
6637$cat >try.c <<EOCP
6638#include <stdlib.h>
6639#include <malloc.h>
f25eda10 6640#$i_mallocmalloc I_MALLOCMALLOC
1cd66f7c
DD
6641#ifdef I_MALLOCMALLOC
6642# include <malloc/malloc.h>
6643#endif
6644
01d07975
YST
6645int main () { return 0; }
6646EOCP
6647set try
6648if eval $compile; then
6649 echo "<malloc.h> found." >&4
6650 val="$define"
6651else
6652 echo "<malloc.h> NOT found." >&4
6653 val="$undef"
6654fi
5b813a60 6655$rm_try
01d07975
YST
6656set i_malloc
6657eval $setvar
b4eb6b3d 6658
c8b93cf9
JH
6659: check for void type
6660echo " "
6661echo "Checking to see how well your C compiler groks the void type..." >&4
6662case "$voidflags" in
6663'')
c727eafa 6664 $cat >try.c <<EOCP
d1daaddf
JH
6665#$i_stdlib I_STDLIB
6666#ifdef I_STDLIB
6667#include <stdlib.h>
6668#endif
c8b93cf9
JH
6669#if TRY & 1
6670void sub() {
6671#else
6672sub() {
6673#endif
6674 extern void moo(); /* function returning void */
6675 void (*goo)(); /* ptr to func returning void */
6676#if TRY & 8
6677 void *hue; /* generic ptr */
6678#endif
6679#if TRY & 2
6680 void (*foo[10])();
6681#endif
6682
6683#if TRY & 4
6684 if(goo == moo) {
6685 exit(0);
6686 }
6687#endif
6688 exit(0);
6689}
6690int main() { sub(); }
6691EOCP
6692 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6693 voidflags=$defvoidused
6694 echo "Good. It appears to support void to the level $package wants.">&4
6695 if $contains warning .out >/dev/null 2>&1; then
6696 echo "However, you might get some warnings that look like this:"
6697 $cat .out
6698 fi
6699 else
6700echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6701 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6702 echo "It supports 1..."
6703 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6704 echo "It also supports 2..."
6705 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6706 voidflags=7
6707 echo "And it supports 4 but not 8 definitely."
6708 else
6709 echo "It doesn't support 4..."
6710 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6711 voidflags=11
6712 echo "But it supports 8."
6713 else
6714 voidflags=3
6715 echo "Neither does it support 8."
6716 fi
6717 fi
6718 else
6719 echo "It does not support 2..."
6720 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6721 voidflags=13
6722 echo "But it supports 4 and 8."
6723 else
6724 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6725 voidflags=5
6726 echo "And it supports 4 but has not heard about 8."
6727 else
6728 echo "However it supports 8 but not 4."
6729 fi
6730 fi
6731 fi
6732 else
6733 echo "There is no support at all for void."
6734 voidflags=0
6735 fi
6736 fi
6737esac
6738case "$voidflags" in
6739"$defvoidused") ;;
6740*) $cat >&4 <<'EOM'
6741 Support flag bits are:
6742 1: basic void declarations.
6743 2: arrays of pointers to functions returning void.
6744 4: operations between pointers to and addresses of void functions.
6745 8: generic void pointers.
6746EOM
6747 dflt="$voidflags";
6748 rp="Your void support flags add up to what?"
6749 . ./myread
6750 voidflags="$ans"
6751 ;;
6752esac
5b813a60 6753$rm_try
c8b93cf9
JH
6754
6755: check for length of pointer
6756echo " "
6757case "$ptrsize" in
6758'')
6759 echo "Checking to see how big your pointers are..." >&4
6760 if test "$voidflags" -gt 7; then
6761 echo '#define VOID_PTR char *' > try.c
6762 else
6763 echo '#define VOID_PTR void *' > try.c
6764 fi
74d00865 6765 $cat >>try.c <<EOCP
c8b93cf9 6766#include <stdio.h>
d1daaddf
JH
6767#$i_stdlib I_STDLIB
6768#ifdef I_STDLIB
6769#include <stdlib.h>
6770#endif
c8b93cf9
JH
6771int main()
6772{
6773 printf("%d\n", (int)sizeof(VOID_PTR));
6774 exit(0);
6775}
6776EOCP
6777 set try
6778 if eval $compile_ok; then
6779 ptrsize=`$run ./try`
6780 echo "Your pointers are $ptrsize bytes long."
6781 else
6782 dflt='4'
6783 echo "(I can't seem to compile the test program. Guessing...)" >&4
6784 rp="What is the size of a pointer (in bytes)?"
6785 . ./myread
6786 ptrsize="$ans"
6787 fi
6788 ;;
6789esac
5b813a60 6790$rm_try
c8b93cf9
JH
6791case "$use64bitall" in
6792"$define"|true|[yY]*)
6793 case "$ptrsize" in
6794 4) cat <<EOM >&4
6795
1911a026
JH
6796*** You have chosen a maximally 64-bit build,
6797*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6798*** Please rerun Configure without -Duse64bitall.
6799EOM
6800 case "$d_quad" in
6801 define)
6802 cat <<EOM >&4
6803*** Since you have quads, you could possibly try with -Duse64bitint.
6804EOM
6805 ;;
6806 esac
6807 cat <<EOM >&4
1911a026 6808*** Cannot continue, aborting.
c8b93cf9
JH
6809
6810EOM
09b58c7b 6811
1911a026 6812 exit 1
c8b93cf9
JH
6813 ;;
6814 esac
6815 ;;
6816esac
6817
19a100ff 6818
9df442c2
NC
6819: determine whether to use malloc wrapping
6820echo " "
6821case "$usemallocwrap" in
6822[yY]*|true|$define) dflt='y' ;;
6823[nN]*|false|$undef) dflt='n' ;;
6824*) case "$usedevel" in
6825 [yY]*|true|$define) dflt='y' ;;
6826 *) dflt='n' ;;
6827 esac
6828 ;;
6829esac
6830rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6831. ./myread
6832usemallocwrap="$ans"
6833case "$ans" in
6834y*|true)
6835 usemallocwrap="$define" ;;
6836*)
6837 usemallocwrap="$undef" ;;
6838esac
c8b93cf9 6839
b4eb6b3d
JH
6840: determine which malloc to compile in
6841echo " "
6842case "$usemymalloc" in
c4163172
JH
6843[yY]*|true|$define) dflt='y' ;;
6844[nN]*|false|$undef) dflt='n' ;;
6845*) case "$ptrsize" in
6846 4) dflt='y' ;;
6847 *) dflt='n' ;;
6848 esac
6849 ;;
8dfa8df9 6850esac
b4eb6b3d
JH
6851rp="Do you wish to attempt to use the malloc that comes with $package?"
6852. ./myread
6853usemymalloc="$ans"
6854case "$ans" in
6855y*|true)
6856 usemymalloc='y'
6857 mallocsrc='malloc.c'
6858 mallocobj="malloc$_o"
6859 d_mymalloc="$define"
6860 case "$libs" in
6861 *-lmalloc*)
6862 : Remove malloc from list of libraries to use
6863 echo "Removing unneeded -lmalloc from library list" >&4
6864 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6865 shift
6866 libs="$*"
6867 echo "libs = $libs" >&4
6868 ;;
6869 esac
6870 ;;
6871*)
6872 usemymalloc='n'
6873 mallocsrc=''
6874 mallocobj=''
6875 d_mymalloc="$undef"
6876 ;;
6877esac
6878
6879: compute the return types of malloc and free
6880echo " "
6881$cat >malloc.c <<END
6882#$i_malloc I_MALLOC
6883#$i_stdlib I_STDLIB
6884#include <stdio.h>
6885#include <sys/types.h>
6886#ifdef I_MALLOC
6887#include <malloc.h>
6888#endif
6889#ifdef I_STDLIB
6890#include <stdlib.h>
6891#endif
6892#ifdef TRY_MALLOC
6893void *malloc();
6894#endif
6895#ifdef TRY_FREE
6896void free();
6897#endif
6898END
6899case "$malloctype" in
6900'')
6901 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6902 malloctype='void *'
6903 else
6904 malloctype='char *'
6905 fi
6906 ;;
6907esac
6908echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6909
6910case "$freetype" in
6911'')
6912 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6913 freetype='void'
6914 else
6915 freetype='int'
6916 fi
6917 ;;
6918esac
6919echo "Your system uses $freetype free(), it would seem." >&4
6920$rm -f malloc.[co]
b4eb6b3d
JH
6921: determine where site specific architecture-dependent libraries go.
6922: sitelib default is /usr/local/lib/perl5/site_perl/$version
6923: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6924: sitelib may have an optional trailing /share.
6925case "$sitearch" in
6926'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6927 dflt="$dflt/$archname"
6928 ;;
6929*) dflt="$sitearch"
6930 ;;
6931esac
6932set sitearch sitearch none
6933eval $prefixit
6934$cat <<EOM
6935
6936The installation process will also create a directory for
6937architecture-dependent site-specific extensions and modules.
6938
6939EOM
6940fn=d~+
6941rp='Pathname for the site-specific architecture-dependent library files?'
6942. ./getfile
79522dd2
NC
6943prefixvar=sitearch
6944. ./setprefixvar
c95d0e17
GA
6945if $test X"$sitearch" = X"$sitelib"; then
6946 d_sitearch="$undef"
6947else
6948 d_sitearch="$define"
6949fi
b4eb6b3d 6950
613d6c3e 6951: Set the vendorprefix variables
b4eb6b3d
JH
6952$cat <<EOM
6953
6954The installation process will also create a directory for
6955vendor-supplied add-ons. Vendors who supply perl with their system
6956may find it convenient to place all vendor-supplied files in this
6957directory rather than in the main distribution directory. This will
6958ease upgrades between binary-compatible maintenance versions of perl.
6959
6960Of course you may also use these directories in whatever way you see
6961fit. For example, you might use them to access modules shared over a
6962company-wide network.
6963
6964The default answer should be fine for most people.
6965This causes further questions about vendor add-ons to be skipped
6966and no vendor-specific directories will be configured for perl.
6967
6968EOM
6969rp='Do you want to configure vendor-specific add-on directories?'
6970case "$usevendorprefix" in
6971define|true|[yY]*) dflt=y ;;
6972*) : User may have set vendorprefix directly on Configure command line.
6973 case "$vendorprefix" in
6974 ''|' ') dflt=n ;;
6975 *) dflt=y ;;
6976 esac
6977 ;;
6978esac
6979. ./myread
6980case "$ans" in
6981[yY]*) fn=d~+
6982 rp='Installation prefix to use for vendor-supplied add-ons?'
6983 case "$vendorprefix" in
6984 '') dflt='' ;;
6985 *) dflt=$vendorprefix ;;
6986 esac
6987 . ./getfile
6988 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6989 oldvendorprefix=''
6990 case "$vendorprefix" in
6991 '') ;;
6992 *) case "$ans" in
6993 "$prefix") ;;
6994 *) oldvendorprefix="$prefix";;
6995 esac
6996 ;;
6997 esac
6998 usevendorprefix="$define"
6999 vendorprefix="$ans"
7000 vendorprefixexp="$ansexp"
7001 ;;
7002*) usevendorprefix="$undef"
7003 vendorprefix=''
7004 vendorprefixexp=''
7005 ;;
7006esac
7007
613d6c3e 7008: Set the vendorlib variables
b4eb6b3d
JH
7009case "$vendorprefix" in
7010'') d_vendorlib="$undef"
7011 vendorlib=''
7012 vendorlibexp=''
7013 ;;
7014*) d_vendorlib="$define"
7015 : determine where vendor-supplied modules go.
7016 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7017 case "$vendorlib" in
7018 '')
7019 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7020 case "$installstyle" in
7021 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7022 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7023 esac
7024 ;;
7025 *) dflt="$vendorlib"
7026 ;;
7027 esac
7028 fn=d~+
7029 rp='Pathname for the vendor-supplied library files?'
7030 . ./getfile
7031 vendorlib="$ans"
7032 vendorlibexp="$ansexp"
7033 ;;
7034esac
7035vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
7036prefixvar=vendorlib
7037. ./installprefix
b4eb6b3d 7038
613d6c3e 7039: Set the vendorarch variables
b4eb6b3d
JH
7040case "$vendorprefix" in
7041'') d_vendorarch="$undef"
7042 vendorarch=''
7043 vendorarchexp=''
7044 ;;
7045*) d_vendorarch="$define"
7046 : determine where vendor-supplied architecture-dependent libraries go.
7047 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7048 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7049 : vendorlib may have an optional trailing /share.
7050 case "$vendorarch" in
7051 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7052 dflt="$dflt/$archname"
7053 ;;
7054 *) dflt="$vendorarch" ;;
7055 esac
7056 fn=d~+
7057 rp='Pathname for vendor-supplied architecture-dependent files?'
7058 . ./getfile
7059 vendorarch="$ans"
7060 vendorarchexp="$ansexp"
7061 ;;
7062esac
a092d240
NC
7063prefixvar=vendorarch
7064. ./installprefix
1be1b388
MB
7065if $test X"$vendorarch" = X"$vendorlib"; then
7066 d_vendorarch="$undef"
7067else
7068 d_vendorarch="$define"
7069fi
b4eb6b3d
JH
7070
7071: Final catch-all directories to search
7072$cat <<EOM
7073
7074Lastly, you can have perl look in other directories for extensions and
7075modules in addition to those already specified.
7076These directories will be searched after
7077 $sitearch
7078 $sitelib
7079EOM
7080test X"$vendorlib" != "X" && echo ' ' $vendorlib
7081test X"$vendorarch" != "X" && echo ' ' $vendorarch
7082echo ' '
7083case "$otherlibdirs" in
7084''|' ') dflt='none' ;;
7085*) dflt="$otherlibdirs" ;;
7086esac
7087$cat <<EOM
7088Enter a colon-separated set of extra paths to include in perl's @INC
7089search path, or enter 'none' for no extra paths.
7090
7091EOM
7092
7093rp='Colon-separated list of additional directories for perl to search?'
7094. ./myread
7095case "$ans" in
7096' '|''|none) otherlibdirs=' ' ;;
7097*) otherlibdirs="$ans" ;;
7098esac
7099case "$otherlibdirs" in
7100' ') val=$undef ;;
7101*) val=$define ;;
7102esac
7103set d_perl_otherlibdirs
7104eval $setvar
7105
7106: Cruising for prototypes
7107echo " "
7108echo "Checking out function prototypes..." >&4
55954f19
JH
7109$cat >prototype.c <<EOCP
7110#$i_stdlib I_STDLIB
7111#ifdef I_STDLIB
7112#include <stdlib.h>
7113#endif
b4eb6b3d
JH
7114int main(int argc, char *argv[]) {
7115 exit(0);}
7116EOCP
7117if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7118 echo "Your C compiler appears to support function prototypes."
7119 val="$define"
7120else
7121 echo "Your C compiler doesn't seem to understand function prototypes."
7122 val="$undef"
7123fi
7124set prototype
7125eval $setvar
7126$rm -f prototype*
7127
613d6c3e 7128: Check if ansi2knr is required
b4eb6b3d
JH
7129case "$prototype" in
7130"$define") ;;
7131*) ansi2knr='ansi2knr'
7132 echo " "
7133 cat <<EOM >&4
7134
7135$me: FATAL ERROR:
7136This version of $package can only be compiled by a compiler that
7137understands function prototypes. Unfortunately, your C compiler
7138 $cc $ccflags
7139doesn't seem to understand them. Sorry about that.
7140
7141If GNU cc is available for your system, perhaps you could try that instead.
7142
7143Eventually, we hope to support building Perl with pre-ANSI compilers.
7144If you would like to help in that effort, please contact <perlbug@perl.org>.
7145
7146Aborting Configure now.
7147EOM
7148 exit 2
7149 ;;
7150esac
7151
34f1896b
MB
7152: DTrace support
7153dflt_dtrace='/usr/sbin/dtrace'
6e3b7bfa
MB
7154$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7155
34f1896b
MB
7156cat <<EOM
7157
7158Perl can be built to support DTrace on platforms that support it.
7159DTrace is a diagnosis and performance analysis tool from Sun.
7160
7161If this doesn't make any sense to you, just accept the default '$dflt'.
7162EOM
7163
7164while $test 1 ; do
7165 case "$usedtrace" in
7166 $define|true|[yY]*)
7167 dflt='y'
7168 ;;
7169 ?*)
7170 dflt='y'
7171 dflt_dtrace=$usedtrace
7172 ;;
7173 *)
7174 dflt='n'
7175 ;;
7176 esac
7177
7178 rp='Support DTrace if available?'
7179 . ./myread
7180 case "$ans" in
7181 y|Y) val="$define" ;;
7182 *) val="$undef" ;;
7183 esac
7184 set usedtrace
7185 eval $setvar
7186
7187 test "X$usedtrace" != "X$define" && break
7188
7189 echo " "
7190 rp='Where is the dtrace executable?'
7191 dflt=$dflt_dtrace
7192 . ./getfile
7193 val="$ans"
7194 set dtrace
7195 eval $setvar
7196
7197 if $test -f $dtrace
7198 then
7199 if $dtrace -h -s ../perldtrace.d \
7200 -o perldtrace.tmp >/dev/null 2>&1 \
7201 && rm -f perldtrace.tmp
7202 then
7203 echo " "
7204 echo "Good: your $dtrace knows about the -h flag."
7205 else
7206 cat >&2 <<EOM
7207
7208*** $me: Fatal Error: $dtrace doesn't support -h flag
7209***
7210*** Your installed dtrace doesn't support the -h switch to compile a D
7211*** program into a C header. Can't continue.
7212
7213EOM
7214 exit 1
7215 fi
7216 break;
7217 fi
7218
7219 case "$fastread" in
7220 yes)
7221 cat >&2 <<EOM
7222
7223*** $me: Fatal Error: $dtrace not found.
7224*** Can't continue.
7225
7226EOM
7227 exit 1
7228 ;;
7229 *)
7230 echo "*** $dtrace was not found."
7231 echo " "
7232 ;;
7233 esac
7234done
7235
613d6c3e 7236: See if we want extra modules installed
6fcddf3b 7237echo " "
6fcddf3b 7238case "$extras" in
bf35c3f6
JH
7239'') dflt='n';;
7240*) dflt='y';;
6fcddf3b
JH
7241esac
7242cat <<EOM
7243Perl can be built with extra modules or bundles of modules which
7244will be fetched from the CPAN and installed alongside Perl.
7245
7246Notice that you will need access to the CPAN; either via the Internet,
7247or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7248be asked later to configure the CPAN.pm module which will in turn do
7249the installation of the rest of the extra modules or bundles.)
7250
7251Notice also that if the modules require any external software such as
dd2de242
JH
7252libraries and headers (the libz library and the zlib.h header for the
7253Compress::Zlib module, for example) you MUST have any such software
7254already installed, this configuration process will NOT install such
7255things for you.
6fcddf3b
JH
7256
7257If this doesn't make any sense to you, just accept the default '$dflt'.
7258EOM
dd2de242 7259rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7260. ./myread
7261case "$ans" in
7262y|Y)
7263 cat <<EOM
7264
7265Please list any extra modules or bundles to be installed from CPAN,
7266with spaces between the names. The names can be in any format the
dd2de242
JH
7267'install' command of CPAN.pm will understand. (Answer 'none',
7268without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7269EOM
7270 rp='Extras?'
7271 dflt="$extras"
7272 . ./myread
7273 extras="$ans"
7274esac
7275case "$extras" in
7276''|'none')
7277 val=''
7278 $rm -f ../extras.lst
7279 ;;
7280*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7281 echo "$extras" > ../extras.lst
7282 val="'$extras'"
6fcddf3b
JH
7283 ;;
7284esac
7285set extras
7286eval $setvar
7287echo " "
7288
6e1038e0
MB
7289: determine where html pages for programs go
7290set html1dir html1dir none
7291eval $prefixit
7292$cat <<EOM
7293
f3f1a2d8 7294If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7295the appropriate directory here. To skip installing html files,
7296answer "none".
7297EOM
7298case "$html1dir" in
7299''|none|$undef|' ') dflt=none ;;
7300*) dflt=$html1dir ;;
7301esac
7302fn=dn+~
7303rp="Directory for the main $spackage html pages?"
7304. ./getfile
79522dd2
NC
7305prefixvar=html1dir
7306. ./setprefixvar
6e1038e0
MB
7307: Use ' ' for none so value is preserved next time through Configure
7308$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7309
7310: determine where html pages for libraries and modules go
7311set html3dir html3dir none
7312eval $prefixit
7313$cat <<EOM
7314
7315If you wish to install html files for modules associated with $spackage,
7316indicate the appropriate directory here. To skip installing html files,
7317answer "none".
7318EOM
7319: There is no obvious default. If they have specified html1dir, then
7320: try to key off that, possibly changing .../html1 into .../html3.
7321case "$html3dir" in
7322'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7323*) dflt=$html3dir ;;
7324esac
7325fn=dn+~
7326rp="Directory for the $spackage module html pages?"
7327. ./getfile
79522dd2
NC
7328prefixvar=html3dir
7329. ./setprefixvar
6e1038e0
MB
7330: Use ' ' for none so value is preserved next time through Configure
7331$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7332
89ce900e
JH
7333: determine whether to install perl also as /usr/bin/perl
7334
7335echo " "
7336if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7337 $cat <<EOM
7338Many scripts expect perl to be installed as /usr/bin/perl.
7339
7340If you want to, I can install the perl you are about to compile
7341as /usr/bin/perl (in addition to $bin/perl).
7342EOM
7343 if test -f /usr/bin/perl; then
7344 $cat <<EOM
7345
7346However, please note that because you already have a /usr/bin/perl,
7347overwriting that with a new Perl would very probably cause problems.
7348Therefore I'm assuming you don't want to do that (unless you insist).
7349
7350EOM
7351 case "$installusrbinperl" in
7352 "$define"|[yY]*) dflt='y';;
7353 *) dflt='n';;
7354 esac
7355 else
7356 $cat <<EOM
7357
7358Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7359
7360EOM
7361 case "$installusrbinperl" in
7362 "$undef"|[nN]*) dflt='n';;
7363 *) dflt='y';;
7364 esac
7365 fi
7366 rp="Do you want to install perl as /usr/bin/perl?"
7367 . ./myread
7368 case "$ans" in
7369 [yY]*) val="$define";;
7370 *) val="$undef" ;;
7371 esac
7372else
7373 val="$undef"
7374fi
7375set installusrbinperl
7376eval $setvar
7377
613d6c3e 7378: Check if we are using the GNU C library
89ce900e
JH
7379echo " "
7380echo "Checking for GNU C Library..." >&4
7381cat >try.c <<'EOCP'
7382/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7383 alone are insufficient to distinguish different versions, such as
7384 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7385 libc version 2.1.0. A. Dougherty, June 3, 2002.
7386*/
7387#include <stdio.h>
7388int main(void)
7389{
7390#ifdef __GLIBC__
7391# ifdef __GLIBC_MINOR__
4fb7dc7d 7392# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7393# include <gnu/libc-version.h>
7394 printf("%s\n", gnu_get_libc_version());
7395# else
7396 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7397# endif
7398# else
7399 printf("%d\n", __GLIBC__);
7400# endif
7401 return 0;
7402#else
7403 return 1;
7404#endif
7405}
7406EOCP
7407set try
7408if eval $compile_ok && $run ./try > glibc.ver; then
7409 val="$define"
7410 gnulibc_version=`$cat glibc.ver`
7411 echo "You are using the GNU C Library version $gnulibc_version"
7412else
7413 val="$undef"
7414 gnulibc_version=''
7415 echo "You are not using the GNU C Library"
7416fi
5b813a60 7417$rm_try glibc.ver
89ce900e
JH
7418set d_gnulibc
7419eval $setvar
7420
7421: see if nm is to be used to determine whether a symbol is defined or not
7422case "$usenm" in
7423'')
7424 dflt=''
7425 case "$d_gnulibc" in
7426 "$define")
7427 echo " "
7428 echo "nm probably won't work on the GNU C Library." >&4
7429 dflt=n
7430 ;;
7431 esac
7432 case "$dflt" in
7433 '')
7434 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7435 echo " "
7436 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7437 echo "'nm' won't be sufficient on this sytem." >&4
7438 dflt=n
7439 fi
7440 ;;
7441 esac
7442 case "$dflt" in
7443 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7444 if $test $dflt -gt 20; then
7445 dflt=y
7446 else
7447 dflt=n
7448 fi
7449 ;;
7450 esac
b4eb6b3d 7451 ;;
89ce900e
JH
7452*)
7453 case "$usenm" in
7454 true|$define) dflt=y;;
7455 *) dflt=n;;
7456 esac
b4eb6b3d
JH
7457 ;;
7458esac
89ce900e 7459$cat <<EOM
b4eb6b3d 7460
89ce900e
JH
7461I can use $nm to extract the symbols from your C libraries. This
7462is a time consuming task which may generate huge output on the disk (up
7463to 3 megabytes) but that should make the symbols extraction faster. The
7464alternative is to skip the 'nm' extraction part and to compile a small
7465test program instead to determine whether each symbol is present. If
7466you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7467this may be the best solution.
b4eb6b3d 7468
89ce900e 7469You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7470
89ce900e
JH
7471EOM
7472rp="Shall I use $nm to extract C symbols from the libraries?"
7473. ./myread
7474case "$ans" in
7475[Nn]*) usenm=false;;
7476*) usenm=true;;
b4eb6b3d 7477esac
89ce900e
JH
7478
7479runnm=$usenm
7480case "$reuseval" in
7481true) runnm=false;;
b4eb6b3d 7482esac
b4eb6b3d 7483
89ce900e
JH
7484: nm options which may be necessary
7485case "$nm_opt" in
7486'') if $test -f /mach_boot; then
7487 nm_opt='' # Mach
7488 elif $test -d /usr/ccs/lib; then
7489 nm_opt='-p' # Solaris (and SunOS?)
7490 elif $test -f /dgux; then
7491 nm_opt='-p' # DG-UX
7492 elif $test -f /lib64/rld; then
7493 nm_opt='-p' # 64-bit Irix
7494 else
7495 nm_opt=''
7496 fi;;
7497esac
b4eb6b3d 7498
89ce900e
JH
7499: nm options which may be necessary for shared libraries but illegal
7500: for archive libraries. Thank you, Linux.
7501case "$nm_so_opt" in
7502'') case "$myuname" in
fb2e1bc0 7503 *linux*|gnu*)
89ce900e
JH
7504 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7505 nm_so_opt='--dynamic'
7506 fi
7507 ;;
7508 esac
7509 ;;
7510esac
b4eb6b3d 7511
1d8eaf8c 7512: Figure out where the libc is located
89ce900e
JH
7513case "$runnm" in
7514true)
1d8eaf8c 7515: get list of predefined functions in a handy place
89ce900e
JH
7516echo " "
7517case "$libc" in
7518'') libc=unknown
7519 case "$libs" in
7520 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7521 esac
7522 ;;
b4eb6b3d 7523esac
89ce900e
JH
7524case "$libs" in
7525'') ;;
7526*) for thislib in $libs; do
7527 case "$thislib" in
7528 -lc|-lc_s)
7529 : Handle C library specially below.
7530 ;;
7531 -l*)
7532 thislib=`echo $thislib | $sed -e 's/^-l//'`
7533 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7534 :
7535 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7536 :
7537 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7538 :
7539 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7540 :
7541 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7542 :
7543 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7544 :
7545 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7546 :
7547 else
7548 try=''
7549 fi
7550 libnames="$libnames $try"
7551 ;;
7552 *) libnames="$libnames $thislib" ;;
7553 esac
7554 done
b4eb6b3d
JH
7555 ;;
7556esac
89ce900e
JH
7557xxx=normal
7558case "$libc" in
7559unknown)
7560 set /lib/libc.$so
7561 for xxx in $libpth; do
7562 $test -r $1 || set $xxx/libc.$so
7563 : The messy sed command sorts on library version numbers.
7564 $test -r $1 || \
7565 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7566 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7567 h
7568 s/[0-9][0-9]*/0000&/g
7569 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7570 G
7571 s/\n/ /' | \
7572 $sort | $sed -e 's/^.* //'`
7573 eval set \$$#
7574 done
7575 $test -r $1 || set /usr/ccs/lib/libc.$so
7576 $test -r $1 || set /lib/libsys_s$_a
7577 ;;
7578*)
7579 set blurfl
7580 ;;
7581esac
7582if $test -r "$1"; then
7583 echo "Your (shared) C library seems to be in $1."
7584 libc="$1"
7585elif $test -r /lib/libc && $test -r /lib/clib; then
7586 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7587 xxx=apollo
7588 libc='/lib/clib /lib/libc'
7589 if $test -r /lib/syslib; then
7590 echo "(Your math library is in /lib/syslib.)"
7591 libc="$libc /lib/syslib"
7592 fi
7593elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7594 echo "Your C library seems to be in $libc, as you said before."
7595elif $test -r $incpath/usr/lib/libc$_a; then
7596 libc=$incpath/usr/lib/libc$_a;
7597 echo "Your C library seems to be in $libc. That's fine."
7598elif $test -r /lib/libc$_a; then
7599 libc=/lib/libc$_a;
7600 echo "Your C library seems to be in $libc. You're normal."
7601else
7602 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7603 :
7604 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7605 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7606 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7607 :
7608 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7609 :
7610 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7611 :
7612 else
7613 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7614 fi
7615 if $test -r "$tans"; then
7616 echo "Your C library seems to be in $tans, of all places."
7617 libc=$tans
7618 else
7619 libc='blurfl'
7620 fi
7621fi
7622if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7623 dflt="$libc"
7624 cat <<EOM
b4eb6b3d 7625
89ce900e
JH
7626If the guess above is wrong (which it might be if you're using a strange
7627compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7628
89ce900e
JH
7629EOM
7630else
7631 dflt=''
7632 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7633 cat >&4 <<EOM
7634I can't seem to find your C library. I've looked in the following places:
5e366f65 7635
b4eb6b3d 7636EOM
89ce900e
JH
7637 $sed 's/^/ /' libpath
7638 cat <<EOM
5e366f65 7639
89ce900e 7640None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7641
7642EOM
89ce900e
JH
7643fi
7644fn=f
7645rp='Where is your C library?'
7646. ./getfile
7647libc="$ans"
5e366f65 7648
89ce900e
JH
7649echo " "
7650echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7651set X `cat libnames`
7652shift
7653xxx=files
7654case $# in 1) xxx=file; esac
7655echo "Extracting names from the following $xxx for later perusal:" >&4
7656echo " "
7657$sed 's/^/ /' libnames >&4
7658echo " "
7659$echo $n "This may take a while...$c" >&4
5e366f65 7660
89ce900e
JH
7661for file in $*; do
7662 case $file in
7663 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7664 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7665 esac
89ce900e
JH
7666done >libc.tmp
7667
7668$echo $n ".$c"
7669$grep fprintf libc.tmp > libc.ptf
7670xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7671xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
9e08e8f0 7672xxx='[ADTSIWi]'
ab900c53 7673if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7674 eval $xscan;\
7675 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7676 eval $xrun
7677elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7678 eval $xscan;\
7679 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7680 eval $xrun
7681elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7682 eval $xscan;\
7683 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7684 eval $xrun
7685elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7686 eval $xscan;\
7687 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7688 eval $xrun
7689elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7690 eval $xscan;\
7691 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7692 eval $xrun
7693elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7694 eval $xscan;\
7695 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7696 eval $xrun
7697elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7698 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7699 eval $xscan;\
7700 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7701 eval $xrun
7702elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7703 eval $xscan;\
7704 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7705 eval $xrun
7706elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7707 eval $xscan;\
7708 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7709 eval $xrun
7710elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7711 eval $xscan;\
7712 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7713 eval $xrun
7714elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7715 eval $xscan;\
7716 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7717 eval $xrun
7718elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7719 eval $xscan;\
7720 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7721 eval $xrun
7722elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7723 eval $xscan;\
7724 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7725 eval $xrun
7726elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7727 eval $xscan;\
7728 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7729 eval $xrun
b4eb6b3d 7730else
89ce900e
JH
7731 $nm -p $* 2>/dev/null >libc.tmp
7732 $grep fprintf libc.tmp > libc.ptf
7733 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7734 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7735 then
7736 nm_opt='-p'
7737 eval $xrun
7738 else
7739 echo " "
7740 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7741 com=''
1d8eaf8c
MB
7742 if $ar t $libc > libc.tmp && \
7743 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7744 then
89ce900e
JH
7745 for thisname in $libnames $libc; do
7746 $ar t $thisname >>libc.tmp
7747 done
7748 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7749 echo "Ok." >&4
7750 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
89ce900e
JH
7751 for thisname in $libnames $libc; do
7752 $ar tv $thisname >>libc.tmp
89ce900e
JH
7753 emximp -o tmp.imp $thisname \
7754 2>/dev/null && \
7755 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7756 < tmp.imp >>libc.tmp
1d8eaf8c 7757 $rm -f tmp.imp
89ce900e
JH
7758 done
7759 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7760 echo "Ok." >&4
7761 else
7762 echo "$ar didn't seem to work right." >&4
7763 echo "Maybe this is a Cray...trying bld instead..." >&4
1d8eaf8c
MB
7764 if bld t $libc | \
7765 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7766 $test -s libc.list
89ce900e
JH
7767 then
7768 for thisname in $libnames; do
7769 bld t $libnames | \
7770 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7771 $ar t $thisname >>libc.tmp
7772 done
7773 echo "Ok." >&4
7774 else
7775 echo "That didn't work either. Giving up." >&4
7776 exit 1
7777 fi
7778 fi
7779 fi
b4eb6b3d 7780fi
89ce900e
JH
7781nm_extract="$com"
7782case "$PASE" in
7783define)
7784 echo " "
7785 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7786 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7787 ;;
7788*) if $test -f /lib/syscalls.exp; then
7789 echo " "
7790 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
1d8eaf8c
MB
7791 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7792 /lib/syscalls.exp >>libc.list
89ce900e
JH
7793 fi
7794 ;;
7795esac
7796;;
7797esac
7798$rm -f libnames libpath
b4eb6b3d
JH
7799
7800: see if dld is available
7801set dld.h i_dld
7802eval $inhdr
7803
613d6c3e 7804: Check if we are using C++
43dddb59
MB
7805echo " "
7806echo "Checking for C++..." >&4
20e87299 7807$cat >try.c <<'EOCP'
43dddb59
MB
7808#include <stdio.h>
7809int main(void)
7810{
7811#ifdef __cplusplus
20e87299 7812 return 0;
43dddb59 7813#else
20e87299 7814 return 1;
43dddb59 7815#endif
43dddb59
MB
7816}
7817EOCP
7818set try
20e87299
AD
7819if eval $compile_ok && $run ./try; then
7820 val="$define"
43dddb59
MB
7821 echo "You are using a C++ compiler."
7822else
7823 val="$undef"
7824 echo "You are not using a C++ compiler."
7825fi
5b813a60 7826$rm_try cplusplus$$
43dddb59
MB
7827set d_cplusplus
7828eval $setvar
7829
89ce900e
JH
7830: is a C symbol defined?
7831csym='tlook=$1;
7832case "$3" in
373dfab3
JH
7833-v) tf=libc.tmp; tdc="";;
7834-a) tf=libc.tmp; tdc="[]";;
7835*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e 7836esac;
61c26d18
MHM
7837case "$d_cplusplus" in
7838 $define) extern_C="extern \"C\"" ;;
7839 *) extern_C="extern" ;;
7840esac;
89ce900e
JH
7841tx=yes;
7842case "$reuseval-$4" in
7843true-) ;;
7844true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7845esac;
7846case "$tx" in
7847yes)
43dddb59 7848 tval=false;
5129fff4
JH
7849 if $test "$runnm" = true; then
7850 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7851 tval=true;
5129fff4 7852 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
61c26d18 7853 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7854 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7855 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7856 $rm_try;
89ce900e 7857 fi;
5129fff4 7858 else
61c26d18 7859 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7860 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5b813a60 7861 $rm_try;
ab900c53
AB
7862 fi;
7863 ;;
89ce900e
JH
7864*)
7865 case "$tval" in
7866 $define) tval=true;;
7867 *) tval=false;;
ab900c53
AB
7868 esac;
7869 ;;
89ce900e
JH
7870esac;
7871eval "$2=$tval"'
7872
7873: define an is-in-libc? function
7874inlibc='echo " "; td=$define; tu=$undef;
7875sym=$1; var=$2; eval "was=\$$2";
7876tx=yes;
7877case "$reuseval$was" in
7878true) ;;
7879true*) tx=no;;
7880esac;
7881case "$tx" in
7882yes)
7883 set $sym tres -f;
7884 eval $csym;
7885 case "$tres" in
7886 true)
7887 echo "$sym() found." >&4;
7888 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7889 *)
7890 echo "$sym() NOT found." >&4;
7891 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7892 esac;;
7893*)
7894 case "$was" in
7895 $define) echo "$sym() found." >&4;;
7896 *) echo "$sym() NOT found." >&4;;
7897 esac;;
7898esac'
7899
b4eb6b3d
JH
7900: see if dlopen exists
7901xxx_runnm="$runnm"
666ea192 7902xxx_ccflags="$ccflags"
b4eb6b3d 7903runnm=false
666ea192
JH
7904: with g++ one needs -shared to get is-in-libc to work for dlopen
7905case "$gccversion" in
7906'') ;;
7907*) case "$d_cplusplus" in
7908 "$define") ccflags="$ccflags -shared" ;;
7909 esac
7910 ;;
7911esac
b4eb6b3d
JH
7912set dlopen d_dlopen
7913eval $inlibc
7914runnm="$xxx_runnm"
666ea192 7915ccflags="$xxx_ccflags"
b4eb6b3d 7916
4fb7dc7d
JH
7917: see if this is a unistd.h system
7918set unistd.h i_unistd
7919eval $inhdr
7920
b4eb6b3d
JH
7921: determine which dynamic loading, if any, to compile in
7922echo " "
7923dldir="ext/DynaLoader"
7924case "$usedl" in
7925$define|y|true)
7926 dflt='y'
7927 usedl="$define"
7928 ;;
7929$undef|n|false)
7930 dflt='n'
7931 usedl="$undef"
7932 ;;
5b813a60 7933*)
b4eb6b3d
JH
7934 dflt='n'
7935 case "$d_dlopen" in
7936 $define) dflt='y' ;;
7937 esac
7938 case "$i_dld" in
7939 $define) dflt='y' ;;
7940 esac
7941 : Does a dl_xxx.xs file exist for this operating system
7942 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7943 ;;
7944esac
7945rp="Do you wish to use dynamic loading?"
7946. ./myread
7947usedl="$ans"
f1ce3bf1 7948bin_ELF="$undef"
b4eb6b3d
JH
7949case "$ans" in
7950y*) usedl="$define"
7951 case "$dlsrc" in
7952 '')
7953 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7954 dflt="$dldir/dl_${osname}.xs"
7955 elif $test "$d_dlopen" = "$define" ; then
7956 dflt="$dldir/dl_dlopen.xs"
7957 elif $test "$i_dld" = "$define" ; then
7958 dflt="$dldir/dl_dld.xs"
7959 else
7960 dflt=''
7961 fi
7962 ;;
7963 *) dflt="$dldir/$dlsrc"
7964 ;;
7965 esac
7966 echo "The following dynamic loading files are available:"
7967 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7968 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7969 rp="Source file to use for dynamic loading"
7970 fn="fne"
7971 gfpth="$src"
7972 . ./getfile
7973 usedl="$define"
7974 : emulate basename
7975 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7976
7977 $cat << EOM
7978
7979Some systems may require passing special flags to $cc -c to
7980compile modules that will be used to create a shared library.
7981To use no flags, say "none".
7982
7983EOM
7984 case "$cccdlflags" in
7985 '') case "$gccversion" in
7986 '') case "$osname" in
7987 hpux) dflt='+z' ;;
7988 next) dflt='none' ;;
7989 irix*) dflt='-KPIC' ;;
48bcfe03 7990 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7991 sunos) dflt='-pic' ;;
7992 *) dflt='none' ;;
7993 esac
7994 ;;
7995 *) case "$osname" in
b6cc0f4c 7996 darwin) dflt='none' ;;
15fcae63 7997 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7998 *) dflt='-fpic' ;;
7999 esac ;;
8000 esac ;;
8001 ' ') dflt='none' ;;
8002 *) dflt="$cccdlflags" ;;
8003 esac
8004 rp="Any special flags to pass to $cc -c to compile shared library modules?"
8005 . ./myread
8006 case "$ans" in
8007 none) cccdlflags=' ' ;;
8008 *) cccdlflags="$ans" ;;
8009 esac
8010
8011 cat << EOM
8012
8013Some systems use ld to create libraries that can be dynamically loaded,
8014while other systems (such as those using ELF) use $cc.
8015
8016EOM
8017 case "$ld" in
55954f19 8018 '') $cat >try.c <<EOM
b4eb6b3d
JH
8019/* Test for whether ELF binaries are produced */
8020#include <fcntl.h>
55954f19
JH
8021#$i_stdlib I_STDLIB
8022#ifdef I_STDLIB
b4eb6b3d 8023#include <stdlib.h>
55954f19 8024#endif
4fb7dc7d
JH
8025#$i_unistd I_UNISTD
8026#ifdef I_UNISTD
8027#include <unistd.h>
8028#endif
b4eb6b3d
JH
8029int main() {
8030 char b[4];
8031 int i = open("a.out",O_RDONLY);
5b813a60 8032 if(i == -1)
b4eb6b3d
JH
8033 exit(1); /* fail */
8034 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8035 exit(0); /* succeed (yes, it's ELF) */
8036 else
8037 exit(1); /* fail */
8038}
8039EOM
5440bc8e 8040 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
8041 cat <<EOM
8042You appear to have ELF support. I'll use $cc to build dynamic libraries.
8043EOM
8044 dflt="$cc"
f1ce3bf1 8045 bin_ELF="$define"
b4eb6b3d
JH
8046 else
8047 echo "I'll use ld to build dynamic libraries."
8048 dflt='ld'
8049 fi
5b813a60 8050 $rm_try
b4eb6b3d
JH
8051 ;;
8052 *) dflt="$ld"
8053 ;;
8054 esac
8055
8056 rp="What command should be used to create dynamic libraries?"
8057 . ./myread
8058 ld="$ans"
8059
8060 cat << EOM
8061
8062Some systems may require passing special flags to $ld to create a
8063library that can be dynamically loaded. If your ld flags include
8064-L/other/path options to locate libraries outside your loader's normal
8065search path, you may need to specify those -L options here as well. To
8066use no flags, say "none".
8067
8068EOM
8069 case "$lddlflags" in
8070 '') case "$osname" in
8071 beos) dflt='-nostart' ;;
df00ff3b 8072 haiku) dflt='-shared' ;;
b4eb6b3d
JH
8073 hpux) dflt='-b';
8074 case "$gccversion" in
8075 '') dflt="$dflt +vnocompatwarnings" ;;
8076 esac
5b813a60 8077 ;;
15fcae63 8078 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
8079 next) dflt='none' ;;
8080 solaris) dflt='-G' ;;
8081 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 8082 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
8083 *) dflt='none' ;;
8084 esac
8085 ;;
8086 *) dflt="$lddlflags" ;;
8087 esac
8088
8089 : Try to guess additional flags to pick up local libraries.
8090 : Be careful not to append to a plain 'none'
8091 case "$dflt" in
8092 none) dflt='' ;;
8093 esac
8094 for thisflag in $ldflags; do
8095 case "$thisflag" in
b5b9f165 8096 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
8097 case " $dflt " in
8098 *" $thisflag "*) ;;
8099 *) dflt="$dflt $thisflag" ;;
8100 esac
8101 ;;
8102 esac
8103 done
8104
8105 case "$dflt" in
8106 ''|' ') dflt='none' ;;
8107 esac
8108
8f68b0e6
AD
8109 case "$ldflags" in
8110 *-fstack-protector*)
8111 case "$dflt" in
8112 *-fstack-protector*) ;; # Don't add it again
8113 *) dflt="$dflt -fstack-protector" ;;
8114 esac
8115 ;;
8116 esac
8117
8118
b4eb6b3d
JH
8119 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8120 . ./myread
8121 case "$ans" in
8122 none) lddlflags=' ' ;;
8123 *) lddlflags="$ans" ;;
8124 esac
8125
8126 cat <<EOM
8127
8128Some systems may require passing special flags to $cc to indicate that
8129the resulting executable will use dynamic linking. To use no flags,
8130say "none".
8131
8132EOM
8133 case "$ccdlflags" in
8134 '') case "$osname" in
fb2e1bc0 8135 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
8136 next|sunos) dflt='none' ;;
8137 *) dflt='none' ;;
b4eb6b3d
JH
8138 esac ;;
8139 ' ') dflt='none' ;;
8140 *) dflt="$ccdlflags" ;;
8141 esac
8142 rp="Any special flags to pass to $cc to use dynamic linking?"
8143 . ./myread
8144 case "$ans" in
8145 none) ccdlflags=' ' ;;
8146 *) ccdlflags="$ans" ;;
8147 esac
8148 ;;
8149*) usedl="$undef"
8150 ld='ld'
8151 dlsrc='dl_none.xs'
8152 lddlflags=''
8153 ccdlflags=''
8154 ;;
8155esac
8156
34f1896b 8157: Do we want a shared libperl?
b4eb6b3d
JH
8158also=''
8159case "$usedl" in
8160$undef)
8161 # No dynamic loading being used, so don't bother even to prompt.
8162 useshrplib='false'
8163 ;;
8164*) case "$useshrplib" in
8165 '') case "$osname" in
df00ff3b 8166 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
b4eb6b3d
JH
8167 dflt=y
8168 also='Building a shared libperl is required for dynamic loading to work on your system.'
8169 ;;
8170 next*)
8171 case "$osvers" in
8172 4*) dflt=y
8173 also='Building a shared libperl is needed for MAB support.'
8174 ;;
8175 *) dflt=n
8176 ;;
8177 esac
8178 ;;
8179 *) dflt=n
8180 ;;
8181 esac
8182 ;;
8183 $define|true|[Yy]*)
8184 dflt=y
8185 ;;
8186 *) dflt=n
8187 ;;
8188 esac
8189 $cat << EOM
8190
8191The perl executable is normally obtained by linking perlmain.c with
8192libperl${_a}, any static extensions (usually just DynaLoader), and
8193any other libraries needed on this system (such as -lm, etc.). Since
8194your system supports dynamic loading, it is probably possible to build
8195a shared libperl.$so. If you will have more than one executable linked
8196to libperl.$so, this will significantly reduce the size of each
5cadb3f3 8197executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
8198default is probably sensible for your system.
8199$also
8200
8201EOM
8202 rp="Build a shared libperl.$so (y/n)"
8203 . ./myread
8204 case "$ans" in
8205 true|$define|[Yy]*)
8206 useshrplib='true' ;;
8207 *) useshrplib='false' ;;
8208 esac
8209 ;;
8210esac
8211
8212case "$useshrplib" in
8213true)
df31f9b1
MB
8214 case "$userelocatableinc" in
8215 true|define)
8216 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8217 echo "See INSTALL for an explanation why that won't work." >&4
8218 exit 4
8219 ;;
8220 esac
b4eb6b3d
JH
8221 case "$libperl" in
8222 '')
8223 # Figure out a good name for libperl.so. Since it gets stored in
8224 # a version-specific architecture-dependent library, the version
8225 # number isn't really that important, except for making cc/ld happy.
8226 #
56e771c1 8227 # A name such as libperl.so.10.1
b4eb6b3d 8228 majmin="libperl.$so.$patchlevel.$subversion"
56e771c1 8229 # A name such as libperl.so.100
b4eb6b3d
JH
8230 majonly=`echo $patchlevel $subversion |
8231 $awk '{printf "%d%02d", $1, $2}'`
8232 majonly=libperl.$so.$majonly
8233 # I'd prefer to keep the os-specific stuff here to a minimum, and
8234 # rely on figuring it out from the naming of libc.
8235 case "${osname}${osvers}" in
8236 next4*)
8237 dflt=libperl.5.$so
8238 # XXX How handle the --version stuff for MAB?
8239 ;;
fb2e1bc0 8240 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8241 dflt=libperl.$so
8242 ;;
56e771c1
RU
8243 cygwin*) # ld links now against the dll directly
8244 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8245 majonly=`echo $patchlevel $subversion |
8246 $awk '{printf "%03d%03d", $1, $2}'`
8247 majonly=cygperl5.$majonly.$so
8248 dflt=$majmin
b4eb6b3d
JH
8249 ;;
8250 *) # Try to guess based on whether libc has major.minor.
8251 case "$libc" in
8252 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8253 *libc.$so.[0-9]*) dflt=$majonly ;;
8254 *) dflt=libperl.$so ;;
8255 esac
8256 ;;
8257 esac
8258 ;;
8259 *) dflt=$libperl
8260 ;;
8261 esac
8262 cat << EOM
8263
8264I need to select a good name for the shared libperl. If your system uses
8265library names with major and minor numbers, then you might want something
8266like $majmin. Alternatively, if your system uses a single version
8267number for shared libraries, then you might want to use $majonly.
8268Or, your system might be quite happy with a simple libperl.$so.
8269
8270Since the shared libperl will get installed into a version-specific
8271architecture-dependent directory, the version number of the shared perl
8272library probably isn't important, so the default should be o.k.
8273
8274EOM
8275 rp='What name do you want to give to the shared libperl?'
8276 . ./myread
8277 libperl=$ans
8278 echo "Ok, I'll use $libperl"
8279 ;;
8280*)
8281 libperl="libperl${_a}"
8282 ;;
8283esac
8284
8285# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8286case "$shrpdir" in
8287'') ;;
8288*) $cat >&4 <<EOM
8289WARNING: Use of the shrpdir variable for the installation location of
8290the shared $libperl is not supported. It was never documented and
8291will not work in this version. Let me (perlbug@perl.org)
8292know of any problems this may cause.
8293
8294EOM
8295 case "$shrpdir" in
8296 "$archlibexp/CORE")
8297 $cat >&4 <<EOM
8298But your current setting of $shrpdir is
8299the default anyway, so it's harmless.
8300EOM
8301 ;;
8302 *)
8303 $cat >&4 <<EOM
8304Further, your current attempted setting of $shrpdir
8305conflicts with the value of $archlibexp/CORE
8306that installperl will use.
8307EOM
8308 ;;
8309 esac
8310 ;;
8311esac
8312
8313# How will the perl executable find the installed shared $libperl?
8314# Add $xxx to ccdlflags.
8315# If we can't figure out a command-line option, use $shrpenv to
8316# set env LD_RUN_PATH. The main perl makefile uses this.
8317shrpdir=$archlibexp/CORE
8318xxx=''
8319tmp_shrpenv=''
8320if "$useshrplib"; then
34f1896b 8321 case "$osname" in
b4eb6b3d
JH
8322 aix)
8323 # We'll set it in Makefile.SH...
8324 ;;
b5b9f165 8325 solaris)
b4eb6b3d
JH
8326 xxx="-R $shrpdir"
8327 ;;
a774dfe6 8328 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8329 xxx="-Wl,-R$shrpdir"
8330 ;;
fb2e1bc0 8331 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8332 xxx="-Wl,-rpath,$shrpdir"
8333 ;;
8334 next)
8335 # next doesn't like the default...
8336 ;;
8337 beos)
8338 # beos doesn't like the default, either.
8339 ;;
df00ff3b
IW
8340 haiku)
8341 # Haiku doesn't like the default, either.
8342 ;;
b4eb6b3d
JH
8343 hpux*)
8344 # hpux doesn't like the default, either.
8345 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8346 ;;
56e771c1
RU
8347 cygwin)
8348 # cygwin needs only ldlibpth
8349 ;;
b4eb6b3d
JH
8350 *)
8351 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8352 ;;
8353 esac
8354 case "$xxx" in
8355 '') ;;
34f1896b 8356 *)
b4eb6b3d
JH
8357 # Only add $xxx if it isn't already in ccdlflags.
8358 case " $ccdlflags " in
8359 *" $xxx "*) ;;
8360 *) ccdlflags="$ccdlflags $xxx"
8361 cat <<EOM >&4
8362
8363Adding $xxx to the flags
34f1896b 8364passed to $ld so that the perl executable will find the
b4eb6b3d
JH
8365installed shared $libperl.
8366
8367EOM
8368 ;;
8369 esac
8370 ;;
8371 esac
8372fi
8373# Fix ccdlflags in AIX for building external extensions.
8374# (For building Perl itself bare -bE:perl.exp is needed,
8375# Makefile.SH takes care of this.)
8376case "$osname" in
8377aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8378esac
8379# Respect a hint or command-line value.
8380case "$shrpenv" in
8381'') shrpenv="$tmp_shrpenv" ;;
8382esac
8383case "$ldlibpthname" in
8384'') ldlibpthname=LD_LIBRARY_PATH ;;
8385none) ldlibpthname='' ;;
8386esac
8387
8388: determine where manual pages are on this system
8389echo " "
8390case "$sysman" in
8391'')
4a0a3829
SD
8392 syspath='/usr/share/man/man1 /usr/man/man1'
8393 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8394 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8395 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8396 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8397 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8398 sysman=`./loc . /usr/man/man1 $syspath`
8399 ;;
8400esac
8401if $test -d "$sysman"; then
8402 echo "System manual is in $sysman." >&4
8403else
8404 echo "Could not find manual pages in source form." >&4
8405fi
8406
8407: determine where manual pages go
8408set man1dir man1dir none
8409eval $prefixit
8410$cat <<EOM
8411
8412$spackage has manual pages available in source form.
8413EOM
8414case "$nroff" in
8415nroff)
8416 echo "However, you don't have nroff, so they're probably useless to you."
8417 case "$man1dir" in
8418 '') man1dir="none";;
8419 esac;;
8420esac
8421echo "If you don't want the manual sources installed, answer 'none'."
8422case "$man1dir" in
8423' ') dflt=none
8424 ;;
8425'')
4a0a3829
SD
8426 lookpath="$prefixexp/share/man/man1"
8427 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8428 lookpath="$lookpath $prefixexp/man/p_man/man1"
8429 lookpath="$lookpath $prefixexp/man/u_man/man1"
8430 lookpath="$lookpath $prefixexp/man/man.1"
8431 case "$sysman" in
8432 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8433 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8434 esac
8435 set dflt
8436 eval $prefixup
8437 ;;
8438*) dflt="$man1dir"
8439 ;;
8440esac
8441echo " "
8442fn=dn+~
8443rp="Where do the main $spackage manual pages (source) go?"
8444. ./getfile
8445if $test "X$man1direxp" != "X$ansexp"; then
8446 installman1dir=''
8447fi
79522dd2
NC
8448prefixvar=man1dir
8449. ./setprefixvar
8450
477140ee
NC
8451case "$man1dir" in
8452'') man1dir=' '
8453 installman1dir='';;
8454esac
b4eb6b3d
JH
8455
8456: What suffix to use on installed man pages
8457
8458case "$man1dir" in
8459' ')
8460 man1ext='0'
8461 ;;
8462*)
8463 rp="What suffix should be used for the main $spackage man pages?"
8464 case "$man1ext" in
8465 '') case "$man1dir" in
8466 *1) dflt=1 ;;
8467 *1p) dflt=1p ;;
8468 *1pm) dflt=1pm ;;
8469 *l) dflt=l;;
8470 *n) dflt=n;;
8471 *o) dflt=o;;
8472 *p) dflt=p;;
8473 *C) dflt=C;;
8474 *L) dflt=L;;
8475 *L1) dflt=L1;;
8476 *) dflt=1;;
8477 esac
8478 ;;
8479 *) dflt="$man1ext";;
8480 esac
8481 . ./myread
8482 man1ext="$ans"
8483 ;;
8484esac
8485
8486: see if we can have long filenames
8487echo " "
8488first=123456789abcdef
8489$rm -f $first
8490if (echo hi >$first) 2>/dev/null; then
8491 if $test -f 123456789abcde; then
8492 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8493 val="$undef"
8494 else
8495 echo 'You can have filenames longer than 14 characters.'>&4
8496 val="$define"
8497 fi
8498else
8499 $cat <<'EOM'
8500You can't have filenames longer than 14 chars.
8501You can't even think about them!
8502EOM
8503 val="$undef"
776a38e3 8504fi
b4eb6b3d
JH
8505set d_flexfnam
8506eval $setvar
8507$rm -rf 123456789abcde*
8508
8509: determine where library module manual pages go
8510set man3dir man3dir none
8511eval $prefixit
8512$cat <<EOM
8513
8514$spackage has manual pages for many of the library modules.
8515EOM
8516
8517case "$nroff" in
8518nroff)
8519 $cat <<'EOM'
8520However, you don't have nroff, so they're probably useless to you.
8521EOM
8522 case "$man3dir" in
8523 '') man3dir="none";;
8524 esac;;
8525esac
8526
8527case "$d_flexfnam" in
8528undef)
8529 $cat <<'EOM'
f3f1a2d8 8530However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8531EOM
8532 case "$man3dir" in
8533 '') man3dir="none";;
8534 esac;;
8535esac
8536
8537echo "If you don't want the manual sources installed, answer 'none'."
8538prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8539case "$man3dir" in
8540'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8541 if $test -d "$privlib/man/man3"; then
8542 cat <<EOM >&4
8543
8544WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8545$privlib/man/man3. This version will suggest a
8546new default of $dflt.
b4eb6b3d
JH
8547EOM
8548 tdflt=$dflt
8549 dflt='n'
8550 rp='Do you wish to preserve the old behavior?(y/n)'
8551 . ./myread
8552 case "$ans" in
8553 y*) dflt="$privlib/man/man3" ;;
8554 *) dflt=$tdflt ;;
8555 esac
8556 fi
8557 ;;
8558*) dflt="$man3dir" ;;
8559esac
8560case "$dflt" in
8561' ') dflt=none ;;
8562esac
8563echo " "
8564fn=dn+~
8565rp="Where do the $package library man pages (source) go?"
8566. ./getfile
79522dd2
NC
8567prefixvar=man3dir
8568. ./setprefixvar
8569
477140ee
NC
8570case "$man3dir" in
8571'') man3dir=' '
8572 installman3dir='';;
8573esac
b4eb6b3d
JH
8574
8575: What suffix to use on installed man pages
8576case "$man3dir" in
8577' ')
8578 man3ext='0'
8579 ;;
8580*)
8581 rp="What suffix should be used for the $package library man pages?"
8582 case "$man3ext" in
8583 '') case "$man3dir" in
8584 *3) dflt=3 ;;
8585 *3p) dflt=3p ;;
8586 *3pm) dflt=3pm ;;
8587 *l) dflt=l;;
8588 *n) dflt=n;;
8589 *o) dflt=o;;
8590 *p) dflt=p;;
8591 *C) dflt=C;;
8592 *L) dflt=L;;
8593 *L3) dflt=L3;;
8594 *) dflt=3;;
8595 esac
8596 ;;
8597 *) dflt="$man3ext";;
8598 esac
8599 . ./myread
8600 man3ext="$ans"
8601 ;;
8602esac
8603
8604: see if we have to deal with yellow pages, now NIS.
0384a54a 8605if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8606 if $test -f /usr/etc/nibindd; then
8607 echo " "
8608 echo "I'm fairly confident you're on a NeXT."
8609 echo " "
8610 rp='Do you get the hosts file via NetInfo?'
8611 dflt=y
8612 case "$hostcat" in
8613 nidump*) ;;
8614 '') ;;
8615 *) dflt=n;;
8616 esac
8617 . ./myread
8618 case "$ans" in
8619 y*) hostcat='nidump hosts .';;
8620 *) case "$hostcat" in
8621 nidump*) hostcat='';;
8622 esac
8623 ;;
8624 esac
8625 fi
8626 case "$hostcat" in
8627 nidump*) ;;
8628 *)
8629 case "$hostcat" in
8630 *ypcat*) dflt=y;;
8631 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8632 dflt=y
8633 else
8634 dflt=n
8635 fi;;
8636 *) dflt=n;;
8637 esac
8638 echo " "
8639 rp='Are you getting the hosts file via yellow pages?'
8640 . ./myread
8641 case "$ans" in
8642 y*) hostcat='ypcat hosts';;
8643 *) hostcat='cat /etc/hosts';;
8644 esac
8645 ;;
8646 esac
8647fi
8648case "$hostcat" in
8649'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8650esac
8651case "$groupcat" in
8652'') test -f /etc/group && groupcat='cat /etc/group';;
8653esac
8654case "$passcat" in
8655'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8656esac
8657
8658: now get the host name
8659echo " "
8660echo "Figuring out host name..." >&4
8661case "$myhostname" in
8662'') cont=true
8663 echo 'Maybe "hostname" will work...'
73614538 8664 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8665 myhostname=$tans
8666 phostname=hostname
8667 cont=''
8668 fi
8669 ;;
8670*) cont='';;
8671esac
8672if $test "$cont"; then
8673 if ./xenix; then
8674 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8675 if tans=`cat /etc/systemid 2>&1` ; then
8676 myhostname=$tans
8677 phostname='cat /etc/systemid'
8678 echo "Whadyaknow. Xenix always was a bit strange..."
8679 cont=''
8680 fi
8681 elif $test -r /etc/systemid; then
8682 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8683 fi
8684fi
8685if $test "$cont"; then
8686 echo 'No, maybe "uuname -l" will work...'
73614538 8687 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8688 myhostname=$tans
8689 phostname='uuname -l'
8690 else
8691 echo 'Strange. Maybe "uname -n" will work...'
73614538 8692 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8693 myhostname=$tans
8694 phostname='uname -n'
8695 else
8696 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8697 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8698 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8699 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8700 else
8701 case "$myhostname" in
8702 '') echo "Does this machine have an identity crisis or something?"
8703 phostname='';;
8704 *)
8705 echo "Well, you said $myhostname before..."
8706 phostname='echo $myhostname';;
8707 esac
8708 fi
8709 fi
8710 fi
8711fi
52a549d0
JH
8712case "$myhostname" in
8713'') myhostname=noname ;;
8714esac
b4eb6b3d
JH
8715: you do not want to know about this
8716set $myhostname
8717myhostname=$1
8718
8719: verify guess
8720if $test "$myhostname" ; then
8721 dflt=y
8722 rp='Your host name appears to be "'$myhostname'".'" Right?"
8723 . ./myread
8724 case "$ans" in
8725 y*) ;;
8726 *) myhostname='';;
8727 esac
8728fi
8729
8730: bad guess or no guess
8731while $test "X$myhostname" = X ; do
8732 dflt=''
8733 rp="Please type the (one word) name of your host:"
8734 . ./myread
8735 myhostname="$ans"
8736done
8737
8738: translate upper to lower if necessary
8739case "$myhostname" in
8740*[A-Z]*)
8741 echo "(Normalizing case in your host name)"
8742 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8743 ;;
8744esac
8745
8746case "$myhostname" in
8747*.*)
8748 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8749 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8750 echo "(Trimming domain name from host name--host name is now $myhostname)"
8751 ;;
8752*) case "$mydomain" in
8753 '')
8754 {
8755 test "X$hostcat" = "Xypcat hosts" &&
8756 ypmatch "$myhostname" hosts 2>/dev/null |\
8757 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8758 $test -s hosts
8759 } || {
8760 test "X$hostcat" != "X" &&
8761 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8762 /[ ]$myhostname[ . ]/p" > hosts
8763 }
8764 tmp_re="[ . ]"
f08cbdd1
PP
8765 if $test -f hosts; then
8766 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8767 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8768 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8769 hosts | $sort | $uniq | \
8770 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8771 case `$echo X$dflt` in
8772 X*\ *) echo "(Several hosts in the database matched hostname)"
8773 dflt=.
8774 ;;
8775 X.) echo "(You do not have fully-qualified names in the hosts database)"
8776 ;;
8777 esac
8778 else
8779 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8780 dflt=.
f08cbdd1 8781 fi
b4eb6b3d
JH
8782 case "$dflt" in
8783 .)
8784 tans=`./loc resolv.conf X /etc /usr/etc`
8785 if $test -f "$tans"; then
8786 echo "(Attempting domain name extraction from $tans)"
8787 dflt=.`$sed -n -e 's/ / /g' \
8788 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
1d40d392 8789 -e 1q 2>/dev/null`
b4eb6b3d
JH
8790 case "$dflt" in
8791 .) dflt=.`$sed -n -e 's/ / /g' \
8792 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
1d40d392 8793 -e 1q 2>/dev/null`
b4eb6b3d
JH
8794 ;;
8795 esac
8796 fi
8797 ;;
8798 esac
8799 case "$dflt" in
8800 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8801 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8802 case "$dflt" in
8803 '') dflt='.';;
8804 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8805 esac
8806 ;;
8807 esac
59c9e5d6
PP
8808 case "$dflt$osname" in
8809 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8810 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8811 ;;
8812 esac
b4eb6b3d
JH
8813 case "$dflt" in
8814 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8815 dflt='.nonet'
b4eb6b3d
JH
8816 ;;
8817 esac
8818 $rm -f hosts
8819 ;;
8820 *) dflt="$mydomain";;
8821 esac;;
8822esac
8823echo " "
8824rp="What is your domain name?"
8825. ./myread
8826tans="$ans"
8827case "$ans" in
8828'') ;;
8829.*) ;;
8830*) tans=".$tans";;
8831esac
8832mydomain="$tans"
8833
8834: translate upper to lower if necessary
8835case "$mydomain" in
8836*[A-Z]*)
8837 echo "(Normalizing case in your domain name)"
8838 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8839 ;;
8840esac
8841
8842: a little sanity check here
8843case "$phostname" in
8844'') ;;
8845*)
8846 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8847 $myhostname$mydomain|$myhostname) ;;
8848 *)
8849 case "$phostname" in
8850 sed*)
8851 echo "(That doesn't agree with your whoami.h file, by the way.)"
8852 ;;
8853 *)
8854 echo "(That doesn't agree with your $phostname command, by the way.)"
8855 ;;
8856 esac
8857 ;;
8858 esac
8859 ;;
8860esac
8861
776a38e3 8862: determine the e-mail address of the user who is running us
b4eb6b3d
JH
8863$cat <<EOM
8864
8865I need to get your e-mail address in Internet format if possible, i.e.
8866something like user@host.domain. Please answer accurately since I have
8867no easy means to double check it. The default value provided below
8868is most probably close to reality but may not be valid from outside
8869your organization...
8870
8871EOM
8872cont=x
8873while test "$cont"; do
8874 case "$cf_email" in
8875 '') dflt="$cf_by@$myhostname$mydomain";;
8876 *) dflt="$cf_email";;
8877 esac
8878 rp='What is your e-mail address?'
8879 . ./myread
8880 cf_email="$ans"
8881 case "$cf_email" in
8882 *@*.*) cont='' ;;
8883 *)
8884 rp='Address does not look like an Internet one. Use it anyway?'
8885 case "$fastread" in
8886 yes) dflt=y ;;
8887 *) dflt=n ;;
8888 esac
8889 . ./myread
8890 case "$ans" in
8891 y*) cont='' ;;
8892 *) echo " " ;;
8893 esac
8894 ;;
8895 esac
8896done
8897
34f1896b 8898: Ask e-mail of administrator
b4eb6b3d
JH
8899$cat <<EOM
8900
8901If you or somebody else will be maintaining perl at your site, please
8902fill in the correct e-mail address here so that they may be contacted
8903if necessary. Currently, the "perlbug" program included with perl
8904will send mail to this address in addition to perlbug@perl.org. You may
8905enter "none" for no administrator.
8906
8907EOM
8908case "$perladmin" in
8909'') dflt="$cf_email";;
8910*) dflt="$perladmin";;
8911esac
8912rp='Perl administrator e-mail address'
8913. ./myread
8914perladmin="$ans"
8915
674912d7
RB
8916: determine whether to only install version-specific parts.
8917echo " "
8918$cat <<EOM
8919Do you want to install only the version-specific parts of the perl
8920distribution? Usually you do *not* want to do this.
8921EOM
8922case "$versiononly" in
8923"$define"|[Yy]*|true) dflt='y' ;;
8924*) dflt='n';
8925esac
8926rp="Do you want to install only the version-specific parts of perl?"
8927. ./myread
8928case "$ans" in
8929[yY]*) val="$define";;
8930*) val="$undef" ;;
8931esac
8932set versiononly
8933eval $setvar
8934
ad493445
MB
8935case "$versiononly" in
8936"$define") inc_version_list=''
8937 inc_version_list_init=0
8938 ;;
8939esac
8940
b4eb6b3d 8941: figure out how to guarantee perl startup
d0e36aa9 8942: XXX Note that this currently takes advantage of the bug that binexp ignores
a2d23ec2
MB
8943: the Configure -Dinstallprefix setting, which in turn means that under
8944: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8945case "$startperl" in
8946'')
8947 case "$sharpbang" in
8948 *!)
8949 $cat <<EOH
8950
8951I can use the #! construct to start perl on your system. This will
8952make startup of perl scripts faster, but may cause problems if you
8953want to share those scripts and perl is not in a standard place
a2d23ec2
MB
8954($initialinstalllocation/perl) on all your platforms. The alternative
8955is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8956
8957EOH
674912d7 8958 case "$versiononly" in
a2d23ec2 8959 "$define") dflt="$initialinstalllocation/perl$version";;
d0e36aa9 8960 *) dflt="$initialinstalllocation/perl";;
674912d7 8961 esac
b4eb6b3d
JH
8962 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8963 . ./myread
8964 case "$ans" in
8965 none) startperl=": # use perl";;
8966 *) startperl="#!$ans"
8967 if $test 30 -lt `echo "$ans" | wc -c`; then
8968 $cat >&4 <<EOM
8969
8970WARNING: Some systems limit the #! command to 32 characters.
8971If you experience difficulty running Perl scripts with #!, try
8972installing Perl in a directory with a shorter pathname.
8973
8974EOM
8975 fi ;;
8976 esac
8977 ;;
8978 *) startperl=": # use perl"
8979 ;;
8980 esac
8981 ;;
8982esac
8983echo "I'll use $startperl to start perl scripts."
8984
8985: figure best path for perl in scripts
8986case "$perlpath" in
8987'')
5e20a8ca 8988 case "$versiononly" in
d0e36aa9
NC
8989 "$define") perlpath="$initialinstalllocation/perl$version";;
8990 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8991 esac
b4eb6b3d
JH
8992 case "$startperl" in
8993 *!*) ;;
8994 *)
8995 $cat <<EOH
8996
8997I will use the "eval 'exec'" idiom to start Perl on your system.
8998I can use the full path of your Perl binary for this purpose, but
8999doing so may cause problems if you want to share those scripts and
d0e36aa9 9000Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
9001
9002EOH
d0e36aa9 9003 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
9004 rp="What path shall I use in \"eval 'exec'\"?"
9005 . ./myread
9006 perlpath="$ans"
9007 ;;
9008 esac
9009 ;;
9010esac
9011case "$startperl" in
9012*!*) ;;
9013*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9014esac
9015
9016: determine where public executable scripts go
9017set scriptdir scriptdir
9018eval $prefixit
9019case "$scriptdir" in
9020'')
9021 dflt="$bin"
9022 : guess some guesses
9023 $test -d /usr/share/scripts && dflt=/usr/share/scripts
9024 $test -d /usr/share/bin && dflt=/usr/share/bin
9025 $test -d /usr/local/script && dflt=/usr/local/script
9026 $test -d /usr/local/scripts && dflt=/usr/local/scripts
9027 $test -d $prefixexp/script && dflt=$prefixexp/script
9028 set dflt
9029 eval $prefixup
9030 ;;
9031*) dflt="$scriptdir"
9032 ;;
9033esac
9034$cat <<EOM
f3f1a2d8 9035
b4eb6b3d
JH
9036Some installations have a separate directory just for executable scripts so
9037that they can mount it across multiple architectures but keep the scripts in
9038one spot. You might, for example, have a subdirectory of /usr/share for this.
9039Or you might just lump your scripts in with all your other executables.
f3f1a2d8 9040
b4eb6b3d
JH
9041EOM
9042fn=d~
9043rp='Where do you keep publicly executable scripts?'
9044. ./getfile
9045if $test "X$ansexp" != "X$scriptdirexp"; then
9046 installscript=''
9047fi
f3f1a2d8 9048installscriptdir=''
79522dd2
NC
9049prefixvar=scriptdir
9050. ./setprefixvar
9051: A little fix up for an irregularly named variable.
9052installscript="$installscriptdir"
9053
b4eb6b3d
JH
9054: determine where add-on public executables go
9055case "$sitebin" in
9056'') dflt=$siteprefix/bin ;;
9057*) dflt=$sitebin ;;
9058esac
9059fn=d~
9060rp='Pathname where the add-on public executables should be installed?'
9061. ./getfile
79522dd2
NC
9062prefixvar=sitebin
9063. ./setprefixvar
b4eb6b3d 9064
6e1038e0 9065: determine where add-on html pages go
8d2cbf27 9066: There is no standard location, so try to copy the previously-selected
6e1038e0 9067: directory structure for the core html pages.
8d2cbf27
JH
9068case "$sitehtml1dir" in
9069'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9070*) dflt=$sitehtml1dir ;;
6e1038e0
MB
9071esac
9072case "$dflt" in
9073''|' ') dflt=none ;;
9074esac
9075fn=dn+~
9076rp='Pathname where the site-specific html pages should be installed?'
9077. ./getfile
79522dd2
NC
9078prefixvar=sitehtml1dir
9079. ./setprefixvar
6e1038e0
MB
9080
9081: determine where add-on library html pages go
9082: There is no standard location, so try to copy the previously-selected
9083: directory structure for the core html pages.
8d2cbf27
JH
9084case "$sitehtml3dir" in
9085'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9086*) dflt=$sitehtml3dir ;;
6e1038e0
MB
9087esac
9088case "$dflt" in
9089''|' ') dflt=none ;;
9090esac
9091fn=dn+~
9092rp='Pathname where the site-specific library html pages should be installed?'
9093. ./getfile
79522dd2
NC
9094prefixvar=sitehtml3dir
9095. ./setprefixvar
6e1038e0
MB
9096
9097: determine where add-on manual pages go
91e123a8
JH
9098case "$siteman1dir" in
9099'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9100*) dflt=$siteman1dir ;;
6e1038e0 9101esac
257059b5
JH
9102case "$dflt" in
9103''|' ') dflt=none ;;
9104esac
6e1038e0
MB
9105fn=dn+~
9106rp='Pathname where the site-specific manual pages should be installed?'
9107. ./getfile
79522dd2
NC
9108prefixvar=siteman1dir
9109. ./setprefixvar
6e1038e0
MB
9110
9111: determine where add-on library man pages go
91e123a8
JH
9112case "$siteman3dir" in
9113'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9114*) dflt=$siteman3dir ;;
6e1038e0 9115esac
257059b5
JH
9116case "$dflt" in
9117''|' ') dflt=none ;;
9118esac
6e1038e0
MB
9119fn=dn+~
9120rp='Pathname where the site-specific library manual pages should be installed?'
9121. ./getfile
79522dd2
NC
9122prefixvar=siteman3dir
9123. ./setprefixvar
6e1038e0
MB
9124
9125: determine where add-on public executable scripts go
9126case "$sitescript" in
9127'') dflt=$siteprefix/script
9128 $test -d $dflt || dflt=$sitebin ;;
9129*) dflt="$sitescript" ;;
9130esac
9131fn=d~+
9132rp='Pathname where add-on public executable scripts should be installed?'
9133. ./getfile
79522dd2
NC
9134prefixvar=sitescript
9135. ./setprefixvar
6e1038e0 9136
34f1896b 9137: Check if faststdio is requested and available
15b61c98
JH
9138case "$usefaststdio" in
9139$define|true|[yY]*|'')
9140 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9141 case "$xversion" in
9142 [68]) dflt='y' ;;
9143 *) dflt='n' ;;
9144 esac
9145 ;;
9146*) dflt='n';;
9147esac
9148cat <<EOM
9149
9150Perl can be built to use 'fast stdio', which means using the stdio
9151library but also directly manipulating the stdio buffers to enable
9152faster I/O. Using stdio is better for backward compatibility (especially
9153for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9154interface has been preferred instead of stdio.
9155
9156If this doesn't make any sense to you, just accept the default '$dflt'.
9157EOM
9158rp='Use the "fast stdio" if available?'
9159. ./myread
9160case "$ans" in
34f1896b 9161y|Y) val="$define" ;;
15b61c98
JH
9162*) val="$undef" ;;
9163esac
9164set usefaststdio
9165eval $setvar
9166
9167
96056487
JH
9168: define an is-a-typedef? function
9169typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9170case "$inclist" in
9171"") inclist="sys/types.h";;
9172esac;
9173eval "varval=\$$var";
9174case "$varval" in
9175"")
9176 $rm -f temp.c;
9177 for inc in $inclist; do
9178 echo "#include <$inc>" >>temp.c;
9179 done;
9180 echo "#ifdef $type" >> temp.c;
9181 echo "printf(\"We have $type\");" >> temp.c;
9182 echo "#endif" >> temp.c;
9183 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9184 if $contains $type temp.E >/dev/null 2>&1; then
9185 eval "$var=\$type";
9186 else
9187 eval "$var=\$def";
9188 fi;
9189 $rm -f temp.?;;
9190*) eval "$var=\$varval";;
9191esac'
9192
9193: define an is-a-typedef? function that prompts if the type is not available.
9194typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9195case "$inclist" in
9196"") inclist="sys/types.h";;
9197esac;
9198eval "varval=\$$var";
9199case "$varval" in
9200"")
9201 $rm -f temp.c;
9202 for inc in $inclist; do
9203 echo "#include <$inc>" >>temp.c;
9204 done;
9205 echo "#ifdef $type" >> temp.c;
9206 echo "printf(\"We have $type\");" >> temp.c;
9207 echo "#endif" >> temp.c;
9208 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9209 echo " " ;
9210 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9211 if $contains $type temp.E >/dev/null 2>&1; then
9212 echo "$type found." >&4;
9213 eval "$var=\$type";
9214 else
9215 echo "$type NOT found." >&4;
9216 dflt="$def";
9217 . ./myread ;
9218 eval "$var=\$ans";
9219 fi;
9220 $rm -f temp.?;;
9221*) eval "$var=\$varval";;
9222esac'
9223
9224: see what type lseek is declared as in the kernel
9225rp="What is the type used for lseek's offset on this system?"
9226set off_t lseektype long stdio.h sys/types.h
9227eval $typedef_ask
9228
9229echo " "
9230echo "Checking to see how big your file offsets are..." >&4
9231$cat >try.c <<EOCP
9232#include <sys/types.h>
9233#include <stdio.h>
9234int main()
9235{
9236 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9237 return(0);
96056487
JH
9238}
9239EOCP
9240set try
9241if eval $compile_ok; then
9242 lseeksize=`$run ./try`
9243 echo "Your file offsets are $lseeksize bytes long."
9244else
9245 dflt=$longsize
9246 echo " "
9247 echo "(I can't seem to compile the test program. Guessing...)"
9248 rp="What is the size of your file offsets (in bytes)?"
9249 . ./myread
9250 lseeksize="$ans"
9251fi
5b813a60 9252$rm_try
96056487
JH
9253
9254: see what type file positions are declared as in the library
9255rp="What is the type for file position used by fsetpos()?"
9256set fpos_t fpostype long stdio.h sys/types.h
9257eval $typedef_ask
9258
613d6c3e 9259: Check size for Fpos_t
96056487
JH
9260echo " "
9261case "$fpostype" in
9262*_t) zzz="$fpostype" ;;
9263*) zzz="fpos_t" ;;
9264esac
613d6c3e 9265echo "Checking the size of $zzz..." >&4
96056487
JH
9266cat > try.c <<EOCP
9267#include <sys/types.h>
9268#include <stdio.h>
d1daaddf
JH
9269#$i_stdlib I_STDLIB
9270#ifdef I_STDLIB
9271#include <stdlib.h>
9272#endif
96056487
JH
9273int main() {
9274 printf("%d\n", (int)sizeof($fpostype));
9275 exit(0);
9276}
9277EOCP
9278set try
9279if eval $compile_ok; then
9280 yyy=`$run ./try`
9281 case "$yyy" in
9282 '') fpossize=4
9283 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9284 ;;
9285 *) fpossize=$yyy
9286 echo "Your $zzz is $fpossize bytes long."
9287 ;;
9288 esac
9289else
9290 dflt="$longsize"
9291 echo " " >&4
9292 echo "(I can't compile the test program. Guessing...)" >&4
9293 rp="What is the size of your file positions (in bytes)?"
9294 . ./myread
9295 fpossize="$ans"
9296fi
9297
613d6c3e 9298: Check for large file support
96056487
JH
9299# Backward compatibility (uselfs is deprecated).
9300case "$uselfs" in
9301"$define"|true|[yY]*)
9302 cat <<EOM >&4
9303
9304*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9305EOM
9306 uselargefiles="$define"
9307 ;;
5b813a60 9308esac
96056487
JH
9309
9310case "$lseeksize:$fpossize" in
93118:8) cat <<EOM
9312
9313You can have files larger than 2 gigabytes.
9314EOM
9315 val="$define" ;;
9316*) case "$uselargefiles" in
9317 "$undef"|false|[nN]*) dflt='n' ;;
9318 *) dflt='y' ;;
9319 esac
9320 cat <<EOM
9321
9322Perl can be built to understand large files (files larger than 2 gigabytes)
9323on some systems. To do so, Configure can be run with -Duselargefiles.
9324
9325If this doesn't make any sense to you, just accept the default '$dflt'.
9326EOM
9327 rp='Try to understand large files, if available?'
9328 . ./myread
9329 case "$ans" in
9330 y|Y) val="$define" ;;
9331 *) val="$undef" ;;
9332 esac
9333 ;;
9334esac
9335set uselargefiles
9336eval $setvar
96056487
JH
9337: Look for a hint-file generated 'call-back-unit'. If the
9338: user has specified that a large files perl is to be built,
9339: we may need to set or change some other defaults.
9da7673b
MB
9340if $test -f uselargefiles.cbu; then
9341 echo "Your platform has some specific hints regarding large file builds, using them..."
9342 . ./uselargefiles.cbu
9343fi
9344case "$uselargefiles" in
9345"$define")
96056487 9346 if $test -f uselargefiles.cbu; then
96056487
JH
9347 echo " "
9348 echo "Rechecking to see how big your file offsets are..." >&4
9349 $cat >try.c <<EOCP
9350#include <sys/types.h>
9351#include <stdio.h>
9352int main()
9353{
9354 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9355 return(0);
96056487
JH
9356}
9357EOCP
9358 set try
9359 if eval $compile_ok; then
9360 lseeksize=`$run ./try`
9361 $echo "Your file offsets are now $lseeksize bytes long."
9362 else
9363 dflt="$lseeksize"
9364 echo " "
9365 echo "(I can't seem to compile the test program. Guessing...)"
9366 rp="What is the size of your file offsets (in bytes)?"
9367 . ./myread
9368 lseeksize="$ans"
9369 fi
9370 case "$fpostype" in
9371 *_t) zzz="$fpostype" ;;
9372 *) zzz="fpos_t" ;;
9373 esac
5b813a60 9374 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9375 $cat > try.c <<EOCP
9376#include <sys/types.h>
9377#include <stdio.h>
55954f19
JH
9378#$i_stdlib I_STDLIB
9379#ifdef I_STDLIB
9380#include <stdlib.h>
9381#endif
96056487
JH
9382int main() {
9383 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9384 return(0);
96056487
JH
9385}
9386EOCP
9387 set try
9388 if eval $compile_ok; then
9389 yyy=`$run ./try`
9390 dflt="$lseeksize"
9391 case "$yyy" in
9392 '') echo " "
9393 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9394 ;;
9395 *) fpossize=$yyy
9396 echo " $fpossize bytes." >&4
9397 ;;
9398 esac
9399 else
9400 dflt="$fpossize"
9401 echo " "
9402 echo "(I can't compile the test program. Guessing...)" >&4
9403 rp="What is the size of your file positions (in bytes)?"
9404 . ./myread
9405 fpossize="$ans"
9406 fi
5b813a60 9407 $rm_try
96056487
JH
9408 fi
9409 ;;
9410esac
9411
613d6c3e 9412: Set the vendorbin variables
b4eb6b3d
JH
9413case "$vendorprefix" in
9414'') d_vendorbin="$undef"
9415 vendorbin=''
9416 vendorbinexp=''
9417 ;;
9418*) d_vendorbin="$define"
9419 : determine where vendor-supplied executables go.
9420 case "$vendorbin" in
9421 '') dflt=$vendorprefix/bin ;;
9422 *) dflt="$vendorbin" ;;
9423 esac
9424 fn=d~+
9425 rp='Pathname for the vendor-supplied executables directory?'
9426 . ./getfile
9427 vendorbin="$ans"
9428 vendorbinexp="$ansexp"
9429 ;;
9430esac
a092d240
NC
9431prefixvar=vendorbin
9432. ./installprefix
b4eb6b3d 9433
613d6c3e 9434: Set the vendorhtml1dir variables
6e1038e0 9435case "$vendorprefix" in
8d2cbf27
JH
9436'') vendorhtml1dir=''
9437 vendorhtml1direxp=''
6e1038e0
MB
9438 ;;
9439*) : determine where vendor-supplied html pages go.
9440 : There is no standard location, so try to copy the previously-selected
9441 : directory structure for the core html pages.
9442 : XXX Better default suggestions would be welcome.
8d2cbf27 9443 case "$vendorhtml1dir" in
6e1038e0 9444 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9445 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9446 esac
9447 case "$dflt" in
9448 ''|' ') dflt=none ;;
9449 esac
9450 fn=dn+~
9451 rp='Pathname for the vendor-supplied html pages?'
9452 . ./getfile
8d2cbf27
JH
9453 vendorhtml1dir="$ans"
9454 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9455 ;;
9456esac
9457: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9458$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9459prefixvar=vendorhtml1dir
9460. ./installprefix
6e1038e0 9461
613d6c3e 9462: Set the vendorhtml3dir variables
6e1038e0 9463case "$vendorprefix" in
8d2cbf27
JH
9464'') vendorhtml3dir=''
9465 vendorhtml3direxp=''
6e1038e0
MB
9466 ;;
9467*) : determine where vendor-supplied module html pages go.
9468 : There is no standard location, so try to copy the previously-selected
9469 : directory structure for the core html pages.
9470 : XXX Better default suggestions would be welcome.
8d2cbf27 9471 case "$vendorhtml3dir" in
6e1038e0 9472 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9473 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9474 esac
9475 case "$dflt" in
9476 ''|' ') dflt=none ;;
9477 esac
9478 fn=dn+~
9479 rp='Pathname for the vendor-supplied html pages?'
9480 . ./getfile
8d2cbf27
JH
9481 vendorhtml3dir="$ans"
9482 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9483 ;;
9484esac
9485: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9486$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9487prefixvar=vendorhtml3dir
9488. ./installprefix
6e1038e0 9489
613d6c3e 9490: Set the vendorman1dir variables
6e1038e0 9491case "$vendorprefix" in
91e123a8
JH
9492'') vendorman1dir=''
9493 vendorman1direxp=''
6e1038e0
MB
9494 ;;
9495*) : determine where vendor-supplied manual pages go.
91e123a8 9496 case "$vendorman1dir" in
6e1038e0 9497 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9498 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9499 esac
9500 case "$dflt" in
9501 ''|' ') dflt=none ;;
9502 esac
9503 fn=nd~+
9504 rp='Pathname for the vendor-supplied manual section 1 pages?'
9505 . ./getfile
91e123a8
JH
9506 vendorman1dir="$ans"
9507 vendorman1direxp="$ansexp"
6e1038e0
MB
9508 ;;
9509esac
9510: Use ' ' for none so value is preserved next time through Configure
91e123a8 9511$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9512prefixvar=vendorman1dir
9513. ./installprefix
6e1038e0 9514
613d6c3e 9515: Set the vendorman3dir variables
6e1038e0 9516case "$vendorprefix" in
91e123a8
JH
9517'') vendorman3dir=''
9518 vendorman3direxp=''
6e1038e0
MB
9519 ;;
9520*) : determine where vendor-supplied module manual pages go.
91e123a8 9521 case "$vendorman3dir" in
6e1038e0 9522 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9523 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9524 esac
9525 case "$dflt" in
9526 ''|' ') dflt=none ;;
9527 esac
9528 fn=nd~+
9529 rp='Pathname for the vendor-supplied manual section 3 pages?'
9530 . ./getfile
91e123a8
JH
9531 vendorman3dir="$ans"
9532 vendorman3direxp="$ansexp"
6e1038e0
MB
9533 ;;
9534esac
9535: Use ' ' for none so value is preserved next time through Configure
91e123a8 9536$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9537prefixvar=vendorman3dir
9538. ./installprefix
6e1038e0 9539
613d6c3e 9540: Set the vendorscript variables
6e1038e0
MB
9541case "$vendorprefix" in
9542'') d_vendorscript="$undef"
9543 vendorscript=''
9544 vendorscriptexp=''
9545 ;;
9546*) d_vendorscript="$define"
9547 : determine where vendor-supplied scripts go.
9548 case "$vendorscript" in
9549 '') dflt=$vendorprefix/script
9550 $test -d $dflt || dflt=$vendorbin ;;
9551 *) dflt="$vendorscript" ;;
9552 esac
9553 $cat <<EOM
9554
f3f1a2d8 9555The installation process will create a directory for
6e1038e0
MB
9556vendor-supplied scripts.
9557
9558EOM
9559 fn=d~+
9560 rp='Pathname for the vendor-supplied scripts directory?'
9561 . ./getfile
9562 vendorscript="$ans"
9563 vendorscriptexp="$ansexp"
9564 ;;
9565esac
a092d240
NC
9566prefixvar=vendorscript
9567. ./installprefix
6e1038e0 9568
f47f1645
TC
9569: script used to emit important warnings
9570cat >warn <<EOS
9571$startsh
9572if test \$# -gt 0; then
9573 echo "\$@" >msg
9574else
9575 cat >msg
9576fi
9577echo "*** WARNING:" >&4
9578sed -e 's/^/*** /' <msg >&4
9579echo "*** " >&4
9580cat msg >>config.msg
9581echo " " >>config.msg
9582rm -f msg
9583EOS
9584chmod +x warn
9585$eunicefix warn
9586
9587: see which of string.h or strings.h is needed
9588echo " "
9589strings=`./findhdr string.h`
9590if $test "$strings" && $test -r "$strings"; then
9591 echo "Using <string.h> instead of <strings.h>." >&4
9592 val="$define"
9593else
9594 val="$undef"
9595 strings=`./findhdr strings.h`
9596 if $test "$strings" && $test -r "$strings"; then
9597 echo "Using <strings.h> instead of <string.h>." >&4
9598 else
9599 ./warn "No string header found -- You'll surely have problems."
9600 fi
9601fi
9602set i_string
9603eval $setvar
9604case "$i_string" in
9605"$undef") strings=`./findhdr strings.h`;;
9606*) strings=`./findhdr string.h`;;
9607esac
9608
b4eb6b3d
JH
9609: see if qgcvt exists
9610set qgcvt d_qgcvt
9611eval $inlibc
9612
613d6c3e 9613: Check print/scan long double stuff
89ce900e
JH
9614echo " "
9615
9616if $test X"$d_longdbl" = X"$define"; then
9617
9618echo "Checking how to print long doubles..." >&4
9619
9620if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9621 $cat >try.c <<'EOCP'
9622#include <sys/types.h>
9623#include <stdio.h>
9624int main() {
9625 double d = 123.456;
9626 printf("%.3f\n", d);
9627}
9628EOCP
9629 set try
9630 if eval $compile; then
9631 yyy=`$run ./try`
9632 case "$yyy" in
9633 123.456)
9634 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9635 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9636 echo "We will use %f."
9637 ;;
9638 esac
9639 fi
9640fi
9641
9642if $test X"$sPRIfldbl" = X; then
9643 $cat >try.c <<'EOCP'
9644#include <sys/types.h>
9645#include <stdio.h>
9646int main() {
9647 long double d = 123.456;
9648 printf("%.3Lf\n", d);
9649}
9650EOCP
9651 set try
9652 if eval $compile; then
9653 yyy=`$run ./try`
9654 case "$yyy" in
9655 123.456)
9656 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9657 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9658 echo "We will use %Lf."
9659 ;;
9660 esac
9661 fi
9662fi
9663
9664if $test X"$sPRIfldbl" = X; then
9665 $cat >try.c <<'EOCP'
9666#include <sys/types.h>
9667#include <stdio.h>
9668int main() {
9669 long double d = 123.456;
9670 printf("%.3llf\n", d);
9671}
9672EOCP
9673 set try
9674 if eval $compile; then
9675 yyy=`$run ./try`
9676 case "$yyy" in
9677 123.456)
9678 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9679 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9680 echo "We will use %llf."
9681 ;;
9682 esac
9683 fi
9684fi
9685
9686if $test X"$sPRIfldbl" = X; then
9687 $cat >try.c <<'EOCP'
9688#include <sys/types.h>
9689#include <stdio.h>
9690int main() {
9691 long double d = 123.456;
9692 printf("%.3lf\n", d);
9693}
9694EOCP
9695 set try
9696 if eval $compile; then
9697 yyy=`$run ./try`
9698 case "$yyy" in
9699 123.456)
9700 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9701 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9702 echo "We will use %lf."
9703 ;;
9704 esac
9705 fi
9706fi
9707
9708if $test X"$sPRIfldbl" = X; then
9709 echo "Cannot figure out how to print long doubles." >&4
9710else
9711 sSCNfldbl=$sPRIfldbl # expect consistency
9712fi
9713
5b813a60 9714$rm_try
89ce900e
JH
9715
9716fi # d_longdbl
9717
9718case "$sPRIfldbl" in
5b813a60
MB
9719'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9720 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9721 d_SCNfldbl="$undef";
9722 ;;
5b813a60
MB
9723*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9724 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9725 d_SCNfldbl="$define";
9726 ;;
9727esac
9728
b4eb6b3d 9729: Check how to convert floats to strings.
a5b10d80
YST
9730
9731if test "X$d_Gconvert" = X; then
9732
b4eb6b3d
JH
9733echo " "
9734echo "Checking for an efficient way to convert floats to strings."
9735echo " " > try.c
9736case "$uselongdouble" in
9737"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9738esac
9739case "$d_longdbl" in
9740"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9741esac
9742case "$d_PRIgldbl" in
9743"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9744esac
9745$cat >>try.c <<EOP
9746#ifdef TRY_gconvert
9747#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9748char *myname = "gconvert";
9749#endif
9750#ifdef TRY_gcvt
9751#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9752char *myname = "gcvt";
9753#endif
9754#ifdef TRY_qgcvt
9755#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9756char *myname = "qgcvt";
9757#define DOUBLETYPE long double
9758#endif
9759#ifdef TRY_sprintf
a5b10d80
YST
9760#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9761#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9762#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9763#else
a5b10d80
YST
9764#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9765#endif
9766#else
b4eb6b3d
JH
9767#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9768#endif
9769char *myname = "sprintf";
9770#endif
9771
9772#ifndef DOUBLETYPE
9773#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9774#define DOUBLETYPE long double
9775#else
9776#define DOUBLETYPE double
9777#endif
9778#endif
9779
9780#include <stdio.h>
9781
f47f1645 9782#$i_stdlib I_STDLIB
b4eb6b3d
JH
9783#ifdef I_STDLIB
9784#include <stdlib.h>
9785#endif
f47f1645
TC
9786#$i_string I_STRING
9787#ifdef I_STRING
9788# include <string.h>
9789#else
9790# include <strings.h>
9791#endif
b4eb6b3d 9792
f47f1645 9793int checkit(char *expect, char *got)
b4eb6b3d
JH
9794{
9795 if (strcmp(expect, got)) {
9796 printf("%s oddity: Expected %s, got %s\n",
9797 myname, expect, got);
9798 exit(1);
9799 }
9800}
9801
9802int main()
5b813a60
MB
9803{
9804 char buf[64];
b4eb6b3d
JH
9805 buf[63] = '\0';
9806
9807 /* This must be 1st test on (which?) platform */
9808 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9809 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9810 checkit("0.1", buf);
9811
5b813a60 9812 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9813 checkit("0.01", buf);
9814
5b813a60 9815 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9816 checkit("0.001", buf);
9817
5b813a60 9818 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9819 checkit("0.0001", buf);
9820
9821 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9822 if (strlen(buf) > 5)
9823 checkit("9e-005", buf); /* for Microsoft ?? */
9824 else
9825 checkit("9e-05", buf);
9826
5b813a60 9827 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9828 checkit("1", buf);
9829
5b813a60 9830 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9831 checkit("1.1", buf);
9832
5b813a60 9833 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9834 checkit("1.01", buf);
9835
5b813a60 9836 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9837 checkit("1.001", buf);
9838
5b813a60 9839 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9840 checkit("1.0001", buf);
9841
5b813a60 9842 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9843 checkit("1.00001", buf);
9844
5b813a60 9845 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9846 checkit("1.000001", buf);
9847
5b813a60 9848 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9849 checkit("0", buf);
9850
5b813a60 9851 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9852 checkit("-1", buf);
9853
9854 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9855 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9856 checkit("100000", buf);
5b813a60 9857
b4eb6b3d 9858 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9859 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9860 checkit("-100000", buf);
9861
5b813a60 9862 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9863 checkit("123.456", buf);
9864
ab6ca9f4 9865 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9866 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9867 /* 34 should be enough to scare even long double
9868 * places into using the e notation. */
ab6ca9f4 9869 if (strlen(buf) > 5)
94b339ad 9870 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9871 else
94b339ad 9872 checkit("1e+34", buf);
8e2a5ede 9873
d1eb8299
YST
9874 /* For Perl, if you add additional tests here, also add them to
9875 * t/base/num.t for benefit of platforms not using Configure or
9876 * overriding d_Gconvert */
9877
b4eb6b3d
JH
9878 exit(0);
9879}
9880EOP
ab6ca9f4 9881: first add preferred functions to our list
a5b10d80 9882xxx_list=""
ab6ca9f4 9883for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9884 case $xxx_convert in
9885 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9886 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9887 esac
a5b10d80
YST
9888done
9889: then add any others
9890for xxx_convert in gconvert gcvt sprintf; do
9891 case "$xxx_list" in
9892 *$xxx_convert*) ;;
9893 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9894 esac
a5b10d80
YST
9895done
9896
9897case "$d_longdbl$uselongdouble" in
9898"$define$define")
9899 : again, add prefered functions to our list first
9900 xxx_ld_list=""
ab6ca9f4 9901 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9902 case $xxx_convert in
9903 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9904 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9905 esac
9906 done
9907 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9908 for xxx_convert in qgcvt sprintf $xxx_list; do
9909 case "$xxx_ld_list" in
9910 $xxx_convert*|*" $xxx_convert"*) ;;
9911 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9912 esac
9913 done
9914 : if sprintf cannot do long doubles, move it to the end
9915 if test "$d_PRIgldbl" != "$define"; then
9916 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9917 fi
9918 : if no qgcvt, remove it
9919 if test "$d_qgcvt" != "$define"; then
9920 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9921 fi
9922 : use the ld_list
9923 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9924 ;;
9925esac
9926
9927for xxx_convert in $xxx_list; do
9928 echo "Trying $xxx_convert..."
93451a0d 9929 $rm -f try try$_o core
b4eb6b3d
JH
9930 set try -DTRY_$xxx_convert
9931 if eval $compile; then
9932 echo "$xxx_convert() found." >&4
5440bc8e 9933 if $run ./try; then
b4eb6b3d
JH
9934 echo "I'll use $xxx_convert to convert floats into a string." >&4
9935 break;
9936 else
9937 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9938 xxx_convert=''
b4eb6b3d
JH
9939 fi
9940 else
9941 echo "$xxx_convert NOT found." >&4
9942 fi
9943done
ab6ca9f4 9944
a5b10d80
YST
9945if test X$xxx_convert = X; then
9946 echo "*** WHOA THERE!!! ***" >&4
9947 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9948 xxx_convert=sprintf
9949fi
9950
b4eb6b3d
JH
9951case "$xxx_convert" in
9952gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9953gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9954qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9955*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9956 "$define$define$define")
9957 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9958 "$define$define$undef")
9959 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9960 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9961 esac
5b813a60 9962 ;;
b4eb6b3d
JH
9963esac
9964
a5b10d80 9965fi
93451a0d 9966$rm_try
a5b10d80 9967
74cac757
JH
9968: see if _fwalk exists
9969set fwalk d__fwalk
9970eval $inlibc
9971
b4eb6b3d
JH
9972: Initialize h_fcntl
9973h_fcntl=false
9974
9975: Initialize h_sysfile
9976h_sysfile=false
9977
9978: access call always available on UNIX
9979set access d_access
9980eval $inlibc
9981
9982: locate the flags for 'access()'
9983case "$d_access" in
9984"$define")
9985 echo " "
55954f19 9986 $cat >access.c <<EOCP
b4eb6b3d
JH
9987#include <sys/types.h>
9988#ifdef I_FCNTL
9989#include <fcntl.h>
9990#endif
9991#ifdef I_SYS_FILE
9992#include <sys/file.h>
9993#endif
9994#ifdef I_UNISTD
9995#include <unistd.h>
9996#endif
55954f19
JH
9997#$i_stdlib I_STDLIB
9998#ifdef I_STDLIB
9999#include <stdlib.h>
10000#endif
b4eb6b3d
JH
10001int main() {
10002 exit(R_OK);
10003}
10004EOCP
10005 : check sys/file.h first, no particular reason here
10006 if $test `./findhdr sys/file.h` && \
7a282f6d 10007 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10008 h_sysfile=true;
10009 echo "<sys/file.h> defines the *_OK access constants." >&4
10010 elif $test `./findhdr fcntl.h` && \
7a282f6d 10011 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10012 h_fcntl=true;
10013 echo "<fcntl.h> defines the *_OK access constants." >&4
10014 elif $test `./findhdr unistd.h` && \
7a282f6d 10015 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10016 echo "<unistd.h> defines the *_OK access constants." >&4
10017 else
10018 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10019 fi
10020 ;;
10021esac
10022$rm -f access*
10023
10024: see if accessx exists
10025set accessx d_accessx
10026eval $inlibc
10027
89ce900e
JH
10028: see if aintl exists
10029set aintl d_aintl
10030eval $inlibc
10031
b4eb6b3d
JH
10032: see if alarm exists
10033set alarm d_alarm
10034eval $inlibc
10035
96938616
MB
10036: see if 64bit time functions exists
10037
10038set ctime64 d_ctime64
10039eval $inlibc
10040
10041set localtime64 d_localtime64
10042eval $inlibc
10043
10044set gmtime64 d_gmtime64
10045eval $inlibc
10046
10047set mktime64 d_mktime64
10048eval $inlibc
10049
10050set difftime64 d_difftime64
10051eval $inlibc
10052
10053set asctime64 d_asctime64
10054eval $inlibc
10055
a9dade78
JH
10056: see if POSIX threads are available
10057set pthread.h i_pthread
10058eval $inhdr
10059
10bc17b6
JH
10060: define a fucntion to check prototypes
10061$cat > protochk <<EOSH
10062$startsh
10063cc="$cc"
10064optimize="$optimize"
10065ccflags="$ccflags"
10066prototype="$prototype"
10067define="$define"
c944cfb9 10068rm_try="$rm_try"
a9dade78
JH
10069usethreads=$usethreads
10070i_pthread=$i_pthread
10071pthread_h_first=$pthread_h_first
10bc17b6
JH
10072EOSH
10073
10074$cat >> protochk <<'EOSH'
10075
5b813a60 10076$rm_try
10bc17b6
JH
10077foo="$1"
10078shift
10079while test $# -ge 2; do
10080 case "$1" in
10081 $define) echo "#include <$2>" >> try.c ;;
10082 literal) echo "$2" >> try.c ;;
10083 esac
cce6a207
MB
10084 # Extra magic for the benefit of systems that need pthread.h
10085 # to be included early to correctly detect threadsafe functions.
10086 # Such functions must guarantee themselves, though, that the usethreads
10087 # and i_pthread have been defined, before calling protochk.
10088 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10089 echo "#include <pthread.h>" >> try.c
10090 pthread_h_done=yes
10091 fi
10bc17b6
JH
10092 shift 2
10093done
10094test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10095cat >> try.c <<'EOCP'
10096#ifdef CAN_PROTOTYPE
10097#define _(args) args
10098#else
10099#define _(args) ()
10100#endif
10101EOCP
10102echo "$foo" >> try.c
10103echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10104$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10105status=$?
5b813a60 10106$rm_try
10bc17b6
JH
10107exit $status
10108EOSH
10109chmod +x protochk
10110$eunicefix protochk
10111
34f1896b 10112: Define hasproto macro for Configure internal use
89ce900e
JH
10113hasproto='varname=$1; func=$2; shift; shift;
10114while $test $# -ge 2; do
10115 case "$1" in
10116 $define) echo "#include <$2>";;
10117 esac ;
10118 shift 2;
10119done > try.c;
10120$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10121if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10122 echo "$func() prototype found.";
10123 val="$define";
10124else
10125 echo "$func() prototype NOT found.";
10126 val="$undef";
10127fi;
10128set $varname;
10129eval $setvar;
5b813a60 10130$rm_try tryout.c'
89ce900e 10131
10bc17b6
JH
10132: see if sys/types.h has to be included
10133set sys/types.h i_systypes
10134eval $inhdr
10135
10136: see if sys/select.h has to be included
10137set sys/select.h i_sysselct
10138eval $inhdr
10139
34f1896b 10140: Define hasfield macro for Configure internal use
10bc17b6
JH
10141hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10142while $test $# -ge 2; do
10143 case "$1" in
10144 $define) echo "#include <$2>";;
10145 esac ;
10146 shift 2;
10147done > try.c;
10148echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10149set try;
10150if eval $compile; then
10151 val="$define";
10152else
10153 val="$undef";
10154fi;
10155set $varname;
10156eval $setvar;
5b813a60 10157$rm_try'
10bc17b6
JH
10158
10159: see if we should include time.h, sys/time.h, or both
10160echo " "
10161if test "X$timeincl" = X; then
10162 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10163 $echo $n "I'm now running the test program...$c"
55954f19 10164 $cat >try.c <<EOCP
10bc17b6
JH
10165#include <sys/types.h>
10166#ifdef I_TIME
10167#include <time.h>
10168#endif
10169#ifdef I_SYSTIME
10170#ifdef SYSTIMEKERNEL
10171#define KERNEL
10172#endif
10173#include <sys/time.h>
10174#endif
10175#ifdef I_SYSSELECT
10176#include <sys/select.h>
10177#endif
55954f19
JH
10178#$i_stdlib I_STDLIB
10179#ifdef I_STDLIB
10180#include <stdlib.h>
10181#endif
10bc17b6
JH
10182int main()
10183{
10184 struct tm foo;
10185#ifdef S_TIMEVAL
10186 struct timeval bar;
10187#endif
10188#ifdef S_TIMEZONE
10189 struct timezone tzp;
10190#endif
10191 if (foo.tm_sec == foo.tm_sec)
10192 exit(0);
10193#ifdef S_TIMEVAL
10194 if (bar.tv_sec == bar.tv_sec)
10195 exit(0);
10196#endif
10197 exit(1);
10198}
10199EOCP
10200 flags=''
10201 for s_timezone in '-DS_TIMEZONE' ''; do
10202 sysselect=''
10203 for s_timeval in '-DS_TIMEVAL' ''; do
10204 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10205 for i_time in '' '-DI_TIME'; do
10206 for i_systime in '-DI_SYSTIME' ''; do
10207 case "$flags" in
10208 '') $echo $n ".$c"
10209 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10210 if eval $compile; then
10211 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10212 shift
10213 flags="$*"
10214 echo " "
10215 $echo $n "Succeeded with $flags$c"
10216 fi
10217 ;;
10218 esac
10219 done
10220 done
10221 done
10222 done
10223 done
10224 timeincl=''
10225 echo " "
10226 case "$flags" in
10227 *SYSTIMEKERNEL*) i_systimek="$define"
10228 timeincl=`./findhdr sys/time.h`
10229 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10230 *) i_systimek="$undef";;
10231 esac
10232 case "$flags" in
10233 *I_TIME*) i_time="$define"
10234 timeincl=`./findhdr time.h`" $timeincl"
10235 echo "We'll include <time.h>." >&4;;
10236 *) i_time="$undef";;
10237 esac
10238 case "$flags" in
10239 *I_SYSTIME*) i_systime="$define"
10240 timeincl=`./findhdr sys/time.h`" $timeincl"
10241 echo "We'll include <sys/time.h>." >&4;;
10242 *) i_systime="$undef";;
10243 esac
5b813a60 10244 $rm_try
10bc17b6
JH
10245fi
10246: see if struct tm knows about tm_zone
10247case "$i_systime$i_time" in
5b813a60 10248*$define*)
10bc17b6
JH
10249 echo " "
10250 echo "Checking to see if your struct tm has tm_zone field..." >&4
10251 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10252 eval $hasfield
10253 ;;
10254*) val="$undef"
10255 set d_tm_tm_zone
10256 eval $setvar
10257 ;;
10258esac
10259case "$d_tm_tm_zone" in
10260"$define") echo "Yes, it does." ;;
10261*) echo "No, it doesn't." ;;
10262esac
10263: see if struct tm knows about tm_gmtoff
10264case "$i_systime$i_time" in
5b813a60 10265*$define*)
10bc17b6
JH
10266 echo " "
10267 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10268 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10269 eval $hasfield
10270 ;;
10271*) val="$undef"
10272 set d_tm_tm_gmtoff
10273 eval $setvar
10274 ;;
10275esac
10276case "$d_tm_tm_gmtoff" in
10277"$define") echo "Yes, it does." ;;
10278*) echo "No, it doesn't." ;;
10279esac
10280
10281: see if asctime_r exists
10282set asctime_r d_asctime_r
10283eval $inlibc
10284case "$d_asctime_r" in
10285"$define")
d63eadf0 10286 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10287 case "$d_asctime_r_proto:$usethreads" in
10288 ":define") d_asctime_r_proto=define
a48ec845
JH
10289 set d_asctime_r_proto asctime_r $hdrs
10290 eval $hasproto ;;
10291 *) ;;
10292 esac
10293 case "$d_asctime_r_proto" in
10294 define)
10bc17b6
JH
10295 case "$asctime_r_proto" in
10296 ''|0) try='char* asctime_r(const struct tm*, char*);'
61c26d18 10297 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10bc17b6
JH
10298 esac
10299 case "$asctime_r_proto" in
10300 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
61c26d18 10301 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10bc17b6
JH
10302 esac
10303 case "$asctime_r_proto" in
10304 ''|0) try='int asctime_r(const struct tm*, char*);'
61c26d18 10305 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10bc17b6
JH
10306 esac
10307 case "$asctime_r_proto" in
10308 ''|0) try='int asctime_r(const struct tm*, char*, int);'
61c26d18 10309 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10bc17b6
JH
10310 esac
10311 case "$asctime_r_proto" in
90e831dc 10312 ''|0) d_asctime_r=undef
10bc17b6 10313 asctime_r_proto=0
a48ec845 10314 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10315 * ) case "$asctime_r_proto" in
10316 REENTRANT_PROTO*) ;;
10317 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10318 esac
10319 echo "Prototype: $try" ;;
10320 esac
10321 ;;
c18e646a
JH
10322 *) case "$usethreads" in
10323 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10324 esac
90e831dc
SB
10325 d_asctime_r=undef
10326 asctime_r_proto=0
c18e646a 10327 ;;
a48ec845
JH
10328 esac
10329 ;;
10bc17b6
JH
10330*) asctime_r_proto=0
10331 ;;
10332esac
10333
b4eb6b3d
JH
10334: see if atolf exists
10335set atolf d_atolf
10336eval $inlibc
10337
10338: see if atoll exists
10339set atoll d_atoll
10340eval $inlibc
10341
0dbb1585
AL
10342: Look for GCC-style attribute format
10343case "$d_attribute_format" in
bde30f85 10344'')
b4eb6b3d 10345echo " "
0dbb1585 10346echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10347$cat >attrib.c <<'EOCP'
10348#include <stdio.h>
0dbb1585 10349void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10350EOCP
10351if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10352 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10353 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10354 val="$undef"
10355 else
0dbb1585 10356 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10357 val="$define"
10358 fi
10359else
10360 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10361 val="$undef"
10362fi
bde30f85 10363;;
0dbb1585 10364*) val="$d_attribute_format" ;;
bde30f85 10365esac
0dbb1585
AL
10366set d_attribute_format
10367eval $setvar
10368$rm -f attrib*
10369
dcb594bc
MB
10370: Look for GCC-style attribute format with null format allowed
10371case "$d_printf_format_null" in
10372'') case "$d_attribute_format" in
10373 $define)
10374 echo " "
10375 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10376$cat >attrib.c <<EOCP
10377#include <stdio.h>
10378#$i_stdlib I_STDLIB
10379#ifdef I_STDLIB
10380#include <stdlib.h>
10381#endif
10382int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10383int null_printf (char* pat,...) { return (int)pat; }
10384int main () { exit(null_printf(NULL)); }
10385EOCP
10386 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10387 : run the executable in case it produces a run-time warning
10388 if $run ./attrib >>attrib.out 2>&1; then
10389 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10390 echo "Your C compiler doesn't allow __printf__ format to be null."
10391 val="$undef"
10392 else
10393 echo "Your C compiler allows __printf__ format to be null."
10394 val="$define"
10395 fi
10396 else
10397 echo "Your C compiler executable failed with __printf__ format null."
10398 val="$undef"
10399 fi
10400 else
10401 echo "Your C compiler fails with __printf__ format null."
10402 val="$undef"
10403 fi
10404 ;;
10405 *) val="$undef" ;;
10406 esac
10407;;
10408*) val="$d_printf_format_null" ;;
10409esac
10410set d_printf_format_null
10411eval $setvar
10412$rm -f attrib*
10413
0dbb1585
AL
10414: Look for GCC-style attribute malloc
10415case "$d_attribute_malloc" in
10416'')
10417echo " "
10418echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10419$cat >attrib.c <<'EOCP'
10420#include <stdio.h>
10421char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10422EOCP
10423if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10424 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10425 echo "Your C compiler doesn't support __attribute__((malloc))."
10426 val="$undef"
10427 else
10428 echo "Your C compiler supports __attribute__((malloc))."
10429 val="$define"
10430 fi
10431else
10432 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10433 val="$undef"
10434fi
10435;;
10436*) val="$d_attribute_malloc" ;;
10437esac
10438set d_attribute_malloc
10439eval $setvar
10440$rm -f attrib*
10441
10442: Look for GCC-style attribute nonnull
10443case "$d_attribute_nonnull" in
10444'')
10445echo " "
10446echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10447$cat >attrib.c <<'EOCP'
10448#include <stdio.h>
10449void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10450EOCP
10451if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10452 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10453 echo "Your C compiler doesn't support __attribute__((nonnull))."
10454 val="$undef"
10455 else
10456 echo "Your C compiler supports __attribute__((nonnull))."
10457 val="$define"
10458 fi
10459else
10460 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10461 val="$undef"
10462fi
10463;;
10464*) val="$d_attribute_nonnull" ;;
10465esac
10466set d_attribute_nonnull
10467eval $setvar
10468$rm -f attrib*
10469
10470: Look for GCC-style attribute noreturn
10471case "$d_attribute_noreturn" in
10472'')
10473echo " "
10474echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10475$cat >attrib.c <<'EOCP'
10476#include <stdio.h>
10477void fall_over_dead( void ) __attribute__((noreturn));
10478EOCP
10479if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10480 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10481 echo "Your C compiler doesn't support __attribute__((noreturn))."
10482 val="$undef"
10483 else
10484 echo "Your C compiler supports __attribute__((noreturn))."
10485 val="$define"
10486 fi
10487else
10488 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10489 val="$undef"
10490fi
10491;;
10492*) val="$d_attribute_noreturn" ;;
10493esac
10494set d_attribute_noreturn
10495eval $setvar
10496$rm -f attrib*
10497
10498: Look for GCC-style attribute pure
10499case "$d_attribute_pure" in
10500'')
10501echo " "
10502echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10503$cat >attrib.c <<'EOCP'
10504#include <stdio.h>
10505int square( int n ) __attribute__((pure));
10506EOCP
10507if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10508 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10509 echo "Your C compiler doesn't support __attribute__((pure))."
10510 val="$undef"
10511 else
10512 echo "Your C compiler supports __attribute__((pure))."
10513 val="$define"
10514 fi
10515else
10516 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10517 val="$undef"
10518fi
10519;;
10520*) val="$d_attribute_pure" ;;
10521esac
10522set d_attribute_pure
10523eval $setvar
10524$rm -f attrib*
10525
10526: Look for GCC-style attribute unused
10527case "$d_attribute_unused" in
10528'')
10529echo " "
10530echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10531$cat >attrib.c <<'EOCP'
10532#include <stdio.h>
10533int do_something( int dummy __attribute__((unused)), int n );
10534EOCP
10535if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10536 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10537 echo "Your C compiler doesn't support __attribute__((unused))."
10538 val="$undef"
10539 else
10540 echo "Your C compiler supports __attribute__((unused))."
10541 val="$define"
10542 fi
10543else
10544 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10545 val="$undef"
10546fi
10547;;
10548*) val="$d_attribute_unused" ;;
10549esac
10550set d_attribute_unused
10551eval $setvar
10552$rm -f attrib*
10553
fcdf39cf
RGS
10554: Look for GCC-style attribute deprecated
10555case "$d_attribute_deprecated" in
10556'')
10557echo " "
10558echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10559$cat >attrib.c <<'EOCP'
10560#include <stdio.h>
10561int I_am_deprecated(void) __attribute__((deprecated));
10562EOCP
10563if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10564 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10565 echo "Your C compiler doesn't support __attribute__((deprecated))."
10566 val="$undef"
10567 else
10568 echo "Your C compiler supports __attribute__((deprecated))."
10569 val="$define"
10570 fi
10571else
10572 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10573 val="$undef"
10574fi
10575;;
10576*) val="$d_attribute_deprecated" ;;
10577esac
10578set d_attribute_deprecated
10579eval $setvar
10580$rm -f attrib*
10581
0dbb1585
AL
10582: Look for GCC-style attribute warn_unused_result
10583case "$d_attribute_warn_unused_result" in
10584'')
10585echo " "
10586echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10587$cat >attrib.c <<'EOCP'
10588#include <stdio.h>
10589int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10590EOCP
10591if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10592 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10593 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10594 val="$undef"
10595 else
10596 echo "Your C compiler supports __attribute__((warn_unused_result))."
10597 val="$define"
10598 fi
10599else
10600 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10601 val="$undef"
10602fi
10603;;
10604*) val="$d_attribute_warn_unused_result" ;;
10605esac
10606set d_attribute_warn_unused_result
b4eb6b3d
JH
10607eval $setvar
10608$rm -f attrib*
10609
10610: see if bcmp exists
10611set bcmp d_bcmp
10612eval $inlibc
10613
10614: see if bcopy exists
10615set bcopy d_bcopy
10616eval $inlibc
10617
b4eb6b3d
JH
10618: see if getpgrp exists
10619set getpgrp d_getpgrp
10620eval $inlibc
10621
10622case "$d_getpgrp" in
10623"$define")
10624 echo " "
10625 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10626 $cat >try.c <<EOP
b4eb6b3d
JH
10627#$i_unistd I_UNISTD
10628#include <sys/types.h>
10629#ifdef I_UNISTD
10630# include <unistd.h>
10631#endif
55954f19
JH
10632#$i_stdlib I_STDLIB
10633#ifdef I_STDLIB
10634#include <stdlib.h>
10635#endif
b4eb6b3d
JH
10636int main()
10637{
10638 if (getuid() == 0) {
10639 printf("(I see you are running Configure as super-user...)\n");
10640 setuid(1);
10641 }
10642#ifdef TRY_BSD_PGRP
10643 if (getpgrp(1) == 0)
10644 exit(0);
10645#else
10646 if (getpgrp() > 0)
10647 exit(0);
10648#endif
10649 exit(1);
10650}
10651EOP
5440bc8e 10652 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10653 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10654 val="$define"
5440bc8e 10655 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10656 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10657 val="$undef"
10658 else
10659 echo "I can't seem to compile and run the test program."
10660 if ./usg; then
10661 xxx="a USG one, i.e. you use getpgrp()."
10662 else
10663 # SVR4 systems can appear rather BSD-ish.
10664 case "$i_unistd" in
10665 $undef)
10666 xxx="a BSD one, i.e. you use getpgrp(pid)."
10667 val="$define"
10668 ;;
10669 $define)
10670 xxx="probably a USG one, i.e. you use getpgrp()."
10671 val="$undef"
10672 ;;
10673 esac
10674 fi
10675 echo "Assuming your getpgrp is $xxx" >&4
10676 fi
10677 ;;
10678*) val="$undef";;
10679esac
10680set d_bsdgetpgrp
10681eval $setvar
5b813a60 10682$rm_try
b4eb6b3d
JH
10683
10684: see if setpgrp exists
10685set setpgrp d_setpgrp
10686eval $inlibc
10687
10688case "$d_setpgrp" in
10689"$define")
10690 echo " "
10691 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10692 $cat >try.c <<EOP
b4eb6b3d
JH
10693#$i_unistd I_UNISTD
10694#include <sys/types.h>
10695#ifdef I_UNISTD
10696# include <unistd.h>
10697#endif
55954f19
JH
10698#$i_stdlib I_STDLIB
10699#ifdef I_STDLIB
10700#include <stdlib.h>
10701#endif
b4eb6b3d
JH
10702int main()
10703{
10704 if (getuid() == 0) {
10705 printf("(I see you are running Configure as super-user...)\n");
10706 setuid(1);
10707 }
10708#ifdef TRY_BSD_PGRP
10709 if (-1 == setpgrp(1, 1))
10710 exit(0);
10711#else
10712 if (setpgrp() != -1)
10713 exit(0);
10714#endif
10715 exit(1);
10716}
10717EOP
5440bc8e 10718 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10719 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10720 val="$define"
5440bc8e 10721 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10722 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10723 val="$undef"
10724 else
10725 echo "(I can't seem to compile and run the test program.)"
10726 if ./usg; then
10727 xxx="a USG one, i.e. you use setpgrp()."
10728 else
10729 # SVR4 systems can appear rather BSD-ish.
10730 case "$i_unistd" in
10731 $undef)
10732 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10733 val="$define"
10734 ;;
10735 $define)
10736 xxx="probably a USG one, i.e. you use setpgrp()."
10737 val="$undef"
10738 ;;
10739 esac
10740 fi
10741 echo "Assuming your setpgrp is $xxx" >&4
10742 fi
10743 ;;
10744*) val="$undef";;
10745esac
10746set d_bsdsetpgrp
10747eval $setvar
5b813a60
MB
10748$rm_try
10749
635aebb7
AL
10750: Look for GCC-style __builtin_choose_expr
10751case "$d_builtin_choose_expr" in
10752'')
10753 echo " "
10754 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10755 $cat >try.c <<'EOCP'
10756#include <assert.h>
10757#include <stdlib.h>
10758#include <stdio.h>
10759
10760#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10761
10762int main(void) {
10763 assert( SYRINX(1) == 2112 );
10764 assert( SYRINX(1) != 5150 );
10765 assert( SYRINX(0) == 5150 );
10766 assert( SYRINX(0) != 2112 );
10767 puts( "All good!" );
10768 exit(0);
10769}
10770
10771EOCP
10772 set try
70ceb34a 10773 if eval $compile && $run ./try; then
635aebb7
AL
10774 echo "Your C compiler supports __builtin_choose_expr."
10775 val="$define"
10776 else
10777 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10778 val="$undef"
10779 fi
10780;;
10781*) val="$d_builtin_choose_expr" ;;
10782esac
10783
10784set d_builtin_choose_expr
10785eval $setvar
5b813a60 10786$rm_try
635aebb7
AL
10787
10788: Look for GCC-style __builtin_expect
10789case "$d_builtin_expect" in
10790'')
10791 echo " "
10792 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
70ceb34a 10793 $cat >try.c <<'EOCP'
635aebb7
AL
10794int main(void) {
10795 int n = 50;
10796 if ( __builtin_expect(n, 0) ) n = 1;
70ceb34a
NC
10797 /* Remember shell exit code truth is 0, C truth is non-zero */
10798 return !(n == 1);
635aebb7
AL
10799}
10800EOCP
10801 set try
70ceb34a
NC
10802 if eval $compile && $run ./try; then
10803 echo "Your C compiler supports __builtin_expect."
635aebb7
AL
10804 val="$define"
10805 else
70ceb34a 10806 echo "Your C compiler doesn't seem to understand __builtin_expect."
635aebb7
AL
10807 val="$undef"
10808 fi
10809 ;;
10810*) val="$d_builtin_expect" ;;
10811esac
10812
10813set d_builtin_expect
10814eval $setvar
5b813a60 10815$rm_try
635aebb7 10816
b4eb6b3d
JH
10817: see if bzero exists
10818set bzero d_bzero
10819eval $inlibc
10820
a2d23ec2
MB
10821: see if stdarg is available
10822echo " "
10823if $test `./findhdr stdarg.h`; then
10824 echo "<stdarg.h> found." >&4
10825 valstd="$define"
10826else
10827 echo "<stdarg.h> NOT found." >&4
10828 valstd="$undef"
10829fi
10830
10831: see if varags is available
10832echo " "
10833if $test `./findhdr varargs.h`; then
10834 echo "<varargs.h> found." >&4
10835else
10836 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10837fi
10838
10839: set up the varargs testing programs
10840$cat > varargs.c <<EOP
10841#ifdef I_STDARG
10842#include <stdarg.h>
10843#endif
10844#ifdef I_VARARGS
10845#include <varargs.h>
10846#endif
10847
10848#ifdef I_STDARG
10849int f(char *p, ...)
10850#else
10851int f(va_alist)
10852va_dcl
10853#endif
10854{
10855 va_list ap;
10856#ifndef I_STDARG
10857 char *p;
10858#endif
10859#ifdef I_STDARG
10860 va_start(ap,p);
10861#else
10862 va_start(ap);
10863 p = va_arg(ap, char *);
10864#endif
10865 va_end(ap);
4fb7dc7d 10866 return 0;
a2d23ec2
MB
10867}
10868EOP
10869$cat > varargs <<EOP
10870$startsh
10871if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10872 echo "true"
10873else
10874 echo "false"
10875fi
10876$rm -f varargs$_o
10877EOP
10878chmod +x varargs
10879
10880: now check which varargs header should be included
10881echo " "
10882i_varhdr=''
10883case "$valstd" in
10884"$define")
10885 if `./varargs I_STDARG`; then
10886 val='stdarg.h'
10887 elif `./varargs I_VARARGS`; then
10888 val='varargs.h'
10889 fi
10890 ;;
10891*)
10892 if `./varargs I_VARARGS`; then
10893 val='varargs.h'
10894 fi
10895 ;;
10896esac
10897case "$val" in
10898'')
10899echo "I could not find the definition for va_dcl... You have problems..." >&4
10900 val="$undef"; set i_stdarg; eval $setvar
10901 val="$undef"; set i_varargs; eval $setvar
10902 ;;
613d6c3e 10903*)
a2d23ec2
MB
10904 set i_varhdr
10905 eval $setvar
10906 case "$i_varhdr" in
10907 stdarg.h)
10908 val="$define"; set i_stdarg; eval $setvar
10909 val="$undef"; set i_varargs; eval $setvar
10910 ;;
10911 varargs.h)
10912 val="$undef"; set i_stdarg; eval $setvar
10913 val="$define"; set i_varargs; eval $setvar
10914 ;;
10915 esac
10916 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10917esac
10918$rm -f varargs*
10919
10920: see if the Compiler supports C99 variadic macros
10921case "$i_stdarg$i_stdlib" in
10922 "$define$define")
10923 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10924 $cat >try.c <<EOCP
10925#include <stdio.h>
10926#include <stdarg.h>
10927
10928#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10929
10930int main() {
10931 char buf[20];
10932 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10933 puts(buf);
10934 return 0;
10935}
10936EOCP
10937 set try
10938 if eval $compile && $run ./try 2>&1 >/dev/null; then
10939 case "`$run ./try`" in
10940 "123 456 789")
10941 echo "You have C99 variadic macros." >&4
10942 d_c99_variadic_macros="$define"
10943 ;;
10944 *)
10945 echo "You don't have functional C99 variadic macros." >&4
10946 d_c99_variadic_macros="$undef"
10947 ;;
10948 esac
10949 else
10950 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10951 d_c99_variadic_macros="$undef"
10952 fi
5b813a60 10953 $rm_try
a2d23ec2
MB
10954 ;;
10955 *)
10956 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10957 d_c99_variadic_macros="$undef"
10958 ;;
10959esac
10960
b4eb6b3d
JH
10961: see if signal is declared as pointer to function returning int or void
10962echo " "
10963xxx=`./findhdr signal.h`
10964$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10965if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10966 echo "You have int (*signal())() instead of void." >&4
10967 val="$undef"
10968elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10969 echo "You have void (*signal())()." >&4
10970 val="$define"
10971elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10972 echo "You have int (*signal())() instead of void." >&4
10973 val="$undef"
10974elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10975 echo "You have void (*signal())()." >&4
10976 val="$define"
10977else
10978 case "$d_voidsig" in
10979 '')
10980 echo "I can't determine whether signal handler returns void or int..." >&4
10981 dflt=void
10982 rp="What type does your signal handler return?"
10983 . ./myread
10984 case "$ans" in
10985 v*) val="$define";;
10986 *) val="$undef";;
10987 esac;;
10988 "$define")
10989 echo "As you already told me, signal handler returns void." >&4
10990 val="$define"
10991 ;;
10992 *) echo "As you already told me, signal handler returns int." >&4
10993 val="$undef"
10994 ;;
10995 esac
10996fi
10997set d_voidsig
10998eval $setvar
10999case "$d_voidsig" in
11000"$define") signal_t="void";;
11001*) signal_t="int";;
11002esac
11003$rm -f $$.tmp
11004
11005: check for ability to cast large floats to 32-bit ints.
11006echo " "
11007echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11008if $test "$intsize" -ge 4; then
11009 xxx=int
11010else
11011 xxx=long
11012fi
11013$cat >try.c <<EOCP
11014#include <stdio.h>
d1daaddf
JH
11015#$i_stdlib I_STDLIB
11016#ifdef I_STDLIB
11017#include <stdlib.h>
11018#endif
b4eb6b3d
JH
11019#include <sys/types.h>
11020#include <signal.h>
7090f861 11021$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
11022int main()
11023{
11024 $xxx i32;
11025 double f, g;
11026 int result = 0;
11027 char str[16];
11028 signal(SIGFPE, blech);
11029
5b813a60 11030 /* Don't let compiler optimize the test away. Store the number
e237eb00 11031 in a writable string for gcc to pass to sscanf under HP-UX.
b4eb6b3d
JH
11032 */
11033 sprintf(str, "2147483647");
11034 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11035 g = 10 * f;
11036 i32 = ($xxx) g;
11037
11038 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 11039 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
11040 behavior here, which is to preserve the sign and give
11041 back 0x7fff ffff.
11042 */
11043 if (i32 != ($xxx) f)
11044 result |= 1;
11045 exit(result);
11046}
11047EOCP
11048set try
11049if eval $compile_ok; then
5440bc8e 11050 $run ./try
b4eb6b3d
JH
11051 yyy=$?
11052else
11053 echo "(I can't seem to compile the test program--assuming it can't)"
11054 yyy=1
11055fi
11056case "$yyy" in
110570) val="$define"
11058 echo "Yup, it can."
11059 ;;
11060*) val="$undef"
11061 echo "Nope, it can't."
11062 ;;
11063esac
11064set d_casti32
11065eval $setvar
5b813a60 11066$rm_try
b4eb6b3d
JH
11067
11068: check for ability to cast negative floats to unsigned
11069echo " "
11070echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11071$cat >try.c <<EOCP
11072#include <stdio.h>
d1daaddf
JH
11073#$i_stdlib I_STDLIB
11074#ifdef I_STDLIB
11075#include <stdlib.h>
11076#endif
b4eb6b3d
JH
11077#include <sys/types.h>
11078#include <signal.h>
7090f861
JH
11079$signal_t blech(int s) { exit(7); }
11080$signal_t blech_in_list(int s) { exit(4); }
11081unsigned long dummy_long(unsigned long p) { return p; }
11082unsigned int dummy_int(unsigned int p) { return p; }
11083unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
11084int main()
11085{
11086 double f;
11087 unsigned long along;
11088 unsigned int aint;
11089 unsigned short ashort;
11090 int result = 0;
11091 char str[16];
5b813a60 11092
b4eb6b3d
JH
11093 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11094 a direct f = -123. assignment. gcc-2.8.0 reportedly
11095 optimized the whole file away
11096 */
5b813a60 11097 /* Store the number in a writable string for gcc to pass to
e237eb00 11098 sscanf under HP-UX.
b4eb6b3d
JH
11099 */
11100 sprintf(str, "-123");
11101 sscanf(str, "%lf", &f); /* f = -123.; */
11102
11103 signal(SIGFPE, blech);
11104 along = (unsigned long)f;
11105 aint = (unsigned int)f;
11106 ashort = (unsigned short)f;
11107 if (along != (unsigned long)-123)
11108 result |= 1;
11109 if (aint != (unsigned int)-123)
11110 result |= 1;
11111 if (ashort != (unsigned short)-123)
11112 result |= 1;
11113 sprintf(str, "1073741824.");
11114 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11115 f = f + f;
11116 along = 0;
11117 along = (unsigned long)f;
11118 if (along != 0x80000000)
11119 result |= 2;
11120 f -= 1.;
11121 along = 0;
11122 along = (unsigned long)f;
11123 if (along != 0x7fffffff)
11124 result |= 1;
11125 f += 2.;
11126 along = 0;
11127 along = (unsigned long)f;
11128 if (along != 0x80000001)
11129 result |= 2;
11130 if (result)
11131 exit(result);
11132 signal(SIGFPE, blech_in_list);
11133 sprintf(str, "123.");
11134 sscanf(str, "%lf", &f); /* f = 123.; */
11135 along = dummy_long((unsigned long)f);
11136 aint = dummy_int((unsigned int)f);
11137 ashort = dummy_short((unsigned short)f);
11138 if (along != (unsigned long)123)
11139 result |= 4;
11140 if (aint != (unsigned int)123)
11141 result |= 4;
11142 if (ashort != (unsigned short)123)
11143 result |= 4;
11144 exit(result);
11145
11146}
11147EOCP
11148set try
11149if eval $compile_ok; then
5440bc8e 11150 $run ./try
b4eb6b3d
JH
11151 castflags=$?
11152else
11153 echo "(I can't seem to compile the test program--assuming it can't)"
11154 castflags=7
11155fi
11156case "$castflags" in
111570) val="$define"
11158 echo "Yup, it can."
11159 ;;
11160*) val="$undef"
11161 echo "Nope, it can't."
11162 ;;
11163esac
11164set d_castneg
11165eval $setvar
5b813a60 11166$rm_try
b4eb6b3d
JH
11167
11168: see if vprintf exists
11169echo " "
11170if set vprintf val -f d_vprintf; eval $csym; $val; then
11171 echo 'vprintf() found.' >&4
11172 val="$define"
55954f19 11173 $cat >try.c <<EOF
d0bc9cc8
AD
11174#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11175#$i_varargs I_VARARGS
11176
55954f19 11177#$i_stdlib I_STDLIB
d0bc9cc8
AD
11178#$i_unistd I_UNISTD
11179
11180#ifdef I_STDARG
11181# include <stdarg.h>
11182#else /* I_VARARGS */
11183# include <varargs.h>
11184#endif
11185
11186#ifdef I_UNISTD
11187# include <unistd.h>
11188#endif
11189
55954f19 11190#ifdef I_STDLIB
d0bc9cc8 11191# include <stdlib.h>
55954f19 11192#endif
b4eb6b3d 11193
d0bc9cc8
AD
11194#include <stdio.h> /* vsprintf prototype */
11195
11196#ifdef I_STDARG
11197void xxx(int n, ...)
11198{
11199 va_list args;
11200 char buf[10];
11201 va_start(args, n);
11202 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11203}
11204int main() { xxx(1, "foo"); }
11205
11206#else /* I_VARARGS */
b4eb6b3d
JH
11207
11208xxx(va_alist)
11209va_dcl
11210{
d0bc9cc8
AD
11211 va_list args;
11212 char buf[10];
11213 va_start(args);
11214 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 11215}
d0bc9cc8
AD
11216int main() { xxx("foo"); }
11217
11218#endif
11219
b4eb6b3d 11220EOF
5440bc8e 11221 set try
d0bc9cc8
AD
11222 if eval $compile_ok; then
11223 if $run ./try; then
11224 echo "Your vsprintf() returns (int)." >&4
11225 val2="$undef"
11226 else
11227 echo "Your vsprintf() returns (char*)." >&4
11228 val2="$define"
11229 fi
b4eb6b3d 11230 else
d0bc9cc8
AD
11231 echo 'I am unable to compile the vsprintf() test program.' >&4
11232 # We shouldn't get here. If we do, assume the standard signature,
11233 # not the old BSD one.
11234 echo 'Guessing that vsprintf() returns (int).' >&4
11235 val2="$undef"
b4eb6b3d
JH
11236 fi
11237else
11238 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
11239 val="$undef"
11240 val2="$undef"
b4eb6b3d 11241fi
5b813a60 11242$rm_try
b4eb6b3d
JH
11243set d_vprintf
11244eval $setvar
11245val=$val2
11246set d_charvspr
11247eval $setvar
11248
11249: see if chown exists
11250set chown d_chown
11251eval $inlibc
11252
11253: see if chroot exists
11254set chroot d_chroot
11255eval $inlibc
11256
11257: see if chsize exists
11258set chsize d_chsize
11259eval $inlibc
11260
758a5d79
JH
11261: see if class exists
11262set class d_class
11263eval $inlibc
11264
b0a2e8e6
MB
11265: see if clearenv exists
11266set clearenv d_clearenv
11267eval $inlibc
11268
34f1896b 11269: Define hasstruct macro for Configure internal use
4e0554ec
JH
11270hasstruct='varname=$1; struct=$2; shift; shift;
11271while $test $# -ge 2; do
11272 case "$1" in
11273 $define) echo "#include <$2>";;
11274 esac ;
11275 shift 2;
11276done > try.c;
11277echo "int main () { struct $struct foo; }" >> try.c;
11278set try;
11279if eval $compile; then
11280 val="$define";
11281else
11282 val="$undef";
11283fi;
11284set $varname;
11285eval $setvar;
5b813a60 11286$rm_try'
4e0554ec 11287
34f1896b 11288: see whether socket exists
4e0554ec
JH
11289socketlib=''
11290sockethdr=''
4e0554ec
JH
11291echo " "
11292$echo $n "Hmm... $c" >&4
11293if set socket val -f d_socket; eval $csym; $val; then
11294 echo "Looks like you have Berkeley networking support." >&4
11295 d_socket="$define"
11296 if set setsockopt val -f; eval $csym; $val; then
11297 d_oldsock="$undef"
11298 else
11299 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11300 d_oldsock="$define"
11301 fi
11302else
11303 if $contains socklib libc.list >/dev/null 2>&1; then
11304 echo "Looks like you have Berkeley networking support." >&4
11305 d_socket="$define"
11306 : we will have to assume that it supports the 4.2 BSD interface
11307 d_oldsock="$undef"
11308 else
11309 echo "You don't have Berkeley networking in libc$_a..." >&4
11310 if test "X$d_socket" = "X$define"; then
11311 echo "...but you seem to believe that you have sockets." >&4
11312 else
11313 for net in net socket
11314 do
11315 if test -f /usr/lib/lib$net$_a; then
11316 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
11317 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11318 if $contains socket libc.list >/dev/null 2>&1; then
11319 d_socket="$define"
11320 socketlib="-l$net"
11321 case "$net" in
11322 net)
11323 echo "...but the Wollongong group seems to have hacked it in." >&4
11324 sockethdr="-I/usr/netinclude"
11325 ;;
11326 esac
5b813a60 11327 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
11328 if $contains setsockopt libc.list >/dev/null 2>&1; then
11329 d_oldsock="$undef"
11330 else
11331 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11332 d_oldsock="$define"
11333 fi
11334 break
11335 fi
11336 fi
11337 done
11338 if test "X$d_socket" != "X$define"; then
11339 echo "or anywhere else I see." >&4
11340 d_socket="$undef"
11341 d_oldsock="$undef"
11342 fi
11343 fi
11344 fi
11345fi
11346
11347: see if socketpair exists
11348set socketpair d_sockpair
11349eval $inlibc
11350
11351
11352echo " "
3c728e00 11353echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11354for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11355 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11356 $cat >try.c <<EOF
11357#include <sys/types.h>
11358#include <sys/socket.h>
11359int main() {
11360 int i = $ENUM;
11361}
11362EOF
11363 val="$undef"
11364 set try; if eval $compile; then
11365 val="$define"
11366 fi
11367 set d_${enum}; eval $setvar
5b813a60 11368 $rm_try
4e0554ec
JH
11369done
11370
11371: see if this is a sys/uio.h system
11372set sys/uio.h i_sysuio
11373eval $inhdr
11374
34f1896b 11375: Check for cmsghdr support
4e0554ec
JH
11376echo " "
11377echo "Checking to see if your system supports struct cmsghdr..." >&4
11378set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11379eval $hasstruct
11380case "$d_cmsghdr_s" in
11381"$define") echo "Yes, it does." ;;
11382*) echo "No, it doesn't." ;;
11383esac
11384
11385
b4eb6b3d
JH
11386: check for const keyword
11387echo " "
11388echo 'Checking to see if your C compiler knows about "const"...' >&4
11389$cat >const.c <<'EOCP'
11390typedef struct spug { int drokk; } spug;
76f47787 11391int main()
b4eb6b3d
JH
11392{
11393 const char *foo;
666ea192 11394 const spug y = { 0 };
b4eb6b3d
JH
11395}
11396EOCP
11397if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11398 val="$define"
11399 echo "Yup, it does."
11400else
11401 val="$undef"
11402 echo "Nope, it doesn't."
11403fi
11404set d_const
11405eval $setvar
11406
89ce900e
JH
11407: see if copysignl exists
11408set copysignl d_copysignl
11409eval $inlibc
11410
b4eb6b3d
JH
11411: see if crypt exists
11412echo " "
a5a94ea5
JH
11413set crypt d_crypt
11414eval $inlibc
11415case "$d_crypt" in
11416$define) cryptlib='' ;;
11417*) if set crypt val -f d_crypt; eval $csym; $val; then
11418 echo 'crypt() found.' >&4
b4eb6b3d 11419 val="$define"
a5a94ea5
JH
11420 cryptlib=''
11421 else
11422 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11423 if $test -z "$cryptlib"; then
11424 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11425 else
11426 cryptlib=-lcrypt
11427 fi
11428 if $test -z "$cryptlib"; then
11429 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11430 else
11431 cryptlib=-lcrypt
11432 fi
11433 if $test -z "$cryptlib"; then
11434 cryptlib=`./loc libcrypt$_a "" $libpth`
11435 else
11436 cryptlib=-lcrypt
11437 fi
11438 if $test -z "$cryptlib"; then
11439 echo 'crypt() NOT found.' >&4
11440 val="$undef"
11441 else
11442 val="$define"
11443 fi
b4eb6b3d 11444 fi
a5a94ea5
JH
11445 set d_crypt
11446 eval $setvar
11447 ;;
11448esac
b4eb6b3d 11449
10bc17b6
JH
11450: see if this is a crypt.h system
11451set crypt.h i_crypt
11452eval $inhdr
11453
11454: see if crypt_r exists
11455set crypt_r d_crypt_r
11456eval $inlibc
11457case "$d_crypt_r" in
11458"$define")
11459 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11460 case "$d_crypt_r_proto:$usethreads" in
11461 ":define") d_crypt_r_proto=define
a48ec845
JH
11462 set d_crypt_r_proto crypt_r $hdrs
11463 eval $hasproto ;;
11464 *) ;;
11465 esac
11466 case "$d_crypt_r_proto" in
11467 define)
10bc17b6
JH
11468 case "$crypt_r_proto" in
11469 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
61c26d18 11470 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
10bc17b6
JH
11471 esac
11472 case "$crypt_r_proto" in
b430fd04 11473 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
61c26d18 11474 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
b430fd04
JH
11475 esac
11476 case "$crypt_r_proto" in
90e831dc 11477 ''|0) d_crypt_r=undef
10bc17b6 11478 crypt_r_proto=0
a48ec845 11479 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11480 * ) case "$crypt_r_proto" in
11481 REENTRANT_PROTO*) ;;
11482 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11483 esac
11484 echo "Prototype: $try" ;;
11485 esac
11486 ;;
c18e646a
JH
11487 *) case "$usethreads" in
11488 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11489 esac
90e831dc
SB
11490 d_crypt_r=undef
11491 crypt_r_proto=0
c18e646a 11492 ;;
a48ec845
JH
11493 esac
11494 ;;
10bc17b6
JH
11495*) crypt_r_proto=0
11496 ;;
11497esac
11498
b4eb6b3d
JH
11499: get csh whereabouts
11500case "$csh" in
11501'csh') val="$undef" ;;
11502*) val="$define" ;;
11503esac
11504set d_csh
11505eval $setvar
11506: Respect a hint or command line value for full_csh.
11507case "$full_csh" in
11508'') full_csh=$csh ;;
11509esac
11510
13cfc98d
MB
11511: see if ctermid exists
11512set ctermid d_ctermid
11513eval $inlibc
11514
10bc17b6
JH
11515: see if ctermid_r exists
11516set ctermid_r d_ctermid_r
11517eval $inlibc
11518case "$d_ctermid_r" in
11519"$define")
31ee0cb7 11520 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11521 case "$d_ctermid_r_proto:$usethreads" in
11522 ":define") d_ctermid_r_proto=define
a48ec845
JH
11523 set d_ctermid_r_proto ctermid_r $hdrs
11524 eval $hasproto ;;
11525 *) ;;
11526 esac
11527 case "$d_ctermid_r_proto" in
11528 define)
10bc17b6
JH
11529 case "$ctermid_r_proto" in
11530 ''|0) try='char* ctermid_r(char*);'
61c26d18 11531 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
10bc17b6
JH
11532 esac
11533 case "$ctermid_r_proto" in
90e831dc 11534 ''|0) d_ctermid_r=undef
10bc17b6 11535 ctermid_r_proto=0
a48ec845 11536 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11537 * ) case "$ctermid_r_proto" in
11538 REENTRANT_PROTO*) ;;
11539 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11540 esac
11541 echo "Prototype: $try" ;;
11542 esac
11543 ;;
c18e646a
JH
11544 *) case "$usethreads" in
11545 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11546 esac
90e831dc
SB
11547 d_ctermid_r=undef
11548 ctermid_r_proto=0
c18e646a 11549 ;;
a48ec845
JH
11550 esac
11551 ;;
10bc17b6
JH
11552*) ctermid_r_proto=0
11553 ;;
11554esac
11555
11556: see if ctime_r exists
11557set ctime_r d_ctime_r
11558eval $inlibc
11559case "$d_ctime_r" in
11560"$define")
d63eadf0 11561 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11562 case "$d_ctime_r_proto:$usethreads" in
11563 ":define") d_ctime_r_proto=define
a48ec845
JH
11564 set d_ctime_r_proto ctime_r $hdrs
11565 eval $hasproto ;;
11566 *) ;;
11567 esac
11568 case "$d_ctime_r_proto" in
11569 define)
10bc17b6
JH
11570 case "$ctime_r_proto" in
11571 ''|0) try='char* ctime_r(const time_t*, char*);'
61c26d18 11572 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
10bc17b6
JH
11573 esac
11574 case "$ctime_r_proto" in
11575 ''|0) try='char* ctime_r(const time_t*, char*, int);'
61c26d18 11576 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
10bc17b6
JH
11577 esac
11578 case "$ctime_r_proto" in
11579 ''|0) try='int ctime_r(const time_t*, char*);'
61c26d18 11580 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
10bc17b6
JH
11581 esac
11582 case "$ctime_r_proto" in
11583 ''|0) try='int ctime_r(const time_t*, char*, int);'
61c26d18 11584 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
10bc17b6
JH
11585 esac
11586 case "$ctime_r_proto" in
90e831dc 11587 ''|0) d_ctime_r=undef
10bc17b6 11588 ctime_r_proto=0
a48ec845 11589 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11590 * ) case "$ctime_r_proto" in
11591 REENTRANT_PROTO*) ;;
11592 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11593 esac
11594 echo "Prototype: $try" ;;
11595 esac
11596 ;;
c18e646a
JH
11597 *) case "$usethreads" in
11598 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11599 esac
90e831dc
SB
11600 d_ctime_r=undef
11601 ctime_r_proto=0
c18e646a 11602 ;;
a48ec845
JH
11603 esac
11604 ;;
10bc17b6
JH
11605*) ctime_r_proto=0
11606 ;;
11607esac
11608
b4eb6b3d
JH
11609: see if cuserid exists
11610set cuserid d_cuserid
11611eval $inlibc
11612
11613: see if this is a limits.h system
11614set limits.h i_limits
11615eval $inhdr
11616
11617: see if this is a float.h system
11618set float.h i_float
11619eval $inhdr
11620
11621: See if number of significant digits in a double precision number is known
11622echo " "
11623$cat >dbl_dig.c <<EOM
11624#$i_limits I_LIMITS
11625#$i_float I_FLOAT
11626#ifdef I_LIMITS
11627#include <limits.h>
11628#endif
11629#ifdef I_FLOAT
11630#include <float.h>
11631#endif
11632#ifdef DBL_DIG
11633printf("Contains DBL_DIG");
11634#endif
11635EOM
11636$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11637if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11638 echo "DBL_DIG found." >&4
11639 val="$define"
11640else
11641 echo "DBL_DIG NOT found." >&4
11642 val="$undef"
11643fi
11644$rm -f dbl_dig.?
11645set d_dbl_dig
11646eval $setvar
11647
2ef53570
JH
11648: see if dbm.h is available
11649: see if dbmclose exists
11650set dbmclose d_dbmclose
11651eval $inlibc
11652
11653case "$d_dbmclose" in
11654$define)
11655 set dbm.h i_dbm
11656 eval $inhdr
11657 case "$i_dbm" in
11658 $define)
11659 val="$undef"
11660 set i_rpcsvcdbm
11661 eval $setvar
11662 ;;
11663 *) set rpcsvc/dbm.h i_rpcsvcdbm
11664 eval $inhdr
11665 ;;
11666 esac
11667 ;;
11668*) echo "We won't be including <dbm.h>"
11669 val="$undef"
11670 set i_dbm
11671 eval $setvar
11672 val="$undef"
11673 set i_rpcsvcdbm
11674 eval $setvar
11675 ;;
11676esac
11677
11678: see if prototype for dbminit is available
11679echo " "
11680set d_dbminitproto dbminit $i_dbm dbm.h
11681eval $hasproto
11682
b4eb6b3d
JH
11683: see if difftime exists
11684set difftime d_difftime
11685eval $inlibc
11686
11687: see if this is a dirent system
11688echo " "
11689if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11690 val="$define"
11691 echo "<dirent.h> found." >&4
11692else
11693 val="$undef"
11694 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11695 echo "<sys/dir.h> found." >&4
11696 echo " "
11697 else
11698 xinc=`./findhdr sys/ndir.h`
11699 fi
11700 echo "<dirent.h> NOT found." >&4
11701fi
11702set i_dirent
11703eval $setvar
11704
11705: Look for type of directory structure.
11706echo " "
11707$cppstdin $cppflags $cppminus < "$xinc" > try.c
11708
11709case "$direntrytype" in
11710''|' ')
11711 case "$i_dirent" in
11712 $define) guess1='struct dirent' ;;
11713 *) guess1='struct direct' ;;
11714 esac
11715 ;;
11716*) guess1="$direntrytype"
11717 ;;
11718esac
11719
11720case "$guess1" in
11721'struct dirent') guess2='struct direct' ;;
11722*) guess2='struct dirent' ;;
11723esac
5b813a60 11724
b4eb6b3d
JH
11725if $contains "$guess1" try.c >/dev/null 2>&1; then
11726 direntrytype="$guess1"
11727 echo "Your directory entries are $direntrytype." >&4
11728elif $contains "$guess2" try.c >/dev/null 2>&1; then
11729 direntrytype="$guess2"
11730 echo "Your directory entries seem to be $direntrytype." >&4
11731else
11732 echo "I don't recognize your system's directory entries." >&4
11733 rp="What type is used for directory entries on this system?"
11734 dflt="$guess1"
11735 . ./myread
11736 direntrytype="$ans"
11737fi
5b813a60 11738$rm_try
b4eb6b3d
JH
11739
11740: see if the directory entry stores field length
11741echo " "
11742$cppstdin $cppflags $cppminus < "$xinc" > try.c
11743if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11744 echo "Good, your directory entry keeps length information in d_namlen." >&4
11745 val="$define"
11746else
11747 echo "Your directory entry does not know about the d_namlen field." >&4
11748 val="$undef"
11749fi
11750set d_dirnamlen
11751eval $setvar
5b813a60 11752$rm_try
b4eb6b3d 11753
de52168c
SP
11754: Look for DIR.dd_fd
11755case "$i_dirent" in
11756"$define")
11757 echo "Checking to see if DIR has a dd_fd member variable" >&4
11758 $cat >try.c <<EOCP
11759#$i_stdlib I_STDLIB
11760#ifdef I_STDLIB
11761#include <stdlib.h>
11762#endif
11763#include <dirent.h>
11764
11765int main() {
11766 DIR dir;
11767 dir.dd_fd = 1;
11768 return 0;
11769}
11770EOCP
11771 val=$undef
11772 set try
11773 if eval $compile; then
11774 echo "Yes, it does."
11775 val="$define"
11776 else
11777 echo "No, it does not."
11778 val="$undef"
11779 fi
11780 ;;
11781*)
11782 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11783 val="$undef"
11784 ;;
11785esac
11786set d_dir_dd_fd
11787eval $setvar
5b813a60 11788$rm_try
de52168c 11789
ae0e3d3b
JH
11790: see if this is an sysdir system
11791set sys/dir.h i_sysdir
11792eval $inhdr
11793
11794: see if this is an sysndir system
11795set sys/ndir.h i_sysndir
11796eval $inhdr
11797
11798: Look for dirfd
11799echo " "
11800$cat >dirfd.c <<EOM
11801#include <stdio.h>
55954f19
JH
11802#$i_stdlib I_STDLIB
11803#ifdef I_STDLIB
11804#include <stdlib.h>
11805#endif
ae0e3d3b
JH
11806#$i_dirent I_DIRENT /**/
11807#$i_sysdir I_SYS_DIR /**/
11808#$i_sysndir I_SYS_NDIR /**/
11809#$i_systypes I_SYS_TYPES /**/
11810#if defined(I_SYS_TYPES)
11811#include <sys/types.h>
11812#endif
11813#if defined(I_DIRENT)
11814#include <dirent.h>
11815#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11816#include <sys/dir.h>
11817#endif
11818#else
11819#ifdef I_SYS_NDIR
11820#include <sys/ndir.h>
11821#else
11822#ifdef I_SYS_DIR
11823#ifdef hp9000s500
11824#include <ndir.h> /* may be wrong in the future */
11825#else
11826#include <sys/dir.h>
11827#endif
11828#endif
11829#endif
11830#endif
11831int main() {
11832 DIR *dirp = opendir(".");
11833 if (dirfd(dirp) >= 0)
11834 exit(0);
11835 else
11836 exit(1);
11837}
11838EOM
5cadb3f3 11839val=$undef
ae0e3d3b
JH
11840set dirfd
11841if eval $compile; then
11842 val="$define"
11843fi
11844case "$val" in
11845$define) echo "dirfd() found." >&4 ;;
11846*) echo "dirfd() NOT found." >&4 ;;
11847esac
11848set d_dirfd
11849eval $setvar
11850$rm -f dirfd*
11851
b4eb6b3d
JH
11852: see if dlerror exists
11853xxx_runnm="$runnm"
11854runnm=false
11855set dlerror d_dlerror
11856eval $inlibc
11857runnm="$xxx_runnm"
11858
11859: see if dlfcn is available
11860set dlfcn.h i_dlfcn
11861eval $inhdr
11862
34f1896b 11863: Check what extension to use for shared libs
b4eb6b3d
JH
11864case "$usedl" in
11865$define|y|true)
11866 $cat << EOM
11867
11868On a few systems, the dynamically loaded modules that perl generates and uses
11869will need a different extension than shared libs. The default will probably
11870be appropriate.
11871
11872EOM
11873 case "$dlext" in
11874 '') dflt="$so" ;;
11875 *) dflt="$dlext" ;;
11876 esac
11877 rp='What is the extension of dynamically loaded modules'
11878 . ./myread
11879 dlext="$ans"
11880 ;;
11881*)
11882 dlext="none"
11883 ;;
11884esac
11885
11886: Check if dlsym need a leading underscore
11887echo " "
11888val="$undef"
11889
11890case "$dlsrc" in
11891dl_dlopen.xs)
11892 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11893 $cat >dyna.c <<'EOM'
11894fred () { }
11895EOM
11896
11897$cat >fred.c<<EOM
11898
11899#include <stdio.h>
55954f19
JH
11900#$i_stdlib I_STDLIB
11901#ifdef I_STDLIB
11902#include <stdlib.h>
11903#endif
b4eb6b3d
JH
11904#$i_dlfcn I_DLFCN
11905#ifdef I_DLFCN
5440bc8e 11906#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11907#else
11908#include <sys/types.h>
11909#include <nlist.h>
11910#include <link.h>
11911#endif
11912
11913extern int fred() ;
11914
11915int main()
11916{
11917 void * handle ;
11918 void * symbol ;
11919#ifndef RTLD_LAZY
11920 int mode = 1 ;
11921#else
11922 int mode = RTLD_LAZY ;
11923#endif
11924 handle = dlopen("./dyna.$dlext", mode) ;
11925 if (handle == NULL) {
11926 printf ("1\n") ;
11927 fflush (stdout) ;
11928 exit(0);
11929 }
11930 symbol = dlsym(handle, "fred") ;
11931 if (symbol == NULL) {
11932 /* try putting a leading underscore */
11933 symbol = dlsym(handle, "_fred") ;
11934 if (symbol == NULL) {
11935 printf ("2\n") ;
11936 fflush (stdout) ;
11937 exit(0);
11938 }
11939 printf ("3\n") ;
11940 }
11941 else
11942 printf ("4\n") ;
11943 fflush (stdout) ;
11944 exit(0);
11945}
11946EOM
11947 : Call the object file tmp-dyna.o in case dlext=o.
613d6c3e
MB
11948 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11949 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11950 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11951 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11952 xxx=`$run ./fred`
b4eb6b3d
JH
11953 case $xxx in
11954 1) echo "Test program failed using dlopen." >&4
11955 echo "Perhaps you should not use dynamic loading." >&4;;
11956 2) echo "Test program failed using dlsym." >&4
11957 echo "Perhaps you should not use dynamic loading." >&4;;
11958 3) echo "dlsym needs a leading underscore" >&4
11959 val="$define" ;;
11960 4) echo "dlsym doesn't need a leading underscore." >&4;;
11961 esac
11962 else
11963 echo "I can't compile and run the test program." >&4
11964 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11965 fi
11966 ;;
11967esac
613d6c3e 11968
3c728e00 11969$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11970
11971set d_dlsymun
11972eval $setvar
11973
10bc17b6
JH
11974: see if drand48_r exists
11975set drand48_r d_drand48_r
11976eval $inlibc
11977case "$d_drand48_r" in
11978"$define")
11979 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11980 case "$d_drand48_r_proto:$usethreads" in
11981 ":define") d_drand48_r_proto=define
a48ec845
JH
11982 set d_drand48_r_proto drand48_r $hdrs
11983 eval $hasproto ;;
11984 *) ;;
11985 esac
11986 case "$d_drand48_r_proto" in
11987 define)
10bc17b6
JH
11988 case "$drand48_r_proto" in
11989 ''|0) try='int drand48_r(struct drand48_data*, double*);'
61c26d18 11990 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
10bc17b6
JH
11991 esac
11992 case "$drand48_r_proto" in
90e831dc 11993 ''|0) d_drand48_r=undef
10bc17b6 11994 drand48_r_proto=0
a48ec845 11995 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11996 * ) case "$drand48_r_proto" in
11997 REENTRANT_PROTO*) ;;
11998 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11999 esac
12000 echo "Prototype: $try" ;;
12001 esac
12002 ;;
c18e646a
JH
12003 *) case "$usethreads" in
12004 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12005 esac
90e831dc
SB
12006 d_drand48_r=undef
12007 drand48_r_proto=0
c18e646a 12008 ;;
a48ec845
JH
12009 esac
12010 ;;
10bc17b6
JH
12011*) drand48_r_proto=0
12012 ;;
12013esac
12014
12015: see if prototype for drand48 is available
12016echo " "
12017set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12018eval $hasproto
12019
b4eb6b3d
JH
12020: see if dup2 exists
12021set dup2 d_dup2
12022eval $inlibc
12023
12024: see if eaccess exists
12025set eaccess d_eaccess
12026eval $inlibc
12027
12028: see if endgrent exists
12029set endgrent d_endgrent
12030eval $inlibc
12031
10bc17b6
JH
12032: see if this is an grp system
12033set grp.h i_grp
12034eval $inhdr
12035
12036case "$i_grp" in
12037$define)
12038 xxx=`./findhdr grp.h`
12039 $cppstdin $cppflags $cppminus < $xxx >$$.h
12040
12041 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12042 val="$define"
12043 else
12044 val="$undef"
12045 fi
12046 set d_grpasswd
12047 eval $setvar
12048
12049 $rm -f $$.h
12050 ;;
12051*)
12052 val="$undef";
12053 set d_grpasswd; eval $setvar
12054 ;;
12055esac
12056
12057: see if endgrent_r exists
12058set endgrent_r d_endgrent_r
12059eval $inlibc
12060case "$d_endgrent_r" in
12061"$define")
12062 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12063 case "$d_endgrent_r_proto:$usethreads" in
12064 ":define") d_endgrent_r_proto=define
a48ec845
JH
12065 set d_endgrent_r_proto endgrent_r $hdrs
12066 eval $hasproto ;;
12067 *) ;;
12068 esac
12069 case "$d_endgrent_r_proto" in
12070 define)
10bc17b6
JH
12071 case "$endgrent_r_proto" in
12072 ''|0) try='int endgrent_r(FILE**);'
61c26d18 12073 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
10bc17b6
JH
12074 esac
12075 case "$endgrent_r_proto" in
12076 ''|0) try='void endgrent_r(FILE**);'
61c26d18 12077 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
10bc17b6
JH
12078 esac
12079 case "$endgrent_r_proto" in
90e831dc 12080 ''|0) d_endgrent_r=undef
10bc17b6 12081 endgrent_r_proto=0
a48ec845 12082 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12083 * ) case "$endgrent_r_proto" in
12084 REENTRANT_PROTO*) ;;
12085 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12086 esac
12087 echo "Prototype: $try" ;;
12088 esac
12089 ;;
c18e646a
JH
12090 *) case "$usethreads" in
12091 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12092 esac
90e831dc
SB
12093 d_endgrent_r=undef
12094 endgrent_r_proto=0
c18e646a 12095 ;;
a48ec845
JH
12096 esac
12097 ;;
10bc17b6
JH
12098*) endgrent_r_proto=0
12099 ;;
12100esac
12101
b4eb6b3d
JH
12102: see if endhostent exists
12103set endhostent d_endhent
12104eval $inlibc
12105
10bc17b6
JH
12106: see if this is a netdb.h system
12107set netdb.h i_netdb
12108eval $inhdr
12109
12110: see if endhostent_r exists
12111set endhostent_r d_endhostent_r
12112eval $inlibc
12113case "$d_endhostent_r" in
12114"$define")
12115 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12116 case "$d_endhostent_r_proto:$usethreads" in
12117 ":define") d_endhostent_r_proto=define
a48ec845
JH
12118 set d_endhostent_r_proto endhostent_r $hdrs
12119 eval $hasproto ;;
12120 *) ;;
12121 esac
12122 case "$d_endhostent_r_proto" in
12123 define)
10bc17b6
JH
12124 case "$endhostent_r_proto" in
12125 ''|0) try='int endhostent_r(struct hostent_data*);'
61c26d18 12126 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
12127 esac
12128 case "$endhostent_r_proto" in
12129 ''|0) try='void endhostent_r(struct hostent_data*);'
61c26d18 12130 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
12131 esac
12132 case "$endhostent_r_proto" in
90e831dc 12133 ''|0) d_endhostent_r=undef
10bc17b6 12134 endhostent_r_proto=0
a48ec845 12135 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12136 * ) case "$endhostent_r_proto" in
12137 REENTRANT_PROTO*) ;;
12138 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12139 esac
12140 echo "Prototype: $try" ;;
12141 esac
12142 ;;
c18e646a
JH
12143 *) case "$usethreads" in
12144 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12145 esac
90e831dc
SB
12146 d_endhostent_r=undef
12147 endhostent_r_proto=0
c18e646a 12148 ;;
a48ec845
JH
12149 esac
12150 ;;
10bc17b6
JH
12151*) endhostent_r_proto=0
12152 ;;
12153esac
12154
b4eb6b3d
JH
12155: see if endnetent exists
12156set endnetent d_endnent
12157eval $inlibc
12158
10bc17b6
JH
12159: see if endnetent_r exists
12160set endnetent_r d_endnetent_r
12161eval $inlibc
12162case "$d_endnetent_r" in
12163"$define")
12164 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12165 case "$d_endnetent_r_proto:$usethreads" in
12166 ":define") d_endnetent_r_proto=define
a48ec845
JH
12167 set d_endnetent_r_proto endnetent_r $hdrs
12168 eval $hasproto ;;
12169 *) ;;
12170 esac
12171 case "$d_endnetent_r_proto" in
12172 define)
10bc17b6
JH
12173 case "$endnetent_r_proto" in
12174 ''|0) try='int endnetent_r(struct netent_data*);'
61c26d18 12175 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
12176 esac
12177 case "$endnetent_r_proto" in
12178 ''|0) try='void endnetent_r(struct netent_data*);'
61c26d18 12179 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
12180 esac
12181 case "$endnetent_r_proto" in
90e831dc 12182 ''|0) d_endnetent_r=undef
10bc17b6 12183 endnetent_r_proto=0
a48ec845 12184 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12185 * ) case "$endnetent_r_proto" in
12186 REENTRANT_PROTO*) ;;
12187 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12188 esac
12189 echo "Prototype: $try" ;;
12190 esac
12191 ;;
c18e646a
JH
12192 *) case "$usethreads" in
12193 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12194 esac
90e831dc
SB
12195 d_endnetent_r=undef
12196 endnetent_r_proto=0
c18e646a 12197 ;;
a48ec845
JH
12198 esac
12199 ;;
10bc17b6
JH
12200*) endnetent_r_proto=0
12201 ;;
12202esac
12203
b4eb6b3d
JH
12204: see if endprotoent exists
12205set endprotoent d_endpent
12206eval $inlibc
12207
10bc17b6
JH
12208: see if endprotoent_r exists
12209set endprotoent_r d_endprotoent_r
12210eval $inlibc
12211case "$d_endprotoent_r" in
12212"$define")
12213 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12214 case "$d_endprotoent_r_proto:$usethreads" in
12215 ":define") d_endprotoent_r_proto=define
a48ec845
JH
12216 set d_endprotoent_r_proto endprotoent_r $hdrs
12217 eval $hasproto ;;
12218 *) ;;
12219 esac
12220 case "$d_endprotoent_r_proto" in
12221 define)
10bc17b6
JH
12222 case "$endprotoent_r_proto" in
12223 ''|0) try='int endprotoent_r(struct protoent_data*);'
61c26d18 12224 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
12225 esac
12226 case "$endprotoent_r_proto" in
12227 ''|0) try='void endprotoent_r(struct protoent_data*);'
61c26d18 12228 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
12229 esac
12230 case "$endprotoent_r_proto" in
90e831dc 12231 ''|0) d_endprotoent_r=undef
10bc17b6 12232 endprotoent_r_proto=0
a48ec845 12233 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12234 * ) case "$endprotoent_r_proto" in
12235 REENTRANT_PROTO*) ;;
12236 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12237 esac
12238 echo "Prototype: $try" ;;
12239 esac
12240 ;;
c18e646a
JH
12241 *) case "$usethreads" in
12242 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12243 esac
90e831dc
SB
12244 d_endprotoent_r=undef
12245 endprotoent_r_proto=0
c18e646a 12246 ;;
a48ec845
JH
12247 esac
12248 ;;
10bc17b6
JH
12249*) endprotoent_r_proto=0
12250 ;;
12251esac
12252
b4eb6b3d
JH
12253: see if endpwent exists
12254set endpwent d_endpwent
12255eval $inlibc
12256
10bc17b6
JH
12257: see if this is a pwd.h system
12258set pwd.h i_pwd
12259eval $inhdr
12260
12261case "$i_pwd" in
12262$define)
12263 xxx=`./findhdr pwd.h`
12264 $cppstdin $cppflags $cppminus < $xxx >$$.h
12265
12266 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12267 val="$define"
12268 else
12269 val="$undef"
12270 fi
12271 set d_pwquota
12272 eval $setvar
12273
12274 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12275 val="$define"
12276 else
12277 val="$undef"
12278 fi
12279 set d_pwage
12280 eval $setvar
12281
12282 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12283 val="$define"
12284 else
12285 val="$undef"
12286 fi
12287 set d_pwchange
12288 eval $setvar
12289
12290 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12291 val="$define"
12292 else
12293 val="$undef"
12294 fi
12295 set d_pwclass
12296 eval $setvar
12297
12298 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12299 val="$define"
12300 else
12301 val="$undef"
12302 fi
12303 set d_pwexpire
12304 eval $setvar
12305
12306 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12307 val="$define"
12308 else
12309 val="$undef"
12310 fi
12311 set d_pwcomment
12312 eval $setvar
12313
12314 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12315 val="$define"
12316 else
12317 val="$undef"
12318 fi
12319 set d_pwgecos
12320 eval $setvar
12321
12322 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12323 val="$define"
12324 else
12325 val="$undef"
12326 fi
12327 set d_pwpasswd
12328 eval $setvar
12329
12330 $rm -f $$.h
12331 ;;
12332*)
12333 val="$undef";
12334 set d_pwquota; eval $setvar
12335 set d_pwage; eval $setvar
12336 set d_pwchange; eval $setvar
12337 set d_pwclass; eval $setvar
12338 set d_pwexpire; eval $setvar
12339 set d_pwcomment; eval $setvar
12340 set d_pwgecos; eval $setvar
12341 set d_pwpasswd; eval $setvar
12342 ;;
12343esac
12344
12345: see if endpwent_r exists
12346set endpwent_r d_endpwent_r
12347eval $inlibc
12348case "$d_endpwent_r" in
12349"$define")
12350 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12351 case "$d_endpwent_r_proto:$usethreads" in
12352 ":define") d_endpwent_r_proto=define
a48ec845
JH
12353 set d_endpwent_r_proto endpwent_r $hdrs
12354 eval $hasproto ;;
12355 *) ;;
12356 esac
12357 case "$d_endpwent_r_proto" in
12358 define)
10bc17b6
JH
12359 case "$endpwent_r_proto" in
12360 ''|0) try='int endpwent_r(FILE**);'
61c26d18 12361 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
10bc17b6
JH
12362 esac
12363 case "$endpwent_r_proto" in
12364 ''|0) try='void endpwent_r(FILE**);'
61c26d18 12365 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
10bc17b6
JH
12366 esac
12367 case "$endpwent_r_proto" in
90e831dc 12368 ''|0) d_endpwent_r=undef
10bc17b6 12369 endpwent_r_proto=0
a48ec845 12370 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12371 * ) case "$endpwent_r_proto" in
12372 REENTRANT_PROTO*) ;;
12373 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12374 esac
12375 echo "Prototype: $try" ;;
12376 esac
12377 ;;
c18e646a
JH
12378 *) case "$usethreads" in
12379 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12380 esac
90e831dc
SB
12381 d_endpwent_r=undef
12382 endpwent_r_proto=0
c18e646a 12383 ;;
a48ec845
JH
12384 esac
12385 ;;
10bc17b6
JH
12386*) endpwent_r_proto=0
12387 ;;
12388esac
12389
b4eb6b3d
JH
12390: see if endservent exists
12391set endservent d_endsent
12392eval $inlibc
12393
10bc17b6
JH
12394: see if endservent_r exists
12395set endservent_r d_endservent_r
12396eval $inlibc
12397case "$d_endservent_r" in
12398"$define")
12399 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12400 case "$d_endservent_r_proto:$usethreads" in
12401 ":define") d_endservent_r_proto=define
a48ec845
JH
12402 set d_endservent_r_proto endservent_r $hdrs
12403 eval $hasproto ;;
12404 *) ;;
12405 esac
12406 case "$d_endservent_r_proto" in
12407 define)
10bc17b6
JH
12408 case "$endservent_r_proto" in
12409 ''|0) try='int endservent_r(struct servent_data*);'
61c26d18 12410 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12411 esac
12412 case "$endservent_r_proto" in
12413 ''|0) try='void endservent_r(struct servent_data*);'
61c26d18 12414 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12415 esac
12416 case "$endservent_r_proto" in
90e831dc 12417 ''|0) d_endservent_r=undef
10bc17b6 12418 endservent_r_proto=0
a48ec845 12419 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12420 * ) case "$endservent_r_proto" in
12421 REENTRANT_PROTO*) ;;
12422 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12423 esac
12424 echo "Prototype: $try" ;;
12425 esac
12426 ;;
c18e646a
JH
12427 *) case "$usethreads" in
12428 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12429 esac
90e831dc
SB
12430 d_endservent_r=undef
12431 endservent_r_proto=0
c18e646a 12432 ;;
a48ec845
JH
12433 esac
12434 ;;
10bc17b6
JH
12435*) endservent_r_proto=0
12436 ;;
12437esac
12438
b4eb6b3d
JH
12439: Locate the flags for 'open()'
12440echo " "
55954f19 12441$cat >try.c <<EOCP
b4eb6b3d
JH
12442#include <sys/types.h>
12443#ifdef I_FCNTL
12444#include <fcntl.h>
12445#endif
12446#ifdef I_SYS_FILE
12447#include <sys/file.h>
12448#endif
55954f19
JH
12449#$i_stdlib I_STDLIB
12450#ifdef I_STDLIB
12451#include <stdlib.h>
12452#endif
b4eb6b3d
JH
12453int main() {
12454 if(O_RDONLY);
12455#ifdef O_TRUNC
12456 exit(0);
12457#else
12458 exit(1);
12459#endif
12460}
12461EOCP
12462: check sys/file.h first to get FREAD on Sun
12463if $test `./findhdr sys/file.h` && \
5440bc8e 12464 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12465 h_sysfile=true;
12466 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12467 if $run ./try; then
b4eb6b3d
JH
12468 echo "and you have the 3 argument form of open()." >&4
12469 val="$define"
12470 else
12471 echo "but not the 3 argument form of open(). Oh, well." >&4
12472 val="$undef"
12473 fi
12474elif $test `./findhdr fcntl.h` && \
5440bc8e 12475 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12476 h_fcntl=true;
12477 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12478 if $run ./try; then
b4eb6b3d
JH
12479 echo "and you have the 3 argument form of open()." >&4
12480 val="$define"
12481 else
12482 echo "but not the 3 argument form of open(). Oh, well." >&4
12483 val="$undef"
12484 fi
12485else
12486 val="$undef"
12487 echo "I can't find the O_* constant definitions! You got problems." >&4
12488fi
12489set d_open3
12490eval $setvar
5b813a60 12491$rm_try
b4eb6b3d 12492
3c728e00
JH
12493: see if this is a sys/file.h system
12494val=''
12495set sys/file.h val
12496eval $inhdr
12497
12498: do we need to include sys/file.h ?
12499case "$val" in
12500"$define")
12501 echo " "
12502 if $h_sysfile; then
12503 val="$define"
12504 echo "We'll be including <sys/file.h>." >&4
12505 else
12506 val="$undef"
12507 echo "We won't be including <sys/file.h>." >&4
12508 fi
12509 ;;
12510*)
12511 h_sysfile=false
12512 ;;
12513esac
12514set i_sysfile
12515eval $setvar
12516
12517: see if fcntl.h is there
12518val=''
12519set fcntl.h val
12520eval $inhdr
12521
12522: see if we can include fcntl.h
12523case "$val" in
12524"$define")
12525 echo " "
12526 if $h_fcntl; then
12527 val="$define"
12528 echo "We'll be including <fcntl.h>." >&4
12529 else
12530 val="$undef"
12531 if $h_sysfile; then
12532 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12533 else
12534 echo "We won't be including <fcntl.h>." >&4
12535 fi
12536 fi
12537 ;;
12538*)
12539 h_fcntl=false
12540 val="$undef"
12541 ;;
12542esac
12543set i_fcntl
12544eval $setvar
12545
4dd8f9b3
JH
12546: see if fork exists
12547set fork d_fork
12548eval $inlibc
12549
12550: see if pipe exists
12551set pipe d_pipe
12552eval $inlibc
12553
b4eb6b3d
JH
12554: check for non-blocking I/O stuff
12555case "$h_sysfile" in
a0acbdc3
JH
12556true) echo "#include <sys/file.h>" > head.c;;
12557*)
12558 case "$h_fcntl" in
12559 true) echo "#include <fcntl.h>" > head.c;;
12560 *) echo "#include <sys/fcntl.h>" > head.c;;
12561 esac
12562 ;;
b4eb6b3d
JH
12563esac
12564echo " "
12565echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12566case "$o_nonblock" in
12567'')
12568 $cat head.c > try.c
3c728e00 12569 $cat >>try.c <<EOCP
b4eb6b3d 12570#include <stdio.h>
55954f19
JH
12571#$i_stdlib I_STDLIB
12572#ifdef I_STDLIB
80b3ef99 12573#include <stdlib.h>
55954f19 12574#endif
3c728e00
JH
12575#$i_fcntl I_FCNTL
12576#ifdef I_FCNTL
12577#include <fcntl.h>
12578#endif
b4eb6b3d
JH
12579int main() {
12580#ifdef O_NONBLOCK
12581 printf("O_NONBLOCK\n");
12582 exit(0);
12583#endif
12584#ifdef O_NDELAY
12585 printf("O_NDELAY\n");
12586 exit(0);
12587#endif
12588#ifdef FNDELAY
12589 printf("FNDELAY\n");
12590 exit(0);
12591#endif
12592 exit(0);
12593}
12594EOCP
12595 set try
12596 if eval $compile_ok; then
5440bc8e 12597 o_nonblock=`$run ./try`
b4eb6b3d
JH
12598 case "$o_nonblock" in
12599 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12600 *) echo "Seems like we can use $o_nonblock.";;
12601 esac
12602 else
12603 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12604 fi
12605 ;;
12606*) echo "Using $hint value $o_nonblock.";;
12607esac
5b813a60 12608$rm_try
b4eb6b3d
JH
12609
12610echo " "
12611echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12612case "$eagain" in
12613'')
4dd8f9b3
JH
12614 case "$d_fork:$d_pipe" in
12615 define:define)
b4eb6b3d
JH
12616 $cat head.c > try.c
12617 $cat >>try.c <<EOCP
12618#include <errno.h>
12619#include <sys/types.h>
12620#include <signal.h>
5b813a60 12621#include <stdio.h>
55954f19
JH
12622#$i_stdlib I_STDLIB
12623#ifdef I_STDLIB
12624#include <stdlib.h>
12625#endif
1deb0a86
JH
12626#$i_fcntl I_FCNTL
12627#ifdef I_FCNTL
12628#include <fcntl.h>
12629#endif
b4eb6b3d
JH
12630#define MY_O_NONBLOCK $o_nonblock
12631#ifndef errno /* XXX need better Configure test */
12632extern int errno;
12633#endif
12634#$i_unistd I_UNISTD
12635#ifdef I_UNISTD
12636#include <unistd.h>
12637#endif
12638#$i_string I_STRING
12639#ifdef I_STRING
12640#include <string.h>
12641#else
12642#include <strings.h>
12643#endif
7090f861 12644$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12645EOCP
12646 $cat >> try.c <<'EOCP'
12647int main()
12648{
12649 int pd[2];
12650 int pu[2];
12651 char buf[1];
12652 char string[100];
12653
12654 pipe(pd); /* Down: child -> parent */
12655 pipe(pu); /* Up: parent -> child */
12656 if (0 != fork()) {
12657 int ret;
12658 close(pd[1]); /* Parent reads from pd[0] */
12659 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12660#ifdef F_SETFL
b4eb6b3d
JH
12661 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12662 exit(1);
a0acbdc3
JH
12663#else
12664 exit(4);
12665#endif
b4eb6b3d
JH
12666 signal(SIGALRM, blech);
12667 alarm(5);
12668 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12669 exit(2);
12670 sprintf(string, "%d\n", ret);
12671 write(2, string, strlen(string));
12672 alarm(0);
12673#ifdef EAGAIN
12674 if (errno == EAGAIN) {
12675 printf("EAGAIN\n");
12676 goto ok;
12677 }
12678#endif
12679#ifdef EWOULDBLOCK
12680 if (errno == EWOULDBLOCK)
12681 printf("EWOULDBLOCK\n");
12682#endif
12683 ok:
12684 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12685 sleep(2); /* Give it time to close our pipe */
12686 alarm(5);
12687 ret = read(pd[0], buf, 1); /* Should read EOF */
12688 alarm(0);
12689 sprintf(string, "%d\n", ret);
868439a2 12690 write(4, string, strlen(string));
b4eb6b3d
JH
12691 exit(0);
12692 }
12693
12694 close(pd[0]); /* We write to pd[1] */
12695 close(pu[1]); /* We read from pu[0] */
12696 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12697 close(pd[1]); /* Pipe pd is now fully closed! */
12698 exit(0); /* Bye bye, thank you for playing! */
12699}
12700EOCP
12701 set try
12702 if eval $compile_ok; then
12703 echo "$startsh" >mtry
868439a2 12704 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12705 chmod +x mtry
12706 ./mtry >/dev/null 2>&1
12707 case $? in
12708 0) eagain=`$cat try.out`;;
12709 1) echo "Could not perform non-blocking setting!";;
12710 2) echo "I did a successful read() for something that was not there!";;
12711 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12712 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12713 *) echo "Something terribly wrong happened during testing.";;
12714 esac
12715 rd_nodata=`$cat try.ret`
12716 echo "A read() system call with no data present returns $rd_nodata."
12717 case "$rd_nodata" in
12718 0|-1) ;;
12719 *)
12720 echo "(That's peculiar, fixing that to be -1.)"
12721 rd_nodata=-1
12722 ;;
12723 esac
12724 case "$eagain" in
12725 '')
12726 echo "Forcing errno EAGAIN on read() with no data available."
12727 eagain=EAGAIN
12728 ;;
12729 *)
12730 echo "Your read() sets errno to $eagain when no data is available."
12731 ;;
12732 esac
12733 status=`$cat try.err`
12734 case "$status" in
12735 0) echo "And it correctly returns 0 to signal EOF.";;
12736 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12737 *) echo "However, your read() returns '$status' on EOF??";;
12738 esac
12739 val="$define"
12740 if test "$status" = "$rd_nodata"; then
12741 echo "WARNING: you can't distinguish between EOF and no data!"
12742 val="$undef"
12743 fi
12744 else
12745 echo "I can't compile the test program--assuming errno EAGAIN will do."
12746 eagain=EAGAIN
12747 fi
4dd8f9b3
JH
12748 ;;
12749 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12750 eagain=EAGAIN
12751 val="$define"
12752 ;;
12753 esac
b4eb6b3d
JH
12754 set d_eofnblk
12755 eval $setvar
12756 ;;
12757*)
12758 echo "Using $hint value $eagain."
12759 echo "Your read() returns $rd_nodata when no data is present."
12760 case "$d_eofnblk" in
12761 "$define") echo "And you can see EOF because read() returns 0.";;
12762 "$undef") echo "But you can't see EOF status from read() returned value.";;
12763 *)
12764 echo "(Assuming you can't see EOF status from read anyway.)"
12765 d_eofnblk=$undef
12766 ;;
12767 esac
12768 ;;
12769esac
5b813a60 12770$rm_try head.c mtry
b4eb6b3d 12771
15b61c98
JH
12772: see if _ptr and _cnt from stdio act std
12773echo " "
b4eb6b3d 12774
15b61c98
JH
12775if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12776 echo "(Looks like you have stdio.h from BSD.)"
12777 case "$stdio_ptr" in
12778 '') stdio_ptr='((fp)->_p)'
12779 ptr_lval=$define
12780 ;;
12781 *) ptr_lval=$d_stdio_ptr_lval;;
12782 esac
12783 case "$stdio_cnt" in
12784 '') stdio_cnt='((fp)->_r)'
12785 cnt_lval=$define
12786 ;;
12787 *) cnt_lval=$d_stdio_cnt_lval;;
12788 esac
12789 case "$stdio_base" in
12790 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12791 esac
12792 case "$stdio_bufsiz" in
12793 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12794 esac
12795elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12796 echo "(Looks like you have stdio.h from Linux.)"
12797 case "$stdio_ptr" in
12798 '') stdio_ptr='((fp)->_IO_read_ptr)'
12799 ptr_lval=$define
12800 ;;
12801 *) ptr_lval=$d_stdio_ptr_lval;;
12802 esac
12803 case "$stdio_cnt" in
12804 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12805 cnt_lval=$undef
12806 ;;
12807 *) cnt_lval=$d_stdio_cnt_lval;;
12808 esac
12809 case "$stdio_base" in
12810 '') stdio_base='((fp)->_IO_read_base)';;
12811 esac
12812 case "$stdio_bufsiz" in
12813 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12814 esac
12815else
12816 case "$stdio_ptr" in
12817 '') stdio_ptr='((fp)->_ptr)'
12818 ptr_lval=$define
12819 ;;
12820 *) ptr_lval=$d_stdio_ptr_lval;;
12821 esac
12822 case "$stdio_cnt" in
12823 '') stdio_cnt='((fp)->_cnt)'
12824 cnt_lval=$define
12825 ;;
12826 *) cnt_lval=$d_stdio_cnt_lval;;
12827 esac
12828 case "$stdio_base" in
12829 '') stdio_base='((fp)->_base)';;
12830 esac
12831 case "$stdio_bufsiz" in
12832 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12833 esac
12834fi
b4eb6b3d 12835
15b61c98
JH
12836: test whether _ptr and _cnt really work
12837echo "Checking how std your stdio is..." >&4
12838$cat >try.c <<EOP
12839#include <stdio.h>
55954f19
JH
12840#$i_stdlib I_STDLIB
12841#ifdef I_STDLIB
9d9004a9 12842#include <stdlib.h>
55954f19 12843#endif
15b61c98
JH
12844#define FILE_ptr(fp) $stdio_ptr
12845#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12846int main() {
15b61c98
JH
12847 FILE *fp = fopen("try.c", "r");
12848 char c = getc(fp);
12849 if (
12850 18 <= FILE_cnt(fp) &&
12851 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12852 )
12853 exit(0);
12854 exit(1);
9d9004a9 12855}
15b61c98
JH
12856EOP
12857val="$undef"
12858set try
12859if eval $compile && $to try.c; then
12860 if $run ./try; then
12861 echo "Your stdio acts pretty std."
12862 val="$define"
9d9004a9 12863 else
15b61c98 12864 echo "Your stdio isn't very std."
9d9004a9 12865 fi
15b61c98
JH
12866else
12867 echo "Your stdio doesn't appear very std."
12868fi
5b813a60 12869$rm_try
15b61c98
JH
12870
12871# glibc 2.2.90 and above apparently change stdio streams so Perl's
12872# direct buffer manipulation no longer works. The Configure tests
12873# should be changed to correctly detect this, but until then,
12874# the following check should at least let perl compile and run.
12875# (This quick fix should be updated before 5.8.1.)
12876# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12877# A. Dougherty, June 3, 2002.
12878case "$d_gnulibc" in
12879$define)
12880 case "$gnulibc_version" in
12881 2.[01]*) ;;
12882 2.2) ;;
12883 2.2.[0-9]) ;;
12884 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12885 val="$undef"
12886 ;;
12887 esac
9d9004a9
AD
12888 ;;
12889esac
15b61c98 12890set d_stdstdio
9d9004a9 12891eval $setvar
9d9004a9 12892
15b61c98
JH
12893: Can _ptr be used as an lvalue?
12894case "$d_stdstdio$ptr_lval" in
12895$define$define) val=$define ;;
12896*) val=$undef ;;
12897esac
12898set d_stdio_ptr_lval
12899eval $setvar
9d9004a9 12900
15b61c98
JH
12901: Can _cnt be used as an lvalue?
12902case "$d_stdstdio$cnt_lval" in
12903$define$define) val=$define ;;
12904*) val=$undef ;;
12905esac
12906set d_stdio_cnt_lval
12907eval $setvar
b4eb6b3d 12908
15b61c98
JH
12909
12910: test whether setting _ptr sets _cnt as a side effect
12911d_stdio_ptr_lval_sets_cnt="$undef"
12912d_stdio_ptr_lval_nochange_cnt="$undef"
12913case "$d_stdio_ptr_lval$d_stdstdio" in
12914$define$define)
12915 echo "Checking to see what happens if we set the stdio ptr..." >&4
12916$cat >try.c <<EOP
12917#include <stdio.h>
12918/* Can we scream? */
12919/* Eat dust sed :-) */
12920/* In the buffer space, no one can hear you scream. */
55954f19
JH
12921#$i_stdlib I_STDLIB
12922#ifdef I_STDLIB
12923#include <stdlib.h>
12924#endif
15b61c98
JH
12925#define FILE_ptr(fp) $stdio_ptr
12926#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12927#include <sys/types.h>
b4eb6b3d 12928int main() {
15b61c98
JH
12929 FILE *fp = fopen("try.c", "r");
12930 int c;
12931 char *ptr;
12932 size_t cnt;
12933 if (!fp) {
12934 puts("Fail even to read");
12935 exit(1);
12936 }
12937 c = getc(fp); /* Read away the first # */
12938 if (c == EOF) {
12939 puts("Fail even to read");
12940 exit(1);
12941 }
12942 if (!(
12943 18 <= FILE_cnt(fp) &&
12944 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12945 )) {
12946 puts("Fail even to read");
12947 exit (1);
12948 }
12949 ptr = (char*) FILE_ptr(fp);
12950 cnt = (size_t)FILE_cnt(fp);
12951
12952 FILE_ptr(fp) += 42;
12953
12954 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12955 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12956 exit (1);
12957 }
12958 if (FILE_cnt(fp) <= 20) {
12959 printf ("Fail (<20 chars to test)");
12960 exit (1);
12961 }
12962 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12963 puts("Fail compare");
12964 exit (1);
12965 }
12966 if (cnt == FILE_cnt(fp)) {
12967 puts("Pass_unchanged");
12968 exit (0);
5b813a60 12969 }
15b61c98
JH
12970 if (FILE_cnt(fp) == (cnt - 42)) {
12971 puts("Pass_changed");
12972 exit (0);
12973 }
12974 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12975 return 1;
12976
12977}
12978EOP
12979 set try
12980 if eval $compile && $to try.c; then
12981 case `$run ./try` in
12982 Pass_changed)
12983 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12984 d_stdio_ptr_lval_sets_cnt="$define" ;;
12985 Pass_unchanged)
12986 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12987 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12988 Fail*)
12989 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12990 *)
12991 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12992 esac
12993 else
12994 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12995 fi
5b813a60 12996 $rm_try
15b61c98
JH
12997 ;;
12998esac
12999
13000: see if _base is also standard
13001val="$undef"
13002case "$d_stdstdio" in
13003$define)
13004 $cat >try.c <<EOP
13005#include <stdio.h>
13006#$i_stdlib I_STDLIB
13007#ifdef I_STDLIB
13008#include <stdlib.h>
13009#endif
13010#define FILE_base(fp) $stdio_base
13011#define FILE_bufsiz(fp) $stdio_bufsiz
13012int main() {
13013 FILE *fp = fopen("try.c", "r");
13014 char c = getc(fp);
13015 if (
13016 19 <= FILE_bufsiz(fp) &&
13017 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13018 )
13019 exit(0);
13020 exit(1);
13021}
13022EOP
13023 set try
13024 if eval $compile && $to try.c; then
13025 if $run ./try; then
13026 echo "And its _base field acts std."
13027 val="$define"
13028 else
13029 echo "But its _base field isn't std."
13030 fi
13031 else
13032 echo "However, it seems to be lacking the _base field."
13033 fi
5b813a60 13034 $rm_try
15b61c98
JH
13035 ;;
13036esac
13037set d_stdiobase
13038eval $setvar
13039
13040: see if fast_stdio exists
13041val="$undef"
13042case "$d_stdstdio:$d_stdio_ptr_lval" in
13043"$define:$define")
13044 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13045 *$define*)
13046 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13047 val="$define"
13048 ;;
13049 esac
13050 ;;
13051esac
13052set d_faststdio
13053eval $setvar
13054
13055
13056
13057: see if fchdir exists
13058set fchdir d_fchdir
13059eval $inlibc
13060
13061: see if fchmod exists
13062set fchmod d_fchmod
13063eval $inlibc
13064
13065: see if fchown exists
13066set fchown d_fchown
13067eval $inlibc
13068
13069: see if this is an fcntl system
13070set fcntl d_fcntl
13071eval $inlibc
13072
15b61c98 13073: See if fcntl-based locking works.
613d6c3e 13074echo " "
15b61c98
JH
13075$cat >try.c <<EOCP
13076#$i_stdlib I_STDLIB
13077#ifdef I_STDLIB
13078#include <stdlib.h>
13079#endif
13080#include <unistd.h>
13081#include <fcntl.h>
13082#include <signal.h>
7090f861 13083$signal_t blech(int x) { exit(3); }
15b61c98
JH
13084int main() {
13085#if defined(F_SETLK) && defined(F_SETLKW)
13086 struct flock flock;
13087 int retval, fd;
13088 fd = open("try.c", O_RDONLY);
13089 flock.l_type = F_RDLCK;
13090 flock.l_whence = SEEK_SET;
13091 flock.l_start = flock.l_len = 0;
13092 signal(SIGALRM, blech);
13093 alarm(10);
13094 retval = fcntl(fd, F_SETLK, &flock);
13095 close(fd);
13096 (retval < 0 ? exit(2) : exit(0));
13097#else
13098 exit(2);
13099#endif
13100}
13101EOCP
13102echo "Checking if fcntl-based file locking works... "
13103case "$d_fcntl" in
13104"$define")
13105 set try
13106 if eval $compile_ok; then
13107 if $run ./try; then
13108 echo "Yes, it seems to work."
13109 val="$define"
13110 else
13111 echo "Nope, it didn't work."
13112 val="$undef"
13113 case "$?" in
13114 3) $cat >&4 <<EOM
13115***
13116*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13117*** This is (almost) impossible.
13118*** If your NFS lock daemons are not feeling well, something like
13119*** this may happen, please investigate. Cannot continue, aborting.
13120***
13121EOM
13122 exit 1
13123 ;;
13124 esac
13125 fi
13126 else
13127 echo "I'm unable to compile the test program, so I'll assume not."
13128 val="$undef"
13129 fi
13130 ;;
13131*) val="$undef";
13132 echo "Nope, since you don't even have fcntl()."
13133 ;;
13134esac
13135set d_fcntl_can_lock
13136eval $setvar
5b813a60 13137$rm_try
15b61c98
JH
13138
13139: check for fd_set items
13140$cat <<EOM
13141
13142Checking to see how well your C compiler handles fd_set and friends ...
13143EOM
13144$cat >try.c <<EOCP
13145#$i_stdlib I_STDLIB
13146#ifdef I_STDLIB
13147#include <stdlib.h>
13148#endif
13149#$i_systime I_SYS_TIME
13150#$i_sysselct I_SYS_SELECT
13151#$d_socket HAS_SOCKET
13152#include <sys/types.h>
13153#ifdef HAS_SOCKET
13154#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13155#endif
13156#ifdef I_SYS_TIME
13157#include <sys/time.h>
13158#endif
13159#ifdef I_SYS_SELECT
13160#include <sys/select.h>
13161#endif
13162int main() {
13163 fd_set fds;
13164
13165#ifdef TRYBITS
13166 if(fds.fds_bits);
13167#endif
13168
13169#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13170 exit(0);
13171#else
13172 exit(1);
13173#endif
13174}
13175EOCP
13176set try -DTRYBITS
13177if eval $compile; then
13178 d_fds_bits="$define"
13179 d_fd_set="$define"
13180 echo "Well, your system knows about the normal fd_set typedef..." >&4
13181 if $run ./try; then
b4eb6b3d
JH
13182 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13183 d_fd_macros="$define"
13184 else
13185 $cat >&4 <<'EOM'
13186but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13187EOM
13188 d_fd_macros="$undef"
13189 fi
13190else
13191 $cat <<'EOM'
13192Hmm, your compiler has some difficulty with fd_set. Checking further...
13193EOM
5440bc8e 13194 set try
b4eb6b3d
JH
13195 if eval $compile; then
13196 d_fds_bits="$undef"
13197 d_fd_set="$define"
13198 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 13199 if $run ./try; then
b4eb6b3d
JH
13200 echo "and you have the normal fd_set macros." >&4
13201 d_fd_macros="$define"
13202 else
13203 $cat <<'EOM'
13204but not the normal fd_set macros! Gross! More work for me...
13205EOM
13206 d_fd_macros="$undef"
13207 fi
13208 else
13209 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13210 d_fd_set="$undef"
13211 d_fds_bits="$undef"
13212 d_fd_macros="$undef"
13213 fi
13214fi
5b813a60 13215$rm_try
b4eb6b3d
JH
13216
13217: see if fgetpos exists
13218set fgetpos d_fgetpos
13219eval $inlibc
13220
758a5d79
JH
13221: see if finite exists
13222set finite d_finite
13223eval $inlibc
13224
13225: see if finitel exists
13226set finitel d_finitel
13227eval $inlibc
13228
b4eb6b3d
JH
13229: see if flock exists
13230set flock d_flock
13231eval $inlibc
13232
2ef53570
JH
13233: see if prototype for flock is available
13234echo " "
13235set d_flockproto flock $i_sysfile sys/file.h
13236eval $hasproto
13237
758a5d79
JH
13238: see if fp_class exists
13239set fp_class d_fp_class
13240eval $inlibc
13241
b4eb6b3d
JH
13242: see if pathconf exists
13243set pathconf d_pathconf
13244eval $inlibc
13245
13246: see if fpathconf exists
13247set fpathconf d_fpathconf
13248eval $inlibc
13249
758a5d79
JH
13250: see if fpclass exists
13251set fpclass d_fpclass
13252eval $inlibc
13253
13254: see if fpclassify exists
13255set fpclassify d_fpclassify
13256eval $inlibc
13257
13258: see if fpclassl exists
13259set fpclassl d_fpclassl
13260eval $inlibc
13261
b4eb6b3d
JH
13262: check for fpos64_t
13263echo " "
13264echo "Checking to see if you have fpos64_t..." >&4
13265$cat >try.c <<EOCP
13266#include <stdio.h>
13267int main() { fpos64_t x = 7; }
13268EOCP
13269set try
13270if eval $compile; then
13271 val="$define"
13272 echo "You have fpos64_t."
13273else
13274 val="$undef"
13275 echo "You do not have fpos64_t."
13276 case "$fpossize" in
13277 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13278 esac
13279fi
5b813a60 13280$rm_try
b4eb6b3d
JH
13281set d_fpos64_t
13282eval $setvar
13283
13284: see if frexpl exists
13285set frexpl d_frexpl
13286eval $inlibc
13287
b4eb6b3d
JH
13288: see if this is a sys/param system
13289set sys/param.h i_sysparam
13290eval $inhdr
13291
13292: see if this is a sys/mount.h system
13293set sys/mount.h i_sysmount
13294eval $inhdr
13295
34f1896b 13296: Check for fs_data_s
b4eb6b3d
JH
13297echo " "
13298echo "Checking to see if your system supports struct fs_data..." >&4
13299set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13300eval $hasstruct
13301case "$d_fs_data_s" in
13302"$define") echo "Yes, it does." ;;
13303*) echo "No, it doesn't." ;;
13304esac
13305
13306: see if fseeko exists
13307set fseeko d_fseeko
13308eval $inlibc
13309case "$longsize" in
133108) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13311esac
13312
13313: see if fsetpos exists
13314set fsetpos d_fsetpos
13315eval $inlibc
13316
b4eb6b3d
JH
13317: see if fstatfs exists
13318set fstatfs d_fstatfs
13319eval $inlibc
13320
b4eb6b3d
JH
13321: see if statvfs exists
13322set statvfs d_statvfs
13323eval $inlibc
13324
13325: see if fstatvfs exists
13326set fstatvfs d_fstatvfs
13327eval $inlibc
13328
13329
411ab01c
JH
13330: see if fsync exists
13331set fsync d_fsync
13332eval $inlibc
13333
b4eb6b3d
JH
13334: see if ftello exists
13335set ftello d_ftello
13336eval $inlibc
13337case "$longsize" in
133388) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13339esac
13340
bff98e24 13341: check for a working futimes
613d6c3e 13342d_futimes="$undef"
bff98e24 13343echo " "
5b813a60 13344echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13345$cat >try.c <<EOCP
13346#include <stdio.h>
13347#include <sys/time.h>
13348#include <errno.h>
13349#include <fcntl.h>
13350
13351int main ()
13352{
13353 int fd, rv;
13354 fd = open ("try.c", O_RDWR);
13355 if (-1 == fd) exit (1);
13356 rv = futimes (fd, NULL);
13357 exit (rv == -1 ? errno : 0);
13358}
13359EOCP
13360set try
13361if eval $compile; then
13362 `$run ./try`
13363 rc=$?
13364 case "$rc" in
5b813a60 13365 0) echo "Yes, you have" >&4
bff98e24
SP
13366 d_futimes="$define"
13367 ;;
5b813a60 13368 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13369 ;;
13370 esac
13371else
43dddb59 13372 echo "No, it does not (probably harmless)" >&4
bff98e24 13373fi
5b813a60 13374$rm_try
dc814df1 13375
e74475c7
MHM
13376: see if ndbm.h is available
13377set ndbm.h i_ndbm
13378eval $inhdr
13379: Compatibility location for RedHat 7.1
13380set gdbm/ndbm.h i_gdbmndbm
13381eval $inhdr
13382: Compatibility location for Debian 4.0
13383set gdbm-ndbm.h i_gdbm_ndbm
13384eval $inhdr
13385
13386val="$undef"
13387if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13388 : see if dbm_open exists
13389 set dbm_open d_dbm_open
13390 eval $inlibc
13391 case "$d_dbm_open" in
13392 $undef)
13393 i_ndbm="$undef"
13394 i_gdbmndbm="$undef"
13395 i_gdbm_ndbm="$undef"
13396 echo "We won't be including <ndbm.h>"
13397 val="$undef"
13398 ;;
13399 *) val="$define"
13400 ;;
13401 esac
13402fi
13403set d_ndbm
13404eval $setvar
13405
13406ndbm_hdr_protochk='name=$1; hdr=$2;
13407eval "ihdr=\$""i_$name";
13408val="$undef";
13409if $test "$ihdr" = "$define"; then
13410 $echo "Checking if your <$hdr> uses prototypes..." >&4;
13411 case "$d_cplusplus" in
13412 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13413 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13414 esac;
13415 case "$val" in
13416 $define) $echo "Your <$hdr> seems to have prototypes";;
13417 *) $echo "Your <$hdr> does not seem to have prototypes";;
13418 esac;
13419fi;
13420set "d_${name}_h_uses_prototypes";
13421eval $setvar'
13422
13423set ndbm ndbm.h
13424eval $ndbm_hdr_protochk
13425set gdbmndbm gdbm/ndbm.h
13426eval $ndbm_hdr_protochk
13427set gdbm_ndbm gdbm-ndbm.h
13428eval $ndbm_hdr_protochk
13429
5086dff9
MB
13430: see if getaddrinfo exists
13431set getaddrinfo d_getaddrinfo
13432eval $inlibc
13433
b4eb6b3d
JH
13434: see if getcwd exists
13435set getcwd d_getcwd
13436eval $inlibc
13437
13438: see if getespwnam exists
13439set getespwnam d_getespwnam
13440eval $inlibc
13441
b4eb6b3d
JH
13442: see if getfsstat exists
13443set getfsstat d_getfsstat
13444eval $inlibc
13445
13446: see if getgrent exists
13447set getgrent d_getgrent
13448eval $inlibc
13449
10bc17b6
JH
13450: see if getgrent_r exists
13451set getgrent_r d_getgrent_r
13452eval $inlibc
13453case "$d_getgrent_r" in
13454"$define")
13455 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13456 case "$d_getgrent_r_proto:$usethreads" in
13457 ":define") d_getgrent_r_proto=define
a48ec845
JH
13458 set d_getgrent_r_proto getgrent_r $hdrs
13459 eval $hasproto ;;
13460 *) ;;
13461 esac
13462 case "$d_getgrent_r_proto" in
13463 define)
10bc17b6
JH
13464 case "$getgrent_r_proto" in
13465 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
61c26d18 13466 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
10bc17b6
JH
13467 esac
13468 case "$getgrent_r_proto" in
13469 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
61c26d18 13470 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
10bc17b6
JH
13471 esac
13472 case "$getgrent_r_proto" in
13473 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
61c26d18 13474 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
10bc17b6
JH
13475 esac
13476 case "$getgrent_r_proto" in
13477 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
61c26d18 13478 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
10bc17b6
JH
13479 esac
13480 case "$getgrent_r_proto" in
13481 ''|0) try='int getgrent_r(struct group*, char*, int);'
61c26d18 13482 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
10bc17b6
JH
13483 esac
13484 case "$getgrent_r_proto" in
13485 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
61c26d18 13486 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
10bc17b6
JH
13487 esac
13488 case "$getgrent_r_proto" in
90e831dc 13489 ''|0) d_getgrent_r=undef
10bc17b6 13490 getgrent_r_proto=0
a48ec845 13491 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13492 * ) case "$getgrent_r_proto" in
13493 REENTRANT_PROTO*) ;;
13494 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13495 esac
13496 echo "Prototype: $try" ;;
13497 esac
13498 ;;
c18e646a
JH
13499 *) case "$usethreads" in
13500 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13501 esac
90e831dc
SB
13502 d_getgrent_r=undef
13503 getgrent_r_proto=0
c18e646a 13504 ;;
a48ec845
JH
13505 esac
13506 ;;
10bc17b6
JH
13507*) getgrent_r_proto=0
13508 ;;
13509esac
13510
13511: see if getgrgid_r exists
13512set getgrgid_r d_getgrgid_r
13513eval $inlibc
13514case "$d_getgrgid_r" in
13515"$define")
13516 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13517 case "$d_getgrgid_r_proto:$usethreads" in
13518 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13519 set d_getgrgid_r_proto getgrgid_r $hdrs
13520 eval $hasproto ;;
13521 *) ;;
13522 esac
13523 case "$d_getgrgid_r_proto" in
13524 define)
10bc17b6
JH
13525 case "$getgrgid_r_proto" in
13526 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
61c26d18 13527 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
10bc17b6
JH
13528 esac
13529 case "$getgrgid_r_proto" in
13530 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
61c26d18 13531 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
10bc17b6
JH
13532 esac
13533 case "$getgrgid_r_proto" in
13534 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13535 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
10bc17b6
JH
13536 esac
13537 case "$getgrgid_r_proto" in
13538 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13539 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
10bc17b6
JH
13540 esac
13541 case "$getgrgid_r_proto" in
90e831dc 13542 ''|0) d_getgrgid_r=undef
10bc17b6 13543 getgrgid_r_proto=0
a48ec845 13544 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13545 * ) case "$getgrgid_r_proto" in
13546 REENTRANT_PROTO*) ;;
13547 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13548 esac
13549 echo "Prototype: $try" ;;
13550 esac
13551 ;;
c18e646a
JH
13552 *) case "$usethreads" in
13553 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13554 esac
90e831dc
SB
13555 d_getgrgid_r=undef
13556 getgrgid_r_proto=0
c18e646a 13557 ;;
a48ec845
JH
13558 esac
13559 ;;
10bc17b6
JH
13560*) getgrgid_r_proto=0
13561 ;;
13562esac
13563
13564: see if getgrnam_r exists
13565set getgrnam_r d_getgrnam_r
13566eval $inlibc
13567case "$d_getgrnam_r" in
13568"$define")
13569 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13570 case "$d_getgrnam_r_proto:$usethreads" in
13571 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13572 set d_getgrnam_r_proto getgrnam_r $hdrs
13573 eval $hasproto ;;
13574 *) ;;
13575 esac
13576 case "$d_getgrnam_r_proto" in
13577 define)
10bc17b6
JH
13578 case "$getgrnam_r_proto" in
13579 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
61c26d18 13580 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
10bc17b6
JH
13581 esac
13582 case "$getgrnam_r_proto" in
13583 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
61c26d18 13584 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
10bc17b6
JH
13585 esac
13586 case "$getgrnam_r_proto" in
13587 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
61c26d18 13588 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
10bc17b6
JH
13589 esac
13590 case "$getgrnam_r_proto" in
13591 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13592 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
10bc17b6
JH
13593 esac
13594 case "$getgrnam_r_proto" in
13595 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13596 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
10bc17b6
JH
13597 esac
13598 case "$getgrnam_r_proto" in
90e831dc 13599 ''|0) d_getgrnam_r=undef
10bc17b6 13600 getgrnam_r_proto=0
a48ec845 13601 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13602 * ) case "$getgrnam_r_proto" in
13603 REENTRANT_PROTO*) ;;
13604 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13605 esac
13606 echo "Prototype: $try" ;;
13607 esac
13608 ;;
c18e646a
JH
13609 *) case "$usethreads" in
13610 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13611 esac
90e831dc
SB
13612 d_getgrnam_r=undef
13613 getgrnam_r_proto=0
c18e646a 13614 ;;
a48ec845
JH
13615 esac
13616 ;;
10bc17b6
JH
13617*) getgrnam_r_proto=0
13618 ;;
13619esac
13620
b4eb6b3d
JH
13621: see if gethostbyaddr exists
13622set gethostbyaddr d_gethbyaddr
13623eval $inlibc
13624
13625: see if gethostbyname exists
13626set gethostbyname d_gethbyname
13627eval $inlibc
13628
13629: see if gethostent exists
13630set gethostent d_gethent
13631eval $inlibc
13632
13633: see how we will look up host name
13634echo " "
13635call=''
13636if set gethostname val -f d_gethname; eval $csym; $val; then
13637 echo 'gethostname() found.' >&4
13638 d_gethname="$define"
13639 call=gethostname
13640fi
13641if set uname val -f d_uname; eval $csym; $val; then
13642 if ./xenix; then
13643 $cat <<'EOM'
13644uname() was found, but you're running xenix, and older versions of xenix
13645have a broken uname(). If you don't really know whether your xenix is old
13646enough to have a broken system call, use the default answer.
13647
13648EOM
13649 dflt=y
13650 case "$d_uname" in
13651 "$define") dflt=n;;
13652 esac
13653 rp='Is your uname() broken?'
13654 . ./myread
13655 case "$ans" in
13656 n*) d_uname="$define"; call=uname;;
13657 esac
13658 else
13659 echo 'uname() found.' >&4
13660 d_uname="$define"
13661 case "$call" in
13662 '') call=uname ;;
13663 esac
13664 fi
13665fi
13666case "$d_gethname" in
13667'') d_gethname="$undef";;
13668esac
13669case "$d_uname" in
13670'') d_uname="$undef";;
13671esac
13672case "$d_uname$d_gethname" in
13673*define*)
13674 dflt=n
13675 cat <<EOM
613d6c3e 13676
b4eb6b3d
JH
13677Every now and then someone has a $call() that lies about the hostname
13678but can't be fixed for political or economic reasons. If you wish, I can
13679pretend $call() isn't there and maybe compute hostname at run-time
13680thanks to the '$phostname' command.
13681
13682EOM
13683 rp="Shall I ignore $call() from now on?"
13684 . ./myread
13685 case "$ans" in
13686 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13687 esac;;
13688esac
13689case "$phostname" in
13690'') aphostname='';;
13691*) case "$aphostname" in
13692 /*) ;;
13693 *) set X $phostname
13694 shift
13695 file=$1
13696 shift
13697 file=`./loc $file $file $pth`
13698 aphostname=`echo $file $*`
13699 ;;
13700 esac
13701 ;;
13702esac
13703case "$d_uname$d_gethname" in
13704*define*) ;;
13705*)
13706 case "$phostname" in
13707 '')
13708 echo "There will be no way for $package to get your hostname." >&4;;
13709 *)
13710 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13711 ;;
13712 esac;;
13713esac
13714case "$d_phostname" in
13715'') d_phostname="$undef";;
13716esac
13717
10bc17b6
JH
13718: see if gethostbyaddr_r exists
13719set gethostbyaddr_r d_gethostbyaddr_r
13720eval $inlibc
13721case "$d_gethostbyaddr_r" in
13722"$define")
13723 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13724 case "$d_gethostbyaddr_r_proto:$usethreads" in
13725 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13726 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13727 eval $hasproto ;;
13728 *) ;;
13729 esac
13730 case "$d_gethostbyaddr_r_proto" in
13731 define)
10bc17b6
JH
13732 case "$gethostbyaddr_r_proto" in
13733 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13734 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
10bc17b6
JH
13735 esac
13736 case "$gethostbyaddr_r_proto" in
13737 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
61c26d18 13738 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
10bc17b6
JH
13739 esac
13740 case "$gethostbyaddr_r_proto" in
13741 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13742 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
10bc17b6
JH
13743 esac
13744 case "$gethostbyaddr_r_proto" in
13745 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13746 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
10bc17b6
JH
13747 esac
13748 case "$gethostbyaddr_r_proto" in
13749 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
61c26d18 13750 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
10bc17b6
JH
13751 esac
13752 case "$gethostbyaddr_r_proto" in
13753 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13754 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
10bc17b6
JH
13755 esac
13756 case "$gethostbyaddr_r_proto" in
13757 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
61c26d18 13758 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
10bc17b6
JH
13759 esac
13760 case "$gethostbyaddr_r_proto" in
13761 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
61c26d18 13762 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
10bc17b6
JH
13763 esac
13764 case "$gethostbyaddr_r_proto" in
13765 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
61c26d18 13766 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
10bc17b6
JH
13767 esac
13768 case "$gethostbyaddr_r_proto" in
13769 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
61c26d18 13770 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
10bc17b6
JH
13771 esac
13772 case "$gethostbyaddr_r_proto" in
a845a0d4 13773 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13774 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
a845a0d4
JH
13775 esac
13776 case "$gethostbyaddr_r_proto" in
90e831dc 13777 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13778 gethostbyaddr_r_proto=0
a48ec845 13779 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13780 * ) case "$gethostbyaddr_r_proto" in
13781 REENTRANT_PROTO*) ;;
13782 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13783 esac
13784 echo "Prototype: $try" ;;
13785 esac
13786 ;;
c18e646a
JH
13787 *) case "$usethreads" in
13788 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13789 esac
90e831dc
SB
13790 d_gethostbyaddr_r=undef
13791 gethostbyaddr_r_proto=0
c18e646a 13792 ;;
a48ec845
JH
13793 esac
13794 ;;
10bc17b6
JH
13795*) gethostbyaddr_r_proto=0
13796 ;;
13797esac
13798
13799: see if gethostbyname_r exists
13800set gethostbyname_r d_gethostbyname_r
13801eval $inlibc
13802case "$d_gethostbyname_r" in
13803"$define")
13804 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13805 case "$d_gethostbyname_r_proto:$usethreads" in
13806 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13807 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13808 eval $hasproto ;;
13809 *) ;;
13810 esac
13811 case "$d_gethostbyname_r_proto" in
13812 define)
10bc17b6
JH
13813 case "$gethostbyname_r_proto" in
13814 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13815 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
13816 esac
13817 case "$gethostbyname_r_proto" in
13818 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13819 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
10bc17b6
JH
13820 esac
13821 case "$gethostbyname_r_proto" in
13822 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
61c26d18 13823 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
10bc17b6
JH
13824 esac
13825 case "$gethostbyname_r_proto" in
90e831dc 13826 ''|0) d_gethostbyname_r=undef
10bc17b6 13827 gethostbyname_r_proto=0
a48ec845 13828 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13829 * ) case "$gethostbyname_r_proto" in
13830 REENTRANT_PROTO*) ;;
13831 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13832 esac
13833 echo "Prototype: $try" ;;
13834 esac
13835 ;;
c18e646a
JH
13836 *) case "$usethreads" in
13837 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13838 esac
90e831dc
SB
13839 d_gethostbyname_r=undef
13840 gethostbyname_r_proto=0
c18e646a 13841 ;;
a48ec845
JH
13842 esac
13843 ;;
10bc17b6
JH
13844*) gethostbyname_r_proto=0
13845 ;;
13846esac
13847
13848: see if gethostent_r exists
13849set gethostent_r d_gethostent_r
13850eval $inlibc
13851case "$d_gethostent_r" in
13852"$define")
13853 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13854 case "$d_gethostent_r_proto:$usethreads" in
13855 ":define") d_gethostent_r_proto=define
a48ec845
JH
13856 set d_gethostent_r_proto gethostent_r $hdrs
13857 eval $hasproto ;;
13858 *) ;;
13859 esac
13860 case "$d_gethostent_r_proto" in
13861 define)
10bc17b6
JH
13862 case "$gethostent_r_proto" in
13863 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13864 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
10bc17b6
JH
13865 esac
13866 case "$gethostent_r_proto" in
13867 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13868 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
10bc17b6
JH
13869 esac
13870 case "$gethostent_r_proto" in
13871 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13872 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
10bc17b6
JH
13873 esac
13874 case "$gethostent_r_proto" in
13875 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
61c26d18 13876 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
10bc17b6
JH
13877 esac
13878 case "$gethostent_r_proto" in
13879 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
61c26d18 13880 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
10bc17b6
JH
13881 esac
13882 case "$gethostent_r_proto" in
13883 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
61c26d18 13884 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
10bc17b6
JH
13885 esac
13886 case "$gethostent_r_proto" in
90e831dc 13887 ''|0) d_gethostent_r=undef
10bc17b6 13888 gethostent_r_proto=0
a48ec845 13889 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13890 * ) case "$gethostent_r_proto" in
13891 REENTRANT_PROTO*) ;;
13892 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13893 esac
13894 echo "Prototype: $try" ;;
13895 esac
13896 ;;
c18e646a
JH
13897 *) case "$usethreads" in
13898 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13899 esac
90e831dc
SB
13900 d_gethostent_r=undef
13901 gethostent_r_proto=0
c18e646a 13902 ;;
a48ec845
JH
13903 esac
13904 ;;
10bc17b6
JH
13905*) gethostent_r_proto=0
13906 ;;
13907esac
b4eb6b3d
JH
13908
13909: see if prototypes for various gethostxxx netdb.h functions are available
13910echo " "
13911set d_gethostprotos gethostent $i_netdb netdb.h
13912eval $hasproto
13913
4e0554ec
JH
13914: see if getitimer exists
13915set getitimer d_getitimer
13916eval $inlibc
13917
b4eb6b3d
JH
13918: see if getlogin exists
13919set getlogin d_getlogin
13920eval $inlibc
13921
10bc17b6
JH
13922: see if getlogin_r exists
13923set getlogin_r d_getlogin_r
13924eval $inlibc
13925case "$d_getlogin_r" in
13926"$define")
13927 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13928 case "$d_getlogin_r_proto:$usethreads" in
13929 ":define") d_getlogin_r_proto=define
a48ec845
JH
13930 set d_getlogin_r_proto getlogin_r $hdrs
13931 eval $hasproto ;;
13932 *) ;;
13933 esac
13934 case "$d_getlogin_r_proto" in
13935 define)
10bc17b6
JH
13936 case "$getlogin_r_proto" in
13937 ''|0) try='int getlogin_r(char*, size_t);'
61c26d18 13938 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
10bc17b6
JH
13939 esac
13940 case "$getlogin_r_proto" in
13941 ''|0) try='int getlogin_r(char*, int);'
61c26d18 13942 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
10bc17b6
JH
13943 esac
13944 case "$getlogin_r_proto" in
13945 ''|0) try='char* getlogin_r(char*, size_t);'
61c26d18 13946 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
10bc17b6
JH
13947 esac
13948 case "$getlogin_r_proto" in
13949 ''|0) try='char* getlogin_r(char*, int);'
61c26d18 13950 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
10bc17b6
JH
13951 esac
13952 case "$getlogin_r_proto" in
90e831dc 13953 ''|0) d_getlogin_r=undef
10bc17b6 13954 getlogin_r_proto=0
a48ec845 13955 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13956 * ) case "$getlogin_r_proto" in
13957 REENTRANT_PROTO*) ;;
13958 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13959 esac
13960 echo "Prototype: $try" ;;
13961 esac
13962 ;;
c18e646a
JH
13963 *) case "$usethreads" in
13964 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13965 esac
90e831dc
SB
13966 d_getlogin_r=undef
13967 getlogin_r_proto=0
c18e646a 13968 ;;
a48ec845
JH
13969 esac
13970 ;;
10bc17b6
JH
13971*) getlogin_r_proto=0
13972 ;;
13973esac
13974
b4eb6b3d
JH
13975: see if getmnt exists
13976set getmnt d_getmnt
13977eval $inlibc
13978
13979: see if getmntent exists
13980set getmntent d_getmntent
13981eval $inlibc
13982
5086dff9
MB
13983: see if getnameinfo exists
13984set getnameinfo d_getnameinfo
13985eval $inlibc
13986
b4eb6b3d
JH
13987: see if getnetbyaddr exists
13988set getnetbyaddr d_getnbyaddr
13989eval $inlibc
13990
13991: see if getnetbyname exists
13992set getnetbyname d_getnbyname
13993eval $inlibc
13994
13995: see if getnetent exists
13996set getnetent d_getnent
13997eval $inlibc
13998
10bc17b6
JH
13999: see if getnetbyaddr_r exists
14000set getnetbyaddr_r d_getnetbyaddr_r
14001eval $inlibc
14002case "$d_getnetbyaddr_r" in
14003"$define")
14004 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14005 case "$d_getnetbyaddr_r_proto:$usethreads" in
14006 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
14007 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14008 eval $hasproto ;;
14009 *) ;;
14010 esac
14011 case "$d_getnetbyaddr_r_proto" in
14012 define)
10bc17b6
JH
14013 case "$getnetbyaddr_r_proto" in
14014 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14015 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
10bc17b6
JH
14016 esac
14017 case "$getnetbyaddr_r_proto" in
14018 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14019 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
10bc17b6
JH
14020 esac
14021 case "$getnetbyaddr_r_proto" in
14022 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
61c26d18 14023 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
10bc17b6
JH
14024 esac
14025 case "$getnetbyaddr_r_proto" in
14026 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14027 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
10bc17b6
JH
14028 esac
14029 case "$getnetbyaddr_r_proto" in
14030 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
61c26d18 14031 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
10bc17b6
JH
14032 esac
14033 case "$getnetbyaddr_r_proto" in
14034 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
61c26d18 14035 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
10bc17b6
JH
14036 esac
14037 case "$getnetbyaddr_r_proto" in
14038 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
61c26d18 14039 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
10bc17b6
JH
14040 esac
14041 case "$getnetbyaddr_r_proto" in
a845a0d4 14042 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14043 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
a845a0d4
JH
14044 esac
14045 case "$getnetbyaddr_r_proto" in
90e831dc 14046 ''|0) d_getnetbyaddr_r=undef
10bc17b6 14047 getnetbyaddr_r_proto=0
a48ec845 14048 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14049 * ) case "$getnetbyaddr_r_proto" in
14050 REENTRANT_PROTO*) ;;
14051 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14052 esac
14053 echo "Prototype: $try" ;;
14054 esac
14055 ;;
c18e646a
JH
14056 *) case "$usethreads" in
14057 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14058 esac
90e831dc
SB
14059 d_getnetbyaddr_r=undef
14060 getnetbyaddr_r_proto=0
c18e646a 14061 ;;
a48ec845
JH
14062 esac
14063 ;;
10bc17b6
JH
14064*) getnetbyaddr_r_proto=0
14065 ;;
14066esac
14067
14068: see if getnetbyname_r exists
14069set getnetbyname_r d_getnetbyname_r
14070eval $inlibc
14071case "$d_getnetbyname_r" in
14072"$define")
14073 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14074 case "$d_getnetbyname_r_proto:$usethreads" in
14075 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
14076 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14077 eval $hasproto ;;
14078 *) ;;
14079 esac
14080 case "$d_getnetbyname_r_proto" in
14081 define)
10bc17b6
JH
14082 case "$getnetbyname_r_proto" in
14083 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14084 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
14085 esac
14086 case "$getnetbyname_r_proto" in
14087 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14088 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
10bc17b6
JH
14089 esac
14090 case "$getnetbyname_r_proto" in
14091 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14092 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
10bc17b6
JH
14093 esac
14094 case "$getnetbyname_r_proto" in
14095 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
61c26d18 14096 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
10bc17b6
JH
14097 esac
14098 case "$getnetbyname_r_proto" in
90e831dc 14099 ''|0) d_getnetbyname_r=undef
10bc17b6 14100 getnetbyname_r_proto=0
a48ec845 14101 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14102 * ) case "$getnetbyname_r_proto" in
14103 REENTRANT_PROTO*) ;;
14104 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14105 esac
14106 echo "Prototype: $try" ;;
14107 esac
14108 ;;
c18e646a
JH
14109 *) case "$usethreads" in
14110 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14111 esac
90e831dc
SB
14112 d_getnetbyname_r=undef
14113 getnetbyname_r_proto=0
c18e646a 14114 ;;
a48ec845
JH
14115 esac
14116 ;;
10bc17b6
JH
14117*) getnetbyname_r_proto=0
14118 ;;
14119esac
14120
14121: see if getnetent_r exists
14122set getnetent_r d_getnetent_r
14123eval $inlibc
14124case "$d_getnetent_r" in
14125"$define")
14126 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14127 case "$d_getnetent_r_proto:$usethreads" in
14128 ":define") d_getnetent_r_proto=define
a48ec845
JH
14129 set d_getnetent_r_proto getnetent_r $hdrs
14130 eval $hasproto ;;
14131 *) ;;
14132 esac
14133 case "$d_getnetent_r_proto" in
14134 define)
10bc17b6
JH
14135 case "$getnetent_r_proto" in
14136 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14137 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
10bc17b6
JH
14138 esac
14139 case "$getnetent_r_proto" in
14140 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14141 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
10bc17b6
JH
14142 esac
14143 case "$getnetent_r_proto" in
14144 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14145 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
10bc17b6
JH
14146 esac
14147 case "$getnetent_r_proto" in
14148 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
61c26d18 14149 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
10bc17b6
JH
14150 esac
14151 case "$getnetent_r_proto" in
14152 ''|0) try='int getnetent_r(struct netent*, char*, int);'
61c26d18 14153 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
10bc17b6
JH
14154 esac
14155 case "$getnetent_r_proto" in
14156 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
61c26d18 14157 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
10bc17b6
JH
14158 esac
14159 case "$getnetent_r_proto" in
90e831dc 14160 ''|0) d_getnetent_r=undef
10bc17b6 14161 getnetent_r_proto=0
a48ec845 14162 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14163 * ) case "$getnetent_r_proto" in
14164 REENTRANT_PROTO*) ;;
14165 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14166 esac
14167 echo "Prototype: $try" ;;
14168 esac
14169 ;;
c18e646a
JH
14170 *) case "$usethreads" in
14171 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14172 esac
90e831dc
SB
14173 d_getnetent_r=undef
14174 getnetent_r_proto=0
c18e646a 14175 ;;
a48ec845
JH
14176 esac
14177 ;;
10bc17b6
JH
14178*) getnetent_r_proto=0
14179 ;;
14180esac
14181
b4eb6b3d
JH
14182: see if prototypes for various getnetxxx netdb.h functions are available
14183echo " "
14184set d_getnetprotos getnetent $i_netdb netdb.h
14185eval $hasproto
14186
0c0643d0
JH
14187: see if getpagesize exists
14188set getpagesize d_getpagsz
14189eval $inlibc
14190
34f1896b 14191: Optional checks for getprotobyname and getprotobynumber
b4eb6b3d
JH
14192
14193: see if getprotobyname exists
14194set getprotobyname d_getpbyname
14195eval $inlibc
14196
14197: see if getprotobynumber exists
14198set getprotobynumber d_getpbynumber
14199eval $inlibc
14200
14201: see if getprotoent exists
14202set getprotoent d_getpent
14203eval $inlibc
14204
14205: see if getpgid exists
14206set getpgid d_getpgid
14207eval $inlibc
14208
14209: see if getpgrp2 exists
14210set getpgrp2 d_getpgrp2
14211eval $inlibc
14212
14213: see if getppid exists
14214set getppid d_getppid
14215eval $inlibc
14216
14217: see if getpriority exists
14218set getpriority d_getprior
14219eval $inlibc
14220
10bc17b6
JH
14221: see if getprotobyname_r exists
14222set getprotobyname_r d_getprotobyname_r
14223eval $inlibc
14224case "$d_getprotobyname_r" in
14225"$define")
14226 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14227 case "$d_getprotobyname_r_proto:$usethreads" in
14228 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
14229 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14230 eval $hasproto ;;
14231 *) ;;
14232 esac
14233 case "$d_getprotobyname_r_proto" in
14234 define)
10bc17b6
JH
14235 case "$getprotobyname_r_proto" in
14236 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14237 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
10bc17b6
JH
14238 esac
14239 case "$getprotobyname_r_proto" in
14240 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
61c26d18 14241 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
10bc17b6
JH
14242 esac
14243 case "$getprotobyname_r_proto" in
14244 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
61c26d18 14245 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
10bc17b6
JH
14246 esac
14247 case "$getprotobyname_r_proto" in
90e831dc 14248 ''|0) d_getprotobyname_r=undef
10bc17b6 14249 getprotobyname_r_proto=0
a48ec845 14250 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14251 * ) case "$getprotobyname_r_proto" in
14252 REENTRANT_PROTO*) ;;
14253 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14254 esac
14255 echo "Prototype: $try" ;;
14256 esac
14257 ;;
c18e646a
JH
14258 *) case "$usethreads" in
14259 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14260 esac
90e831dc
SB
14261 d_getprotobyname_r=undef
14262 getprotobyname_r_proto=0
c18e646a 14263 ;;
a48ec845
JH
14264 esac
14265 ;;
10bc17b6
JH
14266*) getprotobyname_r_proto=0
14267 ;;
14268esac
14269
14270: see if getprotobynumber_r exists
14271set getprotobynumber_r d_getprotobynumber_r
14272eval $inlibc
14273case "$d_getprotobynumber_r" in
14274"$define")
14275 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14276 case "$d_getprotobynumber_r_proto:$usethreads" in
14277 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
14278 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14279 eval $hasproto ;;
14280 *) ;;
14281 esac
14282 case "$d_getprotobynumber_r_proto" in
14283 define)
10bc17b6
JH
14284 case "$getprotobynumber_r_proto" in
14285 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14286 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
10bc17b6
JH
14287 esac
14288 case "$getprotobynumber_r_proto" in
14289 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
61c26d18 14290 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
10bc17b6
JH
14291 esac
14292 case "$getprotobynumber_r_proto" in
14293 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
61c26d18 14294 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
10bc17b6
JH
14295 esac
14296 case "$getprotobynumber_r_proto" in
90e831dc 14297 ''|0) d_getprotobynumber_r=undef
10bc17b6 14298 getprotobynumber_r_proto=0
a48ec845 14299 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14300 * ) case "$getprotobynumber_r_proto" in
14301 REENTRANT_PROTO*) ;;
14302 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14303 esac
14304 echo "Prototype: $try" ;;
14305 esac
14306 ;;
c18e646a
JH
14307 *) case "$usethreads" in
14308 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14309 esac
90e831dc
SB
14310 d_getprotobynumber_r=undef
14311 getprotobynumber_r_proto=0
c18e646a 14312 ;;
a48ec845
JH
14313 esac
14314 ;;
10bc17b6
JH
14315*) getprotobynumber_r_proto=0
14316 ;;
14317esac
14318
14319: see if getprotoent_r exists
14320set getprotoent_r d_getprotoent_r
14321eval $inlibc
14322case "$d_getprotoent_r" in
14323"$define")
14324 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14325 case "$d_getprotoent_r_proto:$usethreads" in
14326 ":define") d_getprotoent_r_proto=define
a48ec845
JH
14327 set d_getprotoent_r_proto getprotoent_r $hdrs
14328 eval $hasproto ;;
14329 *) ;;
14330 esac
14331 case "$d_getprotoent_r_proto" in
14332 define)
10bc17b6
JH
14333 case "$getprotoent_r_proto" in
14334 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14335 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
10bc17b6
JH
14336 esac
14337 case "$getprotoent_r_proto" in
14338 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
61c26d18 14339 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
10bc17b6
JH
14340 esac
14341 case "$getprotoent_r_proto" in
14342 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
61c26d18 14343 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
10bc17b6
JH
14344 esac
14345 case "$getprotoent_r_proto" in
14346 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
61c26d18 14347 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
10bc17b6
JH
14348 esac
14349 case "$getprotoent_r_proto" in
90e831dc 14350 ''|0) d_getprotoent_r=undef
10bc17b6 14351 getprotoent_r_proto=0
a48ec845 14352 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14353 * ) case "$getprotoent_r_proto" in
14354 REENTRANT_PROTO*) ;;
14355 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14356 esac
14357 echo "Prototype: $try" ;;
14358 esac
14359 ;;
c18e646a
JH
14360 *) case "$usethreads" in
14361 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14362 esac
90e831dc
SB
14363 d_getprotoent_r=undef
14364 getprotoent_r_proto=0
c18e646a 14365 ;;
a48ec845
JH
14366 esac
14367 ;;
10bc17b6
JH
14368*) getprotoent_r_proto=0
14369 ;;
14370esac
14371
b4eb6b3d
JH
14372: see if prototypes for various getprotoxxx netdb.h functions are available
14373echo " "
14374set d_getprotoprotos getprotoent $i_netdb netdb.h
14375eval $hasproto
14376
14377: see if getprpwnam exists
14378set getprpwnam d_getprpwnam
14379eval $inlibc
14380
14381: see if getpwent exists
14382set getpwent d_getpwent
14383eval $inlibc
14384
10bc17b6
JH
14385: see if getpwent_r exists
14386set getpwent_r d_getpwent_r
14387eval $inlibc
14388case "$d_getpwent_r" in
14389"$define")
14390 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14391 case "$d_getpwent_r_proto:$usethreads" in
14392 ":define") d_getpwent_r_proto=define
a48ec845
JH
14393 set d_getpwent_r_proto getpwent_r $hdrs
14394 eval $hasproto ;;
14395 *) ;;
14396 esac
14397 case "$d_getpwent_r_proto" in
14398 define)
10bc17b6
JH
14399 case "$getpwent_r_proto" in
14400 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14401 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
10bc17b6
JH
14402 esac
14403 case "$getpwent_r_proto" in
14404 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
61c26d18 14405 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
10bc17b6
JH
14406 esac
14407 case "$getpwent_r_proto" in
14408 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
61c26d18 14409 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
10bc17b6
JH
14410 esac
14411 case "$getpwent_r_proto" in
14412 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
61c26d18 14413 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
10bc17b6
JH
14414 esac
14415 case "$getpwent_r_proto" in
14416 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
61c26d18 14417 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
10bc17b6
JH
14418 esac
14419 case "$getpwent_r_proto" in
14420 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
61c26d18 14421 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
10bc17b6
JH
14422 esac
14423 case "$getpwent_r_proto" in
90e831dc 14424 ''|0) d_getpwent_r=undef
10bc17b6 14425 getpwent_r_proto=0
a48ec845 14426 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14427 * ) case "$getpwent_r_proto" in
14428 REENTRANT_PROTO*) ;;
14429 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14430 esac
14431 echo "Prototype: $try" ;;
14432 esac
14433 ;;
c18e646a
JH
14434 *) case "$usethreads" in
14435 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14436 esac
90e831dc
SB
14437 d_getpwent_r=undef
14438 getpwent_r_proto=0
c18e646a 14439 ;;
a48ec845
JH
14440 esac
14441 ;;
10bc17b6
JH
14442*) getpwent_r_proto=0
14443 ;;
14444esac
14445
14446: see if getpwnam_r exists
14447set getpwnam_r d_getpwnam_r
14448eval $inlibc
14449case "$d_getpwnam_r" in
14450"$define")
14451 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14452 case "$d_getpwnam_r_proto:$usethreads" in
14453 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14454 set d_getpwnam_r_proto getpwnam_r $hdrs
14455 eval $hasproto ;;
14456 *) ;;
14457 esac
14458 case "$d_getpwnam_r_proto" in
14459 define)
10bc17b6
JH
14460 case "$getpwnam_r_proto" in
14461 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14462 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14463 esac
14464 case "$getpwnam_r_proto" in
14465 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
61c26d18 14466 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
10bc17b6
JH
14467 esac
14468 case "$getpwnam_r_proto" in
14469 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14470 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
10bc17b6
JH
14471 esac
14472 case "$getpwnam_r_proto" in
14473 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14474 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
10bc17b6
JH
14475 esac
14476 case "$getpwnam_r_proto" in
90e831dc 14477 ''|0) d_getpwnam_r=undef
10bc17b6 14478 getpwnam_r_proto=0
a48ec845 14479 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14480 * ) case "$getpwnam_r_proto" in
14481 REENTRANT_PROTO*) ;;
14482 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14483 esac
14484 echo "Prototype: $try" ;;
14485 esac
14486 ;;
c18e646a
JH
14487 *) case "$usethreads" in
14488 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14489 esac
90e831dc
SB
14490 d_getpwnam_r=undef
14491 getpwnam_r_proto=0
c18e646a 14492 ;;
a48ec845
JH
14493 esac
14494 ;;
10bc17b6
JH
14495*) getpwnam_r_proto=0
14496 ;;
14497esac
14498
14499: see if getpwuid_r exists
14500set getpwuid_r d_getpwuid_r
14501eval $inlibc
14502case "$d_getpwuid_r" in
14503"$define")
14504 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14505 case "$d_getpwuid_r_proto:$usethreads" in
14506 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14507 set d_getpwuid_r_proto getpwuid_r $hdrs
14508 eval $hasproto ;;
14509 *) ;;
14510 esac
14511 case "$d_getpwuid_r_proto" in
14512 define)
10bc17b6
JH
14513 case "$getpwuid_r_proto" in
14514 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14515 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
10bc17b6
JH
14516 esac
14517 case "$getpwuid_r_proto" in
14518 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
61c26d18 14519 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
10bc17b6
JH
14520 esac
14521 case "$getpwuid_r_proto" in
14522 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14523 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
10bc17b6
JH
14524 esac
14525 case "$getpwuid_r_proto" in
14526 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14527 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
10bc17b6
JH
14528 esac
14529 case "$getpwuid_r_proto" in
90e831dc 14530 ''|0) d_getpwuid_r=undef
10bc17b6 14531 getpwuid_r_proto=0
a48ec845 14532 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14533 * ) case "$getpwuid_r_proto" in
14534 REENTRANT_PROTO*) ;;
14535 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14536 esac
14537 echo "Prototype: $try" ;;
14538 esac
14539 ;;
c18e646a
JH
14540 *) case "$usethreads" in
14541 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14542 esac
90e831dc
SB
14543 d_getpwuid_r=undef
14544 getpwuid_r_proto=0
c18e646a 14545 ;;
a48ec845
JH
14546 esac
14547 ;;
10bc17b6
JH
14548*) getpwuid_r_proto=0
14549 ;;
14550esac
14551
34f1896b 14552: Optional checks for getsbyname and getsbyport
b4eb6b3d
JH
14553
14554: see if getservbyname exists
14555set getservbyname d_getsbyname
14556eval $inlibc
14557
14558: see if getservbyport exists
14559set getservbyport d_getsbyport
14560eval $inlibc
14561
14562: see if getservent exists
14563set getservent d_getsent
14564eval $inlibc
14565
10bc17b6
JH
14566: see if getservbyname_r exists
14567set getservbyname_r d_getservbyname_r
14568eval $inlibc
14569case "$d_getservbyname_r" in
14570"$define")
14571 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14572 case "$d_getservbyname_r_proto:$usethreads" in
14573 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14574 set d_getservbyname_r_proto getservbyname_r $hdrs
14575 eval $hasproto ;;
14576 *) ;;
14577 esac
14578 case "$d_getservbyname_r_proto" in
14579 define)
10bc17b6
JH
14580 case "$getservbyname_r_proto" in
14581 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14582 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
10bc17b6
JH
14583 esac
14584 case "$getservbyname_r_proto" in
14585 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
61c26d18 14586 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
10bc17b6
JH
14587 esac
14588 case "$getservbyname_r_proto" in
14589 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
61c26d18 14590 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
10bc17b6
JH
14591 esac
14592 case "$getservbyname_r_proto" in
90e831dc 14593 ''|0) d_getservbyname_r=undef
10bc17b6 14594 getservbyname_r_proto=0
a48ec845 14595 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14596 * ) case "$getservbyname_r_proto" in
14597 REENTRANT_PROTO*) ;;
14598 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14599 esac
14600 echo "Prototype: $try" ;;
14601 esac
14602 ;;
c18e646a
JH
14603 *) case "$usethreads" in
14604 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14605 esac
90e831dc
SB
14606 d_getservbyname_r=undef
14607 getservbyname_r_proto=0
c18e646a 14608 ;;
a48ec845
JH
14609 esac
14610 ;;
10bc17b6
JH
14611*) getservbyname_r_proto=0
14612 ;;
14613esac
14614
14615: see if getservbyport_r exists
14616set getservbyport_r d_getservbyport_r
14617eval $inlibc
14618case "$d_getservbyport_r" in
14619"$define")
14620 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14621 case "$d_getservbyport_r_proto:$usethreads" in
14622 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14623 set d_getservbyport_r_proto getservbyport_r $hdrs
14624 eval $hasproto ;;
14625 *) ;;
14626 esac
14627 case "$d_getservbyport_r_proto" in
14628 define)
10bc17b6
JH
14629 case "$getservbyport_r_proto" in
14630 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14631 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
10bc17b6
JH
14632 esac
14633 case "$getservbyport_r_proto" in
14634 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
61c26d18 14635 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
10bc17b6
JH
14636 esac
14637 case "$getservbyport_r_proto" in
14638 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
61c26d18 14639 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
10bc17b6
JH
14640 esac
14641 case "$getservbyport_r_proto" in
90e831dc 14642 ''|0) d_getservbyport_r=undef
10bc17b6 14643 getservbyport_r_proto=0
a48ec845 14644 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14645 * ) case "$getservbyport_r_proto" in
14646 REENTRANT_PROTO*) ;;
14647 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14648 esac
14649 echo "Prototype: $try" ;;
14650 esac
14651 ;;
c18e646a
JH
14652 *) case "$usethreads" in
14653 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14654 esac
90e831dc
SB
14655 d_getservbyport_r=undef
14656 getservbyport_r_proto=0
c18e646a 14657 ;;
a48ec845
JH
14658 esac
14659 ;;
10bc17b6
JH
14660*) getservbyport_r_proto=0
14661 ;;
14662esac
14663
14664: see if getservent_r exists
14665set getservent_r d_getservent_r
14666eval $inlibc
14667case "$d_getservent_r" in
14668"$define")
14669 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14670 case "$d_getservent_r_proto:$usethreads" in
14671 ":define") d_getservent_r_proto=define
a48ec845
JH
14672 set d_getservent_r_proto getservent_r $hdrs
14673 eval $hasproto ;;
14674 *) ;;
14675 esac
14676 case "$d_getservent_r_proto" in
14677 define)
10bc17b6
JH
14678 case "$getservent_r_proto" in
14679 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
61c26d18 14680 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
10bc17b6
JH
14681 esac
14682 case "$getservent_r_proto" in
14683 ''|0) try='int getservent_r(struct servent*, char*, int);'
61c26d18 14684 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
10bc17b6
JH
14685 esac
14686 case "$getservent_r_proto" in
14687 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
61c26d18 14688 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
10bc17b6
JH
14689 esac
14690 case "$getservent_r_proto" in
14691 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
61c26d18 14692 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
10bc17b6
JH
14693 esac
14694 case "$getservent_r_proto" in
90e831dc 14695 ''|0) d_getservent_r=undef
10bc17b6 14696 getservent_r_proto=0
a48ec845 14697 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14698 * ) case "$getservent_r_proto" in
14699 REENTRANT_PROTO*) ;;
14700 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14701 esac
14702 echo "Prototype: $try" ;;
14703 esac
14704 ;;
c18e646a
JH
14705 *) case "$usethreads" in
14706 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14707 esac
90e831dc
SB
14708 d_getservent_r=undef
14709 getservent_r_proto=0
c18e646a 14710 ;;
a48ec845
JH
14711 esac
14712 ;;
10bc17b6
JH
14713*) getservent_r_proto=0
14714 ;;
14715esac
14716
b4eb6b3d
JH
14717: see if prototypes for various getservxxx netdb.h functions are available
14718echo " "
14719set d_getservprotos getservent $i_netdb netdb.h
14720eval $hasproto
14721
14722: see if getspnam exists
14723set getspnam d_getspnam
14724eval $inlibc
14725
10bc17b6
JH
14726: see if this is a shadow.h system
14727set shadow.h i_shadow
14728eval $inhdr
14729
14730: see if getspnam_r exists
14731set getspnam_r d_getspnam_r
14732eval $inlibc
14733case "$d_getspnam_r" in
14734"$define")
14735 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14736 case "$d_getspnam_r_proto:$usethreads" in
14737 ":define") d_getspnam_r_proto=define
a48ec845
JH
14738 set d_getspnam_r_proto getspnam_r $hdrs
14739 eval $hasproto ;;
14740 *) ;;
14741 esac
14742 case "$d_getspnam_r_proto" in
14743 define)
10bc17b6
JH
14744 case "$getspnam_r_proto" in
14745 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
61c26d18 14746 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14747 esac
14748 case "$getspnam_r_proto" in
14749 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
61c26d18 14750 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
10bc17b6
JH
14751 esac
14752 case "$getspnam_r_proto" in
90e831dc 14753 ''|0) d_getspnam_r=undef
10bc17b6 14754 getspnam_r_proto=0
a48ec845 14755 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14756 * ) case "$getspnam_r_proto" in
14757 REENTRANT_PROTO*) ;;
14758 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14759 esac
14760 echo "Prototype: $try" ;;
14761 esac
14762 ;;
c18e646a
JH
14763 *) case "$usethreads" in
14764 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14765 esac
90e831dc
SB
14766 d_getspnam_r=undef
14767 getspnam_r_proto=0
c18e646a 14768 ;;
a48ec845
JH
14769 esac
14770 ;;
10bc17b6
JH
14771*) getspnam_r_proto=0
14772 ;;
14773esac
14774
b4eb6b3d
JH
14775: see if gettimeofday or ftime exists
14776set gettimeofday d_gettimeod
14777eval $inlibc
14778case "$d_gettimeod" in
14779"$undef")
14780 set ftime d_ftime
14781 eval $inlibc
14782 ;;
14783*)
14784 val="$undef"; set d_ftime; eval $setvar
14785 ;;
14786esac
14787case "$d_gettimeod$d_ftime" in
14788"$undef$undef")
14789 echo " "
14790 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14791 ;;
14792esac
14793
10bc17b6
JH
14794: see if gmtime_r exists
14795set gmtime_r d_gmtime_r
14796eval $inlibc
14797case "$d_gmtime_r" in
14798"$define")
d63eadf0 14799 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14800 case "$d_gmtime_r_proto:$usethreads" in
14801 ":define") d_gmtime_r_proto=define
a48ec845
JH
14802 set d_gmtime_r_proto gmtime_r $hdrs
14803 eval $hasproto ;;
14804 *) ;;
14805 esac
14806 case "$d_gmtime_r_proto" in
14807 define)
10bc17b6
JH
14808 case "$gmtime_r_proto" in
14809 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
61c26d18 14810 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
10bc17b6
JH
14811 esac
14812 case "$gmtime_r_proto" in
14813 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
61c26d18 14814 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
10bc17b6
JH
14815 esac
14816 case "$gmtime_r_proto" in
90e831dc 14817 ''|0) d_gmtime_r=undef
10bc17b6 14818 gmtime_r_proto=0
a48ec845 14819 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14820 * ) case "$gmtime_r_proto" in
14821 REENTRANT_PROTO*) ;;
14822 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14823 esac
14824 echo "Prototype: $try" ;;
14825 esac
b4eb6b3d 14826 ;;
c18e646a
JH
14827 *) case "$usethreads" in
14828 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14829 esac
90e831dc
SB
14830 d_gmtime_r=undef
14831 gmtime_r_proto=0
c18e646a 14832 ;;
a48ec845
JH
14833 esac
14834 ;;
10bc17b6 14835*) gmtime_r_proto=0
b4eb6b3d
JH
14836 ;;
14837esac
14838
14839: see if hasmntopt exists
14840set hasmntopt d_hasmntopt
14841eval $inlibc
14842
14843: see if this is a netinet/in.h or sys/in.h system
14844set netinet/in.h i_niin sys/in.h i_sysin
14845eval $inhdr
14846
14847: see if arpa/inet.h has to be included
14848set arpa/inet.h i_arpainet
14849eval $inhdr
14850
14851: see if htonl --and friends-- exists
14852val=''
14853set htonl val
14854eval $inlibc
14855
14856: Maybe they are macros.
14857case "$val" in
14858$undef)
14859 $cat >htonl.c <<EOM
14860#include <stdio.h>
14861#include <sys/types.h>
14862#$i_niin I_NETINET_IN
14863#$i_sysin I_SYS_IN
14864#$i_arpainet I_ARPA_INET
14865#ifdef I_NETINET_IN
14866#include <netinet/in.h>
14867#endif
14868#ifdef I_SYS_IN
14869#include <sys/in.h>
14870#endif
14871#ifdef I_ARPA_INET
14872#include <arpa/inet.h>
14873#endif
14874#ifdef htonl
14875printf("Defined as a macro.");
14876#endif
14877EOM
14878 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14879 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14880 val="$define"
14881 echo "But it seems to be defined as a macro." >&4
14882 fi
14883 $rm -f htonl.?
14884 ;;
14885esac
14886set d_htonl
14887eval $setvar
14888
36adc09b
JH
14889: see if ilogbl exists
14890set ilogbl d_ilogbl
14891eval $inlibc
14892
b4eb6b3d
JH
14893: index or strchr
14894echo " "
14895if set index val -f; eval $csym; $val; then
14896 if set strchr val -f d_strchr; eval $csym; $val; then
14897 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14898 val="$define"
14899 vali="$undef"
14900 echo "strchr() found." >&4
14901 else
14902 val="$undef"
14903 vali="$define"
14904 echo "index() found." >&4
14905 fi
14906 else
14907 val="$undef"
14908 vali="$define"
8dfa8df9
JH
14909 echo "index() found." >&4
14910 fi
b4eb6b3d 14911else
8dfa8df9
JH
14912 if set strchr val -f d_strchr; eval $csym; $val; then
14913 val="$define"
14914 vali="$undef"
14915 echo "strchr() found." >&4
14916 else
14917 echo "No index() or strchr() found!" >&4
14918 val="$undef"
14919 vali="$undef"
14920 fi
b4eb6b3d 14921fi
8dfa8df9
JH
14922set d_strchr; eval $setvar
14923val="$vali"
14924set d_index; eval $setvar
14925
14926: check whether inet_aton exists
14927set inet_aton d_inetaton
14928eval $inlibc
b4eb6b3d 14929
5086dff9
MB
14930: see if inet_ntop exists
14931set inet_ntop d_inetntop
14932eval $inlibc
14933
14934: see if inet_pton exists
14935set inet_pton d_inetpton
14936eval $inlibc
14937
b4eb6b3d
JH
14938: Look for isascii
14939echo " "
36adc09b 14940$cat >isascii.c <<EOCP
b4eb6b3d
JH
14941#include <stdio.h>
14942#include <ctype.h>
55954f19
JH
14943#$i_stdlib I_STDLIB
14944#ifdef I_STDLIB
14945#include <stdlib.h>
14946#endif
b4eb6b3d
JH
14947int main() {
14948 int c = 'A';
14949 if (isascii(c))
14950 exit(0);
14951 else
14952 exit(1);
14953}
14954EOCP
14955set isascii
14956if eval $compile; then
14957 echo "isascii() found." >&4
14958 val="$define"
14959else
14960 echo "isascii() NOT found." >&4
14961 val="$undef"
14962fi
14963set d_isascii
14964eval $setvar
14965$rm -f isascii*
14966
758a5d79
JH
14967: see if isfinite exists
14968set isfinite d_isfinite
14969eval $inlibc
14970
14971: see if isinf exists
14972set isinf d_isinf
14973eval $inlibc
14974
b4eb6b3d
JH
14975: see if isnan exists
14976set isnan d_isnan
14977eval $inlibc
14978
14979: see if isnanl exists
14980set isnanl d_isnanl
14981eval $inlibc
14982
14983: see if killpg exists
14984set killpg d_killpg
14985eval $inlibc
14986
14987: see if lchown exists
14988echo " "
14989$cat > try.c <<'EOCP'
14990/* System header to define __stub macros and hopefully few prototypes,
14991 which can conflict with char lchown(); below. */
14992#include <assert.h>
14993/* Override any gcc2 internal prototype to avoid an error. */
14994/* We use char because int might match the return type of a gcc2
14995 builtin and then its argument prototype would still apply. */
14996char lchown();
14997int main() {
14998 /* The GNU C library defines this for functions which it implements
14999 to always fail with ENOSYS. Some functions are actually named
15000 something starting with __ and the normal name is an alias. */
15001#if defined (__stub_lchown) || defined (__stub___lchown)
15002choke me
15003#else
15004lchown();
15005#endif
15006; return 0; }
15007EOCP
15008set try
15009if eval $compile; then
15010 $echo "lchown() found." >&4
15011 val="$define"
15012else
15013 $echo "lchown() NOT found." >&4
15014 val="$undef"
15015fi
15016set d_lchown
15017eval $setvar
15018
15019: See if number of significant digits in a double precision number is known
15020echo " "
15021$cat >ldbl_dig.c <<EOM
15022#$i_limits I_LIMITS
15023#$i_float I_FLOAT
15024#ifdef I_LIMITS
15025#include <limits.h>
15026#endif
15027#ifdef I_FLOAT
15028#include <float.h>
15029#endif
15030#ifdef LDBL_DIG
15031printf("Contains LDBL_DIG");
15032#endif
15033EOM
15034$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15035if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15036 echo "LDBL_DIG found." >&4
15037 val="$define"
15038else
15039 echo "LDBL_DIG NOT found." >&4
15040 val="$undef"
15041fi
15042$rm -f ldbl_dig.?
15043set d_ldbl_dig
15044eval $setvar
15045
0a0abfba
MB
15046: see if this is a math.h system
15047set math.h i_math
15048eval $inhdr
15049
613d6c3e 15050: check to see if math.h defines _LIB_VERSION
0a0abfba
MB
15051d_libm_lib_version="$undef"
15052case $i_math in
15053 $define)
0a0abfba
MB
15054 echo " "
15055 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15056 $cat >try.c <<EOCP
15057#include <unistd.h>
15058#include <math.h>
15059int main (int argc, char *argv[])
15060{
15061 printf ("%d\n", _LIB_VERSION);
15062 return (0);
15063 } /* main */
15064EOCP
15065 set try
15066 if eval $compile; then
15067 foo=`$run ./try`
15068 echo "Yes, it does ($foo)" >&4
15069 d_libm_lib_version="$define"
15070 else
4dd8f9b3 15071 echo "No, it does not (probably harmless)" >&4
0a0abfba 15072 fi
5b813a60 15073 $rm_try
0a0abfba
MB
15074 ;;
15075
15076 esac
15077
b4eb6b3d
JH
15078: see if link exists
15079set link d_link
15080eval $inlibc
15081
10bc17b6
JH
15082: see if localtime_r exists
15083set localtime_r d_localtime_r
15084eval $inlibc
15085case "$d_localtime_r" in
15086"$define")
d63eadf0 15087 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
15088 case "$d_localtime_r_proto:$usethreads" in
15089 ":define") d_localtime_r_proto=define
a48ec845
JH
15090 set d_localtime_r_proto localtime_r $hdrs
15091 eval $hasproto ;;
15092 *) ;;
15093 esac
15094 case "$d_localtime_r_proto" in
15095 define)
10bc17b6
JH
15096 case "$localtime_r_proto" in
15097 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
61c26d18 15098 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
10bc17b6
JH
15099 esac
15100 case "$localtime_r_proto" in
15101 ''|0) try='int localtime_r(const time_t*, struct tm*);'
61c26d18 15102 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
10bc17b6
JH
15103 esac
15104 case "$localtime_r_proto" in
90e831dc 15105 ''|0) d_localtime_r=undef
10bc17b6 15106 localtime_r_proto=0
a48ec845 15107 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15108 * ) case "$localtime_r_proto" in
15109 REENTRANT_PROTO*) ;;
15110 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15111 esac
15112 echo "Prototype: $try" ;;
15113 esac
15114 ;;
c18e646a
JH
15115 *) case "$usethreads" in
15116 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15117 esac
90e831dc
SB
15118 d_localtime_r=undef
15119 localtime_r_proto=0
c18e646a 15120 ;;
a48ec845
JH
15121 esac
15122 ;;
10bc17b6
JH
15123*) localtime_r_proto=0
15124 ;;
15125esac
15126
8572b25d
BH
15127: see if localtime_r calls tzset
15128case "$localtime_r_proto" in
15129REENTRANT_PROTO*)
15130 $cat >try.c <<EOCP
15131/* Does our libc's localtime_r call tzset ?
15132 * return 0 if so, 1 otherwise.
15133 */
61c26d18
MHM
15134#$i_systypes I_SYS_TYPES
15135#$i_unistd I_UNISTD
15136#$i_time I_TIME
15137#$i_stdlib I_STDLIB
15138#$i_string I_STRING
15139#$i_malloc I_MALLOC
15140#ifdef I_SYS_TYPES
15141# include <sys/types.h>
15142#endif
15143#ifdef I_UNISTD
15144# include <unistd.h>
15145#endif
15146#ifdef I_TIME
15147# include <time.h>
15148#endif
15149#ifdef I_STDLIB
15150#include <stdlib.h>
15151#endif
15152#ifdef I_STRING
15153# include <string.h>
15154#else
15155# include <strings.h>
15156#endif
15157#ifdef I_MALLOC
15158# include <malloc.h>
15159#endif
8572b25d
BH
15160int main()
15161{
15162 time_t t = time(0L);
15163 char w_tz[]="TZ" "=GMT+5",
15164 e_tz[]="TZ" "=GMT-5",
15165 *tz_e = (char*)malloc(16),
15166 *tz_w = (char*)malloc(16);
15167 struct tm tm_e, tm_w;
15168 memset(&tm_e,'\0',sizeof(struct tm));
15169 memset(&tm_w,'\0',sizeof(struct tm));
15170 strcpy(tz_e,e_tz);
15171 strcpy(tz_w,w_tz);
15172
15173 putenv(tz_e);
15174 localtime_r(&t, &tm_e);
15175
15176 putenv(tz_w);
15177 localtime_r(&t, &tm_w);
15178
15179 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15180 return 1;
15181 return 0;
15182}
15183EOCP
15184 set try
15185 if eval $compile; then
43dddb59 15186 if $run ./try; then
8572b25d
BH
15187 d_localtime_r_needs_tzset=undef;
15188 else
15189 d_localtime_r_needs_tzset=define;
15190 fi;
15191 else
15192 d_localtime_r_needs_tzset=undef;
15193 fi;
15194 ;;
15195 *)
15196 d_localtime_r_needs_tzset=undef;
15197 ;;
15198esac
5b813a60 15199$rm_try
8572b25d 15200
b4eb6b3d
JH
15201: see if localeconv exists
15202set localeconv d_locconv
15203eval $inlibc
15204
15205: see if lockf exists
15206set lockf d_lockf
15207eval $inlibc
15208
b4eb6b3d
JH
15209: see if prototype for lseek is available
15210echo " "
4786929f 15211set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
15212eval $hasproto
15213
15214: see if lstat exists
15215set lstat d_lstat
15216eval $inlibc
15217
15218: see if madvise exists
15219set madvise d_madvise
15220eval $inlibc
15221
7dd121ae
MB
15222: see if malloc_size exists
15223set malloc_size d_malloc_size
15224eval $inlibc
15225
15226: see if malloc_size_good exists
15227set malloc_good_size d_malloc_good_size
15228eval $inlibc
15229
b4eb6b3d
JH
15230: see if mblen exists
15231set mblen d_mblen
15232eval $inlibc
15233
15234: see if mbstowcs exists
15235set mbstowcs d_mbstowcs
15236eval $inlibc
15237
15238: see if mbtowc exists
15239set mbtowc d_mbtowc
15240eval $inlibc
15241
15242: see if memchr exists
15243set memchr d_memchr
15244eval $inlibc
15245
15246: see if memcmp exists
15247set memcmp d_memcmp
15248eval $inlibc
15249
15250: see if memcpy exists
15251set memcpy d_memcpy
15252eval $inlibc
15253
15254: see if memmove exists
15255set memmove d_memmove
15256eval $inlibc
15257
15258: see if memset exists
15259set memset d_memset
15260eval $inlibc
15261
15262: see if mkdir exists
15263set mkdir d_mkdir
15264eval $inlibc
15265
15266: see if mkdtemp exists
15267set mkdtemp d_mkdtemp
15268eval $inlibc
15269
15270: see if mkfifo exists
15271set mkfifo d_mkfifo
15272eval $inlibc
15273
15274: see if mkstemp exists
15275set mkstemp d_mkstemp
15276eval $inlibc
15277
15278: see if mkstemps exists
15279set mkstemps d_mkstemps
15280eval $inlibc
15281
15282: see if mktime exists
15283set mktime d_mktime
15284eval $inlibc
15285
15286: see if this is a sys/mman.h system
15287set sys/mman.h i_sysmman
15288eval $inhdr
15289
15290: see if mmap exists
15291set mmap d_mmap
15292eval $inlibc
15293: see what shmat returns
15294: default to something harmless
15295mmaptype='void *'
15296case "$i_sysmman$d_mmap" in
15297"$define$define")
15298 $cat >mmap.c <<'END'
15299#include <sys/mman.h>
15300void *mmap();
15301END
15302 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15303 mmaptype='void *'
15304 else
15305 mmaptype='caddr_t'
15306 fi
15307 echo "and it returns ($mmaptype)." >&4
15308 ;;
15309esac
15310
15311
15312
89ce900e
JH
15313: see if sqrtl exists
15314set sqrtl d_sqrtl
15315eval $inlibc
15316
af1ff193
JH
15317: see if scalbnl exists
15318set scalbnl d_scalbnl
15319eval $inlibc
15320
89ce900e
JH
15321: see if modfl exists
15322set modfl d_modfl
15323eval $inlibc
15324
15325: see if prototype for modfl is available
15326echo " "
3a794506 15327set d_modflproto modfl $i_math math.h
89ce900e
JH
15328eval $hasproto
15329
15330d_modfl_pow32_bug="$undef"
15331
15332case "$d_longdbl$d_modfl" in
15333$define$define)
15334 $cat <<EOM
15335Checking to see whether your modfl() is okay for large values...
15336EOM
15337$cat >try.c <<EOCP
5b813a60 15338#include <math.h>
89ce900e
JH
15339#include <stdio.h>
15340EOCP
15341if $test "X$d_modflproto" != "X$define"; then
15342 $cat >>try.c <<EOCP
5b813a60 15343/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
15344long double modfl (long double, long double *);
15345EOCP
15346fi
15347$cat >>try.c <<EOCP
15348int main() {
15349 long double nv = 4294967303.15;
15350 long double v, w;
5b813a60 15351 v = modfl(nv, &w);
89ce900e
JH
15352#ifdef __GLIBC__
15353 printf("glibc");
15354#endif
15355 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15356 return 0;
15357}
15358EOCP
15359 case "$osname:$gccversion" in
15360 aix:) saveccflags="$ccflags"
15361 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15362 esac
15363 set try
15364 if eval $compile; then
15365 foo=`$run ./try`
15366 case "$foo" in
15367 *" 4294967303.150000 1.150000 4294967302.000000")
15368 echo >&4 "Your modfl() is broken for large values."
15369 d_modfl_pow32_bug="$define"
15370 case "$foo" in
15371 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15372 ;;
15373 esac
15374 ;;
15375 *" 4294967303.150000 0.150000 4294967303.000000")
15376 echo >&4 "Your modfl() seems okay for large values."
15377 ;;
15378 *) echo >&4 "I don't understand your modfl() at all."
15379 d_modfl="$undef"
15380 ;;
15381 esac
5b813a60 15382 $rm_try
89ce900e
JH
15383 else
15384 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15385 d_modfl="$undef"
15386 fi
15387 case "$osname:$gccversion" in
15388 aix:) ccflags="$saveccflags" ;; # restore
15389 esac
15390 ;;
15391esac
15392
15393if $test "$uselongdouble" = "$define"; then
af1ff193
JH
15394 message=""
15395 if $test "$d_sqrtl" != "$define"; then
15396 message="$message sqrtl"
15397 fi
15398 if $test "$d_modfl" != "$define"; then
89ce900e
JH
15399 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15400 echo "You have both aintl and copysignl, so I can emulate modfl."
15401 else
af1ff193 15402 message="$message modfl"
89ce900e 15403 fi
af1ff193
JH
15404 fi
15405 if $test "$d_frexpl" != "$define"; then
15406 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15407 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15408 else
15409 message="$message frexpl"
15410 fi
15411 fi
89ce900e 15412
af1ff193 15413 if $test "$message" != ""; then
89ce900e
JH
15414 $cat <<EOM >&4
15415
15416*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15417*** the following mathematical functions needed for long double support:
15418*** $message
fe63a0b4
JH
15419*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15420*** Cannot continue, aborting.
89ce900e
JH
15421
15422EOM
15423
fe63a0b4 15424 exit 1
89ce900e
JH
15425 fi
15426fi
15427
b4eb6b3d
JH
15428: see if mprotect exists
15429set mprotect d_mprotect
15430eval $inlibc
15431
15432: see if msgctl exists
15433set msgctl d_msgctl
15434eval $inlibc
15435
15436: see if msgget exists
15437set msgget d_msgget
15438eval $inlibc
15439
15440: see if msgsnd exists
15441set msgsnd d_msgsnd
15442eval $inlibc
15443
15444: see if msgrcv exists
15445set msgrcv d_msgrcv
15446eval $inlibc
15447
15448: see how much of the 'msg*(2)' library is present.
15449h_msg=true
15450echo " "
15451case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15452*"$undef"*) h_msg=false;;
15453esac
15454case "$osname" in
15455freebsd)
15456 case "`ipcs 2>&1`" in
15457 "SVID messages"*"not configured"*)
15458 echo "Your $osname does not have the msg*(2) configured." >&4
15459 h_msg=false
15460 val="$undef"
15461 set msgctl d_msgctl
15462 eval $setvar
15463 set msgget d_msgget
15464 eval $setvar
15465 set msgsnd d_msgsnd
15466 eval $setvar
15467 set msgrcv d_msgrcv
15468 eval $setvar
15469 ;;
15470 esac
15471 ;;
15472esac
15473: we could also check for sys/ipc.h ...
15474if $h_msg && $test `./findhdr sys/msg.h`; then
15475 echo "You have the full msg*(2) library." >&4
15476 val="$define"
15477else
15478 echo "You don't have the full msg*(2) library." >&4
15479 val="$undef"
15480fi
15481set d_msg
15482eval $setvar
15483
34f1896b 15484: Check for msghdr_s
4e0554ec
JH
15485echo " "
15486echo "Checking to see if your system supports struct msghdr..." >&4
15487set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15488eval $hasstruct
15489case "$d_msghdr_s" in
15490"$define") echo "Yes, it does." ;;
15491*) echo "No, it doesn't." ;;
15492esac
15493
15494
b4eb6b3d
JH
15495: see if msync exists
15496set msync d_msync
15497eval $inlibc
15498
15499: see if munmap exists
15500set munmap d_munmap
15501eval $inlibc
15502
15503: see if nice exists
15504set nice d_nice
15505eval $inlibc
15506
2765b840
JH
15507: see if this is a langinfo.h system
15508set langinfo.h i_langinfo
15509eval $inhdr
15510
15511: see if nl_langinfo exists
15512set nl_langinfo d_nl_langinfo
15513eval $inlibc
15514
1d1be0dc
NC
15515: check for volatile keyword
15516echo " "
15517echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15518$cat >try.c <<'EOCP'
76f47787 15519int main()
1d1be0dc
NC
15520{
15521 typedef struct _goo_struct goo_struct;
15522 goo_struct * volatile goo = ((goo_struct *)0);
15523 struct _goo_struct {
15524 long long_int;
15525 int reg_int;
15526 char char_var;
15527 };
15528 typedef unsigned short foo_t;
15529 char *volatile foo;
15530 volatile int bar;
15531 volatile foo_t blech;
15532 foo = foo;
15533}
15534EOCP
15535if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15536 val="$define"
15537 echo "Yup, it does."
15538else
15539 val="$undef"
15540 echo "Nope, it doesn't."
15541fi
15542set d_volatile
15543eval $setvar
5b813a60 15544$rm_try
1d1be0dc 15545
613d6c3e 15546: Check basic sizes
b4eb6b3d
JH
15547echo " "
15548$echo "Choosing the C types to be used for Perl's internal types..." >&4
15549
15550case "$use64bitint:$d_quad:$quadtype" in
15551define:define:?*)
15552 ivtype="$quadtype"
15553 uvtype="$uquadtype"
15554 ivsize=8
15555 uvsize=8
15556 ;;
15557*) ivtype="long"
15558 uvtype="unsigned long"
15559 ivsize=$longsize
15560 uvsize=$longsize
15561 ;;
15562esac
15563
15564case "$uselongdouble:$d_longdbl" in
15565define:define)
15566 nvtype="long double"
15567 nvsize=$longdblsize
15568 ;;
15569*) nvtype=double
15570 nvsize=$doublesize
15571 ;;
15572esac
15573
15574$echo "(IV will be "$ivtype", $ivsize bytes)"
15575$echo "(UV will be "$uvtype", $uvsize bytes)"
15576$echo "(NV will be "$nvtype", $nvsize bytes)"
15577
15578$cat >try.c <<EOCP
15579#$i_inttypes I_INTTYPES
15580#ifdef I_INTTYPES
15581#include <inttypes.h>
15582#endif
15583#include <stdio.h>
15584int main() {
15585#ifdef INT8
15586 int8_t i = INT8_MAX;
15587 uint8_t u = UINT8_MAX;
15588 printf("int8_t\n");
15589#endif
15590#ifdef INT16
15591 int16_t i = INT16_MAX;
15592 uint16_t i = UINT16_MAX;
15593 printf("int16_t\n");
15594#endif
15595#ifdef INT32
15596 int32_t i = INT32_MAX;
15597 uint32_t u = UINT32_MAX;
15598 printf("int32_t\n");
15599#endif
15600}
15601EOCP
15602
13187456 15603i8type="signed char"
0ab0821a
MB
15604u8type="unsigned char"
15605i8size=1
15606u8size=1
b4eb6b3d
JH
15607
15608case "$i16type" in
15609'') case "$shortsize" in
15610 2) i16type=short
15611 u16type="unsigned short"
15612 i16size=$shortsize
15613 u16size=$shortsize
15614 ;;
15615 esac
15616 ;;
15617esac
15618case "$i16type" in
15619'') set try -DINT16
15620 if eval $compile; then
5440bc8e 15621 case "`$run ./try`" in
b4eb6b3d
JH
15622 int16_t)
15623 i16type=int16_t
15624 u16type=uint16_t
15625 i16size=2
15626 u16size=2
15627 ;;
15628 esac
15629 fi
15630 ;;
15631esac
15632case "$i16type" in
15633'') if $test $shortsize -ge 2; then
15634 i16type=short
15635 u16type="unsigned short"
15636 i16size=$shortsize
15637 u16size=$shortsize
15638 fi
15639 ;;
15640esac
15641
15642case "$i32type" in
15643'') case "$longsize" in
15644 4) i32type=long
15645 u32type="unsigned long"
15646 i32size=$longsize
15647 u32size=$longsize
15648 ;;
15649 *) case "$intsize" in
15650 4) i32type=int
15651 u32type="unsigned int"
15652 i32size=$intsize
15653 u32size=$intsize
15654 ;;
15655 esac
15656 ;;
15657 esac
15658 ;;
15659esac
15660case "$i32type" in
15661'') set try -DINT32
15662 if eval $compile; then
5440bc8e 15663 case "`$run ./try`" in
b4eb6b3d
JH
15664 int32_t)
15665 i32type=int32_t
15666 u32type=uint32_t
15667 i32size=4
15668 u32size=4
15669 ;;
15670 esac
15671 fi
15672 ;;
15673esac
15674case "$i32type" in
15675'') if $test $intsize -ge 4; then
15676 i32type=int
15677 u32type="unsigned int"
15678 i32size=$intsize
15679 u32size=$intsize
15680 fi
15681 ;;
15682esac
15683
15684case "$i64type" in
15685'') case "$d_quad:$quadtype" in
15686 define:?*)
15687 i64type="$quadtype"
15688 u64type="$uquadtype"
15689 i64size=8
15690 u64size=8
15691 ;;
15692 esac
15693 ;;
15694esac
15695
1d1be0dc
NC
15696$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15697: volatile so that the compiler has to store it out to memory.
15698if test X"$d_volatile" = X"$define"; then
15699 volatile=volatile
15700fi
b4eb6b3d
JH
15701$cat <<EOP >try.c
15702#include <stdio.h>
55954f19
JH
15703#$i_stdlib I_STDLIB
15704#ifdef I_STDLIB
15705#include <stdlib.h>
15706#endif
1d1be0dc
NC
15707#include <sys/types.h>
15708#include <signal.h>
15709#ifdef SIGFPE
15710$volatile int bletched = 0;
7090f861 15711$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15712#endif
b4eb6b3d
JH
15713int main() {
15714 $uvtype u = 0;
1d1be0dc 15715 $nvtype d;
b4eb6b3d
JH
15716 int n = 8 * $uvsize;
15717 int i;
1d1be0dc
NC
15718#ifdef SIGFPE
15719 signal(SIGFPE, blech);
15720#endif
15721
b4eb6b3d
JH
15722 for (i = 0; i < n; i++) {
15723 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15724 d = ($nvtype)u;
15725 if (($uvtype)d != u)
b4eb6b3d 15726 break;
1d1be0dc
NC
15727 if (d <= 0)
15728 break;
15729 d = ($nvtype)(u - 1);
15730 if (($uvtype)d != (u - 1))
15731 break;
15732#ifdef SIGFPE
22676560 15733 if (bletched)
1d1be0dc
NC
15734 break;
15735#endif
b4eb6b3d 15736 }
efd1522b 15737 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15738 exit(0);
15739}
15740EOP
1d1be0dc
NC
15741set try
15742
15743d_nv_preserves_uv="$undef"
15744if eval $compile; then
53133ed1 15745 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15746fi
53133ed1 15747case "$nv_preserves_uv_bits" in
5b813a60 15748\-[1-9]*)
53133ed1
NC
15749 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15750 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15751 d_nv_preserves_uv="$define"
b4eb6b3d 15752 ;;
53133ed1 15753[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15754 d_nv_preserves_uv="$undef" ;;
15755*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15756 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15757esac
5b813a60 15758$rm_try
1d1be0dc 15759
b68c599a
NC
15760$echo "Checking to find the largest integer value your NVs can hold..." >&4
15761: volatile so that the compiler has to store it out to memory.
15762if test X"$d_volatile" = X"$define"; then
15763 volatile=volatile
15764fi
15765$cat <<EOP >try.c
15766#include <stdio.h>
15767
15768typedef $nvtype NV;
15769
15770int
15771main() {
15772 NV value = 2;
15773 int count = 1;
15774
15775 while(count < 256) {
15776 $volatile NV up = value + 1.0;
15777 $volatile NV negated = -value;
15778 $volatile NV down = negated - 1.0;
15779 $volatile NV got_up = up - value;
15780 int up_good = got_up == 1.0;
15781 int got_down = down - negated;
15782 int down_good = got_down == -1.0;
15783
15784 if (down_good != up_good) {
15785 fprintf(stderr,
15786 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15787 up_good, (double) got_up, down_good, (double) got_down,
15788 count, (double) value);
15789 return 1;
15790 }
15791 if (!up_good) {
15792 while (1) {
15793 if (count > 8) {
15794 count -= 8;
15795 fputs("256.0", stdout);
15796 } else {
15797 count--;
15798 fputs("2.0", stdout);
15799 }
15800 if (!count) {
15801 puts("");
15802 return 0;
15803 }
15804 fputs("*", stdout);
15805 }
15806 }
15807 value *= 2;
15808 ++count;
15809 }
15810 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15811 count, (double) value);
15812 return 1;
15813}
15814EOP
15815set try
15816
15817nv_overflows_integers_at='0'
15818if eval $compile; then
15819 xxx="`$run ./try`"
15820 case "$?" in
15821 0)
15822 case "$xxx" in
15823 2*) cat >&4 <<EOM
15824The largest integer your NVs can preserve is equal to $xxx
15825EOM
15826 nv_overflows_integers_at="$xxx"
15827 ;;
15828 *) cat >&4 <<EOM
15829Cannot determine the largest integer value your NVs can hold, unexpected output
15830'$xxx'
15831EOM
15832 ;;
15833 esac
15834 ;;
15835 *) cat >&4 <<EOM
15836Cannot determine the largest integer value your NVs can hold
15837EOM
15838 ;;
15839 esac
15840fi
15841$rm_try
15842
f607920a
CB
15843$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15844: volatile so that the compiler has to store it out to memory.
15845if test X"$d_volatile" = X"$define"; then
15846 volatile=volatile
15847fi
15848$cat <<EOP >try.c
15849#include <stdio.h>
15850#$i_stdlib I_STDLIB
15851#ifdef I_STDLIB
15852#include <stdlib.h>
15853#endif
15854#$i_string I_STRING
15855#ifdef I_STRING
15856# include <string.h>
15857#else
15858# include <strings.h>
15859#endif
15860#include <sys/types.h>
15861#include <signal.h>
15862#ifdef SIGFPE
15863$volatile int bletched = 0;
7090f861 15864$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15865#endif
15866
15867int checkit($nvtype d, char *where) {
15868 unsigned char *p = (char *)&d;
15869 unsigned char *end = p + sizeof(d);
15870 int fail = 0;
15871
15872 while (p < end)
15873 fail += *p++;
15874
15875 if (!fail)
17f6277d 15876 return 0;
f607920a
CB
15877
15878 p = (char *)&d;
15879 printf("No - %s: 0x", where);
15880 while (p < end)
15881 printf ("%02X", *p++);
15882 printf("\n");
15883 return 1;
15884}
15885
15886int main(int argc, char **argv) {
15887 $nvtype d = 0.0;
15888 int fail = 0;
15889 fail += checkit(d, "0.0");
15890
15891 /* The compiler shouldn't be assuming that bletched is 0 */
15892 d = bletched;
15893
15894 fail += checkit(d, "bleched");
15895
15896#ifdef SIGFPE
15897 signal(SIGFPE, blech);
15898#endif
15899
15900 /* Paranoia - the compiler should have no way of knowing that ANSI says
15901 that argv[argc] will always be NULL. Actually, if it did assume this it
15902 would be buggy, as this is C and main() can be called from elsewhere in
15903 the program. */
15904 d = argv[argc] ? 1 : 0;
15905
15906 if (d) {
15907 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15908 }
15909
15910 fail += checkit(d, "ternary");
15911
15912 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15913
15914 if (d != 0.0) {
15915 printf("No - memset doesn't give 0.0\n");
15916 /* This might just blow up: */
15917 printf("(gives %g)\n", d);
15918 return 1;
15919 }
5b813a60 15920
f607920a
CB
15921#ifdef SIGFPE
15922 if (bletched) {
15923 printf("No - something bleched\n");
15924 return 1;
15925 }
15926#endif
15927 if (fail) {
15928 printf("No - %d fail(s)\n", fail);
15929 return 1;
15930 }
15931 printf("Yes\n");
15932 return 0;
15933}
15934EOP
15935set try
15936
15937d_nv_zero_is_allbits_zero="$undef"
15938if eval $compile; then
15939 xxx="`$run ./try`"
15940 case "$?" in
15941 0)
15942 case "$xxx" in
15943 Yes) cat >&4 <<EOM
159440.0 is represented as all bits zero in memory
15945EOM
15946 d_nv_zero_is_allbits_zero="$define"
15947 ;;
15948 *) cat >&4 <<EOM
159490.0 is not represented as all bits zero in memory
15950EOM
15951 d_nv_zero_is_allbits_zero="$undef"
15952 ;;
15953 esac
15954 ;;
15955 *) cat >&4 <<EOM
159560.0 is not represented as all bits zero in memory
15957EOM
15958 d_nv_zero_is_allbits_zero="$undef"
15959 ;;
15960 esac
15961fi
5b813a60 15962$rm_try
b4eb6b3d
JH
15963
15964: check for off64_t
15965echo " "
15966echo "Checking to see if you have off64_t..." >&4
15967$cat >try.c <<EOCP
15968#include <sys/types.h>
15969#include <unistd.h>
15970int main() { off64_t x = 7; }
15971EOCP
15972set try
15973if eval $compile; then
15974 val="$define"
15975 echo "You have off64_t."
15976else
15977 val="$undef"
15978 echo "You do not have off64_t."
15979 case "$lseeksize" in
15980 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15981 esac
15982fi
5b813a60 15983$rm_try
b4eb6b3d
JH
15984set d_off64_t
15985eval $setvar
15986
b4eb6b3d
JH
15987: how to create joinable pthreads
15988if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15989 echo " "
5b813a60 15990 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
15991 $cat >try.c <<'EOCP'
15992#include <pthread.h>
15993int main() {
15994 int detachstate = JOINABLE;
15995}
15996EOCP
15997 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15998 if eval $compile; then
15999 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16000 val="$undef" # Yes, undef.
16001 set d_old_pthread_create_joinable
16002 eval $setvar
16003 val=""
16004 set old_pthread_create_joinable
16005 eval $setvar
16006 else
16007 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16008 if eval $compile; then
16009 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16010 val="$define"
16011 set d_old_pthread_create_joinable
16012 eval $setvar
16013 val=PTHREAD_CREATE_UNDETACHED
16014 set old_pthread_create_joinable
16015 eval $setvar
5b813a60 16016 else
b4eb6b3d
JH
16017 set try -DJOINABLE=__UNDETACHED
16018 if eval $compile; then
16019 echo "You seem to use __UNDETACHED." >&4
16020 val="$define"
16021 set d_old_pthread_create_joinable
16022 eval $setvar
16023 val=__UNDETACHED
16024 set old_pthread_create_joinable
16025 eval $setvar
16026 else
16027 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
16028 val="$define"
16029 set d_old_pthread_create_joinable
16030 eval $setvar
16031 val=0
16032 set old_pthread_create_joinable
16033 eval $setvar
16034 fi
16035 fi
16036 fi
5b813a60 16037 $rm_try
b4eb6b3d
JH
16038else
16039 d_old_pthread_create_joinable="$undef"
16040 old_pthread_create_joinable=""
16041fi
16042
16043: see if pause exists
16044set pause d_pause
16045eval $inlibc
16046
b4eb6b3d
JH
16047: see if poll exists
16048set poll d_poll
16049eval $inlibc
16050
c796e3db
MB
16051: see if prctl exists
16052set prctl d_prctl
16053eval $inlibc
16054
16055: see if prctl supports PR_SET_NAME
16056d_prctl_set_name=$undef
16057case $d_prctl in
16058 $define)
16059 $cat >try.c <<EOM
16060#include <sys/prctl.h>
16061
16062int main (int argc, char *argv[])
16063{
16064 return (prctl (PR_SET_NAME, "Test"));
16065 } /* main */
16066EOM
16067 set try
16068 if eval $compile_ok && $run ./try; then
16069 echo "Your prctl (PR_SET_NAME, ...) works"
16070 d_prctl_set_name=$define
16071 fi
16072 $rm_try
16073 ;;
16074 esac
16075
c7aff470
NIS
16076: see if readlink exists
16077set readlink d_readlink
16078eval $inlibc
16079
613d6c3e 16080: Check if exe is symlink to abs path of executing program
c7aff470 16081echo " "
f24dbf84 16082procselfexe=''
c7aff470 16083val="$undef"
a33c94aa
JH
16084case "$d_readlink" in
16085"$define")
c7aff470
NIS
16086 if $issymlink /proc/self/exe ; then
16087 $ls -l /proc/self/exe > reflect
51660ed5 16088 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 16089 echo "You have Linux-like /proc/self/exe."
92236451 16090 procselfexe='"/proc/self/exe"'
f24dbf84 16091 val="$define"
f24dbf84
JH
16092 fi
16093 fi
16094 if $issymlink /proc/curproc/file ; then
16095 $ls -l /proc/curproc/file > reflect
16096 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16097 echo "You have BSD-like /proc/curproc/file."
92236451 16098 procselfexe='"/proc/curproc/file"'
f24dbf84 16099 val="$define"
c7aff470 16100 fi
c7aff470 16101 fi
a33c94aa
JH
16102 ;;
16103esac
428dc699 16104$rm -f reflect
c7aff470
NIS
16105set d_procselfexe
16106eval $setvar
16107
233e16ce
MB
16108: backward compatibility for d_hvfork
16109if test X$d_hvfork != X; then
16110 d_vfork="$d_hvfork"
16111 d_hvfork=''
16112fi
16113: see if there is a vfork
16114val=''
16115set vfork val
16116eval $inlibc
16117
16118d_pseudofork=$undef
16119
16120: Ok, but do we want to use it. vfork is reportedly unreliable in
16121: perl on Solaris 2.x, and probably elsewhere.
16122case "$val" in
16123$define)
16124 echo " "
16125 case "$usevfork" in
16126 false) dflt='n';;
16127 *) dflt='y';;
16128 esac
16129 cat <<'EOM'
16130
16131Perl can only use a vfork() that doesn't suffer from strict
16132restrictions on calling functions or modifying global data in
16133the child. For example, glibc-2.1 contains such a vfork()
16134that is unsuitable. If your system provides a proper fork()
16135call, chances are that you do NOT want perl to use vfork().
16136
16137EOM
16138 rp="Do you still want to use vfork()?"
16139 . ./myread
16140 case "$ans" in
16141 y|Y) ;;
16142 *)
16143 echo "Ok, we won't use vfork()."
16144 val="$undef"
16145 ;;
16146 esac
16147 ;;
16148esac
16149set d_vfork
16150eval $setvar
16151case "$d_vfork" in
16152$define) usevfork='true';;
16153*) usevfork='false';;
16154esac
16155
263fee3f
JH
16156: see whether the pthread_atfork exists
16157$cat >try.c <<EOP
16158#include <pthread.h>
16159#include <stdio.h>
16160int main() {
16161#ifdef PTHREAD_ATFORK
16162 pthread_atfork(NULL,NULL,NULL);
16163#endif
16164}
16165EOP
16166
d6483fcc 16167: see if pthread_atfork exists
263fee3f
JH
16168set try -DPTHREAD_ATFORK
16169if eval $compile; then
16170 val="$define"
16171else
16172 val="$undef"
16173fi
16174case "$usethreads" in
16175$define)
16176 case "$val" in
16177 $define) echo 'pthread_atfork found.' >&4 ;;
16178 *) echo 'pthread_atfork NOT found.' >&4 ;;
16179 esac
16180esac
16181set d_pthread_atfork
16182eval $setvar
d6483fcc 16183
58d975c3
JH
16184: see if pthread_attr_setscope exists
16185set pthread_attr_setscope d_pthread_attr_setscope
16186eval $inlibc
16187
b4eb6b3d
JH
16188: see whether the various POSIXish _yields exist
16189$cat >try.c <<EOP
16190#include <pthread.h>
16191#include <stdio.h>
16192int main() {
16193#ifdef SCHED_YIELD
16194 sched_yield();
16195#else
16196#ifdef PTHREAD_YIELD
16197 pthread_yield();
16198#else
16199#ifdef PTHREAD_YIELD_NULL
16200 pthread_yield(NULL);
16201#endif
16202#endif
16203#endif
16204}
16205EOP
16206: see if sched_yield exists
16207set try -DSCHED_YIELD
16208if eval $compile; then
16209 val="$define"
16210 sched_yield='sched_yield()'
16211else
16212 val="$undef"
16213fi
16214case "$usethreads" in
16215$define)
16216 case "$val" in
16217 $define) echo 'sched_yield() found.' >&4 ;;
16218 *) echo 'sched_yield() NOT found.' >&4 ;;
16219 esac
16220esac
10bc17b6
JH
16221set d_sched_yield
16222eval $setvar
b4eb6b3d 16223
10bc17b6
JH
16224: see if pthread_yield exists
16225set try -DPTHREAD_YIELD
16226if eval $compile; then
16227 val="$define"
16228 case "$sched_yield" in
16229 '') sched_yield='pthread_yield()' ;;
16230 esac
16231else
16232 set try -DPTHREAD_YIELD_NULL
16233 if eval $compile; then
16234 val="$define"
16235 case "$sched_yield" in
16236 '') sched_yield='pthread_yield(NULL)' ;;
16237 esac
16238 else
16239 val="$undef"
16240 fi
16241fi
16242case "$usethreads" in
16243$define)
16244 case "$val" in
16245 $define) echo 'pthread_yield() found.' >&4 ;;
16246 *) echo 'pthread_yield() NOT found.' >&4 ;;
16247 esac
16248 ;;
16249esac
16250set d_pthread_yield
16251eval $setvar
10bc17b6
JH
16252case "$sched_yield" in
16253'') sched_yield=undef ;;
16254esac
5b813a60 16255$rm_try
10bc17b6
JH
16256
16257: see if random_r exists
16258set random_r d_random_r
16259eval $inlibc
16260case "$d_random_r" in
16261"$define")
16262 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16263 case "$d_random_r_proto:$usethreads" in
16264 ":define") d_random_r_proto=define
a48ec845
JH
16265 set d_random_r_proto random_r $hdrs
16266 eval $hasproto ;;
16267 *) ;;
16268 esac
16269 case "$d_random_r_proto" in
16270 define)
10bc17b6
JH
16271 case "$random_r_proto" in
16272 ''|0) try='int random_r(int*, struct random_data*);'
61c26d18 16273 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
a845a0d4
JH
16274 esac
16275 case "$random_r_proto" in
16276 ''|0) try='int random_r(long*, struct random_data*);'
61c26d18 16277 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
a845a0d4
JH
16278 esac
16279 case "$random_r_proto" in
16280 ''|0) try='int random_r(struct random_data*, int32_t*);'
61c26d18 16281 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
16282 esac
16283 case "$random_r_proto" in
90e831dc 16284 ''|0) d_random_r=undef
10bc17b6 16285 random_r_proto=0
a48ec845 16286 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16287 * ) case "$random_r_proto" in
16288 REENTRANT_PROTO*) ;;
16289 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16290 esac
16291 echo "Prototype: $try" ;;
16292 esac
b4eb6b3d 16293 ;;
c18e646a
JH
16294 *) case "$usethreads" in
16295 define) echo "random_r has no prototype, not using it." >&4 ;;
16296 esac
90e831dc
SB
16297 d_random_r=undef
16298 random_r_proto=0
c18e646a 16299 ;;
a48ec845
JH
16300 esac
16301 ;;
10bc17b6 16302*) random_r_proto=0
b4eb6b3d
JH
16303 ;;
16304esac
16305
16306: see if readdir and friends exist
16307set readdir d_readdir
16308eval $inlibc
16309set seekdir d_seekdir
16310eval $inlibc
16311set telldir d_telldir
16312eval $inlibc
16313set rewinddir d_rewinddir
16314eval $inlibc
16315
10bc17b6
JH
16316: see if readdir64_r exists
16317set readdir64_r d_readdir64_r
16318eval $inlibc
16319case "$d_readdir64_r" in
16320"$define")
16321 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16322 case "$d_readdir64_r_proto:$usethreads" in
16323 ":define") d_readdir64_r_proto=define
a48ec845
JH
16324 set d_readdir64_r_proto readdir64_r $hdrs
16325 eval $hasproto ;;
16326 *) ;;
16327 esac
16328 case "$d_readdir64_r_proto" in
16329 define)
10bc17b6
JH
16330 case "$readdir64_r_proto" in
16331 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
61c26d18 16332 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
10bc17b6
JH
16333 esac
16334 case "$readdir64_r_proto" in
16335 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
61c26d18 16336 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
10bc17b6
JH
16337 esac
16338 case "$readdir64_r_proto" in
90e831dc 16339 ''|0) d_readdir64_r=undef
10bc17b6 16340 readdir64_r_proto=0
a48ec845 16341 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16342 * ) case "$readdir64_r_proto" in
16343 REENTRANT_PROTO*) ;;
16344 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16345 esac
16346 echo "Prototype: $try" ;;
16347 esac
16348 ;;
c18e646a
JH
16349 *) case "$usethreads" in
16350 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16351 esac
90e831dc
SB
16352 d_readdir64_r=undef
16353 readdir64_r_proto=0
c18e646a 16354 ;;
a48ec845
JH
16355 esac
16356 ;;
10bc17b6
JH
16357*) readdir64_r_proto=0
16358 ;;
16359esac
16360
16361: see if readdir_r exists
16362set readdir_r d_readdir_r
16363eval $inlibc
16364case "$d_readdir_r" in
16365"$define")
16366 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16367 case "$d_readdir_r_proto:$usethreads" in
16368 ":define") d_readdir_r_proto=define
a48ec845
JH
16369 set d_readdir_r_proto readdir_r $hdrs
16370 eval $hasproto ;;
16371 *) ;;
16372 esac
16373 case "$d_readdir_r_proto" in
16374 define)
10bc17b6
JH
16375 case "$readdir_r_proto" in
16376 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
61c26d18 16377 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
10bc17b6
JH
16378 esac
16379 case "$readdir_r_proto" in
16380 ''|0) try='int readdir_r(DIR*, struct dirent*);'
61c26d18 16381 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
10bc17b6
JH
16382 esac
16383 case "$readdir_r_proto" in
90e831dc 16384 ''|0) d_readdir_r=undef
10bc17b6 16385 readdir_r_proto=0
a48ec845 16386 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16387 * ) case "$readdir_r_proto" in
16388 REENTRANT_PROTO*) ;;
16389 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16390 esac
16391 echo "Prototype: $try" ;;
16392 esac
16393 ;;
c18e646a
JH
16394 *) case "$usethreads" in
16395 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16396 esac
90e831dc
SB
16397 d_readdir_r=undef
16398 readdir_r_proto=0
c18e646a 16399 ;;
a48ec845
JH
16400 esac
16401 ;;
10bc17b6
JH
16402*) readdir_r_proto=0
16403 ;;
16404esac
16405
4e0554ec
JH
16406: see if readv exists
16407set readv d_readv
16408eval $inlibc
16409
16410: see if recvmsg exists
16411set recvmsg d_recvmsg
16412eval $inlibc
16413
b4eb6b3d
JH
16414: see if rename exists
16415set rename d_rename
16416eval $inlibc
16417
16418: see if rmdir exists
16419set rmdir d_rmdir
16420eval $inlibc
16421
16422: see if memory.h is available.
16423val=''
16424set memory.h val
16425eval $inhdr
16426
16427: See if it conflicts with string.h
16428case "$val" in
16429$define)
16430 case "$strings" in
16431 '') ;;
16432 *)
16433 $cppstdin $cppflags $cppminus < $strings > mem.h
16434 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16435 echo " "
16436 echo "We won't be including <memory.h>."
16437 val="$undef"
16438 fi
16439 $rm -f mem.h
16440 ;;
16441 esac
16442esac
16443set i_memory
16444eval $setvar
16445
16446: can bcopy handle overlapping blocks?
b6cc3bc4 16447echo " "
b4eb6b3d 16448val="$undef"
b6cc3bc4
AD
16449case "$d_memmove" in
16450"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16451*) case "$d_bcopy" in
16452 "$define")
16453 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16454 $cat >try.c <<EOCP
b4eb6b3d
JH
16455#$i_memory I_MEMORY
16456#$i_stdlib I_STDLIB
16457#$i_string I_STRING
16458#$i_unistd I_UNISTD
16459EOCP
16460 $cat >>try.c <<'EOCP'
16461#include <stdio.h>
16462#ifdef I_MEMORY
16463# include <memory.h>
16464#endif
16465#ifdef I_STDLIB
16466# include <stdlib.h>
16467#endif
16468#ifdef I_STRING
16469# include <string.h>
16470#else
16471# include <strings.h>
16472#endif
16473#ifdef I_UNISTD
16474# include <unistd.h> /* Needed for NetBSD */
16475#endif
16476int main()
16477{
16478char buf[128], abc[128];
16479char *b;
16480int len;
16481int off;
16482int align;
16483
b6cc3bc4
AD
16484/* Copy "abcde..." string to char abc[] so that gcc doesn't
16485 try to store the string in read-only memory. */
b4eb6b3d
JH
16486bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16487
16488for (align = 7; align >= 0; align--) {
16489 for (len = 36; len; len--) {
16490 b = buf+align;
16491 bcopy(abc, b, len);
16492 for (off = 1; off <= len; off++) {
16493 bcopy(b, b+off, len);
16494 bcopy(b+off, b, len);
16495 if (bcmp(b, abc, len))
16496 exit(1);
16497 }
16498 }
16499}
16500exit(0);
16501}
16502EOCP
b6cc3bc4
AD
16503 set try
16504 if eval $compile_ok; then
43dddb59 16505 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16506 echo "Yes, it can."
16507 val="$define"
16508 else
16509 echo "It can't, sorry."
16510 fi
b4eb6b3d 16511 else
b6cc3bc4 16512 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16513 fi
b6cc3bc4
AD
16514 ;;
16515 esac
5b813a60 16516 $rm_try
b4eb6b3d
JH
16517 ;;
16518esac
b4eb6b3d
JH
16519set d_safebcpy
16520eval $setvar
16521
16522: can memcpy handle overlapping blocks?
b6cc3bc4 16523echo " "
b4eb6b3d 16524val="$undef"
b6cc3bc4
AD
16525case "$d_memmove" in
16526"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16527*) case "$d_memcpy" in
16528 "$define")
16529 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16530 $cat >try.c <<EOCP
b4eb6b3d
JH
16531#$i_memory I_MEMORY
16532#$i_stdlib I_STDLIB
16533#$i_string I_STRING
16534#$i_unistd I_UNISTD
16535EOCP
16536 $cat >>try.c <<'EOCP'
16537#include <stdio.h>
16538#ifdef I_MEMORY
16539# include <memory.h>
16540#endif
16541#ifdef I_STDLIB
16542# include <stdlib.h>
16543#endif
16544#ifdef I_STRING
16545# include <string.h>
16546#else
16547# include <strings.h>
16548#endif
16549#ifdef I_UNISTD
16550# include <unistd.h> /* Needed for NetBSD */
16551#endif
16552int main()
16553{
16554char buf[128], abc[128];
16555char *b;
16556int len;
16557int off;
16558int align;
16559
16560/* Copy "abcde..." string to char abc[] so that gcc doesn't
16561 try to store the string in read-only memory. */
16562memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16563
16564for (align = 7; align >= 0; align--) {
16565 for (len = 36; len; len--) {
16566 b = buf+align;
16567 memcpy(b, abc, len);
16568 for (off = 1; off <= len; off++) {
16569 memcpy(b+off, b, len);
16570 memcpy(b, b+off, len);
16571 if (memcmp(b, abc, len))
16572 exit(1);
16573 }
16574 }
16575}
16576exit(0);
16577}
16578EOCP
b6cc3bc4
AD
16579 set try
16580 if eval $compile_ok; then
43dddb59 16581 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16582 echo "Yes, it can."
16583 val="$define"
16584 else
16585 echo "It can't, sorry."
16586 fi
b4eb6b3d 16587 else
b6cc3bc4 16588 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16589 fi
b6cc3bc4
AD
16590 ;;
16591 esac
5b813a60 16592 $rm_try
b4eb6b3d
JH
16593 ;;
16594esac
b4eb6b3d
JH
16595set d_safemcpy
16596eval $setvar
16597
16598: can memcmp be trusted to compare relative magnitude?
16599val="$undef"
16600case "$d_memcmp" in
16601"$define")
16602 echo " "
16603 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16604 $cat >try.c <<EOCP
16605#$i_memory I_MEMORY
16606#$i_stdlib I_STDLIB
16607#$i_string I_STRING
16608#$i_unistd I_UNISTD
16609EOCP
16610 $cat >>try.c <<'EOCP'
16611#include <stdio.h>
16612#ifdef I_MEMORY
16613# include <memory.h>
16614#endif
16615#ifdef I_STDLIB
36adc09b 16616# include <stdlib.h>
b4eb6b3d
JH
16617#endif
16618#ifdef I_STRING
16619# include <string.h>
16620#else
16621# include <strings.h>
16622#endif
16623#ifdef I_UNISTD
16624# include <unistd.h> /* Needed for NetBSD */
16625#endif
16626int main()
16627{
16628char a = -1;
16629char b = 0;
16630if ((a < b) && memcmp(&a, &b, 1) < 0)
16631 exit(1);
16632exit(0);
16633}
16634EOCP
16635 set try
16636 if eval $compile_ok; then
5440bc8e 16637 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16638 echo "Yes, it can."
16639 val="$define"
16640 else
16641 echo "No, it can't (it uses signed chars)."
16642 fi
16643 else
16644 echo "(I can't compile the test program, so we'll assume not...)"
16645 fi
16646 ;;
16647esac
5b813a60 16648$rm_try
b4eb6b3d
JH
16649set d_sanemcmp
16650eval $setvar
16651
ef9f17be
JH
16652: see if prototype for sbrk is available
16653echo " "
16654set d_sbrkproto sbrk $i_unistd unistd.h
16655eval $hasproto
16656
b4eb6b3d
JH
16657: see if select exists
16658set select d_select
16659eval $inlibc
16660
16661: see if semctl exists
16662set semctl d_semctl
16663eval $inlibc
16664
16665: see if semget exists
16666set semget d_semget
16667eval $inlibc
16668
16669: see if semop exists
16670set semop d_semop
16671eval $inlibc
16672
16673: see how much of the 'sem*(2)' library is present.
16674h_sem=true
16675echo " "
16676case "$d_semctl$d_semget$d_semop" in
16677*"$undef"*) h_sem=false;;
16678esac
16679case "$osname" in
16680freebsd)
16681 case "`ipcs 2>&1`" in
16682 "SVID messages"*"not configured"*)
16683 echo "Your $osname does not have the sem*(2) configured." >&4
16684 h_sem=false
16685 val="$undef"
16686 set semctl d_semctl
16687 eval $setvar
16688 set semget d_semget
16689 eval $setvar
16690 set semop d_semop
16691 eval $setvar
16692 ;;
16693 esac
16694 ;;
16695esac
16696: we could also check for sys/ipc.h ...
16697if $h_sem && $test `./findhdr sys/sem.h`; then
16698 echo "You have the full sem*(2) library." >&4
16699 val="$define"
16700else
16701 echo "You don't have the full sem*(2) library." >&4
16702 val="$undef"
16703fi
16704set d_sem
16705eval $setvar
16706
16707: see whether sys/sem.h defines union semun
16708echo " "
16709$cat > try.c <<'END'
16710#include <sys/types.h>
16711#include <sys/ipc.h>
16712#include <sys/sem.h>
16713int main () { union semun semun; semun.buf = 0; }
16714END
16715set try
16716if eval $compile; then
16717 echo "You have union semun in <sys/sem.h>." >&4
16718 val="$define"
16719else
16720 echo "You do not have union semun in <sys/sem.h>." >&4
16721 val="$undef"
16722fi
5b813a60 16723$rm_try
b4eb6b3d
JH
16724set d_union_semun
16725eval $setvar
16726
16727: see how to do semctl IPC_STAT
16728case "$d_sem" in
16729$define)
b4eb6b3d 16730 echo " "
93451a0d 16731 $cat > tryh.h <<END
b4eb6b3d
JH
16732#ifndef S_IRUSR
16733# ifdef S_IREAD
16734# define S_IRUSR S_IREAD
16735# define S_IWUSR S_IWRITE
16736# define S_IXUSR S_IEXEC
16737# else
16738# define S_IRUSR 0400
16739# define S_IWUSR 0200
16740# define S_IXUSR 0100
16741# endif
16742# define S_IRGRP (S_IRUSR>>3)
16743# define S_IWGRP (S_IWUSR>>3)
16744# define S_IXGRP (S_IXUSR>>3)
16745# define S_IROTH (S_IRUSR>>6)
16746# define S_IWOTH (S_IWUSR>>6)
16747# define S_IXOTH (S_IXUSR>>6)
16748#endif
16749#ifndef S_IRWXU
16750# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16751# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16752# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16753#endif
16754END
2fad75a1 16755 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16756 case "$d_semctl_semun" in
16757 '')
35918792 16758 val="$undef"
2fad75a1 16759 $cat > try.c <<END
b4eb6b3d
JH
16760#include <sys/types.h>
16761#include <sys/ipc.h>
16762#include <sys/sem.h>
16763#include <sys/stat.h>
16764#include <stdio.h>
16765#include <errno.h>
93451a0d 16766#include "tryh.h"
b4eb6b3d
JH
16767#ifndef errno
16768extern int errno;
16769#endif
16770#$d_union_semun HAS_UNION_SEMUN
16771int main() {
16772 union semun
16773#ifndef HAS_UNION_SEMUN
16774 {
16775 int val;
16776 struct semid_ds *buf;
16777 unsigned short *array;
16778 }
16779#endif
16780 arg;
16781 int sem, st;
16782
16783#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16784 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16785 if (sem > -1) {
16786 struct semid_ds argbuf;
16787 arg.buf = &argbuf;
16788# ifdef IPC_STAT
16789 st = semctl(sem, 0, IPC_STAT, arg);
16790 if (st == 0)
16791 printf("semun\n");
16792 else
16793# endif /* IPC_STAT */
16794 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16795# ifdef IPC_RMID
16796 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16797# endif /* IPC_RMID */
b4eb6b3d
JH
16798 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16799 } else
16800#endif /* IPC_PRIVATE && ... */
16801 printf("semget failed: errno = %d\n", errno);
16802 return 0;
16803}
16804END
2fad75a1
JH
16805 set try
16806 if eval $compile; then
16807 xxx=`$run ./try`
16808 case "$xxx" in
16809 semun) val="$define" ;;
16810 esac
16811 fi
5b813a60 16812 $rm_try
35918792
YST
16813 set d_semctl_semun
16814 eval $setvar
2fad75a1
JH
16815 ;;
16816 esac
b4eb6b3d
JH
16817 case "$d_semctl_semun" in
16818 $define)
16819 echo "You can use union semun for semctl IPC_STAT." >&4
16820 also='also'
16821 ;;
16822 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16823 also=''
16824 ;;
16825 esac
16826
16827 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16828 case "$d_semctl_semid_ds" in
16829 '')
35918792 16830 val="$undef"
2fad75a1 16831 $cat > try.c <<'END'
b4eb6b3d
JH
16832#include <sys/types.h>
16833#include <sys/ipc.h>
16834#include <sys/sem.h>
16835#include <sys/stat.h>
93451a0d 16836#include "tryh.h"
b4eb6b3d
JH
16837#include <stdio.h>
16838#include <errno.h>
16839#ifndef errno
16840extern int errno;
16841#endif
16842int main() {
16843 struct semid_ds arg;
16844 int sem, st;
16845
16846#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16847 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16848 if (sem > -1) {
16849# ifdef IPC_STAT
16850 st = semctl(sem, 0, IPC_STAT, &arg);
16851 if (st == 0)
16852 printf("semid_ds\n");
16853 else
16854# endif /* IPC_STAT */
16855 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16856# ifdef IPC_RMID
16857 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16858# endif /* IPC_RMID */
16859 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16860 } else
16861#endif /* IPC_PRIVATE && ... */
16862 printf("semget failed: errno = %d\n", errno);
16863
16864 return 0;
16865}
16866END
2fad75a1
JH
16867 set try
16868 if eval $compile; then
16869 xxx=`$run ./try`
16870 case "$xxx" in
16871 semid_ds) val="$define" ;;
16872 esac
16873 fi
5b813a60 16874 $rm_try
35918792
YST
16875 set d_semctl_semid_ds
16876 eval $setvar
2fad75a1
JH
16877 ;;
16878 esac
b4eb6b3d
JH
16879 case "$d_semctl_semid_ds" in
16880 $define)
16881 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16882 ;;
16883 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16884 ;;
16885 esac
b4eb6b3d
JH
16886 ;;
16887*) val="$undef"
16888
16889 # We do not have the full sem*(2) library, so assume we can not
16890 # use either.
16891
16892 set d_semctl_semun
16893 eval $setvar
16894
16895 set d_semctl_semid_ds
16896 eval $setvar
16897 ;;
16898esac
93451a0d 16899$rm_try tryh.h
b4eb6b3d 16900
4e0554ec
JH
16901: see if sendmsg exists
16902set sendmsg d_sendmsg
16903eval $inlibc
16904
b4eb6b3d
JH
16905: see if setegid exists
16906set setegid d_setegid
16907eval $inlibc
16908
16909: see if seteuid exists
16910set seteuid d_seteuid
16911eval $inlibc
16912
16913: see if setgrent exists
16914set setgrent d_setgrent
16915eval $inlibc
16916
10bc17b6
JH
16917: see if setgrent_r exists
16918set setgrent_r d_setgrent_r
16919eval $inlibc
16920case "$d_setgrent_r" in
16921"$define")
16922 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16923 case "$d_setgrent_r_proto:$usethreads" in
16924 ":define") d_setgrent_r_proto=define
a48ec845
JH
16925 set d_setgrent_r_proto setgrent_r $hdrs
16926 eval $hasproto ;;
16927 *) ;;
16928 esac
16929 case "$d_setgrent_r_proto" in
16930 define)
10bc17b6
JH
16931 case "$setgrent_r_proto" in
16932 ''|0) try='int setgrent_r(FILE**);'
61c26d18 16933 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
10bc17b6
JH
16934 esac
16935 case "$setgrent_r_proto" in
16936 ''|0) try='void setgrent_r(FILE**);'
61c26d18 16937 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
10bc17b6
JH
16938 esac
16939 case "$setgrent_r_proto" in
90e831dc 16940 ''|0) d_setgrent_r=undef
10bc17b6 16941 setgrent_r_proto=0
a48ec845 16942 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16943 * ) case "$setgrent_r_proto" in
16944 REENTRANT_PROTO*) ;;
16945 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16946 esac
16947 echo "Prototype: $try" ;;
16948 esac
16949 ;;
c18e646a
JH
16950 *) case "$usethreads" in
16951 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16952 esac
90e831dc
SB
16953 d_setgrent_r=undef
16954 setgrent_r_proto=0
c18e646a 16955 ;;
a48ec845
JH
16956 esac
16957 ;;
10bc17b6
JH
16958*) setgrent_r_proto=0
16959 ;;
16960esac
16961
b4eb6b3d
JH
16962: see if sethostent exists
16963set sethostent d_sethent
16964eval $inlibc
16965
10bc17b6
JH
16966: see if sethostent_r exists
16967set sethostent_r d_sethostent_r
16968eval $inlibc
16969case "$d_sethostent_r" in
16970"$define")
16971 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16972 case "$d_sethostent_r_proto:$usethreads" in
16973 ":define") d_sethostent_r_proto=define
a48ec845
JH
16974 set d_sethostent_r_proto sethostent_r $hdrs
16975 eval $hasproto ;;
16976 *) ;;
16977 esac
16978 case "$d_sethostent_r_proto" in
16979 define)
10bc17b6
JH
16980 case "$sethostent_r_proto" in
16981 ''|0) try='int sethostent_r(int, struct hostent_data*);'
61c26d18 16982 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
10bc17b6
JH
16983 esac
16984 case "$sethostent_r_proto" in
16985 ''|0) try='void sethostent_r(int, struct hostent_data*);'
61c26d18 16986 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
10bc17b6
JH
16987 esac
16988 case "$sethostent_r_proto" in
90e831dc 16989 ''|0) d_sethostent_r=undef
10bc17b6 16990 sethostent_r_proto=0
a48ec845 16991 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16992 * ) case "$sethostent_r_proto" in
16993 REENTRANT_PROTO*) ;;
16994 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16995 esac
16996 echo "Prototype: $try" ;;
16997 esac
16998 ;;
c18e646a
JH
16999 *) case "$usethreads" in
17000 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17001 esac
90e831dc
SB
17002 d_sethostent_r=undef
17003 sethostent_r_proto=0
c18e646a 17004 ;;
a48ec845
JH
17005 esac
17006 ;;
10bc17b6
JH
17007*) sethostent_r_proto=0
17008 ;;
17009esac
17010
4e0554ec
JH
17011: see if setitimer exists
17012set setitimer d_setitimer
17013eval $inlibc
17014
b4eb6b3d
JH
17015: see if setlinebuf exists
17016set setlinebuf d_setlinebuf
17017eval $inlibc
17018
17019: see if setlocale exists
17020set setlocale d_setlocale
17021eval $inlibc
17022
10bc17b6
JH
17023: see if locale.h is available
17024set locale.h i_locale
17025eval $inhdr
17026
17027: see if setlocale_r exists
17028set setlocale_r d_setlocale_r
17029eval $inlibc
17030case "$d_setlocale_r" in
17031"$define")
17032 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
17033 case "$d_setlocale_r_proto:$usethreads" in
17034 ":define") d_setlocale_r_proto=define
a48ec845
JH
17035 set d_setlocale_r_proto setlocale_r $hdrs
17036 eval $hasproto ;;
17037 *) ;;
17038 esac
17039 case "$d_setlocale_r_proto" in
17040 define)
10bc17b6
JH
17041 case "$setlocale_r_proto" in
17042 ''|0) try='int setlocale_r(int, const char*, char*, int);'
61c26d18 17043 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
10bc17b6
JH
17044 esac
17045 case "$setlocale_r_proto" in
90e831dc 17046 ''|0) d_setlocale_r=undef
10bc17b6 17047 setlocale_r_proto=0
a48ec845 17048 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17049 * ) case "$setlocale_r_proto" in
17050 REENTRANT_PROTO*) ;;
17051 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17052 esac
17053 echo "Prototype: $try" ;;
17054 esac
17055 ;;
c18e646a
JH
17056 *) case "$usethreads" in
17057 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17058 esac
90e831dc
SB
17059 d_setlocale_r=undef
17060 setlocale_r_proto=0
c18e646a 17061 ;;
a48ec845
JH
17062 esac
17063 ;;
10bc17b6
JH
17064*) setlocale_r_proto=0
17065 ;;
17066esac
17067
b4eb6b3d
JH
17068: see if setnetent exists
17069set setnetent d_setnent
17070eval $inlibc
17071
10bc17b6
JH
17072: see if setnetent_r exists
17073set setnetent_r d_setnetent_r
17074eval $inlibc
17075case "$d_setnetent_r" in
17076"$define")
17077 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17078 case "$d_setnetent_r_proto:$usethreads" in
17079 ":define") d_setnetent_r_proto=define
a48ec845
JH
17080 set d_setnetent_r_proto setnetent_r $hdrs
17081 eval $hasproto ;;
17082 *) ;;
17083 esac
17084 case "$d_setnetent_r_proto" in
17085 define)
10bc17b6
JH
17086 case "$setnetent_r_proto" in
17087 ''|0) try='int setnetent_r(int, struct netent_data*);'
61c26d18 17088 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
10bc17b6
JH
17089 esac
17090 case "$setnetent_r_proto" in
17091 ''|0) try='void setnetent_r(int, struct netent_data*);'
61c26d18 17092 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
10bc17b6
JH
17093 esac
17094 case "$setnetent_r_proto" in
90e831dc 17095 ''|0) d_setnetent_r=undef
10bc17b6 17096 setnetent_r_proto=0
a48ec845 17097 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17098 * ) case "$setnetent_r_proto" in
17099 REENTRANT_PROTO*) ;;
17100 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17101 esac
17102 echo "Prototype: $try" ;;
17103 esac
17104 ;;
c18e646a
JH
17105 *) case "$usethreads" in
17106 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17107 esac
90e831dc
SB
17108 d_setnetent_r=undef
17109 setnetent_r_proto=0
c18e646a 17110 ;;
a48ec845
JH
17111 esac
17112 ;;
10bc17b6
JH
17113*) setnetent_r_proto=0
17114 ;;
17115esac
17116
b4eb6b3d
JH
17117: see if setprotoent exists
17118set setprotoent d_setpent
17119eval $inlibc
17120
17121: see if setpgid exists
17122set setpgid d_setpgid
17123eval $inlibc
17124
17125: see if setpgrp2 exists
17126set setpgrp2 d_setpgrp2
17127eval $inlibc
17128
17129: see if setpriority exists
17130set setpriority d_setprior
17131eval $inlibc
17132
17133: see if setproctitle exists
17134set setproctitle d_setproctitle
17135eval $inlibc
17136
10bc17b6
JH
17137: see if setprotoent_r exists
17138set setprotoent_r d_setprotoent_r
17139eval $inlibc
17140case "$d_setprotoent_r" in
17141"$define")
17142 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17143 case "$d_setprotoent_r_proto:$usethreads" in
17144 ":define") d_setprotoent_r_proto=define
a48ec845
JH
17145 set d_setprotoent_r_proto setprotoent_r $hdrs
17146 eval $hasproto ;;
17147 *) ;;
17148 esac
17149 case "$d_setprotoent_r_proto" in
17150 define)
10bc17b6
JH
17151 case "$setprotoent_r_proto" in
17152 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
61c26d18 17153 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
10bc17b6
JH
17154 esac
17155 case "$setprotoent_r_proto" in
17156 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
61c26d18 17157 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
10bc17b6
JH
17158 esac
17159 case "$setprotoent_r_proto" in
90e831dc 17160 ''|0) d_setprotoent_r=undef
10bc17b6 17161 setprotoent_r_proto=0
a48ec845 17162 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17163 * ) case "$setprotoent_r_proto" in
17164 REENTRANT_PROTO*) ;;
17165 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17166 esac
17167 echo "Prototype: $try" ;;
17168 esac
17169 ;;
c18e646a
JH
17170 *) case "$usethreads" in
17171 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17172 esac
90e831dc
SB
17173 d_setprotoent_r=undef
17174 setprotoent_r_proto=0
c18e646a 17175 ;;
a48ec845
JH
17176 esac
17177 ;;
10bc17b6
JH
17178*) setprotoent_r_proto=0
17179 ;;
17180esac
17181
b4eb6b3d
JH
17182: see if setpwent exists
17183set setpwent d_setpwent
17184eval $inlibc
17185
10bc17b6
JH
17186: see if setpwent_r exists
17187set setpwent_r d_setpwent_r
17188eval $inlibc
17189case "$d_setpwent_r" in
17190"$define")
17191 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
17192 case "$d_setpwent_r_proto:$usethreads" in
17193 ":define") d_setpwent_r_proto=define
a48ec845
JH
17194 set d_setpwent_r_proto setpwent_r $hdrs
17195 eval $hasproto ;;
17196 *) ;;
17197 esac
17198 case "$d_setpwent_r_proto" in
17199 define)
10bc17b6
JH
17200 case "$setpwent_r_proto" in
17201 ''|0) try='int setpwent_r(FILE**);'
61c26d18 17202 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
10bc17b6
JH
17203 esac
17204 case "$setpwent_r_proto" in
17205 ''|0) try='void setpwent_r(FILE**);'
61c26d18 17206 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
10bc17b6
JH
17207 esac
17208 case "$setpwent_r_proto" in
90e831dc 17209 ''|0) d_setpwent_r=undef
10bc17b6 17210 setpwent_r_proto=0
a48ec845 17211 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17212 * ) case "$setpwent_r_proto" in
17213 REENTRANT_PROTO*) ;;
17214 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17215 esac
17216 echo "Prototype: $try" ;;
17217 esac
17218 ;;
c18e646a
JH
17219 *) case "$usethreads" in
17220 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17221 esac
90e831dc
SB
17222 d_setpwent_r=undef
17223 setpwent_r_proto=0
c18e646a 17224 ;;
a48ec845
JH
17225 esac
17226 ;;
10bc17b6
JH
17227*) setpwent_r_proto=0
17228 ;;
17229esac
17230
b4eb6b3d
JH
17231: see if setregid exists
17232set setregid d_setregid
17233eval $inlibc
17234set setresgid d_setresgid
17235eval $inlibc
17236
17237: see if setreuid exists
17238set setreuid d_setreuid
17239eval $inlibc
17240set setresuid d_setresuid
17241eval $inlibc
17242
17243: see if setrgid exists
17244set setrgid d_setrgid
17245eval $inlibc
17246
17247: see if setruid exists
17248set setruid d_setruid
17249eval $inlibc
17250
17251: see if setservent exists
17252set setservent d_setsent
17253eval $inlibc
17254
10bc17b6
JH
17255: see if setservent_r exists
17256set setservent_r d_setservent_r
17257eval $inlibc
17258case "$d_setservent_r" in
17259"$define")
17260 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17261 case "$d_setservent_r_proto:$usethreads" in
17262 ":define") d_setservent_r_proto=define
a48ec845
JH
17263 set d_setservent_r_proto setservent_r $hdrs
17264 eval $hasproto ;;
17265 *) ;;
17266 esac
17267 case "$d_setservent_r_proto" in
17268 define)
10bc17b6
JH
17269 case "$setservent_r_proto" in
17270 ''|0) try='int setservent_r(int, struct servent_data*);'
61c26d18 17271 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
10bc17b6
JH
17272 esac
17273 case "$setservent_r_proto" in
17274 ''|0) try='void setservent_r(int, struct servent_data*);'
61c26d18 17275 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
10bc17b6
JH
17276 esac
17277 case "$setservent_r_proto" in
90e831dc 17278 ''|0) d_setservent_r=undef
10bc17b6 17279 setservent_r_proto=0
a48ec845 17280 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17281 * ) case "$setservent_r_proto" in
17282 REENTRANT_PROTO*) ;;
17283 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17284 esac
17285 echo "Prototype: $try" ;;
17286 esac
17287 ;;
c18e646a
JH
17288 *) case "$usethreads" in
17289 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17290 esac
90e831dc
SB
17291 d_setservent_r=undef
17292 setservent_r_proto=0
c18e646a 17293 ;;
a48ec845
JH
17294 esac
17295 ;;
10bc17b6
JH
17296*) setservent_r_proto=0
17297 ;;
17298esac
17299
b4eb6b3d
JH
17300: see if setsid exists
17301set setsid d_setsid
17302eval $inlibc
17303
17304: see if setvbuf exists
17305set setvbuf d_setvbuf
17306eval $inlibc
17307
17308: see if sfio.h is available
17309set sfio.h i_sfio
17310eval $inhdr
17311
b4eb6b3d
JH
17312: see if sfio library is available
17313case "$i_sfio" in
17314$define)
17315 val=''
17316 set sfreserve val
17317 eval $inlibc
17318 ;;
17319*)
17320 val="$undef"
17321 ;;
17322esac
17323: Ok, but do we want to use it.
17324case "$val" in
17325$define)
17326 case "$usesfio" in
17327 true|$define|[yY]*) dflt='y';;
17328 *) dflt='n';;
17329 esac
17330 echo "$package can use the sfio library, but it is experimental."
17331 case "$useperlio" in
17332 "$undef")
17333 echo "For sfio also the PerlIO abstraction layer is needed."
17334 echo "Earlier you said you wouldn't want that."
17335 ;;
17336 esac
17337 rp="You seem to have sfio available, do you want to try using it?"
17338 . ./myread
17339 case "$ans" in
17340 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
17341 useperlio="$define"
17342 val="$define"
17343 ;;
17344 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
17345 val="$undef"
b4eb6b3d
JH
17346 ;;
17347 esac
17348 ;;
17349*) case "$usesfio" in
17350 true|$define|[yY]*)
17351 echo "Sorry, cannot find sfio on this machine." >&4
17352 echo "Ignoring your setting of usesfio=$usesfio." >&4
17353 val="$undef"
17354 ;;
17355 esac
17356 ;;
17357esac
17358set d_sfio
17359eval $setvar
17360case "$d_sfio" in
17361$define) usesfio='true';;
17362*) usesfio='false';;
17363esac
3659ebf1
JH
17364case "$d_sfio" in
17365$define) ;;
17366*) : Remove sfio from list of libraries to use
7483f793
JH
17367 case "$libs" in
17368 *-lsfio*)
17369 echo "Removing unneeded -lsfio from library list" >&4
17370 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17371 shift
17372 libs="$*"
17373 echo "libs = $libs" >&4
17374 ;;
17375 esac
3659ebf1
JH
17376;;
17377esac
17378
b4eb6b3d
JH
17379
17380: see if shmctl exists
17381set shmctl d_shmctl
17382eval $inlibc
17383
17384: see if shmget exists
17385set shmget d_shmget
17386eval $inlibc
17387
17388: see if shmat exists
17389set shmat d_shmat
17390eval $inlibc
17391: see what shmat returns
17392case "$d_shmat" in
17393"$define")
17394 $cat >shmat.c <<'END'
17395#include <sys/shm.h>
17396void *shmat();
17397END
17398 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17399 shmattype='void *'
17400 else
17401 shmattype='char *'
17402 fi
17403 echo "and it returns ($shmattype)." >&4
17404 : see if a prototype for shmat is available
17405 xxx=`./findhdr sys/shm.h`
17406 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17407 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17408 val="$define"
17409 else
17410 val="$undef"
17411 fi
17412 $rm -f shmat.[co]
17413 ;;
17414*)
17415 val="$undef"
17416 ;;
17417esac
17418set d_shmatprototype
17419eval $setvar
17420
17421: see if shmdt exists
17422set shmdt d_shmdt
17423eval $inlibc
17424
17425: see how much of the 'shm*(2)' library is present.
17426h_shm=true
17427echo " "
17428case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17429*"$undef"*) h_shm=false;;
17430esac
17431case "$osname" in
17432freebsd)
17433 case "`ipcs 2>&1`" in
17434 "SVID shared memory"*"not configured"*)
17435 echo "Your $osname does not have the shm*(2) configured." >&4
17436 h_shm=false
17437 val="$undef"
17438 set shmctl d_shmctl
17439 evat $setvar
17440 set shmget d_shmget
17441 evat $setvar
17442 set shmat d_shmat
17443 evat $setvar
17444 set shmdt d_shmdt
17445 evat $setvar
17446 ;;
17447 esac
17448 ;;
17449esac
17450: we could also check for sys/ipc.h ...
17451if $h_shm && $test `./findhdr sys/shm.h`; then
17452 echo "You have the full shm*(2) library." >&4
17453 val="$define"
17454else
17455 echo "You don't have the full shm*(2) library." >&4
17456 val="$undef"
17457fi
17458set d_shm
17459eval $setvar
17460
b4eb6b3d 17461: see if we have sigaction
613d6c3e 17462echo " "
b4eb6b3d
JH
17463if set sigaction val -f d_sigaction; eval $csym; $val; then
17464 echo 'sigaction() found.' >&4
073b6de5 17465 $cat > try.c <<EOP
b4eb6b3d
JH
17466#include <stdio.h>
17467#include <sys/types.h>
17468#include <signal.h>
073b6de5
JH
17469#$i_stdlib I_STDLIB
17470#ifdef I_STDLIB
17471#include <stdlib.h>
17472#endif
b4eb6b3d
JH
17473int main()
17474{
17475 struct sigaction act, oact;
17476 act.sa_flags = 0;
17477 oact.sa_handler = 0;
17478 /* so that act and oact are used */
17479 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17480}
17481EOP
17482 set try
17483 if eval $compile_ok; then
17484 val="$define"
17485 else
17486 echo "But you don't seem to have a useable struct sigaction." >&4
17487 val="$undef"
17488 fi
17489else
17490 echo 'sigaction NOT found.' >&4
17491 val="$undef"
17492fi
17493set d_sigaction; eval $setvar
5b813a60 17494$rm_try
b4eb6b3d 17495
ed140128
AD
17496: see if this is a sunmath.h system
17497set sunmath.h i_sunmath
17498eval $inhdr
17499
17500: see if signbit exists
17501$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17502$cat >try.c <<EOCP
17503#$i_math I_MATH
17504#$i_sunmath I_SUNMATH
17505#ifdef I_MATH
17506# include <math.h>
17507#endif
17508#ifdef I_SUNMATH /* Solaris special math library */
17509# include <sunmath.h>
17510#endif
17511#define NV $nvtype
17512int main(int argc, char **argv)
17513{
17514 NV x = 0.0;
17515 NV y = -0.0;
17516 if ((signbit(x) == 0) && (signbit(y) != 0))
17517 return 0;
17518 else
17519 return 1;
17520}
17521EOCP
17522val="$undef"
17523set try
17524if eval $compile; then
17525 if $run ./try; then
17526 $echo "Yes." >&4
17527 val="$define"
17528 else
17529 $echo "Signbit seems to be available, but doesn't work as I expected."
17530 $echo "I won't use it." >&4
17531 val="$undef"
17532 fi
17533else
17534 $echo "Nope." >&4
17535 dflt="$undef"
17536fi
17537set d_signbit
17538eval $setvar
5b813a60 17539$rm_try
ed140128 17540
983dbef6
JH
17541: see if sigprocmask exists
17542set sigprocmask d_sigprocmask
17543eval $inlibc
17544
b4eb6b3d
JH
17545: see if sigsetjmp exists
17546echo " "
17547case "$d_sigsetjmp" in
17548'')
c727eafa 17549 $cat >try.c <<EOP
b4eb6b3d 17550#include <setjmp.h>
d1daaddf
JH
17551#$i_stdlib I_STDLIB
17552#ifdef I_STDLIB
17553#include <stdlib.h>
17554#endif
b4eb6b3d
JH
17555sigjmp_buf env;
17556int set = 1;
17557int main()
17558{
17559 if (sigsetjmp(env,1))
17560 exit(set);
17561 set = 0;
17562 siglongjmp(env, 1);
17563 exit(1);
17564}
17565EOP
17566 set try
17567 if eval $compile; then
5440bc8e 17568 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17569 echo "POSIX sigsetjmp found." >&4
17570 val="$define"
17571 else
17572 $cat >&4 <<EOM
17573Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17574I'll ignore them.
17575EOM
17576 val="$undef"
17577 fi
17578 else
17579 echo "sigsetjmp not found." >&4
17580 val="$undef"
17581 fi
17582 ;;
17583*) val="$d_sigsetjmp"
17584 case "$d_sigsetjmp" in
17585 $define) echo "POSIX sigsetjmp found." >&4;;
17586 $undef) echo "sigsetjmp not found." >&4;;
17587 esac
17588 ;;
17589esac
17590set d_sigsetjmp
17591eval $setvar
5b813a60 17592$rm_try
b4eb6b3d 17593
4f5da3e9
SP
17594: see if snprintf exists
17595set snprintf d_snprintf
17596eval $inlibc
17597
17598: see if vsnprintf exists
17599set vsnprintf d_vsnprintf
17600eval $inlibc
17601
2478f7a0
MB
17602case "$d_snprintf-$d_vsnprintf" in
17603"$define-$define")
17604 $cat <<EOM
17605Checking whether your snprintf() and vsnprintf() work okay...
17606EOM
17607 $cat >try.c <<'EOCP'
17608/* v?snprintf testing logic courtesy of Russ Allbery.
17609 * According to C99:
17610 * - if the buffer is too short it still must be \0-terminated
17611 * - if the buffer is too short the potentially required length
17612 * must be returned and not -1
17613 * - if the buffer is NULL the potentially required length
17614 * must be returned and not -1 or core dump
17615 */
17616#include <stdio.h>
17617#include <stdarg.h>
17618
17619char buf[2];
17620
17621int test (char *format, ...)
17622{
17623 va_list args;
17624 int count;
17625
17626 va_start (args, format);
17627 count = vsnprintf (buf, sizeof buf, format, args);
17628 va_end (args);
17629 return count;
17630}
17631
17632int main ()
17633{
17634 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17635 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17636}
17637EOCP
17638 set try
17639 if eval $compile; then
17640 `$run ./try`
17641 case "$?" in
17642 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17643 *) cat <<EOM >&4
17644Your snprintf() and snprintf() don't seem to be working okay.
17645EOM
17646 d_snprintf="$undef"
17647 d_vsnprintf="$undef"
17648 ;;
17649 esac
17650 else
17651 echo "(I can't seem to compile the test program--assuming they don't)"
17652 d_snprintf="$undef"
17653 d_vsnprintf="$undef"
17654 fi
5b813a60 17655 $rm_try
2478f7a0
MB
17656 ;;
17657esac
17658
49a78c82
JH
17659: see if sockatmark exists
17660set sockatmark d_sockatmark
17661eval $inlibc
17662
2ef53570
JH
17663: see if prototype for sockatmark is available
17664echo " "
17665set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17666eval $hasproto
17667
b4eb6b3d
JH
17668: see if socks5_init exists
17669set socks5_init d_socks5_init
17670eval $inlibc
17671
360321b3
YST
17672: see if sprintf returns the length of the string in the buffer as per ANSI
17673$echo "Checking whether sprintf returns the length of the string..." >&4
17674$cat <<EOP >try.c
17675#include <stdio.h>
17676#$i_stdlib I_STDLIB
17677#ifdef I_STDLIB
17678#include <stdlib.h>
17679#endif
17680#$i_string I_STRING
17681#ifdef I_STRING
17682# include <string.h>
17683#else
17684# include <strings.h>
17685#endif
17686#$i_math I_MATH
17687#ifdef I_MATH
17688#include <math.h>
17689#endif
17690
17691char buffer[256];
17692
17693int check (size_t expect, int test) {
17694 size_t got = strlen(buffer);
17695 if (expect == got)
17696 return 0;
17697
17698 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17699 test, buffer);
17700 exit (test);
17701}
17702
17703int main(int argc, char **argv) {
17704 int test = 0;
17705
17706 check(sprintf(buffer, ""), ++test);
17707 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17708 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17709
17710 return 0;
17711}
17712EOP
17713set try
17714
360321b3
YST
17715if eval $compile; then
17716 xxx="`$run ./try`"
17717 case "$?" in
17718 0) cat >&4 <<EOM
17719sprintf returns the length of the string (as ANSI says it should)
17720EOM
17721 d_sprintf_returns_strlen="$define"
17722 ;;
17723 *) cat >&4 <<EOM
17724sprintf does not return the length of the string (how old is this system?)
17725EOM
17726 d_sprintf_returns_strlen="$undef"
17727 ;;
17728 esac
d2821e72 17729else
36a30365
JH
17730 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17731 d_sprintf_returns_strlen="$undef"
360321b3 17732fi
5b813a60 17733$rm_try
360321b3 17734
10bc17b6
JH
17735: see if srand48_r exists
17736set srand48_r d_srand48_r
17737eval $inlibc
17738case "$d_srand48_r" in
17739"$define")
17740 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17741 case "$d_srand48_r_proto:$usethreads" in
17742 ":define") d_srand48_r_proto=define
a48ec845
JH
17743 set d_srand48_r_proto srand48_r $hdrs
17744 eval $hasproto ;;
17745 *) ;;
17746 esac
17747 case "$d_srand48_r_proto" in
17748 define)
10bc17b6
JH
17749 case "$srand48_r_proto" in
17750 ''|0) try='int srand48_r(long, struct drand48_data*);'
61c26d18 17751 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
10bc17b6
JH
17752 esac
17753 case "$srand48_r_proto" in
90e831dc 17754 ''|0) d_srand48_r=undef
10bc17b6 17755 srand48_r_proto=0
a48ec845 17756 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17757 * ) case "$srand48_r_proto" in
17758 REENTRANT_PROTO*) ;;
17759 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17760 esac
17761 echo "Prototype: $try" ;;
17762 esac
17763 ;;
c18e646a
JH
17764 *) case "$usethreads" in
17765 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17766 esac
90e831dc
SB
17767 d_srand48_r=undef
17768 srand48_r_proto=0
c18e646a 17769 ;;
a48ec845
JH
17770 esac
17771 ;;
10bc17b6
JH
17772*) srand48_r_proto=0
17773 ;;
17774esac
17775
17776: see if srandom_r exists
17777set srandom_r d_srandom_r
17778eval $inlibc
17779case "$d_srandom_r" in
17780"$define")
17781 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17782 case "$d_srandom_r_proto:$usethreads" in
17783 ":define") d_srandom_r_proto=define
a48ec845
JH
17784 set d_srandom_r_proto srandom_r $hdrs
17785 eval $hasproto ;;
17786 *) ;;
17787 esac
17788 case "$d_srandom_r_proto" in
17789 define)
10bc17b6
JH
17790 case "$srandom_r_proto" in
17791 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
61c26d18 17792 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
10bc17b6
JH
17793 esac
17794 case "$srandom_r_proto" in
90e831dc 17795 ''|0) d_srandom_r=undef
10bc17b6 17796 srandom_r_proto=0
a48ec845 17797 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17798 * ) case "$srandom_r_proto" in
17799 REENTRANT_PROTO*) ;;
17800 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17801 esac
17802 echo "Prototype: $try" ;;
17803 esac
17804 ;;
c18e646a
JH
17805 *) case "$usethreads" in
17806 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17807 esac
90e831dc
SB
17808 d_srandom_r=undef
17809 srandom_r_proto=0
c18e646a 17810 ;;
a48ec845
JH
17811 esac
17812 ;;
10bc17b6
JH
17813*) srandom_r_proto=0
17814 ;;
17815esac
17816
eef837ea
JH
17817: see if prototype for setresgid is available
17818echo " "
17819set d_sresgproto setresgid $i_unistd unistd.h
17820eval $hasproto
17821
640374d0
JH
17822: see if prototype for setresuid is available
17823echo " "
17824set d_sresuproto setresuid $i_unistd unistd.h
17825eval $hasproto
17826
b4eb6b3d
JH
17827: see if sys/stat.h is available
17828set sys/stat.h i_sysstat
17829eval $inhdr
17830
b4eb6b3d
JH
17831: see if stat knows about block sizes
17832echo " "
17833echo "Checking to see if your struct stat has st_blocks field..." >&4
17834set d_statblks stat st_blocks $i_sysstat sys/stat.h
17835eval $hasfield
17836
b4eb6b3d
JH
17837: see if this is a sys/vfs.h system
17838set sys/vfs.h i_sysvfs
17839eval $inhdr
17840
b4eb6b3d
JH
17841: see if this is a sys/statfs.h system
17842set sys/statfs.h i_sysstatfs
17843eval $inhdr
17844
34f1896b 17845: Check for statfs_s
b4eb6b3d
JH
17846echo " "
17847echo "Checking to see if your system supports struct statfs..." >&4
17848set 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
17849eval $hasstruct
17850case "$d_statfs_s" in
17851"$define") echo "Yes, it does." ;;
17852*) echo "No, it doesn't." ;;
17853esac
17854
17855
b4eb6b3d
JH
17856: see if struct statfs knows about f_flags
17857case "$d_statfs_s" in
34f1896b 17858define)
b4eb6b3d
JH
17859 echo " "
17860 echo "Checking to see if your struct statfs has f_flags field..." >&4
17861 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
17862 eval $hasfield
17863 ;;
17864*) val="$undef"
17865 set d_statfs_f_flags
17866 eval $setvar
17867 ;;
17868esac
17869case "$d_statfs_f_flags" in
17870"$define") echo "Yes, it does." ;;
17871*) echo "No, it doesn't." ;;
17872esac
17873
17a6c8e3
AD
17874: see what flavor, if any, of static inline is supported
17875echo " "
17876echo "Checking to see if your system supports static inline..."
17877$cat > try.c <<'EOCP'
17878#include <stdlib.h>
17879extern int f_via_a(int x);
17880extern int f_via_b(int x);
17881int main(int argc, char **argv)
17882{
17883 int y;
17884
17885 y = f_via_a(0);
17886#ifdef USE_B
17887 y = f_via_b(0);
17888#endif
17889 if (y == 42) {
17890 return EXIT_SUCCESS;
17891 }
17892 else {
17893 return EXIT_FAILURE;
17894 }
17895}
17896EOCP
17897$cat > a.c <<'EOCP'
17898static INLINE int f(int x) {
17899 int y;
17900 y = x + 42;
17901 return y;
17902}
17903
17904int f_via_a(int x)
17905{
17906 return f(x);
17907}
17908EOCP
17909$cat > b.c <<'EOCP'
17910extern int f(int x);
17911
17912int f_via_b(int x)
17913{
17914 return f(x);
17915}
17916EOCP
17917
17918# Respect a hint (or previous) value for perl_static_inline, if there is one.
17919case "$perl_static_inline" in
17920'') # Check the various possibilities, and break out on success.
17921 # For gcc, prefer __inline__, which will still permit
17922 # cflags.SH to add in -ansi.
17923 case "$gccversion" in
17924 '') xxx="inline __inline__ __inline _inline";;
17925 *) xxx="__inline__ inline __inline _inline";;
17926 esac
17927 for inline in $xxx; do
17928 set try -DINLINE=$inline a.c
17929 if eval $compile && $run ./try; then
17930 # Now make sure there is no external linkage of static
17931 # functions
17932 set try -DINLINE=$inline -DUSE_B a.c b.c
17933 if eval $compile && $run ./try; then
17934 $echo "Your compiler supports static $inline, " >&4
17935 $echo "but it also creates an external definition," >&4
17936 $echo "so I won't use it." >&4
17937 val=$undef
17938 else
17939 $echo "Your compiler supports static $inline." >&4
17940 val=$define
17941 perl_static_inline="static $inline";
17942 break;
17943 fi
17944 else
17945 $echo "Your compiler does NOT support static $inline." >&4
17946 val="$undef"
17947 fi
17948 done
17949 ;;
17950*inline*) # Some variant of inline exists.
17951 echo "Keeping your $hint value of $perl_static_inline."
17952 val=$define
17953 ;;
17954static) # No inline capabilities
17955 echo "Keeping your $hint value of $perl_static_inline."
17956 val=$undef
17957 ;;
17958*) # Unrecognized previous value -- blindly trust the supplied
17959 # value and hope it makes sense. Use old value for
17960 # d_static_inline, if there is one.
17961 echo "Keeping your $hint value of $perl_static_inline."
17962 case "$d_static_inline" in
17963 '') val=$define ;;
17964 *) val=$d_static_inline ;;
17965 esac
17966 ;;
17967esac
17968# Fallback to plain 'static' if nothing worked.
17969case "$perl_static_inline" in
17970'')
17971 perl_static_inline="static"
17972 val=$undef
17973 ;;
17974esac
17975set d_static_inline
17976eval $setvar
17977$rm -f a.[co] b.[co]
17978$rm_try
17979
613d6c3e 17980: Check stream access
b4eb6b3d
JH
17981$cat >&4 <<EOM
17982Checking how to access stdio streams by file descriptor number...
17983EOM
17984case "$stdio_stream_array" in
17985'') $cat >try.c <<EOCP
17986#include <stdio.h>
17987int main() {
17988 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17989 printf("yes\n");
17990}
17991EOCP
17992 for s in _iob __iob __sF
17993 do
17994 set try -DSTDIO_STREAM_ARRAY=$s
17995 if eval $compile; then
5440bc8e 17996 case "`$run ./try`" in
b4eb6b3d
JH
17997 yes) stdio_stream_array=$s; break ;;
17998 esac
17999 fi
18000 done
5b813a60 18001 $rm_try
b4eb6b3d
JH
18002esac
18003case "$stdio_stream_array" in
18004'') $cat >&4 <<EOM
18005I can't figure out how to access stdio streams by file descriptor number.
18006EOM
18007 d_stdio_stream_array="$undef"
18008 ;;
18009*) $cat >&4 <<EOM
18010You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18011EOM
18012 d_stdio_stream_array="$define"
18013 ;;
18014esac
18015
18016: see if strcoll exists
18017set strcoll d_strcoll
18018eval $inlibc
18019
18020: check for structure copying
18021echo " "
18022echo "Checking to see if your C compiler can copy structs..." >&4
18023$cat >try.c <<'EOCP'
76f47787 18024int main()
b4eb6b3d
JH
18025{
18026 struct blurfl {
18027 int dyick;
18028 } foo, bar;
18029
18030 foo = bar;
18031}
18032EOCP
18033if $cc -c try.c >/dev/null 2>&1 ; then
18034 val="$define"
18035 echo "Yup, it can."
18036else
18037 val="$undef"
18038 echo "Nope, it can't."
18039fi
18040set d_strctcpy
18041eval $setvar
5b813a60 18042$rm_try
b4eb6b3d
JH
18043
18044: see if strerror and/or sys_errlist[] exist
18045echo " "
18046if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18047 if set strerror val -f d_strerror; eval $csym; $val; then
18048 echo 'strerror() found.' >&4
18049 d_strerror="$define"
18050 d_strerrm='strerror(e)'
18051 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18052 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18053 d_syserrlst="$define"
18054 else
18055 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18056 d_syserrlst="$undef"
18057 fi
18058 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18059 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18060 echo 'strerror() found in string header.' >&4
18061 d_strerror="$define"
18062 d_strerrm='strerror(e)'
18063 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18064 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18065 d_syserrlst="$define"
18066 else
18067 echo "(You don't appear to have any sys_errlist[], how can this be?)"
18068 d_syserrlst="$undef"
18069 fi
18070 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18071 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18072 d_strerror="$undef"
18073 d_syserrlst="$define"
18074 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18075 else
18076 echo 'strerror() and sys_errlist[] NOT found.' >&4
18077 d_strerror="$undef"
18078 d_syserrlst="$undef"
18079 d_strerrm='"unknown"'
18080 fi
18081fi
18082
10bc17b6
JH
18083: see if strerror_r exists
18084set strerror_r d_strerror_r
18085eval $inlibc
18086case "$d_strerror_r" in
18087"$define")
18088 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
18089 case "$d_strerror_r_proto:$usethreads" in
18090 ":define") d_strerror_r_proto=define
a48ec845
JH
18091 set d_strerror_r_proto strerror_r $hdrs
18092 eval $hasproto ;;
18093 *) ;;
18094 esac
18095 case "$d_strerror_r_proto" in
18096 define)
10bc17b6
JH
18097 case "$strerror_r_proto" in
18098 ''|0) try='int strerror_r(int, char*, size_t);'
61c26d18 18099 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
10bc17b6
JH
18100 esac
18101 case "$strerror_r_proto" in
18102 ''|0) try='int strerror_r(int, char*, int);'
61c26d18 18103 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
10bc17b6
JH
18104 esac
18105 case "$strerror_r_proto" in
18106 ''|0) try='char* strerror_r(int, char*, size_t);'
61c26d18 18107 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
10bc17b6
JH
18108 esac
18109 case "$strerror_r_proto" in
90e831dc 18110 ''|0) d_strerror_r=undef
10bc17b6 18111 strerror_r_proto=0
a48ec845 18112 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18113 * ) case "$strerror_r_proto" in
18114 REENTRANT_PROTO*) ;;
18115 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18116 esac
18117 echo "Prototype: $try" ;;
18118 esac
18119 ;;
c18e646a
JH
18120 *) case "$usethreads" in
18121 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18122 esac
90e831dc
SB
18123 d_strerror_r=undef
18124 strerror_r_proto=0
c18e646a 18125 ;;
a48ec845
JH
18126 esac
18127 ;;
10bc17b6
JH
18128*) strerror_r_proto=0
18129 ;;
18130esac
18131
b3c85772
JH
18132: see if strftime exists
18133set strftime d_strftime
18134eval $inlibc
18135
08c92000
MB
18136: see if strlcat exists
18137set strlcat d_strlcat
18138eval $inlibc
18139
18140: see if strlcpy exists
18141set strlcpy d_strlcpy
18142eval $inlibc
18143
b4eb6b3d
JH
18144: see if strtod exists
18145set strtod d_strtod
18146eval $inlibc
18147
18148: see if strtol exists
18149set strtol d_strtol
18150eval $inlibc
18151
18152: see if strtold exists
18153set strtold d_strtold
18154eval $inlibc
18155
18156: see if strtoll exists
18157set strtoll d_strtoll
18158eval $inlibc
18159
18160case "$d_longlong-$d_strtoll" in
18161"$define-$define")
18162 $cat <<EOM
18163Checking whether your strtoll() works okay...
18164EOM
18165 $cat >try.c <<'EOCP'
18166#include <errno.h>
18167#ifdef __hpux
18168#define strtoll __strtoll
18169#endif
e75931a7
YST
18170#ifdef __EMX__
18171#define strtoll _strtoll
18172#endif
b4eb6b3d 18173#include <stdio.h>
613d6c3e 18174extern long long int strtoll(char *s, char **, int);
b4eb6b3d
JH
18175static int bad = 0;
18176int check(char *s, long long ell, int een) {
18177 long long gll;
18178 errno = 0;
18179 gll = strtoll(s, 0, 10);
18180 if (!((gll == ell) && (errno == een)))
18181 bad++;
18182}
18183int main() {
18184 check(" 1", 1LL, 0);
18185 check(" 0", 0LL, 0);
18186 check("-1", -1LL, 0);
18187 check("-9223372036854775808", -9223372036854775808LL, 0);
18188 check("-9223372036854775808", -9223372036854775808LL, 0);
18189 check(" 9223372036854775807", 9223372036854775807LL, 0);
18190 check("-9223372036854775808", -9223372036854775808LL, 0);
18191 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
18192 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18193 if (!bad)
18194 printf("ok\n");
18195}
18196EOCP
18197 set try
18198 if eval $compile; then
5440bc8e 18199 yyy=`$run ./try`
e75931a7 18200 case "$yyy" in
b4eb6b3d
JH
18201 ok) echo "Your strtoll() seems to be working okay." ;;
18202 *) cat <<EOM >&4
18203Your strtoll() doesn't seem to be working okay.
18204EOM
18205 d_strtoll="$undef"
18206 ;;
69eadf66 18207 esac
e75931a7
YST
18208 else
18209 echo "(I can't seem to compile the test program--assuming it doesn't)"
18210 d_strtoll="$undef"
b4eb6b3d
JH
18211 fi
18212 ;;
18213esac
18214
28e5dec8
JH
18215: see if strtoq exists
18216set strtoq d_strtoq
18217eval $inlibc
18218
b4eb6b3d
JH
18219: see if strtoul exists
18220set strtoul d_strtoul
18221eval $inlibc
18222
d0e6d399
NC
18223case "$d_strtoul" in
18224"$define")
18225 $cat <<EOM
18226Checking whether your strtoul() works okay...
18227EOM
18228 $cat >try.c <<'EOCP'
18229#include <errno.h>
18230#include <stdio.h>
613d6c3e 18231extern unsigned long int strtoul(char *s, char **, int);
d0e6d399
NC
18232static int bad = 0;
18233void check(char *s, unsigned long eul, int een) {
18234 unsigned long gul;
18235 errno = 0;
18236 gul = strtoul(s, 0, 10);
18237 if (!((gul == eul) && (errno == een)))
18238 bad++;
18239}
18240int main() {
18241 check(" 1", 1L, 0);
18242 check(" 0", 0L, 0);
18243EOCP
18244 case "$longsize" in
18245 8)
18246 $cat >>try.c <<'EOCP'
09c0d2c4
JH
18247 check("18446744073709551615", 18446744073709551615UL, 0);
18248 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 18249#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 18250 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
18251 check("-18446744073709551614", 2, 0);
18252 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
18253 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18254 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 18255#endif
d0e6d399
NC
18256EOCP
18257 ;;
18258 4)
18259 $cat >>try.c <<'EOCP'
18260 check("4294967295", 4294967295UL, 0);
18261 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 18262#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
18263 check("-1", 4294967295UL, 0);
18264 check("-4294967294", 2, 0);
18265 check("-4294967295", 1, 0);
18266 check("-4294967296", 4294967295UL, ERANGE);
18267 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 18268#endif
d0e6d399
NC
18269EOCP
18270 ;;
18271 *)
18272: Should we write these tests to be more portable by sprintf-ing
18273: ~0 and then manipulating that char string as input for strtol?
18274 ;;
18275 esac
18276 $cat >>try.c <<'EOCP'
18277 if (!bad)
18278 printf("ok\n");
18279 return 0;
18280}
18281EOCP
18282 set try
18283 if eval $compile; then
5440bc8e 18284 case "`$run ./try`" in
d0e6d399
NC
18285 ok) echo "Your strtoul() seems to be working okay." ;;
18286 *) cat <<EOM >&4
18287Your strtoul() doesn't seem to be working okay.
18288EOM
18289 d_strtoul="$undef"
18290 ;;
18291 esac
9597a80f
NC
18292 else
18293 echo "(I can't seem to compile the test program--assuming it doesn't)"
18294 d_strtoul="$undef"
d0e6d399
NC
18295 fi
18296 ;;
18297esac
18298
b4eb6b3d
JH
18299: see if strtoull exists
18300set strtoull d_strtoull
18301eval $inlibc
18302
18303case "$d_longlong-$d_strtoull" in
18304"$define-$define")
18305 $cat <<EOM
18306Checking whether your strtoull() works okay...
18307EOM
18308 $cat >try.c <<'EOCP'
18309#include <errno.h>
18310#ifdef __hpux
18311#define strtoull __strtoull
18312#endif
18313#include <stdio.h>
613d6c3e 18314extern unsigned long long int strtoull(char *s, char **, int);
b4eb6b3d
JH
18315static int bad = 0;
18316int check(char *s, long long eull, int een) {
18317 long long gull;
18318 errno = 0;
18319 gull = strtoull(s, 0, 10);
18320 if (!((gull == eull) && (errno == een)))
18321 bad++;
18322}
18323int main() {
d0e6d399
NC
18324 check(" 1", 1LL, 0);
18325 check(" 0", 0LL, 0);
18326 check("18446744073709551615", 18446744073709551615ULL, 0);
18327 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18328#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
18329 check("-1", 18446744073709551615ULL, 0);
18330 check("-18446744073709551614", 2LL, 0);
18331 check("-18446744073709551615", 1LL, 0);
18332 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18333 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18334#endif
b4eb6b3d
JH
18335 if (!bad)
18336 printf("ok\n");
18337}
18338EOCP
18339 set try
18340 if eval $compile; then
5440bc8e 18341 case "`$run ./try`" in
b4eb6b3d
JH
18342 ok) echo "Your strtoull() seems to be working okay." ;;
18343 *) cat <<EOM >&4
18344Your strtoull() doesn't seem to be working okay.
18345EOM
18346 d_strtoull="$undef"
18347 ;;
18348 esac
9597a80f
NC
18349 else
18350 echo "(I can't seem to compile the test program--assuming it doesn't)"
18351 d_strtoull="$undef"
b4eb6b3d
JH
18352 fi
18353 ;;
18354esac
18355
18356: see if strtouq exists
18357set strtouq d_strtouq
18358eval $inlibc
18359
d0e6d399
NC
18360case "$d_strtouq" in
18361"$define")
18362 $cat <<EOM
18363Checking whether your strtouq() works okay...
18364EOM
18365 $cat >try.c <<'EOCP'
18366#include <errno.h>
18367#include <stdio.h>
613d6c3e 18368extern unsigned long long int strtouq(char *s, char **, int);
d0e6d399
NC
18369static int bad = 0;
18370void check(char *s, unsigned long long eull, int een) {
18371 unsigned long long gull;
18372 errno = 0;
18373 gull = strtouq(s, 0, 10);
18374 if (!((gull == eull) && (errno == een)))
18375 bad++;
18376}
18377int main() {
18378 check(" 1", 1LL, 0);
18379 check(" 0", 0LL, 0);
18380 check("18446744073709551615", 18446744073709551615ULL, 0);
18381 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18382#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
18383 check("-1", 18446744073709551615ULL, 0);
18384 check("-18446744073709551614", 2LL, 0);
18385 check("-18446744073709551615", 1LL, 0);
18386 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18387 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18388#endif
d0e6d399
NC
18389 if (!bad)
18390 printf("ok\n");
18391 return 0;
18392}
18393EOCP
18394 set try
18395 if eval $compile; then
5440bc8e 18396 case "`$run ./try`" in
d0e6d399
NC
18397 ok) echo "Your strtouq() seems to be working okay." ;;
18398 *) cat <<EOM >&4
18399Your strtouq() doesn't seem to be working okay.
18400EOM
18401 d_strtouq="$undef"
18402 ;;
18403 esac
9597a80f
NC
18404 else
18405 echo "(I can't seem to compile the test program--assuming it doesn't)"
18406 d_strtouq="$undef"
d0e6d399
NC
18407 fi
18408 ;;
18409esac
18410
b4eb6b3d
JH
18411: see if strxfrm exists
18412set strxfrm d_strxfrm
18413eval $inlibc
18414
18415: see if symlink exists
18416set symlink d_symlink
18417eval $inlibc
18418
18419: see if syscall exists
18420set syscall d_syscall
18421eval $inlibc
18422
2ef53570
JH
18423: see if prototype for syscall is available
18424echo " "
18425set d_syscallproto syscall $i_unistd unistd.h
18426eval $hasproto
18427
b4eb6b3d
JH
18428: see if sysconf exists
18429set sysconf d_sysconf
18430eval $inlibc
18431
18432: see if system exists
18433set system d_system
18434eval $inlibc
18435
18436: see if tcgetpgrp exists
18437set tcgetpgrp d_tcgetpgrp
18438eval $inlibc
18439
18440: see if tcsetpgrp exists
18441set tcsetpgrp d_tcsetpgrp
18442eval $inlibc
18443
18444: see if prototype for telldir is available
18445echo " "
18446set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18447eval $hasproto
18448
ad493445
MB
18449: see if time exists
18450echo " "
18451if test "X$d_time" = X -o X"$timetype" = X; then
18452 if set time val -f d_time; eval $csym; $val; then
18453 echo 'time() found.' >&4
18454 val="$define"
18455 rp="What is the type returned by time() on this system?"
18456 set time_t timetype long stdio.h sys/types.h
18457 eval $typedef_ask
18458 else
18459 echo 'time() not found, hope that will do.' >&4
18460 val="$undef"
18461 timetype='int';
18462 fi
18463 set d_time
18464 eval $setvar
18465fi
18466
cbb9e8a7
MB
18467: see if timegm exists
18468set timegm d_timegm
18469eval $inlibc
18470
b4eb6b3d
JH
18471: see if this is a sys/times.h system
18472set sys/times.h i_systimes
18473eval $inhdr
18474
18475: see if times exists
18476echo " "
18477if set times val -f d_times; eval $csym; $val; then
18478 echo 'times() found.' >&4
18479 d_times="$define"
18480 inc=''
18481 case "$i_systimes" in
18482 "$define") inc='sys/times.h';;
18483 esac
18484 rp="What is the type returned by times() on this system?"
18485 set clock_t clocktype long stdio.h sys/types.h $inc
18486 eval $typedef_ask
18487else
18488 echo 'times() NOT found, hope that will do.' >&4
18489 d_times="$undef"
18490 clocktype='int'
18491fi
18492
10bc17b6
JH
18493: see if tmpnam_r exists
18494set tmpnam_r d_tmpnam_r
18495eval $inlibc
18496case "$d_tmpnam_r" in
18497"$define")
31ee0cb7 18498 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
18499 case "$d_tmpnam_r_proto:$usethreads" in
18500 ":define") d_tmpnam_r_proto=define
a48ec845
JH
18501 set d_tmpnam_r_proto tmpnam_r $hdrs
18502 eval $hasproto ;;
18503 *) ;;
18504 esac
18505 case "$d_tmpnam_r_proto" in
18506 define)
10bc17b6
JH
18507 case "$tmpnam_r_proto" in
18508 ''|0) try='char* tmpnam_r(char*);'
61c26d18 18509 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
10bc17b6
JH
18510 esac
18511 case "$tmpnam_r_proto" in
90e831dc 18512 ''|0) d_tmpnam_r=undef
10bc17b6 18513 tmpnam_r_proto=0
a48ec845 18514 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18515 * ) case "$tmpnam_r_proto" in
18516 REENTRANT_PROTO*) ;;
18517 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18518 esac
18519 echo "Prototype: $try" ;;
18520 esac
18521 ;;
c18e646a
JH
18522 *) case "$usethreads" in
18523 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18524 esac
90e831dc
SB
18525 d_tmpnam_r=undef
18526 tmpnam_r_proto=0
c18e646a 18527 ;;
a48ec845
JH
18528 esac
18529 ;;
10bc17b6
JH
18530*) tmpnam_r_proto=0
18531 ;;
18532esac
18533
b4eb6b3d
JH
18534: see if truncate exists
18535set truncate d_truncate
18536eval $inlibc
18537
10bc17b6
JH
18538: see if ttyname_r exists
18539set ttyname_r d_ttyname_r
18540eval $inlibc
18541case "$d_ttyname_r" in
18542"$define")
18543 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
18544 case "$d_ttyname_r_proto:$usethreads" in
18545 ":define") d_ttyname_r_proto=define
a48ec845
JH
18546 set d_ttyname_r_proto ttyname_r $hdrs
18547 eval $hasproto ;;
18548 *) ;;
18549 esac
18550 case "$d_ttyname_r_proto" in
18551 define)
10bc17b6
JH
18552 case "$ttyname_r_proto" in
18553 ''|0) try='int ttyname_r(int, char*, size_t);'
61c26d18 18554 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
10bc17b6
JH
18555 esac
18556 case "$ttyname_r_proto" in
18557 ''|0) try='int ttyname_r(int, char*, int);'
61c26d18 18558 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
10bc17b6
JH
18559 esac
18560 case "$ttyname_r_proto" in
18561 ''|0) try='char* ttyname_r(int, char*, int);'
61c26d18 18562 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
10bc17b6
JH
18563 esac
18564 case "$ttyname_r_proto" in
90e831dc 18565 ''|0) d_ttyname_r=undef
10bc17b6 18566 ttyname_r_proto=0
a48ec845 18567 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18568 * ) case "$ttyname_r_proto" in
18569 REENTRANT_PROTO*) ;;
18570 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18571 esac
18572 echo "Prototype: $try" ;;
18573 esac
18574 ;;
c18e646a
JH
18575 *) case "$usethreads" in
18576 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18577 esac
90e831dc
SB
18578 d_ttyname_r=undef
18579 ttyname_r_proto=0
c18e646a 18580 ;;
a48ec845
JH
18581 esac
18582 ;;
10bc17b6
JH
18583*) ttyname_r_proto=0
18584 ;;
18585esac
18586
b4eb6b3d
JH
18587: see if tzname[] exists
18588echo " "
18589if set tzname val -a d_tzname; eval $csym; $val; then
18590 val="$define"
18591 echo 'tzname[] found.' >&4
18592else
18593 val="$undef"
18594 echo 'tzname[] NOT found.' >&4
18595fi
18596set d_tzname
18597eval $setvar
18598
613d6c3e 18599: Check if is a multiplatform env
4e0554ec
JH
18600case "$osname" in
18601next|rhapsody|darwin) multiarch="$define" ;;
18602esac
18603case "$multiarch" in
18604''|[nN]*) multiarch="$undef" ;;
18605esac
18606
24412007 18607: check for ordering of bytes in a UV
4e0554ec 18608echo " "
5440bc8e 18609case "$usecrosscompile$multiarch" in
4e0554ec
JH
18610*$define*)
18611 $cat <<EOM
18612You seem to be either cross-compiling or doing a multiarchitecture build,
18613skipping the byteorder check.
18614
18615EOM
5440bc8e 18616 byteorder='ffff'
4e0554ec
JH
18617 ;;
18618*)
18619 case "$byteorder" in
18620 '')
18621 $cat <<'EOM'
18622In the following, larger digits indicate more significance. A big-endian
18623machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18624little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18625machines may have weird orders like 3412. A Cray will report 87654321,
18626an Alpha will report 12345678. If the test program works the default is
18627probably right.
18628I'm now running the test program...
18629EOM
24412007 18630 $cat >try.c <<EOCP
4e0554ec 18631#include <stdio.h>
55954f19
JH
18632#$i_stdlib I_STDLIB
18633#ifdef I_STDLIB
18634#include <stdlib.h>
18635#endif
24412007
JH
18636#include <sys/types.h>
18637typedef $uvtype UV;
4e0554ec
JH
18638int main()
18639{
18640 int i;
18641 union {
24412007
JH
18642 UV l;
18643 char c[$uvsize];
4e0554ec
JH
18644 } u;
18645
24412007 18646 if ($uvsize > 4)
b5ded3e5 18647 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18648 else
a4c53327 18649 u.l = (UV)0x04030201;
24412007 18650 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18651 printf("%c", u.c[i]+'0');
18652 printf("\n");
18653 exit(0);
18654}
18655EOCP
18656 xxx_prompt=y
18657 set try
43dddb59 18658 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18659 dflt=`$run ./try`
4e0554ec
JH
18660 case "$dflt" in
18661 [1-4][1-4][1-4][1-4]|12345678|87654321)
18662 echo "(The test program ran ok.)"
18663 echo "byteorder=$dflt"
18664 xxx_prompt=n
18665 ;;
18666 ????|????????) echo "(The test program ran ok.)" ;;
18667 *) echo "(The test program didn't run right for some reason.)" ;;
18668 esac
18669 else
18670 dflt='4321'
18671 cat <<'EOM'
18672(I can't seem to compile the test program. Guessing big-endian...)
18673EOM
18674 fi
18675 case "$xxx_prompt" in
18676 y)
24412007 18677 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18678 . ./myread
18679 byteorder="$ans"
18680 ;;
18681 *) byteorder=$dflt
18682 ;;
18683 esac
18684 ;;
18685 esac
5b813a60 18686 $rm_try
4e0554ec
JH
18687 ;;
18688esac
18689
613d6c3e 18690: Checking 32bit aligndness
4e0554ec
JH
18691$cat <<EOM
18692
18693Checking to see whether you can access character data unalignedly...
18694EOM
dc7b0a4f
JH
18695case "$d_u32align" in
18696'') $cat >try.c <<EOCP
4e0554ec 18697#include <stdio.h>
d1daaddf
JH
18698#$i_stdlib I_STDLIB
18699#ifdef I_STDLIB
18700#include <stdlib.h>
18701#endif
4e0554ec 18702#define U32 $u32type
d308175a
JH
18703#define BYTEORDER 0x$byteorder
18704#define U8 $u8type
9958dc3c
JH
18705#include <signal.h>
18706#ifdef SIGBUS
7090f861 18707$signal_t bletch(int s) { exit(4); }
9958dc3c 18708#endif
4e0554ec
JH
18709int main() {
18710#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
f1c7503b
MB
18711 volatile U8 buf[8];
18712 volatile U32 *up;
4e0554ec
JH
18713 int i;
18714
18715 if (sizeof(U32) != 4) {
18716 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18717 exit(1);
18718 }
18719
18720 fflush(stdout);
18721
9958dc3c
JH
18722#ifdef SIGBUS
18723 signal(SIGBUS, bletch);
18724#endif
18725
8906a23e
JH
18726 buf[0] = 0;
18727 buf[1] = 0;
18728 buf[2] = 0;
18729 buf[3] = 1;
7eac3fd6 18730 buf[4] = 0;
8906a23e
JH
18731 buf[5] = 0;
18732 buf[6] = 0;
7eac3fd6 18733 buf[7] = 1;
8906a23e 18734
4e0554ec
JH
18735 for (i = 0; i < 4; i++) {
18736 up = (U32*)(buf + i);
18737 if (! ((*up == 1 << (8*i)) || /* big-endian */
18738 (*up == 1 << (8*(3-i))) /* little-endian */
18739 )
18740 )
18741 {
18742 printf("read failed (%x)\n", *up);
18743 exit(2);
18744 }
18745 }
18746
18747 /* write test */
18748 for (i = 0; i < 4; i++) {
18749 up = (U32*)(buf + i);
18750 *up = 0xBeef;
18751 if (*up != 0xBeef) {
18752 printf("write failed (%x)\n", *up);
18753 exit(3);
18754 }
18755 }
18756
18757 exit(0);
18758#else
18759 printf("1\n");
18760 exit(1);
18761#endif
18762 return 0;
18763}
18764EOCP
18765set try
18766if eval $compile_ok; then
d308175a 18767 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18768 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18769 case "$?" in
18770 0) cat >&4 <<EOM
18771You can access character data pretty unalignedly.
18772EOM
18773 d_u32align="$undef"
18774 ;;
18775 *) cat >&4 <<EOM
18776It seems that you must access character data in an aligned manner.
18777EOM
18778 d_u32align="$define"
18779 ;;
18780 esac
4e0554ec
JH
18781else
18782 rp='Can you access character data at unaligned addresses?'
18783 dflt='n'
18784 . ./myread
18785 case "$ans" in
18786 [yY]*) d_u32align="$undef" ;;
18787 *) d_u32align="$define" ;;
18788 esac
18789fi
5b813a60 18790$rm_try
dc7b0a4f
JH
18791;;
18792esac
4e0554ec
JH
18793
18794: see if ualarm exists
18795set ualarm d_ualarm
18796eval $inlibc
18797
b4eb6b3d
JH
18798: see if umask exists
18799set umask d_umask
18800eval $inlibc
18801
758a5d79
JH
18802: see if unordered exists
18803set unordered d_unordered
18804eval $inlibc
18805
bdf33aa7
SP
18806: see if unsetenv exists
18807set unsetenv d_unsetenv
18808eval $inlibc
18809
4e0554ec
JH
18810: see if usleep exists
18811set usleep d_usleep
18812eval $inlibc
18813
2ef53570
JH
18814: see if prototype for usleep is available
18815echo " "
18816set d_usleepproto usleep $i_unistd unistd.h
18817eval $hasproto
18818
b4eb6b3d
JH
18819: see if ustat exists
18820set ustat d_ustat
18821eval $inlibc
18822
b4eb6b3d
JH
18823: see if closedir exists
18824set closedir d_closedir
18825eval $inlibc
18826
18827case "$d_closedir" in
18828"$define")
18829 echo " "
18830 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18831 cat > try.c <<EOM
b4eb6b3d
JH
18832#$i_dirent I_DIRENT /**/
18833#$i_sysdir I_SYS_DIR /**/
18834#$i_sysndir I_SYS_NDIR /**/
18835#$i_systypes I_SYS_TYPES /**/
18836
18837#if defined(I_SYS_TYPES)
18838#include <sys/types.h>
18839#endif
18840#if defined(I_DIRENT)
18841#include <dirent.h>
18842#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18843#include <sys/dir.h>
18844#endif
18845#else
18846#ifdef I_SYS_NDIR
18847#include <sys/ndir.h>
18848#else
18849#ifdef I_SYS_DIR
18850#ifdef hp9000s500
18851#include <ndir.h> /* may be wrong in the future */
18852#else
18853#include <sys/dir.h>
18854#endif
18855#endif
18856#endif
5b813a60 18857#endif
b4eb6b3d
JH
18858int main() { return closedir(opendir(".")); }
18859EOM
5440bc8e 18860 set try
b4eb6b3d 18861 if eval $compile_ok; then
5440bc8e 18862 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18863 echo "Yes, it does."
18864 val="$undef"
18865 else
18866 echo "No, it doesn't."
18867 val="$define"
18868 fi
18869 else
18870 echo "(I can't seem to compile the test program--assuming it doesn't)"
18871 val="$define"
18872 fi
18873 ;;
18874*)
18875 val="$undef";
18876 ;;
18877esac
18878set d_void_closedir
18879eval $setvar
5b813a60
MB
18880$rm_try
18881
b4eb6b3d
JH
18882: see if there is a wait4
18883set wait4 d_wait4
18884eval $inlibc
18885
18886: see if waitpid exists
18887set waitpid d_waitpid
18888eval $inlibc
18889
18890: see if wcstombs exists
18891set wcstombs d_wcstombs
18892eval $inlibc
18893
18894: see if wctomb exists
18895set wctomb d_wctomb
18896eval $inlibc
18897
4e0554ec
JH
18898: see if writev exists
18899set writev d_writev
18900eval $inlibc
18901
b4eb6b3d
JH
18902: preserve RCS keywords in files with variable substitution, grrr
18903Date='$Date'
18904Id='$Id'
18905Log='$Log'
18906RCSfile='$RCSfile'
18907Revision='$Revision'
18908
b4eb6b3d
JH
18909: check for alignment requirements
18910echo " "
5440bc8e 18911case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18912*$define*)
18913 $cat <<EOM
18914You seem to be either cross-compiling or doing a multiarchitecture build,
18915skipping the memory alignment check.
18916
18917EOM
18918 case "$alignbytes" in
18919 '') alignbytes=8 ;;
18920 esac
18921 ;;
18922*)
18923 case "$alignbytes" in
18924 '') echo "Checking alignment constraints..." >&4
18925 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18926 $cat >try.c <<'EOCP'
18927typedef long double NV;
18928EOCP
18929 else
18930 $cat >try.c <<'EOCP'
18931typedef double NV;
18932EOCP
18933 fi
18934 $cat >>try.c <<'EOCP'
18935#include <stdio.h>
18936struct foobar {
18937 char foo;
18938 NV bar;
18939} try_algn;
18940int main()
18941{
18942 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18943 return(0);
18944}
18945EOCP
18946 set try
18947 if eval $compile_ok; then
5440bc8e 18948 dflt=`$run ./try`
b4eb6b3d
JH
18949 else
18950 dflt='8'
18951 echo "(I can't seem to compile the test program...)"
18952 fi
18953 ;;
18954 *) dflt="$alignbytes"
18955 ;;
18956 esac
18957 rp="Doubles must be aligned on a how-many-byte boundary?"
18958 . ./myread
18959 alignbytes="$ans"
5b813a60 18960 $rm_try
b4eb6b3d
JH
18961 ;;
18962esac
18963
18964
18965: set the base revision
18966baserev=5.0
18967
89c1d914
MB
18968: length of character in bytes. Is always 1, otherwise it isnt C
18969: This used to be a test using sizeof
18970charsize=1
c193ef60
MB
18971
18972: Check for the number of bits in a character
18973case "$charbits" in
18974'') echo "Checking how long a character is (in bits)..." >&4
18975 $cat >try.c <<EOCP
18976#include <stdio.h>
18977int main ()
18978{
18979 int n;
18980 unsigned char c;
18981 for (c = 1, n = 0; c; c <<= 1, n++) ;
18982 printf ("%d\n", n);
18983 return (0);
18984 }
18985EOCP
18986 set try
18987 if eval $compile_ok; then
18988 dflt=`$run ./try`
18989 else
18990 dflt='8'
18991 echo "(I can't seem to compile the test program. Guessing...)"
18992 fi
18993 ;;
18994*)
18995 dflt="$charbits"
18996 ;;
18997esac
18998rp="What is the length of a character (in bits)?"
18999. ./myread
19000charbits="$ans"
19001$rm_try
19002case "$charbits" in
190038) ;;
19004*) cat >&4 << EOM
19005Your system has an unsigned character size of $charbits bits, which
19006is rather unusual (normally it is 8 bits). Perl likely will not work
19007correctly on your system, with subtle bugs in various places.
19008EOM
19009 rp='Do you really want to continue?'
19010 dflt='n'
19011 . ./myread
19012 case "$ans" in
19013 [yY]) echo >&4 "Okay, continuing." ;;
19014 *) exit 1 ;;
19015 esac
19016esac
19017
3099fc99 19018: how do we concatenate cpp tokens here?
b4eb6b3d 19019echo " "
3099fc99 19020echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
19021$cat >cpp_stuff.c <<'EOCP'
19022#define RCAT(a,b)a/**/b
19023#define ACAT(a,b)a ## b
19024RCAT(Rei,ser)
19025ACAT(Cir,cus)
19026EOCP
19027$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19028if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19029 echo "Oh! Smells like ANSI's been here." >&4
19030 echo "We can catify or stringify, separately or together!"
19031 cpp_stuff=42
19032elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19033 echo "Ah, yes! The good old days!" >&4
19034 echo "However, in the good old days we don't know how to stringify and"
19035 echo "catify at the same time."
19036 cpp_stuff=1
19037else
19038 $cat >&4 <<EOM
3099fc99
CW
19039Hmm, I don't seem to be able to concatenate tokens with your cpp.
19040You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
19041EOM
19042 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19043fi
19044$rm -f cpp_stuff.*
19045
19046: see if this is a db.h system
19047set db.h i_db
19048eval $inhdr
19049
19050case "$i_db" in
19051$define)
19052 : Check db version.
19053 echo " "
19054 echo "Checking Berkeley DB version ..." >&4
19055 $cat >try.c <<EOCP
19056#$d_const HASCONST
19057#ifndef HASCONST
19058#define const
19059#endif
19060#include <sys/types.h>
19061#include <stdio.h>
55954f19
JH
19062#$i_stdlib I_STDLIB
19063#ifdef I_STDLIB
19064#include <stdlib.h>
19065#endif
b4eb6b3d 19066#include <db.h>
640374d0 19067int main(int argc, char *argv[])
b4eb6b3d
JH
19068{
19069#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19070 int Major, Minor, Patch ;
19071 unsigned long Version ;
19072 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
19073 if (argc == 2) {
19074 printf("%d %d %d %d %d %d\n",
19075 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19076 Major, Minor, Patch);
19077 exit(0);
19078 }
19079 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
19080
19081 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19082 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19083 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19084 Major, Minor, Patch) ;
19085
19086 /* check that db.h & libdb are compatible */
19087 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 19088 printf("db.h and libdb are incompatible.\n") ;
5b813a60 19089 exit(3);
b4eb6b3d
JH
19090 }
19091
640374d0 19092 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
19093
19094 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19095 + DB_VERSION_PATCH ;
19096
19097 /* needs to be >= 2.3.4 */
19098 if (Version < 2003004) {
19099 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 19100 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 19101 exit(2);
b4eb6b3d
JH
19102 }
19103
19104 exit(0);
19105#else
19106#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
19107 if (argc == 2) {
19108 printf("1 0 0\n");
19109 exit(0);
19110 }
19111 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
19112 exit(0); /* DB version < 2: the coast is clear. */
19113#else
19114 exit(1); /* <db.h> not Berkeley DB? */
19115#endif
19116#endif
19117}
19118EOCP
19119 set try
5440bc8e 19120 if eval $compile_ok && $run ./try; then
b4eb6b3d 19121 echo 'Looks OK.' >&4
5440bc8e 19122 set `$run ./try 1`
640374d0
JH
19123 db_version_major=$1
19124 db_version_minor=$2
19125 db_version_patch=$3
b4eb6b3d
JH
19126 else
19127 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
19128 i_db=$undef
19129 case " $libs " in
19130 *"-ldb "*)
19131 : Remove db from list of libraries to use
19132 echo "Removing unusable -ldb from library list" >&4
19133 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19134 shift
19135 libs="$*"
19136 echo "libs = $libs" >&4
19137 ;;
19138 esac
19139 fi
5b813a60 19140 $rm_try
b4eb6b3d
JH
19141 ;;
19142esac
19143
19144case "$i_db" in
19145define)
5b813a60 19146 : Check the return type needed for hash
b4eb6b3d
JH
19147 echo " "
19148 echo "Checking return type needed for hash for Berkeley DB ..." >&4
19149 $cat >try.c <<EOCP
19150#$d_const HASCONST
19151#ifndef HASCONST
19152#define const
19153#endif
19154#include <sys/types.h>
19155#include <db.h>
19156
19157#ifndef DB_VERSION_MAJOR
19158u_int32_t hash_cb (ptr, size)
19159const void *ptr;
19160size_t size;
19161{
19162}
19163HASHINFO info;
19164int main()
19165{
19166 info.hash = hash_cb;
19167}
19168#endif
19169EOCP
19170 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19171 if $contains warning try.out >>/dev/null 2>&1 ; then
19172 db_hashtype='int'
19173 else
19174 db_hashtype='u_int32_t'
19175 fi
19176 else
19177 : XXX Maybe we should just give up here.
19178 db_hashtype=u_int32_t
19179 $cat try.out >&4
19180 echo "Help: I can't seem to compile the db test program." >&4
19181 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19182 fi
5b813a60 19183 $rm_try
b4eb6b3d
JH
19184 echo "Your version of Berkeley DB uses $db_hashtype for hash."
19185 ;;
19186*) db_hashtype=u_int32_t
19187 ;;
19188esac
19189case "$i_db" in
19190define)
5b813a60 19191 : Check the return type needed for prefix
b4eb6b3d
JH
19192 echo " "
19193 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19194 cat >try.c <<EOCP
19195#$d_const HASCONST
19196#ifndef HASCONST
19197#define const
19198#endif
19199#include <sys/types.h>
19200#include <db.h>
19201
19202#ifndef DB_VERSION_MAJOR
19203size_t prefix_cb (key1, key2)
19204const DBT *key1;
19205const DBT *key2;
19206{
19207}
19208BTREEINFO info;
19209int main()
19210{
19211 info.prefix = prefix_cb;
19212}
19213#endif
19214EOCP
19215 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19216 if $contains warning try.out >>/dev/null 2>&1 ; then
19217 db_prefixtype='int'
19218 else
19219 db_prefixtype='size_t'
19220 fi
19221 else
19222 db_prefixtype='size_t'
19223 : XXX Maybe we should just give up here.
19224 $cat try.out >&4
19225 echo "Help: I can't seem to compile the db test program." >&4
19226 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19227 fi
5b813a60 19228 $rm_try
b4eb6b3d
JH
19229 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19230 ;;
19231*) db_prefixtype='size_t'
19232 ;;
19233esac
19234
b4eb6b3d
JH
19235: How can we generate normalized random numbers ?
19236echo " "
19237echo "Looking for a random number function..." >&4
19238case "$randfunc" in
19239'')
19240 if set drand48 val -f; eval $csym; $val; then
19241 dflt="drand48"
19242 echo "Good, found drand48()." >&4
19243 elif set random val -f; eval $csym; $val; then
19244 dflt="random"
19245 echo "OK, found random()." >&4
19246 else
19247 dflt="rand"
19248 echo "Yick, looks like I have to use rand()." >&4
19249 fi
19250 echo " "
19251 ;;
19252*)
19253 dflt="$randfunc"
19254 ;;
19255esac
19256cont=true
19257
19258case "$ccflags" in
19259*-Dmy_rand=*|*-Dmy_srand=*)
19260 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19261 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19262 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19263 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19264 ;;
19265esac
19266
19267while $test "$cont"; do
19268 rp="Use which function to generate random numbers?"
19269 . ./myread
19270 if $test "$ans" = "$dflt"; then
19271 : null
19272 else
19273 randbits=''
19274 fi
19275 randfunc="$ans"
19276 if set $ans val -f; eval $csym; $val; then
19277 cont=''
19278 else
19279 dflt=y
19280 rp="I cannot find function $ans. Use that name anyway?"
19281 . ./myread
19282 dflt=rand
19283 case "$ans" in
19284 [yY]*) cont='';;
19285 esac
19286 fi
19287 case "$cont" in
19288 '')
19289 case "$randfunc" in
19290 drand48)
19291 drand01="drand48()"
19292 seedfunc="srand48"
19293 randbits=48
19294 randseedtype=long
19295 ;;
19296 rand|random)
19297 case "$randbits" in
19298 '')
19299echo "Checking to see how many bits your $randfunc() function produces..." >&4
19300 $cat >try.c <<EOCP
19301#$i_unistd I_UNISTD
19302#$i_stdlib I_STDLIB
19303#include <stdio.h>
19304#ifdef I_UNISTD
19305# include <unistd.h>
19306#endif
19307#ifdef I_STDLIB
19308# include <stdlib.h>
19309#endif
19310int main()
19311{
19312 register int i;
19313 register unsigned long tmp;
19314 register unsigned long max = 0L;
19315
19316 for (i = 1000; i; i--) {
19317 tmp = (unsigned long) $randfunc();
19318 if (tmp > max) max = tmp;
19319 }
19320 for (i = 0; max; i++)
19321 max /= 2;
19322 printf("%d\n",i);
19323}
19324EOCP
19325 set try
19326 if eval $compile_ok; then
19327 dflt=`try`
19328 else
19329 dflt='?'
19330 echo "(I can't seem to compile the test program...)"
19331 fi
19332 ;;
19333 *)
19334 dflt="$randbits"
19335 ;;
19336 esac
19337 rp="How many bits does your $randfunc() function produce?"
19338 . ./myread
19339 randbits="$ans"
5b813a60 19340 $rm_try
b4eb6b3d
JH
19341 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19342 seedfunc="s$randfunc"
19343 randseedtype=unsigned
19344 ;;
19345 *)
19346 dflt="31"
19347 rp="How many bits does your $randfunc() function produce?"
19348 . ./myread
19349 randbits="$ans"
19350 seedfunc="s$randfunc"
19351 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19352 if set $seedfunc val -f; eval $csym; $val; then
19353 echo "(Using $seedfunc() to seed random generator)"
19354 else
19355 echo "(Warning: no $seedfunc() to seed random generator)"
19356 seedfunc=rand
19357 fi
19358 randseedtype=unsigned
19359 ;;
19360 esac
19361 ;;
19362 esac
19363done
19364
613d6c3e 19365: Determine if this is an EBCDIC system
b4eb6b3d
JH
19366echo " "
19367echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 19368$cat >try.c <<'EOM'
b4eb6b3d
JH
19369int main()
19370{
19371 if ('M'==0xd4) return 0;
19372 return 1;
19373}
19374EOM
19375
19376val=$undef
5440bc8e 19377set try
b4eb6b3d 19378if eval $compile_ok; then
5440bc8e 19379 if $run ./try; then
b4eb6b3d
JH
19380 echo "You seem to speak EBCDIC." >&4
19381 val="$define"
19382 else
5440bc8e 19383 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
19384 fi
19385else
19386 echo "I'm unable to compile the test program." >&4
19387 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19388fi
5b813a60 19389$rm_try
b4eb6b3d
JH
19390set ebcdic
19391eval $setvar
19392
613d6c3e 19393: Check how to flush
b4eb6b3d
JH
19394echo " "
19395$cat >&4 <<EOM
19396Checking how to flush all pending stdio output...
19397EOM
19398# I only know how to find the first 32 possibly open files on SunOS.
19399# See also hints/sunos_4_1.sh and util.c --AD
19400case "$osname" in
19401sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19402esac
19403$cat >>try.c <<EOCP
19404#include <stdio.h>
55954f19
JH
19405#$i_stdlib I_STDLIB
19406#ifdef I_STDLIB
19407#include <stdlib.h>
19408#endif
b4eb6b3d
JH
19409#$i_unistd I_UNISTD
19410#ifdef I_UNISTD
19411# include <unistd.h>
19412#endif
19413#$d_sysconf HAS_SYSCONF
19414#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19415#ifdef HAS_STDIO_STREAM_ARRAY
19416# define STDIO_STREAM_ARRAY $stdio_stream_array
19417#endif
19418int main() {
5440bc8e
JH
19419 FILE* p;
19420 unlink("try.out");
19421 p = fopen("try.out", "w");
b4eb6b3d
JH
19422#ifdef TRY_FPUTC
19423 fputc('x', p);
19424#else
19425# ifdef TRY_FPRINTF
19426 fprintf(p, "x");
19427# endif
19428#endif
19429#ifdef TRY_FFLUSH_NULL
19430 fflush(NULL);
19431#endif
19432#ifdef TRY_FFLUSH_ALL
19433 {
19434 long open_max = -1;
19435# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19436 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19437# else
19438# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19439 open_max = sysconf(_SC_OPEN_MAX);
19440# else
19441# ifdef FOPEN_MAX
19442 open_max = FOPEN_MAX;
19443# else
19444# ifdef OPEN_MAX
19445 open_max = OPEN_MAX;
19446# else
19447# ifdef _NFILE
19448 open_max = _NFILE;
19449# endif
19450# endif
19451# endif
19452# endif
5b813a60 19453# endif
b4eb6b3d
JH
19454# ifdef HAS_STDIO_STREAM_ARRAY
19455 if (open_max > 0) {
19456 long i;
19457 for (i = 0; i < open_max; i++)
19458 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19459 STDIO_STREAM_ARRAY[i]._file < open_max &&
19460 STDIO_STREAM_ARRAY[i]._flag)
19461 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 19462 }
b4eb6b3d
JH
19463 }
19464# endif
19465#endif
19466 _exit(42);
19467}
19468EOCP
19469: first we have to find out how _not_ to flush
5440bc8e 19470$to try.c
b4eb6b3d
JH
19471if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19472 output=''
19473 set try -DTRY_FPUTC
19474 if eval $compile; then
fbe73d74 19475 $run ./try 2>/dev/null
28f5ac64 19476 code="$?"
5440bc8e 19477 $from try.out
28f5ac64 19478 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19479 output=-DTRY_FPUTC
19480 fi
19481 fi
19482 case "$output" in
19483 '')
19484 set try -DTRY_FPRINTF
b4eb6b3d 19485 if eval $compile; then
fbe73d74 19486 $run ./try 2>/dev/null
28f5ac64 19487 code="$?"
5440bc8e 19488 $from try.out
28f5ac64 19489 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19490 output=-DTRY_FPRINTF
19491 fi
19492 fi
19493 ;;
19494 esac
19495fi
19496: check for fflush NULL behaviour
19497case "$fflushNULL" in
19498'') set try -DTRY_FFLUSH_NULL $output
19499 if eval $compile; then
5440bc8e 19500 $run ./try 2>/dev/null
b4eb6b3d 19501 code="$?"
5440bc8e 19502 $from try.out
b4eb6b3d
JH
19503 if $test -s try.out -a "X$code" = X42; then
19504 fflushNULL="`$cat try.out`"
19505 else
19506 if $test "X$code" != X42; then
19507 $cat >&4 <<EOM
19508(If this test failed, don't worry, we'll try another method shortly.)
19509EOM
19510 fi
19511 fi
19512 fi
2c476adc 19513 $rm -f core try.core core.try.*
b4eb6b3d
JH
19514 case "$fflushNULL" in
19515 x) $cat >&4 <<EOM
19516Your fflush(NULL) works okay for output streams.
19517Let's see if it clobbers input pipes...
19518EOM
19519# As of mid-March 2000 all versions of Solaris appear to have a stdio
19520# bug that improperly flushes the input end of pipes. So we avoid the
19521# autoflush on fork/system/exec support for now. :-(
19522$cat >tryp.c <<EOCP
19523#include <stdio.h>
19524int
19525main(int argc, char **argv)
19526{
19527 char buf[1024];
19528 int i;
19529 char *bp = buf;
19530 while (1) {
19531 while ((i = getc(stdin)) != -1
19532 && (*bp++ = i) != '\n'
19533 && bp < &buf[1024])
19534 /* DO NOTHING */ ;
19535 *bp = '\0';
19536 fprintf(stdout, "%s", buf);
19537 fflush(NULL);
19538 if (i == -1)
19539 return 0;
19540 bp = buf;
19541 }
19542}
19543EOCP
19544 fflushNULL="$define"
19545 set tryp
19546 if eval $compile; then
19547 $rm -f tryp.out
5440bc8e 19548 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19549 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19550 $cat >&4 <<EOM
19551fflush(NULL) seems to behave okay with input streams.
19552EOM
19553 fflushNULL="$define"
19554 else
19555 $cat >&4 <<EOM
19556Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19557EOM
19558 fflushNULL="$undef"
19559 fi
19560 fi
19561 $rm -f core tryp.c tryp.core core.tryp.*
19562 ;;
19563 '') $cat >&4 <<EOM
19564Your fflush(NULL) isn't working (contrary to ANSI C).
19565EOM
19566 fflushNULL="$undef"
19567 ;;
19568 *) $cat >&4 <<EOM
19569Cannot figure out whether your fflush(NULL) works or not.
19570I'm assuming it doesn't (contrary to ANSI C).
19571EOM
19572 fflushNULL="$undef"
19573 ;;
19574 esac
19575 ;;
19576$define|true|[yY]*)
19577 fflushNULL="$define"
19578 ;;
19579*)
19580 fflushNULL="$undef"
19581 ;;
19582esac
19583: check explicit looping only if NULL did not work, and if the pipe
19584: bug does not show up on an explicit flush too
19585case "$fflushNULL" in
19586"$undef")
19587 $cat >tryp.c <<EOCP
19588#include <stdio.h>
19589int
19590main(int argc, char **argv)
19591{
19592 char buf[1024];
19593 int i;
19594 char *bp = buf;
19595 while (1) {
19596 while ((i = getc(stdin)) != -1
19597 && (*bp++ = i) != '\n'
19598 && bp < &buf[1024])
19599 /* DO NOTHING */ ;
19600 *bp = '\0';
19601 fprintf(stdout, "%s", buf);
19602 fflush(stdin);
19603 if (i == -1)
19604 return 0;
19605 bp = buf;
19606 }
19607}
19608EOCP
19609 set tryp
19610 if eval $compile; then
19611 $rm -f tryp.out
5440bc8e 19612 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19613 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19614 $cat >&4 <<EOM
19615Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19616EOM
19617 : now check for fflushall behaviour
19618 case "$fflushall" in
19619 '') set try -DTRY_FFLUSH_ALL $output
19620 if eval $compile; then
19621 $cat >&4 <<EOM
19622(Now testing the other method--but note that this also may fail.)
19623EOM
5440bc8e 19624 $run ./try 2>/dev/null
28f5ac64 19625 code=$?
fbe73d74 19626 $from try.out
28f5ac64 19627 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19628 fflushall="`$cat try.out`"
19629 fi
19630 fi
5b813a60 19631 $rm_try
b4eb6b3d
JH
19632 case "$fflushall" in
19633 x) $cat >&4 <<EOM
19634Whew. Flushing explicitly all the stdio streams works.
19635EOM
19636 fflushall="$define"
19637 ;;
19638 '') $cat >&4 <<EOM
19639Sigh. Flushing explicitly all the stdio streams doesn't work.
19640EOM
19641 fflushall="$undef"
19642 ;;
19643 *) $cat >&4 <<EOM
19644Cannot figure out whether flushing stdio streams explicitly works or not.
19645I'm assuming it doesn't.
19646EOM
19647 fflushall="$undef"
19648 ;;
19649 esac
19650 ;;
19651 "$define"|true|[yY]*)
19652 fflushall="$define"
19653 ;;
19654 *)
19655 fflushall="$undef"
19656 ;;
19657 esac
19658 else
19659 $cat >&4 <<EOM
19660All is futile. Even fflush(stdin) clobbers input pipes!
19661EOM
19662 fflushall="$undef"
19663 fi
19664 else
19665 fflushall="$undef"
19666 fi
19667 $rm -f core tryp.c tryp.core core.tryp.*
19668 ;;
19669*) fflushall="$undef"
19670 ;;
19671esac
19672
19673case "$fflushNULL$fflushall" in
19674undefundef)
19675 $cat <<EOM
19676OK, I give up. I cannot figure out how to flush pending stdio output.
19677We won't be flushing handles at all before fork/exec/popen.
19678EOM
19679 ;;
19680esac
34f1896b 19681$rm_try tryp
b4eb6b3d
JH
19682
19683: Store the full pathname to the ar program for use in the C program
19684: Respect a hint or command line value for full_ar.
19685case "$full_ar" in
19686'') full_ar=$ar ;;
19687esac
19688
19689: Store the full pathname to the sed program for use in the C program
19690full_sed=$sed
19691
19692: see what type gids are declared as in the kernel
19693echo " "
19694echo "Looking for the type for group ids returned by getgid()."
19695set gid_t gidtype xxx stdio.h sys/types.h
19696eval $typedef
19697case "$gidtype" in
19698xxx)
19699 xxx=`./findhdr sys/user.h`
19700 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19701 case $1 in
19702 unsigned) dflt="$1 $2" ;;
19703 *) dflt="$1" ;;
19704 esac
19705 ;;
19706*) dflt="$gidtype";;
19707esac
19708case "$gidtype" in
19709gid_t) echo "gid_t found." ;;
19710*) rp="What is the type for group ids returned by getgid()?"
19711 . ./myread
19712 gidtype="$ans"
19713 ;;
19714esac
19715
613d6c3e 19716: Check the size of GID
b4eb6b3d
JH
19717echo " "
19718case "$gidtype" in
19719*_t) zzz="$gidtype" ;;
19720*) zzz="gid" ;;
19721esac
613d6c3e 19722echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
19723cat > try.c <<EOCP
19724#include <sys/types.h>
19725#include <stdio.h>
d1daaddf
JH
19726#$i_stdlib I_STDLIB
19727#ifdef I_STDLIB
19728#include <stdlib.h>
19729#endif
b4eb6b3d
JH
19730int main() {
19731 printf("%d\n", (int)sizeof($gidtype));
19732 exit(0);
19733}
19734EOCP
19735set try
19736if eval $compile_ok; then
5440bc8e 19737 yyy=`$run ./try`
b4eb6b3d
JH
19738 case "$yyy" in
19739 '') gidsize=4
19740 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19741 ;;
19742 *) gidsize=$yyy
19743 echo "Your $zzz is $gidsize bytes long."
19744 ;;
19745 esac
19746else
19747 gidsize=4
19748 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19749fi
19750
19751
613d6c3e 19752: Check if GID is signed
b4eb6b3d
JH
19753echo " "
19754case "$gidtype" in
19755*_t) zzz="$gidtype" ;;
19756*) zzz="gid" ;;
19757esac
613d6c3e 19758echo "Checking the sign of $zzz..." >&4
b4eb6b3d
JH
19759cat > try.c <<EOCP
19760#include <sys/types.h>
19761#include <stdio.h>
19762int main() {
19763 $gidtype foo = -1;
19764 if (foo < 0)
19765 printf("-1\n");
19766 else
19767 printf("1\n");
19768}
19769EOCP
19770set try
19771if eval $compile; then
5440bc8e 19772 yyy=`$run ./try`
b4eb6b3d
JH
19773 case "$yyy" in
19774 '') gidsign=1
19775 echo "(I can't execute the test program--guessing unsigned.)" >&4
19776 ;;
19777 *) gidsign=$yyy
19778 case "$gidsign" in
19779 1) echo "Your $zzz is unsigned." ;;
19780 -1) echo "Your $zzz is signed." ;;
19781 esac
19782 ;;
19783 esac
19784else
19785 gidsign=1
19786 echo "(I can't compile the test program--guessing unsigned.)" >&4
19787fi
19788
19789
613d6c3e 19790: Check 64bit sizes
b4eb6b3d
JH
19791echo " "
19792
19793if $test X"$quadtype" != X; then
19794
19795echo "Checking how to print 64-bit integers..." >&4
19796
19797if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19798 $cat >try.c <<'EOCP'
19799#include <sys/types.h>
19800#include <stdio.h>
19801int main() {
19802 int q = 12345678901;
19803 printf("%ld\n", q);
19804}
19805EOCP
19806 set try
19807 if eval $compile; then
5440bc8e 19808 yyy=`$run ./try`
b4eb6b3d
JH
19809 case "$yyy" in
19810 12345678901)
19811 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19812 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19813 echo "We will use %d."
19814 ;;
19815 esac
19816 fi
19817fi
19818
19819if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19820 $cat >try.c <<'EOCP'
19821#include <sys/types.h>
19822#include <stdio.h>
19823int main() {
19824 long q = 12345678901;
19825 printf("%ld\n", q);
19826}
19827EOCP
19828 set try
19829 if eval $compile; then
5440bc8e 19830 yyy=`$run ./try`
b4eb6b3d
JH
19831 case "$yyy" in
19832 12345678901)
19833 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19834 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19835 echo "We will use %ld."
19836 ;;
19837 esac
19838 fi
19839fi
19840
19841if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19842 $cat >try.c <<'EOCP'
19843#include <sys/types.h>
19844#include <inttypes.h>
19845#include <stdio.h>
19846int main() {
19847 int64_t q = 12345678901;
19848 printf("%" PRId64 "\n", q);
19849}
19850EOCP
19851 set try
19852 if eval $compile; then
5440bc8e 19853 yyy=`$run ./try`
b4eb6b3d
JH
19854 case "$yyy" in
19855 12345678901)
19856 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19857 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19858 echo "We will use the C9X style."
19859 ;;
19860 esac
19861 fi
19862fi
19863
2ef53570
JH
19864if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19865 $cat >try.c <<EOCP
b4eb6b3d
JH
19866#include <sys/types.h>
19867#include <stdio.h>
19868int main() {
2ef53570
JH
19869 $quadtype q = 12345678901;
19870 printf("%Ld\n", q);
b4eb6b3d
JH
19871}
19872EOCP
19873 set try
19874 if eval $compile; then
5440bc8e 19875 yyy=`$run ./try`
b4eb6b3d
JH
19876 case "$yyy" in
19877 12345678901)
2ef53570
JH
19878 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19879 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19880 echo "We will use %Ld."
b4eb6b3d
JH
19881 ;;
19882 esac
19883 fi
19884fi
19885
2ef53570
JH
19886if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19887 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19888#include <sys/types.h>
19889#include <stdio.h>
19890int main() {
2ef53570
JH
19891 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19892 printf("%lld\n", q);
b4eb6b3d
JH
19893}
19894EOCP
19895 set try
19896 if eval $compile; then
5440bc8e 19897 yyy=`$run ./try`
b4eb6b3d
JH
19898 case "$yyy" in
19899 12345678901)
2ef53570
JH
19900 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19901 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19902 echo "We will use the %lld style."
b4eb6b3d
JH
19903 ;;
19904 esac
19905 fi
19906fi
19907
19908if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19909 $cat >try.c <<EOCP
19910#include <sys/types.h>
19911#include <stdio.h>
19912int main() {
19913 $quadtype q = 12345678901;
19914 printf("%qd\n", q);
19915}
19916EOCP
19917 set try
19918 if eval $compile; then
5440bc8e 19919 yyy=`$run ./try`
b4eb6b3d
JH
19920 case "$yyy" in
19921 12345678901)
19922 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19923 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19924 echo "We will use %qd."
19925 ;;
19926 esac
19927 fi
19928fi
19929
19930if $test X"$sPRId64" = X; then
19931 echo "Cannot figure out how to print 64-bit integers." >&4
19932fi
5b813a60 19933$rm_try
b4eb6b3d
JH
19934
19935fi
19936
19937case "$sPRId64" in
5b813a60
MB
19938'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19939 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 19940 ;;
5b813a60
MB
19941*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19942 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
19943 ;;
19944esac
19945
34f1896b 19946: Check format strings for internal types
b4eb6b3d
JH
19947echo " "
19948$echo "Checking the format strings to be used for Perl's internal types..." >&4
19949
19950if $test X"$ivsize" = X8; then
19951 ivdformat="$sPRId64"
19952 uvuformat="$sPRIu64"
19953 uvoformat="$sPRIo64"
19954 uvxformat="$sPRIx64"
19955 uvXUformat="$sPRIXU64"
19956else
19957 if $test X"$ivsize" = X"$longsize"; then
19958 ivdformat='"ld"'
19959 uvuformat='"lu"'
19960 uvoformat='"lo"'
19961 uvxformat='"lx"'
19962 uvXUformat='"lX"'
19963 else
19964 if $test X"$ivsize" = X"$intsize"; then
19965 ivdformat='"d"'
19966 uvuformat='"u"'
19967 uvoformat='"o"'
19968 uvxformat='"x"'
19969 uvXUformat='"X"'
19970 else
19971 : far out
19972 if $test X"$ivsize" = X"$shortsize"; then
19973 ivdformat='"hd"'
19974 uvuformat='"hu"'
19975 uvoformat='"ho"'
19976 uvxformat='"hx"'
19977 uvXUformat='"hX"'
19978 fi
19979 fi
19980 fi
19981fi
19982
19983if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19984 nveformat="$sPRIeldbl"
19985 nvfformat="$sPRIfldbl"
19986 nvgformat="$sPRIgldbl"
19987 nvEUformat="$sPRIEUldbl"
19988 nvFUformat="$sPRIFUldbl"
19989 nvGUformat="$sPRIGUldbl"
19990else
19991 nveformat='"e"'
19992 nvfformat='"f"'
19993 nvgformat='"g"'
19994 nvEUformat='"E"'
19995 nvFUformat='"F"'
19996 nvGUformat='"G"'
19997fi
19998
19999case "$ivdformat" in
3c728e00 20000'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
20001 exit 1
20002 ;;
20003esac
20004
34f1896b 20005: Check format string for GID
b4eb6b3d
JH
20006
20007echo " "
20008$echo "Checking the format string to be used for gids..." >&4
20009
20010case "$gidsign" in
20011-1) if $test X"$gidsize" = X"$ivsize"; then
20012 gidformat="$ivdformat"
20013 else
20014 if $test X"$gidsize" = X"$longsize"; then
20015 gidformat='"ld"'
20016 else
20017 if $test X"$gidsize" = X"$intsize"; then
20018 gidformat='"d"'
20019 else
20020 if $test X"$gidsize" = X"$shortsize"; then
20021 gidformat='"hd"'
20022 fi
20023 fi
20024 fi
20025 fi
20026 ;;
20027*) if $test X"$gidsize" = X"$uvsize"; then
20028 gidformat="$uvuformat"
20029 else
20030 if $test X"$gidsize" = X"$longsize"; then
20031 gidformat='"lu"'
20032 else
20033 if $test X"$gidsize" = X"$intsize"; then
20034 gidformat='"u"'
20035 else
20036 if $test X"$gidsize" = X"$shortsize"; then
20037 gidformat='"hu"'
20038 fi
20039 fi
20040 fi
20041 fi
20042 ;;
20043esac
20044
20045: see if getgroups exists
20046set getgroups d_getgrps
20047eval $inlibc
20048
20049: see if setgroups exists
20050set setgroups d_setgrps
20051eval $inlibc
20052
b4eb6b3d
JH
20053: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20054echo " "
20055case "$d_getgrps$d_setgrps" in
20056*define*)
20057 case "$groupstype" in
20058 '') dflt="$gidtype" ;;
20059 *) dflt="$groupstype" ;;
20060 esac
20061 $cat <<EOM
20062What type of pointer is the second argument to getgroups() and setgroups()?
20063Usually this is the same as group ids, $gidtype, but not always.
20064
20065EOM
20066 rp='What type pointer is the second argument to getgroups() and setgroups()?'
20067 . ./myread
20068 groupstype="$ans"
20069 ;;
20070*) groupstype="$gidtype";;
20071esac
20072
613d6c3e 20073: MAD = Misc Attribute Definition
d620c7b3 20074
fd655d33
NC
20075if $test $patchlevel -lt 9; then
20076: MAD is not available in 5.8.x or earlier.
20077 ans=n;
20078else
20079 case "$mad" in
20080 $define|true|[yY]*) dflt='y' ;;
20081 *) dflt='n' ;;
20082 esac
20083 cat <<EOM
d620c7b3
MB
20084
20085Would you like to build with Misc Attribute Decoration? This is development
20086work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20087overhead on the interpreter.
20088
20089If this doesn't make any sense to you, just accept the default '$dflt'.
20090EOM
fd655d33
NC
20091 rp='Build Perl with MAD?'
20092 . ./myread
20093fi
d620c7b3 20094case "$ans" in
00e74f14
NC
20095y|Y) val="$define"
20096 madlyh='madly.h madly.act madly.tab'
20097 madlysrc='madly.c'
20098 madlyobj="madly$_o" ;;
20099*) val="$undef"
20100 madlyh=''
20101 madlysrc=''
20102 madlyobj='' ;;
d620c7b3
MB
20103esac
20104set mad
20105eval $setvar
20106
216dac04 20107: check whether make sets MAKE
b4eb6b3d
JH
20108echo " "
20109echo "Checking if your $make program sets \$(MAKE)..." >&4
20110case "$make_set_make" in
20111'')
20112 $sed 's/^X //' > testmake.mak << 'EOF'
20113Xall:
20114X @echo 'maketemp="$(MAKE)"'
20115EOF
20116 case "`$make -f testmake.mak 2>/dev/null`" in
20117 *maketemp=*) make_set_make='#' ;;
20118 *) make_set_make="MAKE=$make" ;;
20119 esac
20120 $rm -f testmake.mak
20121 ;;
20122esac
20123case "$make_set_make" in
20124'#') echo "Yup, it does.";;
20125*) echo "Nope, it doesn't.";;
20126esac
20127
20128: see what type is used for mode_t
20129rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20130set mode_t modetype int stdio.h sys/types.h
20131eval $typedef_ask
20132
2cc61e15
DD
20133: see if we need va_copy
20134echo " "
20135case "$i_stdarg" in
20136"$define")
20137 $cat >try.c <<EOCP
20138#include <stdarg.h>
20139#include <stdio.h>
85c8a686
DD
20140#$i_stdlib I_STDLIB
20141#ifdef I_STDLIB
20142#include <stdlib.h>
20143#endif
20144#include <signal.h>
2cc61e15
DD
20145
20146int
20147ivfprintf(FILE *f, const char *fmt, va_list *valp)
20148{
20149 return vfprintf(f, fmt, *valp);
20150}
5b813a60
MB
20151
20152int
2cc61e15
DD
20153myvfprintf(FILE *f, const char *fmt, va_list val)
20154{
20155 return ivfprintf(f, fmt, &val);
20156}
5b813a60 20157
2cc61e15 20158int
5b813a60 20159myprintf(char *fmt, ...)
2cc61e15
DD
20160{
20161 va_list val;
20162 va_start(val, fmt);
5b813a60
MB
20163 return myvfprintf(stdout, fmt, val);
20164}
2cc61e15
DD
20165
20166int
20167main(int ac, char **av)
20168{
85c8a686
DD
20169 signal(SIGSEGV, exit);
20170
5b813a60
MB
20171 myprintf("%s%cs all right, then\n", "that", '\'');
20172 exit(0);
2cc61e15
DD
20173}
20174EOCP
20175 set try
5440bc8e
JH
20176 if eval $compile && $run ./try 2>&1 >/dev/null; then
20177 case "`$run ./try`" in
2cc61e15
DD
20178 "that's all right, then")
20179 okay=yes
20180 ;;
20181 esac
20182 fi
20183 case "$okay" in
20184 yes) echo "It seems that you don't need va_copy()." >&4
20185 need_va_copy="$undef"
20186 ;;
20187 *) echo "It seems that va_copy() or similar will be needed." >&4
20188 need_va_copy="$define"
20189 ;;
20190 esac
5b813a60 20191 $rm_try
2cc61e15
DD
20192 ;;
20193*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20194 ;;
20195esac
20196
b4eb6b3d
JH
20197: see what type is used for size_t
20198rp="What is the type used for the length parameter for string functions?"
20199set size_t sizetype 'unsigned int' stdio.h sys/types.h
20200eval $typedef_ask
20201
20202: check for type of arguments to gethostbyaddr.
20203if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20204 case "$d_gethbyaddr" in
20205 $define)
20206 $cat <<EOM
20207
20208Checking to see what type of arguments are accepted by gethostbyaddr().
20209EOM
20210 hdrs="$define sys/types.h
20211 $d_socket sys/socket.h
20212 $i_niin netinet/in.h
20213 $i_netdb netdb.h
20214 $i_unistd unistd.h"
20215 : The first arg can 'char *' or 'void *'
20216 : The second arg is some of integral type
20217 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20218 for yyy in size_t long int; do
20219 case "$netdb_host_type" in
61c26d18 20220 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
b4eb6b3d
JH
20221 if ./protochk "$try" $hdrs; then
20222 echo "Your system accepts $xxx for the first arg."
20223 echo "...and $yyy for the second arg."
20224 netdb_host_type="$xxx"
20225 netdb_hlen_type="$yyy"
20226 fi
20227 ;;
20228 esac
20229 done
20230 done
20231 : In case none of those worked, prompt the user.
20232 case "$netdb_host_type" in
20233 '') rp='What is the type for the 1st argument to gethostbyaddr?'
20234 dflt='char *'
20235 . ./myread
20236 netdb_host_type=$ans
20237 rp='What is the type for the 2nd argument to gethostbyaddr?'
20238 dflt="$sizetype"
20239 . ./myread
20240 netdb_hlen_type=$ans
20241 ;;
20242 esac
20243 ;;
20244 *) : no gethostbyaddr, so pick harmless defaults
20245 netdb_host_type='char *'
20246 netdb_hlen_type="$sizetype"
20247 ;;
20248 esac
20249 # Remove the "const" if needed. -- but then we'll have a
20250 # prototype clash!
20251 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20252fi
20253
20254: check for type of argument to gethostbyname.
20255if test "X$netdb_name_type" = X ; then
20256 case "$d_gethbyname" in
20257 $define)
20258 $cat <<EOM
20259
20260Checking to see what type of argument is accepted by gethostbyname().
20261EOM
20262 hdrs="$define sys/types.h
20263 $d_socket sys/socket.h
20264 $i_niin netinet/in.h
20265 $i_netdb netdb.h
20266 $i_unistd unistd.h"
20267 for xxx in "const char *" "char *"; do
20268 case "$netdb_name_type" in
61c26d18 20269 '') try="$extern_C struct hostent *gethostbyname($xxx);"
b4eb6b3d
JH
20270 if ./protochk "$try" $hdrs; then
20271 echo "Your system accepts $xxx."
20272 netdb_name_type="$xxx"
20273 fi
20274 ;;
20275 esac
20276 done
20277 : In case none of those worked, prompt the user.
20278 case "$netdb_name_type" in
20279 '') rp='What is the type for the 1st argument to gethostbyname?'
20280 dflt='char *'
20281 . ./myread
20282 netdb_name_type=$ans
20283 ;;
20284 esac
20285 ;;
20286 *) : no gethostbyname, so pick harmless default
20287 netdb_name_type='char *'
20288 ;;
20289 esac
20290fi
20291
20292: check for type of 1st argument to getnetbyaddr.
20293if test "X$netdb_net_type" = X ; then
20294 case "$d_getnbyaddr" in
20295 $define)
20296 $cat <<EOM
20297
20298Checking to see what type of 1st argument is accepted by getnetbyaddr().
20299EOM
20300 hdrs="$define sys/types.h
20301 $d_socket sys/socket.h
20302 $i_niin netinet/in.h
20303 $i_netdb netdb.h
20304 $i_unistd unistd.h"
20305 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20306 case "$netdb_net_type" in
61c26d18 20307 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
b4eb6b3d
JH
20308 if ./protochk "$try" $hdrs; then
20309 echo "Your system accepts $xxx."
20310 netdb_net_type="$xxx"
20311 fi
20312 ;;
20313 esac
20314 done
20315 : In case none of those worked, prompt the user.
20316 case "$netdb_net_type" in
20317 '') rp='What is the type for the 1st argument to getnetbyaddr?'
20318 dflt='long'
20319 . ./myread
20320 netdb_net_type=$ans
20321 ;;
20322 esac
20323 ;;
20324 *) : no getnetbyaddr, so pick harmless default
20325 netdb_net_type='long'
20326 ;;
20327 esac
20328fi
20329: locate the preferred pager for this system
d604bb53 20330fn=f/
b4eb6b3d
JH
20331case "$pager" in
20332'')
20333 dflt=''
20334 case "$pg" in
20335 /*) dflt=$pg;;
20336 [a-zA-Z]:/*) dflt=$pg;;
20337 esac
20338 case "$more" in
20339 /*) dflt=$more;;
20340 [a-zA-Z]:/*) dflt=$more;;
20341 esac
20342 case "$less" in
20343 /*) dflt=$less;;
20344 [a-zA-Z]:/*) dflt=$less;;
20345 esac
20346 case "$dflt" in
20347 '') dflt=/usr/ucb/more;;
20348 esac
20349 ;;
d604bb53 20350*) dflt="$pager"
d604bb53
JH
20351 fn="f/($pager)"
20352 ;;
b4eb6b3d
JH
20353esac
20354echo " "
b4eb6b3d
JH
20355rp='What pager is used on your system?'
20356. ./getfile
20357pager="$ans"
20358
20359: see what type pids are declared as in the kernel
20360rp="What is the type of process ids on this system?"
20361set pid_t pidtype int stdio.h sys/types.h
20362eval $typedef_ask
20363
b4eb6b3d
JH
20364: see if ar generates random libraries by itself
20365echo " "
20366echo "Checking how to generate random libraries on your machine..." >&4
20367echo 'int bar1() { return bar2(); }' > bar1.c
20368echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
20369$cat > foo.c <<EOP
20370#$i_stdlib I_STDLIB
20371#ifdef I_STDLIB
20372#include <stdlib.h>
20373#endif
b4eb6b3d
JH
20374int main() { printf("%d\n", bar1()); exit(0); }
20375EOP
20376$cc $ccflags -c bar1.c >/dev/null 2>&1
20377$cc $ccflags -c bar2.c >/dev/null 2>&1
20378$cc $ccflags -c foo.c >/dev/null 2>&1
20379$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 20380if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20381 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20382 echo "$ar appears to generate random libraries itself."
20383 orderlib=false
e39a9d84
LC
20384 if [ "X$ranlib" = "X" ]; then
20385 ranlib=":"
20386 fi
88d4d47b
PC
20387elif $ar s bar$_a >/dev/null 2>&1 &&
20388 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20389 $run ./foobar >/dev/null 2>&1; then
20390 echo "a table of contents needs to be added with '$ar s'."
20391 orderlib=false
20392 ranlib="$ar s"
b4eb6b3d 20393elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 20394 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20395 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20396 echo "a table of contents needs to be added with '$ar ts'."
20397 orderlib=false
20398 ranlib="$ar ts"
20399else
20400 case "$ranlib" in
20401 :) ranlib='';;
20402 '')
20403 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20404 $test -f $ranlib || ranlib=''
20405 ;;
20406 esac
20407 if $test -n "$ranlib"; then
20408 echo "your system has '$ranlib'; we'll use that."
20409 orderlib=false
20410 else
20411 echo "your system doesn't seem to support random libraries"
20412 echo "so we'll use lorder and tsort to order the libraries."
20413 orderlib=true
20414 ranlib=":"
20415 fi
20416fi
88d4d47b 20417$rm -f foo* bar*
b4eb6b3d 20418
92a3ac59
MB
20419: see if this is a values.h system
20420set values.h i_values
20421eval $inhdr
20422
73e6e416 20423: Check the max offset that gmtime and localtime accept
92a3ac59 20424echo "Checking max offsets that gmtime () accepts"
81c4fd9e 20425
92a3ac59
MB
20426case $i_values in
20427 define) yyy="#include <values.h>" ;;
20428 *) yyy="" ;;
20429 esac
20430
690aedd1
MB
20431case "$sGMTIME_min/$sGMTIME_max" in
20432 0/0|/)
20433 $cat >try.c <<EOCP
81c4fd9e
MB
20434#include <sys/types.h>
20435#include <stdio.h>
20436#include <time.h>
92a3ac59 20437$yyy
81c4fd9e 20438
92a3ac59
MB
20439int i;
20440struct tm *tmp;
20441time_t pt;
20442
1b289682 20443void gm_check (time_t t, int min_year, int max_year)
92a3ac59 20444{
81c4fd9e 20445 tmp = gmtime (&t);
1b289682
MB
20446 if ( tmp == NULL ||
20447 /* Check tm_year overflow */
20448 tmp->tm_year < min_year || tmp->tm_year > max_year)
92a3ac59
MB
20449 tmp = NULL;
20450 else
20451 pt = t;
20452 } /* gm_check */
81c4fd9e 20453
92a3ac59
MB
20454int check_max ()
20455{
73e6e416
MB
20456 tmp = NULL;
20457 pt = 0;
92a3ac59 20458#ifdef MAXLONG
1b289682 20459 gm_check (MAXLONG, 69, 0x7fffffff);
92a3ac59 20460#endif
73e6e416
MB
20461 if (tmp == NULL || tmp->tm_year < 0) {
20462 for (i = 63; i >= 0; i--) {
20463 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20464 if (x < 0 || x < pt) continue;
20465 gm_check (x, 69, 0x7fffffff);
73e6e416
MB
20466 }
20467 }
20468 printf ("sGMTIME_max=%ld\n", pt);
20469 return (0);
1b289682 20470 } /* check_max */
81c4fd9e 20471
92a3ac59
MB
20472int check_min ()
20473{
73e6e416
MB
20474 tmp = NULL;
20475 pt = 0;
92a3ac59 20476#ifdef MINLONG
1b289682 20477 gm_check (MINLONG, -1900, 70);
92a3ac59 20478#endif
73e6e416
MB
20479 if (tmp == NULL) {
20480 for (i = 36; i >= 0; i--) {
20481 time_t x = pt - ((time_t)1 << i);
20482 if (x > 0) continue;
1b289682 20483 gm_check (x, -1900, 70);
73e6e416
MB
20484 }
20485 }
20486 printf ("sGMTIME_min=%ld\n", pt);
20487 return (0);
20488 } /* check_min */
92a3ac59
MB
20489
20490int main (int argc, char *argv[])
20491{
73e6e416
MB
20492 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20493 check_max ();
20494 check_min ();
20495 return (0);
20496 } /* main */
81c4fd9e 20497EOCP
690aedd1
MB
20498 set try
20499 if eval $compile; then
20500 eval `$run ./try`
20501 else
20502 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20503 fi
20504 $rm_try
20505 ;;
20506 esac
81c4fd9e 20507
73e6e416
MB
20508echo "Checking max offsets that localtime () accepts"
20509
690aedd1
MB
20510case "$sLOCALTIME_min/$sLOCALTIME_max" in
20511 0/0|/)
20512 $cat >try.c <<EOCP
73e6e416
MB
20513#include <sys/types.h>
20514#include <stdio.h>
20515#include <time.h>
20516$yyy
20517
20518int i;
20519struct tm *tmp;
20520time_t pt;
20521
1b289682 20522void local_check (time_t t, int min_year, int max_year)
73e6e416 20523{
5bca5c48
MB
20524 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20525 tmp = NULL;
20526 else
20527 tmp = localtime (&t);
1b289682
MB
20528 if ( tmp == NULL ||
20529 /* Check tm_year overflow */
20530 tmp->tm_year < min_year || tmp->tm_year > max_year)
73e6e416
MB
20531 tmp = NULL;
20532 else
20533 pt = t;
20534 } /* local_check */
20535
20536int check_max ()
20537{
20538 tmp = NULL;
20539 pt = 0;
20540#ifdef MAXLONG
1b289682 20541 local_check (MAXLONG, 69, 0x7fffffff);
73e6e416
MB
20542#endif
20543 if (tmp == NULL || tmp->tm_year < 0) {
20544 for (i = 63; i >= 0; i--) {
20545 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20546 if (x < 0 || x < pt) continue;
20547 local_check (x, 69, 0x7fffffff);
73e6e416
MB
20548 }
20549 }
20550 printf ("sLOCALTIME_max=%ld\n", pt);
20551 return (0);
1b289682 20552 } /* check_max */
73e6e416
MB
20553
20554int check_min ()
20555{
20556 tmp = NULL;
20557 pt = 0;
20558#ifdef MINLONG
1b289682 20559 local_check (MINLONG, -1900, 70);
73e6e416
MB
20560#endif
20561 if (tmp == NULL) {
20562 for (i = 36; i >= 0; i--) {
20563 time_t x = pt - ((time_t)1 << i);
20564 if (x > 0) continue;
1b289682 20565 local_check (x, -1900, 70);
73e6e416
MB
20566 }
20567 }
20568 printf ("sLOCALTIME_min=%ld\n", pt);
20569 return (0);
20570 } /* check_min */
20571
20572int main (int argc, char *argv[])
20573{
20574 check_max ();
20575 check_min ();
20576 return (0);
20577 } /* main */
20578EOCP
690aedd1
MB
20579 set try
20580 if eval $compile; then
20581 eval `$run ./try`
20582 else
20583 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20584 fi
20585 $rm_try
20586 ;;
20587 esac
73e6e416 20588
c0bacbef 20589: check for type of arguments to select.
b4eb6b3d
JH
20590case "$selecttype" in
20591'') case "$d_select" in
20592 $define)
20593 echo " "
20594 $cat <<EOM
20595Checking to see what type of arguments are accepted by select().
20596EOM
20597 hdrs="$define sys/types.h
c0bacbef 20598 $i_systime sys/time.h
b4eb6b3d
JH
20599 $i_sysselct sys/select.h
20600 $d_socket sys/socket.h"
20601 : The first arg can be int, unsigned, or size_t
20602 : The last arg may or may not be 'const'
20603 val=''
20604 : void pointer has been seen but using that
20605 : breaks the selectminbits test
20606 for xxx in 'fd_set *' 'int *'; do
20607 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20608 for tmo in 'struct timeval *' 'const struct timeval *'; do
20609 case "$val" in
61c26d18 20610 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
b4eb6b3d
JH
20611 if ./protochk "$try" $hdrs; then
20612 echo "Your system accepts $xxx."
20613 val="$xxx"
20614 fi
20615 ;;
20616 esac
20617 done
20618 done
20619 done
20620 case "$val" in
20621 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20622 case "$d_fd_set" in
20623 $define) dflt="fd_set *" ;;
20624 *) dflt="int *" ;;
20625 esac
20626 . ./myread
20627 val=$ans
20628 ;;
20629 esac
20630 selecttype="$val"
20631 ;;
20632 *) : no select, so pick a harmless default
20633 selecttype='int *'
20634 ;;
20635 esac
20636 ;;
20637esac
20638
20639: check for the select 'width'
20640case "$selectminbits" in
e6e7e605
JH
20641'') safebits=`expr $ptrsize \* 8`
20642 case "$d_select" in
b4eb6b3d
JH
20643 $define)
20644 $cat <<EOM
20645
20646Checking to see on how many bits at a time your select() operates...
20647EOM
20648 $cat >try.c <<EOCP
20649#include <sys/types.h>
20650#$i_time I_TIME
20651#$i_systime I_SYS_TIME
20652#$i_systimek I_SYS_TIME_KERNEL
20653#ifdef I_TIME
20654# include <time.h>
20655#endif
20656#ifdef I_SYS_TIME
20657# ifdef I_SYS_TIME_KERNEL
20658# define KERNEL
20659# endif
20660# include <sys/time.h>
20661# ifdef I_SYS_TIME_KERNEL
20662# undef KERNEL
20663# endif
20664#endif
20665#$i_sysselct I_SYS_SELECT
20666#ifdef I_SYS_SELECT
20667#include <sys/select.h>
20668#endif
20669#$d_socket HAS_SOCKET
20670#ifdef HAS_SOCKET
20671# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20672#endif
20673#include <stdio.h>
d1daaddf
JH
20674#$i_stdlib I_STDLIB
20675#ifdef I_STDLIB
20676#include <stdlib.h>
20677#endif
b4eb6b3d
JH
20678$selecttype b;
20679#define S sizeof(*(b))
20680#define MINBITS 64
20681#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20682#define NBITS (NBYTES * 8)
20683int main() {
7090f861 20684 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
20685 struct timeval t;
20686 int i;
20687 FILE* fp;
20688 int fd;
20689
e6e7e605
JH
20690 if (!s)
20691 exit(1);
b4eb6b3d
JH
20692 fclose(stdin);
20693 fp = fopen("try.c", "r");
20694 if (fp == 0)
e6e7e605 20695 exit(2);
b4eb6b3d
JH
20696 fd = fileno(fp);
20697 if (fd < 0)
e6e7e605 20698 exit(3);
b4eb6b3d
JH
20699 b = ($selecttype)s;
20700 for (i = 0; i < NBITS; i++)
20701 FD_SET(i, b);
20702 t.tv_sec = 0;
20703 t.tv_usec = 0;
20704 select(fd + 1, b, 0, 0, &t);
20705 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 20706 free(s);
b4eb6b3d
JH
20707 printf("%d\n", i + 1);
20708 return 0;
20709}
20710EOCP
20711 set try
20712 if eval $compile_ok; then
5440bc8e 20713 selectminbits=`$run ./try`
b4eb6b3d
JH
20714 case "$selectminbits" in
20715 '') cat >&4 <<EOM
20716Cannot figure out on how many bits at a time your select() operates.
e6e7e605 20717I'll play safe and guess it is $safebits bits.
b4eb6b3d 20718EOM
e6e7e605
JH
20719 selectminbits=$safebits
20720 bits="$safebits bits"
b4eb6b3d
JH
20721 ;;
20722 1) bits="1 bit" ;;
20723 *) bits="$selectminbits bits" ;;
20724 esac
20725 echo "Your select() operates on $bits at a time." >&4
20726 else
20727 rp='What is the minimum number of bits your select() operates on?'
20728 case "$byteorder" in
e6e7e605
JH
20729 12345678) dflt=64 ;;
20730 1234) dflt=32 ;;
b4eb6b3d
JH
20731 *) dflt=1 ;;
20732 esac
20733 . ./myread
20734 val=$ans
20735 selectminbits="$val"
20736 fi
5b813a60 20737 $rm_try
b4eb6b3d
JH
20738 ;;
20739 *) : no select, so pick a harmless default
e6e7e605 20740 selectminbits=$safebits
b4eb6b3d
JH
20741 ;;
20742 esac
20743 ;;
20744esac
20745
20746: Trace out the files included by signal.h, then look for SIGxxx names.
b4eb6b3d
JH
20747if [ "X$fieldn" = X ]; then
20748 : Just make some guesses. We check them later.
20749 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20750else
20751 xxx=`echo '#include <signal.h>' |
20752 $cppstdin $cppminus $cppflags 2>/dev/null |
613d6c3e 20753 $grep '^[ ]*#.*include' |
776a38e3
MB
20754 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20755 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d 20756fi
b4eb6b3d
JH
20757xxxfiles=''
20758for xx in $xxx /dev/null ; do
20759 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20760done
b4eb6b3d
JH
20761case "$xxxfiles" in
20762'') xxxfiles=`./findhdr signal.h` ;;
20763esac
20764xxx=`awk '
20765$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20766 print substr($2, 4, 20)
20767}
20768$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20769 print substr($3, 4, 20)
20770}' $xxxfiles`
20771: Append some common names just in case the awk scan failed.
20772xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20773xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20774xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20775xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20776xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20777
20778: generate a few handy files for later
55954f19 20779$cat > signal.c <<EOCP
b4eb6b3d
JH
20780#include <sys/types.h>
20781#include <signal.h>
55954f19
JH
20782#$i_stdlib I_STDLIB
20783#ifdef I_STDLIB
20784#include <stdlib.h>
20785#endif
b4eb6b3d
JH
20786#include <stdio.h>
20787int main() {
20788
20789/* Strange style to avoid deeply-nested #if/#else/#endif */
20790#ifndef NSIG
20791# ifdef _NSIG
20792# define NSIG (_NSIG)
20793# endif
20794#endif
20795
20796#ifndef NSIG
20797# ifdef SIGMAX
20798# define NSIG (SIGMAX+1)
20799# endif
20800#endif
20801
20802#ifndef NSIG
20803# ifdef SIG_MAX
20804# define NSIG (SIG_MAX+1)
20805# endif
20806#endif
20807
20808#ifndef NSIG
3609ea0d
JH
20809# ifdef _SIG_MAX
20810# define NSIG (_SIG_MAX+1)
20811# endif
20812#endif
20813
20814#ifndef NSIG
b4eb6b3d
JH
20815# ifdef MAXSIG
20816# define NSIG (MAXSIG+1)
20817# endif
20818#endif
20819
20820#ifndef NSIG
20821# ifdef MAX_SIG
20822# define NSIG (MAX_SIG+1)
20823# endif
20824#endif
20825
20826#ifndef NSIG
20827# ifdef SIGARRAYSIZE
3609ea0d 20828# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
20829# endif
20830#endif
20831
20832#ifndef NSIG
20833# ifdef _sys_nsig
20834# define NSIG (_sys_nsig) /* Solaris 2.5 */
20835# endif
20836#endif
20837
20838/* Default to some arbitrary number that's big enough to get most
20839 of the common signals.
20840*/
20841#ifndef NSIG
20842# define NSIG 50
20843#endif
20844
20845printf("NSIG %d\n", NSIG);
20846
20847#ifndef JUST_NSIG
20848
20849EOCP
20850
20851echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20852{
20853 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 20854 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
20855 printf $1; printf ");\n"
20856 printf "#endif\n"
20857}
20858END {
20859 printf "#endif /* JUST_NSIG */\n";
20860 printf "exit(0);\n}\n";
20861}
20862' >>signal.c
20863$cat >signal.awk <<'EOP'
20864BEGIN { ndups = 0 }
65197d93 20865$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20866($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20867 if ($2 > maxsig) { maxsig = $2 }
20868 if (sig_name[$2]) {
20869 dup_name[ndups] = $1
20870 dup_num[ndups] = $2
613d6c3e 20871 ndups++
b4eb6b3d 20872 }
1ebe1ffb 20873 else {
65197d93
JH
20874 sig_name[$2] = $1
20875 sig_num[$2] = $2
b4eb6b3d
JH
20876 }
20877}
613d6c3e 20878END {
b4eb6b3d
JH
20879 if (nsig == 0) {
20880 nsig = maxsig + 1
20881 }
20882 printf("NSIG %d\n", nsig);
20883 for (n = 1; n < nsig; n++) {
20884 if (sig_name[n]) {
20885 printf("%s %d\n", sig_name[n], sig_num[n])
20886 }
20887 else {
613d6c3e 20888 printf("NUM%d %d\n", n, n)
b4eb6b3d
JH
20889 }
20890 }
20891 for (n = 0; n < ndups; n++) {
20892 printf("%s %d\n", dup_name[n], dup_num[n])
20893 }
20894}
20895EOP
20896$cat >signal_cmd <<EOS
20897$startsh
20898if $test -s signal.lst; then
20899 echo "Using your existing signal.lst file"
20900 exit 0
20901fi
20902xxx="$xxx"
20903EOS
20904$cat >>signal_cmd <<'EOS'
20905
20906set signal
20907if eval $compile_ok; then
776a38e3
MB
20908 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20909 $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20910else
20911 echo "(I can't seem be able to compile the whole test program)" >&4
20912 echo "(I'll try it in little pieces.)" >&4
20913 set signal -DJUST_NSIG
20914 if eval $compile_ok; then
5440bc8e 20915 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20916 $cat signal.nsg
20917 else
20918 echo "I can't seem to figure out how many signals you have." >&4
20919 echo "Guessing 50." >&4
20920 echo 'NSIG 50' > signal.nsg
20921 fi
20922 : Now look at all the signal names, one at a time.
20923 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20924 $cat > signal.c <<EOCP
20925#include <sys/types.h>
20926#include <signal.h>
20927#include <stdio.h>
20928int main() {
20929printf("$xx %d\n", SIG${xx});
20930return 0;
20931}
20932EOCP
20933 set signal
20934 if eval $compile; then
20935 echo "SIG${xx} found."
5440bc8e 20936 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20937 else
20938 echo "SIG${xx} NOT found."
20939 fi
20940 done
20941 if $test -s signal.ls1; then
20942 $cat signal.nsg signal.ls1 |
65197d93 20943 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20944 fi
20945
20946fi
20947if $test -s signal.lst; then
20948 :
20949else
20950 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20951 echo 'kill -l' >signal
20952 set X `csh -f <signal`
20953 $rm -f signal
20954 shift
20955 case $# in
20956 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20957 esac
20958 echo $@ | $tr ' ' $trnl | \
20959 $awk '{ printf "%s %d\n", $1, ++s; }
20960 END { printf "NSIG %d\n", ++s }' >signal.lst
20961fi
20962$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20963EOS
20964chmod a+x signal_cmd
20965$eunicefix signal_cmd
20966
20967: generate list of signal names
20968echo " "
20969case "$sig_name_init" in
20970'') doinit=yes ;;
20971*) case "$sig_num_init" in
20972 ''|*,*) doinit=yes ;;
20973 esac ;;
20974esac
20975case "$doinit" in
20976yes)
20977 echo "Generating a list of signal names and numbers..." >&4
20978 . ./signal_cmd
20979 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20980 sig_name=`$awk 'BEGIN { printf "ZERO " }
20981 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20982 sig_num=`$awk 'BEGIN { printf "0 " }
20983 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20984 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
20985 !/^NSIG/ { printf "\"%s\", ", $1 }
20986 END { printf "0\n" }' signal.lst`
20987 sig_num_init=`$awk 'BEGIN { printf "0, " }
20988 !/^NSIG/ { printf "%d, ", $2}
20989 END { printf "0\n"}' signal.lst`
20990 ;;
20991esac
20992echo "The following $sig_count signals are available:"
20993echo " "
20994echo $sig_name | $awk \
20995'BEGIN { linelen = 0 }
20996{
20997 for (i = 1; i <= NF; i++) {
20998 name = "SIG" $i " "
20999 linelen = linelen + length(name)
21000 if (linelen > 70) {
21001 printf "\n"
21002 linelen = length(name)
21003 }
21004 printf "%s", name
21005 }
21006 printf "\n"
21007}'
76d3c696 21008sig_size=`echo $sig_name | awk '{print NF}'`
c0bacbef 21009$rm -f signal signal.c signal.awk signal.lst signal_cmd
b4eb6b3d 21010
613d6c3e 21011: Check size of size
b4eb6b3d
JH
21012echo " "
21013case "$sizetype" in
21014*_t) zzz="$sizetype" ;;
21015*) zzz="filesize" ;;
21016esac
613d6c3e 21017echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21018cat > try.c <<EOCP
21019#include <sys/types.h>
21020#include <stdio.h>
d1daaddf
JH
21021#$i_stdlib I_STDLIB
21022#ifdef I_STDLIB
21023#include <stdlib.h>
21024#endif
b4eb6b3d
JH
21025int main() {
21026 printf("%d\n", (int)sizeof($sizetype));
21027 exit(0);
21028}
21029EOCP
21030set try
21031if eval $compile_ok; then
5440bc8e 21032 yyy=`$run ./try`
b4eb6b3d
JH
21033 case "$yyy" in
21034 '') sizesize=4
21035 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21036 ;;
21037 *) sizesize=$yyy
21038 echo "Your $zzz size is $sizesize bytes."
21039 ;;
21040 esac
21041else
21042 sizesize=4
21043 echo "(I can't compile the test program--guessing $sizesize.)" >&4
21044fi
21045
21046
21047: check for socklen_t
21048echo " "
21049echo "Checking to see if you have socklen_t..." >&4
21050$cat >try.c <<EOCP
21051#include <sys/types.h>
21052#$d_socket HAS_SOCKET
21053#ifdef HAS_SOCKET
21054#include <sys/socket.h>
21055#endif
21056int main() { socklen_t x = 16; }
21057EOCP
21058set try
21059if eval $compile; then
21060 val="$define"
21061 echo "You have socklen_t."
21062else
21063 val="$undef"
21064 echo "You do not have socklen_t."
21065 case "$sizetype" in
21066 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21067 esac
21068fi
5b813a60 21069$rm_try
b4eb6b3d
JH
21070set d_socklen_t
21071eval $setvar
21072
a7710f8d
JH
21073: see if this is a socks.h system
21074set socks.h i_socks
21075eval $inhdr
21076
b4eb6b3d
JH
21077: check for type of the size argument to socket calls
21078case "$d_socket" in
21079"$define")
21080 $cat <<EOM
21081
21082Checking to see what type is the last argument of accept().
21083EOM
b4eb6b3d
JH
21084 yyy=''
21085 case "$d_socklen_t" in
21086 "$define") yyy="$yyy socklen_t"
21087 esac
21088 yyy="$yyy $sizetype int long unsigned"
21089 for xxx in $yyy; do
21090 case "$socksizetype" in
61c26d18 21091 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
21092 case "$usesocks" in
21093 "$define")
21094 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21095 echo "Your system accepts '$xxx *' for the last argument of accept()."
21096 socksizetype="$xxx"
21097 fi
21098 ;;
21099 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
21100 echo "Your system accepts '$xxx *' for the last argument of accept()."
21101 socksizetype="$xxx"
21102 fi
21103 ;;
21104 esac
b4eb6b3d
JH
21105 ;;
21106 esac
21107 done
21108: In case none of those worked, prompt the user.
21109 case "$socksizetype" in
21110 '') rp='What is the type for socket address structure sizes?'
21111 dflt='int'
21112 . ./myread
21113 socksizetype=$ans
21114 ;;
21115 esac
21116 ;;
21117*) : no sockets, so pick relatively harmless default
21118 socksizetype='int'
21119 ;;
21120esac
21121
21122: see what type is used for signed size_t
21123set ssize_t ssizetype int stdio.h sys/types.h
21124eval $typedef
21125dflt="$ssizetype"
5440bc8e 21126$cat > try.c <<EOM
b4eb6b3d 21127#include <stdio.h>
d1daaddf
JH
21128#$i_stdlib I_STDLIB
21129#ifdef I_STDLIB
21130#include <stdlib.h>
21131#endif
b4eb6b3d
JH
21132#include <sys/types.h>
21133#define Size_t $sizetype
21134#define SSize_t $dflt
21135int main()
21136{
21137 if (sizeof(Size_t) == sizeof(SSize_t))
21138 printf("$dflt\n");
21139 else if (sizeof(Size_t) == sizeof(int))
21140 printf("int\n");
5b813a60 21141 else
b4eb6b3d
JH
21142 printf("long\n");
21143 exit(0);
21144}
21145EOM
21146echo " "
5440bc8e
JH
21147set try
21148if eval $compile_ok && $run ./try > /dev/null; then
21149 ssizetype=`$run ./try`
b4eb6b3d
JH
21150 echo "I'll be using $ssizetype for functions returning a byte count." >&4
21151else
21152 $cat >&4 <<EOM
21153Help! I can't compile and run the ssize_t test program: please enlighten me!
21154(This is probably a misconfiguration in your system or libraries, and
21155you really ought to fix it. Still, I'll try anyway.)
21156
21157I need a type that is the same size as $sizetype, but is guaranteed to
21158be signed. Common values are ssize_t, int and long.
21159
21160EOM
21161 rp="What signed type is the same size as $sizetype?"
21162 . ./myread
21163 ssizetype="$ans"
21164fi
5b813a60 21165$rm_try
b4eb6b3d
JH
21166
21167: see what type of char stdio uses.
21168echo " "
1d8eaf8c 21169echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
aa517f50 21170if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
21171 echo "Your stdio uses unsigned chars." >&4
21172 stdchar="unsigned char"
21173else
aa517f50
JH
21174 echo "Your stdio uses signed chars." >&4
21175 stdchar="char"
b4eb6b3d 21176fi
1d8eaf8c 21177$rm -f stdioh
b4eb6b3d 21178
b4eb6b3d
JH
21179: see what type uids are declared as in the kernel
21180echo " "
21181echo "Looking for the type for user ids returned by getuid()."
21182set uid_t uidtype xxx stdio.h sys/types.h
21183eval $typedef
21184case "$uidtype" in
21185xxx)
21186 xxx=`./findhdr sys/user.h`
21187 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21188 case $1 in
21189 unsigned) dflt="$1 $2" ;;
21190 *) dflt="$1" ;;
21191 esac
21192 ;;
21193*) dflt="$uidtype";;
21194esac
21195case "$uidtype" in
21196uid_t) echo "uid_t found." ;;
21197*) rp="What is the type for user ids returned by getuid()?"
21198 . ./myread
21199 uidtype="$ans"
21200 ;;
21201esac
21202
613d6c3e 21203: Check size of UID
b4eb6b3d
JH
21204echo " "
21205case "$uidtype" in
21206*_t) zzz="$uidtype" ;;
21207*) zzz="uid" ;;
21208esac
613d6c3e 21209echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21210cat > try.c <<EOCP
21211#include <sys/types.h>
21212#include <stdio.h>
d1daaddf
JH
21213#$i_stdlib I_STDLIB
21214#ifdef I_STDLIB
21215#include <stdlib.h>
21216#endif
b4eb6b3d
JH
21217int main() {
21218 printf("%d\n", (int)sizeof($uidtype));
21219 exit(0);
21220}
21221EOCP
21222set try
21223if eval $compile_ok; then
5440bc8e 21224 yyy=`$run ./try`
b4eb6b3d
JH
21225 case "$yyy" in
21226 '') uidsize=4
21227 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21228 ;;
21229 *) uidsize=$yyy
21230 echo "Your $zzz is $uidsize bytes long."
21231 ;;
21232 esac
21233else
21234 uidsize=4
21235 echo "(I can't compile the test program--guessing $uidsize.)" >&4
21236fi
21237
613d6c3e 21238: Check if UID is signed
b4eb6b3d
JH
21239echo " "
21240case "$uidtype" in
21241*_t) zzz="$uidtype" ;;
21242*) zzz="uid" ;;
21243esac
21244echo "Checking the sign of $zzz..." >&4
21245cat > try.c <<EOCP
21246#include <sys/types.h>
21247#include <stdio.h>
21248int main() {
21249 $uidtype foo = -1;
21250 if (foo < 0)
21251 printf("-1\n");
21252 else
21253 printf("1\n");
21254}
21255EOCP
21256set try
21257if eval $compile; then
5440bc8e 21258 yyy=`$run ./try`
b4eb6b3d
JH
21259 case "$yyy" in
21260 '') uidsign=1
21261 echo "(I can't execute the test program--guessing unsigned.)" >&4
21262 ;;
21263 *) uidsign=$yyy
21264 case "$uidsign" in
21265 1) echo "Your $zzz is unsigned." ;;
21266 -1) echo "Your $zzz is signed." ;;
21267 esac
21268 ;;
21269 esac
21270else
21271 uidsign=1
21272 echo "(I can't compile the test program--guessing unsigned.)" >&4
21273fi
21274
21275
34f1896b 21276: Check format string for UID
b4eb6b3d
JH
21277echo " "
21278$echo "Checking the format string to be used for uids..." >&4
21279
21280case "$uidsign" in
21281-1) if $test X"$uidsize" = X"$ivsize"; then
21282 uidformat="$ivdformat"
21283 else
21284 if $test X"$uidsize" = X"$longsize"; then
21285 uidformat='"ld"'
21286 else
21287 if $test X"$uidsize" = X"$intsize"; then
21288 uidformat='"d"'
21289 else
21290 if $test X"$uidsize" = X"$shortsize"; then
21291 uidformat='"hd"'
21292 fi
21293 fi
21294 fi
21295 fi
21296 ;;
21297*) if $test X"$uidsize" = X"$uvsize"; then
21298 uidformat="$uvuformat"
21299 else
21300 if $test X"$uidsize" = X"$longsize"; then
21301 uidformat='"lu"'
21302 else
21303 if $test X"$uidsize" = X"$intsize"; then
21304 uidformat='"u"'
21305 else
21306 if $test X"$uidsize" = X"$shortsize"; then
21307 uidformat='"hu"'
21308 fi
21309 fi
21310 fi
21311 fi
21312 ;;
21313esac
21314
34f1896b 21315: Check if site customization support was requested
4afd418c
MB
21316case "$usesitecustomize" in
21317 $define|true|[Yy]*)
21318 usesitecustomize="$define"
21319 ;;
21320 *)
21321 usesitecustomize="$undef"
21322 ;;
21323 esac
21324
d03b3b00
MB
21325: see if prototypes support variable argument declarations
21326echo " "
21327case "$prototype$i_stdarg" in
21328$define$define)
21329 echo "It appears we'll be able to prototype varargs functions." >&4
21330 val="$define"
21331 ;;
21332*)
21333 echo "Too bad... We won't be using prototyped varargs functions..." >&4
21334 val="$undef"
21335 ;;
21336esac
21337set vaproto
21338eval $setvar
21339
3659ebf1
JH
21340: determine compiler compiler
21341case "$yacc" in
21342'')
21343 dflt=yacc;;
21344*)
21345 dflt="$yacc";;
21346esac
21347echo " "
21348comp='yacc'
3c728e00 21349if $test -f "$byacc$_exe"; then
3659ebf1
JH
21350 dflt="$byacc"
21351 comp="byacc or $comp"
21352fi
3c728e00 21353if $test -f "$bison$_exe"; then
3659ebf1
JH
21354 comp="$comp or bison -y"
21355fi
21356rp="Which compiler compiler ($comp) shall I use?"
21357. ./myread
21358yacc="$ans"
21359case "$yacc" in
21360*bis*)
21361 case "$yacc" in
21362 *-y*) ;;
21363 *)
21364 yacc="$yacc -y"
21365 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21366 ;;
21367 esac
21368 ;;
21369esac
21370
c0bacbef
MB
21371: see if this is a assert.h system
21372set assert.h i_assert
21373eval $inhdr
21374
758a5d79
JH
21375: see if this is a fp.h system
21376set fp.h i_fp
21377eval $inhdr
21378
21379: see if this is a fp_class.h system
21380set fp_class.h i_fp_class
21381eval $inhdr
21382
13cfc98d
MB
21383: see if gdbm.h is available
21384set gdbm.h t_gdbm
21385eval $inhdr
21386case "$t_gdbm" in
21387$define)
21388 : see if gdbm_open exists
21389 set gdbm_open d_gdbm_open
21390 eval $inlibc
21391 case "$d_gdbm_open" in
21392 $undef)
21393 t_gdbm="$undef"
21394 echo "We won't be including <gdbm.h>"
21395 ;;
21396 esac
21397 ;;
21398esac
21399val="$t_gdbm"
21400set i_gdbm
21401eval $setvar
21402
b2f871ed
AD
21403: see if this is a ieeefp.h system
21404case "$i_ieeefp" in
21405'' ) set ieeefp.h i_ieeefp
21406 eval $inhdr
21407 ;;
21408esac
21409
21410: see if this is a libutil.h system
21411set libutil.h i_libutil
21412eval $inhdr
21413
21414: see if mach cthreads are available
21415if test "X$usethreads" = "X$define"; then
21416 set mach/cthreads.h i_machcthr
21417 eval $inhdr
21418else
21419 i_machcthr="$undef"
21420fi
21421
21422: see if this is a mntent.h system
21423set mntent.h i_mntent
21424eval $inhdr
21425
b4eb6b3d
JH
21426: see if net/errno.h is available
21427val=''
21428set net/errno.h val
21429eval $inhdr
21430
21431: Unfortunately, it causes problems on some systems. Arrgh.
21432case "$val" in
21433$define)
21434 cat > try.c <<'EOM'
21435#include <stdio.h>
21436#include <errno.h>
21437#include <net/errno.h>
21438int func()
21439{
21440 return ENOTSOCK;
21441}
21442EOM
21443 if $cc $ccflags -c try.c >/dev/null 2>&1; then
21444 echo "We'll be including <net/errno.h>." >&4
21445 else
21446 echo "We won't be including <net/errno.h>." >&4
21447 val="$undef"
21448 fi
5b813a60 21449 $rm_try
b4eb6b3d
JH
21450 ;;
21451esac
21452set i_neterrno
21453eval $setvar
21454
21455: see if netinet/tcp.h is available
21456set netinet/tcp.h i_netinettcp
21457eval $inhdr
21458
21459: see if this is a poll.h system
21460set poll.h i_poll
21461eval $inhdr
21462
21463: see if this is a prot.h system
21464set prot.h i_prot
21465eval $inhdr
21466
613d6c3e 21467: Preprocessor symbols
b4eb6b3d 21468echo " "
ddfca5da 21469$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
21470$cat <<'EOSH' > Cppsym.know
21471a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21472AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 21473alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
21474ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21475BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
21476BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21477bull c cadmus clipper CMU COFF COMPILER_VERSION
21478concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 21479CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
21480Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21481FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21482GLIBC GLIBC_MINOR
21483GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
21484H3050R H3050RX hbullx20 hcx host_mips
21485hp200 hp300 hp700 HP700 hp800 hp9000
21486hp9000s200 hp9000s300 hp9000s400 hp9000s500
21487hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21488i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 21489IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
21490INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21491LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21492LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 21493LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
21494LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21495M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21496M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21497M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21498MATH_HAS_NO_SIDE_EFFECTS
21499mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21500mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21501mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21502MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21503mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21504NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 21505news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
21506ns32016 ns32332 ns32k nsc32000
21507OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21508pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21509pc532 pdp11 PGC PIC plexus PORTAR posix
21510POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21511POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 21512PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 21513riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
21514SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21515sony sony_news sonyrisc sparc sparclite spectrum
21516stardent stdc STDC_EXT stratos sun sun3 sun386
21517Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21518SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21519SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21520sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 21521TM3200 TM5400 TM5600
b4eb6b3d
JH
21522tower tower32 tower32_200 tower32_600 tower32_700
21523tower32_800 tower32_850 tss
21524u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21525ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
21526unix UNIX95 UNIX99 unixpc unos
21527USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21528USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21529USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21530USGr4 USGr4_2
44c87379 21531Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
21532XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21533XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21534z8000
21535EOSH
21536# Maybe put other stuff here too.
21537cat <<EOSH >>Cppsym.know
21538$osname
21539EOSH
21540./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21541./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21542$cat Cppsym.know > Cppsym.c
381aa1ff 21543$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
21544$rm -f Cppsym.a Cppsym.b Cppsym.c
21545cat <<EOSH > Cppsym
21546$startsh
21547if $test \$# -gt 0; then
21548 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21549 if $test -s Cppsym.got; then
21550 $rm -f Cppsym.got
21551 exit 0
21552 fi
21553 $rm -f Cppsym.got
21554 exit 1
21555else
21556 $tr " " "$trnl" | ./Cppsym.try
21557 exit 0
21558fi
21559EOSH
21560chmod +x Cppsym
21561$eunicefix Cppsym
21562cat <<EOSH > Cppsym.try
21563$startsh
21564cat <<'EOCP' > try.c
21565#include <stdio.h>
360321b3
YST
21566#if cpp_stuff == 1
21567#define STRINGIFY(a) "a"
21568#endif
21569#if cpp_stuff == 42
21570#define StGiFy(a) #a
21571#define STRINGIFY(a) StGiFy(a)
21572#endif
21573#if $cpp_stuff != 1 && $cpp_stuff != 42
21574# include "Bletch: How does this C preprocessor stringify macros?"
21575#endif
b4eb6b3d
JH
21576int main() {
21577EOCP
21578$awk \\
21579EOSH
21580cat <<'EOSH' >> Cppsym.try
21581'length($1) > 0 {
360321b3
YST
21582 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21583 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21584 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21585 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 21586}' >> try.c
2ef53570 21587echo 'return 0;}' >> try.c
b4eb6b3d
JH
21588EOSH
21589cat <<EOSH >> Cppsym.try
21590ccflags="$ccflags"
21591case "$osname-$gccversion" in
21592irix-) ccflags="\$ccflags -woff 1178" ;;
21593os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21594esac
360321b3 21595$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
21596EOSH
21597chmod +x Cppsym.try
21598$eunicefix Cppsym.try
21599./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 21600: Add in any linux cpp "predefined macros":
b6a7163e 21601case "$osname::$gccversion" in
eeb92b76 21602 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
b6a7163e
MB
21603 tHdrH=_tmpHdr
21604 rm -f $tHdrH'.h' $tHdrH
21605 touch $tHdrH'.h'
6f5be6d1 21606 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
b6a7163e
MB
21607 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21608 if [ -s $tHdrH'_cppsym.real' ]; then
21609 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21610 fi
21611 fi
21612 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21613 ;;
21614esac
b4eb6b3d
JH
21615: now check the C compiler for additional symbols
21616postprocess_cc_v=''
21617case "$osname" in
21618aix) postprocess_cc_v="|$tr , ' '" ;;
21619esac
21620$cat >ccsym <<EOS
21621$startsh
21622$cat >tmp.c <<EOF
21623extern int foo;
21624EOF
21625for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21626do
21627 case "\$i" in
21628 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 21629 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
21630 esac
21631done
5b813a60 21632$rm_try
b4eb6b3d
JH
21633EOS
21634postprocess_cc_v=''
21635chmod +x ccsym
21636$eunicefix ccsym
21637./ccsym > ccsym1.raw
21638if $test -s ccsym1.raw; then
21639 $sort ccsym1.raw | $uniq >ccsym.raw
21640else
21641 mv ccsym1.raw ccsym.raw
21642fi
21643
21644$awk '/\=/ { print $0; next }
21645 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
21646$comm -13 Cppsym.true ccsym.list >ccsym.own
21647$comm -12 Cppsym.true ccsym.list >ccsym.com
21648$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
21649also=''
21650if $test -z ccsym.raw; then
21651 echo "Your C compiler doesn't seem to define any symbols!" >&4
21652 echo " "
21653 echo "However, your C preprocessor defines the following symbols:"
21654 $cat Cppsym.true
21655 ccsymbols=''
21656 cppsymbols=`$cat Cppsym.true`
21657 cppsymbols=`echo $cppsymbols`
21658 cppccsymbols="$cppsymbols"
21659else
21660 if $test -s ccsym.com; then
21661 echo "Your C compiler and pre-processor define these symbols:"
21662 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21663 also='also '
21664 symbols='ones'
21665 cppccsymbols=`$cat ccsym.com`
21666 cppccsymbols=`echo $cppccsymbols`
21667 $test "$silent" || sleep 1
21668 fi
21669 if $test -s ccsym.cpp; then
21670 $test "$also" && echo " "
21671 echo "Your C pre-processor ${also}defines the following symbols:"
21672 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21673 also='further '
21674 cppsymbols=`$cat ccsym.cpp`
21675 cppsymbols=`echo $cppsymbols`
21676 $test "$silent" || sleep 1
21677 fi
21678 if $test -s ccsym.own; then
21679 $test "$also" && echo " "
21680 echo "Your C compiler ${also}defines the following cpp symbols:"
21681 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21682 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21683 ccsymbols=`$cat ccsym.own`
21684 ccsymbols=`echo $ccsymbols`
21685 $test "$silent" || sleep 1
21686 fi
21687fi
b4eb6b3d
JH
21688
21689: see if this is a termio system
21690val="$undef"
21691val2="$undef"
21692val3="$undef"
21693if $test `./findhdr termios.h`; then
21694 set tcsetattr i_termios
21695 eval $inlibc
21696 val3="$i_termios"
21697fi
21698echo " "
21699case "$val3" in
21700"$define") echo "You have POSIX termios.h... good!" >&4;;
21701*) if ./Cppsym pyr; then
21702 case "`/bin/universe`" in
21703 ucb) if $test `./findhdr sgtty.h`; then
21704 val2="$define"
21705 echo "<sgtty.h> found." >&4
21706 else
21707 echo "System is pyramid with BSD universe."
216dac04 21708 ./warn "<sgtty.h> not found--you could have problems."
b4eb6b3d
JH
21709 fi;;
21710 *) if $test `./findhdr termio.h`; then
21711 val="$define"
21712 echo "<termio.h> found." >&4
21713 else
21714 echo "System is pyramid with USG universe."
216dac04 21715 ./warn "<termio.h> not found--you could have problems."
b4eb6b3d
JH
21716 fi;;
21717 esac
21718 elif ./usg; then
21719 if $test `./findhdr termio.h`; then
21720 echo "<termio.h> found." >&4
21721 val="$define"
21722 elif $test `./findhdr sgtty.h`; then
21723 echo "<sgtty.h> found." >&4
21724 val2="$define"
21725 else
216dac04 21726 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
b4eb6b3d
JH
21727 fi
21728 else
21729 if $test `./findhdr sgtty.h`; then
21730 echo "<sgtty.h> found." >&4
21731 val2="$define"
21732 elif $test `./findhdr termio.h`; then
21733 echo "<termio.h> found." >&4
21734 val="$define"
21735 else
216dac04 21736 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
b4eb6b3d
JH
21737 fi
21738 fi;;
21739esac
21740set i_termio; eval $setvar
21741val=$val2; set i_sgtty; eval $setvar
21742val=$val3; set i_termios; eval $setvar
21743
b4eb6b3d
JH
21744: see if stddef is available
21745set stddef.h i_stddef
21746eval $inhdr
923fc586 21747
b4eb6b3d
JH
21748: see if sys/access.h is available
21749set sys/access.h i_sysaccess
21750eval $inhdr
21751
21752: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21753set sys/filio.h i_sysfilio
21754eval $inhdr
21755echo " "
21756if $test `./findhdr sys/ioctl.h`; then
21757 val="$define"
21758 echo '<sys/ioctl.h> found.' >&4
21759else
21760 val="$undef"
21761 if $test $i_sysfilio = "$define"; then
21762 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 21763 else
b4eb6b3d
JH
21764 $test $i_sgtty = "$define" && xxx="sgtty.h"
21765 $test $i_termio = "$define" && xxx="termio.h"
21766 $test $i_termios = "$define" && xxx="termios.h"
21767echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21768 fi
21769fi
21770set i_sysioctl
21771eval $setvar
21772
49a78c82
JH
21773: see if socket ioctl defs are in sys/sockio.h
21774echo " "
21775xxx=`./findhdr sys/sockio.h`
21776if $test "$xxx"; then
21777 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21778 val="$define"
21779 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21780 else
21781 val="$undef"
21782 echo "No socket ioctls found in <sys/sockio.h>." >&4
21783 fi
21784else
21785 val="$undef"
21786 $cat <<EOM
21787<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21788EOM
21789fi
21790set i_syssockio
21791eval $setvar
21792
b4eb6b3d
JH
21793: see if this is a syslog.h system
21794set syslog.h i_syslog
21795eval $inhdr
21796
b4eb6b3d
JH
21797: see if this is a sys/mode.h system
21798set sys/mode.h i_sysmode
21799eval $inhdr
21800
216dac04
MB
21801: see if there is a sys/poll.h file
21802set sys/poll.h i_syspoll
21803eval $inhdr
21804
b4eb6b3d
JH
21805: see if sys/resource.h has to be included
21806set sys/resource.h i_sysresrc
21807eval $inhdr
21808
21809: see if sys/security.h is available
21810set sys/security.h i_syssecrt
21811eval $inhdr
21812
21813: see if this is a sys/statvfs.h system
21814set sys/statvfs.h i_sysstatvfs
21815eval $inhdr
21816
b4eb6b3d
JH
21817: see if this is a sys/un.h system
21818set sys/un.h i_sysun
21819eval $inhdr
21820
b4eb6b3d
JH
21821: see if this is a sys/utsname.h system
21822set sys/utsname.h i_sysutsname
21823eval $inhdr
21824
21825: see if this is a syswait system
21826set sys/wait.h i_syswait
21827eval $inhdr
21828
21829: see if this is a ustat.h system
21830set ustat.h i_ustat
21831eval $inhdr
21832
21833: see if this is an utime system
21834set utime.h i_utime
21835eval $inhdr
21836
b4eb6b3d
JH
21837: see if this is a vfork system
21838case "$d_vfork" in
21839"$define")
21840 set vfork.h i_vfork
21841 eval $inhdr
21842 ;;
21843*)
21844 i_vfork="$undef"
21845 ;;
21846esac
21847
613d6c3e 21848: Check extensions
b4eb6b3d
JH
21849echo " "
21850echo "Looking for extensions..." >&4
21851: If we are using the old config.sh, known_extensions may contain
21852: old or inaccurate or duplicate values.
21853known_extensions=''
21854nonxs_extensions=''
21855: We do not use find because it might not be available.
21856: We do not just use MANIFEST because the user may have dropped
21857: some additional extensions into the source tree and expect them
21858: to be built.
21859
38fddf8b
MB
21860: Function to recursively find available extensions, ignoring DynaLoader
21861: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
4cc80fc4 21862: In 5.10.1 and later, extensions are stored in directories
88a6f4fc 21863: like File-Glob instead of the older File/Glob/.
b4eb6b3d
JH
21864find_extensions='
21865 for xxx in *; do
822a6ee0
MB
21866 case "$xxx" in
21867 DynaLoader|dynaload) ;;
21868 *)
238a6851
NC
21869 this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21870 leaf=`echo $xxx | $sed -e s/.*-//`;
dd6c21be 21871 if $test -d File; then
38fddf8b
MB
21872 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21873 known_extensions="$known_extensions $1$this_ext";
21874 elif $test -f $xxx/Makefile.PL; then
21875 nonxs_extensions="$nonxs_extensions $1$this_ext";
21876 else
21877 if $test -d $xxx -a $# -lt 10; then
21878 set $1$xxx/ $*;
21879 cd "$xxx";
21880 eval $find_extensions;
21881 cd ..;
21882 shift;
21883 fi;
21884 fi;
dd6c21be
NC
21885 else
21886 $ls -1 $xxx > $$.tmp;
21887 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21888 known_extensions="$known_extensions $this_ext";
21889 elif $contains "\.c$" $$.tmp > /dev/null 2>&1; then
21890 known_extensions="$known_extensions $this_ext";
dd6c21be
NC
21891 elif $test -d $xxx; then
21892 nonxs_extensions="$nonxs_extensions $this_ext";
21893 fi;
21894 $rm -f $$.tmp;
822a6ee0
MB
21895 fi
21896 ;;
21897 esac;
b4eb6b3d
JH
21898 done'
21899tdir=`pwd`
dd6c21be
NC
21900cd "$rsrc/cpan"
21901set X
21902shift
21903eval $find_extensions
a193a2db
NC
21904cd "$rsrc/dist"
21905set X
21906shift
21907eval $find_extensions
6904989c 21908cd "$rsrc/ext"
b4eb6b3d
JH
21909set X
21910shift
21911eval $find_extensions
38fddf8b
MB
21912if $test -d File-Glob; then
21913 : All ext/ flattened
21914else
21915 # Special case: Add in modules that nest beyond the first level.
21916 # Currently threads/shared and Hash/Util/FieldHash, since they are
21917 # not picked up by the recursive find above (and adding in general
21918 # recursive finding breaks SDBM_File/sdbm).
21919 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21920 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21921fi
faae14e6
MB
21922set X $known_extensions
21923shift
a32b3e13 21924known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
b4eb6b3d
JH
21925set X $nonxs_extensions
21926shift
a32b3e13 21927nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
6904989c 21928cd "$tdir"
b4eb6b3d
JH
21929
21930: Now see which are supported on this system.
21931avail_ext=''
21932for xxx in $known_extensions ; do
21933 case "$xxx" in
21934 DB_File|db_file)
21935 case "$i_db" in
21936 $define) avail_ext="$avail_ext $xxx" ;;
21937 esac
21938 ;;
21939 GDBM_File|gdbm_fil)
7c345082 21940 case "$i_gdbm" in
b4eb6b3d
JH
21941 $define) avail_ext="$avail_ext $xxx" ;;
21942 esac
21943 ;;
1d59c593 21944 I18N/Langinfo|i18n_lan)
7c345082 21945 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
21946 $define$define) avail_ext="$avail_ext $xxx" ;;
21947 esac
21948 ;;
7978b0db
JH
21949 IPC/SysV|ipc/sysv)
21950 : XXX Do we need a useipcsysv variable here
21951 case "${d_msg}${d_sem}${d_shm}" in
21952 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21953 esac
21954 ;;
b4eb6b3d 21955 NDBM_File|ndbm_fil)
7894ad66 21956 case "$d_ndbm" in
b4eb6b3d
JH
21957 $define)
21958 case "$osname-$use64bitint" in
0be9fa5d 21959 hpux-define)
b4eb6b3d
JH
21960 case "$libs" in
21961 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21962 esac
21963 ;;
21964 *) avail_ext="$avail_ext $xxx" ;;
21965 esac
21966 ;;
21967 esac
21968 ;;
7c345082 21969 ODBM_File|odbm_fil)
b4eb6b3d
JH
21970 case "${i_dbm}${i_rpcsvcdbm}" in
21971 *"${define}"*)
7978b0db
JH
21972 case "$d_cplusplus" in
21973 define) ;; # delete as a function name will not work
21974 *) case "$osname-$use64bitint" in
21975 hpux-define)
21976 case "$libs" in
21977 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21978 esac
21979 ;;
21980 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
21981 esac
21982 ;;
b4eb6b3d
JH
21983 esac
21984 ;;
21985 esac
21986 ;;
7978b0db
JH
21987 Opcode|opcode)
21988 case "$useopcode" in
b4eb6b3d
JH
21989 true|define|y) avail_ext="$avail_ext $xxx" ;;
21990 esac
21991 ;;
7978b0db
JH
21992 POSIX|posix)
21993 case "$useposix" in
b4eb6b3d
JH
21994 true|define|y) avail_ext="$avail_ext $xxx" ;;
21995 esac
21996 ;;
21997 Socket|socket)
7c345082 21998 case "$d_socket" in
4a9f028c
JH
21999 true|$define|y)
22000 case "$osname" in
22001 beos) ;; # not unless BONE
22002 *) avail_ext="$avail_ext $xxx" ;;
22003 esac
22004 ;;
b4eb6b3d
JH
22005 esac
22006 ;;
22007 Sys/Syslog|sys/syslog)
22008 : XXX syslog requires socket
7c345082 22009 case "$d_socket" in
b4eb6b3d
JH
22010 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22011 esac
22012 ;;
22013 Thread|thread)
b00ec89b
AB
22014 case "$usethreads" in
22015 true|$define|y)
47f9f84c 22016 case "$use5005threads" in
3f30fabf 22017 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 22018 esac
b4eb6b3d
JH
22019 esac
22020 ;;
7978b0db
JH
22021 threads|threads/shared)
22022 # threads and threads::shared are special cases.
22023 # To stop people from asking "Perl 5.8.0 was supposed
22024 # to have this new fancy threads implementation but my
22025 # perl doesn't have it" and from people trying to
22026 # (re)install the threads module using CPAN.pm and
22027 # CPAN.pm then offering to reinstall Perl 5.8.0,
22028 # the threads.pm and threads/shared.pm will always be
22029 # there, croaking informatively ("you need to rebuild
22030 # all of Perl with threads, sorry") when threads haven't
22031 # been compiled in.
22032 # --jhi
22033 avail_ext="$avail_ext $xxx"
22034 ;;
aefe3e7e
NC
22035 VMS*)
22036 ;;
78ff2d7b 22037 Win32*)
b149d92d
JD
22038 case "$osname" in
22039 cygwin) avail_ext="$avail_ext $xxx" ;;
22040 esac
22041 ;;
f9b6ed1c
AD
22042 XS/APItest|xs/apitest)
22043 # This is just for testing. Skip it unless we have dynamic loading.
88e1f1a2
JV
22044
22045 case "$usedl" in
22046 $define) avail_ext="$avail_ext $xxx" ;;
22047 esac
22048 ;;
f9b6ed1c
AD
22049 XS/Typemap|xs/typemap)
22050 # This is just for testing. Skip it unless we have dynamic loading.
22051 case "$usedl" in
22052 $define) avail_ext="$avail_ext $xxx" ;;
22053 esac
22054 ;;
b4eb6b3d 22055 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
22056 ;;
22057 esac
b4eb6b3d 22058done
5f80c64f 22059
b4eb6b3d
JH
22060set X $avail_ext
22061shift
22062avail_ext="$*"
5f80c64f 22063
ef0c5be8
JH
22064case "$onlyextensions" in
22065'') ;;
22066*) keepextensions=''
22067 echo "You have requested that only certains extensions be included..." >&4
22068 for i in $onlyextensions; do
22069 case " $avail_ext " in
22070 *" $i "*)
22071 echo "Keeping extension $i."
22072 keepextensions="$keepextensions $i"
22073 ;;
22074 *) echo "Ignoring extension $i." ;;
22075 esac
22076 done
22077 avail_ext="$keepextensions"
22078 ;;
22079esac
22080
22081case "$noextensions" in
22082'') ;;
22083*) keepextensions=''
22084 echo "You have requested that certain extensions be ignored..." >&4
22085 for i in $avail_ext; do
c3dadc13
AD
22086 case " $noextensions " in
22087 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
22088 *) echo "Keeping extension $i.";
22089 keepextensions="$keepextensions $i"
22090 ;;
22091 esac
22092 done
22093 avail_ext="$keepextensions"
22094 ;;
22095esac
22096
b4eb6b3d
JH
22097: Now see which nonxs extensions are supported on this system.
22098: For now assume all are.
22099nonxs_ext=''
22100for xxx in $nonxs_extensions ; do
22101 case "$xxx" in
22102 *) nonxs_ext="$nonxs_ext $xxx"
22103 ;;
22104 esac
22105done
5f80c64f 22106
b4eb6b3d
JH
22107set X $nonxs_ext
22108shift
22109nonxs_ext="$*"
22110
22111case $usedl in
22112$define)
22113 $cat <<EOM
22114A number of extensions are supplied with $package. You may choose to
22115compile these extensions for dynamic loading (the default), compile
22116them into the $package executable (static loading), or not include
22117them at all. Answer "none" to include no extensions.
22118Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
22119
22120EOM
b4eb6b3d 22121 case "$dynamic_ext" in
736accd3
YST
22122 '')
22123 : Exclude those listed in static_ext
22124 dflt=''
22125 for xxx in $avail_ext; do
22126 case " $static_ext " in
22127 *" $xxx "*) ;;
22128 *) dflt="$dflt $xxx" ;;
22129 esac
22130 done
22131 set X $dflt
22132 shift
22133 dflt="$*"
22134 ;;
b4eb6b3d
JH
22135 *) dflt="$dynamic_ext"
22136 # Perhaps we are reusing an old out-of-date config.sh.
22137 case "$hint" in
22138 previous)
22139 if test X"$dynamic_ext" != X"$avail_ext"; then
22140 $cat <<EOM
7c345082
RGS
22141NOTICE: Your previous config.sh list may be incorrect.
22142The extensions now available to you are
b4eb6b3d
JH
22143 ${avail_ext}
22144but the default list from your previous config.sh is
7c345082 22145 ${dynamic_ext}
9c839522 22146
b4eb6b3d
JH
22147EOM
22148 fi
9c839522
PM
22149 ;;
22150 esac
b4eb6b3d
JH
22151 ;;
22152 esac
5f80c64f 22153 case "$dflt" in
b4eb6b3d
JH
22154 '') dflt=none;;
22155 esac
22156 rp="What extensions do you wish to load dynamically?"
22157 . ./myread
22158 case "$ans" in
22159 none) dynamic_ext=' ' ;;
22160 *) dynamic_ext="$ans" ;;
5f80c64f 22161 esac
5f80c64f 22162
b4eb6b3d
JH
22163 case "$static_ext" in
22164 '')
22165 : Exclude those already listed in dynamic linking
22166 dflt=''
22167 for xxx in $avail_ext; do
22168 case " $dynamic_ext " in
22169 *" $xxx "*) ;;
22170 *) dflt="$dflt $xxx" ;;
22171 esac
22172 done
22173 set X $dflt
22174 shift
22175 dflt="$*"
22176 ;;
7c345082 22177 *) dflt="$static_ext"
b4eb6b3d
JH
22178 ;;
22179 esac
9c839522 22180
b4eb6b3d
JH
22181 case "$dflt" in
22182 '') dflt=none;;
22183 esac
22184 rp="What extensions do you wish to load statically?"
22185 . ./myread
22186 case "$ans" in
22187 none) static_ext=' ' ;;
22188 *) static_ext="$ans" ;;
22189 esac
22190 ;;
22191*)
22192 $cat <<EOM
7c345082
RGS
22193A number of extensions are supplied with $package. Answer "none"
22194to include no extensions.
b4eb6b3d 22195Note that DynaLoader is always built and need not be mentioned here.
9c839522 22196
b4eb6b3d
JH
22197EOM
22198 case "$static_ext" in
22199 '') dflt="$avail_ext" ;;
22200 *) dflt="$static_ext"
22201 # Perhaps we are reusing an old out-of-date config.sh.
22202 case "$hint" in
22203 previous)
22204 if test X"$static_ext" != X"$avail_ext"; then
22205 $cat <<EOM
7c345082
RGS
22206NOTICE: Your previous config.sh list may be incorrect.
22207The extensions now available to you are
b4eb6b3d
JH
22208 ${avail_ext}
22209but the default list from your previous config.sh is
7c345082 22210 ${static_ext}
5f80c64f
JH
22211
22212EOM
b4eb6b3d
JH
22213 fi
22214 ;;
22215 esac
22216 ;;
22217 esac
22218 : Exclude those that are not xs extensions
22219 case "$dflt" in
22220 '') dflt=none;;
22221 esac
22222 rp="What extensions do you wish to include?"
22223 . ./myread
22224 case "$ans" in
22225 none) static_ext=' ' ;;
22226 *) static_ext="$ans" ;;
22227 esac
22228 ;;
5f80c64f 22229esac
7c345082 22230#
f1f6834f
AD
22231# Encode is a special case. If we are building Encode as a static
22232# extension, we need to explicitly list its subextensions as well.
22233# For other nested extensions, this is handled automatically by
22234# the appropriate Makefile.PL.
22235case " $static_ext " in
22236 *" Encode "*) # Add the subextensions of Encode
22237 cd "$rsrc/ext"
22238 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22239 static_ext="$static_ext Encode/$xxx"
22240 done
22241 cd "$tdir"
22242 ;;
22243esac
5f80c64f 22244
b4eb6b3d
JH
22245set X $dynamic_ext $static_ext $nonxs_ext
22246shift
22247extensions="$*"
22248
93a2cd18
AD
22249# Sanity check: We require an extension suitable for use with
22250# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
22251# should show up as failures in the test suite, but it's helpful to
22252# catch them now.) The 'extensions' list is normally sorted
22253# alphabetically, so we need to accept either
22254# DB_File ... Fcntl ... IO ....
22255# or something like
22256# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
22257case " $extensions" in
22258*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22259*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22260*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
22261*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22262 echo "WARNING: The Perl you are building will be quite crippled." >& 4
22263 ;;
22264esac
22265
9c839522
PM
22266: Remove libraries needed only for extensions
22267: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
22268: The exception is SunOS 4.x, which needs them.
22269case "${osname}X${osvers}" in
22270sunos*X4*)
22271 perllibs="$libs"
22272 ;;
22273*) case "$usedl" in
22274 $define|true|[yY]*)
a33f2d9f 22275 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
eedaba54
PM
22276 shift
22277 perllibs="$*"
22278 ;;
22279 *) perllibs="$libs"
22280 ;;
22281 esac
22282 ;;
9c839522 22283esac
5f80c64f
JH
22284
22285: Remove build directory name from cppstdin so it can be used from
22286: either the present location or the final installed location.
22287echo " "
22288: Get out of the UU directory to get correct path name.
22289cd ..
22290case "$cppstdin" in
22291`pwd`/cppstdin)
22292 echo "Stripping down cppstdin path name"
22293 cppstdin=cppstdin
22294 ;;
22295esac
22296cd UU
22297
22298: end of configuration questions
22299echo " "
22300echo "End of configuration questions."
22301echo " "
22302
22303: back to where it started
22304if test -d ../UU; then
22305 cd ..
22306fi
22307
776a38e3 22308: configuration may be unconditionally patched via a 'config.arch' file
48370efc 22309if $test -f config.arch; then
776a38e3 22310 echo "I see a config.arch file, loading it." >&4
48370efc
JH
22311 . ./config.arch
22312fi
22313
5f80c64f
JH
22314: configuration may be patched via a 'config.over' file
22315if $test -f config.over; then
22316 echo " "
22317 dflt=y
22318 rp='I see a config.over file. Do you wish to load it?'
22319 . UU/myread
22320 case "$ans" in
22321 n*) echo "OK, I'll ignore it.";;
22322 *) . ./config.over
22323 echo "Configuration override changes have been loaded."
22324 ;;
22325 esac
22326fi
22327
22328: in case they want portability, strip down executable paths
22329case "$d_portable" in
22330"$define")
22331 echo " "
22332 echo "Stripping down executable paths..." >&4
22333 for file in $loclist $trylist; do
534ac15a
JH
22334 eval temp=\$$file
22335 eval $file=`basename $temp`
5f80c64f
JH
22336 done
22337 ;;
22338esac
22339
22340: create config.sh file
22341echo " "
22342echo "Creating config.sh..." >&4
22343$spitshell <<EOT >config.sh
22344$startsh
22345#
22346# This file was produced by running the Configure script. It holds all the
22347# definitions figured out by Configure. Should you modify one of these values,
22348# do not forget to propagate your changes by running "Configure -der". You may
22349# instead choose to run each of the .SH files by yourself, or "Configure -S".
22350#
22351
22352# Package name : $package
22353# Source directory : $src
22354# Configuration time: $cf_time
22355# Configured by : $cf_by
22356# Target system : $myuname
22357
776a38e3 22358EOT
94a9a4bc 22359: Add in command line options if available
776a38e3 22360$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
94a9a4bc 22361
776a38e3
MB
22362$spitshell <<EOT >>config.sh
22363
5f80c64f
JH
22364Author='$Author'
22365Date='$Date'
22366Header='$Header'
22367Id='$Id'
22368Locker='$Locker'
22369Log='$Log'
5f80c64f
JH
22370RCSfile='$RCSfile'
22371Revision='$Revision'
22372Source='$Source'
22373State='$State'
22374_a='$_a'
22375_exe='$_exe'
22376_o='$_o'
b4eb6b3d 22377afs='$afs'
a6d26a0d 22378afsroot='$afsroot'
b4eb6b3d
JH
22379alignbytes='$alignbytes'
22380ansi2knr='$ansi2knr'
22381aphostname='$aphostname'
22382api_revision='$api_revision'
22383api_subversion='$api_subversion'
22384api_version='$api_version'
22385api_versionstring='$api_versionstring'
5f80c64f 22386ar='$ar'
b4eb6b3d
JH
22387archlib='$archlib'
22388archlibexp='$archlibexp'
22389archname64='$archname64'
22390archname='$archname'
5f80c64f 22391archobjs='$archobjs'
10bc17b6 22392asctime_r_proto='$asctime_r_proto'
5f80c64f 22393awk='$awk'
b4eb6b3d 22394baserev='$baserev'
5f80c64f 22395bash='$bash'
b4eb6b3d 22396bin='$bin'
f1ce3bf1 22397bin_ELF='$bin_ELF'
b4eb6b3d 22398binexp='$binexp'
5f80c64f
JH
22399bison='$bison'
22400byacc='$byacc'
b4eb6b3d 22401byteorder='$byteorder'
5f80c64f 22402c='$c'
b4eb6b3d 22403castflags='$castflags'
5f80c64f
JH
22404cat='$cat'
22405cc='$cc'
22406cccdlflags='$cccdlflags'
22407ccdlflags='$ccdlflags'
22408ccflags='$ccflags'
b4eb6b3d 22409ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 22410ccname='$ccname'
b4eb6b3d 22411ccsymbols='$ccsymbols'
6b356c8e 22412ccversion='$ccversion'
5f80c64f 22413cf_by='$cf_by'
b4eb6b3d 22414cf_email='$cf_email'
5f80c64f 22415cf_time='$cf_time'
c193ef60
MB
22416charbits='$charbits'
22417charsize='$charsize'
5f80c64f
JH
22418chgrp='$chgrp'
22419chmod='$chmod'
22420chown='$chown'
b4eb6b3d 22421clocktype='$clocktype'
5f80c64f
JH
22422comm='$comm'
22423compress='$compress'
22424contains='$contains'
22425cp='$cp'
22426cpio='$cpio'
22427cpp='$cpp'
b4eb6b3d
JH
22428cpp_stuff='$cpp_stuff'
22429cppccsymbols='$cppccsymbols'
5f80c64f
JH
22430cppflags='$cppflags'
22431cpplast='$cpplast'
22432cppminus='$cppminus'
22433cpprun='$cpprun'
22434cppstdin='$cppstdin'
b4eb6b3d 22435cppsymbols='$cppsymbols'
10bc17b6 22436crypt_r_proto='$crypt_r_proto'
b4eb6b3d 22437cryptlib='$cryptlib'
5f80c64f 22438csh='$csh'
10bc17b6
JH
22439ctermid_r_proto='$ctermid_r_proto'
22440ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
22441d_Gconvert='$d_Gconvert'
22442d_PRIEUldbl='$d_PRIEUldbl'
22443d_PRIFUldbl='$d_PRIFUldbl'
22444d_PRIGUldbl='$d_PRIGUldbl'
22445d_PRIXU64='$d_PRIXU64'
22446d_PRId64='$d_PRId64'
22447d_PRIeldbl='$d_PRIeldbl'
22448d_PRIfldbl='$d_PRIfldbl'
22449d_PRIgldbl='$d_PRIgldbl'
22450d_PRIi64='$d_PRIi64'
22451d_PRIo64='$d_PRIo64'
22452d_PRIu64='$d_PRIu64'
22453d_PRIx64='$d_PRIx64'
22454d_SCNfldbl='$d_SCNfldbl'
74cac757 22455d__fwalk='$d__fwalk'
b4eb6b3d
JH
22456d_access='$d_access'
22457d_accessx='$d_accessx'
55954f19 22458d_aintl='$d_aintl'
b4eb6b3d
JH
22459d_alarm='$d_alarm'
22460d_archlib='$d_archlib'
96938616 22461d_asctime64='$d_asctime64'
10bc17b6 22462d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
22463d_atolf='$d_atolf'
22464d_atoll='$d_atoll'
fcdf39cf 22465d_attribute_deprecated='$d_attribute_deprecated'
0dbb1585
AL
22466d_attribute_format='$d_attribute_format'
22467d_attribute_malloc='$d_attribute_malloc'
22468d_attribute_nonnull='$d_attribute_nonnull'
22469d_attribute_noreturn='$d_attribute_noreturn'
22470d_attribute_pure='$d_attribute_pure'
22471d_attribute_unused='$d_attribute_unused'
22472d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
22473d_bcmp='$d_bcmp'
22474d_bcopy='$d_bcopy'
5f80c64f 22475d_bsd='$d_bsd'
b4eb6b3d
JH
22476d_bsdgetpgrp='$d_bsdgetpgrp'
22477d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
22478d_builtin_choose_expr='$d_builtin_choose_expr'
22479d_builtin_expect='$d_builtin_expect'
b4eb6b3d 22480d_bzero='$d_bzero'
a2d23ec2 22481d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
22482d_casti32='$d_casti32'
22483d_castneg='$d_castneg'
22484d_charvspr='$d_charvspr'
22485d_chown='$d_chown'
22486d_chroot='$d_chroot'
22487d_chsize='$d_chsize'
758a5d79 22488d_class='$d_class'
b0a2e8e6 22489d_clearenv='$d_clearenv'
b4eb6b3d 22490d_closedir='$d_closedir'
4e0554ec 22491d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 22492d_const='$d_const'
55954f19 22493d_copysignl='$d_copysignl'
666ea192 22494d_cplusplus='$d_cplusplus'
b4eb6b3d 22495d_crypt='$d_crypt'
10bc17b6 22496d_crypt_r='$d_crypt_r'
b4eb6b3d 22497d_csh='$d_csh'
13cfc98d 22498d_ctermid='$d_ctermid'
10bc17b6 22499d_ctermid_r='$d_ctermid_r'
96938616 22500d_ctime64='$d_ctime64'
10bc17b6 22501d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
22502d_cuserid='$d_cuserid'
22503d_dbl_dig='$d_dbl_dig'
2ef53570 22504d_dbminitproto='$d_dbminitproto'
96938616 22505d_difftime64='$d_difftime64'
b4eb6b3d 22506d_difftime='$d_difftime'
de52168c 22507d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 22508d_dirfd='$d_dirfd'
b4eb6b3d
JH
22509d_dirnamlen='$d_dirnamlen'
22510d_dlerror='$d_dlerror'
5f80c64f 22511d_dlopen='$d_dlopen'
b4eb6b3d
JH
22512d_dlsymun='$d_dlsymun'
22513d_dosuid='$d_dosuid'
10bc17b6 22514d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
22515d_drand48proto='$d_drand48proto'
22516d_dup2='$d_dup2'
22517d_eaccess='$d_eaccess'
22518d_endgrent='$d_endgrent'
10bc17b6 22519d_endgrent_r='$d_endgrent_r'
b4eb6b3d 22520d_endhent='$d_endhent'
10bc17b6 22521d_endhostent_r='$d_endhostent_r'
b4eb6b3d 22522d_endnent='$d_endnent'
10bc17b6 22523d_endnetent_r='$d_endnetent_r'
b4eb6b3d 22524d_endpent='$d_endpent'
10bc17b6 22525d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 22526d_endpwent='$d_endpwent'
10bc17b6 22527d_endpwent_r='$d_endpwent_r'
b4eb6b3d 22528d_endsent='$d_endsent'
10bc17b6 22529d_endservent_r='$d_endservent_r'
b4eb6b3d 22530d_eofnblk='$d_eofnblk'
5f80c64f 22531d_eunice='$d_eunice'
15b61c98 22532d_faststdio='$d_faststdio'
b363b713 22533d_fchdir='$d_fchdir'
b4eb6b3d
JH
22534d_fchmod='$d_fchmod'
22535d_fchown='$d_fchown'
22536d_fcntl='$d_fcntl'
9d9004a9 22537d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
22538d_fd_macros='$d_fd_macros'
22539d_fd_set='$d_fd_set'
22540d_fds_bits='$d_fds_bits'
22541d_fgetpos='$d_fgetpos'
758a5d79
JH
22542d_finite='$d_finite'
22543d_finitel='$d_finitel'
b4eb6b3d
JH
22544d_flexfnam='$d_flexfnam'
22545d_flock='$d_flock'
2ef53570 22546d_flockproto='$d_flockproto'
b4eb6b3d 22547d_fork='$d_fork'
758a5d79 22548d_fp_class='$d_fp_class'
b4eb6b3d 22549d_fpathconf='$d_fpathconf'
758a5d79
JH
22550d_fpclass='$d_fpclass'
22551d_fpclassify='$d_fpclassify'
22552d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
22553d_fpos64_t='$d_fpos64_t'
22554d_frexpl='$d_frexpl'
22555d_fs_data_s='$d_fs_data_s'
22556d_fseeko='$d_fseeko'
22557d_fsetpos='$d_fsetpos'
22558d_fstatfs='$d_fstatfs'
22559d_fstatvfs='$d_fstatvfs'
411ab01c 22560d_fsync='$d_fsync'
b4eb6b3d
JH
22561d_ftello='$d_ftello'
22562d_ftime='$d_ftime'
dc814df1 22563d_futimes='$d_futimes'
e74475c7
MHM
22564d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22565d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
5086dff9 22566d_getaddrinfo='$d_getaddrinfo'
b4eb6b3d
JH
22567d_getcwd='$d_getcwd'
22568d_getespwnam='$d_getespwnam'
22569d_getfsstat='$d_getfsstat'
22570d_getgrent='$d_getgrent'
10bc17b6
JH
22571d_getgrent_r='$d_getgrent_r'
22572d_getgrgid_r='$d_getgrgid_r'
22573d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
22574d_getgrps='$d_getgrps'
22575d_gethbyaddr='$d_gethbyaddr'
22576d_gethbyname='$d_gethbyname'
22577d_gethent='$d_gethent'
22578d_gethname='$d_gethname'
10bc17b6
JH
22579d_gethostbyaddr_r='$d_gethostbyaddr_r'
22580d_gethostbyname_r='$d_gethostbyname_r'
22581d_gethostent_r='$d_gethostent_r'
b4eb6b3d 22582d_gethostprotos='$d_gethostprotos'
4e0554ec 22583d_getitimer='$d_getitimer'
b4eb6b3d 22584d_getlogin='$d_getlogin'
10bc17b6 22585d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
22586d_getmnt='$d_getmnt'
22587d_getmntent='$d_getmntent'
5086dff9 22588d_getnameinfo='$d_getnameinfo'
b4eb6b3d
JH
22589d_getnbyaddr='$d_getnbyaddr'
22590d_getnbyname='$d_getnbyname'
22591d_getnent='$d_getnent'
10bc17b6
JH
22592d_getnetbyaddr_r='$d_getnetbyaddr_r'
22593d_getnetbyname_r='$d_getnetbyname_r'
22594d_getnetent_r='$d_getnetent_r'
b4eb6b3d 22595d_getnetprotos='$d_getnetprotos'
0c0643d0 22596d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
22597d_getpbyname='$d_getpbyname'
22598d_getpbynumber='$d_getpbynumber'
22599d_getpent='$d_getpent'
22600d_getpgid='$d_getpgid'
22601d_getpgrp2='$d_getpgrp2'
22602d_getpgrp='$d_getpgrp'
22603d_getppid='$d_getppid'
22604d_getprior='$d_getprior'
10bc17b6
JH
22605d_getprotobyname_r='$d_getprotobyname_r'
22606d_getprotobynumber_r='$d_getprotobynumber_r'
22607d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
22608d_getprotoprotos='$d_getprotoprotos'
22609d_getprpwnam='$d_getprpwnam'
22610d_getpwent='$d_getpwent'
10bc17b6
JH
22611d_getpwent_r='$d_getpwent_r'
22612d_getpwnam_r='$d_getpwnam_r'
22613d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
22614d_getsbyname='$d_getsbyname'
22615d_getsbyport='$d_getsbyport'
22616d_getsent='$d_getsent'
10bc17b6
JH
22617d_getservbyname_r='$d_getservbyname_r'
22618d_getservbyport_r='$d_getservbyport_r'
22619d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
22620d_getservprotos='$d_getservprotos'
22621d_getspnam='$d_getspnam'
10bc17b6 22622d_getspnam_r='$d_getspnam_r'
b4eb6b3d 22623d_gettimeod='$d_gettimeod'
96938616 22624d_gmtime64='$d_gmtime64'
10bc17b6 22625d_gmtime_r='$d_gmtime_r'
5f80c64f 22626d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
22627d_grpasswd='$d_grpasswd'
22628d_hasmntopt='$d_hasmntopt'
22629d_htonl='$d_htonl'
55954f19 22630d_ilogbl='$d_ilogbl'
f3f1a2d8 22631d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
22632d_index='$d_index'
22633d_inetaton='$d_inetaton'
5086dff9
MB
22634d_inetntop='$d_inetntop'
22635d_inetpton='$d_inetpton'
b4eb6b3d
JH
22636d_int64_t='$d_int64_t'
22637d_isascii='$d_isascii'
758a5d79
JH
22638d_isfinite='$d_isfinite'
22639d_isinf='$d_isinf'
b4eb6b3d
JH
22640d_isnan='$d_isnan'
22641d_isnanl='$d_isnanl'
22642d_killpg='$d_killpg'
22643d_lchown='$d_lchown'
22644d_ldbl_dig='$d_ldbl_dig'
0a0abfba 22645d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 22646d_link='$d_link'
96938616 22647d_localtime64='$d_localtime64'
10bc17b6 22648d_localtime_r='$d_localtime_r'
8572b25d 22649d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
22650d_locconv='$d_locconv'
22651d_lockf='$d_lockf'
22652d_longdbl='$d_longdbl'
22653d_longlong='$d_longlong'
22654d_lseekproto='$d_lseekproto'
22655d_lstat='$d_lstat'
22656d_madvise='$d_madvise'
7dd121ae
MB
22657d_malloc_good_size='$d_malloc_good_size'
22658d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
22659d_mblen='$d_mblen'
22660d_mbstowcs='$d_mbstowcs'
22661d_mbtowc='$d_mbtowc'
22662d_memchr='$d_memchr'
22663d_memcmp='$d_memcmp'
22664d_memcpy='$d_memcpy'
22665d_memmove='$d_memmove'
22666d_memset='$d_memset'
22667d_mkdir='$d_mkdir'
22668d_mkdtemp='$d_mkdtemp'
22669d_mkfifo='$d_mkfifo'
22670d_mkstemp='$d_mkstemp'
22671d_mkstemps='$d_mkstemps'
96938616 22672d_mktime64='$d_mktime64'
b4eb6b3d
JH
22673d_mktime='$d_mktime'
22674d_mmap='$d_mmap'
22675d_modfl='$d_modfl'
e67aeab1 22676d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 22677d_modflproto='$d_modflproto'
b4eb6b3d
JH
22678d_mprotect='$d_mprotect'
22679d_msg='$d_msg'
22680d_msg_ctrunc='$d_msg_ctrunc'
22681d_msg_dontroute='$d_msg_dontroute'
22682d_msg_oob='$d_msg_oob'
22683d_msg_peek='$d_msg_peek'
22684d_msg_proxy='$d_msg_proxy'
22685d_msgctl='$d_msgctl'
22686d_msgget='$d_msgget'
4e0554ec 22687d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
22688d_msgrcv='$d_msgrcv'
22689d_msgsnd='$d_msgsnd'
22690d_msync='$d_msync'
22691d_munmap='$d_munmap'
22692d_mymalloc='$d_mymalloc'
a33f2d9f 22693d_ndbm='$d_ndbm'
e74475c7 22694d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
b4eb6b3d 22695d_nice='$d_nice'
2765b840 22696d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 22697d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 22698d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
22699d_off64_t='$d_off64_t'
22700d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22701d_oldpthreads='$d_oldpthreads'
22702d_oldsock='$d_oldsock'
22703d_open3='$d_open3'
22704d_pathconf='$d_pathconf'
22705d_pause='$d_pause'
22706d_perl_otherlibdirs='$d_perl_otherlibdirs'
22707d_phostname='$d_phostname'
22708d_pipe='$d_pipe'
22709d_poll='$d_poll'
5f80c64f 22710d_portable='$d_portable'
c796e3db
MB
22711d_prctl='$d_prctl'
22712d_prctl_set_name='$d_prctl_set_name'
dcb594bc 22713d_printf_format_null='$d_printf_format_null'
c7aff470 22714d_procselfexe='$d_procselfexe'
233e16ce 22715d_pseudofork='$d_pseudofork'
d6483fcc 22716d_pthread_atfork='$d_pthread_atfork'
58d975c3 22717d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
22718d_pthread_yield='$d_pthread_yield'
22719d_pwage='$d_pwage'
22720d_pwchange='$d_pwchange'
22721d_pwclass='$d_pwclass'
22722d_pwcomment='$d_pwcomment'
22723d_pwexpire='$d_pwexpire'
22724d_pwgecos='$d_pwgecos'
22725d_pwpasswd='$d_pwpasswd'
22726d_pwquota='$d_pwquota'
22727d_qgcvt='$d_qgcvt'
22728d_quad='$d_quad'
10bc17b6
JH
22729d_random_r='$d_random_r'
22730d_readdir64_r='$d_readdir64_r'
b4eb6b3d 22731d_readdir='$d_readdir'
10bc17b6 22732d_readdir_r='$d_readdir_r'
b4eb6b3d 22733d_readlink='$d_readlink'
4e0554ec
JH
22734d_readv='$d_readv'
22735d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
22736d_rename='$d_rename'
22737d_rewinddir='$d_rewinddir'
22738d_rmdir='$d_rmdir'
22739d_safebcpy='$d_safebcpy'
22740d_safemcpy='$d_safemcpy'
22741d_sanemcmp='$d_sanemcmp'
ef9f17be 22742d_sbrkproto='$d_sbrkproto'
55954f19 22743d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
22744d_sched_yield='$d_sched_yield'
22745d_scm_rights='$d_scm_rights'
22746d_seekdir='$d_seekdir'
22747d_select='$d_select'
22748d_sem='$d_sem'
22749d_semctl='$d_semctl'
22750d_semctl_semid_ds='$d_semctl_semid_ds'
22751d_semctl_semun='$d_semctl_semun'
22752d_semget='$d_semget'
22753d_semop='$d_semop'
4e0554ec 22754d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
22755d_setegid='$d_setegid'
22756d_seteuid='$d_seteuid'
22757d_setgrent='$d_setgrent'
10bc17b6 22758d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
22759d_setgrps='$d_setgrps'
22760d_sethent='$d_sethent'
10bc17b6 22761d_sethostent_r='$d_sethostent_r'
4e0554ec 22762d_setitimer='$d_setitimer'
b4eb6b3d
JH
22763d_setlinebuf='$d_setlinebuf'
22764d_setlocale='$d_setlocale'
10bc17b6 22765d_setlocale_r='$d_setlocale_r'
b4eb6b3d 22766d_setnent='$d_setnent'
10bc17b6 22767d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
22768d_setpent='$d_setpent'
22769d_setpgid='$d_setpgid'
22770d_setpgrp2='$d_setpgrp2'
22771d_setpgrp='$d_setpgrp'
22772d_setprior='$d_setprior'
22773d_setproctitle='$d_setproctitle'
10bc17b6 22774d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 22775d_setpwent='$d_setpwent'
10bc17b6 22776d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
22777d_setregid='$d_setregid'
22778d_setresgid='$d_setresgid'
22779d_setresuid='$d_setresuid'
22780d_setreuid='$d_setreuid'
22781d_setrgid='$d_setrgid'
22782d_setruid='$d_setruid'
22783d_setsent='$d_setsent'
10bc17b6 22784d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
22785d_setsid='$d_setsid'
22786d_setvbuf='$d_setvbuf'
22787d_sfio='$d_sfio'
22788d_shm='$d_shm'
22789d_shmat='$d_shmat'
22790d_shmatprototype='$d_shmatprototype'
22791d_shmctl='$d_shmctl'
22792d_shmdt='$d_shmdt'
22793d_shmget='$d_shmget'
22794d_sigaction='$d_sigaction'
ed140128 22795d_signbit='$d_signbit'
983dbef6 22796d_sigprocmask='$d_sigprocmask'
b4eb6b3d 22797d_sigsetjmp='$d_sigsetjmp'
c95d0e17 22798d_sitearch='$d_sitearch'
4f5da3e9 22799d_snprintf='$d_snprintf'
49a78c82 22800d_sockatmark='$d_sockatmark'
2ef53570 22801d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
22802d_socket='$d_socket'
22803d_socklen_t='$d_socklen_t'
22804d_sockpair='$d_sockpair'
22805d_socks5_init='$d_socks5_init'
360321b3 22806d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 22807d_sqrtl='$d_sqrtl'
10bc17b6
JH
22808d_srand48_r='$d_srand48_r'
22809d_srandom_r='$d_srandom_r'
eef837ea 22810d_sresgproto='$d_sresgproto'
640374d0 22811d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
22812d_statblks='$d_statblks'
22813d_statfs_f_flags='$d_statfs_f_flags'
22814d_statfs_s='$d_statfs_s'
17a6c8e3 22815d_static_inline='$d_static_inline'
b4eb6b3d
JH
22816d_statvfs='$d_statvfs'
22817d_stdio_cnt_lval='$d_stdio_cnt_lval'
22818d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
22819d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22820d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
22821d_stdio_stream_array='$d_stdio_stream_array'
22822d_stdiobase='$d_stdiobase'
22823d_stdstdio='$d_stdstdio'
22824d_strchr='$d_strchr'
22825d_strcoll='$d_strcoll'
22826d_strctcpy='$d_strctcpy'
22827d_strerrm='$d_strerrm'
22828d_strerror='$d_strerror'
10bc17b6 22829d_strerror_r='$d_strerror_r'
b3c85772 22830d_strftime='$d_strftime'
08c92000
MB
22831d_strlcat='$d_strlcat'
22832d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
22833d_strtod='$d_strtod'
22834d_strtol='$d_strtol'
22835d_strtold='$d_strtold'
22836d_strtoll='$d_strtoll'
28e5dec8 22837d_strtoq='$d_strtoq'
b4eb6b3d
JH
22838d_strtoul='$d_strtoul'
22839d_strtoull='$d_strtoull'
22840d_strtouq='$d_strtouq'
22841d_strxfrm='$d_strxfrm'
22842d_suidsafe='$d_suidsafe'
22843d_symlink='$d_symlink'
22844d_syscall='$d_syscall'
2ef53570 22845d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
22846d_sysconf='$d_sysconf'
22847d_sysernlst='$d_sysernlst'
22848d_syserrlst='$d_syserrlst'
22849d_system='$d_system'
22850d_tcgetpgrp='$d_tcgetpgrp'
22851d_tcsetpgrp='$d_tcsetpgrp'
22852d_telldir='$d_telldir'
22853d_telldirproto='$d_telldirproto'
22854d_time='$d_time'
cbb9e8a7 22855d_timegm='$d_timegm'
b4eb6b3d 22856d_times='$d_times'
14b90194
JH
22857d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22858d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 22859d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 22860d_truncate='$d_truncate'
10bc17b6 22861d_ttyname_r='$d_ttyname_r'
b4eb6b3d 22862d_tzname='$d_tzname'
4e0554ec
JH
22863d_u32align='$d_u32align'
22864d_ualarm='$d_ualarm'
b4eb6b3d
JH
22865d_umask='$d_umask'
22866d_uname='$d_uname'
22867d_union_semun='$d_union_semun'
758a5d79 22868d_unordered='$d_unordered'
bdf33aa7 22869d_unsetenv='$d_unsetenv'
4e0554ec 22870d_usleep='$d_usleep'
2ef53570 22871d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
22872d_ustat='$d_ustat'
22873d_vendorarch='$d_vendorarch'
22874d_vendorbin='$d_vendorbin'
22875d_vendorlib='$d_vendorlib'
6e1038e0 22876d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
22877d_vfork='$d_vfork'
22878d_void_closedir='$d_void_closedir'
22879d_voidsig='$d_voidsig'
22880d_voidtty='$d_voidtty'
22881d_volatile='$d_volatile'
22882d_vprintf='$d_vprintf'
4f5da3e9 22883d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
22884d_wait4='$d_wait4'
22885d_waitpid='$d_waitpid'
22886d_wcstombs='$d_wcstombs'
22887d_wctomb='$d_wctomb'
4e0554ec 22888d_writev='$d_writev'
5f80c64f
JH
22889d_xenix='$d_xenix'
22890date='$date'
b4eb6b3d
JH
22891db_hashtype='$db_hashtype'
22892db_prefixtype='$db_prefixtype'
640374d0
JH
22893db_version_major='$db_version_major'
22894db_version_minor='$db_version_minor'
22895db_version_patch='$db_version_patch'
b4eb6b3d
JH
22896defvoidused='$defvoidused'
22897direntrytype='$direntrytype'
22898dlext='$dlext'
5f80c64f 22899dlsrc='$dlsrc'
b4eb6b3d
JH
22900doublesize='$doublesize'
22901drand01='$drand01'
10bc17b6 22902drand48_r_proto='$drand48_r_proto'
5ac1e9b2 22903dtrace='$dtrace'
b4eb6b3d
JH
22904dynamic_ext='$dynamic_ext'
22905eagain='$eagain'
22906ebcdic='$ebcdic'
5f80c64f
JH
22907echo='$echo'
22908egrep='$egrep'
22909emacs='$emacs'
10bc17b6
JH
22910endgrent_r_proto='$endgrent_r_proto'
22911endhostent_r_proto='$endhostent_r_proto'
22912endnetent_r_proto='$endnetent_r_proto'
22913endprotoent_r_proto='$endprotoent_r_proto'
22914endpwent_r_proto='$endpwent_r_proto'
22915endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
22916eunicefix='$eunicefix'
22917exe_ext='$exe_ext'
22918expr='$expr'
b4eb6b3d 22919extensions='$extensions'
61c26d18 22920extern_C='$extern_C'
6fcddf3b 22921extras='$extras'
b4eb6b3d
JH
22922fflushNULL='$fflushNULL'
22923fflushall='$fflushall'
5f80c64f
JH
22924find='$find'
22925firstmakefile='$firstmakefile'
22926flex='$flex'
b4eb6b3d
JH
22927fpossize='$fpossize'
22928fpostype='$fpostype'
22929freetype='$freetype'
5440bc8e 22930from='$from'
b4eb6b3d
JH
22931full_ar='$full_ar'
22932full_csh='$full_csh'
22933full_sed='$full_sed'
2d736872 22934gccansipedantic='$gccansipedantic'
5b463ca7 22935gccosandvers='$gccosandvers'
5f80c64f 22936gccversion='$gccversion'
10bc17b6
JH
22937getgrent_r_proto='$getgrent_r_proto'
22938getgrgid_r_proto='$getgrgid_r_proto'
22939getgrnam_r_proto='$getgrnam_r_proto'
22940gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22941gethostbyname_r_proto='$gethostbyname_r_proto'
22942gethostent_r_proto='$gethostent_r_proto'
22943getlogin_r_proto='$getlogin_r_proto'
22944getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22945getnetbyname_r_proto='$getnetbyname_r_proto'
22946getnetent_r_proto='$getnetent_r_proto'
22947getprotobyname_r_proto='$getprotobyname_r_proto'
22948getprotobynumber_r_proto='$getprotobynumber_r_proto'
22949getprotoent_r_proto='$getprotoent_r_proto'
22950getpwent_r_proto='$getpwent_r_proto'
22951getpwnam_r_proto='$getpwnam_r_proto'
22952getpwuid_r_proto='$getpwuid_r_proto'
22953getservbyname_r_proto='$getservbyname_r_proto'
22954getservbyport_r_proto='$getservbyport_r_proto'
22955getservent_r_proto='$getservent_r_proto'
22956getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
22957gidformat='$gidformat'
22958gidsign='$gidsign'
22959gidsize='$gidsize'
22960gidtype='$gidtype'
5f80c64f 22961glibpth='$glibpth'
3c728e00 22962gmake='$gmake'
10bc17b6 22963gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 22964gnulibc_version='$gnulibc_version'
5f80c64f 22965grep='$grep'
b4eb6b3d
JH
22966groupcat='$groupcat'
22967groupstype='$groupstype'
5f80c64f 22968gzip='$gzip'
b4eb6b3d
JH
22969h_fcntl='$h_fcntl'
22970h_sysfile='$h_sysfile'
5f80c64f 22971hint='$hint'
b4eb6b3d 22972hostcat='$hostcat'
6e1038e0
MB
22973html1dir='$html1dir'
22974html1direxp='$html1direxp'
22975html3dir='$html3dir'
22976html3direxp='$html3direxp'
b4eb6b3d
JH
22977i16size='$i16size'
22978i16type='$i16type'
22979i32size='$i32size'
22980i32type='$i32type'
22981i64size='$i64size'
22982i64type='$i64type'
22983i8size='$i8size'
22984i8type='$i8type'
22985i_arpainet='$i_arpainet'
2a0de2c5 22986i_assert='$i_assert'
b4eb6b3d 22987i_bsdioctl='$i_bsdioctl'
10bc17b6 22988i_crypt='$i_crypt'
b4eb6b3d
JH
22989i_db='$i_db'
22990i_dbm='$i_dbm'
22991i_dirent='$i_dirent'
5f80c64f 22992i_dld='$i_dld'
b4eb6b3d
JH
22993i_dlfcn='$i_dlfcn'
22994i_fcntl='$i_fcntl'
22995i_float='$i_float'
758a5d79
JH
22996i_fp='$i_fp'
22997i_fp_class='$i_fp_class'
b4eb6b3d 22998i_gdbm='$i_gdbm'
a33f2d9f
AD
22999i_gdbm_ndbm='$i_gdbm_ndbm'
23000i_gdbmndbm='$i_gdbmndbm'
b4eb6b3d 23001i_grp='$i_grp'
b4eb6b3d
JH
23002i_ieeefp='$i_ieeefp'
23003i_inttypes='$i_inttypes'
2765b840 23004i_langinfo='$i_langinfo'
b4eb6b3d
JH
23005i_libutil='$i_libutil'
23006i_limits='$i_limits'
23007i_locale='$i_locale'
23008i_machcthr='$i_machcthr'
23009i_malloc='$i_malloc'
1cd66f7c 23010i_mallocmalloc='$i_mallocmalloc'
b4eb6b3d
JH
23011i_math='$i_math'
23012i_memory='$i_memory'
23013i_mntent='$i_mntent'
23014i_ndbm='$i_ndbm'
23015i_netdb='$i_netdb'
23016i_neterrno='$i_neterrno'
23017i_netinettcp='$i_netinettcp'
23018i_niin='$i_niin'
23019i_poll='$i_poll'
23020i_prot='$i_prot'
23021i_pthread='$i_pthread'
23022i_pwd='$i_pwd'
23023i_rpcsvcdbm='$i_rpcsvcdbm'
23024i_sfio='$i_sfio'
23025i_sgtty='$i_sgtty'
23026i_shadow='$i_shadow'
23027i_socks='$i_socks'
23028i_stdarg='$i_stdarg'
23029i_stddef='$i_stddef'
23030i_stdlib='$i_stdlib'
23031i_string='$i_string'
23032i_sunmath='$i_sunmath'
23033i_sysaccess='$i_sysaccess'
23034i_sysdir='$i_sysdir'
23035i_sysfile='$i_sysfile'
23036i_sysfilio='$i_sysfilio'
23037i_sysin='$i_sysin'
23038i_sysioctl='$i_sysioctl'
23039i_syslog='$i_syslog'
23040i_sysmman='$i_sysmman'
23041i_sysmode='$i_sysmode'
23042i_sysmount='$i_sysmount'
23043i_sysndir='$i_sysndir'
23044i_sysparam='$i_sysparam'
216dac04 23045i_syspoll='$i_syspoll'
b4eb6b3d
JH
23046i_sysresrc='$i_sysresrc'
23047i_syssecrt='$i_syssecrt'
23048i_sysselct='$i_sysselct'
23049i_syssockio='$i_syssockio'
23050i_sysstat='$i_sysstat'
23051i_sysstatfs='$i_sysstatfs'
23052i_sysstatvfs='$i_sysstatvfs'
23053i_systime='$i_systime'
23054i_systimek='$i_systimek'
23055i_systimes='$i_systimes'
23056i_systypes='$i_systypes'
23057i_sysuio='$i_sysuio'
23058i_sysun='$i_sysun'
23059i_sysutsname='$i_sysutsname'
23060i_sysvfs='$i_sysvfs'
23061i_syswait='$i_syswait'
23062i_termio='$i_termio'
23063i_termios='$i_termios'
23064i_time='$i_time'
23065i_unistd='$i_unistd'
23066i_ustat='$i_ustat'
23067i_utime='$i_utime'
23068i_values='$i_values'
23069i_varargs='$i_varargs'
23070i_varhdr='$i_varhdr'
23071i_vfork='$i_vfork'
5f80c64f 23072ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
23073inc_version_list='$inc_version_list'
23074inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
23075incpath='$incpath'
23076inews='$inews'
f3f1a2d8 23077initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
23078installarchlib='$installarchlib'
23079installbin='$installbin'
6e1038e0
MB
23080installhtml1dir='$installhtml1dir'
23081installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
23082installman1dir='$installman1dir'
23083installman3dir='$installman3dir'
23084installprefix='$installprefix'
23085installprefixexp='$installprefixexp'
23086installprivlib='$installprivlib'
23087installscript='$installscript'
23088installsitearch='$installsitearch'
23089installsitebin='$installsitebin'
8d2cbf27
JH
23090installsitehtml1dir='$installsitehtml1dir'
23091installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 23092installsitelib='$installsitelib'
91e123a8
JH
23093installsiteman1dir='$installsiteman1dir'
23094installsiteman3dir='$installsiteman3dir'
6e1038e0 23095installsitescript='$installsitescript'
b4eb6b3d
JH
23096installstyle='$installstyle'
23097installusrbinperl='$installusrbinperl'
23098installvendorarch='$installvendorarch'
23099installvendorbin='$installvendorbin'
8d2cbf27
JH
23100installvendorhtml1dir='$installvendorhtml1dir'
23101installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 23102installvendorlib='$installvendorlib'
91e123a8
JH
23103installvendorman1dir='$installvendorman1dir'
23104installvendorman3dir='$installvendorman3dir'
6e1038e0 23105installvendorscript='$installvendorscript'
b4eb6b3d 23106intsize='$intsize'
4b661809 23107issymlink='$issymlink'
b4eb6b3d
JH
23108ivdformat='$ivdformat'
23109ivsize='$ivsize'
23110ivtype='$ivtype'
23111known_extensions='$known_extensions'
5f80c64f 23112ksh='$ksh'
5f80c64f
JH
23113ld='$ld'
23114lddlflags='$lddlflags'
23115ldflags='$ldflags'
b4eb6b3d
JH
23116ldflags_uselargefiles='$ldflags_uselargefiles'
23117ldlibpthname='$ldlibpthname'
5f80c64f
JH
23118less='$less'
23119lib_ext='$lib_ext'
23120libc='$libc'
b4eb6b3d 23121libperl='$libperl'
5f80c64f
JH
23122libpth='$libpth'
23123libs='$libs'
43999f95
JH
23124libsdirs='$libsdirs'
23125libsfiles='$libsfiles'
23126libsfound='$libsfound'
13b3f787 23127libspath='$libspath'
5f80c64f 23128libswanted='$libswanted'
b4eb6b3d 23129libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
23130line='$line'
23131lint='$lint'
23132lkflags='$lkflags'
23133ln='$ln'
23134lns='$lns'
10bc17b6 23135localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
23136locincpth='$locincpth'
23137loclibpth='$loclibpth'
b4eb6b3d
JH
23138longdblsize='$longdblsize'
23139longlongsize='$longlongsize'
23140longsize='$longsize'
5f80c64f
JH
23141lp='$lp'
23142lpr='$lpr'
23143ls='$ls'
b4eb6b3d
JH
23144lseeksize='$lseeksize'
23145lseektype='$lseektype'
a724edfe 23146mad='$mad'
f3f1a2d8
MB
23147madlyh='$madlyh'
23148madlyobj='$madlyobj'
23149madlysrc='$madlysrc'
5f80c64f
JH
23150mail='$mail'
23151mailx='$mailx'
23152make='$make'
23153make_set_make='$make_set_make'
b4eb6b3d
JH
23154mallocobj='$mallocobj'
23155mallocsrc='$mallocsrc'
23156malloctype='$malloctype'
23157man1dir='$man1dir'
23158man1direxp='$man1direxp'
23159man1ext='$man1ext'
23160man3dir='$man3dir'
23161man3direxp='$man3direxp'
23162man3ext='$man3ext'
5f80c64f 23163mips_type='$mips_type'
5129fff4 23164mistrustnm='$mistrustnm'
5f80c64f 23165mkdir='$mkdir'
b4eb6b3d
JH
23166mmaptype='$mmaptype'
23167modetype='$modetype'
5f80c64f 23168more='$more'
b4eb6b3d 23169multiarch='$multiarch'
5f80c64f 23170mv='$mv'
b4eb6b3d
JH
23171myarchname='$myarchname'
23172mydomain='$mydomain'
23173myhostname='$myhostname'
5f80c64f
JH
23174myuname='$myuname'
23175n='$n'
2cc61e15 23176need_va_copy='$need_va_copy'
b4eb6b3d
JH
23177netdb_hlen_type='$netdb_hlen_type'
23178netdb_host_type='$netdb_host_type'
23179netdb_name_type='$netdb_name_type'
23180netdb_net_type='$netdb_net_type'
5f80c64f
JH
23181nm='$nm'
23182nm_opt='$nm_opt'
23183nm_so_opt='$nm_so_opt'
b4eb6b3d 23184nonxs_ext='$nonxs_ext'
5f80c64f 23185nroff='$nroff'
b4eb6b3d
JH
23186nvEUformat='$nvEUformat'
23187nvFUformat='$nvFUformat'
23188nvGUformat='$nvGUformat'
b68c599a 23189nv_overflows_integers_at='$nv_overflows_integers_at'
53133ed1 23190nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
23191nveformat='$nveformat'
23192nvfformat='$nvfformat'
23193nvgformat='$nvgformat'
23194nvsize='$nvsize'
23195nvtype='$nvtype'
23196o_nonblock='$o_nonblock'
5f80c64f 23197obj_ext='$obj_ext'
b4eb6b3d 23198old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 23199optimize='$optimize'
b4eb6b3d 23200orderlib='$orderlib'
5f80c64f
JH
23201osname='$osname'
23202osvers='$osvers'
b4eb6b3d 23203otherlibdirs='$otherlibdirs'
5f80c64f 23204package='$package'
b4eb6b3d
JH
23205pager='$pager'
23206passcat='$passcat'
23207patchlevel='$patchlevel'
5f80c64f 23208path_sep='$path_sep'
b4eb6b3d 23209perl5='$perl5'
5f80c64f 23210perl='$perl'
151e6568 23211perl_patchlevel='$perl_patchlevel'
17a6c8e3 23212perl_static_inline='$perl_static_inline'
b4eb6b3d 23213perladmin='$perladmin'
9c839522 23214perllibs='$perllibs'
b4eb6b3d 23215perlpath='$perlpath'
5f80c64f 23216pg='$pg'
b4eb6b3d
JH
23217phostname='$phostname'
23218pidtype='$pidtype'
5f80c64f
JH
23219plibpth='$plibpth'
23220pmake='$pmake'
23221pr='$pr'
b4eb6b3d
JH
23222prefix='$prefix'
23223prefixexp='$prefixexp'
23224privlib='$privlib'
23225privlibexp='$privlibexp'
f24dbf84 23226procselfexe='$procselfexe'
b4eb6b3d
JH
23227prototype='$prototype'
23228ptrsize='$ptrsize'
23229quadkind='$quadkind'
23230quadtype='$quadtype'
23231randbits='$randbits'
23232randfunc='$randfunc'
10bc17b6 23233random_r_proto='$random_r_proto'
b4eb6b3d
JH
23234randseedtype='$randseedtype'
23235ranlib='$ranlib'
23236rd_nodata='$rd_nodata'
10bc17b6
JH
23237readdir64_r_proto='$readdir64_r_proto'
23238readdir_r_proto='$readdir_r_proto'
b4eb6b3d 23239revision='$revision'
5f80c64f 23240rm='$rm'
5b813a60 23241rm_try='$rm_try'
5f80c64f 23242rmail='$rmail'
5440bc8e 23243run='$run'
5f80c64f 23244runnm='$runnm'
81c4fd9e
MB
23245sGMTIME_max='$sGMTIME_max'
23246sGMTIME_min='$sGMTIME_min'
73e6e416
MB
23247sLOCALTIME_max='$sLOCALTIME_max'
23248sLOCALTIME_min='$sLOCALTIME_min'
b4eb6b3d
JH
23249sPRIEUldbl='$sPRIEUldbl'
23250sPRIFUldbl='$sPRIFUldbl'
23251sPRIGUldbl='$sPRIGUldbl'
23252sPRIXU64='$sPRIXU64'
23253sPRId64='$sPRId64'
23254sPRIeldbl='$sPRIeldbl'
23255sPRIfldbl='$sPRIfldbl'
23256sPRIgldbl='$sPRIgldbl'
23257sPRIi64='$sPRIi64'
23258sPRIo64='$sPRIo64'
23259sPRIu64='$sPRIu64'
23260sPRIx64='$sPRIx64'
23261sSCNfldbl='$sSCNfldbl'
23262sched_yield='$sched_yield'
23263scriptdir='$scriptdir'
23264scriptdirexp='$scriptdirexp'
5f80c64f 23265sed='$sed'
b4eb6b3d
JH
23266seedfunc='$seedfunc'
23267selectminbits='$selectminbits'
23268selecttype='$selecttype'
5f80c64f 23269sendmail='$sendmail'
10bc17b6
JH
23270setgrent_r_proto='$setgrent_r_proto'
23271sethostent_r_proto='$sethostent_r_proto'
23272setlocale_r_proto='$setlocale_r_proto'
23273setnetent_r_proto='$setnetent_r_proto'
23274setprotoent_r_proto='$setprotoent_r_proto'
23275setpwent_r_proto='$setpwent_r_proto'
23276setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
23277sh='$sh'
23278shar='$shar'
23279sharpbang='$sharpbang'
b4eb6b3d
JH
23280shmattype='$shmattype'
23281shortsize='$shortsize'
23282shrpenv='$shrpenv'
5f80c64f 23283shsharp='$shsharp'
b4eb6b3d
JH
23284sig_count='$sig_count'
23285sig_name='$sig_name'
23286sig_name_init='$sig_name_init'
23287sig_num='$sig_num'
23288sig_num_init='$sig_num_init'
76d3c696 23289sig_size='$sig_size'
b4eb6b3d
JH
23290signal_t='$signal_t'
23291sitearch='$sitearch'
23292sitearchexp='$sitearchexp'
23293sitebin='$sitebin'
23294sitebinexp='$sitebinexp'
8d2cbf27
JH
23295sitehtml1dir='$sitehtml1dir'
23296sitehtml1direxp='$sitehtml1direxp'
23297sitehtml3dir='$sitehtml3dir'
23298sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
23299sitelib='$sitelib'
23300sitelib_stem='$sitelib_stem'
23301sitelibexp='$sitelibexp'
91e123a8
JH
23302siteman1dir='$siteman1dir'
23303siteman1direxp='$siteman1direxp'
23304siteman3dir='$siteman3dir'
23305siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
23306siteprefix='$siteprefix'
23307siteprefixexp='$siteprefixexp'
6e1038e0
MB
23308sitescript='$sitescript'
23309sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
23310sizesize='$sizesize'
23311sizetype='$sizetype'
5f80c64f
JH
23312sleep='$sleep'
23313smail='$smail'
5f80c64f 23314so='$so'
b4eb6b3d
JH
23315sockethdr='$sockethdr'
23316socketlib='$socketlib'
23317socksizetype='$socksizetype'
5f80c64f
JH
23318sort='$sort'
23319spackage='$spackage'
23320spitshell='$spitshell'
10bc17b6
JH
23321srand48_r_proto='$srand48_r_proto'
23322srandom_r_proto='$srandom_r_proto'
5f80c64f 23323src='$src'
b4eb6b3d
JH
23324ssizetype='$ssizetype'
23325startperl='$startperl'
5f80c64f 23326startsh='$startsh'
b4eb6b3d
JH
23327static_ext='$static_ext'
23328stdchar='$stdchar'
23329stdio_base='$stdio_base'
23330stdio_bufsiz='$stdio_bufsiz'
23331stdio_cnt='$stdio_cnt'
23332stdio_filbuf='$stdio_filbuf'
23333stdio_ptr='$stdio_ptr'
23334stdio_stream_array='$stdio_stream_array'
10bc17b6 23335strerror_r_proto='$strerror_r_proto'
b4eb6b3d 23336strings='$strings'
5f80c64f 23337submit='$submit'
b4eb6b3d
JH
23338subversion='$subversion'
23339sysman='$sysman'
5f80c64f
JH
23340tail='$tail'
23341tar='$tar'
5440bc8e 23342targetarch='$targetarch'
5f80c64f
JH
23343tbl='$tbl'
23344tee='$tee'
23345test='$test'
b4eb6b3d
JH
23346timeincl='$timeincl'
23347timetype='$timetype'
10bc17b6 23348tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 23349to='$to'
5f80c64f
JH
23350touch='$touch'
23351tr='$tr'
23352trnl='$trnl'
23353troff='$troff'
10bc17b6 23354ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
23355u16size='$u16size'
23356u16type='$u16type'
23357u32size='$u32size'
23358u32type='$u32type'
23359u64size='$u64size'
23360u64type='$u64type'
23361u8size='$u8size'
23362u8type='$u8type'
23363uidformat='$uidformat'
23364uidsign='$uidsign'
23365uidsize='$uidsize'
23366uidtype='$uidtype'
5f80c64f
JH
23367uname='$uname'
23368uniq='$uniq'
b4eb6b3d
JH
23369uquadtype='$uquadtype'
23370use5005threads='$use5005threads'
23371use64bitall='$use64bitall'
23372use64bitint='$use64bitint'
5440bc8e 23373usecrosscompile='$usecrosscompile'
1be1b388 23374usedevel='$usedevel'
5f80c64f 23375usedl='$usedl'
5ac1e9b2 23376usedtrace='$usedtrace'
15b61c98 23377usefaststdio='$usefaststdio'
b4eb6b3d
JH
23378useithreads='$useithreads'
23379uselargefiles='$uselargefiles'
23380uselongdouble='$uselongdouble'
19a100ff 23381usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
23382usemorebits='$usemorebits'
23383usemultiplicity='$usemultiplicity'
23384usemymalloc='$usemymalloc'
5f80c64f 23385usenm='$usenm'
b4eb6b3d
JH
23386useopcode='$useopcode'
23387useperlio='$useperlio'
23388useposix='$useposix'
9514c62b 23389usereentrant='$usereentrant'
d51aaa9d 23390userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
23391usesfio='$usesfio'
23392useshrplib='$useshrplib'
5f106f9c 23393usesitecustomize='$usesitecustomize'
29209bc5 23394usesocks='$usesocks'
b4eb6b3d
JH
23395usethreads='$usethreads'
23396usevendorprefix='$usevendorprefix'
23397usevfork='$usevfork'
5f80c64f
JH
23398usrinc='$usrinc'
23399uuname='$uuname'
b4eb6b3d
JH
23400uvXUformat='$uvXUformat'
23401uvoformat='$uvoformat'
23402uvsize='$uvsize'
23403uvtype='$uvtype'
23404uvuformat='$uvuformat'
23405uvxformat='$uvxformat'
d03b3b00 23406vaproto='$vaproto'
b4eb6b3d
JH
23407vendorarch='$vendorarch'
23408vendorarchexp='$vendorarchexp'
23409vendorbin='$vendorbin'
23410vendorbinexp='$vendorbinexp'
8d2cbf27
JH
23411vendorhtml1dir='$vendorhtml1dir'
23412vendorhtml1direxp='$vendorhtml1direxp'
23413vendorhtml3dir='$vendorhtml3dir'
23414vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
23415vendorlib='$vendorlib'
23416vendorlib_stem='$vendorlib_stem'
23417vendorlibexp='$vendorlibexp'
91e123a8
JH
23418vendorman1dir='$vendorman1dir'
23419vendorman1direxp='$vendorman1direxp'
23420vendorman3dir='$vendorman3dir'
23421vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
23422vendorprefix='$vendorprefix'
23423vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
23424vendorscript='$vendorscript'
23425vendorscriptexp='$vendorscriptexp'
b4eb6b3d 23426version='$version'
861eb78d 23427version_patchlevel_string='$version_patchlevel_string'
d56c5707 23428versiononly='$versiononly'
5f80c64f 23429vi='$vi'
b4eb6b3d 23430voidflags='$voidflags'
5f80c64f 23431xlibpth='$xlibpth'
3659ebf1
JH
23432yacc='$yacc'
23433yaccflags='$yaccflags'
5f80c64f
JH
23434zcat='$zcat'
23435zip='$zip'
23436EOT
23437
5f80c64f
JH
23438: add special variables
23439$test -f $src/patchlevel.h && \
d9421656 23440awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
0f04e85f 23441echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
a02608de 23442echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
23443
23444: propagate old symbols
23445if $test -f UU/config.sh; then
381aa1ff 23446 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
776a38e3
MB
23447 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23448 config.sh config.sh UU/oldconfig.sh |\
23449 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
23450 set X `cat UU/oldsyms`
23451 shift
23452 case $# in
23453 0) ;;
23454 *)
23455 cat <<EOM
23456Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23457EOM
776a38e3 23458 echo ": Variables propagated from previous config.sh file." >>config.sh
5f80c64f
JH
23459 for sym in `cat UU/oldsyms`; do
23460 echo " Propagating $hint variable "'$'"$sym..."
23461 eval 'tmp="$'"${sym}"'"'
23462 echo "$tmp" | \
23463 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23464 done
23465 ;;
23466 esac
23467fi
23468
23469: Finish up by extracting the .SH files
23470case "$alldone" in
23471exit)
23472 $rm -rf UU
24ccb310 23473 echo "Extraction done."
5f80c64f
JH
23474 exit 0
23475 ;;
23476cont)
23477 ;;
23478'')
23479 dflt=''
23480 nostick=true
23481 $cat <<EOM
23482
23483If you'd like to make any changes to the config.sh file before I begin
23484to configure things, do it as a shell escape now (e.g. !vi config.sh).
23485
23486EOM
23487 rp="Press return or use a shell escape to edit config.sh:"
23488 . UU/myread
23489 nostick=''
23490 case "$ans" in
23491 '') ;;
23492 *) : in case they cannot read
23493 sh 1>&4 -c "$ans";;
23494 esac
23495 ;;
23496esac
23497
23498: if this fails, just run all the .SH files by hand
23499. ./config.sh
23500
23501echo " "
23502exec 1>&4
a43e8593 23503pwd=`pwd`
5f80c64f 23504. ./UU/extract
6904989c 23505cd "$pwd"
5f80c64f
JH
23506
23507if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23508 dflt=y
23509 case "$silent" in
23510 true) ;;
23511 *)
23512 $cat <<EOM
23513
23514Now you need to generate make dependencies by running "$make depend".
23515You might prefer to run it in background: "$make depend > makedepend.out &"
23516It can take a while, so you might not want to run it right now.
23517
23518EOM
23519 ;;
23520 esac
23521 rp="Run $make depend now?"
23522 . UU/myread
23523 case "$ans" in
23524 y*)
3d5d58b1 23525 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
23526 ;;
23527 *)
23528 echo "You must run '$make depend' then '$make'."
23529 ;;
23530 esac
23531elif test -f [Mm]akefile; then
23532 echo " "
23533 echo "Now you must run a $make."
23534else
24ccb310 23535 echo "Configure done."
5f80c64f
JH
23536fi
23537
23538if $test -f Policy.sh; then
23539 $cat <<EOM
23540
23541If you compile $package on a different machine or from a different object
23542directory, copy the Policy.sh file from this object directory to the
23543new one before you run Configure -- this will help you with most of
23544the policy defaults.
23545
23546EOM
23547fi
23548if $test -f config.msg; then
23549 echo "Hmm. I also noted the following information while running:"
23550 echo " "
23551 $cat config.msg >&4
23552 $rm -f config.msg
23553fi
23554$rm -f kit*isdone ark*isdone
23555$rm -rf UU
23556
23557: End of Configure
23558