This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Since change 9c901649534a1360, vendorlib_stem isn't always added to @INC.
[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#
6e3b7bfa 33# Generated on Sat Feb 13 19:05:42 CET 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=''
a33c94aa 631d_procselfexe=''
f24dbf84 632procselfexe=''
b4eb6b3d
JH
633d_old_pthread_create_joinable=''
634old_pthread_create_joinable=''
d6483fcc 635d_pthread_atfork=''
58d975c3 636d_pthread_attr_setscope=''
b4eb6b3d
JH
637d_pthread_yield=''
638d_sched_yield=''
639sched_yield=''
640d_qgcvt=''
10bc17b6
JH
641d_random_r=''
642random_r_proto=''
643d_readdir64_r=''
644readdir64_r_proto=''
b4eb6b3d
JH
645d_readdir=''
646d_rewinddir=''
647d_seekdir=''
648d_telldir=''
10bc17b6
JH
649d_readdir_r=''
650readdir_r_proto=''
b4eb6b3d 651d_readlink=''
4e0554ec
JH
652d_readv=''
653d_recvmsg=''
b4eb6b3d
JH
654d_rename=''
655d_rmdir=''
656d_safebcpy=''
657d_safemcpy=''
658d_sanemcmp=''
ef9f17be 659d_sbrkproto=''
55954f19 660d_scalbnl=''
b4eb6b3d
JH
661d_select=''
662d_sem=''
663d_semctl=''
664d_semget=''
665d_semop=''
4e0554ec 666d_sendmsg=''
b4eb6b3d
JH
667d_setegid=''
668d_seteuid=''
669d_setgrent=''
10bc17b6
JH
670d_setgrent_r=''
671setgrent_r_proto=''
b4eb6b3d
JH
672d_setgrps=''
673d_sethent=''
10bc17b6
JH
674d_sethostent_r=''
675sethostent_r_proto=''
4e0554ec 676d_setitimer=''
b4eb6b3d
JH
677d_setlinebuf=''
678d_setlocale=''
10bc17b6
JH
679d_setlocale_r=''
680setlocale_r_proto=''
b4eb6b3d 681d_setnent=''
10bc17b6
JH
682d_setnetent_r=''
683setnetent_r_proto=''
b4eb6b3d
JH
684d_setpent=''
685d_setpgid=''
686d_setpgrp2=''
687d_bsdsetpgrp=''
688d_setpgrp=''
689d_setprior=''
690d_setproctitle=''
10bc17b6
JH
691d_setprotoent_r=''
692setprotoent_r_proto=''
b4eb6b3d 693d_setpwent=''
10bc17b6
JH
694d_setpwent_r=''
695setpwent_r_proto=''
b4eb6b3d
JH
696d_setregid=''
697d_setresgid=''
698d_setresuid=''
699d_setreuid=''
700d_setrgid=''
701d_setruid=''
702d_setsent=''
10bc17b6
JH
703d_setservent_r=''
704setservent_r_proto=''
b4eb6b3d
JH
705d_setsid=''
706d_setvbuf=''
707d_sfio=''
708usesfio=''
709d_shm=''
710d_shmat=''
711d_shmatprototype=''
712shmattype=''
713d_shmctl=''
714d_shmdt=''
715d_shmget=''
716d_sigaction=''
ed140128 717d_signbit=''
983dbef6 718d_sigprocmask=''
b4eb6b3d 719d_sigsetjmp=''
5f106f9c 720usesitecustomize=''
4f5da3e9
SP
721d_snprintf=''
722d_vsnprintf=''
49a78c82 723d_sockatmark=''
2ef53570 724d_sockatmarkproto=''
b4eb6b3d
JH
725d_msg_ctrunc=''
726d_msg_dontroute=''
727d_msg_oob=''
728d_msg_peek=''
729d_msg_proxy=''
730d_oldsock=''
731d_scm_rights=''
732d_socket=''
733d_sockpair=''
734sockethdr=''
735socketlib=''
736d_socklen_t=''
737d_socks5_init=''
360321b3 738d_sprintf_returns_strlen=''
b4eb6b3d 739d_sqrtl=''
10bc17b6
JH
740d_srand48_r=''
741srand48_r_proto=''
742d_srandom_r=''
743srandom_r_proto=''
eef837ea 744d_sresgproto=''
640374d0 745d_sresuproto=''
b4eb6b3d
JH
746d_statblks=''
747d_statfs_f_flags=''
748d_statfs_s=''
749d_fstatvfs=''
750d_statvfs=''
751d_stdio_cnt_lval=''
752d_stdio_ptr_lval=''
a7ffa9b9
NC
753d_stdio_ptr_lval_nochange_cnt=''
754d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
755d_stdiobase=''
756d_stdstdio=''
757stdio_base=''
758stdio_bufsiz=''
759stdio_cnt=''
760stdio_filbuf=''
761stdio_ptr=''
762d_index=''
763d_strchr=''
764d_strcoll=''
765d_strctcpy=''
766d_strerrm=''
767d_strerror=''
768d_sysernlst=''
769d_syserrlst=''
10bc17b6
JH
770d_strerror_r=''
771strerror_r_proto=''
b3c85772 772d_strftime=''
08c92000
MB
773d_strlcat=''
774d_strlcpy=''
b4eb6b3d
JH
775d_strtod=''
776d_strtol=''
777d_strtold=''
778d_strtoll=''
28e5dec8 779d_strtoq=''
b4eb6b3d
JH
780d_strtoul=''
781d_strtoull=''
782d_strtouq=''
783d_strxfrm=''
784d_symlink=''
785d_syscall=''
2ef53570 786d_syscallproto=''
b4eb6b3d
JH
787d_sysconf=''
788d_system=''
789d_tcgetpgrp=''
790d_tcsetpgrp=''
791d_telldirproto=''
792d_time=''
793timetype=''
96938616
MB
794d_asctime64=''
795d_ctime64=''
796d_difftime64=''
797d_gmtime64=''
798d_localtime64=''
799d_mktime64=''
cbb9e8a7 800d_timegm=''
b4eb6b3d
JH
801clocktype=''
802d_times=''
10bc17b6
JH
803d_tmpnam_r=''
804tmpnam_r_proto=''
b4eb6b3d 805d_truncate=''
10bc17b6
JH
806d_ttyname_r=''
807ttyname_r_proto=''
b4eb6b3d 808d_tzname=''
4e0554ec
JH
809d_u32align=''
810d_ualarm=''
b4eb6b3d
JH
811d_umask=''
812d_semctl_semid_ds=''
813d_semctl_semun=''
814d_union_semun=''
758a5d79 815d_unordered=''
bdf33aa7 816d_unsetenv=''
4e0554ec 817d_usleep=''
2ef53570 818d_usleepproto=''
b4eb6b3d 819d_ustat=''
233e16ce 820d_pseudofork=''
b4eb6b3d
JH
821d_vfork=''
822usevfork=''
823d_voidsig=''
824signal_t=''
825d_volatile=''
826d_charvspr=''
827d_vprintf=''
828d_wait4=''
829d_waitpid=''
830d_wcstombs=''
831d_wctomb=''
4e0554ec 832d_writev=''
b4eb6b3d 833dlext=''
f1ce3bf1 834bin_ELF=''
85e6fe83
LW
835cccdlflags=''
836ccdlflags=''
2304df62 837dlsrc=''
232e078e 838ld=''
85e6fe83 839lddlflags=''
2304df62 840usedl=''
b4eb6b3d
JH
841doublesize=''
842ebcdic=''
843fflushNULL=''
844fflushall=''
845fpossize=''
846fpostype=''
2d736872 847gccansipedantic=''
5b463ca7 848gccosandvers=''
8a27cf78 849gccversion=''
b4eb6b3d
JH
850gidformat=''
851gidsign=''
852gidsize=''
853gidtype=''
854groupstype=''
855h_fcntl=''
856h_sysfile=''
6e1038e0
MB
857html1dir=''
858html1direxp=''
859installhtml1dir=''
860html3dir=''
861html3direxp=''
862installhtml3dir=''
b4eb6b3d 863i_arpainet=''
c0bacbef 864i_assert=''
10bc17b6 865i_crypt=''
b4eb6b3d
JH
866db_hashtype=''
867db_prefixtype=''
640374d0
JH
868db_version_major=''
869db_version_minor=''
870db_version_patch=''
b4eb6b3d
JH
871i_db=''
872i_dbm=''
873i_rpcsvcdbm=''
874d_dirnamlen=''
875direntrytype=''
876i_dirent=''
a0d0e21e 877i_dld=''
b4eb6b3d
JH
878i_dlfcn=''
879i_fcntl=''
880i_float=''
758a5d79
JH
881i_fp=''
882i_fp_class=''
b4eb6b3d
JH
883i_gdbm=''
884d_grpasswd=''
885i_grp=''
b4eb6b3d
JH
886i_ieeefp=''
887i_inttypes=''
2765b840 888i_langinfo=''
b4eb6b3d
JH
889i_libutil=''
890i_limits=''
891i_locale=''
892i_machcthr=''
893i_malloc=''
1cd66f7c 894i_mallocmalloc=''
b4eb6b3d
JH
895i_math=''
896i_memory=''
897i_mntent=''
e74475c7
MHM
898d_gdbm_ndbm_h_uses_prototypes=''
899d_gdbmndbm_h_uses_prototypes=''
a33f2d9f 900d_ndbm=''
e74475c7 901d_ndbm_h_uses_prototypes=''
a33f2d9f
AD
902i_gdbm_ndbm=''
903i_gdbmndbm=''
b4eb6b3d
JH
904i_ndbm=''
905i_netdb=''
906i_neterrno=''
907i_netinettcp=''
908i_niin=''
909i_sysin=''
910i_poll=''
911i_prot=''
912i_pthread=''
913d_pwage=''
914d_pwchange=''
915d_pwclass=''
916d_pwcomment=''
917d_pwexpire=''
918d_pwgecos=''
919d_pwpasswd=''
920d_pwquota=''
921i_pwd=''
922i_sfio=''
923i_shadow=''
924i_socks=''
925i_stddef=''
926i_stdlib=''
927i_string=''
928strings=''
929i_sunmath=''
930i_sysaccess=''
931i_sysdir=''
932i_sysfile=''
933d_voidtty=''
934i_bsdioctl=''
935i_sysfilio=''
936i_sysioctl=''
937i_syssockio=''
938i_syslog=''
939i_sysmman=''
940i_sysmode=''
941i_sysmount=''
942i_sysndir=''
943i_sysparam=''
216dac04 944i_syspoll=''
b4eb6b3d
JH
945i_sysresrc=''
946i_syssecrt=''
947i_sysselct=''
948i_sysstat=''
949i_sysstatfs=''
950i_sysstatvfs=''
951i_systimes=''
952i_systypes=''
953i_sysuio=''
954i_sysun=''
955i_sysutsname=''
956i_sysvfs=''
957i_syswait=''
958i_sgtty=''
959i_termio=''
960i_termios=''
14b90194
JH
961d_tm_tm_gmtoff=''
962d_tm_tm_zone=''
b4eb6b3d
JH
963i_systime=''
964i_systimek=''
965i_time=''
966timeincl=''
967i_unistd=''
968i_ustat=''
969i_utime=''
970i_values=''
971i_stdarg=''
972i_varargs=''
973i_varhdr=''
974i_vfork=''
f3f1a2d8 975d_inc_version_list=''
b4eb6b3d
JH
976inc_version_list=''
977inc_version_list_init=''
978installprefix=''
979installprefixexp=''
980installstyle=''
981installusrbinperl=''
982intsize=''
983longsize=''
984shortsize=''
4b661809 985issymlink=''
2304df62 986libc=''
b4eb6b3d
JH
987ldlibpthname=''
988libperl=''
989shrpenv=''
990useshrplib=''
a0d0e21e 991glibpth=''
2304df62 992libpth=''
8e07c86e 993loclibpth=''
2304df62
AD
994plibpth=''
995xlibpth=''
1cfa4ec7 996ignore_versioned_solibs=''
2304df62 997libs=''
43999f95
JH
998libsdirs=''
999libsfiles=''
1000libsfound=''
13b3f787 1001libspath=''
85e6fe83 1002lns=''
b4eb6b3d
JH
1003d_PRIEUldbl=''
1004d_PRIFUldbl=''
1005d_PRIGUldbl=''
1006d_PRIeldbl=''
1007d_PRIfldbl=''
1008d_PRIgldbl=''
1009d_SCNfldbl=''
1010sPRIEUldbl=''
1011sPRIFUldbl=''
1012sPRIGUldbl=''
1013sPRIeldbl=''
1014sPRIfldbl=''
1015sPRIgldbl=''
1016sSCNfldbl=''
1017lseeksize=''
1018lseektype=''
d620c7b3 1019mad=''
00e74f14
NC
1020madlyh=''
1021madlyobj=''
1022madlysrc=''
f3f1a2d8
MB
1023make_set_make=''
1024d_mymalloc=''
1025freetype=''
b4eb6b3d
JH
1026mallocobj=''
1027mallocsrc=''
1028malloctype=''
9df442c2 1029usemallocwrap=''
b4eb6b3d
JH
1030usemymalloc=''
1031installman1dir=''
1032man1dir=''
1033man1direxp=''
1034man1ext=''
1035installman3dir=''
1036man3dir=''
1037man3direxp=''
1038man3ext=''
1039modetype=''
1040multiarch=''
1041mydomain=''
1042myhostname=''
1043phostname=''
2304df62
AD
1044c=''
1045n=''
b4eb6b3d
JH
1046d_eofnblk=''
1047eagain=''
1048o_nonblock=''
1049rd_nodata=''
2cc61e15 1050need_va_copy=''
b4eb6b3d
JH
1051netdb_hlen_type=''
1052netdb_host_type=''
1053netdb_name_type=''
1054netdb_net_type=''
1055groupcat=''
1056hostcat=''
1057passcat=''
1058orderlib=''
1059ranlib=''
1060d_perl_otherlibdirs=''
1061otherlibdirs=''
2304df62
AD
1062package=''
1063spackage=''
b4eb6b3d
JH
1064pager=''
1065api_revision=''
1066api_subversion=''
1067api_version=''
1068api_versionstring=''
1069patchlevel=''
151e6568 1070perl_patchlevel=''
b4eb6b3d
JH
1071revision=''
1072subversion=''
1073version=''
861eb78d 1074version_patchlevel_string=''
b4eb6b3d
JH
1075perl5=''
1076perladmin=''
1077perlpath=''
1078d_nv_preserves_uv=''
f607920a 1079d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1080i16size=''
1081i16type=''
1082i32size=''
1083i32type=''
1084i64size=''
1085i64type=''
1086i8size=''
1087i8type=''
1088ivsize=''
1089ivtype=''
b68c599a 1090nv_overflows_integers_at=''
4137585d 1091nv_preserves_uv_bits=''
b4eb6b3d
JH
1092nvsize=''
1093nvtype=''
1094u16size=''
1095u16type=''
1096u32size=''
1097u32type=''
1098u64size=''
1099u64type=''
1100u8size=''
1101u8type=''
1102uvsize=''
1103uvtype=''
1104ivdformat=''
1105nvEUformat=''
1106nvFUformat=''
1107nvGUformat=''
1108nveformat=''
1109nvfformat=''
1110nvgformat=''
1111uvXUformat=''
1112uvoformat=''
1113uvuformat=''
1114uvxformat=''
1115pidtype=''
1116prefix=''
1117prefixexp=''
1118installprivlib=''
1119privlib=''
1120privlibexp=''
1121prototype=''
1122ptrsize=''
1123d_PRIXU64=''
1124d_PRId64=''
1125d_PRIi64=''
1126d_PRIo64=''
1127d_PRIu64=''
1128d_PRIx64=''
1129sPRIXU64=''
1130sPRId64=''
1131sPRIi64=''
1132sPRIo64=''
1133sPRIu64=''
1134sPRIx64=''
1135d_quad=''
1136quadkind=''
1137quadtype=''
1138uquadtype=''
1139drand01=''
1140randbits=''
1141randfunc=''
1142randseedtype=''
1143seedfunc=''
1144installscript=''
1145scriptdir=''
1146scriptdirexp=''
1147selectminbits=''
1148selecttype=''
8ff267be 1149sh=''
b4eb6b3d
JH
1150sig_count=''
1151sig_name=''
1152sig_name_init=''
1153sig_num=''
1154sig_num_init=''
76d3c696 1155sig_size=''
f3f1a2d8 1156d_sitearch=''
b4eb6b3d
JH
1157installsitearch=''
1158sitearch=''
1159sitearchexp=''
1160installsitebin=''
1161sitebin=''
1162sitebinexp=''
8d2cbf27
JH
1163installsitehtml1dir=''
1164sitehtml1dir=''
1165sitehtml1direxp=''
1166installsitehtml3dir=''
1167sitehtml3dir=''
1168sitehtml3direxp=''
b4eb6b3d
JH
1169installsitelib=''
1170sitelib=''
1171sitelib_stem=''
1172sitelibexp=''
91e123a8
JH
1173installsiteman1dir=''
1174siteman1dir=''
1175siteman1direxp=''
1176installsiteman3dir=''
1177siteman3dir=''
1178siteman3direxp=''
b4eb6b3d
JH
1179siteprefix=''
1180siteprefixexp=''
6e1038e0
MB
1181installsitescript=''
1182sitescript=''
1183sitescriptexp=''
b4eb6b3d
JH
1184sizesize=''
1185sizetype=''
a0d0e21e 1186so=''
b4eb6b3d 1187socksizetype=''
2304df62
AD
1188sharpbang=''
1189shsharp=''
1190spitshell=''
dfe9444c 1191src=''
b4eb6b3d
JH
1192ssizetype=''
1193startperl=''
2304df62 1194startsh=''
b4eb6b3d
JH
1195stdchar=''
1196d_stdio_stream_array=''
1197stdio_stream_array=''
1198sysman=''
81c4fd9e
MB
1199sGMTIME_max=''
1200sGMTIME_min=''
73e6e416
MB
1201sLOCALTIME_max=''
1202sLOCALTIME_min=''
5ff3f7a4 1203trnl=''
b4eb6b3d
JH
1204uidformat=''
1205uidsign=''
1206uidsize=''
1207uidtype=''
1208archname64=''
1209use64bitall=''
1210use64bitint=''
34f1896b
MB
1211dtrace=''
1212usedtrace=''
15b61c98 1213usefaststdio=''
b4eb6b3d
JH
1214ccflags_uselargefiles=''
1215ldflags_uselargefiles=''
1216libswanted_uselargefiles=''
1217uselargefiles=''
1218uselongdouble=''
1219usemorebits=''
1220usemultiplicity=''
2304df62 1221nm_opt=''
40a7a20a 1222nm_so_opt=''
2304df62
AD
1223runnm=''
1224usenm=''
b4eb6b3d 1225useperlio=''
29209bc5 1226usesocks=''
b4eb6b3d
JH
1227d_oldpthreads=''
1228use5005threads=''
1229useithreads=''
9514c62b 1230usereentrant=''
b4eb6b3d 1231usethreads=''
2304df62 1232incpath=''
2304df62
AD
1233mips_type=''
1234usrinc=''
d03b3b00 1235vaproto=''
b4eb6b3d
JH
1236d_vendorarch=''
1237installvendorarch=''
1238vendorarch=''
1239vendorarchexp=''
1240d_vendorbin=''
1241installvendorbin=''
1242vendorbin=''
1243vendorbinexp=''
8d2cbf27
JH
1244installvendorhtml1dir=''
1245vendorhtml1dir=''
1246vendorhtml1direxp=''
1247installvendorhtml3dir=''
1248vendorhtml3dir=''
1249vendorhtml3direxp=''
b4eb6b3d
JH
1250d_vendorlib=''
1251installvendorlib=''
1252vendorlib=''
1253vendorlib_stem=''
1254vendorlibexp=''
91e123a8
JH
1255installvendorman1dir=''
1256vendorman1dir=''
1257vendorman1direxp=''
1258installvendorman3dir=''
1259vendorman3dir=''
1260vendorman3direxp=''
b4eb6b3d
JH
1261usevendorprefix=''
1262vendorprefix=''
1263vendorprefixexp=''
6e1038e0
MB
1264d_vendorscript=''
1265installvendorscript=''
1266vendorscript=''
1267vendorscriptexp=''
d56c5707 1268versiononly=''
b4eb6b3d
JH
1269defvoidused=''
1270voidflags=''
3659ebf1
JH
1271yacc=''
1272yaccflags=''
2304df62
AD
1273CONFIG=''
1274
34f1896b 1275: Detect odd OSs
ecfc5424
AD
1276define='define'
1277undef='undef'
1278smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1279rmlist=''
1280
1281: We must find out about Eunice early
1282eunicefix=':'
1283if test -f /etc/unixtovms; then
1284 eunicefix=/etc/unixtovms
1285fi
1286if test -f /etc/unixtovms.exe; then
1287 eunicefix=/etc/unixtovms.exe
1288fi
1289
cfb04860 1290: Set executable suffix now -- needed before hints available
6153ba32
PG
1291if test -f "/libs/version.library"; then
1292: Amiga OS
1293 _exe=""
1294elif test -f "/system/gnu_library/bin/ar.pm"; then
1295: Stratus VOS
cfb04860 1296 _exe=".pm"
6153ba32
PG
1297elif test -n "$DJGPP"; then
1298: DOS DJGPP
cfb04860 1299 _exe=".exe"
5c728af0 1300elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1301: OS/2 or cygwin
ba863942
JH
1302 _exe=".exe"
1303fi
868439a2 1304
1d8eaf8c 1305groupstype=''
b4eb6b3d 1306i_whoami=''
9da7673b
MB
1307: Trailing extension. Override this in a hint file, if needed.
1308: Extra object files, if any, needed on this platform.
1309archobjs=''
1310archname=''
64615a5e 1311libnames=''
732c9516
JH
1312: change the next line if compiling for Xenix/286 on Xenix/386
1313xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1314: Possible local library directories to search.
1315loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1316loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1317
1318: general looking path for locating libraries
5869b1f1 1319glibpth="/lib /usr/lib $xlibpth"
732c9516 1320glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1321test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1322test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1323test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1324
1325: Private path used by Configure to find libraries. Its value
1326: is prepended to libpth. This variable takes care of special
1327: machines, like the mips. Usually, it should be empty.
1328plibpth=''
1329
1cfa4ec7
GS
1330: default library list
1331libswanted=''
921b2963 1332: some systems want to use only the non-versioned libso:s
1cfa4ec7 1333ignore_versioned_solibs=''
ed140128
AD
1334: set usethreads on the Configure command line to enable threads.
1335usereentrant='undef'
1336: full support for void wanted by default
1337defvoidused=15
1338
1339: Possible local include directories to search.
1340: Set locincpth to "" in a hint file to defeat local include searches.
1341locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1342locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1343:
1344: no include file wanted by default
1345inclwanted=''
1346
1347: Enable -DEBUGGING and -DDEBUGGING from the command line
1348EBUGGING=''
1349DEBUGGING=old
1350
1351ccname=''
1352ccversion=''
1353perllibs=''
1354: set useposix=false in your hint file to disable the POSIX extension.
1355useposix=true
1356: set useopcode=false in your hint file to disable the Opcode extension.
1357useopcode=true
b4eb6b3d
JH
1358archname64=''
1359ccflags_uselargefiles=''
1360ldflags_uselargefiles=''
1361libswanted_uselargefiles=''
1362: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1363: set usesocks on the Configure command line to enable socks.
ecfc5424 1364: List of libraries we want.
15431986 1365: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef 1366libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8119684f 1367libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1368: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1369: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1370glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1371glibpth="/usr/shlib $glibpth"
1372: Do not use vfork unless overridden by a hint file.
1373usevfork=false
1374
8ff267be 1375: Find the basic shell for Bourne shell scripts
1376case "$sh" in
1377'')
8ff267be 1378 case "$SYSTYPE" in
1379 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1380 *) xxx='/bin/sh';;
1381 esac
1382 if test -f "$xxx"; then
1383 sh="$xxx"
1384 else
1385 : Build up a list and do a single loop so we can 'break' out.
1386 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1387 for xxx in sh bash ksh pdksh ash; do
1388 for p in $pth; do
1389 try="$try ${p}/${xxx}"
1390 done
1391 done
1392 for xxx in $try; do
1393 if test -f "$xxx"; then
1394 sh="$xxx";
8ff267be 1395 break
a5a94ea5
JH
1396 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1397 sh="$xxx";
1398 break
8ff267be 1399 elif test -f "$xxx.exe"; then
1400 sh="$xxx";
8ff267be 1401 break
1402 fi
1403 done
1404 fi
1405 ;;
1406esac
1407
1408case "$sh" in
a33c94aa 1409'') cat >&2 <<EOM
8ff267be 1410$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1411
8ff267be 1412Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1413Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1414we'll try to straighten this all out.
8ff267be 1415EOM
1416 exit 1
1417 ;;
1418esac
1419
760ac839 1420: see if sh knows # comments
73614538 1421if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1422 shsharp=true
1423 spitshell=cat
760ac839 1424 xcat=/bin/cat
a931254c
JH
1425 test -f $xcat$_exe || xcat=/usr/bin/cat
1426 if test ! -f $xcat$_exe; then
4bdb8fb5 1427 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1428 if test -f $p/cat$_exe; then
1deb0a86 1429 xcat=$p/cat
3c728e00
JH
1430 break
1431 fi
1432 done
1deb0a86
JH
1433 if test ! -f $xcat$_exe; then
1434 echo "Can't find cat anywhere!"
3c728e00
JH
1435 exit 1
1436 fi
1437 fi
5440bc8e
JH
1438 echo "#!$xcat" >sharp
1439 $eunicefix sharp
1440 chmod +x sharp
1d8eaf8c 1441 ./sharp > today 2>/dev/null
760ac839 1442 if test -s today; then
760ac839
LW
1443 sharpbang='#!'
1444 else
5440bc8e
JH
1445 echo "#! $xcat" > sharp
1446 $eunicefix sharp
1447 chmod +x sharp
1d8eaf8c 1448 ./sharp > today 2>/dev/null
760ac839 1449 if test -s today; then
760ac839
LW
1450 sharpbang='#! '
1451 else
760ac839
LW
1452 sharpbang=': use '
1453 fi
1454 fi
1455else
dfe9444c 1456 echo " "
8ff267be 1457 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1458 shsharp=false
1459 cd ..
1460 echo "exec grep -v '^[ ]*#'" >spitshell
1461 chmod +x spitshell
1462 $eunicefix spitshell
1463 spitshell=`pwd`/spitshell
1464 cd UU
1465 echo "I presume that if # doesn't work, #! won't work either!"
1466 sharpbang=': use '
1467fi
5440bc8e 1468rm -f sharp today
760ac839
LW
1469
1470: figure out how to guarantee sh startup
8ff267be 1471case "$startsh" in
1472'') startsh=${sharpbang}${sh} ;;
1473*)
760ac839 1474esac
5440bc8e 1475cat >sharp <<EOSS
760ac839
LW
1476$startsh
1477set abc
1478test "$?abc" != 1
1479EOSS
1480
5440bc8e
JH
1481chmod +x sharp
1482$eunicefix sharp
1483if ./sharp; then
8ff267be 1484 : echo "Yup, it does."
760ac839 1485else
dfe9444c
AD
1486 echo "Hmm... '$startsh' does not guarantee sh startup..."
1487 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1488fi
5440bc8e 1489rm -f sharp
760ac839 1490
aebf16e7
AD
1491: Save command line options in file UU/cmdline.opt for later use in
1492: generating config.sh.
1493cat > cmdline.opt <<EOSH
613d6c3e 1494: Configure command line arguments.
aebf16e7
AD
1495config_arg0='$0'
1496config_args='$*'
1497config_argc=$#
1498EOSH
1499argn=1
ee45ea83
IZ
1500args_exp=''
1501args_sep=''
aebf16e7
AD
1502for arg in "$@"; do
1503 cat >>cmdline.opt <<EOSH
1504config_arg$argn='$arg'
1505EOSH
ee45ea83
IZ
1506 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1507$arg
1508EOC
1509 arg_exp=`cat cmdl.opt`
1510 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1511 argn=`expr $argn + 1`
ee45ea83 1512 args_sep=' '
aebf16e7 1513done
ee45ea83 1514rm -f cmdl.opt
aebf16e7 1515
2304df62
AD
1516: produce awk script to parse command line options
1517cat >options.awk <<'EOF'
1518BEGIN {
02e93a22 1519 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1520
1521 len = length(optstr);
1522 for (i = 1; i <= len; i++) {
1523 c = substr(optstr, i, 1);
1524 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1525 if (a == ":") {
1526 arg[c] = 1;
1527 i++;
1528 }
1529 opt[c] = 1;
1530 }
1531}
1532{
1533 expect = 0;
1534 str = $0;
1535 if (substr(str, 1, 1) != "-") {
1536 printf("'%s'\n", str);
1537 next;
1538 }
1539 len = length($0);
1540 for (i = 2; i <= len; i++) {
1541 c = substr(str, i, 1);
1542 if (!opt[c]) {
1543 printf("-%s\n", substr(str, i));
1544 next;
1545 }
1546 printf("-%s\n", c);
1547 if (arg[c]) {
1548 if (i < len)
1549 printf("'%s'\n", substr(str, i + 1));
1550 else
1551 expect = 1;
1552 next;
1553 }
1554 }
1555}
1556END {
1557 if (expect)
1558 print "?";
1559}
1560EOF
1561
1562: process the command line options
4633a7c4
LW
1563set X `for arg in "$@"; do echo "X$arg"; done |
1564 sed -e s/X// | awk -f options.awk`
2304df62
AD
1565eval "set $*"
1566shift
1567rm -f options.awk
1568
1569: set up default values
1570fastread=''
1571reuseval=false
1572config_sh=''
1573alldone=''
1574error=''
1575silent=''
1576extractsh=''
ecfc5424 1577override=''
16d20bd9 1578knowitall=''
02e93a22 1579rm -f optdef.sh posthint.sh
28757baa 1580cat >optdef.sh <<EOS
1581$startsh
1582EOS
2304df62 1583
dfe9444c 1584
2304df62
AD
1585: option parsing
1586while test $# -gt 0; do
1587 case "$1" in
1588 -d) shift; fastread=yes;;
1589 -e) shift; alldone=cont;;
1590 -f)
1591 shift
1592 cd ..
1593 if test -r "$1"; then
1594 config_sh="$1"
1595 else
a0d0e21e 1596 echo "$me: cannot read config file $1." >&2
2304df62
AD
1597 error=true
1598 fi
1599 cd UU
1600 shift;;
3f30fabf 1601 --help|\
2304df62
AD
1602 -h) shift; error=true;;
1603 -r) shift; reuseval=true;;
dfe9444c 1604 -s) shift; silent=true; realsilent=true;;
2304df62 1605 -E) shift; alldone=exit;;
16d20bd9 1606 -K) shift; knowitall=true;;
ecfc5424 1607 -O) shift; override=true;;
dfe9444c 1608 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1609 -D)
1610 shift
1611 case "$1" in
1612 *=)
1613 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1614 echo "$me: ignoring -D $1" >&2
1615 ;;
ecfc5424 1616 *=*) echo "$1" | \
1aef975c
AD
1617 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1618 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1619 esac
1620 shift
1621 ;;
1622 -U)
1623 shift
1624 case "$1" in
1aef975c 1625 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1626 *=*)
1627 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1628 echo "$me: ignoring -U $1" >&2
1629 ;;
1aef975c 1630 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1631 esac
1632 shift
1633 ;;
02e93a22
JH
1634 -A)
1635 shift
1636 xxx=''
1637 yyy="$1"
02e93a22 1638 zzz=''
5f83a3e9 1639 uuu=undef
02e93a22 1640 case "$yyy" in
f7c31117 1641 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1642 case "$zzz" in
1643 *:*) zzz='' ;;
1644 *) xxx=append
613d6c3e 1645 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
f7c31117 1646 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1647 esac
1648 ;;
1649 esac
1650 case "$xxx" in
1651 '') case "$yyy" in
f7c31117
JH
1652 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1653 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1654 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1655 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1656 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1657 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9 1658 esac
613d6c3e 1659 ;;
5f83a3e9 1660 esac
02e93a22
JH
1661 case "$xxx" in
1662 append)
5f83a3e9 1663 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1664 clear)
5f83a3e9 1665 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1666 define)
1667 case "$zzz" in
1668 '') zzz=define ;;
1669 esac
5f83a3e9 1670 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1671 eval)
5f83a3e9 1672 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1673 prepend)
5f83a3e9 1674 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1675 undef)
1676 case "$zzz" in
1677 '') zzz="$uuu" ;;
1678 esac
5f83a3e9
JH
1679 echo "$yyy=$zzz" >> posthint.sh ;;
1680 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1681 esac
bde6b06b 1682 shift
02e93a22 1683 ;;
216dac04 1684 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
5f83a3e9 1685 exit 0;;
2304df62 1686 --) break;;
a0d0e21e 1687 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1688 *) break;;
1689 esac
1690done
1691
1692case "$error" in
1693true)
1694 cat >&2 <<EOM
2afac517 1695Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1696 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1697 -d : use defaults for all answers.
1698 -e : go on without questioning past the production of config.sh.
1699 -f : specify an alternate default configuration file.
1700 -h : print this help message and exit (with an error status).
1701 -r : reuse C symbols value if possible (skips costly nm extraction).
1702 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1703 -D : define symbol to have some value:
1704 -D symbol symbol gets the value 'define'
1705 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1706 common used examples (see INSTALL for more info):
1707 -Duse64bitint use 64bit integers
b79e0b55 1708 -Duse64bitall use 64bit integers and pointers
3f30fabf 1709 -Dusethreads use thread support
b79e0b55 1710 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1711 -DEBUGGING=none DEBUGGING options
1712 -Dcc=gcc choose your compiler
1713 -Dprefix=/opt/perl5 choose your destination
2304df62 1714 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1715 -K : do not use unless you know what you are doing.
ecfc5424 1716 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1717 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1718 -U : undefine symbol:
1719 -U symbol symbol gets the value 'undef'
1720 -U symbol= symbol gets completely empty
3f30fabf 1721 e.g.: -Uversiononly
02e93a22 1722 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1723 -A append:symbol=value append value to symbol
1724 -A symbol=value like append:, but with a separating space
1725 -A define:symbol=value define symbol to have value
1726 -A clear:symbol define symbol to be ''
1727 -A define:symbol define symbol to be 'define'
1728 -A eval:symbol=value define symbol to be eval of value
1729 -A prepend:symbol=value prepend value to symbol
1730 -A undef:symbol define symbol to be 'undef'
1731 -A undef:symbol= define symbol to be ''
3f30fabf 1732 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1733 -A ccflags=-DSOME_MACRO
2304df62
AD
1734 -V : print version number and exit (with a zero status).
1735EOM
1736 exit 1
1737 ;;
1738esac
1739
dfe9444c
AD
1740: Sanity checks
1741case "$fastread$alldone" in
1742yescont|yesexit) ;;
1743*)
aaeb8e51
GS
1744 case "$extractsh" in
1745 true) ;;
1746 *)
1747 if test ! -t 0; then
1748 echo "Say 'sh Configure', not 'sh <Configure'"
1749 exit 1
1750 fi
1751 ;;
1752 esac
dfe9444c
AD
1753 ;;
1754esac
1755
2304df62
AD
1756exec 4>&1
1757case "$silent" in
1758true) exec 1>/dev/null;;
1759esac
1760
ecfc5424 1761: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1762touch optdef.sh
1763. ./optdef.sh
02e93a22
JH
1764: create the posthint manipulation script and leave the file out there...
1765touch posthint.sh
a0d0e21e 1766
2304df62 1767: set package name
34f1896b 1768package='perl5'
b4eb6b3d
JH
1769first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1770last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1771case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1772ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1773*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1774esac
2304df62 1775
2304df62
AD
1776: Some greps do not return status, grrr.
1777echo "grimblepritz" >grimble
1778if grep blurfldyick grimble >/dev/null 2>&1 ; then
1779 contains=contains
1780elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1781 contains=grep
1782else
1783 contains=contains
1784fi
1785rm -f grimble
1786: the following should work in any shell
1787case "$contains" in
1788contains*)
1789 echo " "
1790 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1791 cat >contains <<'EOSS'
1792grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1793EOSS
1794chmod +x contains
1795esac
1796
dfe9444c
AD
1797: Find the path to the source tree
1798case "$src" in
1799'') case "$0" in
b233458b
JH
1800 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1801 case "$src" in
1802 /*) ;;
8504afb7 1803 .) ;;
b233458b
JH
1804 *) src=`cd ../$src && pwd` ;;
1805 esac
1806 ;;
dfe9444c
AD
1807 *) src='.';;
1808 esac;;
1809esac
1810case "$src" in
1811'') src=/
1812 rsrc=/
1813 ;;
34f1896b
MB
1814/*) rsrc="$src";;
1815*) rsrc="../$src";;
dfe9444c
AD
1816esac
1817if test -f $rsrc/Configure && \
34f1896b 1818 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
dfe9444c
AD
1819then
1820 : found it, so we are ok.
1821else
1822 rsrc=''
1823 for src in . .. ../.. ../../.. ../../../..; do
1824 if test -f ../$src/Configure && \
1825 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1826 then
1827 rsrc=../$src
1828 break
1829 fi
1830 done
1831fi
1832case "$rsrc" in
1833'')
1834 cat <<EOM >&4
1835
1836Sorry, I can't seem to locate the source dir for $package. Please start
1837Configure with an explicit path -- i.e. /some/path/Configure.
1838
1839EOM
1840 exit 1
1841 ;;
1842../.) rsrc='..';;
1843*)
1844 echo " "
1845 echo "Sources for $package found in \"$src\"." >&4
1846 ;;
1847esac
1848
1849: script used to extract .SH files with variable substitutions
1850cat >extract <<'EOS'
a02608de 1851PERL_CONFIG_SH=true
dfe9444c 1852echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1853if test -f MANIFEST; then
1854 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1855else
1856 echo "(Looking for .SH files under the source directory.)"
6904989c 1857 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1858fi
1859shift
1860case $# in
6904989c 18610) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1862esac
6904989c 1863if test ! -f "$src/$1"; then
dfe9444c
AD
1864 shift
1865fi
1866mkdir_p='
1867name=$1;
1868create="";
1869while test $name; do
1870 if test ! -d "$name"; then
1871 create="$name $create";
1872 name=`echo $name | sed -e "s|^[^/]*$||"`;
1873 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1874 else
1875 name="";
1876 fi;
1877done;
1878for file in $create; do
1879 mkdir $file;
1880done
1881'
1882for file in $*; do
1883 case "$src" in
1884 ".")
1885 case "$file" in
1886 */*)
1887 dir=`expr X$file : 'X\(.*\)/'`
1888 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1889 (cd "$dir" && . ./$file)
dfe9444c
AD
1890 ;;
1891 *)
1892 . ./$file
1893 ;;
1894 esac
1895 ;;
1896 *)
1897 case "$file" in
1898 */*)
1899 dir=`expr X$file : 'X\(.*\)/'`
1900 file=`expr X$file : 'X.*/\(.*\)'`
1901 (set x $dir; shift; eval $mkdir_p)
6904989c 1902 sh <"$src/$dir/$file"
dfe9444c
AD
1903 ;;
1904 *)
6904989c 1905 sh <"$src/$file"
dfe9444c
AD
1906 ;;
1907 esac
1908 ;;
1909 esac
1910done
6904989c 1911if test -f "$src/config_h.SH"; then
dfe9444c
AD
1912 if test ! -f config.h; then
1913 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1914 . "$src/config_h.SH"
dfe9444c
AD
1915 fi
1916fi
1917EOS
1918
1919: extract files and exit if asked to do so
1920case "$extractsh" in
1921true)
1922 case "$realsilent" in
1923 true) ;;
1924 *) exec 1>&4;;
1925 esac
1926 case "$config_sh" in
1927 '') config_sh='config.sh';;
1928 esac
1929 echo " "
1930 echo "Fetching answers from $config_sh..."
1931 cd ..
1932 . $config_sh
1933 test "$override" && . ./optdef.sh
1934 echo " "
1935 . UU/extract
1936 rm -rf UU
24ccb310 1937 echo "Extraction done."
dfe9444c
AD
1938 exit 0
1939 ;;
1940esac
1941
1942: Eunice requires " " instead of "", can you believe it
1943echo " "
1944: Here we go...
1945echo "Beginning of configuration questions for $package."
1946
1947trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1948
2304df62
AD
1949: first determine how to suppress newline on echo command
1950echo " "
1951echo "Checking echo to see how to suppress newlines..."
1952(echo "hi there\c" ; echo " ") >.echotmp
1953if $contains c .echotmp >/dev/null 2>&1 ; then
1954 echo "...using -n."
1955 n='-n'
1956 c=''
1957else
1958 cat <<'EOM'
1959...using \c
1960EOM
1961 n=''
1962 c='\c'
1963fi
1964echo $n "The star should be here-->$c"
1965echo '*'
1966rm -f .echotmp
1967
1968: Now test for existence of everything in MANIFEST
1969echo " "
6904989c 1970if test -f "$rsrc/MANIFEST"; then
2304df62 1971 echo "First let's make sure your kit is complete. Checking..." >&4
1d8eaf8c 1972 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
776a38e3 1973 (split -l 50 2>/dev/null || split -50)
2304df62 1974 rm -f missing
dfe9444c 1975 tmppwd=`pwd`
2304df62 1976 for filelist in x??; do
776a38e3
MB
1977 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1978 >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1979 done
1980 if test -s missing; then
1981 cat missing >&4
1982 cat >&4 <<'EOM'
1983
1984THIS PACKAGE SEEMS TO BE INCOMPLETE.
1985
1986You have the option of continuing the configuration process, despite the
1987distinct possibility that your kit is damaged, by typing 'y'es. If you
1988do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1989and contact the author (perlbug@perl.org).
2304df62
AD
1990
1991EOM
1992 echo $n "Continue? [n] $c" >&4
1993 read ans
1994 case "$ans" in
1995 y*)
1996 echo "Continuing..." >&4
1997 rm -f missing
1998 ;;
1999 *)
2000 echo "ABORTING..." >&4
2001 kill $$
2002 ;;
2003 esac
2004 else
dfe9444c 2005 echo "Looks good..."
2304df62
AD
2006 fi
2007else
2008 echo "There is no MANIFEST file. I hope your kit is complete !"
2009fi
2010rm -f missing x??
2011
5ff3f7a4 2012: Find the appropriate value for a newline for tr
613d6c3e 2013echo " "
5ff3f7a4
GS
2014if test -n "$DJGPP"; then
2015 trnl='\012'
2016fi
2017if test X"$trnl" = X; then
2018 case "`echo foo|tr '\n' x 2>/dev/null`" in
2019 foox) trnl='\n' ;;
2020 esac
2021fi
2022if test X"$trnl" = X; then
2023 case "`echo foo|tr '\012' x 2>/dev/null`" in
2024 foox) trnl='\012' ;;
2025 esac
2026fi
2027if test X"$trnl" = X; then
8be2c24c
JH
2028 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2029 fooxy) trnl='\n\r' ;;
2030 esac
2031fi
2032if test X"$trnl" = X; then
5ff3f7a4
GS
2033 cat <<EOM >&2
2034
2035$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2036
2037EOM
2038 exit 1
2039fi
2040
2304df62
AD
2041: compute the number of columns on the terminal for proper question formatting
2042case "$COLUMNS" in
2043'') COLUMNS='80';;
2044esac
2045
2046: set up the echo used in my read
2047myecho="case \"\$xxxm\" in
2048'') echo $n \"\$rp $c\" >&4;;
2049*) case \"\$rp\" in
2050 '') echo $n \"[\$xxxm] $c\";;
2051 *)
2052 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2053 echo \"\$rp\" >&4
2054 echo $n \"[\$xxxm] $c\" >&4
2055 else
2056 echo $n \"\$rp [\$xxxm] $c\" >&4
2057 fi
2058 ;;
2059 esac;;
2060esac"
2061
2062: now set up to do reads with possible shell escape and default assignment
2063cat <<EOSC >myread
28757baa 2064$startsh
2304df62
AD
2065xxxm=\$dflt
2066$myecho
2067ans='!'
2068case "\$fastread" in
2069yes) case "\$dflt" in
2070 '') ;;
2071 *) ans='';
2072 case "\$silent-\$rp" in
2073 true-) ;;
2074 *) echo " " >&4;;
2075 esac;;
2076 esac;;
2077*) case "\$silent" in
2078 true) case "\$rp" in
2079 '') ans='';;
2080 esac;;
2081 esac;;
2082esac
2083while expr "X\$ans" : "X!" >/dev/null; do
2084 read answ
2085 set x \$xxxm
2086 shift
dfe9444c 2087 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2088 case "\$answ" in
dfe9444c
AD
2089 "!")
2090 sh 1>&4
2091 echo " "
2092 $myecho
2093 ;;
2094 !*)
2095 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2096 shift
2097 sh 1>&4 -c "\$*"
2098 echo " "
2099 $myecho
2100 ;;
2304df62
AD
2101 "\$ans")
2102 case "\$ans" in
ecfc5424
AD
2103 \\&*)
2104 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2105 shift
2106 case "\$1" in
2107 -d)
2108 fastread=yes
40a7a20a 2109 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2110 ;;
2111 -*)
40a7a20a 2112 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2113 ;;
2114 esac
2115 $myecho
2116 ans=!
2117 ;;
2304df62
AD
2118 esac;;
2119 *)
2120 case "\$aok" in
2121 y)
2122 echo "*** Substitution done -- please confirm."
2123 xxxm="\$ans"
c9795ab7 2124 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2125 xxxm="\$ans"
2126 ans=!
2127 ;;
2128 *)
2129 echo "*** Error -- try again."
2130 ans=!
2131 ;;
2132 esac
2133 $myecho
2134 ;;
2135 esac
2136 case "\$ans\$xxxm\$nostick" in
2137 '')
2138 ans=!
2139 $myecho
2140 ;;
2141 esac
2142done
2143case "\$ans" in
2144'') ans="\$xxxm";;
2145esac
2146EOSC
2147
2148: create .config dir to save info across Configure sessions
2149test -d ../.config || mkdir ../.config
2150cat >../.config/README <<EOF
2151This directory created by Configure to save information that should
dfe9444c 2152persist across sessions for $package.
2304df62
AD
2153
2154You may safely delete it if you wish.
2155EOF
2156
613d6c3e 2157: See if we are using a devel version and want that
9507cadf 2158xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2159case "$usedevel" in
1be1b388
MB
2160$define|true|[yY]*)
2161 usedevel="$define" ;;
9507cadf 2162*) case "$xversion" in
0107c034
JH
2163 *[13579])
2164 cat >&4 <<EOH
2165*** WHOA THERE!!! ***
2166
2167 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2168 The version of this $package distribution is $xversion, that is, odd,
2169 (as opposed to even) and that signifies a development release.
3d5d58b1 2170 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2171
2172 Do ***NOT*** install this into production use.
2173 Data corruption and crashes are possible.
2174
2175 It is most seriously suggested that you do not continue any further
2176 unless you want to help in developing and debugging Perl.
2177
6adc6a45
JH
2178 If you *still* want to build perl, you can answer 'y' now,
2179 or pass -Dusedevel to Configure.
2180
0107c034
JH
2181EOH
2182 rp='Do you really want to continue?'
2183 dflt='n'
2184 . ./myread
2185 case "$ans" in
8feeef0e
JH
2186 [yY]) echo >&4 "Okay, continuing."
2187 usedevel="$define" ;;
0107c034
JH
2188 *) echo >&4 "Okay, bye."
2189 exit 1
2190 ;;
2191 esac
2192 ;;
2193 esac
1be1b388 2194 usedevel="$undef"
0107c034
JH
2195 ;;
2196esac
8feeef0e
JH
2197case "$usedevel" in
2198$define|true|[yY]*)
2199 case "$versiononly" in
2200 '') versiononly="$define" ;;
2201 esac
2202 case "$installusrbinperl" in
2203 '') installusrbinperl="$undef" ;;
2204 esac
2205 ;;
2206esac
0107c034 2207
2304df62
AD
2208: general instructions
2209needman=true
2210firsttime=true
760ac839 2211user=`(logname) 2>/dev/null`
dfe9444c
AD
2212case "$user" in
2213'') user=`whoami 2>&1`;;
760ac839 2214esac
2304df62
AD
2215if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2216 firsttime=false
2217 echo " "
2218 rp='Would you like to see the instructions?'
2219 dflt=n
2220 . ./myread
2221 case "$ans" in
2222 [yY]*) ;;
2223 *) needman=false;;
2224 esac
2225fi
2226if $needman; then
2227 cat <<EOH
4e2a5f63 2228
2304df62 2229This installation shell script will examine your system and ask you questions
a0d0e21e 2230to determine how the perl5 package should be installed. If you get
2304df62
AD
2231stuck on a question, you may use a ! shell escape to start a subshell or
2232execute a command. Many of the questions will have default answers in square
2233brackets; typing carriage return will give you the default.
2234
2235On some of the questions which ask for file or directory names you are allowed
2236to use the ~name construct to specify the login directory belonging to "name",
2237even if you don't have a shell which knows about that. Questions where this is
2238allowed will be marked "(~name ok)".
2239
2240EOH
2241 rp=''
2242 dflt='Type carriage return to continue'
2243 . ./myread
2244 cat <<'EOH'
2245
2246The prompter used in this script allows you to use shell variables and
2247backticks in your answers. You may use $1, $2, etc... to refer to the words
2248in the default answer, as if the default line was a set of arguments given to a
2249script shell. This means you may also use $* to repeat the whole default line,
2250so you do not have to re-type everything to add something to the default.
2251
2252Everytime there is a substitution, you will have to confirm. If there is an
2253error (e.g. an unmatched backtick), the default answer will remain unchanged
2254and you will be prompted again.
2255
2256If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2257the questions and use the computed defaults (or the previous answers if there
2258was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2259You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2260on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2261
2262EOH
2263 . ./myread
2264 cat <<EOH
2265
2266Much effort has been expended to ensure that this shell script will run on any
2267Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2268Configure and run it again. If you can't run Configure for some reason,
2269you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2270have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2271
2272This installation script affects things in two ways:
2273
22741) it may do direct variable substitutions on some of the files included
2275 in this kit.
22762) it builds a config.h file for inclusion in C programs. You may edit
2277 any of these files as the need arises after running this script.
2278
2279If you make a mistake on a question, there is no easy way to back up to it
2280currently. The easiest thing to do is to edit config.sh and rerun all the SH
2281files. Configure will offer to let you do this before it runs the SH files.
2282
2283EOH
2284 dflt='Type carriage return to continue'
2285 . ./myread
2286 case "$firsttime" in
2287 true) echo $user >>../.config/instruct;;
2288 esac
2289fi
2290
2304df62
AD
2291: find out where common programs are
2292echo " "
2293echo "Locating common programs..." >&4
2294cat <<EOSC >loc
2295$startsh
2296case \$# in
22970) exit 1;;
2298esac
2299thing=\$1
2300shift
2301dflt=\$1
2302shift
2303for dir in \$*; do
2304 case "\$thing" in
2305 .)
2306 if test -d \$dir/\$thing; then
2307 echo \$dir
2308 exit 0
2309 fi
2310 ;;
2311 *)
a0d0e21e 2312 for thisthing in \$dir/\$thing; do
ecfc5424 2313 : just loop through to pick last item
a0d0e21e 2314 done
25f94b33 2315 if test -f \$thisthing; then
a0d0e21e 2316 echo \$thisthing
2304df62 2317 exit 0
a5a94ea5
JH
2318 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2319 echo \$thisthing
776a38e3 2320 exit 0
2304df62 2321 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2322 if test -n "$DJGPP"; then
2323 echo \$dir/\$thing.exe
b921d661 2324 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2325 : on Eunice apparently
2326 echo \$dir/\$thing
2327 fi
2d736872 2328 exit 0
2304df62
AD
2329 fi
2330 ;;
2331 esac
2332done
2333echo \$dflt
2334exit 1
2335EOSC
2336chmod +x loc
2337$eunicefix loc
2338loclist="
2339awk
2340cat
f8006fac 2341chmod
b4eb6b3d
JH
2342comm
2343cp
2304df62
AD
2344echo
2345expr
2346grep
a0d0e21e 2347ls
b4eb6b3d 2348mkdir
2304df62
AD
2349rm
2350sed
b4eb6b3d 2351sort
85e6fe83 2352touch
2304df62 2353tr
b4eb6b3d 2354uniq
2304df62
AD
2355"
2356trylist="
dfe9444c 2357ar
3659ebf1 2358bison
b4eb6b3d 2359byacc
2304df62 2360cpp
b4eb6b3d 2361csh
2304df62
AD
2362date
2363egrep
1fef16b3 2364gmake
8ff267be 2365gzip
b4eb6b3d 2366less
8ff267be 2367ln
3c728e00 2368make
b4eb6b3d 2369more
693762b4 2370nm
b4eb6b3d
JH
2371nroff
2372pg
2304df62
AD
2373test
2374uname
8ff267be 2375zip
2304df62 2376"
8e07c86e 2377pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2378pth="$pth /lib /usr/lib"
2379for file in $loclist; do
dfe9444c
AD
2380 eval xxx=\$$file
2381 case "$xxx" in
2382 /*|?:[\\/]*)
2383 if test -f "$xxx"; then
2384 : ok
2385 else
2386 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2387 xxx=`./loc $file $file $pth`
2388 fi
2389 ;;
2390 '') xxx=`./loc $file $file $pth`;;
2391 *) xxx=`./loc $xxx $xxx $pth`;;
2392 esac
a5a94ea5 2393 eval $file=$xxx$_exe
2304df62
AD
2394 eval _$file=$xxx
2395 case "$xxx" in
2396 /*)
2397 echo $file is in $xxx.
2398 ;;
8e07c86e
AD
2399 ?:[\\/]*)
2400 echo $file is in $xxx.
2401 ;;
2304df62 2402 *)
25f94b33
AD
2403 echo "I don't know where '$file' is, and my life depends on it." >&4
2404 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2405 exit 1
2304df62
AD
2406 ;;
2407 esac
2408done
2409echo " "
2410echo "Don't worry if any of the following aren't found..."
2411say=offhand
2412for file in $trylist; do
dfe9444c
AD
2413 eval xxx=\$$file
2414 case "$xxx" in
2415 /*|?:[\\/]*)
2416 if test -f "$xxx"; then
2417 : ok
2418 else
2419 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2420 xxx=`./loc $file $file $pth`
2421 fi
2422 ;;
2423 '') xxx=`./loc $file $file $pth`;;
2424 *) xxx=`./loc $xxx $xxx $pth`;;
2425 esac
306a8474 2426 eval $file=$xxx$_exe
2304df62
AD
2427 eval _$file=$xxx
2428 case "$xxx" in
2429 /*)
2430 echo $file is in $xxx.
2431 ;;
8e07c86e
AD
2432 ?:[\\/]*)
2433 echo $file is in $xxx.
2434 ;;
2304df62
AD
2435 *)
2436 echo "I don't see $file out there, $say."
2437 say=either
2438 ;;
2439 esac
2440done
2441case "$egrep" in
1fef16b3 2442egrep)
2304df62
AD
2443 echo "Substituting grep for egrep."
2444 egrep=$grep
868439a2 2445 _egrep=$grep
2304df62
AD
2446 ;;
2447esac
3141af47
MB
2448case "$less" in
2449'') ;;
2450*) if $less -R </dev/null >/dev/null; then
2451 echo "Substituting less -R for less."
2452 less="$less -R"
2453 _less=$less
2454 fi
2455 ;;
2456esac
8ff267be 2457case "$ln" in
1fef16b3 2458ln)
8ff267be 2459 echo "Substituting cp for ln."
2460 ln=$cp
868439a2 2461 _ln=$cp
8ff267be 2462 ;;
2463esac
2e26f1d5 2464case "$make" in
613d6c3e 2465make)
2e26f1d5
JH
2466 case "$gmake" in
2467 gmake)
2468 echo "I can't find make or gmake, and my life depends on it." >&4
2469 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2470 exit 1
2471 ;;
2472 esac
2473 ;;
613d6c3e 2474esac
2e26f1d5
JH
2475case "$gmake" in
2476gmake) ;;
2477*) # We can't have osname yet.
1fef16b3
JH
2478 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2479 # Assume that gmake, if found, is definitely GNU make
2480 # and prefer it over the system make.
2481 echo "Substituting gmake for make."
2482 make=$gmake
868439a2 2483 _make=$gmake
1fef16b3
JH
2484 fi
2485 ;;
a5a94ea5 2486esac
2304df62
AD
2487case "$test" in
2488test)
2489 echo "Hopefully test is built into your sh."
2490 ;;
2491*)
73614538 2492 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2493 echo "Using the test built into your sh."
2304df62
AD
2494 test=test
2495 _test=test
2496 fi
2497 ;;
2498esac
2499case "$echo" in
2500echo)
2501 echo "Hopefully echo is built into your sh."
2502 ;;
2503'') ;;
2504*)
2505 echo " "
2506echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2507 $echo $n "hi there$c" >foo1
2508 echo $n "hi there$c" >foo2
2509 if cmp foo1 foo2 >/dev/null 2>&1; then
2510 echo "They are compatible. In fact, they may be identical."
2511 else
2512 case "$n" in
2513 '-n') n='' c='\c';;
2514 *) n='-n' c='';;
2515 esac
2516 cat <<FOO
2517They are not compatible! You are probably running ksh on a non-USG system.
2518I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2519have echo built in and we may have to run some Bourne shell scripts. That
2520means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2521
2522FOO
2523 $echo $n "The star should be here-->$c"
2524 $echo "*"
2525 fi
2526 $rm -f foo1 foo2
2527 ;;
2528esac
2529
2f88d857
MB
2530# This question was auctioned at YAPC::Europe-2007 in Vienna
2531# I never promised you could answer it. I only auctioned the question.
2532cat <<FOO
2533The following message is sponsored by
2534
2535 Dresden.pm<--The stars should be here.
2536
2537Dear Perl user, system administrator or package
2538maintainer, the Perl community sends greetings to
2539you. Do you (emblematical) greet back [Y/n]? n
2540
2541FOO
2542
613d6c3e 2543: Check what type of C compiler we use
6b769f8f 2544cat <<EOS >trygcc
2573c5f9
JH
2545$startsh
2546EOS
6b769f8f 2547cat <<'EOSC' >>trygcc
2573c5f9
JH
2548case "$cc" in
2549'') ;;
2550*) $rm -f try try.*
2551 $cat >try.c <<EOM
2552int main(int argc, char *argv[]) {
2553 return 0;
2554}
2555EOM
e4778687 2556 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2557 :
2558 else
2559 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2560 despair=yes
2561 trygcc=yes
2562 case "$cc" in
2563 *gcc*) trygcc=no ;;
2564 esac
dce40316
AD
2565 # Skip this test because it gives a false match on output like:
2566 # ./trygcc: line 23: cc: command not found
2567 # case "`$cc -v -c try.c 2>&1`" in
2568 # *gcc*) trygcc=no ;;
2569 # esac
2573c5f9
JH
2570 if $test X"$trygcc" = Xyes; then
2571 if gcc -o try -c try.c; then
2572 echo " "
2573 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2574 # Switching compilers may undo the work of hints files.
2575 # The most common problem is -D_REENTRANT for threads.
2576 # This heuristic catches that case, but gets false positives
2577 # if -Dusethreads was not actually specified. Better to
2578 # bail out here with a useful message than fail
2579 # mysteriously later. Should we perhaps just try to
2580 # re-invoke Configure -Dcc=gcc config_args ?
2581 if $test -f usethreads.cbu; then
2582 $cat >&4 <<EOM
2583
2584*** However, any setting of the C compiler flags (e.g. for thread support)
2585*** will be lost. It may be necessary for you to restart Configure and
2586*** add -Dcc=gcc to your Configure command line.
2587
2588EOM
2589 rp="Would you like to go ahead and try gcc anyway?"
2590 dflt=n
2591 else
2592 rp="Would you like to use it?"
2593 dflt=y
2594 fi
2573c5f9
JH
2595 if $test -f myread; then
2596 . ./myread
2597 else
2598 if $test -f UU/myread; then
2599 . ./UU/myread
2600 else
2601 echo "Cannot find myread, sorry. Aborting." >&2
2602 exit 1
2603 fi
2604 fi
2605 case "$ans" in
6371411c 2606 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2607 esac
2608 fi
2609 fi
6b769f8f
RB
2610 fi
2611 $rm -f try try.*
2612 ;;
2613esac
2614EOSC
2615
2616cat <<EOS >checkcc
2617$startsh
2618EOS
2619cat <<'EOSC' >>checkcc
2620case "$cc" in
2621'') ;;
2622*) $rm -f try try.*
2623 $cat >try.c <<EOM
2624int main(int argc, char *argv[]) {
2625 return 0;
2626}
2627EOM
2628 if $cc -o try $ccflags $ldflags try.c; then
2629 :
2630 else
2573c5f9 2631 if $test X"$despair" = Xyes; then
6b769f8f
RB
2632 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2633 fi
2634 $cat >&4 <<EOM
5dd4fbdf
MB
2635You need to find a working C compiler.
2636Either (purchase and) install the C compiler supplied by your OS vendor,
2637or for a free C compiler try http://gcc.gnu.org/
2638I cannot continue any further, aborting.
2639EOM
6b769f8f 2640 exit 1
2573c5f9
JH
2641 fi
2642 $rm -f try try.*
2643 ;;
2644esac
2645EOSC
2646
a0d0e21e
LW
2647: determine whether symbolic links are supported
2648echo " "
2649$touch blurfl
2650if $ln -s blurfl sym > /dev/null 2>&1 ; then
2651 echo "Symbolic links are supported." >&4
818f00be 2652 lns="$ln -s"
a0d0e21e
LW
2653else
2654 echo "Symbolic links are NOT supported." >&4
2655 lns="$ln"
2656fi
2657$rm -f blurfl sym
2658
dafca956
JH
2659: determine whether symbolic links are supported
2660echo " "
2661case "$lns" in
18ea2752 2662*"ln"*" -s")
dafca956
JH
2663 echo "Checking how to test for symbolic links..." >&4
2664 $lns blurfl sym
4b661809 2665 if $test "X$issymlink" = X; then
2e2a97a6
JH
2666 case "$newsh" in
2667 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2668 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2669 esac
5d644a95
MB
2670 if test $? = 0; then
2671 issymlink="test -h"
2e2a97a6
JH
2672 else
2673 echo "Your builtin 'test -h' may be broken." >&4
2674 case "$test" in
2675 /*) ;;
2676 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2677 for p in $pth
2678 do
2679 if test -f "$p/$test"; then
2680 test="$p/$test"
2681 break
2682 fi
2683 done
2684 ;;
2685 esac
2686 case "$test" in
2687 /*)
2688 echo "Trying external '$test -h'." >&4
2689 issymlink="$test -h"
2690 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2691 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2692 issymlink=''
2693 fi
2694 ;;
2695 *) issymlink='' ;;
2696 esac
5d644a95
MB
2697 fi
2698 fi
4b661809 2699 if $test "X$issymlink" = X; then
dafca956 2700 if $test -L sym 2>/dev/null; then
5d644a95 2701 issymlink="$test -L"
2e2a97a6 2702 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2703 fi
2704 fi
4b661809 2705 if $test "X$issymlink" != X; then
5d644a95 2706 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2707 else
2708 echo "I do not know how you can test for symbolic links." >&4
2709 fi
2710 $rm -f blurfl sym
2711 ;;
2712*) echo "No symbolic links, so not testing for their testing..." >&4
2713 ;;
2714esac
2715echo " "
2716
34f1896b 2717: Make symlinks util
dafca956
JH
2718case "$mksymlinks" in
2719$define|true|[yY]*)
2720 case "$src" in
2721 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2722 exit 1
2723 ;;
4b661809 2724 *) case "$lns:$issymlink" in
f314eb9f 2725 *"ln"*" -s:"*"test -"?)
dafca956
JH
2726 echo "Creating the symbolic links..." >&4
2727 echo "(First creating the subdirectories...)" >&4
2728 cd ..
2729 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2730 read directory
2731 test -z "$directory" && break
2732 mkdir -p $directory
2733 done
2734 # Sanity check 1.
2735 if test ! -d t/base; then
2736 echo "Failed to create the subdirectories. Aborting." >&4
2737 exit 1
2738 fi
2739 echo "(Then creating the symlinks...)" >&4
2740 awk '{print $1}' $src/MANIFEST | while true; do
2741 read filename
2742 test -z "$filename" && break
2743 if test -f $filename; then
5d644a95 2744 if $issymlink $filename; then
dafca956
JH
2745 rm -f $filename
2746 fi
2747 fi
2748 if test -f $filename; then
2749 echo "$filename already exists, not symlinking."
2750 else
2751 ln -s $src/$filename $filename
2752 fi
2753 done
2754 # Sanity check 2.
a0d24b8a
JH
2755 if test ! -f t/base/lex.t; then
2756 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2757 exit 1
2758 fi
2759 cd UU
2760 ;;
2761 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2762 ;;
2763 esac
2764 ;;
2765 esac
2766 ;;
2767esac
2768
613d6c3e 2769: Check for Cross-Compilation
5440bc8e
JH
2770case "$usecrosscompile" in
2771$define|true|[yY]*)
93bc48fa 2772 $echo "Cross-compiling..."
5440bc8e
JH
2773 croak=''
2774 case "$cc" in
2775 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2776 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2777 ar=$targetarch-ar
2778 # leave out ld, choosing it is more complex
2779 nm=$targetarch-nm
2780 ranlib=$targetarch-ranlib
93bc48fa 2781 $echo 'extern int foo;' > try.c
f8006fac 2782 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2783 shift
2784 if $test $# -gt 0; then
2785 incpth="$incpth $*"
f8006fac
JH
2786 incpth="`$echo $incpth|$sed 's/^ //'`"
2787 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2788 for i in $*; do
f8006fac 2789 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2790 if $test -d $j; then
2791 libpth="$libpth $j"
2792 fi
2793 done
f8006fac
JH
2794 libpth="`$echo $libpth|$sed 's/^ //'`"
2795 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2796 fi
2797 $rm -f try.c
5440bc8e
JH
2798 ;;
2799 esac
2800 case "$targetarch" in
93bc48fa
JH
2801 '') echo "Targetarch not defined." >&4; croak=y ;;
2802 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2803 esac
2804 case "$incpth" in
93bc48fa 2805 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2806 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2807 esac
2808 case "$libpth" in
93bc48fa 2809 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2810 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2811 esac
93bc48fa
JH
2812 case "$usrinc" in
2813 '') for i in $incpth; do
2814 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2815 usrinc=$i
2816 echo "Guessing usrinc $usrinc." >&4
2817 break
2818 fi
2819 done
2820 case "$usrinc" in
2821 '') echo "Usrinc not defined." >&4; croak=y ;;
2822 esac
2823 ;;
2824 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2825 esac
93bc48fa
JH
2826 case "$targethost" in
2827 '') echo "Targethost not defined." >&4; croak=y ;;
2828 *) echo "Using targethost $targethost." >&4
5440bc8e 2829 esac
93bc48fa
JH
2830 locincpth=' '
2831 loclibpth=' '
5440bc8e 2832 case "$croak" in
93bc48fa 2833 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2834 esac
2835 case "$src" in
2836 /*) run=$src/Cross/run
93c0359c 2837 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2838 to=$src/Cross/to
2839 from=$src/Cross/from
2840 ;;
93bc48fa 2841 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2842 run=$pwd/Cross/run
f8006fac 2843 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2844 to=$pwd/Cross/to
2845 from=$pwd/Cross/from
2846 ;;
2847 esac
2848 case "$targetrun" in
2849 '') targetrun=ssh ;;
2850 esac
2851 case "$targetto" in
2852 '') targetto=scp ;;
2853 esac
2854 case "$targetfrom" in
2855 '') targetfrom=scp ;;
2856 esac
2857 run=$run-$targetrun
2858 to=$to-$targetto
2859 from=$from-$targetfrom
93bc48fa
JH
2860 case "$targetdir" in
2861 '') targetdir=/tmp
2862 echo "Guessing targetdir $targetdir." >&4
2863 ;;
2864 esac
5440bc8e 2865 case "$targetuser" in
93bc48fa
JH
2866 '') targetuser=root
2867 echo "Guessing targetuser $targetuser." >&4
2868 ;;
5440bc8e
JH
2869 esac
2870 case "$targetfrom" in
2871 scp) q=-q ;;
2872 *) q='' ;;
2873 esac
2874 case "$targetrun" in
2875 ssh|rsh)
2876 cat >$run <<EOF
2877#!/bin/sh
93c0359c
JH
2878case "\$1" in
2879-cwd)
2880 shift
2881 cwd=\$1
2882 shift
2883 ;;
2884esac
2885case "\$cwd" in
2886'') cwd=$targetdir ;;
2887esac
5440bc8e
JH
2888exe=\$1
2889shift
93c0359c
JH
2890if $test ! -f \$exe.xok; then
2891 $to \$exe
2892 $touch \$exe.xok
2893fi
2894$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2895EOF
2896 ;;
93bc48fa 2897 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2898 exit 1
2899 ;;
2900 esac
93c0359c
JH
2901 case "$targetmkdir" in
2902 */Cross/mkdir)
2903 cat >$targetmkdir <<EOF
2904#!/bin/sh
2905$targetrun -l $targetuser $targethost "mkdir -p \$@"
2906EOF
f8006fac 2907 $chmod a+rx $targetmkdir
93c0359c
JH
2908 ;;
2909 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2910 exit 1
2911 ;;
2912 esac
5440bc8e
JH
2913 case "$targetto" in
2914 scp|rcp)
2915 cat >$to <<EOF
2916#!/bin/sh
2917for f in \$@
2918do
93c0359c
JH
2919 case "\$f" in
2920 /*)
2921 $targetmkdir \`dirname \$f\`
2922 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2923 ;;
2924 *)
2925 $targetmkdir $targetdir/\`dirname \$f\`
2926 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2927 ;;
2928 esac
5440bc8e
JH
2929done
2930exit 0
2931EOF
2932 ;;
2933 cp) cat >$to <<EOF
2934#!/bin/sh
93c0359c
JH
2935for f in \$@
2936do
2937 case "\$f" in
2938 /*)
2939 $mkdir -p $targetdir/\`dirname \$f\`
2940 $cp \$f $targetdir/\$f || exit 1
2941 ;;
2942 *)
2943 $targetmkdir $targetdir/\`dirname \$f\`
2944 $cp \$f $targetdir/\$f || exit 1
2945 ;;
2946 esac
2947done
2948exit 0
5440bc8e
JH
2949EOF
2950 ;;
93bc48fa 2951 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2952 exit 1
2953 ;;
2954 esac
2955 case "$targetfrom" in
2956 scp|rcp)
2957 cat >$from <<EOF
2958#!/bin/sh
2959for f in \$@
2960do
93c0359c 2961 $rm -f \$f
5440bc8e
JH
2962 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2963done
2964exit 0
2965EOF
2966 ;;
2967 cp) cat >$from <<EOF
2968#!/bin/sh
2969for f in \$@
2970do
93c0359c 2971 $rm -f \$f
5440bc8e
JH
2972 cp $targetdir/\$f . || exit 1
2973done
2974exit 0
2975EOF
2976 ;;
93bc48fa 2977 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2978 exit 1
2979 ;;
2980 esac
93bc48fa
JH
2981 if $test ! -f $run; then
2982 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2983 else
f8006fac 2984 $chmod a+rx $run
5440bc8e 2985 fi
93bc48fa
JH
2986 if $test ! -f $to; then
2987 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2988 else
f8006fac 2989 $chmod a+rx $to
5440bc8e 2990 fi
93bc48fa
JH
2991 if $test ! -f $from; then
2992 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2993 else
f8006fac 2994 $chmod a+rx $from
5440bc8e 2995 fi
93bc48fa 2996 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2997 exit 1
2998 fi
2999 cat >&4 <<EOF
f8006fac
JH
3000Using '$run' for remote execution,
3001and '$from' and '$to'
93bc48fa 3002for remote file transfer.
5440bc8e
JH
3003EOF
3004 ;;
3005*) run=''
3006 to=:
3007 from=:
3008 usecrosscompile='undef'
3009 targetarch=''
3010 ;;
3011esac
3012
ecfc5424
AD
3013: see whether [:lower:] and [:upper:] are supported character classes
3014echo " "
ecfc5424
AD
3015case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3016ABYZ)
3017 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3018 up='[:upper:]'
3019 low='[:lower:]'
3020 ;;
416d0bea
MB
3021*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3022 # (0xd9 and 0xe2), therefore that is a nice testing point.
3023 if test "X$up" = X -o "X$low" = X; then
3024 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3025 rs) up='[A-Z]'
3026 low='[a-z]'
28e8609d
JH
3027 ;;
3028 esac
416d0bea 3029 fi
28e8609d 3030 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3031 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3032 rs) up='A-Z'
28e8609d
JH
3033 low='a-z'
3034 ;;
3035 esac
416d0bea 3036 fi
28e8609d 3037 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3038 case "`echo RS | od -x 2>/dev/null`" in
3039 *D9E2*|*d9e2*)
28e8609d
JH
3040 echo "Hey, this might be EBCDIC." >&4
3041 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3042 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3043 rs) up='[A-IJ-RS-Z]'
3044 low='[a-ij-rs-z]'
28e8609d
JH
3045 ;;
3046 esac
3047 fi
3048 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3049 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3050 rs) up='A-IJ-RS-Z'
3051 low='a-ij-rs-z'
28e8609d
JH
3052 ;;
3053 esac
3054 fi
3055 ;;
3056 esac
3057 fi
3058esac
416d0bea
MB
3059case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3060rs)
28e8609d
JH
3061 echo "Using $up and $low to convert case." >&4
3062 ;;
ecfc5424 3063*)
28e8609d
JH
3064 echo "I don't know how to translate letters from upper to lower case." >&4
3065 echo "Your tr is not acting any way I know of." >&4
3066 exit 1
3067 ;;
ecfc5424
AD
3068esac
3069: set up the translation script tr, must be called with ./tr of course
3070cat >tr <<EOSC
3071$startsh
3072case "\$1\$2" in
3073'[A-Z][a-z]') exec $tr '$up' '$low';;
3074'[a-z][A-Z]') exec $tr '$low' '$up';;
3075esac
3076exec $tr "\$@"
3077EOSC
3078chmod +x tr
3079$eunicefix tr
3080
2304df62
AD
3081: Try to determine whether config.sh was made on this system
3082case "$config_sh" in
3083'')
43999f95
JH
3084myuname=`$uname -a 2>/dev/null`
3085$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3086# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3087# because the A-Z/a-z are not consecutive.
34e09935 3088myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3eaeeeae 3089 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3090newmyuname="$myuname"
2304df62 3091dflt=n
16d20bd9
AD
3092case "$knowitall" in
3093'')
3094 if test -f ../config.sh; then
3095 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3096 eval "`grep myuname= ../config.sh`"
3097 fi
3098 if test "X$myuname" = "X$newmyuname"; then
3099 dflt=y
3100 fi
2304df62 3101 fi
16d20bd9
AD
3102 ;;
3103*) dflt=y;;
3104esac
2304df62
AD
3105
3106: Get old answers from old config file if Configure was run on the
3107: same system, otherwise use the hints.
3108hint=default
3109cd ..
3110if test -f config.sh; then
16d20bd9
AD
3111 echo " "
3112 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3113 . UU/myread
3114 case "$ans" in
f83701cd
AD
3115 n*|N*) echo "OK, I'll ignore it."
3116 mv config.sh config.sh.old
3117 myuname="$newmyuname"
3118 ;;
2304df62 3119 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3120 tmp_n="$n"
3121 tmp_c="$c"
85cad39c 3122 tmp_sh="$sh"
2304df62
AD
3123 . ./config.sh
3124 cp config.sh UU
ecfc5424
AD
3125 n="$tmp_n"
3126 c="$tmp_c"
85cad39c 3127 : Older versions did not always set $sh. Catch re-use of such
3128 : an old config.sh.
3129 case "$sh" in
3130 '') sh="$tmp_sh" ;;
3131 esac
2304df62
AD
3132 hint=previous
3133 ;;
3134 esac
3135fi
2573c5f9 3136. ./UU/checkcc
2304df62
AD
3137if test ! -f config.sh; then
3138 $cat <<EOM
3139
4e2a5f63
AD
3140First time through, eh? I have some defaults handy for some systems
3141that need some extra help getting the Configure answers right:
2304df62
AD
3142
3143EOM
dfe9444c 3144 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3145 dflt=''
3146 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3147 : tests or hints, please send them to perlbug@perl.org
2304df62 3148 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3149 $test -f /irix && osname=irix
85e6fe83
LW
3150 $test -f /xenix && osname=sco_xenix
3151 $test -f /dynix && osname=dynix
3152 $test -f /dnix && osname=dnix
5f05dabc 3153 $test -f /lynx.os && osname=lynxos
3154 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3155 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3156 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3157 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3158 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3159 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3160 $test -d /usr/apollo/bin && osname=apollo
3161 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3162 $test -d /usr/include/minix && osname=minix
d54344fc 3163 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3164 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3165 osname=machten
4633a7c4 3166 if $test -x /sbin/version; then
dfe9444c 3167 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3168 $sed -e 's/[A-Za-z]$//'`
3169 elif $test -x /usr/etc/version; then
dfe9444c 3170 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3171 $sed -e 's/[A-Za-z]$//'`
3172 else
3173 osvers="$2.$3"
3174 fi
3175 fi
aaacdc8b
GS
3176
3177 $test -f /sys/posix.dll &&
3178 $test -f /usr/bin/what &&
3179 set X `/usr/bin/what /sys/posix.dll` &&
3180 $test "$3" = UWIN &&
3181 osname=uwin &&
3182 osvers="$5"
3183
2304df62
AD
3184 if $test -f $uname; then
3185 set X $myuname
3186 shift
3187
2304df62 3188 case "$5" in
85e6fe83 3189 fps*) osname=fps ;;
2304df62
AD
3190 mips*)
3191 case "$4" in
85e6fe83
LW
3192 umips) osname=umips ;;
3193 *) osname=mips ;;
2304df62 3194 esac;;
85e6fe83
LW
3195 [23]100) osname=mips ;;
3196 next*) osname=next ;;
ecfc5424 3197 i386*)
c6912327
JH
3198 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3199 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3200 osname='sco'
3201 osvers=$tmp
3202 elif $test -f /etc/kconfig; then
ecfc5424 3203 osname=isc
bd628c73 3204 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3205 osvers=4
3206 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3207 osvers=3
2304df62 3208 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3209 osvers=2
ecfc5424
AD
3210 fi
3211 fi
2000072c 3212 tmp=''
ecfc5424 3213 ;;
c4f23d77
AD
3214 pc*)
3215 if test -n "$DJGPP"; then
3216 osname=dos
3217 osvers=djgpp
3218 fi
3219 ;;
2304df62
AD
3220 esac
3221
3222 case "$1" in
a0d0e21e
LW
3223 aix) osname=aix
3224 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3225 case "$tmp" in
e81c5c2a
NC
3226 # oslevel can fail with:
3227 # oslevel: Unable to acquire lock.
3228 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3229 '<3240'|'<>3240') osvers=3.2.0 ;;
3230 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3231 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3232 *) osvers=$tmp;;
a0d0e21e
LW
3233 esac
3234 ;;
aaacdc8b
GS
3235 bsd386) osname=bsd386
3236 osvers=`$uname -r`
3237 ;;
3238 cygwin*) osname=cygwin
3239 osvers="$3"
3240 ;;
23f87696
SZ
3241 *dc.osx) osname=dcosx
3242 osvers="$3"
3243 ;;
a0d0e21e
LW
3244 dnix) osname=dnix
3245 osvers="$3"
3246 ;;
3247 domainos) osname=apollo
3248 osvers="$3"
3249 ;;
a774dfe6
RSG
3250 dgux) osname=dgux
3251 osvers="$3"
3252 ;;
3253 dragonfly) osname=dragonfly
a0d0e21e
LW
3254 osvers="$3"
3255 ;;
760ac839 3256 dynixptx*) osname=dynixptx
e58e581d 3257 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3258 ;;
a774dfe6 3259 freebsd) osname=freebsd
a0d0e21e 3260 osvers="$3" ;;
761ee4e8
BD
3261 genix) osname=genix ;;
3262 gnu) osname=gnu
3263 osvers="$3" ;;
a774dfe6 3264 hp*) osname=hpux
bfb7748a 3265 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3266 ;;
761ee4e8 3267 irix*) osname=irix
a0d0e21e
LW
3268 case "$3" in
3269 4*) osvers=4 ;;
3270 5*) osvers=5 ;;
ecfc5424 3271 *) osvers="$3" ;;
a0d0e21e
LW
3272 esac
3273 ;;
761ee4e8 3274 linux) osname=linux
a0d0e21e 3275 case "$3" in
a0d0e21e
LW
3276 *) osvers="$3" ;;
3277 esac
3278 ;;
761ee4e8 3279 MiNT) osname=mint
28e8609d
JH
3280 ;;
3281 netbsd*) osname=netbsd
ecfc5424
AD
3282 osvers="$3"
3283 ;;
4e81affe
MM
3284 news-os) osvers="$3"
3285 case "$3" in
3286 4*) osname=newsos4 ;;
3287 *) osname=newsos ;;
3288 esac
3289 ;;
aaacdc8b 3290 next*) osname=next ;;
28bb1e2c 3291 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3292 openbsd) osname=openbsd
3293 osvers="$3"
3294 ;;
5c728af0
IZ
3295 os2) osname=os2
3296 osvers="$4"
3297 ;;
aaacdc8b
GS
3298 POSIX-BC | posix-bc ) osname=posix-bc
3299 osvers="$3"
a0d0e21e 3300 ;;
ae3afa4e
TH
3301 powerux | power_ux | powermax_os | powermaxos | \
3302 powerunix | power_unix) osname=powerux
3303 osvers="$3"
3304 ;;
aaacdc8b
GS
3305 qnx) osname=qnx
3306 osvers="$4"
3307 ;;
a0d0e21e
LW
3308 solaris) osname=solaris
3309 case "$3" in
3310 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3311 *) osvers="$3" ;;
a0d0e21e
LW
3312 esac
3313 ;;
85e6fe83
LW
3314 sunos) osname=sunos
3315 case "$3" in
85e6fe83
LW
3316 5*) osname=solaris
3317 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3318 *) osvers="$3" ;;
2304df62
AD
3319 esac
3320 ;;
a0d0e21e 3321 titanos) osname=titanos
85e6fe83 3322 case "$3" in
a0d0e21e
LW
3323 1*) osvers=1 ;;
3324 2*) osvers=2 ;;
3325 3*) osvers=3 ;;
3326 4*) osvers=4 ;;
ecfc5424 3327 *) osvers="$3" ;;
2304df62
AD
3328 esac
3329 ;;
85e6fe83 3330 ultrix) osname=ultrix
ecfc5424 3331 osvers="$3"
2304df62 3332 ;;
28757baa 3333 osf1|mls+) case "$5" in
fed7345c
AD
3334 alpha)
3335 osname=dec_osf
fdd85a03 3336 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3337 case "$osvers" in
3338 [1-9].[0-9]*) ;;
3339 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3340 esac
ecfc5424
AD
3341 ;;
3342 hp*) osname=hp_osf1 ;;
3343 mips) osname=mips_osf1 ;;
85e6fe83
LW
3344 esac
3345 ;;
af1ff193 3346 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3347 openunix|unixware) osname=svr5
0337d152
BG
3348 osvers="$4"
3349 ;;
3c728e00 3350 uts) osname=uts
a0d0e21e
LW
3351 osvers="$3"
3352 ;;
3c728e00
JH
3353 vos) osvers="$3"
3354 ;;
85e6fe83 3355 $2) case "$osname" in
2304df62 3356 *isc*) ;;
a0d0e21e 3357 *freebsd*) ;;
5f05dabc 3358 svr*)
a0d0e21e 3359 : svr4.x or possibly later
a774dfe6 3360 case "svr$3" in
a0d0e21e
LW
3361 ${osname}*)
3362 osname=svr$3
3363 osvers=$4
3364 ;;
3365 esac
3366 case "$osname" in
3367 svr4.0)
3368 : Check for ESIX
3369 if test -f /stand/boot ; then
3370 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3371 if test -n "$INITPROG" -a -f "$INITPROG"; then
3372 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3373 if test -n "$isesix"; then
a0d0e21e
LW
3374 osname=esix4
3375 fi
3376 fi
3377 fi
3378 ;;
3379 esac
3380 ;;
2304df62 3381 *) if test -f /etc/systemid; then
a0d0e21e
LW
3382 osname=sco
3383 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3384 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3385 osvers=$1.$2.$3
c4f23d77 3386 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3387 osvers=$1.$2
c4f23d77 3388 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3389 osvers=$1
2304df62 3390 fi
a0d0e21e
LW
3391 else
3392 case "$osname" in
3393 '') : Still unknown. Probably a generic Sys V.
3394 osname="sysv"
3395 osvers="$3"
3396 ;;
3397 esac
2304df62
AD
3398 fi
3399 ;;
3400 esac
3401 ;;
a0d0e21e
LW
3402 *) case "$osname" in
3403 '') : Still unknown. Probably a generic BSD.
3404 osname="$1"
3405 osvers="$3"
3406 ;;
3407 esac
3408 ;;
2304df62
AD
3409 esac
3410 else
dfe9444c
AD
3411 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3412 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3413 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3414 osname=news_os
2304df62 3415 fi
dfe9444c 3416 $rm -f UU/kernel.what
5c728af0 3417 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3418 set X $myuname
3419 osname=os2
3420 osvers="$5"
2304df62
AD
3421 fi
3422 fi
a774dfe6 3423
5440bc8e
JH
3424 case "$targetarch" in
3425 '') ;;
3426 *) hostarch=$osname
3427 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3428 osvers=''
3429 ;;
3430 esac
3431
a0d0e21e
LW
3432 : Now look for a hint file osname_osvers, unless one has been
3433 : specified already.
3434 case "$hintfile" in
3435 ''|' ')
1e127011 3436 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3437 : Also try without trailing minor version numbers.
1e127011
DD
3438 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3439 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3440 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3441 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3442 case "$file" in
3443 '') dflt=none ;;
3444 *) case "$osvers" in
3445 '') dflt=$file
3446 ;;
dfe9444c 3447 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3448 dflt=$file
dfe9444c 3449 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3450 dflt=$xfile
dfe9444c 3451 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3452 dflt=$xxfile
dfe9444c 3453 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3454 dflt=$xxxfile
dfe9444c 3455 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3456 dflt=$xxxxfile
dfe9444c 3457 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3458 dflt="${osname}"
3459 else
3460 dflt=none
3461 fi
3462 ;;
3463 esac
85e6fe83
LW
3464 ;;
3465 esac
4e2a5f63
AD
3466 if $test -f Policy.sh ; then
3467 case "$dflt" in
3468 *Policy*) ;;
3469 none) dflt="Policy" ;;
3470 *) dflt="Policy $dflt" ;;
3471 esac
3472 fi
85e6fe83 3473 ;;
a0d0e21e 3474 *)
ecfc5424 3475 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3476 ;;
2304df62 3477 esac
1aef975c 3478
4e2a5f63
AD
3479 if $test -f Policy.sh ; then
3480 $cat <<EOM
3481
3482There's also a Policy hint file available, which should make the
3483site-specific (policy) questions easier to answer.
3484EOM
3485
3486 fi
3487
2304df62
AD
3488 $cat <<EOM
3489
3490You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3491If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3492previous run of Configure, you may specify it as well as or instead of
3493OS-specific hints. If hints are provided for your OS, you should use them:
3494although Perl can probably be built without hints on many platforms, using
3495hints often improve performance and may enable features that Configure can't
3496set up on its own. If there are no hints that match your OS, specify "none";
3497DO NOT give a wrong version or a wrong OS.
2304df62
AD
3498
3499EOM
4e2a5f63 3500
2304df62 3501 rp="Which of these apply, if any?"
dfe9444c 3502 . UU/myread
85e6fe83
LW
3503 tans=$ans
3504 for file in $tans; do
4e2a5f63
AD
3505 if $test X$file = XPolicy -a -f Policy.sh; then
3506 . Policy.sh
3507 $cat Policy.sh >> UU/config.sh
3508 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3509 . $src/hints/$file.sh
3510 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3511 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3512 : nothing
3513 else
85e6fe83
LW
3514 : Give one chance to correct a possible typo.
3515 echo "$file.sh does not exist"
3516 dflt=$file
3517 rp="hint to use instead?"
dfe9444c 3518 . UU/myread
85e6fe83 3519 for file in $ans; do
dfe9444c
AD
3520 if $test -f "$src/hints/$file.sh"; then
3521 . $src/hints/$file.sh
3522 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3523 elif $test X$ans = X -o X$ans = Xnone ; then
3524 : nothing
3525 else
3526 echo "$file.sh does not exist -- ignored."
3527 fi
3528 done
2304df62
AD
3529 fi
3530 done
85e6fe83 3531
2304df62 3532 hint=recommended
85e6fe83 3533 : Remember our hint file for later.
dfe9444c 3534 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3535 hintfile="$file"
85e6fe83 3536 else
a0d0e21e 3537 hintfile=''
85e6fe83 3538 fi
2304df62
AD
3539fi
3540cd UU
3541;;
3542*)
3543 echo " "
3544 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3545 tmp_n="$n"
3546 tmp_c="$c"
2304df62
AD
3547 cd ..
3548 cp $config_sh config.sh 2>/dev/null
a78b0d02 3549 chmod +w config.sh
2304df62
AD
3550 . ./config.sh
3551 cd UU
3552 cp ../config.sh .
ecfc5424
AD
3553 n="$tmp_n"
3554 c="$tmp_c"
2304df62
AD
3555 hint=previous
3556 ;;
3557esac
1aef975c 3558test "$override" && . ./optdef.sh
2304df62
AD
3559
3560: Restore computed paths
3561for file in $loclist $trylist; do
3562 eval $file="\$_$file"
3563done
3564
85e6fe83 3565cat << EOM
a0d0e21e 3566
85e6fe83 3567Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3568The default value is probably right if the name rings a bell. Otherwise,
3569since spelling matters for me, either accept the default or answer "none"
3570to leave it blank.
a0d0e21e 3571
85e6fe83 3572EOM
85e6fe83 3573case "$osname" in
a0d0e21e 3574 ''|' ')
85e6fe83 3575 case "$hintfile" in
a0d0e21e 3576 ''|' '|none) dflt=none ;;
ecfc5424 3577 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3578 esac
3579 ;;
3580 *) dflt="$osname" ;;
3581esac
3582rp="Operating system name?"
3583. ./myread
3584case "$ans" in
ecfc5424
AD
3585none) osname='' ;;
3586*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3587esac
8ff267be 3588echo " "
3589case "$osvers" in
3590 ''|' ')
3591 case "$hintfile" in
3592 ''|' '|none) dflt=none ;;
3593 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3594 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3595 case "$dflt" in
3596 ''|' ') dflt=none ;;
3597 esac
3598 ;;
3599 esac
3600 ;;
3601 *) dflt="$osvers" ;;
3602esac
3603rp="Operating system version?"
3604. ./myread
3605case "$ans" in
3606none) osvers='' ;;
3607*) osvers="$ans" ;;
3608esac
3609
02e93a22
JH
3610
3611. ./posthint.sh
3612
2304df62 3613: who configured the system
59b83a6f 3614cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3615case "$cf_by" in
3616"")
7c04078e 3617 cf_by=`(logname) 2>/dev/null`
dfe9444c 3618 case "$cf_by" in
7c04078e
GA
3619 "")
3620 cf_by=`(whoami) 2>/dev/null`
3621 case "$cf_by" in
3622 "") cf_by=unknown ;;
3623 esac ;;
8ff267be 3624 esac ;;
3625esac
2304df62 3626
f3f1a2d8
MB
3627: decide how portable to be. Allow command line overrides.
3628case "$d_portable" in
3629"$undef") ;;
3630*) d_portable="$define" ;;
b4eb6b3d 3631esac
b4eb6b3d 3632
f3f1a2d8
MB
3633: set up shell script to do ~ expansion
3634cat >filexp <<EOSS
3635$startsh
3636: expand filename
3637case "\$1" in
f16e9d76 3638 \~/*|\~)
f3f1a2d8
MB
3639 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3640 ;;
4137585d 3641 \~*)
f3f1a2d8
MB
3642 if $test -f /bin/csh; then
3643 /bin/csh -f -c "glob \$1"
3644 failed=\$?
3645 echo ""
3646 exit \$failed
3647 else
3648 name=\`$expr x\$1 : '..\([^/]*\)'\`
3649 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3650 if $test ! -d "\$dir"; then
3651 me=\`basename \$0\`
3652 echo "\$me: can't locate home directory for: \$name" >&2
3653 exit 1
3654 fi
3655 case "\$1" in
3656 */*)
3657 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3658 ;;
3659 *)
3660 echo \$dir
3661 ;;
3662 esac
3663 fi
3664 ;;
3665*)
3666 echo \$1
3667 ;;
b29b105d 3668esac
f3f1a2d8
MB
3669EOSS
3670chmod +x filexp
3671$eunicefix filexp
b29b105d 3672
f3f1a2d8
MB
3673: now set up to get a file name
3674cat <<EOS >getfile
3675$startsh
3676EOS
3677cat <<'EOSC' >>getfile
3678tilde=''
3679fullpath=''
3680already=''
3681skip=''
3682none_ok=''
3683exp_file=''
3684nopath_ok=''
3685orig_rp="$rp"
3686orig_dflt="$dflt"
3687case "$gfpth" in
3688'') gfpth='.' ;;
b29b105d 3689esac
b29b105d 3690
f3f1a2d8
MB
3691case "$fn" in
3692*\(*)
3693 : getfile will accept an answer from the comma-separated list
3694 : enclosed in parentheses even if it does not meet other criteria.
3695 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3696 fn=`echo $fn | sed 's/(.*)//'`
3697 ;;
b29b105d
JH
3698esac
3699
f3f1a2d8
MB
3700case "$fn" in
3701*:*)
3702 loc_file=`expr $fn : '.*:\(.*\)'`
3703 fn=`expr $fn : '\(.*\):.*'`
3704 ;;
b29b105d 3705esac
b29b105d 3706
f3f1a2d8
MB
3707case "$fn" in
3708*~*) tilde=true;;
3709esac
3710case "$fn" in
3711*/*) fullpath=true;;
3712esac
3713case "$fn" in
3714*+*) skip=true;;
3715esac
3716case "$fn" in
3717*n*) none_ok=true;;
3718esac
3719case "$fn" in
3720*e*) exp_file=true;;
3721esac
3722case "$fn" in
3723*p*) nopath_ok=true;;
b29b105d 3724esac
b29b105d 3725
f3f1a2d8
MB
3726case "$fn" in
3727*f*) type='File';;
3728*d*) type='Directory';;
3729*l*) type='Locate';;
3730esac
b29b105d 3731
f3f1a2d8
MB
3732what="$type"
3733case "$what" in
3734Locate) what='File';;
3735esac
b29b105d 3736
f3f1a2d8
MB
3737case "$exp_file" in
3738'')
3739 case "$d_portable" in
3740 "$define") ;;
3741 *) exp_file=true;;
b29b105d
JH
3742 esac
3743 ;;
3744esac
3745
f3f1a2d8
MB
3746cd ..
3747while test "$type"; do
3748 redo=''
3749 rp="$orig_rp"
3750 dflt="$orig_dflt"
3751 case "$tilde" in
3752 true) rp="$rp (~name ok)";;
3753 esac
3754 . UU/myread
3755 if test -f UU/getfile.ok && \
3756 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3757 then
3758 value="$ans"
3759 ansexp="$ans"
3760 break
3761 fi
3762 case "$ans" in
3763 none)
3764 value=''
3765 ansexp=''
3766 case "$none_ok" in
3767 true) type='';;
b29b105d
JH
3768 esac
3769 ;;
f3f1a2d8
MB
3770 *)
3771 case "$tilde" in
3772 '') value="$ans"
3773 ansexp="$ans";;
3774 *)
3775 value=`UU/filexp $ans`
3776 case $? in
3777 0)
3778 if test "$ans" != "$value"; then
3779 echo "(That expands to $value on this system.)"
3780 fi
3781 ;;
3782 *) value="$ans";;
3783 esac
3784 ansexp="$value"
3785 case "$exp_file" in
3786 '') value="$ans";;
3787 esac
3788 ;;
3789 esac
3790 case "$fullpath" in
3791 true)
3792 case "$ansexp" in
3793 /*) value="$ansexp" ;;
3794 [a-zA-Z]:/*) value="$ansexp" ;;
3795 *)
3796 redo=true
3797 case "$already" in
3798 true)
3799 echo "I shall only accept a full path name, as in /bin/ls." >&4
3800 echo "Use a ! shell escape if you wish to check pathnames." >&4
3801 ;;
3802 *)
3803 echo "Please give a full path name, starting with slash." >&4
3804 case "$tilde" in
3805 true)
3806 echo "Note that using ~name is ok provided it expands well." >&4
3807 already=true
3808 ;;
3809 esac
3810 esac
3811 ;;
3812 esac
3813 ;;
3814 esac
3815 case "$redo" in
3816 '')
3817 case "$type" in
3818 File)
3819 for fp in $gfpth; do
3820 if test "X$fp" = X.; then
3821 pf="$ansexp"
3822 else
3823 pf="$fp/$ansexp"
3824 fi
3825 if test -f "$pf"; then
3826 type=''
3827 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3828 then
3829 echo "($value is not a plain file, but that's ok.)"
3830 type=''
3831 fi
3832 if test X"$type" = X; then
3833 value="$pf"
3834 break
3835 fi
3836 done
3837 ;;
3838 Directory)
3839 for fp in $gfpth; do
3840 if test "X$fp" = X.; then
3841 dir="$ans"
3842 direxp="$ansexp"
3843 else
3844 dir="$fp/$ansexp"
3845 direxp="$fp/$ansexp"
3846 fi
3847 if test -d "$direxp"; then
3848 type=''
3849 value="$dir"
3850 break
3851 fi
3852 done
3853 ;;
3854 Locate)
3855 if test -d "$ansexp"; then
3856 echo "(Looking for $loc_file in directory $value.)"
3857 value="$value/$loc_file"
3858 ansexp="$ansexp/$loc_file"
3859 fi
3860 if test -f "$ansexp"; then
3861 type=''
3862 fi
3863 case "$nopath_ok" in
3864 true) case "$value" in
3865 */*) ;;
3866 *) echo "Assuming $value will be in people's path."
3867 type=''
3868 ;;
3869 esac
3870 ;;
3871 esac
3872 ;;
3873 esac
b4eb6b3d 3874
f3f1a2d8
MB
3875 case "$skip" in
3876 true) type='';
3877 esac
3878
3879 case "$type" in
3880 '') ;;
3881 *)
3882 if test "$fastread" = yes; then
3883 dflt=y
3884 else
3885 dflt=n
3886 fi
3887 rp="$what $value doesn't exist. Use that name anyway?"
3888 . UU/myread
3889 dflt=''
3890 case "$ans" in
3891 y*) type='';;
3892 *) echo " ";;
3893 esac
3894 ;;
3895 esac
3896 ;;
3897 esac
3898 ;;
b4eb6b3d 3899 esac
f3f1a2d8
MB
3900done
3901cd UU
3902ans="$value"
3903rp="$orig_rp"
3904dflt="$orig_dflt"
3905rm -f getfile.ok
3906test "X$gfpthkeep" != Xy && gfpth=""
3907EOSC
3908
3909: determine root of directory hierarchy where package will be installed.
3910case "$prefix" in
3911'')
3912 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3913 ;;
3914*?/)
3915 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3916 ;;
3917*)
f3f1a2d8 3918 dflt="$prefix"
b4eb6b3d
JH
3919 ;;
3920esac
f3f1a2d8 3921$cat <<EOM
b4eb6b3d 3922
f3f1a2d8
MB
3923By default, $package will be installed in $dflt/bin, manual pages
3924under $dflt/man, etc..., i.e. with $dflt as prefix for all
3925installation directories. Typically this is something like /usr/local.
3926If you wish to have binaries under /usr/bin but other parts of the
3927installation under /usr/local, that's ok: you will be prompted
3928separately for each of the installation directories, the prefix being
3929only used to set the defaults.
c915ce7f
JH
3930
3931EOM
f3f1a2d8
MB
3932fn=d~
3933rp='Installation prefix to use?'
3934. ./getfile
3935oldprefix=''
3936case "$prefix" in
3937'') ;;
3938*)
3939 case "$ans" in
3940 "$prefix") ;;
3941 *) oldprefix="$prefix";;
3942 esac
c915ce7f
JH
3943 ;;
3944esac
f3f1a2d8
MB
3945prefix="$ans"
3946prefixexp="$ansexp"
c915ce7f 3947
776a38e3 3948: allow them to override the AFS root
f3f1a2d8
MB
3949case "$afsroot" in
3950'') afsroot=/afs ;;
3951*) afsroot=$afsroot ;;
b4eb6b3d 3952esac
b4eb6b3d 3953
776a38e3 3954: is AFS running?
f3f1a2d8
MB
3955echo " "
3956case "$afs" in
3957$define|true) afs=true ;;
3958$undef|false) afs=false ;;
776a38e3 3959*) if $test -d $afsroot; then
f3f1a2d8
MB
3960 afs=true
3961 else
3962 afs=false
3963 fi
b4eb6b3d 3964 ;;
f3f1a2d8
MB
3965esac
3966if $afs; then
3967 echo "AFS may be running... I'll be extra cautious then..." >&4
3968else
3969 echo "AFS does not seem to be running..." >&4
9da7673b 3970fi
b4eb6b3d 3971
f3f1a2d8
MB
3972: determine installation prefix for where package is to be installed.
3973if $afs; then
3974$cat <<EOM
3975
3976Since you are running AFS, I need to distinguish the directory in which
3977files will reside from the directory in which they are installed (and from
3978which they are presumably copied to the former directory by occult means).
b4eb6b3d 3979
b4eb6b3d 3980EOM
f3f1a2d8
MB
3981 case "$installprefix" in
3982 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3983 *) dflt="$installprefix";;
3984 esac
3985else
3986$cat <<EOM
b4eb6b3d 3987
f3f1a2d8
MB
3988In some special cases, particularly when building $package for distribution,
3989it is convenient to distinguish the directory in which files should be
3990installed from the directory ($prefix) in which they will
3991eventually reside. For most users, these two directories are the same.
3992
3993EOM
3994 case "$installprefix" in
3995 '') dflt=$prefix ;;
3996 *) dflt=$installprefix;;
3997 esac
3998fi
3999fn=d~
4000rp='What installation prefix should I use for installing files?'
4001. ./getfile
4002installprefix="$ans"
4003installprefixexp="$ansexp"
4004
4005: Perform the prefixexp/installprefixexp correction if necessary
4006cat <<EOS >installprefix
4007$startsh
4008EOS
4009cat <<'EOSC' >>installprefix
4010: Change installation prefix, if necessary.
4011if $test X"$prefix" != X"$installprefix"; then
4012 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4013else
4014 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4015fi
4016EOSC
4017chmod +x installprefix
4018$eunicefix installprefix
4019
4020: Set variables such as privlib and privlibexp from the output of ./getfile
4021: performing the prefixexp/installprefixexp correction if necessary.
4022cat <<EOS >setprefixvar
4023$startsh
4024EOS
4025cat <<'EOSC' >>setprefixvar
4026eval "${prefixvar}=\"\$ans\""
4027eval "${prefixvar}exp=\"\$ansexp\""
4028. ./installprefix
4029EOSC
4030chmod +x setprefixvar
4031$eunicefix setprefixvar
4032
4033: set up the script used to warn in case of inconsistency
4034cat <<EOS >whoa
4035$startsh
4036EOS
4037cat <<'EOSC' >>whoa
4038dflt=y
dcb594bc
MB
4039case "$hint" in
4040 recommended)
4041 case "$hintfile" in
4042 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4043 ;;
4044 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4045 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4046 ;;
4047 esac
4048 ;;
4049 *) echo " "
4050 echo "*** WHOA THERE!!! ***" >&4
4051 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4052 ;;
4053esac
f3f1a2d8
MB
4054rp=" Keep the $hint value?"
4055. ./myread
4056case "$ans" in
4057y) td=$was; tu=$was;;
4058esac
4059EOSC
4060
216dac04 4061: function used to set '$1' to '$val'
f3f1a2d8
MB
4062setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4063case "$val$was" in
4064$define$undef) . ./whoa; eval "$var=\$td";;
4065$undef$define) . ./whoa; eval "$var=\$tu";;
4066*) eval "$var=$val";;
4067esac'
4068
34f1896b 4069: Check is we will use socks
f3f1a2d8
MB
4070case "$usesocks" in
4071$define|true|[yY]*) dflt='y';;
4072*) dflt='n';;
4073esac
4074cat <<EOM
4075
4076Perl can be built to use the SOCKS proxy protocol library. To do so,
4077Configure must be run with -Dusesocks. If you use SOCKS you also need
4078to use the PerlIO abstraction layer, this will be implicitly selected.
4079
4080If this doesn't make any sense to you, just accept the default '$dflt'.
4081EOM
4082rp='Build Perl for SOCKS?'
4083. ./myread
4084case "$ans" in
613d6c3e 4085y|Y) val="$define" ;;
f3f1a2d8
MB
4086*) val="$undef" ;;
4087esac
4088set usesocks
4089eval $setvar
4090
4091case "$usesocks" in
4092$define|true|[yY]*) useperlio="$define";;
4093esac
4094
34f1896b 4095: Check if we want perlio
f3f1a2d8
MB
4096case "$useperlio" in
4097$define|true|[yY]*|'') dflt='y';;
4098*) dflt='n';;
4099esac
4100cat <<EOM
4101
4102Previous version of $package used the standard IO mechanisms as
4103defined in <stdio.h>. Versions 5.003_02 and later of $package allow
4104alternate IO mechanisms via the PerlIO abstraction layer, but the
4105stdio mechanism is still available if needed. The abstraction layer
4106can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4107Using PerlIO with sfio may cause problems with some extension modules.
4108
4109If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 4110EOM
f3f1a2d8
MB
4111rp='Use the PerlIO abstraction layer?'
4112. ./myread
4113case "$ans" in
34f1896b 4114y|Y)
b4eb6b3d
JH
4115 val="$define"
4116 ;;
34f1896b 4117*)
f3f1a2d8
MB
4118 echo "Ok, doing things the stdio way."
4119 val="$undef"
4120 ;;
4121esac
4122set useperlio
34f1896b 4123eval $setvar
f3f1a2d8
MB
4124
4125case "$usesocks" in
4126$define|true|[yY]*)
4127 case "$useperlio" in
4128 $define|true|[yY]*) ;;
4129 *) cat >&4 <<EOM
4130
4131You are using the SOCKS proxy protocol library which means that you
4132should also use the PerlIO layer. You may be headed for trouble.
4133
4134EOM
4135 ;;
b4eb6b3d 4136 esac
f3f1a2d8
MB
4137 ;;
4138esac
4139
5c40187f
MB
4140: get the patchlevel
4141echo " "
4142echo "Getting the current patchlevel..." >&4
4143if $test -r $rsrc/patchlevel.h;then
4144 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4145 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4146 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4147 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4148 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4149 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4150 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4151else
4152 revision=0
4153 patchlevel=0
4154 subversion=0
4155 api_revision=0
4156 api_version=0
4157 api_subversion=0
4158 perl_patchlevel=0
4159 $echo "(You do not have patchlevel.h. Eek.)"
4160fi
4161if $test -r $rsrc/.patch ; then
4162 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4163 perl_patchlevel=`cat $rsrc/.patch`
4164 fi
4165fi
4166: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4167version_patchlevel_string="version $patchlevel subversion $subversion"
4168case "$perl_patchlevel" in
41690|'') ;;
0f04e85f
MB
4170*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4171 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4172 ;;
5c40187f
MB
4173esac
4174
4175$echo "(You have $package $version_patchlevel_string.)"
4176
4177case "$osname" in
4178dos|vms)
4179 : XXX Should be a Configure test for double-dots in filenames.
4180 version=`echo $revision $patchlevel $subversion | \
4181 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4182 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4183 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4184 ;;
4185*)
4186 version=`echo $revision $patchlevel $subversion | \
4187 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4188 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4189 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4190 ;;
4191esac
4192: Special case the 5.005_xx maintenance series, which used 5.005
4193: without any subversion label as a subdirectory in $sitelib
4194if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4195 api_versionstring='5.005'
4196fi
4197
613d6c3e 4198: Do we want threads support and if so, what type
f3f1a2d8
MB
4199case "$usethreads" in
4200$define|true|[yY]*) dflt='y';;
4201*) # Catch case where user specified ithreads or 5005threads but
4202 # forgot -Dusethreads (A.D. 4/2002)
4203 case "$useithreads$use5005threads" in
613d6c3e 4204 *$define*)
f3f1a2d8
MB
4205 case "$useperlio" in
4206 "$define") dflt='y' ;;
4207 *) dflt='n' ;;
4208 esac
4209 ;;
4210 *) dflt='n';;
4211 esac
4212 ;;
4213esac
4214cat <<EOM
4215
4216Perl can be built to take advantage of threads on some systems.
4217To do so, Configure can be run with -Dusethreads.
4218
4219Note that Perl built with threading support runs slightly slower
4220and uses more memory than plain Perl. The current implementation
4221is believed to be stable, but it is fairly new, and so should be
4222treated with caution.
4223
4224If this doesn't make any sense to you, just accept the default '$dflt'.
4225EOM
4226rp='Build a threading Perl?'
4227. ./myread
4228case "$ans" in
4229y|Y) val="$define" ;;
4230*) val="$undef" ;;
4231esac
4232set usethreads
4233eval $setvar
4234
5c40187f
MB
4235if $test $patchlevel -lt 9; then
4236 case "$usethreads" in
4237 $define)
f3f1a2d8
MB
4238 $cat <<EOM
4239
4240Since release 5.6, Perl has had two different threading implementations,
4241the newer interpreter-based version (ithreads) with one interpreter per
4242thread, and the older 5.005 version (5005threads).
4243The 5005threads version is effectively unmaintained and will probably be
4244removed in Perl 5.10, so there should be no need to build a Perl using it
4245unless needed for backwards compatibility with some existing 5.005threads
4246code.
4247
4248EOM
4249 : Default to ithreads unless overridden on command line or with
4250 : old config.sh
4251 dflt='y'
4252 case "$use5005threads" in
4253 $define|true|[yY]*) dflt='n';;
4254 esac
4255 case "$useithreads" in
4256 $undef|false|[nN]*) dflt='n';;
4257 esac
4258 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4259 . ./myread
4260 case "$ans" in
f3f1a2d8 4261 y|Y) val="$define" ;;
b4eb6b3d
JH
4262 *) val="$undef" ;;
4263 esac
f3f1a2d8
MB
4264 set useithreads
4265 eval $setvar
4266 : Now set use5005threads to the opposite value.
4267 case "$useithreads" in
4268 $define) val="$undef" ;;
4269 *) val="$define" ;;
4270 esac
4271 set use5005threads
4272 eval $setvar
4273 ;;
5c40187f 4274 *)
f3f1a2d8
MB
4275 useithreads="$undef"
4276 use5005threads="$undef"
b4eb6b3d 4277 ;;
5c40187f 4278 esac
b4eb6b3d 4279
5c40187f
MB
4280 case "$useithreads$use5005threads" in
4281 "$define$define")
f3f1a2d8 4282 $cat >&4 <<EOM
96056487 4283
f3f1a2d8
MB
4284You cannot have both the ithreads and the 5.005 threads enabled
4285at the same time. Disabling the 5.005 threads since they are
4286much less stable than the ithreads.
4287
4288EOM
4289 use5005threads="$undef"
96056487 4290 ;;
5c40187f
MB
4291 esac
4292
4293else
4294: perl-5.9.x and later
4295
47f9f84c 4296 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4297 case "$use5005threads" in
4298 $define|true|[yY]*)
4299 $cat >&4 <<EOM
47f9f84c
JH
4300
43015.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4302
47f9f84c 4303EOM
3f30fabf
MB
4304 ;;
4305 esac
47f9f84c 4306 fi
3f30fabf 4307
47f9f84c
JH
4308 use5005threads="$undef"
4309 useithreads="$usethreads"
5c40187f 4310fi
96056487 4311
f3f1a2d8
MB
4312if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4313 cat >&4 <<EOF
4314***
4315*** To build with ithreads you must also use the PerlIO layer.
4316*** Cannot continue, aborting.
4317***
4318EOF
4319 exit 1
4320fi
4321
4322case "$d_oldpthreads" in
4323'') : Configure tests would be welcome here. For now, assume undef.
4324 val="$undef" ;;
4325*) val="$d_oldpthreads" ;;
4326esac
4327set d_oldpthreads
4328eval $setvar
4329
4330
4331: Look for a hint-file generated 'call-back-unit'. If the
4332: user has specified that a threading perl is to be built,
4333: we may need to set or change some other defaults.
4334if $test -f usethreads.cbu; then
4335 echo "Your platform has some specific hints regarding threaded builds, using them..."
4336 . ./usethreads.cbu
4337else
4338 case "$usethreads" in
4339 "$define"|true|[yY]*)
4340 $cat <<EOM
4341(Your platform does not have any specific hints for threaded builds.
4342 Assuming POSIX threads, then.)
4343EOM
4344 ;;
4345 esac
4346fi
4347
34f1896b 4348: Check if multiplicity is required
f3f1a2d8
MB
4349cat <<EOM
4350
4351Perl can be built so that multiple Perl interpreters can coexist
4352within the same Perl executable.
4353EOM
4354
4355case "$useithreads" in
4356$define)
4357 cat <<EOM
4358This multiple interpreter support is required for interpreter-based threads.
4359EOM
4360 val="$define"
4361 ;;
4362*) case "$usemultiplicity" in
4363 $define|true|[yY]*) dflt='y';;
4364 *) dflt='n';;
4365 esac
4366 echo " "
4367 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4368 rp='Build Perl for multiplicity?'
4369 . ./myread
4370 case "$ans" in
4371 y|Y) val="$define" ;;
4372 *) val="$undef" ;;
4373 esac
4374 ;;
4375esac
4376set usemultiplicity
4377eval $setvar
4378
34f1896b 4379: Check if morebits is requested
f3f1a2d8
MB
4380case "$usemorebits" in
4381"$define"|true|[yY]*)
4382 use64bitint="$define"
4383 uselongdouble="$define"
4384 usemorebits="$define"
4385 ;;
4386*) usemorebits="$undef"
4387 ;;
4388esac
4389
776a38e3
MB
4390: Determine the C compiler to be used
4391echo " "
4392case "$cc" in
4393'') dflt=cc;;
4394*) dflt="$cc";;
4395esac
4396rp="Use which C compiler?"
4397. ./myread
4398cc="$ans"
4399
4400: See whether they have no cc but they do have gcc
4401. ./trygcc
4402if $test -f cc.cbu; then
4403 . ./cc.cbu
4404fi
4405. ./checkcc
4406
f3f1a2d8
MB
4407: make some quick guesses about what we are up against
4408echo " "
4409$echo $n "Hmm... $c"
4410echo exit 1 >bsd
4411echo exit 1 >usg
4412echo exit 1 >v7
4413echo exit 1 >osf1
4414echo exit 1 >eunice
4415echo exit 1 >xenix
4416echo exit 1 >venix
4417echo exit 1 >os2
4418d_bsd="$undef"
4419$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4420if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4421then
4422 echo "Looks kind of like an OSF/1 system, but we'll see..."
4423 echo exit 0 >osf1
381aa1ff 4424elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4425 xxx=`./loc addbib blurfl $pth`
4426 if $test -f $xxx; then
4427 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4428 echo exit 0 >bsd
4429 echo exit 0 >usg
4430 else
4431 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4432 echo "Looks kind of like an extended USG system, but we'll see..."
4433 else
4434 echo "Looks kind of like a USG system, but we'll see..."
4435 fi
4436 echo exit 0 >usg
4437 fi
4438elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4439 echo "Looks kind of like a BSD system, but we'll see..."
4440 d_bsd="$define"
4441 echo exit 0 >bsd
4442else
4443 echo "Looks kind of like a Version 7 system, but we'll see..."
4444 echo exit 0 >v7
4445fi
4446case "$eunicefix" in
4447*unixtovms*)
4448 $cat <<'EOI'
4449There is, however, a strange, musty smell in the air that reminds me of
4450something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4451EOI
4452 echo exit 0 >eunice
4453 d_eunice="$define"
4454: it so happens the Eunice I know will not run shell scripts in Unix format
4455 ;;
4456*)
4457 echo " "
4458 echo "Congratulations. You aren't running Eunice."
4459 d_eunice="$undef"
4460 ;;
4461esac
4462: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4463: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4464: semicolon as a patch separator
e5e20432
JH
4465case "$p_" in
4466:) ;;
4467*)
4468 $cat <<'EOI'
4469I have the feeling something is not exactly right, however...don't tell me...
4470lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4471(Or you may be running DOS with DJGPP.)
e5e20432
JH
4472EOI
4473 echo exit 0 >os2
4474 ;;
4475esac
4476if test -f /xenix; then
4477 echo "Actually, this looks more like a XENIX system..."
4478 echo exit 0 >xenix
4479 d_xenix="$define"
4480else
4481 echo " "
4482 echo "It's not Xenix..."
4483 d_xenix="$undef"
4484fi
4485chmod +x xenix
4486$eunicefix xenix
4487if test -f /venix; then
4488 echo "Actually, this looks more like a VENIX system..."
4489 echo exit 0 >venix
4490else
4491 echo " "
4492 if ./xenix; then
4493 : null
4494 else
4495 echo "Nor is it Venix..."
4496 fi
4497fi
4498chmod +x bsd usg v7 osf1 eunice xenix venix os2
4499$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4500$rm -f foo
4501
613d6c3e 4502: Check if we are using GNU gcc and what its version is
e5e20432
JH
4503echo " "
4504echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4505$cat >try.c <<EOM
e5e20432
JH
4506#include <stdio.h>
4507int main() {
7686528e 4508#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4509#ifdef __VERSION__
4510 printf("%s\n", __VERSION__);
4511#else
4512 printf("%s\n", "1");
4513#endif
4514#endif
073b6de5 4515 return(0);
e5e20432
JH
4516}
4517EOM
5440bc8e
JH
4518if $cc -o try $ccflags $ldflags try.c; then
4519 gccversion=`$run ./try`
f3f1a2d8
MB
4520 case "$gccversion" in
4521 '') echo "You are not using GNU cc." ;;
4522 *) echo "You are using GNU cc $gccversion."
4523 ccname=gcc
4524 ;;
4525 esac
4526else
4527 echo " "
4528 echo "*** WHOA THERE!!! ***" >&4
4529 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4530 case "$knowitall" in
4531 '')
4532 echo " You'd better start hunting for one and let me know about it." >&4
4533 exit 1
2304df62
AD
4534 ;;
4535 esac
f3f1a2d8
MB
4536fi
4537$rm -f try try.*
4538case "$gccversion" in
45391*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4540esac
4541case "$gccversion" in
4542'') gccosandvers='' ;;
4543*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4544 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4545 gccshortvers=''
4546 case "$gccosandvers" in
4547 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4548 $osname$osvers) ;; # looking good
4549 $osname*) cat <<EOM >&4
4550
4551*** WHOA THERE!!! ***
4552
4553 Your gcc has not been compiled for the exact release of
4554 your operating system ($gccosandvers versus $osname$osvers).
4555
4556 In general it is a good idea to keep gcc synchronized with
4557 the operating system because otherwise serious problems
4558 may ensue when trying to compile software, like Perl.
4559
4560 I'm trying to be optimistic here, though, and will continue.
4561 If later during the configuration and build icky compilation
4562 problems appear (headerfile conflicts being the most common
4563 manifestation), I suggest reinstalling the gcc to match
4564 your operating system release.
4565
4566EOM
4567 ;;
4568 *) gccosandvers='' ;; # failed to parse, better be silent
4569 esac
4570 ;;
4571esac
4572case "$ccname" in
4573'') ccname="$cc" ;;
4574esac
4575
4576# gcc 3.* complain about adding -Idirectories that they already know about,
4577# so we will take those off from locincpth.
4578case "$gccversion" in
45793*)
4580 echo "main(){}">try.c
4581 for incdir in $locincpth; do
4582 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4583 grep '^c[cp]p*[01]: warning: changing search order '`
4584 if test "X$warn" != X; then
4585 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4586 fi
4587 done
4588 $rm -f try try.*
4589esac
2304df62 4590
bd9b35c9
JH
4591: What should the include directory be ?
4592echo " "
4593$echo $n "Hmm... $c"
4594dflt='/usr/include'
4595incpath=''
4596mips_type=''
4597if $test -f /bin/mips && /bin/mips; then
4598 echo "Looks like a MIPS system..."
4599 $cat >usr.c <<'EOCP'
4600#ifdef SYSTYPE_BSD43
4601/bsd43
4602#endif
4603EOCP
8a27cf78 4604 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4605 dflt='/bsd43/usr/include'
4606 incpath='/bsd43'
4607 mips_type='BSD 4.3'
4608 else
4609 mips_type='System V'
4610 fi
4611 $rm -f usr.c usr.out
4612 echo "and you're compiling with the $mips_type compiler and libraries."
4613 xxx_prompt=y
4614 echo "exit 0" >mips
4615else
4616 echo "Doesn't look like a MIPS system."
4617 xxx_prompt=n
4618 echo "exit 1" >mips
4619fi
4620chmod +x mips
4621$eunicefix mips
4622case "$usrinc" in
4623'') ;;
4624*) dflt="$usrinc";;
4625esac
4626case "$xxx_prompt" in
4627y) fn=d/
4628 echo " "
4629 rp='Where are the include files you want to use?'
4630 . ./getfile
4631 usrinc="$ans"
8e07c86e 4632 ;;
bd9b35c9 4633*) usrinc="$dflt"
8e07c86e
AD
4634 ;;
4635esac
2304df62 4636
96056487
JH
4637: see how we invoke the C preprocessor
4638echo " "
4639echo "Now, how can we feed standard input to your C preprocessor..." >&4
4640cat <<'EOT' >testcpp.c
4641#define ABC abc
4642#define XYZ xyz
4643ABC.XYZ
4644EOT
4645cd ..
4646if test ! -f cppstdin; then
4647 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4648 # AIX cc -E doesn't show the absolute headerfile
4649 # locations but we'll cheat by using the -M flag.
4650 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4651 else
4652 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4653 fi
4654else
4655 echo "Keeping your $hint cppstdin wrapper."
4656fi
4657chmod 755 cppstdin
4658wrapper=`pwd`/cppstdin
4659ok='false'
4660cd UU
4661
4662if $test "X$cppstdin" != "X" && \
4663 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4664 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4665then
4666 echo "You used to use $cppstdin $cppminus so we'll use that again."
4667 case "$cpprun" in
4668 '') echo "But let's see if we can live without a wrapper..." ;;
4669 *)
4670 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4671 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4672 then
4673 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4674 ok='true'
4675 else
4676 echo "(However, $cpprun $cpplast does not work, let's see...)"
4677 fi
4678 ;;
4679 esac
4680else
4681 case "$cppstdin" in
4682 '') ;;
4683 *)
4684 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4685 ;;
4686 esac
4687fi
4688
4689if $ok; then
4690 : nothing
4691elif echo 'Maybe "'"$cc"' -E" will work...'; \
4692 $cc -E <testcpp.c >testcpp.out 2>&1; \
4693 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4694 echo "Yup, it does."
4695 x_cpp="$cc -E"
4696 x_minus='';
4697elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4698 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4699 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4700 echo "Yup, it does."
4701 x_cpp="$cc -E"
4702 x_minus='-';
4703elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4704 $cc -P <testcpp.c >testcpp.out 2>&1; \
4705 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4706 echo "Yipee, that works!"
4707 x_cpp="$cc -P"
4708 x_minus='';
4709elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4710 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4711 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4712 echo "At long last!"
4713 x_cpp="$cc -P"
4714 x_minus='-';
4715elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4716 $cpp <testcpp.c >testcpp.out 2>&1; \
4717 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4718 echo "It works!"
4719 x_cpp="$cpp"
4720 x_minus='';
4721elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4722 $cpp - <testcpp.c >testcpp.out 2>&1; \
4723 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4724 echo "Hooray, it works! I was beginning to wonder."
4725 x_cpp="$cpp"
4726 x_minus='-';
4727elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4728 $wrapper <testcpp.c >testcpp.out 2>&1; \
4729 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4730 x_cpp="$wrapper"
4731 x_minus=''
4732 echo "Eureka!"
4733else
4734 dflt=''
4735 rp="No dice. I can't find a C preprocessor. Name one:"
4736 . ./myread
4737 x_cpp="$ans"
4738 x_minus=''
4739 $x_cpp <testcpp.c >testcpp.out 2>&1
4740 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4741 echo "OK, that will do." >&4
4742 else
4743echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4744 exit 1
4745 fi
4746fi
4747
4748case "$ok" in
4749false)
4750 cppstdin="$x_cpp"
4751 cppminus="$x_minus"
4752 cpprun="$x_cpp"
4753 cpplast="$x_minus"
4754 set X $x_cpp
4755 shift
4756 case "$1" in
4757 "$cpp")
4758 echo "Perhaps can we force $cc -E using a wrapper..."
4759 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4760 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4761 then
4762 echo "Yup, we can."
4763 cppstdin="$wrapper"
4764 cppminus='';
4765 else
4766 echo "Nope, we'll have to live without it..."
4767 fi
4768 ;;
4769 esac
4770 case "$cpprun" in
4771 "$wrapper")
4772 cpprun=''
4773 cpplast=''
4774 ;;
4775 esac
4776 ;;
4777esac
4778
4779case "$cppstdin" in
4780"$wrapper"|'cppstdin') ;;
4781*) $rm -f $wrapper;;
4782esac
4783$rm -f testcpp.c testcpp.out
4784
bd9b35c9
JH
4785: Set private lib path
4786case "$plibpth" in
4787'') if ./mips; then
4788 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4789 fi;;
4790esac
4791case "$libpth" in
4792' ') dlist='';;
4793'') dlist="$loclibpth $plibpth $glibpth";;
4794*) dlist="$libpth";;
4795esac
4796
4797: Now check and see which directories actually exist, avoiding duplicates
4798libpth=''
4799for xxx in $dlist
4800do
4801 if $test -d $xxx; then
4802 case " $libpth " in
4803 *" $xxx "*) ;;
4804 *) libpth="$libpth $xxx";;
4805 esac
4806 fi
4807done
4808$cat <<'EOM'
4809
4810Some systems have incompatible or broken versions of libraries. Among
4811the directories listed in the question below, please remove any you
4812know not to be holding relevant libraries, and add any that are needed.
4813Say "none" for none.
8e07c86e
AD
4814
4815EOM
bd9b35c9
JH
4816case "$libpth" in
4817'') dflt='none';;
8e07c86e 4818*)
bd9b35c9
JH
4819 set X $libpth
4820 shift
4821 dflt=${1+"$@"}
8e07c86e 4822 ;;
a0d0e21e 4823esac
bd9b35c9
JH
4824rp="Directories to use for library searches?"
4825. ./myread
4826case "$ans" in
4827none) libpth=' ';;
4828*) libpth="$ans";;
4829esac
a0d0e21e 4830
bd9b35c9
JH
4831: compute shared library extension
4832case "$so" in
4833'')
4834 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4835 dflt='sl'
dd4e71fd 4836 else
bd9b35c9 4837 dflt='so'
dd4e71fd
JH
4838 fi
4839 ;;
bd9b35c9 4840*) dflt="$so";;
dd4e71fd 4841esac
dd4e71fd
JH
4842$cat <<EOM
4843
bd9b35c9 4844On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4845you want to suppress searching of shared libraries for the remainder
bd9b35c9 4846of this configuration.
dd4e71fd
JH
4847
4848EOM
bd9b35c9
JH
4849rp='What is the file extension used for shared libraries?'
4850. ./myread
4851so="$ans"
dd4e71fd 4852
bd9b35c9
JH
4853: Define several unixisms.
4854: Hints files or command line option can be used to override them.
4855: The convoluted testing is in case hints files set either the old
4856: or the new name.
4857case "$_exe" in
4858'') case "$exe_ext" in
1fef16b3 4859 '') ;;
bd9b35c9 4860 *) _exe="$exe_ext" ;;
dd4e71fd 4861 esac
bd9b35c9 4862 ;;
bfb7748a 4863esac
bd9b35c9
JH
4864case "$_a" in
4865'') case "$lib_ext" in
4866 '') _a='.a';;
4867 *) _a="$lib_ext" ;;
dd4e71fd
JH
4868 esac
4869 ;;
dd4e71fd 4870esac
bd9b35c9
JH
4871case "$_o" in
4872'') case "$obj_ext" in
4873 '') _o='.o';;
4874 *) _o="$obj_ext";;
4875 esac
4876 ;;
4877esac
4878case "$p_" in
4879'') case "$path_sep" in
4880 '') p_=':';;
4881 *) p_="$path_sep";;
4882 esac
4883 ;;
4884esac
4885exe_ext=$_exe
4886lib_ext=$_a
4887obj_ext=$_o
4888path_sep=$p_
dd4e71fd 4889
5b813a60
MB
4890rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4891
b4eb6b3d
JH
4892: Which makefile gets called first. This is used by make depend.
4893case "$firstmakefile" in
4894'') firstmakefile='makefile';;
4633a7c4 4895esac
4633a7c4 4896
34f1896b 4897: Check for uselongdouble support
1f603089
JH
4898case "$ccflags" in
4899*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4900esac
4901
4902case "$uselongdouble" in
4903$define|true|[yY]*) dflt='y';;
4904*) dflt='n';;
4905esac
4906cat <<EOM
4907
4908Perl can be built to take advantage of long doubles which
4909(if available) may give more accuracy and range for floating point numbers.
4910
4911If this doesn't make any sense to you, just accept the default '$dflt'.
4912EOM
4913rp='Try to use long doubles if available?'
4914. ./myread
4915case "$ans" in
4916y|Y) val="$define" ;;
4917*) val="$undef" ;;
4918esac
4919set uselongdouble
4920eval $setvar
4921
4922case "$uselongdouble" in
4923true|[yY]*) uselongdouble="$define" ;;
4924esac
4925
1f603089
JH
4926: Look for a hint-file generated 'call-back-unit'. If the
4927: user has specified that long doubles should be used,
4928: we may need to set or change some other defaults.
9da7673b
MB
4929if $test -f uselongdouble.cbu; then
4930 echo "Your platform has some specific hints regarding long doubles, using them..."
4931 . ./uselongdouble.cbu
4932else
4933 case "$uselongdouble" in
4934 $define)
1f603089 4935 $cat <<EOM
9da7673b 4936(Your platform does not have any specific hints for long doubles.)
1f603089 4937EOM
1f603089 4938 ;;
9da7673b
MB
4939 esac
4940fi
1f603089 4941
bd9b35c9
JH
4942: Looking for optional libraries
4943echo " "
4944echo "Checking for optional libraries..." >&4
4945case "$libs" in
4946' '|'') dflt='';;
4947*) dflt="$libs";;
4948esac
4949case "$libswanted" in
4950'') libswanted='c_s';;
4951esac
4952case "$usesocks" in
923fc586 4953"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4954esac
68435ea7
JH
4955libsfound=''
4956libsfiles=''
4957libsdirs=''
13b3f787
JH
4958libspath=''
4959for thisdir in $libpth $xlibpth; do
4960 test -d $thisdir && libspath="$libspath $thisdir"
4961done
bd9b35c9 4962for thislib in $libswanted; do
13b3f787 4963 for thisdir in $libspath; do
f7dd4e7f
JH
4964 xxx=''
4965 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4966 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4967 $test -f "$xxx" && eval $libscheck
4968 $test -f "$xxx" && libstyle=shared
4969 fi
4970 if test ! -f "$xxx"; then
4971 xxx=$thisdir/lib$thislib.$so
4972 $test -f "$xxx" && eval $libscheck
4973 $test -f "$xxx" && libstyle=shared
613d6c3e 4974 fi
f7dd4e7f
JH
4975 if test ! -f "$xxx"; then
4976 xxx=$thisdir/lib$thislib$_a
4977 $test -f "$xxx" && eval $libscheck
4978 $test -f "$xxx" && libstyle=static
4979 fi
4980 if test ! -f "$xxx"; then
4981 xxx=$thisdir/$thislib$_a
4982 $test -f "$xxx" && eval $libscheck
4983 $test -f "$xxx" && libstyle=static
4984 fi
4985 if test ! -f "$xxx"; then
4986 xxx=$thisdir/lib${thislib}_s$_a
4987 $test -f "$xxx" && eval $libscheck
4988 $test -f "$xxx" && libstyle=static
09ea5ba9 4989 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4990 fi
4991 if test ! -f "$xxx"; then
4992 xxx=$thisdir/Slib$thislib$_a
4993 $test -f "$xxx" && eval $libscheck
4994 $test -f "$xxx" && libstyle=static
4995 fi
4996 if $test -f "$xxx"; then
43999f95 4997 case "$libstyle" in
f7dd4e7f
JH
4998 shared) echo "Found -l$thislib (shared)." ;;
4999 static) echo "Found -l$thislib." ;;
5000 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 5001 esac
bd9b35c9
JH
5002 case " $dflt " in
5003 *"-l$thislib "*);;
f7dd4e7f 5004 *) dflt="$dflt -l$thislib"
43999f95
JH
5005 libsfound="$libsfound $xxx"
5006 yyy=`basename $xxx`
5007 libsfiles="$libsfiles $yyy"
1e127011 5008 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
5009 case " $libsdirs " in
5010 *" $yyy "*) ;;
5011 *) libsdirs="$libsdirs $yyy" ;;
5012 esac
5013 ;;
bd9b35c9 5014 esac
f7dd4e7f 5015 break
613d6c3e 5016 fi
f7dd4e7f
JH
5017 done
5018 if $test ! -f "$xxx"; then
5019 echo "No -l$thislib."
bd9b35c9
JH
5020 fi
5021done
5022set X $dflt
5023shift
5024dflt="$*"
5025case "$libs" in
5026'') dflt="$dflt";;
5027*) dflt="$libs";;
5028esac
5029case "$dflt" in
5030' '|'') dflt='none';;
5031esac
4633a7c4 5032
bd9b35c9 5033$cat <<EOM
4633a7c4 5034
bd9b35c9
JH
5035In order to compile $package on your machine, a number of libraries
5036are usually needed. Include any other special libraries here as well.
5037Say "none" for none. The default list is almost always right.
8e07c86e 5038EOM
8e07c86e 5039
bd9b35c9
JH
5040echo " "
5041rp="What libraries to use?"
5042. ./myread
5043case "$ans" in
5044none) libs=' ';;
5045*) libs="$ans";;
5046esac
d71b2b6b 5047
bd9b35c9
JH
5048: determine optimization, if desired, or use for debug flag also
5049case "$optimize" in
5050' '|$undef) dflt='none';;
5051'') dflt='-O';;
5052*) dflt="$optimize";;
5053esac
5054$cat <<EOH
d71b2b6b 5055
bd9b35c9
JH
5056By default, $package compiles with the -O flag to use the optimizer.
5057Alternately, you might want to use the symbolic debugger, which uses
5058the -g flag (on traditional Unix systems). Either flag can be
5059specified here. To use neither flag, specify the word "none".
d71b2b6b 5060
bd9b35c9
JH
5061EOH
5062rp="What optimizer/debugger flag should be used?"
5063. ./myread
5064optimize="$ans"
5065case "$optimize" in
5066'none') optimize=" ";;
5067esac
5068
eaf812ae
MB
5069: Check what DEBUGGING is required from the command line
5070: -DEBUGGING or -DDEBUGGING or
5071: -DEBUGGING=both = -g + -DDEBUGGING
5072: -DEBUGGING=-g or -Doptimize=-g = -g
5073: -DEBUGGING=none or -UDEBUGGING =
5074: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5075case "$EBUGGING" in
5076'') ;;
5077*) DEBUGGING=$EBUGGING ;;
5078esac
5079
5080case "$DEBUGGING" in
5a7c70d6 5081-g|both|$define)
eaf812ae
MB
5082 case "$optimize" in
5083 *-g*) ;;
5084 *) optimize="$optimize -g" ;;
5085 esac ;;
5086none|$undef)
5087 case "$optimize" in
5088 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5089 shift
5090 optimize="$*"
5091 ;;
5092 esac ;;
5093esac
5094
bd9b35c9 5095dflt=''
eaf812ae
MB
5096case "$DEBUGGING" in
5097both|$define) dflt='-DDEBUGGING'
5098esac
5099
c34316b3
NC
5100: argument order is deliberate, as the flag will start with - which set could
5101: think is an option
6682be1c 5102checkccflag='check=$1; flag=$2; callback=$3;
c34316b3
NC
5103echo " ";
5104echo "Checking if your compiler accepts $flag" 2>&1;
5105echo "int main(void) { return 0; }" > gcctest.c;
04b62921 5106if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
c34316b3 5107 echo "Yes, it does." 2>&1;
580e570e 5108 if $test -s gcctest.out ; then
04b62921
MB
5109 echo "But your platform does not like it:";
5110 cat gcctest.out;
5111 else
5112 case "$ccflags" in
5113 *$check*)
5114 echo "Leaving current flags $ccflags alone." 2>&1
5115 ;;
5116 *) dflt="$dflt $flag";
5117 eval $callback
5118 ;;
5119 esac
5120 fi
c34316b3
NC
5121else
5122 echo "Nope, it does not, but that is ok." 2>&1;
5123fi
5124'
5125
bd9b35c9
JH
5126: We will not override a previous value, but we might want to
5127: augment a hint file
5128case "$hint" in
5129default|recommended)
5130 case "$gccversion" in
eaf812ae 5131 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5132 esac
eaf812ae
MB
5133 case "$optimize:$DEBUGGING" in
5134 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5135 esac
bd9b35c9 5136 case "$gccversion" in
580e570e 5137 2*) if $test -d /etc/conf/kconfig.d &&
bd9b35c9
JH
5138 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5139 then
00e89ad4 5140 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5141 dflt="$dflt -posix"
5142 fi
f0d04425 5143 ;;
bd9b35c9
JH
5144 esac
5145 case "$gccversion" in
5146 1*) ;;
5147 2.[0-8]*) ;;
c0bacbef 5148 ?*) set strict-aliasing -fno-strict-aliasing
c34316b3 5149 eval $checkccflag
f0d04425 5150 ;;
e5e20432 5151 esac
00e89ad4
AD
5152 # For gcc, adding -pipe speeds up compilations for some, but apparently
5153 # some assemblers can't read from stdin. (It also slows down compilations
5154 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5155 case "$gccversion" in
c34316b3
NC
5156 ?*) set pipe -pipe
5157 eval $checkccflag
00e89ad4
AD
5158 ;;
5159 esac
6682be1c
NC
5160
5161 # on x86_64 (at least) we require an extra library (libssp) in the
5162 # link command line. This library is not named, so I infer that it is
5163 # an implementation detail that may change. Hence the safest approach
5164 # is to add the flag to the flags passed to the compiler at link time,
5165 # as that way the compiler can do the right implementation dependant
5166 # thing. (NWC)
5167 case "$gccversion" in
8f68b0e6 5168 ?*) set stack-protector -fstack-protector
6682be1c
NC
5169 eval $checkccflag
5170 ;;
5171 esac
e5e20432
JH
5172 ;;
5173esac
5174
bd9b35c9
JH
5175case "$mips_type" in
5176*BSD*|'') inclwanted="$locincpth $usrinc";;
5177*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5178esac
5179for thisincl in $inclwanted; do
5180 if $test -d $thisincl; then
5181 if $test x$thisincl != x$usrinc; then
5182 case "$dflt" in
00e89ad4
AD
5183 *" -I$thisincl "*);;
5184 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5185 esac
5186 fi
5187 fi
5188done
40a7a20a 5189
bd9b35c9
JH
5190inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5191 xxx=true;
5192elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5193 xxx=true;
5194else
5195 xxx=false;
5196fi;
5197if $xxx; then
5198 case "$dflt" in
5199 *$2*);;
5200 *) dflt="$dflt -D$2";;
5201 esac;
5202fi'
40a7a20a 5203
bd9b35c9 5204set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5205
bd9b35c9
JH
5206case "$usesocks" in
5207$define)
5208 ccflags="$ccflags -DSOCKS"
5209 ;;
5210esac
40a7a20a 5211
bd9b35c9
JH
5212case "$hint" in
5213default|recommended) dflt="$ccflags $dflt" ;;
5214*) dflt="$ccflags";;
5215esac
40a7a20a 5216
bd9b35c9
JH
5217case "$dflt" in
5218''|' ') dflt=none;;
5219esac
422af00a 5220
bd9b35c9 5221$cat <<EOH
40a7a20a 5222
bd9b35c9
JH
5223Your C compiler may want other flags. For this question you should include
5224-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5225but you should NOT include libraries or ld flags like -lwhatever. If you
5226want $package to honor its debug switch, you should include -DDEBUGGING here.
5227Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5228
bd9b35c9 5229To use no flags, specify the word "none".
40a7a20a 5230
bd9b35c9
JH
5231EOH
5232set X $dflt
5233shift
5234dflt=${1+"$@"}
5235rp="Any additional cc flags?"
5236. ./myread
5237case "$ans" in
5238none) ccflags='';;
5239*) ccflags="$ans";;
5240esac
8e07c86e 5241
bd9b35c9 5242: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5243case "$cppflags" in
5244'') cppflags="$ccflags" ;;
5245*) cppflags="$cppflags $ccflags" ;;
5246esac
bd9b35c9
JH
5247case "$gccversion" in
52481*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5249esac
bd9b35c9
JH
5250case "$mips_type" in
5251'');;
5252*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5253esac
5254case "$cppflags" in
5255'');;
5256*)
5257 echo " "
5258 echo "Let me guess what the preprocessor flags are..." >&4
5259 set X $cppflags
5260 shift
5261 cppflags=''
5262 $cat >cpp.c <<'EOM'
5263#define BLURFL foo
8e07c86e 5264
bd9b35c9
JH
5265BLURFL xx LFRULB
5266EOM
5267 previous=''
5268 for flag in $*
5269 do
5270 case "$flag" in
5271 -*) ftry="$flag";;
5272 *) ftry="$previous $flag";;
5273 esac
5274 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5275 >cpp1.out 2>/dev/null && \
5276 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5277 >cpp2.out 2>/dev/null && \
5278 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5279 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5280 then
5281 cppflags="$cppflags $ftry"
5282 previous=''
5283 else
5284 previous="$flag"
5285 fi
5286 done
5287 set X $cppflags
5288 shift
5289 cppflags=${1+"$@"}
5290 case "$cppflags" in
5291 *-*) echo "They appear to be: $cppflags";;
5292 esac
5293 $rm -f cpp.c cpp?.out
2afac517 5294 ;;
5295esac
8e07c86e 5296
bd9b35c9
JH
5297: flags used in final linking phase
5298case "$ldflags" in
5299'') if ./venix; then
5300 dflt='-i -z'
10a23457 5301 else
bd9b35c9 5302 dflt=''
10a23457 5303 fi
bd9b35c9
JH
5304 case "$ccflags" in
5305 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5306 esac
bd9b35c9
JH
5307 ;;
5308*) dflt="$ldflags";;
5309esac
b2f871ed
AD
5310# See note above about -fstack-protector
5311case "$ccflags" in
5312*-fstack-protector*)
5313 case "$dflt" in
5314 *-fstack-protector*) ;; # Don't add it again
5315 *) dflt="$dflt -fstack-protector" ;;
5316 esac
5317 ;;
5318esac
bd9b35c9
JH
5319
5320: Try to guess additional flags to pick up local libraries.
5321for thislibdir in $libpth; do
5322 case " $loclibpth " in
5323 *" $thislibdir "*)
00e89ad4 5324 case "$dflt " in
bd9b35c9
JH
5325 *"-L$thislibdir "*) ;;
5326 *) dflt="$dflt -L$thislibdir" ;;
5327 esac
c4f23d77
AD
5328 ;;
5329 esac
bd9b35c9 5330done
c4f23d77 5331
bd9b35c9
JH
5332case "$dflt" in
5333'') dflt='none' ;;
5334esac
c4f23d77 5335
bd9b35c9
JH
5336$cat <<EOH
5337
5338Your C linker may need flags. For this question you should
5339include -L/whatever and any other flags used by the C linker, but you
5340should NOT include libraries like -lwhatever.
5341
5342Make sure you include the appropriate -L/path flags if your C linker
5343does not normally search all of the directories you specified above,
5344namely
5345 $libpth
5346To use no flags, specify the word "none".
5347
5348EOH
5349
5350rp="Any additional ld flags (NOT including libraries)?"
5351. ./myread
5352case "$ans" in
5353none) ldflags='';;
5354*) ldflags="$ans";;
5355esac
5356rmlist="$rmlist pdp11"
5357
5358: coherency check
5359echo " "
5360echo "Checking your choice of C compiler and flags for coherency..." >&4
5361$cat > try.c <<'EOF'
5362#include <stdio.h>
55954f19 5363int main() { printf("Ok\n"); return(0); }
bd9b35c9 5364EOF
7a282f6d 5365set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5366shift
5367$cat >try.msg <<'EOM'
5368I've tried to compile and run the following simple program:
5369
5370EOM
5371$cat try.c >> try.msg
5372
5373$cat >> try.msg <<EOM
5374
5375I used the command:
5376
5377 $*
5440bc8e 5378 $run ./try
bd9b35c9
JH
5379
5380and I got the following output:
5381
5382EOM
5383dflt=y
73614538 5384if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
613d6c3e 5385 if $sh -c "$run ./try " >>try.msg 2>&1; then
5440bc8e 5386 xxx=`$run ./try`
bd9b35c9
JH
5387 case "$xxx" in
5388 "Ok") dflt=n ;;
5389 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5390 case " $libs " in
5391 *" -lsfio "*)
5392 cat >> try.msg <<'EOQS'
5393If $libs contains -lsfio, and sfio is mis-configured, then it
5394sometimes (apparently) runs and exits with a 0 status, but with no
5395output! It may have to do with sfio's use of _exit vs. exit.
5396
5397EOQS
5398 rp="You have a big problem. Shall I abort Configure"
5399 dflt=y
5400 ;;
5401 esac
5402 ;;
5403 esac
5404 else
5405 echo "The program compiled OK, but exited with status $?." >>try.msg
5406 rp="You have a problem. Shall I abort Configure"
5407 dflt=y
5408 fi
5409else
5410 echo "I can't compile the test program." >>try.msg
5411 rp="You have a BIG problem. Shall I abort Configure"
5412 dflt=y
5413fi
5414case "$dflt" in
5415y)
5416 $cat try.msg >&4
5417 case "$knowitall" in
5418 '')
5419 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5420 ;;
bd9b35c9 5421 *) dflt=n;;
c4f23d77 5422 esac
bd9b35c9
JH
5423 echo " "
5424 . ./myread
5425 case "$ans" in
5426 n*|N*) ;;
5427 *) echo "Ok. Stopping Configure." >&4
5428 exit 1
c4f23d77
AD
5429 ;;
5430 esac
5431 ;;
bd9b35c9 5432n) echo "OK, that should do.";;
c4f23d77 5433esac
613d6c3e 5434$rm_try gcctest gcctest.out
c4f23d77 5435
bd9b35c9
JH
5436: define a shorthand compile call
5437compile='
5438mc_file=$1;
5439shift;
08593cf4
NC
5440case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5441echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5442exit 1;
5443fi;
5444esac;
08413ebc 5445$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5446: define a shorthand compile call for compilations that should be ok.
5447compile_ok='
5448mc_file=$1;
5449shift;
7a282f6d 5450$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5451
8dfa8df9
JH
5452: determine filename position in cpp output
5453echo " "
5454echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5455case "$osname" in
5456vos) testaccess=-e ;;
5457*) testaccess=-r ;;
5458esac
8dfa8df9
JH
5459echo '#include <stdio.h>' > foo.c
5460$cat >fieldn <<EOF
5461$startsh
5462$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5463$grep '^[ ]*#.*stdio\.h' | \
5464while read cline; do
5465 pos=1
5466 set \$cline
5467 while $test \$# -gt 0; do
a5a94ea5 5468 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5469 echo "\$pos"
5470 exit 0
5471 fi
5472 shift
5473 pos=\`expr \$pos + 1\`
5474 done
5475done
5476EOF
5477chmod +x fieldn
5478fieldn=`./fieldn`
5479$rm -f foo.c fieldn
5480case $fieldn in
5481'') pos='???';;
54821) pos=first;;
54832) pos=second;;
54843) pos=third;;
5485*) pos="${fieldn}th";;
5486esac
5487echo "Your cpp writes the filename in the $pos field of the line."
5488
3c728e00
JH
5489case "$osname" in
5490vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5491os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5492*) cppfilter='' ;;
5493esac
8dfa8df9
JH
5494: locate header file
5495$cat >findhdr <<EOF
5496$startsh
5497wanted=\$1
5498name=''
5499for usrincdir in $usrinc
5500do
5501 if test -f \$usrincdir/\$wanted; then
5502 echo "\$usrincdir/\$wanted"
5503 exit 0
5504 fi
5505done
5506awkprg='{ print \$$fieldn }'
5507echo "#include <\$wanted>" > foo\$\$.c
5508$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5509$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5510while read cline; do
5511 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5512 case "\$name" in
5513 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5514 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5515 *) exit 2;;
5516 esac;
5517done;
5518#
5519# status = 0: grep returned 0 lines, case statement not executed
5520# status = 1: headerfile found
5521# status = 2: while loop executed, no headerfile found
5522#
5523status=\$?
5524$rm -f foo\$\$.c;
5525if test \$status -eq 1; then
5526 exit 0;
5527fi
5528exit 1
5529EOF
5530chmod +x findhdr
5531
5532: define an alternate in-header-list? function
5533inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5534cont=true; xxf="echo \"<\$1> found.\" >&4";
5535case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5536*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5537esac;
5538case $# in 4) instead=instead;; *) instead="at last";; esac;
5539while $test "$cont"; do
5540 xxx=`./findhdr $1`
5541 var=$2; eval "was=\$$2";
5542 if $test "$xxx" && $test -r "$xxx";
5543 then eval $xxf;
5544 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5545 cont="";
5546 else eval $xxnf;
5547 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5548 set $yyy; shift; shift; yyy=$@;
5549 case $# in 0) cont="";;
5550 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5551 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5552 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5553 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5554 esac;
5555done;
5556while $test "$yyy";
5557do set $yyy; var=$2; eval "was=\$$2";
5558 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5559 set $yyy; shift; shift; yyy=$@;
5560done'
5561
d1daaddf
JH
5562: see if stdlib is available
5563set stdlib.h i_stdlib
5564eval $inhdr
5565
5566: check for lengths of integral types
5567echo " "
5568case "$intsize" in
5569'')
5570 echo "Checking to see how big your integers are..." >&4
c63dfae1 5571 $cat >try.c <<EOCP
d1daaddf
JH
5572#include <stdio.h>
5573#$i_stdlib I_STDLIB
5574#ifdef I_STDLIB
5575#include <stdlib.h>
5576#endif
5577int main()
5578{
5579 printf("intsize=%d;\n", (int)sizeof(int));
5580 printf("longsize=%d;\n", (int)sizeof(long));
5581 printf("shortsize=%d;\n", (int)sizeof(short));
5582 exit(0);
5583}
5584EOCP
5585 set try
5586 if eval $compile_ok && $run ./try > /dev/null; then
5587 eval `$run ./try`
5588 echo "Your integers are $intsize bytes long."
5589 echo "Your long integers are $longsize bytes long."
5590 echo "Your short integers are $shortsize bytes long."
5591 else
5592 $cat >&4 <<EOM
5593!
5594Help! I can't compile and run the intsize test program: please enlighten me!
5595(This is probably a misconfiguration in your system or libraries, and
5596you really ought to fix it. Still, I'll try anyway.)
5597!
5598EOM
5599 dflt=4
5600 rp="What is the size of an integer (in bytes)?"
5601 . ./myread
5602 intsize="$ans"
5603 dflt=$intsize
5604 rp="What is the size of a long integer (in bytes)?"
5605 . ./myread
5606 longsize="$ans"
5607 dflt=2
5608 rp="What is the size of a short integer (in bytes)?"
5609 . ./myread
5610 shortsize="$ans"
5611 fi
5612 ;;
5613esac
5b813a60 5614$rm_try
d1daaddf
JH
5615
5616: check for long long
5617echo " "
5618echo "Checking to see if you have long long..." >&4
5619echo 'int main() { long long x = 7; return 0; }' > try.c
5620set try
5621if eval $compile; then
5622 val="$define"
5623 echo "You have long long."
5624else
5625 val="$undef"
5626 echo "You do not have long long."
5627fi
5b813a60 5628$rm_try
d1daaddf
JH
5629set d_longlong
5630eval $setvar
5631
5632: check for length of long long
5633case "${d_longlong}${longlongsize}" in
5634$define)
5635 echo " "
5636 echo "Checking to see how big your long longs are..." >&4
5637 $cat >try.c <<'EOCP'
5638#include <stdio.h>
5639int main()
5640{
5641 printf("%d\n", (int)sizeof(long long));
5642 return(0);
5643}
5644EOCP
5645 set try
5646 if eval $compile_ok; then
5647 longlongsize=`$run ./try`
5648 echo "Your long longs are $longlongsize bytes long."
5649 else
5650 dflt='8'
5651 echo " "
5652 echo "(I can't seem to compile the test program. Guessing...)"
5653 rp="What is the size of a long long (in bytes)?"
5654 . ./myread
5655 longlongsize="$ans"
5656 fi
5657 if $test "X$longsize" = "X$longlongsize"; then
5658 echo "(That isn't any different from an ordinary long.)"
5b813a60 5659 fi
d1daaddf
JH
5660 ;;
5661esac
5b813a60 5662$rm_try
d1daaddf 5663
8dfa8df9
JH
5664: see if inttypes.h is available
5665: we want a real compile instead of Inhdr because some systems
5666: have an inttypes.h which includes non-existent headers
5667echo " "
5668$cat >try.c <<EOCP
5669#include <inttypes.h>
5670int main() {
5671 static int32_t foo32 = 0x12345678;
5672}
5673EOCP
5674set try
5675if eval $compile; then
5676 echo "<inttypes.h> found." >&4
5677 val="$define"
5678else
5679 echo "<inttypes.h> NOT found." >&4
5680 val="$undef"
5681fi
5b813a60 5682$rm_try
8dfa8df9
JH
5683set i_inttypes
5684eval $setvar
5685
5686: check for int64_t
5687echo " "
5688echo "Checking to see if you have int64_t..." >&4
5689$cat >try.c <<EOCP
5690#include <sys/types.h>
5691#$i_inttypes I_INTTYPES
5692#ifdef I_INTTYPES
5693#include <inttypes.h>
5694#endif
5695int main() { int64_t x = 7; }
5696EOCP
5697set try
5698if eval $compile; then
5699 val="$define"
5700 echo "You have int64_t."
5701else
5702 val="$undef"
5703 echo "You do not have int64_t."
5704fi
5b813a60 5705$rm_try
8dfa8df9
JH
5706set d_int64_t
5707eval $setvar
5708
613d6c3e 5709: Check if 64bit ints have a quad type
8dfa8df9
JH
5710echo " "
5711echo "Checking which 64-bit integer type we could use..." >&4
5712
5713case "$intsize" in
57148) val=int
5715 set quadtype
5716 eval $setvar
5717 val='"unsigned int"'
5718 set uquadtype
5719 eval $setvar
5720 quadkind=1
5721 ;;
5722*) case "$longsize" in
5723 8) val=long
5724 set quadtype
5725 eval $setvar
5726 val='"unsigned long"'
5727 set uquadtype
5728 eval $setvar
5729 quadkind=2
5730 ;;
5731 *) case "$d_longlong:$longlongsize" in
5732 define:8)
5733 val='"long long"'
5734 set quadtype
5735 eval $setvar
5736 val='"unsigned long long"'
5737 set uquadtype
5738 eval $setvar
5739 quadkind=3
5740 ;;
5741 *) case "$d_int64_t" in
5742 define)
5743 val=int64_t
5744 set quadtype
5745 eval $setvar
5746 val=uint64_t
5747 set uquadtype
5748 eval $setvar
5749 quadkind=4
5750 ;;
5751 esac
5752 ;;
5753 esac
5754 ;;
5755 esac
5756 ;;
5757esac
5758
5759case "$quadtype" in
5760'') echo "Alas, no 64-bit integer types in sight." >&4
5761 d_quad="$undef"
5762 ;;
5763*) echo "We could use '$quadtype' for 64-bit integers." >&4
5764 d_quad="$define"
5765 ;;
5766esac
5767
34f1896b 5768: Do we want 64bit support
b4eb6b3d
JH
5769case "$uselonglong" in
5770"$define"|true|[yY]*)
5771 cat <<EOM >&4
5772
5773*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5774EOM
5775 use64bitint="$define"
5776 ;;
613d6c3e 5777esac
b4eb6b3d
JH
5778case "$use64bits" in
5779"$define"|true|[yY]*)
5780 cat <<EOM >&4
5781
5782*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5783EOM
5784 use64bitint="$define"
5785 ;;
613d6c3e 5786esac
b4eb6b3d
JH
5787case "$use64bitints" in
5788"$define"|true|[yY]*)
5789 cat <<EOM >&4
5790
5791*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5792EOM
5793 use64bitint="$define"
5794 ;;
613d6c3e 5795esac
b4eb6b3d
JH
5796case "$use64bitsint" in
5797"$define"|true|[yY]*)
5798 cat <<EOM >&4
5799
5800*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5801EOM
5802 use64bitint="$define"
5803 ;;
613d6c3e 5804esac
b4eb6b3d
JH
5805case "$uselonglongs" in
5806"$define"|true|[yY]*)
5807 cat <<EOM >&4
5808
5809*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5810EOM
5811 use64bitint="$define"
5812 ;;
613d6c3e 5813esac
b4eb6b3d
JH
5814case "$use64bitsall" in
5815"$define"|true|[yY]*)
5816 cat <<EOM >&4
5817
5818*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5819EOM
5820 use64bitall="$define"
5821 ;;
613d6c3e 5822esac
b4eb6b3d
JH
5823
5824case "$ccflags" in
5825*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5826esac
5827case "$use64bitall" in
5828"$define"|true|[yY]*) use64bitint="$define" ;;
5829esac
5830
5831case "$longsize" in
58328) cat <<EOM
5833
5834You have natively 64-bit long integers.
5835EOM
5836 val="$define"
5837 ;;
5838*) case "$use64bitint" in
5839 "$define"|true|[yY]*) dflt='y';;
5840 *) dflt='n';;
5841 esac
8dfa8df9
JH
5842 case "$d_quad" in
5843 "$define") ;;
5844 *) dflt='n' ;;
5845 esac
b4eb6b3d
JH
5846 cat <<EOM
5847
5848Perl can be built to take advantage of 64-bit integer types
5849on some systems. To do so, Configure can be run with -Duse64bitint.
5850Choosing this option will most probably introduce binary incompatibilities.
5851
5852If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5853(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5854EOM
5855 rp='Try to use 64-bit integers, if available?'
5856 . ./myread
5857 case "$ans" in
5858 [yY]*) val="$define" ;;
5859 *) val="$undef" ;;
5860 esac
5861 ;;
5862esac
5863set use64bitint
5864eval $setvar
5865
5866case "$use64bitall" in
5867"$define"|true|[yY]*) dflt='y' ;;
5868*) case "$longsize" in
5869 8) dflt='y' ;;
5870 *) dflt='n' ;;
5871 esac
5872 ;;
613d6c3e 5873esac
b4eb6b3d
JH
5874cat <<EOM
5875
5876You may also choose to try maximal 64-bitness. It means using as much
587764-bitness as possible on the platform. This in turn means even more
5878binary incompatibilities. On the other hand, your platform may not
5879have any more 64-bitness available than what you already have chosen.
5880
5881If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5882(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5883EOM
5884rp='Try to use maximal 64-bit support, if available?'
5885. ./myread
5886case "$ans" in
5887[yY]*) val="$define" ;;
5888*) val="$undef" ;;
5889esac
5890set use64bitall
5891eval $setvar
5892case "$use64bitall" in
5893"$define")
5894 case "$use64bitint" in
5895 "$undef")
5896 cat <<EOM
5897
5898Since you have chosen a maximally 64-bit build, I'm also turning on
5899the use of 64-bit integers.
5900EOM
5901 use64bitint="$define" ;;
5902 esac
5903 ;;
5904esac
5905
b4eb6b3d
JH
5906: Look for a hint-file generated 'call-back-unit'. If the
5907: user has specified that a 64-bit perl is to be built,
5908: we may need to set or change some other defaults.
19a100ff 5909if $test -f use64bitint.cbu; then
9da7673b 5910 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5911 . ./use64bitint.cbu
5912fi
9da7673b
MB
5913case "$use64bitint" in
5914"$define"|true|[yY]*)
b4eb6b3d
JH
5915 case "$longsize" in
5916 4) case "$archname64" in
5917 '') archname64=64int ;;
5918 esac
5919 ;;
5920 esac
5921 ;;
5922esac
5923
b4eb6b3d
JH
5924: Look for a hint-file generated 'call-back-unit'. If the
5925: user has specified that a maximally 64-bit perl is to be built,
5926: we may need to set or change some other defaults.
19a100ff 5927if $test -f use64bitall.cbu; then
9da7673b 5928 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5929 . ./use64bitall.cbu
5930fi
9da7673b
MB
5931case "$use64bitall" in
5932"$define"|true|[yY]*)
b4eb6b3d
JH
5933 case "$longsize" in
5934 4) case "$archname64" in
5935 ''|64int) archname64=64all ;;
5936 esac
5937 ;;
5938 esac
5939 ;;
5940esac
5941
1911a026
JH
5942case "$d_quad:$use64bitint" in
5943$undef:$define)
5944 cat >&4 <<EOF
5945
5946*** You have chosen to use 64-bit integers,
19a100ff 5947*** but none can be found.
09b58c7b 5948*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5949*** Cannot continue, aborting.
5950
5951EOF
5952 exit 1
5953 ;;
5954esac
5955
36adc09b
JH
5956: check for length of double
5957echo " "
5958case "$doublesize" in
5959'')
5960 echo "Checking to see how big your double precision numbers are..." >&4
5961 $cat >try.c <<EOCP
5962#include <stdio.h>
1911a026
JH
5963#$i_stdlib I_STDLIB
5964#ifdef I_STDLIB
5965#include <stdlib.h>
5966#endif
36adc09b
JH
5967int main()
5968{
5969 printf("%d\n", (int)sizeof(double));
1911a026 5970 exit(0);
36adc09b
JH
5971}
5972EOCP
5973 set try
5974 if eval $compile_ok; then
5975 doublesize=`$run ./try`
5976 echo "Your double is $doublesize bytes long."
5977 else
5978 dflt='8'
5979 echo "(I can't seem to compile the test program. Guessing...)"
5980 rp="What is the size of a double precision number (in bytes)?"
5981 . ./myread
5982 doublesize="$ans"
5983 fi
5984 ;;
5985esac
5b813a60 5986$rm_try
36adc09b
JH
5987
5988: check for long doubles
5989echo " "
5990echo "Checking to see if you have long double..." >&4
5991echo 'int main() { long double x = 7.0; }' > try.c
5992set try
5993if eval $compile; then
5994 val="$define"
5995 echo "You have long double."
5996else
5997 val="$undef"
5998 echo "You do not have long double."
5999fi
5b813a60 6000$rm_try
36adc09b
JH
6001set d_longdbl
6002eval $setvar
6003
6004: check for length of long double
6005case "${d_longdbl}${longdblsize}" in
6006$define)
6007 echo " "
6008 echo "Checking to see how big your long doubles are..." >&4
6009 $cat >try.c <<'EOCP'
6010#include <stdio.h>
6011int main()
6012{
6013 printf("%d\n", sizeof(long double));
6014}
6015EOCP
6016 set try
6017 set try
6018 if eval $compile; then
6019 longdblsize=`$run ./try`
6020 echo "Your long doubles are $longdblsize bytes long."
6021 else
6022 dflt='8'
6023 echo " "
6024 echo "(I can't seem to compile the test program. Guessing...)" >&4
6025 rp="What is the size of a long double (in bytes)?"
6026 . ./myread
6027 longdblsize="$ans"
6028 fi
6029 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
6030 echo "That isn't any different from an ordinary double."
6031 echo "I'll keep your setting anyway, but you may see some"
6032 echo "harmless compilation warnings."
5b813a60 6033 fi
36adc09b
JH
6034 ;;
6035esac
5b813a60 6036$rm_try
36adc09b 6037
89ce900e 6038: determine the architecture name
b4eb6b3d 6039echo " "
89ce900e
JH
6040if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6041 tarch=`arch`"-$osname"
6042elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6043 if uname -m > tmparch 2>&1 ; then
6044 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6045 -e 's/$/'"-$osname/" tmparch`
6046 else
6047 tarch="$osname"
6048 fi
6049 $rm -f tmparch
b4eb6b3d 6050else
89ce900e 6051 tarch="$osname"
b4eb6b3d 6052fi
89ce900e
JH
6053case "$myarchname" in
6054''|"$tarch") ;;
6055*)
6056 echo "(Your architecture name used to be $myarchname.)"
6057 archname=''
6058 ;;
6059esac
6060case "$targetarch" in
6061'') ;;
6062*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6063esac
6064myarchname="$tarch"
6065case "$archname" in
6066'') dflt="$tarch";;
6067*) dflt="$archname";;
6068esac
6069rp='What is your architecture name'
6070. ./myread
6071archname="$ans"
6072case "$usethreads" in
6073$define)
6074 echo "Threads selected." >&4
6075 case "$archname" in
6076 *-thread*) echo "...and architecture name already has -thread." >&4
6077 ;;
6078 *) archname="$archname-thread"
6079 echo "...setting architecture name to $archname." >&4
6080 ;;
6081 esac
6082 ;;
6083esac
6084case "$usemultiplicity" in
6085$define)
6086 echo "Multiplicity selected." >&4
6087 case "$archname" in
6088 *-multi*) echo "...and architecture name already has -multi." >&4
6089 ;;
6090 *) archname="$archname-multi"
6091 echo "...setting architecture name to $archname." >&4
6092 ;;
6093 esac
6094 ;;
6095esac
6096case "$use64bitint$use64bitall" in
6097*"$define"*)
6098 case "$archname64" in
6099 '')
6100 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6101 ;;
89ce900e
JH
6102 *)
6103 case "$use64bitint" in
6104 "$define") echo "64 bit integers selected." >&4 ;;
6105 esac
6106 case "$use64bitall" in
6107 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6108 esac
6109 case "$archname" in
6110 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6111 ;;
6112 *) archname="$archname-$archname64"
6113 echo "...setting architecture name to $archname." >&4
6114 ;;
6115 esac
c1a7f87b
JH
6116 ;;
6117 esac
89ce900e
JH
6118esac
6119case "$uselongdouble" in
6120$define)
6121 echo "Long doubles selected." >&4
6122 case "$longdblsize" in
6123 $doublesize)
6124 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6125 ;;
6126 *)
6127 case "$archname" in
6128 *-ld*) echo "...and architecture name already has -ld." >&4
6129 ;;
6130 *) archname="$archname-ld"
6131 echo "...setting architecture name to $archname." >&4
6132 ;;
6133 esac
bd9b35c9
JH
6134 ;;
6135 esac
bd9b35c9 6136 ;;
89ce900e
JH
6137esac
6138case "$useperlio" in
6139$define)
6140 echo "Perlio selected." >&4
6141 ;;
bd9b35c9 6142*)
89ce900e
JH
6143 echo "Perlio not selected, using stdio." >&4
6144 case "$archname" in
6145 *-stdio*) echo "...and architecture name already has -stdio." >&4
6146 ;;
6147 *) archname="$archname-stdio"
6148 echo "...setting architecture name to $archname." >&4
6149 ;;
6150 esac
bd9b35c9
JH
6151 ;;
6152esac
d2e0c6f7
JH
6153if $test -f archname.cbu; then
6154 echo "Your platform has some specific hints for architecture name, using them..."
6155 . ./archname.cbu
6156fi
bd9b35c9 6157
b4eb6b3d
JH
6158: set the prefixit variable, to compute a suitable default value
6159prefixit='case "$3" in
6160""|none)
6161 case "$oldprefix" in
6162 "") eval "$1=\"\$$2\"";;
6163 *)
6164 case "$3" in
6165 "") eval "$1=";;
6166 none)
6167 eval "tp=\"\$$2\"";
6168 case "$tp" in
6169 ""|" ") eval "$1=\"\$$2\"";;
6170 *) eval "$1=";;
6171 esac;;
6172 esac;;
6173 esac;;
6174*)
6175 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6176 case "$tp" in
6177 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6178 /*-$oldprefix/*|\~*-$oldprefix/*)
6179 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6180 *) eval "$1=\"\$$2\"";;
6181 esac;;
6182esac'
6183
f3f1a2d8
MB
6184: determine installation style
6185: For now, try to deduce it from prefix unless it is already set.
6186: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6187case "$installstyle" in
6188'') case "$prefix" in
6189 *perl*) dflt='lib';;
6190 *) dflt='lib/perl5' ;;
6191 esac
6192 ;;
6193*) dflt="$installstyle" ;;
4d20abad 6194esac
f3f1a2d8
MB
6195: Probably not worth prompting for this since we prompt for all
6196: the directories individually, and the prompt would be too long and
6197: confusing anyway.
6198installstyle=$dflt
4d20abad 6199
eaf812ae
MB
6200: determine where public executables go
6201echo " "
6202set dflt bin bin
6203eval $prefixit
6204fn=d~
6205rp='Pathname where the public executables will reside?'
6206. ./getfile
6207if $test "X$ansexp" != "X$binexp"; then
6208 installbin=''
6209fi
6210prefixvar=bin
6211: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6212: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6213: this via initialinstalllocation
eaf812ae
MB
6214. ./setprefixvar
6215
6216case "$userelocatableinc" in
6217$define|true|[yY]*) dflt='y' ;;
6218*) dflt='n' ;;
6219esac
6220cat <<EOM
6221
6222Would you like to build Perl so that the installation is relocatable, so that
6223library paths in @INC are determined relative to the path of the perl binary?
6224This is not advised for system Perl installs, or if you need to run setid
6225scripts or scripts under taint mode.
6226
6227If this doesn't make any sense to you, just accept the default '$dflt'.
6228EOM
6229rp='Use relocatable @INC?'
6230. ./myread
6231case "$ans" in
6232y|Y) val="$define" ;;
6233*) val="$undef" ;;
6234esac
6235set userelocatableinc
6236eval $setvar
6237
ea7d701d 6238initialinstalllocation="$binexp"
eaf812ae
MB
6239: Default prefix is now "up one level from where the binaries are"
6240case "$userelocatableinc" in
6241$define|true|[yY]*)
eaf812ae
MB
6242 bin=".../"
6243 binexp=".../"
6244 prefix=".../.."
6245 prefixexp=".../.."
6246 installprefixexp=".../.."
6247 ;;
6248esac
6249
b4eb6b3d
JH
6250: determine where private library files go
6251: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6252: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6253: /opt/perl/lib/perl5... would be redundant.
6254: The default "style" setting is made in installstyle.U
6255case "$installstyle" in
6256*lib/perl5*) set dflt privlib lib/$package/$version ;;
6257*) set dflt privlib lib/$version ;;
6258esac
6259eval $prefixit
6260$cat <<EOM
6261
6262There are some auxiliary files for $package that need to be put into a
6263private library directory that is accessible by everyone.
6264
6265EOM
eaf812ae 6266fn=$binexp
b4eb6b3d
JH
6267fn=d~+
6268rp='Pathname where the private library files will reside?'
6269. ./getfile
79522dd2
NC
6270prefixvar=privlib
6271. ./setprefixvar
b4eb6b3d
JH
6272
6273: set the prefixup variable, to restore leading tilda escape
6274prefixup='case "$prefixexp" in
6275"$prefix") ;;
6276*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6277esac'
6278
6279: determine where public architecture dependent libraries go
6280set archlib archlib
6281eval $prefixit
6282: privlib default is /usr/local/lib/$package/$version
6283: archlib default is /usr/local/lib/$package/$version/$archname
6284: privlib may have an optional trailing /share.
6285tdflt=`echo $privlib | $sed 's,/share$,,'`
6286tdflt=$tdflt/$archname
6287case "$archlib" in
6288'') dflt=$tdflt
6289 ;;
6290*) dflt="$archlib"
6291 ;;
6292esac
6293$cat <<EOM
6294
6295$spackage contains architecture-dependent library files. If you are
6296sharing libraries in a heterogeneous environment, you might store
6297these files in a separate location. Otherwise, you can just include
6298them with the rest of the public library files.
6299
6300EOM
eaf812ae 6301fn=$binexp
b4eb6b3d
JH
6302fn=d+~
6303rp='Where do you want to put the public architecture-dependent libraries?'
6304. ./getfile
79522dd2
NC
6305prefixvar=archlib
6306. ./setprefixvar
b4eb6b3d
JH
6307if $test X"$archlib" = X"$privlib"; then
6308 d_archlib="$undef"
6309else
6310 d_archlib="$define"
6311fi
b4eb6b3d 6312
b4eb6b3d
JH
6313: see if setuid scripts can be secure
6314$cat <<EOM
6315
6316Some kernels have a bug that prevents setuid #! scripts from being
6317secure. Some sites have disabled setuid #! scripts because of this.
6318
6319First let's decide if your kernel supports secure setuid #! scripts.
6320(If setuid #! scripts would be secure but have been disabled anyway,
6321don't say that they are secure if asked.)
6322
6323EOM
6324
6325val="$undef"
6326if $test -d /dev/fd; then
6327 echo "#!$ls" >reflect
6328 chmod +x,u+s reflect
6329 ./reflect >flect 2>&1
6330 if $contains "/dev/fd" flect >/dev/null; then
6331 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6332 val="$define"
6333 else
6334 $cat <<EOM
6335If you are not sure if they are secure, I can check but I'll need a
6336username and password different from the one you are using right now.
6337If you don't have such a username or don't want me to test, simply
6338enter 'none'.
6339
6340EOM
6341 rp='Other username to test security of setuid scripts with?'
6342 dflt='none'
6343 . ./myread
6344 case "$ans" in
6345 n|none)
6346 case "$d_suidsafe" in
6347 '') echo "I'll assume setuid scripts are *not* secure." >&4
6348 dflt=n;;
6349 "$undef")
6350 echo "Well, the $hint value is *not* secure." >&4
6351 dflt=n;;
6352 *) echo "Well, the $hint value *is* secure." >&4
6353 dflt=y;;
6354 esac
c1a7f87b 6355 ;;
b4eb6b3d
JH
6356 *)
6357 $rm -f reflect flect
6358 echo "#!$ls" >reflect
6359 chmod +x,u+s reflect
6360 echo >flect
6361 chmod a+w flect
6362 echo '"su" will (probably) prompt you for '"$ans's password."
6363 su $ans -c './reflect >flect'
6364 if $contains "/dev/fd" flect >/dev/null; then
6365 echo "Okay, it looks like setuid scripts are secure." >&4
6366 dflt=y
6367 else
6368 echo "I don't think setuid scripts are secure." >&4
6369 dflt=n
6370 fi
6371 ;;
6372 esac
6373 rp='Does your kernel have *secure* setuid scripts?'
6374 . ./myread
6375 case "$ans" in
6376 [yY]*) val="$define";;
6377 *) val="$undef";;
6378 esac
6379 fi
6380else
6381 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6382 echo "(That's for file descriptors, not floppy disks.)"
6383 val="$undef"
6384fi
6385set d_suidsafe
6386eval $setvar
6387
6388$rm -f reflect flect
6389
6390: now see if they want to do setuid emulation
01614441 6391if $test $patchlevel -lt 11; then
b4eb6b3d
JH
6392echo " "
6393val="$undef"
6394case "$d_suidsafe" in
6395"$define")
6396 val="$undef"
3c728e00 6397 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6398 ;;
f3f1a2d8
MB
6399*)
6400 $cat <<EOM
6401Some systems have disabled setuid scripts, especially systems where
6402setuid scripts cannot be secure. On systems where setuid scripts have
6403been disabled, the setuid/setgid bits on scripts are currently
6404useless. It is possible for $package to detect those bits and emulate
6405setuid/setgid in a secure fashion. This emulation will only work if
6406setuid scripts have been disabled in your kernel.
6407
6408EOM
6409 case "$d_dosuid" in
6410 "$define") dflt=y ;;
6411 *) dflt=n ;;
6412 esac
6413 rp="Do you want to do setuid/setgid emulation?"
6414 . ./myread
6415 case "$ans" in
6416 [yY]*) val="$define";;
6417 *) val="$undef";;
6418 esac
6419 ;;
6420esac
6421set d_dosuid
6422eval $setvar
01614441
MB
6423else
6424 case "$d_dosuid" in
6425 "$define")
6426 cat >&4 <<EOH
6427
6428SUID emulation has been removed for 5.12
6429Please re-run Configure without -Dd_dosuid
6430
6431EOH
6432 exit 1;
6433 ;;
6434 esac
6435 d_dosuid=undef
6436fi
f3f1a2d8 6437
f3f1a2d8
MB
6438: Find perl5.005 or later.
6439echo "Looking for a previously installed perl5.005 or later... "
6440case "$perl5" in
6441'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6442 : Check if this perl is recent and can load a simple module
6443 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6444 perl5=$tdir/perl
6445 break;
6446 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6447 perl5=$tdir/perl5
6448 break;
6449 fi
6450 done
6451 ;;
6452*) perl5="$perl5"
6453 ;;
6454esac
6455case "$perl5" in
6456'') echo "None found. That's ok.";;
6457*) echo "Using $perl5." ;;
6458esac
6459
613d6c3e 6460: Set the siteprefix variables
f3f1a2d8
MB
6461$cat <<EOM
6462
6463After $package is installed, you may wish to install various
6464add-on modules and utilities. Typically, these add-ons will
6465be installed under $prefix with the rest
6466of this package. However, you may wish to install such add-ons
6467elsewhere under a different prefix.
6468
6469If you do not wish to put everything under a single prefix, that's
6470ok. You will be prompted for the individual locations; this siteprefix
6471is only used to suggest the defaults.
6472
6473The default should be fine for most people.
6474
6475EOM
6476fn=d~+
6477rp='Installation prefix to use for add-on modules and utilities?'
6478: XXX Here might be another good place for an installstyle setting.
6479case "$siteprefix" in
6480'') dflt=$prefix ;;
6481*) dflt=$siteprefix ;;
6482esac
6483. ./getfile
6484: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6485oldsiteprefix=''
6486case "$siteprefix" in
6487'') ;;
6488*) case "$ans" in
6489 "$prefix") ;;
6490 *) oldsiteprefix="$prefix";;
6491 esac
6492 ;;
6493esac
6494siteprefix="$ans"
6495siteprefixexp="$ansexp"
6496
6497: determine where site specific libraries go.
6498: Usual default is /usr/local/lib/perl5/site_perl/$version
6499: The default "style" setting is made in installstyle.U
6500: XXX No longer works with Prefixit stuff.
6501prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6502case "$sitelib" in
6503'') case "$installstyle" in
6504 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6505 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6506 esac
6507 ;;
6508*) dflt="$sitelib"
6509 ;;
6510esac
6511$cat <<EOM
6512
6513The installation process will create a directory for
6514site-specific extensions and modules. Most users find it convenient
6515to place all site-specific files in this directory rather than in the
6516main distribution directory.
6517
6518EOM
6519fn=d~+
6520rp='Pathname for the site-specific library files?'
6521. ./getfile
6522prefixvar=sitelib
6523. ./setprefixvar
6524sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6525
6526: Determine list of previous versions to include in @INC
6527$cat > getverlist <<EOPL
6528#!$perl5 -w
6529use File::Basename;
6530\$api_versionstring = "$api_versionstring";
6531\$version = "$version";
6532\$stem = "$sitelib_stem";
6533\$archname = "$archname";
6534EOPL
6535 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6536# The list found is store twice for each entry: the original name, and
6537# the binary broken down version as pack "sss", so sorting is easy and
6538# unambiguous. This will work for all versions that have a maximum of
6539# three digit groups, separate by '.'s or '_'s. Names are extended with
6540# ".0.0" to ensure at least three elements for the pack.
6541# -- H.Merijn Brand (m)'06 23-10-2006
6542
f3f1a2d8
MB
6543# Can't have leading @ because metaconfig interprets it as a command!
6544;@inc_version_list=();
6545# XXX Redo to do opendir/readdir?
6546if (-d $stem) {
6547 chdir($stem);
13cfc98d
MB
6548 ;@candidates = map {
6549 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
a71f1801 6550 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
f3f1a2d8
MB
6551}
6552else {
6553 ;@candidates = ();
6554}
6555
13cfc98d
MB
6556($pversion, $aversion, $vsn5005) = map {
6557 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6558foreach $d (@candidates) {
13cfc98d
MB
6559 if ($d->[1] lt $pversion) {
6560 if ($d->[1] ge $aversion) {
6561 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6562 }
13cfc98d
MB
6563 elsif ($d->[1] ge $vsn5005) {
6564 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6565 }
6566 }
6567 else {
6568 # Skip newer version. I.e. don't look in
6569 # 5.7.0 if we're installing 5.6.1.
6570 }
6571}
6572
6573if (@inc_version_list) {
6574 print join(' ', @inc_version_list);
6575}
6576else {
6577 # Blank space to preserve value for next Configure run.
6578 print " ";
6579}
6580EOPL
6581chmod +x getverlist
6582case "$inc_version_list" in
6583'') if test -x "$perl5$exe_ext"; then
6584 dflt=`$perl5 getverlist`
6585 else
6586 dflt='none'
6587 fi
6588 ;;
6589$undef) dflt='none' ;;
6590*) eval dflt=\"$inc_version_list\" ;;
6591esac
6592case "$dflt" in
6593''|' ') dflt=none ;;
6594esac
6595case "$dflt" in
65965.005) dflt=none ;;
6597esac
6598$cat <<EOM
6599
6600In order to ease the process of upgrading, this version of perl
6601can be configured to use modules built and installed with earlier
6602versions of perl that were installed under $prefix. Specify here
6603the list of earlier versions that this version of perl should check.
6604If Configure detected no earlier versions of perl installed under
6605$prefix, then the list will be empty. Answer 'none' to tell perl
6606to not search earlier versions.
b4eb6b3d 6607
f3f1a2d8
MB
6608The default should almost always be sensible, so if you're not sure,
6609just accept the default.
b4eb6b3d 6610EOM
f3f1a2d8
MB
6611
6612rp='List of earlier versions to include in @INC?'
6613. ./myread
6614case "$ans" in
6615[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6616*) inc_version_list="$ans" ;;
6617esac
6618case "$inc_version_list" in
6619''|' ')
6620 inc_version_list_init='0'
6621 d_inc_version_list="$undef"
6622 ;;
6623*) inc_version_list_init=`echo $inc_version_list |
6624 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6625 d_inc_version_list="$define"
b4eb6b3d
JH
6626 ;;
6627esac
f3f1a2d8 6628$rm -f getverlist
b4eb6b3d 6629
1cd66f7c
DD
6630: see if malloc/malloc.h has to be included
6631set malloc/malloc.h i_mallocmalloc
6632eval $inhdr
6633
b4eb6b3d 6634: see if this is a malloc.h system
01d07975
YST
6635: we want a real compile instead of Inhdr because some systems have a
6636: malloc.h that just gives a compile error saying to use stdlib.h instead
6637echo " "
6638$cat >try.c <<EOCP
6639#include <stdlib.h>
6640#include <malloc.h>
f25eda10 6641#$i_mallocmalloc I_MALLOCMALLOC
1cd66f7c
DD
6642#ifdef I_MALLOCMALLOC
6643# include <malloc/malloc.h>
6644#endif
6645
01d07975
YST
6646int main () { return 0; }
6647EOCP
6648set try
6649if eval $compile; then
6650 echo "<malloc.h> found." >&4
6651 val="$define"
6652else
6653 echo "<malloc.h> NOT found." >&4
6654 val="$undef"
6655fi
5b813a60 6656$rm_try
01d07975
YST
6657set i_malloc
6658eval $setvar
b4eb6b3d 6659
c8b93cf9
JH
6660: check for void type
6661echo " "
6662echo "Checking to see how well your C compiler groks the void type..." >&4
6663case "$voidflags" in
6664'')
c727eafa 6665 $cat >try.c <<EOCP
d1daaddf
JH
6666#$i_stdlib I_STDLIB
6667#ifdef I_STDLIB
6668#include <stdlib.h>
6669#endif
c8b93cf9
JH
6670#if TRY & 1
6671void sub() {
6672#else
6673sub() {
6674#endif
6675 extern void moo(); /* function returning void */
6676 void (*goo)(); /* ptr to func returning void */
6677#if TRY & 8
6678 void *hue; /* generic ptr */
6679#endif
6680#if TRY & 2
6681 void (*foo[10])();
6682#endif
6683
6684#if TRY & 4
6685 if(goo == moo) {
6686 exit(0);
6687 }
6688#endif
6689 exit(0);
6690}
6691int main() { sub(); }
6692EOCP
6693 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6694 voidflags=$defvoidused
6695 echo "Good. It appears to support void to the level $package wants.">&4
6696 if $contains warning .out >/dev/null 2>&1; then
6697 echo "However, you might get some warnings that look like this:"
6698 $cat .out
6699 fi
6700 else
6701echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6702 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6703 echo "It supports 1..."
6704 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6705 echo "It also supports 2..."
6706 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6707 voidflags=7
6708 echo "And it supports 4 but not 8 definitely."
6709 else
6710 echo "It doesn't support 4..."
6711 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6712 voidflags=11
6713 echo "But it supports 8."
6714 else
6715 voidflags=3
6716 echo "Neither does it support 8."
6717 fi
6718 fi
6719 else
6720 echo "It does not support 2..."
6721 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6722 voidflags=13
6723 echo "But it supports 4 and 8."
6724 else
6725 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6726 voidflags=5
6727 echo "And it supports 4 but has not heard about 8."
6728 else
6729 echo "However it supports 8 but not 4."
6730 fi
6731 fi
6732 fi
6733 else
6734 echo "There is no support at all for void."
6735 voidflags=0
6736 fi
6737 fi
6738esac
6739case "$voidflags" in
6740"$defvoidused") ;;
6741*) $cat >&4 <<'EOM'
6742 Support flag bits are:
6743 1: basic void declarations.
6744 2: arrays of pointers to functions returning void.
6745 4: operations between pointers to and addresses of void functions.
6746 8: generic void pointers.
6747EOM
6748 dflt="$voidflags";
6749 rp="Your void support flags add up to what?"
6750 . ./myread
6751 voidflags="$ans"
6752 ;;
6753esac
5b813a60 6754$rm_try
c8b93cf9
JH
6755
6756: check for length of pointer
6757echo " "
6758case "$ptrsize" in
6759'')
6760 echo "Checking to see how big your pointers are..." >&4
6761 if test "$voidflags" -gt 7; then
6762 echo '#define VOID_PTR char *' > try.c
6763 else
6764 echo '#define VOID_PTR void *' > try.c
6765 fi
74d00865 6766 $cat >>try.c <<EOCP
c8b93cf9 6767#include <stdio.h>
d1daaddf
JH
6768#$i_stdlib I_STDLIB
6769#ifdef I_STDLIB
6770#include <stdlib.h>
6771#endif
c8b93cf9
JH
6772int main()
6773{
6774 printf("%d\n", (int)sizeof(VOID_PTR));
6775 exit(0);
6776}
6777EOCP
6778 set try
6779 if eval $compile_ok; then
6780 ptrsize=`$run ./try`
6781 echo "Your pointers are $ptrsize bytes long."
6782 else
6783 dflt='4'
6784 echo "(I can't seem to compile the test program. Guessing...)" >&4
6785 rp="What is the size of a pointer (in bytes)?"
6786 . ./myread
6787 ptrsize="$ans"
6788 fi
6789 ;;
6790esac
5b813a60 6791$rm_try
c8b93cf9
JH
6792case "$use64bitall" in
6793"$define"|true|[yY]*)
6794 case "$ptrsize" in
6795 4) cat <<EOM >&4
6796
1911a026
JH
6797*** You have chosen a maximally 64-bit build,
6798*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6799*** Please rerun Configure without -Duse64bitall.
6800EOM
6801 case "$d_quad" in
6802 define)
6803 cat <<EOM >&4
6804*** Since you have quads, you could possibly try with -Duse64bitint.
6805EOM
6806 ;;
6807 esac
6808 cat <<EOM >&4
1911a026 6809*** Cannot continue, aborting.
c8b93cf9
JH
6810
6811EOM
09b58c7b 6812
1911a026 6813 exit 1
c8b93cf9
JH
6814 ;;
6815 esac
6816 ;;
6817esac
6818
19a100ff 6819
9df442c2
NC
6820: determine whether to use malloc wrapping
6821echo " "
6822case "$usemallocwrap" in
6823[yY]*|true|$define) dflt='y' ;;
6824[nN]*|false|$undef) dflt='n' ;;
6825*) case "$usedevel" in
6826 [yY]*|true|$define) dflt='y' ;;
6827 *) dflt='n' ;;
6828 esac
6829 ;;
6830esac
6831rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6832. ./myread
6833usemallocwrap="$ans"
6834case "$ans" in
6835y*|true)
6836 usemallocwrap="$define" ;;
6837*)
6838 usemallocwrap="$undef" ;;
6839esac
c8b93cf9 6840
b4eb6b3d
JH
6841: determine which malloc to compile in
6842echo " "
6843case "$usemymalloc" in
c4163172
JH
6844[yY]*|true|$define) dflt='y' ;;
6845[nN]*|false|$undef) dflt='n' ;;
6846*) case "$ptrsize" in
6847 4) dflt='y' ;;
6848 *) dflt='n' ;;
6849 esac
6850 ;;
8dfa8df9 6851esac
b4eb6b3d
JH
6852rp="Do you wish to attempt to use the malloc that comes with $package?"
6853. ./myread
6854usemymalloc="$ans"
6855case "$ans" in
6856y*|true)
6857 usemymalloc='y'
6858 mallocsrc='malloc.c'
6859 mallocobj="malloc$_o"
6860 d_mymalloc="$define"
6861 case "$libs" in
6862 *-lmalloc*)
6863 : Remove malloc from list of libraries to use
6864 echo "Removing unneeded -lmalloc from library list" >&4
6865 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6866 shift
6867 libs="$*"
6868 echo "libs = $libs" >&4
6869 ;;
6870 esac
6871 ;;
6872*)
6873 usemymalloc='n'
6874 mallocsrc=''
6875 mallocobj=''
6876 d_mymalloc="$undef"
6877 ;;
6878esac
6879
6880: compute the return types of malloc and free
6881echo " "
6882$cat >malloc.c <<END
6883#$i_malloc I_MALLOC
6884#$i_stdlib I_STDLIB
6885#include <stdio.h>
6886#include <sys/types.h>
6887#ifdef I_MALLOC
6888#include <malloc.h>
6889#endif
6890#ifdef I_STDLIB
6891#include <stdlib.h>
6892#endif
6893#ifdef TRY_MALLOC
6894void *malloc();
6895#endif
6896#ifdef TRY_FREE
6897void free();
6898#endif
6899END
6900case "$malloctype" in
6901'')
6902 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6903 malloctype='void *'
6904 else
6905 malloctype='char *'
6906 fi
6907 ;;
6908esac
6909echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6910
6911case "$freetype" in
6912'')
6913 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6914 freetype='void'
6915 else
6916 freetype='int'
6917 fi
6918 ;;
6919esac
6920echo "Your system uses $freetype free(), it would seem." >&4
6921$rm -f malloc.[co]
b4eb6b3d
JH
6922: determine where site specific architecture-dependent libraries go.
6923: sitelib default is /usr/local/lib/perl5/site_perl/$version
6924: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6925: sitelib may have an optional trailing /share.
6926case "$sitearch" in
6927'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6928 dflt="$dflt/$archname"
6929 ;;
6930*) dflt="$sitearch"
6931 ;;
6932esac
6933set sitearch sitearch none
6934eval $prefixit
6935$cat <<EOM
6936
6937The installation process will also create a directory for
6938architecture-dependent site-specific extensions and modules.
6939
6940EOM
6941fn=d~+
6942rp='Pathname for the site-specific architecture-dependent library files?'
6943. ./getfile
79522dd2
NC
6944prefixvar=sitearch
6945. ./setprefixvar
c95d0e17
GA
6946if $test X"$sitearch" = X"$sitelib"; then
6947 d_sitearch="$undef"
6948else
6949 d_sitearch="$define"
6950fi
b4eb6b3d 6951
613d6c3e 6952: Set the vendorprefix variables
b4eb6b3d
JH
6953$cat <<EOM
6954
6955The installation process will also create a directory for
6956vendor-supplied add-ons. Vendors who supply perl with their system
6957may find it convenient to place all vendor-supplied files in this
6958directory rather than in the main distribution directory. This will
6959ease upgrades between binary-compatible maintenance versions of perl.
6960
6961Of course you may also use these directories in whatever way you see
6962fit. For example, you might use them to access modules shared over a
6963company-wide network.
6964
6965The default answer should be fine for most people.
6966This causes further questions about vendor add-ons to be skipped
6967and no vendor-specific directories will be configured for perl.
6968
6969EOM
6970rp='Do you want to configure vendor-specific add-on directories?'
6971case "$usevendorprefix" in
6972define|true|[yY]*) dflt=y ;;
6973*) : User may have set vendorprefix directly on Configure command line.
6974 case "$vendorprefix" in
6975 ''|' ') dflt=n ;;
6976 *) dflt=y ;;
6977 esac
6978 ;;
6979esac
6980. ./myread
6981case "$ans" in
6982[yY]*) fn=d~+
6983 rp='Installation prefix to use for vendor-supplied add-ons?'
6984 case "$vendorprefix" in
6985 '') dflt='' ;;
6986 *) dflt=$vendorprefix ;;
6987 esac
6988 . ./getfile
6989 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6990 oldvendorprefix=''
6991 case "$vendorprefix" in
6992 '') ;;
6993 *) case "$ans" in
6994 "$prefix") ;;
6995 *) oldvendorprefix="$prefix";;
6996 esac
6997 ;;
6998 esac
6999 usevendorprefix="$define"
7000 vendorprefix="$ans"
7001 vendorprefixexp="$ansexp"
7002 ;;
7003*) usevendorprefix="$undef"
7004 vendorprefix=''
7005 vendorprefixexp=''
7006 ;;
7007esac
7008
613d6c3e 7009: Set the vendorlib variables
b4eb6b3d
JH
7010case "$vendorprefix" in
7011'') d_vendorlib="$undef"
7012 vendorlib=''
7013 vendorlibexp=''
7014 ;;
7015*) d_vendorlib="$define"
7016 : determine where vendor-supplied modules go.
7017 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7018 case "$vendorlib" in
7019 '')
7020 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7021 case "$installstyle" in
7022 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7023 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7024 esac
7025 ;;
7026 *) dflt="$vendorlib"
7027 ;;
7028 esac
7029 fn=d~+
7030 rp='Pathname for the vendor-supplied library files?'
7031 . ./getfile
7032 vendorlib="$ans"
7033 vendorlibexp="$ansexp"
7034 ;;
7035esac
7036vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
7037prefixvar=vendorlib
7038. ./installprefix
b4eb6b3d 7039
613d6c3e 7040: Set the vendorarch variables
b4eb6b3d
JH
7041case "$vendorprefix" in
7042'') d_vendorarch="$undef"
7043 vendorarch=''
7044 vendorarchexp=''
7045 ;;
7046*) d_vendorarch="$define"
7047 : determine where vendor-supplied architecture-dependent libraries go.
7048 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7049 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7050 : vendorlib may have an optional trailing /share.
7051 case "$vendorarch" in
7052 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7053 dflt="$dflt/$archname"
7054 ;;
7055 *) dflt="$vendorarch" ;;
7056 esac
7057 fn=d~+
7058 rp='Pathname for vendor-supplied architecture-dependent files?'
7059 . ./getfile
7060 vendorarch="$ans"
7061 vendorarchexp="$ansexp"
7062 ;;
7063esac
a092d240
NC
7064prefixvar=vendorarch
7065. ./installprefix
1be1b388
MB
7066if $test X"$vendorarch" = X"$vendorlib"; then
7067 d_vendorarch="$undef"
7068else
7069 d_vendorarch="$define"
7070fi
b4eb6b3d
JH
7071
7072: Final catch-all directories to search
7073$cat <<EOM
7074
7075Lastly, you can have perl look in other directories for extensions and
7076modules in addition to those already specified.
7077These directories will be searched after
7078 $sitearch
7079 $sitelib
7080EOM
7081test X"$vendorlib" != "X" && echo ' ' $vendorlib
7082test X"$vendorarch" != "X" && echo ' ' $vendorarch
7083echo ' '
7084case "$otherlibdirs" in
7085''|' ') dflt='none' ;;
7086*) dflt="$otherlibdirs" ;;
7087esac
7088$cat <<EOM
7089Enter a colon-separated set of extra paths to include in perl's @INC
7090search path, or enter 'none' for no extra paths.
7091
7092EOM
7093
7094rp='Colon-separated list of additional directories for perl to search?'
7095. ./myread
7096case "$ans" in
7097' '|''|none) otherlibdirs=' ' ;;
7098*) otherlibdirs="$ans" ;;
7099esac
7100case "$otherlibdirs" in
7101' ') val=$undef ;;
7102*) val=$define ;;
7103esac
7104set d_perl_otherlibdirs
7105eval $setvar
7106
7107: Cruising for prototypes
7108echo " "
7109echo "Checking out function prototypes..." >&4
55954f19
JH
7110$cat >prototype.c <<EOCP
7111#$i_stdlib I_STDLIB
7112#ifdef I_STDLIB
7113#include <stdlib.h>
7114#endif
b4eb6b3d
JH
7115int main(int argc, char *argv[]) {
7116 exit(0);}
7117EOCP
7118if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7119 echo "Your C compiler appears to support function prototypes."
7120 val="$define"
7121else
7122 echo "Your C compiler doesn't seem to understand function prototypes."
7123 val="$undef"
7124fi
7125set prototype
7126eval $setvar
7127$rm -f prototype*
7128
613d6c3e 7129: Check if ansi2knr is required
b4eb6b3d
JH
7130case "$prototype" in
7131"$define") ;;
7132*) ansi2knr='ansi2knr'
7133 echo " "
7134 cat <<EOM >&4
7135
7136$me: FATAL ERROR:
7137This version of $package can only be compiled by a compiler that
7138understands function prototypes. Unfortunately, your C compiler
7139 $cc $ccflags
7140doesn't seem to understand them. Sorry about that.
7141
7142If GNU cc is available for your system, perhaps you could try that instead.
7143
7144Eventually, we hope to support building Perl with pre-ANSI compilers.
7145If you would like to help in that effort, please contact <perlbug@perl.org>.
7146
7147Aborting Configure now.
7148EOM
7149 exit 2
7150 ;;
7151esac
7152
34f1896b
MB
7153: DTrace support
7154dflt_dtrace='/usr/sbin/dtrace'
6e3b7bfa
MB
7155$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7156
34f1896b
MB
7157cat <<EOM
7158
7159Perl can be built to support DTrace on platforms that support it.
7160DTrace is a diagnosis and performance analysis tool from Sun.
7161
7162If this doesn't make any sense to you, just accept the default '$dflt'.
7163EOM
7164
7165while $test 1 ; do
7166 case "$usedtrace" in
7167 $define|true|[yY]*)
7168 dflt='y'
7169 ;;
7170 ?*)
7171 dflt='y'
7172 dflt_dtrace=$usedtrace
7173 ;;
7174 *)
7175 dflt='n'
7176 ;;
7177 esac
7178
7179 rp='Support DTrace if available?'
7180 . ./myread
7181 case "$ans" in
7182 y|Y) val="$define" ;;
7183 *) val="$undef" ;;
7184 esac
7185 set usedtrace
7186 eval $setvar
7187
7188 test "X$usedtrace" != "X$define" && break
7189
7190 echo " "
7191 rp='Where is the dtrace executable?'
7192 dflt=$dflt_dtrace
7193 . ./getfile
7194 val="$ans"
7195 set dtrace
7196 eval $setvar
7197
7198 if $test -f $dtrace
7199 then
7200 if $dtrace -h -s ../perldtrace.d \
7201 -o perldtrace.tmp >/dev/null 2>&1 \
7202 && rm -f perldtrace.tmp
7203 then
7204 echo " "
7205 echo "Good: your $dtrace knows about the -h flag."
7206 else
7207 cat >&2 <<EOM
7208
7209*** $me: Fatal Error: $dtrace doesn't support -h flag
7210***
7211*** Your installed dtrace doesn't support the -h switch to compile a D
7212*** program into a C header. Can't continue.
7213
7214EOM
7215 exit 1
7216 fi
7217 break;
7218 fi
7219
7220 case "$fastread" in
7221 yes)
7222 cat >&2 <<EOM
7223
7224*** $me: Fatal Error: $dtrace not found.
7225*** Can't continue.
7226
7227EOM
7228 exit 1
7229 ;;
7230 *)
7231 echo "*** $dtrace was not found."
7232 echo " "
7233 ;;
7234 esac
7235done
7236
613d6c3e 7237: See if we want extra modules installed
6fcddf3b 7238echo " "
6fcddf3b 7239case "$extras" in
bf35c3f6
JH
7240'') dflt='n';;
7241*) dflt='y';;
6fcddf3b
JH
7242esac
7243cat <<EOM
7244Perl can be built with extra modules or bundles of modules which
7245will be fetched from the CPAN and installed alongside Perl.
7246
7247Notice that you will need access to the CPAN; either via the Internet,
7248or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7249be asked later to configure the CPAN.pm module which will in turn do
7250the installation of the rest of the extra modules or bundles.)
7251
7252Notice also that if the modules require any external software such as
dd2de242
JH
7253libraries and headers (the libz library and the zlib.h header for the
7254Compress::Zlib module, for example) you MUST have any such software
7255already installed, this configuration process will NOT install such
7256things for you.
6fcddf3b
JH
7257
7258If this doesn't make any sense to you, just accept the default '$dflt'.
7259EOM
dd2de242 7260rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7261. ./myread
7262case "$ans" in
7263y|Y)
7264 cat <<EOM
7265
7266Please list any extra modules or bundles to be installed from CPAN,
7267with spaces between the names. The names can be in any format the
dd2de242
JH
7268'install' command of CPAN.pm will understand. (Answer 'none',
7269without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7270EOM
7271 rp='Extras?'
7272 dflt="$extras"
7273 . ./myread
7274 extras="$ans"
7275esac
7276case "$extras" in
7277''|'none')
7278 val=''
7279 $rm -f ../extras.lst
7280 ;;
7281*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7282 echo "$extras" > ../extras.lst
7283 val="'$extras'"
6fcddf3b
JH
7284 ;;
7285esac
7286set extras
7287eval $setvar
7288echo " "
7289
6e1038e0
MB
7290: determine where html pages for programs go
7291set html1dir html1dir none
7292eval $prefixit
7293$cat <<EOM
7294
f3f1a2d8 7295If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7296the appropriate directory here. To skip installing html files,
7297answer "none".
7298EOM
7299case "$html1dir" in
7300''|none|$undef|' ') dflt=none ;;
7301*) dflt=$html1dir ;;
7302esac
7303fn=dn+~
7304rp="Directory for the main $spackage html pages?"
7305. ./getfile
79522dd2
NC
7306prefixvar=html1dir
7307. ./setprefixvar
6e1038e0
MB
7308: Use ' ' for none so value is preserved next time through Configure
7309$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7310
7311: determine where html pages for libraries and modules go
7312set html3dir html3dir none
7313eval $prefixit
7314$cat <<EOM
7315
7316If you wish to install html files for modules associated with $spackage,
7317indicate the appropriate directory here. To skip installing html files,
7318answer "none".
7319EOM
7320: There is no obvious default. If they have specified html1dir, then
7321: try to key off that, possibly changing .../html1 into .../html3.
7322case "$html3dir" in
7323'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7324*) dflt=$html3dir ;;
7325esac
7326fn=dn+~
7327rp="Directory for the $spackage module html pages?"
7328. ./getfile
79522dd2
NC
7329prefixvar=html3dir
7330. ./setprefixvar
6e1038e0
MB
7331: Use ' ' for none so value is preserved next time through Configure
7332$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7333
89ce900e
JH
7334: determine whether to install perl also as /usr/bin/perl
7335
7336echo " "
7337if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7338 $cat <<EOM
7339Many scripts expect perl to be installed as /usr/bin/perl.
7340
7341If you want to, I can install the perl you are about to compile
7342as /usr/bin/perl (in addition to $bin/perl).
7343EOM
7344 if test -f /usr/bin/perl; then
7345 $cat <<EOM
7346
7347However, please note that because you already have a /usr/bin/perl,
7348overwriting that with a new Perl would very probably cause problems.
7349Therefore I'm assuming you don't want to do that (unless you insist).
7350
7351EOM
7352 case "$installusrbinperl" in
7353 "$define"|[yY]*) dflt='y';;
7354 *) dflt='n';;
7355 esac
7356 else
7357 $cat <<EOM
7358
7359Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7360
7361EOM
7362 case "$installusrbinperl" in
7363 "$undef"|[nN]*) dflt='n';;
7364 *) dflt='y';;
7365 esac
7366 fi
7367 rp="Do you want to install perl as /usr/bin/perl?"
7368 . ./myread
7369 case "$ans" in
7370 [yY]*) val="$define";;
7371 *) val="$undef" ;;
7372 esac
7373else
7374 val="$undef"
7375fi
7376set installusrbinperl
7377eval $setvar
7378
613d6c3e 7379: Check if we are using the GNU C library
89ce900e
JH
7380echo " "
7381echo "Checking for GNU C Library..." >&4
7382cat >try.c <<'EOCP'
7383/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7384 alone are insufficient to distinguish different versions, such as
7385 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7386 libc version 2.1.0. A. Dougherty, June 3, 2002.
7387*/
7388#include <stdio.h>
7389int main(void)
7390{
7391#ifdef __GLIBC__
7392# ifdef __GLIBC_MINOR__
4fb7dc7d 7393# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7394# include <gnu/libc-version.h>
7395 printf("%s\n", gnu_get_libc_version());
7396# else
7397 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7398# endif
7399# else
7400 printf("%d\n", __GLIBC__);
7401# endif
7402 return 0;
7403#else
7404 return 1;
7405#endif
7406}
7407EOCP
7408set try
7409if eval $compile_ok && $run ./try > glibc.ver; then
7410 val="$define"
7411 gnulibc_version=`$cat glibc.ver`
7412 echo "You are using the GNU C Library version $gnulibc_version"
7413else
7414 val="$undef"
7415 gnulibc_version=''
7416 echo "You are not using the GNU C Library"
7417fi
5b813a60 7418$rm_try glibc.ver
89ce900e
JH
7419set d_gnulibc
7420eval $setvar
7421
7422: see if nm is to be used to determine whether a symbol is defined or not
7423case "$usenm" in
7424'')
7425 dflt=''
7426 case "$d_gnulibc" in
7427 "$define")
7428 echo " "
7429 echo "nm probably won't work on the GNU C Library." >&4
7430 dflt=n
7431 ;;
7432 esac
7433 case "$dflt" in
7434 '')
7435 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7436 echo " "
7437 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7438 echo "'nm' won't be sufficient on this sytem." >&4
7439 dflt=n
7440 fi
7441 ;;
7442 esac
7443 case "$dflt" in
7444 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7445 if $test $dflt -gt 20; then
7446 dflt=y
7447 else
7448 dflt=n
7449 fi
7450 ;;
7451 esac
b4eb6b3d 7452 ;;
89ce900e
JH
7453*)
7454 case "$usenm" in
7455 true|$define) dflt=y;;
7456 *) dflt=n;;
7457 esac
b4eb6b3d
JH
7458 ;;
7459esac
89ce900e 7460$cat <<EOM
b4eb6b3d 7461
89ce900e
JH
7462I can use $nm to extract the symbols from your C libraries. This
7463is a time consuming task which may generate huge output on the disk (up
7464to 3 megabytes) but that should make the symbols extraction faster. The
7465alternative is to skip the 'nm' extraction part and to compile a small
7466test program instead to determine whether each symbol is present. If
7467you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7468this may be the best solution.
b4eb6b3d 7469
89ce900e 7470You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7471
89ce900e
JH
7472EOM
7473rp="Shall I use $nm to extract C symbols from the libraries?"
7474. ./myread
7475case "$ans" in
7476[Nn]*) usenm=false;;
7477*) usenm=true;;
b4eb6b3d 7478esac
89ce900e
JH
7479
7480runnm=$usenm
7481case "$reuseval" in
7482true) runnm=false;;
b4eb6b3d 7483esac
b4eb6b3d 7484
89ce900e
JH
7485: nm options which may be necessary
7486case "$nm_opt" in
7487'') if $test -f /mach_boot; then
7488 nm_opt='' # Mach
7489 elif $test -d /usr/ccs/lib; then
7490 nm_opt='-p' # Solaris (and SunOS?)
7491 elif $test -f /dgux; then
7492 nm_opt='-p' # DG-UX
7493 elif $test -f /lib64/rld; then
7494 nm_opt='-p' # 64-bit Irix
7495 else
7496 nm_opt=''
7497 fi;;
7498esac
b4eb6b3d 7499
89ce900e
JH
7500: nm options which may be necessary for shared libraries but illegal
7501: for archive libraries. Thank you, Linux.
7502case "$nm_so_opt" in
7503'') case "$myuname" in
fb2e1bc0 7504 *linux*|gnu*)
89ce900e
JH
7505 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7506 nm_so_opt='--dynamic'
7507 fi
7508 ;;
7509 esac
7510 ;;
7511esac
b4eb6b3d 7512
1d8eaf8c 7513: Figure out where the libc is located
89ce900e
JH
7514case "$runnm" in
7515true)
1d8eaf8c 7516: get list of predefined functions in a handy place
89ce900e
JH
7517echo " "
7518case "$libc" in
7519'') libc=unknown
7520 case "$libs" in
7521 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7522 esac
7523 ;;
b4eb6b3d 7524esac
89ce900e
JH
7525case "$libs" in
7526'') ;;
7527*) for thislib in $libs; do
7528 case "$thislib" in
7529 -lc|-lc_s)
7530 : Handle C library specially below.
7531 ;;
7532 -l*)
7533 thislib=`echo $thislib | $sed -e 's/^-l//'`
7534 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7535 :
7536 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7537 :
7538 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7539 :
7540 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7541 :
7542 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7543 :
7544 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7545 :
7546 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7547 :
7548 else
7549 try=''
7550 fi
7551 libnames="$libnames $try"
7552 ;;
7553 *) libnames="$libnames $thislib" ;;
7554 esac
7555 done
b4eb6b3d
JH
7556 ;;
7557esac
89ce900e
JH
7558xxx=normal
7559case "$libc" in
7560unknown)
7561 set /lib/libc.$so
7562 for xxx in $libpth; do
7563 $test -r $1 || set $xxx/libc.$so
7564 : The messy sed command sorts on library version numbers.
7565 $test -r $1 || \
7566 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7567 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7568 h
7569 s/[0-9][0-9]*/0000&/g
7570 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7571 G
7572 s/\n/ /' | \
7573 $sort | $sed -e 's/^.* //'`
7574 eval set \$$#
7575 done
7576 $test -r $1 || set /usr/ccs/lib/libc.$so
7577 $test -r $1 || set /lib/libsys_s$_a
7578 ;;
7579*)
7580 set blurfl
7581 ;;
7582esac
7583if $test -r "$1"; then
7584 echo "Your (shared) C library seems to be in $1."
7585 libc="$1"
7586elif $test -r /lib/libc && $test -r /lib/clib; then
7587 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7588 xxx=apollo
7589 libc='/lib/clib /lib/libc'
7590 if $test -r /lib/syslib; then
7591 echo "(Your math library is in /lib/syslib.)"
7592 libc="$libc /lib/syslib"
7593 fi
7594elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7595 echo "Your C library seems to be in $libc, as you said before."
7596elif $test -r $incpath/usr/lib/libc$_a; then
7597 libc=$incpath/usr/lib/libc$_a;
7598 echo "Your C library seems to be in $libc. That's fine."
7599elif $test -r /lib/libc$_a; then
7600 libc=/lib/libc$_a;
7601 echo "Your C library seems to be in $libc. You're normal."
7602else
7603 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7604 :
7605 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7606 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7607 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7608 :
7609 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7610 :
7611 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7612 :
7613 else
7614 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7615 fi
7616 if $test -r "$tans"; then
7617 echo "Your C library seems to be in $tans, of all places."
7618 libc=$tans
7619 else
7620 libc='blurfl'
7621 fi
7622fi
7623if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7624 dflt="$libc"
7625 cat <<EOM
b4eb6b3d 7626
89ce900e
JH
7627If the guess above is wrong (which it might be if you're using a strange
7628compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7629
89ce900e
JH
7630EOM
7631else
7632 dflt=''
7633 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7634 cat >&4 <<EOM
7635I can't seem to find your C library. I've looked in the following places:
5e366f65 7636
b4eb6b3d 7637EOM
89ce900e
JH
7638 $sed 's/^/ /' libpath
7639 cat <<EOM
5e366f65 7640
89ce900e 7641None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7642
7643EOM
89ce900e
JH
7644fi
7645fn=f
7646rp='Where is your C library?'
7647. ./getfile
7648libc="$ans"
5e366f65 7649
89ce900e
JH
7650echo " "
7651echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7652set X `cat libnames`
7653shift
7654xxx=files
7655case $# in 1) xxx=file; esac
7656echo "Extracting names from the following $xxx for later perusal:" >&4
7657echo " "
7658$sed 's/^/ /' libnames >&4
7659echo " "
7660$echo $n "This may take a while...$c" >&4
5e366f65 7661
89ce900e
JH
7662for file in $*; do
7663 case $file in
7664 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7665 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7666 esac
89ce900e
JH
7667done >libc.tmp
7668
7669$echo $n ".$c"
7670$grep fprintf libc.tmp > libc.ptf
7671xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7672xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7673xxx='[ADTSIW]'
ab900c53 7674if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7675 eval $xscan;\
7676 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7677 eval $xrun
7678elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7679 eval $xscan;\
7680 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7681 eval $xrun
7682elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7683 eval $xscan;\
7684 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7685 eval $xrun
7686elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7687 eval $xscan;\
7688 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7689 eval $xrun
7690elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7691 eval $xscan;\
7692 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7693 eval $xrun
7694elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7695 eval $xscan;\
7696 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7697 eval $xrun
7698elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7699 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7700 eval $xscan;\
7701 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7702 eval $xrun
7703elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7704 eval $xscan;\
7705 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7706 eval $xrun
7707elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7708 eval $xscan;\
7709 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7710 eval $xrun
7711elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7712 eval $xscan;\
7713 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7714 eval $xrun
7715elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7716 eval $xscan;\
7717 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7718 eval $xrun
7719elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7720 eval $xscan;\
7721 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7722 eval $xrun
7723elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7724 eval $xscan;\
7725 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7726 eval $xrun
7727elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7728 eval $xscan;\
7729 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7730 eval $xrun
b4eb6b3d 7731else
89ce900e
JH
7732 $nm -p $* 2>/dev/null >libc.tmp
7733 $grep fprintf libc.tmp > libc.ptf
7734 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7735 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7736 then
7737 nm_opt='-p'
7738 eval $xrun
7739 else
7740 echo " "
7741 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7742 com=''
1d8eaf8c
MB
7743 if $ar t $libc > libc.tmp && \
7744 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7745 then
89ce900e
JH
7746 for thisname in $libnames $libc; do
7747 $ar t $thisname >>libc.tmp
7748 done
7749 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7750 echo "Ok." >&4
7751 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
89ce900e
JH
7752 for thisname in $libnames $libc; do
7753 $ar tv $thisname >>libc.tmp
89ce900e
JH
7754 emximp -o tmp.imp $thisname \
7755 2>/dev/null && \
7756 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7757 < tmp.imp >>libc.tmp
1d8eaf8c 7758 $rm -f tmp.imp
89ce900e
JH
7759 done
7760 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7761 echo "Ok." >&4
7762 else
7763 echo "$ar didn't seem to work right." >&4
7764 echo "Maybe this is a Cray...trying bld instead..." >&4
1d8eaf8c
MB
7765 if bld t $libc | \
7766 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7767 $test -s libc.list
89ce900e
JH
7768 then
7769 for thisname in $libnames; do
7770 bld t $libnames | \
7771 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7772 $ar t $thisname >>libc.tmp
7773 done
7774 echo "Ok." >&4
7775 else
7776 echo "That didn't work either. Giving up." >&4
7777 exit 1
7778 fi
7779 fi
7780 fi
b4eb6b3d 7781fi
89ce900e
JH
7782nm_extract="$com"
7783case "$PASE" in
7784define)
7785 echo " "
7786 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7787 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7788 ;;
7789*) if $test -f /lib/syscalls.exp; then
7790 echo " "
7791 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
1d8eaf8c
MB
7792 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7793 /lib/syscalls.exp >>libc.list
89ce900e
JH
7794 fi
7795 ;;
7796esac
7797;;
7798esac
7799$rm -f libnames libpath
b4eb6b3d
JH
7800
7801: see if dld is available
7802set dld.h i_dld
7803eval $inhdr
7804
613d6c3e 7805: Check if we are using C++
43dddb59
MB
7806echo " "
7807echo "Checking for C++..." >&4
20e87299 7808$cat >try.c <<'EOCP'
43dddb59
MB
7809#include <stdio.h>
7810int main(void)
7811{
7812#ifdef __cplusplus
20e87299 7813 return 0;
43dddb59 7814#else
20e87299 7815 return 1;
43dddb59 7816#endif
43dddb59
MB
7817}
7818EOCP
7819set try
20e87299
AD
7820if eval $compile_ok && $run ./try; then
7821 val="$define"
43dddb59
MB
7822 echo "You are using a C++ compiler."
7823else
7824 val="$undef"
7825 echo "You are not using a C++ compiler."
7826fi
5b813a60 7827$rm_try cplusplus$$
43dddb59
MB
7828set d_cplusplus
7829eval $setvar
7830
89ce900e
JH
7831: is a C symbol defined?
7832csym='tlook=$1;
7833case "$3" in
373dfab3
JH
7834-v) tf=libc.tmp; tdc="";;
7835-a) tf=libc.tmp; tdc="[]";;
7836*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e 7837esac;
61c26d18
MHM
7838case "$d_cplusplus" in
7839 $define) extern_C="extern \"C\"" ;;
7840 *) extern_C="extern" ;;
7841esac;
89ce900e
JH
7842tx=yes;
7843case "$reuseval-$4" in
7844true-) ;;
7845true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7846esac;
7847case "$tx" in
7848yes)
43dddb59 7849 tval=false;
5129fff4
JH
7850 if $test "$runnm" = true; then
7851 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7852 tval=true;
5129fff4 7853 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
61c26d18 7854 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7855 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7856 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7857 $rm_try;
89ce900e 7858 fi;
5129fff4 7859 else
61c26d18 7860 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7861 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5b813a60 7862 $rm_try;
ab900c53
AB
7863 fi;
7864 ;;
89ce900e
JH
7865*)
7866 case "$tval" in
7867 $define) tval=true;;
7868 *) tval=false;;
ab900c53
AB
7869 esac;
7870 ;;
89ce900e
JH
7871esac;
7872eval "$2=$tval"'
7873
7874: define an is-in-libc? function
7875inlibc='echo " "; td=$define; tu=$undef;
7876sym=$1; var=$2; eval "was=\$$2";
7877tx=yes;
7878case "$reuseval$was" in
7879true) ;;
7880true*) tx=no;;
7881esac;
7882case "$tx" in
7883yes)
7884 set $sym tres -f;
7885 eval $csym;
7886 case "$tres" in
7887 true)
7888 echo "$sym() found." >&4;
7889 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7890 *)
7891 echo "$sym() NOT found." >&4;
7892 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7893 esac;;
7894*)
7895 case "$was" in
7896 $define) echo "$sym() found." >&4;;
7897 *) echo "$sym() NOT found." >&4;;
7898 esac;;
7899esac'
7900
b4eb6b3d
JH
7901: see if dlopen exists
7902xxx_runnm="$runnm"
666ea192 7903xxx_ccflags="$ccflags"
b4eb6b3d 7904runnm=false
666ea192
JH
7905: with g++ one needs -shared to get is-in-libc to work for dlopen
7906case "$gccversion" in
7907'') ;;
7908*) case "$d_cplusplus" in
7909 "$define") ccflags="$ccflags -shared" ;;
7910 esac
7911 ;;
7912esac
b4eb6b3d
JH
7913set dlopen d_dlopen
7914eval $inlibc
7915runnm="$xxx_runnm"
666ea192 7916ccflags="$xxx_ccflags"
b4eb6b3d 7917
4fb7dc7d
JH
7918: see if this is a unistd.h system
7919set unistd.h i_unistd
7920eval $inhdr
7921
b4eb6b3d
JH
7922: determine which dynamic loading, if any, to compile in
7923echo " "
7924dldir="ext/DynaLoader"
7925case "$usedl" in
7926$define|y|true)
7927 dflt='y'
7928 usedl="$define"
7929 ;;
7930$undef|n|false)
7931 dflt='n'
7932 usedl="$undef"
7933 ;;
5b813a60 7934*)
b4eb6b3d
JH
7935 dflt='n'
7936 case "$d_dlopen" in
7937 $define) dflt='y' ;;
7938 esac
7939 case "$i_dld" in
7940 $define) dflt='y' ;;
7941 esac
7942 : Does a dl_xxx.xs file exist for this operating system
7943 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7944 ;;
7945esac
7946rp="Do you wish to use dynamic loading?"
7947. ./myread
7948usedl="$ans"
f1ce3bf1 7949bin_ELF="$undef"
b4eb6b3d
JH
7950case "$ans" in
7951y*) usedl="$define"
7952 case "$dlsrc" in
7953 '')
7954 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7955 dflt="$dldir/dl_${osname}.xs"
7956 elif $test "$d_dlopen" = "$define" ; then
7957 dflt="$dldir/dl_dlopen.xs"
7958 elif $test "$i_dld" = "$define" ; then
7959 dflt="$dldir/dl_dld.xs"
7960 else
7961 dflt=''
7962 fi
7963 ;;
7964 *) dflt="$dldir/$dlsrc"
7965 ;;
7966 esac
7967 echo "The following dynamic loading files are available:"
7968 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7969 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7970 rp="Source file to use for dynamic loading"
7971 fn="fne"
7972 gfpth="$src"
7973 . ./getfile
7974 usedl="$define"
7975 : emulate basename
7976 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7977
7978 $cat << EOM
7979
7980Some systems may require passing special flags to $cc -c to
7981compile modules that will be used to create a shared library.
7982To use no flags, say "none".
7983
7984EOM
7985 case "$cccdlflags" in
7986 '') case "$gccversion" in
7987 '') case "$osname" in
7988 hpux) dflt='+z' ;;
7989 next) dflt='none' ;;
7990 irix*) dflt='-KPIC' ;;
48bcfe03 7991 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7992 sunos) dflt='-pic' ;;
7993 *) dflt='none' ;;
7994 esac
7995 ;;
7996 *) case "$osname" in
b6cc0f4c 7997 darwin) dflt='none' ;;
15fcae63 7998 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7999 *) dflt='-fpic' ;;
8000 esac ;;
8001 esac ;;
8002 ' ') dflt='none' ;;
8003 *) dflt="$cccdlflags" ;;
8004 esac
8005 rp="Any special flags to pass to $cc -c to compile shared library modules?"
8006 . ./myread
8007 case "$ans" in
8008 none) cccdlflags=' ' ;;
8009 *) cccdlflags="$ans" ;;
8010 esac
8011
8012 cat << EOM
8013
8014Some systems use ld to create libraries that can be dynamically loaded,
8015while other systems (such as those using ELF) use $cc.
8016
8017EOM
8018 case "$ld" in
55954f19 8019 '') $cat >try.c <<EOM
b4eb6b3d
JH
8020/* Test for whether ELF binaries are produced */
8021#include <fcntl.h>
55954f19
JH
8022#$i_stdlib I_STDLIB
8023#ifdef I_STDLIB
b4eb6b3d 8024#include <stdlib.h>
55954f19 8025#endif
4fb7dc7d
JH
8026#$i_unistd I_UNISTD
8027#ifdef I_UNISTD
8028#include <unistd.h>
8029#endif
b4eb6b3d
JH
8030int main() {
8031 char b[4];
8032 int i = open("a.out",O_RDONLY);
5b813a60 8033 if(i == -1)
b4eb6b3d
JH
8034 exit(1); /* fail */
8035 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8036 exit(0); /* succeed (yes, it's ELF) */
8037 else
8038 exit(1); /* fail */
8039}
8040EOM
5440bc8e 8041 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
8042 cat <<EOM
8043You appear to have ELF support. I'll use $cc to build dynamic libraries.
8044EOM
8045 dflt="$cc"
f1ce3bf1 8046 bin_ELF="$define"
b4eb6b3d
JH
8047 else
8048 echo "I'll use ld to build dynamic libraries."
8049 dflt='ld'
8050 fi
5b813a60 8051 $rm_try
b4eb6b3d
JH
8052 ;;
8053 *) dflt="$ld"
8054 ;;
8055 esac
8056
8057 rp="What command should be used to create dynamic libraries?"
8058 . ./myread
8059 ld="$ans"
8060
8061 cat << EOM
8062
8063Some systems may require passing special flags to $ld to create a
8064library that can be dynamically loaded. If your ld flags include
8065-L/other/path options to locate libraries outside your loader's normal
8066search path, you may need to specify those -L options here as well. To
8067use no flags, say "none".
8068
8069EOM
8070 case "$lddlflags" in
8071 '') case "$osname" in
8072 beos) dflt='-nostart' ;;
df00ff3b 8073 haiku) dflt='-shared' ;;
b4eb6b3d
JH
8074 hpux) dflt='-b';
8075 case "$gccversion" in
8076 '') dflt="$dflt +vnocompatwarnings" ;;
8077 esac
5b813a60 8078 ;;
15fcae63 8079 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
8080 next) dflt='none' ;;
8081 solaris) dflt='-G' ;;
8082 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 8083 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
8084 *) dflt='none' ;;
8085 esac
8086 ;;
8087 *) dflt="$lddlflags" ;;
8088 esac
8089
8090 : Try to guess additional flags to pick up local libraries.
8091 : Be careful not to append to a plain 'none'
8092 case "$dflt" in
8093 none) dflt='' ;;
8094 esac
8095 for thisflag in $ldflags; do
8096 case "$thisflag" in
b5b9f165 8097 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
8098 case " $dflt " in
8099 *" $thisflag "*) ;;
8100 *) dflt="$dflt $thisflag" ;;
8101 esac
8102 ;;
8103 esac
8104 done
8105
8106 case "$dflt" in
8107 ''|' ') dflt='none' ;;
8108 esac
8109
8f68b0e6
AD
8110 case "$ldflags" in
8111 *-fstack-protector*)
8112 case "$dflt" in
8113 *-fstack-protector*) ;; # Don't add it again
8114 *) dflt="$dflt -fstack-protector" ;;
8115 esac
8116 ;;
8117 esac
8118
8119
b4eb6b3d
JH
8120 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8121 . ./myread
8122 case "$ans" in
8123 none) lddlflags=' ' ;;
8124 *) lddlflags="$ans" ;;
8125 esac
8126
8127 cat <<EOM
8128
8129Some systems may require passing special flags to $cc to indicate that
8130the resulting executable will use dynamic linking. To use no flags,
8131say "none".
8132
8133EOM
8134 case "$ccdlflags" in
8135 '') case "$osname" in
fb2e1bc0 8136 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
8137 next|sunos) dflt='none' ;;
8138 *) dflt='none' ;;
b4eb6b3d
JH
8139 esac ;;
8140 ' ') dflt='none' ;;
8141 *) dflt="$ccdlflags" ;;
8142 esac
8143 rp="Any special flags to pass to $cc to use dynamic linking?"
8144 . ./myread
8145 case "$ans" in
8146 none) ccdlflags=' ' ;;
8147 *) ccdlflags="$ans" ;;
8148 esac
8149 ;;
8150*) usedl="$undef"
8151 ld='ld'
8152 dlsrc='dl_none.xs'
8153 lddlflags=''
8154 ccdlflags=''
8155 ;;
8156esac
8157
34f1896b 8158: Do we want a shared libperl?
b4eb6b3d
JH
8159also=''
8160case "$usedl" in
8161$undef)
8162 # No dynamic loading being used, so don't bother even to prompt.
8163 useshrplib='false'
8164 ;;
8165*) case "$useshrplib" in
8166 '') case "$osname" in
df00ff3b 8167 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
b4eb6b3d
JH
8168 dflt=y
8169 also='Building a shared libperl is required for dynamic loading to work on your system.'
8170 ;;
8171 next*)
8172 case "$osvers" in
8173 4*) dflt=y
8174 also='Building a shared libperl is needed for MAB support.'
8175 ;;
8176 *) dflt=n
8177 ;;
8178 esac
8179 ;;
8180 *) dflt=n
8181 ;;
8182 esac
8183 ;;
8184 $define|true|[Yy]*)
8185 dflt=y
8186 ;;
8187 *) dflt=n
8188 ;;
8189 esac
8190 $cat << EOM
8191
8192The perl executable is normally obtained by linking perlmain.c with
8193libperl${_a}, any static extensions (usually just DynaLoader), and
8194any other libraries needed on this system (such as -lm, etc.). Since
8195your system supports dynamic loading, it is probably possible to build
8196a shared libperl.$so. If you will have more than one executable linked
8197to libperl.$so, this will significantly reduce the size of each
5cadb3f3 8198executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
8199default is probably sensible for your system.
8200$also
8201
8202EOM
8203 rp="Build a shared libperl.$so (y/n)"
8204 . ./myread
8205 case "$ans" in
8206 true|$define|[Yy]*)
8207 useshrplib='true' ;;
8208 *) useshrplib='false' ;;
8209 esac
8210 ;;
8211esac
8212
8213case "$useshrplib" in
8214true)
df31f9b1
MB
8215 case "$userelocatableinc" in
8216 true|define)
8217 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8218 echo "See INSTALL for an explanation why that won't work." >&4
8219 exit 4
8220 ;;
8221 esac
b4eb6b3d
JH
8222 case "$libperl" in
8223 '')
8224 # Figure out a good name for libperl.so. Since it gets stored in
8225 # a version-specific architecture-dependent library, the version
8226 # number isn't really that important, except for making cc/ld happy.
8227 #
56e771c1 8228 # A name such as libperl.so.10.1
b4eb6b3d 8229 majmin="libperl.$so.$patchlevel.$subversion"
56e771c1 8230 # A name such as libperl.so.100
b4eb6b3d
JH
8231 majonly=`echo $patchlevel $subversion |
8232 $awk '{printf "%d%02d", $1, $2}'`
8233 majonly=libperl.$so.$majonly
8234 # I'd prefer to keep the os-specific stuff here to a minimum, and
8235 # rely on figuring it out from the naming of libc.
8236 case "${osname}${osvers}" in
8237 next4*)
8238 dflt=libperl.5.$so
8239 # XXX How handle the --version stuff for MAB?
8240 ;;
fb2e1bc0 8241 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8242 dflt=libperl.$so
8243 ;;
56e771c1
RU
8244 cygwin*) # ld links now against the dll directly
8245 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8246 majonly=`echo $patchlevel $subversion |
8247 $awk '{printf "%03d%03d", $1, $2}'`
8248 majonly=cygperl5.$majonly.$so
8249 dflt=$majmin
b4eb6b3d
JH
8250 ;;
8251 *) # Try to guess based on whether libc has major.minor.
8252 case "$libc" in
8253 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8254 *libc.$so.[0-9]*) dflt=$majonly ;;
8255 *) dflt=libperl.$so ;;
8256 esac
8257 ;;
8258 esac
8259 ;;
8260 *) dflt=$libperl
8261 ;;
8262 esac
8263 cat << EOM
8264
8265I need to select a good name for the shared libperl. If your system uses
8266library names with major and minor numbers, then you might want something
8267like $majmin. Alternatively, if your system uses a single version
8268number for shared libraries, then you might want to use $majonly.
8269Or, your system might be quite happy with a simple libperl.$so.
8270
8271Since the shared libperl will get installed into a version-specific
8272architecture-dependent directory, the version number of the shared perl
8273library probably isn't important, so the default should be o.k.
8274
8275EOM
8276 rp='What name do you want to give to the shared libperl?'
8277 . ./myread
8278 libperl=$ans
8279 echo "Ok, I'll use $libperl"
8280 ;;
8281*)
8282 libperl="libperl${_a}"
8283 ;;
8284esac
8285
8286# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8287case "$shrpdir" in
8288'') ;;
8289*) $cat >&4 <<EOM
8290WARNING: Use of the shrpdir variable for the installation location of
8291the shared $libperl is not supported. It was never documented and
8292will not work in this version. Let me (perlbug@perl.org)
8293know of any problems this may cause.
8294
8295EOM
8296 case "$shrpdir" in
8297 "$archlibexp/CORE")
8298 $cat >&4 <<EOM
8299But your current setting of $shrpdir is
8300the default anyway, so it's harmless.
8301EOM
8302 ;;
8303 *)
8304 $cat >&4 <<EOM
8305Further, your current attempted setting of $shrpdir
8306conflicts with the value of $archlibexp/CORE
8307that installperl will use.
8308EOM
8309 ;;
8310 esac
8311 ;;
8312esac
8313
8314# How will the perl executable find the installed shared $libperl?
8315# Add $xxx to ccdlflags.
8316# If we can't figure out a command-line option, use $shrpenv to
8317# set env LD_RUN_PATH. The main perl makefile uses this.
8318shrpdir=$archlibexp/CORE
8319xxx=''
8320tmp_shrpenv=''
8321if "$useshrplib"; then
34f1896b 8322 case "$osname" in
b4eb6b3d
JH
8323 aix)
8324 # We'll set it in Makefile.SH...
8325 ;;
b5b9f165 8326 solaris)
b4eb6b3d
JH
8327 xxx="-R $shrpdir"
8328 ;;
a774dfe6 8329 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8330 xxx="-Wl,-R$shrpdir"
8331 ;;
fb2e1bc0 8332 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8333 xxx="-Wl,-rpath,$shrpdir"
8334 ;;
8335 next)
8336 # next doesn't like the default...
8337 ;;
8338 beos)
8339 # beos doesn't like the default, either.
8340 ;;
df00ff3b
IW
8341 haiku)
8342 # Haiku doesn't like the default, either.
8343 ;;
b4eb6b3d
JH
8344 hpux*)
8345 # hpux doesn't like the default, either.
8346 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8347 ;;
56e771c1
RU
8348 cygwin)
8349 # cygwin needs only ldlibpth
8350 ;;
b4eb6b3d
JH
8351 *)
8352 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8353 ;;
8354 esac
8355 case "$xxx" in
8356 '') ;;
34f1896b 8357 *)
b4eb6b3d
JH
8358 # Only add $xxx if it isn't already in ccdlflags.
8359 case " $ccdlflags " in
8360 *" $xxx "*) ;;
8361 *) ccdlflags="$ccdlflags $xxx"
8362 cat <<EOM >&4
8363
8364Adding $xxx to the flags
34f1896b 8365passed to $ld so that the perl executable will find the
b4eb6b3d
JH
8366installed shared $libperl.
8367
8368EOM
8369 ;;
8370 esac
8371 ;;
8372 esac
8373fi
8374# Fix ccdlflags in AIX for building external extensions.
8375# (For building Perl itself bare -bE:perl.exp is needed,
8376# Makefile.SH takes care of this.)
8377case "$osname" in
8378aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8379esac
8380# Respect a hint or command-line value.
8381case "$shrpenv" in
8382'') shrpenv="$tmp_shrpenv" ;;
8383esac
8384case "$ldlibpthname" in
8385'') ldlibpthname=LD_LIBRARY_PATH ;;
8386none) ldlibpthname='' ;;
8387esac
8388
8389: determine where manual pages are on this system
8390echo " "
8391case "$sysman" in
8392'')
4a0a3829
SD
8393 syspath='/usr/share/man/man1 /usr/man/man1'
8394 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8395 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8396 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8397 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8398 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8399 sysman=`./loc . /usr/man/man1 $syspath`
8400 ;;
8401esac
8402if $test -d "$sysman"; then
8403 echo "System manual is in $sysman." >&4
8404else
8405 echo "Could not find manual pages in source form." >&4
8406fi
8407
8408: determine where manual pages go
8409set man1dir man1dir none
8410eval $prefixit
8411$cat <<EOM
8412
8413$spackage has manual pages available in source form.
8414EOM
8415case "$nroff" in
8416nroff)
8417 echo "However, you don't have nroff, so they're probably useless to you."
8418 case "$man1dir" in
8419 '') man1dir="none";;
8420 esac;;
8421esac
8422echo "If you don't want the manual sources installed, answer 'none'."
8423case "$man1dir" in
8424' ') dflt=none
8425 ;;
8426'')
4a0a3829
SD
8427 lookpath="$prefixexp/share/man/man1"
8428 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8429 lookpath="$lookpath $prefixexp/man/p_man/man1"
8430 lookpath="$lookpath $prefixexp/man/u_man/man1"
8431 lookpath="$lookpath $prefixexp/man/man.1"
8432 case "$sysman" in
8433 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8434 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8435 esac
8436 set dflt
8437 eval $prefixup
8438 ;;
8439*) dflt="$man1dir"
8440 ;;
8441esac
8442echo " "
8443fn=dn+~
8444rp="Where do the main $spackage manual pages (source) go?"
8445. ./getfile
8446if $test "X$man1direxp" != "X$ansexp"; then
8447 installman1dir=''
8448fi
79522dd2
NC
8449prefixvar=man1dir
8450. ./setprefixvar
8451
477140ee
NC
8452case "$man1dir" in
8453'') man1dir=' '
8454 installman1dir='';;
8455esac
b4eb6b3d
JH
8456
8457: What suffix to use on installed man pages
8458
8459case "$man1dir" in
8460' ')
8461 man1ext='0'
8462 ;;
8463*)
8464 rp="What suffix should be used for the main $spackage man pages?"
8465 case "$man1ext" in
8466 '') case "$man1dir" in
8467 *1) dflt=1 ;;
8468 *1p) dflt=1p ;;
8469 *1pm) dflt=1pm ;;
8470 *l) dflt=l;;
8471 *n) dflt=n;;
8472 *o) dflt=o;;
8473 *p) dflt=p;;
8474 *C) dflt=C;;
8475 *L) dflt=L;;
8476 *L1) dflt=L1;;
8477 *) dflt=1;;
8478 esac
8479 ;;
8480 *) dflt="$man1ext";;
8481 esac
8482 . ./myread
8483 man1ext="$ans"
8484 ;;
8485esac
8486
8487: see if we can have long filenames
8488echo " "
8489first=123456789abcdef
8490$rm -f $first
8491if (echo hi >$first) 2>/dev/null; then
8492 if $test -f 123456789abcde; then
8493 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8494 val="$undef"
8495 else
8496 echo 'You can have filenames longer than 14 characters.'>&4
8497 val="$define"
8498 fi
8499else
8500 $cat <<'EOM'
8501You can't have filenames longer than 14 chars.
8502You can't even think about them!
8503EOM
8504 val="$undef"
776a38e3 8505fi
b4eb6b3d
JH
8506set d_flexfnam
8507eval $setvar
8508$rm -rf 123456789abcde*
8509
8510: determine where library module manual pages go
8511set man3dir man3dir none
8512eval $prefixit
8513$cat <<EOM
8514
8515$spackage has manual pages for many of the library modules.
8516EOM
8517
8518case "$nroff" in
8519nroff)
8520 $cat <<'EOM'
8521However, you don't have nroff, so they're probably useless to you.
8522EOM
8523 case "$man3dir" in
8524 '') man3dir="none";;
8525 esac;;
8526esac
8527
8528case "$d_flexfnam" in
8529undef)
8530 $cat <<'EOM'
f3f1a2d8 8531However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8532EOM
8533 case "$man3dir" in
8534 '') man3dir="none";;
8535 esac;;
8536esac
8537
8538echo "If you don't want the manual sources installed, answer 'none'."
8539prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8540case "$man3dir" in
8541'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8542 if $test -d "$privlib/man/man3"; then
8543 cat <<EOM >&4
8544
8545WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8546$privlib/man/man3. This version will suggest a
8547new default of $dflt.
b4eb6b3d
JH
8548EOM
8549 tdflt=$dflt
8550 dflt='n'
8551 rp='Do you wish to preserve the old behavior?(y/n)'
8552 . ./myread
8553 case "$ans" in
8554 y*) dflt="$privlib/man/man3" ;;
8555 *) dflt=$tdflt ;;
8556 esac
8557 fi
8558 ;;
8559*) dflt="$man3dir" ;;
8560esac
8561case "$dflt" in
8562' ') dflt=none ;;
8563esac
8564echo " "
8565fn=dn+~
8566rp="Where do the $package library man pages (source) go?"
8567. ./getfile
79522dd2
NC
8568prefixvar=man3dir
8569. ./setprefixvar
8570
477140ee
NC
8571case "$man3dir" in
8572'') man3dir=' '
8573 installman3dir='';;
8574esac
b4eb6b3d
JH
8575
8576: What suffix to use on installed man pages
8577case "$man3dir" in
8578' ')
8579 man3ext='0'
8580 ;;
8581*)
8582 rp="What suffix should be used for the $package library man pages?"
8583 case "$man3ext" in
8584 '') case "$man3dir" in
8585 *3) dflt=3 ;;
8586 *3p) dflt=3p ;;
8587 *3pm) dflt=3pm ;;
8588 *l) dflt=l;;
8589 *n) dflt=n;;
8590 *o) dflt=o;;
8591 *p) dflt=p;;
8592 *C) dflt=C;;
8593 *L) dflt=L;;
8594 *L3) dflt=L3;;
8595 *) dflt=3;;
8596 esac
8597 ;;
8598 *) dflt="$man3ext";;
8599 esac
8600 . ./myread
8601 man3ext="$ans"
8602 ;;
8603esac
8604
8605: see if we have to deal with yellow pages, now NIS.
0384a54a 8606if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8607 if $test -f /usr/etc/nibindd; then
8608 echo " "
8609 echo "I'm fairly confident you're on a NeXT."
8610 echo " "
8611 rp='Do you get the hosts file via NetInfo?'
8612 dflt=y
8613 case "$hostcat" in
8614 nidump*) ;;
8615 '') ;;
8616 *) dflt=n;;
8617 esac
8618 . ./myread
8619 case "$ans" in
8620 y*) hostcat='nidump hosts .';;
8621 *) case "$hostcat" in
8622 nidump*) hostcat='';;
8623 esac
8624 ;;
8625 esac
8626 fi
8627 case "$hostcat" in
8628 nidump*) ;;
8629 *)
8630 case "$hostcat" in
8631 *ypcat*) dflt=y;;
8632 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8633 dflt=y
8634 else
8635 dflt=n
8636 fi;;
8637 *) dflt=n;;
8638 esac
8639 echo " "
8640 rp='Are you getting the hosts file via yellow pages?'
8641 . ./myread
8642 case "$ans" in
8643 y*) hostcat='ypcat hosts';;
8644 *) hostcat='cat /etc/hosts';;
8645 esac
8646 ;;
8647 esac
8648fi
8649case "$hostcat" in
8650'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8651esac
8652case "$groupcat" in
8653'') test -f /etc/group && groupcat='cat /etc/group';;
8654esac
8655case "$passcat" in
8656'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8657esac
8658
8659: now get the host name
8660echo " "
8661echo "Figuring out host name..." >&4
8662case "$myhostname" in
8663'') cont=true
8664 echo 'Maybe "hostname" will work...'
73614538 8665 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8666 myhostname=$tans
8667 phostname=hostname
8668 cont=''
8669 fi
8670 ;;
8671*) cont='';;
8672esac
8673if $test "$cont"; then
8674 if ./xenix; then
8675 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8676 if tans=`cat /etc/systemid 2>&1` ; then
8677 myhostname=$tans
8678 phostname='cat /etc/systemid'
8679 echo "Whadyaknow. Xenix always was a bit strange..."
8680 cont=''
8681 fi
8682 elif $test -r /etc/systemid; then
8683 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8684 fi
8685fi
8686if $test "$cont"; then
8687 echo 'No, maybe "uuname -l" will work...'
73614538 8688 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8689 myhostname=$tans
8690 phostname='uuname -l'
8691 else
8692 echo 'Strange. Maybe "uname -n" will work...'
73614538 8693 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8694 myhostname=$tans
8695 phostname='uname -n'
8696 else
8697 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8698 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8699 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8700 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8701 else
8702 case "$myhostname" in
8703 '') echo "Does this machine have an identity crisis or something?"
8704 phostname='';;
8705 *)
8706 echo "Well, you said $myhostname before..."
8707 phostname='echo $myhostname';;
8708 esac
8709 fi
8710 fi
8711 fi
8712fi
52a549d0
JH
8713case "$myhostname" in
8714'') myhostname=noname ;;
8715esac
b4eb6b3d
JH
8716: you do not want to know about this
8717set $myhostname
8718myhostname=$1
8719
8720: verify guess
8721if $test "$myhostname" ; then
8722 dflt=y
8723 rp='Your host name appears to be "'$myhostname'".'" Right?"
8724 . ./myread
8725 case "$ans" in
8726 y*) ;;
8727 *) myhostname='';;
8728 esac
8729fi
8730
8731: bad guess or no guess
8732while $test "X$myhostname" = X ; do
8733 dflt=''
8734 rp="Please type the (one word) name of your host:"
8735 . ./myread
8736 myhostname="$ans"
8737done
8738
8739: translate upper to lower if necessary
8740case "$myhostname" in
8741*[A-Z]*)
8742 echo "(Normalizing case in your host name)"
8743 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8744 ;;
8745esac
8746
8747case "$myhostname" in
8748*.*)
8749 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8750 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8751 echo "(Trimming domain name from host name--host name is now $myhostname)"
8752 ;;
8753*) case "$mydomain" in
8754 '')
8755 {
8756 test "X$hostcat" = "Xypcat hosts" &&
8757 ypmatch "$myhostname" hosts 2>/dev/null |\
8758 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8759 $test -s hosts
8760 } || {
8761 test "X$hostcat" != "X" &&
8762 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8763 /[ ]$myhostname[ . ]/p" > hosts
8764 }
8765 tmp_re="[ . ]"
f08cbdd1
PP
8766 if $test -f hosts; then
8767 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8768 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8769 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8770 hosts | $sort | $uniq | \
8771 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8772 case `$echo X$dflt` in
8773 X*\ *) echo "(Several hosts in the database matched hostname)"
8774 dflt=.
8775 ;;
8776 X.) echo "(You do not have fully-qualified names in the hosts database)"
8777 ;;
8778 esac
8779 else
8780 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8781 dflt=.
f08cbdd1 8782 fi
b4eb6b3d
JH
8783 case "$dflt" in
8784 .)
8785 tans=`./loc resolv.conf X /etc /usr/etc`
8786 if $test -f "$tans"; then
8787 echo "(Attempting domain name extraction from $tans)"
8788 dflt=.`$sed -n -e 's/ / /g' \
8789 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
1d40d392 8790 -e 1q 2>/dev/null`
b4eb6b3d
JH
8791 case "$dflt" in
8792 .) dflt=.`$sed -n -e 's/ / /g' \
8793 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
1d40d392 8794 -e 1q 2>/dev/null`
b4eb6b3d
JH
8795 ;;
8796 esac
8797 fi
8798 ;;
8799 esac
8800 case "$dflt" in
8801 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8802 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8803 case "$dflt" in
8804 '') dflt='.';;
8805 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8806 esac
8807 ;;
8808 esac
59c9e5d6
PP
8809 case "$dflt$osname" in
8810 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8811 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8812 ;;
8813 esac
b4eb6b3d
JH
8814 case "$dflt" in
8815 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8816 dflt='.nonet'
b4eb6b3d
JH
8817 ;;
8818 esac
8819 $rm -f hosts
8820 ;;
8821 *) dflt="$mydomain";;
8822 esac;;
8823esac
8824echo " "
8825rp="What is your domain name?"
8826. ./myread
8827tans="$ans"
8828case "$ans" in
8829'') ;;
8830.*) ;;
8831*) tans=".$tans";;
8832esac
8833mydomain="$tans"
8834
8835: translate upper to lower if necessary
8836case "$mydomain" in
8837*[A-Z]*)
8838 echo "(Normalizing case in your domain name)"
8839 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8840 ;;
8841esac
8842
8843: a little sanity check here
8844case "$phostname" in
8845'') ;;
8846*)
8847 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8848 $myhostname$mydomain|$myhostname) ;;
8849 *)
8850 case "$phostname" in
8851 sed*)
8852 echo "(That doesn't agree with your whoami.h file, by the way.)"
8853 ;;
8854 *)
8855 echo "(That doesn't agree with your $phostname command, by the way.)"
8856 ;;
8857 esac
8858 ;;
8859 esac
8860 ;;
8861esac
8862
776a38e3 8863: determine the e-mail address of the user who is running us
b4eb6b3d
JH
8864$cat <<EOM
8865
8866I need to get your e-mail address in Internet format if possible, i.e.
8867something like user@host.domain. Please answer accurately since I have
8868no easy means to double check it. The default value provided below
8869is most probably close to reality but may not be valid from outside
8870your organization...
8871
8872EOM
8873cont=x
8874while test "$cont"; do
8875 case "$cf_email" in
8876 '') dflt="$cf_by@$myhostname$mydomain";;
8877 *) dflt="$cf_email";;
8878 esac
8879 rp='What is your e-mail address?'
8880 . ./myread
8881 cf_email="$ans"
8882 case "$cf_email" in
8883 *@*.*) cont='' ;;
8884 *)
8885 rp='Address does not look like an Internet one. Use it anyway?'
8886 case "$fastread" in
8887 yes) dflt=y ;;
8888 *) dflt=n ;;
8889 esac
8890 . ./myread
8891 case "$ans" in
8892 y*) cont='' ;;
8893 *) echo " " ;;
8894 esac
8895 ;;
8896 esac
8897done
8898
34f1896b 8899: Ask e-mail of administrator
b4eb6b3d
JH
8900$cat <<EOM
8901
8902If you or somebody else will be maintaining perl at your site, please
8903fill in the correct e-mail address here so that they may be contacted
8904if necessary. Currently, the "perlbug" program included with perl
8905will send mail to this address in addition to perlbug@perl.org. You may
8906enter "none" for no administrator.
8907
8908EOM
8909case "$perladmin" in
8910'') dflt="$cf_email";;
8911*) dflt="$perladmin";;
8912esac
8913rp='Perl administrator e-mail address'
8914. ./myread
8915perladmin="$ans"
8916
674912d7
RB
8917: determine whether to only install version-specific parts.
8918echo " "
8919$cat <<EOM
8920Do you want to install only the version-specific parts of the perl
8921distribution? Usually you do *not* want to do this.
8922EOM
8923case "$versiononly" in
8924"$define"|[Yy]*|true) dflt='y' ;;
8925*) dflt='n';
8926esac
8927rp="Do you want to install only the version-specific parts of perl?"
8928. ./myread
8929case "$ans" in
8930[yY]*) val="$define";;
8931*) val="$undef" ;;
8932esac
8933set versiononly
8934eval $setvar
8935
ad493445
MB
8936case "$versiononly" in
8937"$define") inc_version_list=''
8938 inc_version_list_init=0
8939 ;;
8940esac
8941
b4eb6b3d 8942: figure out how to guarantee perl startup
d0e36aa9 8943: XXX Note that this currently takes advantage of the bug that binexp ignores
a2d23ec2
MB
8944: the Configure -Dinstallprefix setting, which in turn means that under
8945: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8946case "$startperl" in
8947'')
8948 case "$sharpbang" in
8949 *!)
8950 $cat <<EOH
8951
8952I can use the #! construct to start perl on your system. This will
8953make startup of perl scripts faster, but may cause problems if you
8954want to share those scripts and perl is not in a standard place
a2d23ec2
MB
8955($initialinstalllocation/perl) on all your platforms. The alternative
8956is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8957
8958EOH
674912d7 8959 case "$versiononly" in
a2d23ec2 8960 "$define") dflt="$initialinstalllocation/perl$version";;
d0e36aa9 8961 *) dflt="$initialinstalllocation/perl";;
674912d7 8962 esac
b4eb6b3d
JH
8963 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8964 . ./myread
8965 case "$ans" in
8966 none) startperl=": # use perl";;
8967 *) startperl="#!$ans"
8968 if $test 30 -lt `echo "$ans" | wc -c`; then
8969 $cat >&4 <<EOM
8970
8971WARNING: Some systems limit the #! command to 32 characters.
8972If you experience difficulty running Perl scripts with #!, try
8973installing Perl in a directory with a shorter pathname.
8974
8975EOM
8976 fi ;;
8977 esac
8978 ;;
8979 *) startperl=": # use perl"
8980 ;;
8981 esac
8982 ;;
8983esac
8984echo "I'll use $startperl to start perl scripts."
8985
8986: figure best path for perl in scripts
8987case "$perlpath" in
8988'')
5e20a8ca 8989 case "$versiononly" in
d0e36aa9
NC
8990 "$define") perlpath="$initialinstalllocation/perl$version";;
8991 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8992 esac
b4eb6b3d
JH
8993 case "$startperl" in
8994 *!*) ;;
8995 *)
8996 $cat <<EOH
8997
8998I will use the "eval 'exec'" idiom to start Perl on your system.
8999I can use the full path of your Perl binary for this purpose, but
9000doing so may cause problems if you want to share those scripts and
d0e36aa9 9001Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
9002
9003EOH
d0e36aa9 9004 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
9005 rp="What path shall I use in \"eval 'exec'\"?"
9006 . ./myread
9007 perlpath="$ans"
9008 ;;
9009 esac
9010 ;;
9011esac
9012case "$startperl" in
9013*!*) ;;
9014*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9015esac
9016
9017: determine where public executable scripts go
9018set scriptdir scriptdir
9019eval $prefixit
9020case "$scriptdir" in
9021'')
9022 dflt="$bin"
9023 : guess some guesses
9024 $test -d /usr/share/scripts && dflt=/usr/share/scripts
9025 $test -d /usr/share/bin && dflt=/usr/share/bin
9026 $test -d /usr/local/script && dflt=/usr/local/script
9027 $test -d /usr/local/scripts && dflt=/usr/local/scripts
9028 $test -d $prefixexp/script && dflt=$prefixexp/script
9029 set dflt
9030 eval $prefixup
9031 ;;
9032*) dflt="$scriptdir"
9033 ;;
9034esac
9035$cat <<EOM
f3f1a2d8 9036
b4eb6b3d
JH
9037Some installations have a separate directory just for executable scripts so
9038that they can mount it across multiple architectures but keep the scripts in
9039one spot. You might, for example, have a subdirectory of /usr/share for this.
9040Or you might just lump your scripts in with all your other executables.
f3f1a2d8 9041
b4eb6b3d
JH
9042EOM
9043fn=d~
9044rp='Where do you keep publicly executable scripts?'
9045. ./getfile
9046if $test "X$ansexp" != "X$scriptdirexp"; then
9047 installscript=''
9048fi
f3f1a2d8 9049installscriptdir=''
79522dd2
NC
9050prefixvar=scriptdir
9051. ./setprefixvar
9052: A little fix up for an irregularly named variable.
9053installscript="$installscriptdir"
9054
b4eb6b3d
JH
9055: determine where add-on public executables go
9056case "$sitebin" in
9057'') dflt=$siteprefix/bin ;;
9058*) dflt=$sitebin ;;
9059esac
9060fn=d~
9061rp='Pathname where the add-on public executables should be installed?'
9062. ./getfile
79522dd2
NC
9063prefixvar=sitebin
9064. ./setprefixvar
b4eb6b3d 9065
6e1038e0 9066: determine where add-on html pages go
8d2cbf27 9067: There is no standard location, so try to copy the previously-selected
6e1038e0 9068: directory structure for the core html pages.
8d2cbf27
JH
9069case "$sitehtml1dir" in
9070'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9071*) dflt=$sitehtml1dir ;;
6e1038e0
MB
9072esac
9073case "$dflt" in
9074''|' ') dflt=none ;;
9075esac
9076fn=dn+~
9077rp='Pathname where the site-specific html pages should be installed?'
9078. ./getfile
79522dd2
NC
9079prefixvar=sitehtml1dir
9080. ./setprefixvar
6e1038e0
MB
9081
9082: determine where add-on library html pages go
9083: There is no standard location, so try to copy the previously-selected
9084: directory structure for the core html pages.
8d2cbf27
JH
9085case "$sitehtml3dir" in
9086'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9087*) dflt=$sitehtml3dir ;;
6e1038e0
MB
9088esac
9089case "$dflt" in
9090''|' ') dflt=none ;;
9091esac
9092fn=dn+~
9093rp='Pathname where the site-specific library html pages should be installed?'
9094. ./getfile
79522dd2
NC
9095prefixvar=sitehtml3dir
9096. ./setprefixvar
6e1038e0
MB
9097
9098: determine where add-on manual pages go
91e123a8
JH
9099case "$siteman1dir" in
9100'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9101*) dflt=$siteman1dir ;;
6e1038e0 9102esac
257059b5
JH
9103case "$dflt" in
9104''|' ') dflt=none ;;
9105esac
6e1038e0
MB
9106fn=dn+~
9107rp='Pathname where the site-specific manual pages should be installed?'
9108. ./getfile
79522dd2
NC
9109prefixvar=siteman1dir
9110. ./setprefixvar
6e1038e0
MB
9111
9112: determine where add-on library man pages go
91e123a8
JH
9113case "$siteman3dir" in
9114'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9115*) dflt=$siteman3dir ;;
6e1038e0 9116esac
257059b5
JH
9117case "$dflt" in
9118''|' ') dflt=none ;;
9119esac
6e1038e0
MB
9120fn=dn+~
9121rp='Pathname where the site-specific library manual pages should be installed?'
9122. ./getfile
79522dd2
NC
9123prefixvar=siteman3dir
9124. ./setprefixvar
6e1038e0
MB
9125
9126: determine where add-on public executable scripts go
9127case "$sitescript" in
9128'') dflt=$siteprefix/script
9129 $test -d $dflt || dflt=$sitebin ;;
9130*) dflt="$sitescript" ;;
9131esac
9132fn=d~+
9133rp='Pathname where add-on public executable scripts should be installed?'
9134. ./getfile
79522dd2
NC
9135prefixvar=sitescript
9136. ./setprefixvar
6e1038e0 9137
34f1896b 9138: Check if faststdio is requested and available
15b61c98
JH
9139case "$usefaststdio" in
9140$define|true|[yY]*|'')
9141 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9142 case "$xversion" in
9143 [68]) dflt='y' ;;
9144 *) dflt='n' ;;
9145 esac
9146 ;;
9147*) dflt='n';;
9148esac
9149cat <<EOM
9150
9151Perl can be built to use 'fast stdio', which means using the stdio
9152library but also directly manipulating the stdio buffers to enable
9153faster I/O. Using stdio is better for backward compatibility (especially
9154for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9155interface has been preferred instead of stdio.
9156
9157If this doesn't make any sense to you, just accept the default '$dflt'.
9158EOM
9159rp='Use the "fast stdio" if available?'
9160. ./myread
9161case "$ans" in
34f1896b 9162y|Y) val="$define" ;;
15b61c98
JH
9163*) val="$undef" ;;
9164esac
9165set usefaststdio
9166eval $setvar
9167
9168
96056487
JH
9169: define an is-a-typedef? function
9170typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9171case "$inclist" in
9172"") inclist="sys/types.h";;
9173esac;
9174eval "varval=\$$var";
9175case "$varval" in
9176"")
9177 $rm -f temp.c;
9178 for inc in $inclist; do
9179 echo "#include <$inc>" >>temp.c;
9180 done;
9181 echo "#ifdef $type" >> temp.c;
9182 echo "printf(\"We have $type\");" >> temp.c;
9183 echo "#endif" >> temp.c;
9184 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9185 if $contains $type temp.E >/dev/null 2>&1; then
9186 eval "$var=\$type";
9187 else
9188 eval "$var=\$def";
9189 fi;
9190 $rm -f temp.?;;
9191*) eval "$var=\$varval";;
9192esac'
9193
9194: define an is-a-typedef? function that prompts if the type is not available.
9195typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9196case "$inclist" in
9197"") inclist="sys/types.h";;
9198esac;
9199eval "varval=\$$var";
9200case "$varval" in
9201"")
9202 $rm -f temp.c;
9203 for inc in $inclist; do
9204 echo "#include <$inc>" >>temp.c;
9205 done;
9206 echo "#ifdef $type" >> temp.c;
9207 echo "printf(\"We have $type\");" >> temp.c;
9208 echo "#endif" >> temp.c;
9209 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9210 echo " " ;
9211 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9212 if $contains $type temp.E >/dev/null 2>&1; then
9213 echo "$type found." >&4;
9214 eval "$var=\$type";
9215 else
9216 echo "$type NOT found." >&4;
9217 dflt="$def";
9218 . ./myread ;
9219 eval "$var=\$ans";
9220 fi;
9221 $rm -f temp.?;;
9222*) eval "$var=\$varval";;
9223esac'
9224
9225: see what type lseek is declared as in the kernel
9226rp="What is the type used for lseek's offset on this system?"
9227set off_t lseektype long stdio.h sys/types.h
9228eval $typedef_ask
9229
9230echo " "
9231echo "Checking to see how big your file offsets are..." >&4
9232$cat >try.c <<EOCP
9233#include <sys/types.h>
9234#include <stdio.h>
9235int main()
9236{
9237 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9238 return(0);
96056487
JH
9239}
9240EOCP
9241set try
9242if eval $compile_ok; then
9243 lseeksize=`$run ./try`
9244 echo "Your file offsets are $lseeksize bytes long."
9245else
9246 dflt=$longsize
9247 echo " "
9248 echo "(I can't seem to compile the test program. Guessing...)"
9249 rp="What is the size of your file offsets (in bytes)?"
9250 . ./myread
9251 lseeksize="$ans"
9252fi
5b813a60 9253$rm_try
96056487
JH
9254
9255: see what type file positions are declared as in the library
9256rp="What is the type for file position used by fsetpos()?"
9257set fpos_t fpostype long stdio.h sys/types.h
9258eval $typedef_ask
9259
613d6c3e 9260: Check size for Fpos_t
96056487
JH
9261echo " "
9262case "$fpostype" in
9263*_t) zzz="$fpostype" ;;
9264*) zzz="fpos_t" ;;
9265esac
613d6c3e 9266echo "Checking the size of $zzz..." >&4
96056487
JH
9267cat > try.c <<EOCP
9268#include <sys/types.h>
9269#include <stdio.h>
d1daaddf
JH
9270#$i_stdlib I_STDLIB
9271#ifdef I_STDLIB
9272#include <stdlib.h>
9273#endif
96056487
JH
9274int main() {
9275 printf("%d\n", (int)sizeof($fpostype));
9276 exit(0);
9277}
9278EOCP
9279set try
9280if eval $compile_ok; then
9281 yyy=`$run ./try`
9282 case "$yyy" in
9283 '') fpossize=4
9284 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9285 ;;
9286 *) fpossize=$yyy
9287 echo "Your $zzz is $fpossize bytes long."
9288 ;;
9289 esac
9290else
9291 dflt="$longsize"
9292 echo " " >&4
9293 echo "(I can't compile the test program. Guessing...)" >&4
9294 rp="What is the size of your file positions (in bytes)?"
9295 . ./myread
9296 fpossize="$ans"
9297fi
9298
613d6c3e 9299: Check for large file support
96056487
JH
9300# Backward compatibility (uselfs is deprecated).
9301case "$uselfs" in
9302"$define"|true|[yY]*)
9303 cat <<EOM >&4
9304
9305*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9306EOM
9307 uselargefiles="$define"
9308 ;;
5b813a60 9309esac
96056487
JH
9310
9311case "$lseeksize:$fpossize" in
93128:8) cat <<EOM
9313
9314You can have files larger than 2 gigabytes.
9315EOM
9316 val="$define" ;;
9317*) case "$uselargefiles" in
9318 "$undef"|false|[nN]*) dflt='n' ;;
9319 *) dflt='y' ;;
9320 esac
9321 cat <<EOM
9322
9323Perl can be built to understand large files (files larger than 2 gigabytes)
9324on some systems. To do so, Configure can be run with -Duselargefiles.
9325
9326If this doesn't make any sense to you, just accept the default '$dflt'.
9327EOM
9328 rp='Try to understand large files, if available?'
9329 . ./myread
9330 case "$ans" in
9331 y|Y) val="$define" ;;
9332 *) val="$undef" ;;
9333 esac
9334 ;;
9335esac
9336set uselargefiles
9337eval $setvar
96056487
JH
9338: Look for a hint-file generated 'call-back-unit'. If the
9339: user has specified that a large files perl is to be built,
9340: we may need to set or change some other defaults.
9da7673b
MB
9341if $test -f uselargefiles.cbu; then
9342 echo "Your platform has some specific hints regarding large file builds, using them..."
9343 . ./uselargefiles.cbu
9344fi
9345case "$uselargefiles" in
9346"$define")
96056487 9347 if $test -f uselargefiles.cbu; then
96056487
JH
9348 echo " "
9349 echo "Rechecking to see how big your file offsets are..." >&4
9350 $cat >try.c <<EOCP
9351#include <sys/types.h>
9352#include <stdio.h>
9353int main()
9354{
9355 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9356 return(0);
96056487
JH
9357}
9358EOCP
9359 set try
9360 if eval $compile_ok; then
9361 lseeksize=`$run ./try`
9362 $echo "Your file offsets are now $lseeksize bytes long."
9363 else
9364 dflt="$lseeksize"
9365 echo " "
9366 echo "(I can't seem to compile the test program. Guessing...)"
9367 rp="What is the size of your file offsets (in bytes)?"
9368 . ./myread
9369 lseeksize="$ans"
9370 fi
9371 case "$fpostype" in
9372 *_t) zzz="$fpostype" ;;
9373 *) zzz="fpos_t" ;;
9374 esac
5b813a60 9375 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9376 $cat > try.c <<EOCP
9377#include <sys/types.h>
9378#include <stdio.h>
55954f19
JH
9379#$i_stdlib I_STDLIB
9380#ifdef I_STDLIB
9381#include <stdlib.h>
9382#endif
96056487
JH
9383int main() {
9384 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9385 return(0);
96056487
JH
9386}
9387EOCP
9388 set try
9389 if eval $compile_ok; then
9390 yyy=`$run ./try`
9391 dflt="$lseeksize"
9392 case "$yyy" in
9393 '') echo " "
9394 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9395 ;;
9396 *) fpossize=$yyy
9397 echo " $fpossize bytes." >&4
9398 ;;
9399 esac
9400 else
9401 dflt="$fpossize"
9402 echo " "
9403 echo "(I can't compile the test program. Guessing...)" >&4
9404 rp="What is the size of your file positions (in bytes)?"
9405 . ./myread
9406 fpossize="$ans"
9407 fi
5b813a60 9408 $rm_try
96056487
JH
9409 fi
9410 ;;
9411esac
9412
613d6c3e 9413: Set the vendorbin variables
b4eb6b3d
JH
9414case "$vendorprefix" in
9415'') d_vendorbin="$undef"
9416 vendorbin=''
9417 vendorbinexp=''
9418 ;;
9419*) d_vendorbin="$define"
9420 : determine where vendor-supplied executables go.
9421 case "$vendorbin" in
9422 '') dflt=$vendorprefix/bin ;;
9423 *) dflt="$vendorbin" ;;
9424 esac
9425 fn=d~+
9426 rp='Pathname for the vendor-supplied executables directory?'
9427 . ./getfile
9428 vendorbin="$ans"
9429 vendorbinexp="$ansexp"
9430 ;;
9431esac
a092d240
NC
9432prefixvar=vendorbin
9433. ./installprefix
b4eb6b3d 9434
613d6c3e 9435: Set the vendorhtml1dir variables
6e1038e0 9436case "$vendorprefix" in
8d2cbf27
JH
9437'') vendorhtml1dir=''
9438 vendorhtml1direxp=''
6e1038e0
MB
9439 ;;
9440*) : determine where vendor-supplied html pages go.
9441 : There is no standard location, so try to copy the previously-selected
9442 : directory structure for the core html pages.
9443 : XXX Better default suggestions would be welcome.
8d2cbf27 9444 case "$vendorhtml1dir" in
6e1038e0 9445 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9446 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9447 esac
9448 case "$dflt" in
9449 ''|' ') dflt=none ;;
9450 esac
9451 fn=dn+~
9452 rp='Pathname for the vendor-supplied html pages?'
9453 . ./getfile
8d2cbf27
JH
9454 vendorhtml1dir="$ans"
9455 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9456 ;;
9457esac
9458: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9459$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9460prefixvar=vendorhtml1dir
9461. ./installprefix
6e1038e0 9462
613d6c3e 9463: Set the vendorhtml3dir variables
6e1038e0 9464case "$vendorprefix" in
8d2cbf27
JH
9465'') vendorhtml3dir=''
9466 vendorhtml3direxp=''
6e1038e0
MB
9467 ;;
9468*) : determine where vendor-supplied module html pages go.
9469 : There is no standard location, so try to copy the previously-selected
9470 : directory structure for the core html pages.
9471 : XXX Better default suggestions would be welcome.
8d2cbf27 9472 case "$vendorhtml3dir" in
6e1038e0 9473 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9474 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9475 esac
9476 case "$dflt" in
9477 ''|' ') dflt=none ;;
9478 esac
9479 fn=dn+~
9480 rp='Pathname for the vendor-supplied html pages?'
9481 . ./getfile
8d2cbf27
JH
9482 vendorhtml3dir="$ans"
9483 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9484 ;;
9485esac
9486: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9487$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9488prefixvar=vendorhtml3dir
9489. ./installprefix
6e1038e0 9490
613d6c3e 9491: Set the vendorman1dir variables
6e1038e0 9492case "$vendorprefix" in
91e123a8
JH
9493'') vendorman1dir=''
9494 vendorman1direxp=''
6e1038e0
MB
9495 ;;
9496*) : determine where vendor-supplied manual pages go.
91e123a8 9497 case "$vendorman1dir" in
6e1038e0 9498 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9499 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9500 esac
9501 case "$dflt" in
9502 ''|' ') dflt=none ;;
9503 esac
9504 fn=nd~+
9505 rp='Pathname for the vendor-supplied manual section 1 pages?'
9506 . ./getfile
91e123a8
JH
9507 vendorman1dir="$ans"
9508 vendorman1direxp="$ansexp"
6e1038e0
MB
9509 ;;
9510esac
9511: Use ' ' for none so value is preserved next time through Configure
91e123a8 9512$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9513prefixvar=vendorman1dir
9514. ./installprefix
6e1038e0 9515
613d6c3e 9516: Set the vendorman3dir variables
6e1038e0 9517case "$vendorprefix" in
91e123a8
JH
9518'') vendorman3dir=''
9519 vendorman3direxp=''
6e1038e0
MB
9520 ;;
9521*) : determine where vendor-supplied module manual pages go.
91e123a8 9522 case "$vendorman3dir" in
6e1038e0 9523 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9524 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9525 esac
9526 case "$dflt" in
9527 ''|' ') dflt=none ;;
9528 esac
9529 fn=nd~+
9530 rp='Pathname for the vendor-supplied manual section 3 pages?'
9531 . ./getfile
91e123a8
JH
9532 vendorman3dir="$ans"
9533 vendorman3direxp="$ansexp"
6e1038e0
MB
9534 ;;
9535esac
9536: Use ' ' for none so value is preserved next time through Configure
91e123a8 9537$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9538prefixvar=vendorman3dir
9539. ./installprefix
6e1038e0 9540
613d6c3e 9541: Set the vendorscript variables
6e1038e0
MB
9542case "$vendorprefix" in
9543'') d_vendorscript="$undef"
9544 vendorscript=''
9545 vendorscriptexp=''
9546 ;;
9547*) d_vendorscript="$define"
9548 : determine where vendor-supplied scripts go.
9549 case "$vendorscript" in
9550 '') dflt=$vendorprefix/script
9551 $test -d $dflt || dflt=$vendorbin ;;
9552 *) dflt="$vendorscript" ;;
9553 esac
9554 $cat <<EOM
9555
f3f1a2d8 9556The installation process will create a directory for
6e1038e0
MB
9557vendor-supplied scripts.
9558
9559EOM
9560 fn=d~+
9561 rp='Pathname for the vendor-supplied scripts directory?'
9562 . ./getfile
9563 vendorscript="$ans"
9564 vendorscriptexp="$ansexp"
9565 ;;
9566esac
a092d240
NC
9567prefixvar=vendorscript
9568. ./installprefix
6e1038e0 9569
f47f1645
TC
9570: script used to emit important warnings
9571cat >warn <<EOS
9572$startsh
9573if test \$# -gt 0; then
9574 echo "\$@" >msg
9575else
9576 cat >msg
9577fi
9578echo "*** WARNING:" >&4
9579sed -e 's/^/*** /' <msg >&4
9580echo "*** " >&4
9581cat msg >>config.msg
9582echo " " >>config.msg
9583rm -f msg
9584EOS
9585chmod +x warn
9586$eunicefix warn
9587
9588: see which of string.h or strings.h is needed
9589echo " "
9590strings=`./findhdr string.h`
9591if $test "$strings" && $test -r "$strings"; then
9592 echo "Using <string.h> instead of <strings.h>." >&4
9593 val="$define"
9594else
9595 val="$undef"
9596 strings=`./findhdr strings.h`
9597 if $test "$strings" && $test -r "$strings"; then
9598 echo "Using <strings.h> instead of <string.h>." >&4
9599 else
9600 ./warn "No string header found -- You'll surely have problems."
9601 fi
9602fi
9603set i_string
9604eval $setvar
9605case "$i_string" in
9606"$undef") strings=`./findhdr strings.h`;;
9607*) strings=`./findhdr string.h`;;
9608esac
9609
b4eb6b3d
JH
9610: see if qgcvt exists
9611set qgcvt d_qgcvt
9612eval $inlibc
9613
613d6c3e 9614: Check print/scan long double stuff
89ce900e
JH
9615echo " "
9616
9617if $test X"$d_longdbl" = X"$define"; then
9618
9619echo "Checking how to print long doubles..." >&4
9620
9621if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9622 $cat >try.c <<'EOCP'
9623#include <sys/types.h>
9624#include <stdio.h>
9625int main() {
9626 double d = 123.456;
9627 printf("%.3f\n", d);
9628}
9629EOCP
9630 set try
9631 if eval $compile; then
9632 yyy=`$run ./try`
9633 case "$yyy" in
9634 123.456)
9635 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9636 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9637 echo "We will use %f."
9638 ;;
9639 esac
9640 fi
9641fi
9642
9643if $test X"$sPRIfldbl" = X; then
9644 $cat >try.c <<'EOCP'
9645#include <sys/types.h>
9646#include <stdio.h>
9647int main() {
9648 long double d = 123.456;
9649 printf("%.3Lf\n", d);
9650}
9651EOCP
9652 set try
9653 if eval $compile; then
9654 yyy=`$run ./try`
9655 case "$yyy" in
9656 123.456)
9657 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9658 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9659 echo "We will use %Lf."
9660 ;;
9661 esac
9662 fi
9663fi
9664
9665if $test X"$sPRIfldbl" = X; then
9666 $cat >try.c <<'EOCP'
9667#include <sys/types.h>
9668#include <stdio.h>
9669int main() {
9670 long double d = 123.456;
9671 printf("%.3llf\n", d);
9672}
9673EOCP
9674 set try
9675 if eval $compile; then
9676 yyy=`$run ./try`
9677 case "$yyy" in
9678 123.456)
9679 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9680 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9681 echo "We will use %llf."
9682 ;;
9683 esac
9684 fi
9685fi
9686
9687if $test X"$sPRIfldbl" = X; then
9688 $cat >try.c <<'EOCP'
9689#include <sys/types.h>
9690#include <stdio.h>
9691int main() {
9692 long double d = 123.456;
9693 printf("%.3lf\n", d);
9694}
9695EOCP
9696 set try
9697 if eval $compile; then
9698 yyy=`$run ./try`
9699 case "$yyy" in
9700 123.456)
9701 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9702 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9703 echo "We will use %lf."
9704 ;;
9705 esac
9706 fi
9707fi
9708
9709if $test X"$sPRIfldbl" = X; then
9710 echo "Cannot figure out how to print long doubles." >&4
9711else
9712 sSCNfldbl=$sPRIfldbl # expect consistency
9713fi
9714
5b813a60 9715$rm_try
89ce900e
JH
9716
9717fi # d_longdbl
9718
9719case "$sPRIfldbl" in
5b813a60
MB
9720'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9721 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9722 d_SCNfldbl="$undef";
9723 ;;
5b813a60
MB
9724*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9725 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9726 d_SCNfldbl="$define";
9727 ;;
9728esac
9729
b4eb6b3d 9730: Check how to convert floats to strings.
a5b10d80
YST
9731
9732if test "X$d_Gconvert" = X; then
9733
b4eb6b3d
JH
9734echo " "
9735echo "Checking for an efficient way to convert floats to strings."
9736echo " " > try.c
9737case "$uselongdouble" in
9738"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9739esac
9740case "$d_longdbl" in
9741"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9742esac
9743case "$d_PRIgldbl" in
9744"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9745esac
9746$cat >>try.c <<EOP
9747#ifdef TRY_gconvert
9748#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9749char *myname = "gconvert";
9750#endif
9751#ifdef TRY_gcvt
9752#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9753char *myname = "gcvt";
9754#endif
9755#ifdef TRY_qgcvt
9756#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9757char *myname = "qgcvt";
9758#define DOUBLETYPE long double
9759#endif
9760#ifdef TRY_sprintf
a5b10d80
YST
9761#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9762#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9763#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9764#else
a5b10d80
YST
9765#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9766#endif
9767#else
b4eb6b3d
JH
9768#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9769#endif
9770char *myname = "sprintf";
9771#endif
9772
9773#ifndef DOUBLETYPE
9774#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9775#define DOUBLETYPE long double
9776#else
9777#define DOUBLETYPE double
9778#endif
9779#endif
9780
9781#include <stdio.h>
9782
f47f1645 9783#$i_stdlib I_STDLIB
b4eb6b3d
JH
9784#ifdef I_STDLIB
9785#include <stdlib.h>
9786#endif
f47f1645
TC
9787#$i_string I_STRING
9788#ifdef I_STRING
9789# include <string.h>
9790#else
9791# include <strings.h>
9792#endif
b4eb6b3d 9793
f47f1645 9794int checkit(char *expect, char *got)
b4eb6b3d
JH
9795{
9796 if (strcmp(expect, got)) {
9797 printf("%s oddity: Expected %s, got %s\n",
9798 myname, expect, got);
9799 exit(1);
9800 }
9801}
9802
9803int main()
5b813a60
MB
9804{
9805 char buf[64];
b4eb6b3d
JH
9806 buf[63] = '\0';
9807
9808 /* This must be 1st test on (which?) platform */
9809 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9810 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9811 checkit("0.1", buf);
9812
5b813a60 9813 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9814 checkit("0.01", buf);
9815
5b813a60 9816 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9817 checkit("0.001", buf);
9818
5b813a60 9819 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9820 checkit("0.0001", buf);
9821
9822 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9823 if (strlen(buf) > 5)
9824 checkit("9e-005", buf); /* for Microsoft ?? */
9825 else
9826 checkit("9e-05", buf);
9827
5b813a60 9828 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9829 checkit("1", buf);
9830
5b813a60 9831 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9832 checkit("1.1", buf);
9833
5b813a60 9834 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9835 checkit("1.01", buf);
9836
5b813a60 9837 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9838 checkit("1.001", buf);
9839
5b813a60 9840 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9841 checkit("1.0001", buf);
9842
5b813a60 9843 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9844 checkit("1.00001", buf);
9845
5b813a60 9846 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9847 checkit("1.000001", buf);
9848
5b813a60 9849 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9850 checkit("0", buf);
9851
5b813a60 9852 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9853 checkit("-1", buf);
9854
9855 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9856 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9857 checkit("100000", buf);
5b813a60 9858
b4eb6b3d 9859 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9860 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9861 checkit("-100000", buf);
9862
5b813a60 9863 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9864 checkit("123.456", buf);
9865
ab6ca9f4 9866 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9867 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9868 /* 34 should be enough to scare even long double
9869 * places into using the e notation. */
ab6ca9f4 9870 if (strlen(buf) > 5)
94b339ad 9871 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9872 else
94b339ad 9873 checkit("1e+34", buf);
8e2a5ede 9874
d1eb8299
YST
9875 /* For Perl, if you add additional tests here, also add them to
9876 * t/base/num.t for benefit of platforms not using Configure or
9877 * overriding d_Gconvert */
9878
b4eb6b3d
JH
9879 exit(0);
9880}
9881EOP
ab6ca9f4 9882: first add preferred functions to our list
a5b10d80 9883xxx_list=""
ab6ca9f4 9884for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9885 case $xxx_convert in
9886 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9887 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9888 esac
a5b10d80
YST
9889done
9890: then add any others
9891for xxx_convert in gconvert gcvt sprintf; do
9892 case "$xxx_list" in
9893 *$xxx_convert*) ;;
9894 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9895 esac
a5b10d80
YST
9896done
9897
9898case "$d_longdbl$uselongdouble" in
9899"$define$define")
9900 : again, add prefered functions to our list first
9901 xxx_ld_list=""
ab6ca9f4 9902 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9903 case $xxx_convert in
9904 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9905 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9906 esac
9907 done
9908 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9909 for xxx_convert in qgcvt sprintf $xxx_list; do
9910 case "$xxx_ld_list" in
9911 $xxx_convert*|*" $xxx_convert"*) ;;
9912 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9913 esac
9914 done
9915 : if sprintf cannot do long doubles, move it to the end
9916 if test "$d_PRIgldbl" != "$define"; then
9917 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9918 fi
9919 : if no qgcvt, remove it
9920 if test "$d_qgcvt" != "$define"; then
9921 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9922 fi
9923 : use the ld_list
9924 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9925 ;;
9926esac
9927
9928for xxx_convert in $xxx_list; do
9929 echo "Trying $xxx_convert..."
93451a0d 9930 $rm -f try try$_o core
b4eb6b3d
JH
9931 set try -DTRY_$xxx_convert
9932 if eval $compile; then
9933 echo "$xxx_convert() found." >&4
5440bc8e 9934 if $run ./try; then
b4eb6b3d
JH
9935 echo "I'll use $xxx_convert to convert floats into a string." >&4
9936 break;
9937 else
9938 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9939 xxx_convert=''
b4eb6b3d
JH
9940 fi
9941 else
9942 echo "$xxx_convert NOT found." >&4
9943 fi
9944done
ab6ca9f4 9945
a5b10d80
YST
9946if test X$xxx_convert = X; then
9947 echo "*** WHOA THERE!!! ***" >&4
9948 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9949 xxx_convert=sprintf
9950fi
9951
b4eb6b3d
JH
9952case "$xxx_convert" in
9953gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9954gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9955qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9956*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9957 "$define$define$define")
9958 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9959 "$define$define$undef")
9960 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9961 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9962 esac
5b813a60 9963 ;;
b4eb6b3d
JH
9964esac
9965
a5b10d80 9966fi
93451a0d 9967$rm_try
a5b10d80 9968
74cac757
JH
9969: see if _fwalk exists
9970set fwalk d__fwalk
9971eval $inlibc
9972
b4eb6b3d
JH
9973: Initialize h_fcntl
9974h_fcntl=false
9975
9976: Initialize h_sysfile
9977h_sysfile=false
9978
9979: access call always available on UNIX
9980set access d_access
9981eval $inlibc
9982
9983: locate the flags for 'access()'
9984case "$d_access" in
9985"$define")
9986 echo " "
55954f19 9987 $cat >access.c <<EOCP
b4eb6b3d
JH
9988#include <sys/types.h>
9989#ifdef I_FCNTL
9990#include <fcntl.h>
9991#endif
9992#ifdef I_SYS_FILE
9993#include <sys/file.h>
9994#endif
9995#ifdef I_UNISTD
9996#include <unistd.h>
9997#endif
55954f19
JH
9998#$i_stdlib I_STDLIB
9999#ifdef I_STDLIB
10000#include <stdlib.h>
10001#endif
b4eb6b3d
JH
10002int main() {
10003 exit(R_OK);
10004}
10005EOCP
10006 : check sys/file.h first, no particular reason here
10007 if $test `./findhdr sys/file.h` && \
7a282f6d 10008 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10009 h_sysfile=true;
10010 echo "<sys/file.h> defines the *_OK access constants." >&4
10011 elif $test `./findhdr fcntl.h` && \
7a282f6d 10012 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10013 h_fcntl=true;
10014 echo "<fcntl.h> defines the *_OK access constants." >&4
10015 elif $test `./findhdr unistd.h` && \
7a282f6d 10016 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10017 echo "<unistd.h> defines the *_OK access constants." >&4
10018 else
10019 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10020 fi
10021 ;;
10022esac
10023$rm -f access*
10024
10025: see if accessx exists
10026set accessx d_accessx
10027eval $inlibc
10028
89ce900e
JH
10029: see if aintl exists
10030set aintl d_aintl
10031eval $inlibc
10032
b4eb6b3d
JH
10033: see if alarm exists
10034set alarm d_alarm
10035eval $inlibc
10036
96938616
MB
10037: see if 64bit time functions exists
10038
10039set ctime64 d_ctime64
10040eval $inlibc
10041
10042set localtime64 d_localtime64
10043eval $inlibc
10044
10045set gmtime64 d_gmtime64
10046eval $inlibc
10047
10048set mktime64 d_mktime64
10049eval $inlibc
10050
10051set difftime64 d_difftime64
10052eval $inlibc
10053
10054set asctime64 d_asctime64
10055eval $inlibc
10056
a9dade78
JH
10057: see if POSIX threads are available
10058set pthread.h i_pthread
10059eval $inhdr
10060
10bc17b6
JH
10061: define a fucntion to check prototypes
10062$cat > protochk <<EOSH
10063$startsh
10064cc="$cc"
10065optimize="$optimize"
10066ccflags="$ccflags"
10067prototype="$prototype"
10068define="$define"
c944cfb9 10069rm_try="$rm_try"
a9dade78
JH
10070usethreads=$usethreads
10071i_pthread=$i_pthread
10072pthread_h_first=$pthread_h_first
10bc17b6
JH
10073EOSH
10074
10075$cat >> protochk <<'EOSH'
10076
5b813a60 10077$rm_try
10bc17b6
JH
10078foo="$1"
10079shift
10080while test $# -ge 2; do
10081 case "$1" in
10082 $define) echo "#include <$2>" >> try.c ;;
10083 literal) echo "$2" >> try.c ;;
10084 esac
cce6a207
MB
10085 # Extra magic for the benefit of systems that need pthread.h
10086 # to be included early to correctly detect threadsafe functions.
10087 # Such functions must guarantee themselves, though, that the usethreads
10088 # and i_pthread have been defined, before calling protochk.
10089 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10090 echo "#include <pthread.h>" >> try.c
10091 pthread_h_done=yes
10092 fi
10bc17b6
JH
10093 shift 2
10094done
10095test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10096cat >> try.c <<'EOCP'
10097#ifdef CAN_PROTOTYPE
10098#define _(args) args
10099#else
10100#define _(args) ()
10101#endif
10102EOCP
10103echo "$foo" >> try.c
10104echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10105$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10106status=$?
5b813a60 10107$rm_try
10bc17b6
JH
10108exit $status
10109EOSH
10110chmod +x protochk
10111$eunicefix protochk
10112
34f1896b 10113: Define hasproto macro for Configure internal use
89ce900e
JH
10114hasproto='varname=$1; func=$2; shift; shift;
10115while $test $# -ge 2; do
10116 case "$1" in
10117 $define) echo "#include <$2>";;
10118 esac ;
10119 shift 2;
10120done > try.c;
10121$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10122if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10123 echo "$func() prototype found.";
10124 val="$define";
10125else
10126 echo "$func() prototype NOT found.";
10127 val="$undef";
10128fi;
10129set $varname;
10130eval $setvar;
5b813a60 10131$rm_try tryout.c'
89ce900e 10132
10bc17b6
JH
10133: see if sys/types.h has to be included
10134set sys/types.h i_systypes
10135eval $inhdr
10136
10137: see if sys/select.h has to be included
10138set sys/select.h i_sysselct
10139eval $inhdr
10140
34f1896b 10141: Define hasfield macro for Configure internal use
10bc17b6
JH
10142hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10143while $test $# -ge 2; do
10144 case "$1" in
10145 $define) echo "#include <$2>";;
10146 esac ;
10147 shift 2;
10148done > try.c;
10149echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10150set try;
10151if eval $compile; then
10152 val="$define";
10153else
10154 val="$undef";
10155fi;
10156set $varname;
10157eval $setvar;
5b813a60 10158$rm_try'
10bc17b6
JH
10159
10160: see if we should include time.h, sys/time.h, or both
10161echo " "
10162if test "X$timeincl" = X; then
10163 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10164 $echo $n "I'm now running the test program...$c"
55954f19 10165 $cat >try.c <<EOCP
10bc17b6
JH
10166#include <sys/types.h>
10167#ifdef I_TIME
10168#include <time.h>
10169#endif
10170#ifdef I_SYSTIME
10171#ifdef SYSTIMEKERNEL
10172#define KERNEL
10173#endif
10174#include <sys/time.h>
10175#endif
10176#ifdef I_SYSSELECT
10177#include <sys/select.h>
10178#endif
55954f19
JH
10179#$i_stdlib I_STDLIB
10180#ifdef I_STDLIB
10181#include <stdlib.h>
10182#endif
10bc17b6
JH
10183int main()
10184{
10185 struct tm foo;
10186#ifdef S_TIMEVAL
10187 struct timeval bar;
10188#endif
10189#ifdef S_TIMEZONE
10190 struct timezone tzp;
10191#endif
10192 if (foo.tm_sec == foo.tm_sec)
10193 exit(0);
10194#ifdef S_TIMEVAL
10195 if (bar.tv_sec == bar.tv_sec)
10196 exit(0);
10197#endif
10198 exit(1);
10199}
10200EOCP
10201 flags=''
10202 for s_timezone in '-DS_TIMEZONE' ''; do
10203 sysselect=''
10204 for s_timeval in '-DS_TIMEVAL' ''; do
10205 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10206 for i_time in '' '-DI_TIME'; do
10207 for i_systime in '-DI_SYSTIME' ''; do
10208 case "$flags" in
10209 '') $echo $n ".$c"
10210 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10211 if eval $compile; then
10212 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10213 shift
10214 flags="$*"
10215 echo " "
10216 $echo $n "Succeeded with $flags$c"
10217 fi
10218 ;;
10219 esac
10220 done
10221 done
10222 done
10223 done
10224 done
10225 timeincl=''
10226 echo " "
10227 case "$flags" in
10228 *SYSTIMEKERNEL*) i_systimek="$define"
10229 timeincl=`./findhdr sys/time.h`
10230 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10231 *) i_systimek="$undef";;
10232 esac
10233 case "$flags" in
10234 *I_TIME*) i_time="$define"
10235 timeincl=`./findhdr time.h`" $timeincl"
10236 echo "We'll include <time.h>." >&4;;
10237 *) i_time="$undef";;
10238 esac
10239 case "$flags" in
10240 *I_SYSTIME*) i_systime="$define"
10241 timeincl=`./findhdr sys/time.h`" $timeincl"
10242 echo "We'll include <sys/time.h>." >&4;;
10243 *) i_systime="$undef";;
10244 esac
5b813a60 10245 $rm_try
10bc17b6
JH
10246fi
10247: see if struct tm knows about tm_zone
10248case "$i_systime$i_time" in
5b813a60 10249*$define*)
10bc17b6
JH
10250 echo " "
10251 echo "Checking to see if your struct tm has tm_zone field..." >&4
10252 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10253 eval $hasfield
10254 ;;
10255*) val="$undef"
10256 set d_tm_tm_zone
10257 eval $setvar
10258 ;;
10259esac
10260case "$d_tm_tm_zone" in
10261"$define") echo "Yes, it does." ;;
10262*) echo "No, it doesn't." ;;
10263esac
10264: see if struct tm knows about tm_gmtoff
10265case "$i_systime$i_time" in
5b813a60 10266*$define*)
10bc17b6
JH
10267 echo " "
10268 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10269 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10270 eval $hasfield
10271 ;;
10272*) val="$undef"
10273 set d_tm_tm_gmtoff
10274 eval $setvar
10275 ;;
10276esac
10277case "$d_tm_tm_gmtoff" in
10278"$define") echo "Yes, it does." ;;
10279*) echo "No, it doesn't." ;;
10280esac
10281
10282: see if asctime_r exists
10283set asctime_r d_asctime_r
10284eval $inlibc
10285case "$d_asctime_r" in
10286"$define")
d63eadf0 10287 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10288 case "$d_asctime_r_proto:$usethreads" in
10289 ":define") d_asctime_r_proto=define
a48ec845
JH
10290 set d_asctime_r_proto asctime_r $hdrs
10291 eval $hasproto ;;
10292 *) ;;
10293 esac
10294 case "$d_asctime_r_proto" in
10295 define)
10bc17b6
JH
10296 case "$asctime_r_proto" in
10297 ''|0) try='char* asctime_r(const struct tm*, char*);'
61c26d18 10298 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10bc17b6
JH
10299 esac
10300 case "$asctime_r_proto" in
10301 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
61c26d18 10302 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10bc17b6
JH
10303 esac
10304 case "$asctime_r_proto" in
10305 ''|0) try='int asctime_r(const struct tm*, char*);'
61c26d18 10306 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10bc17b6
JH
10307 esac
10308 case "$asctime_r_proto" in
10309 ''|0) try='int asctime_r(const struct tm*, char*, int);'
61c26d18 10310 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10bc17b6
JH
10311 esac
10312 case "$asctime_r_proto" in
90e831dc 10313 ''|0) d_asctime_r=undef
10bc17b6 10314 asctime_r_proto=0
a48ec845 10315 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10316 * ) case "$asctime_r_proto" in
10317 REENTRANT_PROTO*) ;;
10318 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10319 esac
10320 echo "Prototype: $try" ;;
10321 esac
10322 ;;
c18e646a
JH
10323 *) case "$usethreads" in
10324 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10325 esac
90e831dc
SB
10326 d_asctime_r=undef
10327 asctime_r_proto=0
c18e646a 10328 ;;
a48ec845
JH
10329 esac
10330 ;;
10bc17b6
JH
10331*) asctime_r_proto=0
10332 ;;
10333esac
10334
b4eb6b3d
JH
10335: see if atolf exists
10336set atolf d_atolf
10337eval $inlibc
10338
10339: see if atoll exists
10340set atoll d_atoll
10341eval $inlibc
10342
0dbb1585
AL
10343: Look for GCC-style attribute format
10344case "$d_attribute_format" in
bde30f85 10345'')
b4eb6b3d 10346echo " "
0dbb1585 10347echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10348$cat >attrib.c <<'EOCP'
10349#include <stdio.h>
0dbb1585 10350void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10351EOCP
10352if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10353 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10354 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10355 val="$undef"
10356 else
0dbb1585 10357 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10358 val="$define"
10359 fi
10360else
10361 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10362 val="$undef"
10363fi
bde30f85 10364;;
0dbb1585 10365*) val="$d_attribute_format" ;;
bde30f85 10366esac
0dbb1585
AL
10367set d_attribute_format
10368eval $setvar
10369$rm -f attrib*
10370
dcb594bc
MB
10371: Look for GCC-style attribute format with null format allowed
10372case "$d_printf_format_null" in
10373'') case "$d_attribute_format" in
10374 $define)
10375 echo " "
10376 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10377$cat >attrib.c <<EOCP
10378#include <stdio.h>
10379#$i_stdlib I_STDLIB
10380#ifdef I_STDLIB
10381#include <stdlib.h>
10382#endif
10383int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10384int null_printf (char* pat,...) { return (int)pat; }
10385int main () { exit(null_printf(NULL)); }
10386EOCP
10387 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10388 : run the executable in case it produces a run-time warning
10389 if $run ./attrib >>attrib.out 2>&1; then
10390 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10391 echo "Your C compiler doesn't allow __printf__ format to be null."
10392 val="$undef"
10393 else
10394 echo "Your C compiler allows __printf__ format to be null."
10395 val="$define"
10396 fi
10397 else
10398 echo "Your C compiler executable failed with __printf__ format null."
10399 val="$undef"
10400 fi
10401 else
10402 echo "Your C compiler fails with __printf__ format null."
10403 val="$undef"
10404 fi
10405 ;;
10406 *) val="$undef" ;;
10407 esac
10408;;
10409*) val="$d_printf_format_null" ;;
10410esac
10411set d_printf_format_null
10412eval $setvar
10413$rm -f attrib*
10414
0dbb1585
AL
10415: Look for GCC-style attribute malloc
10416case "$d_attribute_malloc" in
10417'')
10418echo " "
10419echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10420$cat >attrib.c <<'EOCP'
10421#include <stdio.h>
10422char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10423EOCP
10424if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10425 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10426 echo "Your C compiler doesn't support __attribute__((malloc))."
10427 val="$undef"
10428 else
10429 echo "Your C compiler supports __attribute__((malloc))."
10430 val="$define"
10431 fi
10432else
10433 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10434 val="$undef"
10435fi
10436;;
10437*) val="$d_attribute_malloc" ;;
10438esac
10439set d_attribute_malloc
10440eval $setvar
10441$rm -f attrib*
10442
10443: Look for GCC-style attribute nonnull
10444case "$d_attribute_nonnull" in
10445'')
10446echo " "
10447echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10448$cat >attrib.c <<'EOCP'
10449#include <stdio.h>
10450void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10451EOCP
10452if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10453 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10454 echo "Your C compiler doesn't support __attribute__((nonnull))."
10455 val="$undef"
10456 else
10457 echo "Your C compiler supports __attribute__((nonnull))."
10458 val="$define"
10459 fi
10460else
10461 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10462 val="$undef"
10463fi
10464;;
10465*) val="$d_attribute_nonnull" ;;
10466esac
10467set d_attribute_nonnull
10468eval $setvar
10469$rm -f attrib*
10470
10471: Look for GCC-style attribute noreturn
10472case "$d_attribute_noreturn" in
10473'')
10474echo " "
10475echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10476$cat >attrib.c <<'EOCP'
10477#include <stdio.h>
10478void fall_over_dead( void ) __attribute__((noreturn));
10479EOCP
10480if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10481 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10482 echo "Your C compiler doesn't support __attribute__((noreturn))."
10483 val="$undef"
10484 else
10485 echo "Your C compiler supports __attribute__((noreturn))."
10486 val="$define"
10487 fi
10488else
10489 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10490 val="$undef"
10491fi
10492;;
10493*) val="$d_attribute_noreturn" ;;
10494esac
10495set d_attribute_noreturn
10496eval $setvar
10497$rm -f attrib*
10498
10499: Look for GCC-style attribute pure
10500case "$d_attribute_pure" in
10501'')
10502echo " "
10503echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10504$cat >attrib.c <<'EOCP'
10505#include <stdio.h>
10506int square( int n ) __attribute__((pure));
10507EOCP
10508if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10509 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10510 echo "Your C compiler doesn't support __attribute__((pure))."
10511 val="$undef"
10512 else
10513 echo "Your C compiler supports __attribute__((pure))."
10514 val="$define"
10515 fi
10516else
10517 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10518 val="$undef"
10519fi
10520;;
10521*) val="$d_attribute_pure" ;;
10522esac
10523set d_attribute_pure
10524eval $setvar
10525$rm -f attrib*
10526
10527: Look for GCC-style attribute unused
10528case "$d_attribute_unused" in
10529'')
10530echo " "
10531echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10532$cat >attrib.c <<'EOCP'
10533#include <stdio.h>
10534int do_something( int dummy __attribute__((unused)), int n );
10535EOCP
10536if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10537 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10538 echo "Your C compiler doesn't support __attribute__((unused))."
10539 val="$undef"
10540 else
10541 echo "Your C compiler supports __attribute__((unused))."
10542 val="$define"
10543 fi
10544else
10545 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10546 val="$undef"
10547fi
10548;;
10549*) val="$d_attribute_unused" ;;
10550esac
10551set d_attribute_unused
10552eval $setvar
10553$rm -f attrib*
10554
fcdf39cf
RGS
10555: Look for GCC-style attribute deprecated
10556case "$d_attribute_deprecated" in
10557'')
10558echo " "
10559echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10560$cat >attrib.c <<'EOCP'
10561#include <stdio.h>
10562int I_am_deprecated(void) __attribute__((deprecated));
10563EOCP
10564if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10565 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10566 echo "Your C compiler doesn't support __attribute__((deprecated))."
10567 val="$undef"
10568 else
10569 echo "Your C compiler supports __attribute__((deprecated))."
10570 val="$define"
10571 fi
10572else
10573 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10574 val="$undef"
10575fi
10576;;
10577*) val="$d_attribute_deprecated" ;;
10578esac
10579set d_attribute_deprecated
10580eval $setvar
10581$rm -f attrib*
10582
0dbb1585
AL
10583: Look for GCC-style attribute warn_unused_result
10584case "$d_attribute_warn_unused_result" in
10585'')
10586echo " "
10587echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10588$cat >attrib.c <<'EOCP'
10589#include <stdio.h>
10590int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10591EOCP
10592if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10593 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10594 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10595 val="$undef"
10596 else
10597 echo "Your C compiler supports __attribute__((warn_unused_result))."
10598 val="$define"
10599 fi
10600else
10601 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10602 val="$undef"
10603fi
10604;;
10605*) val="$d_attribute_warn_unused_result" ;;
10606esac
10607set d_attribute_warn_unused_result
b4eb6b3d
JH
10608eval $setvar
10609$rm -f attrib*
10610
10611: see if bcmp exists
10612set bcmp d_bcmp
10613eval $inlibc
10614
10615: see if bcopy exists
10616set bcopy d_bcopy
10617eval $inlibc
10618
b4eb6b3d
JH
10619: see if getpgrp exists
10620set getpgrp d_getpgrp
10621eval $inlibc
10622
10623case "$d_getpgrp" in
10624"$define")
10625 echo " "
10626 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10627 $cat >try.c <<EOP
b4eb6b3d
JH
10628#$i_unistd I_UNISTD
10629#include <sys/types.h>
10630#ifdef I_UNISTD
10631# include <unistd.h>
10632#endif
55954f19
JH
10633#$i_stdlib I_STDLIB
10634#ifdef I_STDLIB
10635#include <stdlib.h>
10636#endif
b4eb6b3d
JH
10637int main()
10638{
10639 if (getuid() == 0) {
10640 printf("(I see you are running Configure as super-user...)\n");
10641 setuid(1);
10642 }
10643#ifdef TRY_BSD_PGRP
10644 if (getpgrp(1) == 0)
10645 exit(0);
10646#else
10647 if (getpgrp() > 0)
10648 exit(0);
10649#endif
10650 exit(1);
10651}
10652EOP
5440bc8e 10653 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10654 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10655 val="$define"
5440bc8e 10656 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10657 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10658 val="$undef"
10659 else
10660 echo "I can't seem to compile and run the test program."
10661 if ./usg; then
10662 xxx="a USG one, i.e. you use getpgrp()."
10663 else
10664 # SVR4 systems can appear rather BSD-ish.
10665 case "$i_unistd" in
10666 $undef)
10667 xxx="a BSD one, i.e. you use getpgrp(pid)."
10668 val="$define"
10669 ;;
10670 $define)
10671 xxx="probably a USG one, i.e. you use getpgrp()."
10672 val="$undef"
10673 ;;
10674 esac
10675 fi
10676 echo "Assuming your getpgrp is $xxx" >&4
10677 fi
10678 ;;
10679*) val="$undef";;
10680esac
10681set d_bsdgetpgrp
10682eval $setvar
5b813a60 10683$rm_try
b4eb6b3d
JH
10684
10685: see if setpgrp exists
10686set setpgrp d_setpgrp
10687eval $inlibc
10688
10689case "$d_setpgrp" in
10690"$define")
10691 echo " "
10692 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10693 $cat >try.c <<EOP
b4eb6b3d
JH
10694#$i_unistd I_UNISTD
10695#include <sys/types.h>
10696#ifdef I_UNISTD
10697# include <unistd.h>
10698#endif
55954f19
JH
10699#$i_stdlib I_STDLIB
10700#ifdef I_STDLIB
10701#include <stdlib.h>
10702#endif
b4eb6b3d
JH
10703int main()
10704{
10705 if (getuid() == 0) {
10706 printf("(I see you are running Configure as super-user...)\n");
10707 setuid(1);
10708 }
10709#ifdef TRY_BSD_PGRP
10710 if (-1 == setpgrp(1, 1))
10711 exit(0);
10712#else
10713 if (setpgrp() != -1)
10714 exit(0);
10715#endif
10716 exit(1);
10717}
10718EOP
5440bc8e 10719 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10720 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10721 val="$define"
5440bc8e 10722 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10723 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10724 val="$undef"
10725 else
10726 echo "(I can't seem to compile and run the test program.)"
10727 if ./usg; then
10728 xxx="a USG one, i.e. you use setpgrp()."
10729 else
10730 # SVR4 systems can appear rather BSD-ish.
10731 case "$i_unistd" in
10732 $undef)
10733 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10734 val="$define"
10735 ;;
10736 $define)
10737 xxx="probably a USG one, i.e. you use setpgrp()."
10738 val="$undef"
10739 ;;
10740 esac
10741 fi
10742 echo "Assuming your setpgrp is $xxx" >&4
10743 fi
10744 ;;
10745*) val="$undef";;
10746esac
10747set d_bsdsetpgrp
10748eval $setvar
5b813a60
MB
10749$rm_try
10750
635aebb7
AL
10751: Look for GCC-style __builtin_choose_expr
10752case "$d_builtin_choose_expr" in
10753'')
10754 echo " "
10755 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10756 $cat >try.c <<'EOCP'
10757#include <assert.h>
10758#include <stdlib.h>
10759#include <stdio.h>
10760
10761#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10762
10763int main(void) {
10764 assert( SYRINX(1) == 2112 );
10765 assert( SYRINX(1) != 5150 );
10766 assert( SYRINX(0) == 5150 );
10767 assert( SYRINX(0) != 2112 );
10768 puts( "All good!" );
10769 exit(0);
10770}
10771
10772EOCP
10773 set try
70ceb34a 10774 if eval $compile && $run ./try; then
635aebb7
AL
10775 echo "Your C compiler supports __builtin_choose_expr."
10776 val="$define"
10777 else
10778 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10779 val="$undef"
10780 fi
10781;;
10782*) val="$d_builtin_choose_expr" ;;
10783esac
10784
10785set d_builtin_choose_expr
10786eval $setvar
5b813a60 10787$rm_try
635aebb7
AL
10788
10789: Look for GCC-style __builtin_expect
10790case "$d_builtin_expect" in
10791'')
10792 echo " "
10793 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
70ceb34a 10794 $cat >try.c <<'EOCP'
635aebb7
AL
10795int main(void) {
10796 int n = 50;
10797 if ( __builtin_expect(n, 0) ) n = 1;
70ceb34a
NC
10798 /* Remember shell exit code truth is 0, C truth is non-zero */
10799 return !(n == 1);
635aebb7
AL
10800}
10801EOCP
10802 set try
70ceb34a
NC
10803 if eval $compile && $run ./try; then
10804 echo "Your C compiler supports __builtin_expect."
635aebb7
AL
10805 val="$define"
10806 else
70ceb34a 10807 echo "Your C compiler doesn't seem to understand __builtin_expect."
635aebb7
AL
10808 val="$undef"
10809 fi
10810 ;;
10811*) val="$d_builtin_expect" ;;
10812esac
10813
10814set d_builtin_expect
10815eval $setvar
5b813a60 10816$rm_try
635aebb7 10817
b4eb6b3d
JH
10818: see if bzero exists
10819set bzero d_bzero
10820eval $inlibc
10821
a2d23ec2
MB
10822: see if stdarg is available
10823echo " "
10824if $test `./findhdr stdarg.h`; then
10825 echo "<stdarg.h> found." >&4
10826 valstd="$define"
10827else
10828 echo "<stdarg.h> NOT found." >&4
10829 valstd="$undef"
10830fi
10831
10832: see if varags is available
10833echo " "
10834if $test `./findhdr varargs.h`; then
10835 echo "<varargs.h> found." >&4
10836else
10837 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10838fi
10839
10840: set up the varargs testing programs
10841$cat > varargs.c <<EOP
10842#ifdef I_STDARG
10843#include <stdarg.h>
10844#endif
10845#ifdef I_VARARGS
10846#include <varargs.h>
10847#endif
10848
10849#ifdef I_STDARG
10850int f(char *p, ...)
10851#else
10852int f(va_alist)
10853va_dcl
10854#endif
10855{
10856 va_list ap;
10857#ifndef I_STDARG
10858 char *p;
10859#endif
10860#ifdef I_STDARG
10861 va_start(ap,p);
10862#else
10863 va_start(ap);
10864 p = va_arg(ap, char *);
10865#endif
10866 va_end(ap);
4fb7dc7d 10867 return 0;
a2d23ec2
MB
10868}
10869EOP
10870$cat > varargs <<EOP
10871$startsh
10872if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10873 echo "true"
10874else
10875 echo "false"
10876fi
10877$rm -f varargs$_o
10878EOP
10879chmod +x varargs
10880
10881: now check which varargs header should be included
10882echo " "
10883i_varhdr=''
10884case "$valstd" in
10885"$define")
10886 if `./varargs I_STDARG`; then
10887 val='stdarg.h'
10888 elif `./varargs I_VARARGS`; then
10889 val='varargs.h'
10890 fi
10891 ;;
10892*)
10893 if `./varargs I_VARARGS`; then
10894 val='varargs.h'
10895 fi
10896 ;;
10897esac
10898case "$val" in
10899'')
10900echo "I could not find the definition for va_dcl... You have problems..." >&4
10901 val="$undef"; set i_stdarg; eval $setvar
10902 val="$undef"; set i_varargs; eval $setvar
10903 ;;
613d6c3e 10904*)
a2d23ec2
MB
10905 set i_varhdr
10906 eval $setvar
10907 case "$i_varhdr" in
10908 stdarg.h)
10909 val="$define"; set i_stdarg; eval $setvar
10910 val="$undef"; set i_varargs; eval $setvar
10911 ;;
10912 varargs.h)
10913 val="$undef"; set i_stdarg; eval $setvar
10914 val="$define"; set i_varargs; eval $setvar
10915 ;;
10916 esac
10917 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10918esac
10919$rm -f varargs*
10920
10921: see if the Compiler supports C99 variadic macros
10922case "$i_stdarg$i_stdlib" in
10923 "$define$define")
10924 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10925 $cat >try.c <<EOCP
10926#include <stdio.h>
10927#include <stdarg.h>
10928
10929#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10930
10931int main() {
10932 char buf[20];
10933 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10934 puts(buf);
10935 return 0;
10936}
10937EOCP
10938 set try
10939 if eval $compile && $run ./try 2>&1 >/dev/null; then
10940 case "`$run ./try`" in
10941 "123 456 789")
10942 echo "You have C99 variadic macros." >&4
10943 d_c99_variadic_macros="$define"
10944 ;;
10945 *)
10946 echo "You don't have functional C99 variadic macros." >&4
10947 d_c99_variadic_macros="$undef"
10948 ;;
10949 esac
10950 else
10951 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10952 d_c99_variadic_macros="$undef"
10953 fi
5b813a60 10954 $rm_try
a2d23ec2
MB
10955 ;;
10956 *)
10957 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10958 d_c99_variadic_macros="$undef"
10959 ;;
10960esac
10961
b4eb6b3d
JH
10962: see if signal is declared as pointer to function returning int or void
10963echo " "
10964xxx=`./findhdr signal.h`
10965$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10966if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10967 echo "You have int (*signal())() instead of void." >&4
10968 val="$undef"
10969elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10970 echo "You have void (*signal())()." >&4
10971 val="$define"
10972elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10973 echo "You have int (*signal())() instead of void." >&4
10974 val="$undef"
10975elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10976 echo "You have void (*signal())()." >&4
10977 val="$define"
10978else
10979 case "$d_voidsig" in
10980 '')
10981 echo "I can't determine whether signal handler returns void or int..." >&4
10982 dflt=void
10983 rp="What type does your signal handler return?"
10984 . ./myread
10985 case "$ans" in
10986 v*) val="$define";;
10987 *) val="$undef";;
10988 esac;;
10989 "$define")
10990 echo "As you already told me, signal handler returns void." >&4
10991 val="$define"
10992 ;;
10993 *) echo "As you already told me, signal handler returns int." >&4
10994 val="$undef"
10995 ;;
10996 esac
10997fi
10998set d_voidsig
10999eval $setvar
11000case "$d_voidsig" in
11001"$define") signal_t="void";;
11002*) signal_t="int";;
11003esac
11004$rm -f $$.tmp
11005
11006: check for ability to cast large floats to 32-bit ints.
11007echo " "
11008echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11009if $test "$intsize" -ge 4; then
11010 xxx=int
11011else
11012 xxx=long
11013fi
11014$cat >try.c <<EOCP
11015#include <stdio.h>
d1daaddf
JH
11016#$i_stdlib I_STDLIB
11017#ifdef I_STDLIB
11018#include <stdlib.h>
11019#endif
b4eb6b3d
JH
11020#include <sys/types.h>
11021#include <signal.h>
7090f861 11022$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
11023int main()
11024{
11025 $xxx i32;
11026 double f, g;
11027 int result = 0;
11028 char str[16];
11029 signal(SIGFPE, blech);
11030
5b813a60 11031 /* Don't let compiler optimize the test away. Store the number
e237eb00 11032 in a writable string for gcc to pass to sscanf under HP-UX.
b4eb6b3d
JH
11033 */
11034 sprintf(str, "2147483647");
11035 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11036 g = 10 * f;
11037 i32 = ($xxx) g;
11038
11039 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 11040 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
11041 behavior here, which is to preserve the sign and give
11042 back 0x7fff ffff.
11043 */
11044 if (i32 != ($xxx) f)
11045 result |= 1;
11046 exit(result);
11047}
11048EOCP
11049set try
11050if eval $compile_ok; then
5440bc8e 11051 $run ./try
b4eb6b3d
JH
11052 yyy=$?
11053else
11054 echo "(I can't seem to compile the test program--assuming it can't)"
11055 yyy=1
11056fi
11057case "$yyy" in
110580) val="$define"
11059 echo "Yup, it can."
11060 ;;
11061*) val="$undef"
11062 echo "Nope, it can't."
11063 ;;
11064esac
11065set d_casti32
11066eval $setvar
5b813a60 11067$rm_try
b4eb6b3d
JH
11068
11069: check for ability to cast negative floats to unsigned
11070echo " "
11071echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11072$cat >try.c <<EOCP
11073#include <stdio.h>
d1daaddf
JH
11074#$i_stdlib I_STDLIB
11075#ifdef I_STDLIB
11076#include <stdlib.h>
11077#endif
b4eb6b3d
JH
11078#include <sys/types.h>
11079#include <signal.h>
7090f861
JH
11080$signal_t blech(int s) { exit(7); }
11081$signal_t blech_in_list(int s) { exit(4); }
11082unsigned long dummy_long(unsigned long p) { return p; }
11083unsigned int dummy_int(unsigned int p) { return p; }
11084unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
11085int main()
11086{
11087 double f;
11088 unsigned long along;
11089 unsigned int aint;
11090 unsigned short ashort;
11091 int result = 0;
11092 char str[16];
5b813a60 11093
b4eb6b3d
JH
11094 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11095 a direct f = -123. assignment. gcc-2.8.0 reportedly
11096 optimized the whole file away
11097 */
5b813a60 11098 /* Store the number in a writable string for gcc to pass to
e237eb00 11099 sscanf under HP-UX.
b4eb6b3d
JH
11100 */
11101 sprintf(str, "-123");
11102 sscanf(str, "%lf", &f); /* f = -123.; */
11103
11104 signal(SIGFPE, blech);
11105 along = (unsigned long)f;
11106 aint = (unsigned int)f;
11107 ashort = (unsigned short)f;
11108 if (along != (unsigned long)-123)
11109 result |= 1;
11110 if (aint != (unsigned int)-123)
11111 result |= 1;
11112 if (ashort != (unsigned short)-123)
11113 result |= 1;
11114 sprintf(str, "1073741824.");
11115 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11116 f = f + f;
11117 along = 0;
11118 along = (unsigned long)f;
11119 if (along != 0x80000000)
11120 result |= 2;
11121 f -= 1.;
11122 along = 0;
11123 along = (unsigned long)f;
11124 if (along != 0x7fffffff)
11125 result |= 1;
11126 f += 2.;
11127 along = 0;
11128 along = (unsigned long)f;
11129 if (along != 0x80000001)
11130 result |= 2;
11131 if (result)
11132 exit(result);
11133 signal(SIGFPE, blech_in_list);
11134 sprintf(str, "123.");
11135 sscanf(str, "%lf", &f); /* f = 123.; */
11136 along = dummy_long((unsigned long)f);
11137 aint = dummy_int((unsigned int)f);
11138 ashort = dummy_short((unsigned short)f);
11139 if (along != (unsigned long)123)
11140 result |= 4;
11141 if (aint != (unsigned int)123)
11142 result |= 4;
11143 if (ashort != (unsigned short)123)
11144 result |= 4;
11145 exit(result);
11146
11147}
11148EOCP
11149set try
11150if eval $compile_ok; then
5440bc8e 11151 $run ./try
b4eb6b3d
JH
11152 castflags=$?
11153else
11154 echo "(I can't seem to compile the test program--assuming it can't)"
11155 castflags=7
11156fi
11157case "$castflags" in
111580) val="$define"
11159 echo "Yup, it can."
11160 ;;
11161*) val="$undef"
11162 echo "Nope, it can't."
11163 ;;
11164esac
11165set d_castneg
11166eval $setvar
5b813a60 11167$rm_try
b4eb6b3d
JH
11168
11169: see if vprintf exists
11170echo " "
11171if set vprintf val -f d_vprintf; eval $csym; $val; then
11172 echo 'vprintf() found.' >&4
11173 val="$define"
55954f19 11174 $cat >try.c <<EOF
d0bc9cc8
AD
11175#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11176#$i_varargs I_VARARGS
11177
55954f19 11178#$i_stdlib I_STDLIB
d0bc9cc8
AD
11179#$i_unistd I_UNISTD
11180
11181#ifdef I_STDARG
11182# include <stdarg.h>
11183#else /* I_VARARGS */
11184# include <varargs.h>
11185#endif
11186
11187#ifdef I_UNISTD
11188# include <unistd.h>
11189#endif
11190
55954f19 11191#ifdef I_STDLIB
d0bc9cc8 11192# include <stdlib.h>
55954f19 11193#endif
b4eb6b3d 11194
d0bc9cc8
AD
11195#include <stdio.h> /* vsprintf prototype */
11196
11197#ifdef I_STDARG
11198void xxx(int n, ...)
11199{
11200 va_list args;
11201 char buf[10];
11202 va_start(args, n);
11203 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11204}
11205int main() { xxx(1, "foo"); }
11206
11207#else /* I_VARARGS */
b4eb6b3d
JH
11208
11209xxx(va_alist)
11210va_dcl
11211{
d0bc9cc8
AD
11212 va_list args;
11213 char buf[10];
11214 va_start(args);
11215 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 11216}
d0bc9cc8
AD
11217int main() { xxx("foo"); }
11218
11219#endif
11220
b4eb6b3d 11221EOF
5440bc8e 11222 set try
d0bc9cc8
AD
11223 if eval $compile_ok; then
11224 if $run ./try; then
11225 echo "Your vsprintf() returns (int)." >&4
11226 val2="$undef"
11227 else
11228 echo "Your vsprintf() returns (char*)." >&4
11229 val2="$define"
11230 fi
b4eb6b3d 11231 else
d0bc9cc8
AD
11232 echo 'I am unable to compile the vsprintf() test program.' >&4
11233 # We shouldn't get here. If we do, assume the standard signature,
11234 # not the old BSD one.
11235 echo 'Guessing that vsprintf() returns (int).' >&4
11236 val2="$undef"
b4eb6b3d
JH
11237 fi
11238else
11239 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
11240 val="$undef"
11241 val2="$undef"
b4eb6b3d 11242fi
5b813a60 11243$rm_try
b4eb6b3d
JH
11244set d_vprintf
11245eval $setvar
11246val=$val2
11247set d_charvspr
11248eval $setvar
11249
11250: see if chown exists
11251set chown d_chown
11252eval $inlibc
11253
11254: see if chroot exists
11255set chroot d_chroot
11256eval $inlibc
11257
11258: see if chsize exists
11259set chsize d_chsize
11260eval $inlibc
11261
758a5d79
JH
11262: see if class exists
11263set class d_class
11264eval $inlibc
11265
b0a2e8e6
MB
11266: see if clearenv exists
11267set clearenv d_clearenv
11268eval $inlibc
11269
34f1896b 11270: Define hasstruct macro for Configure internal use
4e0554ec
JH
11271hasstruct='varname=$1; struct=$2; shift; shift;
11272while $test $# -ge 2; do
11273 case "$1" in
11274 $define) echo "#include <$2>";;
11275 esac ;
11276 shift 2;
11277done > try.c;
11278echo "int main () { struct $struct foo; }" >> try.c;
11279set try;
11280if eval $compile; then
11281 val="$define";
11282else
11283 val="$undef";
11284fi;
11285set $varname;
11286eval $setvar;
5b813a60 11287$rm_try'
4e0554ec 11288
34f1896b 11289: see whether socket exists
4e0554ec
JH
11290socketlib=''
11291sockethdr=''
4e0554ec
JH
11292echo " "
11293$echo $n "Hmm... $c" >&4
11294if set socket val -f d_socket; eval $csym; $val; then
11295 echo "Looks like you have Berkeley networking support." >&4
11296 d_socket="$define"
11297 if set setsockopt val -f; eval $csym; $val; then
11298 d_oldsock="$undef"
11299 else
11300 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11301 d_oldsock="$define"
11302 fi
11303else
11304 if $contains socklib libc.list >/dev/null 2>&1; then
11305 echo "Looks like you have Berkeley networking support." >&4
11306 d_socket="$define"
11307 : we will have to assume that it supports the 4.2 BSD interface
11308 d_oldsock="$undef"
11309 else
11310 echo "You don't have Berkeley networking in libc$_a..." >&4
11311 if test "X$d_socket" = "X$define"; then
11312 echo "...but you seem to believe that you have sockets." >&4
11313 else
11314 for net in net socket
11315 do
11316 if test -f /usr/lib/lib$net$_a; then
11317 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
11318 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11319 if $contains socket libc.list >/dev/null 2>&1; then
11320 d_socket="$define"
11321 socketlib="-l$net"
11322 case "$net" in
11323 net)
11324 echo "...but the Wollongong group seems to have hacked it in." >&4
11325 sockethdr="-I/usr/netinclude"
11326 ;;
11327 esac
5b813a60 11328 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
11329 if $contains setsockopt libc.list >/dev/null 2>&1; then
11330 d_oldsock="$undef"
11331 else
11332 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11333 d_oldsock="$define"
11334 fi
11335 break
11336 fi
11337 fi
11338 done
11339 if test "X$d_socket" != "X$define"; then
11340 echo "or anywhere else I see." >&4
11341 d_socket="$undef"
11342 d_oldsock="$undef"
11343 fi
11344 fi
11345 fi
11346fi
11347
11348: see if socketpair exists
11349set socketpair d_sockpair
11350eval $inlibc
11351
11352
11353echo " "
3c728e00 11354echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11355for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11356 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11357 $cat >try.c <<EOF
11358#include <sys/types.h>
11359#include <sys/socket.h>
11360int main() {
11361 int i = $ENUM;
11362}
11363EOF
11364 val="$undef"
11365 set try; if eval $compile; then
11366 val="$define"
11367 fi
11368 set d_${enum}; eval $setvar
5b813a60 11369 $rm_try
4e0554ec
JH
11370done
11371
11372: see if this is a sys/uio.h system
11373set sys/uio.h i_sysuio
11374eval $inhdr
11375
34f1896b 11376: Check for cmsghdr support
4e0554ec
JH
11377echo " "
11378echo "Checking to see if your system supports struct cmsghdr..." >&4
11379set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11380eval $hasstruct
11381case "$d_cmsghdr_s" in
11382"$define") echo "Yes, it does." ;;
11383*) echo "No, it doesn't." ;;
11384esac
11385
11386
b4eb6b3d
JH
11387: check for const keyword
11388echo " "
11389echo 'Checking to see if your C compiler knows about "const"...' >&4
11390$cat >const.c <<'EOCP'
11391typedef struct spug { int drokk; } spug;
76f47787 11392int main()
b4eb6b3d
JH
11393{
11394 const char *foo;
666ea192 11395 const spug y = { 0 };
b4eb6b3d
JH
11396}
11397EOCP
11398if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11399 val="$define"
11400 echo "Yup, it does."
11401else
11402 val="$undef"
11403 echo "Nope, it doesn't."
11404fi
11405set d_const
11406eval $setvar
11407
89ce900e
JH
11408: see if copysignl exists
11409set copysignl d_copysignl
11410eval $inlibc
11411
b4eb6b3d
JH
11412: see if crypt exists
11413echo " "
a5a94ea5
JH
11414set crypt d_crypt
11415eval $inlibc
11416case "$d_crypt" in
11417$define) cryptlib='' ;;
11418*) if set crypt val -f d_crypt; eval $csym; $val; then
11419 echo 'crypt() found.' >&4
b4eb6b3d 11420 val="$define"
a5a94ea5
JH
11421 cryptlib=''
11422 else
11423 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11424 if $test -z "$cryptlib"; then
11425 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11426 else
11427 cryptlib=-lcrypt
11428 fi
11429 if $test -z "$cryptlib"; then
11430 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11431 else
11432 cryptlib=-lcrypt
11433 fi
11434 if $test -z "$cryptlib"; then
11435 cryptlib=`./loc libcrypt$_a "" $libpth`
11436 else
11437 cryptlib=-lcrypt
11438 fi
11439 if $test -z "$cryptlib"; then
11440 echo 'crypt() NOT found.' >&4
11441 val="$undef"
11442 else
11443 val="$define"
11444 fi
b4eb6b3d 11445 fi
a5a94ea5
JH
11446 set d_crypt
11447 eval $setvar
11448 ;;
11449esac
b4eb6b3d 11450
10bc17b6
JH
11451: see if this is a crypt.h system
11452set crypt.h i_crypt
11453eval $inhdr
11454
11455: see if crypt_r exists
11456set crypt_r d_crypt_r
11457eval $inlibc
11458case "$d_crypt_r" in
11459"$define")
11460 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11461 case "$d_crypt_r_proto:$usethreads" in
11462 ":define") d_crypt_r_proto=define
a48ec845
JH
11463 set d_crypt_r_proto crypt_r $hdrs
11464 eval $hasproto ;;
11465 *) ;;
11466 esac
11467 case "$d_crypt_r_proto" in
11468 define)
10bc17b6
JH
11469 case "$crypt_r_proto" in
11470 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
61c26d18 11471 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
10bc17b6
JH
11472 esac
11473 case "$crypt_r_proto" in
b430fd04 11474 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
61c26d18 11475 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
b430fd04
JH
11476 esac
11477 case "$crypt_r_proto" in
90e831dc 11478 ''|0) d_crypt_r=undef
10bc17b6 11479 crypt_r_proto=0
a48ec845 11480 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11481 * ) case "$crypt_r_proto" in
11482 REENTRANT_PROTO*) ;;
11483 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11484 esac
11485 echo "Prototype: $try" ;;
11486 esac
11487 ;;
c18e646a
JH
11488 *) case "$usethreads" in
11489 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11490 esac
90e831dc
SB
11491 d_crypt_r=undef
11492 crypt_r_proto=0
c18e646a 11493 ;;
a48ec845
JH
11494 esac
11495 ;;
10bc17b6
JH
11496*) crypt_r_proto=0
11497 ;;
11498esac
11499
b4eb6b3d
JH
11500: get csh whereabouts
11501case "$csh" in
11502'csh') val="$undef" ;;
11503*) val="$define" ;;
11504esac
11505set d_csh
11506eval $setvar
11507: Respect a hint or command line value for full_csh.
11508case "$full_csh" in
11509'') full_csh=$csh ;;
11510esac
11511
13cfc98d
MB
11512: see if ctermid exists
11513set ctermid d_ctermid
11514eval $inlibc
11515
10bc17b6
JH
11516: see if ctermid_r exists
11517set ctermid_r d_ctermid_r
11518eval $inlibc
11519case "$d_ctermid_r" in
11520"$define")
31ee0cb7 11521 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11522 case "$d_ctermid_r_proto:$usethreads" in
11523 ":define") d_ctermid_r_proto=define
a48ec845
JH
11524 set d_ctermid_r_proto ctermid_r $hdrs
11525 eval $hasproto ;;
11526 *) ;;
11527 esac
11528 case "$d_ctermid_r_proto" in
11529 define)
10bc17b6
JH
11530 case "$ctermid_r_proto" in
11531 ''|0) try='char* ctermid_r(char*);'
61c26d18 11532 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
10bc17b6
JH
11533 esac
11534 case "$ctermid_r_proto" in
90e831dc 11535 ''|0) d_ctermid_r=undef
10bc17b6 11536 ctermid_r_proto=0
a48ec845 11537 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11538 * ) case "$ctermid_r_proto" in
11539 REENTRANT_PROTO*) ;;
11540 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11541 esac
11542 echo "Prototype: $try" ;;
11543 esac
11544 ;;
c18e646a
JH
11545 *) case "$usethreads" in
11546 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11547 esac
90e831dc
SB
11548 d_ctermid_r=undef
11549 ctermid_r_proto=0
c18e646a 11550 ;;
a48ec845
JH
11551 esac
11552 ;;
10bc17b6
JH
11553*) ctermid_r_proto=0
11554 ;;
11555esac
11556
11557: see if ctime_r exists
11558set ctime_r d_ctime_r
11559eval $inlibc
11560case "$d_ctime_r" in
11561"$define")
d63eadf0 11562 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11563 case "$d_ctime_r_proto:$usethreads" in
11564 ":define") d_ctime_r_proto=define
a48ec845
JH
11565 set d_ctime_r_proto ctime_r $hdrs
11566 eval $hasproto ;;
11567 *) ;;
11568 esac
11569 case "$d_ctime_r_proto" in
11570 define)
10bc17b6
JH
11571 case "$ctime_r_proto" in
11572 ''|0) try='char* ctime_r(const time_t*, char*);'
61c26d18 11573 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
10bc17b6
JH
11574 esac
11575 case "$ctime_r_proto" in
11576 ''|0) try='char* ctime_r(const time_t*, char*, int);'
61c26d18 11577 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
10bc17b6
JH
11578 esac
11579 case "$ctime_r_proto" in
11580 ''|0) try='int ctime_r(const time_t*, char*);'
61c26d18 11581 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
10bc17b6
JH
11582 esac
11583 case "$ctime_r_proto" in
11584 ''|0) try='int ctime_r(const time_t*, char*, int);'
61c26d18 11585 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
10bc17b6
JH
11586 esac
11587 case "$ctime_r_proto" in
90e831dc 11588 ''|0) d_ctime_r=undef
10bc17b6 11589 ctime_r_proto=0
a48ec845 11590 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11591 * ) case "$ctime_r_proto" in
11592 REENTRANT_PROTO*) ;;
11593 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11594 esac
11595 echo "Prototype: $try" ;;
11596 esac
11597 ;;
c18e646a
JH
11598 *) case "$usethreads" in
11599 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11600 esac
90e831dc
SB
11601 d_ctime_r=undef
11602 ctime_r_proto=0
c18e646a 11603 ;;
a48ec845
JH
11604 esac
11605 ;;
10bc17b6
JH
11606*) ctime_r_proto=0
11607 ;;
11608esac
11609
b4eb6b3d
JH
11610: see if cuserid exists
11611set cuserid d_cuserid
11612eval $inlibc
11613
11614: see if this is a limits.h system
11615set limits.h i_limits
11616eval $inhdr
11617
11618: see if this is a float.h system
11619set float.h i_float
11620eval $inhdr
11621
11622: See if number of significant digits in a double precision number is known
11623echo " "
11624$cat >dbl_dig.c <<EOM
11625#$i_limits I_LIMITS
11626#$i_float I_FLOAT
11627#ifdef I_LIMITS
11628#include <limits.h>
11629#endif
11630#ifdef I_FLOAT
11631#include <float.h>
11632#endif
11633#ifdef DBL_DIG
11634printf("Contains DBL_DIG");
11635#endif
11636EOM
11637$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11638if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11639 echo "DBL_DIG found." >&4
11640 val="$define"
11641else
11642 echo "DBL_DIG NOT found." >&4
11643 val="$undef"
11644fi
11645$rm -f dbl_dig.?
11646set d_dbl_dig
11647eval $setvar
11648
2ef53570
JH
11649: see if dbm.h is available
11650: see if dbmclose exists
11651set dbmclose d_dbmclose
11652eval $inlibc
11653
11654case "$d_dbmclose" in
11655$define)
11656 set dbm.h i_dbm
11657 eval $inhdr
11658 case "$i_dbm" in
11659 $define)
11660 val="$undef"
11661 set i_rpcsvcdbm
11662 eval $setvar
11663 ;;
11664 *) set rpcsvc/dbm.h i_rpcsvcdbm
11665 eval $inhdr
11666 ;;
11667 esac
11668 ;;
11669*) echo "We won't be including <dbm.h>"
11670 val="$undef"
11671 set i_dbm
11672 eval $setvar
11673 val="$undef"
11674 set i_rpcsvcdbm
11675 eval $setvar
11676 ;;
11677esac
11678
11679: see if prototype for dbminit is available
11680echo " "
11681set d_dbminitproto dbminit $i_dbm dbm.h
11682eval $hasproto
11683
b4eb6b3d
JH
11684: see if difftime exists
11685set difftime d_difftime
11686eval $inlibc
11687
11688: see if this is a dirent system
11689echo " "
11690if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11691 val="$define"
11692 echo "<dirent.h> found." >&4
11693else
11694 val="$undef"
11695 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11696 echo "<sys/dir.h> found." >&4
11697 echo " "
11698 else
11699 xinc=`./findhdr sys/ndir.h`
11700 fi
11701 echo "<dirent.h> NOT found." >&4
11702fi
11703set i_dirent
11704eval $setvar
11705
11706: Look for type of directory structure.
11707echo " "
11708$cppstdin $cppflags $cppminus < "$xinc" > try.c
11709
11710case "$direntrytype" in
11711''|' ')
11712 case "$i_dirent" in
11713 $define) guess1='struct dirent' ;;
11714 *) guess1='struct direct' ;;
11715 esac
11716 ;;
11717*) guess1="$direntrytype"
11718 ;;
11719esac
11720
11721case "$guess1" in
11722'struct dirent') guess2='struct direct' ;;
11723*) guess2='struct dirent' ;;
11724esac
5b813a60 11725
b4eb6b3d
JH
11726if $contains "$guess1" try.c >/dev/null 2>&1; then
11727 direntrytype="$guess1"
11728 echo "Your directory entries are $direntrytype." >&4
11729elif $contains "$guess2" try.c >/dev/null 2>&1; then
11730 direntrytype="$guess2"
11731 echo "Your directory entries seem to be $direntrytype." >&4
11732else
11733 echo "I don't recognize your system's directory entries." >&4
11734 rp="What type is used for directory entries on this system?"
11735 dflt="$guess1"
11736 . ./myread
11737 direntrytype="$ans"
11738fi
5b813a60 11739$rm_try
b4eb6b3d
JH
11740
11741: see if the directory entry stores field length
11742echo " "
11743$cppstdin $cppflags $cppminus < "$xinc" > try.c
11744if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11745 echo "Good, your directory entry keeps length information in d_namlen." >&4
11746 val="$define"
11747else
11748 echo "Your directory entry does not know about the d_namlen field." >&4
11749 val="$undef"
11750fi
11751set d_dirnamlen
11752eval $setvar
5b813a60 11753$rm_try
b4eb6b3d 11754
de52168c
SP
11755: Look for DIR.dd_fd
11756case "$i_dirent" in
11757"$define")
11758 echo "Checking to see if DIR has a dd_fd member variable" >&4
11759 $cat >try.c <<EOCP
11760#$i_stdlib I_STDLIB
11761#ifdef I_STDLIB
11762#include <stdlib.h>
11763#endif
11764#include <dirent.h>
11765
11766int main() {
11767 DIR dir;
11768 dir.dd_fd = 1;
11769 return 0;
11770}
11771EOCP
11772 val=$undef
11773 set try
11774 if eval $compile; then
11775 echo "Yes, it does."
11776 val="$define"
11777 else
11778 echo "No, it does not."
11779 val="$undef"
11780 fi
11781 ;;
11782*)
11783 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11784 val="$undef"
11785 ;;
11786esac
11787set d_dir_dd_fd
11788eval $setvar
5b813a60 11789$rm_try
de52168c 11790
ae0e3d3b
JH
11791: see if this is an sysdir system
11792set sys/dir.h i_sysdir
11793eval $inhdr
11794
11795: see if this is an sysndir system
11796set sys/ndir.h i_sysndir
11797eval $inhdr
11798
11799: Look for dirfd
11800echo " "
11801$cat >dirfd.c <<EOM
11802#include <stdio.h>
55954f19
JH
11803#$i_stdlib I_STDLIB
11804#ifdef I_STDLIB
11805#include <stdlib.h>
11806#endif
ae0e3d3b
JH
11807#$i_dirent I_DIRENT /**/
11808#$i_sysdir I_SYS_DIR /**/
11809#$i_sysndir I_SYS_NDIR /**/
11810#$i_systypes I_SYS_TYPES /**/
11811#if defined(I_SYS_TYPES)
11812#include <sys/types.h>
11813#endif
11814#if defined(I_DIRENT)
11815#include <dirent.h>
11816#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11817#include <sys/dir.h>
11818#endif
11819#else
11820#ifdef I_SYS_NDIR
11821#include <sys/ndir.h>
11822#else
11823#ifdef I_SYS_DIR
11824#ifdef hp9000s500
11825#include <ndir.h> /* may be wrong in the future */
11826#else
11827#include <sys/dir.h>
11828#endif
11829#endif
11830#endif
11831#endif
11832int main() {
11833 DIR *dirp = opendir(".");
11834 if (dirfd(dirp) >= 0)
11835 exit(0);
11836 else
11837 exit(1);
11838}
11839EOM
5cadb3f3 11840val=$undef
ae0e3d3b
JH
11841set dirfd
11842if eval $compile; then
11843 val="$define"
11844fi
11845case "$val" in
11846$define) echo "dirfd() found." >&4 ;;
11847*) echo "dirfd() NOT found." >&4 ;;
11848esac
11849set d_dirfd
11850eval $setvar
11851$rm -f dirfd*
11852
b4eb6b3d
JH
11853: see if dlerror exists
11854xxx_runnm="$runnm"
11855runnm=false
11856set dlerror d_dlerror
11857eval $inlibc
11858runnm="$xxx_runnm"
11859
11860: see if dlfcn is available
11861set dlfcn.h i_dlfcn
11862eval $inhdr
11863
34f1896b 11864: Check what extension to use for shared libs
b4eb6b3d
JH
11865case "$usedl" in
11866$define|y|true)
11867 $cat << EOM
11868
11869On a few systems, the dynamically loaded modules that perl generates and uses
11870will need a different extension than shared libs. The default will probably
11871be appropriate.
11872
11873EOM
11874 case "$dlext" in
11875 '') dflt="$so" ;;
11876 *) dflt="$dlext" ;;
11877 esac
11878 rp='What is the extension of dynamically loaded modules'
11879 . ./myread
11880 dlext="$ans"
11881 ;;
11882*)
11883 dlext="none"
11884 ;;
11885esac
11886
11887: Check if dlsym need a leading underscore
11888echo " "
11889val="$undef"
11890
11891case "$dlsrc" in
11892dl_dlopen.xs)
11893 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11894 $cat >dyna.c <<'EOM'
11895fred () { }
11896EOM
11897
11898$cat >fred.c<<EOM
11899
11900#include <stdio.h>
55954f19
JH
11901#$i_stdlib I_STDLIB
11902#ifdef I_STDLIB
11903#include <stdlib.h>
11904#endif
b4eb6b3d
JH
11905#$i_dlfcn I_DLFCN
11906#ifdef I_DLFCN
5440bc8e 11907#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11908#else
11909#include <sys/types.h>
11910#include <nlist.h>
11911#include <link.h>
11912#endif
11913
11914extern int fred() ;
11915
11916int main()
11917{
11918 void * handle ;
11919 void * symbol ;
11920#ifndef RTLD_LAZY
11921 int mode = 1 ;
11922#else
11923 int mode = RTLD_LAZY ;
11924#endif
11925 handle = dlopen("./dyna.$dlext", mode) ;
11926 if (handle == NULL) {
11927 printf ("1\n") ;
11928 fflush (stdout) ;
11929 exit(0);
11930 }
11931 symbol = dlsym(handle, "fred") ;
11932 if (symbol == NULL) {
11933 /* try putting a leading underscore */
11934 symbol = dlsym(handle, "_fred") ;
11935 if (symbol == NULL) {
11936 printf ("2\n") ;
11937 fflush (stdout) ;
11938 exit(0);
11939 }
11940 printf ("3\n") ;
11941 }
11942 else
11943 printf ("4\n") ;
11944 fflush (stdout) ;
11945 exit(0);
11946}
11947EOM
11948 : Call the object file tmp-dyna.o in case dlext=o.
613d6c3e
MB
11949 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11950 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11951 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11952 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11953 xxx=`$run ./fred`
b4eb6b3d
JH
11954 case $xxx in
11955 1) echo "Test program failed using dlopen." >&4
11956 echo "Perhaps you should not use dynamic loading." >&4;;
11957 2) echo "Test program failed using dlsym." >&4
11958 echo "Perhaps you should not use dynamic loading." >&4;;
11959 3) echo "dlsym needs a leading underscore" >&4
11960 val="$define" ;;
11961 4) echo "dlsym doesn't need a leading underscore." >&4;;
11962 esac
11963 else
11964 echo "I can't compile and run the test program." >&4
11965 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11966 fi
11967 ;;
11968esac
613d6c3e 11969
3c728e00 11970$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11971
11972set d_dlsymun
11973eval $setvar
11974
10bc17b6
JH
11975: see if drand48_r exists
11976set drand48_r d_drand48_r
11977eval $inlibc
11978case "$d_drand48_r" in
11979"$define")
11980 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11981 case "$d_drand48_r_proto:$usethreads" in
11982 ":define") d_drand48_r_proto=define
a48ec845
JH
11983 set d_drand48_r_proto drand48_r $hdrs
11984 eval $hasproto ;;
11985 *) ;;
11986 esac
11987 case "$d_drand48_r_proto" in
11988 define)
10bc17b6
JH
11989 case "$drand48_r_proto" in
11990 ''|0) try='int drand48_r(struct drand48_data*, double*);'
61c26d18 11991 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
10bc17b6
JH
11992 esac
11993 case "$drand48_r_proto" in
90e831dc 11994 ''|0) d_drand48_r=undef
10bc17b6 11995 drand48_r_proto=0
a48ec845 11996 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11997 * ) case "$drand48_r_proto" in
11998 REENTRANT_PROTO*) ;;
11999 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12000 esac
12001 echo "Prototype: $try" ;;
12002 esac
12003 ;;
c18e646a
JH
12004 *) case "$usethreads" in
12005 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12006 esac
90e831dc
SB
12007 d_drand48_r=undef
12008 drand48_r_proto=0
c18e646a 12009 ;;
a48ec845
JH
12010 esac
12011 ;;
10bc17b6
JH
12012*) drand48_r_proto=0
12013 ;;
12014esac
12015
12016: see if prototype for drand48 is available
12017echo " "
12018set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12019eval $hasproto
12020
b4eb6b3d
JH
12021: see if dup2 exists
12022set dup2 d_dup2
12023eval $inlibc
12024
12025: see if eaccess exists
12026set eaccess d_eaccess
12027eval $inlibc
12028
12029: see if endgrent exists
12030set endgrent d_endgrent
12031eval $inlibc
12032
10bc17b6
JH
12033: see if this is an grp system
12034set grp.h i_grp
12035eval $inhdr
12036
12037case "$i_grp" in
12038$define)
12039 xxx=`./findhdr grp.h`
12040 $cppstdin $cppflags $cppminus < $xxx >$$.h
12041
12042 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12043 val="$define"
12044 else
12045 val="$undef"
12046 fi
12047 set d_grpasswd
12048 eval $setvar
12049
12050 $rm -f $$.h
12051 ;;
12052*)
12053 val="$undef";
12054 set d_grpasswd; eval $setvar
12055 ;;
12056esac
12057
12058: see if endgrent_r exists
12059set endgrent_r d_endgrent_r
12060eval $inlibc
12061case "$d_endgrent_r" in
12062"$define")
12063 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12064 case "$d_endgrent_r_proto:$usethreads" in
12065 ":define") d_endgrent_r_proto=define
a48ec845
JH
12066 set d_endgrent_r_proto endgrent_r $hdrs
12067 eval $hasproto ;;
12068 *) ;;
12069 esac
12070 case "$d_endgrent_r_proto" in
12071 define)
10bc17b6
JH
12072 case "$endgrent_r_proto" in
12073 ''|0) try='int endgrent_r(FILE**);'
61c26d18 12074 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
10bc17b6
JH
12075 esac
12076 case "$endgrent_r_proto" in
12077 ''|0) try='void endgrent_r(FILE**);'
61c26d18 12078 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
10bc17b6
JH
12079 esac
12080 case "$endgrent_r_proto" in
90e831dc 12081 ''|0) d_endgrent_r=undef
10bc17b6 12082 endgrent_r_proto=0
a48ec845 12083 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12084 * ) case "$endgrent_r_proto" in
12085 REENTRANT_PROTO*) ;;
12086 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12087 esac
12088 echo "Prototype: $try" ;;
12089 esac
12090 ;;
c18e646a
JH
12091 *) case "$usethreads" in
12092 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12093 esac
90e831dc
SB
12094 d_endgrent_r=undef
12095 endgrent_r_proto=0
c18e646a 12096 ;;
a48ec845
JH
12097 esac
12098 ;;
10bc17b6
JH
12099*) endgrent_r_proto=0
12100 ;;
12101esac
12102
b4eb6b3d
JH
12103: see if endhostent exists
12104set endhostent d_endhent
12105eval $inlibc
12106
10bc17b6
JH
12107: see if this is a netdb.h system
12108set netdb.h i_netdb
12109eval $inhdr
12110
12111: see if endhostent_r exists
12112set endhostent_r d_endhostent_r
12113eval $inlibc
12114case "$d_endhostent_r" in
12115"$define")
12116 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12117 case "$d_endhostent_r_proto:$usethreads" in
12118 ":define") d_endhostent_r_proto=define
a48ec845
JH
12119 set d_endhostent_r_proto endhostent_r $hdrs
12120 eval $hasproto ;;
12121 *) ;;
12122 esac
12123 case "$d_endhostent_r_proto" in
12124 define)
10bc17b6
JH
12125 case "$endhostent_r_proto" in
12126 ''|0) try='int endhostent_r(struct hostent_data*);'
61c26d18 12127 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
12128 esac
12129 case "$endhostent_r_proto" in
12130 ''|0) try='void endhostent_r(struct hostent_data*);'
61c26d18 12131 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
12132 esac
12133 case "$endhostent_r_proto" in
90e831dc 12134 ''|0) d_endhostent_r=undef
10bc17b6 12135 endhostent_r_proto=0
a48ec845 12136 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12137 * ) case "$endhostent_r_proto" in
12138 REENTRANT_PROTO*) ;;
12139 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12140 esac
12141 echo "Prototype: $try" ;;
12142 esac
12143 ;;
c18e646a
JH
12144 *) case "$usethreads" in
12145 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12146 esac
90e831dc
SB
12147 d_endhostent_r=undef
12148 endhostent_r_proto=0
c18e646a 12149 ;;
a48ec845
JH
12150 esac
12151 ;;
10bc17b6
JH
12152*) endhostent_r_proto=0
12153 ;;
12154esac
12155
b4eb6b3d
JH
12156: see if endnetent exists
12157set endnetent d_endnent
12158eval $inlibc
12159
10bc17b6
JH
12160: see if endnetent_r exists
12161set endnetent_r d_endnetent_r
12162eval $inlibc
12163case "$d_endnetent_r" in
12164"$define")
12165 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12166 case "$d_endnetent_r_proto:$usethreads" in
12167 ":define") d_endnetent_r_proto=define
a48ec845
JH
12168 set d_endnetent_r_proto endnetent_r $hdrs
12169 eval $hasproto ;;
12170 *) ;;
12171 esac
12172 case "$d_endnetent_r_proto" in
12173 define)
10bc17b6
JH
12174 case "$endnetent_r_proto" in
12175 ''|0) try='int endnetent_r(struct netent_data*);'
61c26d18 12176 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
12177 esac
12178 case "$endnetent_r_proto" in
12179 ''|0) try='void endnetent_r(struct netent_data*);'
61c26d18 12180 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
12181 esac
12182 case "$endnetent_r_proto" in
90e831dc 12183 ''|0) d_endnetent_r=undef
10bc17b6 12184 endnetent_r_proto=0
a48ec845 12185 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12186 * ) case "$endnetent_r_proto" in
12187 REENTRANT_PROTO*) ;;
12188 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12189 esac
12190 echo "Prototype: $try" ;;
12191 esac
12192 ;;
c18e646a
JH
12193 *) case "$usethreads" in
12194 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12195 esac
90e831dc
SB
12196 d_endnetent_r=undef
12197 endnetent_r_proto=0
c18e646a 12198 ;;
a48ec845
JH
12199 esac
12200 ;;
10bc17b6
JH
12201*) endnetent_r_proto=0
12202 ;;
12203esac
12204
b4eb6b3d
JH
12205: see if endprotoent exists
12206set endprotoent d_endpent
12207eval $inlibc
12208
10bc17b6
JH
12209: see if endprotoent_r exists
12210set endprotoent_r d_endprotoent_r
12211eval $inlibc
12212case "$d_endprotoent_r" in
12213"$define")
12214 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12215 case "$d_endprotoent_r_proto:$usethreads" in
12216 ":define") d_endprotoent_r_proto=define
a48ec845
JH
12217 set d_endprotoent_r_proto endprotoent_r $hdrs
12218 eval $hasproto ;;
12219 *) ;;
12220 esac
12221 case "$d_endprotoent_r_proto" in
12222 define)
10bc17b6
JH
12223 case "$endprotoent_r_proto" in
12224 ''|0) try='int endprotoent_r(struct protoent_data*);'
61c26d18 12225 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
12226 esac
12227 case "$endprotoent_r_proto" in
12228 ''|0) try='void endprotoent_r(struct protoent_data*);'
61c26d18 12229 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
12230 esac
12231 case "$endprotoent_r_proto" in
90e831dc 12232 ''|0) d_endprotoent_r=undef
10bc17b6 12233 endprotoent_r_proto=0
a48ec845 12234 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12235 * ) case "$endprotoent_r_proto" in
12236 REENTRANT_PROTO*) ;;
12237 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12238 esac
12239 echo "Prototype: $try" ;;
12240 esac
12241 ;;
c18e646a
JH
12242 *) case "$usethreads" in
12243 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12244 esac
90e831dc
SB
12245 d_endprotoent_r=undef
12246 endprotoent_r_proto=0
c18e646a 12247 ;;
a48ec845
JH
12248 esac
12249 ;;
10bc17b6
JH
12250*) endprotoent_r_proto=0
12251 ;;
12252esac
12253
b4eb6b3d
JH
12254: see if endpwent exists
12255set endpwent d_endpwent
12256eval $inlibc
12257
10bc17b6
JH
12258: see if this is a pwd.h system
12259set pwd.h i_pwd
12260eval $inhdr
12261
12262case "$i_pwd" in
12263$define)
12264 xxx=`./findhdr pwd.h`
12265 $cppstdin $cppflags $cppminus < $xxx >$$.h
12266
12267 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12268 val="$define"
12269 else
12270 val="$undef"
12271 fi
12272 set d_pwquota
12273 eval $setvar
12274
12275 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12276 val="$define"
12277 else
12278 val="$undef"
12279 fi
12280 set d_pwage
12281 eval $setvar
12282
12283 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12284 val="$define"
12285 else
12286 val="$undef"
12287 fi
12288 set d_pwchange
12289 eval $setvar
12290
12291 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12292 val="$define"
12293 else
12294 val="$undef"
12295 fi
12296 set d_pwclass
12297 eval $setvar
12298
12299 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12300 val="$define"
12301 else
12302 val="$undef"
12303 fi
12304 set d_pwexpire
12305 eval $setvar
12306
12307 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12308 val="$define"
12309 else
12310 val="$undef"
12311 fi
12312 set d_pwcomment
12313 eval $setvar
12314
12315 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12316 val="$define"
12317 else
12318 val="$undef"
12319 fi
12320 set d_pwgecos
12321 eval $setvar
12322
12323 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12324 val="$define"
12325 else
12326 val="$undef"
12327 fi
12328 set d_pwpasswd
12329 eval $setvar
12330
12331 $rm -f $$.h
12332 ;;
12333*)
12334 val="$undef";
12335 set d_pwquota; eval $setvar
12336 set d_pwage; eval $setvar
12337 set d_pwchange; eval $setvar
12338 set d_pwclass; eval $setvar
12339 set d_pwexpire; eval $setvar
12340 set d_pwcomment; eval $setvar
12341 set d_pwgecos; eval $setvar
12342 set d_pwpasswd; eval $setvar
12343 ;;
12344esac
12345
12346: see if endpwent_r exists
12347set endpwent_r d_endpwent_r
12348eval $inlibc
12349case "$d_endpwent_r" in
12350"$define")
12351 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12352 case "$d_endpwent_r_proto:$usethreads" in
12353 ":define") d_endpwent_r_proto=define
a48ec845
JH
12354 set d_endpwent_r_proto endpwent_r $hdrs
12355 eval $hasproto ;;
12356 *) ;;
12357 esac
12358 case "$d_endpwent_r_proto" in
12359 define)
10bc17b6
JH
12360 case "$endpwent_r_proto" in
12361 ''|0) try='int endpwent_r(FILE**);'
61c26d18 12362 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
10bc17b6
JH
12363 esac
12364 case "$endpwent_r_proto" in
12365 ''|0) try='void endpwent_r(FILE**);'
61c26d18 12366 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
10bc17b6
JH
12367 esac
12368 case "$endpwent_r_proto" in
90e831dc 12369 ''|0) d_endpwent_r=undef
10bc17b6 12370 endpwent_r_proto=0
a48ec845 12371 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12372 * ) case "$endpwent_r_proto" in
12373 REENTRANT_PROTO*) ;;
12374 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12375 esac
12376 echo "Prototype: $try" ;;
12377 esac
12378 ;;
c18e646a
JH
12379 *) case "$usethreads" in
12380 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12381 esac
90e831dc
SB
12382 d_endpwent_r=undef
12383 endpwent_r_proto=0
c18e646a 12384 ;;
a48ec845
JH
12385 esac
12386 ;;
10bc17b6
JH
12387*) endpwent_r_proto=0
12388 ;;
12389esac
12390
b4eb6b3d
JH
12391: see if endservent exists
12392set endservent d_endsent
12393eval $inlibc
12394
10bc17b6
JH
12395: see if endservent_r exists
12396set endservent_r d_endservent_r
12397eval $inlibc
12398case "$d_endservent_r" in
12399"$define")
12400 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12401 case "$d_endservent_r_proto:$usethreads" in
12402 ":define") d_endservent_r_proto=define
a48ec845
JH
12403 set d_endservent_r_proto endservent_r $hdrs
12404 eval $hasproto ;;
12405 *) ;;
12406 esac
12407 case "$d_endservent_r_proto" in
12408 define)
10bc17b6
JH
12409 case "$endservent_r_proto" in
12410 ''|0) try='int endservent_r(struct servent_data*);'
61c26d18 12411 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12412 esac
12413 case "$endservent_r_proto" in
12414 ''|0) try='void endservent_r(struct servent_data*);'
61c26d18 12415 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12416 esac
12417 case "$endservent_r_proto" in
90e831dc 12418 ''|0) d_endservent_r=undef
10bc17b6 12419 endservent_r_proto=0
a48ec845 12420 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12421 * ) case "$endservent_r_proto" in
12422 REENTRANT_PROTO*) ;;
12423 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12424 esac
12425 echo "Prototype: $try" ;;
12426 esac
12427 ;;
c18e646a
JH
12428 *) case "$usethreads" in
12429 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12430 esac
90e831dc
SB
12431 d_endservent_r=undef
12432 endservent_r_proto=0
c18e646a 12433 ;;
a48ec845
JH
12434 esac
12435 ;;
10bc17b6
JH
12436*) endservent_r_proto=0
12437 ;;
12438esac
12439
b4eb6b3d
JH
12440: Locate the flags for 'open()'
12441echo " "
55954f19 12442$cat >try.c <<EOCP
b4eb6b3d
JH
12443#include <sys/types.h>
12444#ifdef I_FCNTL
12445#include <fcntl.h>
12446#endif
12447#ifdef I_SYS_FILE
12448#include <sys/file.h>
12449#endif
55954f19
JH
12450#$i_stdlib I_STDLIB
12451#ifdef I_STDLIB
12452#include <stdlib.h>
12453#endif
b4eb6b3d
JH
12454int main() {
12455 if(O_RDONLY);
12456#ifdef O_TRUNC
12457 exit(0);
12458#else
12459 exit(1);
12460#endif
12461}
12462EOCP
12463: check sys/file.h first to get FREAD on Sun
12464if $test `./findhdr sys/file.h` && \
5440bc8e 12465 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12466 h_sysfile=true;
12467 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12468 if $run ./try; then
b4eb6b3d
JH
12469 echo "and you have the 3 argument form of open()." >&4
12470 val="$define"
12471 else
12472 echo "but not the 3 argument form of open(). Oh, well." >&4
12473 val="$undef"
12474 fi
12475elif $test `./findhdr fcntl.h` && \
5440bc8e 12476 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12477 h_fcntl=true;
12478 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12479 if $run ./try; then
b4eb6b3d
JH
12480 echo "and you have the 3 argument form of open()." >&4
12481 val="$define"
12482 else
12483 echo "but not the 3 argument form of open(). Oh, well." >&4
12484 val="$undef"
12485 fi
12486else
12487 val="$undef"
12488 echo "I can't find the O_* constant definitions! You got problems." >&4
12489fi
12490set d_open3
12491eval $setvar
5b813a60 12492$rm_try
b4eb6b3d 12493
3c728e00
JH
12494: see if this is a sys/file.h system
12495val=''
12496set sys/file.h val
12497eval $inhdr
12498
12499: do we need to include sys/file.h ?
12500case "$val" in
12501"$define")
12502 echo " "
12503 if $h_sysfile; then
12504 val="$define"
12505 echo "We'll be including <sys/file.h>." >&4
12506 else
12507 val="$undef"
12508 echo "We won't be including <sys/file.h>." >&4
12509 fi
12510 ;;
12511*)
12512 h_sysfile=false
12513 ;;
12514esac
12515set i_sysfile
12516eval $setvar
12517
12518: see if fcntl.h is there
12519val=''
12520set fcntl.h val
12521eval $inhdr
12522
12523: see if we can include fcntl.h
12524case "$val" in
12525"$define")
12526 echo " "
12527 if $h_fcntl; then
12528 val="$define"
12529 echo "We'll be including <fcntl.h>." >&4
12530 else
12531 val="$undef"
12532 if $h_sysfile; then
12533 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12534 else
12535 echo "We won't be including <fcntl.h>." >&4
12536 fi
12537 fi
12538 ;;
12539*)
12540 h_fcntl=false
12541 val="$undef"
12542 ;;
12543esac
12544set i_fcntl
12545eval $setvar
12546
4dd8f9b3
JH
12547: see if fork exists
12548set fork d_fork
12549eval $inlibc
12550
12551: see if pipe exists
12552set pipe d_pipe
12553eval $inlibc
12554
b4eb6b3d
JH
12555: check for non-blocking I/O stuff
12556case "$h_sysfile" in
a0acbdc3
JH
12557true) echo "#include <sys/file.h>" > head.c;;
12558*)
12559 case "$h_fcntl" in
12560 true) echo "#include <fcntl.h>" > head.c;;
12561 *) echo "#include <sys/fcntl.h>" > head.c;;
12562 esac
12563 ;;
b4eb6b3d
JH
12564esac
12565echo " "
12566echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12567case "$o_nonblock" in
12568'')
12569 $cat head.c > try.c
3c728e00 12570 $cat >>try.c <<EOCP
b4eb6b3d 12571#include <stdio.h>
55954f19
JH
12572#$i_stdlib I_STDLIB
12573#ifdef I_STDLIB
80b3ef99 12574#include <stdlib.h>
55954f19 12575#endif
3c728e00
JH
12576#$i_fcntl I_FCNTL
12577#ifdef I_FCNTL
12578#include <fcntl.h>
12579#endif
b4eb6b3d
JH
12580int main() {
12581#ifdef O_NONBLOCK
12582 printf("O_NONBLOCK\n");
12583 exit(0);
12584#endif
12585#ifdef O_NDELAY
12586 printf("O_NDELAY\n");
12587 exit(0);
12588#endif
12589#ifdef FNDELAY
12590 printf("FNDELAY\n");
12591 exit(0);
12592#endif
12593 exit(0);
12594}
12595EOCP
12596 set try
12597 if eval $compile_ok; then
5440bc8e 12598 o_nonblock=`$run ./try`
b4eb6b3d
JH
12599 case "$o_nonblock" in
12600 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12601 *) echo "Seems like we can use $o_nonblock.";;
12602 esac
12603 else
12604 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12605 fi
12606 ;;
12607*) echo "Using $hint value $o_nonblock.";;
12608esac
5b813a60 12609$rm_try
b4eb6b3d
JH
12610
12611echo " "
12612echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12613case "$eagain" in
12614'')
4dd8f9b3
JH
12615 case "$d_fork:$d_pipe" in
12616 define:define)
b4eb6b3d
JH
12617 $cat head.c > try.c
12618 $cat >>try.c <<EOCP
12619#include <errno.h>
12620#include <sys/types.h>
12621#include <signal.h>
5b813a60 12622#include <stdio.h>
55954f19
JH
12623#$i_stdlib I_STDLIB
12624#ifdef I_STDLIB
12625#include <stdlib.h>
12626#endif
1deb0a86
JH
12627#$i_fcntl I_FCNTL
12628#ifdef I_FCNTL
12629#include <fcntl.h>
12630#endif
b4eb6b3d
JH
12631#define MY_O_NONBLOCK $o_nonblock
12632#ifndef errno /* XXX need better Configure test */
12633extern int errno;
12634#endif
12635#$i_unistd I_UNISTD
12636#ifdef I_UNISTD
12637#include <unistd.h>
12638#endif
12639#$i_string I_STRING
12640#ifdef I_STRING
12641#include <string.h>
12642#else
12643#include <strings.h>
12644#endif
7090f861 12645$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12646EOCP
12647 $cat >> try.c <<'EOCP'
12648int main()
12649{
12650 int pd[2];
12651 int pu[2];
12652 char buf[1];
12653 char string[100];
12654
12655 pipe(pd); /* Down: child -> parent */
12656 pipe(pu); /* Up: parent -> child */
12657 if (0 != fork()) {
12658 int ret;
12659 close(pd[1]); /* Parent reads from pd[0] */
12660 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12661#ifdef F_SETFL
b4eb6b3d
JH
12662 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12663 exit(1);
a0acbdc3
JH
12664#else
12665 exit(4);
12666#endif
b4eb6b3d
JH
12667 signal(SIGALRM, blech);
12668 alarm(5);
12669 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12670 exit(2);
12671 sprintf(string, "%d\n", ret);
12672 write(2, string, strlen(string));
12673 alarm(0);
12674#ifdef EAGAIN
12675 if (errno == EAGAIN) {
12676 printf("EAGAIN\n");
12677 goto ok;
12678 }
12679#endif
12680#ifdef EWOULDBLOCK
12681 if (errno == EWOULDBLOCK)
12682 printf("EWOULDBLOCK\n");
12683#endif
12684 ok:
12685 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12686 sleep(2); /* Give it time to close our pipe */
12687 alarm(5);
12688 ret = read(pd[0], buf, 1); /* Should read EOF */
12689 alarm(0);
12690 sprintf(string, "%d\n", ret);
868439a2 12691 write(4, string, strlen(string));
b4eb6b3d
JH
12692 exit(0);
12693 }
12694
12695 close(pd[0]); /* We write to pd[1] */
12696 close(pu[1]); /* We read from pu[0] */
12697 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12698 close(pd[1]); /* Pipe pd is now fully closed! */
12699 exit(0); /* Bye bye, thank you for playing! */
12700}
12701EOCP
12702 set try
12703 if eval $compile_ok; then
12704 echo "$startsh" >mtry
868439a2 12705 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12706 chmod +x mtry
12707 ./mtry >/dev/null 2>&1
12708 case $? in
12709 0) eagain=`$cat try.out`;;
12710 1) echo "Could not perform non-blocking setting!";;
12711 2) echo "I did a successful read() for something that was not there!";;
12712 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12713 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12714 *) echo "Something terribly wrong happened during testing.";;
12715 esac
12716 rd_nodata=`$cat try.ret`
12717 echo "A read() system call with no data present returns $rd_nodata."
12718 case "$rd_nodata" in
12719 0|-1) ;;
12720 *)
12721 echo "(That's peculiar, fixing that to be -1.)"
12722 rd_nodata=-1
12723 ;;
12724 esac
12725 case "$eagain" in
12726 '')
12727 echo "Forcing errno EAGAIN on read() with no data available."
12728 eagain=EAGAIN
12729 ;;
12730 *)
12731 echo "Your read() sets errno to $eagain when no data is available."
12732 ;;
12733 esac
12734 status=`$cat try.err`
12735 case "$status" in
12736 0) echo "And it correctly returns 0 to signal EOF.";;
12737 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12738 *) echo "However, your read() returns '$status' on EOF??";;
12739 esac
12740 val="$define"
12741 if test "$status" = "$rd_nodata"; then
12742 echo "WARNING: you can't distinguish between EOF and no data!"
12743 val="$undef"
12744 fi
12745 else
12746 echo "I can't compile the test program--assuming errno EAGAIN will do."
12747 eagain=EAGAIN
12748 fi
4dd8f9b3
JH
12749 ;;
12750 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12751 eagain=EAGAIN
12752 val="$define"
12753 ;;
12754 esac
b4eb6b3d
JH
12755 set d_eofnblk
12756 eval $setvar
12757 ;;
12758*)
12759 echo "Using $hint value $eagain."
12760 echo "Your read() returns $rd_nodata when no data is present."
12761 case "$d_eofnblk" in
12762 "$define") echo "And you can see EOF because read() returns 0.";;
12763 "$undef") echo "But you can't see EOF status from read() returned value.";;
12764 *)
12765 echo "(Assuming you can't see EOF status from read anyway.)"
12766 d_eofnblk=$undef
12767 ;;
12768 esac
12769 ;;
12770esac
5b813a60 12771$rm_try head.c mtry
b4eb6b3d 12772
15b61c98
JH
12773: see if _ptr and _cnt from stdio act std
12774echo " "
b4eb6b3d 12775
15b61c98
JH
12776if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12777 echo "(Looks like you have stdio.h from BSD.)"
12778 case "$stdio_ptr" in
12779 '') stdio_ptr='((fp)->_p)'
12780 ptr_lval=$define
12781 ;;
12782 *) ptr_lval=$d_stdio_ptr_lval;;
12783 esac
12784 case "$stdio_cnt" in
12785 '') stdio_cnt='((fp)->_r)'
12786 cnt_lval=$define
12787 ;;
12788 *) cnt_lval=$d_stdio_cnt_lval;;
12789 esac
12790 case "$stdio_base" in
12791 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12792 esac
12793 case "$stdio_bufsiz" in
12794 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12795 esac
12796elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12797 echo "(Looks like you have stdio.h from Linux.)"
12798 case "$stdio_ptr" in
12799 '') stdio_ptr='((fp)->_IO_read_ptr)'
12800 ptr_lval=$define
12801 ;;
12802 *) ptr_lval=$d_stdio_ptr_lval;;
12803 esac
12804 case "$stdio_cnt" in
12805 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12806 cnt_lval=$undef
12807 ;;
12808 *) cnt_lval=$d_stdio_cnt_lval;;
12809 esac
12810 case "$stdio_base" in
12811 '') stdio_base='((fp)->_IO_read_base)';;
12812 esac
12813 case "$stdio_bufsiz" in
12814 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12815 esac
12816else
12817 case "$stdio_ptr" in
12818 '') stdio_ptr='((fp)->_ptr)'
12819 ptr_lval=$define
12820 ;;
12821 *) ptr_lval=$d_stdio_ptr_lval;;
12822 esac
12823 case "$stdio_cnt" in
12824 '') stdio_cnt='((fp)->_cnt)'
12825 cnt_lval=$define
12826 ;;
12827 *) cnt_lval=$d_stdio_cnt_lval;;
12828 esac
12829 case "$stdio_base" in
12830 '') stdio_base='((fp)->_base)';;
12831 esac
12832 case "$stdio_bufsiz" in
12833 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12834 esac
12835fi
b4eb6b3d 12836
15b61c98
JH
12837: test whether _ptr and _cnt really work
12838echo "Checking how std your stdio is..." >&4
12839$cat >try.c <<EOP
12840#include <stdio.h>
55954f19
JH
12841#$i_stdlib I_STDLIB
12842#ifdef I_STDLIB
9d9004a9 12843#include <stdlib.h>
55954f19 12844#endif
15b61c98
JH
12845#define FILE_ptr(fp) $stdio_ptr
12846#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12847int main() {
15b61c98
JH
12848 FILE *fp = fopen("try.c", "r");
12849 char c = getc(fp);
12850 if (
12851 18 <= FILE_cnt(fp) &&
12852 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12853 )
12854 exit(0);
12855 exit(1);
9d9004a9 12856}
15b61c98
JH
12857EOP
12858val="$undef"
12859set try
12860if eval $compile && $to try.c; then
12861 if $run ./try; then
12862 echo "Your stdio acts pretty std."
12863 val="$define"
9d9004a9 12864 else
15b61c98 12865 echo "Your stdio isn't very std."
9d9004a9 12866 fi
15b61c98
JH
12867else
12868 echo "Your stdio doesn't appear very std."
12869fi
5b813a60 12870$rm_try
15b61c98
JH
12871
12872# glibc 2.2.90 and above apparently change stdio streams so Perl's
12873# direct buffer manipulation no longer works. The Configure tests
12874# should be changed to correctly detect this, but until then,
12875# the following check should at least let perl compile and run.
12876# (This quick fix should be updated before 5.8.1.)
12877# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12878# A. Dougherty, June 3, 2002.
12879case "$d_gnulibc" in
12880$define)
12881 case "$gnulibc_version" in
12882 2.[01]*) ;;
12883 2.2) ;;
12884 2.2.[0-9]) ;;
12885 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12886 val="$undef"
12887 ;;
12888 esac
9d9004a9
AD
12889 ;;
12890esac
15b61c98 12891set d_stdstdio
9d9004a9 12892eval $setvar
9d9004a9 12893
15b61c98
JH
12894: Can _ptr be used as an lvalue?
12895case "$d_stdstdio$ptr_lval" in
12896$define$define) val=$define ;;
12897*) val=$undef ;;
12898esac
12899set d_stdio_ptr_lval
12900eval $setvar
9d9004a9 12901
15b61c98
JH
12902: Can _cnt be used as an lvalue?
12903case "$d_stdstdio$cnt_lval" in
12904$define$define) val=$define ;;
12905*) val=$undef ;;
12906esac
12907set d_stdio_cnt_lval
12908eval $setvar
b4eb6b3d 12909
15b61c98
JH
12910
12911: test whether setting _ptr sets _cnt as a side effect
12912d_stdio_ptr_lval_sets_cnt="$undef"
12913d_stdio_ptr_lval_nochange_cnt="$undef"
12914case "$d_stdio_ptr_lval$d_stdstdio" in
12915$define$define)
12916 echo "Checking to see what happens if we set the stdio ptr..." >&4
12917$cat >try.c <<EOP
12918#include <stdio.h>
12919/* Can we scream? */
12920/* Eat dust sed :-) */
12921/* In the buffer space, no one can hear you scream. */
55954f19
JH
12922#$i_stdlib I_STDLIB
12923#ifdef I_STDLIB
12924#include <stdlib.h>
12925#endif
15b61c98
JH
12926#define FILE_ptr(fp) $stdio_ptr
12927#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12928#include <sys/types.h>
b4eb6b3d 12929int main() {
15b61c98
JH
12930 FILE *fp = fopen("try.c", "r");
12931 int c;
12932 char *ptr;
12933 size_t cnt;
12934 if (!fp) {
12935 puts("Fail even to read");
12936 exit(1);
12937 }
12938 c = getc(fp); /* Read away the first # */
12939 if (c == EOF) {
12940 puts("Fail even to read");
12941 exit(1);
12942 }
12943 if (!(
12944 18 <= FILE_cnt(fp) &&
12945 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12946 )) {
12947 puts("Fail even to read");
12948 exit (1);
12949 }
12950 ptr = (char*) FILE_ptr(fp);
12951 cnt = (size_t)FILE_cnt(fp);
12952
12953 FILE_ptr(fp) += 42;
12954
12955 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12956 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12957 exit (1);
12958 }
12959 if (FILE_cnt(fp) <= 20) {
12960 printf ("Fail (<20 chars to test)");
12961 exit (1);
12962 }
12963 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12964 puts("Fail compare");
12965 exit (1);
12966 }
12967 if (cnt == FILE_cnt(fp)) {
12968 puts("Pass_unchanged");
12969 exit (0);
5b813a60 12970 }
15b61c98
JH
12971 if (FILE_cnt(fp) == (cnt - 42)) {
12972 puts("Pass_changed");
12973 exit (0);
12974 }
12975 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12976 return 1;
12977
12978}
12979EOP
12980 set try
12981 if eval $compile && $to try.c; then
12982 case `$run ./try` in
12983 Pass_changed)
12984 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12985 d_stdio_ptr_lval_sets_cnt="$define" ;;
12986 Pass_unchanged)
12987 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12988 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12989 Fail*)
12990 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12991 *)
12992 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12993 esac
12994 else
12995 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12996 fi
5b813a60 12997 $rm_try
15b61c98
JH
12998 ;;
12999esac
13000
13001: see if _base is also standard
13002val="$undef"
13003case "$d_stdstdio" in
13004$define)
13005 $cat >try.c <<EOP
13006#include <stdio.h>
13007#$i_stdlib I_STDLIB
13008#ifdef I_STDLIB
13009#include <stdlib.h>
13010#endif
13011#define FILE_base(fp) $stdio_base
13012#define FILE_bufsiz(fp) $stdio_bufsiz
13013int main() {
13014 FILE *fp = fopen("try.c", "r");
13015 char c = getc(fp);
13016 if (
13017 19 <= FILE_bufsiz(fp) &&
13018 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13019 )
13020 exit(0);
13021 exit(1);
13022}
13023EOP
13024 set try
13025 if eval $compile && $to try.c; then
13026 if $run ./try; then
13027 echo "And its _base field acts std."
13028 val="$define"
13029 else
13030 echo "But its _base field isn't std."
13031 fi
13032 else
13033 echo "However, it seems to be lacking the _base field."
13034 fi
5b813a60 13035 $rm_try
15b61c98
JH
13036 ;;
13037esac
13038set d_stdiobase
13039eval $setvar
13040
13041: see if fast_stdio exists
13042val="$undef"
13043case "$d_stdstdio:$d_stdio_ptr_lval" in
13044"$define:$define")
13045 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13046 *$define*)
13047 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13048 val="$define"
13049 ;;
13050 esac
13051 ;;
13052esac
13053set d_faststdio
13054eval $setvar
13055
13056
13057
13058: see if fchdir exists
13059set fchdir d_fchdir
13060eval $inlibc
13061
13062: see if fchmod exists
13063set fchmod d_fchmod
13064eval $inlibc
13065
13066: see if fchown exists
13067set fchown d_fchown
13068eval $inlibc
13069
13070: see if this is an fcntl system
13071set fcntl d_fcntl
13072eval $inlibc
13073
15b61c98 13074: See if fcntl-based locking works.
613d6c3e 13075echo " "
15b61c98
JH
13076$cat >try.c <<EOCP
13077#$i_stdlib I_STDLIB
13078#ifdef I_STDLIB
13079#include <stdlib.h>
13080#endif
13081#include <unistd.h>
13082#include <fcntl.h>
13083#include <signal.h>
7090f861 13084$signal_t blech(int x) { exit(3); }
15b61c98
JH
13085int main() {
13086#if defined(F_SETLK) && defined(F_SETLKW)
13087 struct flock flock;
13088 int retval, fd;
13089 fd = open("try.c", O_RDONLY);
13090 flock.l_type = F_RDLCK;
13091 flock.l_whence = SEEK_SET;
13092 flock.l_start = flock.l_len = 0;
13093 signal(SIGALRM, blech);
13094 alarm(10);
13095 retval = fcntl(fd, F_SETLK, &flock);
13096 close(fd);
13097 (retval < 0 ? exit(2) : exit(0));
13098#else
13099 exit(2);
13100#endif
13101}
13102EOCP
13103echo "Checking if fcntl-based file locking works... "
13104case "$d_fcntl" in
13105"$define")
13106 set try
13107 if eval $compile_ok; then
13108 if $run ./try; then
13109 echo "Yes, it seems to work."
13110 val="$define"
13111 else
13112 echo "Nope, it didn't work."
13113 val="$undef"
13114 case "$?" in
13115 3) $cat >&4 <<EOM
13116***
13117*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13118*** This is (almost) impossible.
13119*** If your NFS lock daemons are not feeling well, something like
13120*** this may happen, please investigate. Cannot continue, aborting.
13121***
13122EOM
13123 exit 1
13124 ;;
13125 esac
13126 fi
13127 else
13128 echo "I'm unable to compile the test program, so I'll assume not."
13129 val="$undef"
13130 fi
13131 ;;
13132*) val="$undef";
13133 echo "Nope, since you don't even have fcntl()."
13134 ;;
13135esac
13136set d_fcntl_can_lock
13137eval $setvar
5b813a60 13138$rm_try
15b61c98
JH
13139
13140: check for fd_set items
13141$cat <<EOM
13142
13143Checking to see how well your C compiler handles fd_set and friends ...
13144EOM
13145$cat >try.c <<EOCP
13146#$i_stdlib I_STDLIB
13147#ifdef I_STDLIB
13148#include <stdlib.h>
13149#endif
13150#$i_systime I_SYS_TIME
13151#$i_sysselct I_SYS_SELECT
13152#$d_socket HAS_SOCKET
13153#include <sys/types.h>
13154#ifdef HAS_SOCKET
13155#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13156#endif
13157#ifdef I_SYS_TIME
13158#include <sys/time.h>
13159#endif
13160#ifdef I_SYS_SELECT
13161#include <sys/select.h>
13162#endif
13163int main() {
13164 fd_set fds;
13165
13166#ifdef TRYBITS
13167 if(fds.fds_bits);
13168#endif
13169
13170#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13171 exit(0);
13172#else
13173 exit(1);
13174#endif
13175}
13176EOCP
13177set try -DTRYBITS
13178if eval $compile; then
13179 d_fds_bits="$define"
13180 d_fd_set="$define"
13181 echo "Well, your system knows about the normal fd_set typedef..." >&4
13182 if $run ./try; then
b4eb6b3d
JH
13183 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13184 d_fd_macros="$define"
13185 else
13186 $cat >&4 <<'EOM'
13187but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13188EOM
13189 d_fd_macros="$undef"
13190 fi
13191else
13192 $cat <<'EOM'
13193Hmm, your compiler has some difficulty with fd_set. Checking further...
13194EOM
5440bc8e 13195 set try
b4eb6b3d
JH
13196 if eval $compile; then
13197 d_fds_bits="$undef"
13198 d_fd_set="$define"
13199 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 13200 if $run ./try; then
b4eb6b3d
JH
13201 echo "and you have the normal fd_set macros." >&4
13202 d_fd_macros="$define"
13203 else
13204 $cat <<'EOM'
13205but not the normal fd_set macros! Gross! More work for me...
13206EOM
13207 d_fd_macros="$undef"
13208 fi
13209 else
13210 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13211 d_fd_set="$undef"
13212 d_fds_bits="$undef"
13213 d_fd_macros="$undef"
13214 fi
13215fi
5b813a60 13216$rm_try
b4eb6b3d
JH
13217
13218: see if fgetpos exists
13219set fgetpos d_fgetpos
13220eval $inlibc
13221
758a5d79
JH
13222: see if finite exists
13223set finite d_finite
13224eval $inlibc
13225
13226: see if finitel exists
13227set finitel d_finitel
13228eval $inlibc
13229
b4eb6b3d
JH
13230: see if flock exists
13231set flock d_flock
13232eval $inlibc
13233
2ef53570
JH
13234: see if prototype for flock is available
13235echo " "
13236set d_flockproto flock $i_sysfile sys/file.h
13237eval $hasproto
13238
758a5d79
JH
13239: see if fp_class exists
13240set fp_class d_fp_class
13241eval $inlibc
13242
b4eb6b3d
JH
13243: see if pathconf exists
13244set pathconf d_pathconf
13245eval $inlibc
13246
13247: see if fpathconf exists
13248set fpathconf d_fpathconf
13249eval $inlibc
13250
758a5d79
JH
13251: see if fpclass exists
13252set fpclass d_fpclass
13253eval $inlibc
13254
13255: see if fpclassify exists
13256set fpclassify d_fpclassify
13257eval $inlibc
13258
13259: see if fpclassl exists
13260set fpclassl d_fpclassl
13261eval $inlibc
13262
b4eb6b3d
JH
13263: check for fpos64_t
13264echo " "
13265echo "Checking to see if you have fpos64_t..." >&4
13266$cat >try.c <<EOCP
13267#include <stdio.h>
13268int main() { fpos64_t x = 7; }
13269EOCP
13270set try
13271if eval $compile; then
13272 val="$define"
13273 echo "You have fpos64_t."
13274else
13275 val="$undef"
13276 echo "You do not have fpos64_t."
13277 case "$fpossize" in
13278 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13279 esac
13280fi
5b813a60 13281$rm_try
b4eb6b3d
JH
13282set d_fpos64_t
13283eval $setvar
13284
13285: see if frexpl exists
13286set frexpl d_frexpl
13287eval $inlibc
13288
b4eb6b3d
JH
13289: see if this is a sys/param system
13290set sys/param.h i_sysparam
13291eval $inhdr
13292
13293: see if this is a sys/mount.h system
13294set sys/mount.h i_sysmount
13295eval $inhdr
13296
34f1896b 13297: Check for fs_data_s
b4eb6b3d
JH
13298echo " "
13299echo "Checking to see if your system supports struct fs_data..." >&4
13300set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13301eval $hasstruct
13302case "$d_fs_data_s" in
13303"$define") echo "Yes, it does." ;;
13304*) echo "No, it doesn't." ;;
13305esac
13306
13307: see if fseeko exists
13308set fseeko d_fseeko
13309eval $inlibc
13310case "$longsize" in
133118) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13312esac
13313
13314: see if fsetpos exists
13315set fsetpos d_fsetpos
13316eval $inlibc
13317
b4eb6b3d
JH
13318: see if fstatfs exists
13319set fstatfs d_fstatfs
13320eval $inlibc
13321
b4eb6b3d
JH
13322: see if statvfs exists
13323set statvfs d_statvfs
13324eval $inlibc
13325
13326: see if fstatvfs exists
13327set fstatvfs d_fstatvfs
13328eval $inlibc
13329
13330
411ab01c
JH
13331: see if fsync exists
13332set fsync d_fsync
13333eval $inlibc
13334
b4eb6b3d
JH
13335: see if ftello exists
13336set ftello d_ftello
13337eval $inlibc
13338case "$longsize" in
133398) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13340esac
13341
bff98e24 13342: check for a working futimes
613d6c3e 13343d_futimes="$undef"
bff98e24 13344echo " "
5b813a60 13345echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13346$cat >try.c <<EOCP
13347#include <stdio.h>
13348#include <sys/time.h>
13349#include <errno.h>
13350#include <fcntl.h>
13351
13352int main ()
13353{
13354 int fd, rv;
13355 fd = open ("try.c", O_RDWR);
13356 if (-1 == fd) exit (1);
13357 rv = futimes (fd, NULL);
13358 exit (rv == -1 ? errno : 0);
13359}
13360EOCP
13361set try
13362if eval $compile; then
13363 `$run ./try`
13364 rc=$?
13365 case "$rc" in
5b813a60 13366 0) echo "Yes, you have" >&4
bff98e24
SP
13367 d_futimes="$define"
13368 ;;
5b813a60 13369 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13370 ;;
13371 esac
13372else
43dddb59 13373 echo "No, it does not (probably harmless)" >&4
bff98e24 13374fi
5b813a60 13375$rm_try
dc814df1 13376
e74475c7
MHM
13377: see if ndbm.h is available
13378set ndbm.h i_ndbm
13379eval $inhdr
13380: Compatibility location for RedHat 7.1
13381set gdbm/ndbm.h i_gdbmndbm
13382eval $inhdr
13383: Compatibility location for Debian 4.0
13384set gdbm-ndbm.h i_gdbm_ndbm
13385eval $inhdr
13386
13387val="$undef"
13388if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13389 : see if dbm_open exists
13390 set dbm_open d_dbm_open
13391 eval $inlibc
13392 case "$d_dbm_open" in
13393 $undef)
13394 i_ndbm="$undef"
13395 i_gdbmndbm="$undef"
13396 i_gdbm_ndbm="$undef"
13397 echo "We won't be including <ndbm.h>"
13398 val="$undef"
13399 ;;
13400 *) val="$define"
13401 ;;
13402 esac
13403fi
13404set d_ndbm
13405eval $setvar
13406
13407ndbm_hdr_protochk='name=$1; hdr=$2;
13408eval "ihdr=\$""i_$name";
13409val="$undef";
13410if $test "$ihdr" = "$define"; then
13411 $echo "Checking if your <$hdr> uses prototypes..." >&4;
13412 case "$d_cplusplus" in
13413 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13414 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13415 esac;
13416 case "$val" in
13417 $define) $echo "Your <$hdr> seems to have prototypes";;
13418 *) $echo "Your <$hdr> does not seem to have prototypes";;
13419 esac;
13420fi;
13421set "d_${name}_h_uses_prototypes";
13422eval $setvar'
13423
13424set ndbm ndbm.h
13425eval $ndbm_hdr_protochk
13426set gdbmndbm gdbm/ndbm.h
13427eval $ndbm_hdr_protochk
13428set gdbm_ndbm gdbm-ndbm.h
13429eval $ndbm_hdr_protochk
13430
5086dff9
MB
13431: see if getaddrinfo exists
13432set getaddrinfo d_getaddrinfo
13433eval $inlibc
13434
b4eb6b3d
JH
13435: see if getcwd exists
13436set getcwd d_getcwd
13437eval $inlibc
13438
13439: see if getespwnam exists
13440set getespwnam d_getespwnam
13441eval $inlibc
13442
b4eb6b3d
JH
13443: see if getfsstat exists
13444set getfsstat d_getfsstat
13445eval $inlibc
13446
13447: see if getgrent exists
13448set getgrent d_getgrent
13449eval $inlibc
13450
10bc17b6
JH
13451: see if getgrent_r exists
13452set getgrent_r d_getgrent_r
13453eval $inlibc
13454case "$d_getgrent_r" in
13455"$define")
13456 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13457 case "$d_getgrent_r_proto:$usethreads" in
13458 ":define") d_getgrent_r_proto=define
a48ec845
JH
13459 set d_getgrent_r_proto getgrent_r $hdrs
13460 eval $hasproto ;;
13461 *) ;;
13462 esac
13463 case "$d_getgrent_r_proto" in
13464 define)
10bc17b6
JH
13465 case "$getgrent_r_proto" in
13466 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
61c26d18 13467 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
10bc17b6
JH
13468 esac
13469 case "$getgrent_r_proto" in
13470 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
61c26d18 13471 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
10bc17b6
JH
13472 esac
13473 case "$getgrent_r_proto" in
13474 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
61c26d18 13475 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
10bc17b6
JH
13476 esac
13477 case "$getgrent_r_proto" in
13478 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
61c26d18 13479 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
10bc17b6
JH
13480 esac
13481 case "$getgrent_r_proto" in
13482 ''|0) try='int getgrent_r(struct group*, char*, int);'
61c26d18 13483 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
10bc17b6
JH
13484 esac
13485 case "$getgrent_r_proto" in
13486 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
61c26d18 13487 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
10bc17b6
JH
13488 esac
13489 case "$getgrent_r_proto" in
90e831dc 13490 ''|0) d_getgrent_r=undef
10bc17b6 13491 getgrent_r_proto=0
a48ec845 13492 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13493 * ) case "$getgrent_r_proto" in
13494 REENTRANT_PROTO*) ;;
13495 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13496 esac
13497 echo "Prototype: $try" ;;
13498 esac
13499 ;;
c18e646a
JH
13500 *) case "$usethreads" in
13501 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13502 esac
90e831dc
SB
13503 d_getgrent_r=undef
13504 getgrent_r_proto=0
c18e646a 13505 ;;
a48ec845
JH
13506 esac
13507 ;;
10bc17b6
JH
13508*) getgrent_r_proto=0
13509 ;;
13510esac
13511
13512: see if getgrgid_r exists
13513set getgrgid_r d_getgrgid_r
13514eval $inlibc
13515case "$d_getgrgid_r" in
13516"$define")
13517 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13518 case "$d_getgrgid_r_proto:$usethreads" in
13519 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13520 set d_getgrgid_r_proto getgrgid_r $hdrs
13521 eval $hasproto ;;
13522 *) ;;
13523 esac
13524 case "$d_getgrgid_r_proto" in
13525 define)
10bc17b6
JH
13526 case "$getgrgid_r_proto" in
13527 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
61c26d18 13528 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
10bc17b6
JH
13529 esac
13530 case "$getgrgid_r_proto" in
13531 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
61c26d18 13532 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
10bc17b6
JH
13533 esac
13534 case "$getgrgid_r_proto" in
13535 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13536 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
10bc17b6
JH
13537 esac
13538 case "$getgrgid_r_proto" in
13539 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13540 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
10bc17b6
JH
13541 esac
13542 case "$getgrgid_r_proto" in
90e831dc 13543 ''|0) d_getgrgid_r=undef
10bc17b6 13544 getgrgid_r_proto=0
a48ec845 13545 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13546 * ) case "$getgrgid_r_proto" in
13547 REENTRANT_PROTO*) ;;
13548 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13549 esac
13550 echo "Prototype: $try" ;;
13551 esac
13552 ;;
c18e646a
JH
13553 *) case "$usethreads" in
13554 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13555 esac
90e831dc
SB
13556 d_getgrgid_r=undef
13557 getgrgid_r_proto=0
c18e646a 13558 ;;
a48ec845
JH
13559 esac
13560 ;;
10bc17b6
JH
13561*) getgrgid_r_proto=0
13562 ;;
13563esac
13564
13565: see if getgrnam_r exists
13566set getgrnam_r d_getgrnam_r
13567eval $inlibc
13568case "$d_getgrnam_r" in
13569"$define")
13570 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13571 case "$d_getgrnam_r_proto:$usethreads" in
13572 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13573 set d_getgrnam_r_proto getgrnam_r $hdrs
13574 eval $hasproto ;;
13575 *) ;;
13576 esac
13577 case "$d_getgrnam_r_proto" in
13578 define)
10bc17b6
JH
13579 case "$getgrnam_r_proto" in
13580 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
61c26d18 13581 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
10bc17b6
JH
13582 esac
13583 case "$getgrnam_r_proto" in
13584 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
61c26d18 13585 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
10bc17b6
JH
13586 esac
13587 case "$getgrnam_r_proto" in
13588 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
61c26d18 13589 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
10bc17b6
JH
13590 esac
13591 case "$getgrnam_r_proto" in
13592 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13593 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
10bc17b6
JH
13594 esac
13595 case "$getgrnam_r_proto" in
13596 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13597 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
10bc17b6
JH
13598 esac
13599 case "$getgrnam_r_proto" in
90e831dc 13600 ''|0) d_getgrnam_r=undef
10bc17b6 13601 getgrnam_r_proto=0
a48ec845 13602 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13603 * ) case "$getgrnam_r_proto" in
13604 REENTRANT_PROTO*) ;;
13605 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13606 esac
13607 echo "Prototype: $try" ;;
13608 esac
13609 ;;
c18e646a
JH
13610 *) case "$usethreads" in
13611 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13612 esac
90e831dc
SB
13613 d_getgrnam_r=undef
13614 getgrnam_r_proto=0
c18e646a 13615 ;;
a48ec845
JH
13616 esac
13617 ;;
10bc17b6
JH
13618*) getgrnam_r_proto=0
13619 ;;
13620esac
13621
b4eb6b3d
JH
13622: see if gethostbyaddr exists
13623set gethostbyaddr d_gethbyaddr
13624eval $inlibc
13625
13626: see if gethostbyname exists
13627set gethostbyname d_gethbyname
13628eval $inlibc
13629
13630: see if gethostent exists
13631set gethostent d_gethent
13632eval $inlibc
13633
13634: see how we will look up host name
13635echo " "
13636call=''
13637if set gethostname val -f d_gethname; eval $csym; $val; then
13638 echo 'gethostname() found.' >&4
13639 d_gethname="$define"
13640 call=gethostname
13641fi
13642if set uname val -f d_uname; eval $csym; $val; then
13643 if ./xenix; then
13644 $cat <<'EOM'
13645uname() was found, but you're running xenix, and older versions of xenix
13646have a broken uname(). If you don't really know whether your xenix is old
13647enough to have a broken system call, use the default answer.
13648
13649EOM
13650 dflt=y
13651 case "$d_uname" in
13652 "$define") dflt=n;;
13653 esac
13654 rp='Is your uname() broken?'
13655 . ./myread
13656 case "$ans" in
13657 n*) d_uname="$define"; call=uname;;
13658 esac
13659 else
13660 echo 'uname() found.' >&4
13661 d_uname="$define"
13662 case "$call" in
13663 '') call=uname ;;
13664 esac
13665 fi
13666fi
13667case "$d_gethname" in
13668'') d_gethname="$undef";;
13669esac
13670case "$d_uname" in
13671'') d_uname="$undef";;
13672esac
13673case "$d_uname$d_gethname" in
13674*define*)
13675 dflt=n
13676 cat <<EOM
613d6c3e 13677
b4eb6b3d
JH
13678Every now and then someone has a $call() that lies about the hostname
13679but can't be fixed for political or economic reasons. If you wish, I can
13680pretend $call() isn't there and maybe compute hostname at run-time
13681thanks to the '$phostname' command.
13682
13683EOM
13684 rp="Shall I ignore $call() from now on?"
13685 . ./myread
13686 case "$ans" in
13687 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13688 esac;;
13689esac
13690case "$phostname" in
13691'') aphostname='';;
13692*) case "$aphostname" in
13693 /*) ;;
13694 *) set X $phostname
13695 shift
13696 file=$1
13697 shift
13698 file=`./loc $file $file $pth`
13699 aphostname=`echo $file $*`
13700 ;;
13701 esac
13702 ;;
13703esac
13704case "$d_uname$d_gethname" in
13705*define*) ;;
13706*)
13707 case "$phostname" in
13708 '')
13709 echo "There will be no way for $package to get your hostname." >&4;;
13710 *)
13711 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13712 ;;
13713 esac;;
13714esac
13715case "$d_phostname" in
13716'') d_phostname="$undef";;
13717esac
13718
10bc17b6
JH
13719: see if gethostbyaddr_r exists
13720set gethostbyaddr_r d_gethostbyaddr_r
13721eval $inlibc
13722case "$d_gethostbyaddr_r" in
13723"$define")
13724 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13725 case "$d_gethostbyaddr_r_proto:$usethreads" in
13726 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13727 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13728 eval $hasproto ;;
13729 *) ;;
13730 esac
13731 case "$d_gethostbyaddr_r_proto" in
13732 define)
10bc17b6
JH
13733 case "$gethostbyaddr_r_proto" in
13734 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13735 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
10bc17b6
JH
13736 esac
13737 case "$gethostbyaddr_r_proto" in
13738 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
61c26d18 13739 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
10bc17b6
JH
13740 esac
13741 case "$gethostbyaddr_r_proto" in
13742 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13743 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
10bc17b6
JH
13744 esac
13745 case "$gethostbyaddr_r_proto" in
13746 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13747 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
10bc17b6
JH
13748 esac
13749 case "$gethostbyaddr_r_proto" in
13750 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
61c26d18 13751 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
10bc17b6
JH
13752 esac
13753 case "$gethostbyaddr_r_proto" in
13754 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13755 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
10bc17b6
JH
13756 esac
13757 case "$gethostbyaddr_r_proto" in
13758 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
61c26d18 13759 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
10bc17b6
JH
13760 esac
13761 case "$gethostbyaddr_r_proto" in
13762 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
61c26d18 13763 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
10bc17b6
JH
13764 esac
13765 case "$gethostbyaddr_r_proto" in
13766 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
61c26d18 13767 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
10bc17b6
JH
13768 esac
13769 case "$gethostbyaddr_r_proto" in
13770 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
61c26d18 13771 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
10bc17b6
JH
13772 esac
13773 case "$gethostbyaddr_r_proto" in
a845a0d4 13774 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13775 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
a845a0d4
JH
13776 esac
13777 case "$gethostbyaddr_r_proto" in
90e831dc 13778 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13779 gethostbyaddr_r_proto=0
a48ec845 13780 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13781 * ) case "$gethostbyaddr_r_proto" in
13782 REENTRANT_PROTO*) ;;
13783 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13784 esac
13785 echo "Prototype: $try" ;;
13786 esac
13787 ;;
c18e646a
JH
13788 *) case "$usethreads" in
13789 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13790 esac
90e831dc
SB
13791 d_gethostbyaddr_r=undef
13792 gethostbyaddr_r_proto=0
c18e646a 13793 ;;
a48ec845
JH
13794 esac
13795 ;;
10bc17b6
JH
13796*) gethostbyaddr_r_proto=0
13797 ;;
13798esac
13799
13800: see if gethostbyname_r exists
13801set gethostbyname_r d_gethostbyname_r
13802eval $inlibc
13803case "$d_gethostbyname_r" in
13804"$define")
13805 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13806 case "$d_gethostbyname_r_proto:$usethreads" in
13807 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13808 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13809 eval $hasproto ;;
13810 *) ;;
13811 esac
13812 case "$d_gethostbyname_r_proto" in
13813 define)
10bc17b6
JH
13814 case "$gethostbyname_r_proto" in
13815 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13816 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
13817 esac
13818 case "$gethostbyname_r_proto" in
13819 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13820 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
10bc17b6
JH
13821 esac
13822 case "$gethostbyname_r_proto" in
13823 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
61c26d18 13824 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
10bc17b6
JH
13825 esac
13826 case "$gethostbyname_r_proto" in
90e831dc 13827 ''|0) d_gethostbyname_r=undef
10bc17b6 13828 gethostbyname_r_proto=0
a48ec845 13829 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13830 * ) case "$gethostbyname_r_proto" in
13831 REENTRANT_PROTO*) ;;
13832 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13833 esac
13834 echo "Prototype: $try" ;;
13835 esac
13836 ;;
c18e646a
JH
13837 *) case "$usethreads" in
13838 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13839 esac
90e831dc
SB
13840 d_gethostbyname_r=undef
13841 gethostbyname_r_proto=0
c18e646a 13842 ;;
a48ec845
JH
13843 esac
13844 ;;
10bc17b6
JH
13845*) gethostbyname_r_proto=0
13846 ;;
13847esac
13848
13849: see if gethostent_r exists
13850set gethostent_r d_gethostent_r
13851eval $inlibc
13852case "$d_gethostent_r" in
13853"$define")
13854 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13855 case "$d_gethostent_r_proto:$usethreads" in
13856 ":define") d_gethostent_r_proto=define
a48ec845
JH
13857 set d_gethostent_r_proto gethostent_r $hdrs
13858 eval $hasproto ;;
13859 *) ;;
13860 esac
13861 case "$d_gethostent_r_proto" in
13862 define)
10bc17b6
JH
13863 case "$gethostent_r_proto" in
13864 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13865 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
10bc17b6
JH
13866 esac
13867 case "$gethostent_r_proto" in
13868 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13869 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
10bc17b6
JH
13870 esac
13871 case "$gethostent_r_proto" in
13872 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13873 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
10bc17b6
JH
13874 esac
13875 case "$gethostent_r_proto" in
13876 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
61c26d18 13877 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
10bc17b6
JH
13878 esac
13879 case "$gethostent_r_proto" in
13880 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
61c26d18 13881 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
10bc17b6
JH
13882 esac
13883 case "$gethostent_r_proto" in
13884 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
61c26d18 13885 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
10bc17b6
JH
13886 esac
13887 case "$gethostent_r_proto" in
90e831dc 13888 ''|0) d_gethostent_r=undef
10bc17b6 13889 gethostent_r_proto=0
a48ec845 13890 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13891 * ) case "$gethostent_r_proto" in
13892 REENTRANT_PROTO*) ;;
13893 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13894 esac
13895 echo "Prototype: $try" ;;
13896 esac
13897 ;;
c18e646a
JH
13898 *) case "$usethreads" in
13899 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13900 esac
90e831dc
SB
13901 d_gethostent_r=undef
13902 gethostent_r_proto=0
c18e646a 13903 ;;
a48ec845
JH
13904 esac
13905 ;;
10bc17b6
JH
13906*) gethostent_r_proto=0
13907 ;;
13908esac
b4eb6b3d
JH
13909
13910: see if prototypes for various gethostxxx netdb.h functions are available
13911echo " "
13912set d_gethostprotos gethostent $i_netdb netdb.h
13913eval $hasproto
13914
4e0554ec
JH
13915: see if getitimer exists
13916set getitimer d_getitimer
13917eval $inlibc
13918
b4eb6b3d
JH
13919: see if getlogin exists
13920set getlogin d_getlogin
13921eval $inlibc
13922
10bc17b6
JH
13923: see if getlogin_r exists
13924set getlogin_r d_getlogin_r
13925eval $inlibc
13926case "$d_getlogin_r" in
13927"$define")
13928 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13929 case "$d_getlogin_r_proto:$usethreads" in
13930 ":define") d_getlogin_r_proto=define
a48ec845
JH
13931 set d_getlogin_r_proto getlogin_r $hdrs
13932 eval $hasproto ;;
13933 *) ;;
13934 esac
13935 case "$d_getlogin_r_proto" in
13936 define)
10bc17b6
JH
13937 case "$getlogin_r_proto" in
13938 ''|0) try='int getlogin_r(char*, size_t);'
61c26d18 13939 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
10bc17b6
JH
13940 esac
13941 case "$getlogin_r_proto" in
13942 ''|0) try='int getlogin_r(char*, int);'
61c26d18 13943 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
10bc17b6
JH
13944 esac
13945 case "$getlogin_r_proto" in
13946 ''|0) try='char* getlogin_r(char*, size_t);'
61c26d18 13947 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
10bc17b6
JH
13948 esac
13949 case "$getlogin_r_proto" in
13950 ''|0) try='char* getlogin_r(char*, int);'
61c26d18 13951 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
10bc17b6
JH
13952 esac
13953 case "$getlogin_r_proto" in
90e831dc 13954 ''|0) d_getlogin_r=undef
10bc17b6 13955 getlogin_r_proto=0
a48ec845 13956 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13957 * ) case "$getlogin_r_proto" in
13958 REENTRANT_PROTO*) ;;
13959 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13960 esac
13961 echo "Prototype: $try" ;;
13962 esac
13963 ;;
c18e646a
JH
13964 *) case "$usethreads" in
13965 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13966 esac
90e831dc
SB
13967 d_getlogin_r=undef
13968 getlogin_r_proto=0
c18e646a 13969 ;;
a48ec845
JH
13970 esac
13971 ;;
10bc17b6
JH
13972*) getlogin_r_proto=0
13973 ;;
13974esac
13975
b4eb6b3d
JH
13976: see if getmnt exists
13977set getmnt d_getmnt
13978eval $inlibc
13979
13980: see if getmntent exists
13981set getmntent d_getmntent
13982eval $inlibc
13983
5086dff9
MB
13984: see if getnameinfo exists
13985set getnameinfo d_getnameinfo
13986eval $inlibc
13987
b4eb6b3d
JH
13988: see if getnetbyaddr exists
13989set getnetbyaddr d_getnbyaddr
13990eval $inlibc
13991
13992: see if getnetbyname exists
13993set getnetbyname d_getnbyname
13994eval $inlibc
13995
13996: see if getnetent exists
13997set getnetent d_getnent
13998eval $inlibc
13999
10bc17b6
JH
14000: see if getnetbyaddr_r exists
14001set getnetbyaddr_r d_getnetbyaddr_r
14002eval $inlibc
14003case "$d_getnetbyaddr_r" in
14004"$define")
14005 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14006 case "$d_getnetbyaddr_r_proto:$usethreads" in
14007 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
14008 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14009 eval $hasproto ;;
14010 *) ;;
14011 esac
14012 case "$d_getnetbyaddr_r_proto" in
14013 define)
10bc17b6
JH
14014 case "$getnetbyaddr_r_proto" in
14015 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14016 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
10bc17b6
JH
14017 esac
14018 case "$getnetbyaddr_r_proto" in
14019 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14020 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
10bc17b6
JH
14021 esac
14022 case "$getnetbyaddr_r_proto" in
14023 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
61c26d18 14024 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
10bc17b6
JH
14025 esac
14026 case "$getnetbyaddr_r_proto" in
14027 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14028 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
10bc17b6
JH
14029 esac
14030 case "$getnetbyaddr_r_proto" in
14031 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
61c26d18 14032 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
10bc17b6
JH
14033 esac
14034 case "$getnetbyaddr_r_proto" in
14035 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
61c26d18 14036 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
10bc17b6
JH
14037 esac
14038 case "$getnetbyaddr_r_proto" in
14039 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
61c26d18 14040 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
10bc17b6
JH
14041 esac
14042 case "$getnetbyaddr_r_proto" in
a845a0d4 14043 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14044 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
a845a0d4
JH
14045 esac
14046 case "$getnetbyaddr_r_proto" in
90e831dc 14047 ''|0) d_getnetbyaddr_r=undef
10bc17b6 14048 getnetbyaddr_r_proto=0
a48ec845 14049 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14050 * ) case "$getnetbyaddr_r_proto" in
14051 REENTRANT_PROTO*) ;;
14052 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14053 esac
14054 echo "Prototype: $try" ;;
14055 esac
14056 ;;
c18e646a
JH
14057 *) case "$usethreads" in
14058 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14059 esac
90e831dc
SB
14060 d_getnetbyaddr_r=undef
14061 getnetbyaddr_r_proto=0
c18e646a 14062 ;;
a48ec845
JH
14063 esac
14064 ;;
10bc17b6
JH
14065*) getnetbyaddr_r_proto=0
14066 ;;
14067esac
14068
14069: see if getnetbyname_r exists
14070set getnetbyname_r d_getnetbyname_r
14071eval $inlibc
14072case "$d_getnetbyname_r" in
14073"$define")
14074 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14075 case "$d_getnetbyname_r_proto:$usethreads" in
14076 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
14077 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14078 eval $hasproto ;;
14079 *) ;;
14080 esac
14081 case "$d_getnetbyname_r_proto" in
14082 define)
10bc17b6
JH
14083 case "$getnetbyname_r_proto" in
14084 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14085 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
14086 esac
14087 case "$getnetbyname_r_proto" in
14088 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14089 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
10bc17b6
JH
14090 esac
14091 case "$getnetbyname_r_proto" in
14092 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14093 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
10bc17b6
JH
14094 esac
14095 case "$getnetbyname_r_proto" in
14096 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
61c26d18 14097 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
10bc17b6
JH
14098 esac
14099 case "$getnetbyname_r_proto" in
90e831dc 14100 ''|0) d_getnetbyname_r=undef
10bc17b6 14101 getnetbyname_r_proto=0
a48ec845 14102 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14103 * ) case "$getnetbyname_r_proto" in
14104 REENTRANT_PROTO*) ;;
14105 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14106 esac
14107 echo "Prototype: $try" ;;
14108 esac
14109 ;;
c18e646a
JH
14110 *) case "$usethreads" in
14111 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14112 esac
90e831dc
SB
14113 d_getnetbyname_r=undef
14114 getnetbyname_r_proto=0
c18e646a 14115 ;;
a48ec845
JH
14116 esac
14117 ;;
10bc17b6
JH
14118*) getnetbyname_r_proto=0
14119 ;;
14120esac
14121
14122: see if getnetent_r exists
14123set getnetent_r d_getnetent_r
14124eval $inlibc
14125case "$d_getnetent_r" in
14126"$define")
14127 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14128 case "$d_getnetent_r_proto:$usethreads" in
14129 ":define") d_getnetent_r_proto=define
a48ec845
JH
14130 set d_getnetent_r_proto getnetent_r $hdrs
14131 eval $hasproto ;;
14132 *) ;;
14133 esac
14134 case "$d_getnetent_r_proto" in
14135 define)
10bc17b6
JH
14136 case "$getnetent_r_proto" in
14137 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14138 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
10bc17b6
JH
14139 esac
14140 case "$getnetent_r_proto" in
14141 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14142 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
10bc17b6
JH
14143 esac
14144 case "$getnetent_r_proto" in
14145 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14146 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
10bc17b6
JH
14147 esac
14148 case "$getnetent_r_proto" in
14149 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
61c26d18 14150 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
10bc17b6
JH
14151 esac
14152 case "$getnetent_r_proto" in
14153 ''|0) try='int getnetent_r(struct netent*, char*, int);'
61c26d18 14154 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
10bc17b6
JH
14155 esac
14156 case "$getnetent_r_proto" in
14157 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
61c26d18 14158 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
10bc17b6
JH
14159 esac
14160 case "$getnetent_r_proto" in
90e831dc 14161 ''|0) d_getnetent_r=undef
10bc17b6 14162 getnetent_r_proto=0
a48ec845 14163 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14164 * ) case "$getnetent_r_proto" in
14165 REENTRANT_PROTO*) ;;
14166 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14167 esac
14168 echo "Prototype: $try" ;;
14169 esac
14170 ;;
c18e646a
JH
14171 *) case "$usethreads" in
14172 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14173 esac
90e831dc
SB
14174 d_getnetent_r=undef
14175 getnetent_r_proto=0
c18e646a 14176 ;;
a48ec845
JH
14177 esac
14178 ;;
10bc17b6
JH
14179*) getnetent_r_proto=0
14180 ;;
14181esac
14182
b4eb6b3d
JH
14183: see if prototypes for various getnetxxx netdb.h functions are available
14184echo " "
14185set d_getnetprotos getnetent $i_netdb netdb.h
14186eval $hasproto
14187
0c0643d0
JH
14188: see if getpagesize exists
14189set getpagesize d_getpagsz
14190eval $inlibc
14191
34f1896b 14192: Optional checks for getprotobyname and getprotobynumber
b4eb6b3d
JH
14193
14194: see if getprotobyname exists
14195set getprotobyname d_getpbyname
14196eval $inlibc
14197
14198: see if getprotobynumber exists
14199set getprotobynumber d_getpbynumber
14200eval $inlibc
14201
14202: see if getprotoent exists
14203set getprotoent d_getpent
14204eval $inlibc
14205
14206: see if getpgid exists
14207set getpgid d_getpgid
14208eval $inlibc
14209
14210: see if getpgrp2 exists
14211set getpgrp2 d_getpgrp2
14212eval $inlibc
14213
14214: see if getppid exists
14215set getppid d_getppid
14216eval $inlibc
14217
14218: see if getpriority exists
14219set getpriority d_getprior
14220eval $inlibc
14221
10bc17b6
JH
14222: see if getprotobyname_r exists
14223set getprotobyname_r d_getprotobyname_r
14224eval $inlibc
14225case "$d_getprotobyname_r" in
14226"$define")
14227 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14228 case "$d_getprotobyname_r_proto:$usethreads" in
14229 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
14230 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14231 eval $hasproto ;;
14232 *) ;;
14233 esac
14234 case "$d_getprotobyname_r_proto" in
14235 define)
10bc17b6
JH
14236 case "$getprotobyname_r_proto" in
14237 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14238 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
10bc17b6
JH
14239 esac
14240 case "$getprotobyname_r_proto" in
14241 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
61c26d18 14242 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
10bc17b6
JH
14243 esac
14244 case "$getprotobyname_r_proto" in
14245 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
61c26d18 14246 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
10bc17b6
JH
14247 esac
14248 case "$getprotobyname_r_proto" in
90e831dc 14249 ''|0) d_getprotobyname_r=undef
10bc17b6 14250 getprotobyname_r_proto=0
a48ec845 14251 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14252 * ) case "$getprotobyname_r_proto" in
14253 REENTRANT_PROTO*) ;;
14254 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14255 esac
14256 echo "Prototype: $try" ;;
14257 esac
14258 ;;
c18e646a
JH
14259 *) case "$usethreads" in
14260 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14261 esac
90e831dc
SB
14262 d_getprotobyname_r=undef
14263 getprotobyname_r_proto=0
c18e646a 14264 ;;
a48ec845
JH
14265 esac
14266 ;;
10bc17b6
JH
14267*) getprotobyname_r_proto=0
14268 ;;
14269esac
14270
14271: see if getprotobynumber_r exists
14272set getprotobynumber_r d_getprotobynumber_r
14273eval $inlibc
14274case "$d_getprotobynumber_r" in
14275"$define")
14276 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14277 case "$d_getprotobynumber_r_proto:$usethreads" in
14278 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
14279 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14280 eval $hasproto ;;
14281 *) ;;
14282 esac
14283 case "$d_getprotobynumber_r_proto" in
14284 define)
10bc17b6
JH
14285 case "$getprotobynumber_r_proto" in
14286 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14287 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
10bc17b6
JH
14288 esac
14289 case "$getprotobynumber_r_proto" in
14290 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
61c26d18 14291 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
10bc17b6
JH
14292 esac
14293 case "$getprotobynumber_r_proto" in
14294 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
61c26d18 14295 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
10bc17b6
JH
14296 esac
14297 case "$getprotobynumber_r_proto" in
90e831dc 14298 ''|0) d_getprotobynumber_r=undef
10bc17b6 14299 getprotobynumber_r_proto=0
a48ec845 14300 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14301 * ) case "$getprotobynumber_r_proto" in
14302 REENTRANT_PROTO*) ;;
14303 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14304 esac
14305 echo "Prototype: $try" ;;
14306 esac
14307 ;;
c18e646a
JH
14308 *) case "$usethreads" in
14309 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14310 esac
90e831dc
SB
14311 d_getprotobynumber_r=undef
14312 getprotobynumber_r_proto=0
c18e646a 14313 ;;
a48ec845
JH
14314 esac
14315 ;;
10bc17b6
JH
14316*) getprotobynumber_r_proto=0
14317 ;;
14318esac
14319
14320: see if getprotoent_r exists
14321set getprotoent_r d_getprotoent_r
14322eval $inlibc
14323case "$d_getprotoent_r" in
14324"$define")
14325 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14326 case "$d_getprotoent_r_proto:$usethreads" in
14327 ":define") d_getprotoent_r_proto=define
a48ec845
JH
14328 set d_getprotoent_r_proto getprotoent_r $hdrs
14329 eval $hasproto ;;
14330 *) ;;
14331 esac
14332 case "$d_getprotoent_r_proto" in
14333 define)
10bc17b6
JH
14334 case "$getprotoent_r_proto" in
14335 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14336 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
10bc17b6
JH
14337 esac
14338 case "$getprotoent_r_proto" in
14339 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
61c26d18 14340 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
10bc17b6
JH
14341 esac
14342 case "$getprotoent_r_proto" in
14343 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
61c26d18 14344 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
10bc17b6
JH
14345 esac
14346 case "$getprotoent_r_proto" in
14347 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
61c26d18 14348 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
10bc17b6
JH
14349 esac
14350 case "$getprotoent_r_proto" in
90e831dc 14351 ''|0) d_getprotoent_r=undef
10bc17b6 14352 getprotoent_r_proto=0
a48ec845 14353 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14354 * ) case "$getprotoent_r_proto" in
14355 REENTRANT_PROTO*) ;;
14356 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14357 esac
14358 echo "Prototype: $try" ;;
14359 esac
14360 ;;
c18e646a
JH
14361 *) case "$usethreads" in
14362 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14363 esac
90e831dc
SB
14364 d_getprotoent_r=undef
14365 getprotoent_r_proto=0
c18e646a 14366 ;;
a48ec845
JH
14367 esac
14368 ;;
10bc17b6
JH
14369*) getprotoent_r_proto=0
14370 ;;
14371esac
14372
b4eb6b3d
JH
14373: see if prototypes for various getprotoxxx netdb.h functions are available
14374echo " "
14375set d_getprotoprotos getprotoent $i_netdb netdb.h
14376eval $hasproto
14377
14378: see if getprpwnam exists
14379set getprpwnam d_getprpwnam
14380eval $inlibc
14381
14382: see if getpwent exists
14383set getpwent d_getpwent
14384eval $inlibc
14385
10bc17b6
JH
14386: see if getpwent_r exists
14387set getpwent_r d_getpwent_r
14388eval $inlibc
14389case "$d_getpwent_r" in
14390"$define")
14391 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14392 case "$d_getpwent_r_proto:$usethreads" in
14393 ":define") d_getpwent_r_proto=define
a48ec845
JH
14394 set d_getpwent_r_proto getpwent_r $hdrs
14395 eval $hasproto ;;
14396 *) ;;
14397 esac
14398 case "$d_getpwent_r_proto" in
14399 define)
10bc17b6
JH
14400 case "$getpwent_r_proto" in
14401 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14402 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
10bc17b6
JH
14403 esac
14404 case "$getpwent_r_proto" in
14405 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
61c26d18 14406 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
10bc17b6
JH
14407 esac
14408 case "$getpwent_r_proto" in
14409 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
61c26d18 14410 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
10bc17b6
JH
14411 esac
14412 case "$getpwent_r_proto" in
14413 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
61c26d18 14414 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
10bc17b6
JH
14415 esac
14416 case "$getpwent_r_proto" in
14417 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
61c26d18 14418 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
10bc17b6
JH
14419 esac
14420 case "$getpwent_r_proto" in
14421 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
61c26d18 14422 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
10bc17b6
JH
14423 esac
14424 case "$getpwent_r_proto" in
90e831dc 14425 ''|0) d_getpwent_r=undef
10bc17b6 14426 getpwent_r_proto=0
a48ec845 14427 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14428 * ) case "$getpwent_r_proto" in
14429 REENTRANT_PROTO*) ;;
14430 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14431 esac
14432 echo "Prototype: $try" ;;
14433 esac
14434 ;;
c18e646a
JH
14435 *) case "$usethreads" in
14436 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14437 esac
90e831dc
SB
14438 d_getpwent_r=undef
14439 getpwent_r_proto=0
c18e646a 14440 ;;
a48ec845
JH
14441 esac
14442 ;;
10bc17b6
JH
14443*) getpwent_r_proto=0
14444 ;;
14445esac
14446
14447: see if getpwnam_r exists
14448set getpwnam_r d_getpwnam_r
14449eval $inlibc
14450case "$d_getpwnam_r" in
14451"$define")
14452 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14453 case "$d_getpwnam_r_proto:$usethreads" in
14454 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14455 set d_getpwnam_r_proto getpwnam_r $hdrs
14456 eval $hasproto ;;
14457 *) ;;
14458 esac
14459 case "$d_getpwnam_r_proto" in
14460 define)
10bc17b6
JH
14461 case "$getpwnam_r_proto" in
14462 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14463 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14464 esac
14465 case "$getpwnam_r_proto" in
14466 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
61c26d18 14467 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
10bc17b6
JH
14468 esac
14469 case "$getpwnam_r_proto" in
14470 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14471 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
10bc17b6
JH
14472 esac
14473 case "$getpwnam_r_proto" in
14474 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14475 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
10bc17b6
JH
14476 esac
14477 case "$getpwnam_r_proto" in
90e831dc 14478 ''|0) d_getpwnam_r=undef
10bc17b6 14479 getpwnam_r_proto=0
a48ec845 14480 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14481 * ) case "$getpwnam_r_proto" in
14482 REENTRANT_PROTO*) ;;
14483 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14484 esac
14485 echo "Prototype: $try" ;;
14486 esac
14487 ;;
c18e646a
JH
14488 *) case "$usethreads" in
14489 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14490 esac
90e831dc
SB
14491 d_getpwnam_r=undef
14492 getpwnam_r_proto=0
c18e646a 14493 ;;
a48ec845
JH
14494 esac
14495 ;;
10bc17b6
JH
14496*) getpwnam_r_proto=0
14497 ;;
14498esac
14499
14500: see if getpwuid_r exists
14501set getpwuid_r d_getpwuid_r
14502eval $inlibc
14503case "$d_getpwuid_r" in
14504"$define")
14505 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14506 case "$d_getpwuid_r_proto:$usethreads" in
14507 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14508 set d_getpwuid_r_proto getpwuid_r $hdrs
14509 eval $hasproto ;;
14510 *) ;;
14511 esac
14512 case "$d_getpwuid_r_proto" in
14513 define)
10bc17b6
JH
14514 case "$getpwuid_r_proto" in
14515 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14516 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
10bc17b6
JH
14517 esac
14518 case "$getpwuid_r_proto" in
14519 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
61c26d18 14520 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
10bc17b6
JH
14521 esac
14522 case "$getpwuid_r_proto" in
14523 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14524 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
10bc17b6
JH
14525 esac
14526 case "$getpwuid_r_proto" in
14527 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14528 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
10bc17b6
JH
14529 esac
14530 case "$getpwuid_r_proto" in
90e831dc 14531 ''|0) d_getpwuid_r=undef
10bc17b6 14532 getpwuid_r_proto=0
a48ec845 14533 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14534 * ) case "$getpwuid_r_proto" in
14535 REENTRANT_PROTO*) ;;
14536 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14537 esac
14538 echo "Prototype: $try" ;;
14539 esac
14540 ;;
c18e646a
JH
14541 *) case "$usethreads" in
14542 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14543 esac
90e831dc
SB
14544 d_getpwuid_r=undef
14545 getpwuid_r_proto=0
c18e646a 14546 ;;
a48ec845
JH
14547 esac
14548 ;;
10bc17b6
JH
14549*) getpwuid_r_proto=0
14550 ;;
14551esac
14552
34f1896b 14553: Optional checks for getsbyname and getsbyport
b4eb6b3d
JH
14554
14555: see if getservbyname exists
14556set getservbyname d_getsbyname
14557eval $inlibc
14558
14559: see if getservbyport exists
14560set getservbyport d_getsbyport
14561eval $inlibc
14562
14563: see if getservent exists
14564set getservent d_getsent
14565eval $inlibc
14566
10bc17b6
JH
14567: see if getservbyname_r exists
14568set getservbyname_r d_getservbyname_r
14569eval $inlibc
14570case "$d_getservbyname_r" in
14571"$define")
14572 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14573 case "$d_getservbyname_r_proto:$usethreads" in
14574 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14575 set d_getservbyname_r_proto getservbyname_r $hdrs
14576 eval $hasproto ;;
14577 *) ;;
14578 esac
14579 case "$d_getservbyname_r_proto" in
14580 define)
10bc17b6
JH
14581 case "$getservbyname_r_proto" in
14582 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14583 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
10bc17b6
JH
14584 esac
14585 case "$getservbyname_r_proto" in
14586 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
61c26d18 14587 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
10bc17b6
JH
14588 esac
14589 case "$getservbyname_r_proto" in
14590 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
61c26d18 14591 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
10bc17b6
JH
14592 esac
14593 case "$getservbyname_r_proto" in
90e831dc 14594 ''|0) d_getservbyname_r=undef
10bc17b6 14595 getservbyname_r_proto=0
a48ec845 14596 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14597 * ) case "$getservbyname_r_proto" in
14598 REENTRANT_PROTO*) ;;
14599 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14600 esac
14601 echo "Prototype: $try" ;;
14602 esac
14603 ;;
c18e646a
JH
14604 *) case "$usethreads" in
14605 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14606 esac
90e831dc
SB
14607 d_getservbyname_r=undef
14608 getservbyname_r_proto=0
c18e646a 14609 ;;
a48ec845
JH
14610 esac
14611 ;;
10bc17b6
JH
14612*) getservbyname_r_proto=0
14613 ;;
14614esac
14615
14616: see if getservbyport_r exists
14617set getservbyport_r d_getservbyport_r
14618eval $inlibc
14619case "$d_getservbyport_r" in
14620"$define")
14621 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14622 case "$d_getservbyport_r_proto:$usethreads" in
14623 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14624 set d_getservbyport_r_proto getservbyport_r $hdrs
14625 eval $hasproto ;;
14626 *) ;;
14627 esac
14628 case "$d_getservbyport_r_proto" in
14629 define)
10bc17b6
JH
14630 case "$getservbyport_r_proto" in
14631 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14632 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
10bc17b6
JH
14633 esac
14634 case "$getservbyport_r_proto" in
14635 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
61c26d18 14636 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
10bc17b6
JH
14637 esac
14638 case "$getservbyport_r_proto" in
14639 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
61c26d18 14640 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
10bc17b6
JH
14641 esac
14642 case "$getservbyport_r_proto" in
90e831dc 14643 ''|0) d_getservbyport_r=undef
10bc17b6 14644 getservbyport_r_proto=0
a48ec845 14645 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14646 * ) case "$getservbyport_r_proto" in
14647 REENTRANT_PROTO*) ;;
14648 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14649 esac
14650 echo "Prototype: $try" ;;
14651 esac
14652 ;;
c18e646a
JH
14653 *) case "$usethreads" in
14654 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14655 esac
90e831dc
SB
14656 d_getservbyport_r=undef
14657 getservbyport_r_proto=0
c18e646a 14658 ;;
a48ec845
JH
14659 esac
14660 ;;
10bc17b6
JH
14661*) getservbyport_r_proto=0
14662 ;;
14663esac
14664
14665: see if getservent_r exists
14666set getservent_r d_getservent_r
14667eval $inlibc
14668case "$d_getservent_r" in
14669"$define")
14670 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14671 case "$d_getservent_r_proto:$usethreads" in
14672 ":define") d_getservent_r_proto=define
a48ec845
JH
14673 set d_getservent_r_proto getservent_r $hdrs
14674 eval $hasproto ;;
14675 *) ;;
14676 esac
14677 case "$d_getservent_r_proto" in
14678 define)
10bc17b6
JH
14679 case "$getservent_r_proto" in
14680 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
61c26d18 14681 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
10bc17b6
JH
14682 esac
14683 case "$getservent_r_proto" in
14684 ''|0) try='int getservent_r(struct servent*, char*, int);'
61c26d18 14685 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
10bc17b6
JH
14686 esac
14687 case "$getservent_r_proto" in
14688 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
61c26d18 14689 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
10bc17b6
JH
14690 esac
14691 case "$getservent_r_proto" in
14692 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
61c26d18 14693 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
10bc17b6
JH
14694 esac
14695 case "$getservent_r_proto" in
90e831dc 14696 ''|0) d_getservent_r=undef
10bc17b6 14697 getservent_r_proto=0
a48ec845 14698 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14699 * ) case "$getservent_r_proto" in
14700 REENTRANT_PROTO*) ;;
14701 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14702 esac
14703 echo "Prototype: $try" ;;
14704 esac
14705 ;;
c18e646a
JH
14706 *) case "$usethreads" in
14707 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14708 esac
90e831dc
SB
14709 d_getservent_r=undef
14710 getservent_r_proto=0
c18e646a 14711 ;;
a48ec845
JH
14712 esac
14713 ;;
10bc17b6
JH
14714*) getservent_r_proto=0
14715 ;;
14716esac
14717
b4eb6b3d
JH
14718: see if prototypes for various getservxxx netdb.h functions are available
14719echo " "
14720set d_getservprotos getservent $i_netdb netdb.h
14721eval $hasproto
14722
14723: see if getspnam exists
14724set getspnam d_getspnam
14725eval $inlibc
14726
10bc17b6
JH
14727: see if this is a shadow.h system
14728set shadow.h i_shadow
14729eval $inhdr
14730
14731: see if getspnam_r exists
14732set getspnam_r d_getspnam_r
14733eval $inlibc
14734case "$d_getspnam_r" in
14735"$define")
14736 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14737 case "$d_getspnam_r_proto:$usethreads" in
14738 ":define") d_getspnam_r_proto=define
a48ec845
JH
14739 set d_getspnam_r_proto getspnam_r $hdrs
14740 eval $hasproto ;;
14741 *) ;;
14742 esac
14743 case "$d_getspnam_r_proto" in
14744 define)
10bc17b6
JH
14745 case "$getspnam_r_proto" in
14746 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
61c26d18 14747 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14748 esac
14749 case "$getspnam_r_proto" in
14750 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
61c26d18 14751 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
10bc17b6
JH
14752 esac
14753 case "$getspnam_r_proto" in
90e831dc 14754 ''|0) d_getspnam_r=undef
10bc17b6 14755 getspnam_r_proto=0
a48ec845 14756 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14757 * ) case "$getspnam_r_proto" in
14758 REENTRANT_PROTO*) ;;
14759 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14760 esac
14761 echo "Prototype: $try" ;;
14762 esac
14763 ;;
c18e646a
JH
14764 *) case "$usethreads" in
14765 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14766 esac
90e831dc
SB
14767 d_getspnam_r=undef
14768 getspnam_r_proto=0
c18e646a 14769 ;;
a48ec845
JH
14770 esac
14771 ;;
10bc17b6
JH
14772*) getspnam_r_proto=0
14773 ;;
14774esac
14775
b4eb6b3d
JH
14776: see if gettimeofday or ftime exists
14777set gettimeofday d_gettimeod
14778eval $inlibc
14779case "$d_gettimeod" in
14780"$undef")
14781 set ftime d_ftime
14782 eval $inlibc
14783 ;;
14784*)
14785 val="$undef"; set d_ftime; eval $setvar
14786 ;;
14787esac
14788case "$d_gettimeod$d_ftime" in
14789"$undef$undef")
14790 echo " "
14791 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14792 ;;
14793esac
14794
10bc17b6
JH
14795: see if gmtime_r exists
14796set gmtime_r d_gmtime_r
14797eval $inlibc
14798case "$d_gmtime_r" in
14799"$define")
d63eadf0 14800 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14801 case "$d_gmtime_r_proto:$usethreads" in
14802 ":define") d_gmtime_r_proto=define
a48ec845
JH
14803 set d_gmtime_r_proto gmtime_r $hdrs
14804 eval $hasproto ;;
14805 *) ;;
14806 esac
14807 case "$d_gmtime_r_proto" in
14808 define)
10bc17b6
JH
14809 case "$gmtime_r_proto" in
14810 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
61c26d18 14811 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
10bc17b6
JH
14812 esac
14813 case "$gmtime_r_proto" in
14814 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
61c26d18 14815 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
10bc17b6
JH
14816 esac
14817 case "$gmtime_r_proto" in
90e831dc 14818 ''|0) d_gmtime_r=undef
10bc17b6 14819 gmtime_r_proto=0
a48ec845 14820 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14821 * ) case "$gmtime_r_proto" in
14822 REENTRANT_PROTO*) ;;
14823 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14824 esac
14825 echo "Prototype: $try" ;;
14826 esac
b4eb6b3d 14827 ;;
c18e646a
JH
14828 *) case "$usethreads" in
14829 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14830 esac
90e831dc
SB
14831 d_gmtime_r=undef
14832 gmtime_r_proto=0
c18e646a 14833 ;;
a48ec845
JH
14834 esac
14835 ;;
10bc17b6 14836*) gmtime_r_proto=0
b4eb6b3d
JH
14837 ;;
14838esac
14839
14840: see if hasmntopt exists
14841set hasmntopt d_hasmntopt
14842eval $inlibc
14843
14844: see if this is a netinet/in.h or sys/in.h system
14845set netinet/in.h i_niin sys/in.h i_sysin
14846eval $inhdr
14847
14848: see if arpa/inet.h has to be included
14849set arpa/inet.h i_arpainet
14850eval $inhdr
14851
14852: see if htonl --and friends-- exists
14853val=''
14854set htonl val
14855eval $inlibc
14856
14857: Maybe they are macros.
14858case "$val" in
14859$undef)
14860 $cat >htonl.c <<EOM
14861#include <stdio.h>
14862#include <sys/types.h>
14863#$i_niin I_NETINET_IN
14864#$i_sysin I_SYS_IN
14865#$i_arpainet I_ARPA_INET
14866#ifdef I_NETINET_IN
14867#include <netinet/in.h>
14868#endif
14869#ifdef I_SYS_IN
14870#include <sys/in.h>
14871#endif
14872#ifdef I_ARPA_INET
14873#include <arpa/inet.h>
14874#endif
14875#ifdef htonl
14876printf("Defined as a macro.");
14877#endif
14878EOM
14879 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14880 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14881 val="$define"
14882 echo "But it seems to be defined as a macro." >&4
14883 fi
14884 $rm -f htonl.?
14885 ;;
14886esac
14887set d_htonl
14888eval $setvar
14889
36adc09b
JH
14890: see if ilogbl exists
14891set ilogbl d_ilogbl
14892eval $inlibc
14893
b4eb6b3d
JH
14894: index or strchr
14895echo " "
14896if set index val -f; eval $csym; $val; then
14897 if set strchr val -f d_strchr; eval $csym; $val; then
14898 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14899 val="$define"
14900 vali="$undef"
14901 echo "strchr() found." >&4
14902 else
14903 val="$undef"
14904 vali="$define"
14905 echo "index() found." >&4
14906 fi
14907 else
14908 val="$undef"
14909 vali="$define"
8dfa8df9
JH
14910 echo "index() found." >&4
14911 fi
b4eb6b3d 14912else
8dfa8df9
JH
14913 if set strchr val -f d_strchr; eval $csym; $val; then
14914 val="$define"
14915 vali="$undef"
14916 echo "strchr() found." >&4
14917 else
14918 echo "No index() or strchr() found!" >&4
14919 val="$undef"
14920 vali="$undef"
14921 fi
b4eb6b3d 14922fi
8dfa8df9
JH
14923set d_strchr; eval $setvar
14924val="$vali"
14925set d_index; eval $setvar
14926
14927: check whether inet_aton exists
14928set inet_aton d_inetaton
14929eval $inlibc
b4eb6b3d 14930
5086dff9
MB
14931: see if inet_ntop exists
14932set inet_ntop d_inetntop
14933eval $inlibc
14934
14935: see if inet_pton exists
14936set inet_pton d_inetpton
14937eval $inlibc
14938
b4eb6b3d
JH
14939: Look for isascii
14940echo " "
36adc09b 14941$cat >isascii.c <<EOCP
b4eb6b3d
JH
14942#include <stdio.h>
14943#include <ctype.h>
55954f19
JH
14944#$i_stdlib I_STDLIB
14945#ifdef I_STDLIB
14946#include <stdlib.h>
14947#endif
b4eb6b3d
JH
14948int main() {
14949 int c = 'A';
14950 if (isascii(c))
14951 exit(0);
14952 else
14953 exit(1);
14954}
14955EOCP
14956set isascii
14957if eval $compile; then
14958 echo "isascii() found." >&4
14959 val="$define"
14960else
14961 echo "isascii() NOT found." >&4
14962 val="$undef"
14963fi
14964set d_isascii
14965eval $setvar
14966$rm -f isascii*
14967
758a5d79
JH
14968: see if isfinite exists
14969set isfinite d_isfinite
14970eval $inlibc
14971
14972: see if isinf exists
14973set isinf d_isinf
14974eval $inlibc
14975
b4eb6b3d
JH
14976: see if isnan exists
14977set isnan d_isnan
14978eval $inlibc
14979
14980: see if isnanl exists
14981set isnanl d_isnanl
14982eval $inlibc
14983
14984: see if killpg exists
14985set killpg d_killpg
14986eval $inlibc
14987
14988: see if lchown exists
14989echo " "
14990$cat > try.c <<'EOCP'
14991/* System header to define __stub macros and hopefully few prototypes,
14992 which can conflict with char lchown(); below. */
14993#include <assert.h>
14994/* Override any gcc2 internal prototype to avoid an error. */
14995/* We use char because int might match the return type of a gcc2
14996 builtin and then its argument prototype would still apply. */
14997char lchown();
14998int main() {
14999 /* The GNU C library defines this for functions which it implements
15000 to always fail with ENOSYS. Some functions are actually named
15001 something starting with __ and the normal name is an alias. */
15002#if defined (__stub_lchown) || defined (__stub___lchown)
15003choke me
15004#else
15005lchown();
15006#endif
15007; return 0; }
15008EOCP
15009set try
15010if eval $compile; then
15011 $echo "lchown() found." >&4
15012 val="$define"
15013else
15014 $echo "lchown() NOT found." >&4
15015 val="$undef"
15016fi
15017set d_lchown
15018eval $setvar
15019
15020: See if number of significant digits in a double precision number is known
15021echo " "
15022$cat >ldbl_dig.c <<EOM
15023#$i_limits I_LIMITS
15024#$i_float I_FLOAT
15025#ifdef I_LIMITS
15026#include <limits.h>
15027#endif
15028#ifdef I_FLOAT
15029#include <float.h>
15030#endif
15031#ifdef LDBL_DIG
15032printf("Contains LDBL_DIG");
15033#endif
15034EOM
15035$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15036if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15037 echo "LDBL_DIG found." >&4
15038 val="$define"
15039else
15040 echo "LDBL_DIG NOT found." >&4
15041 val="$undef"
15042fi
15043$rm -f ldbl_dig.?
15044set d_ldbl_dig
15045eval $setvar
15046
0a0abfba
MB
15047: see if this is a math.h system
15048set math.h i_math
15049eval $inhdr
15050
613d6c3e 15051: check to see if math.h defines _LIB_VERSION
0a0abfba
MB
15052d_libm_lib_version="$undef"
15053case $i_math in
15054 $define)
0a0abfba
MB
15055 echo " "
15056 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15057 $cat >try.c <<EOCP
15058#include <unistd.h>
15059#include <math.h>
15060int main (int argc, char *argv[])
15061{
15062 printf ("%d\n", _LIB_VERSION);
15063 return (0);
15064 } /* main */
15065EOCP
15066 set try
15067 if eval $compile; then
15068 foo=`$run ./try`
15069 echo "Yes, it does ($foo)" >&4
15070 d_libm_lib_version="$define"
15071 else
4dd8f9b3 15072 echo "No, it does not (probably harmless)" >&4
0a0abfba 15073 fi
5b813a60 15074 $rm_try
0a0abfba
MB
15075 ;;
15076
15077 esac
15078
b4eb6b3d
JH
15079: see if link exists
15080set link d_link
15081eval $inlibc
15082
10bc17b6
JH
15083: see if localtime_r exists
15084set localtime_r d_localtime_r
15085eval $inlibc
15086case "$d_localtime_r" in
15087"$define")
d63eadf0 15088 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
15089 case "$d_localtime_r_proto:$usethreads" in
15090 ":define") d_localtime_r_proto=define
a48ec845
JH
15091 set d_localtime_r_proto localtime_r $hdrs
15092 eval $hasproto ;;
15093 *) ;;
15094 esac
15095 case "$d_localtime_r_proto" in
15096 define)
10bc17b6
JH
15097 case "$localtime_r_proto" in
15098 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
61c26d18 15099 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
10bc17b6
JH
15100 esac
15101 case "$localtime_r_proto" in
15102 ''|0) try='int localtime_r(const time_t*, struct tm*);'
61c26d18 15103 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
10bc17b6
JH
15104 esac
15105 case "$localtime_r_proto" in
90e831dc 15106 ''|0) d_localtime_r=undef
10bc17b6 15107 localtime_r_proto=0
a48ec845 15108 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15109 * ) case "$localtime_r_proto" in
15110 REENTRANT_PROTO*) ;;
15111 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15112 esac
15113 echo "Prototype: $try" ;;
15114 esac
15115 ;;
c18e646a
JH
15116 *) case "$usethreads" in
15117 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15118 esac
90e831dc
SB
15119 d_localtime_r=undef
15120 localtime_r_proto=0
c18e646a 15121 ;;
a48ec845
JH
15122 esac
15123 ;;
10bc17b6
JH
15124*) localtime_r_proto=0
15125 ;;
15126esac
15127
8572b25d
BH
15128: see if localtime_r calls tzset
15129case "$localtime_r_proto" in
15130REENTRANT_PROTO*)
15131 $cat >try.c <<EOCP
15132/* Does our libc's localtime_r call tzset ?
15133 * return 0 if so, 1 otherwise.
15134 */
61c26d18
MHM
15135#$i_systypes I_SYS_TYPES
15136#$i_unistd I_UNISTD
15137#$i_time I_TIME
15138#$i_stdlib I_STDLIB
15139#$i_string I_STRING
15140#$i_malloc I_MALLOC
15141#ifdef I_SYS_TYPES
15142# include <sys/types.h>
15143#endif
15144#ifdef I_UNISTD
15145# include <unistd.h>
15146#endif
15147#ifdef I_TIME
15148# include <time.h>
15149#endif
15150#ifdef I_STDLIB
15151#include <stdlib.h>
15152#endif
15153#ifdef I_STRING
15154# include <string.h>
15155#else
15156# include <strings.h>
15157#endif
15158#ifdef I_MALLOC
15159# include <malloc.h>
15160#endif
8572b25d
BH
15161int main()
15162{
15163 time_t t = time(0L);
15164 char w_tz[]="TZ" "=GMT+5",
15165 e_tz[]="TZ" "=GMT-5",
15166 *tz_e = (char*)malloc(16),
15167 *tz_w = (char*)malloc(16);
15168 struct tm tm_e, tm_w;
15169 memset(&tm_e,'\0',sizeof(struct tm));
15170 memset(&tm_w,'\0',sizeof(struct tm));
15171 strcpy(tz_e,e_tz);
15172 strcpy(tz_w,w_tz);
15173
15174 putenv(tz_e);
15175 localtime_r(&t, &tm_e);
15176
15177 putenv(tz_w);
15178 localtime_r(&t, &tm_w);
15179
15180 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15181 return 1;
15182 return 0;
15183}
15184EOCP
15185 set try
15186 if eval $compile; then
43dddb59 15187 if $run ./try; then
8572b25d
BH
15188 d_localtime_r_needs_tzset=undef;
15189 else
15190 d_localtime_r_needs_tzset=define;
15191 fi;
15192 else
15193 d_localtime_r_needs_tzset=undef;
15194 fi;
15195 ;;
15196 *)
15197 d_localtime_r_needs_tzset=undef;
15198 ;;
15199esac
5b813a60 15200$rm_try
8572b25d 15201
b4eb6b3d
JH
15202: see if localeconv exists
15203set localeconv d_locconv
15204eval $inlibc
15205
15206: see if lockf exists
15207set lockf d_lockf
15208eval $inlibc
15209
b4eb6b3d
JH
15210: see if prototype for lseek is available
15211echo " "
4786929f 15212set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
15213eval $hasproto
15214
15215: see if lstat exists
15216set lstat d_lstat
15217eval $inlibc
15218
15219: see if madvise exists
15220set madvise d_madvise
15221eval $inlibc
15222
7dd121ae
MB
15223: see if malloc_size exists
15224set malloc_size d_malloc_size
15225eval $inlibc
15226
15227: see if malloc_size_good exists
15228set malloc_good_size d_malloc_good_size
15229eval $inlibc
15230
b4eb6b3d
JH
15231: see if mblen exists
15232set mblen d_mblen
15233eval $inlibc
15234
15235: see if mbstowcs exists
15236set mbstowcs d_mbstowcs
15237eval $inlibc
15238
15239: see if mbtowc exists
15240set mbtowc d_mbtowc
15241eval $inlibc
15242
15243: see if memchr exists
15244set memchr d_memchr
15245eval $inlibc
15246
15247: see if memcmp exists
15248set memcmp d_memcmp
15249eval $inlibc
15250
15251: see if memcpy exists
15252set memcpy d_memcpy
15253eval $inlibc
15254
15255: see if memmove exists
15256set memmove d_memmove
15257eval $inlibc
15258
15259: see if memset exists
15260set memset d_memset
15261eval $inlibc
15262
15263: see if mkdir exists
15264set mkdir d_mkdir
15265eval $inlibc
15266
15267: see if mkdtemp exists
15268set mkdtemp d_mkdtemp
15269eval $inlibc
15270
15271: see if mkfifo exists
15272set mkfifo d_mkfifo
15273eval $inlibc
15274
15275: see if mkstemp exists
15276set mkstemp d_mkstemp
15277eval $inlibc
15278
15279: see if mkstemps exists
15280set mkstemps d_mkstemps
15281eval $inlibc
15282
15283: see if mktime exists
15284set mktime d_mktime
15285eval $inlibc
15286
15287: see if this is a sys/mman.h system
15288set sys/mman.h i_sysmman
15289eval $inhdr
15290
15291: see if mmap exists
15292set mmap d_mmap
15293eval $inlibc
15294: see what shmat returns
15295: default to something harmless
15296mmaptype='void *'
15297case "$i_sysmman$d_mmap" in
15298"$define$define")
15299 $cat >mmap.c <<'END'
15300#include <sys/mman.h>
15301void *mmap();
15302END
15303 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15304 mmaptype='void *'
15305 else
15306 mmaptype='caddr_t'
15307 fi
15308 echo "and it returns ($mmaptype)." >&4
15309 ;;
15310esac
15311
15312
15313
89ce900e
JH
15314: see if sqrtl exists
15315set sqrtl d_sqrtl
15316eval $inlibc
15317
af1ff193
JH
15318: see if scalbnl exists
15319set scalbnl d_scalbnl
15320eval $inlibc
15321
89ce900e
JH
15322: see if modfl exists
15323set modfl d_modfl
15324eval $inlibc
15325
15326: see if prototype for modfl is available
15327echo " "
3a794506 15328set d_modflproto modfl $i_math math.h
89ce900e
JH
15329eval $hasproto
15330
15331d_modfl_pow32_bug="$undef"
15332
15333case "$d_longdbl$d_modfl" in
15334$define$define)
15335 $cat <<EOM
15336Checking to see whether your modfl() is okay for large values...
15337EOM
15338$cat >try.c <<EOCP
5b813a60 15339#include <math.h>
89ce900e
JH
15340#include <stdio.h>
15341EOCP
15342if $test "X$d_modflproto" != "X$define"; then
15343 $cat >>try.c <<EOCP
5b813a60 15344/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
15345long double modfl (long double, long double *);
15346EOCP
15347fi
15348$cat >>try.c <<EOCP
15349int main() {
15350 long double nv = 4294967303.15;
15351 long double v, w;
5b813a60 15352 v = modfl(nv, &w);
89ce900e
JH
15353#ifdef __GLIBC__
15354 printf("glibc");
15355#endif
15356 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15357 return 0;
15358}
15359EOCP
15360 case "$osname:$gccversion" in
15361 aix:) saveccflags="$ccflags"
15362 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15363 esac
15364 set try
15365 if eval $compile; then
15366 foo=`$run ./try`
15367 case "$foo" in
15368 *" 4294967303.150000 1.150000 4294967302.000000")
15369 echo >&4 "Your modfl() is broken for large values."
15370 d_modfl_pow32_bug="$define"
15371 case "$foo" in
15372 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15373 ;;
15374 esac
15375 ;;
15376 *" 4294967303.150000 0.150000 4294967303.000000")
15377 echo >&4 "Your modfl() seems okay for large values."
15378 ;;
15379 *) echo >&4 "I don't understand your modfl() at all."
15380 d_modfl="$undef"
15381 ;;
15382 esac
5b813a60 15383 $rm_try
89ce900e
JH
15384 else
15385 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15386 d_modfl="$undef"
15387 fi
15388 case "$osname:$gccversion" in
15389 aix:) ccflags="$saveccflags" ;; # restore
15390 esac
15391 ;;
15392esac
15393
15394if $test "$uselongdouble" = "$define"; then
af1ff193
JH
15395 message=""
15396 if $test "$d_sqrtl" != "$define"; then
15397 message="$message sqrtl"
15398 fi
15399 if $test "$d_modfl" != "$define"; then
89ce900e
JH
15400 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15401 echo "You have both aintl and copysignl, so I can emulate modfl."
15402 else
af1ff193 15403 message="$message modfl"
89ce900e 15404 fi
af1ff193
JH
15405 fi
15406 if $test "$d_frexpl" != "$define"; then
15407 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15408 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15409 else
15410 message="$message frexpl"
15411 fi
15412 fi
89ce900e 15413
af1ff193 15414 if $test "$message" != ""; then
89ce900e
JH
15415 $cat <<EOM >&4
15416
15417*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15418*** the following mathematical functions needed for long double support:
15419*** $message
fe63a0b4
JH
15420*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15421*** Cannot continue, aborting.
89ce900e
JH
15422
15423EOM
15424
fe63a0b4 15425 exit 1
89ce900e
JH
15426 fi
15427fi
15428
b4eb6b3d
JH
15429: see if mprotect exists
15430set mprotect d_mprotect
15431eval $inlibc
15432
15433: see if msgctl exists
15434set msgctl d_msgctl
15435eval $inlibc
15436
15437: see if msgget exists
15438set msgget d_msgget
15439eval $inlibc
15440
15441: see if msgsnd exists
15442set msgsnd d_msgsnd
15443eval $inlibc
15444
15445: see if msgrcv exists
15446set msgrcv d_msgrcv
15447eval $inlibc
15448
15449: see how much of the 'msg*(2)' library is present.
15450h_msg=true
15451echo " "
15452case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15453*"$undef"*) h_msg=false;;
15454esac
15455case "$osname" in
15456freebsd)
15457 case "`ipcs 2>&1`" in
15458 "SVID messages"*"not configured"*)
15459 echo "Your $osname does not have the msg*(2) configured." >&4
15460 h_msg=false
15461 val="$undef"
15462 set msgctl d_msgctl
15463 eval $setvar
15464 set msgget d_msgget
15465 eval $setvar
15466 set msgsnd d_msgsnd
15467 eval $setvar
15468 set msgrcv d_msgrcv
15469 eval $setvar
15470 ;;
15471 esac
15472 ;;
15473esac
15474: we could also check for sys/ipc.h ...
15475if $h_msg && $test `./findhdr sys/msg.h`; then
15476 echo "You have the full msg*(2) library." >&4
15477 val="$define"
15478else
15479 echo "You don't have the full msg*(2) library." >&4
15480 val="$undef"
15481fi
15482set d_msg
15483eval $setvar
15484
34f1896b 15485: Check for msghdr_s
4e0554ec
JH
15486echo " "
15487echo "Checking to see if your system supports struct msghdr..." >&4
15488set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15489eval $hasstruct
15490case "$d_msghdr_s" in
15491"$define") echo "Yes, it does." ;;
15492*) echo "No, it doesn't." ;;
15493esac
15494
15495
b4eb6b3d
JH
15496: see if msync exists
15497set msync d_msync
15498eval $inlibc
15499
15500: see if munmap exists
15501set munmap d_munmap
15502eval $inlibc
15503
15504: see if nice exists
15505set nice d_nice
15506eval $inlibc
15507
2765b840
JH
15508: see if this is a langinfo.h system
15509set langinfo.h i_langinfo
15510eval $inhdr
15511
15512: see if nl_langinfo exists
15513set nl_langinfo d_nl_langinfo
15514eval $inlibc
15515
1d1be0dc
NC
15516: check for volatile keyword
15517echo " "
15518echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15519$cat >try.c <<'EOCP'
76f47787 15520int main()
1d1be0dc
NC
15521{
15522 typedef struct _goo_struct goo_struct;
15523 goo_struct * volatile goo = ((goo_struct *)0);
15524 struct _goo_struct {
15525 long long_int;
15526 int reg_int;
15527 char char_var;
15528 };
15529 typedef unsigned short foo_t;
15530 char *volatile foo;
15531 volatile int bar;
15532 volatile foo_t blech;
15533 foo = foo;
15534}
15535EOCP
15536if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15537 val="$define"
15538 echo "Yup, it does."
15539else
15540 val="$undef"
15541 echo "Nope, it doesn't."
15542fi
15543set d_volatile
15544eval $setvar
5b813a60 15545$rm_try
1d1be0dc 15546
613d6c3e 15547: Check basic sizes
b4eb6b3d
JH
15548echo " "
15549$echo "Choosing the C types to be used for Perl's internal types..." >&4
15550
15551case "$use64bitint:$d_quad:$quadtype" in
15552define:define:?*)
15553 ivtype="$quadtype"
15554 uvtype="$uquadtype"
15555 ivsize=8
15556 uvsize=8
15557 ;;
15558*) ivtype="long"
15559 uvtype="unsigned long"
15560 ivsize=$longsize
15561 uvsize=$longsize
15562 ;;
15563esac
15564
15565case "$uselongdouble:$d_longdbl" in
15566define:define)
15567 nvtype="long double"
15568 nvsize=$longdblsize
15569 ;;
15570*) nvtype=double
15571 nvsize=$doublesize
15572 ;;
15573esac
15574
15575$echo "(IV will be "$ivtype", $ivsize bytes)"
15576$echo "(UV will be "$uvtype", $uvsize bytes)"
15577$echo "(NV will be "$nvtype", $nvsize bytes)"
15578
15579$cat >try.c <<EOCP
15580#$i_inttypes I_INTTYPES
15581#ifdef I_INTTYPES
15582#include <inttypes.h>
15583#endif
15584#include <stdio.h>
15585int main() {
15586#ifdef INT8
15587 int8_t i = INT8_MAX;
15588 uint8_t u = UINT8_MAX;
15589 printf("int8_t\n");
15590#endif
15591#ifdef INT16
15592 int16_t i = INT16_MAX;
15593 uint16_t i = UINT16_MAX;
15594 printf("int16_t\n");
15595#endif
15596#ifdef INT32
15597 int32_t i = INT32_MAX;
15598 uint32_t u = UINT32_MAX;
15599 printf("int32_t\n");
15600#endif
15601}
15602EOCP
15603
13187456 15604i8type="signed char"
0ab0821a
MB
15605u8type="unsigned char"
15606i8size=1
15607u8size=1
b4eb6b3d
JH
15608
15609case "$i16type" in
15610'') case "$shortsize" in
15611 2) i16type=short
15612 u16type="unsigned short"
15613 i16size=$shortsize
15614 u16size=$shortsize
15615 ;;
15616 esac
15617 ;;
15618esac
15619case "$i16type" in
15620'') set try -DINT16
15621 if eval $compile; then
5440bc8e 15622 case "`$run ./try`" in
b4eb6b3d
JH
15623 int16_t)
15624 i16type=int16_t
15625 u16type=uint16_t
15626 i16size=2
15627 u16size=2
15628 ;;
15629 esac
15630 fi
15631 ;;
15632esac
15633case "$i16type" in
15634'') if $test $shortsize -ge 2; then
15635 i16type=short
15636 u16type="unsigned short"
15637 i16size=$shortsize
15638 u16size=$shortsize
15639 fi
15640 ;;
15641esac
15642
15643case "$i32type" in
15644'') case "$longsize" in
15645 4) i32type=long
15646 u32type="unsigned long"
15647 i32size=$longsize
15648 u32size=$longsize
15649 ;;
15650 *) case "$intsize" in
15651 4) i32type=int
15652 u32type="unsigned int"
15653 i32size=$intsize
15654 u32size=$intsize
15655 ;;
15656 esac
15657 ;;
15658 esac
15659 ;;
15660esac
15661case "$i32type" in
15662'') set try -DINT32
15663 if eval $compile; then
5440bc8e 15664 case "`$run ./try`" in
b4eb6b3d
JH
15665 int32_t)
15666 i32type=int32_t
15667 u32type=uint32_t
15668 i32size=4
15669 u32size=4
15670 ;;
15671 esac
15672 fi
15673 ;;
15674esac
15675case "$i32type" in
15676'') if $test $intsize -ge 4; then
15677 i32type=int
15678 u32type="unsigned int"
15679 i32size=$intsize
15680 u32size=$intsize
15681 fi
15682 ;;
15683esac
15684
15685case "$i64type" in
15686'') case "$d_quad:$quadtype" in
15687 define:?*)
15688 i64type="$quadtype"
15689 u64type="$uquadtype"
15690 i64size=8
15691 u64size=8
15692 ;;
15693 esac
15694 ;;
15695esac
15696
1d1be0dc
NC
15697$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15698: volatile so that the compiler has to store it out to memory.
15699if test X"$d_volatile" = X"$define"; then
15700 volatile=volatile
15701fi
b4eb6b3d
JH
15702$cat <<EOP >try.c
15703#include <stdio.h>
55954f19
JH
15704#$i_stdlib I_STDLIB
15705#ifdef I_STDLIB
15706#include <stdlib.h>
15707#endif
1d1be0dc
NC
15708#include <sys/types.h>
15709#include <signal.h>
15710#ifdef SIGFPE
15711$volatile int bletched = 0;
7090f861 15712$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15713#endif
b4eb6b3d
JH
15714int main() {
15715 $uvtype u = 0;
1d1be0dc 15716 $nvtype d;
b4eb6b3d
JH
15717 int n = 8 * $uvsize;
15718 int i;
1d1be0dc
NC
15719#ifdef SIGFPE
15720 signal(SIGFPE, blech);
15721#endif
15722
b4eb6b3d
JH
15723 for (i = 0; i < n; i++) {
15724 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15725 d = ($nvtype)u;
15726 if (($uvtype)d != u)
b4eb6b3d 15727 break;
1d1be0dc
NC
15728 if (d <= 0)
15729 break;
15730 d = ($nvtype)(u - 1);
15731 if (($uvtype)d != (u - 1))
15732 break;
15733#ifdef SIGFPE
22676560 15734 if (bletched)
1d1be0dc
NC
15735 break;
15736#endif
b4eb6b3d 15737 }
efd1522b 15738 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15739 exit(0);
15740}
15741EOP
1d1be0dc
NC
15742set try
15743
15744d_nv_preserves_uv="$undef"
15745if eval $compile; then
53133ed1 15746 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15747fi
53133ed1 15748case "$nv_preserves_uv_bits" in
5b813a60 15749\-[1-9]*)
53133ed1
NC
15750 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15751 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15752 d_nv_preserves_uv="$define"
b4eb6b3d 15753 ;;
53133ed1 15754[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15755 d_nv_preserves_uv="$undef" ;;
15756*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15757 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15758esac
5b813a60 15759$rm_try
1d1be0dc 15760
b68c599a
NC
15761$echo "Checking to find the largest integer value your NVs can hold..." >&4
15762: volatile so that the compiler has to store it out to memory.
15763if test X"$d_volatile" = X"$define"; then
15764 volatile=volatile
15765fi
15766$cat <<EOP >try.c
15767#include <stdio.h>
15768
15769typedef $nvtype NV;
15770
15771int
15772main() {
15773 NV value = 2;
15774 int count = 1;
15775
15776 while(count < 256) {
15777 $volatile NV up = value + 1.0;
15778 $volatile NV negated = -value;
15779 $volatile NV down = negated - 1.0;
15780 $volatile NV got_up = up - value;
15781 int up_good = got_up == 1.0;
15782 int got_down = down - negated;
15783 int down_good = got_down == -1.0;
15784
15785 if (down_good != up_good) {
15786 fprintf(stderr,
15787 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15788 up_good, (double) got_up, down_good, (double) got_down,
15789 count, (double) value);
15790 return 1;
15791 }
15792 if (!up_good) {
15793 while (1) {
15794 if (count > 8) {
15795 count -= 8;
15796 fputs("256.0", stdout);
15797 } else {
15798 count--;
15799 fputs("2.0", stdout);
15800 }
15801 if (!count) {
15802 puts("");
15803 return 0;
15804 }
15805 fputs("*", stdout);
15806 }
15807 }
15808 value *= 2;
15809 ++count;
15810 }
15811 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15812 count, (double) value);
15813 return 1;
15814}
15815EOP
15816set try
15817
15818nv_overflows_integers_at='0'
15819if eval $compile; then
15820 xxx="`$run ./try`"
15821 case "$?" in
15822 0)
15823 case "$xxx" in
15824 2*) cat >&4 <<EOM
15825The largest integer your NVs can preserve is equal to $xxx
15826EOM
15827 nv_overflows_integers_at="$xxx"
15828 ;;
15829 *) cat >&4 <<EOM
15830Cannot determine the largest integer value your NVs can hold, unexpected output
15831'$xxx'
15832EOM
15833 ;;
15834 esac
15835 ;;
15836 *) cat >&4 <<EOM
15837Cannot determine the largest integer value your NVs can hold
15838EOM
15839 ;;
15840 esac
15841fi
15842$rm_try
15843
f607920a
CB
15844$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15845: volatile so that the compiler has to store it out to memory.
15846if test X"$d_volatile" = X"$define"; then
15847 volatile=volatile
15848fi
15849$cat <<EOP >try.c
15850#include <stdio.h>
15851#$i_stdlib I_STDLIB
15852#ifdef I_STDLIB
15853#include <stdlib.h>
15854#endif
15855#$i_string I_STRING
15856#ifdef I_STRING
15857# include <string.h>
15858#else
15859# include <strings.h>
15860#endif
15861#include <sys/types.h>
15862#include <signal.h>
15863#ifdef SIGFPE
15864$volatile int bletched = 0;
7090f861 15865$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15866#endif
15867
15868int checkit($nvtype d, char *where) {
15869 unsigned char *p = (char *)&d;
15870 unsigned char *end = p + sizeof(d);
15871 int fail = 0;
15872
15873 while (p < end)
15874 fail += *p++;
15875
15876 if (!fail)
17f6277d 15877 return 0;
f607920a
CB
15878
15879 p = (char *)&d;
15880 printf("No - %s: 0x", where);
15881 while (p < end)
15882 printf ("%02X", *p++);
15883 printf("\n");
15884 return 1;
15885}
15886
15887int main(int argc, char **argv) {
15888 $nvtype d = 0.0;
15889 int fail = 0;
15890 fail += checkit(d, "0.0");
15891
15892 /* The compiler shouldn't be assuming that bletched is 0 */
15893 d = bletched;
15894
15895 fail += checkit(d, "bleched");
15896
15897#ifdef SIGFPE
15898 signal(SIGFPE, blech);
15899#endif
15900
15901 /* Paranoia - the compiler should have no way of knowing that ANSI says
15902 that argv[argc] will always be NULL. Actually, if it did assume this it
15903 would be buggy, as this is C and main() can be called from elsewhere in
15904 the program. */
15905 d = argv[argc] ? 1 : 0;
15906
15907 if (d) {
15908 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15909 }
15910
15911 fail += checkit(d, "ternary");
15912
15913 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15914
15915 if (d != 0.0) {
15916 printf("No - memset doesn't give 0.0\n");
15917 /* This might just blow up: */
15918 printf("(gives %g)\n", d);
15919 return 1;
15920 }
5b813a60 15921
f607920a
CB
15922#ifdef SIGFPE
15923 if (bletched) {
15924 printf("No - something bleched\n");
15925 return 1;
15926 }
15927#endif
15928 if (fail) {
15929 printf("No - %d fail(s)\n", fail);
15930 return 1;
15931 }
15932 printf("Yes\n");
15933 return 0;
15934}
15935EOP
15936set try
15937
15938d_nv_zero_is_allbits_zero="$undef"
15939if eval $compile; then
15940 xxx="`$run ./try`"
15941 case "$?" in
15942 0)
15943 case "$xxx" in
15944 Yes) cat >&4 <<EOM
159450.0 is represented as all bits zero in memory
15946EOM
15947 d_nv_zero_is_allbits_zero="$define"
15948 ;;
15949 *) cat >&4 <<EOM
159500.0 is not represented as all bits zero in memory
15951EOM
15952 d_nv_zero_is_allbits_zero="$undef"
15953 ;;
15954 esac
15955 ;;
15956 *) cat >&4 <<EOM
159570.0 is not represented as all bits zero in memory
15958EOM
15959 d_nv_zero_is_allbits_zero="$undef"
15960 ;;
15961 esac
15962fi
5b813a60 15963$rm_try
b4eb6b3d
JH
15964
15965: check for off64_t
15966echo " "
15967echo "Checking to see if you have off64_t..." >&4
15968$cat >try.c <<EOCP
15969#include <sys/types.h>
15970#include <unistd.h>
15971int main() { off64_t x = 7; }
15972EOCP
15973set try
15974if eval $compile; then
15975 val="$define"
15976 echo "You have off64_t."
15977else
15978 val="$undef"
15979 echo "You do not have off64_t."
15980 case "$lseeksize" in
15981 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15982 esac
15983fi
5b813a60 15984$rm_try
b4eb6b3d
JH
15985set d_off64_t
15986eval $setvar
15987
b4eb6b3d
JH
15988: how to create joinable pthreads
15989if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15990 echo " "
5b813a60 15991 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
15992 $cat >try.c <<'EOCP'
15993#include <pthread.h>
15994int main() {
15995 int detachstate = JOINABLE;
15996}
15997EOCP
15998 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15999 if eval $compile; then
16000 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16001 val="$undef" # Yes, undef.
16002 set d_old_pthread_create_joinable
16003 eval $setvar
16004 val=""
16005 set old_pthread_create_joinable
16006 eval $setvar
16007 else
16008 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16009 if eval $compile; then
16010 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16011 val="$define"
16012 set d_old_pthread_create_joinable
16013 eval $setvar
16014 val=PTHREAD_CREATE_UNDETACHED
16015 set old_pthread_create_joinable
16016 eval $setvar
5b813a60 16017 else
b4eb6b3d
JH
16018 set try -DJOINABLE=__UNDETACHED
16019 if eval $compile; then
16020 echo "You seem to use __UNDETACHED." >&4
16021 val="$define"
16022 set d_old_pthread_create_joinable
16023 eval $setvar
16024 val=__UNDETACHED
16025 set old_pthread_create_joinable
16026 eval $setvar
16027 else
16028 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
16029 val="$define"
16030 set d_old_pthread_create_joinable
16031 eval $setvar
16032 val=0
16033 set old_pthread_create_joinable
16034 eval $setvar
16035 fi
16036 fi
16037 fi
5b813a60 16038 $rm_try
b4eb6b3d
JH
16039else
16040 d_old_pthread_create_joinable="$undef"
16041 old_pthread_create_joinable=""
16042fi
16043
16044: see if pause exists
16045set pause d_pause
16046eval $inlibc
16047
b4eb6b3d
JH
16048: see if poll exists
16049set poll d_poll
16050eval $inlibc
16051
c7aff470
NIS
16052: see if readlink exists
16053set readlink d_readlink
16054eval $inlibc
16055
613d6c3e 16056: Check if exe is symlink to abs path of executing program
c7aff470 16057echo " "
f24dbf84 16058procselfexe=''
c7aff470 16059val="$undef"
a33c94aa
JH
16060case "$d_readlink" in
16061"$define")
c7aff470
NIS
16062 if $issymlink /proc/self/exe ; then
16063 $ls -l /proc/self/exe > reflect
51660ed5 16064 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 16065 echo "You have Linux-like /proc/self/exe."
92236451 16066 procselfexe='"/proc/self/exe"'
f24dbf84 16067 val="$define"
f24dbf84
JH
16068 fi
16069 fi
16070 if $issymlink /proc/curproc/file ; then
16071 $ls -l /proc/curproc/file > reflect
16072 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16073 echo "You have BSD-like /proc/curproc/file."
92236451 16074 procselfexe='"/proc/curproc/file"'
f24dbf84 16075 val="$define"
c7aff470 16076 fi
c7aff470 16077 fi
a33c94aa
JH
16078 ;;
16079esac
428dc699 16080$rm -f reflect
c7aff470
NIS
16081set d_procselfexe
16082eval $setvar
16083
233e16ce
MB
16084: backward compatibility for d_hvfork
16085if test X$d_hvfork != X; then
16086 d_vfork="$d_hvfork"
16087 d_hvfork=''
16088fi
16089: see if there is a vfork
16090val=''
16091set vfork val
16092eval $inlibc
16093
16094d_pseudofork=$undef
16095
16096: Ok, but do we want to use it. vfork is reportedly unreliable in
16097: perl on Solaris 2.x, and probably elsewhere.
16098case "$val" in
16099$define)
16100 echo " "
16101 case "$usevfork" in
16102 false) dflt='n';;
16103 *) dflt='y';;
16104 esac
16105 cat <<'EOM'
16106
16107Perl can only use a vfork() that doesn't suffer from strict
16108restrictions on calling functions or modifying global data in
16109the child. For example, glibc-2.1 contains such a vfork()
16110that is unsuitable. If your system provides a proper fork()
16111call, chances are that you do NOT want perl to use vfork().
16112
16113EOM
16114 rp="Do you still want to use vfork()?"
16115 . ./myread
16116 case "$ans" in
16117 y|Y) ;;
16118 *)
16119 echo "Ok, we won't use vfork()."
16120 val="$undef"
16121 ;;
16122 esac
16123 ;;
16124esac
16125set d_vfork
16126eval $setvar
16127case "$d_vfork" in
16128$define) usevfork='true';;
16129*) usevfork='false';;
16130esac
16131
263fee3f
JH
16132: see whether the pthread_atfork exists
16133$cat >try.c <<EOP
16134#include <pthread.h>
16135#include <stdio.h>
16136int main() {
16137#ifdef PTHREAD_ATFORK
16138 pthread_atfork(NULL,NULL,NULL);
16139#endif
16140}
16141EOP
16142
d6483fcc 16143: see if pthread_atfork exists
263fee3f
JH
16144set try -DPTHREAD_ATFORK
16145if eval $compile; then
16146 val="$define"
16147else
16148 val="$undef"
16149fi
16150case "$usethreads" in
16151$define)
16152 case "$val" in
16153 $define) echo 'pthread_atfork found.' >&4 ;;
16154 *) echo 'pthread_atfork NOT found.' >&4 ;;
16155 esac
16156esac
16157set d_pthread_atfork
16158eval $setvar
d6483fcc 16159
58d975c3
JH
16160: see if pthread_attr_setscope exists
16161set pthread_attr_setscope d_pthread_attr_setscope
16162eval $inlibc
16163
b4eb6b3d
JH
16164: see whether the various POSIXish _yields exist
16165$cat >try.c <<EOP
16166#include <pthread.h>
16167#include <stdio.h>
16168int main() {
16169#ifdef SCHED_YIELD
16170 sched_yield();
16171#else
16172#ifdef PTHREAD_YIELD
16173 pthread_yield();
16174#else
16175#ifdef PTHREAD_YIELD_NULL
16176 pthread_yield(NULL);
16177#endif
16178#endif
16179#endif
16180}
16181EOP
16182: see if sched_yield exists
16183set try -DSCHED_YIELD
16184if eval $compile; then
16185 val="$define"
16186 sched_yield='sched_yield()'
16187else
16188 val="$undef"
16189fi
16190case "$usethreads" in
16191$define)
16192 case "$val" in
16193 $define) echo 'sched_yield() found.' >&4 ;;
16194 *) echo 'sched_yield() NOT found.' >&4 ;;
16195 esac
16196esac
10bc17b6
JH
16197set d_sched_yield
16198eval $setvar
b4eb6b3d 16199
10bc17b6
JH
16200: see if pthread_yield exists
16201set try -DPTHREAD_YIELD
16202if eval $compile; then
16203 val="$define"
16204 case "$sched_yield" in
16205 '') sched_yield='pthread_yield()' ;;
16206 esac
16207else
16208 set try -DPTHREAD_YIELD_NULL
16209 if eval $compile; then
16210 val="$define"
16211 case "$sched_yield" in
16212 '') sched_yield='pthread_yield(NULL)' ;;
16213 esac
16214 else
16215 val="$undef"
16216 fi
16217fi
16218case "$usethreads" in
16219$define)
16220 case "$val" in
16221 $define) echo 'pthread_yield() found.' >&4 ;;
16222 *) echo 'pthread_yield() NOT found.' >&4 ;;
16223 esac
16224 ;;
16225esac
16226set d_pthread_yield
16227eval $setvar
10bc17b6
JH
16228case "$sched_yield" in
16229'') sched_yield=undef ;;
16230esac
5b813a60 16231$rm_try
10bc17b6
JH
16232
16233: see if random_r exists
16234set random_r d_random_r
16235eval $inlibc
16236case "$d_random_r" in
16237"$define")
16238 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16239 case "$d_random_r_proto:$usethreads" in
16240 ":define") d_random_r_proto=define
a48ec845
JH
16241 set d_random_r_proto random_r $hdrs
16242 eval $hasproto ;;
16243 *) ;;
16244 esac
16245 case "$d_random_r_proto" in
16246 define)
10bc17b6
JH
16247 case "$random_r_proto" in
16248 ''|0) try='int random_r(int*, struct random_data*);'
61c26d18 16249 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
a845a0d4
JH
16250 esac
16251 case "$random_r_proto" in
16252 ''|0) try='int random_r(long*, struct random_data*);'
61c26d18 16253 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
a845a0d4
JH
16254 esac
16255 case "$random_r_proto" in
16256 ''|0) try='int random_r(struct random_data*, int32_t*);'
61c26d18 16257 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
16258 esac
16259 case "$random_r_proto" in
90e831dc 16260 ''|0) d_random_r=undef
10bc17b6 16261 random_r_proto=0
a48ec845 16262 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16263 * ) case "$random_r_proto" in
16264 REENTRANT_PROTO*) ;;
16265 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16266 esac
16267 echo "Prototype: $try" ;;
16268 esac
b4eb6b3d 16269 ;;
c18e646a
JH
16270 *) case "$usethreads" in
16271 define) echo "random_r has no prototype, not using it." >&4 ;;
16272 esac
90e831dc
SB
16273 d_random_r=undef
16274 random_r_proto=0
c18e646a 16275 ;;
a48ec845
JH
16276 esac
16277 ;;
10bc17b6 16278*) random_r_proto=0
b4eb6b3d
JH
16279 ;;
16280esac
16281
16282: see if readdir and friends exist
16283set readdir d_readdir
16284eval $inlibc
16285set seekdir d_seekdir
16286eval $inlibc
16287set telldir d_telldir
16288eval $inlibc
16289set rewinddir d_rewinddir
16290eval $inlibc
16291
10bc17b6
JH
16292: see if readdir64_r exists
16293set readdir64_r d_readdir64_r
16294eval $inlibc
16295case "$d_readdir64_r" in
16296"$define")
16297 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16298 case "$d_readdir64_r_proto:$usethreads" in
16299 ":define") d_readdir64_r_proto=define
a48ec845
JH
16300 set d_readdir64_r_proto readdir64_r $hdrs
16301 eval $hasproto ;;
16302 *) ;;
16303 esac
16304 case "$d_readdir64_r_proto" in
16305 define)
10bc17b6
JH
16306 case "$readdir64_r_proto" in
16307 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
61c26d18 16308 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
10bc17b6
JH
16309 esac
16310 case "$readdir64_r_proto" in
16311 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
61c26d18 16312 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
10bc17b6
JH
16313 esac
16314 case "$readdir64_r_proto" in
90e831dc 16315 ''|0) d_readdir64_r=undef
10bc17b6 16316 readdir64_r_proto=0
a48ec845 16317 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16318 * ) case "$readdir64_r_proto" in
16319 REENTRANT_PROTO*) ;;
16320 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16321 esac
16322 echo "Prototype: $try" ;;
16323 esac
16324 ;;
c18e646a
JH
16325 *) case "$usethreads" in
16326 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16327 esac
90e831dc
SB
16328 d_readdir64_r=undef
16329 readdir64_r_proto=0
c18e646a 16330 ;;
a48ec845
JH
16331 esac
16332 ;;
10bc17b6
JH
16333*) readdir64_r_proto=0
16334 ;;
16335esac
16336
16337: see if readdir_r exists
16338set readdir_r d_readdir_r
16339eval $inlibc
16340case "$d_readdir_r" in
16341"$define")
16342 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16343 case "$d_readdir_r_proto:$usethreads" in
16344 ":define") d_readdir_r_proto=define
a48ec845
JH
16345 set d_readdir_r_proto readdir_r $hdrs
16346 eval $hasproto ;;
16347 *) ;;
16348 esac
16349 case "$d_readdir_r_proto" in
16350 define)
10bc17b6
JH
16351 case "$readdir_r_proto" in
16352 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
61c26d18 16353 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
10bc17b6
JH
16354 esac
16355 case "$readdir_r_proto" in
16356 ''|0) try='int readdir_r(DIR*, struct dirent*);'
61c26d18 16357 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
10bc17b6
JH
16358 esac
16359 case "$readdir_r_proto" in
90e831dc 16360 ''|0) d_readdir_r=undef
10bc17b6 16361 readdir_r_proto=0
a48ec845 16362 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16363 * ) case "$readdir_r_proto" in
16364 REENTRANT_PROTO*) ;;
16365 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16366 esac
16367 echo "Prototype: $try" ;;
16368 esac
16369 ;;
c18e646a
JH
16370 *) case "$usethreads" in
16371 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16372 esac
90e831dc
SB
16373 d_readdir_r=undef
16374 readdir_r_proto=0
c18e646a 16375 ;;
a48ec845
JH
16376 esac
16377 ;;
10bc17b6
JH
16378*) readdir_r_proto=0
16379 ;;
16380esac
16381
4e0554ec
JH
16382: see if readv exists
16383set readv d_readv
16384eval $inlibc
16385
16386: see if recvmsg exists
16387set recvmsg d_recvmsg
16388eval $inlibc
16389
b4eb6b3d
JH
16390: see if rename exists
16391set rename d_rename
16392eval $inlibc
16393
16394: see if rmdir exists
16395set rmdir d_rmdir
16396eval $inlibc
16397
16398: see if memory.h is available.
16399val=''
16400set memory.h val
16401eval $inhdr
16402
16403: See if it conflicts with string.h
16404case "$val" in
16405$define)
16406 case "$strings" in
16407 '') ;;
16408 *)
16409 $cppstdin $cppflags $cppminus < $strings > mem.h
16410 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16411 echo " "
16412 echo "We won't be including <memory.h>."
16413 val="$undef"
16414 fi
16415 $rm -f mem.h
16416 ;;
16417 esac
16418esac
16419set i_memory
16420eval $setvar
16421
16422: can bcopy handle overlapping blocks?
b6cc3bc4 16423echo " "
b4eb6b3d 16424val="$undef"
b6cc3bc4
AD
16425case "$d_memmove" in
16426"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16427*) case "$d_bcopy" in
16428 "$define")
16429 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16430 $cat >try.c <<EOCP
b4eb6b3d
JH
16431#$i_memory I_MEMORY
16432#$i_stdlib I_STDLIB
16433#$i_string I_STRING
16434#$i_unistd I_UNISTD
16435EOCP
16436 $cat >>try.c <<'EOCP'
16437#include <stdio.h>
16438#ifdef I_MEMORY
16439# include <memory.h>
16440#endif
16441#ifdef I_STDLIB
16442# include <stdlib.h>
16443#endif
16444#ifdef I_STRING
16445# include <string.h>
16446#else
16447# include <strings.h>
16448#endif
16449#ifdef I_UNISTD
16450# include <unistd.h> /* Needed for NetBSD */
16451#endif
16452int main()
16453{
16454char buf[128], abc[128];
16455char *b;
16456int len;
16457int off;
16458int align;
16459
b6cc3bc4
AD
16460/* Copy "abcde..." string to char abc[] so that gcc doesn't
16461 try to store the string in read-only memory. */
b4eb6b3d
JH
16462bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16463
16464for (align = 7; align >= 0; align--) {
16465 for (len = 36; len; len--) {
16466 b = buf+align;
16467 bcopy(abc, b, len);
16468 for (off = 1; off <= len; off++) {
16469 bcopy(b, b+off, len);
16470 bcopy(b+off, b, len);
16471 if (bcmp(b, abc, len))
16472 exit(1);
16473 }
16474 }
16475}
16476exit(0);
16477}
16478EOCP
b6cc3bc4
AD
16479 set try
16480 if eval $compile_ok; then
43dddb59 16481 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16482 echo "Yes, it can."
16483 val="$define"
16484 else
16485 echo "It can't, sorry."
16486 fi
b4eb6b3d 16487 else
b6cc3bc4 16488 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16489 fi
b6cc3bc4
AD
16490 ;;
16491 esac
5b813a60 16492 $rm_try
b4eb6b3d
JH
16493 ;;
16494esac
b4eb6b3d
JH
16495set d_safebcpy
16496eval $setvar
16497
16498: can memcpy handle overlapping blocks?
b6cc3bc4 16499echo " "
b4eb6b3d 16500val="$undef"
b6cc3bc4
AD
16501case "$d_memmove" in
16502"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16503*) case "$d_memcpy" in
16504 "$define")
16505 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16506 $cat >try.c <<EOCP
b4eb6b3d
JH
16507#$i_memory I_MEMORY
16508#$i_stdlib I_STDLIB
16509#$i_string I_STRING
16510#$i_unistd I_UNISTD
16511EOCP
16512 $cat >>try.c <<'EOCP'
16513#include <stdio.h>
16514#ifdef I_MEMORY
16515# include <memory.h>
16516#endif
16517#ifdef I_STDLIB
16518# include <stdlib.h>
16519#endif
16520#ifdef I_STRING
16521# include <string.h>
16522#else
16523# include <strings.h>
16524#endif
16525#ifdef I_UNISTD
16526# include <unistd.h> /* Needed for NetBSD */
16527#endif
16528int main()
16529{
16530char buf[128], abc[128];
16531char *b;
16532int len;
16533int off;
16534int align;
16535
16536/* Copy "abcde..." string to char abc[] so that gcc doesn't
16537 try to store the string in read-only memory. */
16538memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16539
16540for (align = 7; align >= 0; align--) {
16541 for (len = 36; len; len--) {
16542 b = buf+align;
16543 memcpy(b, abc, len);
16544 for (off = 1; off <= len; off++) {
16545 memcpy(b+off, b, len);
16546 memcpy(b, b+off, len);
16547 if (memcmp(b, abc, len))
16548 exit(1);
16549 }
16550 }
16551}
16552exit(0);
16553}
16554EOCP
b6cc3bc4
AD
16555 set try
16556 if eval $compile_ok; then
43dddb59 16557 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16558 echo "Yes, it can."
16559 val="$define"
16560 else
16561 echo "It can't, sorry."
16562 fi
b4eb6b3d 16563 else
b6cc3bc4 16564 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16565 fi
b6cc3bc4
AD
16566 ;;
16567 esac
5b813a60 16568 $rm_try
b4eb6b3d
JH
16569 ;;
16570esac
b4eb6b3d
JH
16571set d_safemcpy
16572eval $setvar
16573
16574: can memcmp be trusted to compare relative magnitude?
16575val="$undef"
16576case "$d_memcmp" in
16577"$define")
16578 echo " "
16579 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16580 $cat >try.c <<EOCP
16581#$i_memory I_MEMORY
16582#$i_stdlib I_STDLIB
16583#$i_string I_STRING
16584#$i_unistd I_UNISTD
16585EOCP
16586 $cat >>try.c <<'EOCP'
16587#include <stdio.h>
16588#ifdef I_MEMORY
16589# include <memory.h>
16590#endif
16591#ifdef I_STDLIB
36adc09b 16592# include <stdlib.h>
b4eb6b3d
JH
16593#endif
16594#ifdef I_STRING
16595# include <string.h>
16596#else
16597# include <strings.h>
16598#endif
16599#ifdef I_UNISTD
16600# include <unistd.h> /* Needed for NetBSD */
16601#endif
16602int main()
16603{
16604char a = -1;
16605char b = 0;
16606if ((a < b) && memcmp(&a, &b, 1) < 0)
16607 exit(1);
16608exit(0);
16609}
16610EOCP
16611 set try
16612 if eval $compile_ok; then
5440bc8e 16613 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16614 echo "Yes, it can."
16615 val="$define"
16616 else
16617 echo "No, it can't (it uses signed chars)."
16618 fi
16619 else
16620 echo "(I can't compile the test program, so we'll assume not...)"
16621 fi
16622 ;;
16623esac
5b813a60 16624$rm_try
b4eb6b3d
JH
16625set d_sanemcmp
16626eval $setvar
16627
ef9f17be
JH
16628: see if prototype for sbrk is available
16629echo " "
16630set d_sbrkproto sbrk $i_unistd unistd.h
16631eval $hasproto
16632
b4eb6b3d
JH
16633: see if select exists
16634set select d_select
16635eval $inlibc
16636
16637: see if semctl exists
16638set semctl d_semctl
16639eval $inlibc
16640
16641: see if semget exists
16642set semget d_semget
16643eval $inlibc
16644
16645: see if semop exists
16646set semop d_semop
16647eval $inlibc
16648
16649: see how much of the 'sem*(2)' library is present.
16650h_sem=true
16651echo " "
16652case "$d_semctl$d_semget$d_semop" in
16653*"$undef"*) h_sem=false;;
16654esac
16655case "$osname" in
16656freebsd)
16657 case "`ipcs 2>&1`" in
16658 "SVID messages"*"not configured"*)
16659 echo "Your $osname does not have the sem*(2) configured." >&4
16660 h_sem=false
16661 val="$undef"
16662 set semctl d_semctl
16663 eval $setvar
16664 set semget d_semget
16665 eval $setvar
16666 set semop d_semop
16667 eval $setvar
16668 ;;
16669 esac
16670 ;;
16671esac
16672: we could also check for sys/ipc.h ...
16673if $h_sem && $test `./findhdr sys/sem.h`; then
16674 echo "You have the full sem*(2) library." >&4
16675 val="$define"
16676else
16677 echo "You don't have the full sem*(2) library." >&4
16678 val="$undef"
16679fi
16680set d_sem
16681eval $setvar
16682
16683: see whether sys/sem.h defines union semun
16684echo " "
16685$cat > try.c <<'END'
16686#include <sys/types.h>
16687#include <sys/ipc.h>
16688#include <sys/sem.h>
16689int main () { union semun semun; semun.buf = 0; }
16690END
16691set try
16692if eval $compile; then
16693 echo "You have union semun in <sys/sem.h>." >&4
16694 val="$define"
16695else
16696 echo "You do not have union semun in <sys/sem.h>." >&4
16697 val="$undef"
16698fi
5b813a60 16699$rm_try
b4eb6b3d
JH
16700set d_union_semun
16701eval $setvar
16702
16703: see how to do semctl IPC_STAT
16704case "$d_sem" in
16705$define)
b4eb6b3d 16706 echo " "
93451a0d 16707 $cat > tryh.h <<END
b4eb6b3d
JH
16708#ifndef S_IRUSR
16709# ifdef S_IREAD
16710# define S_IRUSR S_IREAD
16711# define S_IWUSR S_IWRITE
16712# define S_IXUSR S_IEXEC
16713# else
16714# define S_IRUSR 0400
16715# define S_IWUSR 0200
16716# define S_IXUSR 0100
16717# endif
16718# define S_IRGRP (S_IRUSR>>3)
16719# define S_IWGRP (S_IWUSR>>3)
16720# define S_IXGRP (S_IXUSR>>3)
16721# define S_IROTH (S_IRUSR>>6)
16722# define S_IWOTH (S_IWUSR>>6)
16723# define S_IXOTH (S_IXUSR>>6)
16724#endif
16725#ifndef S_IRWXU
16726# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16727# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16728# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16729#endif
16730END
2fad75a1 16731 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16732 case "$d_semctl_semun" in
16733 '')
35918792 16734 val="$undef"
2fad75a1 16735 $cat > try.c <<END
b4eb6b3d
JH
16736#include <sys/types.h>
16737#include <sys/ipc.h>
16738#include <sys/sem.h>
16739#include <sys/stat.h>
16740#include <stdio.h>
16741#include <errno.h>
93451a0d 16742#include "tryh.h"
b4eb6b3d
JH
16743#ifndef errno
16744extern int errno;
16745#endif
16746#$d_union_semun HAS_UNION_SEMUN
16747int main() {
16748 union semun
16749#ifndef HAS_UNION_SEMUN
16750 {
16751 int val;
16752 struct semid_ds *buf;
16753 unsigned short *array;
16754 }
16755#endif
16756 arg;
16757 int sem, st;
16758
16759#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16760 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16761 if (sem > -1) {
16762 struct semid_ds argbuf;
16763 arg.buf = &argbuf;
16764# ifdef IPC_STAT
16765 st = semctl(sem, 0, IPC_STAT, arg);
16766 if (st == 0)
16767 printf("semun\n");
16768 else
16769# endif /* IPC_STAT */
16770 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16771# ifdef IPC_RMID
16772 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16773# endif /* IPC_RMID */
b4eb6b3d
JH
16774 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16775 } else
16776#endif /* IPC_PRIVATE && ... */
16777 printf("semget failed: errno = %d\n", errno);
16778 return 0;
16779}
16780END
2fad75a1
JH
16781 set try
16782 if eval $compile; then
16783 xxx=`$run ./try`
16784 case "$xxx" in
16785 semun) val="$define" ;;
16786 esac
16787 fi
5b813a60 16788 $rm_try
35918792
YST
16789 set d_semctl_semun
16790 eval $setvar
2fad75a1
JH
16791 ;;
16792 esac
b4eb6b3d
JH
16793 case "$d_semctl_semun" in
16794 $define)
16795 echo "You can use union semun for semctl IPC_STAT." >&4
16796 also='also'
16797 ;;
16798 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16799 also=''
16800 ;;
16801 esac
16802
16803 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16804 case "$d_semctl_semid_ds" in
16805 '')
35918792 16806 val="$undef"
2fad75a1 16807 $cat > try.c <<'END'
b4eb6b3d
JH
16808#include <sys/types.h>
16809#include <sys/ipc.h>
16810#include <sys/sem.h>
16811#include <sys/stat.h>
93451a0d 16812#include "tryh.h"
b4eb6b3d
JH
16813#include <stdio.h>
16814#include <errno.h>
16815#ifndef errno
16816extern int errno;
16817#endif
16818int main() {
16819 struct semid_ds arg;
16820 int sem, st;
16821
16822#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16823 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16824 if (sem > -1) {
16825# ifdef IPC_STAT
16826 st = semctl(sem, 0, IPC_STAT, &arg);
16827 if (st == 0)
16828 printf("semid_ds\n");
16829 else
16830# endif /* IPC_STAT */
16831 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16832# ifdef IPC_RMID
16833 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16834# endif /* IPC_RMID */
16835 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16836 } else
16837#endif /* IPC_PRIVATE && ... */
16838 printf("semget failed: errno = %d\n", errno);
16839
16840 return 0;
16841}
16842END
2fad75a1
JH
16843 set try
16844 if eval $compile; then
16845 xxx=`$run ./try`
16846 case "$xxx" in
16847 semid_ds) val="$define" ;;
16848 esac
16849 fi
5b813a60 16850 $rm_try
35918792
YST
16851 set d_semctl_semid_ds
16852 eval $setvar
2fad75a1
JH
16853 ;;
16854 esac
b4eb6b3d
JH
16855 case "$d_semctl_semid_ds" in
16856 $define)
16857 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16858 ;;
16859 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16860 ;;
16861 esac
b4eb6b3d
JH
16862 ;;
16863*) val="$undef"
16864
16865 # We do not have the full sem*(2) library, so assume we can not
16866 # use either.
16867
16868 set d_semctl_semun
16869 eval $setvar
16870
16871 set d_semctl_semid_ds
16872 eval $setvar
16873 ;;
16874esac
93451a0d 16875$rm_try tryh.h
b4eb6b3d 16876
4e0554ec
JH
16877: see if sendmsg exists
16878set sendmsg d_sendmsg
16879eval $inlibc
16880
b4eb6b3d
JH
16881: see if setegid exists
16882set setegid d_setegid
16883eval $inlibc
16884
16885: see if seteuid exists
16886set seteuid d_seteuid
16887eval $inlibc
16888
16889: see if setgrent exists
16890set setgrent d_setgrent
16891eval $inlibc
16892
10bc17b6
JH
16893: see if setgrent_r exists
16894set setgrent_r d_setgrent_r
16895eval $inlibc
16896case "$d_setgrent_r" in
16897"$define")
16898 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16899 case "$d_setgrent_r_proto:$usethreads" in
16900 ":define") d_setgrent_r_proto=define
a48ec845
JH
16901 set d_setgrent_r_proto setgrent_r $hdrs
16902 eval $hasproto ;;
16903 *) ;;
16904 esac
16905 case "$d_setgrent_r_proto" in
16906 define)
10bc17b6
JH
16907 case "$setgrent_r_proto" in
16908 ''|0) try='int setgrent_r(FILE**);'
61c26d18 16909 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
10bc17b6
JH
16910 esac
16911 case "$setgrent_r_proto" in
16912 ''|0) try='void setgrent_r(FILE**);'
61c26d18 16913 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
10bc17b6
JH
16914 esac
16915 case "$setgrent_r_proto" in
90e831dc 16916 ''|0) d_setgrent_r=undef
10bc17b6 16917 setgrent_r_proto=0
a48ec845 16918 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16919 * ) case "$setgrent_r_proto" in
16920 REENTRANT_PROTO*) ;;
16921 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16922 esac
16923 echo "Prototype: $try" ;;
16924 esac
16925 ;;
c18e646a
JH
16926 *) case "$usethreads" in
16927 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16928 esac
90e831dc
SB
16929 d_setgrent_r=undef
16930 setgrent_r_proto=0
c18e646a 16931 ;;
a48ec845
JH
16932 esac
16933 ;;
10bc17b6
JH
16934*) setgrent_r_proto=0
16935 ;;
16936esac
16937
b4eb6b3d
JH
16938: see if sethostent exists
16939set sethostent d_sethent
16940eval $inlibc
16941
10bc17b6
JH
16942: see if sethostent_r exists
16943set sethostent_r d_sethostent_r
16944eval $inlibc
16945case "$d_sethostent_r" in
16946"$define")
16947 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16948 case "$d_sethostent_r_proto:$usethreads" in
16949 ":define") d_sethostent_r_proto=define
a48ec845
JH
16950 set d_sethostent_r_proto sethostent_r $hdrs
16951 eval $hasproto ;;
16952 *) ;;
16953 esac
16954 case "$d_sethostent_r_proto" in
16955 define)
10bc17b6
JH
16956 case "$sethostent_r_proto" in
16957 ''|0) try='int sethostent_r(int, struct hostent_data*);'
61c26d18 16958 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
10bc17b6
JH
16959 esac
16960 case "$sethostent_r_proto" in
16961 ''|0) try='void sethostent_r(int, struct hostent_data*);'
61c26d18 16962 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
10bc17b6
JH
16963 esac
16964 case "$sethostent_r_proto" in
90e831dc 16965 ''|0) d_sethostent_r=undef
10bc17b6 16966 sethostent_r_proto=0
a48ec845 16967 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16968 * ) case "$sethostent_r_proto" in
16969 REENTRANT_PROTO*) ;;
16970 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16971 esac
16972 echo "Prototype: $try" ;;
16973 esac
16974 ;;
c18e646a
JH
16975 *) case "$usethreads" in
16976 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16977 esac
90e831dc
SB
16978 d_sethostent_r=undef
16979 sethostent_r_proto=0
c18e646a 16980 ;;
a48ec845
JH
16981 esac
16982 ;;
10bc17b6
JH
16983*) sethostent_r_proto=0
16984 ;;
16985esac
16986
4e0554ec
JH
16987: see if setitimer exists
16988set setitimer d_setitimer
16989eval $inlibc
16990
b4eb6b3d
JH
16991: see if setlinebuf exists
16992set setlinebuf d_setlinebuf
16993eval $inlibc
16994
16995: see if setlocale exists
16996set setlocale d_setlocale
16997eval $inlibc
16998
10bc17b6
JH
16999: see if locale.h is available
17000set locale.h i_locale
17001eval $inhdr
17002
17003: see if setlocale_r exists
17004set setlocale_r d_setlocale_r
17005eval $inlibc
17006case "$d_setlocale_r" in
17007"$define")
17008 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
17009 case "$d_setlocale_r_proto:$usethreads" in
17010 ":define") d_setlocale_r_proto=define
a48ec845
JH
17011 set d_setlocale_r_proto setlocale_r $hdrs
17012 eval $hasproto ;;
17013 *) ;;
17014 esac
17015 case "$d_setlocale_r_proto" in
17016 define)
10bc17b6
JH
17017 case "$setlocale_r_proto" in
17018 ''|0) try='int setlocale_r(int, const char*, char*, int);'
61c26d18 17019 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
10bc17b6
JH
17020 esac
17021 case "$setlocale_r_proto" in
90e831dc 17022 ''|0) d_setlocale_r=undef
10bc17b6 17023 setlocale_r_proto=0
a48ec845 17024 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17025 * ) case "$setlocale_r_proto" in
17026 REENTRANT_PROTO*) ;;
17027 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17028 esac
17029 echo "Prototype: $try" ;;
17030 esac
17031 ;;
c18e646a
JH
17032 *) case "$usethreads" in
17033 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17034 esac
90e831dc
SB
17035 d_setlocale_r=undef
17036 setlocale_r_proto=0
c18e646a 17037 ;;
a48ec845
JH
17038 esac
17039 ;;
10bc17b6
JH
17040*) setlocale_r_proto=0
17041 ;;
17042esac
17043
b4eb6b3d
JH
17044: see if setnetent exists
17045set setnetent d_setnent
17046eval $inlibc
17047
10bc17b6
JH
17048: see if setnetent_r exists
17049set setnetent_r d_setnetent_r
17050eval $inlibc
17051case "$d_setnetent_r" in
17052"$define")
17053 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17054 case "$d_setnetent_r_proto:$usethreads" in
17055 ":define") d_setnetent_r_proto=define
a48ec845
JH
17056 set d_setnetent_r_proto setnetent_r $hdrs
17057 eval $hasproto ;;
17058 *) ;;
17059 esac
17060 case "$d_setnetent_r_proto" in
17061 define)
10bc17b6
JH
17062 case "$setnetent_r_proto" in
17063 ''|0) try='int setnetent_r(int, struct netent_data*);'
61c26d18 17064 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
10bc17b6
JH
17065 esac
17066 case "$setnetent_r_proto" in
17067 ''|0) try='void setnetent_r(int, struct netent_data*);'
61c26d18 17068 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
10bc17b6
JH
17069 esac
17070 case "$setnetent_r_proto" in
90e831dc 17071 ''|0) d_setnetent_r=undef
10bc17b6 17072 setnetent_r_proto=0
a48ec845 17073 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17074 * ) case "$setnetent_r_proto" in
17075 REENTRANT_PROTO*) ;;
17076 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17077 esac
17078 echo "Prototype: $try" ;;
17079 esac
17080 ;;
c18e646a
JH
17081 *) case "$usethreads" in
17082 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17083 esac
90e831dc
SB
17084 d_setnetent_r=undef
17085 setnetent_r_proto=0
c18e646a 17086 ;;
a48ec845
JH
17087 esac
17088 ;;
10bc17b6
JH
17089*) setnetent_r_proto=0
17090 ;;
17091esac
17092
b4eb6b3d
JH
17093: see if setprotoent exists
17094set setprotoent d_setpent
17095eval $inlibc
17096
17097: see if setpgid exists
17098set setpgid d_setpgid
17099eval $inlibc
17100
17101: see if setpgrp2 exists
17102set setpgrp2 d_setpgrp2
17103eval $inlibc
17104
17105: see if setpriority exists
17106set setpriority d_setprior
17107eval $inlibc
17108
17109: see if setproctitle exists
17110set setproctitle d_setproctitle
17111eval $inlibc
17112
10bc17b6
JH
17113: see if setprotoent_r exists
17114set setprotoent_r d_setprotoent_r
17115eval $inlibc
17116case "$d_setprotoent_r" in
17117"$define")
17118 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17119 case "$d_setprotoent_r_proto:$usethreads" in
17120 ":define") d_setprotoent_r_proto=define
a48ec845
JH
17121 set d_setprotoent_r_proto setprotoent_r $hdrs
17122 eval $hasproto ;;
17123 *) ;;
17124 esac
17125 case "$d_setprotoent_r_proto" in
17126 define)
10bc17b6
JH
17127 case "$setprotoent_r_proto" in
17128 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
61c26d18 17129 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
10bc17b6
JH
17130 esac
17131 case "$setprotoent_r_proto" in
17132 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
61c26d18 17133 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
10bc17b6
JH
17134 esac
17135 case "$setprotoent_r_proto" in
90e831dc 17136 ''|0) d_setprotoent_r=undef
10bc17b6 17137 setprotoent_r_proto=0
a48ec845 17138 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17139 * ) case "$setprotoent_r_proto" in
17140 REENTRANT_PROTO*) ;;
17141 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17142 esac
17143 echo "Prototype: $try" ;;
17144 esac
17145 ;;
c18e646a
JH
17146 *) case "$usethreads" in
17147 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17148 esac
90e831dc
SB
17149 d_setprotoent_r=undef
17150 setprotoent_r_proto=0
c18e646a 17151 ;;
a48ec845
JH
17152 esac
17153 ;;
10bc17b6
JH
17154*) setprotoent_r_proto=0
17155 ;;
17156esac
17157
b4eb6b3d
JH
17158: see if setpwent exists
17159set setpwent d_setpwent
17160eval $inlibc
17161
10bc17b6
JH
17162: see if setpwent_r exists
17163set setpwent_r d_setpwent_r
17164eval $inlibc
17165case "$d_setpwent_r" in
17166"$define")
17167 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
17168 case "$d_setpwent_r_proto:$usethreads" in
17169 ":define") d_setpwent_r_proto=define
a48ec845
JH
17170 set d_setpwent_r_proto setpwent_r $hdrs
17171 eval $hasproto ;;
17172 *) ;;
17173 esac
17174 case "$d_setpwent_r_proto" in
17175 define)
10bc17b6
JH
17176 case "$setpwent_r_proto" in
17177 ''|0) try='int setpwent_r(FILE**);'
61c26d18 17178 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
10bc17b6
JH
17179 esac
17180 case "$setpwent_r_proto" in
17181 ''|0) try='void setpwent_r(FILE**);'
61c26d18 17182 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
10bc17b6
JH
17183 esac
17184 case "$setpwent_r_proto" in
90e831dc 17185 ''|0) d_setpwent_r=undef
10bc17b6 17186 setpwent_r_proto=0
a48ec845 17187 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17188 * ) case "$setpwent_r_proto" in
17189 REENTRANT_PROTO*) ;;
17190 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17191 esac
17192 echo "Prototype: $try" ;;
17193 esac
17194 ;;
c18e646a
JH
17195 *) case "$usethreads" in
17196 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17197 esac
90e831dc
SB
17198 d_setpwent_r=undef
17199 setpwent_r_proto=0
c18e646a 17200 ;;
a48ec845
JH
17201 esac
17202 ;;
10bc17b6
JH
17203*) setpwent_r_proto=0
17204 ;;
17205esac
17206
b4eb6b3d
JH
17207: see if setregid exists
17208set setregid d_setregid
17209eval $inlibc
17210set setresgid d_setresgid
17211eval $inlibc
17212
17213: see if setreuid exists
17214set setreuid d_setreuid
17215eval $inlibc
17216set setresuid d_setresuid
17217eval $inlibc
17218
17219: see if setrgid exists
17220set setrgid d_setrgid
17221eval $inlibc
17222
17223: see if setruid exists
17224set setruid d_setruid
17225eval $inlibc
17226
17227: see if setservent exists
17228set setservent d_setsent
17229eval $inlibc
17230
10bc17b6
JH
17231: see if setservent_r exists
17232set setservent_r d_setservent_r
17233eval $inlibc
17234case "$d_setservent_r" in
17235"$define")
17236 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17237 case "$d_setservent_r_proto:$usethreads" in
17238 ":define") d_setservent_r_proto=define
a48ec845
JH
17239 set d_setservent_r_proto setservent_r $hdrs
17240 eval $hasproto ;;
17241 *) ;;
17242 esac
17243 case "$d_setservent_r_proto" in
17244 define)
10bc17b6
JH
17245 case "$setservent_r_proto" in
17246 ''|0) try='int setservent_r(int, struct servent_data*);'
61c26d18 17247 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
10bc17b6
JH
17248 esac
17249 case "$setservent_r_proto" in
17250 ''|0) try='void setservent_r(int, struct servent_data*);'
61c26d18 17251 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
10bc17b6
JH
17252 esac
17253 case "$setservent_r_proto" in
90e831dc 17254 ''|0) d_setservent_r=undef
10bc17b6 17255 setservent_r_proto=0
a48ec845 17256 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17257 * ) case "$setservent_r_proto" in
17258 REENTRANT_PROTO*) ;;
17259 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17260 esac
17261 echo "Prototype: $try" ;;
17262 esac
17263 ;;
c18e646a
JH
17264 *) case "$usethreads" in
17265 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17266 esac
90e831dc
SB
17267 d_setservent_r=undef
17268 setservent_r_proto=0
c18e646a 17269 ;;
a48ec845
JH
17270 esac
17271 ;;
10bc17b6
JH
17272*) setservent_r_proto=0
17273 ;;
17274esac
17275
b4eb6b3d
JH
17276: see if setsid exists
17277set setsid d_setsid
17278eval $inlibc
17279
17280: see if setvbuf exists
17281set setvbuf d_setvbuf
17282eval $inlibc
17283
17284: see if sfio.h is available
17285set sfio.h i_sfio
17286eval $inhdr
17287
b4eb6b3d
JH
17288: see if sfio library is available
17289case "$i_sfio" in
17290$define)
17291 val=''
17292 set sfreserve val
17293 eval $inlibc
17294 ;;
17295*)
17296 val="$undef"
17297 ;;
17298esac
17299: Ok, but do we want to use it.
17300case "$val" in
17301$define)
17302 case "$usesfio" in
17303 true|$define|[yY]*) dflt='y';;
17304 *) dflt='n';;
17305 esac
17306 echo "$package can use the sfio library, but it is experimental."
17307 case "$useperlio" in
17308 "$undef")
17309 echo "For sfio also the PerlIO abstraction layer is needed."
17310 echo "Earlier you said you wouldn't want that."
17311 ;;
17312 esac
17313 rp="You seem to have sfio available, do you want to try using it?"
17314 . ./myread
17315 case "$ans" in
17316 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
17317 useperlio="$define"
17318 val="$define"
17319 ;;
17320 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
17321 val="$undef"
b4eb6b3d
JH
17322 ;;
17323 esac
17324 ;;
17325*) case "$usesfio" in
17326 true|$define|[yY]*)
17327 echo "Sorry, cannot find sfio on this machine." >&4
17328 echo "Ignoring your setting of usesfio=$usesfio." >&4
17329 val="$undef"
17330 ;;
17331 esac
17332 ;;
17333esac
17334set d_sfio
17335eval $setvar
17336case "$d_sfio" in
17337$define) usesfio='true';;
17338*) usesfio='false';;
17339esac
3659ebf1
JH
17340case "$d_sfio" in
17341$define) ;;
17342*) : Remove sfio from list of libraries to use
7483f793
JH
17343 case "$libs" in
17344 *-lsfio*)
17345 echo "Removing unneeded -lsfio from library list" >&4
17346 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17347 shift
17348 libs="$*"
17349 echo "libs = $libs" >&4
17350 ;;
17351 esac
3659ebf1
JH
17352;;
17353esac
17354
b4eb6b3d
JH
17355
17356: see if shmctl exists
17357set shmctl d_shmctl
17358eval $inlibc
17359
17360: see if shmget exists
17361set shmget d_shmget
17362eval $inlibc
17363
17364: see if shmat exists
17365set shmat d_shmat
17366eval $inlibc
17367: see what shmat returns
17368case "$d_shmat" in
17369"$define")
17370 $cat >shmat.c <<'END'
17371#include <sys/shm.h>
17372void *shmat();
17373END
17374 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17375 shmattype='void *'
17376 else
17377 shmattype='char *'
17378 fi
17379 echo "and it returns ($shmattype)." >&4
17380 : see if a prototype for shmat is available
17381 xxx=`./findhdr sys/shm.h`
17382 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17383 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17384 val="$define"
17385 else
17386 val="$undef"
17387 fi
17388 $rm -f shmat.[co]
17389 ;;
17390*)
17391 val="$undef"
17392 ;;
17393esac
17394set d_shmatprototype
17395eval $setvar
17396
17397: see if shmdt exists
17398set shmdt d_shmdt
17399eval $inlibc
17400
17401: see how much of the 'shm*(2)' library is present.
17402h_shm=true
17403echo " "
17404case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17405*"$undef"*) h_shm=false;;
17406esac
17407case "$osname" in
17408freebsd)
17409 case "`ipcs 2>&1`" in
17410 "SVID shared memory"*"not configured"*)
17411 echo "Your $osname does not have the shm*(2) configured." >&4
17412 h_shm=false
17413 val="$undef"
17414 set shmctl d_shmctl
17415 evat $setvar
17416 set shmget d_shmget
17417 evat $setvar
17418 set shmat d_shmat
17419 evat $setvar
17420 set shmdt d_shmdt
17421 evat $setvar
17422 ;;
17423 esac
17424 ;;
17425esac
17426: we could also check for sys/ipc.h ...
17427if $h_shm && $test `./findhdr sys/shm.h`; then
17428 echo "You have the full shm*(2) library." >&4
17429 val="$define"
17430else
17431 echo "You don't have the full shm*(2) library." >&4
17432 val="$undef"
17433fi
17434set d_shm
17435eval $setvar
17436
b4eb6b3d 17437: see if we have sigaction
613d6c3e 17438echo " "
b4eb6b3d
JH
17439if set sigaction val -f d_sigaction; eval $csym; $val; then
17440 echo 'sigaction() found.' >&4
073b6de5 17441 $cat > try.c <<EOP
b4eb6b3d
JH
17442#include <stdio.h>
17443#include <sys/types.h>
17444#include <signal.h>
073b6de5
JH
17445#$i_stdlib I_STDLIB
17446#ifdef I_STDLIB
17447#include <stdlib.h>
17448#endif
b4eb6b3d
JH
17449int main()
17450{
17451 struct sigaction act, oact;
17452 act.sa_flags = 0;
17453 oact.sa_handler = 0;
17454 /* so that act and oact are used */
17455 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17456}
17457EOP
17458 set try
17459 if eval $compile_ok; then
17460 val="$define"
17461 else
17462 echo "But you don't seem to have a useable struct sigaction." >&4
17463 val="$undef"
17464 fi
17465else
17466 echo 'sigaction NOT found.' >&4
17467 val="$undef"
17468fi
17469set d_sigaction; eval $setvar
5b813a60 17470$rm_try
b4eb6b3d 17471
ed140128
AD
17472: see if this is a sunmath.h system
17473set sunmath.h i_sunmath
17474eval $inhdr
17475
17476: see if signbit exists
17477$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17478$cat >try.c <<EOCP
17479#$i_math I_MATH
17480#$i_sunmath I_SUNMATH
17481#ifdef I_MATH
17482# include <math.h>
17483#endif
17484#ifdef I_SUNMATH /* Solaris special math library */
17485# include <sunmath.h>
17486#endif
17487#define NV $nvtype
17488int main(int argc, char **argv)
17489{
17490 NV x = 0.0;
17491 NV y = -0.0;
17492 if ((signbit(x) == 0) && (signbit(y) != 0))
17493 return 0;
17494 else
17495 return 1;
17496}
17497EOCP
17498val="$undef"
17499set try
17500if eval $compile; then
17501 if $run ./try; then
17502 $echo "Yes." >&4
17503 val="$define"
17504 else
17505 $echo "Signbit seems to be available, but doesn't work as I expected."
17506 $echo "I won't use it." >&4
17507 val="$undef"
17508 fi
17509else
17510 $echo "Nope." >&4
17511 dflt="$undef"
17512fi
17513set d_signbit
17514eval $setvar
5b813a60 17515$rm_try
ed140128 17516
983dbef6
JH
17517: see if sigprocmask exists
17518set sigprocmask d_sigprocmask
17519eval $inlibc
17520
b4eb6b3d
JH
17521: see if sigsetjmp exists
17522echo " "
17523case "$d_sigsetjmp" in
17524'')
c727eafa 17525 $cat >try.c <<EOP
b4eb6b3d 17526#include <setjmp.h>
d1daaddf
JH
17527#$i_stdlib I_STDLIB
17528#ifdef I_STDLIB
17529#include <stdlib.h>
17530#endif
b4eb6b3d
JH
17531sigjmp_buf env;
17532int set = 1;
17533int main()
17534{
17535 if (sigsetjmp(env,1))
17536 exit(set);
17537 set = 0;
17538 siglongjmp(env, 1);
17539 exit(1);
17540}
17541EOP
17542 set try
17543 if eval $compile; then
5440bc8e 17544 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17545 echo "POSIX sigsetjmp found." >&4
17546 val="$define"
17547 else
17548 $cat >&4 <<EOM
17549Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17550I'll ignore them.
17551EOM
17552 val="$undef"
17553 fi
17554 else
17555 echo "sigsetjmp not found." >&4
17556 val="$undef"
17557 fi
17558 ;;
17559*) val="$d_sigsetjmp"
17560 case "$d_sigsetjmp" in
17561 $define) echo "POSIX sigsetjmp found." >&4;;
17562 $undef) echo "sigsetjmp not found." >&4;;
17563 esac
17564 ;;
17565esac
17566set d_sigsetjmp
17567eval $setvar
5b813a60 17568$rm_try
b4eb6b3d 17569
4f5da3e9
SP
17570: see if snprintf exists
17571set snprintf d_snprintf
17572eval $inlibc
17573
17574: see if vsnprintf exists
17575set vsnprintf d_vsnprintf
17576eval $inlibc
17577
2478f7a0
MB
17578case "$d_snprintf-$d_vsnprintf" in
17579"$define-$define")
17580 $cat <<EOM
17581Checking whether your snprintf() and vsnprintf() work okay...
17582EOM
17583 $cat >try.c <<'EOCP'
17584/* v?snprintf testing logic courtesy of Russ Allbery.
17585 * According to C99:
17586 * - if the buffer is too short it still must be \0-terminated
17587 * - if the buffer is too short the potentially required length
17588 * must be returned and not -1
17589 * - if the buffer is NULL the potentially required length
17590 * must be returned and not -1 or core dump
17591 */
17592#include <stdio.h>
17593#include <stdarg.h>
17594
17595char buf[2];
17596
17597int test (char *format, ...)
17598{
17599 va_list args;
17600 int count;
17601
17602 va_start (args, format);
17603 count = vsnprintf (buf, sizeof buf, format, args);
17604 va_end (args);
17605 return count;
17606}
17607
17608int main ()
17609{
17610 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17611 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17612}
17613EOCP
17614 set try
17615 if eval $compile; then
17616 `$run ./try`
17617 case "$?" in
17618 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17619 *) cat <<EOM >&4
17620Your snprintf() and snprintf() don't seem to be working okay.
17621EOM
17622 d_snprintf="$undef"
17623 d_vsnprintf="$undef"
17624 ;;
17625 esac
17626 else
17627 echo "(I can't seem to compile the test program--assuming they don't)"
17628 d_snprintf="$undef"
17629 d_vsnprintf="$undef"
17630 fi
5b813a60 17631 $rm_try
2478f7a0
MB
17632 ;;
17633esac
17634
49a78c82
JH
17635: see if sockatmark exists
17636set sockatmark d_sockatmark
17637eval $inlibc
17638
2ef53570
JH
17639: see if prototype for sockatmark is available
17640echo " "
17641set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17642eval $hasproto
17643
b4eb6b3d
JH
17644: see if socks5_init exists
17645set socks5_init d_socks5_init
17646eval $inlibc
17647
360321b3
YST
17648: see if sprintf returns the length of the string in the buffer as per ANSI
17649$echo "Checking whether sprintf returns the length of the string..." >&4
17650$cat <<EOP >try.c
17651#include <stdio.h>
17652#$i_stdlib I_STDLIB
17653#ifdef I_STDLIB
17654#include <stdlib.h>
17655#endif
17656#$i_string I_STRING
17657#ifdef I_STRING
17658# include <string.h>
17659#else
17660# include <strings.h>
17661#endif
17662#$i_math I_MATH
17663#ifdef I_MATH
17664#include <math.h>
17665#endif
17666
17667char buffer[256];
17668
17669int check (size_t expect, int test) {
17670 size_t got = strlen(buffer);
17671 if (expect == got)
17672 return 0;
17673
17674 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17675 test, buffer);
17676 exit (test);
17677}
17678
17679int main(int argc, char **argv) {
17680 int test = 0;
17681
17682 check(sprintf(buffer, ""), ++test);
17683 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17684 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17685
17686 return 0;
17687}
17688EOP
17689set try
17690
360321b3
YST
17691if eval $compile; then
17692 xxx="`$run ./try`"
17693 case "$?" in
17694 0) cat >&4 <<EOM
17695sprintf returns the length of the string (as ANSI says it should)
17696EOM
17697 d_sprintf_returns_strlen="$define"
17698 ;;
17699 *) cat >&4 <<EOM
17700sprintf does not return the length of the string (how old is this system?)
17701EOM
17702 d_sprintf_returns_strlen="$undef"
17703 ;;
17704 esac
d2821e72 17705else
36a30365
JH
17706 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17707 d_sprintf_returns_strlen="$undef"
360321b3 17708fi
5b813a60 17709$rm_try
360321b3 17710
10bc17b6
JH
17711: see if srand48_r exists
17712set srand48_r d_srand48_r
17713eval $inlibc
17714case "$d_srand48_r" in
17715"$define")
17716 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17717 case "$d_srand48_r_proto:$usethreads" in
17718 ":define") d_srand48_r_proto=define
a48ec845
JH
17719 set d_srand48_r_proto srand48_r $hdrs
17720 eval $hasproto ;;
17721 *) ;;
17722 esac
17723 case "$d_srand48_r_proto" in
17724 define)
10bc17b6
JH
17725 case "$srand48_r_proto" in
17726 ''|0) try='int srand48_r(long, struct drand48_data*);'
61c26d18 17727 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
10bc17b6
JH
17728 esac
17729 case "$srand48_r_proto" in
90e831dc 17730 ''|0) d_srand48_r=undef
10bc17b6 17731 srand48_r_proto=0
a48ec845 17732 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17733 * ) case "$srand48_r_proto" in
17734 REENTRANT_PROTO*) ;;
17735 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17736 esac
17737 echo "Prototype: $try" ;;
17738 esac
17739 ;;
c18e646a
JH
17740 *) case "$usethreads" in
17741 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17742 esac
90e831dc
SB
17743 d_srand48_r=undef
17744 srand48_r_proto=0
c18e646a 17745 ;;
a48ec845
JH
17746 esac
17747 ;;
10bc17b6
JH
17748*) srand48_r_proto=0
17749 ;;
17750esac
17751
17752: see if srandom_r exists
17753set srandom_r d_srandom_r
17754eval $inlibc
17755case "$d_srandom_r" in
17756"$define")
17757 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17758 case "$d_srandom_r_proto:$usethreads" in
17759 ":define") d_srandom_r_proto=define
a48ec845
JH
17760 set d_srandom_r_proto srandom_r $hdrs
17761 eval $hasproto ;;
17762 *) ;;
17763 esac
17764 case "$d_srandom_r_proto" in
17765 define)
10bc17b6
JH
17766 case "$srandom_r_proto" in
17767 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
61c26d18 17768 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
10bc17b6
JH
17769 esac
17770 case "$srandom_r_proto" in
90e831dc 17771 ''|0) d_srandom_r=undef
10bc17b6 17772 srandom_r_proto=0
a48ec845 17773 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17774 * ) case "$srandom_r_proto" in
17775 REENTRANT_PROTO*) ;;
17776 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17777 esac
17778 echo "Prototype: $try" ;;
17779 esac
17780 ;;
c18e646a
JH
17781 *) case "$usethreads" in
17782 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17783 esac
90e831dc
SB
17784 d_srandom_r=undef
17785 srandom_r_proto=0
c18e646a 17786 ;;
a48ec845
JH
17787 esac
17788 ;;
10bc17b6
JH
17789*) srandom_r_proto=0
17790 ;;
17791esac
17792
eef837ea
JH
17793: see if prototype for setresgid is available
17794echo " "
17795set d_sresgproto setresgid $i_unistd unistd.h
17796eval $hasproto
17797
640374d0
JH
17798: see if prototype for setresuid is available
17799echo " "
17800set d_sresuproto setresuid $i_unistd unistd.h
17801eval $hasproto
17802
b4eb6b3d
JH
17803: see if sys/stat.h is available
17804set sys/stat.h i_sysstat
17805eval $inhdr
17806
b4eb6b3d
JH
17807: see if stat knows about block sizes
17808echo " "
17809echo "Checking to see if your struct stat has st_blocks field..." >&4
17810set d_statblks stat st_blocks $i_sysstat sys/stat.h
17811eval $hasfield
17812
b4eb6b3d
JH
17813: see if this is a sys/vfs.h system
17814set sys/vfs.h i_sysvfs
17815eval $inhdr
17816
b4eb6b3d
JH
17817: see if this is a sys/statfs.h system
17818set sys/statfs.h i_sysstatfs
17819eval $inhdr
17820
34f1896b 17821: Check for statfs_s
b4eb6b3d
JH
17822echo " "
17823echo "Checking to see if your system supports struct statfs..." >&4
17824set 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
17825eval $hasstruct
17826case "$d_statfs_s" in
17827"$define") echo "Yes, it does." ;;
17828*) echo "No, it doesn't." ;;
17829esac
17830
17831
b4eb6b3d
JH
17832: see if struct statfs knows about f_flags
17833case "$d_statfs_s" in
34f1896b 17834define)
b4eb6b3d
JH
17835 echo " "
17836 echo "Checking to see if your struct statfs has f_flags field..." >&4
17837 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
17838 eval $hasfield
17839 ;;
17840*) val="$undef"
17841 set d_statfs_f_flags
17842 eval $setvar
17843 ;;
17844esac
17845case "$d_statfs_f_flags" in
17846"$define") echo "Yes, it does." ;;
17847*) echo "No, it doesn't." ;;
17848esac
17849
613d6c3e 17850: Check stream access
b4eb6b3d
JH
17851$cat >&4 <<EOM
17852Checking how to access stdio streams by file descriptor number...
17853EOM
17854case "$stdio_stream_array" in
17855'') $cat >try.c <<EOCP
17856#include <stdio.h>
17857int main() {
17858 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17859 printf("yes\n");
17860}
17861EOCP
17862 for s in _iob __iob __sF
17863 do
17864 set try -DSTDIO_STREAM_ARRAY=$s
17865 if eval $compile; then
5440bc8e 17866 case "`$run ./try`" in
b4eb6b3d
JH
17867 yes) stdio_stream_array=$s; break ;;
17868 esac
17869 fi
17870 done
5b813a60 17871 $rm_try
b4eb6b3d
JH
17872esac
17873case "$stdio_stream_array" in
17874'') $cat >&4 <<EOM
17875I can't figure out how to access stdio streams by file descriptor number.
17876EOM
17877 d_stdio_stream_array="$undef"
17878 ;;
17879*) $cat >&4 <<EOM
17880You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17881EOM
17882 d_stdio_stream_array="$define"
17883 ;;
17884esac
17885
17886: see if strcoll exists
17887set strcoll d_strcoll
17888eval $inlibc
17889
17890: check for structure copying
17891echo " "
17892echo "Checking to see if your C compiler can copy structs..." >&4
17893$cat >try.c <<'EOCP'
76f47787 17894int main()
b4eb6b3d
JH
17895{
17896 struct blurfl {
17897 int dyick;
17898 } foo, bar;
17899
17900 foo = bar;
17901}
17902EOCP
17903if $cc -c try.c >/dev/null 2>&1 ; then
17904 val="$define"
17905 echo "Yup, it can."
17906else
17907 val="$undef"
17908 echo "Nope, it can't."
17909fi
17910set d_strctcpy
17911eval $setvar
5b813a60 17912$rm_try
b4eb6b3d
JH
17913
17914: see if strerror and/or sys_errlist[] exist
17915echo " "
17916if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17917 if set strerror val -f d_strerror; eval $csym; $val; then
17918 echo 'strerror() found.' >&4
17919 d_strerror="$define"
17920 d_strerrm='strerror(e)'
17921 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17922 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17923 d_syserrlst="$define"
17924 else
17925 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17926 d_syserrlst="$undef"
17927 fi
17928 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17929 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17930 echo 'strerror() found in string header.' >&4
17931 d_strerror="$define"
17932 d_strerrm='strerror(e)'
17933 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17934 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17935 d_syserrlst="$define"
17936 else
17937 echo "(You don't appear to have any sys_errlist[], how can this be?)"
17938 d_syserrlst="$undef"
17939 fi
17940 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17941 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17942 d_strerror="$undef"
17943 d_syserrlst="$define"
17944 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17945 else
17946 echo 'strerror() and sys_errlist[] NOT found.' >&4
17947 d_strerror="$undef"
17948 d_syserrlst="$undef"
17949 d_strerrm='"unknown"'
17950 fi
17951fi
17952
10bc17b6
JH
17953: see if strerror_r exists
17954set strerror_r d_strerror_r
17955eval $inlibc
17956case "$d_strerror_r" in
17957"$define")
17958 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
17959 case "$d_strerror_r_proto:$usethreads" in
17960 ":define") d_strerror_r_proto=define
a48ec845
JH
17961 set d_strerror_r_proto strerror_r $hdrs
17962 eval $hasproto ;;
17963 *) ;;
17964 esac
17965 case "$d_strerror_r_proto" in
17966 define)
10bc17b6
JH
17967 case "$strerror_r_proto" in
17968 ''|0) try='int strerror_r(int, char*, size_t);'
61c26d18 17969 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
10bc17b6
JH
17970 esac
17971 case "$strerror_r_proto" in
17972 ''|0) try='int strerror_r(int, char*, int);'
61c26d18 17973 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
10bc17b6
JH
17974 esac
17975 case "$strerror_r_proto" in
17976 ''|0) try='char* strerror_r(int, char*, size_t);'
61c26d18 17977 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
10bc17b6
JH
17978 esac
17979 case "$strerror_r_proto" in
90e831dc 17980 ''|0) d_strerror_r=undef
10bc17b6 17981 strerror_r_proto=0
a48ec845 17982 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17983 * ) case "$strerror_r_proto" in
17984 REENTRANT_PROTO*) ;;
17985 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17986 esac
17987 echo "Prototype: $try" ;;
17988 esac
17989 ;;
c18e646a
JH
17990 *) case "$usethreads" in
17991 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17992 esac
90e831dc
SB
17993 d_strerror_r=undef
17994 strerror_r_proto=0
c18e646a 17995 ;;
a48ec845
JH
17996 esac
17997 ;;
10bc17b6
JH
17998*) strerror_r_proto=0
17999 ;;
18000esac
18001
b3c85772
JH
18002: see if strftime exists
18003set strftime d_strftime
18004eval $inlibc
18005
08c92000
MB
18006: see if strlcat exists
18007set strlcat d_strlcat
18008eval $inlibc
18009
18010: see if strlcpy exists
18011set strlcpy d_strlcpy
18012eval $inlibc
18013
b4eb6b3d
JH
18014: see if strtod exists
18015set strtod d_strtod
18016eval $inlibc
18017
18018: see if strtol exists
18019set strtol d_strtol
18020eval $inlibc
18021
18022: see if strtold exists
18023set strtold d_strtold
18024eval $inlibc
18025
18026: see if strtoll exists
18027set strtoll d_strtoll
18028eval $inlibc
18029
18030case "$d_longlong-$d_strtoll" in
18031"$define-$define")
18032 $cat <<EOM
18033Checking whether your strtoll() works okay...
18034EOM
18035 $cat >try.c <<'EOCP'
18036#include <errno.h>
18037#ifdef __hpux
18038#define strtoll __strtoll
18039#endif
e75931a7
YST
18040#ifdef __EMX__
18041#define strtoll _strtoll
18042#endif
b4eb6b3d 18043#include <stdio.h>
613d6c3e 18044extern long long int strtoll(char *s, char **, int);
b4eb6b3d
JH
18045static int bad = 0;
18046int check(char *s, long long ell, int een) {
18047 long long gll;
18048 errno = 0;
18049 gll = strtoll(s, 0, 10);
18050 if (!((gll == ell) && (errno == een)))
18051 bad++;
18052}
18053int main() {
18054 check(" 1", 1LL, 0);
18055 check(" 0", 0LL, 0);
18056 check("-1", -1LL, 0);
18057 check("-9223372036854775808", -9223372036854775808LL, 0);
18058 check("-9223372036854775808", -9223372036854775808LL, 0);
18059 check(" 9223372036854775807", 9223372036854775807LL, 0);
18060 check("-9223372036854775808", -9223372036854775808LL, 0);
18061 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
18062 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18063 if (!bad)
18064 printf("ok\n");
18065}
18066EOCP
18067 set try
18068 if eval $compile; then
5440bc8e 18069 yyy=`$run ./try`
e75931a7 18070 case "$yyy" in
b4eb6b3d
JH
18071 ok) echo "Your strtoll() seems to be working okay." ;;
18072 *) cat <<EOM >&4
18073Your strtoll() doesn't seem to be working okay.
18074EOM
18075 d_strtoll="$undef"
18076 ;;
69eadf66 18077 esac
e75931a7
YST
18078 else
18079 echo "(I can't seem to compile the test program--assuming it doesn't)"
18080 d_strtoll="$undef"
b4eb6b3d
JH
18081 fi
18082 ;;
18083esac
18084
28e5dec8
JH
18085: see if strtoq exists
18086set strtoq d_strtoq
18087eval $inlibc
18088
b4eb6b3d
JH
18089: see if strtoul exists
18090set strtoul d_strtoul
18091eval $inlibc
18092
d0e6d399
NC
18093case "$d_strtoul" in
18094"$define")
18095 $cat <<EOM
18096Checking whether your strtoul() works okay...
18097EOM
18098 $cat >try.c <<'EOCP'
18099#include <errno.h>
18100#include <stdio.h>
613d6c3e 18101extern unsigned long int strtoul(char *s, char **, int);
d0e6d399
NC
18102static int bad = 0;
18103void check(char *s, unsigned long eul, int een) {
18104 unsigned long gul;
18105 errno = 0;
18106 gul = strtoul(s, 0, 10);
18107 if (!((gul == eul) && (errno == een)))
18108 bad++;
18109}
18110int main() {
18111 check(" 1", 1L, 0);
18112 check(" 0", 0L, 0);
18113EOCP
18114 case "$longsize" in
18115 8)
18116 $cat >>try.c <<'EOCP'
09c0d2c4
JH
18117 check("18446744073709551615", 18446744073709551615UL, 0);
18118 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 18119#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 18120 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
18121 check("-18446744073709551614", 2, 0);
18122 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
18123 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18124 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 18125#endif
d0e6d399
NC
18126EOCP
18127 ;;
18128 4)
18129 $cat >>try.c <<'EOCP'
18130 check("4294967295", 4294967295UL, 0);
18131 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 18132#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
18133 check("-1", 4294967295UL, 0);
18134 check("-4294967294", 2, 0);
18135 check("-4294967295", 1, 0);
18136 check("-4294967296", 4294967295UL, ERANGE);
18137 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 18138#endif
d0e6d399
NC
18139EOCP
18140 ;;
18141 *)
18142: Should we write these tests to be more portable by sprintf-ing
18143: ~0 and then manipulating that char string as input for strtol?
18144 ;;
18145 esac
18146 $cat >>try.c <<'EOCP'
18147 if (!bad)
18148 printf("ok\n");
18149 return 0;
18150}
18151EOCP
18152 set try
18153 if eval $compile; then
5440bc8e 18154 case "`$run ./try`" in
d0e6d399
NC
18155 ok) echo "Your strtoul() seems to be working okay." ;;
18156 *) cat <<EOM >&4
18157Your strtoul() doesn't seem to be working okay.
18158EOM
18159 d_strtoul="$undef"
18160 ;;
18161 esac
9597a80f
NC
18162 else
18163 echo "(I can't seem to compile the test program--assuming it doesn't)"
18164 d_strtoul="$undef"
d0e6d399
NC
18165 fi
18166 ;;
18167esac
18168
b4eb6b3d
JH
18169: see if strtoull exists
18170set strtoull d_strtoull
18171eval $inlibc
18172
18173case "$d_longlong-$d_strtoull" in
18174"$define-$define")
18175 $cat <<EOM
18176Checking whether your strtoull() works okay...
18177EOM
18178 $cat >try.c <<'EOCP'
18179#include <errno.h>
18180#ifdef __hpux
18181#define strtoull __strtoull
18182#endif
18183#include <stdio.h>
613d6c3e 18184extern unsigned long long int strtoull(char *s, char **, int);
b4eb6b3d
JH
18185static int bad = 0;
18186int check(char *s, long long eull, int een) {
18187 long long gull;
18188 errno = 0;
18189 gull = strtoull(s, 0, 10);
18190 if (!((gull == eull) && (errno == een)))
18191 bad++;
18192}
18193int main() {
d0e6d399
NC
18194 check(" 1", 1LL, 0);
18195 check(" 0", 0LL, 0);
18196 check("18446744073709551615", 18446744073709551615ULL, 0);
18197 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18198#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
18199 check("-1", 18446744073709551615ULL, 0);
18200 check("-18446744073709551614", 2LL, 0);
18201 check("-18446744073709551615", 1LL, 0);
18202 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18203 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18204#endif
b4eb6b3d
JH
18205 if (!bad)
18206 printf("ok\n");
18207}
18208EOCP
18209 set try
18210 if eval $compile; then
5440bc8e 18211 case "`$run ./try`" in
b4eb6b3d
JH
18212 ok) echo "Your strtoull() seems to be working okay." ;;
18213 *) cat <<EOM >&4
18214Your strtoull() doesn't seem to be working okay.
18215EOM
18216 d_strtoull="$undef"
18217 ;;
18218 esac
9597a80f
NC
18219 else
18220 echo "(I can't seem to compile the test program--assuming it doesn't)"
18221 d_strtoull="$undef"
b4eb6b3d
JH
18222 fi
18223 ;;
18224esac
18225
18226: see if strtouq exists
18227set strtouq d_strtouq
18228eval $inlibc
18229
d0e6d399
NC
18230case "$d_strtouq" in
18231"$define")
18232 $cat <<EOM
18233Checking whether your strtouq() works okay...
18234EOM
18235 $cat >try.c <<'EOCP'
18236#include <errno.h>
18237#include <stdio.h>
613d6c3e 18238extern unsigned long long int strtouq(char *s, char **, int);
d0e6d399
NC
18239static int bad = 0;
18240void check(char *s, unsigned long long eull, int een) {
18241 unsigned long long gull;
18242 errno = 0;
18243 gull = strtouq(s, 0, 10);
18244 if (!((gull == eull) && (errno == een)))
18245 bad++;
18246}
18247int main() {
18248 check(" 1", 1LL, 0);
18249 check(" 0", 0LL, 0);
18250 check("18446744073709551615", 18446744073709551615ULL, 0);
18251 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18252#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
18253 check("-1", 18446744073709551615ULL, 0);
18254 check("-18446744073709551614", 2LL, 0);
18255 check("-18446744073709551615", 1LL, 0);
18256 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18257 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18258#endif
d0e6d399
NC
18259 if (!bad)
18260 printf("ok\n");
18261 return 0;
18262}
18263EOCP
18264 set try
18265 if eval $compile; then
5440bc8e 18266 case "`$run ./try`" in
d0e6d399
NC
18267 ok) echo "Your strtouq() seems to be working okay." ;;
18268 *) cat <<EOM >&4
18269Your strtouq() doesn't seem to be working okay.
18270EOM
18271 d_strtouq="$undef"
18272 ;;
18273 esac
9597a80f
NC
18274 else
18275 echo "(I can't seem to compile the test program--assuming it doesn't)"
18276 d_strtouq="$undef"
d0e6d399
NC
18277 fi
18278 ;;
18279esac
18280
b4eb6b3d
JH
18281: see if strxfrm exists
18282set strxfrm d_strxfrm
18283eval $inlibc
18284
18285: see if symlink exists
18286set symlink d_symlink
18287eval $inlibc
18288
18289: see if syscall exists
18290set syscall d_syscall
18291eval $inlibc
18292
2ef53570
JH
18293: see if prototype for syscall is available
18294echo " "
18295set d_syscallproto syscall $i_unistd unistd.h
18296eval $hasproto
18297
b4eb6b3d
JH
18298: see if sysconf exists
18299set sysconf d_sysconf
18300eval $inlibc
18301
18302: see if system exists
18303set system d_system
18304eval $inlibc
18305
18306: see if tcgetpgrp exists
18307set tcgetpgrp d_tcgetpgrp
18308eval $inlibc
18309
18310: see if tcsetpgrp exists
18311set tcsetpgrp d_tcsetpgrp
18312eval $inlibc
18313
18314: see if prototype for telldir is available
18315echo " "
18316set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18317eval $hasproto
18318
ad493445
MB
18319: see if time exists
18320echo " "
18321if test "X$d_time" = X -o X"$timetype" = X; then
18322 if set time val -f d_time; eval $csym; $val; then
18323 echo 'time() found.' >&4
18324 val="$define"
18325 rp="What is the type returned by time() on this system?"
18326 set time_t timetype long stdio.h sys/types.h
18327 eval $typedef_ask
18328 else
18329 echo 'time() not found, hope that will do.' >&4
18330 val="$undef"
18331 timetype='int';
18332 fi
18333 set d_time
18334 eval $setvar
18335fi
18336
cbb9e8a7
MB
18337: see if timegm exists
18338set timegm d_timegm
18339eval $inlibc
18340
b4eb6b3d
JH
18341: see if this is a sys/times.h system
18342set sys/times.h i_systimes
18343eval $inhdr
18344
18345: see if times exists
18346echo " "
18347if set times val -f d_times; eval $csym; $val; then
18348 echo 'times() found.' >&4
18349 d_times="$define"
18350 inc=''
18351 case "$i_systimes" in
18352 "$define") inc='sys/times.h';;
18353 esac
18354 rp="What is the type returned by times() on this system?"
18355 set clock_t clocktype long stdio.h sys/types.h $inc
18356 eval $typedef_ask
18357else
18358 echo 'times() NOT found, hope that will do.' >&4
18359 d_times="$undef"
18360 clocktype='int'
18361fi
18362
10bc17b6
JH
18363: see if tmpnam_r exists
18364set tmpnam_r d_tmpnam_r
18365eval $inlibc
18366case "$d_tmpnam_r" in
18367"$define")
31ee0cb7 18368 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
18369 case "$d_tmpnam_r_proto:$usethreads" in
18370 ":define") d_tmpnam_r_proto=define
a48ec845
JH
18371 set d_tmpnam_r_proto tmpnam_r $hdrs
18372 eval $hasproto ;;
18373 *) ;;
18374 esac
18375 case "$d_tmpnam_r_proto" in
18376 define)
10bc17b6
JH
18377 case "$tmpnam_r_proto" in
18378 ''|0) try='char* tmpnam_r(char*);'
61c26d18 18379 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
10bc17b6
JH
18380 esac
18381 case "$tmpnam_r_proto" in
90e831dc 18382 ''|0) d_tmpnam_r=undef
10bc17b6 18383 tmpnam_r_proto=0
a48ec845 18384 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18385 * ) case "$tmpnam_r_proto" in
18386 REENTRANT_PROTO*) ;;
18387 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18388 esac
18389 echo "Prototype: $try" ;;
18390 esac
18391 ;;
c18e646a
JH
18392 *) case "$usethreads" in
18393 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18394 esac
90e831dc
SB
18395 d_tmpnam_r=undef
18396 tmpnam_r_proto=0
c18e646a 18397 ;;
a48ec845
JH
18398 esac
18399 ;;
10bc17b6
JH
18400*) tmpnam_r_proto=0
18401 ;;
18402esac
18403
b4eb6b3d
JH
18404: see if truncate exists
18405set truncate d_truncate
18406eval $inlibc
18407
10bc17b6
JH
18408: see if ttyname_r exists
18409set ttyname_r d_ttyname_r
18410eval $inlibc
18411case "$d_ttyname_r" in
18412"$define")
18413 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
18414 case "$d_ttyname_r_proto:$usethreads" in
18415 ":define") d_ttyname_r_proto=define
a48ec845
JH
18416 set d_ttyname_r_proto ttyname_r $hdrs
18417 eval $hasproto ;;
18418 *) ;;
18419 esac
18420 case "$d_ttyname_r_proto" in
18421 define)
10bc17b6
JH
18422 case "$ttyname_r_proto" in
18423 ''|0) try='int ttyname_r(int, char*, size_t);'
61c26d18 18424 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
10bc17b6
JH
18425 esac
18426 case "$ttyname_r_proto" in
18427 ''|0) try='int ttyname_r(int, char*, int);'
61c26d18 18428 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
10bc17b6
JH
18429 esac
18430 case "$ttyname_r_proto" in
18431 ''|0) try='char* ttyname_r(int, char*, int);'
61c26d18 18432 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
10bc17b6
JH
18433 esac
18434 case "$ttyname_r_proto" in
90e831dc 18435 ''|0) d_ttyname_r=undef
10bc17b6 18436 ttyname_r_proto=0
a48ec845 18437 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18438 * ) case "$ttyname_r_proto" in
18439 REENTRANT_PROTO*) ;;
18440 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18441 esac
18442 echo "Prototype: $try" ;;
18443 esac
18444 ;;
c18e646a
JH
18445 *) case "$usethreads" in
18446 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18447 esac
90e831dc
SB
18448 d_ttyname_r=undef
18449 ttyname_r_proto=0
c18e646a 18450 ;;
a48ec845
JH
18451 esac
18452 ;;
10bc17b6
JH
18453*) ttyname_r_proto=0
18454 ;;
18455esac
18456
b4eb6b3d
JH
18457: see if tzname[] exists
18458echo " "
18459if set tzname val -a d_tzname; eval $csym; $val; then
18460 val="$define"
18461 echo 'tzname[] found.' >&4
18462else
18463 val="$undef"
18464 echo 'tzname[] NOT found.' >&4
18465fi
18466set d_tzname
18467eval $setvar
18468
613d6c3e 18469: Check if is a multiplatform env
4e0554ec
JH
18470case "$osname" in
18471next|rhapsody|darwin) multiarch="$define" ;;
18472esac
18473case "$multiarch" in
18474''|[nN]*) multiarch="$undef" ;;
18475esac
18476
24412007 18477: check for ordering of bytes in a UV
4e0554ec 18478echo " "
5440bc8e 18479case "$usecrosscompile$multiarch" in
4e0554ec
JH
18480*$define*)
18481 $cat <<EOM
18482You seem to be either cross-compiling or doing a multiarchitecture build,
18483skipping the byteorder check.
18484
18485EOM
5440bc8e 18486 byteorder='ffff'
4e0554ec
JH
18487 ;;
18488*)
18489 case "$byteorder" in
18490 '')
18491 $cat <<'EOM'
18492In the following, larger digits indicate more significance. A big-endian
18493machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18494little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18495machines may have weird orders like 3412. A Cray will report 87654321,
18496an Alpha will report 12345678. If the test program works the default is
18497probably right.
18498I'm now running the test program...
18499EOM
24412007 18500 $cat >try.c <<EOCP
4e0554ec 18501#include <stdio.h>
55954f19
JH
18502#$i_stdlib I_STDLIB
18503#ifdef I_STDLIB
18504#include <stdlib.h>
18505#endif
24412007
JH
18506#include <sys/types.h>
18507typedef $uvtype UV;
4e0554ec
JH
18508int main()
18509{
18510 int i;
18511 union {
24412007
JH
18512 UV l;
18513 char c[$uvsize];
4e0554ec
JH
18514 } u;
18515
24412007 18516 if ($uvsize > 4)
b5ded3e5 18517 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18518 else
a4c53327 18519 u.l = (UV)0x04030201;
24412007 18520 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18521 printf("%c", u.c[i]+'0');
18522 printf("\n");
18523 exit(0);
18524}
18525EOCP
18526 xxx_prompt=y
18527 set try
43dddb59 18528 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18529 dflt=`$run ./try`
4e0554ec
JH
18530 case "$dflt" in
18531 [1-4][1-4][1-4][1-4]|12345678|87654321)
18532 echo "(The test program ran ok.)"
18533 echo "byteorder=$dflt"
18534 xxx_prompt=n
18535 ;;
18536 ????|????????) echo "(The test program ran ok.)" ;;
18537 *) echo "(The test program didn't run right for some reason.)" ;;
18538 esac
18539 else
18540 dflt='4321'
18541 cat <<'EOM'
18542(I can't seem to compile the test program. Guessing big-endian...)
18543EOM
18544 fi
18545 case "$xxx_prompt" in
18546 y)
24412007 18547 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18548 . ./myread
18549 byteorder="$ans"
18550 ;;
18551 *) byteorder=$dflt
18552 ;;
18553 esac
18554 ;;
18555 esac
5b813a60 18556 $rm_try
4e0554ec
JH
18557 ;;
18558esac
18559
613d6c3e 18560: Checking 32bit aligndness
4e0554ec
JH
18561$cat <<EOM
18562
18563Checking to see whether you can access character data unalignedly...
18564EOM
dc7b0a4f
JH
18565case "$d_u32align" in
18566'') $cat >try.c <<EOCP
4e0554ec 18567#include <stdio.h>
d1daaddf
JH
18568#$i_stdlib I_STDLIB
18569#ifdef I_STDLIB
18570#include <stdlib.h>
18571#endif
4e0554ec 18572#define U32 $u32type
d308175a
JH
18573#define BYTEORDER 0x$byteorder
18574#define U8 $u8type
9958dc3c
JH
18575#include <signal.h>
18576#ifdef SIGBUS
7090f861 18577$signal_t bletch(int s) { exit(4); }
9958dc3c 18578#endif
4e0554ec
JH
18579int main() {
18580#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 18581 U8 buf[8];
4e0554ec
JH
18582 U32 *up;
18583 int i;
18584
18585 if (sizeof(U32) != 4) {
18586 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18587 exit(1);
18588 }
18589
18590 fflush(stdout);
18591
9958dc3c
JH
18592#ifdef SIGBUS
18593 signal(SIGBUS, bletch);
18594#endif
18595
8906a23e
JH
18596 buf[0] = 0;
18597 buf[1] = 0;
18598 buf[2] = 0;
18599 buf[3] = 1;
7eac3fd6 18600 buf[4] = 0;
8906a23e
JH
18601 buf[5] = 0;
18602 buf[6] = 0;
7eac3fd6 18603 buf[7] = 1;
8906a23e 18604
4e0554ec
JH
18605 for (i = 0; i < 4; i++) {
18606 up = (U32*)(buf + i);
18607 if (! ((*up == 1 << (8*i)) || /* big-endian */
18608 (*up == 1 << (8*(3-i))) /* little-endian */
18609 )
18610 )
18611 {
18612 printf("read failed (%x)\n", *up);
18613 exit(2);
18614 }
18615 }
18616
18617 /* write test */
18618 for (i = 0; i < 4; i++) {
18619 up = (U32*)(buf + i);
18620 *up = 0xBeef;
18621 if (*up != 0xBeef) {
18622 printf("write failed (%x)\n", *up);
18623 exit(3);
18624 }
18625 }
18626
18627 exit(0);
18628#else
18629 printf("1\n");
18630 exit(1);
18631#endif
18632 return 0;
18633}
18634EOCP
18635set try
18636if eval $compile_ok; then
d308175a 18637 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18638 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18639 case "$?" in
18640 0) cat >&4 <<EOM
18641You can access character data pretty unalignedly.
18642EOM
18643 d_u32align="$undef"
18644 ;;
18645 *) cat >&4 <<EOM
18646It seems that you must access character data in an aligned manner.
18647EOM
18648 d_u32align="$define"
18649 ;;
18650 esac
4e0554ec
JH
18651else
18652 rp='Can you access character data at unaligned addresses?'
18653 dflt='n'
18654 . ./myread
18655 case "$ans" in
18656 [yY]*) d_u32align="$undef" ;;
18657 *) d_u32align="$define" ;;
18658 esac
18659fi
5b813a60 18660$rm_try
dc7b0a4f
JH
18661;;
18662esac
4e0554ec
JH
18663
18664: see if ualarm exists
18665set ualarm d_ualarm
18666eval $inlibc
18667
b4eb6b3d
JH
18668: see if umask exists
18669set umask d_umask
18670eval $inlibc
18671
758a5d79
JH
18672: see if unordered exists
18673set unordered d_unordered
18674eval $inlibc
18675
bdf33aa7
SP
18676: see if unsetenv exists
18677set unsetenv d_unsetenv
18678eval $inlibc
18679
4e0554ec
JH
18680: see if usleep exists
18681set usleep d_usleep
18682eval $inlibc
18683
2ef53570
JH
18684: see if prototype for usleep is available
18685echo " "
18686set d_usleepproto usleep $i_unistd unistd.h
18687eval $hasproto
18688
b4eb6b3d
JH
18689: see if ustat exists
18690set ustat d_ustat
18691eval $inlibc
18692
b4eb6b3d
JH
18693: see if closedir exists
18694set closedir d_closedir
18695eval $inlibc
18696
18697case "$d_closedir" in
18698"$define")
18699 echo " "
18700 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18701 cat > try.c <<EOM
b4eb6b3d
JH
18702#$i_dirent I_DIRENT /**/
18703#$i_sysdir I_SYS_DIR /**/
18704#$i_sysndir I_SYS_NDIR /**/
18705#$i_systypes I_SYS_TYPES /**/
18706
18707#if defined(I_SYS_TYPES)
18708#include <sys/types.h>
18709#endif
18710#if defined(I_DIRENT)
18711#include <dirent.h>
18712#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18713#include <sys/dir.h>
18714#endif
18715#else
18716#ifdef I_SYS_NDIR
18717#include <sys/ndir.h>
18718#else
18719#ifdef I_SYS_DIR
18720#ifdef hp9000s500
18721#include <ndir.h> /* may be wrong in the future */
18722#else
18723#include <sys/dir.h>
18724#endif
18725#endif
18726#endif
5b813a60 18727#endif
b4eb6b3d
JH
18728int main() { return closedir(opendir(".")); }
18729EOM
5440bc8e 18730 set try
b4eb6b3d 18731 if eval $compile_ok; then
5440bc8e 18732 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18733 echo "Yes, it does."
18734 val="$undef"
18735 else
18736 echo "No, it doesn't."
18737 val="$define"
18738 fi
18739 else
18740 echo "(I can't seem to compile the test program--assuming it doesn't)"
18741 val="$define"
18742 fi
18743 ;;
18744*)
18745 val="$undef";
18746 ;;
18747esac
18748set d_void_closedir
18749eval $setvar
5b813a60
MB
18750$rm_try
18751
b4eb6b3d
JH
18752: see if there is a wait4
18753set wait4 d_wait4
18754eval $inlibc
18755
18756: see if waitpid exists
18757set waitpid d_waitpid
18758eval $inlibc
18759
18760: see if wcstombs exists
18761set wcstombs d_wcstombs
18762eval $inlibc
18763
18764: see if wctomb exists
18765set wctomb d_wctomb
18766eval $inlibc
18767
4e0554ec
JH
18768: see if writev exists
18769set writev d_writev
18770eval $inlibc
18771
b4eb6b3d
JH
18772: preserve RCS keywords in files with variable substitution, grrr
18773Date='$Date'
18774Id='$Id'
18775Log='$Log'
18776RCSfile='$RCSfile'
18777Revision='$Revision'
18778
b4eb6b3d
JH
18779: check for alignment requirements
18780echo " "
5440bc8e 18781case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18782*$define*)
18783 $cat <<EOM
18784You seem to be either cross-compiling or doing a multiarchitecture build,
18785skipping the memory alignment check.
18786
18787EOM
18788 case "$alignbytes" in
18789 '') alignbytes=8 ;;
18790 esac
18791 ;;
18792*)
18793 case "$alignbytes" in
18794 '') echo "Checking alignment constraints..." >&4
18795 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18796 $cat >try.c <<'EOCP'
18797typedef long double NV;
18798EOCP
18799 else
18800 $cat >try.c <<'EOCP'
18801typedef double NV;
18802EOCP
18803 fi
18804 $cat >>try.c <<'EOCP'
18805#include <stdio.h>
18806struct foobar {
18807 char foo;
18808 NV bar;
18809} try_algn;
18810int main()
18811{
18812 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18813 return(0);
18814}
18815EOCP
18816 set try
18817 if eval $compile_ok; then
5440bc8e 18818 dflt=`$run ./try`
b4eb6b3d
JH
18819 else
18820 dflt='8'
18821 echo "(I can't seem to compile the test program...)"
18822 fi
18823 ;;
18824 *) dflt="$alignbytes"
18825 ;;
18826 esac
18827 rp="Doubles must be aligned on a how-many-byte boundary?"
18828 . ./myread
18829 alignbytes="$ans"
5b813a60 18830 $rm_try
b4eb6b3d
JH
18831 ;;
18832esac
18833
18834
18835: set the base revision
18836baserev=5.0
18837
c193ef60
MB
18838: check for length of character
18839echo " "
18840case "$charsize" in
18841'')
18842 echo "Checking to see how big your characters are (hey, you never know)..." >&4
18843 $cat >try.c <<EOCP
18844#include <stdio.h>
18845#$i_stdlib I_STDLIB
18846#ifdef I_STDLIB
18847#include <stdlib.h>
18848#endif
18849int main()
18850{
18851 printf("%d\n", (int)sizeof(char));
18852 exit(0);
18853}
18854EOCP
18855 set try
18856 if eval $compile_ok; then
18857 dflt=`$run ./try`
18858 else
18859 dflt='1'
18860 echo "(I can't seem to compile the test program. Guessing...)"
18861 fi
18862 ;;
18863*)
18864 dflt="$charsize"
18865 ;;
18866esac
18867rp="What is the size of a character (in bytes)?"
18868. ./myread
18869charsize="$ans"
18870$rm_try
18871
18872: Check for the number of bits in a character
18873case "$charbits" in
18874'') echo "Checking how long a character is (in bits)..." >&4
18875 $cat >try.c <<EOCP
18876#include <stdio.h>
18877int main ()
18878{
18879 int n;
18880 unsigned char c;
18881 for (c = 1, n = 0; c; c <<= 1, n++) ;
18882 printf ("%d\n", n);
18883 return (0);
18884 }
18885EOCP
18886 set try
18887 if eval $compile_ok; then
18888 dflt=`$run ./try`
18889 else
18890 dflt='8'
18891 echo "(I can't seem to compile the test program. Guessing...)"
18892 fi
18893 ;;
18894*)
18895 dflt="$charbits"
18896 ;;
18897esac
18898rp="What is the length of a character (in bits)?"
18899. ./myread
18900charbits="$ans"
18901$rm_try
18902case "$charbits" in
189038) ;;
18904*) cat >&4 << EOM
18905Your system has an unsigned character size of $charbits bits, which
18906is rather unusual (normally it is 8 bits). Perl likely will not work
18907correctly on your system, with subtle bugs in various places.
18908EOM
18909 rp='Do you really want to continue?'
18910 dflt='n'
18911 . ./myread
18912 case "$ans" in
18913 [yY]) echo >&4 "Okay, continuing." ;;
18914 *) exit 1 ;;
18915 esac
18916esac
18917
3099fc99 18918: how do we concatenate cpp tokens here?
b4eb6b3d 18919echo " "
3099fc99 18920echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
18921$cat >cpp_stuff.c <<'EOCP'
18922#define RCAT(a,b)a/**/b
18923#define ACAT(a,b)a ## b
18924RCAT(Rei,ser)
18925ACAT(Cir,cus)
18926EOCP
18927$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18928if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18929 echo "Oh! Smells like ANSI's been here." >&4
18930 echo "We can catify or stringify, separately or together!"
18931 cpp_stuff=42
18932elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18933 echo "Ah, yes! The good old days!" >&4
18934 echo "However, in the good old days we don't know how to stringify and"
18935 echo "catify at the same time."
18936 cpp_stuff=1
18937else
18938 $cat >&4 <<EOM
3099fc99
CW
18939Hmm, I don't seem to be able to concatenate tokens with your cpp.
18940You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
18941EOM
18942 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18943fi
18944$rm -f cpp_stuff.*
18945
18946: see if this is a db.h system
18947set db.h i_db
18948eval $inhdr
18949
18950case "$i_db" in
18951$define)
18952 : Check db version.
18953 echo " "
18954 echo "Checking Berkeley DB version ..." >&4
18955 $cat >try.c <<EOCP
18956#$d_const HASCONST
18957#ifndef HASCONST
18958#define const
18959#endif
18960#include <sys/types.h>
18961#include <stdio.h>
55954f19
JH
18962#$i_stdlib I_STDLIB
18963#ifdef I_STDLIB
18964#include <stdlib.h>
18965#endif
b4eb6b3d 18966#include <db.h>
640374d0 18967int main(int argc, char *argv[])
b4eb6b3d
JH
18968{
18969#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18970 int Major, Minor, Patch ;
18971 unsigned long Version ;
18972 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
18973 if (argc == 2) {
18974 printf("%d %d %d %d %d %d\n",
18975 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18976 Major, Minor, Patch);
18977 exit(0);
18978 }
18979 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
18980
18981 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18982 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18983 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18984 Major, Minor, Patch) ;
18985
18986 /* check that db.h & libdb are compatible */
18987 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 18988 printf("db.h and libdb are incompatible.\n") ;
5b813a60 18989 exit(3);
b4eb6b3d
JH
18990 }
18991
640374d0 18992 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
18993
18994 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18995 + DB_VERSION_PATCH ;
18996
18997 /* needs to be >= 2.3.4 */
18998 if (Version < 2003004) {
18999 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 19000 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 19001 exit(2);
b4eb6b3d
JH
19002 }
19003
19004 exit(0);
19005#else
19006#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
19007 if (argc == 2) {
19008 printf("1 0 0\n");
19009 exit(0);
19010 }
19011 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
19012 exit(0); /* DB version < 2: the coast is clear. */
19013#else
19014 exit(1); /* <db.h> not Berkeley DB? */
19015#endif
19016#endif
19017}
19018EOCP
19019 set try
5440bc8e 19020 if eval $compile_ok && $run ./try; then
b4eb6b3d 19021 echo 'Looks OK.' >&4
5440bc8e 19022 set `$run ./try 1`
640374d0
JH
19023 db_version_major=$1
19024 db_version_minor=$2
19025 db_version_patch=$3
b4eb6b3d
JH
19026 else
19027 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
19028 i_db=$undef
19029 case " $libs " in
19030 *"-ldb "*)
19031 : Remove db from list of libraries to use
19032 echo "Removing unusable -ldb from library list" >&4
19033 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19034 shift
19035 libs="$*"
19036 echo "libs = $libs" >&4
19037 ;;
19038 esac
19039 fi
5b813a60 19040 $rm_try
b4eb6b3d
JH
19041 ;;
19042esac
19043
19044case "$i_db" in
19045define)
5b813a60 19046 : Check the return type needed for hash
b4eb6b3d
JH
19047 echo " "
19048 echo "Checking return type needed for hash for Berkeley DB ..." >&4
19049 $cat >try.c <<EOCP
19050#$d_const HASCONST
19051#ifndef HASCONST
19052#define const
19053#endif
19054#include <sys/types.h>
19055#include <db.h>
19056
19057#ifndef DB_VERSION_MAJOR
19058u_int32_t hash_cb (ptr, size)
19059const void *ptr;
19060size_t size;
19061{
19062}
19063HASHINFO info;
19064int main()
19065{
19066 info.hash = hash_cb;
19067}
19068#endif
19069EOCP
19070 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19071 if $contains warning try.out >>/dev/null 2>&1 ; then
19072 db_hashtype='int'
19073 else
19074 db_hashtype='u_int32_t'
19075 fi
19076 else
19077 : XXX Maybe we should just give up here.
19078 db_hashtype=u_int32_t
19079 $cat try.out >&4
19080 echo "Help: I can't seem to compile the db test program." >&4
19081 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19082 fi
5b813a60 19083 $rm_try
b4eb6b3d
JH
19084 echo "Your version of Berkeley DB uses $db_hashtype for hash."
19085 ;;
19086*) db_hashtype=u_int32_t
19087 ;;
19088esac
19089case "$i_db" in
19090define)
5b813a60 19091 : Check the return type needed for prefix
b4eb6b3d
JH
19092 echo " "
19093 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19094 cat >try.c <<EOCP
19095#$d_const HASCONST
19096#ifndef HASCONST
19097#define const
19098#endif
19099#include <sys/types.h>
19100#include <db.h>
19101
19102#ifndef DB_VERSION_MAJOR
19103size_t prefix_cb (key1, key2)
19104const DBT *key1;
19105const DBT *key2;
19106{
19107}
19108BTREEINFO info;
19109int main()
19110{
19111 info.prefix = prefix_cb;
19112}
19113#endif
19114EOCP
19115 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19116 if $contains warning try.out >>/dev/null 2>&1 ; then
19117 db_prefixtype='int'
19118 else
19119 db_prefixtype='size_t'
19120 fi
19121 else
19122 db_prefixtype='size_t'
19123 : XXX Maybe we should just give up here.
19124 $cat try.out >&4
19125 echo "Help: I can't seem to compile the db test program." >&4
19126 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19127 fi
5b813a60 19128 $rm_try
b4eb6b3d
JH
19129 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19130 ;;
19131*) db_prefixtype='size_t'
19132 ;;
19133esac
19134
b4eb6b3d
JH
19135: How can we generate normalized random numbers ?
19136echo " "
19137echo "Looking for a random number function..." >&4
19138case "$randfunc" in
19139'')
19140 if set drand48 val -f; eval $csym; $val; then
19141 dflt="drand48"
19142 echo "Good, found drand48()." >&4
19143 elif set random val -f; eval $csym; $val; then
19144 dflt="random"
19145 echo "OK, found random()." >&4
19146 else
19147 dflt="rand"
19148 echo "Yick, looks like I have to use rand()." >&4
19149 fi
19150 echo " "
19151 ;;
19152*)
19153 dflt="$randfunc"
19154 ;;
19155esac
19156cont=true
19157
19158case "$ccflags" in
19159*-Dmy_rand=*|*-Dmy_srand=*)
19160 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19161 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19162 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19163 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19164 ;;
19165esac
19166
19167while $test "$cont"; do
19168 rp="Use which function to generate random numbers?"
19169 . ./myread
19170 if $test "$ans" = "$dflt"; then
19171 : null
19172 else
19173 randbits=''
19174 fi
19175 randfunc="$ans"
19176 if set $ans val -f; eval $csym; $val; then
19177 cont=''
19178 else
19179 dflt=y
19180 rp="I cannot find function $ans. Use that name anyway?"
19181 . ./myread
19182 dflt=rand
19183 case "$ans" in
19184 [yY]*) cont='';;
19185 esac
19186 fi
19187 case "$cont" in
19188 '')
19189 case "$randfunc" in
19190 drand48)
19191 drand01="drand48()"
19192 seedfunc="srand48"
19193 randbits=48
19194 randseedtype=long
19195 ;;
19196 rand|random)
19197 case "$randbits" in
19198 '')
19199echo "Checking to see how many bits your $randfunc() function produces..." >&4
19200 $cat >try.c <<EOCP
19201#$i_unistd I_UNISTD
19202#$i_stdlib I_STDLIB
19203#include <stdio.h>
19204#ifdef I_UNISTD
19205# include <unistd.h>
19206#endif
19207#ifdef I_STDLIB
19208# include <stdlib.h>
19209#endif
19210int main()
19211{
19212 register int i;
19213 register unsigned long tmp;
19214 register unsigned long max = 0L;
19215
19216 for (i = 1000; i; i--) {
19217 tmp = (unsigned long) $randfunc();
19218 if (tmp > max) max = tmp;
19219 }
19220 for (i = 0; max; i++)
19221 max /= 2;
19222 printf("%d\n",i);
19223}
19224EOCP
19225 set try
19226 if eval $compile_ok; then
19227 dflt=`try`
19228 else
19229 dflt='?'
19230 echo "(I can't seem to compile the test program...)"
19231 fi
19232 ;;
19233 *)
19234 dflt="$randbits"
19235 ;;
19236 esac
19237 rp="How many bits does your $randfunc() function produce?"
19238 . ./myread
19239 randbits="$ans"
5b813a60 19240 $rm_try
b4eb6b3d
JH
19241 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19242 seedfunc="s$randfunc"
19243 randseedtype=unsigned
19244 ;;
19245 *)
19246 dflt="31"
19247 rp="How many bits does your $randfunc() function produce?"
19248 . ./myread
19249 randbits="$ans"
19250 seedfunc="s$randfunc"
19251 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19252 if set $seedfunc val -f; eval $csym; $val; then
19253 echo "(Using $seedfunc() to seed random generator)"
19254 else
19255 echo "(Warning: no $seedfunc() to seed random generator)"
19256 seedfunc=rand
19257 fi
19258 randseedtype=unsigned
19259 ;;
19260 esac
19261 ;;
19262 esac
19263done
19264
613d6c3e 19265: Determine if this is an EBCDIC system
b4eb6b3d
JH
19266echo " "
19267echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 19268$cat >try.c <<'EOM'
b4eb6b3d
JH
19269int main()
19270{
19271 if ('M'==0xd4) return 0;
19272 return 1;
19273}
19274EOM
19275
19276val=$undef
5440bc8e 19277set try
b4eb6b3d 19278if eval $compile_ok; then
5440bc8e 19279 if $run ./try; then
b4eb6b3d
JH
19280 echo "You seem to speak EBCDIC." >&4
19281 val="$define"
19282 else
5440bc8e 19283 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
19284 fi
19285else
19286 echo "I'm unable to compile the test program." >&4
19287 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19288fi
5b813a60 19289$rm_try
b4eb6b3d
JH
19290set ebcdic
19291eval $setvar
19292
613d6c3e 19293: Check how to flush
b4eb6b3d
JH
19294echo " "
19295$cat >&4 <<EOM
19296Checking how to flush all pending stdio output...
19297EOM
19298# I only know how to find the first 32 possibly open files on SunOS.
19299# See also hints/sunos_4_1.sh and util.c --AD
19300case "$osname" in
19301sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19302esac
19303$cat >>try.c <<EOCP
19304#include <stdio.h>
55954f19
JH
19305#$i_stdlib I_STDLIB
19306#ifdef I_STDLIB
19307#include <stdlib.h>
19308#endif
b4eb6b3d
JH
19309#$i_unistd I_UNISTD
19310#ifdef I_UNISTD
19311# include <unistd.h>
19312#endif
19313#$d_sysconf HAS_SYSCONF
19314#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19315#ifdef HAS_STDIO_STREAM_ARRAY
19316# define STDIO_STREAM_ARRAY $stdio_stream_array
19317#endif
19318int main() {
5440bc8e
JH
19319 FILE* p;
19320 unlink("try.out");
19321 p = fopen("try.out", "w");
b4eb6b3d
JH
19322#ifdef TRY_FPUTC
19323 fputc('x', p);
19324#else
19325# ifdef TRY_FPRINTF
19326 fprintf(p, "x");
19327# endif
19328#endif
19329#ifdef TRY_FFLUSH_NULL
19330 fflush(NULL);
19331#endif
19332#ifdef TRY_FFLUSH_ALL
19333 {
19334 long open_max = -1;
19335# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19336 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19337# else
19338# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19339 open_max = sysconf(_SC_OPEN_MAX);
19340# else
19341# ifdef FOPEN_MAX
19342 open_max = FOPEN_MAX;
19343# else
19344# ifdef OPEN_MAX
19345 open_max = OPEN_MAX;
19346# else
19347# ifdef _NFILE
19348 open_max = _NFILE;
19349# endif
19350# endif
19351# endif
19352# endif
5b813a60 19353# endif
b4eb6b3d
JH
19354# ifdef HAS_STDIO_STREAM_ARRAY
19355 if (open_max > 0) {
19356 long i;
19357 for (i = 0; i < open_max; i++)
19358 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19359 STDIO_STREAM_ARRAY[i]._file < open_max &&
19360 STDIO_STREAM_ARRAY[i]._flag)
19361 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 19362 }
b4eb6b3d
JH
19363 }
19364# endif
19365#endif
19366 _exit(42);
19367}
19368EOCP
19369: first we have to find out how _not_ to flush
5440bc8e 19370$to try.c
b4eb6b3d
JH
19371if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19372 output=''
19373 set try -DTRY_FPUTC
19374 if eval $compile; then
fbe73d74 19375 $run ./try 2>/dev/null
28f5ac64 19376 code="$?"
5440bc8e 19377 $from try.out
28f5ac64 19378 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19379 output=-DTRY_FPUTC
19380 fi
19381 fi
19382 case "$output" in
19383 '')
19384 set try -DTRY_FPRINTF
b4eb6b3d 19385 if eval $compile; then
fbe73d74 19386 $run ./try 2>/dev/null
28f5ac64 19387 code="$?"
5440bc8e 19388 $from try.out
28f5ac64 19389 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19390 output=-DTRY_FPRINTF
19391 fi
19392 fi
19393 ;;
19394 esac
19395fi
19396: check for fflush NULL behaviour
19397case "$fflushNULL" in
19398'') set try -DTRY_FFLUSH_NULL $output
19399 if eval $compile; then
5440bc8e 19400 $run ./try 2>/dev/null
b4eb6b3d 19401 code="$?"
5440bc8e 19402 $from try.out
b4eb6b3d
JH
19403 if $test -s try.out -a "X$code" = X42; then
19404 fflushNULL="`$cat try.out`"
19405 else
19406 if $test "X$code" != X42; then
19407 $cat >&4 <<EOM
19408(If this test failed, don't worry, we'll try another method shortly.)
19409EOM
19410 fi
19411 fi
19412 fi
2c476adc 19413 $rm -f core try.core core.try.*
b4eb6b3d
JH
19414 case "$fflushNULL" in
19415 x) $cat >&4 <<EOM
19416Your fflush(NULL) works okay for output streams.
19417Let's see if it clobbers input pipes...
19418EOM
19419# As of mid-March 2000 all versions of Solaris appear to have a stdio
19420# bug that improperly flushes the input end of pipes. So we avoid the
19421# autoflush on fork/system/exec support for now. :-(
19422$cat >tryp.c <<EOCP
19423#include <stdio.h>
19424int
19425main(int argc, char **argv)
19426{
19427 char buf[1024];
19428 int i;
19429 char *bp = buf;
19430 while (1) {
19431 while ((i = getc(stdin)) != -1
19432 && (*bp++ = i) != '\n'
19433 && bp < &buf[1024])
19434 /* DO NOTHING */ ;
19435 *bp = '\0';
19436 fprintf(stdout, "%s", buf);
19437 fflush(NULL);
19438 if (i == -1)
19439 return 0;
19440 bp = buf;
19441 }
19442}
19443EOCP
19444 fflushNULL="$define"
19445 set tryp
19446 if eval $compile; then
19447 $rm -f tryp.out
5440bc8e 19448 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19449 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19450 $cat >&4 <<EOM
19451fflush(NULL) seems to behave okay with input streams.
19452EOM
19453 fflushNULL="$define"
19454 else
19455 $cat >&4 <<EOM
19456Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19457EOM
19458 fflushNULL="$undef"
19459 fi
19460 fi
19461 $rm -f core tryp.c tryp.core core.tryp.*
19462 ;;
19463 '') $cat >&4 <<EOM
19464Your fflush(NULL) isn't working (contrary to ANSI C).
19465EOM
19466 fflushNULL="$undef"
19467 ;;
19468 *) $cat >&4 <<EOM
19469Cannot figure out whether your fflush(NULL) works or not.
19470I'm assuming it doesn't (contrary to ANSI C).
19471EOM
19472 fflushNULL="$undef"
19473 ;;
19474 esac
19475 ;;
19476$define|true|[yY]*)
19477 fflushNULL="$define"
19478 ;;
19479*)
19480 fflushNULL="$undef"
19481 ;;
19482esac
19483: check explicit looping only if NULL did not work, and if the pipe
19484: bug does not show up on an explicit flush too
19485case "$fflushNULL" in
19486"$undef")
19487 $cat >tryp.c <<EOCP
19488#include <stdio.h>
19489int
19490main(int argc, char **argv)
19491{
19492 char buf[1024];
19493 int i;
19494 char *bp = buf;
19495 while (1) {
19496 while ((i = getc(stdin)) != -1
19497 && (*bp++ = i) != '\n'
19498 && bp < &buf[1024])
19499 /* DO NOTHING */ ;
19500 *bp = '\0';
19501 fprintf(stdout, "%s", buf);
19502 fflush(stdin);
19503 if (i == -1)
19504 return 0;
19505 bp = buf;
19506 }
19507}
19508EOCP
19509 set tryp
19510 if eval $compile; then
19511 $rm -f tryp.out
5440bc8e 19512 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19513 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19514 $cat >&4 <<EOM
19515Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19516EOM
19517 : now check for fflushall behaviour
19518 case "$fflushall" in
19519 '') set try -DTRY_FFLUSH_ALL $output
19520 if eval $compile; then
19521 $cat >&4 <<EOM
19522(Now testing the other method--but note that this also may fail.)
19523EOM
5440bc8e 19524 $run ./try 2>/dev/null
28f5ac64 19525 code=$?
fbe73d74 19526 $from try.out
28f5ac64 19527 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19528 fflushall="`$cat try.out`"
19529 fi
19530 fi
5b813a60 19531 $rm_try
b4eb6b3d
JH
19532 case "$fflushall" in
19533 x) $cat >&4 <<EOM
19534Whew. Flushing explicitly all the stdio streams works.
19535EOM
19536 fflushall="$define"
19537 ;;
19538 '') $cat >&4 <<EOM
19539Sigh. Flushing explicitly all the stdio streams doesn't work.
19540EOM
19541 fflushall="$undef"
19542 ;;
19543 *) $cat >&4 <<EOM
19544Cannot figure out whether flushing stdio streams explicitly works or not.
19545I'm assuming it doesn't.
19546EOM
19547 fflushall="$undef"
19548 ;;
19549 esac
19550 ;;
19551 "$define"|true|[yY]*)
19552 fflushall="$define"
19553 ;;
19554 *)
19555 fflushall="$undef"
19556 ;;
19557 esac
19558 else
19559 $cat >&4 <<EOM
19560All is futile. Even fflush(stdin) clobbers input pipes!
19561EOM
19562 fflushall="$undef"
19563 fi
19564 else
19565 fflushall="$undef"
19566 fi
19567 $rm -f core tryp.c tryp.core core.tryp.*
19568 ;;
19569*) fflushall="$undef"
19570 ;;
19571esac
19572
19573case "$fflushNULL$fflushall" in
19574undefundef)
19575 $cat <<EOM
19576OK, I give up. I cannot figure out how to flush pending stdio output.
19577We won't be flushing handles at all before fork/exec/popen.
19578EOM
19579 ;;
19580esac
34f1896b 19581$rm_try tryp
b4eb6b3d
JH
19582
19583: Store the full pathname to the ar program for use in the C program
19584: Respect a hint or command line value for full_ar.
19585case "$full_ar" in
19586'') full_ar=$ar ;;
19587esac
19588
19589: Store the full pathname to the sed program for use in the C program
19590full_sed=$sed
19591
19592: see what type gids are declared as in the kernel
19593echo " "
19594echo "Looking for the type for group ids returned by getgid()."
19595set gid_t gidtype xxx stdio.h sys/types.h
19596eval $typedef
19597case "$gidtype" in
19598xxx)
19599 xxx=`./findhdr sys/user.h`
19600 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19601 case $1 in
19602 unsigned) dflt="$1 $2" ;;
19603 *) dflt="$1" ;;
19604 esac
19605 ;;
19606*) dflt="$gidtype";;
19607esac
19608case "$gidtype" in
19609gid_t) echo "gid_t found." ;;
19610*) rp="What is the type for group ids returned by getgid()?"
19611 . ./myread
19612 gidtype="$ans"
19613 ;;
19614esac
19615
613d6c3e 19616: Check the size of GID
b4eb6b3d
JH
19617echo " "
19618case "$gidtype" in
19619*_t) zzz="$gidtype" ;;
19620*) zzz="gid" ;;
19621esac
613d6c3e 19622echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
19623cat > try.c <<EOCP
19624#include <sys/types.h>
19625#include <stdio.h>
d1daaddf
JH
19626#$i_stdlib I_STDLIB
19627#ifdef I_STDLIB
19628#include <stdlib.h>
19629#endif
b4eb6b3d
JH
19630int main() {
19631 printf("%d\n", (int)sizeof($gidtype));
19632 exit(0);
19633}
19634EOCP
19635set try
19636if eval $compile_ok; then
5440bc8e 19637 yyy=`$run ./try`
b4eb6b3d
JH
19638 case "$yyy" in
19639 '') gidsize=4
19640 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19641 ;;
19642 *) gidsize=$yyy
19643 echo "Your $zzz is $gidsize bytes long."
19644 ;;
19645 esac
19646else
19647 gidsize=4
19648 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19649fi
19650
19651
613d6c3e 19652: Check if GID is signed
b4eb6b3d
JH
19653echo " "
19654case "$gidtype" in
19655*_t) zzz="$gidtype" ;;
19656*) zzz="gid" ;;
19657esac
613d6c3e 19658echo "Checking the sign of $zzz..." >&4
b4eb6b3d
JH
19659cat > try.c <<EOCP
19660#include <sys/types.h>
19661#include <stdio.h>
19662int main() {
19663 $gidtype foo = -1;
19664 if (foo < 0)
19665 printf("-1\n");
19666 else
19667 printf("1\n");
19668}
19669EOCP
19670set try
19671if eval $compile; then
5440bc8e 19672 yyy=`$run ./try`
b4eb6b3d
JH
19673 case "$yyy" in
19674 '') gidsign=1
19675 echo "(I can't execute the test program--guessing unsigned.)" >&4
19676 ;;
19677 *) gidsign=$yyy
19678 case "$gidsign" in
19679 1) echo "Your $zzz is unsigned." ;;
19680 -1) echo "Your $zzz is signed." ;;
19681 esac
19682 ;;
19683 esac
19684else
19685 gidsign=1
19686 echo "(I can't compile the test program--guessing unsigned.)" >&4
19687fi
19688
19689
613d6c3e 19690: Check 64bit sizes
b4eb6b3d
JH
19691echo " "
19692
19693if $test X"$quadtype" != X; then
19694
19695echo "Checking how to print 64-bit integers..." >&4
19696
19697if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19698 $cat >try.c <<'EOCP'
19699#include <sys/types.h>
19700#include <stdio.h>
19701int main() {
19702 int q = 12345678901;
19703 printf("%ld\n", q);
19704}
19705EOCP
19706 set try
19707 if eval $compile; then
5440bc8e 19708 yyy=`$run ./try`
b4eb6b3d
JH
19709 case "$yyy" in
19710 12345678901)
19711 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19712 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19713 echo "We will use %d."
19714 ;;
19715 esac
19716 fi
19717fi
19718
19719if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19720 $cat >try.c <<'EOCP'
19721#include <sys/types.h>
19722#include <stdio.h>
19723int main() {
19724 long q = 12345678901;
19725 printf("%ld\n", q);
19726}
19727EOCP
19728 set try
19729 if eval $compile; then
5440bc8e 19730 yyy=`$run ./try`
b4eb6b3d
JH
19731 case "$yyy" in
19732 12345678901)
19733 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19734 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19735 echo "We will use %ld."
19736 ;;
19737 esac
19738 fi
19739fi
19740
19741if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19742 $cat >try.c <<'EOCP'
19743#include <sys/types.h>
19744#include <inttypes.h>
19745#include <stdio.h>
19746int main() {
19747 int64_t q = 12345678901;
19748 printf("%" PRId64 "\n", q);
19749}
19750EOCP
19751 set try
19752 if eval $compile; then
5440bc8e 19753 yyy=`$run ./try`
b4eb6b3d
JH
19754 case "$yyy" in
19755 12345678901)
19756 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19757 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19758 echo "We will use the C9X style."
19759 ;;
19760 esac
19761 fi
19762fi
19763
2ef53570
JH
19764if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19765 $cat >try.c <<EOCP
b4eb6b3d
JH
19766#include <sys/types.h>
19767#include <stdio.h>
19768int main() {
2ef53570
JH
19769 $quadtype q = 12345678901;
19770 printf("%Ld\n", q);
b4eb6b3d
JH
19771}
19772EOCP
19773 set try
19774 if eval $compile; then
5440bc8e 19775 yyy=`$run ./try`
b4eb6b3d
JH
19776 case "$yyy" in
19777 12345678901)
2ef53570
JH
19778 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19779 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19780 echo "We will use %Ld."
b4eb6b3d
JH
19781 ;;
19782 esac
19783 fi
19784fi
19785
2ef53570
JH
19786if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19787 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19788#include <sys/types.h>
19789#include <stdio.h>
19790int main() {
2ef53570
JH
19791 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19792 printf("%lld\n", q);
b4eb6b3d
JH
19793}
19794EOCP
19795 set try
19796 if eval $compile; then
5440bc8e 19797 yyy=`$run ./try`
b4eb6b3d
JH
19798 case "$yyy" in
19799 12345678901)
2ef53570
JH
19800 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19801 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19802 echo "We will use the %lld style."
b4eb6b3d
JH
19803 ;;
19804 esac
19805 fi
19806fi
19807
19808if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19809 $cat >try.c <<EOCP
19810#include <sys/types.h>
19811#include <stdio.h>
19812int main() {
19813 $quadtype q = 12345678901;
19814 printf("%qd\n", q);
19815}
19816EOCP
19817 set try
19818 if eval $compile; then
5440bc8e 19819 yyy=`$run ./try`
b4eb6b3d
JH
19820 case "$yyy" in
19821 12345678901)
19822 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19823 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19824 echo "We will use %qd."
19825 ;;
19826 esac
19827 fi
19828fi
19829
19830if $test X"$sPRId64" = X; then
19831 echo "Cannot figure out how to print 64-bit integers." >&4
19832fi
5b813a60 19833$rm_try
b4eb6b3d
JH
19834
19835fi
19836
19837case "$sPRId64" in
5b813a60
MB
19838'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19839 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 19840 ;;
5b813a60
MB
19841*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19842 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
19843 ;;
19844esac
19845
34f1896b 19846: Check format strings for internal types
b4eb6b3d
JH
19847echo " "
19848$echo "Checking the format strings to be used for Perl's internal types..." >&4
19849
19850if $test X"$ivsize" = X8; then
19851 ivdformat="$sPRId64"
19852 uvuformat="$sPRIu64"
19853 uvoformat="$sPRIo64"
19854 uvxformat="$sPRIx64"
19855 uvXUformat="$sPRIXU64"
19856else
19857 if $test X"$ivsize" = X"$longsize"; then
19858 ivdformat='"ld"'
19859 uvuformat='"lu"'
19860 uvoformat='"lo"'
19861 uvxformat='"lx"'
19862 uvXUformat='"lX"'
19863 else
19864 if $test X"$ivsize" = X"$intsize"; then
19865 ivdformat='"d"'
19866 uvuformat='"u"'
19867 uvoformat='"o"'
19868 uvxformat='"x"'
19869 uvXUformat='"X"'
19870 else
19871 : far out
19872 if $test X"$ivsize" = X"$shortsize"; then
19873 ivdformat='"hd"'
19874 uvuformat='"hu"'
19875 uvoformat='"ho"'
19876 uvxformat='"hx"'
19877 uvXUformat='"hX"'
19878 fi
19879 fi
19880 fi
19881fi
19882
19883if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19884 nveformat="$sPRIeldbl"
19885 nvfformat="$sPRIfldbl"
19886 nvgformat="$sPRIgldbl"
19887 nvEUformat="$sPRIEUldbl"
19888 nvFUformat="$sPRIFUldbl"
19889 nvGUformat="$sPRIGUldbl"
19890else
19891 nveformat='"e"'
19892 nvfformat='"f"'
19893 nvgformat='"g"'
19894 nvEUformat='"E"'
19895 nvFUformat='"F"'
19896 nvGUformat='"G"'
19897fi
19898
19899case "$ivdformat" in
3c728e00 19900'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19901 exit 1
19902 ;;
19903esac
19904
34f1896b 19905: Check format string for GID
b4eb6b3d
JH
19906
19907echo " "
19908$echo "Checking the format string to be used for gids..." >&4
19909
19910case "$gidsign" in
19911-1) if $test X"$gidsize" = X"$ivsize"; then
19912 gidformat="$ivdformat"
19913 else
19914 if $test X"$gidsize" = X"$longsize"; then
19915 gidformat='"ld"'
19916 else
19917 if $test X"$gidsize" = X"$intsize"; then
19918 gidformat='"d"'
19919 else
19920 if $test X"$gidsize" = X"$shortsize"; then
19921 gidformat='"hd"'
19922 fi
19923 fi
19924 fi
19925 fi
19926 ;;
19927*) if $test X"$gidsize" = X"$uvsize"; then
19928 gidformat="$uvuformat"
19929 else
19930 if $test X"$gidsize" = X"$longsize"; then
19931 gidformat='"lu"'
19932 else
19933 if $test X"$gidsize" = X"$intsize"; then
19934 gidformat='"u"'
19935 else
19936 if $test X"$gidsize" = X"$shortsize"; then
19937 gidformat='"hu"'
19938 fi
19939 fi
19940 fi
19941 fi
19942 ;;
19943esac
19944
19945: see if getgroups exists
19946set getgroups d_getgrps
19947eval $inlibc
19948
19949: see if setgroups exists
19950set setgroups d_setgrps
19951eval $inlibc
19952
b4eb6b3d
JH
19953: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19954echo " "
19955case "$d_getgrps$d_setgrps" in
19956*define*)
19957 case "$groupstype" in
19958 '') dflt="$gidtype" ;;
19959 *) dflt="$groupstype" ;;
19960 esac
19961 $cat <<EOM
19962What type of pointer is the second argument to getgroups() and setgroups()?
19963Usually this is the same as group ids, $gidtype, but not always.
19964
19965EOM
19966 rp='What type pointer is the second argument to getgroups() and setgroups()?'
19967 . ./myread
19968 groupstype="$ans"
19969 ;;
19970*) groupstype="$gidtype";;
19971esac
19972
613d6c3e 19973: MAD = Misc Attribute Definition
d620c7b3 19974
fd655d33
NC
19975if $test $patchlevel -lt 9; then
19976: MAD is not available in 5.8.x or earlier.
19977 ans=n;
19978else
19979 case "$mad" in
19980 $define|true|[yY]*) dflt='y' ;;
19981 *) dflt='n' ;;
19982 esac
19983 cat <<EOM
d620c7b3
MB
19984
19985Would you like to build with Misc Attribute Decoration? This is development
19986work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19987overhead on the interpreter.
19988
19989If this doesn't make any sense to you, just accept the default '$dflt'.
19990EOM
fd655d33
NC
19991 rp='Build Perl with MAD?'
19992 . ./myread
19993fi
d620c7b3 19994case "$ans" in
00e74f14
NC
19995y|Y) val="$define"
19996 madlyh='madly.h madly.act madly.tab'
19997 madlysrc='madly.c'
19998 madlyobj="madly$_o" ;;
19999*) val="$undef"
20000 madlyh=''
20001 madlysrc=''
20002 madlyobj='' ;;
d620c7b3
MB
20003esac
20004set mad
20005eval $setvar
20006
216dac04 20007: check whether make sets MAKE
b4eb6b3d
JH
20008echo " "
20009echo "Checking if your $make program sets \$(MAKE)..." >&4
20010case "$make_set_make" in
20011'')
20012 $sed 's/^X //' > testmake.mak << 'EOF'
20013Xall:
20014X @echo 'maketemp="$(MAKE)"'
20015EOF
20016 case "`$make -f testmake.mak 2>/dev/null`" in
20017 *maketemp=*) make_set_make='#' ;;
20018 *) make_set_make="MAKE=$make" ;;
20019 esac
20020 $rm -f testmake.mak
20021 ;;
20022esac
20023case "$make_set_make" in
20024'#') echo "Yup, it does.";;
20025*) echo "Nope, it doesn't.";;
20026esac
20027
20028: see what type is used for mode_t
20029rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20030set mode_t modetype int stdio.h sys/types.h
20031eval $typedef_ask
20032
2cc61e15
DD
20033: see if we need va_copy
20034echo " "
20035case "$i_stdarg" in
20036"$define")
20037 $cat >try.c <<EOCP
20038#include <stdarg.h>
20039#include <stdio.h>
85c8a686
DD
20040#$i_stdlib I_STDLIB
20041#ifdef I_STDLIB
20042#include <stdlib.h>
20043#endif
20044#include <signal.h>
2cc61e15
DD
20045
20046int
20047ivfprintf(FILE *f, const char *fmt, va_list *valp)
20048{
20049 return vfprintf(f, fmt, *valp);
20050}
5b813a60
MB
20051
20052int
2cc61e15
DD
20053myvfprintf(FILE *f, const char *fmt, va_list val)
20054{
20055 return ivfprintf(f, fmt, &val);
20056}
5b813a60 20057
2cc61e15 20058int
5b813a60 20059myprintf(char *fmt, ...)
2cc61e15
DD
20060{
20061 va_list val;
20062 va_start(val, fmt);
5b813a60
MB
20063 return myvfprintf(stdout, fmt, val);
20064}
2cc61e15
DD
20065
20066int
20067main(int ac, char **av)
20068{
85c8a686
DD
20069 signal(SIGSEGV, exit);
20070
5b813a60
MB
20071 myprintf("%s%cs all right, then\n", "that", '\'');
20072 exit(0);
2cc61e15
DD
20073}
20074EOCP
20075 set try
5440bc8e
JH
20076 if eval $compile && $run ./try 2>&1 >/dev/null; then
20077 case "`$run ./try`" in
2cc61e15
DD
20078 "that's all right, then")
20079 okay=yes
20080 ;;
20081 esac
20082 fi
20083 case "$okay" in
20084 yes) echo "It seems that you don't need va_copy()." >&4
20085 need_va_copy="$undef"
20086 ;;
20087 *) echo "It seems that va_copy() or similar will be needed." >&4
20088 need_va_copy="$define"
20089 ;;
20090 esac
5b813a60 20091 $rm_try
2cc61e15
DD
20092 ;;
20093*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20094 ;;
20095esac
20096
b4eb6b3d
JH
20097: see what type is used for size_t
20098rp="What is the type used for the length parameter for string functions?"
20099set size_t sizetype 'unsigned int' stdio.h sys/types.h
20100eval $typedef_ask
20101
20102: check for type of arguments to gethostbyaddr.
20103if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20104 case "$d_gethbyaddr" in
20105 $define)
20106 $cat <<EOM
20107
20108Checking to see what type of arguments are accepted by gethostbyaddr().
20109EOM
20110 hdrs="$define sys/types.h
20111 $d_socket sys/socket.h
20112 $i_niin netinet/in.h
20113 $i_netdb netdb.h
20114 $i_unistd unistd.h"
20115 : The first arg can 'char *' or 'void *'
20116 : The second arg is some of integral type
20117 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20118 for yyy in size_t long int; do
20119 case "$netdb_host_type" in
61c26d18 20120 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
b4eb6b3d
JH
20121 if ./protochk "$try" $hdrs; then
20122 echo "Your system accepts $xxx for the first arg."
20123 echo "...and $yyy for the second arg."
20124 netdb_host_type="$xxx"
20125 netdb_hlen_type="$yyy"
20126 fi
20127 ;;
20128 esac
20129 done
20130 done
20131 : In case none of those worked, prompt the user.
20132 case "$netdb_host_type" in
20133 '') rp='What is the type for the 1st argument to gethostbyaddr?'
20134 dflt='char *'
20135 . ./myread
20136 netdb_host_type=$ans
20137 rp='What is the type for the 2nd argument to gethostbyaddr?'
20138 dflt="$sizetype"
20139 . ./myread
20140 netdb_hlen_type=$ans
20141 ;;
20142 esac
20143 ;;
20144 *) : no gethostbyaddr, so pick harmless defaults
20145 netdb_host_type='char *'
20146 netdb_hlen_type="$sizetype"
20147 ;;
20148 esac
20149 # Remove the "const" if needed. -- but then we'll have a
20150 # prototype clash!
20151 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20152fi
20153
20154: check for type of argument to gethostbyname.
20155if test "X$netdb_name_type" = X ; then
20156 case "$d_gethbyname" in
20157 $define)
20158 $cat <<EOM
20159
20160Checking to see what type of argument is accepted by gethostbyname().
20161EOM
20162 hdrs="$define sys/types.h
20163 $d_socket sys/socket.h
20164 $i_niin netinet/in.h
20165 $i_netdb netdb.h
20166 $i_unistd unistd.h"
20167 for xxx in "const char *" "char *"; do
20168 case "$netdb_name_type" in
61c26d18 20169 '') try="$extern_C struct hostent *gethostbyname($xxx);"
b4eb6b3d
JH
20170 if ./protochk "$try" $hdrs; then
20171 echo "Your system accepts $xxx."
20172 netdb_name_type="$xxx"
20173 fi
20174 ;;
20175 esac
20176 done
20177 : In case none of those worked, prompt the user.
20178 case "$netdb_name_type" in
20179 '') rp='What is the type for the 1st argument to gethostbyname?'
20180 dflt='char *'
20181 . ./myread
20182 netdb_name_type=$ans
20183 ;;
20184 esac
20185 ;;
20186 *) : no gethostbyname, so pick harmless default
20187 netdb_name_type='char *'
20188 ;;
20189 esac
20190fi
20191
20192: check for type of 1st argument to getnetbyaddr.
20193if test "X$netdb_net_type" = X ; then
20194 case "$d_getnbyaddr" in
20195 $define)
20196 $cat <<EOM
20197
20198Checking to see what type of 1st argument is accepted by getnetbyaddr().
20199EOM
20200 hdrs="$define sys/types.h
20201 $d_socket sys/socket.h
20202 $i_niin netinet/in.h
20203 $i_netdb netdb.h
20204 $i_unistd unistd.h"
20205 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20206 case "$netdb_net_type" in
61c26d18 20207 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
b4eb6b3d
JH
20208 if ./protochk "$try" $hdrs; then
20209 echo "Your system accepts $xxx."
20210 netdb_net_type="$xxx"
20211 fi
20212 ;;
20213 esac
20214 done
20215 : In case none of those worked, prompt the user.
20216 case "$netdb_net_type" in
20217 '') rp='What is the type for the 1st argument to getnetbyaddr?'
20218 dflt='long'
20219 . ./myread
20220 netdb_net_type=$ans
20221 ;;
20222 esac
20223 ;;
20224 *) : no getnetbyaddr, so pick harmless default
20225 netdb_net_type='long'
20226 ;;
20227 esac
20228fi
20229: locate the preferred pager for this system
d604bb53 20230fn=f/
b4eb6b3d
JH
20231case "$pager" in
20232'')
20233 dflt=''
20234 case "$pg" in
20235 /*) dflt=$pg;;
20236 [a-zA-Z]:/*) dflt=$pg;;
20237 esac
20238 case "$more" in
20239 /*) dflt=$more;;
20240 [a-zA-Z]:/*) dflt=$more;;
20241 esac
20242 case "$less" in
20243 /*) dflt=$less;;
20244 [a-zA-Z]:/*) dflt=$less;;
20245 esac
20246 case "$dflt" in
20247 '') dflt=/usr/ucb/more;;
20248 esac
20249 ;;
d604bb53 20250*) dflt="$pager"
d604bb53
JH
20251 fn="f/($pager)"
20252 ;;
b4eb6b3d
JH
20253esac
20254echo " "
b4eb6b3d
JH
20255rp='What pager is used on your system?'
20256. ./getfile
20257pager="$ans"
20258
20259: see what type pids are declared as in the kernel
20260rp="What is the type of process ids on this system?"
20261set pid_t pidtype int stdio.h sys/types.h
20262eval $typedef_ask
20263
b4eb6b3d
JH
20264: see if ar generates random libraries by itself
20265echo " "
20266echo "Checking how to generate random libraries on your machine..." >&4
20267echo 'int bar1() { return bar2(); }' > bar1.c
20268echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
20269$cat > foo.c <<EOP
20270#$i_stdlib I_STDLIB
20271#ifdef I_STDLIB
20272#include <stdlib.h>
20273#endif
b4eb6b3d
JH
20274int main() { printf("%d\n", bar1()); exit(0); }
20275EOP
20276$cc $ccflags -c bar1.c >/dev/null 2>&1
20277$cc $ccflags -c bar2.c >/dev/null 2>&1
20278$cc $ccflags -c foo.c >/dev/null 2>&1
20279$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 20280if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20281 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20282 echo "$ar appears to generate random libraries itself."
20283 orderlib=false
e39a9d84
LC
20284 if [ "X$ranlib" = "X" ]; then
20285 ranlib=":"
20286 fi
88d4d47b
PC
20287elif $ar s bar$_a >/dev/null 2>&1 &&
20288 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20289 $run ./foobar >/dev/null 2>&1; then
20290 echo "a table of contents needs to be added with '$ar s'."
20291 orderlib=false
20292 ranlib="$ar s"
b4eb6b3d 20293elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 20294 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20295 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20296 echo "a table of contents needs to be added with '$ar ts'."
20297 orderlib=false
20298 ranlib="$ar ts"
20299else
20300 case "$ranlib" in
20301 :) ranlib='';;
20302 '')
20303 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20304 $test -f $ranlib || ranlib=''
20305 ;;
20306 esac
20307 if $test -n "$ranlib"; then
20308 echo "your system has '$ranlib'; we'll use that."
20309 orderlib=false
20310 else
20311 echo "your system doesn't seem to support random libraries"
20312 echo "so we'll use lorder and tsort to order the libraries."
20313 orderlib=true
20314 ranlib=":"
20315 fi
20316fi
88d4d47b 20317$rm -f foo* bar*
b4eb6b3d 20318
92a3ac59
MB
20319: see if this is a values.h system
20320set values.h i_values
20321eval $inhdr
20322
73e6e416 20323: Check the max offset that gmtime and localtime accept
92a3ac59 20324echo "Checking max offsets that gmtime () accepts"
81c4fd9e 20325
92a3ac59
MB
20326case $i_values in
20327 define) yyy="#include <values.h>" ;;
20328 *) yyy="" ;;
20329 esac
20330
690aedd1
MB
20331case "$sGMTIME_min/$sGMTIME_max" in
20332 0/0|/)
20333 $cat >try.c <<EOCP
81c4fd9e
MB
20334#include <sys/types.h>
20335#include <stdio.h>
20336#include <time.h>
92a3ac59 20337$yyy
81c4fd9e 20338
92a3ac59
MB
20339int i;
20340struct tm *tmp;
20341time_t pt;
20342
1b289682 20343void gm_check (time_t t, int min_year, int max_year)
92a3ac59 20344{
81c4fd9e 20345 tmp = gmtime (&t);
1b289682
MB
20346 if ( tmp == NULL ||
20347 /* Check tm_year overflow */
20348 tmp->tm_year < min_year || tmp->tm_year > max_year)
92a3ac59
MB
20349 tmp = NULL;
20350 else
20351 pt = t;
20352 } /* gm_check */
81c4fd9e 20353
92a3ac59
MB
20354int check_max ()
20355{
73e6e416
MB
20356 tmp = NULL;
20357 pt = 0;
92a3ac59 20358#ifdef MAXLONG
1b289682 20359 gm_check (MAXLONG, 69, 0x7fffffff);
92a3ac59 20360#endif
73e6e416
MB
20361 if (tmp == NULL || tmp->tm_year < 0) {
20362 for (i = 63; i >= 0; i--) {
20363 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20364 if (x < 0 || x < pt) continue;
20365 gm_check (x, 69, 0x7fffffff);
73e6e416
MB
20366 }
20367 }
20368 printf ("sGMTIME_max=%ld\n", pt);
20369 return (0);
1b289682 20370 } /* check_max */
81c4fd9e 20371
92a3ac59
MB
20372int check_min ()
20373{
73e6e416
MB
20374 tmp = NULL;
20375 pt = 0;
92a3ac59 20376#ifdef MINLONG
1b289682 20377 gm_check (MINLONG, -1900, 70);
92a3ac59 20378#endif
73e6e416
MB
20379 if (tmp == NULL) {
20380 for (i = 36; i >= 0; i--) {
20381 time_t x = pt - ((time_t)1 << i);
20382 if (x > 0) continue;
1b289682 20383 gm_check (x, -1900, 70);
73e6e416
MB
20384 }
20385 }
20386 printf ("sGMTIME_min=%ld\n", pt);
20387 return (0);
20388 } /* check_min */
92a3ac59
MB
20389
20390int main (int argc, char *argv[])
20391{
73e6e416
MB
20392 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20393 check_max ();
20394 check_min ();
20395 return (0);
20396 } /* main */
81c4fd9e 20397EOCP
690aedd1
MB
20398 set try
20399 if eval $compile; then
20400 eval `$run ./try`
20401 else
20402 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20403 fi
20404 $rm_try
20405 ;;
20406 esac
81c4fd9e 20407
73e6e416
MB
20408echo "Checking max offsets that localtime () accepts"
20409
690aedd1
MB
20410case "$sLOCALTIME_min/$sLOCALTIME_max" in
20411 0/0|/)
20412 $cat >try.c <<EOCP
73e6e416
MB
20413#include <sys/types.h>
20414#include <stdio.h>
20415#include <time.h>
20416$yyy
20417
20418int i;
20419struct tm *tmp;
20420time_t pt;
20421
1b289682 20422void local_check (time_t t, int min_year, int max_year)
73e6e416 20423{
5bca5c48
MB
20424 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20425 tmp = NULL;
20426 else
20427 tmp = localtime (&t);
1b289682
MB
20428 if ( tmp == NULL ||
20429 /* Check tm_year overflow */
20430 tmp->tm_year < min_year || tmp->tm_year > max_year)
73e6e416
MB
20431 tmp = NULL;
20432 else
20433 pt = t;
20434 } /* local_check */
20435
20436int check_max ()
20437{
20438 tmp = NULL;
20439 pt = 0;
20440#ifdef MAXLONG
1b289682 20441 local_check (MAXLONG, 69, 0x7fffffff);
73e6e416
MB
20442#endif
20443 if (tmp == NULL || tmp->tm_year < 0) {
20444 for (i = 63; i >= 0; i--) {
20445 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20446 if (x < 0 || x < pt) continue;
20447 local_check (x, 69, 0x7fffffff);
73e6e416
MB
20448 }
20449 }
20450 printf ("sLOCALTIME_max=%ld\n", pt);
20451 return (0);
1b289682 20452 } /* check_max */
73e6e416
MB
20453
20454int check_min ()
20455{
20456 tmp = NULL;
20457 pt = 0;
20458#ifdef MINLONG
1b289682 20459 local_check (MINLONG, -1900, 70);
73e6e416
MB
20460#endif
20461 if (tmp == NULL) {
20462 for (i = 36; i >= 0; i--) {
20463 time_t x = pt - ((time_t)1 << i);
20464 if (x > 0) continue;
1b289682 20465 local_check (x, -1900, 70);
73e6e416
MB
20466 }
20467 }
20468 printf ("sLOCALTIME_min=%ld\n", pt);
20469 return (0);
20470 } /* check_min */
20471
20472int main (int argc, char *argv[])
20473{
20474 check_max ();
20475 check_min ();
20476 return (0);
20477 } /* main */
20478EOCP
690aedd1
MB
20479 set try
20480 if eval $compile; then
20481 eval `$run ./try`
20482 else
20483 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20484 fi
20485 $rm_try
20486 ;;
20487 esac
73e6e416 20488
c0bacbef 20489: check for type of arguments to select.
b4eb6b3d
JH
20490case "$selecttype" in
20491'') case "$d_select" in
20492 $define)
20493 echo " "
20494 $cat <<EOM
20495Checking to see what type of arguments are accepted by select().
20496EOM
20497 hdrs="$define sys/types.h
c0bacbef 20498 $i_systime sys/time.h
b4eb6b3d
JH
20499 $i_sysselct sys/select.h
20500 $d_socket sys/socket.h"
20501 : The first arg can be int, unsigned, or size_t
20502 : The last arg may or may not be 'const'
20503 val=''
20504 : void pointer has been seen but using that
20505 : breaks the selectminbits test
20506 for xxx in 'fd_set *' 'int *'; do
20507 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20508 for tmo in 'struct timeval *' 'const struct timeval *'; do
20509 case "$val" in
61c26d18 20510 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
b4eb6b3d
JH
20511 if ./protochk "$try" $hdrs; then
20512 echo "Your system accepts $xxx."
20513 val="$xxx"
20514 fi
20515 ;;
20516 esac
20517 done
20518 done
20519 done
20520 case "$val" in
20521 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20522 case "$d_fd_set" in
20523 $define) dflt="fd_set *" ;;
20524 *) dflt="int *" ;;
20525 esac
20526 . ./myread
20527 val=$ans
20528 ;;
20529 esac
20530 selecttype="$val"
20531 ;;
20532 *) : no select, so pick a harmless default
20533 selecttype='int *'
20534 ;;
20535 esac
20536 ;;
20537esac
20538
20539: check for the select 'width'
20540case "$selectminbits" in
e6e7e605
JH
20541'') safebits=`expr $ptrsize \* 8`
20542 case "$d_select" in
b4eb6b3d
JH
20543 $define)
20544 $cat <<EOM
20545
20546Checking to see on how many bits at a time your select() operates...
20547EOM
20548 $cat >try.c <<EOCP
20549#include <sys/types.h>
20550#$i_time I_TIME
20551#$i_systime I_SYS_TIME
20552#$i_systimek I_SYS_TIME_KERNEL
20553#ifdef I_TIME
20554# include <time.h>
20555#endif
20556#ifdef I_SYS_TIME
20557# ifdef I_SYS_TIME_KERNEL
20558# define KERNEL
20559# endif
20560# include <sys/time.h>
20561# ifdef I_SYS_TIME_KERNEL
20562# undef KERNEL
20563# endif
20564#endif
20565#$i_sysselct I_SYS_SELECT
20566#ifdef I_SYS_SELECT
20567#include <sys/select.h>
20568#endif
20569#$d_socket HAS_SOCKET
20570#ifdef HAS_SOCKET
20571# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20572#endif
20573#include <stdio.h>
d1daaddf
JH
20574#$i_stdlib I_STDLIB
20575#ifdef I_STDLIB
20576#include <stdlib.h>
20577#endif
b4eb6b3d
JH
20578$selecttype b;
20579#define S sizeof(*(b))
20580#define MINBITS 64
20581#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20582#define NBITS (NBYTES * 8)
20583int main() {
7090f861 20584 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
20585 struct timeval t;
20586 int i;
20587 FILE* fp;
20588 int fd;
20589
e6e7e605
JH
20590 if (!s)
20591 exit(1);
b4eb6b3d
JH
20592 fclose(stdin);
20593 fp = fopen("try.c", "r");
20594 if (fp == 0)
e6e7e605 20595 exit(2);
b4eb6b3d
JH
20596 fd = fileno(fp);
20597 if (fd < 0)
e6e7e605 20598 exit(3);
b4eb6b3d
JH
20599 b = ($selecttype)s;
20600 for (i = 0; i < NBITS; i++)
20601 FD_SET(i, b);
20602 t.tv_sec = 0;
20603 t.tv_usec = 0;
20604 select(fd + 1, b, 0, 0, &t);
20605 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 20606 free(s);
b4eb6b3d
JH
20607 printf("%d\n", i + 1);
20608 return 0;
20609}
20610EOCP
20611 set try
20612 if eval $compile_ok; then
5440bc8e 20613 selectminbits=`$run ./try`
b4eb6b3d
JH
20614 case "$selectminbits" in
20615 '') cat >&4 <<EOM
20616Cannot figure out on how many bits at a time your select() operates.
e6e7e605 20617I'll play safe and guess it is $safebits bits.
b4eb6b3d 20618EOM
e6e7e605
JH
20619 selectminbits=$safebits
20620 bits="$safebits bits"
b4eb6b3d
JH
20621 ;;
20622 1) bits="1 bit" ;;
20623 *) bits="$selectminbits bits" ;;
20624 esac
20625 echo "Your select() operates on $bits at a time." >&4
20626 else
20627 rp='What is the minimum number of bits your select() operates on?'
20628 case "$byteorder" in
e6e7e605
JH
20629 12345678) dflt=64 ;;
20630 1234) dflt=32 ;;
b4eb6b3d
JH
20631 *) dflt=1 ;;
20632 esac
20633 . ./myread
20634 val=$ans
20635 selectminbits="$val"
20636 fi
5b813a60 20637 $rm_try
b4eb6b3d
JH
20638 ;;
20639 *) : no select, so pick a harmless default
e6e7e605 20640 selectminbits=$safebits
b4eb6b3d
JH
20641 ;;
20642 esac
20643 ;;
20644esac
20645
20646: Trace out the files included by signal.h, then look for SIGxxx names.
b4eb6b3d
JH
20647if [ "X$fieldn" = X ]; then
20648 : Just make some guesses. We check them later.
20649 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20650else
20651 xxx=`echo '#include <signal.h>' |
20652 $cppstdin $cppminus $cppflags 2>/dev/null |
613d6c3e 20653 $grep '^[ ]*#.*include' |
776a38e3
MB
20654 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20655 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d 20656fi
b4eb6b3d
JH
20657xxxfiles=''
20658for xx in $xxx /dev/null ; do
20659 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20660done
b4eb6b3d
JH
20661case "$xxxfiles" in
20662'') xxxfiles=`./findhdr signal.h` ;;
20663esac
20664xxx=`awk '
20665$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20666 print substr($2, 4, 20)
20667}
20668$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20669 print substr($3, 4, 20)
20670}' $xxxfiles`
20671: Append some common names just in case the awk scan failed.
20672xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20673xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20674xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20675xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20676xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20677
20678: generate a few handy files for later
55954f19 20679$cat > signal.c <<EOCP
b4eb6b3d
JH
20680#include <sys/types.h>
20681#include <signal.h>
55954f19
JH
20682#$i_stdlib I_STDLIB
20683#ifdef I_STDLIB
20684#include <stdlib.h>
20685#endif
b4eb6b3d
JH
20686#include <stdio.h>
20687int main() {
20688
20689/* Strange style to avoid deeply-nested #if/#else/#endif */
20690#ifndef NSIG
20691# ifdef _NSIG
20692# define NSIG (_NSIG)
20693# endif
20694#endif
20695
20696#ifndef NSIG
20697# ifdef SIGMAX
20698# define NSIG (SIGMAX+1)
20699# endif
20700#endif
20701
20702#ifndef NSIG
20703# ifdef SIG_MAX
20704# define NSIG (SIG_MAX+1)
20705# endif
20706#endif
20707
20708#ifndef NSIG
3609ea0d
JH
20709# ifdef _SIG_MAX
20710# define NSIG (_SIG_MAX+1)
20711# endif
20712#endif
20713
20714#ifndef NSIG
b4eb6b3d
JH
20715# ifdef MAXSIG
20716# define NSIG (MAXSIG+1)
20717# endif
20718#endif
20719
20720#ifndef NSIG
20721# ifdef MAX_SIG
20722# define NSIG (MAX_SIG+1)
20723# endif
20724#endif
20725
20726#ifndef NSIG
20727# ifdef SIGARRAYSIZE
3609ea0d 20728# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
20729# endif
20730#endif
20731
20732#ifndef NSIG
20733# ifdef _sys_nsig
20734# define NSIG (_sys_nsig) /* Solaris 2.5 */
20735# endif
20736#endif
20737
20738/* Default to some arbitrary number that's big enough to get most
20739 of the common signals.
20740*/
20741#ifndef NSIG
20742# define NSIG 50
20743#endif
20744
20745printf("NSIG %d\n", NSIG);
20746
20747#ifndef JUST_NSIG
20748
20749EOCP
20750
20751echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20752{
20753 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 20754 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
20755 printf $1; printf ");\n"
20756 printf "#endif\n"
20757}
20758END {
20759 printf "#endif /* JUST_NSIG */\n";
20760 printf "exit(0);\n}\n";
20761}
20762' >>signal.c
20763$cat >signal.awk <<'EOP'
20764BEGIN { ndups = 0 }
65197d93 20765$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20766($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20767 if ($2 > maxsig) { maxsig = $2 }
20768 if (sig_name[$2]) {
20769 dup_name[ndups] = $1
20770 dup_num[ndups] = $2
613d6c3e 20771 ndups++
b4eb6b3d 20772 }
1ebe1ffb 20773 else {
65197d93
JH
20774 sig_name[$2] = $1
20775 sig_num[$2] = $2
b4eb6b3d
JH
20776 }
20777}
613d6c3e 20778END {
b4eb6b3d
JH
20779 if (nsig == 0) {
20780 nsig = maxsig + 1
20781 }
20782 printf("NSIG %d\n", nsig);
20783 for (n = 1; n < nsig; n++) {
20784 if (sig_name[n]) {
20785 printf("%s %d\n", sig_name[n], sig_num[n])
20786 }
20787 else {
613d6c3e 20788 printf("NUM%d %d\n", n, n)
b4eb6b3d
JH
20789 }
20790 }
20791 for (n = 0; n < ndups; n++) {
20792 printf("%s %d\n", dup_name[n], dup_num[n])
20793 }
20794}
20795EOP
20796$cat >signal_cmd <<EOS
20797$startsh
20798if $test -s signal.lst; then
20799 echo "Using your existing signal.lst file"
20800 exit 0
20801fi
20802xxx="$xxx"
20803EOS
20804$cat >>signal_cmd <<'EOS'
20805
20806set signal
20807if eval $compile_ok; then
776a38e3
MB
20808 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20809 $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20810else
20811 echo "(I can't seem be able to compile the whole test program)" >&4
20812 echo "(I'll try it in little pieces.)" >&4
20813 set signal -DJUST_NSIG
20814 if eval $compile_ok; then
5440bc8e 20815 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20816 $cat signal.nsg
20817 else
20818 echo "I can't seem to figure out how many signals you have." >&4
20819 echo "Guessing 50." >&4
20820 echo 'NSIG 50' > signal.nsg
20821 fi
20822 : Now look at all the signal names, one at a time.
20823 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20824 $cat > signal.c <<EOCP
20825#include <sys/types.h>
20826#include <signal.h>
20827#include <stdio.h>
20828int main() {
20829printf("$xx %d\n", SIG${xx});
20830return 0;
20831}
20832EOCP
20833 set signal
20834 if eval $compile; then
20835 echo "SIG${xx} found."
5440bc8e 20836 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20837 else
20838 echo "SIG${xx} NOT found."
20839 fi
20840 done
20841 if $test -s signal.ls1; then
20842 $cat signal.nsg signal.ls1 |
65197d93 20843 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20844 fi
20845
20846fi
20847if $test -s signal.lst; then
20848 :
20849else
20850 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20851 echo 'kill -l' >signal
20852 set X `csh -f <signal`
20853 $rm -f signal
20854 shift
20855 case $# in
20856 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20857 esac
20858 echo $@ | $tr ' ' $trnl | \
20859 $awk '{ printf "%s %d\n", $1, ++s; }
20860 END { printf "NSIG %d\n", ++s }' >signal.lst
20861fi
20862$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20863EOS
20864chmod a+x signal_cmd
20865$eunicefix signal_cmd
20866
20867: generate list of signal names
20868echo " "
20869case "$sig_name_init" in
20870'') doinit=yes ;;
20871*) case "$sig_num_init" in
20872 ''|*,*) doinit=yes ;;
20873 esac ;;
20874esac
20875case "$doinit" in
20876yes)
20877 echo "Generating a list of signal names and numbers..." >&4
20878 . ./signal_cmd
20879 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20880 sig_name=`$awk 'BEGIN { printf "ZERO " }
20881 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20882 sig_num=`$awk 'BEGIN { printf "0 " }
20883 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20884 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
20885 !/^NSIG/ { printf "\"%s\", ", $1 }
20886 END { printf "0\n" }' signal.lst`
20887 sig_num_init=`$awk 'BEGIN { printf "0, " }
20888 !/^NSIG/ { printf "%d, ", $2}
20889 END { printf "0\n"}' signal.lst`
20890 ;;
20891esac
20892echo "The following $sig_count signals are available:"
20893echo " "
20894echo $sig_name | $awk \
20895'BEGIN { linelen = 0 }
20896{
20897 for (i = 1; i <= NF; i++) {
20898 name = "SIG" $i " "
20899 linelen = linelen + length(name)
20900 if (linelen > 70) {
20901 printf "\n"
20902 linelen = length(name)
20903 }
20904 printf "%s", name
20905 }
20906 printf "\n"
20907}'
76d3c696 20908sig_size=`echo $sig_name | awk '{print NF}'`
c0bacbef 20909$rm -f signal signal.c signal.awk signal.lst signal_cmd
b4eb6b3d 20910
613d6c3e 20911: Check size of size
b4eb6b3d
JH
20912echo " "
20913case "$sizetype" in
20914*_t) zzz="$sizetype" ;;
20915*) zzz="filesize" ;;
20916esac
613d6c3e 20917echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
20918cat > try.c <<EOCP
20919#include <sys/types.h>
20920#include <stdio.h>
d1daaddf
JH
20921#$i_stdlib I_STDLIB
20922#ifdef I_STDLIB
20923#include <stdlib.h>
20924#endif
b4eb6b3d
JH
20925int main() {
20926 printf("%d\n", (int)sizeof($sizetype));
20927 exit(0);
20928}
20929EOCP
20930set try
20931if eval $compile_ok; then
5440bc8e 20932 yyy=`$run ./try`
b4eb6b3d
JH
20933 case "$yyy" in
20934 '') sizesize=4
20935 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20936 ;;
20937 *) sizesize=$yyy
20938 echo "Your $zzz size is $sizesize bytes."
20939 ;;
20940 esac
20941else
20942 sizesize=4
20943 echo "(I can't compile the test program--guessing $sizesize.)" >&4
20944fi
20945
20946
20947: check for socklen_t
20948echo " "
20949echo "Checking to see if you have socklen_t..." >&4
20950$cat >try.c <<EOCP
20951#include <sys/types.h>
20952#$d_socket HAS_SOCKET
20953#ifdef HAS_SOCKET
20954#include <sys/socket.h>
20955#endif
20956int main() { socklen_t x = 16; }
20957EOCP
20958set try
20959if eval $compile; then
20960 val="$define"
20961 echo "You have socklen_t."
20962else
20963 val="$undef"
20964 echo "You do not have socklen_t."
20965 case "$sizetype" in
20966 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20967 esac
20968fi
5b813a60 20969$rm_try
b4eb6b3d
JH
20970set d_socklen_t
20971eval $setvar
20972
a7710f8d
JH
20973: see if this is a socks.h system
20974set socks.h i_socks
20975eval $inhdr
20976
b4eb6b3d
JH
20977: check for type of the size argument to socket calls
20978case "$d_socket" in
20979"$define")
20980 $cat <<EOM
20981
20982Checking to see what type is the last argument of accept().
20983EOM
b4eb6b3d
JH
20984 yyy=''
20985 case "$d_socklen_t" in
20986 "$define") yyy="$yyy socklen_t"
20987 esac
20988 yyy="$yyy $sizetype int long unsigned"
20989 for xxx in $yyy; do
20990 case "$socksizetype" in
61c26d18 20991 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
20992 case "$usesocks" in
20993 "$define")
20994 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20995 echo "Your system accepts '$xxx *' for the last argument of accept()."
20996 socksizetype="$xxx"
20997 fi
20998 ;;
20999 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
21000 echo "Your system accepts '$xxx *' for the last argument of accept()."
21001 socksizetype="$xxx"
21002 fi
21003 ;;
21004 esac
b4eb6b3d
JH
21005 ;;
21006 esac
21007 done
21008: In case none of those worked, prompt the user.
21009 case "$socksizetype" in
21010 '') rp='What is the type for socket address structure sizes?'
21011 dflt='int'
21012 . ./myread
21013 socksizetype=$ans
21014 ;;
21015 esac
21016 ;;
21017*) : no sockets, so pick relatively harmless default
21018 socksizetype='int'
21019 ;;
21020esac
21021
21022: see what type is used for signed size_t
21023set ssize_t ssizetype int stdio.h sys/types.h
21024eval $typedef
21025dflt="$ssizetype"
5440bc8e 21026$cat > try.c <<EOM
b4eb6b3d 21027#include <stdio.h>
d1daaddf
JH
21028#$i_stdlib I_STDLIB
21029#ifdef I_STDLIB
21030#include <stdlib.h>
21031#endif
b4eb6b3d
JH
21032#include <sys/types.h>
21033#define Size_t $sizetype
21034#define SSize_t $dflt
21035int main()
21036{
21037 if (sizeof(Size_t) == sizeof(SSize_t))
21038 printf("$dflt\n");
21039 else if (sizeof(Size_t) == sizeof(int))
21040 printf("int\n");
5b813a60 21041 else
b4eb6b3d
JH
21042 printf("long\n");
21043 exit(0);
21044}
21045EOM
21046echo " "
5440bc8e
JH
21047set try
21048if eval $compile_ok && $run ./try > /dev/null; then
21049 ssizetype=`$run ./try`
b4eb6b3d
JH
21050 echo "I'll be using $ssizetype for functions returning a byte count." >&4
21051else
21052 $cat >&4 <<EOM
21053Help! I can't compile and run the ssize_t test program: please enlighten me!
21054(This is probably a misconfiguration in your system or libraries, and
21055you really ought to fix it. Still, I'll try anyway.)
21056
21057I need a type that is the same size as $sizetype, but is guaranteed to
21058be signed. Common values are ssize_t, int and long.
21059
21060EOM
21061 rp="What signed type is the same size as $sizetype?"
21062 . ./myread
21063 ssizetype="$ans"
21064fi
5b813a60 21065$rm_try
b4eb6b3d
JH
21066
21067: see what type of char stdio uses.
21068echo " "
1d8eaf8c 21069echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
aa517f50 21070if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
21071 echo "Your stdio uses unsigned chars." >&4
21072 stdchar="unsigned char"
21073else
aa517f50
JH
21074 echo "Your stdio uses signed chars." >&4
21075 stdchar="char"
b4eb6b3d 21076fi
1d8eaf8c 21077$rm -f stdioh
b4eb6b3d 21078
b4eb6b3d
JH
21079: see what type uids are declared as in the kernel
21080echo " "
21081echo "Looking for the type for user ids returned by getuid()."
21082set uid_t uidtype xxx stdio.h sys/types.h
21083eval $typedef
21084case "$uidtype" in
21085xxx)
21086 xxx=`./findhdr sys/user.h`
21087 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21088 case $1 in
21089 unsigned) dflt="$1 $2" ;;
21090 *) dflt="$1" ;;
21091 esac
21092 ;;
21093*) dflt="$uidtype";;
21094esac
21095case "$uidtype" in
21096uid_t) echo "uid_t found." ;;
21097*) rp="What is the type for user ids returned by getuid()?"
21098 . ./myread
21099 uidtype="$ans"
21100 ;;
21101esac
21102
613d6c3e 21103: Check size of UID
b4eb6b3d
JH
21104echo " "
21105case "$uidtype" in
21106*_t) zzz="$uidtype" ;;
21107*) zzz="uid" ;;
21108esac
613d6c3e 21109echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21110cat > try.c <<EOCP
21111#include <sys/types.h>
21112#include <stdio.h>
d1daaddf
JH
21113#$i_stdlib I_STDLIB
21114#ifdef I_STDLIB
21115#include <stdlib.h>
21116#endif
b4eb6b3d
JH
21117int main() {
21118 printf("%d\n", (int)sizeof($uidtype));
21119 exit(0);
21120}
21121EOCP
21122set try
21123if eval $compile_ok; then
5440bc8e 21124 yyy=`$run ./try`
b4eb6b3d
JH
21125 case "$yyy" in
21126 '') uidsize=4
21127 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21128 ;;
21129 *) uidsize=$yyy
21130 echo "Your $zzz is $uidsize bytes long."
21131 ;;
21132 esac
21133else
21134 uidsize=4
21135 echo "(I can't compile the test program--guessing $uidsize.)" >&4
21136fi
21137
613d6c3e 21138: Check if UID is signed
b4eb6b3d
JH
21139echo " "
21140case "$uidtype" in
21141*_t) zzz="$uidtype" ;;
21142*) zzz="uid" ;;
21143esac
21144echo "Checking the sign of $zzz..." >&4
21145cat > try.c <<EOCP
21146#include <sys/types.h>
21147#include <stdio.h>
21148int main() {
21149 $uidtype foo = -1;
21150 if (foo < 0)
21151 printf("-1\n");
21152 else
21153 printf("1\n");
21154}
21155EOCP
21156set try
21157if eval $compile; then
5440bc8e 21158 yyy=`$run ./try`
b4eb6b3d
JH
21159 case "$yyy" in
21160 '') uidsign=1
21161 echo "(I can't execute the test program--guessing unsigned.)" >&4
21162 ;;
21163 *) uidsign=$yyy
21164 case "$uidsign" in
21165 1) echo "Your $zzz is unsigned." ;;
21166 -1) echo "Your $zzz is signed." ;;
21167 esac
21168 ;;
21169 esac
21170else
21171 uidsign=1
21172 echo "(I can't compile the test program--guessing unsigned.)" >&4
21173fi
21174
21175
34f1896b 21176: Check format string for UID
b4eb6b3d
JH
21177echo " "
21178$echo "Checking the format string to be used for uids..." >&4
21179
21180case "$uidsign" in
21181-1) if $test X"$uidsize" = X"$ivsize"; then
21182 uidformat="$ivdformat"
21183 else
21184 if $test X"$uidsize" = X"$longsize"; then
21185 uidformat='"ld"'
21186 else
21187 if $test X"$uidsize" = X"$intsize"; then
21188 uidformat='"d"'
21189 else
21190 if $test X"$uidsize" = X"$shortsize"; then
21191 uidformat='"hd"'
21192 fi
21193 fi
21194 fi
21195 fi
21196 ;;
21197*) if $test X"$uidsize" = X"$uvsize"; then
21198 uidformat="$uvuformat"
21199 else
21200 if $test X"$uidsize" = X"$longsize"; then
21201 uidformat='"lu"'
21202 else
21203 if $test X"$uidsize" = X"$intsize"; then
21204 uidformat='"u"'
21205 else
21206 if $test X"$uidsize" = X"$shortsize"; then
21207 uidformat='"hu"'
21208 fi
21209 fi
21210 fi
21211 fi
21212 ;;
21213esac
21214
34f1896b 21215: Check if site customization support was requested
4afd418c
MB
21216case "$usesitecustomize" in
21217 $define|true|[Yy]*)
21218 usesitecustomize="$define"
21219 ;;
21220 *)
21221 usesitecustomize="$undef"
21222 ;;
21223 esac
21224
d03b3b00
MB
21225: see if prototypes support variable argument declarations
21226echo " "
21227case "$prototype$i_stdarg" in
21228$define$define)
21229 echo "It appears we'll be able to prototype varargs functions." >&4
21230 val="$define"
21231 ;;
21232*)
21233 echo "Too bad... We won't be using prototyped varargs functions..." >&4
21234 val="$undef"
21235 ;;
21236esac
21237set vaproto
21238eval $setvar
21239
3659ebf1
JH
21240: determine compiler compiler
21241case "$yacc" in
21242'')
21243 dflt=yacc;;
21244*)
21245 dflt="$yacc";;
21246esac
21247echo " "
21248comp='yacc'
3c728e00 21249if $test -f "$byacc$_exe"; then
3659ebf1
JH
21250 dflt="$byacc"
21251 comp="byacc or $comp"
21252fi
3c728e00 21253if $test -f "$bison$_exe"; then
3659ebf1
JH
21254 comp="$comp or bison -y"
21255fi
21256rp="Which compiler compiler ($comp) shall I use?"
21257. ./myread
21258yacc="$ans"
21259case "$yacc" in
21260*bis*)
21261 case "$yacc" in
21262 *-y*) ;;
21263 *)
21264 yacc="$yacc -y"
21265 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21266 ;;
21267 esac
21268 ;;
21269esac
21270
c0bacbef
MB
21271: see if this is a assert.h system
21272set assert.h i_assert
21273eval $inhdr
21274
758a5d79
JH
21275: see if this is a fp.h system
21276set fp.h i_fp
21277eval $inhdr
21278
21279: see if this is a fp_class.h system
21280set fp_class.h i_fp_class
21281eval $inhdr
21282
13cfc98d
MB
21283: see if gdbm.h is available
21284set gdbm.h t_gdbm
21285eval $inhdr
21286case "$t_gdbm" in
21287$define)
21288 : see if gdbm_open exists
21289 set gdbm_open d_gdbm_open
21290 eval $inlibc
21291 case "$d_gdbm_open" in
21292 $undef)
21293 t_gdbm="$undef"
21294 echo "We won't be including <gdbm.h>"
21295 ;;
21296 esac
21297 ;;
21298esac
21299val="$t_gdbm"
21300set i_gdbm
21301eval $setvar
21302
b2f871ed
AD
21303: see if this is a ieeefp.h system
21304case "$i_ieeefp" in
21305'' ) set ieeefp.h i_ieeefp
21306 eval $inhdr
21307 ;;
21308esac
21309
21310: see if this is a libutil.h system
21311set libutil.h i_libutil
21312eval $inhdr
21313
21314: see if mach cthreads are available
21315if test "X$usethreads" = "X$define"; then
21316 set mach/cthreads.h i_machcthr
21317 eval $inhdr
21318else
21319 i_machcthr="$undef"
21320fi
21321
21322: see if this is a mntent.h system
21323set mntent.h i_mntent
21324eval $inhdr
21325
b4eb6b3d
JH
21326: see if net/errno.h is available
21327val=''
21328set net/errno.h val
21329eval $inhdr
21330
21331: Unfortunately, it causes problems on some systems. Arrgh.
21332case "$val" in
21333$define)
21334 cat > try.c <<'EOM'
21335#include <stdio.h>
21336#include <errno.h>
21337#include <net/errno.h>
21338int func()
21339{
21340 return ENOTSOCK;
21341}
21342EOM
21343 if $cc $ccflags -c try.c >/dev/null 2>&1; then
21344 echo "We'll be including <net/errno.h>." >&4
21345 else
21346 echo "We won't be including <net/errno.h>." >&4
21347 val="$undef"
21348 fi
5b813a60 21349 $rm_try
b4eb6b3d
JH
21350 ;;
21351esac
21352set i_neterrno
21353eval $setvar
21354
21355: see if netinet/tcp.h is available
21356set netinet/tcp.h i_netinettcp
21357eval $inhdr
21358
21359: see if this is a poll.h system
21360set poll.h i_poll
21361eval $inhdr
21362
21363: see if this is a prot.h system
21364set prot.h i_prot
21365eval $inhdr
21366
613d6c3e 21367: Preprocessor symbols
b4eb6b3d 21368echo " "
ddfca5da 21369$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
21370$cat <<'EOSH' > Cppsym.know
21371a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21372AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 21373alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
21374ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21375BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
21376BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21377bull c cadmus clipper CMU COFF COMPILER_VERSION
21378concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 21379CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
21380Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21381FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21382GLIBC GLIBC_MINOR
21383GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
21384H3050R H3050RX hbullx20 hcx host_mips
21385hp200 hp300 hp700 HP700 hp800 hp9000
21386hp9000s200 hp9000s300 hp9000s400 hp9000s500
21387hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21388i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 21389IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
21390INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21391LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21392LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 21393LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
21394LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21395M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21396M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21397M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21398MATH_HAS_NO_SIDE_EFFECTS
21399mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21400mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21401mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21402MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21403mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21404NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 21405news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
21406ns32016 ns32332 ns32k nsc32000
21407OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21408pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21409pc532 pdp11 PGC PIC plexus PORTAR posix
21410POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21411POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 21412PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 21413riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
21414SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21415sony sony_news sonyrisc sparc sparclite spectrum
21416stardent stdc STDC_EXT stratos sun sun3 sun386
21417Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21418SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21419SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21420sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 21421TM3200 TM5400 TM5600
b4eb6b3d
JH
21422tower tower32 tower32_200 tower32_600 tower32_700
21423tower32_800 tower32_850 tss
21424u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21425ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
21426unix UNIX95 UNIX99 unixpc unos
21427USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21428USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21429USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21430USGr4 USGr4_2
44c87379 21431Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
21432XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21433XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21434z8000
21435EOSH
21436# Maybe put other stuff here too.
21437cat <<EOSH >>Cppsym.know
21438$osname
21439EOSH
21440./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21441./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21442$cat Cppsym.know > Cppsym.c
381aa1ff 21443$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
21444$rm -f Cppsym.a Cppsym.b Cppsym.c
21445cat <<EOSH > Cppsym
21446$startsh
21447if $test \$# -gt 0; then
21448 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21449 if $test -s Cppsym.got; then
21450 $rm -f Cppsym.got
21451 exit 0
21452 fi
21453 $rm -f Cppsym.got
21454 exit 1
21455else
21456 $tr " " "$trnl" | ./Cppsym.try
21457 exit 0
21458fi
21459EOSH
21460chmod +x Cppsym
21461$eunicefix Cppsym
21462cat <<EOSH > Cppsym.try
21463$startsh
21464cat <<'EOCP' > try.c
21465#include <stdio.h>
360321b3
YST
21466#if cpp_stuff == 1
21467#define STRINGIFY(a) "a"
21468#endif
21469#if cpp_stuff == 42
21470#define StGiFy(a) #a
21471#define STRINGIFY(a) StGiFy(a)
21472#endif
21473#if $cpp_stuff != 1 && $cpp_stuff != 42
21474# include "Bletch: How does this C preprocessor stringify macros?"
21475#endif
b4eb6b3d
JH
21476int main() {
21477EOCP
21478$awk \\
21479EOSH
21480cat <<'EOSH' >> Cppsym.try
21481'length($1) > 0 {
360321b3
YST
21482 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21483 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21484 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21485 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 21486}' >> try.c
2ef53570 21487echo 'return 0;}' >> try.c
b4eb6b3d
JH
21488EOSH
21489cat <<EOSH >> Cppsym.try
21490ccflags="$ccflags"
21491case "$osname-$gccversion" in
21492irix-) ccflags="\$ccflags -woff 1178" ;;
21493os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21494esac
360321b3 21495$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
21496EOSH
21497chmod +x Cppsym.try
21498$eunicefix Cppsym.try
21499./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 21500: Add in any linux cpp "predefined macros":
b6a7163e 21501case "$osname::$gccversion" in
eeb92b76 21502 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
b6a7163e
MB
21503 tHdrH=_tmpHdr
21504 rm -f $tHdrH'.h' $tHdrH
21505 touch $tHdrH'.h'
6f5be6d1 21506 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
b6a7163e
MB
21507 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21508 if [ -s $tHdrH'_cppsym.real' ]; then
21509 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21510 fi
21511 fi
21512 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21513 ;;
21514esac
b4eb6b3d
JH
21515: now check the C compiler for additional symbols
21516postprocess_cc_v=''
21517case "$osname" in
21518aix) postprocess_cc_v="|$tr , ' '" ;;
21519esac
21520$cat >ccsym <<EOS
21521$startsh
21522$cat >tmp.c <<EOF
21523extern int foo;
21524EOF
21525for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21526do
21527 case "\$i" in
21528 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 21529 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
21530 esac
21531done
5b813a60 21532$rm_try
b4eb6b3d
JH
21533EOS
21534postprocess_cc_v=''
21535chmod +x ccsym
21536$eunicefix ccsym
21537./ccsym > ccsym1.raw
21538if $test -s ccsym1.raw; then
21539 $sort ccsym1.raw | $uniq >ccsym.raw
21540else
21541 mv ccsym1.raw ccsym.raw
21542fi
21543
21544$awk '/\=/ { print $0; next }
21545 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
21546$comm -13 Cppsym.true ccsym.list >ccsym.own
21547$comm -12 Cppsym.true ccsym.list >ccsym.com
21548$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
21549also=''
21550if $test -z ccsym.raw; then
21551 echo "Your C compiler doesn't seem to define any symbols!" >&4
21552 echo " "
21553 echo "However, your C preprocessor defines the following symbols:"
21554 $cat Cppsym.true
21555 ccsymbols=''
21556 cppsymbols=`$cat Cppsym.true`
21557 cppsymbols=`echo $cppsymbols`
21558 cppccsymbols="$cppsymbols"
21559else
21560 if $test -s ccsym.com; then
21561 echo "Your C compiler and pre-processor define these symbols:"
21562 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21563 also='also '
21564 symbols='ones'
21565 cppccsymbols=`$cat ccsym.com`
21566 cppccsymbols=`echo $cppccsymbols`
21567 $test "$silent" || sleep 1
21568 fi
21569 if $test -s ccsym.cpp; then
21570 $test "$also" && echo " "
21571 echo "Your C pre-processor ${also}defines the following symbols:"
21572 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21573 also='further '
21574 cppsymbols=`$cat ccsym.cpp`
21575 cppsymbols=`echo $cppsymbols`
21576 $test "$silent" || sleep 1
21577 fi
21578 if $test -s ccsym.own; then
21579 $test "$also" && echo " "
21580 echo "Your C compiler ${also}defines the following cpp symbols:"
21581 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21582 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21583 ccsymbols=`$cat ccsym.own`
21584 ccsymbols=`echo $ccsymbols`
21585 $test "$silent" || sleep 1
21586 fi
21587fi
b4eb6b3d
JH
21588
21589: see if this is a termio system
21590val="$undef"
21591val2="$undef"
21592val3="$undef"
21593if $test `./findhdr termios.h`; then
21594 set tcsetattr i_termios
21595 eval $inlibc
21596 val3="$i_termios"
21597fi
21598echo " "
21599case "$val3" in
21600"$define") echo "You have POSIX termios.h... good!" >&4;;
21601*) if ./Cppsym pyr; then
21602 case "`/bin/universe`" in
21603 ucb) if $test `./findhdr sgtty.h`; then
21604 val2="$define"
21605 echo "<sgtty.h> found." >&4
21606 else
21607 echo "System is pyramid with BSD universe."
216dac04 21608 ./warn "<sgtty.h> not found--you could have problems."
b4eb6b3d
JH
21609 fi;;
21610 *) if $test `./findhdr termio.h`; then
21611 val="$define"
21612 echo "<termio.h> found." >&4
21613 else
21614 echo "System is pyramid with USG universe."
216dac04 21615 ./warn "<termio.h> not found--you could have problems."
b4eb6b3d
JH
21616 fi;;
21617 esac
21618 elif ./usg; then
21619 if $test `./findhdr termio.h`; then
21620 echo "<termio.h> found." >&4
21621 val="$define"
21622 elif $test `./findhdr sgtty.h`; then
21623 echo "<sgtty.h> found." >&4
21624 val2="$define"
21625 else
216dac04 21626 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
b4eb6b3d
JH
21627 fi
21628 else
21629 if $test `./findhdr sgtty.h`; then
21630 echo "<sgtty.h> found." >&4
21631 val2="$define"
21632 elif $test `./findhdr termio.h`; then
21633 echo "<termio.h> found." >&4
21634 val="$define"
21635 else
216dac04 21636 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
b4eb6b3d
JH
21637 fi
21638 fi;;
21639esac
21640set i_termio; eval $setvar
21641val=$val2; set i_sgtty; eval $setvar
21642val=$val3; set i_termios; eval $setvar
21643
b4eb6b3d
JH
21644: see if stddef is available
21645set stddef.h i_stddef
21646eval $inhdr
923fc586 21647
b4eb6b3d
JH
21648: see if sys/access.h is available
21649set sys/access.h i_sysaccess
21650eval $inhdr
21651
21652: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21653set sys/filio.h i_sysfilio
21654eval $inhdr
21655echo " "
21656if $test `./findhdr sys/ioctl.h`; then
21657 val="$define"
21658 echo '<sys/ioctl.h> found.' >&4
21659else
21660 val="$undef"
21661 if $test $i_sysfilio = "$define"; then
21662 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 21663 else
b4eb6b3d
JH
21664 $test $i_sgtty = "$define" && xxx="sgtty.h"
21665 $test $i_termio = "$define" && xxx="termio.h"
21666 $test $i_termios = "$define" && xxx="termios.h"
21667echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21668 fi
21669fi
21670set i_sysioctl
21671eval $setvar
21672
49a78c82
JH
21673: see if socket ioctl defs are in sys/sockio.h
21674echo " "
21675xxx=`./findhdr sys/sockio.h`
21676if $test "$xxx"; then
21677 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21678 val="$define"
21679 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21680 else
21681 val="$undef"
21682 echo "No socket ioctls found in <sys/sockio.h>." >&4
21683 fi
21684else
21685 val="$undef"
21686 $cat <<EOM
21687<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21688EOM
21689fi
21690set i_syssockio
21691eval $setvar
21692
b4eb6b3d
JH
21693: see if this is a syslog.h system
21694set syslog.h i_syslog
21695eval $inhdr
21696
b4eb6b3d
JH
21697: see if this is a sys/mode.h system
21698set sys/mode.h i_sysmode
21699eval $inhdr
21700
216dac04
MB
21701: see if there is a sys/poll.h file
21702set sys/poll.h i_syspoll
21703eval $inhdr
21704
b4eb6b3d
JH
21705: see if sys/resource.h has to be included
21706set sys/resource.h i_sysresrc
21707eval $inhdr
21708
21709: see if sys/security.h is available
21710set sys/security.h i_syssecrt
21711eval $inhdr
21712
21713: see if this is a sys/statvfs.h system
21714set sys/statvfs.h i_sysstatvfs
21715eval $inhdr
21716
b4eb6b3d
JH
21717: see if this is a sys/un.h system
21718set sys/un.h i_sysun
21719eval $inhdr
21720
b4eb6b3d
JH
21721: see if this is a sys/utsname.h system
21722set sys/utsname.h i_sysutsname
21723eval $inhdr
21724
21725: see if this is a syswait system
21726set sys/wait.h i_syswait
21727eval $inhdr
21728
21729: see if this is a ustat.h system
21730set ustat.h i_ustat
21731eval $inhdr
21732
21733: see if this is an utime system
21734set utime.h i_utime
21735eval $inhdr
21736
b4eb6b3d
JH
21737: see if this is a vfork system
21738case "$d_vfork" in
21739"$define")
21740 set vfork.h i_vfork
21741 eval $inhdr
21742 ;;
21743*)
21744 i_vfork="$undef"
21745 ;;
21746esac
21747
613d6c3e 21748: Check extensions
b4eb6b3d
JH
21749echo " "
21750echo "Looking for extensions..." >&4
21751: If we are using the old config.sh, known_extensions may contain
21752: old or inaccurate or duplicate values.
21753known_extensions=''
21754nonxs_extensions=''
21755: We do not use find because it might not be available.
21756: We do not just use MANIFEST because the user may have dropped
21757: some additional extensions into the source tree and expect them
21758: to be built.
21759
38fddf8b
MB
21760: Function to recursively find available extensions, ignoring DynaLoader
21761: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
4cc80fc4 21762: In 5.10.1 and later, extensions are stored in directories
88a6f4fc 21763: like File-Glob instead of the older File/Glob/.
b4eb6b3d
JH
21764find_extensions='
21765 for xxx in *; do
822a6ee0
MB
21766 case "$xxx" in
21767 DynaLoader|dynaload) ;;
21768 *)
238a6851
NC
21769 this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21770 leaf=`echo $xxx | $sed -e s/.*-//`;
dd6c21be 21771 if $test -d File; then
38fddf8b
MB
21772 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21773 known_extensions="$known_extensions $1$this_ext";
21774 elif $test -f $xxx/Makefile.PL; then
21775 nonxs_extensions="$nonxs_extensions $1$this_ext";
21776 else
21777 if $test -d $xxx -a $# -lt 10; then
21778 set $1$xxx/ $*;
21779 cd "$xxx";
21780 eval $find_extensions;
21781 cd ..;
21782 shift;
21783 fi;
21784 fi;
dd6c21be
NC
21785 else
21786 $ls -1 $xxx > $$.tmp;
21787 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21788 known_extensions="$known_extensions $this_ext";
21789 elif $contains "\.c$" $$.tmp > /dev/null 2>&1; then
21790 known_extensions="$known_extensions $this_ext";
dd6c21be
NC
21791 elif $test -d $xxx; then
21792 nonxs_extensions="$nonxs_extensions $this_ext";
21793 fi;
21794 $rm -f $$.tmp;
822a6ee0
MB
21795 fi
21796 ;;
21797 esac;
b4eb6b3d
JH
21798 done'
21799tdir=`pwd`
dd6c21be
NC
21800cd "$rsrc/cpan"
21801set X
21802shift
21803eval $find_extensions
a193a2db
NC
21804cd "$rsrc/dist"
21805set X
21806shift
21807eval $find_extensions
6904989c 21808cd "$rsrc/ext"
b4eb6b3d
JH
21809set X
21810shift
21811eval $find_extensions
38fddf8b
MB
21812if $test -d File-Glob; then
21813 : All ext/ flattened
21814else
21815 # Special case: Add in modules that nest beyond the first level.
21816 # Currently threads/shared and Hash/Util/FieldHash, since they are
21817 # not picked up by the recursive find above (and adding in general
21818 # recursive finding breaks SDBM_File/sdbm).
21819 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21820 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21821fi
faae14e6
MB
21822set X $known_extensions
21823shift
a32b3e13 21824known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
b4eb6b3d
JH
21825set X $nonxs_extensions
21826shift
a32b3e13 21827nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
6904989c 21828cd "$tdir"
b4eb6b3d
JH
21829
21830: Now see which are supported on this system.
21831avail_ext=''
21832for xxx in $known_extensions ; do
21833 case "$xxx" in
21834 DB_File|db_file)
21835 case "$i_db" in
21836 $define) avail_ext="$avail_ext $xxx" ;;
21837 esac
21838 ;;
21839 GDBM_File|gdbm_fil)
7c345082 21840 case "$i_gdbm" in
b4eb6b3d
JH
21841 $define) avail_ext="$avail_ext $xxx" ;;
21842 esac
21843 ;;
1d59c593 21844 I18N/Langinfo|i18n_lan)
7c345082 21845 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
21846 $define$define) avail_ext="$avail_ext $xxx" ;;
21847 esac
21848 ;;
7978b0db
JH
21849 IPC/SysV|ipc/sysv)
21850 : XXX Do we need a useipcsysv variable here
21851 case "${d_msg}${d_sem}${d_shm}" in
21852 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21853 esac
21854 ;;
b4eb6b3d 21855 NDBM_File|ndbm_fil)
7894ad66 21856 case "$d_ndbm" in
b4eb6b3d
JH
21857 $define)
21858 case "$osname-$use64bitint" in
0be9fa5d 21859 hpux-define)
b4eb6b3d
JH
21860 case "$libs" in
21861 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21862 esac
21863 ;;
21864 *) avail_ext="$avail_ext $xxx" ;;
21865 esac
21866 ;;
21867 esac
21868 ;;
7c345082 21869 ODBM_File|odbm_fil)
b4eb6b3d
JH
21870 case "${i_dbm}${i_rpcsvcdbm}" in
21871 *"${define}"*)
7978b0db
JH
21872 case "$d_cplusplus" in
21873 define) ;; # delete as a function name will not work
21874 *) case "$osname-$use64bitint" in
21875 hpux-define)
21876 case "$libs" in
21877 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21878 esac
21879 ;;
21880 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
21881 esac
21882 ;;
b4eb6b3d
JH
21883 esac
21884 ;;
21885 esac
21886 ;;
7978b0db
JH
21887 Opcode|opcode)
21888 case "$useopcode" in
b4eb6b3d
JH
21889 true|define|y) avail_ext="$avail_ext $xxx" ;;
21890 esac
21891 ;;
7978b0db
JH
21892 POSIX|posix)
21893 case "$useposix" in
b4eb6b3d
JH
21894 true|define|y) avail_ext="$avail_ext $xxx" ;;
21895 esac
21896 ;;
21897 Socket|socket)
7c345082 21898 case "$d_socket" in
4a9f028c
JH
21899 true|$define|y)
21900 case "$osname" in
21901 beos) ;; # not unless BONE
21902 *) avail_ext="$avail_ext $xxx" ;;
21903 esac
21904 ;;
b4eb6b3d
JH
21905 esac
21906 ;;
21907 Sys/Syslog|sys/syslog)
21908 : XXX syslog requires socket
7c345082 21909 case "$d_socket" in
b4eb6b3d
JH
21910 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21911 esac
21912 ;;
21913 Thread|thread)
b00ec89b
AB
21914 case "$usethreads" in
21915 true|$define|y)
47f9f84c 21916 case "$use5005threads" in
3f30fabf 21917 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 21918 esac
b4eb6b3d
JH
21919 esac
21920 ;;
7978b0db
JH
21921 threads|threads/shared)
21922 # threads and threads::shared are special cases.
21923 # To stop people from asking "Perl 5.8.0 was supposed
21924 # to have this new fancy threads implementation but my
21925 # perl doesn't have it" and from people trying to
21926 # (re)install the threads module using CPAN.pm and
21927 # CPAN.pm then offering to reinstall Perl 5.8.0,
21928 # the threads.pm and threads/shared.pm will always be
21929 # there, croaking informatively ("you need to rebuild
21930 # all of Perl with threads, sorry") when threads haven't
21931 # been compiled in.
21932 # --jhi
21933 avail_ext="$avail_ext $xxx"
21934 ;;
aefe3e7e
NC
21935 VMS*)
21936 ;;
78ff2d7b 21937 Win32*)
b149d92d
JD
21938 case "$osname" in
21939 cygwin) avail_ext="$avail_ext $xxx" ;;
21940 esac
21941 ;;
f9b6ed1c
AD
21942 XS/APItest|xs/apitest)
21943 # This is just for testing. Skip it unless we have dynamic loading.
88e1f1a2
JV
21944
21945 case "$usedl" in
21946 $define) avail_ext="$avail_ext $xxx" ;;
21947 esac
21948 ;;
21949 XS/APItest/KeywordRPN|xs/apitest/keywordrpn)
21950 # This is just for testing. Skip it unless we have dynamic loading.
f9b6ed1c
AD
21951
21952 case "$usedl" in
21953 $define) avail_ext="$avail_ext $xxx" ;;
21954 esac
21955 ;;
21956 XS/Typemap|xs/typemap)
21957 # This is just for testing. Skip it unless we have dynamic loading.
21958 case "$usedl" in
21959 $define) avail_ext="$avail_ext $xxx" ;;
21960 esac
21961 ;;
b4eb6b3d 21962 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
21963 ;;
21964 esac
b4eb6b3d 21965done
5f80c64f 21966
b4eb6b3d
JH
21967set X $avail_ext
21968shift
21969avail_ext="$*"
5f80c64f 21970
ef0c5be8
JH
21971case "$onlyextensions" in
21972'') ;;
21973*) keepextensions=''
21974 echo "You have requested that only certains extensions be included..." >&4
21975 for i in $onlyextensions; do
21976 case " $avail_ext " in
21977 *" $i "*)
21978 echo "Keeping extension $i."
21979 keepextensions="$keepextensions $i"
21980 ;;
21981 *) echo "Ignoring extension $i." ;;
21982 esac
21983 done
21984 avail_ext="$keepextensions"
21985 ;;
21986esac
21987
21988case "$noextensions" in
21989'') ;;
21990*) keepextensions=''
21991 echo "You have requested that certain extensions be ignored..." >&4
21992 for i in $avail_ext; do
c3dadc13
AD
21993 case " $noextensions " in
21994 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
21995 *) echo "Keeping extension $i.";
21996 keepextensions="$keepextensions $i"
21997 ;;
21998 esac
21999 done
22000 avail_ext="$keepextensions"
22001 ;;
22002esac
22003
b4eb6b3d
JH
22004: Now see which nonxs extensions are supported on this system.
22005: For now assume all are.
22006nonxs_ext=''
22007for xxx in $nonxs_extensions ; do
22008 case "$xxx" in
22009 *) nonxs_ext="$nonxs_ext $xxx"
22010 ;;
22011 esac
22012done
5f80c64f 22013
b4eb6b3d
JH
22014set X $nonxs_ext
22015shift
22016nonxs_ext="$*"
22017
22018case $usedl in
22019$define)
22020 $cat <<EOM
22021A number of extensions are supplied with $package. You may choose to
22022compile these extensions for dynamic loading (the default), compile
22023them into the $package executable (static loading), or not include
22024them at all. Answer "none" to include no extensions.
22025Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
22026
22027EOM
b4eb6b3d 22028 case "$dynamic_ext" in
736accd3
YST
22029 '')
22030 : Exclude those listed in static_ext
22031 dflt=''
22032 for xxx in $avail_ext; do
22033 case " $static_ext " in
22034 *" $xxx "*) ;;
22035 *) dflt="$dflt $xxx" ;;
22036 esac
22037 done
22038 set X $dflt
22039 shift
22040 dflt="$*"
22041 ;;
b4eb6b3d
JH
22042 *) dflt="$dynamic_ext"
22043 # Perhaps we are reusing an old out-of-date config.sh.
22044 case "$hint" in
22045 previous)
22046 if test X"$dynamic_ext" != X"$avail_ext"; then
22047 $cat <<EOM
7c345082
RGS
22048NOTICE: Your previous config.sh list may be incorrect.
22049The extensions now available to you are
b4eb6b3d
JH
22050 ${avail_ext}
22051but the default list from your previous config.sh is
7c345082 22052 ${dynamic_ext}
9c839522 22053
b4eb6b3d
JH
22054EOM
22055 fi
9c839522
PM
22056 ;;
22057 esac
b4eb6b3d
JH
22058 ;;
22059 esac
5f80c64f 22060 case "$dflt" in
b4eb6b3d
JH
22061 '') dflt=none;;
22062 esac
22063 rp="What extensions do you wish to load dynamically?"
22064 . ./myread
22065 case "$ans" in
22066 none) dynamic_ext=' ' ;;
22067 *) dynamic_ext="$ans" ;;
5f80c64f 22068 esac
5f80c64f 22069
b4eb6b3d
JH
22070 case "$static_ext" in
22071 '')
22072 : Exclude those already listed in dynamic linking
22073 dflt=''
22074 for xxx in $avail_ext; do
22075 case " $dynamic_ext " in
22076 *" $xxx "*) ;;
22077 *) dflt="$dflt $xxx" ;;
22078 esac
22079 done
22080 set X $dflt
22081 shift
22082 dflt="$*"
22083 ;;
7c345082 22084 *) dflt="$static_ext"
b4eb6b3d
JH
22085 ;;
22086 esac
9c839522 22087
b4eb6b3d
JH
22088 case "$dflt" in
22089 '') dflt=none;;
22090 esac
22091 rp="What extensions do you wish to load statically?"
22092 . ./myread
22093 case "$ans" in
22094 none) static_ext=' ' ;;
22095 *) static_ext="$ans" ;;
22096 esac
22097 ;;
22098*)
22099 $cat <<EOM
7c345082
RGS
22100A number of extensions are supplied with $package. Answer "none"
22101to include no extensions.
b4eb6b3d 22102Note that DynaLoader is always built and need not be mentioned here.
9c839522 22103
b4eb6b3d
JH
22104EOM
22105 case "$static_ext" in
22106 '') dflt="$avail_ext" ;;
22107 *) dflt="$static_ext"
22108 # Perhaps we are reusing an old out-of-date config.sh.
22109 case "$hint" in
22110 previous)
22111 if test X"$static_ext" != X"$avail_ext"; then
22112 $cat <<EOM
7c345082
RGS
22113NOTICE: Your previous config.sh list may be incorrect.
22114The extensions now available to you are
b4eb6b3d
JH
22115 ${avail_ext}
22116but the default list from your previous config.sh is
7c345082 22117 ${static_ext}
5f80c64f
JH
22118
22119EOM
b4eb6b3d
JH
22120 fi
22121 ;;
22122 esac
22123 ;;
22124 esac
22125 : Exclude those that are not xs extensions
22126 case "$dflt" in
22127 '') dflt=none;;
22128 esac
22129 rp="What extensions do you wish to include?"
22130 . ./myread
22131 case "$ans" in
22132 none) static_ext=' ' ;;
22133 *) static_ext="$ans" ;;
22134 esac
22135 ;;
5f80c64f 22136esac
7c345082 22137#
f1f6834f
AD
22138# Encode is a special case. If we are building Encode as a static
22139# extension, we need to explicitly list its subextensions as well.
22140# For other nested extensions, this is handled automatically by
22141# the appropriate Makefile.PL.
22142case " $static_ext " in
22143 *" Encode "*) # Add the subextensions of Encode
22144 cd "$rsrc/ext"
22145 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22146 static_ext="$static_ext Encode/$xxx"
22147 done
22148 cd "$tdir"
22149 ;;
22150esac
5f80c64f 22151
b4eb6b3d
JH
22152set X $dynamic_ext $static_ext $nonxs_ext
22153shift
22154extensions="$*"
22155
93a2cd18
AD
22156# Sanity check: We require an extension suitable for use with
22157# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
22158# should show up as failures in the test suite, but it's helpful to
22159# catch them now.) The 'extensions' list is normally sorted
22160# alphabetically, so we need to accept either
22161# DB_File ... Fcntl ... IO ....
22162# or something like
22163# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
22164case " $extensions" in
22165*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22166*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22167*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
22168*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22169 echo "WARNING: The Perl you are building will be quite crippled." >& 4
22170 ;;
22171esac
22172
9c839522
PM
22173: Remove libraries needed only for extensions
22174: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
22175: The exception is SunOS 4.x, which needs them.
22176case "${osname}X${osvers}" in
22177sunos*X4*)
22178 perllibs="$libs"
22179 ;;
22180*) case "$usedl" in
22181 $define|true|[yY]*)
a33f2d9f 22182 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
eedaba54
PM
22183 shift
22184 perllibs="$*"
22185 ;;
22186 *) perllibs="$libs"
22187 ;;
22188 esac
22189 ;;
9c839522 22190esac
5f80c64f
JH
22191
22192: Remove build directory name from cppstdin so it can be used from
22193: either the present location or the final installed location.
22194echo " "
22195: Get out of the UU directory to get correct path name.
22196cd ..
22197case "$cppstdin" in
22198`pwd`/cppstdin)
22199 echo "Stripping down cppstdin path name"
22200 cppstdin=cppstdin
22201 ;;
22202esac
22203cd UU
22204
22205: end of configuration questions
22206echo " "
22207echo "End of configuration questions."
22208echo " "
22209
22210: back to where it started
22211if test -d ../UU; then
22212 cd ..
22213fi
22214
776a38e3 22215: configuration may be unconditionally patched via a 'config.arch' file
48370efc 22216if $test -f config.arch; then
776a38e3 22217 echo "I see a config.arch file, loading it." >&4
48370efc
JH
22218 . ./config.arch
22219fi
22220
5f80c64f
JH
22221: configuration may be patched via a 'config.over' file
22222if $test -f config.over; then
22223 echo " "
22224 dflt=y
22225 rp='I see a config.over file. Do you wish to load it?'
22226 . UU/myread
22227 case "$ans" in
22228 n*) echo "OK, I'll ignore it.";;
22229 *) . ./config.over
22230 echo "Configuration override changes have been loaded."
22231 ;;
22232 esac
22233fi
22234
22235: in case they want portability, strip down executable paths
22236case "$d_portable" in
22237"$define")
22238 echo " "
22239 echo "Stripping down executable paths..." >&4
22240 for file in $loclist $trylist; do
534ac15a
JH
22241 eval temp=\$$file
22242 eval $file=`basename $temp`
5f80c64f
JH
22243 done
22244 ;;
22245esac
22246
22247: create config.sh file
22248echo " "
22249echo "Creating config.sh..." >&4
22250$spitshell <<EOT >config.sh
22251$startsh
22252#
22253# This file was produced by running the Configure script. It holds all the
22254# definitions figured out by Configure. Should you modify one of these values,
22255# do not forget to propagate your changes by running "Configure -der". You may
22256# instead choose to run each of the .SH files by yourself, or "Configure -S".
22257#
22258
22259# Package name : $package
22260# Source directory : $src
22261# Configuration time: $cf_time
22262# Configured by : $cf_by
22263# Target system : $myuname
22264
776a38e3 22265EOT
94a9a4bc 22266: Add in command line options if available
776a38e3 22267$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
94a9a4bc 22268
776a38e3
MB
22269$spitshell <<EOT >>config.sh
22270
5f80c64f
JH
22271Author='$Author'
22272Date='$Date'
22273Header='$Header'
22274Id='$Id'
22275Locker='$Locker'
22276Log='$Log'
5f80c64f
JH
22277RCSfile='$RCSfile'
22278Revision='$Revision'
22279Source='$Source'
22280State='$State'
22281_a='$_a'
22282_exe='$_exe'
22283_o='$_o'
b4eb6b3d 22284afs='$afs'
a6d26a0d 22285afsroot='$afsroot'
b4eb6b3d
JH
22286alignbytes='$alignbytes'
22287ansi2knr='$ansi2knr'
22288aphostname='$aphostname'
22289api_revision='$api_revision'
22290api_subversion='$api_subversion'
22291api_version='$api_version'
22292api_versionstring='$api_versionstring'
5f80c64f 22293ar='$ar'
b4eb6b3d
JH
22294archlib='$archlib'
22295archlibexp='$archlibexp'
22296archname64='$archname64'
22297archname='$archname'
5f80c64f 22298archobjs='$archobjs'
10bc17b6 22299asctime_r_proto='$asctime_r_proto'
5f80c64f 22300awk='$awk'
b4eb6b3d 22301baserev='$baserev'
5f80c64f 22302bash='$bash'
b4eb6b3d 22303bin='$bin'
f1ce3bf1 22304bin_ELF='$bin_ELF'
b4eb6b3d 22305binexp='$binexp'
5f80c64f
JH
22306bison='$bison'
22307byacc='$byacc'
b4eb6b3d 22308byteorder='$byteorder'
5f80c64f 22309c='$c'
b4eb6b3d 22310castflags='$castflags'
5f80c64f
JH
22311cat='$cat'
22312cc='$cc'
22313cccdlflags='$cccdlflags'
22314ccdlflags='$ccdlflags'
22315ccflags='$ccflags'
b4eb6b3d 22316ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 22317ccname='$ccname'
b4eb6b3d 22318ccsymbols='$ccsymbols'
6b356c8e 22319ccversion='$ccversion'
5f80c64f 22320cf_by='$cf_by'
b4eb6b3d 22321cf_email='$cf_email'
5f80c64f 22322cf_time='$cf_time'
c193ef60
MB
22323charbits='$charbits'
22324charsize='$charsize'
5f80c64f
JH
22325chgrp='$chgrp'
22326chmod='$chmod'
22327chown='$chown'
b4eb6b3d 22328clocktype='$clocktype'
5f80c64f
JH
22329comm='$comm'
22330compress='$compress'
22331contains='$contains'
22332cp='$cp'
22333cpio='$cpio'
22334cpp='$cpp'
b4eb6b3d
JH
22335cpp_stuff='$cpp_stuff'
22336cppccsymbols='$cppccsymbols'
5f80c64f
JH
22337cppflags='$cppflags'
22338cpplast='$cpplast'
22339cppminus='$cppminus'
22340cpprun='$cpprun'
22341cppstdin='$cppstdin'
b4eb6b3d 22342cppsymbols='$cppsymbols'
10bc17b6 22343crypt_r_proto='$crypt_r_proto'
b4eb6b3d 22344cryptlib='$cryptlib'
5f80c64f 22345csh='$csh'
10bc17b6
JH
22346ctermid_r_proto='$ctermid_r_proto'
22347ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
22348d_Gconvert='$d_Gconvert'
22349d_PRIEUldbl='$d_PRIEUldbl'
22350d_PRIFUldbl='$d_PRIFUldbl'
22351d_PRIGUldbl='$d_PRIGUldbl'
22352d_PRIXU64='$d_PRIXU64'
22353d_PRId64='$d_PRId64'
22354d_PRIeldbl='$d_PRIeldbl'
22355d_PRIfldbl='$d_PRIfldbl'
22356d_PRIgldbl='$d_PRIgldbl'
22357d_PRIi64='$d_PRIi64'
22358d_PRIo64='$d_PRIo64'
22359d_PRIu64='$d_PRIu64'
22360d_PRIx64='$d_PRIx64'
22361d_SCNfldbl='$d_SCNfldbl'
74cac757 22362d__fwalk='$d__fwalk'
b4eb6b3d
JH
22363d_access='$d_access'
22364d_accessx='$d_accessx'
55954f19 22365d_aintl='$d_aintl'
b4eb6b3d
JH
22366d_alarm='$d_alarm'
22367d_archlib='$d_archlib'
96938616 22368d_asctime64='$d_asctime64'
10bc17b6 22369d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
22370d_atolf='$d_atolf'
22371d_atoll='$d_atoll'
fcdf39cf 22372d_attribute_deprecated='$d_attribute_deprecated'
0dbb1585
AL
22373d_attribute_format='$d_attribute_format'
22374d_attribute_malloc='$d_attribute_malloc'
22375d_attribute_nonnull='$d_attribute_nonnull'
22376d_attribute_noreturn='$d_attribute_noreturn'
22377d_attribute_pure='$d_attribute_pure'
22378d_attribute_unused='$d_attribute_unused'
22379d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
22380d_bcmp='$d_bcmp'
22381d_bcopy='$d_bcopy'
5f80c64f 22382d_bsd='$d_bsd'
b4eb6b3d
JH
22383d_bsdgetpgrp='$d_bsdgetpgrp'
22384d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
22385d_builtin_choose_expr='$d_builtin_choose_expr'
22386d_builtin_expect='$d_builtin_expect'
b4eb6b3d 22387d_bzero='$d_bzero'
a2d23ec2 22388d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
22389d_casti32='$d_casti32'
22390d_castneg='$d_castneg'
22391d_charvspr='$d_charvspr'
22392d_chown='$d_chown'
22393d_chroot='$d_chroot'
22394d_chsize='$d_chsize'
758a5d79 22395d_class='$d_class'
b0a2e8e6 22396d_clearenv='$d_clearenv'
b4eb6b3d 22397d_closedir='$d_closedir'
4e0554ec 22398d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 22399d_const='$d_const'
55954f19 22400d_copysignl='$d_copysignl'
666ea192 22401d_cplusplus='$d_cplusplus'
b4eb6b3d 22402d_crypt='$d_crypt'
10bc17b6 22403d_crypt_r='$d_crypt_r'
b4eb6b3d 22404d_csh='$d_csh'
13cfc98d 22405d_ctermid='$d_ctermid'
10bc17b6 22406d_ctermid_r='$d_ctermid_r'
96938616 22407d_ctime64='$d_ctime64'
10bc17b6 22408d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
22409d_cuserid='$d_cuserid'
22410d_dbl_dig='$d_dbl_dig'
2ef53570 22411d_dbminitproto='$d_dbminitproto'
96938616 22412d_difftime64='$d_difftime64'
b4eb6b3d 22413d_difftime='$d_difftime'
de52168c 22414d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 22415d_dirfd='$d_dirfd'
b4eb6b3d
JH
22416d_dirnamlen='$d_dirnamlen'
22417d_dlerror='$d_dlerror'
5f80c64f 22418d_dlopen='$d_dlopen'
b4eb6b3d
JH
22419d_dlsymun='$d_dlsymun'
22420d_dosuid='$d_dosuid'
10bc17b6 22421d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
22422d_drand48proto='$d_drand48proto'
22423d_dup2='$d_dup2'
22424d_eaccess='$d_eaccess'
22425d_endgrent='$d_endgrent'
10bc17b6 22426d_endgrent_r='$d_endgrent_r'
b4eb6b3d 22427d_endhent='$d_endhent'
10bc17b6 22428d_endhostent_r='$d_endhostent_r'
b4eb6b3d 22429d_endnent='$d_endnent'
10bc17b6 22430d_endnetent_r='$d_endnetent_r'
b4eb6b3d 22431d_endpent='$d_endpent'
10bc17b6 22432d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 22433d_endpwent='$d_endpwent'
10bc17b6 22434d_endpwent_r='$d_endpwent_r'
b4eb6b3d 22435d_endsent='$d_endsent'
10bc17b6 22436d_endservent_r='$d_endservent_r'
b4eb6b3d 22437d_eofnblk='$d_eofnblk'
5f80c64f 22438d_eunice='$d_eunice'
15b61c98 22439d_faststdio='$d_faststdio'
b363b713 22440d_fchdir='$d_fchdir'
b4eb6b3d
JH
22441d_fchmod='$d_fchmod'
22442d_fchown='$d_fchown'
22443d_fcntl='$d_fcntl'
9d9004a9 22444d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
22445d_fd_macros='$d_fd_macros'
22446d_fd_set='$d_fd_set'
22447d_fds_bits='$d_fds_bits'
22448d_fgetpos='$d_fgetpos'
758a5d79
JH
22449d_finite='$d_finite'
22450d_finitel='$d_finitel'
b4eb6b3d
JH
22451d_flexfnam='$d_flexfnam'
22452d_flock='$d_flock'
2ef53570 22453d_flockproto='$d_flockproto'
b4eb6b3d 22454d_fork='$d_fork'
758a5d79 22455d_fp_class='$d_fp_class'
b4eb6b3d 22456d_fpathconf='$d_fpathconf'
758a5d79
JH
22457d_fpclass='$d_fpclass'
22458d_fpclassify='$d_fpclassify'
22459d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
22460d_fpos64_t='$d_fpos64_t'
22461d_frexpl='$d_frexpl'
22462d_fs_data_s='$d_fs_data_s'
22463d_fseeko='$d_fseeko'
22464d_fsetpos='$d_fsetpos'
22465d_fstatfs='$d_fstatfs'
22466d_fstatvfs='$d_fstatvfs'
411ab01c 22467d_fsync='$d_fsync'
b4eb6b3d
JH
22468d_ftello='$d_ftello'
22469d_ftime='$d_ftime'
dc814df1 22470d_futimes='$d_futimes'
e74475c7
MHM
22471d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22472d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
5086dff9 22473d_getaddrinfo='$d_getaddrinfo'
b4eb6b3d
JH
22474d_getcwd='$d_getcwd'
22475d_getespwnam='$d_getespwnam'
22476d_getfsstat='$d_getfsstat'
22477d_getgrent='$d_getgrent'
10bc17b6
JH
22478d_getgrent_r='$d_getgrent_r'
22479d_getgrgid_r='$d_getgrgid_r'
22480d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
22481d_getgrps='$d_getgrps'
22482d_gethbyaddr='$d_gethbyaddr'
22483d_gethbyname='$d_gethbyname'
22484d_gethent='$d_gethent'
22485d_gethname='$d_gethname'
10bc17b6
JH
22486d_gethostbyaddr_r='$d_gethostbyaddr_r'
22487d_gethostbyname_r='$d_gethostbyname_r'
22488d_gethostent_r='$d_gethostent_r'
b4eb6b3d 22489d_gethostprotos='$d_gethostprotos'
4e0554ec 22490d_getitimer='$d_getitimer'
b4eb6b3d 22491d_getlogin='$d_getlogin'
10bc17b6 22492d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
22493d_getmnt='$d_getmnt'
22494d_getmntent='$d_getmntent'
5086dff9 22495d_getnameinfo='$d_getnameinfo'
b4eb6b3d
JH
22496d_getnbyaddr='$d_getnbyaddr'
22497d_getnbyname='$d_getnbyname'
22498d_getnent='$d_getnent'
10bc17b6
JH
22499d_getnetbyaddr_r='$d_getnetbyaddr_r'
22500d_getnetbyname_r='$d_getnetbyname_r'
22501d_getnetent_r='$d_getnetent_r'
b4eb6b3d 22502d_getnetprotos='$d_getnetprotos'
0c0643d0 22503d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
22504d_getpbyname='$d_getpbyname'
22505d_getpbynumber='$d_getpbynumber'
22506d_getpent='$d_getpent'
22507d_getpgid='$d_getpgid'
22508d_getpgrp2='$d_getpgrp2'
22509d_getpgrp='$d_getpgrp'
22510d_getppid='$d_getppid'
22511d_getprior='$d_getprior'
10bc17b6
JH
22512d_getprotobyname_r='$d_getprotobyname_r'
22513d_getprotobynumber_r='$d_getprotobynumber_r'
22514d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
22515d_getprotoprotos='$d_getprotoprotos'
22516d_getprpwnam='$d_getprpwnam'
22517d_getpwent='$d_getpwent'
10bc17b6
JH
22518d_getpwent_r='$d_getpwent_r'
22519d_getpwnam_r='$d_getpwnam_r'
22520d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
22521d_getsbyname='$d_getsbyname'
22522d_getsbyport='$d_getsbyport'
22523d_getsent='$d_getsent'
10bc17b6
JH
22524d_getservbyname_r='$d_getservbyname_r'
22525d_getservbyport_r='$d_getservbyport_r'
22526d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
22527d_getservprotos='$d_getservprotos'
22528d_getspnam='$d_getspnam'
10bc17b6 22529d_getspnam_r='$d_getspnam_r'
b4eb6b3d 22530d_gettimeod='$d_gettimeod'
96938616 22531d_gmtime64='$d_gmtime64'
10bc17b6 22532d_gmtime_r='$d_gmtime_r'
5f80c64f 22533d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
22534d_grpasswd='$d_grpasswd'
22535d_hasmntopt='$d_hasmntopt'
22536d_htonl='$d_htonl'
55954f19 22537d_ilogbl='$d_ilogbl'
f3f1a2d8 22538d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
22539d_index='$d_index'
22540d_inetaton='$d_inetaton'
5086dff9
MB
22541d_inetntop='$d_inetntop'
22542d_inetpton='$d_inetpton'
b4eb6b3d
JH
22543d_int64_t='$d_int64_t'
22544d_isascii='$d_isascii'
758a5d79
JH
22545d_isfinite='$d_isfinite'
22546d_isinf='$d_isinf'
b4eb6b3d
JH
22547d_isnan='$d_isnan'
22548d_isnanl='$d_isnanl'
22549d_killpg='$d_killpg'
22550d_lchown='$d_lchown'
22551d_ldbl_dig='$d_ldbl_dig'
0a0abfba 22552d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 22553d_link='$d_link'
96938616 22554d_localtime64='$d_localtime64'
10bc17b6 22555d_localtime_r='$d_localtime_r'
8572b25d 22556d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
22557d_locconv='$d_locconv'
22558d_lockf='$d_lockf'
22559d_longdbl='$d_longdbl'
22560d_longlong='$d_longlong'
22561d_lseekproto='$d_lseekproto'
22562d_lstat='$d_lstat'
22563d_madvise='$d_madvise'
7dd121ae
MB
22564d_malloc_good_size='$d_malloc_good_size'
22565d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
22566d_mblen='$d_mblen'
22567d_mbstowcs='$d_mbstowcs'
22568d_mbtowc='$d_mbtowc'
22569d_memchr='$d_memchr'
22570d_memcmp='$d_memcmp'
22571d_memcpy='$d_memcpy'
22572d_memmove='$d_memmove'
22573d_memset='$d_memset'
22574d_mkdir='$d_mkdir'
22575d_mkdtemp='$d_mkdtemp'
22576d_mkfifo='$d_mkfifo'
22577d_mkstemp='$d_mkstemp'
22578d_mkstemps='$d_mkstemps'
96938616 22579d_mktime64='$d_mktime64'
b4eb6b3d
JH
22580d_mktime='$d_mktime'
22581d_mmap='$d_mmap'
22582d_modfl='$d_modfl'
e67aeab1 22583d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 22584d_modflproto='$d_modflproto'
b4eb6b3d
JH
22585d_mprotect='$d_mprotect'
22586d_msg='$d_msg'
22587d_msg_ctrunc='$d_msg_ctrunc'
22588d_msg_dontroute='$d_msg_dontroute'
22589d_msg_oob='$d_msg_oob'
22590d_msg_peek='$d_msg_peek'
22591d_msg_proxy='$d_msg_proxy'
22592d_msgctl='$d_msgctl'
22593d_msgget='$d_msgget'
4e0554ec 22594d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
22595d_msgrcv='$d_msgrcv'
22596d_msgsnd='$d_msgsnd'
22597d_msync='$d_msync'
22598d_munmap='$d_munmap'
22599d_mymalloc='$d_mymalloc'
a33f2d9f 22600d_ndbm='$d_ndbm'
e74475c7 22601d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
b4eb6b3d 22602d_nice='$d_nice'
2765b840 22603d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 22604d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 22605d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
22606d_off64_t='$d_off64_t'
22607d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22608d_oldpthreads='$d_oldpthreads'
22609d_oldsock='$d_oldsock'
22610d_open3='$d_open3'
22611d_pathconf='$d_pathconf'
22612d_pause='$d_pause'
22613d_perl_otherlibdirs='$d_perl_otherlibdirs'
22614d_phostname='$d_phostname'
22615d_pipe='$d_pipe'
22616d_poll='$d_poll'
5f80c64f 22617d_portable='$d_portable'
dcb594bc 22618d_printf_format_null='$d_printf_format_null'
c7aff470 22619d_procselfexe='$d_procselfexe'
233e16ce 22620d_pseudofork='$d_pseudofork'
d6483fcc 22621d_pthread_atfork='$d_pthread_atfork'
58d975c3 22622d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
22623d_pthread_yield='$d_pthread_yield'
22624d_pwage='$d_pwage'
22625d_pwchange='$d_pwchange'
22626d_pwclass='$d_pwclass'
22627d_pwcomment='$d_pwcomment'
22628d_pwexpire='$d_pwexpire'
22629d_pwgecos='$d_pwgecos'
22630d_pwpasswd='$d_pwpasswd'
22631d_pwquota='$d_pwquota'
22632d_qgcvt='$d_qgcvt'
22633d_quad='$d_quad'
10bc17b6
JH
22634d_random_r='$d_random_r'
22635d_readdir64_r='$d_readdir64_r'
b4eb6b3d 22636d_readdir='$d_readdir'
10bc17b6 22637d_readdir_r='$d_readdir_r'
b4eb6b3d 22638d_readlink='$d_readlink'
4e0554ec
JH
22639d_readv='$d_readv'
22640d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
22641d_rename='$d_rename'
22642d_rewinddir='$d_rewinddir'
22643d_rmdir='$d_rmdir'
22644d_safebcpy='$d_safebcpy'
22645d_safemcpy='$d_safemcpy'
22646d_sanemcmp='$d_sanemcmp'
ef9f17be 22647d_sbrkproto='$d_sbrkproto'
55954f19 22648d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
22649d_sched_yield='$d_sched_yield'
22650d_scm_rights='$d_scm_rights'
22651d_seekdir='$d_seekdir'
22652d_select='$d_select'
22653d_sem='$d_sem'
22654d_semctl='$d_semctl'
22655d_semctl_semid_ds='$d_semctl_semid_ds'
22656d_semctl_semun='$d_semctl_semun'
22657d_semget='$d_semget'
22658d_semop='$d_semop'
4e0554ec 22659d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
22660d_setegid='$d_setegid'
22661d_seteuid='$d_seteuid'
22662d_setgrent='$d_setgrent'
10bc17b6 22663d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
22664d_setgrps='$d_setgrps'
22665d_sethent='$d_sethent'
10bc17b6 22666d_sethostent_r='$d_sethostent_r'
4e0554ec 22667d_setitimer='$d_setitimer'
b4eb6b3d
JH
22668d_setlinebuf='$d_setlinebuf'
22669d_setlocale='$d_setlocale'
10bc17b6 22670d_setlocale_r='$d_setlocale_r'
b4eb6b3d 22671d_setnent='$d_setnent'
10bc17b6 22672d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
22673d_setpent='$d_setpent'
22674d_setpgid='$d_setpgid'
22675d_setpgrp2='$d_setpgrp2'
22676d_setpgrp='$d_setpgrp'
22677d_setprior='$d_setprior'
22678d_setproctitle='$d_setproctitle'
10bc17b6 22679d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 22680d_setpwent='$d_setpwent'
10bc17b6 22681d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
22682d_setregid='$d_setregid'
22683d_setresgid='$d_setresgid'
22684d_setresuid='$d_setresuid'
22685d_setreuid='$d_setreuid'
22686d_setrgid='$d_setrgid'
22687d_setruid='$d_setruid'
22688d_setsent='$d_setsent'
10bc17b6 22689d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
22690d_setsid='$d_setsid'
22691d_setvbuf='$d_setvbuf'
22692d_sfio='$d_sfio'
22693d_shm='$d_shm'
22694d_shmat='$d_shmat'
22695d_shmatprototype='$d_shmatprototype'
22696d_shmctl='$d_shmctl'
22697d_shmdt='$d_shmdt'
22698d_shmget='$d_shmget'
22699d_sigaction='$d_sigaction'
ed140128 22700d_signbit='$d_signbit'
983dbef6 22701d_sigprocmask='$d_sigprocmask'
b4eb6b3d 22702d_sigsetjmp='$d_sigsetjmp'
c95d0e17 22703d_sitearch='$d_sitearch'
4f5da3e9 22704d_snprintf='$d_snprintf'
49a78c82 22705d_sockatmark='$d_sockatmark'
2ef53570 22706d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
22707d_socket='$d_socket'
22708d_socklen_t='$d_socklen_t'
22709d_sockpair='$d_sockpair'
22710d_socks5_init='$d_socks5_init'
360321b3 22711d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 22712d_sqrtl='$d_sqrtl'
10bc17b6
JH
22713d_srand48_r='$d_srand48_r'
22714d_srandom_r='$d_srandom_r'
eef837ea 22715d_sresgproto='$d_sresgproto'
640374d0 22716d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
22717d_statblks='$d_statblks'
22718d_statfs_f_flags='$d_statfs_f_flags'
22719d_statfs_s='$d_statfs_s'
22720d_statvfs='$d_statvfs'
22721d_stdio_cnt_lval='$d_stdio_cnt_lval'
22722d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
22723d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22724d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
22725d_stdio_stream_array='$d_stdio_stream_array'
22726d_stdiobase='$d_stdiobase'
22727d_stdstdio='$d_stdstdio'
22728d_strchr='$d_strchr'
22729d_strcoll='$d_strcoll'
22730d_strctcpy='$d_strctcpy'
22731d_strerrm='$d_strerrm'
22732d_strerror='$d_strerror'
10bc17b6 22733d_strerror_r='$d_strerror_r'
b3c85772 22734d_strftime='$d_strftime'
08c92000
MB
22735d_strlcat='$d_strlcat'
22736d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
22737d_strtod='$d_strtod'
22738d_strtol='$d_strtol'
22739d_strtold='$d_strtold'
22740d_strtoll='$d_strtoll'
28e5dec8 22741d_strtoq='$d_strtoq'
b4eb6b3d
JH
22742d_strtoul='$d_strtoul'
22743d_strtoull='$d_strtoull'
22744d_strtouq='$d_strtouq'
22745d_strxfrm='$d_strxfrm'
22746d_suidsafe='$d_suidsafe'
22747d_symlink='$d_symlink'
22748d_syscall='$d_syscall'
2ef53570 22749d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
22750d_sysconf='$d_sysconf'
22751d_sysernlst='$d_sysernlst'
22752d_syserrlst='$d_syserrlst'
22753d_system='$d_system'
22754d_tcgetpgrp='$d_tcgetpgrp'
22755d_tcsetpgrp='$d_tcsetpgrp'
22756d_telldir='$d_telldir'
22757d_telldirproto='$d_telldirproto'
22758d_time='$d_time'
cbb9e8a7 22759d_timegm='$d_timegm'
b4eb6b3d 22760d_times='$d_times'
14b90194
JH
22761d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22762d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 22763d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 22764d_truncate='$d_truncate'
10bc17b6 22765d_ttyname_r='$d_ttyname_r'
b4eb6b3d 22766d_tzname='$d_tzname'
4e0554ec
JH
22767d_u32align='$d_u32align'
22768d_ualarm='$d_ualarm'
b4eb6b3d
JH
22769d_umask='$d_umask'
22770d_uname='$d_uname'
22771d_union_semun='$d_union_semun'
758a5d79 22772d_unordered='$d_unordered'
bdf33aa7 22773d_unsetenv='$d_unsetenv'
4e0554ec 22774d_usleep='$d_usleep'
2ef53570 22775d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
22776d_ustat='$d_ustat'
22777d_vendorarch='$d_vendorarch'
22778d_vendorbin='$d_vendorbin'
22779d_vendorlib='$d_vendorlib'
6e1038e0 22780d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
22781d_vfork='$d_vfork'
22782d_void_closedir='$d_void_closedir'
22783d_voidsig='$d_voidsig'
22784d_voidtty='$d_voidtty'
22785d_volatile='$d_volatile'
22786d_vprintf='$d_vprintf'
4f5da3e9 22787d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
22788d_wait4='$d_wait4'
22789d_waitpid='$d_waitpid'
22790d_wcstombs='$d_wcstombs'
22791d_wctomb='$d_wctomb'
4e0554ec 22792d_writev='$d_writev'
5f80c64f
JH
22793d_xenix='$d_xenix'
22794date='$date'
b4eb6b3d
JH
22795db_hashtype='$db_hashtype'
22796db_prefixtype='$db_prefixtype'
640374d0
JH
22797db_version_major='$db_version_major'
22798db_version_minor='$db_version_minor'
22799db_version_patch='$db_version_patch'
b4eb6b3d
JH
22800defvoidused='$defvoidused'
22801direntrytype='$direntrytype'
22802dlext='$dlext'
5f80c64f 22803dlsrc='$dlsrc'
b4eb6b3d
JH
22804doublesize='$doublesize'
22805drand01='$drand01'
10bc17b6 22806drand48_r_proto='$drand48_r_proto'
5ac1e9b2 22807dtrace='$dtrace'
b4eb6b3d
JH
22808dynamic_ext='$dynamic_ext'
22809eagain='$eagain'
22810ebcdic='$ebcdic'
5f80c64f
JH
22811echo='$echo'
22812egrep='$egrep'
22813emacs='$emacs'
10bc17b6
JH
22814endgrent_r_proto='$endgrent_r_proto'
22815endhostent_r_proto='$endhostent_r_proto'
22816endnetent_r_proto='$endnetent_r_proto'
22817endprotoent_r_proto='$endprotoent_r_proto'
22818endpwent_r_proto='$endpwent_r_proto'
22819endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
22820eunicefix='$eunicefix'
22821exe_ext='$exe_ext'
22822expr='$expr'
b4eb6b3d 22823extensions='$extensions'
61c26d18 22824extern_C='$extern_C'
6fcddf3b 22825extras='$extras'
b4eb6b3d
JH
22826fflushNULL='$fflushNULL'
22827fflushall='$fflushall'
5f80c64f
JH
22828find='$find'
22829firstmakefile='$firstmakefile'
22830flex='$flex'
b4eb6b3d
JH
22831fpossize='$fpossize'
22832fpostype='$fpostype'
22833freetype='$freetype'
5440bc8e 22834from='$from'
b4eb6b3d
JH
22835full_ar='$full_ar'
22836full_csh='$full_csh'
22837full_sed='$full_sed'
2d736872 22838gccansipedantic='$gccansipedantic'
5b463ca7 22839gccosandvers='$gccosandvers'
5f80c64f 22840gccversion='$gccversion'
10bc17b6
JH
22841getgrent_r_proto='$getgrent_r_proto'
22842getgrgid_r_proto='$getgrgid_r_proto'
22843getgrnam_r_proto='$getgrnam_r_proto'
22844gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22845gethostbyname_r_proto='$gethostbyname_r_proto'
22846gethostent_r_proto='$gethostent_r_proto'
22847getlogin_r_proto='$getlogin_r_proto'
22848getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22849getnetbyname_r_proto='$getnetbyname_r_proto'
22850getnetent_r_proto='$getnetent_r_proto'
22851getprotobyname_r_proto='$getprotobyname_r_proto'
22852getprotobynumber_r_proto='$getprotobynumber_r_proto'
22853getprotoent_r_proto='$getprotoent_r_proto'
22854getpwent_r_proto='$getpwent_r_proto'
22855getpwnam_r_proto='$getpwnam_r_proto'
22856getpwuid_r_proto='$getpwuid_r_proto'
22857getservbyname_r_proto='$getservbyname_r_proto'
22858getservbyport_r_proto='$getservbyport_r_proto'
22859getservent_r_proto='$getservent_r_proto'
22860getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
22861gidformat='$gidformat'
22862gidsign='$gidsign'
22863gidsize='$gidsize'
22864gidtype='$gidtype'
5f80c64f 22865glibpth='$glibpth'
3c728e00 22866gmake='$gmake'
10bc17b6 22867gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 22868gnulibc_version='$gnulibc_version'
5f80c64f 22869grep='$grep'
b4eb6b3d
JH
22870groupcat='$groupcat'
22871groupstype='$groupstype'
5f80c64f 22872gzip='$gzip'
b4eb6b3d
JH
22873h_fcntl='$h_fcntl'
22874h_sysfile='$h_sysfile'
5f80c64f 22875hint='$hint'
b4eb6b3d 22876hostcat='$hostcat'
6e1038e0
MB
22877html1dir='$html1dir'
22878html1direxp='$html1direxp'
22879html3dir='$html3dir'
22880html3direxp='$html3direxp'
b4eb6b3d
JH
22881i16size='$i16size'
22882i16type='$i16type'
22883i32size='$i32size'
22884i32type='$i32type'
22885i64size='$i64size'
22886i64type='$i64type'
22887i8size='$i8size'
22888i8type='$i8type'
22889i_arpainet='$i_arpainet'
2a0de2c5 22890i_assert='$i_assert'
b4eb6b3d 22891i_bsdioctl='$i_bsdioctl'
10bc17b6 22892i_crypt='$i_crypt'
b4eb6b3d
JH
22893i_db='$i_db'
22894i_dbm='$i_dbm'
22895i_dirent='$i_dirent'
5f80c64f 22896i_dld='$i_dld'
b4eb6b3d
JH
22897i_dlfcn='$i_dlfcn'
22898i_fcntl='$i_fcntl'
22899i_float='$i_float'
758a5d79
JH
22900i_fp='$i_fp'
22901i_fp_class='$i_fp_class'
b4eb6b3d 22902i_gdbm='$i_gdbm'
a33f2d9f
AD
22903i_gdbm_ndbm='$i_gdbm_ndbm'
22904i_gdbmndbm='$i_gdbmndbm'
b4eb6b3d 22905i_grp='$i_grp'
b4eb6b3d
JH
22906i_ieeefp='$i_ieeefp'
22907i_inttypes='$i_inttypes'
2765b840 22908i_langinfo='$i_langinfo'
b4eb6b3d
JH
22909i_libutil='$i_libutil'
22910i_limits='$i_limits'
22911i_locale='$i_locale'
22912i_machcthr='$i_machcthr'
22913i_malloc='$i_malloc'
1cd66f7c 22914i_mallocmalloc='$i_mallocmalloc'
b4eb6b3d
JH
22915i_math='$i_math'
22916i_memory='$i_memory'
22917i_mntent='$i_mntent'
22918i_ndbm='$i_ndbm'
22919i_netdb='$i_netdb'
22920i_neterrno='$i_neterrno'
22921i_netinettcp='$i_netinettcp'
22922i_niin='$i_niin'
22923i_poll='$i_poll'
22924i_prot='$i_prot'
22925i_pthread='$i_pthread'
22926i_pwd='$i_pwd'
22927i_rpcsvcdbm='$i_rpcsvcdbm'
22928i_sfio='$i_sfio'
22929i_sgtty='$i_sgtty'
22930i_shadow='$i_shadow'
22931i_socks='$i_socks'
22932i_stdarg='$i_stdarg'
22933i_stddef='$i_stddef'
22934i_stdlib='$i_stdlib'
22935i_string='$i_string'
22936i_sunmath='$i_sunmath'
22937i_sysaccess='$i_sysaccess'
22938i_sysdir='$i_sysdir'
22939i_sysfile='$i_sysfile'
22940i_sysfilio='$i_sysfilio'
22941i_sysin='$i_sysin'
22942i_sysioctl='$i_sysioctl'
22943i_syslog='$i_syslog'
22944i_sysmman='$i_sysmman'
22945i_sysmode='$i_sysmode'
22946i_sysmount='$i_sysmount'
22947i_sysndir='$i_sysndir'
22948i_sysparam='$i_sysparam'
216dac04 22949i_syspoll='$i_syspoll'
b4eb6b3d
JH
22950i_sysresrc='$i_sysresrc'
22951i_syssecrt='$i_syssecrt'
22952i_sysselct='$i_sysselct'
22953i_syssockio='$i_syssockio'
22954i_sysstat='$i_sysstat'
22955i_sysstatfs='$i_sysstatfs'
22956i_sysstatvfs='$i_sysstatvfs'
22957i_systime='$i_systime'
22958i_systimek='$i_systimek'
22959i_systimes='$i_systimes'
22960i_systypes='$i_systypes'
22961i_sysuio='$i_sysuio'
22962i_sysun='$i_sysun'
22963i_sysutsname='$i_sysutsname'
22964i_sysvfs='$i_sysvfs'
22965i_syswait='$i_syswait'
22966i_termio='$i_termio'
22967i_termios='$i_termios'
22968i_time='$i_time'
22969i_unistd='$i_unistd'
22970i_ustat='$i_ustat'
22971i_utime='$i_utime'
22972i_values='$i_values'
22973i_varargs='$i_varargs'
22974i_varhdr='$i_varhdr'
22975i_vfork='$i_vfork'
5f80c64f 22976ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
22977inc_version_list='$inc_version_list'
22978inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
22979incpath='$incpath'
22980inews='$inews'
f3f1a2d8 22981initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
22982installarchlib='$installarchlib'
22983installbin='$installbin'
6e1038e0
MB
22984installhtml1dir='$installhtml1dir'
22985installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
22986installman1dir='$installman1dir'
22987installman3dir='$installman3dir'
22988installprefix='$installprefix'
22989installprefixexp='$installprefixexp'
22990installprivlib='$installprivlib'
22991installscript='$installscript'
22992installsitearch='$installsitearch'
22993installsitebin='$installsitebin'
8d2cbf27
JH
22994installsitehtml1dir='$installsitehtml1dir'
22995installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 22996installsitelib='$installsitelib'
91e123a8
JH
22997installsiteman1dir='$installsiteman1dir'
22998installsiteman3dir='$installsiteman3dir'
6e1038e0 22999installsitescript='$installsitescript'
b4eb6b3d
JH
23000installstyle='$installstyle'
23001installusrbinperl='$installusrbinperl'
23002installvendorarch='$installvendorarch'
23003installvendorbin='$installvendorbin'
8d2cbf27
JH
23004installvendorhtml1dir='$installvendorhtml1dir'
23005installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 23006installvendorlib='$installvendorlib'
91e123a8
JH
23007installvendorman1dir='$installvendorman1dir'
23008installvendorman3dir='$installvendorman3dir'
6e1038e0 23009installvendorscript='$installvendorscript'
b4eb6b3d 23010intsize='$intsize'
4b661809 23011issymlink='$issymlink'
b4eb6b3d
JH
23012ivdformat='$ivdformat'
23013ivsize='$ivsize'
23014ivtype='$ivtype'
23015known_extensions='$known_extensions'
5f80c64f 23016ksh='$ksh'
5f80c64f
JH
23017ld='$ld'
23018lddlflags='$lddlflags'
23019ldflags='$ldflags'
b4eb6b3d
JH
23020ldflags_uselargefiles='$ldflags_uselargefiles'
23021ldlibpthname='$ldlibpthname'
5f80c64f
JH
23022less='$less'
23023lib_ext='$lib_ext'
23024libc='$libc'
b4eb6b3d 23025libperl='$libperl'
5f80c64f
JH
23026libpth='$libpth'
23027libs='$libs'
43999f95
JH
23028libsdirs='$libsdirs'
23029libsfiles='$libsfiles'
23030libsfound='$libsfound'
13b3f787 23031libspath='$libspath'
5f80c64f 23032libswanted='$libswanted'
b4eb6b3d 23033libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
23034line='$line'
23035lint='$lint'
23036lkflags='$lkflags'
23037ln='$ln'
23038lns='$lns'
10bc17b6 23039localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
23040locincpth='$locincpth'
23041loclibpth='$loclibpth'
b4eb6b3d
JH
23042longdblsize='$longdblsize'
23043longlongsize='$longlongsize'
23044longsize='$longsize'
5f80c64f
JH
23045lp='$lp'
23046lpr='$lpr'
23047ls='$ls'
b4eb6b3d
JH
23048lseeksize='$lseeksize'
23049lseektype='$lseektype'
a724edfe 23050mad='$mad'
f3f1a2d8
MB
23051madlyh='$madlyh'
23052madlyobj='$madlyobj'
23053madlysrc='$madlysrc'
5f80c64f
JH
23054mail='$mail'
23055mailx='$mailx'
23056make='$make'
23057make_set_make='$make_set_make'
b4eb6b3d
JH
23058mallocobj='$mallocobj'
23059mallocsrc='$mallocsrc'
23060malloctype='$malloctype'
23061man1dir='$man1dir'
23062man1direxp='$man1direxp'
23063man1ext='$man1ext'
23064man3dir='$man3dir'
23065man3direxp='$man3direxp'
23066man3ext='$man3ext'
5f80c64f 23067mips_type='$mips_type'
5129fff4 23068mistrustnm='$mistrustnm'
5f80c64f 23069mkdir='$mkdir'
b4eb6b3d
JH
23070mmaptype='$mmaptype'
23071modetype='$modetype'
5f80c64f 23072more='$more'
b4eb6b3d 23073multiarch='$multiarch'
5f80c64f 23074mv='$mv'
b4eb6b3d
JH
23075myarchname='$myarchname'
23076mydomain='$mydomain'
23077myhostname='$myhostname'
5f80c64f
JH
23078myuname='$myuname'
23079n='$n'
2cc61e15 23080need_va_copy='$need_va_copy'
b4eb6b3d
JH
23081netdb_hlen_type='$netdb_hlen_type'
23082netdb_host_type='$netdb_host_type'
23083netdb_name_type='$netdb_name_type'
23084netdb_net_type='$netdb_net_type'
5f80c64f
JH
23085nm='$nm'
23086nm_opt='$nm_opt'
23087nm_so_opt='$nm_so_opt'
b4eb6b3d 23088nonxs_ext='$nonxs_ext'
5f80c64f 23089nroff='$nroff'
b4eb6b3d
JH
23090nvEUformat='$nvEUformat'
23091nvFUformat='$nvFUformat'
23092nvGUformat='$nvGUformat'
b68c599a 23093nv_overflows_integers_at='$nv_overflows_integers_at'
53133ed1 23094nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
23095nveformat='$nveformat'
23096nvfformat='$nvfformat'
23097nvgformat='$nvgformat'
23098nvsize='$nvsize'
23099nvtype='$nvtype'
23100o_nonblock='$o_nonblock'
5f80c64f 23101obj_ext='$obj_ext'
b4eb6b3d 23102old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 23103optimize='$optimize'
b4eb6b3d 23104orderlib='$orderlib'
5f80c64f
JH
23105osname='$osname'
23106osvers='$osvers'
b4eb6b3d 23107otherlibdirs='$otherlibdirs'
5f80c64f 23108package='$package'
b4eb6b3d
JH
23109pager='$pager'
23110passcat='$passcat'
23111patchlevel='$patchlevel'
5f80c64f 23112path_sep='$path_sep'
b4eb6b3d 23113perl5='$perl5'
5f80c64f 23114perl='$perl'
151e6568 23115perl_patchlevel='$perl_patchlevel'
b4eb6b3d 23116perladmin='$perladmin'
9c839522 23117perllibs='$perllibs'
b4eb6b3d 23118perlpath='$perlpath'
5f80c64f 23119pg='$pg'
b4eb6b3d
JH
23120phostname='$phostname'
23121pidtype='$pidtype'
5f80c64f
JH
23122plibpth='$plibpth'
23123pmake='$pmake'
23124pr='$pr'
b4eb6b3d
JH
23125prefix='$prefix'
23126prefixexp='$prefixexp'
23127privlib='$privlib'
23128privlibexp='$privlibexp'
f24dbf84 23129procselfexe='$procselfexe'
b4eb6b3d
JH
23130prototype='$prototype'
23131ptrsize='$ptrsize'
23132quadkind='$quadkind'
23133quadtype='$quadtype'
23134randbits='$randbits'
23135randfunc='$randfunc'
10bc17b6 23136random_r_proto='$random_r_proto'
b4eb6b3d
JH
23137randseedtype='$randseedtype'
23138ranlib='$ranlib'
23139rd_nodata='$rd_nodata'
10bc17b6
JH
23140readdir64_r_proto='$readdir64_r_proto'
23141readdir_r_proto='$readdir_r_proto'
b4eb6b3d 23142revision='$revision'
5f80c64f 23143rm='$rm'
5b813a60 23144rm_try='$rm_try'
5f80c64f 23145rmail='$rmail'
5440bc8e 23146run='$run'
5f80c64f 23147runnm='$runnm'
81c4fd9e
MB
23148sGMTIME_max='$sGMTIME_max'
23149sGMTIME_min='$sGMTIME_min'
73e6e416
MB
23150sLOCALTIME_max='$sLOCALTIME_max'
23151sLOCALTIME_min='$sLOCALTIME_min'
b4eb6b3d
JH
23152sPRIEUldbl='$sPRIEUldbl'
23153sPRIFUldbl='$sPRIFUldbl'
23154sPRIGUldbl='$sPRIGUldbl'
23155sPRIXU64='$sPRIXU64'
23156sPRId64='$sPRId64'
23157sPRIeldbl='$sPRIeldbl'
23158sPRIfldbl='$sPRIfldbl'
23159sPRIgldbl='$sPRIgldbl'
23160sPRIi64='$sPRIi64'
23161sPRIo64='$sPRIo64'
23162sPRIu64='$sPRIu64'
23163sPRIx64='$sPRIx64'
23164sSCNfldbl='$sSCNfldbl'
23165sched_yield='$sched_yield'
23166scriptdir='$scriptdir'
23167scriptdirexp='$scriptdirexp'
5f80c64f 23168sed='$sed'
b4eb6b3d
JH
23169seedfunc='$seedfunc'
23170selectminbits='$selectminbits'
23171selecttype='$selecttype'
5f80c64f 23172sendmail='$sendmail'
10bc17b6
JH
23173setgrent_r_proto='$setgrent_r_proto'
23174sethostent_r_proto='$sethostent_r_proto'
23175setlocale_r_proto='$setlocale_r_proto'
23176setnetent_r_proto='$setnetent_r_proto'
23177setprotoent_r_proto='$setprotoent_r_proto'
23178setpwent_r_proto='$setpwent_r_proto'
23179setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
23180sh='$sh'
23181shar='$shar'
23182sharpbang='$sharpbang'
b4eb6b3d
JH
23183shmattype='$shmattype'
23184shortsize='$shortsize'
23185shrpenv='$shrpenv'
5f80c64f 23186shsharp='$shsharp'
b4eb6b3d
JH
23187sig_count='$sig_count'
23188sig_name='$sig_name'
23189sig_name_init='$sig_name_init'
23190sig_num='$sig_num'
23191sig_num_init='$sig_num_init'
76d3c696 23192sig_size='$sig_size'
b4eb6b3d
JH
23193signal_t='$signal_t'
23194sitearch='$sitearch'
23195sitearchexp='$sitearchexp'
23196sitebin='$sitebin'
23197sitebinexp='$sitebinexp'
8d2cbf27
JH
23198sitehtml1dir='$sitehtml1dir'
23199sitehtml1direxp='$sitehtml1direxp'
23200sitehtml3dir='$sitehtml3dir'
23201sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
23202sitelib='$sitelib'
23203sitelib_stem='$sitelib_stem'
23204sitelibexp='$sitelibexp'
91e123a8
JH
23205siteman1dir='$siteman1dir'
23206siteman1direxp='$siteman1direxp'
23207siteman3dir='$siteman3dir'
23208siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
23209siteprefix='$siteprefix'
23210siteprefixexp='$siteprefixexp'
6e1038e0
MB
23211sitescript='$sitescript'
23212sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
23213sizesize='$sizesize'
23214sizetype='$sizetype'
5f80c64f
JH
23215sleep='$sleep'
23216smail='$smail'
5f80c64f 23217so='$so'
b4eb6b3d
JH
23218sockethdr='$sockethdr'
23219socketlib='$socketlib'
23220socksizetype='$socksizetype'
5f80c64f
JH
23221sort='$sort'
23222spackage='$spackage'
23223spitshell='$spitshell'
10bc17b6
JH
23224srand48_r_proto='$srand48_r_proto'
23225srandom_r_proto='$srandom_r_proto'
5f80c64f 23226src='$src'
b4eb6b3d
JH
23227ssizetype='$ssizetype'
23228startperl='$startperl'
5f80c64f 23229startsh='$startsh'
b4eb6b3d
JH
23230static_ext='$static_ext'
23231stdchar='$stdchar'
23232stdio_base='$stdio_base'
23233stdio_bufsiz='$stdio_bufsiz'
23234stdio_cnt='$stdio_cnt'
23235stdio_filbuf='$stdio_filbuf'
23236stdio_ptr='$stdio_ptr'
23237stdio_stream_array='$stdio_stream_array'
10bc17b6 23238strerror_r_proto='$strerror_r_proto'
b4eb6b3d 23239strings='$strings'
5f80c64f 23240submit='$submit'
b4eb6b3d
JH
23241subversion='$subversion'
23242sysman='$sysman'
5f80c64f
JH
23243tail='$tail'
23244tar='$tar'
5440bc8e 23245targetarch='$targetarch'
5f80c64f
JH
23246tbl='$tbl'
23247tee='$tee'
23248test='$test'
b4eb6b3d
JH
23249timeincl='$timeincl'
23250timetype='$timetype'
10bc17b6 23251tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 23252to='$to'
5f80c64f
JH
23253touch='$touch'
23254tr='$tr'
23255trnl='$trnl'
23256troff='$troff'
10bc17b6 23257ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
23258u16size='$u16size'
23259u16type='$u16type'
23260u32size='$u32size'
23261u32type='$u32type'
23262u64size='$u64size'
23263u64type='$u64type'
23264u8size='$u8size'
23265u8type='$u8type'
23266uidformat='$uidformat'
23267uidsign='$uidsign'
23268uidsize='$uidsize'
23269uidtype='$uidtype'
5f80c64f
JH
23270uname='$uname'
23271uniq='$uniq'
b4eb6b3d
JH
23272uquadtype='$uquadtype'
23273use5005threads='$use5005threads'
23274use64bitall='$use64bitall'
23275use64bitint='$use64bitint'
5440bc8e 23276usecrosscompile='$usecrosscompile'
1be1b388 23277usedevel='$usedevel'
5f80c64f 23278usedl='$usedl'
5ac1e9b2 23279usedtrace='$usedtrace'
15b61c98 23280usefaststdio='$usefaststdio'
b4eb6b3d
JH
23281useithreads='$useithreads'
23282uselargefiles='$uselargefiles'
23283uselongdouble='$uselongdouble'
19a100ff 23284usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
23285usemorebits='$usemorebits'
23286usemultiplicity='$usemultiplicity'
23287usemymalloc='$usemymalloc'
5f80c64f 23288usenm='$usenm'
b4eb6b3d
JH
23289useopcode='$useopcode'
23290useperlio='$useperlio'
23291useposix='$useposix'
9514c62b 23292usereentrant='$usereentrant'
d51aaa9d 23293userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
23294usesfio='$usesfio'
23295useshrplib='$useshrplib'
5f106f9c 23296usesitecustomize='$usesitecustomize'
29209bc5 23297usesocks='$usesocks'
b4eb6b3d
JH
23298usethreads='$usethreads'
23299usevendorprefix='$usevendorprefix'
23300usevfork='$usevfork'
5f80c64f
JH
23301usrinc='$usrinc'
23302uuname='$uuname'
b4eb6b3d
JH
23303uvXUformat='$uvXUformat'
23304uvoformat='$uvoformat'
23305uvsize='$uvsize'
23306uvtype='$uvtype'
23307uvuformat='$uvuformat'
23308uvxformat='$uvxformat'
d03b3b00 23309vaproto='$vaproto'
b4eb6b3d
JH
23310vendorarch='$vendorarch'
23311vendorarchexp='$vendorarchexp'
23312vendorbin='$vendorbin'
23313vendorbinexp='$vendorbinexp'
8d2cbf27
JH
23314vendorhtml1dir='$vendorhtml1dir'
23315vendorhtml1direxp='$vendorhtml1direxp'
23316vendorhtml3dir='$vendorhtml3dir'
23317vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
23318vendorlib='$vendorlib'
23319vendorlib_stem='$vendorlib_stem'
23320vendorlibexp='$vendorlibexp'
91e123a8
JH
23321vendorman1dir='$vendorman1dir'
23322vendorman1direxp='$vendorman1direxp'
23323vendorman3dir='$vendorman3dir'
23324vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
23325vendorprefix='$vendorprefix'
23326vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
23327vendorscript='$vendorscript'
23328vendorscriptexp='$vendorscriptexp'
b4eb6b3d 23329version='$version'
861eb78d 23330version_patchlevel_string='$version_patchlevel_string'
d56c5707 23331versiononly='$versiononly'
5f80c64f 23332vi='$vi'
b4eb6b3d 23333voidflags='$voidflags'
5f80c64f 23334xlibpth='$xlibpth'
3659ebf1
JH
23335yacc='$yacc'
23336yaccflags='$yaccflags'
5f80c64f
JH
23337zcat='$zcat'
23338zip='$zip'
23339EOT
23340
5f80c64f
JH
23341: add special variables
23342$test -f $src/patchlevel.h && \
d9421656 23343awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
0f04e85f 23344echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
a02608de 23345echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
23346
23347: propagate old symbols
23348if $test -f UU/config.sh; then
381aa1ff 23349 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
776a38e3
MB
23350 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23351 config.sh config.sh UU/oldconfig.sh |\
23352 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
23353 set X `cat UU/oldsyms`
23354 shift
23355 case $# in
23356 0) ;;
23357 *)
23358 cat <<EOM
23359Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23360EOM
776a38e3 23361 echo ": Variables propagated from previous config.sh file." >>config.sh
5f80c64f
JH
23362 for sym in `cat UU/oldsyms`; do
23363 echo " Propagating $hint variable "'$'"$sym..."
23364 eval 'tmp="$'"${sym}"'"'
23365 echo "$tmp" | \
23366 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23367 done
23368 ;;
23369 esac
23370fi
23371
23372: Finish up by extracting the .SH files
23373case "$alldone" in
23374exit)
23375 $rm -rf UU
24ccb310 23376 echo "Extraction done."
5f80c64f
JH
23377 exit 0
23378 ;;
23379cont)
23380 ;;
23381'')
23382 dflt=''
23383 nostick=true
23384 $cat <<EOM
23385
23386If you'd like to make any changes to the config.sh file before I begin
23387to configure things, do it as a shell escape now (e.g. !vi config.sh).
23388
23389EOM
23390 rp="Press return or use a shell escape to edit config.sh:"
23391 . UU/myread
23392 nostick=''
23393 case "$ans" in
23394 '') ;;
23395 *) : in case they cannot read
23396 sh 1>&4 -c "$ans";;
23397 esac
23398 ;;
23399esac
23400
23401: if this fails, just run all the .SH files by hand
23402. ./config.sh
23403
23404echo " "
23405exec 1>&4
a43e8593 23406pwd=`pwd`
5f80c64f 23407. ./UU/extract
6904989c 23408cd "$pwd"
5f80c64f
JH
23409
23410if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23411 dflt=y
23412 case "$silent" in
23413 true) ;;
23414 *)
23415 $cat <<EOM
23416
23417Now you need to generate make dependencies by running "$make depend".
23418You might prefer to run it in background: "$make depend > makedepend.out &"
23419It can take a while, so you might not want to run it right now.
23420
23421EOM
23422 ;;
23423 esac
23424 rp="Run $make depend now?"
23425 . UU/myread
23426 case "$ans" in
23427 y*)
3d5d58b1 23428 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
23429 ;;
23430 *)
23431 echo "You must run '$make depend' then '$make'."
23432 ;;
23433 esac
23434elif test -f [Mm]akefile; then
23435 echo " "
23436 echo "Now you must run a $make."
23437else
24ccb310 23438 echo "Configure done."
5f80c64f
JH
23439fi
23440
23441if $test -f Policy.sh; then
23442 $cat <<EOM
23443
23444If you compile $package on a different machine or from a different object
23445directory, copy the Policy.sh file from this object directory to the
23446new one before you run Configure -- this will help you with most of
23447the policy defaults.
23448
23449EOM
23450fi
23451if $test -f config.msg; then
23452 echo "Hmm. I also noted the following information while running:"
23453 echo " "
23454 $cat config.msg >&4
23455 $rm -f config.msg
23456fi
23457$rm -f kit*isdone ark*isdone
23458$rm -rf UU
23459
23460: End of Configure
23461