This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tests using t/lib/common.pl need to run in separate directories.
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
613d6c3e 14# Note: this Configure script was generated automatically. Rather than
2304df62 15# working with this copy of Configure, you may wish to get metaconfig.
613d6c3e
MB
16# The dist package (which contains metaconfig) is available via SVN:
17# svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
2304df62 18#
6f5be6d1
MB
19# Though this script was generated by metaconfig from metaunits, it is
20# OK to send patches against Configure itself. It's up to the Configure
21# pumpkin to backport the patch to the metaunits if it is accepted.
4471067f
JV
22# For more information on patching Configure, see pod/perlhack.pod
23#
6f5be6d1
MB
24# The metaunits are also available from the public git repository:
25# http://perl5.git.perl.org/metaconfig.git/ or
26# $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
5cadb3f3 27#
5cadb3f3
MB
28# See Porting/pumpkin.pod for more information on metaconfig.
29#
2304df62 30
613d6c3e 31# $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
2304df62 32#
9e08e8f0 33# Generated on Thu Aug 12 11:38:08 CEST 2010 [metaconfig 3.5 PL0]
7f2de2d2 34# (with additional metaconfig patches by perlbug@perl.org)
2304df62 35
283fdd21 36cat >c1$$ <<EOF
2304df62
AD
37ARGGGHHHH!!!!!
38
39SCO csh still thinks true is false. Write to SCO today and tell them that next
40year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
43we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45[End of diatribe. We now return you to your regularly scheduled programming...]
46EOF
283fdd21 47cat >c2$$ <<EOF
2304df62
AD
48
49OOPS! You naughty creature! You didn't run Configure with sh!
50I will attempt to remedy the situation by running sh for you...
51EOF
52
283fdd21 53true || cat c1$$ c2$$
2304df62
AD
54true || exec sh $0 $argv:q
55
283fdd21 56(exit $?0) || cat c2$$
2304df62 57(exit $?0) || exec sh $0 $argv:q
283fdd21 58rm -f c1$$ c2$$
2304df62 59
f6538904 60if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
d03b3b00 61 cat <<EOF
cbee2ce6
JH
62***
63*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
65*** Please read the README.plan9 for further instructions.
66*** Cannot continue, aborting.
67***
68EOF
69 exit 1
70fi
71
f8e2af1d 72if test ! -c /dev/null ; then
d03b3b00 73 cat <<EOF
f8e2af1d
MC
74***
75*** I'm sorry, but /dev/null appears to be a file rather than a device.
76*** Please consult your operating sytem's notes for making a device
77*** in /dev.
78*** Cannot continue, aborting.
79***
80EOF
81 exit 1
82fi
83
a0d0e21e
LW
84: compute my invocation name
85me=$0
86case "$0" in
87*/*)
88 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89 test "$me" || me=$0
90 ;;
91esac
92
dfe9444c 93: Proper separator for the PATH environment variable
8e07c86e 94p_=:
613d6c3e 95: On OS/2 this directory should exist if this is not floppy only system ":-]"
5c728af0 96if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
613d6c3e 97 if test -n "$OS2_SHELL"; then
dfe9444c
AD
98 p_=\;
99 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 101 is_os2=yes
c4f23d77 102 elif test -n "$DJGPP"; then
495e2cbe
MB
103 case "X${MACHTYPE:-nonesuchmach}" in
104 *cygwin) ;;
105 *) p_=\; ;;
106 esac
dfe9444c 107 fi
39e571d4 108fi
a0d0e21e
LW
109
110: Proper PATH setting
111paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 112paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 113paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 114paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 115paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 116paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
117paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 119paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
120
121for p in $paths
122do
8e07c86e
AD
123 case "$p_$PATH$p_" in
124 *$p_$p$p_*) ;;
125 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
126 esac
127done
128
8e07c86e 129PATH=.$p_$PATH
2304df62
AD
130export PATH
131
dfe9444c
AD
132: shall we be using ksh?
133inksh=''
134needksh=''
135avoidksh=''
136newsh=/bin/ksh
137changesh=''
ff0cee69 138if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
139 inksh=true
140fi
141if test -f /hp-ux -a -f /bin/ksh; then
142 needksh='to avoid sh bug in "here document" expansion'
143fi
144if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145 if test X`/usr/bin/uname -v` = X4; then
146 avoidksh="to avoid AIX 4's /bin/sh"
147 newsh=/usr/bin/bsh
2304df62 148 fi
dfe9444c 149fi
cf04f91f
JH
150if test -f /osf_boot -a -f /usr/sbin/setld; then
151 if test X`/usr/bin/uname -s` = XOSF1; then
613d6c3e
MB
152 avoidksh="to avoid Digital UNIX' ksh"
153 newsh=/bin/sh
154 unset BIN_SH
cf04f91f
JH
155 fi
156fi
dfe9444c
AD
157case "$inksh/$needksh" in
158/[a-z]*)
c4f23d77 159 ENV=''
dfe9444c
AD
160 changesh=true
161 reason="$needksh"
162 ;;
163esac
164case "$inksh/$avoidksh" in
165true/[a-z]*)
166 changesh=true
167 reason="$avoidksh"
168 ;;
169esac
170case "$inksh/$needksh-$avoidksh-" in
171true/--)
a0d0e21e
LW
172 cat <<EOM
173(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 174mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 175EOM
dfe9444c
AD
176 ;;
177esac
178case "$changesh" in
179true)
2e2a97a6 180 export newsh
dfe9444c
AD
181 echo "(Feeding myself to $newsh $reason.)"
182 case "$0" in
183 Configure|*/Configure) exec $newsh $0 "$@";;
184 *) exec $newsh Configure "$@";;
185 esac
186 ;;
187esac
7730b9f4 188test -x "${newsh}" || unset newsh
2304df62 189
613d6c3e 190: if needed, set CDPATH to a harmless value that is not chatty
bfb7748a
AD
191: avoid bash 2.02 problems with empty CDPATH.
192case "$CDPATH" in
193'') ;;
194*) case "$SHELL" in
613d6c3e
MB
195 *bash*) CDPATH='.' ;;
196 *) CDPATH='' ;;
bfb7748a
AD
197 esac
198 ;;
199esac
613d6c3e 200
2304df62
AD
201: Configure runs within the UU subdirectory
202test -d UU || mkdir UU
8e07c86e 203cd UU && rm -f ./*
2304df62 204
6b356c8e
JH
205ccname=''
206ccversion=''
b4eb6b3d
JH
207ccsymbols=''
208cppccsymbols=''
209cppsymbols=''
5440bc8e
JH
210from=''
211run=''
212targetarch=''
213to=''
214usecrosscompile=''
61c26d18 215extern_C=''
6b34ded5 216mistrustnm=''
1be1b388 217usedevel=''
9c839522 218perllibs=''
b4eb6b3d
JH
219dynamic_ext=''
220extensions=''
221known_extensions=''
222nonxs_ext=''
223static_ext=''
224useopcode=''
225useposix=''
6fcddf3b 226extras=''
ecfc5424 227d_bsd=''
40a7a20a 228d_eunice=''
2304df62
AD
229d_xenix=''
230eunicefix=''
dfe9444c 231ar=''
2304df62
AD
232awk=''
233bash=''
234bison=''
235byacc=''
236cat=''
237chgrp=''
238chmod=''
239chown=''
ecfc5424 240comm=''
2304df62
AD
241compress=''
242cp=''
243cpio=''
244cpp=''
245csh=''
246date=''
247echo=''
248egrep=''
249emacs=''
250expr=''
251find=''
252flex=''
3c728e00 253gmake=''
2304df62 254grep=''
8ff267be 255gzip=''
2304df62
AD
256inews=''
257ksh=''
258less=''
259line=''
260lint=''
261ln=''
262lp=''
263lpr=''
264ls=''
265mail=''
266mailx=''
dfe9444c 267make=''
2304df62
AD
268mkdir=''
269more=''
270mv=''
693762b4 271nm=''
2304df62
AD
272nroff=''
273perl=''
274pg=''
275pmake=''
276pr=''
277rm=''
278rmail=''
279sed=''
280sendmail=''
2304df62
AD
281shar=''
282sleep=''
283smail=''
284sort=''
285submit=''
286tail=''
287tar=''
288tbl=''
693762b4 289tee=''
2304df62
AD
290test=''
291touch=''
292tr=''
293troff=''
294uname=''
295uniq=''
296uuname=''
297vi=''
298zcat=''
8ff267be 299zip=''
b4eb6b3d
JH
300full_ar=''
301full_sed=''
a0d0e21e 302libswanted=''
2304df62
AD
303hint=''
304myuname=''
85e6fe83
LW
305osname=''
306osvers=''
2304df62
AD
307Author=''
308Date=''
309Header=''
310Id=''
311Locker=''
312Log=''
313RCSfile=''
314Revision=''
315Source=''
316State=''
dfe9444c
AD
317_a=''
318_exe=''
319_o=''
4633a7c4
LW
320archobjs=''
321exe_ext=''
322firstmakefile=''
323lib_ext=''
324obj_ext=''
325path_sep=''
5b813a60 326rm_try=''
b4eb6b3d 327afs=''
a6d26a0d 328afsroot=''
b4eb6b3d
JH
329alignbytes=''
330ansi2knr=''
331archlib=''
332archlibexp=''
333d_archlib=''
334installarchlib=''
335archname=''
336myarchname=''
337d_atolf=''
338d_atoll=''
339baserev=''
340bin=''
341binexp=''
f3f1a2d8 342initialinstalllocation=''
b4eb6b3d 343installbin=''
f3f1a2d8 344userelocatableinc=''
b4eb6b3d 345byteorder=''
2304df62 346cc=''
2304df62
AD
347ccflags=''
348cppflags=''
349ldflags=''
350lkflags=''
8e07c86e 351locincpth=''
2304df62 352optimize=''
b4eb6b3d 353cf_email=''
2304df62
AD
354cf_by=''
355cf_time=''
c193ef60
MB
356charbits=''
357charsize=''
2304df62 358contains=''
b4eb6b3d 359cpp_stuff=''
2304df62
AD
360cpplast=''
361cppminus=''
362cpprun=''
363cppstdin=''
74cac757 364d__fwalk=''
b4eb6b3d
JH
365d_access=''
366d_accessx=''
55954f19 367d_aintl=''
b4eb6b3d 368d_alarm=''
10bc17b6
JH
369asctime_r_proto=''
370d_asctime_r=''
fcdf39cf 371d_attribute_deprecated=''
0dbb1585
AL
372d_attribute_format=''
373d_attribute_malloc=''
374d_attribute_nonnull=''
375d_attribute_noreturn=''
376d_attribute_pure=''
377d_attribute_unused=''
378d_attribute_warn_unused_result=''
dcb594bc 379d_printf_format_null=''
b4eb6b3d
JH
380d_bcmp=''
381d_bcopy=''
635aebb7
AL
382d_builtin_choose_expr=''
383d_builtin_expect=''
b4eb6b3d 384d_bzero=''
a2d23ec2 385d_c99_variadic_macros=''
b4eb6b3d
JH
386d_casti32=''
387castflags=''
388d_castneg=''
389d_chown=''
390d_chroot=''
391d_chsize=''
758a5d79 392d_class=''
b0a2e8e6 393d_clearenv=''
b4eb6b3d
JH
394d_closedir=''
395d_void_closedir=''
4e0554ec 396d_cmsghdr_s=''
b4eb6b3d 397d_const=''
36adc09b 398d_copysignl=''
666ea192 399d_cplusplus=''
b4eb6b3d
JH
400cryptlib=''
401d_crypt=''
10bc17b6
JH
402crypt_r_proto=''
403d_crypt_r=''
b4eb6b3d
JH
404d_csh=''
405full_csh=''
13cfc98d 406d_ctermid=''
10bc17b6
JH
407ctermid_r_proto=''
408d_ctermid_r=''
409ctime_r_proto=''
410d_ctime_r=''
b4eb6b3d
JH
411d_cuserid=''
412d_dbl_dig=''
2ef53570 413d_dbminitproto=''
b4eb6b3d 414d_difftime=''
de52168c 415d_dir_dd_fd=''
ae0e3d3b 416d_dirfd=''
b4eb6b3d 417d_dlerror=''
a0d0e21e 418d_dlopen=''
b4eb6b3d
JH
419d_dlsymun=''
420d_dosuid=''
421d_suidsafe=''
10bc17b6
JH
422d_drand48_r=''
423drand48_r_proto=''
b4eb6b3d
JH
424d_drand48proto=''
425d_dup2=''
426d_eaccess=''
427d_endgrent=''
10bc17b6
JH
428d_endgrent_r=''
429endgrent_r_proto=''
b4eb6b3d 430d_endhent=''
10bc17b6
JH
431d_endhostent_r=''
432endhostent_r_proto=''
b4eb6b3d 433d_endnent=''
10bc17b6
JH
434d_endnetent_r=''
435endnetent_r_proto=''
b4eb6b3d 436d_endpent=''
10bc17b6
JH
437d_endprotoent_r=''
438endprotoent_r_proto=''
b4eb6b3d 439d_endpwent=''
10bc17b6
JH
440d_endpwent_r=''
441endpwent_r_proto=''
b4eb6b3d 442d_endsent=''
10bc17b6
JH
443d_endservent_r=''
444endservent_r_proto=''
15b61c98 445d_faststdio=''
b363b713 446d_fchdir=''
b4eb6b3d
JH
447d_fchmod=''
448d_fchown=''
449d_fcntl=''
9d9004a9 450d_fcntl_can_lock=''
b4eb6b3d
JH
451d_fd_macros=''
452d_fd_set=''
453d_fds_bits=''
454d_fgetpos=''
758a5d79
JH
455d_finite=''
456d_finitel=''
b4eb6b3d
JH
457d_flexfnam=''
458d_flock=''
2ef53570 459d_flockproto=''
b4eb6b3d 460d_fork=''
758a5d79
JH
461d_fp_class=''
462d_fpclass=''
463d_fpclassify=''
464d_fpclassl=''
b4eb6b3d
JH
465d_fpos64_t=''
466d_frexpl=''
467d_fs_data_s=''
468d_fseeko=''
469d_fsetpos=''
470d_fstatfs=''
411ab01c 471d_fsync=''
b4eb6b3d
JH
472d_ftello=''
473d_ftime=''
474d_gettimeod=''
dc814df1 475d_futimes=''
b4eb6b3d 476d_Gconvert=''
5086dff9 477d_getaddrinfo=''
b4eb6b3d
JH
478d_getcwd=''
479d_getespwnam=''
480d_getfsstat=''
481d_getgrent=''
10bc17b6
JH
482d_getgrent_r=''
483getgrent_r_proto=''
484d_getgrgid_r=''
485getgrgid_r_proto=''
486d_getgrnam_r=''
487getgrnam_r_proto=''
b4eb6b3d
JH
488d_getgrps=''
489d_gethbyaddr=''
490d_gethbyname=''
491d_gethent=''
492aphostname=''
493d_gethname=''
494d_phostname=''
495d_uname=''
10bc17b6
JH
496d_gethostbyaddr_r=''
497gethostbyaddr_r_proto=''
498d_gethostbyname_r=''
499gethostbyname_r_proto=''
500d_gethostent_r=''
501gethostent_r_proto=''
b4eb6b3d 502d_gethostprotos=''
4e0554ec 503d_getitimer=''
b4eb6b3d 504d_getlogin=''
10bc17b6
JH
505d_getlogin_r=''
506getlogin_r_proto=''
b4eb6b3d
JH
507d_getmnt=''
508d_getmntent=''
5086dff9 509d_getnameinfo=''
b4eb6b3d
JH
510d_getnbyaddr=''
511d_getnbyname=''
512d_getnent=''
10bc17b6
JH
513d_getnetbyaddr_r=''
514getnetbyaddr_r_proto=''
515d_getnetbyname_r=''
516getnetbyname_r_proto=''
517d_getnetent_r=''
518getnetent_r_proto=''
b4eb6b3d 519d_getnetprotos=''
0c0643d0 520d_getpagsz=''
b4eb6b3d
JH
521d_getpent=''
522d_getpgid=''
523d_getpgrp2=''
524d_bsdgetpgrp=''
525d_getpgrp=''
526d_getppid=''
527d_getprior=''
528d_getpbyname=''
529d_getpbynumber=''
10bc17b6
JH
530d_getprotobyname_r=''
531getprotobyname_r_proto=''
532d_getprotobynumber_r=''
533getprotobynumber_r_proto=''
534d_getprotoent_r=''
535getprotoent_r_proto=''
b4eb6b3d
JH
536d_getprotoprotos=''
537d_getprpwnam=''
538d_getpwent=''
10bc17b6
JH
539d_getpwent_r=''
540getpwent_r_proto=''
541d_getpwnam_r=''
542getpwnam_r_proto=''
543d_getpwuid_r=''
544getpwuid_r_proto=''
b4eb6b3d 545d_getsent=''
10bc17b6
JH
546d_getservbyname_r=''
547getservbyname_r_proto=''
548d_getservbyport_r=''
549getservbyport_r_proto=''
550d_getservent_r=''
551getservent_r_proto=''
b4eb6b3d
JH
552d_getservprotos=''
553d_getspnam=''
10bc17b6
JH
554d_getspnam_r=''
555getspnam_r_proto=''
b4eb6b3d
JH
556d_getsbyname=''
557d_getsbyport=''
10bc17b6
JH
558d_gmtime_r=''
559gmtime_r_proto=''
a4f3eea9 560d_gnulibc=''
5f6e0ee4 561gnulibc_version=''
b4eb6b3d
JH
562d_hasmntopt=''
563d_htonl=''
55954f19 564d_ilogbl=''
b4eb6b3d 565d_inetaton=''
5086dff9
MB
566d_inetntop=''
567d_inetpton=''
b4eb6b3d
JH
568d_int64_t=''
569d_isascii=''
758a5d79
JH
570d_isfinite=''
571d_isinf=''
b4eb6b3d
JH
572d_isnan=''
573d_isnanl=''
574d_killpg=''
575d_lchown=''
576d_ldbl_dig=''
0a0abfba 577d_libm_lib_version=''
b4eb6b3d 578d_link=''
10bc17b6 579d_localtime_r=''
8572b25d 580d_localtime_r_needs_tzset=''
10bc17b6 581localtime_r_proto=''
b4eb6b3d
JH
582d_locconv=''
583d_lockf=''
584d_longdbl=''
585longdblsize=''
586d_longlong=''
587longlongsize=''
588d_lseekproto=''
589d_lstat=''
590d_madvise=''
7dd121ae
MB
591d_malloc_good_size=''
592d_malloc_size=''
b4eb6b3d
JH
593d_mblen=''
594d_mbstowcs=''
595d_mbtowc=''
596d_memchr=''
597d_memcmp=''
598d_memcpy=''
599d_memmove=''
600d_memset=''
601d_mkdir=''
602d_mkdtemp=''
603d_mkfifo=''
604d_mkstemp=''
605d_mkstemps=''
606d_mktime=''
607d_mmap=''
608mmaptype=''
609d_modfl=''
e67aeab1 610d_modfl_pow32_bug=''
bc9a1b2c 611d_modflproto=''
b4eb6b3d
JH
612d_mprotect=''
613d_msg=''
614d_msgctl=''
615d_msgget=''
4e0554ec 616d_msghdr_s=''
b4eb6b3d
JH
617d_msgrcv=''
618d_msgsnd=''
619d_msync=''
620d_munmap=''
621d_nice=''
2765b840 622d_nl_langinfo=''
b4eb6b3d
JH
623d_off64_t=''
624d_open3=''
625d_fpathconf=''
626d_pathconf=''
627d_pause=''
628d_pipe=''
629d_poll=''
2304df62 630d_portable=''
c796e3db
MB
631d_prctl=''
632d_prctl_set_name=''
a33c94aa 633d_procselfexe=''
f24dbf84 634procselfexe=''
b4eb6b3d
JH
635d_old_pthread_create_joinable=''
636old_pthread_create_joinable=''
d6483fcc 637d_pthread_atfork=''
58d975c3 638d_pthread_attr_setscope=''
b4eb6b3d
JH
639d_pthread_yield=''
640d_sched_yield=''
641sched_yield=''
642d_qgcvt=''
10bc17b6
JH
643d_random_r=''
644random_r_proto=''
645d_readdir64_r=''
646readdir64_r_proto=''
b4eb6b3d
JH
647d_readdir=''
648d_rewinddir=''
649d_seekdir=''
650d_telldir=''
10bc17b6
JH
651d_readdir_r=''
652readdir_r_proto=''
b4eb6b3d 653d_readlink=''
4e0554ec
JH
654d_readv=''
655d_recvmsg=''
b4eb6b3d
JH
656d_rename=''
657d_rmdir=''
658d_safebcpy=''
659d_safemcpy=''
660d_sanemcmp=''
ef9f17be 661d_sbrkproto=''
55954f19 662d_scalbnl=''
b4eb6b3d
JH
663d_select=''
664d_sem=''
665d_semctl=''
666d_semget=''
667d_semop=''
4e0554ec 668d_sendmsg=''
b4eb6b3d
JH
669d_setegid=''
670d_seteuid=''
671d_setgrent=''
10bc17b6
JH
672d_setgrent_r=''
673setgrent_r_proto=''
b4eb6b3d
JH
674d_setgrps=''
675d_sethent=''
10bc17b6
JH
676d_sethostent_r=''
677sethostent_r_proto=''
4e0554ec 678d_setitimer=''
b4eb6b3d
JH
679d_setlinebuf=''
680d_setlocale=''
10bc17b6
JH
681d_setlocale_r=''
682setlocale_r_proto=''
b4eb6b3d 683d_setnent=''
10bc17b6
JH
684d_setnetent_r=''
685setnetent_r_proto=''
b4eb6b3d
JH
686d_setpent=''
687d_setpgid=''
688d_setpgrp2=''
689d_bsdsetpgrp=''
690d_setpgrp=''
691d_setprior=''
692d_setproctitle=''
10bc17b6
JH
693d_setprotoent_r=''
694setprotoent_r_proto=''
b4eb6b3d 695d_setpwent=''
10bc17b6
JH
696d_setpwent_r=''
697setpwent_r_proto=''
b4eb6b3d
JH
698d_setregid=''
699d_setresgid=''
700d_setresuid=''
701d_setreuid=''
702d_setrgid=''
703d_setruid=''
704d_setsent=''
10bc17b6
JH
705d_setservent_r=''
706setservent_r_proto=''
b4eb6b3d
JH
707d_setsid=''
708d_setvbuf=''
709d_sfio=''
710usesfio=''
711d_shm=''
712d_shmat=''
713d_shmatprototype=''
714shmattype=''
715d_shmctl=''
716d_shmdt=''
717d_shmget=''
718d_sigaction=''
ed140128 719d_signbit=''
983dbef6 720d_sigprocmask=''
b4eb6b3d 721d_sigsetjmp=''
5f106f9c 722usesitecustomize=''
4f5da3e9
SP
723d_snprintf=''
724d_vsnprintf=''
49a78c82 725d_sockatmark=''
2ef53570 726d_sockatmarkproto=''
b4eb6b3d
JH
727d_msg_ctrunc=''
728d_msg_dontroute=''
729d_msg_oob=''
730d_msg_peek=''
731d_msg_proxy=''
732d_oldsock=''
733d_scm_rights=''
734d_socket=''
735d_sockpair=''
736sockethdr=''
737socketlib=''
738d_socklen_t=''
739d_socks5_init=''
360321b3 740d_sprintf_returns_strlen=''
b4eb6b3d 741d_sqrtl=''
10bc17b6
JH
742d_srand48_r=''
743srand48_r_proto=''
744d_srandom_r=''
745srandom_r_proto=''
eef837ea 746d_sresgproto=''
640374d0 747d_sresuproto=''
b4eb6b3d
JH
748d_statblks=''
749d_statfs_f_flags=''
750d_statfs_s=''
17a6c8e3
AD
751d_static_inline=''
752perl_static_inline=''
b4eb6b3d
JH
753d_fstatvfs=''
754d_statvfs=''
755d_stdio_cnt_lval=''
756d_stdio_ptr_lval=''
a7ffa9b9
NC
757d_stdio_ptr_lval_nochange_cnt=''
758d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
759d_stdiobase=''
760d_stdstdio=''
761stdio_base=''
762stdio_bufsiz=''
763stdio_cnt=''
764stdio_filbuf=''
765stdio_ptr=''
766d_index=''
767d_strchr=''
768d_strcoll=''
769d_strctcpy=''
770d_strerrm=''
771d_strerror=''
772d_sysernlst=''
773d_syserrlst=''
10bc17b6
JH
774d_strerror_r=''
775strerror_r_proto=''
b3c85772 776d_strftime=''
08c92000
MB
777d_strlcat=''
778d_strlcpy=''
b4eb6b3d
JH
779d_strtod=''
780d_strtol=''
781d_strtold=''
782d_strtoll=''
28e5dec8 783d_strtoq=''
b4eb6b3d
JH
784d_strtoul=''
785d_strtoull=''
786d_strtouq=''
787d_strxfrm=''
788d_symlink=''
789d_syscall=''
2ef53570 790d_syscallproto=''
b4eb6b3d
JH
791d_sysconf=''
792d_system=''
793d_tcgetpgrp=''
794d_tcsetpgrp=''
795d_telldirproto=''
796d_time=''
797timetype=''
96938616
MB
798d_asctime64=''
799d_ctime64=''
800d_difftime64=''
801d_gmtime64=''
802d_localtime64=''
803d_mktime64=''
cbb9e8a7 804d_timegm=''
b4eb6b3d
JH
805clocktype=''
806d_times=''
10bc17b6
JH
807d_tmpnam_r=''
808tmpnam_r_proto=''
b4eb6b3d 809d_truncate=''
10bc17b6
JH
810d_ttyname_r=''
811ttyname_r_proto=''
b4eb6b3d 812d_tzname=''
4e0554ec
JH
813d_u32align=''
814d_ualarm=''
b4eb6b3d
JH
815d_umask=''
816d_semctl_semid_ds=''
817d_semctl_semun=''
818d_union_semun=''
758a5d79 819d_unordered=''
bdf33aa7 820d_unsetenv=''
4e0554ec 821d_usleep=''
2ef53570 822d_usleepproto=''
b4eb6b3d 823d_ustat=''
233e16ce 824d_pseudofork=''
b4eb6b3d
JH
825d_vfork=''
826usevfork=''
827d_voidsig=''
828signal_t=''
829d_volatile=''
830d_charvspr=''
831d_vprintf=''
832d_wait4=''
833d_waitpid=''
834d_wcstombs=''
835d_wctomb=''
4e0554ec 836d_writev=''
b4eb6b3d 837dlext=''
f1ce3bf1 838bin_ELF=''
85e6fe83
LW
839cccdlflags=''
840ccdlflags=''
2304df62 841dlsrc=''
232e078e 842ld=''
85e6fe83 843lddlflags=''
2304df62 844usedl=''
b4eb6b3d
JH
845doublesize=''
846ebcdic=''
847fflushNULL=''
848fflushall=''
849fpossize=''
850fpostype=''
2d736872 851gccansipedantic=''
5b463ca7 852gccosandvers=''
8a27cf78 853gccversion=''
b4eb6b3d
JH
854gidformat=''
855gidsign=''
856gidsize=''
857gidtype=''
858groupstype=''
859h_fcntl=''
860h_sysfile=''
6e1038e0
MB
861html1dir=''
862html1direxp=''
863installhtml1dir=''
864html3dir=''
865html3direxp=''
866installhtml3dir=''
b4eb6b3d 867i_arpainet=''
c0bacbef 868i_assert=''
10bc17b6 869i_crypt=''
b4eb6b3d
JH
870db_hashtype=''
871db_prefixtype=''
640374d0
JH
872db_version_major=''
873db_version_minor=''
874db_version_patch=''
b4eb6b3d
JH
875i_db=''
876i_dbm=''
877i_rpcsvcdbm=''
878d_dirnamlen=''
879direntrytype=''
880i_dirent=''
a0d0e21e 881i_dld=''
b4eb6b3d
JH
882i_dlfcn=''
883i_fcntl=''
884i_float=''
758a5d79
JH
885i_fp=''
886i_fp_class=''
b4eb6b3d
JH
887i_gdbm=''
888d_grpasswd=''
889i_grp=''
b4eb6b3d
JH
890i_ieeefp=''
891i_inttypes=''
2765b840 892i_langinfo=''
b4eb6b3d
JH
893i_libutil=''
894i_limits=''
895i_locale=''
896i_machcthr=''
897i_malloc=''
1cd66f7c 898i_mallocmalloc=''
b4eb6b3d
JH
899i_math=''
900i_memory=''
901i_mntent=''
e74475c7
MHM
902d_gdbm_ndbm_h_uses_prototypes=''
903d_gdbmndbm_h_uses_prototypes=''
a33f2d9f 904d_ndbm=''
e74475c7 905d_ndbm_h_uses_prototypes=''
a33f2d9f
AD
906i_gdbm_ndbm=''
907i_gdbmndbm=''
b4eb6b3d
JH
908i_ndbm=''
909i_netdb=''
910i_neterrno=''
911i_netinettcp=''
912i_niin=''
913i_sysin=''
914i_poll=''
915i_prot=''
916i_pthread=''
917d_pwage=''
918d_pwchange=''
919d_pwclass=''
920d_pwcomment=''
921d_pwexpire=''
922d_pwgecos=''
923d_pwpasswd=''
924d_pwquota=''
925i_pwd=''
926i_sfio=''
927i_shadow=''
928i_socks=''
929i_stddef=''
930i_stdlib=''
931i_string=''
932strings=''
933i_sunmath=''
934i_sysaccess=''
935i_sysdir=''
936i_sysfile=''
937d_voidtty=''
938i_bsdioctl=''
939i_sysfilio=''
940i_sysioctl=''
941i_syssockio=''
942i_syslog=''
943i_sysmman=''
944i_sysmode=''
945i_sysmount=''
946i_sysndir=''
947i_sysparam=''
216dac04 948i_syspoll=''
b4eb6b3d
JH
949i_sysresrc=''
950i_syssecrt=''
951i_sysselct=''
952i_sysstat=''
953i_sysstatfs=''
954i_sysstatvfs=''
955i_systimes=''
956i_systypes=''
957i_sysuio=''
958i_sysun=''
959i_sysutsname=''
960i_sysvfs=''
961i_syswait=''
962i_sgtty=''
963i_termio=''
964i_termios=''
14b90194
JH
965d_tm_tm_gmtoff=''
966d_tm_tm_zone=''
b4eb6b3d
JH
967i_systime=''
968i_systimek=''
969i_time=''
970timeincl=''
971i_unistd=''
972i_ustat=''
973i_utime=''
974i_values=''
975i_stdarg=''
976i_varargs=''
977i_varhdr=''
978i_vfork=''
f3f1a2d8 979d_inc_version_list=''
b4eb6b3d
JH
980inc_version_list=''
981inc_version_list_init=''
982installprefix=''
983installprefixexp=''
984installstyle=''
985installusrbinperl=''
986intsize=''
987longsize=''
988shortsize=''
4b661809 989issymlink=''
2304df62 990libc=''
b4eb6b3d
JH
991ldlibpthname=''
992libperl=''
993shrpenv=''
994useshrplib=''
a0d0e21e 995glibpth=''
2304df62 996libpth=''
8e07c86e 997loclibpth=''
2304df62
AD
998plibpth=''
999xlibpth=''
1cfa4ec7 1000ignore_versioned_solibs=''
2304df62 1001libs=''
43999f95
JH
1002libsdirs=''
1003libsfiles=''
1004libsfound=''
13b3f787 1005libspath=''
85e6fe83 1006lns=''
b4eb6b3d
JH
1007d_PRIEUldbl=''
1008d_PRIFUldbl=''
1009d_PRIGUldbl=''
1010d_PRIeldbl=''
1011d_PRIfldbl=''
1012d_PRIgldbl=''
1013d_SCNfldbl=''
1014sPRIEUldbl=''
1015sPRIFUldbl=''
1016sPRIGUldbl=''
1017sPRIeldbl=''
1018sPRIfldbl=''
1019sPRIgldbl=''
1020sSCNfldbl=''
1021lseeksize=''
1022lseektype=''
d620c7b3 1023mad=''
00e74f14
NC
1024madlyh=''
1025madlyobj=''
1026madlysrc=''
f3f1a2d8
MB
1027make_set_make=''
1028d_mymalloc=''
1029freetype=''
b4eb6b3d
JH
1030mallocobj=''
1031mallocsrc=''
1032malloctype=''
9df442c2 1033usemallocwrap=''
b4eb6b3d
JH
1034usemymalloc=''
1035installman1dir=''
1036man1dir=''
1037man1direxp=''
1038man1ext=''
1039installman3dir=''
1040man3dir=''
1041man3direxp=''
1042man3ext=''
1043modetype=''
1044multiarch=''
1045mydomain=''
1046myhostname=''
1047phostname=''
2304df62
AD
1048c=''
1049n=''
b4eb6b3d
JH
1050d_eofnblk=''
1051eagain=''
1052o_nonblock=''
1053rd_nodata=''
2cc61e15 1054need_va_copy=''
b4eb6b3d
JH
1055netdb_hlen_type=''
1056netdb_host_type=''
1057netdb_name_type=''
1058netdb_net_type=''
1059groupcat=''
1060hostcat=''
1061passcat=''
1062orderlib=''
1063ranlib=''
1064d_perl_otherlibdirs=''
1065otherlibdirs=''
2304df62
AD
1066package=''
1067spackage=''
b4eb6b3d
JH
1068pager=''
1069api_revision=''
1070api_subversion=''
1071api_version=''
1072api_versionstring=''
1073patchlevel=''
151e6568 1074perl_patchlevel=''
b4eb6b3d
JH
1075revision=''
1076subversion=''
1077version=''
861eb78d 1078version_patchlevel_string=''
b4eb6b3d
JH
1079perl5=''
1080perladmin=''
1081perlpath=''
1082d_nv_preserves_uv=''
f607920a 1083d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1084i16size=''
1085i16type=''
1086i32size=''
1087i32type=''
1088i64size=''
1089i64type=''
1090i8size=''
1091i8type=''
1092ivsize=''
1093ivtype=''
b68c599a 1094nv_overflows_integers_at=''
4137585d 1095nv_preserves_uv_bits=''
b4eb6b3d
JH
1096nvsize=''
1097nvtype=''
1098u16size=''
1099u16type=''
1100u32size=''
1101u32type=''
1102u64size=''
1103u64type=''
1104u8size=''
1105u8type=''
1106uvsize=''
1107uvtype=''
1108ivdformat=''
1109nvEUformat=''
1110nvFUformat=''
1111nvGUformat=''
1112nveformat=''
1113nvfformat=''
1114nvgformat=''
1115uvXUformat=''
1116uvoformat=''
1117uvuformat=''
1118uvxformat=''
1119pidtype=''
1120prefix=''
1121prefixexp=''
1122installprivlib=''
1123privlib=''
1124privlibexp=''
1125prototype=''
1126ptrsize=''
1127d_PRIXU64=''
1128d_PRId64=''
1129d_PRIi64=''
1130d_PRIo64=''
1131d_PRIu64=''
1132d_PRIx64=''
1133sPRIXU64=''
1134sPRId64=''
1135sPRIi64=''
1136sPRIo64=''
1137sPRIu64=''
1138sPRIx64=''
1139d_quad=''
1140quadkind=''
1141quadtype=''
1142uquadtype=''
1143drand01=''
1144randbits=''
1145randfunc=''
1146randseedtype=''
1147seedfunc=''
1148installscript=''
1149scriptdir=''
1150scriptdirexp=''
1151selectminbits=''
1152selecttype=''
8ff267be 1153sh=''
b4eb6b3d
JH
1154sig_count=''
1155sig_name=''
1156sig_name_init=''
1157sig_num=''
1158sig_num_init=''
76d3c696 1159sig_size=''
f3f1a2d8 1160d_sitearch=''
b4eb6b3d
JH
1161installsitearch=''
1162sitearch=''
1163sitearchexp=''
1164installsitebin=''
1165sitebin=''
1166sitebinexp=''
8d2cbf27
JH
1167installsitehtml1dir=''
1168sitehtml1dir=''
1169sitehtml1direxp=''
1170installsitehtml3dir=''
1171sitehtml3dir=''
1172sitehtml3direxp=''
b4eb6b3d
JH
1173installsitelib=''
1174sitelib=''
1175sitelib_stem=''
1176sitelibexp=''
91e123a8
JH
1177installsiteman1dir=''
1178siteman1dir=''
1179siteman1direxp=''
1180installsiteman3dir=''
1181siteman3dir=''
1182siteman3direxp=''
b4eb6b3d
JH
1183siteprefix=''
1184siteprefixexp=''
6e1038e0
MB
1185installsitescript=''
1186sitescript=''
1187sitescriptexp=''
b4eb6b3d
JH
1188sizesize=''
1189sizetype=''
a0d0e21e 1190so=''
b4eb6b3d 1191socksizetype=''
2304df62
AD
1192sharpbang=''
1193shsharp=''
1194spitshell=''
dfe9444c 1195src=''
b4eb6b3d
JH
1196ssizetype=''
1197startperl=''
2304df62 1198startsh=''
b4eb6b3d
JH
1199stdchar=''
1200d_stdio_stream_array=''
1201stdio_stream_array=''
1202sysman=''
81c4fd9e
MB
1203sGMTIME_max=''
1204sGMTIME_min=''
73e6e416
MB
1205sLOCALTIME_max=''
1206sLOCALTIME_min=''
5ff3f7a4 1207trnl=''
b4eb6b3d
JH
1208uidformat=''
1209uidsign=''
1210uidsize=''
1211uidtype=''
1212archname64=''
1213use64bitall=''
1214use64bitint=''
34f1896b
MB
1215dtrace=''
1216usedtrace=''
15b61c98 1217usefaststdio=''
b4eb6b3d
JH
1218ccflags_uselargefiles=''
1219ldflags_uselargefiles=''
1220libswanted_uselargefiles=''
1221uselargefiles=''
1222uselongdouble=''
1223usemorebits=''
1224usemultiplicity=''
2304df62 1225nm_opt=''
40a7a20a 1226nm_so_opt=''
2304df62
AD
1227runnm=''
1228usenm=''
b4eb6b3d 1229useperlio=''
29209bc5 1230usesocks=''
b4eb6b3d
JH
1231d_oldpthreads=''
1232use5005threads=''
1233useithreads=''
9514c62b 1234usereentrant=''
b4eb6b3d 1235usethreads=''
2304df62 1236incpath=''
2304df62
AD
1237mips_type=''
1238usrinc=''
d03b3b00 1239vaproto=''
b4eb6b3d
JH
1240d_vendorarch=''
1241installvendorarch=''
1242vendorarch=''
1243vendorarchexp=''
1244d_vendorbin=''
1245installvendorbin=''
1246vendorbin=''
1247vendorbinexp=''
8d2cbf27
JH
1248installvendorhtml1dir=''
1249vendorhtml1dir=''
1250vendorhtml1direxp=''
1251installvendorhtml3dir=''
1252vendorhtml3dir=''
1253vendorhtml3direxp=''
b4eb6b3d
JH
1254d_vendorlib=''
1255installvendorlib=''
1256vendorlib=''
1257vendorlib_stem=''
1258vendorlibexp=''
91e123a8
JH
1259installvendorman1dir=''
1260vendorman1dir=''
1261vendorman1direxp=''
1262installvendorman3dir=''
1263vendorman3dir=''
1264vendorman3direxp=''
b4eb6b3d
JH
1265usevendorprefix=''
1266vendorprefix=''
1267vendorprefixexp=''
6e1038e0
MB
1268d_vendorscript=''
1269installvendorscript=''
1270vendorscript=''
1271vendorscriptexp=''
d56c5707 1272versiononly=''
b4eb6b3d
JH
1273defvoidused=''
1274voidflags=''
3659ebf1
JH
1275yacc=''
1276yaccflags=''
2304df62
AD
1277CONFIG=''
1278
34f1896b 1279: Detect odd OSs
ecfc5424
AD
1280define='define'
1281undef='undef'
1282smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1283rmlist=''
1284
1285: We must find out about Eunice early
1286eunicefix=':'
1287if test -f /etc/unixtovms; then
1288 eunicefix=/etc/unixtovms
1289fi
1290if test -f /etc/unixtovms.exe; then
1291 eunicefix=/etc/unixtovms.exe
1292fi
1293
cfb04860 1294: Set executable suffix now -- needed before hints available
6153ba32
PG
1295if test -f "/libs/version.library"; then
1296: Amiga OS
1297 _exe=""
1298elif test -f "/system/gnu_library/bin/ar.pm"; then
1299: Stratus VOS
cfb04860 1300 _exe=".pm"
6153ba32
PG
1301elif test -n "$DJGPP"; then
1302: DOS DJGPP
cfb04860 1303 _exe=".exe"
5c728af0 1304elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1305: OS/2 or cygwin
ba863942
JH
1306 _exe=".exe"
1307fi
868439a2 1308
1d8eaf8c 1309groupstype=''
b4eb6b3d 1310i_whoami=''
9da7673b
MB
1311: Trailing extension. Override this in a hint file, if needed.
1312: Extra object files, if any, needed on this platform.
1313archobjs=''
1314archname=''
64615a5e 1315libnames=''
732c9516
JH
1316: change the next line if compiling for Xenix/286 on Xenix/386
1317xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1318: Possible local library directories to search.
1319loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1320loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1321
1322: general looking path for locating libraries
5869b1f1 1323glibpth="/lib /usr/lib $xlibpth"
732c9516 1324glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1325test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1326test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1327test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1328
1329: Private path used by Configure to find libraries. Its value
1330: is prepended to libpth. This variable takes care of special
1331: machines, like the mips. Usually, it should be empty.
1332plibpth=''
1333
1cfa4ec7
GS
1334: default library list
1335libswanted=''
921b2963 1336: some systems want to use only the non-versioned libso:s
1cfa4ec7 1337ignore_versioned_solibs=''
ed140128
AD
1338: set usethreads on the Configure command line to enable threads.
1339usereentrant='undef'
1340: full support for void wanted by default
1341defvoidused=15
1342
1343: Possible local include directories to search.
1344: Set locincpth to "" in a hint file to defeat local include searches.
1345locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1346locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1347:
1348: no include file wanted by default
1349inclwanted=''
1350
1351: Enable -DEBUGGING and -DDEBUGGING from the command line
1352EBUGGING=''
1353DEBUGGING=old
1354
1355ccname=''
1356ccversion=''
1357perllibs=''
1358: set useposix=false in your hint file to disable the POSIX extension.
1359useposix=true
1360: set useopcode=false in your hint file to disable the Opcode extension.
1361useopcode=true
b4eb6b3d
JH
1362archname64=''
1363ccflags_uselargefiles=''
1364ldflags_uselargefiles=''
1365libswanted_uselargefiles=''
1366: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1367: set usesocks on the Configure command line to enable socks.
ecfc5424 1368: List of libraries we want.
15431986 1369: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef 1370libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8119684f 1371libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1372: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1373: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1374glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1375glibpth="/usr/shlib $glibpth"
1376: Do not use vfork unless overridden by a hint file.
1377usevfork=false
1378
8ff267be 1379: Find the basic shell for Bourne shell scripts
1380case "$sh" in
1381'')
8ff267be 1382 case "$SYSTYPE" in
1383 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1384 *) xxx='/bin/sh';;
1385 esac
1386 if test -f "$xxx"; then
1387 sh="$xxx"
1388 else
1389 : Build up a list and do a single loop so we can 'break' out.
1390 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1391 for xxx in sh bash ksh pdksh ash; do
1392 for p in $pth; do
1393 try="$try ${p}/${xxx}"
1394 done
1395 done
1396 for xxx in $try; do
1397 if test -f "$xxx"; then
1398 sh="$xxx";
8ff267be 1399 break
a5a94ea5
JH
1400 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1401 sh="$xxx";
1402 break
8ff267be 1403 elif test -f "$xxx.exe"; then
1404 sh="$xxx";
8ff267be 1405 break
1406 fi
1407 done
1408 fi
1409 ;;
1410esac
1411
1412case "$sh" in
a33c94aa 1413'') cat >&2 <<EOM
8ff267be 1414$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1415
8ff267be 1416Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1417Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1418we'll try to straighten this all out.
8ff267be 1419EOM
1420 exit 1
1421 ;;
1422esac
1423
760ac839 1424: see if sh knows # comments
73614538 1425if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1426 shsharp=true
1427 spitshell=cat
760ac839 1428 xcat=/bin/cat
a931254c
JH
1429 test -f $xcat$_exe || xcat=/usr/bin/cat
1430 if test ! -f $xcat$_exe; then
4bdb8fb5 1431 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1432 if test -f $p/cat$_exe; then
1deb0a86 1433 xcat=$p/cat
3c728e00
JH
1434 break
1435 fi
1436 done
1deb0a86
JH
1437 if test ! -f $xcat$_exe; then
1438 echo "Can't find cat anywhere!"
3c728e00
JH
1439 exit 1
1440 fi
1441 fi
5440bc8e
JH
1442 echo "#!$xcat" >sharp
1443 $eunicefix sharp
1444 chmod +x sharp
1d8eaf8c 1445 ./sharp > today 2>/dev/null
760ac839 1446 if test -s today; then
760ac839
LW
1447 sharpbang='#!'
1448 else
5440bc8e
JH
1449 echo "#! $xcat" > sharp
1450 $eunicefix sharp
1451 chmod +x sharp
1d8eaf8c 1452 ./sharp > today 2>/dev/null
760ac839 1453 if test -s today; then
760ac839
LW
1454 sharpbang='#! '
1455 else
760ac839
LW
1456 sharpbang=': use '
1457 fi
1458 fi
1459else
dfe9444c 1460 echo " "
8ff267be 1461 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1462 shsharp=false
1463 cd ..
1464 echo "exec grep -v '^[ ]*#'" >spitshell
1465 chmod +x spitshell
1466 $eunicefix spitshell
1467 spitshell=`pwd`/spitshell
1468 cd UU
1469 echo "I presume that if # doesn't work, #! won't work either!"
1470 sharpbang=': use '
1471fi
5440bc8e 1472rm -f sharp today
760ac839
LW
1473
1474: figure out how to guarantee sh startup
8ff267be 1475case "$startsh" in
1476'') startsh=${sharpbang}${sh} ;;
1477*)
760ac839 1478esac
5440bc8e 1479cat >sharp <<EOSS
760ac839
LW
1480$startsh
1481set abc
1482test "$?abc" != 1
1483EOSS
1484
5440bc8e
JH
1485chmod +x sharp
1486$eunicefix sharp
1487if ./sharp; then
8ff267be 1488 : echo "Yup, it does."
760ac839 1489else
dfe9444c
AD
1490 echo "Hmm... '$startsh' does not guarantee sh startup..."
1491 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1492fi
5440bc8e 1493rm -f sharp
760ac839 1494
aebf16e7
AD
1495: Save command line options in file UU/cmdline.opt for later use in
1496: generating config.sh.
1497cat > cmdline.opt <<EOSH
613d6c3e 1498: Configure command line arguments.
aebf16e7
AD
1499config_arg0='$0'
1500config_args='$*'
1501config_argc=$#
1502EOSH
1503argn=1
ee45ea83
IZ
1504args_exp=''
1505args_sep=''
aebf16e7
AD
1506for arg in "$@"; do
1507 cat >>cmdline.opt <<EOSH
1508config_arg$argn='$arg'
1509EOSH
ee45ea83
IZ
1510 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1511$arg
1512EOC
1513 arg_exp=`cat cmdl.opt`
1514 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1515 argn=`expr $argn + 1`
ee45ea83 1516 args_sep=' '
aebf16e7 1517done
ee45ea83 1518rm -f cmdl.opt
aebf16e7 1519
2304df62
AD
1520: produce awk script to parse command line options
1521cat >options.awk <<'EOF'
1522BEGIN {
02e93a22 1523 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1524
1525 len = length(optstr);
1526 for (i = 1; i <= len; i++) {
1527 c = substr(optstr, i, 1);
1528 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1529 if (a == ":") {
1530 arg[c] = 1;
1531 i++;
1532 }
1533 opt[c] = 1;
1534 }
1535}
1536{
1537 expect = 0;
1538 str = $0;
1539 if (substr(str, 1, 1) != "-") {
1540 printf("'%s'\n", str);
1541 next;
1542 }
1543 len = length($0);
1544 for (i = 2; i <= len; i++) {
1545 c = substr(str, i, 1);
1546 if (!opt[c]) {
1547 printf("-%s\n", substr(str, i));
1548 next;
1549 }
1550 printf("-%s\n", c);
1551 if (arg[c]) {
1552 if (i < len)
1553 printf("'%s'\n", substr(str, i + 1));
1554 else
1555 expect = 1;
1556 next;
1557 }
1558 }
1559}
1560END {
1561 if (expect)
1562 print "?";
1563}
1564EOF
1565
1566: process the command line options
4633a7c4
LW
1567set X `for arg in "$@"; do echo "X$arg"; done |
1568 sed -e s/X// | awk -f options.awk`
2304df62
AD
1569eval "set $*"
1570shift
1571rm -f options.awk
1572
1573: set up default values
1574fastread=''
1575reuseval=false
1576config_sh=''
1577alldone=''
1578error=''
1579silent=''
1580extractsh=''
ecfc5424 1581override=''
16d20bd9 1582knowitall=''
02e93a22 1583rm -f optdef.sh posthint.sh
28757baa 1584cat >optdef.sh <<EOS
1585$startsh
1586EOS
2304df62 1587
dfe9444c 1588
2304df62
AD
1589: option parsing
1590while test $# -gt 0; do
1591 case "$1" in
1592 -d) shift; fastread=yes;;
1593 -e) shift; alldone=cont;;
1594 -f)
1595 shift
1596 cd ..
1597 if test -r "$1"; then
1598 config_sh="$1"
1599 else
a0d0e21e 1600 echo "$me: cannot read config file $1." >&2
2304df62
AD
1601 error=true
1602 fi
1603 cd UU
1604 shift;;
3f30fabf 1605 --help|\
2304df62
AD
1606 -h) shift; error=true;;
1607 -r) shift; reuseval=true;;
dfe9444c 1608 -s) shift; silent=true; realsilent=true;;
2304df62 1609 -E) shift; alldone=exit;;
16d20bd9 1610 -K) shift; knowitall=true;;
ecfc5424 1611 -O) shift; override=true;;
dfe9444c 1612 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1613 -D)
1614 shift
1615 case "$1" in
1616 *=)
1617 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1618 echo "$me: ignoring -D $1" >&2
1619 ;;
ecfc5424 1620 *=*) echo "$1" | \
1aef975c
AD
1621 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1622 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1623 esac
1624 shift
1625 ;;
1626 -U)
1627 shift
1628 case "$1" in
1aef975c 1629 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1630 *=*)
1631 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1632 echo "$me: ignoring -U $1" >&2
1633 ;;
1aef975c 1634 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1635 esac
1636 shift
1637 ;;
02e93a22
JH
1638 -A)
1639 shift
1640 xxx=''
1641 yyy="$1"
02e93a22 1642 zzz=''
5f83a3e9 1643 uuu=undef
02e93a22 1644 case "$yyy" in
f7c31117 1645 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1646 case "$zzz" in
1647 *:*) zzz='' ;;
1648 *) xxx=append
613d6c3e 1649 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
f7c31117 1650 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1651 esac
1652 ;;
1653 esac
1654 case "$xxx" in
1655 '') case "$yyy" in
f7c31117
JH
1656 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1657 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1658 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1659 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1660 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1661 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9 1662 esac
613d6c3e 1663 ;;
5f83a3e9 1664 esac
02e93a22
JH
1665 case "$xxx" in
1666 append)
5f83a3e9 1667 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1668 clear)
5f83a3e9 1669 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1670 define)
1671 case "$zzz" in
1672 '') zzz=define ;;
1673 esac
5f83a3e9 1674 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1675 eval)
5f83a3e9 1676 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1677 prepend)
5f83a3e9 1678 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1679 undef)
1680 case "$zzz" in
1681 '') zzz="$uuu" ;;
1682 esac
5f83a3e9
JH
1683 echo "$yyy=$zzz" >> posthint.sh ;;
1684 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1685 esac
bde6b06b 1686 shift
02e93a22 1687 ;;
216dac04 1688 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
5f83a3e9 1689 exit 0;;
2304df62 1690 --) break;;
a0d0e21e 1691 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1692 *) break;;
1693 esac
1694done
1695
1696case "$error" in
1697true)
1698 cat >&2 <<EOM
2afac517 1699Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1700 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1701 -d : use defaults for all answers.
1702 -e : go on without questioning past the production of config.sh.
1703 -f : specify an alternate default configuration file.
1704 -h : print this help message and exit (with an error status).
1705 -r : reuse C symbols value if possible (skips costly nm extraction).
1706 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1707 -D : define symbol to have some value:
1708 -D symbol symbol gets the value 'define'
1709 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1710 common used examples (see INSTALL for more info):
1711 -Duse64bitint use 64bit integers
b79e0b55 1712 -Duse64bitall use 64bit integers and pointers
3f30fabf 1713 -Dusethreads use thread support
b79e0b55 1714 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1715 -DEBUGGING=none DEBUGGING options
1716 -Dcc=gcc choose your compiler
1717 -Dprefix=/opt/perl5 choose your destination
2304df62 1718 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1719 -K : do not use unless you know what you are doing.
ecfc5424 1720 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1721 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1722 -U : undefine symbol:
1723 -U symbol symbol gets the value 'undef'
1724 -U symbol= symbol gets completely empty
3f30fabf 1725 e.g.: -Uversiononly
02e93a22 1726 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1727 -A append:symbol=value append value to symbol
1728 -A symbol=value like append:, but with a separating space
1729 -A define:symbol=value define symbol to have value
1730 -A clear:symbol define symbol to be ''
1731 -A define:symbol define symbol to be 'define'
1732 -A eval:symbol=value define symbol to be eval of value
1733 -A prepend:symbol=value prepend value to symbol
1734 -A undef:symbol define symbol to be 'undef'
1735 -A undef:symbol= define symbol to be ''
3f30fabf 1736 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1737 -A ccflags=-DSOME_MACRO
2304df62
AD
1738 -V : print version number and exit (with a zero status).
1739EOM
1740 exit 1
1741 ;;
1742esac
1743
dfe9444c
AD
1744: Sanity checks
1745case "$fastread$alldone" in
1746yescont|yesexit) ;;
1747*)
aaeb8e51
GS
1748 case "$extractsh" in
1749 true) ;;
1750 *)
1751 if test ! -t 0; then
1752 echo "Say 'sh Configure', not 'sh <Configure'"
1753 exit 1
1754 fi
1755 ;;
1756 esac
dfe9444c
AD
1757 ;;
1758esac
1759
2304df62
AD
1760exec 4>&1
1761case "$silent" in
1762true) exec 1>/dev/null;;
1763esac
1764
ecfc5424 1765: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1766touch optdef.sh
1767. ./optdef.sh
02e93a22
JH
1768: create the posthint manipulation script and leave the file out there...
1769touch posthint.sh
a0d0e21e 1770
2304df62 1771: set package name
34f1896b 1772package='perl5'
b4eb6b3d
JH
1773first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1774last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1775case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1776ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1777*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1778esac
2304df62 1779
2304df62
AD
1780: Some greps do not return status, grrr.
1781echo "grimblepritz" >grimble
1782if grep blurfldyick grimble >/dev/null 2>&1 ; then
1783 contains=contains
1784elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1785 contains=grep
1786else
1787 contains=contains
1788fi
1789rm -f grimble
1790: the following should work in any shell
1791case "$contains" in
1792contains*)
1793 echo " "
1794 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1795 cat >contains <<'EOSS'
1796grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1797EOSS
1798chmod +x contains
1799esac
1800
dfe9444c
AD
1801: Find the path to the source tree
1802case "$src" in
1803'') case "$0" in
b233458b
JH
1804 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1805 case "$src" in
1806 /*) ;;
8504afb7 1807 .) ;;
b233458b
JH
1808 *) src=`cd ../$src && pwd` ;;
1809 esac
1810 ;;
dfe9444c
AD
1811 *) src='.';;
1812 esac;;
1813esac
1814case "$src" in
1815'') src=/
1816 rsrc=/
1817 ;;
34f1896b
MB
1818/*) rsrc="$src";;
1819*) rsrc="../$src";;
dfe9444c
AD
1820esac
1821if test -f $rsrc/Configure && \
34f1896b 1822 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
dfe9444c
AD
1823then
1824 : found it, so we are ok.
1825else
1826 rsrc=''
1827 for src in . .. ../.. ../../.. ../../../..; do
1828 if test -f ../$src/Configure && \
1829 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1830 then
1831 rsrc=../$src
1832 break
1833 fi
1834 done
1835fi
1836case "$rsrc" in
1837'')
1838 cat <<EOM >&4
1839
1840Sorry, I can't seem to locate the source dir for $package. Please start
1841Configure with an explicit path -- i.e. /some/path/Configure.
1842
1843EOM
1844 exit 1
1845 ;;
1846../.) rsrc='..';;
1847*)
1848 echo " "
1849 echo "Sources for $package found in \"$src\"." >&4
1850 ;;
1851esac
1852
1853: script used to extract .SH files with variable substitutions
1854cat >extract <<'EOS'
a02608de 1855PERL_CONFIG_SH=true
dfe9444c 1856echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1857if test -f MANIFEST; then
1858 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1859else
1860 echo "(Looking for .SH files under the source directory.)"
6904989c 1861 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1862fi
1863shift
1864case $# in
6904989c 18650) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1866esac
6904989c 1867if test ! -f "$src/$1"; then
dfe9444c
AD
1868 shift
1869fi
1870mkdir_p='
1871name=$1;
1872create="";
1873while test $name; do
1874 if test ! -d "$name"; then
1875 create="$name $create";
1876 name=`echo $name | sed -e "s|^[^/]*$||"`;
1877 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1878 else
1879 name="";
1880 fi;
1881done;
1882for file in $create; do
1883 mkdir $file;
1884done
1885'
1886for file in $*; do
1887 case "$src" in
1888 ".")
1889 case "$file" in
1890 */*)
1891 dir=`expr X$file : 'X\(.*\)/'`
1892 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1893 (cd "$dir" && . ./$file)
dfe9444c
AD
1894 ;;
1895 *)
1896 . ./$file
1897 ;;
1898 esac
1899 ;;
1900 *)
1901 case "$file" in
1902 */*)
1903 dir=`expr X$file : 'X\(.*\)/'`
1904 file=`expr X$file : 'X.*/\(.*\)'`
1905 (set x $dir; shift; eval $mkdir_p)
6904989c 1906 sh <"$src/$dir/$file"
dfe9444c
AD
1907 ;;
1908 *)
6904989c 1909 sh <"$src/$file"
dfe9444c
AD
1910 ;;
1911 esac
1912 ;;
1913 esac
1914done
6904989c 1915if test -f "$src/config_h.SH"; then
dfe9444c
AD
1916 if test ! -f config.h; then
1917 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1918 . "$src/config_h.SH"
dfe9444c
AD
1919 fi
1920fi
1921EOS
1922
1923: extract files and exit if asked to do so
1924case "$extractsh" in
1925true)
1926 case "$realsilent" in
1927 true) ;;
1928 *) exec 1>&4;;
1929 esac
1930 case "$config_sh" in
1931 '') config_sh='config.sh';;
1932 esac
1933 echo " "
1934 echo "Fetching answers from $config_sh..."
1935 cd ..
1936 . $config_sh
1937 test "$override" && . ./optdef.sh
1938 echo " "
1939 . UU/extract
1940 rm -rf UU
24ccb310 1941 echo "Extraction done."
dfe9444c
AD
1942 exit 0
1943 ;;
1944esac
1945
1946: Eunice requires " " instead of "", can you believe it
1947echo " "
1948: Here we go...
1949echo "Beginning of configuration questions for $package."
1950
1951trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1952
2304df62
AD
1953: first determine how to suppress newline on echo command
1954echo " "
1955echo "Checking echo to see how to suppress newlines..."
1956(echo "hi there\c" ; echo " ") >.echotmp
1957if $contains c .echotmp >/dev/null 2>&1 ; then
1958 echo "...using -n."
1959 n='-n'
1960 c=''
1961else
1962 cat <<'EOM'
1963...using \c
1964EOM
1965 n=''
1966 c='\c'
1967fi
1968echo $n "The star should be here-->$c"
1969echo '*'
1970rm -f .echotmp
1971
1972: Now test for existence of everything in MANIFEST
1973echo " "
6904989c 1974if test -f "$rsrc/MANIFEST"; then
2304df62 1975 echo "First let's make sure your kit is complete. Checking..." >&4
1d8eaf8c 1976 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
776a38e3 1977 (split -l 50 2>/dev/null || split -50)
2304df62 1978 rm -f missing
dfe9444c 1979 tmppwd=`pwd`
2304df62 1980 for filelist in x??; do
776a38e3
MB
1981 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1982 >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1983 done
1984 if test -s missing; then
1985 cat missing >&4
1986 cat >&4 <<'EOM'
1987
1988THIS PACKAGE SEEMS TO BE INCOMPLETE.
1989
1990You have the option of continuing the configuration process, despite the
1991distinct possibility that your kit is damaged, by typing 'y'es. If you
1992do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1993and contact the author (perlbug@perl.org).
2304df62
AD
1994
1995EOM
1996 echo $n "Continue? [n] $c" >&4
1997 read ans
1998 case "$ans" in
1999 y*)
2000 echo "Continuing..." >&4
2001 rm -f missing
2002 ;;
2003 *)
2004 echo "ABORTING..." >&4
2005 kill $$
2006 ;;
2007 esac
2008 else
dfe9444c 2009 echo "Looks good..."
2304df62
AD
2010 fi
2011else
2012 echo "There is no MANIFEST file. I hope your kit is complete !"
2013fi
2014rm -f missing x??
2015
5ff3f7a4 2016: Find the appropriate value for a newline for tr
613d6c3e 2017echo " "
5ff3f7a4
GS
2018if test -n "$DJGPP"; then
2019 trnl='\012'
2020fi
2021if test X"$trnl" = X; then
2022 case "`echo foo|tr '\n' x 2>/dev/null`" in
2023 foox) trnl='\n' ;;
2024 esac
2025fi
2026if test X"$trnl" = X; then
2027 case "`echo foo|tr '\012' x 2>/dev/null`" in
2028 foox) trnl='\012' ;;
2029 esac
2030fi
2031if test X"$trnl" = X; then
8be2c24c
JH
2032 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2033 fooxy) trnl='\n\r' ;;
2034 esac
2035fi
2036if test X"$trnl" = X; then
5ff3f7a4
GS
2037 cat <<EOM >&2
2038
2039$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2040
2041EOM
2042 exit 1
2043fi
2044
2304df62
AD
2045: compute the number of columns on the terminal for proper question formatting
2046case "$COLUMNS" in
2047'') COLUMNS='80';;
2048esac
2049
2050: set up the echo used in my read
2051myecho="case \"\$xxxm\" in
2052'') echo $n \"\$rp $c\" >&4;;
2053*) case \"\$rp\" in
2054 '') echo $n \"[\$xxxm] $c\";;
2055 *)
2056 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2057 echo \"\$rp\" >&4
2058 echo $n \"[\$xxxm] $c\" >&4
2059 else
2060 echo $n \"\$rp [\$xxxm] $c\" >&4
2061 fi
2062 ;;
2063 esac;;
2064esac"
2065
2066: now set up to do reads with possible shell escape and default assignment
2067cat <<EOSC >myread
28757baa 2068$startsh
2304df62
AD
2069xxxm=\$dflt
2070$myecho
2071ans='!'
2072case "\$fastread" in
2073yes) case "\$dflt" in
2074 '') ;;
2075 *) ans='';
2076 case "\$silent-\$rp" in
2077 true-) ;;
2078 *) echo " " >&4;;
2079 esac;;
2080 esac;;
2081*) case "\$silent" in
2082 true) case "\$rp" in
2083 '') ans='';;
2084 esac;;
2085 esac;;
2086esac
2087while expr "X\$ans" : "X!" >/dev/null; do
2088 read answ
2089 set x \$xxxm
2090 shift
dfe9444c 2091 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2092 case "\$answ" in
dfe9444c
AD
2093 "!")
2094 sh 1>&4
2095 echo " "
2096 $myecho
2097 ;;
2098 !*)
2099 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2100 shift
2101 sh 1>&4 -c "\$*"
2102 echo " "
2103 $myecho
2104 ;;
2304df62
AD
2105 "\$ans")
2106 case "\$ans" in
ecfc5424
AD
2107 \\&*)
2108 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2109 shift
2110 case "\$1" in
2111 -d)
2112 fastread=yes
40a7a20a 2113 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2114 ;;
2115 -*)
40a7a20a 2116 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2117 ;;
2118 esac
2119 $myecho
2120 ans=!
2121 ;;
2304df62
AD
2122 esac;;
2123 *)
2124 case "\$aok" in
2125 y)
2126 echo "*** Substitution done -- please confirm."
2127 xxxm="\$ans"
c9795ab7 2128 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2129 xxxm="\$ans"
2130 ans=!
2131 ;;
2132 *)
2133 echo "*** Error -- try again."
2134 ans=!
2135 ;;
2136 esac
2137 $myecho
2138 ;;
2139 esac
2140 case "\$ans\$xxxm\$nostick" in
2141 '')
2142 ans=!
2143 $myecho
2144 ;;
2145 esac
2146done
2147case "\$ans" in
2148'') ans="\$xxxm";;
2149esac
2150EOSC
2151
2152: create .config dir to save info across Configure sessions
2153test -d ../.config || mkdir ../.config
2154cat >../.config/README <<EOF
2155This directory created by Configure to save information that should
dfe9444c 2156persist across sessions for $package.
2304df62
AD
2157
2158You may safely delete it if you wish.
2159EOF
2160
613d6c3e 2161: See if we are using a devel version and want that
9507cadf 2162xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2163case "$usedevel" in
1be1b388
MB
2164$define|true|[yY]*)
2165 usedevel="$define" ;;
9507cadf 2166*) case "$xversion" in
0107c034
JH
2167 *[13579])
2168 cat >&4 <<EOH
2169*** WHOA THERE!!! ***
2170
2171 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2172 The version of this $package distribution is $xversion, that is, odd,
2173 (as opposed to even) and that signifies a development release.
3d5d58b1 2174 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2175
2176 Do ***NOT*** install this into production use.
2177 Data corruption and crashes are possible.
2178
2179 It is most seriously suggested that you do not continue any further
2180 unless you want to help in developing and debugging Perl.
2181
6adc6a45
JH
2182 If you *still* want to build perl, you can answer 'y' now,
2183 or pass -Dusedevel to Configure.
2184
0107c034
JH
2185EOH
2186 rp='Do you really want to continue?'
2187 dflt='n'
2188 . ./myread
2189 case "$ans" in
8feeef0e
JH
2190 [yY]) echo >&4 "Okay, continuing."
2191 usedevel="$define" ;;
0107c034
JH
2192 *) echo >&4 "Okay, bye."
2193 exit 1
2194 ;;
2195 esac
2196 ;;
2197 esac
1be1b388 2198 usedevel="$undef"
0107c034
JH
2199 ;;
2200esac
8feeef0e
JH
2201case "$usedevel" in
2202$define|true|[yY]*)
2203 case "$versiononly" in
2204 '') versiononly="$define" ;;
2205 esac
2206 case "$installusrbinperl" in
2207 '') installusrbinperl="$undef" ;;
2208 esac
2209 ;;
2210esac
0107c034 2211
2304df62
AD
2212: general instructions
2213needman=true
2214firsttime=true
760ac839 2215user=`(logname) 2>/dev/null`
dfe9444c
AD
2216case "$user" in
2217'') user=`whoami 2>&1`;;
760ac839 2218esac
2304df62
AD
2219if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2220 firsttime=false
2221 echo " "
2222 rp='Would you like to see the instructions?'
2223 dflt=n
2224 . ./myread
2225 case "$ans" in
2226 [yY]*) ;;
2227 *) needman=false;;
2228 esac
2229fi
2230if $needman; then
2231 cat <<EOH
4e2a5f63 2232
2304df62 2233This installation shell script will examine your system and ask you questions
a0d0e21e 2234to determine how the perl5 package should be installed. If you get
2304df62
AD
2235stuck on a question, you may use a ! shell escape to start a subshell or
2236execute a command. Many of the questions will have default answers in square
2237brackets; typing carriage return will give you the default.
2238
2239On some of the questions which ask for file or directory names you are allowed
2240to use the ~name construct to specify the login directory belonging to "name",
2241even if you don't have a shell which knows about that. Questions where this is
2242allowed will be marked "(~name ok)".
2243
2244EOH
2245 rp=''
2246 dflt='Type carriage return to continue'
2247 . ./myread
2248 cat <<'EOH'
2249
2250The prompter used in this script allows you to use shell variables and
2251backticks in your answers. You may use $1, $2, etc... to refer to the words
2252in the default answer, as if the default line was a set of arguments given to a
2253script shell. This means you may also use $* to repeat the whole default line,
2254so you do not have to re-type everything to add something to the default.
2255
2256Everytime there is a substitution, you will have to confirm. If there is an
2257error (e.g. an unmatched backtick), the default answer will remain unchanged
2258and you will be prompted again.
2259
2260If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2261the questions and use the computed defaults (or the previous answers if there
2262was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2263You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2264on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2265
2266EOH
2267 . ./myread
2268 cat <<EOH
2269
2270Much effort has been expended to ensure that this shell script will run on any
2271Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2272Configure and run it again. If you can't run Configure for some reason,
2273you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2274have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2275
2276This installation script affects things in two ways:
2277
22781) it may do direct variable substitutions on some of the files included
2279 in this kit.
22802) it builds a config.h file for inclusion in C programs. You may edit
2281 any of these files as the need arises after running this script.
2282
2283If you make a mistake on a question, there is no easy way to back up to it
2284currently. The easiest thing to do is to edit config.sh and rerun all the SH
2285files. Configure will offer to let you do this before it runs the SH files.
2286
2287EOH
2288 dflt='Type carriage return to continue'
2289 . ./myread
2290 case "$firsttime" in
2291 true) echo $user >>../.config/instruct;;
2292 esac
2293fi
2294
2304df62
AD
2295: find out where common programs are
2296echo " "
2297echo "Locating common programs..." >&4
2298cat <<EOSC >loc
2299$startsh
2300case \$# in
23010) exit 1;;
2302esac
2303thing=\$1
2304shift
2305dflt=\$1
2306shift
2307for dir in \$*; do
2308 case "\$thing" in
2309 .)
2310 if test -d \$dir/\$thing; then
2311 echo \$dir
2312 exit 0
2313 fi
2314 ;;
2315 *)
a0d0e21e 2316 for thisthing in \$dir/\$thing; do
ecfc5424 2317 : just loop through to pick last item
a0d0e21e 2318 done
25f94b33 2319 if test -f \$thisthing; then
a0d0e21e 2320 echo \$thisthing
2304df62 2321 exit 0
a5a94ea5
JH
2322 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2323 echo \$thisthing
776a38e3 2324 exit 0
2304df62 2325 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2326 if test -n "$DJGPP"; then
2327 echo \$dir/\$thing.exe
b921d661 2328 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2329 : on Eunice apparently
2330 echo \$dir/\$thing
2331 fi
2d736872 2332 exit 0
2304df62
AD
2333 fi
2334 ;;
2335 esac
2336done
2337echo \$dflt
2338exit 1
2339EOSC
2340chmod +x loc
2341$eunicefix loc
2342loclist="
2343awk
2344cat
f8006fac 2345chmod
b4eb6b3d
JH
2346comm
2347cp
2304df62
AD
2348echo
2349expr
2350grep
a0d0e21e 2351ls
b4eb6b3d 2352mkdir
2304df62
AD
2353rm
2354sed
b4eb6b3d 2355sort
85e6fe83 2356touch
2304df62 2357tr
b4eb6b3d 2358uniq
2304df62
AD
2359"
2360trylist="
dfe9444c 2361ar
3659ebf1 2362bison
b4eb6b3d 2363byacc
2304df62 2364cpp
b4eb6b3d 2365csh
2304df62
AD
2366date
2367egrep
1fef16b3 2368gmake
8ff267be 2369gzip
b4eb6b3d 2370less
8ff267be 2371ln
3c728e00 2372make
b4eb6b3d 2373more
693762b4 2374nm
b4eb6b3d
JH
2375nroff
2376pg
2304df62
AD
2377test
2378uname
8ff267be 2379zip
2304df62 2380"
8e07c86e 2381pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2382pth="$pth /lib /usr/lib"
2383for file in $loclist; do
dfe9444c
AD
2384 eval xxx=\$$file
2385 case "$xxx" in
2386 /*|?:[\\/]*)
2387 if test -f "$xxx"; then
2388 : ok
2389 else
2390 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2391 xxx=`./loc $file $file $pth`
2392 fi
2393 ;;
2394 '') xxx=`./loc $file $file $pth`;;
2395 *) xxx=`./loc $xxx $xxx $pth`;;
2396 esac
a5a94ea5 2397 eval $file=$xxx$_exe
2304df62
AD
2398 eval _$file=$xxx
2399 case "$xxx" in
2400 /*)
2401 echo $file is in $xxx.
2402 ;;
8e07c86e
AD
2403 ?:[\\/]*)
2404 echo $file is in $xxx.
2405 ;;
2304df62 2406 *)
25f94b33
AD
2407 echo "I don't know where '$file' is, and my life depends on it." >&4
2408 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2409 exit 1
2304df62
AD
2410 ;;
2411 esac
2412done
2413echo " "
2414echo "Don't worry if any of the following aren't found..."
2415say=offhand
2416for file in $trylist; do
dfe9444c
AD
2417 eval xxx=\$$file
2418 case "$xxx" in
2419 /*|?:[\\/]*)
2420 if test -f "$xxx"; then
2421 : ok
2422 else
2423 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2424 xxx=`./loc $file $file $pth`
2425 fi
2426 ;;
2427 '') xxx=`./loc $file $file $pth`;;
2428 *) xxx=`./loc $xxx $xxx $pth`;;
2429 esac
306a8474 2430 eval $file=$xxx$_exe
2304df62
AD
2431 eval _$file=$xxx
2432 case "$xxx" in
2433 /*)
2434 echo $file is in $xxx.
2435 ;;
8e07c86e
AD
2436 ?:[\\/]*)
2437 echo $file is in $xxx.
2438 ;;
2304df62
AD
2439 *)
2440 echo "I don't see $file out there, $say."
2441 say=either
2442 ;;
2443 esac
2444done
2445case "$egrep" in
1fef16b3 2446egrep)
2304df62
AD
2447 echo "Substituting grep for egrep."
2448 egrep=$grep
868439a2 2449 _egrep=$grep
2304df62
AD
2450 ;;
2451esac
3141af47
MB
2452case "$less" in
2453'') ;;
2454*) if $less -R </dev/null >/dev/null; then
2455 echo "Substituting less -R for less."
2456 less="$less -R"
2457 _less=$less
2458 fi
2459 ;;
2460esac
8ff267be 2461case "$ln" in
1fef16b3 2462ln)
8ff267be 2463 echo "Substituting cp for ln."
2464 ln=$cp
868439a2 2465 _ln=$cp
8ff267be 2466 ;;
2467esac
2e26f1d5 2468case "$make" in
613d6c3e 2469make)
2e26f1d5
JH
2470 case "$gmake" in
2471 gmake)
2472 echo "I can't find make or gmake, and my life depends on it." >&4
2473 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2474 exit 1
2475 ;;
2476 esac
2477 ;;
613d6c3e 2478esac
2e26f1d5
JH
2479case "$gmake" in
2480gmake) ;;
2481*) # We can't have osname yet.
1fef16b3
JH
2482 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2483 # Assume that gmake, if found, is definitely GNU make
2484 # and prefer it over the system make.
2485 echo "Substituting gmake for make."
2486 make=$gmake
868439a2 2487 _make=$gmake
1fef16b3
JH
2488 fi
2489 ;;
a5a94ea5 2490esac
2304df62
AD
2491case "$test" in
2492test)
2493 echo "Hopefully test is built into your sh."
2494 ;;
2495*)
73614538 2496 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2497 echo "Using the test built into your sh."
2304df62
AD
2498 test=test
2499 _test=test
2500 fi
2501 ;;
2502esac
2503case "$echo" in
2504echo)
2505 echo "Hopefully echo is built into your sh."
2506 ;;
2507'') ;;
2508*)
2509 echo " "
2510echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2511 $echo $n "hi there$c" >foo1
2512 echo $n "hi there$c" >foo2
2513 if cmp foo1 foo2 >/dev/null 2>&1; then
2514 echo "They are compatible. In fact, they may be identical."
2515 else
2516 case "$n" in
2517 '-n') n='' c='\c';;
2518 *) n='-n' c='';;
2519 esac
2520 cat <<FOO
2521They are not compatible! You are probably running ksh on a non-USG system.
2522I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2523have echo built in and we may have to run some Bourne shell scripts. That
2524means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2525
2526FOO
2527 $echo $n "The star should be here-->$c"
2528 $echo "*"
2529 fi
2530 $rm -f foo1 foo2
2531 ;;
2532esac
2533
2f88d857
MB
2534# This question was auctioned at YAPC::Europe-2007 in Vienna
2535# I never promised you could answer it. I only auctioned the question.
2536cat <<FOO
2537The following message is sponsored by
2538
2539 Dresden.pm<--The stars should be here.
2540
2541Dear Perl user, system administrator or package
2542maintainer, the Perl community sends greetings to
2543you. Do you (emblematical) greet back [Y/n]? n
2544
2545FOO
2546
613d6c3e 2547: Check what type of C compiler we use
6b769f8f 2548cat <<EOS >trygcc
2573c5f9
JH
2549$startsh
2550EOS
6b769f8f 2551cat <<'EOSC' >>trygcc
2573c5f9
JH
2552case "$cc" in
2553'') ;;
2554*) $rm -f try try.*
2555 $cat >try.c <<EOM
2556int main(int argc, char *argv[]) {
2557 return 0;
2558}
2559EOM
e4778687 2560 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2561 :
2562 else
2563 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2564 despair=yes
2565 trygcc=yes
2566 case "$cc" in
2567 *gcc*) trygcc=no ;;
2568 esac
dce40316
AD
2569 # Skip this test because it gives a false match on output like:
2570 # ./trygcc: line 23: cc: command not found
2571 # case "`$cc -v -c try.c 2>&1`" in
2572 # *gcc*) trygcc=no ;;
2573 # esac
2573c5f9
JH
2574 if $test X"$trygcc" = Xyes; then
2575 if gcc -o try -c try.c; then
2576 echo " "
2577 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2578 # Switching compilers may undo the work of hints files.
2579 # The most common problem is -D_REENTRANT for threads.
2580 # This heuristic catches that case, but gets false positives
2581 # if -Dusethreads was not actually specified. Better to
2582 # bail out here with a useful message than fail
2583 # mysteriously later. Should we perhaps just try to
2584 # re-invoke Configure -Dcc=gcc config_args ?
2585 if $test -f usethreads.cbu; then
2586 $cat >&4 <<EOM
2587
2588*** However, any setting of the C compiler flags (e.g. for thread support)
2589*** will be lost. It may be necessary for you to restart Configure and
2590*** add -Dcc=gcc to your Configure command line.
2591
2592EOM
2593 rp="Would you like to go ahead and try gcc anyway?"
2594 dflt=n
2595 else
2596 rp="Would you like to use it?"
2597 dflt=y
2598 fi
2573c5f9
JH
2599 if $test -f myread; then
2600 . ./myread
2601 else
2602 if $test -f UU/myread; then
2603 . ./UU/myread
2604 else
2605 echo "Cannot find myread, sorry. Aborting." >&2
2606 exit 1
2607 fi
2608 fi
2609 case "$ans" in
6371411c 2610 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2611 esac
2612 fi
2613 fi
6b769f8f
RB
2614 fi
2615 $rm -f try try.*
2616 ;;
2617esac
2618EOSC
2619
2620cat <<EOS >checkcc
2621$startsh
2622EOS
2623cat <<'EOSC' >>checkcc
2624case "$cc" in
2625'') ;;
2626*) $rm -f try try.*
2627 $cat >try.c <<EOM
2628int main(int argc, char *argv[]) {
2629 return 0;
2630}
2631EOM
2632 if $cc -o try $ccflags $ldflags try.c; then
2633 :
2634 else
2573c5f9 2635 if $test X"$despair" = Xyes; then
6b769f8f
RB
2636 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2637 fi
2638 $cat >&4 <<EOM
5dd4fbdf
MB
2639You need to find a working C compiler.
2640Either (purchase and) install the C compiler supplied by your OS vendor,
2641or for a free C compiler try http://gcc.gnu.org/
2642I cannot continue any further, aborting.
2643EOM
6b769f8f 2644 exit 1
2573c5f9
JH
2645 fi
2646 $rm -f try try.*
2647 ;;
2648esac
2649EOSC
2650
a0d0e21e
LW
2651: determine whether symbolic links are supported
2652echo " "
2653$touch blurfl
2654if $ln -s blurfl sym > /dev/null 2>&1 ; then
2655 echo "Symbolic links are supported." >&4
818f00be 2656 lns="$ln -s"
a0d0e21e
LW
2657else
2658 echo "Symbolic links are NOT supported." >&4
2659 lns="$ln"
2660fi
2661$rm -f blurfl sym
2662
dafca956
JH
2663: determine whether symbolic links are supported
2664echo " "
2665case "$lns" in
18ea2752 2666*"ln"*" -s")
dafca956
JH
2667 echo "Checking how to test for symbolic links..." >&4
2668 $lns blurfl sym
4b661809 2669 if $test "X$issymlink" = X; then
2e2a97a6
JH
2670 case "$newsh" in
2671 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2672 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2673 esac
5d644a95
MB
2674 if test $? = 0; then
2675 issymlink="test -h"
2e2a97a6
JH
2676 else
2677 echo "Your builtin 'test -h' may be broken." >&4
2678 case "$test" in
2679 /*) ;;
2680 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2681 for p in $pth
2682 do
2683 if test -f "$p/$test"; then
2684 test="$p/$test"
2685 break
2686 fi
2687 done
2688 ;;
2689 esac
2690 case "$test" in
2691 /*)
2692 echo "Trying external '$test -h'." >&4
2693 issymlink="$test -h"
2694 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2695 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2696 issymlink=''
2697 fi
2698 ;;
2699 *) issymlink='' ;;
2700 esac
5d644a95
MB
2701 fi
2702 fi
4b661809 2703 if $test "X$issymlink" = X; then
dafca956 2704 if $test -L sym 2>/dev/null; then
5d644a95 2705 issymlink="$test -L"
2e2a97a6 2706 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2707 fi
2708 fi
4b661809 2709 if $test "X$issymlink" != X; then
5d644a95 2710 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2711 else
2712 echo "I do not know how you can test for symbolic links." >&4
2713 fi
2714 $rm -f blurfl sym
2715 ;;
2716*) echo "No symbolic links, so not testing for their testing..." >&4
2717 ;;
2718esac
2719echo " "
2720
34f1896b 2721: Make symlinks util
dafca956
JH
2722case "$mksymlinks" in
2723$define|true|[yY]*)
2724 case "$src" in
2725 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2726 exit 1
2727 ;;
4b661809 2728 *) case "$lns:$issymlink" in
f314eb9f 2729 *"ln"*" -s:"*"test -"?)
dafca956
JH
2730 echo "Creating the symbolic links..." >&4
2731 echo "(First creating the subdirectories...)" >&4
2732 cd ..
2733 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2734 read directory
2735 test -z "$directory" && break
2736 mkdir -p $directory
2737 done
2738 # Sanity check 1.
2739 if test ! -d t/base; then
2740 echo "Failed to create the subdirectories. Aborting." >&4
2741 exit 1
2742 fi
2743 echo "(Then creating the symlinks...)" >&4
2744 awk '{print $1}' $src/MANIFEST | while true; do
2745 read filename
2746 test -z "$filename" && break
2747 if test -f $filename; then
5d644a95 2748 if $issymlink $filename; then
dafca956
JH
2749 rm -f $filename
2750 fi
2751 fi
2752 if test -f $filename; then
2753 echo "$filename already exists, not symlinking."
2754 else
2755 ln -s $src/$filename $filename
2756 fi
2757 done
2758 # Sanity check 2.
a0d24b8a
JH
2759 if test ! -f t/base/lex.t; then
2760 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2761 exit 1
2762 fi
2763 cd UU
2764 ;;
2765 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2766 ;;
2767 esac
2768 ;;
2769 esac
2770 ;;
2771esac
2772
613d6c3e 2773: Check for Cross-Compilation
5440bc8e
JH
2774case "$usecrosscompile" in
2775$define|true|[yY]*)
93bc48fa 2776 $echo "Cross-compiling..."
5440bc8e
JH
2777 croak=''
2778 case "$cc" in
2779 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2780 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2781 ar=$targetarch-ar
2782 # leave out ld, choosing it is more complex
2783 nm=$targetarch-nm
2784 ranlib=$targetarch-ranlib
93bc48fa 2785 $echo 'extern int foo;' > try.c
f8006fac 2786 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2787 shift
2788 if $test $# -gt 0; then
2789 incpth="$incpth $*"
f8006fac
JH
2790 incpth="`$echo $incpth|$sed 's/^ //'`"
2791 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2792 for i in $*; do
f8006fac 2793 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2794 if $test -d $j; then
2795 libpth="$libpth $j"
2796 fi
2797 done
f8006fac
JH
2798 libpth="`$echo $libpth|$sed 's/^ //'`"
2799 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2800 fi
2801 $rm -f try.c
5440bc8e
JH
2802 ;;
2803 esac
2804 case "$targetarch" in
93bc48fa
JH
2805 '') echo "Targetarch not defined." >&4; croak=y ;;
2806 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2807 esac
2808 case "$incpth" in
93bc48fa 2809 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2810 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2811 esac
2812 case "$libpth" in
93bc48fa 2813 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2814 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2815 esac
93bc48fa
JH
2816 case "$usrinc" in
2817 '') for i in $incpth; do
2818 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2819 usrinc=$i
2820 echo "Guessing usrinc $usrinc." >&4
2821 break
2822 fi
2823 done
2824 case "$usrinc" in
2825 '') echo "Usrinc not defined." >&4; croak=y ;;
2826 esac
2827 ;;
2828 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2829 esac
93bc48fa
JH
2830 case "$targethost" in
2831 '') echo "Targethost not defined." >&4; croak=y ;;
2832 *) echo "Using targethost $targethost." >&4
5440bc8e 2833 esac
93bc48fa
JH
2834 locincpth=' '
2835 loclibpth=' '
5440bc8e 2836 case "$croak" in
93bc48fa 2837 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2838 esac
2839 case "$src" in
2840 /*) run=$src/Cross/run
93c0359c 2841 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2842 to=$src/Cross/to
2843 from=$src/Cross/from
2844 ;;
93bc48fa 2845 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2846 run=$pwd/Cross/run
f8006fac 2847 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2848 to=$pwd/Cross/to
2849 from=$pwd/Cross/from
2850 ;;
2851 esac
2852 case "$targetrun" in
2853 '') targetrun=ssh ;;
2854 esac
2855 case "$targetto" in
2856 '') targetto=scp ;;
2857 esac
2858 case "$targetfrom" in
2859 '') targetfrom=scp ;;
2860 esac
2861 run=$run-$targetrun
2862 to=$to-$targetto
2863 from=$from-$targetfrom
93bc48fa
JH
2864 case "$targetdir" in
2865 '') targetdir=/tmp
2866 echo "Guessing targetdir $targetdir." >&4
2867 ;;
2868 esac
5440bc8e 2869 case "$targetuser" in
93bc48fa
JH
2870 '') targetuser=root
2871 echo "Guessing targetuser $targetuser." >&4
2872 ;;
5440bc8e
JH
2873 esac
2874 case "$targetfrom" in
2875 scp) q=-q ;;
2876 *) q='' ;;
2877 esac
2878 case "$targetrun" in
2879 ssh|rsh)
2880 cat >$run <<EOF
2881#!/bin/sh
93c0359c
JH
2882case "\$1" in
2883-cwd)
2884 shift
2885 cwd=\$1
2886 shift
2887 ;;
2888esac
2889case "\$cwd" in
2890'') cwd=$targetdir ;;
2891esac
5440bc8e
JH
2892exe=\$1
2893shift
93c0359c
JH
2894if $test ! -f \$exe.xok; then
2895 $to \$exe
2896 $touch \$exe.xok
2897fi
2898$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2899EOF
2900 ;;
93bc48fa 2901 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2902 exit 1
2903 ;;
2904 esac
93c0359c
JH
2905 case "$targetmkdir" in
2906 */Cross/mkdir)
2907 cat >$targetmkdir <<EOF
2908#!/bin/sh
2909$targetrun -l $targetuser $targethost "mkdir -p \$@"
2910EOF
f8006fac 2911 $chmod a+rx $targetmkdir
93c0359c
JH
2912 ;;
2913 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2914 exit 1
2915 ;;
2916 esac
5440bc8e
JH
2917 case "$targetto" in
2918 scp|rcp)
2919 cat >$to <<EOF
2920#!/bin/sh
2921for f in \$@
2922do
93c0359c
JH
2923 case "\$f" in
2924 /*)
2925 $targetmkdir \`dirname \$f\`
2926 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2927 ;;
2928 *)
2929 $targetmkdir $targetdir/\`dirname \$f\`
2930 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2931 ;;
2932 esac
5440bc8e
JH
2933done
2934exit 0
2935EOF
2936 ;;
2937 cp) cat >$to <<EOF
2938#!/bin/sh
93c0359c
JH
2939for f in \$@
2940do
2941 case "\$f" in
2942 /*)
2943 $mkdir -p $targetdir/\`dirname \$f\`
2944 $cp \$f $targetdir/\$f || exit 1
2945 ;;
2946 *)
2947 $targetmkdir $targetdir/\`dirname \$f\`
2948 $cp \$f $targetdir/\$f || exit 1
2949 ;;
2950 esac
2951done
2952exit 0
5440bc8e
JH
2953EOF
2954 ;;
93bc48fa 2955 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2956 exit 1
2957 ;;
2958 esac
2959 case "$targetfrom" in
2960 scp|rcp)
2961 cat >$from <<EOF
2962#!/bin/sh
2963for f in \$@
2964do
93c0359c 2965 $rm -f \$f
5440bc8e
JH
2966 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2967done
2968exit 0
2969EOF
2970 ;;
2971 cp) cat >$from <<EOF
2972#!/bin/sh
2973for f in \$@
2974do
93c0359c 2975 $rm -f \$f
5440bc8e
JH
2976 cp $targetdir/\$f . || exit 1
2977done
2978exit 0
2979EOF
2980 ;;
93bc48fa 2981 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2982 exit 1
2983 ;;
2984 esac
93bc48fa
JH
2985 if $test ! -f $run; then
2986 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2987 else
f8006fac 2988 $chmod a+rx $run
5440bc8e 2989 fi
93bc48fa
JH
2990 if $test ! -f $to; then
2991 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2992 else
f8006fac 2993 $chmod a+rx $to
5440bc8e 2994 fi
93bc48fa
JH
2995 if $test ! -f $from; then
2996 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2997 else
f8006fac 2998 $chmod a+rx $from
5440bc8e 2999 fi
93bc48fa 3000 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
3001 exit 1
3002 fi
3003 cat >&4 <<EOF
f8006fac
JH
3004Using '$run' for remote execution,
3005and '$from' and '$to'
93bc48fa 3006for remote file transfer.
5440bc8e
JH
3007EOF
3008 ;;
3009*) run=''
3010 to=:
3011 from=:
3012 usecrosscompile='undef'
3013 targetarch=''
3014 ;;
3015esac
3016
ecfc5424
AD
3017: see whether [:lower:] and [:upper:] are supported character classes
3018echo " "
ecfc5424
AD
3019case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3020ABYZ)
3021 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3022 up='[:upper:]'
3023 low='[:lower:]'
3024 ;;
416d0bea
MB
3025*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3026 # (0xd9 and 0xe2), therefore that is a nice testing point.
3027 if test "X$up" = X -o "X$low" = X; then
3028 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3029 rs) up='[A-Z]'
3030 low='[a-z]'
28e8609d
JH
3031 ;;
3032 esac
416d0bea 3033 fi
28e8609d 3034 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3035 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3036 rs) up='A-Z'
28e8609d
JH
3037 low='a-z'
3038 ;;
3039 esac
416d0bea 3040 fi
28e8609d 3041 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3042 case "`echo RS | od -x 2>/dev/null`" in
3043 *D9E2*|*d9e2*)
28e8609d
JH
3044 echo "Hey, this might be EBCDIC." >&4
3045 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3046 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3047 rs) up='[A-IJ-RS-Z]'
3048 low='[a-ij-rs-z]'
28e8609d
JH
3049 ;;
3050 esac
3051 fi
3052 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3053 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3054 rs) up='A-IJ-RS-Z'
3055 low='a-ij-rs-z'
28e8609d
JH
3056 ;;
3057 esac
3058 fi
3059 ;;
3060 esac
3061 fi
3062esac
416d0bea
MB
3063case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3064rs)
28e8609d
JH
3065 echo "Using $up and $low to convert case." >&4
3066 ;;
ecfc5424 3067*)
28e8609d
JH
3068 echo "I don't know how to translate letters from upper to lower case." >&4
3069 echo "Your tr is not acting any way I know of." >&4
3070 exit 1
3071 ;;
ecfc5424
AD
3072esac
3073: set up the translation script tr, must be called with ./tr of course
3074cat >tr <<EOSC
3075$startsh
3076case "\$1\$2" in
3077'[A-Z][a-z]') exec $tr '$up' '$low';;
3078'[a-z][A-Z]') exec $tr '$low' '$up';;
3079esac
3080exec $tr "\$@"
3081EOSC
3082chmod +x tr
3083$eunicefix tr
3084
2304df62
AD
3085: Try to determine whether config.sh was made on this system
3086case "$config_sh" in
3087'')
43999f95
JH
3088myuname=`$uname -a 2>/dev/null`
3089$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3090# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3091# because the A-Z/a-z are not consecutive.
34e09935 3092myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3eaeeeae 3093 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3094newmyuname="$myuname"
2304df62 3095dflt=n
16d20bd9
AD
3096case "$knowitall" in
3097'')
3098 if test -f ../config.sh; then
3099 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3100 eval "`grep myuname= ../config.sh`"
3101 fi
3102 if test "X$myuname" = "X$newmyuname"; then
3103 dflt=y
3104 fi
2304df62 3105 fi
16d20bd9
AD
3106 ;;
3107*) dflt=y;;
3108esac
2304df62
AD
3109
3110: Get old answers from old config file if Configure was run on the
3111: same system, otherwise use the hints.
3112hint=default
3113cd ..
3114if test -f config.sh; then
16d20bd9
AD
3115 echo " "
3116 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3117 . UU/myread
3118 case "$ans" in
f83701cd
AD
3119 n*|N*) echo "OK, I'll ignore it."
3120 mv config.sh config.sh.old
3121 myuname="$newmyuname"
3122 ;;
2304df62 3123 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3124 tmp_n="$n"
3125 tmp_c="$c"
85cad39c 3126 tmp_sh="$sh"
2304df62
AD
3127 . ./config.sh
3128 cp config.sh UU
ecfc5424
AD
3129 n="$tmp_n"
3130 c="$tmp_c"
85cad39c 3131 : Older versions did not always set $sh. Catch re-use of such
3132 : an old config.sh.
3133 case "$sh" in
3134 '') sh="$tmp_sh" ;;
3135 esac
2304df62
AD
3136 hint=previous
3137 ;;
3138 esac
3139fi
2573c5f9 3140. ./UU/checkcc
2304df62
AD
3141if test ! -f config.sh; then
3142 $cat <<EOM
3143
4e2a5f63
AD
3144First time through, eh? I have some defaults handy for some systems
3145that need some extra help getting the Configure answers right:
2304df62
AD
3146
3147EOM
dfe9444c 3148 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3149 dflt=''
3150 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3151 : tests or hints, please send them to perlbug@perl.org
2304df62 3152 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3153 $test -f /irix && osname=irix
85e6fe83
LW
3154 $test -f /xenix && osname=sco_xenix
3155 $test -f /dynix && osname=dynix
3156 $test -f /dnix && osname=dnix
5f05dabc 3157 $test -f /lynx.os && osname=lynxos
3158 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3159 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3160 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3161 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3162 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3163 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3164 $test -d /usr/apollo/bin && osname=apollo
3165 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3166 $test -d /usr/include/minix && osname=minix
d54344fc 3167 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3168 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3169 osname=machten
4633a7c4 3170 if $test -x /sbin/version; then
dfe9444c 3171 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3172 $sed -e 's/[A-Za-z]$//'`
3173 elif $test -x /usr/etc/version; then
dfe9444c 3174 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3175 $sed -e 's/[A-Za-z]$//'`
3176 else
3177 osvers="$2.$3"
3178 fi
3179 fi
aaacdc8b
GS
3180
3181 $test -f /sys/posix.dll &&
3182 $test -f /usr/bin/what &&
3183 set X `/usr/bin/what /sys/posix.dll` &&
3184 $test "$3" = UWIN &&
3185 osname=uwin &&
3186 osvers="$5"
3187
2304df62
AD
3188 if $test -f $uname; then
3189 set X $myuname
3190 shift
3191
2304df62 3192 case "$5" in
85e6fe83 3193 fps*) osname=fps ;;
2304df62
AD
3194 mips*)
3195 case "$4" in
85e6fe83
LW
3196 umips) osname=umips ;;
3197 *) osname=mips ;;
2304df62 3198 esac;;
85e6fe83
LW
3199 [23]100) osname=mips ;;
3200 next*) osname=next ;;
ecfc5424 3201 i386*)
c6912327
JH
3202 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3203 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3204 osname='sco'
3205 osvers=$tmp
3206 elif $test -f /etc/kconfig; then
ecfc5424 3207 osname=isc
bd628c73 3208 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3209 osvers=4
3210 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3211 osvers=3
2304df62 3212 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3213 osvers=2
ecfc5424
AD
3214 fi
3215 fi
2000072c 3216 tmp=''
ecfc5424 3217 ;;
c4f23d77
AD
3218 pc*)
3219 if test -n "$DJGPP"; then
3220 osname=dos
3221 osvers=djgpp
3222 fi
3223 ;;
2304df62
AD
3224 esac
3225
3226 case "$1" in
a0d0e21e
LW
3227 aix) osname=aix
3228 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3229 case "$tmp" in
e81c5c2a
NC
3230 # oslevel can fail with:
3231 # oslevel: Unable to acquire lock.
3232 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3233 '<3240'|'<>3240') osvers=3.2.0 ;;
3234 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3235 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3236 *) osvers=$tmp;;
a0d0e21e
LW
3237 esac
3238 ;;
aaacdc8b
GS
3239 bsd386) osname=bsd386
3240 osvers=`$uname -r`
3241 ;;
3242 cygwin*) osname=cygwin
3243 osvers="$3"
3244 ;;
23f87696
SZ
3245 *dc.osx) osname=dcosx
3246 osvers="$3"
3247 ;;
a0d0e21e
LW
3248 dnix) osname=dnix
3249 osvers="$3"
3250 ;;
3251 domainos) osname=apollo
3252 osvers="$3"
3253 ;;
a774dfe6
RSG
3254 dgux) osname=dgux
3255 osvers="$3"
3256 ;;
3257 dragonfly) osname=dragonfly
a0d0e21e
LW
3258 osvers="$3"
3259 ;;
760ac839 3260 dynixptx*) osname=dynixptx
e58e581d 3261 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3262 ;;
a774dfe6 3263 freebsd) osname=freebsd
a0d0e21e 3264 osvers="$3" ;;
761ee4e8
BD
3265 genix) osname=genix ;;
3266 gnu) osname=gnu
3267 osvers="$3" ;;
a774dfe6 3268 hp*) osname=hpux
bfb7748a 3269 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3270 ;;
761ee4e8 3271 irix*) osname=irix
a0d0e21e
LW
3272 case "$3" in
3273 4*) osvers=4 ;;
3274 5*) osvers=5 ;;
ecfc5424 3275 *) osvers="$3" ;;
a0d0e21e
LW
3276 esac
3277 ;;
761ee4e8 3278 linux) osname=linux
a0d0e21e 3279 case "$3" in
a0d0e21e
LW
3280 *) osvers="$3" ;;
3281 esac
3282 ;;
761ee4e8 3283 MiNT) osname=mint
28e8609d
JH
3284 ;;
3285 netbsd*) osname=netbsd
ecfc5424
AD
3286 osvers="$3"
3287 ;;
4e81affe
MM
3288 news-os) osvers="$3"
3289 case "$3" in
3290 4*) osname=newsos4 ;;
3291 *) osname=newsos ;;
3292 esac
3293 ;;
aaacdc8b 3294 next*) osname=next ;;
28bb1e2c 3295 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3296 openbsd) osname=openbsd
3297 osvers="$3"
3298 ;;
5c728af0
IZ
3299 os2) osname=os2
3300 osvers="$4"
3301 ;;
aaacdc8b
GS
3302 POSIX-BC | posix-bc ) osname=posix-bc
3303 osvers="$3"
a0d0e21e 3304 ;;
ae3afa4e
TH
3305 powerux | power_ux | powermax_os | powermaxos | \
3306 powerunix | power_unix) osname=powerux
3307 osvers="$3"
3308 ;;
aaacdc8b
GS
3309 qnx) osname=qnx
3310 osvers="$4"
3311 ;;
a0d0e21e
LW
3312 solaris) osname=solaris
3313 case "$3" in
3314 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3315 *) osvers="$3" ;;
a0d0e21e
LW
3316 esac
3317 ;;
85e6fe83
LW
3318 sunos) osname=sunos
3319 case "$3" in
85e6fe83
LW
3320 5*) osname=solaris
3321 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3322 *) osvers="$3" ;;
2304df62
AD
3323 esac
3324 ;;
a0d0e21e 3325 titanos) osname=titanos
85e6fe83 3326 case "$3" in
a0d0e21e
LW
3327 1*) osvers=1 ;;
3328 2*) osvers=2 ;;
3329 3*) osvers=3 ;;
3330 4*) osvers=4 ;;
ecfc5424 3331 *) osvers="$3" ;;
2304df62
AD
3332 esac
3333 ;;
85e6fe83 3334 ultrix) osname=ultrix
ecfc5424 3335 osvers="$3"
2304df62 3336 ;;
28757baa 3337 osf1|mls+) case "$5" in
fed7345c
AD
3338 alpha)
3339 osname=dec_osf
fdd85a03 3340 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3341 case "$osvers" in
3342 [1-9].[0-9]*) ;;
3343 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3344 esac
ecfc5424
AD
3345 ;;
3346 hp*) osname=hp_osf1 ;;
3347 mips) osname=mips_osf1 ;;
85e6fe83
LW
3348 esac
3349 ;;
af1ff193 3350 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3351 openunix|unixware) osname=svr5
0337d152
BG
3352 osvers="$4"
3353 ;;
3c728e00 3354 uts) osname=uts
a0d0e21e
LW
3355 osvers="$3"
3356 ;;
3c728e00
JH
3357 vos) osvers="$3"
3358 ;;
85e6fe83 3359 $2) case "$osname" in
2304df62 3360 *isc*) ;;
a0d0e21e 3361 *freebsd*) ;;
5f05dabc 3362 svr*)
a0d0e21e 3363 : svr4.x or possibly later
a774dfe6 3364 case "svr$3" in
a0d0e21e
LW
3365 ${osname}*)
3366 osname=svr$3
3367 osvers=$4
3368 ;;
3369 esac
3370 case "$osname" in
3371 svr4.0)
3372 : Check for ESIX
3373 if test -f /stand/boot ; then
3374 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3375 if test -n "$INITPROG" -a -f "$INITPROG"; then
3376 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3377 if test -n "$isesix"; then
a0d0e21e
LW
3378 osname=esix4
3379 fi
3380 fi
3381 fi
3382 ;;
3383 esac
3384 ;;
2304df62 3385 *) if test -f /etc/systemid; then
a0d0e21e
LW
3386 osname=sco
3387 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3388 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3389 osvers=$1.$2.$3
c4f23d77 3390 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3391 osvers=$1.$2
c4f23d77 3392 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3393 osvers=$1
2304df62 3394 fi
a0d0e21e
LW
3395 else
3396 case "$osname" in
3397 '') : Still unknown. Probably a generic Sys V.
3398 osname="sysv"
3399 osvers="$3"
3400 ;;
3401 esac
2304df62
AD
3402 fi
3403 ;;
3404 esac
3405 ;;
a0d0e21e
LW
3406 *) case "$osname" in
3407 '') : Still unknown. Probably a generic BSD.
3408 osname="$1"
3409 osvers="$3"
3410 ;;
3411 esac
3412 ;;
2304df62
AD
3413 esac
3414 else
dfe9444c
AD
3415 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3416 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3417 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3418 osname=news_os
2304df62 3419 fi
dfe9444c 3420 $rm -f UU/kernel.what
5c728af0 3421 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3422 set X $myuname
3423 osname=os2
3424 osvers="$5"
2304df62
AD
3425 fi
3426 fi
a774dfe6 3427
5440bc8e
JH
3428 case "$targetarch" in
3429 '') ;;
3430 *) hostarch=$osname
3431 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3432 osvers=''
3433 ;;
3434 esac
3435
a0d0e21e
LW
3436 : Now look for a hint file osname_osvers, unless one has been
3437 : specified already.
3438 case "$hintfile" in
3439 ''|' ')
1e127011 3440 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3441 : Also try without trailing minor version numbers.
1e127011
DD
3442 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3443 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3444 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3445 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3446 case "$file" in
3447 '') dflt=none ;;
3448 *) case "$osvers" in
3449 '') dflt=$file
3450 ;;
dfe9444c 3451 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3452 dflt=$file
dfe9444c 3453 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3454 dflt=$xfile
dfe9444c 3455 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3456 dflt=$xxfile
dfe9444c 3457 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3458 dflt=$xxxfile
dfe9444c 3459 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3460 dflt=$xxxxfile
dfe9444c 3461 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3462 dflt="${osname}"
3463 else
3464 dflt=none
3465 fi
3466 ;;
3467 esac
85e6fe83
LW
3468 ;;
3469 esac
4e2a5f63
AD
3470 if $test -f Policy.sh ; then
3471 case "$dflt" in
3472 *Policy*) ;;
3473 none) dflt="Policy" ;;
3474 *) dflt="Policy $dflt" ;;
3475 esac
3476 fi
85e6fe83 3477 ;;
a0d0e21e 3478 *)
ecfc5424 3479 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3480 ;;
2304df62 3481 esac
1aef975c 3482
4e2a5f63
AD
3483 if $test -f Policy.sh ; then
3484 $cat <<EOM
3485
3486There's also a Policy hint file available, which should make the
3487site-specific (policy) questions easier to answer.
3488EOM
3489
3490 fi
3491
2304df62
AD
3492 $cat <<EOM
3493
3494You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3495If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3496previous run of Configure, you may specify it as well as or instead of
3497OS-specific hints. If hints are provided for your OS, you should use them:
3498although Perl can probably be built without hints on many platforms, using
3499hints often improve performance and may enable features that Configure can't
3500set up on its own. If there are no hints that match your OS, specify "none";
3501DO NOT give a wrong version or a wrong OS.
2304df62
AD
3502
3503EOM
4e2a5f63 3504
2304df62 3505 rp="Which of these apply, if any?"
dfe9444c 3506 . UU/myread
85e6fe83
LW
3507 tans=$ans
3508 for file in $tans; do
4e2a5f63
AD
3509 if $test X$file = XPolicy -a -f Policy.sh; then
3510 . Policy.sh
3511 $cat Policy.sh >> UU/config.sh
3512 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3513 . $src/hints/$file.sh
3514 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3515 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3516 : nothing
3517 else
85e6fe83
LW
3518 : Give one chance to correct a possible typo.
3519 echo "$file.sh does not exist"
3520 dflt=$file
3521 rp="hint to use instead?"
dfe9444c 3522 . UU/myread
85e6fe83 3523 for file in $ans; do
dfe9444c
AD
3524 if $test -f "$src/hints/$file.sh"; then
3525 . $src/hints/$file.sh
3526 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3527 elif $test X$ans = X -o X$ans = Xnone ; then
3528 : nothing
3529 else
3530 echo "$file.sh does not exist -- ignored."
3531 fi
3532 done
2304df62
AD
3533 fi
3534 done
85e6fe83 3535
2304df62 3536 hint=recommended
85e6fe83 3537 : Remember our hint file for later.
dfe9444c 3538 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3539 hintfile="$file"
85e6fe83 3540 else
a0d0e21e 3541 hintfile=''
85e6fe83 3542 fi
2304df62
AD
3543fi
3544cd UU
3545;;
3546*)
3547 echo " "
3548 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3549 tmp_n="$n"
3550 tmp_c="$c"
2304df62
AD
3551 cd ..
3552 cp $config_sh config.sh 2>/dev/null
a78b0d02 3553 chmod +w config.sh
2304df62
AD
3554 . ./config.sh
3555 cd UU
3556 cp ../config.sh .
ecfc5424
AD
3557 n="$tmp_n"
3558 c="$tmp_c"
2304df62
AD
3559 hint=previous
3560 ;;
3561esac
1aef975c 3562test "$override" && . ./optdef.sh
2304df62
AD
3563
3564: Restore computed paths
3565for file in $loclist $trylist; do
3566 eval $file="\$_$file"
3567done
3568
85e6fe83 3569cat << EOM
a0d0e21e 3570
85e6fe83 3571Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3572The default value is probably right if the name rings a bell. Otherwise,
3573since spelling matters for me, either accept the default or answer "none"
3574to leave it blank.
a0d0e21e 3575
85e6fe83 3576EOM
85e6fe83 3577case "$osname" in
a0d0e21e 3578 ''|' ')
85e6fe83 3579 case "$hintfile" in
a0d0e21e 3580 ''|' '|none) dflt=none ;;
ecfc5424 3581 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3582 esac
3583 ;;
3584 *) dflt="$osname" ;;
3585esac
3586rp="Operating system name?"
3587. ./myread
3588case "$ans" in
ecfc5424
AD
3589none) osname='' ;;
3590*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3591esac
8ff267be 3592echo " "
3593case "$osvers" in
3594 ''|' ')
3595 case "$hintfile" in
3596 ''|' '|none) dflt=none ;;
3597 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3598 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3599 case "$dflt" in
3600 ''|' ') dflt=none ;;
3601 esac
3602 ;;
3603 esac
3604 ;;
3605 *) dflt="$osvers" ;;
3606esac
3607rp="Operating system version?"
3608. ./myread
3609case "$ans" in
3610none) osvers='' ;;
3611*) osvers="$ans" ;;
3612esac
3613
02e93a22
JH
3614
3615. ./posthint.sh
3616
2304df62 3617: who configured the system
59b83a6f 3618cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3619case "$cf_by" in
3620"")
7c04078e 3621 cf_by=`(logname) 2>/dev/null`
dfe9444c 3622 case "$cf_by" in
7c04078e
GA
3623 "")
3624 cf_by=`(whoami) 2>/dev/null`
3625 case "$cf_by" in
3626 "") cf_by=unknown ;;
3627 esac ;;
8ff267be 3628 esac ;;
3629esac
2304df62 3630
f3f1a2d8
MB
3631: decide how portable to be. Allow command line overrides.
3632case "$d_portable" in
3633"$undef") ;;
3634*) d_portable="$define" ;;
b4eb6b3d 3635esac
b4eb6b3d 3636
f3f1a2d8
MB
3637: set up shell script to do ~ expansion
3638cat >filexp <<EOSS
3639$startsh
3640: expand filename
3641case "\$1" in
f16e9d76 3642 \~/*|\~)
f3f1a2d8
MB
3643 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3644 ;;
4137585d 3645 \~*)
f3f1a2d8
MB
3646 if $test -f /bin/csh; then
3647 /bin/csh -f -c "glob \$1"
3648 failed=\$?
3649 echo ""
3650 exit \$failed
3651 else
3652 name=\`$expr x\$1 : '..\([^/]*\)'\`
3653 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3654 if $test ! -d "\$dir"; then
3655 me=\`basename \$0\`
3656 echo "\$me: can't locate home directory for: \$name" >&2
3657 exit 1
3658 fi
3659 case "\$1" in
3660 */*)
3661 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3662 ;;
3663 *)
3664 echo \$dir
3665 ;;
3666 esac
3667 fi
3668 ;;
3669*)
3670 echo \$1
3671 ;;
b29b105d 3672esac
f3f1a2d8
MB
3673EOSS
3674chmod +x filexp
3675$eunicefix filexp
b29b105d 3676
f3f1a2d8
MB
3677: now set up to get a file name
3678cat <<EOS >getfile
3679$startsh
3680EOS
3681cat <<'EOSC' >>getfile
3682tilde=''
3683fullpath=''
3684already=''
3685skip=''
3686none_ok=''
3687exp_file=''
3688nopath_ok=''
3689orig_rp="$rp"
3690orig_dflt="$dflt"
3691case "$gfpth" in
3692'') gfpth='.' ;;
b29b105d 3693esac
b29b105d 3694
f3f1a2d8
MB
3695case "$fn" in
3696*\(*)
3697 : getfile will accept an answer from the comma-separated list
3698 : enclosed in parentheses even if it does not meet other criteria.
3699 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3700 fn=`echo $fn | sed 's/(.*)//'`
3701 ;;
b29b105d
JH
3702esac
3703
f3f1a2d8
MB
3704case "$fn" in
3705*:*)
3706 loc_file=`expr $fn : '.*:\(.*\)'`
3707 fn=`expr $fn : '\(.*\):.*'`
3708 ;;
b29b105d 3709esac
b29b105d 3710
f3f1a2d8
MB
3711case "$fn" in
3712*~*) tilde=true;;
3713esac
3714case "$fn" in
3715*/*) fullpath=true;;
3716esac
3717case "$fn" in
3718*+*) skip=true;;
3719esac
3720case "$fn" in
3721*n*) none_ok=true;;
3722esac
3723case "$fn" in
3724*e*) exp_file=true;;
3725esac
3726case "$fn" in
3727*p*) nopath_ok=true;;
b29b105d 3728esac
b29b105d 3729
f3f1a2d8
MB
3730case "$fn" in
3731*f*) type='File';;
3732*d*) type='Directory';;
3733*l*) type='Locate';;
3734esac
b29b105d 3735
f3f1a2d8
MB
3736what="$type"
3737case "$what" in
3738Locate) what='File';;
3739esac
b29b105d 3740
f3f1a2d8
MB
3741case "$exp_file" in
3742'')
3743 case "$d_portable" in
3744 "$define") ;;
3745 *) exp_file=true;;
b29b105d
JH
3746 esac
3747 ;;
3748esac
3749
f3f1a2d8
MB
3750cd ..
3751while test "$type"; do
3752 redo=''
3753 rp="$orig_rp"
3754 dflt="$orig_dflt"
3755 case "$tilde" in
3756 true) rp="$rp (~name ok)";;
3757 esac
3758 . UU/myread
3759 if test -f UU/getfile.ok && \
3760 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3761 then
3762 value="$ans"
3763 ansexp="$ans"
3764 break
3765 fi
3766 case "$ans" in
3767 none)
3768 value=''
3769 ansexp=''
3770 case "$none_ok" in
3771 true) type='';;
b29b105d
JH
3772 esac
3773 ;;
f3f1a2d8
MB
3774 *)
3775 case "$tilde" in
3776 '') value="$ans"
3777 ansexp="$ans";;
3778 *)
3779 value=`UU/filexp $ans`
3780 case $? in
3781 0)
3782 if test "$ans" != "$value"; then
3783 echo "(That expands to $value on this system.)"
3784 fi
3785 ;;
3786 *) value="$ans";;
3787 esac
3788 ansexp="$value"
3789 case "$exp_file" in
3790 '') value="$ans";;
3791 esac
3792 ;;
3793 esac
3794 case "$fullpath" in
3795 true)
3796 case "$ansexp" in
3797 /*) value="$ansexp" ;;
3798 [a-zA-Z]:/*) value="$ansexp" ;;
3799 *)
3800 redo=true
3801 case "$already" in
3802 true)
3803 echo "I shall only accept a full path name, as in /bin/ls." >&4
3804 echo "Use a ! shell escape if you wish to check pathnames." >&4
3805 ;;
3806 *)
3807 echo "Please give a full path name, starting with slash." >&4
3808 case "$tilde" in
3809 true)
3810 echo "Note that using ~name is ok provided it expands well." >&4
3811 already=true
3812 ;;
3813 esac
3814 esac
3815 ;;
3816 esac
3817 ;;
3818 esac
3819 case "$redo" in
3820 '')
3821 case "$type" in
3822 File)
3823 for fp in $gfpth; do
3824 if test "X$fp" = X.; then
3825 pf="$ansexp"
3826 else
3827 pf="$fp/$ansexp"
3828 fi
3829 if test -f "$pf"; then
3830 type=''
3831 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3832 then
3833 echo "($value is not a plain file, but that's ok.)"
3834 type=''
3835 fi
3836 if test X"$type" = X; then
3837 value="$pf"
3838 break
3839 fi
3840 done
3841 ;;
3842 Directory)
3843 for fp in $gfpth; do
3844 if test "X$fp" = X.; then
3845 dir="$ans"
3846 direxp="$ansexp"
3847 else
3848 dir="$fp/$ansexp"
3849 direxp="$fp/$ansexp"
3850 fi
3851 if test -d "$direxp"; then
3852 type=''
3853 value="$dir"
3854 break
3855 fi
3856 done
3857 ;;
3858 Locate)
3859 if test -d "$ansexp"; then
3860 echo "(Looking for $loc_file in directory $value.)"
3861 value="$value/$loc_file"
3862 ansexp="$ansexp/$loc_file"
3863 fi
3864 if test -f "$ansexp"; then
3865 type=''
3866 fi
3867 case "$nopath_ok" in
3868 true) case "$value" in
3869 */*) ;;
3870 *) echo "Assuming $value will be in people's path."
3871 type=''
3872 ;;
3873 esac
3874 ;;
3875 esac
3876 ;;
3877 esac
b4eb6b3d 3878
f3f1a2d8
MB
3879 case "$skip" in
3880 true) type='';
3881 esac
3882
3883 case "$type" in
3884 '') ;;
3885 *)
3886 if test "$fastread" = yes; then
3887 dflt=y
3888 else
3889 dflt=n
3890 fi
3891 rp="$what $value doesn't exist. Use that name anyway?"
3892 . UU/myread
3893 dflt=''
3894 case "$ans" in
3895 y*) type='';;
3896 *) echo " ";;
3897 esac
3898 ;;
3899 esac
3900 ;;
3901 esac
3902 ;;
b4eb6b3d 3903 esac
f3f1a2d8
MB
3904done
3905cd UU
3906ans="$value"
3907rp="$orig_rp"
3908dflt="$orig_dflt"
3909rm -f getfile.ok
3910test "X$gfpthkeep" != Xy && gfpth=""
3911EOSC
3912
3913: determine root of directory hierarchy where package will be installed.
3914case "$prefix" in
3915'')
3916 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3917 ;;
3918*?/)
3919 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3920 ;;
3921*)
f3f1a2d8 3922 dflt="$prefix"
b4eb6b3d
JH
3923 ;;
3924esac
f3f1a2d8 3925$cat <<EOM
b4eb6b3d 3926
f3f1a2d8
MB
3927By default, $package will be installed in $dflt/bin, manual pages
3928under $dflt/man, etc..., i.e. with $dflt as prefix for all
3929installation directories. Typically this is something like /usr/local.
3930If you wish to have binaries under /usr/bin but other parts of the
3931installation under /usr/local, that's ok: you will be prompted
3932separately for each of the installation directories, the prefix being
3933only used to set the defaults.
c915ce7f
JH
3934
3935EOM
f3f1a2d8
MB
3936fn=d~
3937rp='Installation prefix to use?'
3938. ./getfile
3939oldprefix=''
3940case "$prefix" in
3941'') ;;
3942*)
3943 case "$ans" in
3944 "$prefix") ;;
3945 *) oldprefix="$prefix";;
3946 esac
c915ce7f
JH
3947 ;;
3948esac
f3f1a2d8
MB
3949prefix="$ans"
3950prefixexp="$ansexp"
c915ce7f 3951
776a38e3 3952: allow them to override the AFS root
f3f1a2d8
MB
3953case "$afsroot" in
3954'') afsroot=/afs ;;
3955*) afsroot=$afsroot ;;
b4eb6b3d 3956esac
b4eb6b3d 3957
776a38e3 3958: is AFS running?
f3f1a2d8
MB
3959echo " "
3960case "$afs" in
3961$define|true) afs=true ;;
3962$undef|false) afs=false ;;
776a38e3 3963*) if $test -d $afsroot; then
f3f1a2d8
MB
3964 afs=true
3965 else
3966 afs=false
3967 fi
b4eb6b3d 3968 ;;
f3f1a2d8
MB
3969esac
3970if $afs; then
3971 echo "AFS may be running... I'll be extra cautious then..." >&4
3972else
3973 echo "AFS does not seem to be running..." >&4
9da7673b 3974fi
b4eb6b3d 3975
f3f1a2d8
MB
3976: determine installation prefix for where package is to be installed.
3977if $afs; then
3978$cat <<EOM
3979
3980Since you are running AFS, I need to distinguish the directory in which
3981files will reside from the directory in which they are installed (and from
3982which they are presumably copied to the former directory by occult means).
b4eb6b3d 3983
b4eb6b3d 3984EOM
f3f1a2d8
MB
3985 case "$installprefix" in
3986 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3987 *) dflt="$installprefix";;
3988 esac
3989else
3990$cat <<EOM
b4eb6b3d 3991
f3f1a2d8
MB
3992In some special cases, particularly when building $package for distribution,
3993it is convenient to distinguish the directory in which files should be
3994installed from the directory ($prefix) in which they will
3995eventually reside. For most users, these two directories are the same.
3996
3997EOM
3998 case "$installprefix" in
3999 '') dflt=$prefix ;;
4000 *) dflt=$installprefix;;
4001 esac
4002fi
4003fn=d~
4004rp='What installation prefix should I use for installing files?'
4005. ./getfile
4006installprefix="$ans"
4007installprefixexp="$ansexp"
4008
4009: Perform the prefixexp/installprefixexp correction if necessary
4010cat <<EOS >installprefix
4011$startsh
4012EOS
4013cat <<'EOSC' >>installprefix
4014: Change installation prefix, if necessary.
4015if $test X"$prefix" != X"$installprefix"; then
4016 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4017else
4018 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4019fi
4020EOSC
4021chmod +x installprefix
4022$eunicefix installprefix
4023
4024: Set variables such as privlib and privlibexp from the output of ./getfile
4025: performing the prefixexp/installprefixexp correction if necessary.
4026cat <<EOS >setprefixvar
4027$startsh
4028EOS
4029cat <<'EOSC' >>setprefixvar
4030eval "${prefixvar}=\"\$ans\""
4031eval "${prefixvar}exp=\"\$ansexp\""
4032. ./installprefix
4033EOSC
4034chmod +x setprefixvar
4035$eunicefix setprefixvar
4036
4037: set up the script used to warn in case of inconsistency
4038cat <<EOS >whoa
4039$startsh
4040EOS
4041cat <<'EOSC' >>whoa
4042dflt=y
dcb594bc
MB
4043case "$hint" in
4044 recommended)
4045 case "$hintfile" in
4046 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4047 ;;
4048 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4049 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4050 ;;
4051 esac
4052 ;;
4053 *) echo " "
4054 echo "*** WHOA THERE!!! ***" >&4
4055 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4056 ;;
4057esac
f3f1a2d8
MB
4058rp=" Keep the $hint value?"
4059. ./myread
4060case "$ans" in
4061y) td=$was; tu=$was;;
4062esac
4063EOSC
4064
216dac04 4065: function used to set '$1' to '$val'
f3f1a2d8
MB
4066setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4067case "$val$was" in
4068$define$undef) . ./whoa; eval "$var=\$td";;
4069$undef$define) . ./whoa; eval "$var=\$tu";;
4070*) eval "$var=$val";;
4071esac'
4072
34f1896b 4073: Check is we will use socks
f3f1a2d8
MB
4074case "$usesocks" in
4075$define|true|[yY]*) dflt='y';;
4076*) dflt='n';;
4077esac
4078cat <<EOM
4079
4080Perl can be built to use the SOCKS proxy protocol library. To do so,
4081Configure must be run with -Dusesocks. If you use SOCKS you also need
4082to use the PerlIO abstraction layer, this will be implicitly selected.
4083
4084If this doesn't make any sense to you, just accept the default '$dflt'.
4085EOM
4086rp='Build Perl for SOCKS?'
4087. ./myread
4088case "$ans" in
613d6c3e 4089y|Y) val="$define" ;;
f3f1a2d8
MB
4090*) val="$undef" ;;
4091esac
4092set usesocks
4093eval $setvar
4094
4095case "$usesocks" in
4096$define|true|[yY]*) useperlio="$define";;
4097esac
4098
34f1896b 4099: Check if we want perlio
f3f1a2d8
MB
4100case "$useperlio" in
4101$define|true|[yY]*|'') dflt='y';;
4102*) dflt='n';;
4103esac
4104cat <<EOM
4105
4106Previous version of $package used the standard IO mechanisms as
4107defined in <stdio.h>. Versions 5.003_02 and later of $package allow
4108alternate IO mechanisms via the PerlIO abstraction layer, but the
4109stdio mechanism is still available if needed. The abstraction layer
4110can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4111Using PerlIO with sfio may cause problems with some extension modules.
4112
4113If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 4114EOM
f3f1a2d8
MB
4115rp='Use the PerlIO abstraction layer?'
4116. ./myread
4117case "$ans" in
34f1896b 4118y|Y)
b4eb6b3d
JH
4119 val="$define"
4120 ;;
34f1896b 4121*)
f3f1a2d8
MB
4122 echo "Ok, doing things the stdio way."
4123 val="$undef"
4124 ;;
4125esac
4126set useperlio
34f1896b 4127eval $setvar
f3f1a2d8
MB
4128
4129case "$usesocks" in
4130$define|true|[yY]*)
4131 case "$useperlio" in
4132 $define|true|[yY]*) ;;
4133 *) cat >&4 <<EOM
4134
4135You are using the SOCKS proxy protocol library which means that you
4136should also use the PerlIO layer. You may be headed for trouble.
4137
4138EOM
4139 ;;
b4eb6b3d 4140 esac
f3f1a2d8
MB
4141 ;;
4142esac
4143
5c40187f
MB
4144: get the patchlevel
4145echo " "
4146echo "Getting the current patchlevel..." >&4
4147if $test -r $rsrc/patchlevel.h;then
4148 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4149 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4150 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4151 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4152 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4153 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4154 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4155else
4156 revision=0
4157 patchlevel=0
4158 subversion=0
4159 api_revision=0
4160 api_version=0
4161 api_subversion=0
4162 perl_patchlevel=0
4163 $echo "(You do not have patchlevel.h. Eek.)"
4164fi
4165if $test -r $rsrc/.patch ; then
4166 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4167 perl_patchlevel=`cat $rsrc/.patch`
4168 fi
4169fi
4170: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4171version_patchlevel_string="version $patchlevel subversion $subversion"
4172case "$perl_patchlevel" in
41730|'') ;;
0f04e85f
MB
4174*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4175 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4176 ;;
5c40187f
MB
4177esac
4178
4179$echo "(You have $package $version_patchlevel_string.)"
4180
4181case "$osname" in
4182dos|vms)
4183 : XXX Should be a Configure test for double-dots in filenames.
4184 version=`echo $revision $patchlevel $subversion | \
4185 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4186 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4187 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4188 ;;
4189*)
4190 version=`echo $revision $patchlevel $subversion | \
4191 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4192 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4193 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4194 ;;
4195esac
4196: Special case the 5.005_xx maintenance series, which used 5.005
4197: without any subversion label as a subdirectory in $sitelib
4198if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4199 api_versionstring='5.005'
4200fi
4201
613d6c3e 4202: Do we want threads support and if so, what type
f3f1a2d8
MB
4203case "$usethreads" in
4204$define|true|[yY]*) dflt='y';;
4205*) # Catch case where user specified ithreads or 5005threads but
4206 # forgot -Dusethreads (A.D. 4/2002)
4207 case "$useithreads$use5005threads" in
613d6c3e 4208 *$define*)
f3f1a2d8
MB
4209 case "$useperlio" in
4210 "$define") dflt='y' ;;
4211 *) dflt='n' ;;
4212 esac
4213 ;;
4214 *) dflt='n';;
4215 esac
4216 ;;
4217esac
4218cat <<EOM
4219
4220Perl can be built to take advantage of threads on some systems.
4221To do so, Configure can be run with -Dusethreads.
4222
4223Note that Perl built with threading support runs slightly slower
4224and uses more memory than plain Perl. The current implementation
4225is believed to be stable, but it is fairly new, and so should be
4226treated with caution.
4227
4228If this doesn't make any sense to you, just accept the default '$dflt'.
4229EOM
4230rp='Build a threading Perl?'
4231. ./myread
4232case "$ans" in
4233y|Y) val="$define" ;;
4234*) val="$undef" ;;
4235esac
4236set usethreads
4237eval $setvar
4238
5c40187f
MB
4239if $test $patchlevel -lt 9; then
4240 case "$usethreads" in
4241 $define)
f3f1a2d8
MB
4242 $cat <<EOM
4243
4244Since release 5.6, Perl has had two different threading implementations,
4245the newer interpreter-based version (ithreads) with one interpreter per
4246thread, and the older 5.005 version (5005threads).
4247The 5005threads version is effectively unmaintained and will probably be
4248removed in Perl 5.10, so there should be no need to build a Perl using it
4249unless needed for backwards compatibility with some existing 5.005threads
4250code.
4251
4252EOM
4253 : Default to ithreads unless overridden on command line or with
4254 : old config.sh
4255 dflt='y'
4256 case "$use5005threads" in
4257 $define|true|[yY]*) dflt='n';;
4258 esac
4259 case "$useithreads" in
4260 $undef|false|[nN]*) dflt='n';;
4261 esac
4262 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4263 . ./myread
4264 case "$ans" in
f3f1a2d8 4265 y|Y) val="$define" ;;
b4eb6b3d
JH
4266 *) val="$undef" ;;
4267 esac
f3f1a2d8
MB
4268 set useithreads
4269 eval $setvar
4270 : Now set use5005threads to the opposite value.
4271 case "$useithreads" in
4272 $define) val="$undef" ;;
4273 *) val="$define" ;;
4274 esac
4275 set use5005threads
4276 eval $setvar
4277 ;;
5c40187f 4278 *)
f3f1a2d8
MB
4279 useithreads="$undef"
4280 use5005threads="$undef"
b4eb6b3d 4281 ;;
5c40187f 4282 esac
b4eb6b3d 4283
5c40187f
MB
4284 case "$useithreads$use5005threads" in
4285 "$define$define")
f3f1a2d8 4286 $cat >&4 <<EOM
96056487 4287
f3f1a2d8
MB
4288You cannot have both the ithreads and the 5.005 threads enabled
4289at the same time. Disabling the 5.005 threads since they are
4290much less stable than the ithreads.
4291
4292EOM
4293 use5005threads="$undef"
96056487 4294 ;;
5c40187f
MB
4295 esac
4296
4297else
4298: perl-5.9.x and later
4299
47f9f84c 4300 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4301 case "$use5005threads" in
4302 $define|true|[yY]*)
4303 $cat >&4 <<EOM
47f9f84c
JH
4304
43055.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4306
47f9f84c 4307EOM
3f30fabf
MB
4308 ;;
4309 esac
47f9f84c 4310 fi
3f30fabf 4311
47f9f84c
JH
4312 use5005threads="$undef"
4313 useithreads="$usethreads"
5c40187f 4314fi
96056487 4315
f3f1a2d8
MB
4316if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4317 cat >&4 <<EOF
4318***
4319*** To build with ithreads you must also use the PerlIO layer.
4320*** Cannot continue, aborting.
4321***
4322EOF
4323 exit 1
4324fi
4325
4326case "$d_oldpthreads" in
4327'') : Configure tests would be welcome here. For now, assume undef.
4328 val="$undef" ;;
4329*) val="$d_oldpthreads" ;;
4330esac
4331set d_oldpthreads
4332eval $setvar
4333
4334
4335: Look for a hint-file generated 'call-back-unit'. If the
4336: user has specified that a threading perl is to be built,
4337: we may need to set or change some other defaults.
4338if $test -f usethreads.cbu; then
4339 echo "Your platform has some specific hints regarding threaded builds, using them..."
4340 . ./usethreads.cbu
4341else
4342 case "$usethreads" in
4343 "$define"|true|[yY]*)
4344 $cat <<EOM
4345(Your platform does not have any specific hints for threaded builds.
4346 Assuming POSIX threads, then.)
4347EOM
4348 ;;
4349 esac
4350fi
4351
34f1896b 4352: Check if multiplicity is required
f3f1a2d8
MB
4353cat <<EOM
4354
4355Perl can be built so that multiple Perl interpreters can coexist
4356within the same Perl executable.
4357EOM
4358
4359case "$useithreads" in
4360$define)
4361 cat <<EOM
4362This multiple interpreter support is required for interpreter-based threads.
4363EOM
4364 val="$define"
4365 ;;
4366*) case "$usemultiplicity" in
4367 $define|true|[yY]*) dflt='y';;
4368 *) dflt='n';;
4369 esac
4370 echo " "
4371 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4372 rp='Build Perl for multiplicity?'
4373 . ./myread
4374 case "$ans" in
4375 y|Y) val="$define" ;;
4376 *) val="$undef" ;;
4377 esac
4378 ;;
4379esac
4380set usemultiplicity
4381eval $setvar
4382
34f1896b 4383: Check if morebits is requested
f3f1a2d8
MB
4384case "$usemorebits" in
4385"$define"|true|[yY]*)
4386 use64bitint="$define"
4387 uselongdouble="$define"
4388 usemorebits="$define"
4389 ;;
4390*) usemorebits="$undef"
4391 ;;
4392esac
4393
776a38e3
MB
4394: Determine the C compiler to be used
4395echo " "
4396case "$cc" in
4397'') dflt=cc;;
4398*) dflt="$cc";;
4399esac
4400rp="Use which C compiler?"
4401. ./myread
4402cc="$ans"
4403
4404: See whether they have no cc but they do have gcc
4405. ./trygcc
4406if $test -f cc.cbu; then
4407 . ./cc.cbu
4408fi
4409. ./checkcc
4410
f3f1a2d8
MB
4411: make some quick guesses about what we are up against
4412echo " "
4413$echo $n "Hmm... $c"
4414echo exit 1 >bsd
4415echo exit 1 >usg
4416echo exit 1 >v7
4417echo exit 1 >osf1
4418echo exit 1 >eunice
4419echo exit 1 >xenix
4420echo exit 1 >venix
4421echo exit 1 >os2
4422d_bsd="$undef"
4423$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4424if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4425then
4426 echo "Looks kind of like an OSF/1 system, but we'll see..."
4427 echo exit 0 >osf1
381aa1ff 4428elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4429 xxx=`./loc addbib blurfl $pth`
4430 if $test -f $xxx; then
4431 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4432 echo exit 0 >bsd
4433 echo exit 0 >usg
4434 else
4435 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4436 echo "Looks kind of like an extended USG system, but we'll see..."
4437 else
4438 echo "Looks kind of like a USG system, but we'll see..."
4439 fi
4440 echo exit 0 >usg
4441 fi
4442elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4443 echo "Looks kind of like a BSD system, but we'll see..."
4444 d_bsd="$define"
4445 echo exit 0 >bsd
4446else
4447 echo "Looks kind of like a Version 7 system, but we'll see..."
4448 echo exit 0 >v7
4449fi
4450case "$eunicefix" in
4451*unixtovms*)
4452 $cat <<'EOI'
4453There is, however, a strange, musty smell in the air that reminds me of
4454something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4455EOI
4456 echo exit 0 >eunice
4457 d_eunice="$define"
4458: it so happens the Eunice I know will not run shell scripts in Unix format
4459 ;;
4460*)
4461 echo " "
4462 echo "Congratulations. You aren't running Eunice."
4463 d_eunice="$undef"
4464 ;;
4465esac
4466: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4467: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4468: semicolon as a patch separator
e5e20432
JH
4469case "$p_" in
4470:) ;;
4471*)
4472 $cat <<'EOI'
4473I have the feeling something is not exactly right, however...don't tell me...
4474lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4475(Or you may be running DOS with DJGPP.)
e5e20432
JH
4476EOI
4477 echo exit 0 >os2
4478 ;;
4479esac
4480if test -f /xenix; then
4481 echo "Actually, this looks more like a XENIX system..."
4482 echo exit 0 >xenix
4483 d_xenix="$define"
4484else
4485 echo " "
4486 echo "It's not Xenix..."
4487 d_xenix="$undef"
4488fi
4489chmod +x xenix
4490$eunicefix xenix
4491if test -f /venix; then
4492 echo "Actually, this looks more like a VENIX system..."
4493 echo exit 0 >venix
4494else
4495 echo " "
4496 if ./xenix; then
4497 : null
4498 else
4499 echo "Nor is it Venix..."
4500 fi
4501fi
4502chmod +x bsd usg v7 osf1 eunice xenix venix os2
4503$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4504$rm -f foo
4505
613d6c3e 4506: Check if we are using GNU gcc and what its version is
e5e20432
JH
4507echo " "
4508echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4509$cat >try.c <<EOM
e5e20432
JH
4510#include <stdio.h>
4511int main() {
7686528e 4512#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4513#ifdef __VERSION__
4514 printf("%s\n", __VERSION__);
4515#else
4516 printf("%s\n", "1");
4517#endif
4518#endif
073b6de5 4519 return(0);
e5e20432
JH
4520}
4521EOM
5440bc8e
JH
4522if $cc -o try $ccflags $ldflags try.c; then
4523 gccversion=`$run ./try`
f3f1a2d8
MB
4524 case "$gccversion" in
4525 '') echo "You are not using GNU cc." ;;
4526 *) echo "You are using GNU cc $gccversion."
4527 ccname=gcc
4528 ;;
4529 esac
4530else
4531 echo " "
4532 echo "*** WHOA THERE!!! ***" >&4
4533 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4534 case "$knowitall" in
4535 '')
4536 echo " You'd better start hunting for one and let me know about it." >&4
4537 exit 1
2304df62
AD
4538 ;;
4539 esac
f3f1a2d8
MB
4540fi
4541$rm -f try try.*
4542case "$gccversion" in
45431*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4544esac
4545case "$gccversion" in
4546'') gccosandvers='' ;;
4547*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4548 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4549 gccshortvers=''
4550 case "$gccosandvers" in
4551 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4552 $osname$osvers) ;; # looking good
4553 $osname*) cat <<EOM >&4
4554
4555*** WHOA THERE!!! ***
4556
4557 Your gcc has not been compiled for the exact release of
4558 your operating system ($gccosandvers versus $osname$osvers).
4559
4560 In general it is a good idea to keep gcc synchronized with
4561 the operating system because otherwise serious problems
4562 may ensue when trying to compile software, like Perl.
4563
4564 I'm trying to be optimistic here, though, and will continue.
4565 If later during the configuration and build icky compilation
4566 problems appear (headerfile conflicts being the most common
4567 manifestation), I suggest reinstalling the gcc to match
4568 your operating system release.
4569
4570EOM
4571 ;;
4572 *) gccosandvers='' ;; # failed to parse, better be silent
4573 esac
4574 ;;
4575esac
4576case "$ccname" in
4577'') ccname="$cc" ;;
4578esac
4579
4580# gcc 3.* complain about adding -Idirectories that they already know about,
4581# so we will take those off from locincpth.
4582case "$gccversion" in
45833*)
4584 echo "main(){}">try.c
4585 for incdir in $locincpth; do
4586 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4587 grep '^c[cp]p*[01]: warning: changing search order '`
4588 if test "X$warn" != X; then
4589 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4590 fi
4591 done
4592 $rm -f try try.*
4593esac
2304df62 4594
bd9b35c9
JH
4595: What should the include directory be ?
4596echo " "
4597$echo $n "Hmm... $c"
4598dflt='/usr/include'
4599incpath=''
4600mips_type=''
4601if $test -f /bin/mips && /bin/mips; then
4602 echo "Looks like a MIPS system..."
4603 $cat >usr.c <<'EOCP'
4604#ifdef SYSTYPE_BSD43
4605/bsd43
4606#endif
4607EOCP
8a27cf78 4608 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4609 dflt='/bsd43/usr/include'
4610 incpath='/bsd43'
4611 mips_type='BSD 4.3'
4612 else
4613 mips_type='System V'
4614 fi
4615 $rm -f usr.c usr.out
4616 echo "and you're compiling with the $mips_type compiler and libraries."
4617 xxx_prompt=y
4618 echo "exit 0" >mips
4619else
4620 echo "Doesn't look like a MIPS system."
4621 xxx_prompt=n
4622 echo "exit 1" >mips
4623fi
4624chmod +x mips
4625$eunicefix mips
4626case "$usrinc" in
4627'') ;;
4628*) dflt="$usrinc";;
4629esac
4630case "$xxx_prompt" in
4631y) fn=d/
4632 echo " "
4633 rp='Where are the include files you want to use?'
4634 . ./getfile
4635 usrinc="$ans"
8e07c86e 4636 ;;
bd9b35c9 4637*) usrinc="$dflt"
8e07c86e
AD
4638 ;;
4639esac
2304df62 4640
96056487
JH
4641: see how we invoke the C preprocessor
4642echo " "
4643echo "Now, how can we feed standard input to your C preprocessor..." >&4
4644cat <<'EOT' >testcpp.c
4645#define ABC abc
4646#define XYZ xyz
4647ABC.XYZ
4648EOT
4649cd ..
4650if test ! -f cppstdin; then
4651 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4652 # AIX cc -E doesn't show the absolute headerfile
4653 # locations but we'll cheat by using the -M flag.
4654 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
4655 else
4656 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4657 fi
4658else
4659 echo "Keeping your $hint cppstdin wrapper."
4660fi
4661chmod 755 cppstdin
4662wrapper=`pwd`/cppstdin
4663ok='false'
4664cd UU
4665
4666if $test "X$cppstdin" != "X" && \
4667 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4668 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4669then
4670 echo "You used to use $cppstdin $cppminus so we'll use that again."
4671 case "$cpprun" in
4672 '') echo "But let's see if we can live without a wrapper..." ;;
4673 *)
4674 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4675 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4676 then
4677 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4678 ok='true'
4679 else
4680 echo "(However, $cpprun $cpplast does not work, let's see...)"
4681 fi
4682 ;;
4683 esac
4684else
4685 case "$cppstdin" in
4686 '') ;;
4687 *)
4688 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4689 ;;
4690 esac
4691fi
4692
4693if $ok; then
4694 : nothing
4695elif echo 'Maybe "'"$cc"' -E" will work...'; \
4696 $cc -E <testcpp.c >testcpp.out 2>&1; \
4697 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4698 echo "Yup, it does."
4699 x_cpp="$cc -E"
4700 x_minus='';
4701elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4702 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4703 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4704 echo "Yup, it does."
4705 x_cpp="$cc -E"
4706 x_minus='-';
4707elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4708 $cc -P <testcpp.c >testcpp.out 2>&1; \
4709 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4710 echo "Yipee, that works!"
4711 x_cpp="$cc -P"
4712 x_minus='';
4713elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4714 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4715 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4716 echo "At long last!"
4717 x_cpp="$cc -P"
4718 x_minus='-';
4719elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4720 $cpp <testcpp.c >testcpp.out 2>&1; \
4721 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4722 echo "It works!"
4723 x_cpp="$cpp"
4724 x_minus='';
4725elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4726 $cpp - <testcpp.c >testcpp.out 2>&1; \
4727 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4728 echo "Hooray, it works! I was beginning to wonder."
4729 x_cpp="$cpp"
4730 x_minus='-';
4731elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4732 $wrapper <testcpp.c >testcpp.out 2>&1; \
4733 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4734 x_cpp="$wrapper"
4735 x_minus=''
4736 echo "Eureka!"
4737else
4738 dflt=''
4739 rp="No dice. I can't find a C preprocessor. Name one:"
4740 . ./myread
4741 x_cpp="$ans"
4742 x_minus=''
4743 $x_cpp <testcpp.c >testcpp.out 2>&1
4744 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4745 echo "OK, that will do." >&4
4746 else
4747echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4748 exit 1
4749 fi
4750fi
4751
4752case "$ok" in
4753false)
4754 cppstdin="$x_cpp"
4755 cppminus="$x_minus"
4756 cpprun="$x_cpp"
4757 cpplast="$x_minus"
4758 set X $x_cpp
4759 shift
4760 case "$1" in
4761 "$cpp")
4762 echo "Perhaps can we force $cc -E using a wrapper..."
4763 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4764 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4765 then
4766 echo "Yup, we can."
4767 cppstdin="$wrapper"
4768 cppminus='';
4769 else
4770 echo "Nope, we'll have to live without it..."
4771 fi
4772 ;;
4773 esac
4774 case "$cpprun" in
4775 "$wrapper")
4776 cpprun=''
4777 cpplast=''
4778 ;;
4779 esac
4780 ;;
4781esac
4782
4783case "$cppstdin" in
4784"$wrapper"|'cppstdin') ;;
4785*) $rm -f $wrapper;;
4786esac
4787$rm -f testcpp.c testcpp.out
4788
bd9b35c9
JH
4789: Set private lib path
4790case "$plibpth" in
4791'') if ./mips; then
4792 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4793 fi;;
4794esac
4795case "$libpth" in
4796' ') dlist='';;
4797'') dlist="$loclibpth $plibpth $glibpth";;
4798*) dlist="$libpth";;
4799esac
4800
4801: Now check and see which directories actually exist, avoiding duplicates
4802libpth=''
4803for xxx in $dlist
4804do
4805 if $test -d $xxx; then
4806 case " $libpth " in
4807 *" $xxx "*) ;;
4808 *) libpth="$libpth $xxx";;
4809 esac
4810 fi
4811done
4812$cat <<'EOM'
4813
4814Some systems have incompatible or broken versions of libraries. Among
4815the directories listed in the question below, please remove any you
4816know not to be holding relevant libraries, and add any that are needed.
4817Say "none" for none.
8e07c86e
AD
4818
4819EOM
bd9b35c9
JH
4820case "$libpth" in
4821'') dflt='none';;
8e07c86e 4822*)
bd9b35c9
JH
4823 set X $libpth
4824 shift
4825 dflt=${1+"$@"}
8e07c86e 4826 ;;
a0d0e21e 4827esac
bd9b35c9
JH
4828rp="Directories to use for library searches?"
4829. ./myread
4830case "$ans" in
4831none) libpth=' ';;
4832*) libpth="$ans";;
4833esac
a0d0e21e 4834
bd9b35c9
JH
4835: compute shared library extension
4836case "$so" in
4837'')
4838 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4839 dflt='sl'
dd4e71fd 4840 else
bd9b35c9 4841 dflt='so'
dd4e71fd
JH
4842 fi
4843 ;;
bd9b35c9 4844*) dflt="$so";;
dd4e71fd 4845esac
dd4e71fd
JH
4846$cat <<EOM
4847
bd9b35c9 4848On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4849you want to suppress searching of shared libraries for the remainder
bd9b35c9 4850of this configuration.
dd4e71fd
JH
4851
4852EOM
bd9b35c9
JH
4853rp='What is the file extension used for shared libraries?'
4854. ./myread
4855so="$ans"
dd4e71fd 4856
bd9b35c9
JH
4857: Define several unixisms.
4858: Hints files or command line option can be used to override them.
4859: The convoluted testing is in case hints files set either the old
4860: or the new name.
4861case "$_exe" in
4862'') case "$exe_ext" in
1fef16b3 4863 '') ;;
bd9b35c9 4864 *) _exe="$exe_ext" ;;
dd4e71fd 4865 esac
bd9b35c9 4866 ;;
bfb7748a 4867esac
bd9b35c9
JH
4868case "$_a" in
4869'') case "$lib_ext" in
4870 '') _a='.a';;
4871 *) _a="$lib_ext" ;;
dd4e71fd
JH
4872 esac
4873 ;;
dd4e71fd 4874esac
bd9b35c9
JH
4875case "$_o" in
4876'') case "$obj_ext" in
4877 '') _o='.o';;
4878 *) _o="$obj_ext";;
4879 esac
4880 ;;
4881esac
4882case "$p_" in
4883'') case "$path_sep" in
4884 '') p_=':';;
4885 *) p_="$path_sep";;
4886 esac
4887 ;;
4888esac
4889exe_ext=$_exe
4890lib_ext=$_a
4891obj_ext=$_o
4892path_sep=$p_
dd4e71fd 4893
5b813a60
MB
4894rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4895
b4eb6b3d
JH
4896: Which makefile gets called first. This is used by make depend.
4897case "$firstmakefile" in
4898'') firstmakefile='makefile';;
4633a7c4 4899esac
4633a7c4 4900
34f1896b 4901: Check for uselongdouble support
1f603089
JH
4902case "$ccflags" in
4903*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4904esac
4905
4906case "$uselongdouble" in
4907$define|true|[yY]*) dflt='y';;
4908*) dflt='n';;
4909esac
4910cat <<EOM
4911
4912Perl can be built to take advantage of long doubles which
4913(if available) may give more accuracy and range for floating point numbers.
4914
4915If this doesn't make any sense to you, just accept the default '$dflt'.
4916EOM
4917rp='Try to use long doubles if available?'
4918. ./myread
4919case "$ans" in
4920y|Y) val="$define" ;;
4921*) val="$undef" ;;
4922esac
4923set uselongdouble
4924eval $setvar
4925
4926case "$uselongdouble" in
4927true|[yY]*) uselongdouble="$define" ;;
4928esac
4929
1f603089
JH
4930: Look for a hint-file generated 'call-back-unit'. If the
4931: user has specified that long doubles should be used,
4932: we may need to set or change some other defaults.
9da7673b
MB
4933if $test -f uselongdouble.cbu; then
4934 echo "Your platform has some specific hints regarding long doubles, using them..."
4935 . ./uselongdouble.cbu
4936else
4937 case "$uselongdouble" in
4938 $define)
1f603089 4939 $cat <<EOM
9da7673b 4940(Your platform does not have any specific hints for long doubles.)
1f603089 4941EOM
1f603089 4942 ;;
9da7673b
MB
4943 esac
4944fi
1f603089 4945
bd9b35c9
JH
4946: Looking for optional libraries
4947echo " "
4948echo "Checking for optional libraries..." >&4
4949case "$libs" in
4950' '|'') dflt='';;
4951*) dflt="$libs";;
4952esac
4953case "$libswanted" in
4954'') libswanted='c_s';;
4955esac
4956case "$usesocks" in
923fc586 4957"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4958esac
68435ea7
JH
4959libsfound=''
4960libsfiles=''
4961libsdirs=''
13b3f787
JH
4962libspath=''
4963for thisdir in $libpth $xlibpth; do
4964 test -d $thisdir && libspath="$libspath $thisdir"
4965done
bd9b35c9 4966for thislib in $libswanted; do
13b3f787 4967 for thisdir in $libspath; do
f7dd4e7f
JH
4968 xxx=''
4969 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4970 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4971 $test -f "$xxx" && eval $libscheck
4972 $test -f "$xxx" && libstyle=shared
4973 fi
4974 if test ! -f "$xxx"; then
4975 xxx=$thisdir/lib$thislib.$so
4976 $test -f "$xxx" && eval $libscheck
4977 $test -f "$xxx" && libstyle=shared
613d6c3e 4978 fi
f7dd4e7f
JH
4979 if test ! -f "$xxx"; then
4980 xxx=$thisdir/lib$thislib$_a
4981 $test -f "$xxx" && eval $libscheck
4982 $test -f "$xxx" && libstyle=static
4983 fi
4984 if test ! -f "$xxx"; then
4985 xxx=$thisdir/$thislib$_a
4986 $test -f "$xxx" && eval $libscheck
4987 $test -f "$xxx" && libstyle=static
4988 fi
4989 if test ! -f "$xxx"; then
4990 xxx=$thisdir/lib${thislib}_s$_a
4991 $test -f "$xxx" && eval $libscheck
4992 $test -f "$xxx" && libstyle=static
09ea5ba9 4993 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4994 fi
4995 if test ! -f "$xxx"; then
4996 xxx=$thisdir/Slib$thislib$_a
4997 $test -f "$xxx" && eval $libscheck
4998 $test -f "$xxx" && libstyle=static
4999 fi
5000 if $test -f "$xxx"; then
43999f95 5001 case "$libstyle" in
f7dd4e7f
JH
5002 shared) echo "Found -l$thislib (shared)." ;;
5003 static) echo "Found -l$thislib." ;;
5004 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 5005 esac
bd9b35c9
JH
5006 case " $dflt " in
5007 *"-l$thislib "*);;
f7dd4e7f 5008 *) dflt="$dflt -l$thislib"
43999f95
JH
5009 libsfound="$libsfound $xxx"
5010 yyy=`basename $xxx`
5011 libsfiles="$libsfiles $yyy"
1e127011 5012 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
5013 case " $libsdirs " in
5014 *" $yyy "*) ;;
5015 *) libsdirs="$libsdirs $yyy" ;;
5016 esac
5017 ;;
bd9b35c9 5018 esac
f7dd4e7f 5019 break
613d6c3e 5020 fi
f7dd4e7f
JH
5021 done
5022 if $test ! -f "$xxx"; then
5023 echo "No -l$thislib."
bd9b35c9
JH
5024 fi
5025done
5026set X $dflt
5027shift
5028dflt="$*"
5029case "$libs" in
5030'') dflt="$dflt";;
5031*) dflt="$libs";;
5032esac
5033case "$dflt" in
5034' '|'') dflt='none';;
5035esac
4633a7c4 5036
bd9b35c9 5037$cat <<EOM
4633a7c4 5038
bd9b35c9
JH
5039In order to compile $package on your machine, a number of libraries
5040are usually needed. Include any other special libraries here as well.
5041Say "none" for none. The default list is almost always right.
8e07c86e 5042EOM
8e07c86e 5043
bd9b35c9
JH
5044echo " "
5045rp="What libraries to use?"
5046. ./myread
5047case "$ans" in
5048none) libs=' ';;
5049*) libs="$ans";;
5050esac
d71b2b6b 5051
bd9b35c9
JH
5052: determine optimization, if desired, or use for debug flag also
5053case "$optimize" in
5054' '|$undef) dflt='none';;
5055'') dflt='-O';;
5056*) dflt="$optimize";;
5057esac
5058$cat <<EOH
d71b2b6b 5059
bd9b35c9
JH
5060By default, $package compiles with the -O flag to use the optimizer.
5061Alternately, you might want to use the symbolic debugger, which uses
5062the -g flag (on traditional Unix systems). Either flag can be
5063specified here. To use neither flag, specify the word "none".
d71b2b6b 5064
bd9b35c9
JH
5065EOH
5066rp="What optimizer/debugger flag should be used?"
5067. ./myread
5068optimize="$ans"
5069case "$optimize" in
5070'none') optimize=" ";;
5071esac
5072
eaf812ae
MB
5073: Check what DEBUGGING is required from the command line
5074: -DEBUGGING or -DDEBUGGING or
5075: -DEBUGGING=both = -g + -DDEBUGGING
5076: -DEBUGGING=-g or -Doptimize=-g = -g
5077: -DEBUGGING=none or -UDEBUGGING =
5078: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5079case "$EBUGGING" in
5080'') ;;
5081*) DEBUGGING=$EBUGGING ;;
5082esac
5083
5084case "$DEBUGGING" in
5a7c70d6 5085-g|both|$define)
eaf812ae
MB
5086 case "$optimize" in
5087 *-g*) ;;
5088 *) optimize="$optimize -g" ;;
5089 esac ;;
5090none|$undef)
5091 case "$optimize" in
5092 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5093 shift
5094 optimize="$*"
5095 ;;
5096 esac ;;
5097esac
5098
bd9b35c9 5099dflt=''
eaf812ae
MB
5100case "$DEBUGGING" in
5101both|$define) dflt='-DDEBUGGING'
5102esac
5103
c34316b3
NC
5104: argument order is deliberate, as the flag will start with - which set could
5105: think is an option
6682be1c 5106checkccflag='check=$1; flag=$2; callback=$3;
c34316b3
NC
5107echo " ";
5108echo "Checking if your compiler accepts $flag" 2>&1;
5109echo "int main(void) { return 0; }" > gcctest.c;
04b62921 5110if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
c34316b3 5111 echo "Yes, it does." 2>&1;
580e570e 5112 if $test -s gcctest.out ; then
04b62921
MB
5113 echo "But your platform does not like it:";
5114 cat gcctest.out;
5115 else
5116 case "$ccflags" in
5117 *$check*)
5118 echo "Leaving current flags $ccflags alone." 2>&1
5119 ;;
5120 *) dflt="$dflt $flag";
5121 eval $callback
5122 ;;
5123 esac
5124 fi
c34316b3
NC
5125else
5126 echo "Nope, it does not, but that is ok." 2>&1;
5127fi
5128'
5129
bd9b35c9
JH
5130: We will not override a previous value, but we might want to
5131: augment a hint file
5132case "$hint" in
5133default|recommended)
5134 case "$gccversion" in
eaf812ae 5135 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5136 esac
eaf812ae
MB
5137 case "$optimize:$DEBUGGING" in
5138 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5139 esac
bd9b35c9 5140 case "$gccversion" in
580e570e 5141 2*) if $test -d /etc/conf/kconfig.d &&
bd9b35c9
JH
5142 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5143 then
00e89ad4 5144 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5145 dflt="$dflt -posix"
5146 fi
f0d04425 5147 ;;
bd9b35c9
JH
5148 esac
5149 case "$gccversion" in
5150 1*) ;;
5151 2.[0-8]*) ;;
c0bacbef 5152 ?*) set strict-aliasing -fno-strict-aliasing
c34316b3 5153 eval $checkccflag
f0d04425 5154 ;;
e5e20432 5155 esac
00e89ad4
AD
5156 # For gcc, adding -pipe speeds up compilations for some, but apparently
5157 # some assemblers can't read from stdin. (It also slows down compilations
5158 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5159 case "$gccversion" in
c34316b3
NC
5160 ?*) set pipe -pipe
5161 eval $checkccflag
00e89ad4
AD
5162 ;;
5163 esac
6682be1c
NC
5164
5165 # on x86_64 (at least) we require an extra library (libssp) in the
5166 # link command line. This library is not named, so I infer that it is
5167 # an implementation detail that may change. Hence the safest approach
5168 # is to add the flag to the flags passed to the compiler at link time,
5169 # as that way the compiler can do the right implementation dependant
5170 # thing. (NWC)
5171 case "$gccversion" in
8f68b0e6 5172 ?*) set stack-protector -fstack-protector
6682be1c
NC
5173 eval $checkccflag
5174 ;;
5175 esac
e5e20432
JH
5176 ;;
5177esac
5178
bd9b35c9
JH
5179case "$mips_type" in
5180*BSD*|'') inclwanted="$locincpth $usrinc";;
5181*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5182esac
5183for thisincl in $inclwanted; do
5184 if $test -d $thisincl; then
5185 if $test x$thisincl != x$usrinc; then
5186 case "$dflt" in
00e89ad4
AD
5187 *" -I$thisincl "*);;
5188 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5189 esac
5190 fi
5191 fi
5192done
40a7a20a 5193
bd9b35c9
JH
5194inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5195 xxx=true;
5196elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5197 xxx=true;
5198else
5199 xxx=false;
5200fi;
5201if $xxx; then
5202 case "$dflt" in
5203 *$2*);;
5204 *) dflt="$dflt -D$2";;
5205 esac;
5206fi'
40a7a20a 5207
bd9b35c9 5208set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5209
bd9b35c9
JH
5210case "$usesocks" in
5211$define)
5212 ccflags="$ccflags -DSOCKS"
5213 ;;
5214esac
40a7a20a 5215
bd9b35c9
JH
5216case "$hint" in
5217default|recommended) dflt="$ccflags $dflt" ;;
5218*) dflt="$ccflags";;
5219esac
40a7a20a 5220
bd9b35c9
JH
5221case "$dflt" in
5222''|' ') dflt=none;;
5223esac
422af00a 5224
bd9b35c9 5225$cat <<EOH
40a7a20a 5226
bd9b35c9
JH
5227Your C compiler may want other flags. For this question you should include
5228-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5229but you should NOT include libraries or ld flags like -lwhatever. If you
5230want $package to honor its debug switch, you should include -DDEBUGGING here.
5231Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5232
bd9b35c9 5233To use no flags, specify the word "none".
40a7a20a 5234
bd9b35c9
JH
5235EOH
5236set X $dflt
5237shift
5238dflt=${1+"$@"}
5239rp="Any additional cc flags?"
5240. ./myread
5241case "$ans" in
5242none) ccflags='';;
5243*) ccflags="$ans";;
5244esac
8e07c86e 5245
bd9b35c9 5246: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5247case "$cppflags" in
5248'') cppflags="$ccflags" ;;
5249*) cppflags="$cppflags $ccflags" ;;
5250esac
bd9b35c9
JH
5251case "$gccversion" in
52521*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5253esac
bd9b35c9
JH
5254case "$mips_type" in
5255'');;
5256*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5257esac
5258case "$cppflags" in
5259'');;
5260*)
5261 echo " "
5262 echo "Let me guess what the preprocessor flags are..." >&4
5263 set X $cppflags
5264 shift
5265 cppflags=''
5266 $cat >cpp.c <<'EOM'
5267#define BLURFL foo
8e07c86e 5268
bd9b35c9
JH
5269BLURFL xx LFRULB
5270EOM
5271 previous=''
5272 for flag in $*
5273 do
5274 case "$flag" in
5275 -*) ftry="$flag";;
5276 *) ftry="$previous $flag";;
5277 esac
5278 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5279 >cpp1.out 2>/dev/null && \
5280 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5281 >cpp2.out 2>/dev/null && \
5282 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5283 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5284 then
5285 cppflags="$cppflags $ftry"
5286 previous=''
5287 else
5288 previous="$flag"
5289 fi
5290 done
5291 set X $cppflags
5292 shift
5293 cppflags=${1+"$@"}
5294 case "$cppflags" in
5295 *-*) echo "They appear to be: $cppflags";;
5296 esac
5297 $rm -f cpp.c cpp?.out
2afac517 5298 ;;
5299esac
8e07c86e 5300
bd9b35c9
JH
5301: flags used in final linking phase
5302case "$ldflags" in
5303'') if ./venix; then
5304 dflt='-i -z'
10a23457 5305 else
bd9b35c9 5306 dflt=''
10a23457 5307 fi
bd9b35c9
JH
5308 case "$ccflags" in
5309 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5310 esac
bd9b35c9
JH
5311 ;;
5312*) dflt="$ldflags";;
5313esac
b2f871ed
AD
5314# See note above about -fstack-protector
5315case "$ccflags" in
5316*-fstack-protector*)
5317 case "$dflt" in
5318 *-fstack-protector*) ;; # Don't add it again
5319 *) dflt="$dflt -fstack-protector" ;;
5320 esac
5321 ;;
5322esac
bd9b35c9
JH
5323
5324: Try to guess additional flags to pick up local libraries.
5325for thislibdir in $libpth; do
5326 case " $loclibpth " in
5327 *" $thislibdir "*)
00e89ad4 5328 case "$dflt " in
bd9b35c9
JH
5329 *"-L$thislibdir "*) ;;
5330 *) dflt="$dflt -L$thislibdir" ;;
5331 esac
c4f23d77
AD
5332 ;;
5333 esac
bd9b35c9 5334done
c4f23d77 5335
bd9b35c9
JH
5336case "$dflt" in
5337'') dflt='none' ;;
5338esac
c4f23d77 5339
bd9b35c9
JH
5340$cat <<EOH
5341
5342Your C linker may need flags. For this question you should
5343include -L/whatever and any other flags used by the C linker, but you
5344should NOT include libraries like -lwhatever.
5345
5346Make sure you include the appropriate -L/path flags if your C linker
5347does not normally search all of the directories you specified above,
5348namely
5349 $libpth
5350To use no flags, specify the word "none".
5351
5352EOH
5353
5354rp="Any additional ld flags (NOT including libraries)?"
5355. ./myread
5356case "$ans" in
5357none) ldflags='';;
5358*) ldflags="$ans";;
5359esac
5360rmlist="$rmlist pdp11"
5361
5362: coherency check
5363echo " "
5364echo "Checking your choice of C compiler and flags for coherency..." >&4
5365$cat > try.c <<'EOF'
5366#include <stdio.h>
55954f19 5367int main() { printf("Ok\n"); return(0); }
bd9b35c9 5368EOF
7a282f6d 5369set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5370shift
5371$cat >try.msg <<'EOM'
5372I've tried to compile and run the following simple program:
5373
5374EOM
5375$cat try.c >> try.msg
5376
5377$cat >> try.msg <<EOM
5378
5379I used the command:
5380
5381 $*
5440bc8e 5382 $run ./try
bd9b35c9
JH
5383
5384and I got the following output:
5385
5386EOM
5387dflt=y
73614538 5388if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
613d6c3e 5389 if $sh -c "$run ./try " >>try.msg 2>&1; then
5440bc8e 5390 xxx=`$run ./try`
bd9b35c9
JH
5391 case "$xxx" in
5392 "Ok") dflt=n ;;
5393 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5394 case " $libs " in
5395 *" -lsfio "*)
5396 cat >> try.msg <<'EOQS'
5397If $libs contains -lsfio, and sfio is mis-configured, then it
5398sometimes (apparently) runs and exits with a 0 status, but with no
5399output! It may have to do with sfio's use of _exit vs. exit.
5400
5401EOQS
5402 rp="You have a big problem. Shall I abort Configure"
5403 dflt=y
5404 ;;
5405 esac
5406 ;;
5407 esac
5408 else
5409 echo "The program compiled OK, but exited with status $?." >>try.msg
5410 rp="You have a problem. Shall I abort Configure"
5411 dflt=y
5412 fi
5413else
5414 echo "I can't compile the test program." >>try.msg
5415 rp="You have a BIG problem. Shall I abort Configure"
5416 dflt=y
5417fi
5418case "$dflt" in
5419y)
5420 $cat try.msg >&4
5421 case "$knowitall" in
5422 '')
5423 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5424 ;;
bd9b35c9 5425 *) dflt=n;;
c4f23d77 5426 esac
bd9b35c9
JH
5427 echo " "
5428 . ./myread
5429 case "$ans" in
5430 n*|N*) ;;
5431 *) echo "Ok. Stopping Configure." >&4
5432 exit 1
c4f23d77
AD
5433 ;;
5434 esac
5435 ;;
bd9b35c9 5436n) echo "OK, that should do.";;
c4f23d77 5437esac
613d6c3e 5438$rm_try gcctest gcctest.out
c4f23d77 5439
bd9b35c9
JH
5440: define a shorthand compile call
5441compile='
5442mc_file=$1;
5443shift;
08593cf4
NC
5444case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5445echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5446exit 1;
5447fi;
5448esac;
08413ebc 5449$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5450: define a shorthand compile call for compilations that should be ok.
5451compile_ok='
5452mc_file=$1;
5453shift;
7a282f6d 5454$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5455
8dfa8df9
JH
5456: determine filename position in cpp output
5457echo " "
5458echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5459case "$osname" in
5460vos) testaccess=-e ;;
5461*) testaccess=-r ;;
5462esac
8dfa8df9
JH
5463echo '#include <stdio.h>' > foo.c
5464$cat >fieldn <<EOF
5465$startsh
5466$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5467$grep '^[ ]*#.*stdio\.h' | \
5468while read cline; do
5469 pos=1
5470 set \$cline
5471 while $test \$# -gt 0; do
a5a94ea5 5472 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5473 echo "\$pos"
5474 exit 0
5475 fi
5476 shift
5477 pos=\`expr \$pos + 1\`
5478 done
5479done
5480EOF
5481chmod +x fieldn
5482fieldn=`./fieldn`
5483$rm -f foo.c fieldn
5484case $fieldn in
5485'') pos='???';;
54861) pos=first;;
54872) pos=second;;
54883) pos=third;;
5489*) pos="${fieldn}th";;
5490esac
5491echo "Your cpp writes the filename in the $pos field of the line."
5492
3c728e00
JH
5493case "$osname" in
5494vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5495os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5496*) cppfilter='' ;;
5497esac
8dfa8df9
JH
5498: locate header file
5499$cat >findhdr <<EOF
5500$startsh
5501wanted=\$1
5502name=''
5503for usrincdir in $usrinc
5504do
5505 if test -f \$usrincdir/\$wanted; then
5506 echo "\$usrincdir/\$wanted"
5507 exit 0
5508 fi
5509done
5510awkprg='{ print \$$fieldn }'
5511echo "#include <\$wanted>" > foo\$\$.c
5512$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5513$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5514while read cline; do
5515 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5516 case "\$name" in
5517 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5518 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5519 *) exit 2;;
5520 esac;
5521done;
5522#
5523# status = 0: grep returned 0 lines, case statement not executed
5524# status = 1: headerfile found
5525# status = 2: while loop executed, no headerfile found
5526#
5527status=\$?
5528$rm -f foo\$\$.c;
5529if test \$status -eq 1; then
5530 exit 0;
5531fi
5532exit 1
5533EOF
5534chmod +x findhdr
5535
5536: define an alternate in-header-list? function
5537inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5538cont=true; xxf="echo \"<\$1> found.\" >&4";
5539case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5540*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5541esac;
5542case $# in 4) instead=instead;; *) instead="at last";; esac;
5543while $test "$cont"; do
5544 xxx=`./findhdr $1`
5545 var=$2; eval "was=\$$2";
5546 if $test "$xxx" && $test -r "$xxx";
5547 then eval $xxf;
5548 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5549 cont="";
5550 else eval $xxnf;
5551 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5552 set $yyy; shift; shift; yyy=$@;
5553 case $# in 0) cont="";;
5554 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5555 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5556 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5557 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5558 esac;
5559done;
5560while $test "$yyy";
5561do set $yyy; var=$2; eval "was=\$$2";
5562 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5563 set $yyy; shift; shift; yyy=$@;
5564done'
5565
d1daaddf
JH
5566: see if stdlib is available
5567set stdlib.h i_stdlib
5568eval $inhdr
5569
5570: check for lengths of integral types
5571echo " "
5572case "$intsize" in
5573'')
5574 echo "Checking to see how big your integers are..." >&4
c63dfae1 5575 $cat >try.c <<EOCP
d1daaddf
JH
5576#include <stdio.h>
5577#$i_stdlib I_STDLIB
5578#ifdef I_STDLIB
5579#include <stdlib.h>
5580#endif
5581int main()
5582{
5583 printf("intsize=%d;\n", (int)sizeof(int));
5584 printf("longsize=%d;\n", (int)sizeof(long));
5585 printf("shortsize=%d;\n", (int)sizeof(short));
5586 exit(0);
5587}
5588EOCP
5589 set try
5590 if eval $compile_ok && $run ./try > /dev/null; then
5591 eval `$run ./try`
5592 echo "Your integers are $intsize bytes long."
5593 echo "Your long integers are $longsize bytes long."
5594 echo "Your short integers are $shortsize bytes long."
5595 else
5596 $cat >&4 <<EOM
5597!
5598Help! I can't compile and run the intsize test program: please enlighten me!
5599(This is probably a misconfiguration in your system or libraries, and
5600you really ought to fix it. Still, I'll try anyway.)
5601!
5602EOM
5603 dflt=4
5604 rp="What is the size of an integer (in bytes)?"
5605 . ./myread
5606 intsize="$ans"
5607 dflt=$intsize
5608 rp="What is the size of a long integer (in bytes)?"
5609 . ./myread
5610 longsize="$ans"
5611 dflt=2
5612 rp="What is the size of a short integer (in bytes)?"
5613 . ./myread
5614 shortsize="$ans"
5615 fi
5616 ;;
5617esac
5b813a60 5618$rm_try
d1daaddf
JH
5619
5620: check for long long
5621echo " "
5622echo "Checking to see if you have long long..." >&4
5623echo 'int main() { long long x = 7; return 0; }' > try.c
5624set try
5625if eval $compile; then
5626 val="$define"
5627 echo "You have long long."
5628else
5629 val="$undef"
5630 echo "You do not have long long."
5631fi
5b813a60 5632$rm_try
d1daaddf
JH
5633set d_longlong
5634eval $setvar
5635
5636: check for length of long long
5637case "${d_longlong}${longlongsize}" in
5638$define)
5639 echo " "
5640 echo "Checking to see how big your long longs are..." >&4
5641 $cat >try.c <<'EOCP'
5642#include <stdio.h>
5643int main()
5644{
5645 printf("%d\n", (int)sizeof(long long));
5646 return(0);
5647}
5648EOCP
5649 set try
5650 if eval $compile_ok; then
5651 longlongsize=`$run ./try`
5652 echo "Your long longs are $longlongsize bytes long."
5653 else
5654 dflt='8'
5655 echo " "
5656 echo "(I can't seem to compile the test program. Guessing...)"
5657 rp="What is the size of a long long (in bytes)?"
5658 . ./myread
5659 longlongsize="$ans"
5660 fi
5661 if $test "X$longsize" = "X$longlongsize"; then
5662 echo "(That isn't any different from an ordinary long.)"
5b813a60 5663 fi
d1daaddf
JH
5664 ;;
5665esac
5b813a60 5666$rm_try
d1daaddf 5667
8dfa8df9
JH
5668: see if inttypes.h is available
5669: we want a real compile instead of Inhdr because some systems
5670: have an inttypes.h which includes non-existent headers
5671echo " "
5672$cat >try.c <<EOCP
5673#include <inttypes.h>
5674int main() {
5675 static int32_t foo32 = 0x12345678;
5676}
5677EOCP
5678set try
5679if eval $compile; then
5680 echo "<inttypes.h> found." >&4
5681 val="$define"
5682else
5683 echo "<inttypes.h> NOT found." >&4
5684 val="$undef"
5685fi
5b813a60 5686$rm_try
8dfa8df9
JH
5687set i_inttypes
5688eval $setvar
5689
5690: check for int64_t
5691echo " "
5692echo "Checking to see if you have int64_t..." >&4
5693$cat >try.c <<EOCP
5694#include <sys/types.h>
5695#$i_inttypes I_INTTYPES
5696#ifdef I_INTTYPES
5697#include <inttypes.h>
5698#endif
5699int main() { int64_t x = 7; }
5700EOCP
5701set try
5702if eval $compile; then
5703 val="$define"
5704 echo "You have int64_t."
5705else
5706 val="$undef"
5707 echo "You do not have int64_t."
5708fi
5b813a60 5709$rm_try
8dfa8df9
JH
5710set d_int64_t
5711eval $setvar
5712
613d6c3e 5713: Check if 64bit ints have a quad type
8dfa8df9
JH
5714echo " "
5715echo "Checking which 64-bit integer type we could use..." >&4
5716
5717case "$intsize" in
57188) val=int
5719 set quadtype
5720 eval $setvar
5721 val='"unsigned int"'
5722 set uquadtype
5723 eval $setvar
5724 quadkind=1
5725 ;;
5726*) case "$longsize" in
5727 8) val=long
5728 set quadtype
5729 eval $setvar
5730 val='"unsigned long"'
5731 set uquadtype
5732 eval $setvar
5733 quadkind=2
5734 ;;
5735 *) case "$d_longlong:$longlongsize" in
5736 define:8)
5737 val='"long long"'
5738 set quadtype
5739 eval $setvar
5740 val='"unsigned long long"'
5741 set uquadtype
5742 eval $setvar
5743 quadkind=3
5744 ;;
5745 *) case "$d_int64_t" in
5746 define)
5747 val=int64_t
5748 set quadtype
5749 eval $setvar
5750 val=uint64_t
5751 set uquadtype
5752 eval $setvar
5753 quadkind=4
5754 ;;
5755 esac
5756 ;;
5757 esac
5758 ;;
5759 esac
5760 ;;
5761esac
5762
5763case "$quadtype" in
5764'') echo "Alas, no 64-bit integer types in sight." >&4
5765 d_quad="$undef"
5766 ;;
5767*) echo "We could use '$quadtype' for 64-bit integers." >&4
5768 d_quad="$define"
5769 ;;
5770esac
5771
34f1896b 5772: Do we want 64bit support
b4eb6b3d
JH
5773case "$uselonglong" in
5774"$define"|true|[yY]*)
5775 cat <<EOM >&4
5776
5777*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5778EOM
5779 use64bitint="$define"
5780 ;;
613d6c3e 5781esac
b4eb6b3d
JH
5782case "$use64bits" in
5783"$define"|true|[yY]*)
5784 cat <<EOM >&4
5785
5786*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5787EOM
5788 use64bitint="$define"
5789 ;;
613d6c3e 5790esac
b4eb6b3d
JH
5791case "$use64bitints" in
5792"$define"|true|[yY]*)
5793 cat <<EOM >&4
5794
5795*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5796EOM
5797 use64bitint="$define"
5798 ;;
613d6c3e 5799esac
b4eb6b3d
JH
5800case "$use64bitsint" in
5801"$define"|true|[yY]*)
5802 cat <<EOM >&4
5803
5804*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5805EOM
5806 use64bitint="$define"
5807 ;;
613d6c3e 5808esac
b4eb6b3d
JH
5809case "$uselonglongs" in
5810"$define"|true|[yY]*)
5811 cat <<EOM >&4
5812
5813*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5814EOM
5815 use64bitint="$define"
5816 ;;
613d6c3e 5817esac
b4eb6b3d
JH
5818case "$use64bitsall" in
5819"$define"|true|[yY]*)
5820 cat <<EOM >&4
5821
5822*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5823EOM
5824 use64bitall="$define"
5825 ;;
613d6c3e 5826esac
b4eb6b3d
JH
5827
5828case "$ccflags" in
5829*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5830esac
5831case "$use64bitall" in
5832"$define"|true|[yY]*) use64bitint="$define" ;;
5833esac
5834
5835case "$longsize" in
58368) cat <<EOM
5837
5838You have natively 64-bit long integers.
5839EOM
5840 val="$define"
5841 ;;
5842*) case "$use64bitint" in
5843 "$define"|true|[yY]*) dflt='y';;
5844 *) dflt='n';;
5845 esac
8dfa8df9
JH
5846 case "$d_quad" in
5847 "$define") ;;
5848 *) dflt='n' ;;
5849 esac
b4eb6b3d
JH
5850 cat <<EOM
5851
5852Perl can be built to take advantage of 64-bit integer types
5853on some systems. To do so, Configure can be run with -Duse64bitint.
5854Choosing this option will most probably introduce binary incompatibilities.
5855
5856If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5857(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5858EOM
5859 rp='Try to use 64-bit integers, if available?'
5860 . ./myread
5861 case "$ans" in
5862 [yY]*) val="$define" ;;
5863 *) val="$undef" ;;
5864 esac
5865 ;;
5866esac
5867set use64bitint
5868eval $setvar
5869
5870case "$use64bitall" in
5871"$define"|true|[yY]*) dflt='y' ;;
5872*) case "$longsize" in
5873 8) dflt='y' ;;
5874 *) dflt='n' ;;
5875 esac
5876 ;;
613d6c3e 5877esac
b4eb6b3d
JH
5878cat <<EOM
5879
5880You may also choose to try maximal 64-bitness. It means using as much
588164-bitness as possible on the platform. This in turn means even more
5882binary incompatibilities. On the other hand, your platform may not
5883have any more 64-bitness available than what you already have chosen.
5884
5885If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5886(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5887EOM
5888rp='Try to use maximal 64-bit support, if available?'
5889. ./myread
5890case "$ans" in
5891[yY]*) val="$define" ;;
5892*) val="$undef" ;;
5893esac
5894set use64bitall
5895eval $setvar
5896case "$use64bitall" in
5897"$define")
5898 case "$use64bitint" in
5899 "$undef")
5900 cat <<EOM
5901
5902Since you have chosen a maximally 64-bit build, I'm also turning on
5903the use of 64-bit integers.
5904EOM
5905 use64bitint="$define" ;;
5906 esac
5907 ;;
5908esac
5909
b4eb6b3d
JH
5910: Look for a hint-file generated 'call-back-unit'. If the
5911: user has specified that a 64-bit perl is to be built,
5912: we may need to set or change some other defaults.
19a100ff 5913if $test -f use64bitint.cbu; then
9da7673b 5914 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5915 . ./use64bitint.cbu
5916fi
9da7673b
MB
5917case "$use64bitint" in
5918"$define"|true|[yY]*)
b4eb6b3d
JH
5919 case "$longsize" in
5920 4) case "$archname64" in
5921 '') archname64=64int ;;
5922 esac
5923 ;;
5924 esac
5925 ;;
5926esac
5927
b4eb6b3d
JH
5928: Look for a hint-file generated 'call-back-unit'. If the
5929: user has specified that a maximally 64-bit perl is to be built,
5930: we may need to set or change some other defaults.
19a100ff 5931if $test -f use64bitall.cbu; then
9da7673b 5932 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5933 . ./use64bitall.cbu
5934fi
9da7673b
MB
5935case "$use64bitall" in
5936"$define"|true|[yY]*)
b4eb6b3d
JH
5937 case "$longsize" in
5938 4) case "$archname64" in
5939 ''|64int) archname64=64all ;;
5940 esac
5941 ;;
5942 esac
5943 ;;
5944esac
5945
1911a026
JH
5946case "$d_quad:$use64bitint" in
5947$undef:$define)
5948 cat >&4 <<EOF
5949
5950*** You have chosen to use 64-bit integers,
19a100ff 5951*** but none can be found.
09b58c7b 5952*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5953*** Cannot continue, aborting.
5954
5955EOF
5956 exit 1
5957 ;;
5958esac
5959
36adc09b
JH
5960: check for length of double
5961echo " "
5962case "$doublesize" in
5963'')
5964 echo "Checking to see how big your double precision numbers are..." >&4
5965 $cat >try.c <<EOCP
5966#include <stdio.h>
1911a026
JH
5967#$i_stdlib I_STDLIB
5968#ifdef I_STDLIB
5969#include <stdlib.h>
5970#endif
36adc09b
JH
5971int main()
5972{
5973 printf("%d\n", (int)sizeof(double));
1911a026 5974 exit(0);
36adc09b
JH
5975}
5976EOCP
5977 set try
5978 if eval $compile_ok; then
5979 doublesize=`$run ./try`
5980 echo "Your double is $doublesize bytes long."
5981 else
5982 dflt='8'
5983 echo "(I can't seem to compile the test program. Guessing...)"
5984 rp="What is the size of a double precision number (in bytes)?"
5985 . ./myread
5986 doublesize="$ans"
5987 fi
5988 ;;
5989esac
5b813a60 5990$rm_try
36adc09b
JH
5991
5992: check for long doubles
5993echo " "
5994echo "Checking to see if you have long double..." >&4
5995echo 'int main() { long double x = 7.0; }' > try.c
5996set try
5997if eval $compile; then
5998 val="$define"
5999 echo "You have long double."
6000else
6001 val="$undef"
6002 echo "You do not have long double."
6003fi
5b813a60 6004$rm_try
36adc09b
JH
6005set d_longdbl
6006eval $setvar
6007
6008: check for length of long double
6009case "${d_longdbl}${longdblsize}" in
6010$define)
6011 echo " "
6012 echo "Checking to see how big your long doubles are..." >&4
6013 $cat >try.c <<'EOCP'
6014#include <stdio.h>
6015int main()
6016{
6017 printf("%d\n", sizeof(long double));
6018}
6019EOCP
6020 set try
6021 set try
6022 if eval $compile; then
6023 longdblsize=`$run ./try`
6024 echo "Your long doubles are $longdblsize bytes long."
6025 else
6026 dflt='8'
6027 echo " "
6028 echo "(I can't seem to compile the test program. Guessing...)" >&4
6029 rp="What is the size of a long double (in bytes)?"
6030 . ./myread
6031 longdblsize="$ans"
6032 fi
6033 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
6034 echo "That isn't any different from an ordinary double."
6035 echo "I'll keep your setting anyway, but you may see some"
6036 echo "harmless compilation warnings."
5b813a60 6037 fi
36adc09b
JH
6038 ;;
6039esac
5b813a60 6040$rm_try
36adc09b 6041
89ce900e 6042: determine the architecture name
b4eb6b3d 6043echo " "
89ce900e
JH
6044if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6045 tarch=`arch`"-$osname"
6046elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6047 if uname -m > tmparch 2>&1 ; then
6048 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6049 -e 's/$/'"-$osname/" tmparch`
6050 else
6051 tarch="$osname"
6052 fi
6053 $rm -f tmparch
b4eb6b3d 6054else
89ce900e 6055 tarch="$osname"
b4eb6b3d 6056fi
89ce900e
JH
6057case "$myarchname" in
6058''|"$tarch") ;;
6059*)
6060 echo "(Your architecture name used to be $myarchname.)"
6061 archname=''
6062 ;;
6063esac
6064case "$targetarch" in
6065'') ;;
6066*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6067esac
6068myarchname="$tarch"
6069case "$archname" in
6070'') dflt="$tarch";;
6071*) dflt="$archname";;
6072esac
6073rp='What is your architecture name'
6074. ./myread
6075archname="$ans"
6076case "$usethreads" in
6077$define)
6078 echo "Threads selected." >&4
6079 case "$archname" in
6080 *-thread*) echo "...and architecture name already has -thread." >&4
6081 ;;
6082 *) archname="$archname-thread"
6083 echo "...setting architecture name to $archname." >&4
6084 ;;
6085 esac
6086 ;;
6087esac
6088case "$usemultiplicity" in
6089$define)
6090 echo "Multiplicity selected." >&4
6091 case "$archname" in
6092 *-multi*) echo "...and architecture name already has -multi." >&4
6093 ;;
6094 *) archname="$archname-multi"
6095 echo "...setting architecture name to $archname." >&4
6096 ;;
6097 esac
6098 ;;
6099esac
6100case "$use64bitint$use64bitall" in
6101*"$define"*)
6102 case "$archname64" in
6103 '')
6104 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6105 ;;
89ce900e
JH
6106 *)
6107 case "$use64bitint" in
6108 "$define") echo "64 bit integers selected." >&4 ;;
6109 esac
6110 case "$use64bitall" in
6111 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6112 esac
6113 case "$archname" in
6114 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6115 ;;
6116 *) archname="$archname-$archname64"
6117 echo "...setting architecture name to $archname." >&4
6118 ;;
6119 esac
c1a7f87b
JH
6120 ;;
6121 esac
89ce900e
JH
6122esac
6123case "$uselongdouble" in
6124$define)
6125 echo "Long doubles selected." >&4
6126 case "$longdblsize" in
6127 $doublesize)
6128 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6129 ;;
6130 *)
6131 case "$archname" in
6132 *-ld*) echo "...and architecture name already has -ld." >&4
6133 ;;
6134 *) archname="$archname-ld"
6135 echo "...setting architecture name to $archname." >&4
6136 ;;
6137 esac
bd9b35c9
JH
6138 ;;
6139 esac
bd9b35c9 6140 ;;
89ce900e
JH
6141esac
6142case "$useperlio" in
6143$define)
6144 echo "Perlio selected." >&4
6145 ;;
bd9b35c9 6146*)
89ce900e
JH
6147 echo "Perlio not selected, using stdio." >&4
6148 case "$archname" in
6149 *-stdio*) echo "...and architecture name already has -stdio." >&4
6150 ;;
6151 *) archname="$archname-stdio"
6152 echo "...setting architecture name to $archname." >&4
6153 ;;
6154 esac
bd9b35c9
JH
6155 ;;
6156esac
d2e0c6f7
JH
6157if $test -f archname.cbu; then
6158 echo "Your platform has some specific hints for architecture name, using them..."
6159 . ./archname.cbu
6160fi
bd9b35c9 6161
b4eb6b3d
JH
6162: set the prefixit variable, to compute a suitable default value
6163prefixit='case "$3" in
6164""|none)
6165 case "$oldprefix" in
6166 "") eval "$1=\"\$$2\"";;
6167 *)
6168 case "$3" in
6169 "") eval "$1=";;
6170 none)
6171 eval "tp=\"\$$2\"";
6172 case "$tp" in
6173 ""|" ") eval "$1=\"\$$2\"";;
6174 *) eval "$1=";;
6175 esac;;
6176 esac;;
6177 esac;;
6178*)
6179 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6180 case "$tp" in
6181 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6182 /*-$oldprefix/*|\~*-$oldprefix/*)
6183 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6184 *) eval "$1=\"\$$2\"";;
6185 esac;;
6186esac'
6187
f3f1a2d8
MB
6188: determine installation style
6189: For now, try to deduce it from prefix unless it is already set.
6190: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6191case "$installstyle" in
6192'') case "$prefix" in
6193 *perl*) dflt='lib';;
6194 *) dflt='lib/perl5' ;;
6195 esac
6196 ;;
6197*) dflt="$installstyle" ;;
4d20abad 6198esac
f3f1a2d8
MB
6199: Probably not worth prompting for this since we prompt for all
6200: the directories individually, and the prompt would be too long and
6201: confusing anyway.
6202installstyle=$dflt
4d20abad 6203
eaf812ae
MB
6204: determine where public executables go
6205echo " "
6206set dflt bin bin
6207eval $prefixit
6208fn=d~
6209rp='Pathname where the public executables will reside?'
6210. ./getfile
6211if $test "X$ansexp" != "X$binexp"; then
6212 installbin=''
6213fi
6214prefixvar=bin
6215: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6216: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6217: this via initialinstalllocation
eaf812ae
MB
6218. ./setprefixvar
6219
6220case "$userelocatableinc" in
6221$define|true|[yY]*) dflt='y' ;;
6222*) dflt='n' ;;
6223esac
6224cat <<EOM
6225
6226Would you like to build Perl so that the installation is relocatable, so that
6227library paths in @INC are determined relative to the path of the perl binary?
6228This is not advised for system Perl installs, or if you need to run setid
6229scripts or scripts under taint mode.
6230
6231If this doesn't make any sense to you, just accept the default '$dflt'.
6232EOM
6233rp='Use relocatable @INC?'
6234. ./myread
6235case "$ans" in
6236y|Y) val="$define" ;;
6237*) val="$undef" ;;
6238esac
6239set userelocatableinc
6240eval $setvar
6241
ea7d701d 6242initialinstalllocation="$binexp"
eaf812ae
MB
6243: Default prefix is now "up one level from where the binaries are"
6244case "$userelocatableinc" in
6245$define|true|[yY]*)
eaf812ae
MB
6246 bin=".../"
6247 binexp=".../"
6248 prefix=".../.."
6249 prefixexp=".../.."
6250 installprefixexp=".../.."
6251 ;;
6252esac
6253
b4eb6b3d
JH
6254: determine where private library files go
6255: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6256: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6257: /opt/perl/lib/perl5... would be redundant.
6258: The default "style" setting is made in installstyle.U
6259case "$installstyle" in
6260*lib/perl5*) set dflt privlib lib/$package/$version ;;
6261*) set dflt privlib lib/$version ;;
6262esac
6263eval $prefixit
6264$cat <<EOM
6265
6266There are some auxiliary files for $package that need to be put into a
6267private library directory that is accessible by everyone.
6268
6269EOM
eaf812ae 6270fn=$binexp
b4eb6b3d
JH
6271fn=d~+
6272rp='Pathname where the private library files will reside?'
6273. ./getfile
79522dd2
NC
6274prefixvar=privlib
6275. ./setprefixvar
b4eb6b3d
JH
6276
6277: set the prefixup variable, to restore leading tilda escape
6278prefixup='case "$prefixexp" in
6279"$prefix") ;;
6280*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6281esac'
6282
6283: determine where public architecture dependent libraries go
6284set archlib archlib
6285eval $prefixit
6286: privlib default is /usr/local/lib/$package/$version
6287: archlib default is /usr/local/lib/$package/$version/$archname
6288: privlib may have an optional trailing /share.
6289tdflt=`echo $privlib | $sed 's,/share$,,'`
6290tdflt=$tdflt/$archname
6291case "$archlib" in
6292'') dflt=$tdflt
6293 ;;
6294*) dflt="$archlib"
6295 ;;
6296esac
6297$cat <<EOM
6298
6299$spackage contains architecture-dependent library files. If you are
6300sharing libraries in a heterogeneous environment, you might store
6301these files in a separate location. Otherwise, you can just include
6302them with the rest of the public library files.
6303
6304EOM
eaf812ae 6305fn=$binexp
b4eb6b3d
JH
6306fn=d+~
6307rp='Where do you want to put the public architecture-dependent libraries?'
6308. ./getfile
79522dd2
NC
6309prefixvar=archlib
6310. ./setprefixvar
b4eb6b3d
JH
6311if $test X"$archlib" = X"$privlib"; then
6312 d_archlib="$undef"
6313else
6314 d_archlib="$define"
6315fi
b4eb6b3d 6316
b4eb6b3d
JH
6317: see if setuid scripts can be secure
6318$cat <<EOM
6319
6320Some kernels have a bug that prevents setuid #! scripts from being
6321secure. Some sites have disabled setuid #! scripts because of this.
6322
6323First let's decide if your kernel supports secure setuid #! scripts.
6324(If setuid #! scripts would be secure but have been disabled anyway,
6325don't say that they are secure if asked.)
6326
6327EOM
6328
6329val="$undef"
6330if $test -d /dev/fd; then
6331 echo "#!$ls" >reflect
6332 chmod +x,u+s reflect
6333 ./reflect >flect 2>&1
6334 if $contains "/dev/fd" flect >/dev/null; then
6335 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6336 val="$define"
6337 else
6338 $cat <<EOM
6339If you are not sure if they are secure, I can check but I'll need a
6340username and password different from the one you are using right now.
6341If you don't have such a username or don't want me to test, simply
6342enter 'none'.
6343
6344EOM
6345 rp='Other username to test security of setuid scripts with?'
6346 dflt='none'
6347 . ./myread
6348 case "$ans" in
6349 n|none)
6350 case "$d_suidsafe" in
6351 '') echo "I'll assume setuid scripts are *not* secure." >&4
6352 dflt=n;;
6353 "$undef")
6354 echo "Well, the $hint value is *not* secure." >&4
6355 dflt=n;;
6356 *) echo "Well, the $hint value *is* secure." >&4
6357 dflt=y;;
6358 esac
c1a7f87b 6359 ;;
b4eb6b3d
JH
6360 *)
6361 $rm -f reflect flect
6362 echo "#!$ls" >reflect
6363 chmod +x,u+s reflect
6364 echo >flect
6365 chmod a+w flect
6366 echo '"su" will (probably) prompt you for '"$ans's password."
6367 su $ans -c './reflect >flect'
6368 if $contains "/dev/fd" flect >/dev/null; then
6369 echo "Okay, it looks like setuid scripts are secure." >&4
6370 dflt=y
6371 else
6372 echo "I don't think setuid scripts are secure." >&4
6373 dflt=n
6374 fi
6375 ;;
6376 esac
6377 rp='Does your kernel have *secure* setuid scripts?'
6378 . ./myread
6379 case "$ans" in
6380 [yY]*) val="$define";;
6381 *) val="$undef";;
6382 esac
6383 fi
6384else
6385 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6386 echo "(That's for file descriptors, not floppy disks.)"
6387 val="$undef"
6388fi
6389set d_suidsafe
6390eval $setvar
6391
6392$rm -f reflect flect
6393
6394: now see if they want to do setuid emulation
01614441 6395if $test $patchlevel -lt 11; then
b4eb6b3d
JH
6396echo " "
6397val="$undef"
6398case "$d_suidsafe" in
6399"$define")
6400 val="$undef"
3c728e00 6401 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6402 ;;
f3f1a2d8
MB
6403*)
6404 $cat <<EOM
6405Some systems have disabled setuid scripts, especially systems where
6406setuid scripts cannot be secure. On systems where setuid scripts have
6407been disabled, the setuid/setgid bits on scripts are currently
6408useless. It is possible for $package to detect those bits and emulate
6409setuid/setgid in a secure fashion. This emulation will only work if
6410setuid scripts have been disabled in your kernel.
6411
6412EOM
6413 case "$d_dosuid" in
6414 "$define") dflt=y ;;
6415 *) dflt=n ;;
6416 esac
6417 rp="Do you want to do setuid/setgid emulation?"
6418 . ./myread
6419 case "$ans" in
6420 [yY]*) val="$define";;
6421 *) val="$undef";;
6422 esac
6423 ;;
6424esac
6425set d_dosuid
6426eval $setvar
01614441
MB
6427else
6428 case "$d_dosuid" in
6429 "$define")
6430 cat >&4 <<EOH
6431
6432SUID emulation has been removed for 5.12
6433Please re-run Configure without -Dd_dosuid
6434
6435EOH
6436 exit 1;
6437 ;;
6438 esac
6439 d_dosuid=undef
6440fi
f3f1a2d8 6441
f3f1a2d8
MB
6442: Find perl5.005 or later.
6443echo "Looking for a previously installed perl5.005 or later... "
6444case "$perl5" in
6445'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6446 : Check if this perl is recent and can load a simple module
6447 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6448 perl5=$tdir/perl
6449 break;
6450 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6451 perl5=$tdir/perl5
6452 break;
6453 fi
6454 done
6455 ;;
6456*) perl5="$perl5"
6457 ;;
6458esac
6459case "$perl5" in
6460'') echo "None found. That's ok.";;
6461*) echo "Using $perl5." ;;
6462esac
6463
613d6c3e 6464: Set the siteprefix variables
f3f1a2d8
MB
6465$cat <<EOM
6466
6467After $package is installed, you may wish to install various
6468add-on modules and utilities. Typically, these add-ons will
6469be installed under $prefix with the rest
6470of this package. However, you may wish to install such add-ons
6471elsewhere under a different prefix.
6472
6473If you do not wish to put everything under a single prefix, that's
6474ok. You will be prompted for the individual locations; this siteprefix
6475is only used to suggest the defaults.
6476
6477The default should be fine for most people.
6478
6479EOM
6480fn=d~+
6481rp='Installation prefix to use for add-on modules and utilities?'
6482: XXX Here might be another good place for an installstyle setting.
6483case "$siteprefix" in
6484'') dflt=$prefix ;;
6485*) dflt=$siteprefix ;;
6486esac
6487. ./getfile
6488: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6489oldsiteprefix=''
6490case "$siteprefix" in
6491'') ;;
6492*) case "$ans" in
6493 "$prefix") ;;
6494 *) oldsiteprefix="$prefix";;
6495 esac
6496 ;;
6497esac
6498siteprefix="$ans"
6499siteprefixexp="$ansexp"
6500
6501: determine where site specific libraries go.
6502: Usual default is /usr/local/lib/perl5/site_perl/$version
6503: The default "style" setting is made in installstyle.U
6504: XXX No longer works with Prefixit stuff.
6505prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6506case "$sitelib" in
6507'') case "$installstyle" in
6508 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6509 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6510 esac
6511 ;;
6512*) dflt="$sitelib"
6513 ;;
6514esac
6515$cat <<EOM
6516
6517The installation process will create a directory for
6518site-specific extensions and modules. Most users find it convenient
6519to place all site-specific files in this directory rather than in the
6520main distribution directory.
6521
6522EOM
6523fn=d~+
6524rp='Pathname for the site-specific library files?'
6525. ./getfile
6526prefixvar=sitelib
6527. ./setprefixvar
6528sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6529
6530: Determine list of previous versions to include in @INC
6531$cat > getverlist <<EOPL
6532#!$perl5 -w
6533use File::Basename;
6534\$api_versionstring = "$api_versionstring";
6535\$version = "$version";
6536\$stem = "$sitelib_stem";
6537\$archname = "$archname";
6538EOPL
6539 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6540# The list found is store twice for each entry: the original name, and
6541# the binary broken down version as pack "sss", so sorting is easy and
6542# unambiguous. This will work for all versions that have a maximum of
6543# three digit groups, separate by '.'s or '_'s. Names are extended with
6544# ".0.0" to ensure at least three elements for the pack.
6545# -- H.Merijn Brand (m)'06 23-10-2006
6546
f3f1a2d8
MB
6547# Can't have leading @ because metaconfig interprets it as a command!
6548;@inc_version_list=();
6549# XXX Redo to do opendir/readdir?
6550if (-d $stem) {
6551 chdir($stem);
13cfc98d
MB
6552 ;@candidates = map {
6553 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
a71f1801 6554 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
f3f1a2d8
MB
6555}
6556else {
6557 ;@candidates = ();
6558}
6559
13cfc98d
MB
6560($pversion, $aversion, $vsn5005) = map {
6561 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6562foreach $d (@candidates) {
13cfc98d
MB
6563 if ($d->[1] lt $pversion) {
6564 if ($d->[1] ge $aversion) {
6565 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6566 }
13cfc98d
MB
6567 elsif ($d->[1] ge $vsn5005) {
6568 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6569 }
6570 }
6571 else {
6572 # Skip newer version. I.e. don't look in
6573 # 5.7.0 if we're installing 5.6.1.
6574 }
6575}
6576
6577if (@inc_version_list) {
6578 print join(' ', @inc_version_list);
6579}
6580else {
6581 # Blank space to preserve value for next Configure run.
6582 print " ";
6583}
6584EOPL
6585chmod +x getverlist
6586case "$inc_version_list" in
6587'') if test -x "$perl5$exe_ext"; then
6588 dflt=`$perl5 getverlist`
6589 else
6590 dflt='none'
6591 fi
6592 ;;
6593$undef) dflt='none' ;;
6594*) eval dflt=\"$inc_version_list\" ;;
6595esac
6596case "$dflt" in
6597''|' ') dflt=none ;;
6598esac
6599case "$dflt" in
66005.005) dflt=none ;;
6601esac
6602$cat <<EOM
6603
6604In order to ease the process of upgrading, this version of perl
6605can be configured to use modules built and installed with earlier
6606versions of perl that were installed under $prefix. Specify here
6607the list of earlier versions that this version of perl should check.
6608If Configure detected no earlier versions of perl installed under
6609$prefix, then the list will be empty. Answer 'none' to tell perl
6610to not search earlier versions.
b4eb6b3d 6611
f3f1a2d8
MB
6612The default should almost always be sensible, so if you're not sure,
6613just accept the default.
b4eb6b3d 6614EOM
f3f1a2d8
MB
6615
6616rp='List of earlier versions to include in @INC?'
6617. ./myread
6618case "$ans" in
6619[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6620*) inc_version_list="$ans" ;;
6621esac
6622case "$inc_version_list" in
6623''|' ')
6624 inc_version_list_init='0'
6625 d_inc_version_list="$undef"
6626 ;;
6627*) inc_version_list_init=`echo $inc_version_list |
6628 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6629 d_inc_version_list="$define"
b4eb6b3d
JH
6630 ;;
6631esac
f3f1a2d8 6632$rm -f getverlist
b4eb6b3d 6633
1cd66f7c
DD
6634: see if malloc/malloc.h has to be included
6635set malloc/malloc.h i_mallocmalloc
6636eval $inhdr
6637
b4eb6b3d 6638: see if this is a malloc.h system
01d07975
YST
6639: we want a real compile instead of Inhdr because some systems have a
6640: malloc.h that just gives a compile error saying to use stdlib.h instead
6641echo " "
6642$cat >try.c <<EOCP
6643#include <stdlib.h>
6644#include <malloc.h>
f25eda10 6645#$i_mallocmalloc I_MALLOCMALLOC
1cd66f7c
DD
6646#ifdef I_MALLOCMALLOC
6647# include <malloc/malloc.h>
6648#endif
6649
01d07975
YST
6650int main () { return 0; }
6651EOCP
6652set try
6653if eval $compile; then
6654 echo "<malloc.h> found." >&4
6655 val="$define"
6656else
6657 echo "<malloc.h> NOT found." >&4
6658 val="$undef"
6659fi
5b813a60 6660$rm_try
01d07975
YST
6661set i_malloc
6662eval $setvar
b4eb6b3d 6663
c8b93cf9
JH
6664: check for void type
6665echo " "
6666echo "Checking to see how well your C compiler groks the void type..." >&4
6667case "$voidflags" in
6668'')
c727eafa 6669 $cat >try.c <<EOCP
d1daaddf
JH
6670#$i_stdlib I_STDLIB
6671#ifdef I_STDLIB
6672#include <stdlib.h>
6673#endif
c8b93cf9
JH
6674#if TRY & 1
6675void sub() {
6676#else
6677sub() {
6678#endif
6679 extern void moo(); /* function returning void */
6680 void (*goo)(); /* ptr to func returning void */
6681#if TRY & 8
6682 void *hue; /* generic ptr */
6683#endif
6684#if TRY & 2
6685 void (*foo[10])();
6686#endif
6687
6688#if TRY & 4
6689 if(goo == moo) {
6690 exit(0);
6691 }
6692#endif
6693 exit(0);
6694}
6695int main() { sub(); }
6696EOCP
6697 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6698 voidflags=$defvoidused
6699 echo "Good. It appears to support void to the level $package wants.">&4
6700 if $contains warning .out >/dev/null 2>&1; then
6701 echo "However, you might get some warnings that look like this:"
6702 $cat .out
6703 fi
6704 else
6705echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6706 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6707 echo "It supports 1..."
6708 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6709 echo "It also supports 2..."
6710 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6711 voidflags=7
6712 echo "And it supports 4 but not 8 definitely."
6713 else
6714 echo "It doesn't support 4..."
6715 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6716 voidflags=11
6717 echo "But it supports 8."
6718 else
6719 voidflags=3
6720 echo "Neither does it support 8."
6721 fi
6722 fi
6723 else
6724 echo "It does not support 2..."
6725 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6726 voidflags=13
6727 echo "But it supports 4 and 8."
6728 else
6729 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6730 voidflags=5
6731 echo "And it supports 4 but has not heard about 8."
6732 else
6733 echo "However it supports 8 but not 4."
6734 fi
6735 fi
6736 fi
6737 else
6738 echo "There is no support at all for void."
6739 voidflags=0
6740 fi
6741 fi
6742esac
6743case "$voidflags" in
6744"$defvoidused") ;;
6745*) $cat >&4 <<'EOM'
6746 Support flag bits are:
6747 1: basic void declarations.
6748 2: arrays of pointers to functions returning void.
6749 4: operations between pointers to and addresses of void functions.
6750 8: generic void pointers.
6751EOM
6752 dflt="$voidflags";
6753 rp="Your void support flags add up to what?"
6754 . ./myread
6755 voidflags="$ans"
6756 ;;
6757esac
5b813a60 6758$rm_try
c8b93cf9
JH
6759
6760: check for length of pointer
6761echo " "
6762case "$ptrsize" in
6763'')
6764 echo "Checking to see how big your pointers are..." >&4
6765 if test "$voidflags" -gt 7; then
6766 echo '#define VOID_PTR char *' > try.c
6767 else
6768 echo '#define VOID_PTR void *' > try.c
6769 fi
74d00865 6770 $cat >>try.c <<EOCP
c8b93cf9 6771#include <stdio.h>
d1daaddf
JH
6772#$i_stdlib I_STDLIB
6773#ifdef I_STDLIB
6774#include <stdlib.h>
6775#endif
c8b93cf9
JH
6776int main()
6777{
6778 printf("%d\n", (int)sizeof(VOID_PTR));
6779 exit(0);
6780}
6781EOCP
6782 set try
6783 if eval $compile_ok; then
6784 ptrsize=`$run ./try`
6785 echo "Your pointers are $ptrsize bytes long."
6786 else
6787 dflt='4'
6788 echo "(I can't seem to compile the test program. Guessing...)" >&4
6789 rp="What is the size of a pointer (in bytes)?"
6790 . ./myread
6791 ptrsize="$ans"
6792 fi
6793 ;;
6794esac
5b813a60 6795$rm_try
c8b93cf9
JH
6796case "$use64bitall" in
6797"$define"|true|[yY]*)
6798 case "$ptrsize" in
6799 4) cat <<EOM >&4
6800
1911a026
JH
6801*** You have chosen a maximally 64-bit build,
6802*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6803*** Please rerun Configure without -Duse64bitall.
6804EOM
6805 case "$d_quad" in
6806 define)
6807 cat <<EOM >&4
6808*** Since you have quads, you could possibly try with -Duse64bitint.
6809EOM
6810 ;;
6811 esac
6812 cat <<EOM >&4
1911a026 6813*** Cannot continue, aborting.
c8b93cf9
JH
6814
6815EOM
09b58c7b 6816
1911a026 6817 exit 1
c8b93cf9
JH
6818 ;;
6819 esac
6820 ;;
6821esac
6822
19a100ff 6823
9df442c2
NC
6824: determine whether to use malloc wrapping
6825echo " "
6826case "$usemallocwrap" in
6827[yY]*|true|$define) dflt='y' ;;
6828[nN]*|false|$undef) dflt='n' ;;
6829*) case "$usedevel" in
6830 [yY]*|true|$define) dflt='y' ;;
6831 *) dflt='n' ;;
6832 esac
6833 ;;
6834esac
6835rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6836. ./myread
6837usemallocwrap="$ans"
6838case "$ans" in
6839y*|true)
6840 usemallocwrap="$define" ;;
6841*)
6842 usemallocwrap="$undef" ;;
6843esac
c8b93cf9 6844
b4eb6b3d
JH
6845: determine which malloc to compile in
6846echo " "
6847case "$usemymalloc" in
c4163172
JH
6848[yY]*|true|$define) dflt='y' ;;
6849[nN]*|false|$undef) dflt='n' ;;
6850*) case "$ptrsize" in
6851 4) dflt='y' ;;
6852 *) dflt='n' ;;
6853 esac
6854 ;;
8dfa8df9 6855esac
b4eb6b3d
JH
6856rp="Do you wish to attempt to use the malloc that comes with $package?"
6857. ./myread
6858usemymalloc="$ans"
6859case "$ans" in
6860y*|true)
6861 usemymalloc='y'
6862 mallocsrc='malloc.c'
6863 mallocobj="malloc$_o"
6864 d_mymalloc="$define"
6865 case "$libs" in
6866 *-lmalloc*)
6867 : Remove malloc from list of libraries to use
6868 echo "Removing unneeded -lmalloc from library list" >&4
6869 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6870 shift
6871 libs="$*"
6872 echo "libs = $libs" >&4
6873 ;;
6874 esac
6875 ;;
6876*)
6877 usemymalloc='n'
6878 mallocsrc=''
6879 mallocobj=''
6880 d_mymalloc="$undef"
6881 ;;
6882esac
6883
6884: compute the return types of malloc and free
6885echo " "
6886$cat >malloc.c <<END
6887#$i_malloc I_MALLOC
6888#$i_stdlib I_STDLIB
6889#include <stdio.h>
6890#include <sys/types.h>
6891#ifdef I_MALLOC
6892#include <malloc.h>
6893#endif
6894#ifdef I_STDLIB
6895#include <stdlib.h>
6896#endif
6897#ifdef TRY_MALLOC
6898void *malloc();
6899#endif
6900#ifdef TRY_FREE
6901void free();
6902#endif
6903END
6904case "$malloctype" in
6905'')
6906 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6907 malloctype='void *'
6908 else
6909 malloctype='char *'
6910 fi
6911 ;;
6912esac
6913echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6914
6915case "$freetype" in
6916'')
6917 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6918 freetype='void'
6919 else
6920 freetype='int'
6921 fi
6922 ;;
6923esac
6924echo "Your system uses $freetype free(), it would seem." >&4
6925$rm -f malloc.[co]
b4eb6b3d
JH
6926: determine where site specific architecture-dependent libraries go.
6927: sitelib default is /usr/local/lib/perl5/site_perl/$version
6928: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6929: sitelib may have an optional trailing /share.
6930case "$sitearch" in
6931'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6932 dflt="$dflt/$archname"
6933 ;;
6934*) dflt="$sitearch"
6935 ;;
6936esac
6937set sitearch sitearch none
6938eval $prefixit
6939$cat <<EOM
6940
6941The installation process will also create a directory for
6942architecture-dependent site-specific extensions and modules.
6943
6944EOM
6945fn=d~+
6946rp='Pathname for the site-specific architecture-dependent library files?'
6947. ./getfile
79522dd2
NC
6948prefixvar=sitearch
6949. ./setprefixvar
c95d0e17
GA
6950if $test X"$sitearch" = X"$sitelib"; then
6951 d_sitearch="$undef"
6952else
6953 d_sitearch="$define"
6954fi
b4eb6b3d 6955
613d6c3e 6956: Set the vendorprefix variables
b4eb6b3d
JH
6957$cat <<EOM
6958
6959The installation process will also create a directory for
6960vendor-supplied add-ons. Vendors who supply perl with their system
6961may find it convenient to place all vendor-supplied files in this
6962directory rather than in the main distribution directory. This will
6963ease upgrades between binary-compatible maintenance versions of perl.
6964
6965Of course you may also use these directories in whatever way you see
6966fit. For example, you might use them to access modules shared over a
6967company-wide network.
6968
6969The default answer should be fine for most people.
6970This causes further questions about vendor add-ons to be skipped
6971and no vendor-specific directories will be configured for perl.
6972
6973EOM
6974rp='Do you want to configure vendor-specific add-on directories?'
6975case "$usevendorprefix" in
6976define|true|[yY]*) dflt=y ;;
6977*) : User may have set vendorprefix directly on Configure command line.
6978 case "$vendorprefix" in
6979 ''|' ') dflt=n ;;
6980 *) dflt=y ;;
6981 esac
6982 ;;
6983esac
6984. ./myread
6985case "$ans" in
6986[yY]*) fn=d~+
6987 rp='Installation prefix to use for vendor-supplied add-ons?'
6988 case "$vendorprefix" in
6989 '') dflt='' ;;
6990 *) dflt=$vendorprefix ;;
6991 esac
6992 . ./getfile
6993 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6994 oldvendorprefix=''
6995 case "$vendorprefix" in
6996 '') ;;
6997 *) case "$ans" in
6998 "$prefix") ;;
6999 *) oldvendorprefix="$prefix";;
7000 esac
7001 ;;
7002 esac
7003 usevendorprefix="$define"
7004 vendorprefix="$ans"
7005 vendorprefixexp="$ansexp"
7006 ;;
7007*) usevendorprefix="$undef"
7008 vendorprefix=''
7009 vendorprefixexp=''
7010 ;;
7011esac
7012
613d6c3e 7013: Set the vendorlib variables
b4eb6b3d
JH
7014case "$vendorprefix" in
7015'') d_vendorlib="$undef"
7016 vendorlib=''
7017 vendorlibexp=''
7018 ;;
7019*) d_vendorlib="$define"
7020 : determine where vendor-supplied modules go.
7021 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7022 case "$vendorlib" in
7023 '')
7024 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7025 case "$installstyle" in
7026 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7027 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7028 esac
7029 ;;
7030 *) dflt="$vendorlib"
7031 ;;
7032 esac
7033 fn=d~+
7034 rp='Pathname for the vendor-supplied library files?'
7035 . ./getfile
7036 vendorlib="$ans"
7037 vendorlibexp="$ansexp"
7038 ;;
7039esac
7040vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
7041prefixvar=vendorlib
7042. ./installprefix
b4eb6b3d 7043
613d6c3e 7044: Set the vendorarch variables
b4eb6b3d
JH
7045case "$vendorprefix" in
7046'') d_vendorarch="$undef"
7047 vendorarch=''
7048 vendorarchexp=''
7049 ;;
7050*) d_vendorarch="$define"
7051 : determine where vendor-supplied architecture-dependent libraries go.
7052 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7053 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7054 : vendorlib may have an optional trailing /share.
7055 case "$vendorarch" in
7056 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7057 dflt="$dflt/$archname"
7058 ;;
7059 *) dflt="$vendorarch" ;;
7060 esac
7061 fn=d~+
7062 rp='Pathname for vendor-supplied architecture-dependent files?'
7063 . ./getfile
7064 vendorarch="$ans"
7065 vendorarchexp="$ansexp"
7066 ;;
7067esac
a092d240
NC
7068prefixvar=vendorarch
7069. ./installprefix
1be1b388
MB
7070if $test X"$vendorarch" = X"$vendorlib"; then
7071 d_vendorarch="$undef"
7072else
7073 d_vendorarch="$define"
7074fi
b4eb6b3d
JH
7075
7076: Final catch-all directories to search
7077$cat <<EOM
7078
7079Lastly, you can have perl look in other directories for extensions and
7080modules in addition to those already specified.
7081These directories will be searched after
7082 $sitearch
7083 $sitelib
7084EOM
7085test X"$vendorlib" != "X" && echo ' ' $vendorlib
7086test X"$vendorarch" != "X" && echo ' ' $vendorarch
7087echo ' '
7088case "$otherlibdirs" in
7089''|' ') dflt='none' ;;
7090*) dflt="$otherlibdirs" ;;
7091esac
7092$cat <<EOM
7093Enter a colon-separated set of extra paths to include in perl's @INC
7094search path, or enter 'none' for no extra paths.
7095
7096EOM
7097
7098rp='Colon-separated list of additional directories for perl to search?'
7099. ./myread
7100case "$ans" in
7101' '|''|none) otherlibdirs=' ' ;;
7102*) otherlibdirs="$ans" ;;
7103esac
7104case "$otherlibdirs" in
7105' ') val=$undef ;;
7106*) val=$define ;;
7107esac
7108set d_perl_otherlibdirs
7109eval $setvar
7110
7111: Cruising for prototypes
7112echo " "
7113echo "Checking out function prototypes..." >&4
55954f19
JH
7114$cat >prototype.c <<EOCP
7115#$i_stdlib I_STDLIB
7116#ifdef I_STDLIB
7117#include <stdlib.h>
7118#endif
b4eb6b3d
JH
7119int main(int argc, char *argv[]) {
7120 exit(0);}
7121EOCP
7122if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7123 echo "Your C compiler appears to support function prototypes."
7124 val="$define"
7125else
7126 echo "Your C compiler doesn't seem to understand function prototypes."
7127 val="$undef"
7128fi
7129set prototype
7130eval $setvar
7131$rm -f prototype*
7132
613d6c3e 7133: Check if ansi2knr is required
b4eb6b3d
JH
7134case "$prototype" in
7135"$define") ;;
7136*) ansi2knr='ansi2knr'
7137 echo " "
7138 cat <<EOM >&4
7139
7140$me: FATAL ERROR:
7141This version of $package can only be compiled by a compiler that
7142understands function prototypes. Unfortunately, your C compiler
7143 $cc $ccflags
7144doesn't seem to understand them. Sorry about that.
7145
7146If GNU cc is available for your system, perhaps you could try that instead.
7147
7148Eventually, we hope to support building Perl with pre-ANSI compilers.
7149If you would like to help in that effort, please contact <perlbug@perl.org>.
7150
7151Aborting Configure now.
7152EOM
7153 exit 2
7154 ;;
7155esac
7156
34f1896b
MB
7157: DTrace support
7158dflt_dtrace='/usr/sbin/dtrace'
6e3b7bfa
MB
7159$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7160
34f1896b
MB
7161cat <<EOM
7162
7163Perl can be built to support DTrace on platforms that support it.
7164DTrace is a diagnosis and performance analysis tool from Sun.
7165
7166If this doesn't make any sense to you, just accept the default '$dflt'.
7167EOM
7168
7169while $test 1 ; do
7170 case "$usedtrace" in
7171 $define|true|[yY]*)
7172 dflt='y'
7173 ;;
7174 ?*)
7175 dflt='y'
7176 dflt_dtrace=$usedtrace
7177 ;;
7178 *)
7179 dflt='n'
7180 ;;
7181 esac
7182
7183 rp='Support DTrace if available?'
7184 . ./myread
7185 case "$ans" in
7186 y|Y) val="$define" ;;
7187 *) val="$undef" ;;
7188 esac
7189 set usedtrace
7190 eval $setvar
7191
7192 test "X$usedtrace" != "X$define" && break
7193
7194 echo " "
7195 rp='Where is the dtrace executable?'
7196 dflt=$dflt_dtrace
7197 . ./getfile
7198 val="$ans"
7199 set dtrace
7200 eval $setvar
7201
7202 if $test -f $dtrace
7203 then
7204 if $dtrace -h -s ../perldtrace.d \
7205 -o perldtrace.tmp >/dev/null 2>&1 \
7206 && rm -f perldtrace.tmp
7207 then
7208 echo " "
7209 echo "Good: your $dtrace knows about the -h flag."
7210 else
7211 cat >&2 <<EOM
7212
7213*** $me: Fatal Error: $dtrace doesn't support -h flag
7214***
7215*** Your installed dtrace doesn't support the -h switch to compile a D
7216*** program into a C header. Can't continue.
7217
7218EOM
7219 exit 1
7220 fi
7221 break;
7222 fi
7223
7224 case "$fastread" in
7225 yes)
7226 cat >&2 <<EOM
7227
7228*** $me: Fatal Error: $dtrace not found.
7229*** Can't continue.
7230
7231EOM
7232 exit 1
7233 ;;
7234 *)
7235 echo "*** $dtrace was not found."
7236 echo " "
7237 ;;
7238 esac
7239done
7240
613d6c3e 7241: See if we want extra modules installed
6fcddf3b 7242echo " "
6fcddf3b 7243case "$extras" in
bf35c3f6
JH
7244'') dflt='n';;
7245*) dflt='y';;
6fcddf3b
JH
7246esac
7247cat <<EOM
7248Perl can be built with extra modules or bundles of modules which
7249will be fetched from the CPAN and installed alongside Perl.
7250
7251Notice that you will need access to the CPAN; either via the Internet,
7252or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7253be asked later to configure the CPAN.pm module which will in turn do
7254the installation of the rest of the extra modules or bundles.)
7255
7256Notice also that if the modules require any external software such as
dd2de242
JH
7257libraries and headers (the libz library and the zlib.h header for the
7258Compress::Zlib module, for example) you MUST have any such software
7259already installed, this configuration process will NOT install such
7260things for you.
6fcddf3b
JH
7261
7262If this doesn't make any sense to you, just accept the default '$dflt'.
7263EOM
dd2de242 7264rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7265. ./myread
7266case "$ans" in
7267y|Y)
7268 cat <<EOM
7269
7270Please list any extra modules or bundles to be installed from CPAN,
7271with spaces between the names. The names can be in any format the
dd2de242
JH
7272'install' command of CPAN.pm will understand. (Answer 'none',
7273without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7274EOM
7275 rp='Extras?'
7276 dflt="$extras"
7277 . ./myread
7278 extras="$ans"
7279esac
7280case "$extras" in
7281''|'none')
7282 val=''
7283 $rm -f ../extras.lst
7284 ;;
7285*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7286 echo "$extras" > ../extras.lst
7287 val="'$extras'"
6fcddf3b
JH
7288 ;;
7289esac
7290set extras
7291eval $setvar
7292echo " "
7293
6e1038e0
MB
7294: determine where html pages for programs go
7295set html1dir html1dir none
7296eval $prefixit
7297$cat <<EOM
7298
f3f1a2d8 7299If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7300the appropriate directory here. To skip installing html files,
7301answer "none".
7302EOM
7303case "$html1dir" in
7304''|none|$undef|' ') dflt=none ;;
7305*) dflt=$html1dir ;;
7306esac
7307fn=dn+~
7308rp="Directory for the main $spackage html pages?"
7309. ./getfile
79522dd2
NC
7310prefixvar=html1dir
7311. ./setprefixvar
6e1038e0
MB
7312: Use ' ' for none so value is preserved next time through Configure
7313$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7314
7315: determine where html pages for libraries and modules go
7316set html3dir html3dir none
7317eval $prefixit
7318$cat <<EOM
7319
7320If you wish to install html files for modules associated with $spackage,
7321indicate the appropriate directory here. To skip installing html files,
7322answer "none".
7323EOM
7324: There is no obvious default. If they have specified html1dir, then
7325: try to key off that, possibly changing .../html1 into .../html3.
7326case "$html3dir" in
7327'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7328*) dflt=$html3dir ;;
7329esac
7330fn=dn+~
7331rp="Directory for the $spackage module html pages?"
7332. ./getfile
79522dd2
NC
7333prefixvar=html3dir
7334. ./setprefixvar
6e1038e0
MB
7335: Use ' ' for none so value is preserved next time through Configure
7336$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7337
89ce900e
JH
7338: determine whether to install perl also as /usr/bin/perl
7339
7340echo " "
7341if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7342 $cat <<EOM
7343Many scripts expect perl to be installed as /usr/bin/perl.
7344
7345If you want to, I can install the perl you are about to compile
7346as /usr/bin/perl (in addition to $bin/perl).
7347EOM
7348 if test -f /usr/bin/perl; then
7349 $cat <<EOM
7350
7351However, please note that because you already have a /usr/bin/perl,
7352overwriting that with a new Perl would very probably cause problems.
7353Therefore I'm assuming you don't want to do that (unless you insist).
7354
7355EOM
7356 case "$installusrbinperl" in
7357 "$define"|[yY]*) dflt='y';;
7358 *) dflt='n';;
7359 esac
7360 else
7361 $cat <<EOM
7362
7363Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7364
7365EOM
7366 case "$installusrbinperl" in
7367 "$undef"|[nN]*) dflt='n';;
7368 *) dflt='y';;
7369 esac
7370 fi
7371 rp="Do you want to install perl as /usr/bin/perl?"
7372 . ./myread
7373 case "$ans" in
7374 [yY]*) val="$define";;
7375 *) val="$undef" ;;
7376 esac
7377else
7378 val="$undef"
7379fi
7380set installusrbinperl
7381eval $setvar
7382
613d6c3e 7383: Check if we are using the GNU C library
89ce900e
JH
7384echo " "
7385echo "Checking for GNU C Library..." >&4
7386cat >try.c <<'EOCP'
7387/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7388 alone are insufficient to distinguish different versions, such as
7389 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7390 libc version 2.1.0. A. Dougherty, June 3, 2002.
7391*/
7392#include <stdio.h>
7393int main(void)
7394{
7395#ifdef __GLIBC__
7396# ifdef __GLIBC_MINOR__
4fb7dc7d 7397# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7398# include <gnu/libc-version.h>
7399 printf("%s\n", gnu_get_libc_version());
7400# else
7401 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7402# endif
7403# else
7404 printf("%d\n", __GLIBC__);
7405# endif
7406 return 0;
7407#else
7408 return 1;
7409#endif
7410}
7411EOCP
7412set try
7413if eval $compile_ok && $run ./try > glibc.ver; then
7414 val="$define"
7415 gnulibc_version=`$cat glibc.ver`
7416 echo "You are using the GNU C Library version $gnulibc_version"
7417else
7418 val="$undef"
7419 gnulibc_version=''
7420 echo "You are not using the GNU C Library"
7421fi
5b813a60 7422$rm_try glibc.ver
89ce900e
JH
7423set d_gnulibc
7424eval $setvar
7425
7426: see if nm is to be used to determine whether a symbol is defined or not
7427case "$usenm" in
7428'')
7429 dflt=''
7430 case "$d_gnulibc" in
7431 "$define")
7432 echo " "
7433 echo "nm probably won't work on the GNU C Library." >&4
7434 dflt=n
7435 ;;
7436 esac
7437 case "$dflt" in
7438 '')
7439 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7440 echo " "
7441 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7442 echo "'nm' won't be sufficient on this sytem." >&4
7443 dflt=n
7444 fi
7445 ;;
7446 esac
7447 case "$dflt" in
7448 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7449 if $test $dflt -gt 20; then
7450 dflt=y
7451 else
7452 dflt=n
7453 fi
7454 ;;
7455 esac
b4eb6b3d 7456 ;;
89ce900e
JH
7457*)
7458 case "$usenm" in
7459 true|$define) dflt=y;;
7460 *) dflt=n;;
7461 esac
b4eb6b3d
JH
7462 ;;
7463esac
89ce900e 7464$cat <<EOM
b4eb6b3d 7465
89ce900e
JH
7466I can use $nm to extract the symbols from your C libraries. This
7467is a time consuming task which may generate huge output on the disk (up
7468to 3 megabytes) but that should make the symbols extraction faster. The
7469alternative is to skip the 'nm' extraction part and to compile a small
7470test program instead to determine whether each symbol is present. If
7471you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7472this may be the best solution.
b4eb6b3d 7473
89ce900e 7474You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7475
89ce900e
JH
7476EOM
7477rp="Shall I use $nm to extract C symbols from the libraries?"
7478. ./myread
7479case "$ans" in
7480[Nn]*) usenm=false;;
7481*) usenm=true;;
b4eb6b3d 7482esac
89ce900e
JH
7483
7484runnm=$usenm
7485case "$reuseval" in
7486true) runnm=false;;
b4eb6b3d 7487esac
b4eb6b3d 7488
89ce900e
JH
7489: nm options which may be necessary
7490case "$nm_opt" in
7491'') if $test -f /mach_boot; then
7492 nm_opt='' # Mach
7493 elif $test -d /usr/ccs/lib; then
7494 nm_opt='-p' # Solaris (and SunOS?)
7495 elif $test -f /dgux; then
7496 nm_opt='-p' # DG-UX
7497 elif $test -f /lib64/rld; then
7498 nm_opt='-p' # 64-bit Irix
7499 else
7500 nm_opt=''
7501 fi;;
7502esac
b4eb6b3d 7503
89ce900e
JH
7504: nm options which may be necessary for shared libraries but illegal
7505: for archive libraries. Thank you, Linux.
7506case "$nm_so_opt" in
7507'') case "$myuname" in
fb2e1bc0 7508 *linux*|gnu*)
89ce900e
JH
7509 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7510 nm_so_opt='--dynamic'
7511 fi
7512 ;;
7513 esac
7514 ;;
7515esac
b4eb6b3d 7516
1d8eaf8c 7517: Figure out where the libc is located
89ce900e
JH
7518case "$runnm" in
7519true)
1d8eaf8c 7520: get list of predefined functions in a handy place
89ce900e
JH
7521echo " "
7522case "$libc" in
7523'') libc=unknown
7524 case "$libs" in
7525 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7526 esac
7527 ;;
b4eb6b3d 7528esac
89ce900e
JH
7529case "$libs" in
7530'') ;;
7531*) for thislib in $libs; do
7532 case "$thislib" in
7533 -lc|-lc_s)
7534 : Handle C library specially below.
7535 ;;
7536 -l*)
7537 thislib=`echo $thislib | $sed -e 's/^-l//'`
7538 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7539 :
7540 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7541 :
7542 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7543 :
7544 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7545 :
7546 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7547 :
7548 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7549 :
7550 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7551 :
7552 else
7553 try=''
7554 fi
7555 libnames="$libnames $try"
7556 ;;
7557 *) libnames="$libnames $thislib" ;;
7558 esac
7559 done
b4eb6b3d
JH
7560 ;;
7561esac
89ce900e
JH
7562xxx=normal
7563case "$libc" in
7564unknown)
7565 set /lib/libc.$so
7566 for xxx in $libpth; do
7567 $test -r $1 || set $xxx/libc.$so
7568 : The messy sed command sorts on library version numbers.
7569 $test -r $1 || \
7570 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7571 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7572 h
7573 s/[0-9][0-9]*/0000&/g
7574 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7575 G
7576 s/\n/ /' | \
7577 $sort | $sed -e 's/^.* //'`
7578 eval set \$$#
7579 done
7580 $test -r $1 || set /usr/ccs/lib/libc.$so
7581 $test -r $1 || set /lib/libsys_s$_a
7582 ;;
7583*)
7584 set blurfl
7585 ;;
7586esac
7587if $test -r "$1"; then
7588 echo "Your (shared) C library seems to be in $1."
7589 libc="$1"
7590elif $test -r /lib/libc && $test -r /lib/clib; then
7591 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7592 xxx=apollo
7593 libc='/lib/clib /lib/libc'
7594 if $test -r /lib/syslib; then
7595 echo "(Your math library is in /lib/syslib.)"
7596 libc="$libc /lib/syslib"
7597 fi
7598elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7599 echo "Your C library seems to be in $libc, as you said before."
7600elif $test -r $incpath/usr/lib/libc$_a; then
7601 libc=$incpath/usr/lib/libc$_a;
7602 echo "Your C library seems to be in $libc. That's fine."
7603elif $test -r /lib/libc$_a; then
7604 libc=/lib/libc$_a;
7605 echo "Your C library seems to be in $libc. You're normal."
7606else
7607 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7608 :
7609 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7610 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7611 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7612 :
7613 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7614 :
7615 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7616 :
7617 else
7618 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7619 fi
7620 if $test -r "$tans"; then
7621 echo "Your C library seems to be in $tans, of all places."
7622 libc=$tans
7623 else
7624 libc='blurfl'
7625 fi
7626fi
7627if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7628 dflt="$libc"
7629 cat <<EOM
b4eb6b3d 7630
89ce900e
JH
7631If the guess above is wrong (which it might be if you're using a strange
7632compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7633
89ce900e
JH
7634EOM
7635else
7636 dflt=''
7637 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7638 cat >&4 <<EOM
7639I can't seem to find your C library. I've looked in the following places:
5e366f65 7640
b4eb6b3d 7641EOM
89ce900e
JH
7642 $sed 's/^/ /' libpath
7643 cat <<EOM
5e366f65 7644
89ce900e 7645None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7646
7647EOM
89ce900e
JH
7648fi
7649fn=f
7650rp='Where is your C library?'
7651. ./getfile
7652libc="$ans"
5e366f65 7653
89ce900e
JH
7654echo " "
7655echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7656set X `cat libnames`
7657shift
7658xxx=files
7659case $# in 1) xxx=file; esac
7660echo "Extracting names from the following $xxx for later perusal:" >&4
7661echo " "
7662$sed 's/^/ /' libnames >&4
7663echo " "
7664$echo $n "This may take a while...$c" >&4
5e366f65 7665
89ce900e
JH
7666for file in $*; do
7667 case $file in
7668 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7669 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7670 esac
89ce900e
JH
7671done >libc.tmp
7672
7673$echo $n ".$c"
7674$grep fprintf libc.tmp > libc.ptf
7675xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7676xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
9e08e8f0 7677xxx='[ADTSIWi]'
ab900c53 7678if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7679 eval $xscan;\
7680 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7681 eval $xrun
7682elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7683 eval $xscan;\
7684 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7685 eval $xrun
7686elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7687 eval $xscan;\
7688 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7689 eval $xrun
7690elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7691 eval $xscan;\
7692 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7693 eval $xrun
7694elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7695 eval $xscan;\
7696 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7697 eval $xrun
7698elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7699 eval $xscan;\
7700 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7701 eval $xrun
7702elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7703 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7704 eval $xscan;\
7705 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7706 eval $xrun
7707elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7708 eval $xscan;\
7709 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7710 eval $xrun
7711elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7712 eval $xscan;\
7713 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7714 eval $xrun
7715elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7716 eval $xscan;\
7717 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7718 eval $xrun
7719elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7720 eval $xscan;\
7721 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7722 eval $xrun
7723elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7724 eval $xscan;\
7725 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7726 eval $xrun
7727elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7728 eval $xscan;\
7729 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7730 eval $xrun
7731elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7732 eval $xscan;\
7733 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7734 eval $xrun
b4eb6b3d 7735else
89ce900e
JH
7736 $nm -p $* 2>/dev/null >libc.tmp
7737 $grep fprintf libc.tmp > libc.ptf
7738 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7739 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7740 then
7741 nm_opt='-p'
7742 eval $xrun
7743 else
7744 echo " "
7745 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7746 com=''
1d8eaf8c
MB
7747 if $ar t $libc > libc.tmp && \
7748 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7749 then
89ce900e
JH
7750 for thisname in $libnames $libc; do
7751 $ar t $thisname >>libc.tmp
7752 done
7753 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7754 echo "Ok." >&4
7755 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
89ce900e
JH
7756 for thisname in $libnames $libc; do
7757 $ar tv $thisname >>libc.tmp
89ce900e
JH
7758 emximp -o tmp.imp $thisname \
7759 2>/dev/null && \
7760 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7761 < tmp.imp >>libc.tmp
1d8eaf8c 7762 $rm -f tmp.imp
89ce900e
JH
7763 done
7764 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7765 echo "Ok." >&4
7766 else
7767 echo "$ar didn't seem to work right." >&4
7768 echo "Maybe this is a Cray...trying bld instead..." >&4
1d8eaf8c
MB
7769 if bld t $libc | \
7770 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7771 $test -s libc.list
89ce900e
JH
7772 then
7773 for thisname in $libnames; do
7774 bld t $libnames | \
7775 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7776 $ar t $thisname >>libc.tmp
7777 done
7778 echo "Ok." >&4
7779 else
7780 echo "That didn't work either. Giving up." >&4
7781 exit 1
7782 fi
7783 fi
7784 fi
b4eb6b3d 7785fi
89ce900e
JH
7786nm_extract="$com"
7787case "$PASE" in
7788define)
7789 echo " "
7790 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7791 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7792 ;;
7793*) if $test -f /lib/syscalls.exp; then
7794 echo " "
7795 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
1d8eaf8c
MB
7796 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7797 /lib/syscalls.exp >>libc.list
89ce900e
JH
7798 fi
7799 ;;
7800esac
7801;;
7802esac
7803$rm -f libnames libpath
b4eb6b3d
JH
7804
7805: see if dld is available
7806set dld.h i_dld
7807eval $inhdr
7808
613d6c3e 7809: Check if we are using C++
43dddb59
MB
7810echo " "
7811echo "Checking for C++..." >&4
20e87299 7812$cat >try.c <<'EOCP'
43dddb59
MB
7813#include <stdio.h>
7814int main(void)
7815{
7816#ifdef __cplusplus
20e87299 7817 return 0;
43dddb59 7818#else
20e87299 7819 return 1;
43dddb59 7820#endif
43dddb59
MB
7821}
7822EOCP
7823set try
20e87299
AD
7824if eval $compile_ok && $run ./try; then
7825 val="$define"
43dddb59
MB
7826 echo "You are using a C++ compiler."
7827else
7828 val="$undef"
7829 echo "You are not using a C++ compiler."
7830fi
5b813a60 7831$rm_try cplusplus$$
43dddb59
MB
7832set d_cplusplus
7833eval $setvar
7834
89ce900e
JH
7835: is a C symbol defined?
7836csym='tlook=$1;
7837case "$3" in
373dfab3
JH
7838-v) tf=libc.tmp; tdc="";;
7839-a) tf=libc.tmp; tdc="[]";;
7840*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e 7841esac;
61c26d18
MHM
7842case "$d_cplusplus" in
7843 $define) extern_C="extern \"C\"" ;;
7844 *) extern_C="extern" ;;
7845esac;
89ce900e
JH
7846tx=yes;
7847case "$reuseval-$4" in
7848true-) ;;
7849true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7850esac;
7851case "$tx" in
7852yes)
43dddb59 7853 tval=false;
5129fff4
JH
7854 if $test "$runnm" = true; then
7855 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7856 tval=true;
5129fff4 7857 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
61c26d18 7858 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7859 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7860 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7861 $rm_try;
89ce900e 7862 fi;
5129fff4 7863 else
61c26d18 7864 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7865 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5b813a60 7866 $rm_try;
ab900c53
AB
7867 fi;
7868 ;;
89ce900e
JH
7869*)
7870 case "$tval" in
7871 $define) tval=true;;
7872 *) tval=false;;
ab900c53
AB
7873 esac;
7874 ;;
89ce900e
JH
7875esac;
7876eval "$2=$tval"'
7877
7878: define an is-in-libc? function
7879inlibc='echo " "; td=$define; tu=$undef;
7880sym=$1; var=$2; eval "was=\$$2";
7881tx=yes;
7882case "$reuseval$was" in
7883true) ;;
7884true*) tx=no;;
7885esac;
7886case "$tx" in
7887yes)
7888 set $sym tres -f;
7889 eval $csym;
7890 case "$tres" in
7891 true)
7892 echo "$sym() found." >&4;
7893 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7894 *)
7895 echo "$sym() NOT found." >&4;
7896 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7897 esac;;
7898*)
7899 case "$was" in
7900 $define) echo "$sym() found." >&4;;
7901 *) echo "$sym() NOT found." >&4;;
7902 esac;;
7903esac'
7904
b4eb6b3d
JH
7905: see if dlopen exists
7906xxx_runnm="$runnm"
666ea192 7907xxx_ccflags="$ccflags"
b4eb6b3d 7908runnm=false
666ea192
JH
7909: with g++ one needs -shared to get is-in-libc to work for dlopen
7910case "$gccversion" in
7911'') ;;
7912*) case "$d_cplusplus" in
7913 "$define") ccflags="$ccflags -shared" ;;
7914 esac
7915 ;;
7916esac
b4eb6b3d
JH
7917set dlopen d_dlopen
7918eval $inlibc
7919runnm="$xxx_runnm"
666ea192 7920ccflags="$xxx_ccflags"
b4eb6b3d 7921
4fb7dc7d
JH
7922: see if this is a unistd.h system
7923set unistd.h i_unistd
7924eval $inhdr
7925
b4eb6b3d
JH
7926: determine which dynamic loading, if any, to compile in
7927echo " "
7928dldir="ext/DynaLoader"
7929case "$usedl" in
7930$define|y|true)
7931 dflt='y'
7932 usedl="$define"
7933 ;;
7934$undef|n|false)
7935 dflt='n'
7936 usedl="$undef"
7937 ;;
5b813a60 7938*)
b4eb6b3d
JH
7939 dflt='n'
7940 case "$d_dlopen" in
7941 $define) dflt='y' ;;
7942 esac
7943 case "$i_dld" in
7944 $define) dflt='y' ;;
7945 esac
7946 : Does a dl_xxx.xs file exist for this operating system
7947 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7948 ;;
7949esac
7950rp="Do you wish to use dynamic loading?"
7951. ./myread
7952usedl="$ans"
f1ce3bf1 7953bin_ELF="$undef"
b4eb6b3d
JH
7954case "$ans" in
7955y*) usedl="$define"
7956 case "$dlsrc" in
7957 '')
7958 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7959 dflt="$dldir/dl_${osname}.xs"
7960 elif $test "$d_dlopen" = "$define" ; then
7961 dflt="$dldir/dl_dlopen.xs"
7962 elif $test "$i_dld" = "$define" ; then
7963 dflt="$dldir/dl_dld.xs"
7964 else
7965 dflt=''
7966 fi
7967 ;;
7968 *) dflt="$dldir/$dlsrc"
7969 ;;
7970 esac
7971 echo "The following dynamic loading files are available:"
7972 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7973 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7974 rp="Source file to use for dynamic loading"
7975 fn="fne"
7976 gfpth="$src"
7977 . ./getfile
7978 usedl="$define"
7979 : emulate basename
7980 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7981
7982 $cat << EOM
7983
7984Some systems may require passing special flags to $cc -c to
7985compile modules that will be used to create a shared library.
7986To use no flags, say "none".
7987
7988EOM
7989 case "$cccdlflags" in
7990 '') case "$gccversion" in
7991 '') case "$osname" in
7992 hpux) dflt='+z' ;;
7993 next) dflt='none' ;;
7994 irix*) dflt='-KPIC' ;;
48bcfe03 7995 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7996 sunos) dflt='-pic' ;;
7997 *) dflt='none' ;;
7998 esac
7999 ;;
8000 *) case "$osname" in
b6cc0f4c 8001 darwin) dflt='none' ;;
15fcae63 8002 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
8003 *) dflt='-fpic' ;;
8004 esac ;;
8005 esac ;;
8006 ' ') dflt='none' ;;
8007 *) dflt="$cccdlflags" ;;
8008 esac
8009 rp="Any special flags to pass to $cc -c to compile shared library modules?"
8010 . ./myread
8011 case "$ans" in
8012 none) cccdlflags=' ' ;;
8013 *) cccdlflags="$ans" ;;
8014 esac
8015
8016 cat << EOM
8017
8018Some systems use ld to create libraries that can be dynamically loaded,
8019while other systems (such as those using ELF) use $cc.
8020
8021EOM
8022 case "$ld" in
55954f19 8023 '') $cat >try.c <<EOM
b4eb6b3d
JH
8024/* Test for whether ELF binaries are produced */
8025#include <fcntl.h>
55954f19
JH
8026#$i_stdlib I_STDLIB
8027#ifdef I_STDLIB
b4eb6b3d 8028#include <stdlib.h>
55954f19 8029#endif
4fb7dc7d
JH
8030#$i_unistd I_UNISTD
8031#ifdef I_UNISTD
8032#include <unistd.h>
8033#endif
b4eb6b3d
JH
8034int main() {
8035 char b[4];
8036 int i = open("a.out",O_RDONLY);
5b813a60 8037 if(i == -1)
b4eb6b3d
JH
8038 exit(1); /* fail */
8039 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8040 exit(0); /* succeed (yes, it's ELF) */
8041 else
8042 exit(1); /* fail */
8043}
8044EOM
5440bc8e 8045 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
8046 cat <<EOM
8047You appear to have ELF support. I'll use $cc to build dynamic libraries.
8048EOM
8049 dflt="$cc"
f1ce3bf1 8050 bin_ELF="$define"
b4eb6b3d
JH
8051 else
8052 echo "I'll use ld to build dynamic libraries."
8053 dflt='ld'
8054 fi
5b813a60 8055 $rm_try
b4eb6b3d
JH
8056 ;;
8057 *) dflt="$ld"
8058 ;;
8059 esac
8060
8061 rp="What command should be used to create dynamic libraries?"
8062 . ./myread
8063 ld="$ans"
8064
8065 cat << EOM
8066
8067Some systems may require passing special flags to $ld to create a
8068library that can be dynamically loaded. If your ld flags include
8069-L/other/path options to locate libraries outside your loader's normal
8070search path, you may need to specify those -L options here as well. To
8071use no flags, say "none".
8072
8073EOM
8074 case "$lddlflags" in
8075 '') case "$osname" in
8076 beos) dflt='-nostart' ;;
df00ff3b 8077 haiku) dflt='-shared' ;;
b4eb6b3d
JH
8078 hpux) dflt='-b';
8079 case "$gccversion" in
8080 '') dflt="$dflt +vnocompatwarnings" ;;
8081 esac
5b813a60 8082 ;;
15fcae63 8083 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
8084 next) dflt='none' ;;
8085 solaris) dflt='-G' ;;
8086 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 8087 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
8088 *) dflt='none' ;;
8089 esac
8090 ;;
8091 *) dflt="$lddlflags" ;;
8092 esac
8093
8094 : Try to guess additional flags to pick up local libraries.
8095 : Be careful not to append to a plain 'none'
8096 case "$dflt" in
8097 none) dflt='' ;;
8098 esac
8099 for thisflag in $ldflags; do
8100 case "$thisflag" in
b5b9f165 8101 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
8102 case " $dflt " in
8103 *" $thisflag "*) ;;
8104 *) dflt="$dflt $thisflag" ;;
8105 esac
8106 ;;
8107 esac
8108 done
8109
8110 case "$dflt" in
8111 ''|' ') dflt='none' ;;
8112 esac
8113
8f68b0e6
AD
8114 case "$ldflags" in
8115 *-fstack-protector*)
8116 case "$dflt" in
8117 *-fstack-protector*) ;; # Don't add it again
8118 *) dflt="$dflt -fstack-protector" ;;
8119 esac
8120 ;;
8121 esac
8122
8123
b4eb6b3d
JH
8124 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8125 . ./myread
8126 case "$ans" in
8127 none) lddlflags=' ' ;;
8128 *) lddlflags="$ans" ;;
8129 esac
8130
8131 cat <<EOM
8132
8133Some systems may require passing special flags to $cc to indicate that
8134the resulting executable will use dynamic linking. To use no flags,
8135say "none".
8136
8137EOM
8138 case "$ccdlflags" in
8139 '') case "$osname" in
fb2e1bc0 8140 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
8141 next|sunos) dflt='none' ;;
8142 *) dflt='none' ;;
b4eb6b3d
JH
8143 esac ;;
8144 ' ') dflt='none' ;;
8145 *) dflt="$ccdlflags" ;;
8146 esac
8147 rp="Any special flags to pass to $cc to use dynamic linking?"
8148 . ./myread
8149 case "$ans" in
8150 none) ccdlflags=' ' ;;
8151 *) ccdlflags="$ans" ;;
8152 esac
8153 ;;
8154*) usedl="$undef"
8155 ld='ld'
8156 dlsrc='dl_none.xs'
8157 lddlflags=''
8158 ccdlflags=''
8159 ;;
8160esac
8161
34f1896b 8162: Do we want a shared libperl?
b4eb6b3d
JH
8163also=''
8164case "$usedl" in
8165$undef)
8166 # No dynamic loading being used, so don't bother even to prompt.
8167 useshrplib='false'
8168 ;;
8169*) case "$useshrplib" in
8170 '') case "$osname" in
df00ff3b 8171 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
b4eb6b3d
JH
8172 dflt=y
8173 also='Building a shared libperl is required for dynamic loading to work on your system.'
8174 ;;
8175 next*)
8176 case "$osvers" in
8177 4*) dflt=y
8178 also='Building a shared libperl is needed for MAB support.'
8179 ;;
8180 *) dflt=n
8181 ;;
8182 esac
8183 ;;
8184 *) dflt=n
8185 ;;
8186 esac
8187 ;;
8188 $define|true|[Yy]*)
8189 dflt=y
8190 ;;
8191 *) dflt=n
8192 ;;
8193 esac
8194 $cat << EOM
8195
8196The perl executable is normally obtained by linking perlmain.c with
8197libperl${_a}, any static extensions (usually just DynaLoader), and
8198any other libraries needed on this system (such as -lm, etc.). Since
8199your system supports dynamic loading, it is probably possible to build
8200a shared libperl.$so. If you will have more than one executable linked
8201to libperl.$so, this will significantly reduce the size of each
5cadb3f3 8202executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
8203default is probably sensible for your system.
8204$also
8205
8206EOM
8207 rp="Build a shared libperl.$so (y/n)"
8208 . ./myread
8209 case "$ans" in
8210 true|$define|[Yy]*)
8211 useshrplib='true' ;;
8212 *) useshrplib='false' ;;
8213 esac
8214 ;;
8215esac
8216
8217case "$useshrplib" in
8218true)
df31f9b1
MB
8219 case "$userelocatableinc" in
8220 true|define)
8221 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8222 echo "See INSTALL for an explanation why that won't work." >&4
8223 exit 4
8224 ;;
8225 esac
b4eb6b3d
JH
8226 case "$libperl" in
8227 '')
8228 # Figure out a good name for libperl.so. Since it gets stored in
8229 # a version-specific architecture-dependent library, the version
8230 # number isn't really that important, except for making cc/ld happy.
8231 #
56e771c1 8232 # A name such as libperl.so.10.1
b4eb6b3d 8233 majmin="libperl.$so.$patchlevel.$subversion"
56e771c1 8234 # A name such as libperl.so.100
b4eb6b3d
JH
8235 majonly=`echo $patchlevel $subversion |
8236 $awk '{printf "%d%02d", $1, $2}'`
8237 majonly=libperl.$so.$majonly
8238 # I'd prefer to keep the os-specific stuff here to a minimum, and
8239 # rely on figuring it out from the naming of libc.
8240 case "${osname}${osvers}" in
8241 next4*)
8242 dflt=libperl.5.$so
8243 # XXX How handle the --version stuff for MAB?
8244 ;;
fb2e1bc0 8245 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8246 dflt=libperl.$so
8247 ;;
56e771c1
RU
8248 cygwin*) # ld links now against the dll directly
8249 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8250 majonly=`echo $patchlevel $subversion |
8251 $awk '{printf "%03d%03d", $1, $2}'`
8252 majonly=cygperl5.$majonly.$so
8253 dflt=$majmin
b4eb6b3d
JH
8254 ;;
8255 *) # Try to guess based on whether libc has major.minor.
8256 case "$libc" in
8257 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8258 *libc.$so.[0-9]*) dflt=$majonly ;;
8259 *) dflt=libperl.$so ;;
8260 esac
8261 ;;
8262 esac
8263 ;;
8264 *) dflt=$libperl
8265 ;;
8266 esac
8267 cat << EOM
8268
8269I need to select a good name for the shared libperl. If your system uses
8270library names with major and minor numbers, then you might want something
8271like $majmin. Alternatively, if your system uses a single version
8272number for shared libraries, then you might want to use $majonly.
8273Or, your system might be quite happy with a simple libperl.$so.
8274
8275Since the shared libperl will get installed into a version-specific
8276architecture-dependent directory, the version number of the shared perl
8277library probably isn't important, so the default should be o.k.
8278
8279EOM
8280 rp='What name do you want to give to the shared libperl?'
8281 . ./myread
8282 libperl=$ans
8283 echo "Ok, I'll use $libperl"
8284 ;;
8285*)
8286 libperl="libperl${_a}"
8287 ;;
8288esac
8289
8290# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8291case "$shrpdir" in
8292'') ;;
8293*) $cat >&4 <<EOM
8294WARNING: Use of the shrpdir variable for the installation location of
8295the shared $libperl is not supported. It was never documented and
8296will not work in this version. Let me (perlbug@perl.org)
8297know of any problems this may cause.
8298
8299EOM
8300 case "$shrpdir" in
8301 "$archlibexp/CORE")
8302 $cat >&4 <<EOM
8303But your current setting of $shrpdir is
8304the default anyway, so it's harmless.
8305EOM
8306 ;;
8307 *)
8308 $cat >&4 <<EOM
8309Further, your current attempted setting of $shrpdir
8310conflicts with the value of $archlibexp/CORE
8311that installperl will use.
8312EOM
8313 ;;
8314 esac
8315 ;;
8316esac
8317
8318# How will the perl executable find the installed shared $libperl?
8319# Add $xxx to ccdlflags.
8320# If we can't figure out a command-line option, use $shrpenv to
8321# set env LD_RUN_PATH. The main perl makefile uses this.
8322shrpdir=$archlibexp/CORE
8323xxx=''
8324tmp_shrpenv=''
8325if "$useshrplib"; then
34f1896b 8326 case "$osname" in
b4eb6b3d
JH
8327 aix)
8328 # We'll set it in Makefile.SH...
8329 ;;
b5b9f165 8330 solaris)
b4eb6b3d
JH
8331 xxx="-R $shrpdir"
8332 ;;
a774dfe6 8333 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8334 xxx="-Wl,-R$shrpdir"
8335 ;;
fb2e1bc0 8336 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8337 xxx="-Wl,-rpath,$shrpdir"
8338 ;;
8339 next)
8340 # next doesn't like the default...
8341 ;;
8342 beos)
8343 # beos doesn't like the default, either.
8344 ;;
df00ff3b
IW
8345 haiku)
8346 # Haiku doesn't like the default, either.
8347 ;;
b4eb6b3d
JH
8348 hpux*)
8349 # hpux doesn't like the default, either.
8350 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8351 ;;
56e771c1
RU
8352 cygwin)
8353 # cygwin needs only ldlibpth
8354 ;;
b4eb6b3d
JH
8355 *)
8356 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8357 ;;
8358 esac
8359 case "$xxx" in
8360 '') ;;
34f1896b 8361 *)
b4eb6b3d
JH
8362 # Only add $xxx if it isn't already in ccdlflags.
8363 case " $ccdlflags " in
8364 *" $xxx "*) ;;
8365 *) ccdlflags="$ccdlflags $xxx"
8366 cat <<EOM >&4
8367
8368Adding $xxx to the flags
34f1896b 8369passed to $ld so that the perl executable will find the
b4eb6b3d
JH
8370installed shared $libperl.
8371
8372EOM
8373 ;;
8374 esac
8375 ;;
8376 esac
8377fi
8378# Fix ccdlflags in AIX for building external extensions.
8379# (For building Perl itself bare -bE:perl.exp is needed,
8380# Makefile.SH takes care of this.)
8381case "$osname" in
8382aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8383esac
8384# Respect a hint or command-line value.
8385case "$shrpenv" in
8386'') shrpenv="$tmp_shrpenv" ;;
8387esac
8388case "$ldlibpthname" in
8389'') ldlibpthname=LD_LIBRARY_PATH ;;
8390none) ldlibpthname='' ;;
8391esac
8392
8393: determine where manual pages are on this system
8394echo " "
8395case "$sysman" in
8396'')
4a0a3829
SD
8397 syspath='/usr/share/man/man1 /usr/man/man1'
8398 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8399 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8400 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8401 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8402 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8403 sysman=`./loc . /usr/man/man1 $syspath`
8404 ;;
8405esac
8406if $test -d "$sysman"; then
8407 echo "System manual is in $sysman." >&4
8408else
8409 echo "Could not find manual pages in source form." >&4
8410fi
8411
8412: determine where manual pages go
8413set man1dir man1dir none
8414eval $prefixit
8415$cat <<EOM
8416
8417$spackage has manual pages available in source form.
8418EOM
8419case "$nroff" in
8420nroff)
8421 echo "However, you don't have nroff, so they're probably useless to you."
8422 case "$man1dir" in
8423 '') man1dir="none";;
8424 esac;;
8425esac
8426echo "If you don't want the manual sources installed, answer 'none'."
8427case "$man1dir" in
8428' ') dflt=none
8429 ;;
8430'')
4a0a3829
SD
8431 lookpath="$prefixexp/share/man/man1"
8432 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8433 lookpath="$lookpath $prefixexp/man/p_man/man1"
8434 lookpath="$lookpath $prefixexp/man/u_man/man1"
8435 lookpath="$lookpath $prefixexp/man/man.1"
8436 case "$sysman" in
8437 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8438 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8439 esac
8440 set dflt
8441 eval $prefixup
8442 ;;
8443*) dflt="$man1dir"
8444 ;;
8445esac
8446echo " "
8447fn=dn+~
8448rp="Where do the main $spackage manual pages (source) go?"
8449. ./getfile
8450if $test "X$man1direxp" != "X$ansexp"; then
8451 installman1dir=''
8452fi
79522dd2
NC
8453prefixvar=man1dir
8454. ./setprefixvar
8455
477140ee
NC
8456case "$man1dir" in
8457'') man1dir=' '
8458 installman1dir='';;
8459esac
b4eb6b3d
JH
8460
8461: What suffix to use on installed man pages
8462
8463case "$man1dir" in
8464' ')
8465 man1ext='0'
8466 ;;
8467*)
8468 rp="What suffix should be used for the main $spackage man pages?"
8469 case "$man1ext" in
8470 '') case "$man1dir" in
8471 *1) dflt=1 ;;
8472 *1p) dflt=1p ;;
8473 *1pm) dflt=1pm ;;
8474 *l) dflt=l;;
8475 *n) dflt=n;;
8476 *o) dflt=o;;
8477 *p) dflt=p;;
8478 *C) dflt=C;;
8479 *L) dflt=L;;
8480 *L1) dflt=L1;;
8481 *) dflt=1;;
8482 esac
8483 ;;
8484 *) dflt="$man1ext";;
8485 esac
8486 . ./myread
8487 man1ext="$ans"
8488 ;;
8489esac
8490
8491: see if we can have long filenames
8492echo " "
8493first=123456789abcdef
8494$rm -f $first
8495if (echo hi >$first) 2>/dev/null; then
8496 if $test -f 123456789abcde; then
8497 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8498 val="$undef"
8499 else
8500 echo 'You can have filenames longer than 14 characters.'>&4
8501 val="$define"
8502 fi
8503else
8504 $cat <<'EOM'
8505You can't have filenames longer than 14 chars.
8506You can't even think about them!
8507EOM
8508 val="$undef"
776a38e3 8509fi
b4eb6b3d
JH
8510set d_flexfnam
8511eval $setvar
8512$rm -rf 123456789abcde*
8513
8514: determine where library module manual pages go
8515set man3dir man3dir none
8516eval $prefixit
8517$cat <<EOM
8518
8519$spackage has manual pages for many of the library modules.
8520EOM
8521
8522case "$nroff" in
8523nroff)
8524 $cat <<'EOM'
8525However, you don't have nroff, so they're probably useless to you.
8526EOM
8527 case "$man3dir" in
8528 '') man3dir="none";;
8529 esac;;
8530esac
8531
8532case "$d_flexfnam" in
8533undef)
8534 $cat <<'EOM'
f3f1a2d8 8535However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8536EOM
8537 case "$man3dir" in
8538 '') man3dir="none";;
8539 esac;;
8540esac
8541
8542echo "If you don't want the manual sources installed, answer 'none'."
8543prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8544case "$man3dir" in
8545'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8546 if $test -d "$privlib/man/man3"; then
8547 cat <<EOM >&4
8548
8549WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8550$privlib/man/man3. This version will suggest a
8551new default of $dflt.
b4eb6b3d
JH
8552EOM
8553 tdflt=$dflt
8554 dflt='n'
8555 rp='Do you wish to preserve the old behavior?(y/n)'
8556 . ./myread
8557 case "$ans" in
8558 y*) dflt="$privlib/man/man3" ;;
8559 *) dflt=$tdflt ;;
8560 esac
8561 fi
8562 ;;
8563*) dflt="$man3dir" ;;
8564esac
8565case "$dflt" in
8566' ') dflt=none ;;
8567esac
8568echo " "
8569fn=dn+~
8570rp="Where do the $package library man pages (source) go?"
8571. ./getfile
79522dd2
NC
8572prefixvar=man3dir
8573. ./setprefixvar
8574
477140ee
NC
8575case "$man3dir" in
8576'') man3dir=' '
8577 installman3dir='';;
8578esac
b4eb6b3d
JH
8579
8580: What suffix to use on installed man pages
8581case "$man3dir" in
8582' ')
8583 man3ext='0'
8584 ;;
8585*)
8586 rp="What suffix should be used for the $package library man pages?"
8587 case "$man3ext" in
8588 '') case "$man3dir" in
8589 *3) dflt=3 ;;
8590 *3p) dflt=3p ;;
8591 *3pm) dflt=3pm ;;
8592 *l) dflt=l;;
8593 *n) dflt=n;;
8594 *o) dflt=o;;
8595 *p) dflt=p;;
8596 *C) dflt=C;;
8597 *L) dflt=L;;
8598 *L3) dflt=L3;;
8599 *) dflt=3;;
8600 esac
8601 ;;
8602 *) dflt="$man3ext";;
8603 esac
8604 . ./myread
8605 man3ext="$ans"
8606 ;;
8607esac
8608
8609: see if we have to deal with yellow pages, now NIS.
0384a54a 8610if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8611 if $test -f /usr/etc/nibindd; then
8612 echo " "
8613 echo "I'm fairly confident you're on a NeXT."
8614 echo " "
8615 rp='Do you get the hosts file via NetInfo?'
8616 dflt=y
8617 case "$hostcat" in
8618 nidump*) ;;
8619 '') ;;
8620 *) dflt=n;;
8621 esac
8622 . ./myread
8623 case "$ans" in
8624 y*) hostcat='nidump hosts .';;
8625 *) case "$hostcat" in
8626 nidump*) hostcat='';;
8627 esac
8628 ;;
8629 esac
8630 fi
8631 case "$hostcat" in
8632 nidump*) ;;
8633 *)
8634 case "$hostcat" in
8635 *ypcat*) dflt=y;;
8636 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8637 dflt=y
8638 else
8639 dflt=n
8640 fi;;
8641 *) dflt=n;;
8642 esac
8643 echo " "
8644 rp='Are you getting the hosts file via yellow pages?'
8645 . ./myread
8646 case "$ans" in
8647 y*) hostcat='ypcat hosts';;
8648 *) hostcat='cat /etc/hosts';;
8649 esac
8650 ;;
8651 esac
8652fi
8653case "$hostcat" in
8654'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8655esac
8656case "$groupcat" in
8657'') test -f /etc/group && groupcat='cat /etc/group';;
8658esac
8659case "$passcat" in
8660'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8661esac
8662
8663: now get the host name
8664echo " "
8665echo "Figuring out host name..." >&4
8666case "$myhostname" in
8667'') cont=true
8668 echo 'Maybe "hostname" will work...'
73614538 8669 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8670 myhostname=$tans
8671 phostname=hostname
8672 cont=''
8673 fi
8674 ;;
8675*) cont='';;
8676esac
8677if $test "$cont"; then
8678 if ./xenix; then
8679 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8680 if tans=`cat /etc/systemid 2>&1` ; then
8681 myhostname=$tans
8682 phostname='cat /etc/systemid'
8683 echo "Whadyaknow. Xenix always was a bit strange..."
8684 cont=''
8685 fi
8686 elif $test -r /etc/systemid; then
8687 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8688 fi
8689fi
8690if $test "$cont"; then
8691 echo 'No, maybe "uuname -l" will work...'
73614538 8692 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8693 myhostname=$tans
8694 phostname='uuname -l'
8695 else
8696 echo 'Strange. Maybe "uname -n" will work...'
73614538 8697 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8698 myhostname=$tans
8699 phostname='uname -n'
8700 else
8701 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8702 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8703 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8704 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8705 else
8706 case "$myhostname" in
8707 '') echo "Does this machine have an identity crisis or something?"
8708 phostname='';;
8709 *)
8710 echo "Well, you said $myhostname before..."
8711 phostname='echo $myhostname';;
8712 esac
8713 fi
8714 fi
8715 fi
8716fi
52a549d0
JH
8717case "$myhostname" in
8718'') myhostname=noname ;;
8719esac
b4eb6b3d
JH
8720: you do not want to know about this
8721set $myhostname
8722myhostname=$1
8723
8724: verify guess
8725if $test "$myhostname" ; then
8726 dflt=y
8727 rp='Your host name appears to be "'$myhostname'".'" Right?"
8728 . ./myread
8729 case "$ans" in
8730 y*) ;;
8731 *) myhostname='';;
8732 esac
8733fi
8734
8735: bad guess or no guess
8736while $test "X$myhostname" = X ; do
8737 dflt=''
8738 rp="Please type the (one word) name of your host:"
8739 . ./myread
8740 myhostname="$ans"
8741done
8742
8743: translate upper to lower if necessary
8744case "$myhostname" in
8745*[A-Z]*)
8746 echo "(Normalizing case in your host name)"
8747 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8748 ;;
8749esac
8750
8751case "$myhostname" in
8752*.*)
8753 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8754 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8755 echo "(Trimming domain name from host name--host name is now $myhostname)"
8756 ;;
8757*) case "$mydomain" in
8758 '')
8759 {
8760 test "X$hostcat" = "Xypcat hosts" &&
8761 ypmatch "$myhostname" hosts 2>/dev/null |\
8762 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8763 $test -s hosts
8764 } || {
8765 test "X$hostcat" != "X" &&
8766 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8767 /[ ]$myhostname[ . ]/p" > hosts
8768 }
8769 tmp_re="[ . ]"
f08cbdd1
PP
8770 if $test -f hosts; then
8771 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8772 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8773 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8774 hosts | $sort | $uniq | \
8775 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8776 case `$echo X$dflt` in
8777 X*\ *) echo "(Several hosts in the database matched hostname)"
8778 dflt=.
8779 ;;
8780 X.) echo "(You do not have fully-qualified names in the hosts database)"
8781 ;;
8782 esac
8783 else
8784 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8785 dflt=.
f08cbdd1 8786 fi
b4eb6b3d
JH
8787 case "$dflt" in
8788 .)
8789 tans=`./loc resolv.conf X /etc /usr/etc`
8790 if $test -f "$tans"; then
8791 echo "(Attempting domain name extraction from $tans)"
8792 dflt=.`$sed -n -e 's/ / /g' \
8793 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
1d40d392 8794 -e 1q 2>/dev/null`
b4eb6b3d
JH
8795 case "$dflt" in
8796 .) dflt=.`$sed -n -e 's/ / /g' \
8797 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
1d40d392 8798 -e 1q 2>/dev/null`
b4eb6b3d
JH
8799 ;;
8800 esac
8801 fi
8802 ;;
8803 esac
8804 case "$dflt" in
8805 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8806 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8807 case "$dflt" in
8808 '') dflt='.';;
8809 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8810 esac
8811 ;;
8812 esac
59c9e5d6
PP
8813 case "$dflt$osname" in
8814 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8815 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8816 ;;
8817 esac
b4eb6b3d
JH
8818 case "$dflt" in
8819 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8820 dflt='.nonet'
b4eb6b3d
JH
8821 ;;
8822 esac
8823 $rm -f hosts
8824 ;;
8825 *) dflt="$mydomain";;
8826 esac;;
8827esac
8828echo " "
8829rp="What is your domain name?"
8830. ./myread
8831tans="$ans"
8832case "$ans" in
8833'') ;;
8834.*) ;;
8835*) tans=".$tans";;
8836esac
8837mydomain="$tans"
8838
8839: translate upper to lower if necessary
8840case "$mydomain" in
8841*[A-Z]*)
8842 echo "(Normalizing case in your domain name)"
8843 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8844 ;;
8845esac
8846
8847: a little sanity check here
8848case "$phostname" in
8849'') ;;
8850*)
8851 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8852 $myhostname$mydomain|$myhostname) ;;
8853 *)
8854 case "$phostname" in
8855 sed*)
8856 echo "(That doesn't agree with your whoami.h file, by the way.)"
8857 ;;
8858 *)
8859 echo "(That doesn't agree with your $phostname command, by the way.)"
8860 ;;
8861 esac
8862 ;;
8863 esac
8864 ;;
8865esac
8866
776a38e3 8867: determine the e-mail address of the user who is running us
b4eb6b3d
JH
8868$cat <<EOM
8869
8870I need to get your e-mail address in Internet format if possible, i.e.
8871something like user@host.domain. Please answer accurately since I have
8872no easy means to double check it. The default value provided below
8873is most probably close to reality but may not be valid from outside
8874your organization...
8875
8876EOM
8877cont=x
8878while test "$cont"; do
8879 case "$cf_email" in
8880 '') dflt="$cf_by@$myhostname$mydomain";;
8881 *) dflt="$cf_email";;
8882 esac
8883 rp='What is your e-mail address?'
8884 . ./myread
8885 cf_email="$ans"
8886 case "$cf_email" in
8887 *@*.*) cont='' ;;
8888 *)
8889 rp='Address does not look like an Internet one. Use it anyway?'
8890 case "$fastread" in
8891 yes) dflt=y ;;
8892 *) dflt=n ;;
8893 esac
8894 . ./myread
8895 case "$ans" in
8896 y*) cont='' ;;
8897 *) echo " " ;;
8898 esac
8899 ;;
8900 esac
8901done
8902
34f1896b 8903: Ask e-mail of administrator
b4eb6b3d
JH
8904$cat <<EOM
8905
8906If you or somebody else will be maintaining perl at your site, please
8907fill in the correct e-mail address here so that they may be contacted
8908if necessary. Currently, the "perlbug" program included with perl
8909will send mail to this address in addition to perlbug@perl.org. You may
8910enter "none" for no administrator.
8911
8912EOM
8913case "$perladmin" in
8914'') dflt="$cf_email";;
8915*) dflt="$perladmin";;
8916esac
8917rp='Perl administrator e-mail address'
8918. ./myread
8919perladmin="$ans"
8920
674912d7
RB
8921: determine whether to only install version-specific parts.
8922echo " "
8923$cat <<EOM
8924Do you want to install only the version-specific parts of the perl
8925distribution? Usually you do *not* want to do this.
8926EOM
8927case "$versiononly" in
8928"$define"|[Yy]*|true) dflt='y' ;;
8929*) dflt='n';
8930esac
8931rp="Do you want to install only the version-specific parts of perl?"
8932. ./myread
8933case "$ans" in
8934[yY]*) val="$define";;
8935*) val="$undef" ;;
8936esac
8937set versiononly
8938eval $setvar
8939
ad493445
MB
8940case "$versiononly" in
8941"$define") inc_version_list=''
8942 inc_version_list_init=0
8943 ;;
8944esac
8945
b4eb6b3d 8946: figure out how to guarantee perl startup
d0e36aa9 8947: XXX Note that this currently takes advantage of the bug that binexp ignores
a2d23ec2
MB
8948: the Configure -Dinstallprefix setting, which in turn means that under
8949: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8950case "$startperl" in
8951'')
8952 case "$sharpbang" in
8953 *!)
8954 $cat <<EOH
8955
8956I can use the #! construct to start perl on your system. This will
8957make startup of perl scripts faster, but may cause problems if you
8958want to share those scripts and perl is not in a standard place
a2d23ec2
MB
8959($initialinstalllocation/perl) on all your platforms. The alternative
8960is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8961
8962EOH
674912d7 8963 case "$versiononly" in
a2d23ec2 8964 "$define") dflt="$initialinstalllocation/perl$version";;
d0e36aa9 8965 *) dflt="$initialinstalllocation/perl";;
674912d7 8966 esac
b4eb6b3d
JH
8967 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8968 . ./myread
8969 case "$ans" in
8970 none) startperl=": # use perl";;
8971 *) startperl="#!$ans"
8972 if $test 30 -lt `echo "$ans" | wc -c`; then
8973 $cat >&4 <<EOM
8974
8975WARNING: Some systems limit the #! command to 32 characters.
8976If you experience difficulty running Perl scripts with #!, try
8977installing Perl in a directory with a shorter pathname.
8978
8979EOM
8980 fi ;;
8981 esac
8982 ;;
8983 *) startperl=": # use perl"
8984 ;;
8985 esac
8986 ;;
8987esac
8988echo "I'll use $startperl to start perl scripts."
8989
8990: figure best path for perl in scripts
8991case "$perlpath" in
8992'')
5e20a8ca 8993 case "$versiononly" in
d0e36aa9
NC
8994 "$define") perlpath="$initialinstalllocation/perl$version";;
8995 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8996 esac
b4eb6b3d
JH
8997 case "$startperl" in
8998 *!*) ;;
8999 *)
9000 $cat <<EOH
9001
9002I will use the "eval 'exec'" idiom to start Perl on your system.
9003I can use the full path of your Perl binary for this purpose, but
9004doing so may cause problems if you want to share those scripts and
d0e36aa9 9005Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
9006
9007EOH
d0e36aa9 9008 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
9009 rp="What path shall I use in \"eval 'exec'\"?"
9010 . ./myread
9011 perlpath="$ans"
9012 ;;
9013 esac
9014 ;;
9015esac
9016case "$startperl" in
9017*!*) ;;
9018*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9019esac
9020
9021: determine where public executable scripts go
9022set scriptdir scriptdir
9023eval $prefixit
9024case "$scriptdir" in
9025'')
9026 dflt="$bin"
9027 : guess some guesses
9028 $test -d /usr/share/scripts && dflt=/usr/share/scripts
9029 $test -d /usr/share/bin && dflt=/usr/share/bin
9030 $test -d /usr/local/script && dflt=/usr/local/script
9031 $test -d /usr/local/scripts && dflt=/usr/local/scripts
9032 $test -d $prefixexp/script && dflt=$prefixexp/script
9033 set dflt
9034 eval $prefixup
9035 ;;
9036*) dflt="$scriptdir"
9037 ;;
9038esac
9039$cat <<EOM
f3f1a2d8 9040
b4eb6b3d
JH
9041Some installations have a separate directory just for executable scripts so
9042that they can mount it across multiple architectures but keep the scripts in
9043one spot. You might, for example, have a subdirectory of /usr/share for this.
9044Or you might just lump your scripts in with all your other executables.
f3f1a2d8 9045
b4eb6b3d
JH
9046EOM
9047fn=d~
9048rp='Where do you keep publicly executable scripts?'
9049. ./getfile
9050if $test "X$ansexp" != "X$scriptdirexp"; then
9051 installscript=''
9052fi
f3f1a2d8 9053installscriptdir=''
79522dd2
NC
9054prefixvar=scriptdir
9055. ./setprefixvar
9056: A little fix up for an irregularly named variable.
9057installscript="$installscriptdir"
9058
b4eb6b3d
JH
9059: determine where add-on public executables go
9060case "$sitebin" in
9061'') dflt=$siteprefix/bin ;;
9062*) dflt=$sitebin ;;
9063esac
9064fn=d~
9065rp='Pathname where the add-on public executables should be installed?'
9066. ./getfile
79522dd2
NC
9067prefixvar=sitebin
9068. ./setprefixvar
b4eb6b3d 9069
6e1038e0 9070: determine where add-on html pages go
8d2cbf27 9071: There is no standard location, so try to copy the previously-selected
6e1038e0 9072: directory structure for the core html pages.
8d2cbf27
JH
9073case "$sitehtml1dir" in
9074'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9075*) dflt=$sitehtml1dir ;;
6e1038e0
MB
9076esac
9077case "$dflt" in
9078''|' ') dflt=none ;;
9079esac
9080fn=dn+~
9081rp='Pathname where the site-specific html pages should be installed?'
9082. ./getfile
79522dd2
NC
9083prefixvar=sitehtml1dir
9084. ./setprefixvar
6e1038e0
MB
9085
9086: determine where add-on library html pages go
9087: There is no standard location, so try to copy the previously-selected
9088: directory structure for the core html pages.
8d2cbf27
JH
9089case "$sitehtml3dir" in
9090'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9091*) dflt=$sitehtml3dir ;;
6e1038e0
MB
9092esac
9093case "$dflt" in
9094''|' ') dflt=none ;;
9095esac
9096fn=dn+~
9097rp='Pathname where the site-specific library html pages should be installed?'
9098. ./getfile
79522dd2
NC
9099prefixvar=sitehtml3dir
9100. ./setprefixvar
6e1038e0
MB
9101
9102: determine where add-on manual pages go
91e123a8
JH
9103case "$siteman1dir" in
9104'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9105*) dflt=$siteman1dir ;;
6e1038e0 9106esac
257059b5
JH
9107case "$dflt" in
9108''|' ') dflt=none ;;
9109esac
6e1038e0
MB
9110fn=dn+~
9111rp='Pathname where the site-specific manual pages should be installed?'
9112. ./getfile
79522dd2
NC
9113prefixvar=siteman1dir
9114. ./setprefixvar
6e1038e0
MB
9115
9116: determine where add-on library man pages go
91e123a8
JH
9117case "$siteman3dir" in
9118'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9119*) dflt=$siteman3dir ;;
6e1038e0 9120esac
257059b5
JH
9121case "$dflt" in
9122''|' ') dflt=none ;;
9123esac
6e1038e0
MB
9124fn=dn+~
9125rp='Pathname where the site-specific library manual pages should be installed?'
9126. ./getfile
79522dd2
NC
9127prefixvar=siteman3dir
9128. ./setprefixvar
6e1038e0
MB
9129
9130: determine where add-on public executable scripts go
9131case "$sitescript" in
9132'') dflt=$siteprefix/script
9133 $test -d $dflt || dflt=$sitebin ;;
9134*) dflt="$sitescript" ;;
9135esac
9136fn=d~+
9137rp='Pathname where add-on public executable scripts should be installed?'
9138. ./getfile
79522dd2
NC
9139prefixvar=sitescript
9140. ./setprefixvar
6e1038e0 9141
34f1896b 9142: Check if faststdio is requested and available
15b61c98
JH
9143case "$usefaststdio" in
9144$define|true|[yY]*|'')
9145 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9146 case "$xversion" in
9147 [68]) dflt='y' ;;
9148 *) dflt='n' ;;
9149 esac
9150 ;;
9151*) dflt='n';;
9152esac
9153cat <<EOM
9154
9155Perl can be built to use 'fast stdio', which means using the stdio
9156library but also directly manipulating the stdio buffers to enable
9157faster I/O. Using stdio is better for backward compatibility (especially
9158for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9159interface has been preferred instead of stdio.
9160
9161If this doesn't make any sense to you, just accept the default '$dflt'.
9162EOM
9163rp='Use the "fast stdio" if available?'
9164. ./myread
9165case "$ans" in
34f1896b 9166y|Y) val="$define" ;;
15b61c98
JH
9167*) val="$undef" ;;
9168esac
9169set usefaststdio
9170eval $setvar
9171
9172
96056487
JH
9173: define an is-a-typedef? function
9174typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9175case "$inclist" in
9176"") inclist="sys/types.h";;
9177esac;
9178eval "varval=\$$var";
9179case "$varval" in
9180"")
9181 $rm -f temp.c;
9182 for inc in $inclist; do
9183 echo "#include <$inc>" >>temp.c;
9184 done;
9185 echo "#ifdef $type" >> temp.c;
9186 echo "printf(\"We have $type\");" >> temp.c;
9187 echo "#endif" >> temp.c;
9188 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9189 if $contains $type temp.E >/dev/null 2>&1; then
9190 eval "$var=\$type";
9191 else
9192 eval "$var=\$def";
9193 fi;
9194 $rm -f temp.?;;
9195*) eval "$var=\$varval";;
9196esac'
9197
9198: define an is-a-typedef? function that prompts if the type is not available.
9199typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9200case "$inclist" in
9201"") inclist="sys/types.h";;
9202esac;
9203eval "varval=\$$var";
9204case "$varval" in
9205"")
9206 $rm -f temp.c;
9207 for inc in $inclist; do
9208 echo "#include <$inc>" >>temp.c;
9209 done;
9210 echo "#ifdef $type" >> temp.c;
9211 echo "printf(\"We have $type\");" >> temp.c;
9212 echo "#endif" >> temp.c;
9213 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9214 echo " " ;
9215 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9216 if $contains $type temp.E >/dev/null 2>&1; then
9217 echo "$type found." >&4;
9218 eval "$var=\$type";
9219 else
9220 echo "$type NOT found." >&4;
9221 dflt="$def";
9222 . ./myread ;
9223 eval "$var=\$ans";
9224 fi;
9225 $rm -f temp.?;;
9226*) eval "$var=\$varval";;
9227esac'
9228
9229: see what type lseek is declared as in the kernel
9230rp="What is the type used for lseek's offset on this system?"
9231set off_t lseektype long stdio.h sys/types.h
9232eval $typedef_ask
9233
9234echo " "
9235echo "Checking to see how big your file offsets are..." >&4
9236$cat >try.c <<EOCP
9237#include <sys/types.h>
9238#include <stdio.h>
9239int main()
9240{
9241 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9242 return(0);
96056487
JH
9243}
9244EOCP
9245set try
9246if eval $compile_ok; then
9247 lseeksize=`$run ./try`
9248 echo "Your file offsets are $lseeksize bytes long."
9249else
9250 dflt=$longsize
9251 echo " "
9252 echo "(I can't seem to compile the test program. Guessing...)"
9253 rp="What is the size of your file offsets (in bytes)?"
9254 . ./myread
9255 lseeksize="$ans"
9256fi
5b813a60 9257$rm_try
96056487
JH
9258
9259: see what type file positions are declared as in the library
9260rp="What is the type for file position used by fsetpos()?"
9261set fpos_t fpostype long stdio.h sys/types.h
9262eval $typedef_ask
9263
613d6c3e 9264: Check size for Fpos_t
96056487
JH
9265echo " "
9266case "$fpostype" in
9267*_t) zzz="$fpostype" ;;
9268*) zzz="fpos_t" ;;
9269esac
613d6c3e 9270echo "Checking the size of $zzz..." >&4
96056487
JH
9271cat > try.c <<EOCP
9272#include <sys/types.h>
9273#include <stdio.h>
d1daaddf
JH
9274#$i_stdlib I_STDLIB
9275#ifdef I_STDLIB
9276#include <stdlib.h>
9277#endif
96056487
JH
9278int main() {
9279 printf("%d\n", (int)sizeof($fpostype));
9280 exit(0);
9281}
9282EOCP
9283set try
9284if eval $compile_ok; then
9285 yyy=`$run ./try`
9286 case "$yyy" in
9287 '') fpossize=4
9288 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9289 ;;
9290 *) fpossize=$yyy
9291 echo "Your $zzz is $fpossize bytes long."
9292 ;;
9293 esac
9294else
9295 dflt="$longsize"
9296 echo " " >&4
9297 echo "(I can't compile the test program. Guessing...)" >&4
9298 rp="What is the size of your file positions (in bytes)?"
9299 . ./myread
9300 fpossize="$ans"
9301fi
9302
613d6c3e 9303: Check for large file support
96056487
JH
9304# Backward compatibility (uselfs is deprecated).
9305case "$uselfs" in
9306"$define"|true|[yY]*)
9307 cat <<EOM >&4
9308
9309*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9310EOM
9311 uselargefiles="$define"
9312 ;;
5b813a60 9313esac
96056487
JH
9314
9315case "$lseeksize:$fpossize" in
93168:8) cat <<EOM
9317
9318You can have files larger than 2 gigabytes.
9319EOM
9320 val="$define" ;;
9321*) case "$uselargefiles" in
9322 "$undef"|false|[nN]*) dflt='n' ;;
9323 *) dflt='y' ;;
9324 esac
9325 cat <<EOM
9326
9327Perl can be built to understand large files (files larger than 2 gigabytes)
9328on some systems. To do so, Configure can be run with -Duselargefiles.
9329
9330If this doesn't make any sense to you, just accept the default '$dflt'.
9331EOM
9332 rp='Try to understand large files, if available?'
9333 . ./myread
9334 case "$ans" in
9335 y|Y) val="$define" ;;
9336 *) val="$undef" ;;
9337 esac
9338 ;;
9339esac
9340set uselargefiles
9341eval $setvar
96056487
JH
9342: Look for a hint-file generated 'call-back-unit'. If the
9343: user has specified that a large files perl is to be built,
9344: we may need to set or change some other defaults.
9da7673b
MB
9345if $test -f uselargefiles.cbu; then
9346 echo "Your platform has some specific hints regarding large file builds, using them..."
9347 . ./uselargefiles.cbu
9348fi
9349case "$uselargefiles" in
9350"$define")
96056487 9351 if $test -f uselargefiles.cbu; then
96056487
JH
9352 echo " "
9353 echo "Rechecking to see how big your file offsets are..." >&4
9354 $cat >try.c <<EOCP
9355#include <sys/types.h>
9356#include <stdio.h>
9357int main()
9358{
9359 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9360 return(0);
96056487
JH
9361}
9362EOCP
9363 set try
9364 if eval $compile_ok; then
9365 lseeksize=`$run ./try`
9366 $echo "Your file offsets are now $lseeksize bytes long."
9367 else
9368 dflt="$lseeksize"
9369 echo " "
9370 echo "(I can't seem to compile the test program. Guessing...)"
9371 rp="What is the size of your file offsets (in bytes)?"
9372 . ./myread
9373 lseeksize="$ans"
9374 fi
9375 case "$fpostype" in
9376 *_t) zzz="$fpostype" ;;
9377 *) zzz="fpos_t" ;;
9378 esac
5b813a60 9379 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9380 $cat > try.c <<EOCP
9381#include <sys/types.h>
9382#include <stdio.h>
55954f19
JH
9383#$i_stdlib I_STDLIB
9384#ifdef I_STDLIB
9385#include <stdlib.h>
9386#endif
96056487
JH
9387int main() {
9388 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9389 return(0);
96056487
JH
9390}
9391EOCP
9392 set try
9393 if eval $compile_ok; then
9394 yyy=`$run ./try`
9395 dflt="$lseeksize"
9396 case "$yyy" in
9397 '') echo " "
9398 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9399 ;;
9400 *) fpossize=$yyy
9401 echo " $fpossize bytes." >&4
9402 ;;
9403 esac
9404 else
9405 dflt="$fpossize"
9406 echo " "
9407 echo "(I can't compile the test program. Guessing...)" >&4
9408 rp="What is the size of your file positions (in bytes)?"
9409 . ./myread
9410 fpossize="$ans"
9411 fi
5b813a60 9412 $rm_try
96056487
JH
9413 fi
9414 ;;
9415esac
9416
613d6c3e 9417: Set the vendorbin variables
b4eb6b3d
JH
9418case "$vendorprefix" in
9419'') d_vendorbin="$undef"
9420 vendorbin=''
9421 vendorbinexp=''
9422 ;;
9423*) d_vendorbin="$define"
9424 : determine where vendor-supplied executables go.
9425 case "$vendorbin" in
9426 '') dflt=$vendorprefix/bin ;;
9427 *) dflt="$vendorbin" ;;
9428 esac
9429 fn=d~+
9430 rp='Pathname for the vendor-supplied executables directory?'
9431 . ./getfile
9432 vendorbin="$ans"
9433 vendorbinexp="$ansexp"
9434 ;;
9435esac
a092d240
NC
9436prefixvar=vendorbin
9437. ./installprefix
b4eb6b3d 9438
613d6c3e 9439: Set the vendorhtml1dir variables
6e1038e0 9440case "$vendorprefix" in
8d2cbf27
JH
9441'') vendorhtml1dir=''
9442 vendorhtml1direxp=''
6e1038e0
MB
9443 ;;
9444*) : determine where vendor-supplied html pages go.
9445 : There is no standard location, so try to copy the previously-selected
9446 : directory structure for the core html pages.
9447 : XXX Better default suggestions would be welcome.
8d2cbf27 9448 case "$vendorhtml1dir" in
6e1038e0 9449 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9450 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9451 esac
9452 case "$dflt" in
9453 ''|' ') dflt=none ;;
9454 esac
9455 fn=dn+~
9456 rp='Pathname for the vendor-supplied html pages?'
9457 . ./getfile
8d2cbf27
JH
9458 vendorhtml1dir="$ans"
9459 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9460 ;;
9461esac
9462: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9463$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9464prefixvar=vendorhtml1dir
9465. ./installprefix
6e1038e0 9466
613d6c3e 9467: Set the vendorhtml3dir variables
6e1038e0 9468case "$vendorprefix" in
8d2cbf27
JH
9469'') vendorhtml3dir=''
9470 vendorhtml3direxp=''
6e1038e0
MB
9471 ;;
9472*) : determine where vendor-supplied module html pages go.
9473 : There is no standard location, so try to copy the previously-selected
9474 : directory structure for the core html pages.
9475 : XXX Better default suggestions would be welcome.
8d2cbf27 9476 case "$vendorhtml3dir" in
6e1038e0 9477 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9478 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9479 esac
9480 case "$dflt" in
9481 ''|' ') dflt=none ;;
9482 esac
9483 fn=dn+~
9484 rp='Pathname for the vendor-supplied html pages?'
9485 . ./getfile
8d2cbf27
JH
9486 vendorhtml3dir="$ans"
9487 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9488 ;;
9489esac
9490: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9491$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9492prefixvar=vendorhtml3dir
9493. ./installprefix
6e1038e0 9494
613d6c3e 9495: Set the vendorman1dir variables
6e1038e0 9496case "$vendorprefix" in
91e123a8
JH
9497'') vendorman1dir=''
9498 vendorman1direxp=''
6e1038e0
MB
9499 ;;
9500*) : determine where vendor-supplied manual pages go.
91e123a8 9501 case "$vendorman1dir" in
6e1038e0 9502 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9503 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9504 esac
9505 case "$dflt" in
9506 ''|' ') dflt=none ;;
9507 esac
9508 fn=nd~+
9509 rp='Pathname for the vendor-supplied manual section 1 pages?'
9510 . ./getfile
91e123a8
JH
9511 vendorman1dir="$ans"
9512 vendorman1direxp="$ansexp"
6e1038e0
MB
9513 ;;
9514esac
9515: Use ' ' for none so value is preserved next time through Configure
91e123a8 9516$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9517prefixvar=vendorman1dir
9518. ./installprefix
6e1038e0 9519
613d6c3e 9520: Set the vendorman3dir variables
6e1038e0 9521case "$vendorprefix" in
91e123a8
JH
9522'') vendorman3dir=''
9523 vendorman3direxp=''
6e1038e0
MB
9524 ;;
9525*) : determine where vendor-supplied module manual pages go.
91e123a8 9526 case "$vendorman3dir" in
6e1038e0 9527 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9528 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9529 esac
9530 case "$dflt" in
9531 ''|' ') dflt=none ;;
9532 esac
9533 fn=nd~+
9534 rp='Pathname for the vendor-supplied manual section 3 pages?'
9535 . ./getfile
91e123a8
JH
9536 vendorman3dir="$ans"
9537 vendorman3direxp="$ansexp"
6e1038e0
MB
9538 ;;
9539esac
9540: Use ' ' for none so value is preserved next time through Configure
91e123a8 9541$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9542prefixvar=vendorman3dir
9543. ./installprefix
6e1038e0 9544
613d6c3e 9545: Set the vendorscript variables
6e1038e0
MB
9546case "$vendorprefix" in
9547'') d_vendorscript="$undef"
9548 vendorscript=''
9549 vendorscriptexp=''
9550 ;;
9551*) d_vendorscript="$define"
9552 : determine where vendor-supplied scripts go.
9553 case "$vendorscript" in
9554 '') dflt=$vendorprefix/script
9555 $test -d $dflt || dflt=$vendorbin ;;
9556 *) dflt="$vendorscript" ;;
9557 esac
9558 $cat <<EOM
9559
f3f1a2d8 9560The installation process will create a directory for
6e1038e0
MB
9561vendor-supplied scripts.
9562
9563EOM
9564 fn=d~+
9565 rp='Pathname for the vendor-supplied scripts directory?'
9566 . ./getfile
9567 vendorscript="$ans"
9568 vendorscriptexp="$ansexp"
9569 ;;
9570esac
a092d240
NC
9571prefixvar=vendorscript
9572. ./installprefix
6e1038e0 9573
f47f1645
TC
9574: script used to emit important warnings
9575cat >warn <<EOS
9576$startsh
9577if test \$# -gt 0; then
9578 echo "\$@" >msg
9579else
9580 cat >msg
9581fi
9582echo "*** WARNING:" >&4
9583sed -e 's/^/*** /' <msg >&4
9584echo "*** " >&4
9585cat msg >>config.msg
9586echo " " >>config.msg
9587rm -f msg
9588EOS
9589chmod +x warn
9590$eunicefix warn
9591
9592: see which of string.h or strings.h is needed
9593echo " "
9594strings=`./findhdr string.h`
9595if $test "$strings" && $test -r "$strings"; then
9596 echo "Using <string.h> instead of <strings.h>." >&4
9597 val="$define"
9598else
9599 val="$undef"
9600 strings=`./findhdr strings.h`
9601 if $test "$strings" && $test -r "$strings"; then
9602 echo "Using <strings.h> instead of <string.h>." >&4
9603 else
9604 ./warn "No string header found -- You'll surely have problems."
9605 fi
9606fi
9607set i_string
9608eval $setvar
9609case "$i_string" in
9610"$undef") strings=`./findhdr strings.h`;;
9611*) strings=`./findhdr string.h`;;
9612esac
9613
b4eb6b3d
JH
9614: see if qgcvt exists
9615set qgcvt d_qgcvt
9616eval $inlibc
9617
613d6c3e 9618: Check print/scan long double stuff
89ce900e
JH
9619echo " "
9620
9621if $test X"$d_longdbl" = X"$define"; then
9622
9623echo "Checking how to print long doubles..." >&4
9624
9625if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9626 $cat >try.c <<'EOCP'
9627#include <sys/types.h>
9628#include <stdio.h>
9629int main() {
9630 double d = 123.456;
9631 printf("%.3f\n", d);
9632}
9633EOCP
9634 set try
9635 if eval $compile; then
9636 yyy=`$run ./try`
9637 case "$yyy" in
9638 123.456)
9639 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9640 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9641 echo "We will use %f."
9642 ;;
9643 esac
9644 fi
9645fi
9646
9647if $test X"$sPRIfldbl" = X; then
9648 $cat >try.c <<'EOCP'
9649#include <sys/types.h>
9650#include <stdio.h>
9651int main() {
9652 long double d = 123.456;
9653 printf("%.3Lf\n", d);
9654}
9655EOCP
9656 set try
9657 if eval $compile; then
9658 yyy=`$run ./try`
9659 case "$yyy" in
9660 123.456)
9661 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9662 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9663 echo "We will use %Lf."
9664 ;;
9665 esac
9666 fi
9667fi
9668
9669if $test X"$sPRIfldbl" = X; then
9670 $cat >try.c <<'EOCP'
9671#include <sys/types.h>
9672#include <stdio.h>
9673int main() {
9674 long double d = 123.456;
9675 printf("%.3llf\n", d);
9676}
9677EOCP
9678 set try
9679 if eval $compile; then
9680 yyy=`$run ./try`
9681 case "$yyy" in
9682 123.456)
9683 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9684 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9685 echo "We will use %llf."
9686 ;;
9687 esac
9688 fi
9689fi
9690
9691if $test X"$sPRIfldbl" = X; then
9692 $cat >try.c <<'EOCP'
9693#include <sys/types.h>
9694#include <stdio.h>
9695int main() {
9696 long double d = 123.456;
9697 printf("%.3lf\n", d);
9698}
9699EOCP
9700 set try
9701 if eval $compile; then
9702 yyy=`$run ./try`
9703 case "$yyy" in
9704 123.456)
9705 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9706 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9707 echo "We will use %lf."
9708 ;;
9709 esac
9710 fi
9711fi
9712
9713if $test X"$sPRIfldbl" = X; then
9714 echo "Cannot figure out how to print long doubles." >&4
9715else
9716 sSCNfldbl=$sPRIfldbl # expect consistency
9717fi
9718
5b813a60 9719$rm_try
89ce900e
JH
9720
9721fi # d_longdbl
9722
9723case "$sPRIfldbl" in
5b813a60
MB
9724'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9725 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9726 d_SCNfldbl="$undef";
9727 ;;
5b813a60
MB
9728*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9729 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9730 d_SCNfldbl="$define";
9731 ;;
9732esac
9733
b4eb6b3d 9734: Check how to convert floats to strings.
a5b10d80
YST
9735
9736if test "X$d_Gconvert" = X; then
9737
b4eb6b3d
JH
9738echo " "
9739echo "Checking for an efficient way to convert floats to strings."
9740echo " " > try.c
9741case "$uselongdouble" in
9742"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9743esac
9744case "$d_longdbl" in
9745"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9746esac
9747case "$d_PRIgldbl" in
9748"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9749esac
9750$cat >>try.c <<EOP
9751#ifdef TRY_gconvert
9752#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9753char *myname = "gconvert";
9754#endif
9755#ifdef TRY_gcvt
9756#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9757char *myname = "gcvt";
9758#endif
9759#ifdef TRY_qgcvt
9760#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9761char *myname = "qgcvt";
9762#define DOUBLETYPE long double
9763#endif
9764#ifdef TRY_sprintf
a5b10d80
YST
9765#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9766#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9767#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9768#else
a5b10d80
YST
9769#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9770#endif
9771#else
b4eb6b3d
JH
9772#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9773#endif
9774char *myname = "sprintf";
9775#endif
9776
9777#ifndef DOUBLETYPE
9778#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9779#define DOUBLETYPE long double
9780#else
9781#define DOUBLETYPE double
9782#endif
9783#endif
9784
9785#include <stdio.h>
9786
f47f1645 9787#$i_stdlib I_STDLIB
b4eb6b3d
JH
9788#ifdef I_STDLIB
9789#include <stdlib.h>
9790#endif
f47f1645
TC
9791#$i_string I_STRING
9792#ifdef I_STRING
9793# include <string.h>
9794#else
9795# include <strings.h>
9796#endif
b4eb6b3d 9797
f47f1645 9798int checkit(char *expect, char *got)
b4eb6b3d
JH
9799{
9800 if (strcmp(expect, got)) {
9801 printf("%s oddity: Expected %s, got %s\n",
9802 myname, expect, got);
9803 exit(1);
9804 }
9805}
9806
9807int main()
5b813a60
MB
9808{
9809 char buf[64];
b4eb6b3d
JH
9810 buf[63] = '\0';
9811
9812 /* This must be 1st test on (which?) platform */
9813 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9814 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9815 checkit("0.1", buf);
9816
5b813a60 9817 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9818 checkit("0.01", buf);
9819
5b813a60 9820 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9821 checkit("0.001", buf);
9822
5b813a60 9823 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9824 checkit("0.0001", buf);
9825
9826 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9827 if (strlen(buf) > 5)
9828 checkit("9e-005", buf); /* for Microsoft ?? */
9829 else
9830 checkit("9e-05", buf);
9831
5b813a60 9832 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9833 checkit("1", buf);
9834
5b813a60 9835 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9836 checkit("1.1", buf);
9837
5b813a60 9838 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9839 checkit("1.01", buf);
9840
5b813a60 9841 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9842 checkit("1.001", buf);
9843
5b813a60 9844 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9845 checkit("1.0001", buf);
9846
5b813a60 9847 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9848 checkit("1.00001", buf);
9849
5b813a60 9850 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9851 checkit("1.000001", buf);
9852
5b813a60 9853 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9854 checkit("0", buf);
9855
5b813a60 9856 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9857 checkit("-1", buf);
9858
9859 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9860 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9861 checkit("100000", buf);
5b813a60 9862
b4eb6b3d 9863 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9864 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9865 checkit("-100000", buf);
9866
5b813a60 9867 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9868 checkit("123.456", buf);
9869
ab6ca9f4 9870 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9871 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9872 /* 34 should be enough to scare even long double
9873 * places into using the e notation. */
ab6ca9f4 9874 if (strlen(buf) > 5)
94b339ad 9875 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9876 else
94b339ad 9877 checkit("1e+34", buf);
8e2a5ede 9878
d1eb8299
YST
9879 /* For Perl, if you add additional tests here, also add them to
9880 * t/base/num.t for benefit of platforms not using Configure or
9881 * overriding d_Gconvert */
9882
b4eb6b3d
JH
9883 exit(0);
9884}
9885EOP
ab6ca9f4 9886: first add preferred functions to our list
a5b10d80 9887xxx_list=""
ab6ca9f4 9888for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9889 case $xxx_convert in
9890 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9891 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9892 esac
a5b10d80
YST
9893done
9894: then add any others
9895for xxx_convert in gconvert gcvt sprintf; do
9896 case "$xxx_list" in
9897 *$xxx_convert*) ;;
9898 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9899 esac
a5b10d80
YST
9900done
9901
9902case "$d_longdbl$uselongdouble" in
9903"$define$define")
9904 : again, add prefered functions to our list first
9905 xxx_ld_list=""
ab6ca9f4 9906 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9907 case $xxx_convert in
9908 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9909 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9910 esac
9911 done
9912 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9913 for xxx_convert in qgcvt sprintf $xxx_list; do
9914 case "$xxx_ld_list" in
9915 $xxx_convert*|*" $xxx_convert"*) ;;
9916 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9917 esac
9918 done
9919 : if sprintf cannot do long doubles, move it to the end
9920 if test "$d_PRIgldbl" != "$define"; then
9921 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9922 fi
9923 : if no qgcvt, remove it
9924 if test "$d_qgcvt" != "$define"; then
9925 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9926 fi
9927 : use the ld_list
9928 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9929 ;;
9930esac
9931
9932for xxx_convert in $xxx_list; do
9933 echo "Trying $xxx_convert..."
93451a0d 9934 $rm -f try try$_o core
b4eb6b3d
JH
9935 set try -DTRY_$xxx_convert
9936 if eval $compile; then
9937 echo "$xxx_convert() found." >&4
5440bc8e 9938 if $run ./try; then
b4eb6b3d
JH
9939 echo "I'll use $xxx_convert to convert floats into a string." >&4
9940 break;
9941 else
9942 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9943 xxx_convert=''
b4eb6b3d
JH
9944 fi
9945 else
9946 echo "$xxx_convert NOT found." >&4
9947 fi
9948done
ab6ca9f4 9949
a5b10d80
YST
9950if test X$xxx_convert = X; then
9951 echo "*** WHOA THERE!!! ***" >&4
9952 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9953 xxx_convert=sprintf
9954fi
9955
b4eb6b3d
JH
9956case "$xxx_convert" in
9957gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9958gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9959qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9960*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9961 "$define$define$define")
9962 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9963 "$define$define$undef")
9964 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9965 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9966 esac
5b813a60 9967 ;;
b4eb6b3d
JH
9968esac
9969
a5b10d80 9970fi
93451a0d 9971$rm_try
a5b10d80 9972
74cac757
JH
9973: see if _fwalk exists
9974set fwalk d__fwalk
9975eval $inlibc
9976
b4eb6b3d
JH
9977: Initialize h_fcntl
9978h_fcntl=false
9979
9980: Initialize h_sysfile
9981h_sysfile=false
9982
9983: access call always available on UNIX
9984set access d_access
9985eval $inlibc
9986
9987: locate the flags for 'access()'
9988case "$d_access" in
9989"$define")
9990 echo " "
55954f19 9991 $cat >access.c <<EOCP
b4eb6b3d
JH
9992#include <sys/types.h>
9993#ifdef I_FCNTL
9994#include <fcntl.h>
9995#endif
9996#ifdef I_SYS_FILE
9997#include <sys/file.h>
9998#endif
9999#ifdef I_UNISTD
10000#include <unistd.h>
10001#endif
55954f19
JH
10002#$i_stdlib I_STDLIB
10003#ifdef I_STDLIB
10004#include <stdlib.h>
10005#endif
b4eb6b3d
JH
10006int main() {
10007 exit(R_OK);
10008}
10009EOCP
10010 : check sys/file.h first, no particular reason here
10011 if $test `./findhdr sys/file.h` && \
7a282f6d 10012 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10013 h_sysfile=true;
10014 echo "<sys/file.h> defines the *_OK access constants." >&4
10015 elif $test `./findhdr fcntl.h` && \
7a282f6d 10016 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10017 h_fcntl=true;
10018 echo "<fcntl.h> defines the *_OK access constants." >&4
10019 elif $test `./findhdr unistd.h` && \
7a282f6d 10020 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10021 echo "<unistd.h> defines the *_OK access constants." >&4
10022 else
10023 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10024 fi
10025 ;;
10026esac
10027$rm -f access*
10028
10029: see if accessx exists
10030set accessx d_accessx
10031eval $inlibc
10032
89ce900e
JH
10033: see if aintl exists
10034set aintl d_aintl
10035eval $inlibc
10036
b4eb6b3d
JH
10037: see if alarm exists
10038set alarm d_alarm
10039eval $inlibc
10040
96938616
MB
10041: see if 64bit time functions exists
10042
10043set ctime64 d_ctime64
10044eval $inlibc
10045
10046set localtime64 d_localtime64
10047eval $inlibc
10048
10049set gmtime64 d_gmtime64
10050eval $inlibc
10051
10052set mktime64 d_mktime64
10053eval $inlibc
10054
10055set difftime64 d_difftime64
10056eval $inlibc
10057
10058set asctime64 d_asctime64
10059eval $inlibc
10060
a9dade78
JH
10061: see if POSIX threads are available
10062set pthread.h i_pthread
10063eval $inhdr
10064
10bc17b6
JH
10065: define a fucntion to check prototypes
10066$cat > protochk <<EOSH
10067$startsh
10068cc="$cc"
10069optimize="$optimize"
10070ccflags="$ccflags"
10071prototype="$prototype"
10072define="$define"
c944cfb9 10073rm_try="$rm_try"
a9dade78
JH
10074usethreads=$usethreads
10075i_pthread=$i_pthread
10076pthread_h_first=$pthread_h_first
10bc17b6
JH
10077EOSH
10078
10079$cat >> protochk <<'EOSH'
10080
5b813a60 10081$rm_try
10bc17b6
JH
10082foo="$1"
10083shift
10084while test $# -ge 2; do
10085 case "$1" in
10086 $define) echo "#include <$2>" >> try.c ;;
10087 literal) echo "$2" >> try.c ;;
10088 esac
cce6a207
MB
10089 # Extra magic for the benefit of systems that need pthread.h
10090 # to be included early to correctly detect threadsafe functions.
10091 # Such functions must guarantee themselves, though, that the usethreads
10092 # and i_pthread have been defined, before calling protochk.
10093 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10094 echo "#include <pthread.h>" >> try.c
10095 pthread_h_done=yes
10096 fi
10bc17b6
JH
10097 shift 2
10098done
10099test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10100cat >> try.c <<'EOCP'
10101#ifdef CAN_PROTOTYPE
10102#define _(args) args
10103#else
10104#define _(args) ()
10105#endif
10106EOCP
10107echo "$foo" >> try.c
10108echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10109$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10110status=$?
5b813a60 10111$rm_try
10bc17b6
JH
10112exit $status
10113EOSH
10114chmod +x protochk
10115$eunicefix protochk
10116
34f1896b 10117: Define hasproto macro for Configure internal use
89ce900e
JH
10118hasproto='varname=$1; func=$2; shift; shift;
10119while $test $# -ge 2; do
10120 case "$1" in
10121 $define) echo "#include <$2>";;
10122 esac ;
10123 shift 2;
10124done > try.c;
10125$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10126if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10127 echo "$func() prototype found.";
10128 val="$define";
10129else
10130 echo "$func() prototype NOT found.";
10131 val="$undef";
10132fi;
10133set $varname;
10134eval $setvar;
5b813a60 10135$rm_try tryout.c'
89ce900e 10136
10bc17b6
JH
10137: see if sys/types.h has to be included
10138set sys/types.h i_systypes
10139eval $inhdr
10140
10141: see if sys/select.h has to be included
10142set sys/select.h i_sysselct
10143eval $inhdr
10144
34f1896b 10145: Define hasfield macro for Configure internal use
10bc17b6
JH
10146hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10147while $test $# -ge 2; do
10148 case "$1" in
10149 $define) echo "#include <$2>";;
10150 esac ;
10151 shift 2;
10152done > try.c;
10153echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10154set try;
10155if eval $compile; then
10156 val="$define";
10157else
10158 val="$undef";
10159fi;
10160set $varname;
10161eval $setvar;
5b813a60 10162$rm_try'
10bc17b6
JH
10163
10164: see if we should include time.h, sys/time.h, or both
10165echo " "
10166if test "X$timeincl" = X; then
10167 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10168 $echo $n "I'm now running the test program...$c"
55954f19 10169 $cat >try.c <<EOCP
10bc17b6
JH
10170#include <sys/types.h>
10171#ifdef I_TIME
10172#include <time.h>
10173#endif
10174#ifdef I_SYSTIME
10175#ifdef SYSTIMEKERNEL
10176#define KERNEL
10177#endif
10178#include <sys/time.h>
10179#endif
10180#ifdef I_SYSSELECT
10181#include <sys/select.h>
10182#endif
55954f19
JH
10183#$i_stdlib I_STDLIB
10184#ifdef I_STDLIB
10185#include <stdlib.h>
10186#endif
10bc17b6
JH
10187int main()
10188{
10189 struct tm foo;
10190#ifdef S_TIMEVAL
10191 struct timeval bar;
10192#endif
10193#ifdef S_TIMEZONE
10194 struct timezone tzp;
10195#endif
10196 if (foo.tm_sec == foo.tm_sec)
10197 exit(0);
10198#ifdef S_TIMEVAL
10199 if (bar.tv_sec == bar.tv_sec)
10200 exit(0);
10201#endif
10202 exit(1);
10203}
10204EOCP
10205 flags=''
10206 for s_timezone in '-DS_TIMEZONE' ''; do
10207 sysselect=''
10208 for s_timeval in '-DS_TIMEVAL' ''; do
10209 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10210 for i_time in '' '-DI_TIME'; do
10211 for i_systime in '-DI_SYSTIME' ''; do
10212 case "$flags" in
10213 '') $echo $n ".$c"
10214 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10215 if eval $compile; then
10216 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10217 shift
10218 flags="$*"
10219 echo " "
10220 $echo $n "Succeeded with $flags$c"
10221 fi
10222 ;;
10223 esac
10224 done
10225 done
10226 done
10227 done
10228 done
10229 timeincl=''
10230 echo " "
10231 case "$flags" in
10232 *SYSTIMEKERNEL*) i_systimek="$define"
10233 timeincl=`./findhdr sys/time.h`
10234 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10235 *) i_systimek="$undef";;
10236 esac
10237 case "$flags" in
10238 *I_TIME*) i_time="$define"
10239 timeincl=`./findhdr time.h`" $timeincl"
10240 echo "We'll include <time.h>." >&4;;
10241 *) i_time="$undef";;
10242 esac
10243 case "$flags" in
10244 *I_SYSTIME*) i_systime="$define"
10245 timeincl=`./findhdr sys/time.h`" $timeincl"
10246 echo "We'll include <sys/time.h>." >&4;;
10247 *) i_systime="$undef";;
10248 esac
5b813a60 10249 $rm_try
10bc17b6
JH
10250fi
10251: see if struct tm knows about tm_zone
10252case "$i_systime$i_time" in
5b813a60 10253*$define*)
10bc17b6
JH
10254 echo " "
10255 echo "Checking to see if your struct tm has tm_zone field..." >&4
10256 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10257 eval $hasfield
10258 ;;
10259*) val="$undef"
10260 set d_tm_tm_zone
10261 eval $setvar
10262 ;;
10263esac
10264case "$d_tm_tm_zone" in
10265"$define") echo "Yes, it does." ;;
10266*) echo "No, it doesn't." ;;
10267esac
10268: see if struct tm knows about tm_gmtoff
10269case "$i_systime$i_time" in
5b813a60 10270*$define*)
10bc17b6
JH
10271 echo " "
10272 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10273 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10274 eval $hasfield
10275 ;;
10276*) val="$undef"
10277 set d_tm_tm_gmtoff
10278 eval $setvar
10279 ;;
10280esac
10281case "$d_tm_tm_gmtoff" in
10282"$define") echo "Yes, it does." ;;
10283*) echo "No, it doesn't." ;;
10284esac
10285
10286: see if asctime_r exists
10287set asctime_r d_asctime_r
10288eval $inlibc
10289case "$d_asctime_r" in
10290"$define")
d63eadf0 10291 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10292 case "$d_asctime_r_proto:$usethreads" in
10293 ":define") d_asctime_r_proto=define
a48ec845
JH
10294 set d_asctime_r_proto asctime_r $hdrs
10295 eval $hasproto ;;
10296 *) ;;
10297 esac
10298 case "$d_asctime_r_proto" in
10299 define)
10bc17b6
JH
10300 case "$asctime_r_proto" in
10301 ''|0) try='char* asctime_r(const struct tm*, char*);'
61c26d18 10302 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10bc17b6
JH
10303 esac
10304 case "$asctime_r_proto" in
10305 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
61c26d18 10306 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10bc17b6
JH
10307 esac
10308 case "$asctime_r_proto" in
10309 ''|0) try='int asctime_r(const struct tm*, char*);'
61c26d18 10310 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10bc17b6
JH
10311 esac
10312 case "$asctime_r_proto" in
10313 ''|0) try='int asctime_r(const struct tm*, char*, int);'
61c26d18 10314 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10bc17b6
JH
10315 esac
10316 case "$asctime_r_proto" in
90e831dc 10317 ''|0) d_asctime_r=undef
10bc17b6 10318 asctime_r_proto=0
a48ec845 10319 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10320 * ) case "$asctime_r_proto" in
10321 REENTRANT_PROTO*) ;;
10322 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10323 esac
10324 echo "Prototype: $try" ;;
10325 esac
10326 ;;
c18e646a
JH
10327 *) case "$usethreads" in
10328 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10329 esac
90e831dc
SB
10330 d_asctime_r=undef
10331 asctime_r_proto=0
c18e646a 10332 ;;
a48ec845
JH
10333 esac
10334 ;;
10bc17b6
JH
10335*) asctime_r_proto=0
10336 ;;
10337esac
10338
b4eb6b3d
JH
10339: see if atolf exists
10340set atolf d_atolf
10341eval $inlibc
10342
10343: see if atoll exists
10344set atoll d_atoll
10345eval $inlibc
10346
0dbb1585
AL
10347: Look for GCC-style attribute format
10348case "$d_attribute_format" in
bde30f85 10349'')
b4eb6b3d 10350echo " "
0dbb1585 10351echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10352$cat >attrib.c <<'EOCP'
10353#include <stdio.h>
0dbb1585 10354void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10355EOCP
10356if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10357 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10358 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10359 val="$undef"
10360 else
0dbb1585 10361 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10362 val="$define"
10363 fi
10364else
10365 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10366 val="$undef"
10367fi
bde30f85 10368;;
0dbb1585 10369*) val="$d_attribute_format" ;;
bde30f85 10370esac
0dbb1585
AL
10371set d_attribute_format
10372eval $setvar
10373$rm -f attrib*
10374
dcb594bc
MB
10375: Look for GCC-style attribute format with null format allowed
10376case "$d_printf_format_null" in
10377'') case "$d_attribute_format" in
10378 $define)
10379 echo " "
10380 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10381$cat >attrib.c <<EOCP
10382#include <stdio.h>
10383#$i_stdlib I_STDLIB
10384#ifdef I_STDLIB
10385#include <stdlib.h>
10386#endif
10387int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10388int null_printf (char* pat,...) { return (int)pat; }
10389int main () { exit(null_printf(NULL)); }
10390EOCP
10391 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10392 : run the executable in case it produces a run-time warning
10393 if $run ./attrib >>attrib.out 2>&1; then
10394 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10395 echo "Your C compiler doesn't allow __printf__ format to be null."
10396 val="$undef"
10397 else
10398 echo "Your C compiler allows __printf__ format to be null."
10399 val="$define"
10400 fi
10401 else
10402 echo "Your C compiler executable failed with __printf__ format null."
10403 val="$undef"
10404 fi
10405 else
10406 echo "Your C compiler fails with __printf__ format null."
10407 val="$undef"
10408 fi
10409 ;;
10410 *) val="$undef" ;;
10411 esac
10412;;
10413*) val="$d_printf_format_null" ;;
10414esac
10415set d_printf_format_null
10416eval $setvar
10417$rm -f attrib*
10418
0dbb1585
AL
10419: Look for GCC-style attribute malloc
10420case "$d_attribute_malloc" in
10421'')
10422echo " "
10423echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10424$cat >attrib.c <<'EOCP'
10425#include <stdio.h>
10426char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10427EOCP
10428if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10429 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10430 echo "Your C compiler doesn't support __attribute__((malloc))."
10431 val="$undef"
10432 else
10433 echo "Your C compiler supports __attribute__((malloc))."
10434 val="$define"
10435 fi
10436else
10437 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10438 val="$undef"
10439fi
10440;;
10441*) val="$d_attribute_malloc" ;;
10442esac
10443set d_attribute_malloc
10444eval $setvar
10445$rm -f attrib*
10446
10447: Look for GCC-style attribute nonnull
10448case "$d_attribute_nonnull" in
10449'')
10450echo " "
10451echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10452$cat >attrib.c <<'EOCP'
10453#include <stdio.h>
10454void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10455EOCP
10456if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10457 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10458 echo "Your C compiler doesn't support __attribute__((nonnull))."
10459 val="$undef"
10460 else
10461 echo "Your C compiler supports __attribute__((nonnull))."
10462 val="$define"
10463 fi
10464else
10465 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10466 val="$undef"
10467fi
10468;;
10469*) val="$d_attribute_nonnull" ;;
10470esac
10471set d_attribute_nonnull
10472eval $setvar
10473$rm -f attrib*
10474
10475: Look for GCC-style attribute noreturn
10476case "$d_attribute_noreturn" in
10477'')
10478echo " "
10479echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10480$cat >attrib.c <<'EOCP'
10481#include <stdio.h>
10482void fall_over_dead( void ) __attribute__((noreturn));
10483EOCP
10484if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10485 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10486 echo "Your C compiler doesn't support __attribute__((noreturn))."
10487 val="$undef"
10488 else
10489 echo "Your C compiler supports __attribute__((noreturn))."
10490 val="$define"
10491 fi
10492else
10493 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10494 val="$undef"
10495fi
10496;;
10497*) val="$d_attribute_noreturn" ;;
10498esac
10499set d_attribute_noreturn
10500eval $setvar
10501$rm -f attrib*
10502
10503: Look for GCC-style attribute pure
10504case "$d_attribute_pure" in
10505'')
10506echo " "
10507echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10508$cat >attrib.c <<'EOCP'
10509#include <stdio.h>
10510int square( int n ) __attribute__((pure));
10511EOCP
10512if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10513 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10514 echo "Your C compiler doesn't support __attribute__((pure))."
10515 val="$undef"
10516 else
10517 echo "Your C compiler supports __attribute__((pure))."
10518 val="$define"
10519 fi
10520else
10521 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10522 val="$undef"
10523fi
10524;;
10525*) val="$d_attribute_pure" ;;
10526esac
10527set d_attribute_pure
10528eval $setvar
10529$rm -f attrib*
10530
10531: Look for GCC-style attribute unused
10532case "$d_attribute_unused" in
10533'')
10534echo " "
10535echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10536$cat >attrib.c <<'EOCP'
10537#include <stdio.h>
10538int do_something( int dummy __attribute__((unused)), int n );
10539EOCP
10540if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10541 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10542 echo "Your C compiler doesn't support __attribute__((unused))."
10543 val="$undef"
10544 else
10545 echo "Your C compiler supports __attribute__((unused))."
10546 val="$define"
10547 fi
10548else
10549 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10550 val="$undef"
10551fi
10552;;
10553*) val="$d_attribute_unused" ;;
10554esac
10555set d_attribute_unused
10556eval $setvar
10557$rm -f attrib*
10558
fcdf39cf
RGS
10559: Look for GCC-style attribute deprecated
10560case "$d_attribute_deprecated" in
10561'')
10562echo " "
10563echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10564$cat >attrib.c <<'EOCP'
10565#include <stdio.h>
10566int I_am_deprecated(void) __attribute__((deprecated));
10567EOCP
10568if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10569 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10570 echo "Your C compiler doesn't support __attribute__((deprecated))."
10571 val="$undef"
10572 else
10573 echo "Your C compiler supports __attribute__((deprecated))."
10574 val="$define"
10575 fi
10576else
10577 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10578 val="$undef"
10579fi
10580;;
10581*) val="$d_attribute_deprecated" ;;
10582esac
10583set d_attribute_deprecated
10584eval $setvar
10585$rm -f attrib*
10586
0dbb1585
AL
10587: Look for GCC-style attribute warn_unused_result
10588case "$d_attribute_warn_unused_result" in
10589'')
10590echo " "
10591echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10592$cat >attrib.c <<'EOCP'
10593#include <stdio.h>
10594int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10595EOCP
10596if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10597 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10598 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10599 val="$undef"
10600 else
10601 echo "Your C compiler supports __attribute__((warn_unused_result))."
10602 val="$define"
10603 fi
10604else
10605 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10606 val="$undef"
10607fi
10608;;
10609*) val="$d_attribute_warn_unused_result" ;;
10610esac
10611set d_attribute_warn_unused_result
b4eb6b3d
JH
10612eval $setvar
10613$rm -f attrib*
10614
10615: see if bcmp exists
10616set bcmp d_bcmp
10617eval $inlibc
10618
10619: see if bcopy exists
10620set bcopy d_bcopy
10621eval $inlibc
10622
b4eb6b3d
JH
10623: see if getpgrp exists
10624set getpgrp d_getpgrp
10625eval $inlibc
10626
10627case "$d_getpgrp" in
10628"$define")
10629 echo " "
10630 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10631 $cat >try.c <<EOP
b4eb6b3d
JH
10632#$i_unistd I_UNISTD
10633#include <sys/types.h>
10634#ifdef I_UNISTD
10635# include <unistd.h>
10636#endif
55954f19
JH
10637#$i_stdlib I_STDLIB
10638#ifdef I_STDLIB
10639#include <stdlib.h>
10640#endif
b4eb6b3d
JH
10641int main()
10642{
10643 if (getuid() == 0) {
10644 printf("(I see you are running Configure as super-user...)\n");
10645 setuid(1);
10646 }
10647#ifdef TRY_BSD_PGRP
10648 if (getpgrp(1) == 0)
10649 exit(0);
10650#else
10651 if (getpgrp() > 0)
10652 exit(0);
10653#endif
10654 exit(1);
10655}
10656EOP
5440bc8e 10657 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10658 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10659 val="$define"
5440bc8e 10660 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10661 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10662 val="$undef"
10663 else
10664 echo "I can't seem to compile and run the test program."
10665 if ./usg; then
10666 xxx="a USG one, i.e. you use getpgrp()."
10667 else
10668 # SVR4 systems can appear rather BSD-ish.
10669 case "$i_unistd" in
10670 $undef)
10671 xxx="a BSD one, i.e. you use getpgrp(pid)."
10672 val="$define"
10673 ;;
10674 $define)
10675 xxx="probably a USG one, i.e. you use getpgrp()."
10676 val="$undef"
10677 ;;
10678 esac
10679 fi
10680 echo "Assuming your getpgrp is $xxx" >&4
10681 fi
10682 ;;
10683*) val="$undef";;
10684esac
10685set d_bsdgetpgrp
10686eval $setvar
5b813a60 10687$rm_try
b4eb6b3d
JH
10688
10689: see if setpgrp exists
10690set setpgrp d_setpgrp
10691eval $inlibc
10692
10693case "$d_setpgrp" in
10694"$define")
10695 echo " "
10696 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10697 $cat >try.c <<EOP
b4eb6b3d
JH
10698#$i_unistd I_UNISTD
10699#include <sys/types.h>
10700#ifdef I_UNISTD
10701# include <unistd.h>
10702#endif
55954f19
JH
10703#$i_stdlib I_STDLIB
10704#ifdef I_STDLIB
10705#include <stdlib.h>
10706#endif
b4eb6b3d
JH
10707int main()
10708{
10709 if (getuid() == 0) {
10710 printf("(I see you are running Configure as super-user...)\n");
10711 setuid(1);
10712 }
10713#ifdef TRY_BSD_PGRP
10714 if (-1 == setpgrp(1, 1))
10715 exit(0);
10716#else
10717 if (setpgrp() != -1)
10718 exit(0);
10719#endif
10720 exit(1);
10721}
10722EOP
5440bc8e 10723 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10724 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10725 val="$define"
5440bc8e 10726 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10727 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10728 val="$undef"
10729 else
10730 echo "(I can't seem to compile and run the test program.)"
10731 if ./usg; then
10732 xxx="a USG one, i.e. you use setpgrp()."
10733 else
10734 # SVR4 systems can appear rather BSD-ish.
10735 case "$i_unistd" in
10736 $undef)
10737 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10738 val="$define"
10739 ;;
10740 $define)
10741 xxx="probably a USG one, i.e. you use setpgrp()."
10742 val="$undef"
10743 ;;
10744 esac
10745 fi
10746 echo "Assuming your setpgrp is $xxx" >&4
10747 fi
10748 ;;
10749*) val="$undef";;
10750esac
10751set d_bsdsetpgrp
10752eval $setvar
5b813a60
MB
10753$rm_try
10754
635aebb7
AL
10755: Look for GCC-style __builtin_choose_expr
10756case "$d_builtin_choose_expr" in
10757'')
10758 echo " "
10759 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10760 $cat >try.c <<'EOCP'
10761#include <assert.h>
10762#include <stdlib.h>
10763#include <stdio.h>
10764
10765#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10766
10767int main(void) {
10768 assert( SYRINX(1) == 2112 );
10769 assert( SYRINX(1) != 5150 );
10770 assert( SYRINX(0) == 5150 );
10771 assert( SYRINX(0) != 2112 );
10772 puts( "All good!" );
10773 exit(0);
10774}
10775
10776EOCP
10777 set try
70ceb34a 10778 if eval $compile && $run ./try; then
635aebb7
AL
10779 echo "Your C compiler supports __builtin_choose_expr."
10780 val="$define"
10781 else
10782 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10783 val="$undef"
10784 fi
10785;;
10786*) val="$d_builtin_choose_expr" ;;
10787esac
10788
10789set d_builtin_choose_expr
10790eval $setvar
5b813a60 10791$rm_try
635aebb7
AL
10792
10793: Look for GCC-style __builtin_expect
10794case "$d_builtin_expect" in
10795'')
10796 echo " "
10797 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
70ceb34a 10798 $cat >try.c <<'EOCP'
635aebb7
AL
10799int main(void) {
10800 int n = 50;
10801 if ( __builtin_expect(n, 0) ) n = 1;
70ceb34a
NC
10802 /* Remember shell exit code truth is 0, C truth is non-zero */
10803 return !(n == 1);
635aebb7
AL
10804}
10805EOCP
10806 set try
70ceb34a
NC
10807 if eval $compile && $run ./try; then
10808 echo "Your C compiler supports __builtin_expect."
635aebb7
AL
10809 val="$define"
10810 else
70ceb34a 10811 echo "Your C compiler doesn't seem to understand __builtin_expect."
635aebb7
AL
10812 val="$undef"
10813 fi
10814 ;;
10815*) val="$d_builtin_expect" ;;
10816esac
10817
10818set d_builtin_expect
10819eval $setvar
5b813a60 10820$rm_try
635aebb7 10821
b4eb6b3d
JH
10822: see if bzero exists
10823set bzero d_bzero
10824eval $inlibc
10825
a2d23ec2
MB
10826: see if stdarg is available
10827echo " "
10828if $test `./findhdr stdarg.h`; then
10829 echo "<stdarg.h> found." >&4
10830 valstd="$define"
10831else
10832 echo "<stdarg.h> NOT found." >&4
10833 valstd="$undef"
10834fi
10835
10836: see if varags is available
10837echo " "
10838if $test `./findhdr varargs.h`; then
10839 echo "<varargs.h> found." >&4
10840else
10841 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10842fi
10843
10844: set up the varargs testing programs
10845$cat > varargs.c <<EOP
10846#ifdef I_STDARG
10847#include <stdarg.h>
10848#endif
10849#ifdef I_VARARGS
10850#include <varargs.h>
10851#endif
10852
10853#ifdef I_STDARG
10854int f(char *p, ...)
10855#else
10856int f(va_alist)
10857va_dcl
10858#endif
10859{
10860 va_list ap;
10861#ifndef I_STDARG
10862 char *p;
10863#endif
10864#ifdef I_STDARG
10865 va_start(ap,p);
10866#else
10867 va_start(ap);
10868 p = va_arg(ap, char *);
10869#endif
10870 va_end(ap);
4fb7dc7d 10871 return 0;
a2d23ec2
MB
10872}
10873EOP
10874$cat > varargs <<EOP
10875$startsh
10876if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10877 echo "true"
10878else
10879 echo "false"
10880fi
10881$rm -f varargs$_o
10882EOP
10883chmod +x varargs
10884
10885: now check which varargs header should be included
10886echo " "
10887i_varhdr=''
10888case "$valstd" in
10889"$define")
10890 if `./varargs I_STDARG`; then
10891 val='stdarg.h'
10892 elif `./varargs I_VARARGS`; then
10893 val='varargs.h'
10894 fi
10895 ;;
10896*)
10897 if `./varargs I_VARARGS`; then
10898 val='varargs.h'
10899 fi
10900 ;;
10901esac
10902case "$val" in
10903'')
10904echo "I could not find the definition for va_dcl... You have problems..." >&4
10905 val="$undef"; set i_stdarg; eval $setvar
10906 val="$undef"; set i_varargs; eval $setvar
10907 ;;
613d6c3e 10908*)
a2d23ec2
MB
10909 set i_varhdr
10910 eval $setvar
10911 case "$i_varhdr" in
10912 stdarg.h)
10913 val="$define"; set i_stdarg; eval $setvar
10914 val="$undef"; set i_varargs; eval $setvar
10915 ;;
10916 varargs.h)
10917 val="$undef"; set i_stdarg; eval $setvar
10918 val="$define"; set i_varargs; eval $setvar
10919 ;;
10920 esac
10921 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10922esac
10923$rm -f varargs*
10924
10925: see if the Compiler supports C99 variadic macros
10926case "$i_stdarg$i_stdlib" in
10927 "$define$define")
10928 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10929 $cat >try.c <<EOCP
10930#include <stdio.h>
10931#include <stdarg.h>
10932
10933#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10934
10935int main() {
10936 char buf[20];
10937 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10938 puts(buf);
10939 return 0;
10940}
10941EOCP
10942 set try
10943 if eval $compile && $run ./try 2>&1 >/dev/null; then
10944 case "`$run ./try`" in
10945 "123 456 789")
10946 echo "You have C99 variadic macros." >&4
10947 d_c99_variadic_macros="$define"
10948 ;;
10949 *)
10950 echo "You don't have functional C99 variadic macros." >&4
10951 d_c99_variadic_macros="$undef"
10952 ;;
10953 esac
10954 else
10955 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10956 d_c99_variadic_macros="$undef"
10957 fi
5b813a60 10958 $rm_try
a2d23ec2
MB
10959 ;;
10960 *)
10961 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10962 d_c99_variadic_macros="$undef"
10963 ;;
10964esac
10965
b4eb6b3d
JH
10966: see if signal is declared as pointer to function returning int or void
10967echo " "
10968xxx=`./findhdr signal.h`
10969$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10970if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10971 echo "You have int (*signal())() instead of void." >&4
10972 val="$undef"
10973elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10974 echo "You have void (*signal())()." >&4
10975 val="$define"
10976elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10977 echo "You have int (*signal())() instead of void." >&4
10978 val="$undef"
10979elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10980 echo "You have void (*signal())()." >&4
10981 val="$define"
10982else
10983 case "$d_voidsig" in
10984 '')
10985 echo "I can't determine whether signal handler returns void or int..." >&4
10986 dflt=void
10987 rp="What type does your signal handler return?"
10988 . ./myread
10989 case "$ans" in
10990 v*) val="$define";;
10991 *) val="$undef";;
10992 esac;;
10993 "$define")
10994 echo "As you already told me, signal handler returns void." >&4
10995 val="$define"
10996 ;;
10997 *) echo "As you already told me, signal handler returns int." >&4
10998 val="$undef"
10999 ;;
11000 esac
11001fi
11002set d_voidsig
11003eval $setvar
11004case "$d_voidsig" in
11005"$define") signal_t="void";;
11006*) signal_t="int";;
11007esac
11008$rm -f $$.tmp
11009
11010: check for ability to cast large floats to 32-bit ints.
11011echo " "
11012echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11013if $test "$intsize" -ge 4; then
11014 xxx=int
11015else
11016 xxx=long
11017fi
11018$cat >try.c <<EOCP
11019#include <stdio.h>
d1daaddf
JH
11020#$i_stdlib I_STDLIB
11021#ifdef I_STDLIB
11022#include <stdlib.h>
11023#endif
b4eb6b3d
JH
11024#include <sys/types.h>
11025#include <signal.h>
7090f861 11026$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
11027int main()
11028{
11029 $xxx i32;
11030 double f, g;
11031 int result = 0;
11032 char str[16];
11033 signal(SIGFPE, blech);
11034
5b813a60 11035 /* Don't let compiler optimize the test away. Store the number
e237eb00 11036 in a writable string for gcc to pass to sscanf under HP-UX.
b4eb6b3d
JH
11037 */
11038 sprintf(str, "2147483647");
11039 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11040 g = 10 * f;
11041 i32 = ($xxx) g;
11042
11043 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 11044 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
11045 behavior here, which is to preserve the sign and give
11046 back 0x7fff ffff.
11047 */
11048 if (i32 != ($xxx) f)
11049 result |= 1;
11050 exit(result);
11051}
11052EOCP
11053set try
11054if eval $compile_ok; then
5440bc8e 11055 $run ./try
b4eb6b3d
JH
11056 yyy=$?
11057else
11058 echo "(I can't seem to compile the test program--assuming it can't)"
11059 yyy=1
11060fi
11061case "$yyy" in
110620) val="$define"
11063 echo "Yup, it can."
11064 ;;
11065*) val="$undef"
11066 echo "Nope, it can't."
11067 ;;
11068esac
11069set d_casti32
11070eval $setvar
5b813a60 11071$rm_try
b4eb6b3d
JH
11072
11073: check for ability to cast negative floats to unsigned
11074echo " "
11075echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11076$cat >try.c <<EOCP
11077#include <stdio.h>
d1daaddf
JH
11078#$i_stdlib I_STDLIB
11079#ifdef I_STDLIB
11080#include <stdlib.h>
11081#endif
b4eb6b3d
JH
11082#include <sys/types.h>
11083#include <signal.h>
7090f861
JH
11084$signal_t blech(int s) { exit(7); }
11085$signal_t blech_in_list(int s) { exit(4); }
11086unsigned long dummy_long(unsigned long p) { return p; }
11087unsigned int dummy_int(unsigned int p) { return p; }
11088unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
11089int main()
11090{
11091 double f;
11092 unsigned long along;
11093 unsigned int aint;
11094 unsigned short ashort;
11095 int result = 0;
11096 char str[16];
5b813a60 11097
b4eb6b3d
JH
11098 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11099 a direct f = -123. assignment. gcc-2.8.0 reportedly
11100 optimized the whole file away
11101 */
5b813a60 11102 /* Store the number in a writable string for gcc to pass to
e237eb00 11103 sscanf under HP-UX.
b4eb6b3d
JH
11104 */
11105 sprintf(str, "-123");
11106 sscanf(str, "%lf", &f); /* f = -123.; */
11107
11108 signal(SIGFPE, blech);
11109 along = (unsigned long)f;
11110 aint = (unsigned int)f;
11111 ashort = (unsigned short)f;
11112 if (along != (unsigned long)-123)
11113 result |= 1;
11114 if (aint != (unsigned int)-123)
11115 result |= 1;
11116 if (ashort != (unsigned short)-123)
11117 result |= 1;
11118 sprintf(str, "1073741824.");
11119 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11120 f = f + f;
11121 along = 0;
11122 along = (unsigned long)f;
11123 if (along != 0x80000000)
11124 result |= 2;
11125 f -= 1.;
11126 along = 0;
11127 along = (unsigned long)f;
11128 if (along != 0x7fffffff)
11129 result |= 1;
11130 f += 2.;
11131 along = 0;
11132 along = (unsigned long)f;
11133 if (along != 0x80000001)
11134 result |= 2;
11135 if (result)
11136 exit(result);
11137 signal(SIGFPE, blech_in_list);
11138 sprintf(str, "123.");
11139 sscanf(str, "%lf", &f); /* f = 123.; */
11140 along = dummy_long((unsigned long)f);
11141 aint = dummy_int((unsigned int)f);
11142 ashort = dummy_short((unsigned short)f);
11143 if (along != (unsigned long)123)
11144 result |= 4;
11145 if (aint != (unsigned int)123)
11146 result |= 4;
11147 if (ashort != (unsigned short)123)
11148 result |= 4;
11149 exit(result);
11150
11151}
11152EOCP
11153set try
11154if eval $compile_ok; then
5440bc8e 11155 $run ./try
b4eb6b3d
JH
11156 castflags=$?
11157else
11158 echo "(I can't seem to compile the test program--assuming it can't)"
11159 castflags=7
11160fi
11161case "$castflags" in
111620) val="$define"
11163 echo "Yup, it can."
11164 ;;
11165*) val="$undef"
11166 echo "Nope, it can't."
11167 ;;
11168esac
11169set d_castneg
11170eval $setvar
5b813a60 11171$rm_try
b4eb6b3d
JH
11172
11173: see if vprintf exists
11174echo " "
11175if set vprintf val -f d_vprintf; eval $csym; $val; then
11176 echo 'vprintf() found.' >&4
11177 val="$define"
55954f19 11178 $cat >try.c <<EOF
d0bc9cc8
AD
11179#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11180#$i_varargs I_VARARGS
11181
55954f19 11182#$i_stdlib I_STDLIB
d0bc9cc8
AD
11183#$i_unistd I_UNISTD
11184
11185#ifdef I_STDARG
11186# include <stdarg.h>
11187#else /* I_VARARGS */
11188# include <varargs.h>
11189#endif
11190
11191#ifdef I_UNISTD
11192# include <unistd.h>
11193#endif
11194
55954f19 11195#ifdef I_STDLIB
d0bc9cc8 11196# include <stdlib.h>
55954f19 11197#endif
b4eb6b3d 11198
d0bc9cc8
AD
11199#include <stdio.h> /* vsprintf prototype */
11200
11201#ifdef I_STDARG
11202void xxx(int n, ...)
11203{
11204 va_list args;
11205 char buf[10];
11206 va_start(args, n);
11207 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11208}
11209int main() { xxx(1, "foo"); }
11210
11211#else /* I_VARARGS */
b4eb6b3d
JH
11212
11213xxx(va_alist)
11214va_dcl
11215{
d0bc9cc8
AD
11216 va_list args;
11217 char buf[10];
11218 va_start(args);
11219 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 11220}
d0bc9cc8
AD
11221int main() { xxx("foo"); }
11222
11223#endif
11224
b4eb6b3d 11225EOF
5440bc8e 11226 set try
d0bc9cc8
AD
11227 if eval $compile_ok; then
11228 if $run ./try; then
11229 echo "Your vsprintf() returns (int)." >&4
11230 val2="$undef"
11231 else
11232 echo "Your vsprintf() returns (char*)." >&4
11233 val2="$define"
11234 fi
b4eb6b3d 11235 else
d0bc9cc8
AD
11236 echo 'I am unable to compile the vsprintf() test program.' >&4
11237 # We shouldn't get here. If we do, assume the standard signature,
11238 # not the old BSD one.
11239 echo 'Guessing that vsprintf() returns (int).' >&4
11240 val2="$undef"
b4eb6b3d
JH
11241 fi
11242else
11243 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
11244 val="$undef"
11245 val2="$undef"
b4eb6b3d 11246fi
5b813a60 11247$rm_try
b4eb6b3d
JH
11248set d_vprintf
11249eval $setvar
11250val=$val2
11251set d_charvspr
11252eval $setvar
11253
11254: see if chown exists
11255set chown d_chown
11256eval $inlibc
11257
11258: see if chroot exists
11259set chroot d_chroot
11260eval $inlibc
11261
11262: see if chsize exists
11263set chsize d_chsize
11264eval $inlibc
11265
758a5d79
JH
11266: see if class exists
11267set class d_class
11268eval $inlibc
11269
b0a2e8e6
MB
11270: see if clearenv exists
11271set clearenv d_clearenv
11272eval $inlibc
11273
34f1896b 11274: Define hasstruct macro for Configure internal use
4e0554ec
JH
11275hasstruct='varname=$1; struct=$2; shift; shift;
11276while $test $# -ge 2; do
11277 case "$1" in
11278 $define) echo "#include <$2>";;
11279 esac ;
11280 shift 2;
11281done > try.c;
11282echo "int main () { struct $struct foo; }" >> try.c;
11283set try;
11284if eval $compile; then
11285 val="$define";
11286else
11287 val="$undef";
11288fi;
11289set $varname;
11290eval $setvar;
5b813a60 11291$rm_try'
4e0554ec 11292
34f1896b 11293: see whether socket exists
4e0554ec
JH
11294socketlib=''
11295sockethdr=''
4e0554ec
JH
11296echo " "
11297$echo $n "Hmm... $c" >&4
11298if set socket val -f d_socket; eval $csym; $val; then
11299 echo "Looks like you have Berkeley networking support." >&4
11300 d_socket="$define"
11301 if set setsockopt val -f; eval $csym; $val; then
11302 d_oldsock="$undef"
11303 else
11304 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11305 d_oldsock="$define"
11306 fi
11307else
11308 if $contains socklib libc.list >/dev/null 2>&1; then
11309 echo "Looks like you have Berkeley networking support." >&4
11310 d_socket="$define"
11311 : we will have to assume that it supports the 4.2 BSD interface
11312 d_oldsock="$undef"
11313 else
11314 echo "You don't have Berkeley networking in libc$_a..." >&4
11315 if test "X$d_socket" = "X$define"; then
11316 echo "...but you seem to believe that you have sockets." >&4
11317 else
11318 for net in net socket
11319 do
11320 if test -f /usr/lib/lib$net$_a; then
11321 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
11322 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11323 if $contains socket libc.list >/dev/null 2>&1; then
11324 d_socket="$define"
11325 socketlib="-l$net"
11326 case "$net" in
11327 net)
11328 echo "...but the Wollongong group seems to have hacked it in." >&4
11329 sockethdr="-I/usr/netinclude"
11330 ;;
11331 esac
5b813a60 11332 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
11333 if $contains setsockopt libc.list >/dev/null 2>&1; then
11334 d_oldsock="$undef"
11335 else
11336 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11337 d_oldsock="$define"
11338 fi
11339 break
11340 fi
11341 fi
11342 done
11343 if test "X$d_socket" != "X$define"; then
11344 echo "or anywhere else I see." >&4
11345 d_socket="$undef"
11346 d_oldsock="$undef"
11347 fi
11348 fi
11349 fi
11350fi
11351
11352: see if socketpair exists
11353set socketpair d_sockpair
11354eval $inlibc
11355
11356
11357echo " "
3c728e00 11358echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11359for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11360 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11361 $cat >try.c <<EOF
11362#include <sys/types.h>
11363#include <sys/socket.h>
11364int main() {
11365 int i = $ENUM;
11366}
11367EOF
11368 val="$undef"
11369 set try; if eval $compile; then
11370 val="$define"
11371 fi
11372 set d_${enum}; eval $setvar
5b813a60 11373 $rm_try
4e0554ec
JH
11374done
11375
11376: see if this is a sys/uio.h system
11377set sys/uio.h i_sysuio
11378eval $inhdr
11379
34f1896b 11380: Check for cmsghdr support
4e0554ec
JH
11381echo " "
11382echo "Checking to see if your system supports struct cmsghdr..." >&4
11383set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11384eval $hasstruct
11385case "$d_cmsghdr_s" in
11386"$define") echo "Yes, it does." ;;
11387*) echo "No, it doesn't." ;;
11388esac
11389
11390
b4eb6b3d
JH
11391: check for const keyword
11392echo " "
11393echo 'Checking to see if your C compiler knows about "const"...' >&4
11394$cat >const.c <<'EOCP'
11395typedef struct spug { int drokk; } spug;
76f47787 11396int main()
b4eb6b3d
JH
11397{
11398 const char *foo;
666ea192 11399 const spug y = { 0 };
b4eb6b3d
JH
11400}
11401EOCP
11402if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11403 val="$define"
11404 echo "Yup, it does."
11405else
11406 val="$undef"
11407 echo "Nope, it doesn't."
11408fi
11409set d_const
11410eval $setvar
11411
89ce900e
JH
11412: see if copysignl exists
11413set copysignl d_copysignl
11414eval $inlibc
11415
b4eb6b3d
JH
11416: see if crypt exists
11417echo " "
a5a94ea5
JH
11418set crypt d_crypt
11419eval $inlibc
11420case "$d_crypt" in
11421$define) cryptlib='' ;;
11422*) if set crypt val -f d_crypt; eval $csym; $val; then
11423 echo 'crypt() found.' >&4
b4eb6b3d 11424 val="$define"
a5a94ea5
JH
11425 cryptlib=''
11426 else
11427 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11428 if $test -z "$cryptlib"; then
11429 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11430 else
11431 cryptlib=-lcrypt
11432 fi
11433 if $test -z "$cryptlib"; then
11434 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11435 else
11436 cryptlib=-lcrypt
11437 fi
11438 if $test -z "$cryptlib"; then
11439 cryptlib=`./loc libcrypt$_a "" $libpth`
11440 else
11441 cryptlib=-lcrypt
11442 fi
11443 if $test -z "$cryptlib"; then
11444 echo 'crypt() NOT found.' >&4
11445 val="$undef"
11446 else
11447 val="$define"
11448 fi
b4eb6b3d 11449 fi
a5a94ea5
JH
11450 set d_crypt
11451 eval $setvar
11452 ;;
11453esac
b4eb6b3d 11454
10bc17b6
JH
11455: see if this is a crypt.h system
11456set crypt.h i_crypt
11457eval $inhdr
11458
11459: see if crypt_r exists
11460set crypt_r d_crypt_r
11461eval $inlibc
11462case "$d_crypt_r" in
11463"$define")
11464 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11465 case "$d_crypt_r_proto:$usethreads" in
11466 ":define") d_crypt_r_proto=define
a48ec845
JH
11467 set d_crypt_r_proto crypt_r $hdrs
11468 eval $hasproto ;;
11469 *) ;;
11470 esac
11471 case "$d_crypt_r_proto" in
11472 define)
10bc17b6
JH
11473 case "$crypt_r_proto" in
11474 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
61c26d18 11475 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
10bc17b6
JH
11476 esac
11477 case "$crypt_r_proto" in
b430fd04 11478 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
61c26d18 11479 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
b430fd04
JH
11480 esac
11481 case "$crypt_r_proto" in
90e831dc 11482 ''|0) d_crypt_r=undef
10bc17b6 11483 crypt_r_proto=0
a48ec845 11484 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11485 * ) case "$crypt_r_proto" in
11486 REENTRANT_PROTO*) ;;
11487 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11488 esac
11489 echo "Prototype: $try" ;;
11490 esac
11491 ;;
c18e646a
JH
11492 *) case "$usethreads" in
11493 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11494 esac
90e831dc
SB
11495 d_crypt_r=undef
11496 crypt_r_proto=0
c18e646a 11497 ;;
a48ec845
JH
11498 esac
11499 ;;
10bc17b6
JH
11500*) crypt_r_proto=0
11501 ;;
11502esac
11503
b4eb6b3d
JH
11504: get csh whereabouts
11505case "$csh" in
11506'csh') val="$undef" ;;
11507*) val="$define" ;;
11508esac
11509set d_csh
11510eval $setvar
11511: Respect a hint or command line value for full_csh.
11512case "$full_csh" in
11513'') full_csh=$csh ;;
11514esac
11515
13cfc98d
MB
11516: see if ctermid exists
11517set ctermid d_ctermid
11518eval $inlibc
11519
10bc17b6
JH
11520: see if ctermid_r exists
11521set ctermid_r d_ctermid_r
11522eval $inlibc
11523case "$d_ctermid_r" in
11524"$define")
31ee0cb7 11525 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11526 case "$d_ctermid_r_proto:$usethreads" in
11527 ":define") d_ctermid_r_proto=define
a48ec845
JH
11528 set d_ctermid_r_proto ctermid_r $hdrs
11529 eval $hasproto ;;
11530 *) ;;
11531 esac
11532 case "$d_ctermid_r_proto" in
11533 define)
10bc17b6
JH
11534 case "$ctermid_r_proto" in
11535 ''|0) try='char* ctermid_r(char*);'
61c26d18 11536 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
10bc17b6
JH
11537 esac
11538 case "$ctermid_r_proto" in
90e831dc 11539 ''|0) d_ctermid_r=undef
10bc17b6 11540 ctermid_r_proto=0
a48ec845 11541 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11542 * ) case "$ctermid_r_proto" in
11543 REENTRANT_PROTO*) ;;
11544 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11545 esac
11546 echo "Prototype: $try" ;;
11547 esac
11548 ;;
c18e646a
JH
11549 *) case "$usethreads" in
11550 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11551 esac
90e831dc
SB
11552 d_ctermid_r=undef
11553 ctermid_r_proto=0
c18e646a 11554 ;;
a48ec845
JH
11555 esac
11556 ;;
10bc17b6
JH
11557*) ctermid_r_proto=0
11558 ;;
11559esac
11560
11561: see if ctime_r exists
11562set ctime_r d_ctime_r
11563eval $inlibc
11564case "$d_ctime_r" in
11565"$define")
d63eadf0 11566 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11567 case "$d_ctime_r_proto:$usethreads" in
11568 ":define") d_ctime_r_proto=define
a48ec845
JH
11569 set d_ctime_r_proto ctime_r $hdrs
11570 eval $hasproto ;;
11571 *) ;;
11572 esac
11573 case "$d_ctime_r_proto" in
11574 define)
10bc17b6
JH
11575 case "$ctime_r_proto" in
11576 ''|0) try='char* ctime_r(const time_t*, char*);'
61c26d18 11577 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
10bc17b6
JH
11578 esac
11579 case "$ctime_r_proto" in
11580 ''|0) try='char* ctime_r(const time_t*, char*, int);'
61c26d18 11581 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
10bc17b6
JH
11582 esac
11583 case "$ctime_r_proto" in
11584 ''|0) try='int ctime_r(const time_t*, char*);'
61c26d18 11585 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
10bc17b6
JH
11586 esac
11587 case "$ctime_r_proto" in
11588 ''|0) try='int ctime_r(const time_t*, char*, int);'
61c26d18 11589 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
10bc17b6
JH
11590 esac
11591 case "$ctime_r_proto" in
90e831dc 11592 ''|0) d_ctime_r=undef
10bc17b6 11593 ctime_r_proto=0
a48ec845 11594 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11595 * ) case "$ctime_r_proto" in
11596 REENTRANT_PROTO*) ;;
11597 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11598 esac
11599 echo "Prototype: $try" ;;
11600 esac
11601 ;;
c18e646a
JH
11602 *) case "$usethreads" in
11603 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11604 esac
90e831dc
SB
11605 d_ctime_r=undef
11606 ctime_r_proto=0
c18e646a 11607 ;;
a48ec845
JH
11608 esac
11609 ;;
10bc17b6
JH
11610*) ctime_r_proto=0
11611 ;;
11612esac
11613
b4eb6b3d
JH
11614: see if cuserid exists
11615set cuserid d_cuserid
11616eval $inlibc
11617
11618: see if this is a limits.h system
11619set limits.h i_limits
11620eval $inhdr
11621
11622: see if this is a float.h system
11623set float.h i_float
11624eval $inhdr
11625
11626: See if number of significant digits in a double precision number is known
11627echo " "
11628$cat >dbl_dig.c <<EOM
11629#$i_limits I_LIMITS
11630#$i_float I_FLOAT
11631#ifdef I_LIMITS
11632#include <limits.h>
11633#endif
11634#ifdef I_FLOAT
11635#include <float.h>
11636#endif
11637#ifdef DBL_DIG
11638printf("Contains DBL_DIG");
11639#endif
11640EOM
11641$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11642if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11643 echo "DBL_DIG found." >&4
11644 val="$define"
11645else
11646 echo "DBL_DIG NOT found." >&4
11647 val="$undef"
11648fi
11649$rm -f dbl_dig.?
11650set d_dbl_dig
11651eval $setvar
11652
2ef53570
JH
11653: see if dbm.h is available
11654: see if dbmclose exists
11655set dbmclose d_dbmclose
11656eval $inlibc
11657
11658case "$d_dbmclose" in
11659$define)
11660 set dbm.h i_dbm
11661 eval $inhdr
11662 case "$i_dbm" in
11663 $define)
11664 val="$undef"
11665 set i_rpcsvcdbm
11666 eval $setvar
11667 ;;
11668 *) set rpcsvc/dbm.h i_rpcsvcdbm
11669 eval $inhdr
11670 ;;
11671 esac
11672 ;;
11673*) echo "We won't be including <dbm.h>"
11674 val="$undef"
11675 set i_dbm
11676 eval $setvar
11677 val="$undef"
11678 set i_rpcsvcdbm
11679 eval $setvar
11680 ;;
11681esac
11682
11683: see if prototype for dbminit is available
11684echo " "
11685set d_dbminitproto dbminit $i_dbm dbm.h
11686eval $hasproto
11687
b4eb6b3d
JH
11688: see if difftime exists
11689set difftime d_difftime
11690eval $inlibc
11691
11692: see if this is a dirent system
11693echo " "
11694if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11695 val="$define"
11696 echo "<dirent.h> found." >&4
11697else
11698 val="$undef"
11699 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11700 echo "<sys/dir.h> found." >&4
11701 echo " "
11702 else
11703 xinc=`./findhdr sys/ndir.h`
11704 fi
11705 echo "<dirent.h> NOT found." >&4
11706fi
11707set i_dirent
11708eval $setvar
11709
11710: Look for type of directory structure.
11711echo " "
11712$cppstdin $cppflags $cppminus < "$xinc" > try.c
11713
11714case "$direntrytype" in
11715''|' ')
11716 case "$i_dirent" in
11717 $define) guess1='struct dirent' ;;
11718 *) guess1='struct direct' ;;
11719 esac
11720 ;;
11721*) guess1="$direntrytype"
11722 ;;
11723esac
11724
11725case "$guess1" in
11726'struct dirent') guess2='struct direct' ;;
11727*) guess2='struct dirent' ;;
11728esac
5b813a60 11729
b4eb6b3d
JH
11730if $contains "$guess1" try.c >/dev/null 2>&1; then
11731 direntrytype="$guess1"
11732 echo "Your directory entries are $direntrytype." >&4
11733elif $contains "$guess2" try.c >/dev/null 2>&1; then
11734 direntrytype="$guess2"
11735 echo "Your directory entries seem to be $direntrytype." >&4
11736else
11737 echo "I don't recognize your system's directory entries." >&4
11738 rp="What type is used for directory entries on this system?"
11739 dflt="$guess1"
11740 . ./myread
11741 direntrytype="$ans"
11742fi
5b813a60 11743$rm_try
b4eb6b3d
JH
11744
11745: see if the directory entry stores field length
11746echo " "
11747$cppstdin $cppflags $cppminus < "$xinc" > try.c
11748if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11749 echo "Good, your directory entry keeps length information in d_namlen." >&4
11750 val="$define"
11751else
11752 echo "Your directory entry does not know about the d_namlen field." >&4
11753 val="$undef"
11754fi
11755set d_dirnamlen
11756eval $setvar
5b813a60 11757$rm_try
b4eb6b3d 11758
de52168c
SP
11759: Look for DIR.dd_fd
11760case "$i_dirent" in
11761"$define")
11762 echo "Checking to see if DIR has a dd_fd member variable" >&4
11763 $cat >try.c <<EOCP
11764#$i_stdlib I_STDLIB
11765#ifdef I_STDLIB
11766#include <stdlib.h>
11767#endif
11768#include <dirent.h>
11769
11770int main() {
11771 DIR dir;
11772 dir.dd_fd = 1;
11773 return 0;
11774}
11775EOCP
11776 val=$undef
11777 set try
11778 if eval $compile; then
11779 echo "Yes, it does."
11780 val="$define"
11781 else
11782 echo "No, it does not."
11783 val="$undef"
11784 fi
11785 ;;
11786*)
11787 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11788 val="$undef"
11789 ;;
11790esac
11791set d_dir_dd_fd
11792eval $setvar
5b813a60 11793$rm_try
de52168c 11794
ae0e3d3b
JH
11795: see if this is an sysdir system
11796set sys/dir.h i_sysdir
11797eval $inhdr
11798
11799: see if this is an sysndir system
11800set sys/ndir.h i_sysndir
11801eval $inhdr
11802
11803: Look for dirfd
11804echo " "
11805$cat >dirfd.c <<EOM
11806#include <stdio.h>
55954f19
JH
11807#$i_stdlib I_STDLIB
11808#ifdef I_STDLIB
11809#include <stdlib.h>
11810#endif
ae0e3d3b
JH
11811#$i_dirent I_DIRENT /**/
11812#$i_sysdir I_SYS_DIR /**/
11813#$i_sysndir I_SYS_NDIR /**/
11814#$i_systypes I_SYS_TYPES /**/
11815#if defined(I_SYS_TYPES)
11816#include <sys/types.h>
11817#endif
11818#if defined(I_DIRENT)
11819#include <dirent.h>
11820#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11821#include <sys/dir.h>
11822#endif
11823#else
11824#ifdef I_SYS_NDIR
11825#include <sys/ndir.h>
11826#else
11827#ifdef I_SYS_DIR
11828#ifdef hp9000s500
11829#include <ndir.h> /* may be wrong in the future */
11830#else
11831#include <sys/dir.h>
11832#endif
11833#endif
11834#endif
11835#endif
11836int main() {
11837 DIR *dirp = opendir(".");
11838 if (dirfd(dirp) >= 0)
11839 exit(0);
11840 else
11841 exit(1);
11842}
11843EOM
5cadb3f3 11844val=$undef
ae0e3d3b
JH
11845set dirfd
11846if eval $compile; then
11847 val="$define"
11848fi
11849case "$val" in
11850$define) echo "dirfd() found." >&4 ;;
11851*) echo "dirfd() NOT found." >&4 ;;
11852esac
11853set d_dirfd
11854eval $setvar
11855$rm -f dirfd*
11856
b4eb6b3d
JH
11857: see if dlerror exists
11858xxx_runnm="$runnm"
11859runnm=false
11860set dlerror d_dlerror
11861eval $inlibc
11862runnm="$xxx_runnm"
11863
11864: see if dlfcn is available
11865set dlfcn.h i_dlfcn
11866eval $inhdr
11867
34f1896b 11868: Check what extension to use for shared libs
b4eb6b3d
JH
11869case "$usedl" in
11870$define|y|true)
11871 $cat << EOM
11872
11873On a few systems, the dynamically loaded modules that perl generates and uses
11874will need a different extension than shared libs. The default will probably
11875be appropriate.
11876
11877EOM
11878 case "$dlext" in
11879 '') dflt="$so" ;;
11880 *) dflt="$dlext" ;;
11881 esac
11882 rp='What is the extension of dynamically loaded modules'
11883 . ./myread
11884 dlext="$ans"
11885 ;;
11886*)
11887 dlext="none"
11888 ;;
11889esac
11890
11891: Check if dlsym need a leading underscore
11892echo " "
11893val="$undef"
11894
11895case "$dlsrc" in
11896dl_dlopen.xs)
11897 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11898 $cat >dyna.c <<'EOM'
11899fred () { }
11900EOM
11901
11902$cat >fred.c<<EOM
11903
11904#include <stdio.h>
55954f19
JH
11905#$i_stdlib I_STDLIB
11906#ifdef I_STDLIB
11907#include <stdlib.h>
11908#endif
b4eb6b3d
JH
11909#$i_dlfcn I_DLFCN
11910#ifdef I_DLFCN
5440bc8e 11911#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11912#else
11913#include <sys/types.h>
11914#include <nlist.h>
11915#include <link.h>
11916#endif
11917
11918extern int fred() ;
11919
11920int main()
11921{
11922 void * handle ;
11923 void * symbol ;
11924#ifndef RTLD_LAZY
11925 int mode = 1 ;
11926#else
11927 int mode = RTLD_LAZY ;
11928#endif
11929 handle = dlopen("./dyna.$dlext", mode) ;
11930 if (handle == NULL) {
11931 printf ("1\n") ;
11932 fflush (stdout) ;
11933 exit(0);
11934 }
11935 symbol = dlsym(handle, "fred") ;
11936 if (symbol == NULL) {
11937 /* try putting a leading underscore */
11938 symbol = dlsym(handle, "_fred") ;
11939 if (symbol == NULL) {
11940 printf ("2\n") ;
11941 fflush (stdout) ;
11942 exit(0);
11943 }
11944 printf ("3\n") ;
11945 }
11946 else
11947 printf ("4\n") ;
11948 fflush (stdout) ;
11949 exit(0);
11950}
11951EOM
11952 : Call the object file tmp-dyna.o in case dlext=o.
613d6c3e
MB
11953 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11954 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11955 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11956 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11957 xxx=`$run ./fred`
b4eb6b3d
JH
11958 case $xxx in
11959 1) echo "Test program failed using dlopen." >&4
11960 echo "Perhaps you should not use dynamic loading." >&4;;
11961 2) echo "Test program failed using dlsym." >&4
11962 echo "Perhaps you should not use dynamic loading." >&4;;
11963 3) echo "dlsym needs a leading underscore" >&4
11964 val="$define" ;;
11965 4) echo "dlsym doesn't need a leading underscore." >&4;;
11966 esac
11967 else
11968 echo "I can't compile and run the test program." >&4
11969 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11970 fi
11971 ;;
11972esac
613d6c3e 11973
3c728e00 11974$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11975
11976set d_dlsymun
11977eval $setvar
11978
10bc17b6
JH
11979: see if drand48_r exists
11980set drand48_r d_drand48_r
11981eval $inlibc
11982case "$d_drand48_r" in
11983"$define")
11984 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11985 case "$d_drand48_r_proto:$usethreads" in
11986 ":define") d_drand48_r_proto=define
a48ec845
JH
11987 set d_drand48_r_proto drand48_r $hdrs
11988 eval $hasproto ;;
11989 *) ;;
11990 esac
11991 case "$d_drand48_r_proto" in
11992 define)
10bc17b6
JH
11993 case "$drand48_r_proto" in
11994 ''|0) try='int drand48_r(struct drand48_data*, double*);'
61c26d18 11995 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
10bc17b6
JH
11996 esac
11997 case "$drand48_r_proto" in
90e831dc 11998 ''|0) d_drand48_r=undef
10bc17b6 11999 drand48_r_proto=0
a48ec845 12000 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12001 * ) case "$drand48_r_proto" in
12002 REENTRANT_PROTO*) ;;
12003 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12004 esac
12005 echo "Prototype: $try" ;;
12006 esac
12007 ;;
c18e646a
JH
12008 *) case "$usethreads" in
12009 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12010 esac
90e831dc
SB
12011 d_drand48_r=undef
12012 drand48_r_proto=0
c18e646a 12013 ;;
a48ec845
JH
12014 esac
12015 ;;
10bc17b6
JH
12016*) drand48_r_proto=0
12017 ;;
12018esac
12019
12020: see if prototype for drand48 is available
12021echo " "
12022set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12023eval $hasproto
12024
b4eb6b3d
JH
12025: see if dup2 exists
12026set dup2 d_dup2
12027eval $inlibc
12028
12029: see if eaccess exists
12030set eaccess d_eaccess
12031eval $inlibc
12032
12033: see if endgrent exists
12034set endgrent d_endgrent
12035eval $inlibc
12036
10bc17b6
JH
12037: see if this is an grp system
12038set grp.h i_grp
12039eval $inhdr
12040
12041case "$i_grp" in
12042$define)
12043 xxx=`./findhdr grp.h`
12044 $cppstdin $cppflags $cppminus < $xxx >$$.h
12045
12046 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12047 val="$define"
12048 else
12049 val="$undef"
12050 fi
12051 set d_grpasswd
12052 eval $setvar
12053
12054 $rm -f $$.h
12055 ;;
12056*)
12057 val="$undef";
12058 set d_grpasswd; eval $setvar
12059 ;;
12060esac
12061
12062: see if endgrent_r exists
12063set endgrent_r d_endgrent_r
12064eval $inlibc
12065case "$d_endgrent_r" in
12066"$define")
12067 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12068 case "$d_endgrent_r_proto:$usethreads" in
12069 ":define") d_endgrent_r_proto=define
a48ec845
JH
12070 set d_endgrent_r_proto endgrent_r $hdrs
12071 eval $hasproto ;;
12072 *) ;;
12073 esac
12074 case "$d_endgrent_r_proto" in
12075 define)
10bc17b6
JH
12076 case "$endgrent_r_proto" in
12077 ''|0) try='int endgrent_r(FILE**);'
61c26d18 12078 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
10bc17b6
JH
12079 esac
12080 case "$endgrent_r_proto" in
12081 ''|0) try='void endgrent_r(FILE**);'
61c26d18 12082 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
10bc17b6
JH
12083 esac
12084 case "$endgrent_r_proto" in
90e831dc 12085 ''|0) d_endgrent_r=undef
10bc17b6 12086 endgrent_r_proto=0
a48ec845 12087 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12088 * ) case "$endgrent_r_proto" in
12089 REENTRANT_PROTO*) ;;
12090 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12091 esac
12092 echo "Prototype: $try" ;;
12093 esac
12094 ;;
c18e646a
JH
12095 *) case "$usethreads" in
12096 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12097 esac
90e831dc
SB
12098 d_endgrent_r=undef
12099 endgrent_r_proto=0
c18e646a 12100 ;;
a48ec845
JH
12101 esac
12102 ;;
10bc17b6
JH
12103*) endgrent_r_proto=0
12104 ;;
12105esac
12106
b4eb6b3d
JH
12107: see if endhostent exists
12108set endhostent d_endhent
12109eval $inlibc
12110
10bc17b6
JH
12111: see if this is a netdb.h system
12112set netdb.h i_netdb
12113eval $inhdr
12114
12115: see if endhostent_r exists
12116set endhostent_r d_endhostent_r
12117eval $inlibc
12118case "$d_endhostent_r" in
12119"$define")
12120 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12121 case "$d_endhostent_r_proto:$usethreads" in
12122 ":define") d_endhostent_r_proto=define
a48ec845
JH
12123 set d_endhostent_r_proto endhostent_r $hdrs
12124 eval $hasproto ;;
12125 *) ;;
12126 esac
12127 case "$d_endhostent_r_proto" in
12128 define)
10bc17b6
JH
12129 case "$endhostent_r_proto" in
12130 ''|0) try='int endhostent_r(struct hostent_data*);'
61c26d18 12131 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
12132 esac
12133 case "$endhostent_r_proto" in
12134 ''|0) try='void endhostent_r(struct hostent_data*);'
61c26d18 12135 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
12136 esac
12137 case "$endhostent_r_proto" in
90e831dc 12138 ''|0) d_endhostent_r=undef
10bc17b6 12139 endhostent_r_proto=0
a48ec845 12140 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12141 * ) case "$endhostent_r_proto" in
12142 REENTRANT_PROTO*) ;;
12143 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12144 esac
12145 echo "Prototype: $try" ;;
12146 esac
12147 ;;
c18e646a
JH
12148 *) case "$usethreads" in
12149 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12150 esac
90e831dc
SB
12151 d_endhostent_r=undef
12152 endhostent_r_proto=0
c18e646a 12153 ;;
a48ec845
JH
12154 esac
12155 ;;
10bc17b6
JH
12156*) endhostent_r_proto=0
12157 ;;
12158esac
12159
b4eb6b3d
JH
12160: see if endnetent exists
12161set endnetent d_endnent
12162eval $inlibc
12163
10bc17b6
JH
12164: see if endnetent_r exists
12165set endnetent_r d_endnetent_r
12166eval $inlibc
12167case "$d_endnetent_r" in
12168"$define")
12169 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12170 case "$d_endnetent_r_proto:$usethreads" in
12171 ":define") d_endnetent_r_proto=define
a48ec845
JH
12172 set d_endnetent_r_proto endnetent_r $hdrs
12173 eval $hasproto ;;
12174 *) ;;
12175 esac
12176 case "$d_endnetent_r_proto" in
12177 define)
10bc17b6
JH
12178 case "$endnetent_r_proto" in
12179 ''|0) try='int endnetent_r(struct netent_data*);'
61c26d18 12180 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
12181 esac
12182 case "$endnetent_r_proto" in
12183 ''|0) try='void endnetent_r(struct netent_data*);'
61c26d18 12184 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
12185 esac
12186 case "$endnetent_r_proto" in
90e831dc 12187 ''|0) d_endnetent_r=undef
10bc17b6 12188 endnetent_r_proto=0
a48ec845 12189 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12190 * ) case "$endnetent_r_proto" in
12191 REENTRANT_PROTO*) ;;
12192 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12193 esac
12194 echo "Prototype: $try" ;;
12195 esac
12196 ;;
c18e646a
JH
12197 *) case "$usethreads" in
12198 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12199 esac
90e831dc
SB
12200 d_endnetent_r=undef
12201 endnetent_r_proto=0
c18e646a 12202 ;;
a48ec845
JH
12203 esac
12204 ;;
10bc17b6
JH
12205*) endnetent_r_proto=0
12206 ;;
12207esac
12208
b4eb6b3d
JH
12209: see if endprotoent exists
12210set endprotoent d_endpent
12211eval $inlibc
12212
10bc17b6
JH
12213: see if endprotoent_r exists
12214set endprotoent_r d_endprotoent_r
12215eval $inlibc
12216case "$d_endprotoent_r" in
12217"$define")
12218 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12219 case "$d_endprotoent_r_proto:$usethreads" in
12220 ":define") d_endprotoent_r_proto=define
a48ec845
JH
12221 set d_endprotoent_r_proto endprotoent_r $hdrs
12222 eval $hasproto ;;
12223 *) ;;
12224 esac
12225 case "$d_endprotoent_r_proto" in
12226 define)
10bc17b6
JH
12227 case "$endprotoent_r_proto" in
12228 ''|0) try='int endprotoent_r(struct protoent_data*);'
61c26d18 12229 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
12230 esac
12231 case "$endprotoent_r_proto" in
12232 ''|0) try='void endprotoent_r(struct protoent_data*);'
61c26d18 12233 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
12234 esac
12235 case "$endprotoent_r_proto" in
90e831dc 12236 ''|0) d_endprotoent_r=undef
10bc17b6 12237 endprotoent_r_proto=0
a48ec845 12238 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12239 * ) case "$endprotoent_r_proto" in
12240 REENTRANT_PROTO*) ;;
12241 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12242 esac
12243 echo "Prototype: $try" ;;
12244 esac
12245 ;;
c18e646a
JH
12246 *) case "$usethreads" in
12247 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12248 esac
90e831dc
SB
12249 d_endprotoent_r=undef
12250 endprotoent_r_proto=0
c18e646a 12251 ;;
a48ec845
JH
12252 esac
12253 ;;
10bc17b6
JH
12254*) endprotoent_r_proto=0
12255 ;;
12256esac
12257
b4eb6b3d
JH
12258: see if endpwent exists
12259set endpwent d_endpwent
12260eval $inlibc
12261
10bc17b6
JH
12262: see if this is a pwd.h system
12263set pwd.h i_pwd
12264eval $inhdr
12265
12266case "$i_pwd" in
12267$define)
12268 xxx=`./findhdr pwd.h`
12269 $cppstdin $cppflags $cppminus < $xxx >$$.h
12270
12271 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12272 val="$define"
12273 else
12274 val="$undef"
12275 fi
12276 set d_pwquota
12277 eval $setvar
12278
12279 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12280 val="$define"
12281 else
12282 val="$undef"
12283 fi
12284 set d_pwage
12285 eval $setvar
12286
12287 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12288 val="$define"
12289 else
12290 val="$undef"
12291 fi
12292 set d_pwchange
12293 eval $setvar
12294
12295 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12296 val="$define"
12297 else
12298 val="$undef"
12299 fi
12300 set d_pwclass
12301 eval $setvar
12302
12303 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12304 val="$define"
12305 else
12306 val="$undef"
12307 fi
12308 set d_pwexpire
12309 eval $setvar
12310
12311 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12312 val="$define"
12313 else
12314 val="$undef"
12315 fi
12316 set d_pwcomment
12317 eval $setvar
12318
12319 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12320 val="$define"
12321 else
12322 val="$undef"
12323 fi
12324 set d_pwgecos
12325 eval $setvar
12326
12327 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12328 val="$define"
12329 else
12330 val="$undef"
12331 fi
12332 set d_pwpasswd
12333 eval $setvar
12334
12335 $rm -f $$.h
12336 ;;
12337*)
12338 val="$undef";
12339 set d_pwquota; eval $setvar
12340 set d_pwage; eval $setvar
12341 set d_pwchange; eval $setvar
12342 set d_pwclass; eval $setvar
12343 set d_pwexpire; eval $setvar
12344 set d_pwcomment; eval $setvar
12345 set d_pwgecos; eval $setvar
12346 set d_pwpasswd; eval $setvar
12347 ;;
12348esac
12349
12350: see if endpwent_r exists
12351set endpwent_r d_endpwent_r
12352eval $inlibc
12353case "$d_endpwent_r" in
12354"$define")
12355 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12356 case "$d_endpwent_r_proto:$usethreads" in
12357 ":define") d_endpwent_r_proto=define
a48ec845
JH
12358 set d_endpwent_r_proto endpwent_r $hdrs
12359 eval $hasproto ;;
12360 *) ;;
12361 esac
12362 case "$d_endpwent_r_proto" in
12363 define)
10bc17b6
JH
12364 case "$endpwent_r_proto" in
12365 ''|0) try='int endpwent_r(FILE**);'
61c26d18 12366 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
10bc17b6
JH
12367 esac
12368 case "$endpwent_r_proto" in
12369 ''|0) try='void endpwent_r(FILE**);'
61c26d18 12370 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
10bc17b6
JH
12371 esac
12372 case "$endpwent_r_proto" in
90e831dc 12373 ''|0) d_endpwent_r=undef
10bc17b6 12374 endpwent_r_proto=0
a48ec845 12375 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12376 * ) case "$endpwent_r_proto" in
12377 REENTRANT_PROTO*) ;;
12378 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12379 esac
12380 echo "Prototype: $try" ;;
12381 esac
12382 ;;
c18e646a
JH
12383 *) case "$usethreads" in
12384 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12385 esac
90e831dc
SB
12386 d_endpwent_r=undef
12387 endpwent_r_proto=0
c18e646a 12388 ;;
a48ec845
JH
12389 esac
12390 ;;
10bc17b6
JH
12391*) endpwent_r_proto=0
12392 ;;
12393esac
12394
b4eb6b3d
JH
12395: see if endservent exists
12396set endservent d_endsent
12397eval $inlibc
12398
10bc17b6
JH
12399: see if endservent_r exists
12400set endservent_r d_endservent_r
12401eval $inlibc
12402case "$d_endservent_r" in
12403"$define")
12404 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12405 case "$d_endservent_r_proto:$usethreads" in
12406 ":define") d_endservent_r_proto=define
a48ec845
JH
12407 set d_endservent_r_proto endservent_r $hdrs
12408 eval $hasproto ;;
12409 *) ;;
12410 esac
12411 case "$d_endservent_r_proto" in
12412 define)
10bc17b6
JH
12413 case "$endservent_r_proto" in
12414 ''|0) try='int endservent_r(struct servent_data*);'
61c26d18 12415 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12416 esac
12417 case "$endservent_r_proto" in
12418 ''|0) try='void endservent_r(struct servent_data*);'
61c26d18 12419 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12420 esac
12421 case "$endservent_r_proto" in
90e831dc 12422 ''|0) d_endservent_r=undef
10bc17b6 12423 endservent_r_proto=0
a48ec845 12424 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12425 * ) case "$endservent_r_proto" in
12426 REENTRANT_PROTO*) ;;
12427 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12428 esac
12429 echo "Prototype: $try" ;;
12430 esac
12431 ;;
c18e646a
JH
12432 *) case "$usethreads" in
12433 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12434 esac
90e831dc
SB
12435 d_endservent_r=undef
12436 endservent_r_proto=0
c18e646a 12437 ;;
a48ec845
JH
12438 esac
12439 ;;
10bc17b6
JH
12440*) endservent_r_proto=0
12441 ;;
12442esac
12443
b4eb6b3d
JH
12444: Locate the flags for 'open()'
12445echo " "
55954f19 12446$cat >try.c <<EOCP
b4eb6b3d
JH
12447#include <sys/types.h>
12448#ifdef I_FCNTL
12449#include <fcntl.h>
12450#endif
12451#ifdef I_SYS_FILE
12452#include <sys/file.h>
12453#endif
55954f19
JH
12454#$i_stdlib I_STDLIB
12455#ifdef I_STDLIB
12456#include <stdlib.h>
12457#endif
b4eb6b3d
JH
12458int main() {
12459 if(O_RDONLY);
12460#ifdef O_TRUNC
12461 exit(0);
12462#else
12463 exit(1);
12464#endif
12465}
12466EOCP
12467: check sys/file.h first to get FREAD on Sun
12468if $test `./findhdr sys/file.h` && \
5440bc8e 12469 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12470 h_sysfile=true;
12471 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12472 if $run ./try; then
b4eb6b3d
JH
12473 echo "and you have the 3 argument form of open()." >&4
12474 val="$define"
12475 else
12476 echo "but not the 3 argument form of open(). Oh, well." >&4
12477 val="$undef"
12478 fi
12479elif $test `./findhdr fcntl.h` && \
5440bc8e 12480 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12481 h_fcntl=true;
12482 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12483 if $run ./try; then
b4eb6b3d
JH
12484 echo "and you have the 3 argument form of open()." >&4
12485 val="$define"
12486 else
12487 echo "but not the 3 argument form of open(). Oh, well." >&4
12488 val="$undef"
12489 fi
12490else
12491 val="$undef"
12492 echo "I can't find the O_* constant definitions! You got problems." >&4
12493fi
12494set d_open3
12495eval $setvar
5b813a60 12496$rm_try
b4eb6b3d 12497
3c728e00
JH
12498: see if this is a sys/file.h system
12499val=''
12500set sys/file.h val
12501eval $inhdr
12502
12503: do we need to include sys/file.h ?
12504case "$val" in
12505"$define")
12506 echo " "
12507 if $h_sysfile; then
12508 val="$define"
12509 echo "We'll be including <sys/file.h>." >&4
12510 else
12511 val="$undef"
12512 echo "We won't be including <sys/file.h>." >&4
12513 fi
12514 ;;
12515*)
12516 h_sysfile=false
12517 ;;
12518esac
12519set i_sysfile
12520eval $setvar
12521
12522: see if fcntl.h is there
12523val=''
12524set fcntl.h val
12525eval $inhdr
12526
12527: see if we can include fcntl.h
12528case "$val" in
12529"$define")
12530 echo " "
12531 if $h_fcntl; then
12532 val="$define"
12533 echo "We'll be including <fcntl.h>." >&4
12534 else
12535 val="$undef"
12536 if $h_sysfile; then
12537 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12538 else
12539 echo "We won't be including <fcntl.h>." >&4
12540 fi
12541 fi
12542 ;;
12543*)
12544 h_fcntl=false
12545 val="$undef"
12546 ;;
12547esac
12548set i_fcntl
12549eval $setvar
12550
4dd8f9b3
JH
12551: see if fork exists
12552set fork d_fork
12553eval $inlibc
12554
12555: see if pipe exists
12556set pipe d_pipe
12557eval $inlibc
12558
b4eb6b3d
JH
12559: check for non-blocking I/O stuff
12560case "$h_sysfile" in
a0acbdc3
JH
12561true) echo "#include <sys/file.h>" > head.c;;
12562*)
12563 case "$h_fcntl" in
12564 true) echo "#include <fcntl.h>" > head.c;;
12565 *) echo "#include <sys/fcntl.h>" > head.c;;
12566 esac
12567 ;;
b4eb6b3d
JH
12568esac
12569echo " "
12570echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12571case "$o_nonblock" in
12572'')
12573 $cat head.c > try.c
3c728e00 12574 $cat >>try.c <<EOCP
b4eb6b3d 12575#include <stdio.h>
55954f19
JH
12576#$i_stdlib I_STDLIB
12577#ifdef I_STDLIB
80b3ef99 12578#include <stdlib.h>
55954f19 12579#endif
3c728e00
JH
12580#$i_fcntl I_FCNTL
12581#ifdef I_FCNTL
12582#include <fcntl.h>
12583#endif
b4eb6b3d
JH
12584int main() {
12585#ifdef O_NONBLOCK
12586 printf("O_NONBLOCK\n");
12587 exit(0);
12588#endif
12589#ifdef O_NDELAY
12590 printf("O_NDELAY\n");
12591 exit(0);
12592#endif
12593#ifdef FNDELAY
12594 printf("FNDELAY\n");
12595 exit(0);
12596#endif
12597 exit(0);
12598}
12599EOCP
12600 set try
12601 if eval $compile_ok; then
5440bc8e 12602 o_nonblock=`$run ./try`
b4eb6b3d
JH
12603 case "$o_nonblock" in
12604 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12605 *) echo "Seems like we can use $o_nonblock.";;
12606 esac
12607 else
12608 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12609 fi
12610 ;;
12611*) echo "Using $hint value $o_nonblock.";;
12612esac
5b813a60 12613$rm_try
b4eb6b3d
JH
12614
12615echo " "
12616echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12617case "$eagain" in
12618'')
4dd8f9b3
JH
12619 case "$d_fork:$d_pipe" in
12620 define:define)
b4eb6b3d
JH
12621 $cat head.c > try.c
12622 $cat >>try.c <<EOCP
12623#include <errno.h>
12624#include <sys/types.h>
12625#include <signal.h>
5b813a60 12626#include <stdio.h>
55954f19
JH
12627#$i_stdlib I_STDLIB
12628#ifdef I_STDLIB
12629#include <stdlib.h>
12630#endif
1deb0a86
JH
12631#$i_fcntl I_FCNTL
12632#ifdef I_FCNTL
12633#include <fcntl.h>
12634#endif
b4eb6b3d
JH
12635#define MY_O_NONBLOCK $o_nonblock
12636#ifndef errno /* XXX need better Configure test */
12637extern int errno;
12638#endif
12639#$i_unistd I_UNISTD
12640#ifdef I_UNISTD
12641#include <unistd.h>
12642#endif
12643#$i_string I_STRING
12644#ifdef I_STRING
12645#include <string.h>
12646#else
12647#include <strings.h>
12648#endif
7090f861 12649$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12650EOCP
12651 $cat >> try.c <<'EOCP'
12652int main()
12653{
12654 int pd[2];
12655 int pu[2];
12656 char buf[1];
12657 char string[100];
12658
12659 pipe(pd); /* Down: child -> parent */
12660 pipe(pu); /* Up: parent -> child */
12661 if (0 != fork()) {
12662 int ret;
12663 close(pd[1]); /* Parent reads from pd[0] */
12664 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12665#ifdef F_SETFL
b4eb6b3d
JH
12666 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12667 exit(1);
a0acbdc3
JH
12668#else
12669 exit(4);
12670#endif
b4eb6b3d
JH
12671 signal(SIGALRM, blech);
12672 alarm(5);
12673 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12674 exit(2);
12675 sprintf(string, "%d\n", ret);
12676 write(2, string, strlen(string));
12677 alarm(0);
12678#ifdef EAGAIN
12679 if (errno == EAGAIN) {
12680 printf("EAGAIN\n");
12681 goto ok;
12682 }
12683#endif
12684#ifdef EWOULDBLOCK
12685 if (errno == EWOULDBLOCK)
12686 printf("EWOULDBLOCK\n");
12687#endif
12688 ok:
12689 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12690 sleep(2); /* Give it time to close our pipe */
12691 alarm(5);
12692 ret = read(pd[0], buf, 1); /* Should read EOF */
12693 alarm(0);
12694 sprintf(string, "%d\n", ret);
868439a2 12695 write(4, string, strlen(string));
b4eb6b3d
JH
12696 exit(0);
12697 }
12698
12699 close(pd[0]); /* We write to pd[1] */
12700 close(pu[1]); /* We read from pu[0] */
12701 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12702 close(pd[1]); /* Pipe pd is now fully closed! */
12703 exit(0); /* Bye bye, thank you for playing! */
12704}
12705EOCP
12706 set try
12707 if eval $compile_ok; then
12708 echo "$startsh" >mtry
868439a2 12709 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12710 chmod +x mtry
12711 ./mtry >/dev/null 2>&1
12712 case $? in
12713 0) eagain=`$cat try.out`;;
12714 1) echo "Could not perform non-blocking setting!";;
12715 2) echo "I did a successful read() for something that was not there!";;
12716 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12717 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12718 *) echo "Something terribly wrong happened during testing.";;
12719 esac
12720 rd_nodata=`$cat try.ret`
12721 echo "A read() system call with no data present returns $rd_nodata."
12722 case "$rd_nodata" in
12723 0|-1) ;;
12724 *)
12725 echo "(That's peculiar, fixing that to be -1.)"
12726 rd_nodata=-1
12727 ;;
12728 esac
12729 case "$eagain" in
12730 '')
12731 echo "Forcing errno EAGAIN on read() with no data available."
12732 eagain=EAGAIN
12733 ;;
12734 *)
12735 echo "Your read() sets errno to $eagain when no data is available."
12736 ;;
12737 esac
12738 status=`$cat try.err`
12739 case "$status" in
12740 0) echo "And it correctly returns 0 to signal EOF.";;
12741 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12742 *) echo "However, your read() returns '$status' on EOF??";;
12743 esac
12744 val="$define"
12745 if test "$status" = "$rd_nodata"; then
12746 echo "WARNING: you can't distinguish between EOF and no data!"
12747 val="$undef"
12748 fi
12749 else
12750 echo "I can't compile the test program--assuming errno EAGAIN will do."
12751 eagain=EAGAIN
12752 fi
4dd8f9b3
JH
12753 ;;
12754 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12755 eagain=EAGAIN
12756 val="$define"
12757 ;;
12758 esac
b4eb6b3d
JH
12759 set d_eofnblk
12760 eval $setvar
12761 ;;
12762*)
12763 echo "Using $hint value $eagain."
12764 echo "Your read() returns $rd_nodata when no data is present."
12765 case "$d_eofnblk" in
12766 "$define") echo "And you can see EOF because read() returns 0.";;
12767 "$undef") echo "But you can't see EOF status from read() returned value.";;
12768 *)
12769 echo "(Assuming you can't see EOF status from read anyway.)"
12770 d_eofnblk=$undef
12771 ;;
12772 esac
12773 ;;
12774esac
5b813a60 12775$rm_try head.c mtry
b4eb6b3d 12776
15b61c98
JH
12777: see if _ptr and _cnt from stdio act std
12778echo " "
b4eb6b3d 12779
15b61c98
JH
12780if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12781 echo "(Looks like you have stdio.h from BSD.)"
12782 case "$stdio_ptr" in
12783 '') stdio_ptr='((fp)->_p)'
12784 ptr_lval=$define
12785 ;;
12786 *) ptr_lval=$d_stdio_ptr_lval;;
12787 esac
12788 case "$stdio_cnt" in
12789 '') stdio_cnt='((fp)->_r)'
12790 cnt_lval=$define
12791 ;;
12792 *) cnt_lval=$d_stdio_cnt_lval;;
12793 esac
12794 case "$stdio_base" in
12795 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12796 esac
12797 case "$stdio_bufsiz" in
12798 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12799 esac
12800elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12801 echo "(Looks like you have stdio.h from Linux.)"
12802 case "$stdio_ptr" in
12803 '') stdio_ptr='((fp)->_IO_read_ptr)'
12804 ptr_lval=$define
12805 ;;
12806 *) ptr_lval=$d_stdio_ptr_lval;;
12807 esac
12808 case "$stdio_cnt" in
12809 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12810 cnt_lval=$undef
12811 ;;
12812 *) cnt_lval=$d_stdio_cnt_lval;;
12813 esac
12814 case "$stdio_base" in
12815 '') stdio_base='((fp)->_IO_read_base)';;
12816 esac
12817 case "$stdio_bufsiz" in
12818 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12819 esac
12820else
12821 case "$stdio_ptr" in
12822 '') stdio_ptr='((fp)->_ptr)'
12823 ptr_lval=$define
12824 ;;
12825 *) ptr_lval=$d_stdio_ptr_lval;;
12826 esac
12827 case "$stdio_cnt" in
12828 '') stdio_cnt='((fp)->_cnt)'
12829 cnt_lval=$define
12830 ;;
12831 *) cnt_lval=$d_stdio_cnt_lval;;
12832 esac
12833 case "$stdio_base" in
12834 '') stdio_base='((fp)->_base)';;
12835 esac
12836 case "$stdio_bufsiz" in
12837 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12838 esac
12839fi
b4eb6b3d 12840
15b61c98
JH
12841: test whether _ptr and _cnt really work
12842echo "Checking how std your stdio is..." >&4
12843$cat >try.c <<EOP
12844#include <stdio.h>
55954f19
JH
12845#$i_stdlib I_STDLIB
12846#ifdef I_STDLIB
9d9004a9 12847#include <stdlib.h>
55954f19 12848#endif
15b61c98
JH
12849#define FILE_ptr(fp) $stdio_ptr
12850#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12851int main() {
15b61c98
JH
12852 FILE *fp = fopen("try.c", "r");
12853 char c = getc(fp);
12854 if (
12855 18 <= FILE_cnt(fp) &&
12856 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12857 )
12858 exit(0);
12859 exit(1);
9d9004a9 12860}
15b61c98
JH
12861EOP
12862val="$undef"
12863set try
12864if eval $compile && $to try.c; then
12865 if $run ./try; then
12866 echo "Your stdio acts pretty std."
12867 val="$define"
9d9004a9 12868 else
15b61c98 12869 echo "Your stdio isn't very std."
9d9004a9 12870 fi
15b61c98
JH
12871else
12872 echo "Your stdio doesn't appear very std."
12873fi
5b813a60 12874$rm_try
15b61c98
JH
12875
12876# glibc 2.2.90 and above apparently change stdio streams so Perl's
12877# direct buffer manipulation no longer works. The Configure tests
12878# should be changed to correctly detect this, but until then,
12879# the following check should at least let perl compile and run.
12880# (This quick fix should be updated before 5.8.1.)
12881# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12882# A. Dougherty, June 3, 2002.
12883case "$d_gnulibc" in
12884$define)
12885 case "$gnulibc_version" in
12886 2.[01]*) ;;
12887 2.2) ;;
12888 2.2.[0-9]) ;;
12889 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12890 val="$undef"
12891 ;;
12892 esac
9d9004a9
AD
12893 ;;
12894esac
15b61c98 12895set d_stdstdio
9d9004a9 12896eval $setvar
9d9004a9 12897
15b61c98
JH
12898: Can _ptr be used as an lvalue?
12899case "$d_stdstdio$ptr_lval" in
12900$define$define) val=$define ;;
12901*) val=$undef ;;
12902esac
12903set d_stdio_ptr_lval
12904eval $setvar
9d9004a9 12905
15b61c98
JH
12906: Can _cnt be used as an lvalue?
12907case "$d_stdstdio$cnt_lval" in
12908$define$define) val=$define ;;
12909*) val=$undef ;;
12910esac
12911set d_stdio_cnt_lval
12912eval $setvar
b4eb6b3d 12913
15b61c98
JH
12914
12915: test whether setting _ptr sets _cnt as a side effect
12916d_stdio_ptr_lval_sets_cnt="$undef"
12917d_stdio_ptr_lval_nochange_cnt="$undef"
12918case "$d_stdio_ptr_lval$d_stdstdio" in
12919$define$define)
12920 echo "Checking to see what happens if we set the stdio ptr..." >&4
12921$cat >try.c <<EOP
12922#include <stdio.h>
12923/* Can we scream? */
12924/* Eat dust sed :-) */
12925/* In the buffer space, no one can hear you scream. */
55954f19
JH
12926#$i_stdlib I_STDLIB
12927#ifdef I_STDLIB
12928#include <stdlib.h>
12929#endif
15b61c98
JH
12930#define FILE_ptr(fp) $stdio_ptr
12931#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12932#include <sys/types.h>
b4eb6b3d 12933int main() {
15b61c98
JH
12934 FILE *fp = fopen("try.c", "r");
12935 int c;
12936 char *ptr;
12937 size_t cnt;
12938 if (!fp) {
12939 puts("Fail even to read");
12940 exit(1);
12941 }
12942 c = getc(fp); /* Read away the first # */
12943 if (c == EOF) {
12944 puts("Fail even to read");
12945 exit(1);
12946 }
12947 if (!(
12948 18 <= FILE_cnt(fp) &&
12949 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12950 )) {
12951 puts("Fail even to read");
12952 exit (1);
12953 }
12954 ptr = (char*) FILE_ptr(fp);
12955 cnt = (size_t)FILE_cnt(fp);
12956
12957 FILE_ptr(fp) += 42;
12958
12959 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12960 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12961 exit (1);
12962 }
12963 if (FILE_cnt(fp) <= 20) {
12964 printf ("Fail (<20 chars to test)");
12965 exit (1);
12966 }
12967 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12968 puts("Fail compare");
12969 exit (1);
12970 }
12971 if (cnt == FILE_cnt(fp)) {
12972 puts("Pass_unchanged");
12973 exit (0);
5b813a60 12974 }
15b61c98
JH
12975 if (FILE_cnt(fp) == (cnt - 42)) {
12976 puts("Pass_changed");
12977 exit (0);
12978 }
12979 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12980 return 1;
12981
12982}
12983EOP
12984 set try
12985 if eval $compile && $to try.c; then
12986 case `$run ./try` in
12987 Pass_changed)
12988 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12989 d_stdio_ptr_lval_sets_cnt="$define" ;;
12990 Pass_unchanged)
12991 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12992 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12993 Fail*)
12994 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12995 *)
12996 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12997 esac
12998 else
12999 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
13000 fi
5b813a60 13001 $rm_try
15b61c98
JH
13002 ;;
13003esac
13004
13005: see if _base is also standard
13006val="$undef"
13007case "$d_stdstdio" in
13008$define)
13009 $cat >try.c <<EOP
13010#include <stdio.h>
13011#$i_stdlib I_STDLIB
13012#ifdef I_STDLIB
13013#include <stdlib.h>
13014#endif
13015#define FILE_base(fp) $stdio_base
13016#define FILE_bufsiz(fp) $stdio_bufsiz
13017int main() {
13018 FILE *fp = fopen("try.c", "r");
13019 char c = getc(fp);
13020 if (
13021 19 <= FILE_bufsiz(fp) &&
13022 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13023 )
13024 exit(0);
13025 exit(1);
13026}
13027EOP
13028 set try
13029 if eval $compile && $to try.c; then
13030 if $run ./try; then
13031 echo "And its _base field acts std."
13032 val="$define"
13033 else
13034 echo "But its _base field isn't std."
13035 fi
13036 else
13037 echo "However, it seems to be lacking the _base field."
13038 fi
5b813a60 13039 $rm_try
15b61c98
JH
13040 ;;
13041esac
13042set d_stdiobase
13043eval $setvar
13044
13045: see if fast_stdio exists
13046val="$undef"
13047case "$d_stdstdio:$d_stdio_ptr_lval" in
13048"$define:$define")
13049 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13050 *$define*)
13051 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13052 val="$define"
13053 ;;
13054 esac
13055 ;;
13056esac
13057set d_faststdio
13058eval $setvar
13059
13060
13061
13062: see if fchdir exists
13063set fchdir d_fchdir
13064eval $inlibc
13065
13066: see if fchmod exists
13067set fchmod d_fchmod
13068eval $inlibc
13069
13070: see if fchown exists
13071set fchown d_fchown
13072eval $inlibc
13073
13074: see if this is an fcntl system
13075set fcntl d_fcntl
13076eval $inlibc
13077
15b61c98 13078: See if fcntl-based locking works.
613d6c3e 13079echo " "
15b61c98
JH
13080$cat >try.c <<EOCP
13081#$i_stdlib I_STDLIB
13082#ifdef I_STDLIB
13083#include <stdlib.h>
13084#endif
13085#include <unistd.h>
13086#include <fcntl.h>
13087#include <signal.h>
7090f861 13088$signal_t blech(int x) { exit(3); }
15b61c98
JH
13089int main() {
13090#if defined(F_SETLK) && defined(F_SETLKW)
13091 struct flock flock;
13092 int retval, fd;
13093 fd = open("try.c", O_RDONLY);
13094 flock.l_type = F_RDLCK;
13095 flock.l_whence = SEEK_SET;
13096 flock.l_start = flock.l_len = 0;
13097 signal(SIGALRM, blech);
13098 alarm(10);
13099 retval = fcntl(fd, F_SETLK, &flock);
13100 close(fd);
13101 (retval < 0 ? exit(2) : exit(0));
13102#else
13103 exit(2);
13104#endif
13105}
13106EOCP
13107echo "Checking if fcntl-based file locking works... "
13108case "$d_fcntl" in
13109"$define")
13110 set try
13111 if eval $compile_ok; then
13112 if $run ./try; then
13113 echo "Yes, it seems to work."
13114 val="$define"
13115 else
13116 echo "Nope, it didn't work."
13117 val="$undef"
13118 case "$?" in
13119 3) $cat >&4 <<EOM
13120***
13121*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13122*** This is (almost) impossible.
13123*** If your NFS lock daemons are not feeling well, something like
13124*** this may happen, please investigate. Cannot continue, aborting.
13125***
13126EOM
13127 exit 1
13128 ;;
13129 esac
13130 fi
13131 else
13132 echo "I'm unable to compile the test program, so I'll assume not."
13133 val="$undef"
13134 fi
13135 ;;
13136*) val="$undef";
13137 echo "Nope, since you don't even have fcntl()."
13138 ;;
13139esac
13140set d_fcntl_can_lock
13141eval $setvar
5b813a60 13142$rm_try
15b61c98
JH
13143
13144: check for fd_set items
13145$cat <<EOM
13146
13147Checking to see how well your C compiler handles fd_set and friends ...
13148EOM
13149$cat >try.c <<EOCP
13150#$i_stdlib I_STDLIB
13151#ifdef I_STDLIB
13152#include <stdlib.h>
13153#endif
13154#$i_systime I_SYS_TIME
13155#$i_sysselct I_SYS_SELECT
13156#$d_socket HAS_SOCKET
13157#include <sys/types.h>
13158#ifdef HAS_SOCKET
13159#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13160#endif
13161#ifdef I_SYS_TIME
13162#include <sys/time.h>
13163#endif
13164#ifdef I_SYS_SELECT
13165#include <sys/select.h>
13166#endif
13167int main() {
13168 fd_set fds;
13169
13170#ifdef TRYBITS
13171 if(fds.fds_bits);
13172#endif
13173
13174#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13175 exit(0);
13176#else
13177 exit(1);
13178#endif
13179}
13180EOCP
13181set try -DTRYBITS
13182if eval $compile; then
13183 d_fds_bits="$define"
13184 d_fd_set="$define"
13185 echo "Well, your system knows about the normal fd_set typedef..." >&4
13186 if $run ./try; then
b4eb6b3d
JH
13187 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13188 d_fd_macros="$define"
13189 else
13190 $cat >&4 <<'EOM'
13191but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13192EOM
13193 d_fd_macros="$undef"
13194 fi
13195else
13196 $cat <<'EOM'
13197Hmm, your compiler has some difficulty with fd_set. Checking further...
13198EOM
5440bc8e 13199 set try
b4eb6b3d
JH
13200 if eval $compile; then
13201 d_fds_bits="$undef"
13202 d_fd_set="$define"
13203 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 13204 if $run ./try; then
b4eb6b3d
JH
13205 echo "and you have the normal fd_set macros." >&4
13206 d_fd_macros="$define"
13207 else
13208 $cat <<'EOM'
13209but not the normal fd_set macros! Gross! More work for me...
13210EOM
13211 d_fd_macros="$undef"
13212 fi
13213 else
13214 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13215 d_fd_set="$undef"
13216 d_fds_bits="$undef"
13217 d_fd_macros="$undef"
13218 fi
13219fi
5b813a60 13220$rm_try
b4eb6b3d
JH
13221
13222: see if fgetpos exists
13223set fgetpos d_fgetpos
13224eval $inlibc
13225
758a5d79
JH
13226: see if finite exists
13227set finite d_finite
13228eval $inlibc
13229
13230: see if finitel exists
13231set finitel d_finitel
13232eval $inlibc
13233
b4eb6b3d
JH
13234: see if flock exists
13235set flock d_flock
13236eval $inlibc
13237
2ef53570
JH
13238: see if prototype for flock is available
13239echo " "
13240set d_flockproto flock $i_sysfile sys/file.h
13241eval $hasproto
13242
758a5d79
JH
13243: see if fp_class exists
13244set fp_class d_fp_class
13245eval $inlibc
13246
b4eb6b3d
JH
13247: see if pathconf exists
13248set pathconf d_pathconf
13249eval $inlibc
13250
13251: see if fpathconf exists
13252set fpathconf d_fpathconf
13253eval $inlibc
13254
758a5d79
JH
13255: see if fpclass exists
13256set fpclass d_fpclass
13257eval $inlibc
13258
13259: see if fpclassify exists
13260set fpclassify d_fpclassify
13261eval $inlibc
13262
13263: see if fpclassl exists
13264set fpclassl d_fpclassl
13265eval $inlibc
13266
b4eb6b3d
JH
13267: check for fpos64_t
13268echo " "
13269echo "Checking to see if you have fpos64_t..." >&4
13270$cat >try.c <<EOCP
13271#include <stdio.h>
13272int main() { fpos64_t x = 7; }
13273EOCP
13274set try
13275if eval $compile; then
13276 val="$define"
13277 echo "You have fpos64_t."
13278else
13279 val="$undef"
13280 echo "You do not have fpos64_t."
13281 case "$fpossize" in
13282 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13283 esac
13284fi
5b813a60 13285$rm_try
b4eb6b3d
JH
13286set d_fpos64_t
13287eval $setvar
13288
13289: see if frexpl exists
13290set frexpl d_frexpl
13291eval $inlibc
13292
b4eb6b3d
JH
13293: see if this is a sys/param system
13294set sys/param.h i_sysparam
13295eval $inhdr
13296
13297: see if this is a sys/mount.h system
13298set sys/mount.h i_sysmount
13299eval $inhdr
13300
34f1896b 13301: Check for fs_data_s
b4eb6b3d
JH
13302echo " "
13303echo "Checking to see if your system supports struct fs_data..." >&4
13304set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13305eval $hasstruct
13306case "$d_fs_data_s" in
13307"$define") echo "Yes, it does." ;;
13308*) echo "No, it doesn't." ;;
13309esac
13310
13311: see if fseeko exists
13312set fseeko d_fseeko
13313eval $inlibc
13314case "$longsize" in
133158) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13316esac
13317
13318: see if fsetpos exists
13319set fsetpos d_fsetpos
13320eval $inlibc
13321
b4eb6b3d
JH
13322: see if fstatfs exists
13323set fstatfs d_fstatfs
13324eval $inlibc
13325
b4eb6b3d
JH
13326: see if statvfs exists
13327set statvfs d_statvfs
13328eval $inlibc
13329
13330: see if fstatvfs exists
13331set fstatvfs d_fstatvfs
13332eval $inlibc
13333
13334
411ab01c
JH
13335: see if fsync exists
13336set fsync d_fsync
13337eval $inlibc
13338
b4eb6b3d
JH
13339: see if ftello exists
13340set ftello d_ftello
13341eval $inlibc
13342case "$longsize" in
133438) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13344esac
13345
bff98e24 13346: check for a working futimes
613d6c3e 13347d_futimes="$undef"
bff98e24 13348echo " "
5b813a60 13349echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13350$cat >try.c <<EOCP
13351#include <stdio.h>
13352#include <sys/time.h>
13353#include <errno.h>
13354#include <fcntl.h>
13355
13356int main ()
13357{
13358 int fd, rv;
13359 fd = open ("try.c", O_RDWR);
13360 if (-1 == fd) exit (1);
13361 rv = futimes (fd, NULL);
13362 exit (rv == -1 ? errno : 0);
13363}
13364EOCP
13365set try
13366if eval $compile; then
13367 `$run ./try`
13368 rc=$?
13369 case "$rc" in
5b813a60 13370 0) echo "Yes, you have" >&4
bff98e24
SP
13371 d_futimes="$define"
13372 ;;
5b813a60 13373 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13374 ;;
13375 esac
13376else
43dddb59 13377 echo "No, it does not (probably harmless)" >&4
bff98e24 13378fi
5b813a60 13379$rm_try
dc814df1 13380
e74475c7
MHM
13381: see if ndbm.h is available
13382set ndbm.h i_ndbm
13383eval $inhdr
13384: Compatibility location for RedHat 7.1
13385set gdbm/ndbm.h i_gdbmndbm
13386eval $inhdr
13387: Compatibility location for Debian 4.0
13388set gdbm-ndbm.h i_gdbm_ndbm
13389eval $inhdr
13390
13391val="$undef"
13392if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13393 : see if dbm_open exists
13394 set dbm_open d_dbm_open
13395 eval $inlibc
13396 case "$d_dbm_open" in
13397 $undef)
13398 i_ndbm="$undef"
13399 i_gdbmndbm="$undef"
13400 i_gdbm_ndbm="$undef"
13401 echo "We won't be including <ndbm.h>"
13402 val="$undef"
13403 ;;
13404 *) val="$define"
13405 ;;
13406 esac
13407fi
13408set d_ndbm
13409eval $setvar
13410
13411ndbm_hdr_protochk='name=$1; hdr=$2;
13412eval "ihdr=\$""i_$name";
13413val="$undef";
13414if $test "$ihdr" = "$define"; then
13415 $echo "Checking if your <$hdr> uses prototypes..." >&4;
13416 case "$d_cplusplus" in
13417 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13418 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13419 esac;
13420 case "$val" in
13421 $define) $echo "Your <$hdr> seems to have prototypes";;
13422 *) $echo "Your <$hdr> does not seem to have prototypes";;
13423 esac;
13424fi;
13425set "d_${name}_h_uses_prototypes";
13426eval $setvar'
13427
13428set ndbm ndbm.h
13429eval $ndbm_hdr_protochk
13430set gdbmndbm gdbm/ndbm.h
13431eval $ndbm_hdr_protochk
13432set gdbm_ndbm gdbm-ndbm.h
13433eval $ndbm_hdr_protochk
13434
5086dff9
MB
13435: see if getaddrinfo exists
13436set getaddrinfo d_getaddrinfo
13437eval $inlibc
13438
b4eb6b3d
JH
13439: see if getcwd exists
13440set getcwd d_getcwd
13441eval $inlibc
13442
13443: see if getespwnam exists
13444set getespwnam d_getespwnam
13445eval $inlibc
13446
b4eb6b3d
JH
13447: see if getfsstat exists
13448set getfsstat d_getfsstat
13449eval $inlibc
13450
13451: see if getgrent exists
13452set getgrent d_getgrent
13453eval $inlibc
13454
10bc17b6
JH
13455: see if getgrent_r exists
13456set getgrent_r d_getgrent_r
13457eval $inlibc
13458case "$d_getgrent_r" in
13459"$define")
13460 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13461 case "$d_getgrent_r_proto:$usethreads" in
13462 ":define") d_getgrent_r_proto=define
a48ec845
JH
13463 set d_getgrent_r_proto getgrent_r $hdrs
13464 eval $hasproto ;;
13465 *) ;;
13466 esac
13467 case "$d_getgrent_r_proto" in
13468 define)
10bc17b6
JH
13469 case "$getgrent_r_proto" in
13470 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
61c26d18 13471 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
10bc17b6
JH
13472 esac
13473 case "$getgrent_r_proto" in
13474 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
61c26d18 13475 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
10bc17b6
JH
13476 esac
13477 case "$getgrent_r_proto" in
13478 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
61c26d18 13479 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
10bc17b6
JH
13480 esac
13481 case "$getgrent_r_proto" in
13482 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
61c26d18 13483 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
10bc17b6
JH
13484 esac
13485 case "$getgrent_r_proto" in
13486 ''|0) try='int getgrent_r(struct group*, char*, int);'
61c26d18 13487 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
10bc17b6
JH
13488 esac
13489 case "$getgrent_r_proto" in
13490 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
61c26d18 13491 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
10bc17b6
JH
13492 esac
13493 case "$getgrent_r_proto" in
90e831dc 13494 ''|0) d_getgrent_r=undef
10bc17b6 13495 getgrent_r_proto=0
a48ec845 13496 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13497 * ) case "$getgrent_r_proto" in
13498 REENTRANT_PROTO*) ;;
13499 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13500 esac
13501 echo "Prototype: $try" ;;
13502 esac
13503 ;;
c18e646a
JH
13504 *) case "$usethreads" in
13505 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13506 esac
90e831dc
SB
13507 d_getgrent_r=undef
13508 getgrent_r_proto=0
c18e646a 13509 ;;
a48ec845
JH
13510 esac
13511 ;;
10bc17b6
JH
13512*) getgrent_r_proto=0
13513 ;;
13514esac
13515
13516: see if getgrgid_r exists
13517set getgrgid_r d_getgrgid_r
13518eval $inlibc
13519case "$d_getgrgid_r" in
13520"$define")
13521 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13522 case "$d_getgrgid_r_proto:$usethreads" in
13523 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13524 set d_getgrgid_r_proto getgrgid_r $hdrs
13525 eval $hasproto ;;
13526 *) ;;
13527 esac
13528 case "$d_getgrgid_r_proto" in
13529 define)
10bc17b6
JH
13530 case "$getgrgid_r_proto" in
13531 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
61c26d18 13532 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
10bc17b6
JH
13533 esac
13534 case "$getgrgid_r_proto" in
13535 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
61c26d18 13536 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
10bc17b6
JH
13537 esac
13538 case "$getgrgid_r_proto" in
13539 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13540 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
10bc17b6
JH
13541 esac
13542 case "$getgrgid_r_proto" in
13543 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13544 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
10bc17b6
JH
13545 esac
13546 case "$getgrgid_r_proto" in
90e831dc 13547 ''|0) d_getgrgid_r=undef
10bc17b6 13548 getgrgid_r_proto=0
a48ec845 13549 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13550 * ) case "$getgrgid_r_proto" in
13551 REENTRANT_PROTO*) ;;
13552 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13553 esac
13554 echo "Prototype: $try" ;;
13555 esac
13556 ;;
c18e646a
JH
13557 *) case "$usethreads" in
13558 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13559 esac
90e831dc
SB
13560 d_getgrgid_r=undef
13561 getgrgid_r_proto=0
c18e646a 13562 ;;
a48ec845
JH
13563 esac
13564 ;;
10bc17b6
JH
13565*) getgrgid_r_proto=0
13566 ;;
13567esac
13568
13569: see if getgrnam_r exists
13570set getgrnam_r d_getgrnam_r
13571eval $inlibc
13572case "$d_getgrnam_r" in
13573"$define")
13574 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13575 case "$d_getgrnam_r_proto:$usethreads" in
13576 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13577 set d_getgrnam_r_proto getgrnam_r $hdrs
13578 eval $hasproto ;;
13579 *) ;;
13580 esac
13581 case "$d_getgrnam_r_proto" in
13582 define)
10bc17b6
JH
13583 case "$getgrnam_r_proto" in
13584 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
61c26d18 13585 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
10bc17b6
JH
13586 esac
13587 case "$getgrnam_r_proto" in
13588 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
61c26d18 13589 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
10bc17b6
JH
13590 esac
13591 case "$getgrnam_r_proto" in
13592 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
61c26d18 13593 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
10bc17b6
JH
13594 esac
13595 case "$getgrnam_r_proto" in
13596 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13597 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
10bc17b6
JH
13598 esac
13599 case "$getgrnam_r_proto" in
13600 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13601 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
10bc17b6
JH
13602 esac
13603 case "$getgrnam_r_proto" in
90e831dc 13604 ''|0) d_getgrnam_r=undef
10bc17b6 13605 getgrnam_r_proto=0
a48ec845 13606 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13607 * ) case "$getgrnam_r_proto" in
13608 REENTRANT_PROTO*) ;;
13609 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13610 esac
13611 echo "Prototype: $try" ;;
13612 esac
13613 ;;
c18e646a
JH
13614 *) case "$usethreads" in
13615 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13616 esac
90e831dc
SB
13617 d_getgrnam_r=undef
13618 getgrnam_r_proto=0
c18e646a 13619 ;;
a48ec845
JH
13620 esac
13621 ;;
10bc17b6
JH
13622*) getgrnam_r_proto=0
13623 ;;
13624esac
13625
b4eb6b3d
JH
13626: see if gethostbyaddr exists
13627set gethostbyaddr d_gethbyaddr
13628eval $inlibc
13629
13630: see if gethostbyname exists
13631set gethostbyname d_gethbyname
13632eval $inlibc
13633
13634: see if gethostent exists
13635set gethostent d_gethent
13636eval $inlibc
13637
13638: see how we will look up host name
13639echo " "
13640call=''
13641if set gethostname val -f d_gethname; eval $csym; $val; then
13642 echo 'gethostname() found.' >&4
13643 d_gethname="$define"
13644 call=gethostname
13645fi
13646if set uname val -f d_uname; eval $csym; $val; then
13647 if ./xenix; then
13648 $cat <<'EOM'
13649uname() was found, but you're running xenix, and older versions of xenix
13650have a broken uname(). If you don't really know whether your xenix is old
13651enough to have a broken system call, use the default answer.
13652
13653EOM
13654 dflt=y
13655 case "$d_uname" in
13656 "$define") dflt=n;;
13657 esac
13658 rp='Is your uname() broken?'
13659 . ./myread
13660 case "$ans" in
13661 n*) d_uname="$define"; call=uname;;
13662 esac
13663 else
13664 echo 'uname() found.' >&4
13665 d_uname="$define"
13666 case "$call" in
13667 '') call=uname ;;
13668 esac
13669 fi
13670fi
13671case "$d_gethname" in
13672'') d_gethname="$undef";;
13673esac
13674case "$d_uname" in
13675'') d_uname="$undef";;
13676esac
13677case "$d_uname$d_gethname" in
13678*define*)
13679 dflt=n
13680 cat <<EOM
613d6c3e 13681
b4eb6b3d
JH
13682Every now and then someone has a $call() that lies about the hostname
13683but can't be fixed for political or economic reasons. If you wish, I can
13684pretend $call() isn't there and maybe compute hostname at run-time
13685thanks to the '$phostname' command.
13686
13687EOM
13688 rp="Shall I ignore $call() from now on?"
13689 . ./myread
13690 case "$ans" in
13691 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13692 esac;;
13693esac
13694case "$phostname" in
13695'') aphostname='';;
13696*) case "$aphostname" in
13697 /*) ;;
13698 *) set X $phostname
13699 shift
13700 file=$1
13701 shift
13702 file=`./loc $file $file $pth`
13703 aphostname=`echo $file $*`
13704 ;;
13705 esac
13706 ;;
13707esac
13708case "$d_uname$d_gethname" in
13709*define*) ;;
13710*)
13711 case "$phostname" in
13712 '')
13713 echo "There will be no way for $package to get your hostname." >&4;;
13714 *)
13715 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13716 ;;
13717 esac;;
13718esac
13719case "$d_phostname" in
13720'') d_phostname="$undef";;
13721esac
13722
10bc17b6
JH
13723: see if gethostbyaddr_r exists
13724set gethostbyaddr_r d_gethostbyaddr_r
13725eval $inlibc
13726case "$d_gethostbyaddr_r" in
13727"$define")
13728 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13729 case "$d_gethostbyaddr_r_proto:$usethreads" in
13730 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13731 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13732 eval $hasproto ;;
13733 *) ;;
13734 esac
13735 case "$d_gethostbyaddr_r_proto" in
13736 define)
10bc17b6
JH
13737 case "$gethostbyaddr_r_proto" in
13738 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13739 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
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*, size_t, int, int*);'
61c26d18 13743 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
10bc17b6
JH
13744 esac
13745 case "$gethostbyaddr_r_proto" in
13746 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13747 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
10bc17b6
JH
13748 esac
13749 case "$gethostbyaddr_r_proto" in
13750 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13751 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
10bc17b6
JH
13752 esac
13753 case "$gethostbyaddr_r_proto" in
13754 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
61c26d18 13755 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
10bc17b6
JH
13756 esac
13757 case "$gethostbyaddr_r_proto" in
13758 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13759 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
10bc17b6
JH
13760 esac
13761 case "$gethostbyaddr_r_proto" in
13762 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
61c26d18 13763 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
10bc17b6
JH
13764 esac
13765 case "$gethostbyaddr_r_proto" in
13766 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
61c26d18 13767 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
10bc17b6
JH
13768 esac
13769 case "$gethostbyaddr_r_proto" in
13770 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
61c26d18 13771 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
10bc17b6
JH
13772 esac
13773 case "$gethostbyaddr_r_proto" in
13774 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
61c26d18 13775 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
10bc17b6
JH
13776 esac
13777 case "$gethostbyaddr_r_proto" in
a845a0d4 13778 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13779 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
a845a0d4
JH
13780 esac
13781 case "$gethostbyaddr_r_proto" in
90e831dc 13782 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13783 gethostbyaddr_r_proto=0
a48ec845 13784 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13785 * ) case "$gethostbyaddr_r_proto" in
13786 REENTRANT_PROTO*) ;;
13787 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13788 esac
13789 echo "Prototype: $try" ;;
13790 esac
13791 ;;
c18e646a
JH
13792 *) case "$usethreads" in
13793 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13794 esac
90e831dc
SB
13795 d_gethostbyaddr_r=undef
13796 gethostbyaddr_r_proto=0
c18e646a 13797 ;;
a48ec845
JH
13798 esac
13799 ;;
10bc17b6
JH
13800*) gethostbyaddr_r_proto=0
13801 ;;
13802esac
13803
13804: see if gethostbyname_r exists
13805set gethostbyname_r d_gethostbyname_r
13806eval $inlibc
13807case "$d_gethostbyname_r" in
13808"$define")
13809 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13810 case "$d_gethostbyname_r_proto:$usethreads" in
13811 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13812 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13813 eval $hasproto ;;
13814 *) ;;
13815 esac
13816 case "$d_gethostbyname_r_proto" in
13817 define)
10bc17b6
JH
13818 case "$gethostbyname_r_proto" in
13819 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13820 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
13821 esac
13822 case "$gethostbyname_r_proto" in
13823 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13824 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
10bc17b6
JH
13825 esac
13826 case "$gethostbyname_r_proto" in
13827 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
61c26d18 13828 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
10bc17b6
JH
13829 esac
13830 case "$gethostbyname_r_proto" in
90e831dc 13831 ''|0) d_gethostbyname_r=undef
10bc17b6 13832 gethostbyname_r_proto=0
a48ec845 13833 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13834 * ) case "$gethostbyname_r_proto" in
13835 REENTRANT_PROTO*) ;;
13836 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13837 esac
13838 echo "Prototype: $try" ;;
13839 esac
13840 ;;
c18e646a
JH
13841 *) case "$usethreads" in
13842 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13843 esac
90e831dc
SB
13844 d_gethostbyname_r=undef
13845 gethostbyname_r_proto=0
c18e646a 13846 ;;
a48ec845
JH
13847 esac
13848 ;;
10bc17b6
JH
13849*) gethostbyname_r_proto=0
13850 ;;
13851esac
13852
13853: see if gethostent_r exists
13854set gethostent_r d_gethostent_r
13855eval $inlibc
13856case "$d_gethostent_r" in
13857"$define")
13858 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13859 case "$d_gethostent_r_proto:$usethreads" in
13860 ":define") d_gethostent_r_proto=define
a48ec845
JH
13861 set d_gethostent_r_proto gethostent_r $hdrs
13862 eval $hasproto ;;
13863 *) ;;
13864 esac
13865 case "$d_gethostent_r_proto" in
13866 define)
10bc17b6
JH
13867 case "$gethostent_r_proto" in
13868 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13869 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
10bc17b6
JH
13870 esac
13871 case "$gethostent_r_proto" in
13872 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13873 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
10bc17b6
JH
13874 esac
13875 case "$gethostent_r_proto" in
13876 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 13877 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
10bc17b6
JH
13878 esac
13879 case "$gethostent_r_proto" in
13880 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
61c26d18 13881 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
10bc17b6
JH
13882 esac
13883 case "$gethostent_r_proto" in
13884 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
61c26d18 13885 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
10bc17b6
JH
13886 esac
13887 case "$gethostent_r_proto" in
13888 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
61c26d18 13889 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
10bc17b6
JH
13890 esac
13891 case "$gethostent_r_proto" in
90e831dc 13892 ''|0) d_gethostent_r=undef
10bc17b6 13893 gethostent_r_proto=0
a48ec845 13894 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13895 * ) case "$gethostent_r_proto" in
13896 REENTRANT_PROTO*) ;;
13897 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13898 esac
13899 echo "Prototype: $try" ;;
13900 esac
13901 ;;
c18e646a
JH
13902 *) case "$usethreads" in
13903 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13904 esac
90e831dc
SB
13905 d_gethostent_r=undef
13906 gethostent_r_proto=0
c18e646a 13907 ;;
a48ec845
JH
13908 esac
13909 ;;
10bc17b6
JH
13910*) gethostent_r_proto=0
13911 ;;
13912esac
b4eb6b3d
JH
13913
13914: see if prototypes for various gethostxxx netdb.h functions are available
13915echo " "
13916set d_gethostprotos gethostent $i_netdb netdb.h
13917eval $hasproto
13918
4e0554ec
JH
13919: see if getitimer exists
13920set getitimer d_getitimer
13921eval $inlibc
13922
b4eb6b3d
JH
13923: see if getlogin exists
13924set getlogin d_getlogin
13925eval $inlibc
13926
10bc17b6
JH
13927: see if getlogin_r exists
13928set getlogin_r d_getlogin_r
13929eval $inlibc
13930case "$d_getlogin_r" in
13931"$define")
13932 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13933 case "$d_getlogin_r_proto:$usethreads" in
13934 ":define") d_getlogin_r_proto=define
a48ec845
JH
13935 set d_getlogin_r_proto getlogin_r $hdrs
13936 eval $hasproto ;;
13937 *) ;;
13938 esac
13939 case "$d_getlogin_r_proto" in
13940 define)
10bc17b6
JH
13941 case "$getlogin_r_proto" in
13942 ''|0) try='int getlogin_r(char*, size_t);'
61c26d18 13943 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
10bc17b6
JH
13944 esac
13945 case "$getlogin_r_proto" in
13946 ''|0) try='int getlogin_r(char*, int);'
61c26d18 13947 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
10bc17b6
JH
13948 esac
13949 case "$getlogin_r_proto" in
13950 ''|0) try='char* getlogin_r(char*, size_t);'
61c26d18 13951 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
10bc17b6
JH
13952 esac
13953 case "$getlogin_r_proto" in
13954 ''|0) try='char* getlogin_r(char*, int);'
61c26d18 13955 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
10bc17b6
JH
13956 esac
13957 case "$getlogin_r_proto" in
90e831dc 13958 ''|0) d_getlogin_r=undef
10bc17b6 13959 getlogin_r_proto=0
a48ec845 13960 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13961 * ) case "$getlogin_r_proto" in
13962 REENTRANT_PROTO*) ;;
13963 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13964 esac
13965 echo "Prototype: $try" ;;
13966 esac
13967 ;;
c18e646a
JH
13968 *) case "$usethreads" in
13969 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13970 esac
90e831dc
SB
13971 d_getlogin_r=undef
13972 getlogin_r_proto=0
c18e646a 13973 ;;
a48ec845
JH
13974 esac
13975 ;;
10bc17b6
JH
13976*) getlogin_r_proto=0
13977 ;;
13978esac
13979
b4eb6b3d
JH
13980: see if getmnt exists
13981set getmnt d_getmnt
13982eval $inlibc
13983
13984: see if getmntent exists
13985set getmntent d_getmntent
13986eval $inlibc
13987
5086dff9
MB
13988: see if getnameinfo exists
13989set getnameinfo d_getnameinfo
13990eval $inlibc
13991
b4eb6b3d
JH
13992: see if getnetbyaddr exists
13993set getnetbyaddr d_getnbyaddr
13994eval $inlibc
13995
13996: see if getnetbyname exists
13997set getnetbyname d_getnbyname
13998eval $inlibc
13999
14000: see if getnetent exists
14001set getnetent d_getnent
14002eval $inlibc
14003
10bc17b6
JH
14004: see if getnetbyaddr_r exists
14005set getnetbyaddr_r d_getnetbyaddr_r
14006eval $inlibc
14007case "$d_getnetbyaddr_r" in
14008"$define")
14009 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14010 case "$d_getnetbyaddr_r_proto:$usethreads" in
14011 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
14012 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14013 eval $hasproto ;;
14014 *) ;;
14015 esac
14016 case "$d_getnetbyaddr_r_proto" in
14017 define)
10bc17b6
JH
14018 case "$getnetbyaddr_r_proto" in
14019 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14020 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
10bc17b6
JH
14021 esac
14022 case "$getnetbyaddr_r_proto" in
14023 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14024 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
10bc17b6
JH
14025 esac
14026 case "$getnetbyaddr_r_proto" in
14027 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
61c26d18 14028 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
10bc17b6
JH
14029 esac
14030 case "$getnetbyaddr_r_proto" in
14031 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14032 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
10bc17b6
JH
14033 esac
14034 case "$getnetbyaddr_r_proto" in
14035 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
61c26d18 14036 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
10bc17b6
JH
14037 esac
14038 case "$getnetbyaddr_r_proto" in
14039 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
61c26d18 14040 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
10bc17b6
JH
14041 esac
14042 case "$getnetbyaddr_r_proto" in
14043 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
61c26d18 14044 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
10bc17b6
JH
14045 esac
14046 case "$getnetbyaddr_r_proto" in
a845a0d4 14047 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14048 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
a845a0d4
JH
14049 esac
14050 case "$getnetbyaddr_r_proto" in
90e831dc 14051 ''|0) d_getnetbyaddr_r=undef
10bc17b6 14052 getnetbyaddr_r_proto=0
a48ec845 14053 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14054 * ) case "$getnetbyaddr_r_proto" in
14055 REENTRANT_PROTO*) ;;
14056 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14057 esac
14058 echo "Prototype: $try" ;;
14059 esac
14060 ;;
c18e646a
JH
14061 *) case "$usethreads" in
14062 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14063 esac
90e831dc
SB
14064 d_getnetbyaddr_r=undef
14065 getnetbyaddr_r_proto=0
c18e646a 14066 ;;
a48ec845
JH
14067 esac
14068 ;;
10bc17b6
JH
14069*) getnetbyaddr_r_proto=0
14070 ;;
14071esac
14072
14073: see if getnetbyname_r exists
14074set getnetbyname_r d_getnetbyname_r
14075eval $inlibc
14076case "$d_getnetbyname_r" in
14077"$define")
14078 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14079 case "$d_getnetbyname_r_proto:$usethreads" in
14080 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
14081 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14082 eval $hasproto ;;
14083 *) ;;
14084 esac
14085 case "$d_getnetbyname_r_proto" in
14086 define)
10bc17b6
JH
14087 case "$getnetbyname_r_proto" in
14088 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14089 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
14090 esac
14091 case "$getnetbyname_r_proto" in
14092 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14093 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
10bc17b6
JH
14094 esac
14095 case "$getnetbyname_r_proto" in
14096 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14097 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
10bc17b6
JH
14098 esac
14099 case "$getnetbyname_r_proto" in
14100 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
61c26d18 14101 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
10bc17b6
JH
14102 esac
14103 case "$getnetbyname_r_proto" in
90e831dc 14104 ''|0) d_getnetbyname_r=undef
10bc17b6 14105 getnetbyname_r_proto=0
a48ec845 14106 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14107 * ) case "$getnetbyname_r_proto" in
14108 REENTRANT_PROTO*) ;;
14109 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14110 esac
14111 echo "Prototype: $try" ;;
14112 esac
14113 ;;
c18e646a
JH
14114 *) case "$usethreads" in
14115 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14116 esac
90e831dc
SB
14117 d_getnetbyname_r=undef
14118 getnetbyname_r_proto=0
c18e646a 14119 ;;
a48ec845
JH
14120 esac
14121 ;;
10bc17b6
JH
14122*) getnetbyname_r_proto=0
14123 ;;
14124esac
14125
14126: see if getnetent_r exists
14127set getnetent_r d_getnetent_r
14128eval $inlibc
14129case "$d_getnetent_r" in
14130"$define")
14131 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14132 case "$d_getnetent_r_proto:$usethreads" in
14133 ":define") d_getnetent_r_proto=define
a48ec845
JH
14134 set d_getnetent_r_proto getnetent_r $hdrs
14135 eval $hasproto ;;
14136 *) ;;
14137 esac
14138 case "$d_getnetent_r_proto" in
14139 define)
10bc17b6
JH
14140 case "$getnetent_r_proto" in
14141 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14142 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
10bc17b6
JH
14143 esac
14144 case "$getnetent_r_proto" in
14145 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14146 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
10bc17b6
JH
14147 esac
14148 case "$getnetent_r_proto" in
14149 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14150 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
10bc17b6
JH
14151 esac
14152 case "$getnetent_r_proto" in
14153 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
61c26d18 14154 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
10bc17b6
JH
14155 esac
14156 case "$getnetent_r_proto" in
14157 ''|0) try='int getnetent_r(struct netent*, char*, int);'
61c26d18 14158 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
10bc17b6
JH
14159 esac
14160 case "$getnetent_r_proto" in
14161 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
61c26d18 14162 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
10bc17b6
JH
14163 esac
14164 case "$getnetent_r_proto" in
90e831dc 14165 ''|0) d_getnetent_r=undef
10bc17b6 14166 getnetent_r_proto=0
a48ec845 14167 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14168 * ) case "$getnetent_r_proto" in
14169 REENTRANT_PROTO*) ;;
14170 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14171 esac
14172 echo "Prototype: $try" ;;
14173 esac
14174 ;;
c18e646a
JH
14175 *) case "$usethreads" in
14176 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14177 esac
90e831dc
SB
14178 d_getnetent_r=undef
14179 getnetent_r_proto=0
c18e646a 14180 ;;
a48ec845
JH
14181 esac
14182 ;;
10bc17b6
JH
14183*) getnetent_r_proto=0
14184 ;;
14185esac
14186
b4eb6b3d
JH
14187: see if prototypes for various getnetxxx netdb.h functions are available
14188echo " "
14189set d_getnetprotos getnetent $i_netdb netdb.h
14190eval $hasproto
14191
0c0643d0
JH
14192: see if getpagesize exists
14193set getpagesize d_getpagsz
14194eval $inlibc
14195
34f1896b 14196: Optional checks for getprotobyname and getprotobynumber
b4eb6b3d
JH
14197
14198: see if getprotobyname exists
14199set getprotobyname d_getpbyname
14200eval $inlibc
14201
14202: see if getprotobynumber exists
14203set getprotobynumber d_getpbynumber
14204eval $inlibc
14205
14206: see if getprotoent exists
14207set getprotoent d_getpent
14208eval $inlibc
14209
14210: see if getpgid exists
14211set getpgid d_getpgid
14212eval $inlibc
14213
14214: see if getpgrp2 exists
14215set getpgrp2 d_getpgrp2
14216eval $inlibc
14217
14218: see if getppid exists
14219set getppid d_getppid
14220eval $inlibc
14221
14222: see if getpriority exists
14223set getpriority d_getprior
14224eval $inlibc
14225
10bc17b6
JH
14226: see if getprotobyname_r exists
14227set getprotobyname_r d_getprotobyname_r
14228eval $inlibc
14229case "$d_getprotobyname_r" in
14230"$define")
14231 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14232 case "$d_getprotobyname_r_proto:$usethreads" in
14233 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
14234 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14235 eval $hasproto ;;
14236 *) ;;
14237 esac
14238 case "$d_getprotobyname_r_proto" in
14239 define)
10bc17b6
JH
14240 case "$getprotobyname_r_proto" in
14241 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14242 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
10bc17b6
JH
14243 esac
14244 case "$getprotobyname_r_proto" in
14245 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
61c26d18 14246 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
10bc17b6
JH
14247 esac
14248 case "$getprotobyname_r_proto" in
14249 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
61c26d18 14250 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
10bc17b6
JH
14251 esac
14252 case "$getprotobyname_r_proto" in
90e831dc 14253 ''|0) d_getprotobyname_r=undef
10bc17b6 14254 getprotobyname_r_proto=0
a48ec845 14255 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14256 * ) case "$getprotobyname_r_proto" in
14257 REENTRANT_PROTO*) ;;
14258 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14259 esac
14260 echo "Prototype: $try" ;;
14261 esac
14262 ;;
c18e646a
JH
14263 *) case "$usethreads" in
14264 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14265 esac
90e831dc
SB
14266 d_getprotobyname_r=undef
14267 getprotobyname_r_proto=0
c18e646a 14268 ;;
a48ec845
JH
14269 esac
14270 ;;
10bc17b6
JH
14271*) getprotobyname_r_proto=0
14272 ;;
14273esac
14274
14275: see if getprotobynumber_r exists
14276set getprotobynumber_r d_getprotobynumber_r
14277eval $inlibc
14278case "$d_getprotobynumber_r" in
14279"$define")
14280 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14281 case "$d_getprotobynumber_r_proto:$usethreads" in
14282 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
14283 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14284 eval $hasproto ;;
14285 *) ;;
14286 esac
14287 case "$d_getprotobynumber_r_proto" in
14288 define)
10bc17b6
JH
14289 case "$getprotobynumber_r_proto" in
14290 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14291 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
10bc17b6
JH
14292 esac
14293 case "$getprotobynumber_r_proto" in
14294 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
61c26d18 14295 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
10bc17b6
JH
14296 esac
14297 case "$getprotobynumber_r_proto" in
14298 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
61c26d18 14299 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
10bc17b6
JH
14300 esac
14301 case "$getprotobynumber_r_proto" in
90e831dc 14302 ''|0) d_getprotobynumber_r=undef
10bc17b6 14303 getprotobynumber_r_proto=0
a48ec845 14304 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14305 * ) case "$getprotobynumber_r_proto" in
14306 REENTRANT_PROTO*) ;;
14307 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14308 esac
14309 echo "Prototype: $try" ;;
14310 esac
14311 ;;
c18e646a
JH
14312 *) case "$usethreads" in
14313 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14314 esac
90e831dc
SB
14315 d_getprotobynumber_r=undef
14316 getprotobynumber_r_proto=0
c18e646a 14317 ;;
a48ec845
JH
14318 esac
14319 ;;
10bc17b6
JH
14320*) getprotobynumber_r_proto=0
14321 ;;
14322esac
14323
14324: see if getprotoent_r exists
14325set getprotoent_r d_getprotoent_r
14326eval $inlibc
14327case "$d_getprotoent_r" in
14328"$define")
14329 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14330 case "$d_getprotoent_r_proto:$usethreads" in
14331 ":define") d_getprotoent_r_proto=define
a48ec845
JH
14332 set d_getprotoent_r_proto getprotoent_r $hdrs
14333 eval $hasproto ;;
14334 *) ;;
14335 esac
14336 case "$d_getprotoent_r_proto" in
14337 define)
10bc17b6
JH
14338 case "$getprotoent_r_proto" in
14339 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14340 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
10bc17b6
JH
14341 esac
14342 case "$getprotoent_r_proto" in
14343 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
61c26d18 14344 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
10bc17b6
JH
14345 esac
14346 case "$getprotoent_r_proto" in
14347 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
61c26d18 14348 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
10bc17b6
JH
14349 esac
14350 case "$getprotoent_r_proto" in
14351 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
61c26d18 14352 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
10bc17b6
JH
14353 esac
14354 case "$getprotoent_r_proto" in
90e831dc 14355 ''|0) d_getprotoent_r=undef
10bc17b6 14356 getprotoent_r_proto=0
a48ec845 14357 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14358 * ) case "$getprotoent_r_proto" in
14359 REENTRANT_PROTO*) ;;
14360 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14361 esac
14362 echo "Prototype: $try" ;;
14363 esac
14364 ;;
c18e646a
JH
14365 *) case "$usethreads" in
14366 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14367 esac
90e831dc
SB
14368 d_getprotoent_r=undef
14369 getprotoent_r_proto=0
c18e646a 14370 ;;
a48ec845
JH
14371 esac
14372 ;;
10bc17b6
JH
14373*) getprotoent_r_proto=0
14374 ;;
14375esac
14376
b4eb6b3d
JH
14377: see if prototypes for various getprotoxxx netdb.h functions are available
14378echo " "
14379set d_getprotoprotos getprotoent $i_netdb netdb.h
14380eval $hasproto
14381
14382: see if getprpwnam exists
14383set getprpwnam d_getprpwnam
14384eval $inlibc
14385
14386: see if getpwent exists
14387set getpwent d_getpwent
14388eval $inlibc
14389
10bc17b6
JH
14390: see if getpwent_r exists
14391set getpwent_r d_getpwent_r
14392eval $inlibc
14393case "$d_getpwent_r" in
14394"$define")
14395 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14396 case "$d_getpwent_r_proto:$usethreads" in
14397 ":define") d_getpwent_r_proto=define
a48ec845
JH
14398 set d_getpwent_r_proto getpwent_r $hdrs
14399 eval $hasproto ;;
14400 *) ;;
14401 esac
14402 case "$d_getpwent_r_proto" in
14403 define)
10bc17b6
JH
14404 case "$getpwent_r_proto" in
14405 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14406 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
10bc17b6
JH
14407 esac
14408 case "$getpwent_r_proto" in
14409 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
61c26d18 14410 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
10bc17b6
JH
14411 esac
14412 case "$getpwent_r_proto" in
14413 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
61c26d18 14414 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
10bc17b6
JH
14415 esac
14416 case "$getpwent_r_proto" in
14417 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
61c26d18 14418 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
10bc17b6
JH
14419 esac
14420 case "$getpwent_r_proto" in
14421 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
61c26d18 14422 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
10bc17b6
JH
14423 esac
14424 case "$getpwent_r_proto" in
14425 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
61c26d18 14426 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
10bc17b6
JH
14427 esac
14428 case "$getpwent_r_proto" in
90e831dc 14429 ''|0) d_getpwent_r=undef
10bc17b6 14430 getpwent_r_proto=0
a48ec845 14431 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14432 * ) case "$getpwent_r_proto" in
14433 REENTRANT_PROTO*) ;;
14434 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14435 esac
14436 echo "Prototype: $try" ;;
14437 esac
14438 ;;
c18e646a
JH
14439 *) case "$usethreads" in
14440 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14441 esac
90e831dc
SB
14442 d_getpwent_r=undef
14443 getpwent_r_proto=0
c18e646a 14444 ;;
a48ec845
JH
14445 esac
14446 ;;
10bc17b6
JH
14447*) getpwent_r_proto=0
14448 ;;
14449esac
14450
14451: see if getpwnam_r exists
14452set getpwnam_r d_getpwnam_r
14453eval $inlibc
14454case "$d_getpwnam_r" in
14455"$define")
14456 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14457 case "$d_getpwnam_r_proto:$usethreads" in
14458 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14459 set d_getpwnam_r_proto getpwnam_r $hdrs
14460 eval $hasproto ;;
14461 *) ;;
14462 esac
14463 case "$d_getpwnam_r_proto" in
14464 define)
10bc17b6
JH
14465 case "$getpwnam_r_proto" in
14466 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14467 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14468 esac
14469 case "$getpwnam_r_proto" in
14470 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
61c26d18 14471 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
10bc17b6
JH
14472 esac
14473 case "$getpwnam_r_proto" in
14474 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14475 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
10bc17b6
JH
14476 esac
14477 case "$getpwnam_r_proto" in
14478 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14479 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
10bc17b6
JH
14480 esac
14481 case "$getpwnam_r_proto" in
90e831dc 14482 ''|0) d_getpwnam_r=undef
10bc17b6 14483 getpwnam_r_proto=0
a48ec845 14484 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14485 * ) case "$getpwnam_r_proto" in
14486 REENTRANT_PROTO*) ;;
14487 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14488 esac
14489 echo "Prototype: $try" ;;
14490 esac
14491 ;;
c18e646a
JH
14492 *) case "$usethreads" in
14493 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14494 esac
90e831dc
SB
14495 d_getpwnam_r=undef
14496 getpwnam_r_proto=0
c18e646a 14497 ;;
a48ec845
JH
14498 esac
14499 ;;
10bc17b6
JH
14500*) getpwnam_r_proto=0
14501 ;;
14502esac
14503
14504: see if getpwuid_r exists
14505set getpwuid_r d_getpwuid_r
14506eval $inlibc
14507case "$d_getpwuid_r" in
14508"$define")
14509 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14510 case "$d_getpwuid_r_proto:$usethreads" in
14511 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14512 set d_getpwuid_r_proto getpwuid_r $hdrs
14513 eval $hasproto ;;
14514 *) ;;
14515 esac
14516 case "$d_getpwuid_r_proto" in
14517 define)
10bc17b6
JH
14518 case "$getpwuid_r_proto" in
14519 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14520 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
10bc17b6
JH
14521 esac
14522 case "$getpwuid_r_proto" in
14523 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
61c26d18 14524 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
10bc17b6
JH
14525 esac
14526 case "$getpwuid_r_proto" in
14527 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14528 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
10bc17b6
JH
14529 esac
14530 case "$getpwuid_r_proto" in
14531 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14532 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
10bc17b6
JH
14533 esac
14534 case "$getpwuid_r_proto" in
90e831dc 14535 ''|0) d_getpwuid_r=undef
10bc17b6 14536 getpwuid_r_proto=0
a48ec845 14537 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14538 * ) case "$getpwuid_r_proto" in
14539 REENTRANT_PROTO*) ;;
14540 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14541 esac
14542 echo "Prototype: $try" ;;
14543 esac
14544 ;;
c18e646a
JH
14545 *) case "$usethreads" in
14546 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14547 esac
90e831dc
SB
14548 d_getpwuid_r=undef
14549 getpwuid_r_proto=0
c18e646a 14550 ;;
a48ec845
JH
14551 esac
14552 ;;
10bc17b6
JH
14553*) getpwuid_r_proto=0
14554 ;;
14555esac
14556
34f1896b 14557: Optional checks for getsbyname and getsbyport
b4eb6b3d
JH
14558
14559: see if getservbyname exists
14560set getservbyname d_getsbyname
14561eval $inlibc
14562
14563: see if getservbyport exists
14564set getservbyport d_getsbyport
14565eval $inlibc
14566
14567: see if getservent exists
14568set getservent d_getsent
14569eval $inlibc
14570
10bc17b6
JH
14571: see if getservbyname_r exists
14572set getservbyname_r d_getservbyname_r
14573eval $inlibc
14574case "$d_getservbyname_r" in
14575"$define")
14576 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14577 case "$d_getservbyname_r_proto:$usethreads" in
14578 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14579 set d_getservbyname_r_proto getservbyname_r $hdrs
14580 eval $hasproto ;;
14581 *) ;;
14582 esac
14583 case "$d_getservbyname_r_proto" in
14584 define)
10bc17b6
JH
14585 case "$getservbyname_r_proto" in
14586 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14587 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
10bc17b6
JH
14588 esac
14589 case "$getservbyname_r_proto" in
14590 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
61c26d18 14591 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
10bc17b6
JH
14592 esac
14593 case "$getservbyname_r_proto" in
14594 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
61c26d18 14595 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
10bc17b6
JH
14596 esac
14597 case "$getservbyname_r_proto" in
90e831dc 14598 ''|0) d_getservbyname_r=undef
10bc17b6 14599 getservbyname_r_proto=0
a48ec845 14600 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14601 * ) case "$getservbyname_r_proto" in
14602 REENTRANT_PROTO*) ;;
14603 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14604 esac
14605 echo "Prototype: $try" ;;
14606 esac
14607 ;;
c18e646a
JH
14608 *) case "$usethreads" in
14609 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14610 esac
90e831dc
SB
14611 d_getservbyname_r=undef
14612 getservbyname_r_proto=0
c18e646a 14613 ;;
a48ec845
JH
14614 esac
14615 ;;
10bc17b6
JH
14616*) getservbyname_r_proto=0
14617 ;;
14618esac
14619
14620: see if getservbyport_r exists
14621set getservbyport_r d_getservbyport_r
14622eval $inlibc
14623case "$d_getservbyport_r" in
14624"$define")
14625 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14626 case "$d_getservbyport_r_proto:$usethreads" in
14627 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14628 set d_getservbyport_r_proto getservbyport_r $hdrs
14629 eval $hasproto ;;
14630 *) ;;
14631 esac
14632 case "$d_getservbyport_r_proto" in
14633 define)
10bc17b6
JH
14634 case "$getservbyport_r_proto" in
14635 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14636 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
10bc17b6
JH
14637 esac
14638 case "$getservbyport_r_proto" in
14639 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
61c26d18 14640 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
10bc17b6
JH
14641 esac
14642 case "$getservbyport_r_proto" in
14643 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
61c26d18 14644 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
10bc17b6
JH
14645 esac
14646 case "$getservbyport_r_proto" in
90e831dc 14647 ''|0) d_getservbyport_r=undef
10bc17b6 14648 getservbyport_r_proto=0
a48ec845 14649 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14650 * ) case "$getservbyport_r_proto" in
14651 REENTRANT_PROTO*) ;;
14652 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14653 esac
14654 echo "Prototype: $try" ;;
14655 esac
14656 ;;
c18e646a
JH
14657 *) case "$usethreads" in
14658 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14659 esac
90e831dc
SB
14660 d_getservbyport_r=undef
14661 getservbyport_r_proto=0
c18e646a 14662 ;;
a48ec845
JH
14663 esac
14664 ;;
10bc17b6
JH
14665*) getservbyport_r_proto=0
14666 ;;
14667esac
14668
14669: see if getservent_r exists
14670set getservent_r d_getservent_r
14671eval $inlibc
14672case "$d_getservent_r" in
14673"$define")
14674 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14675 case "$d_getservent_r_proto:$usethreads" in
14676 ":define") d_getservent_r_proto=define
a48ec845
JH
14677 set d_getservent_r_proto getservent_r $hdrs
14678 eval $hasproto ;;
14679 *) ;;
14680 esac
14681 case "$d_getservent_r_proto" in
14682 define)
10bc17b6
JH
14683 case "$getservent_r_proto" in
14684 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
61c26d18 14685 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
10bc17b6
JH
14686 esac
14687 case "$getservent_r_proto" in
14688 ''|0) try='int getservent_r(struct servent*, char*, int);'
61c26d18 14689 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
10bc17b6
JH
14690 esac
14691 case "$getservent_r_proto" in
14692 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
61c26d18 14693 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
10bc17b6
JH
14694 esac
14695 case "$getservent_r_proto" in
14696 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
61c26d18 14697 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
10bc17b6
JH
14698 esac
14699 case "$getservent_r_proto" in
90e831dc 14700 ''|0) d_getservent_r=undef
10bc17b6 14701 getservent_r_proto=0
a48ec845 14702 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14703 * ) case "$getservent_r_proto" in
14704 REENTRANT_PROTO*) ;;
14705 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14706 esac
14707 echo "Prototype: $try" ;;
14708 esac
14709 ;;
c18e646a
JH
14710 *) case "$usethreads" in
14711 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14712 esac
90e831dc
SB
14713 d_getservent_r=undef
14714 getservent_r_proto=0
c18e646a 14715 ;;
a48ec845
JH
14716 esac
14717 ;;
10bc17b6
JH
14718*) getservent_r_proto=0
14719 ;;
14720esac
14721
b4eb6b3d
JH
14722: see if prototypes for various getservxxx netdb.h functions are available
14723echo " "
14724set d_getservprotos getservent $i_netdb netdb.h
14725eval $hasproto
14726
14727: see if getspnam exists
14728set getspnam d_getspnam
14729eval $inlibc
14730
10bc17b6
JH
14731: see if this is a shadow.h system
14732set shadow.h i_shadow
14733eval $inhdr
14734
14735: see if getspnam_r exists
14736set getspnam_r d_getspnam_r
14737eval $inlibc
14738case "$d_getspnam_r" in
14739"$define")
14740 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14741 case "$d_getspnam_r_proto:$usethreads" in
14742 ":define") d_getspnam_r_proto=define
a48ec845
JH
14743 set d_getspnam_r_proto getspnam_r $hdrs
14744 eval $hasproto ;;
14745 *) ;;
14746 esac
14747 case "$d_getspnam_r_proto" in
14748 define)
10bc17b6
JH
14749 case "$getspnam_r_proto" in
14750 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
61c26d18 14751 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14752 esac
14753 case "$getspnam_r_proto" in
14754 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
61c26d18 14755 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
10bc17b6
JH
14756 esac
14757 case "$getspnam_r_proto" in
90e831dc 14758 ''|0) d_getspnam_r=undef
10bc17b6 14759 getspnam_r_proto=0
a48ec845 14760 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14761 * ) case "$getspnam_r_proto" in
14762 REENTRANT_PROTO*) ;;
14763 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14764 esac
14765 echo "Prototype: $try" ;;
14766 esac
14767 ;;
c18e646a
JH
14768 *) case "$usethreads" in
14769 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14770 esac
90e831dc
SB
14771 d_getspnam_r=undef
14772 getspnam_r_proto=0
c18e646a 14773 ;;
a48ec845
JH
14774 esac
14775 ;;
10bc17b6
JH
14776*) getspnam_r_proto=0
14777 ;;
14778esac
14779
b4eb6b3d
JH
14780: see if gettimeofday or ftime exists
14781set gettimeofday d_gettimeod
14782eval $inlibc
14783case "$d_gettimeod" in
14784"$undef")
14785 set ftime d_ftime
14786 eval $inlibc
14787 ;;
14788*)
14789 val="$undef"; set d_ftime; eval $setvar
14790 ;;
14791esac
14792case "$d_gettimeod$d_ftime" in
14793"$undef$undef")
14794 echo " "
14795 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14796 ;;
14797esac
14798
10bc17b6
JH
14799: see if gmtime_r exists
14800set gmtime_r d_gmtime_r
14801eval $inlibc
14802case "$d_gmtime_r" in
14803"$define")
d63eadf0 14804 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14805 case "$d_gmtime_r_proto:$usethreads" in
14806 ":define") d_gmtime_r_proto=define
a48ec845
JH
14807 set d_gmtime_r_proto gmtime_r $hdrs
14808 eval $hasproto ;;
14809 *) ;;
14810 esac
14811 case "$d_gmtime_r_proto" in
14812 define)
10bc17b6
JH
14813 case "$gmtime_r_proto" in
14814 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
61c26d18 14815 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
10bc17b6
JH
14816 esac
14817 case "$gmtime_r_proto" in
14818 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
61c26d18 14819 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
10bc17b6
JH
14820 esac
14821 case "$gmtime_r_proto" in
90e831dc 14822 ''|0) d_gmtime_r=undef
10bc17b6 14823 gmtime_r_proto=0
a48ec845 14824 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14825 * ) case "$gmtime_r_proto" in
14826 REENTRANT_PROTO*) ;;
14827 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14828 esac
14829 echo "Prototype: $try" ;;
14830 esac
b4eb6b3d 14831 ;;
c18e646a
JH
14832 *) case "$usethreads" in
14833 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14834 esac
90e831dc
SB
14835 d_gmtime_r=undef
14836 gmtime_r_proto=0
c18e646a 14837 ;;
a48ec845
JH
14838 esac
14839 ;;
10bc17b6 14840*) gmtime_r_proto=0
b4eb6b3d
JH
14841 ;;
14842esac
14843
14844: see if hasmntopt exists
14845set hasmntopt d_hasmntopt
14846eval $inlibc
14847
14848: see if this is a netinet/in.h or sys/in.h system
14849set netinet/in.h i_niin sys/in.h i_sysin
14850eval $inhdr
14851
14852: see if arpa/inet.h has to be included
14853set arpa/inet.h i_arpainet
14854eval $inhdr
14855
14856: see if htonl --and friends-- exists
14857val=''
14858set htonl val
14859eval $inlibc
14860
14861: Maybe they are macros.
14862case "$val" in
14863$undef)
14864 $cat >htonl.c <<EOM
14865#include <stdio.h>
14866#include <sys/types.h>
14867#$i_niin I_NETINET_IN
14868#$i_sysin I_SYS_IN
14869#$i_arpainet I_ARPA_INET
14870#ifdef I_NETINET_IN
14871#include <netinet/in.h>
14872#endif
14873#ifdef I_SYS_IN
14874#include <sys/in.h>
14875#endif
14876#ifdef I_ARPA_INET
14877#include <arpa/inet.h>
14878#endif
14879#ifdef htonl
14880printf("Defined as a macro.");
14881#endif
14882EOM
14883 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14884 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14885 val="$define"
14886 echo "But it seems to be defined as a macro." >&4
14887 fi
14888 $rm -f htonl.?
14889 ;;
14890esac
14891set d_htonl
14892eval $setvar
14893
36adc09b
JH
14894: see if ilogbl exists
14895set ilogbl d_ilogbl
14896eval $inlibc
14897
b4eb6b3d
JH
14898: index or strchr
14899echo " "
14900if set index val -f; eval $csym; $val; then
14901 if set strchr val -f d_strchr; eval $csym; $val; then
14902 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14903 val="$define"
14904 vali="$undef"
14905 echo "strchr() found." >&4
14906 else
14907 val="$undef"
14908 vali="$define"
14909 echo "index() found." >&4
14910 fi
14911 else
14912 val="$undef"
14913 vali="$define"
8dfa8df9
JH
14914 echo "index() found." >&4
14915 fi
b4eb6b3d 14916else
8dfa8df9
JH
14917 if set strchr val -f d_strchr; eval $csym; $val; then
14918 val="$define"
14919 vali="$undef"
14920 echo "strchr() found." >&4
14921 else
14922 echo "No index() or strchr() found!" >&4
14923 val="$undef"
14924 vali="$undef"
14925 fi
b4eb6b3d 14926fi
8dfa8df9
JH
14927set d_strchr; eval $setvar
14928val="$vali"
14929set d_index; eval $setvar
14930
14931: check whether inet_aton exists
14932set inet_aton d_inetaton
14933eval $inlibc
b4eb6b3d 14934
5086dff9
MB
14935: see if inet_ntop exists
14936set inet_ntop d_inetntop
14937eval $inlibc
14938
14939: see if inet_pton exists
14940set inet_pton d_inetpton
14941eval $inlibc
14942
b4eb6b3d
JH
14943: Look for isascii
14944echo " "
36adc09b 14945$cat >isascii.c <<EOCP
b4eb6b3d
JH
14946#include <stdio.h>
14947#include <ctype.h>
55954f19
JH
14948#$i_stdlib I_STDLIB
14949#ifdef I_STDLIB
14950#include <stdlib.h>
14951#endif
b4eb6b3d
JH
14952int main() {
14953 int c = 'A';
14954 if (isascii(c))
14955 exit(0);
14956 else
14957 exit(1);
14958}
14959EOCP
14960set isascii
14961if eval $compile; then
14962 echo "isascii() found." >&4
14963 val="$define"
14964else
14965 echo "isascii() NOT found." >&4
14966 val="$undef"
14967fi
14968set d_isascii
14969eval $setvar
14970$rm -f isascii*
14971
758a5d79
JH
14972: see if isfinite exists
14973set isfinite d_isfinite
14974eval $inlibc
14975
14976: see if isinf exists
14977set isinf d_isinf
14978eval $inlibc
14979
b4eb6b3d
JH
14980: see if isnan exists
14981set isnan d_isnan
14982eval $inlibc
14983
14984: see if isnanl exists
14985set isnanl d_isnanl
14986eval $inlibc
14987
14988: see if killpg exists
14989set killpg d_killpg
14990eval $inlibc
14991
14992: see if lchown exists
14993echo " "
14994$cat > try.c <<'EOCP'
14995/* System header to define __stub macros and hopefully few prototypes,
14996 which can conflict with char lchown(); below. */
14997#include <assert.h>
14998/* Override any gcc2 internal prototype to avoid an error. */
14999/* We use char because int might match the return type of a gcc2
15000 builtin and then its argument prototype would still apply. */
15001char lchown();
15002int main() {
15003 /* The GNU C library defines this for functions which it implements
15004 to always fail with ENOSYS. Some functions are actually named
15005 something starting with __ and the normal name is an alias. */
15006#if defined (__stub_lchown) || defined (__stub___lchown)
15007choke me
15008#else
15009lchown();
15010#endif
15011; return 0; }
15012EOCP
15013set try
15014if eval $compile; then
15015 $echo "lchown() found." >&4
15016 val="$define"
15017else
15018 $echo "lchown() NOT found." >&4
15019 val="$undef"
15020fi
15021set d_lchown
15022eval $setvar
15023
15024: See if number of significant digits in a double precision number is known
15025echo " "
15026$cat >ldbl_dig.c <<EOM
15027#$i_limits I_LIMITS
15028#$i_float I_FLOAT
15029#ifdef I_LIMITS
15030#include <limits.h>
15031#endif
15032#ifdef I_FLOAT
15033#include <float.h>
15034#endif
15035#ifdef LDBL_DIG
15036printf("Contains LDBL_DIG");
15037#endif
15038EOM
15039$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15040if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15041 echo "LDBL_DIG found." >&4
15042 val="$define"
15043else
15044 echo "LDBL_DIG NOT found." >&4
15045 val="$undef"
15046fi
15047$rm -f ldbl_dig.?
15048set d_ldbl_dig
15049eval $setvar
15050
0a0abfba
MB
15051: see if this is a math.h system
15052set math.h i_math
15053eval $inhdr
15054
613d6c3e 15055: check to see if math.h defines _LIB_VERSION
0a0abfba
MB
15056d_libm_lib_version="$undef"
15057case $i_math in
15058 $define)
0a0abfba
MB
15059 echo " "
15060 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15061 $cat >try.c <<EOCP
15062#include <unistd.h>
15063#include <math.h>
15064int main (int argc, char *argv[])
15065{
15066 printf ("%d\n", _LIB_VERSION);
15067 return (0);
15068 } /* main */
15069EOCP
15070 set try
15071 if eval $compile; then
15072 foo=`$run ./try`
15073 echo "Yes, it does ($foo)" >&4
15074 d_libm_lib_version="$define"
15075 else
4dd8f9b3 15076 echo "No, it does not (probably harmless)" >&4
0a0abfba 15077 fi
5b813a60 15078 $rm_try
0a0abfba
MB
15079 ;;
15080
15081 esac
15082
b4eb6b3d
JH
15083: see if link exists
15084set link d_link
15085eval $inlibc
15086
10bc17b6
JH
15087: see if localtime_r exists
15088set localtime_r d_localtime_r
15089eval $inlibc
15090case "$d_localtime_r" in
15091"$define")
d63eadf0 15092 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
15093 case "$d_localtime_r_proto:$usethreads" in
15094 ":define") d_localtime_r_proto=define
a48ec845
JH
15095 set d_localtime_r_proto localtime_r $hdrs
15096 eval $hasproto ;;
15097 *) ;;
15098 esac
15099 case "$d_localtime_r_proto" in
15100 define)
10bc17b6
JH
15101 case "$localtime_r_proto" in
15102 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
61c26d18 15103 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
10bc17b6
JH
15104 esac
15105 case "$localtime_r_proto" in
15106 ''|0) try='int localtime_r(const time_t*, struct tm*);'
61c26d18 15107 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
10bc17b6
JH
15108 esac
15109 case "$localtime_r_proto" in
90e831dc 15110 ''|0) d_localtime_r=undef
10bc17b6 15111 localtime_r_proto=0
a48ec845 15112 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15113 * ) case "$localtime_r_proto" in
15114 REENTRANT_PROTO*) ;;
15115 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15116 esac
15117 echo "Prototype: $try" ;;
15118 esac
15119 ;;
c18e646a
JH
15120 *) case "$usethreads" in
15121 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15122 esac
90e831dc
SB
15123 d_localtime_r=undef
15124 localtime_r_proto=0
c18e646a 15125 ;;
a48ec845
JH
15126 esac
15127 ;;
10bc17b6
JH
15128*) localtime_r_proto=0
15129 ;;
15130esac
15131
8572b25d
BH
15132: see if localtime_r calls tzset
15133case "$localtime_r_proto" in
15134REENTRANT_PROTO*)
15135 $cat >try.c <<EOCP
15136/* Does our libc's localtime_r call tzset ?
15137 * return 0 if so, 1 otherwise.
15138 */
61c26d18
MHM
15139#$i_systypes I_SYS_TYPES
15140#$i_unistd I_UNISTD
15141#$i_time I_TIME
15142#$i_stdlib I_STDLIB
15143#$i_string I_STRING
15144#$i_malloc I_MALLOC
15145#ifdef I_SYS_TYPES
15146# include <sys/types.h>
15147#endif
15148#ifdef I_UNISTD
15149# include <unistd.h>
15150#endif
15151#ifdef I_TIME
15152# include <time.h>
15153#endif
15154#ifdef I_STDLIB
15155#include <stdlib.h>
15156#endif
15157#ifdef I_STRING
15158# include <string.h>
15159#else
15160# include <strings.h>
15161#endif
15162#ifdef I_MALLOC
15163# include <malloc.h>
15164#endif
8572b25d
BH
15165int main()
15166{
15167 time_t t = time(0L);
15168 char w_tz[]="TZ" "=GMT+5",
15169 e_tz[]="TZ" "=GMT-5",
15170 *tz_e = (char*)malloc(16),
15171 *tz_w = (char*)malloc(16);
15172 struct tm tm_e, tm_w;
15173 memset(&tm_e,'\0',sizeof(struct tm));
15174 memset(&tm_w,'\0',sizeof(struct tm));
15175 strcpy(tz_e,e_tz);
15176 strcpy(tz_w,w_tz);
15177
15178 putenv(tz_e);
15179 localtime_r(&t, &tm_e);
15180
15181 putenv(tz_w);
15182 localtime_r(&t, &tm_w);
15183
15184 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15185 return 1;
15186 return 0;
15187}
15188EOCP
15189 set try
15190 if eval $compile; then
43dddb59 15191 if $run ./try; then
8572b25d
BH
15192 d_localtime_r_needs_tzset=undef;
15193 else
15194 d_localtime_r_needs_tzset=define;
15195 fi;
15196 else
15197 d_localtime_r_needs_tzset=undef;
15198 fi;
15199 ;;
15200 *)
15201 d_localtime_r_needs_tzset=undef;
15202 ;;
15203esac
5b813a60 15204$rm_try
8572b25d 15205
b4eb6b3d
JH
15206: see if localeconv exists
15207set localeconv d_locconv
15208eval $inlibc
15209
15210: see if lockf exists
15211set lockf d_lockf
15212eval $inlibc
15213
b4eb6b3d
JH
15214: see if prototype for lseek is available
15215echo " "
4786929f 15216set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
15217eval $hasproto
15218
15219: see if lstat exists
15220set lstat d_lstat
15221eval $inlibc
15222
15223: see if madvise exists
15224set madvise d_madvise
15225eval $inlibc
15226
7dd121ae
MB
15227: see if malloc_size exists
15228set malloc_size d_malloc_size
15229eval $inlibc
15230
15231: see if malloc_size_good exists
15232set malloc_good_size d_malloc_good_size
15233eval $inlibc
15234
b4eb6b3d
JH
15235: see if mblen exists
15236set mblen d_mblen
15237eval $inlibc
15238
15239: see if mbstowcs exists
15240set mbstowcs d_mbstowcs
15241eval $inlibc
15242
15243: see if mbtowc exists
15244set mbtowc d_mbtowc
15245eval $inlibc
15246
15247: see if memchr exists
15248set memchr d_memchr
15249eval $inlibc
15250
15251: see if memcmp exists
15252set memcmp d_memcmp
15253eval $inlibc
15254
15255: see if memcpy exists
15256set memcpy d_memcpy
15257eval $inlibc
15258
15259: see if memmove exists
15260set memmove d_memmove
15261eval $inlibc
15262
15263: see if memset exists
15264set memset d_memset
15265eval $inlibc
15266
15267: see if mkdir exists
15268set mkdir d_mkdir
15269eval $inlibc
15270
15271: see if mkdtemp exists
15272set mkdtemp d_mkdtemp
15273eval $inlibc
15274
15275: see if mkfifo exists
15276set mkfifo d_mkfifo
15277eval $inlibc
15278
15279: see if mkstemp exists
15280set mkstemp d_mkstemp
15281eval $inlibc
15282
15283: see if mkstemps exists
15284set mkstemps d_mkstemps
15285eval $inlibc
15286
15287: see if mktime exists
15288set mktime d_mktime
15289eval $inlibc
15290
15291: see if this is a sys/mman.h system
15292set sys/mman.h i_sysmman
15293eval $inhdr
15294
15295: see if mmap exists
15296set mmap d_mmap
15297eval $inlibc
15298: see what shmat returns
15299: default to something harmless
15300mmaptype='void *'
15301case "$i_sysmman$d_mmap" in
15302"$define$define")
15303 $cat >mmap.c <<'END'
15304#include <sys/mman.h>
15305void *mmap();
15306END
15307 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15308 mmaptype='void *'
15309 else
15310 mmaptype='caddr_t'
15311 fi
15312 echo "and it returns ($mmaptype)." >&4
15313 ;;
15314esac
15315
15316
15317
89ce900e
JH
15318: see if sqrtl exists
15319set sqrtl d_sqrtl
15320eval $inlibc
15321
af1ff193
JH
15322: see if scalbnl exists
15323set scalbnl d_scalbnl
15324eval $inlibc
15325
89ce900e
JH
15326: see if modfl exists
15327set modfl d_modfl
15328eval $inlibc
15329
15330: see if prototype for modfl is available
15331echo " "
3a794506 15332set d_modflproto modfl $i_math math.h
89ce900e
JH
15333eval $hasproto
15334
15335d_modfl_pow32_bug="$undef"
15336
15337case "$d_longdbl$d_modfl" in
15338$define$define)
15339 $cat <<EOM
15340Checking to see whether your modfl() is okay for large values...
15341EOM
15342$cat >try.c <<EOCP
5b813a60 15343#include <math.h>
89ce900e
JH
15344#include <stdio.h>
15345EOCP
15346if $test "X$d_modflproto" != "X$define"; then
15347 $cat >>try.c <<EOCP
5b813a60 15348/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
15349long double modfl (long double, long double *);
15350EOCP
15351fi
15352$cat >>try.c <<EOCP
15353int main() {
15354 long double nv = 4294967303.15;
15355 long double v, w;
5b813a60 15356 v = modfl(nv, &w);
89ce900e
JH
15357#ifdef __GLIBC__
15358 printf("glibc");
15359#endif
15360 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15361 return 0;
15362}
15363EOCP
15364 case "$osname:$gccversion" in
15365 aix:) saveccflags="$ccflags"
15366 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15367 esac
15368 set try
15369 if eval $compile; then
15370 foo=`$run ./try`
15371 case "$foo" in
15372 *" 4294967303.150000 1.150000 4294967302.000000")
15373 echo >&4 "Your modfl() is broken for large values."
15374 d_modfl_pow32_bug="$define"
15375 case "$foo" in
15376 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15377 ;;
15378 esac
15379 ;;
15380 *" 4294967303.150000 0.150000 4294967303.000000")
15381 echo >&4 "Your modfl() seems okay for large values."
15382 ;;
15383 *) echo >&4 "I don't understand your modfl() at all."
15384 d_modfl="$undef"
15385 ;;
15386 esac
5b813a60 15387 $rm_try
89ce900e
JH
15388 else
15389 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15390 d_modfl="$undef"
15391 fi
15392 case "$osname:$gccversion" in
15393 aix:) ccflags="$saveccflags" ;; # restore
15394 esac
15395 ;;
15396esac
15397
15398if $test "$uselongdouble" = "$define"; then
af1ff193
JH
15399 message=""
15400 if $test "$d_sqrtl" != "$define"; then
15401 message="$message sqrtl"
15402 fi
15403 if $test "$d_modfl" != "$define"; then
89ce900e
JH
15404 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15405 echo "You have both aintl and copysignl, so I can emulate modfl."
15406 else
af1ff193 15407 message="$message modfl"
89ce900e 15408 fi
af1ff193
JH
15409 fi
15410 if $test "$d_frexpl" != "$define"; then
15411 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15412 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15413 else
15414 message="$message frexpl"
15415 fi
15416 fi
89ce900e 15417
af1ff193 15418 if $test "$message" != ""; then
89ce900e
JH
15419 $cat <<EOM >&4
15420
15421*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15422*** the following mathematical functions needed for long double support:
15423*** $message
fe63a0b4
JH
15424*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15425*** Cannot continue, aborting.
89ce900e
JH
15426
15427EOM
15428
fe63a0b4 15429 exit 1
89ce900e
JH
15430 fi
15431fi
15432
b4eb6b3d
JH
15433: see if mprotect exists
15434set mprotect d_mprotect
15435eval $inlibc
15436
15437: see if msgctl exists
15438set msgctl d_msgctl
15439eval $inlibc
15440
15441: see if msgget exists
15442set msgget d_msgget
15443eval $inlibc
15444
15445: see if msgsnd exists
15446set msgsnd d_msgsnd
15447eval $inlibc
15448
15449: see if msgrcv exists
15450set msgrcv d_msgrcv
15451eval $inlibc
15452
15453: see how much of the 'msg*(2)' library is present.
15454h_msg=true
15455echo " "
15456case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15457*"$undef"*) h_msg=false;;
15458esac
15459case "$osname" in
15460freebsd)
15461 case "`ipcs 2>&1`" in
15462 "SVID messages"*"not configured"*)
15463 echo "Your $osname does not have the msg*(2) configured." >&4
15464 h_msg=false
15465 val="$undef"
15466 set msgctl d_msgctl
15467 eval $setvar
15468 set msgget d_msgget
15469 eval $setvar
15470 set msgsnd d_msgsnd
15471 eval $setvar
15472 set msgrcv d_msgrcv
15473 eval $setvar
15474 ;;
15475 esac
15476 ;;
15477esac
15478: we could also check for sys/ipc.h ...
15479if $h_msg && $test `./findhdr sys/msg.h`; then
15480 echo "You have the full msg*(2) library." >&4
15481 val="$define"
15482else
15483 echo "You don't have the full msg*(2) library." >&4
15484 val="$undef"
15485fi
15486set d_msg
15487eval $setvar
15488
34f1896b 15489: Check for msghdr_s
4e0554ec
JH
15490echo " "
15491echo "Checking to see if your system supports struct msghdr..." >&4
15492set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15493eval $hasstruct
15494case "$d_msghdr_s" in
15495"$define") echo "Yes, it does." ;;
15496*) echo "No, it doesn't." ;;
15497esac
15498
15499
b4eb6b3d
JH
15500: see if msync exists
15501set msync d_msync
15502eval $inlibc
15503
15504: see if munmap exists
15505set munmap d_munmap
15506eval $inlibc
15507
15508: see if nice exists
15509set nice d_nice
15510eval $inlibc
15511
2765b840
JH
15512: see if this is a langinfo.h system
15513set langinfo.h i_langinfo
15514eval $inhdr
15515
15516: see if nl_langinfo exists
15517set nl_langinfo d_nl_langinfo
15518eval $inlibc
15519
1d1be0dc
NC
15520: check for volatile keyword
15521echo " "
15522echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15523$cat >try.c <<'EOCP'
76f47787 15524int main()
1d1be0dc
NC
15525{
15526 typedef struct _goo_struct goo_struct;
15527 goo_struct * volatile goo = ((goo_struct *)0);
15528 struct _goo_struct {
15529 long long_int;
15530 int reg_int;
15531 char char_var;
15532 };
15533 typedef unsigned short foo_t;
15534 char *volatile foo;
15535 volatile int bar;
15536 volatile foo_t blech;
15537 foo = foo;
15538}
15539EOCP
15540if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15541 val="$define"
15542 echo "Yup, it does."
15543else
15544 val="$undef"
15545 echo "Nope, it doesn't."
15546fi
15547set d_volatile
15548eval $setvar
5b813a60 15549$rm_try
1d1be0dc 15550
613d6c3e 15551: Check basic sizes
b4eb6b3d
JH
15552echo " "
15553$echo "Choosing the C types to be used for Perl's internal types..." >&4
15554
15555case "$use64bitint:$d_quad:$quadtype" in
15556define:define:?*)
15557 ivtype="$quadtype"
15558 uvtype="$uquadtype"
15559 ivsize=8
15560 uvsize=8
15561 ;;
15562*) ivtype="long"
15563 uvtype="unsigned long"
15564 ivsize=$longsize
15565 uvsize=$longsize
15566 ;;
15567esac
15568
15569case "$uselongdouble:$d_longdbl" in
15570define:define)
15571 nvtype="long double"
15572 nvsize=$longdblsize
15573 ;;
15574*) nvtype=double
15575 nvsize=$doublesize
15576 ;;
15577esac
15578
15579$echo "(IV will be "$ivtype", $ivsize bytes)"
15580$echo "(UV will be "$uvtype", $uvsize bytes)"
15581$echo "(NV will be "$nvtype", $nvsize bytes)"
15582
15583$cat >try.c <<EOCP
15584#$i_inttypes I_INTTYPES
15585#ifdef I_INTTYPES
15586#include <inttypes.h>
15587#endif
15588#include <stdio.h>
15589int main() {
15590#ifdef INT8
15591 int8_t i = INT8_MAX;
15592 uint8_t u = UINT8_MAX;
15593 printf("int8_t\n");
15594#endif
15595#ifdef INT16
15596 int16_t i = INT16_MAX;
15597 uint16_t i = UINT16_MAX;
15598 printf("int16_t\n");
15599#endif
15600#ifdef INT32
15601 int32_t i = INT32_MAX;
15602 uint32_t u = UINT32_MAX;
15603 printf("int32_t\n");
15604#endif
15605}
15606EOCP
15607
13187456 15608i8type="signed char"
0ab0821a
MB
15609u8type="unsigned char"
15610i8size=1
15611u8size=1
b4eb6b3d
JH
15612
15613case "$i16type" in
15614'') case "$shortsize" in
15615 2) i16type=short
15616 u16type="unsigned short"
15617 i16size=$shortsize
15618 u16size=$shortsize
15619 ;;
15620 esac
15621 ;;
15622esac
15623case "$i16type" in
15624'') set try -DINT16
15625 if eval $compile; then
5440bc8e 15626 case "`$run ./try`" in
b4eb6b3d
JH
15627 int16_t)
15628 i16type=int16_t
15629 u16type=uint16_t
15630 i16size=2
15631 u16size=2
15632 ;;
15633 esac
15634 fi
15635 ;;
15636esac
15637case "$i16type" in
15638'') if $test $shortsize -ge 2; then
15639 i16type=short
15640 u16type="unsigned short"
15641 i16size=$shortsize
15642 u16size=$shortsize
15643 fi
15644 ;;
15645esac
15646
15647case "$i32type" in
15648'') case "$longsize" in
15649 4) i32type=long
15650 u32type="unsigned long"
15651 i32size=$longsize
15652 u32size=$longsize
15653 ;;
15654 *) case "$intsize" in
15655 4) i32type=int
15656 u32type="unsigned int"
15657 i32size=$intsize
15658 u32size=$intsize
15659 ;;
15660 esac
15661 ;;
15662 esac
15663 ;;
15664esac
15665case "$i32type" in
15666'') set try -DINT32
15667 if eval $compile; then
5440bc8e 15668 case "`$run ./try`" in
b4eb6b3d
JH
15669 int32_t)
15670 i32type=int32_t
15671 u32type=uint32_t
15672 i32size=4
15673 u32size=4
15674 ;;
15675 esac
15676 fi
15677 ;;
15678esac
15679case "$i32type" in
15680'') if $test $intsize -ge 4; then
15681 i32type=int
15682 u32type="unsigned int"
15683 i32size=$intsize
15684 u32size=$intsize
15685 fi
15686 ;;
15687esac
15688
15689case "$i64type" in
15690'') case "$d_quad:$quadtype" in
15691 define:?*)
15692 i64type="$quadtype"
15693 u64type="$uquadtype"
15694 i64size=8
15695 u64size=8
15696 ;;
15697 esac
15698 ;;
15699esac
15700
1d1be0dc
NC
15701$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15702: volatile so that the compiler has to store it out to memory.
15703if test X"$d_volatile" = X"$define"; then
15704 volatile=volatile
15705fi
b4eb6b3d
JH
15706$cat <<EOP >try.c
15707#include <stdio.h>
55954f19
JH
15708#$i_stdlib I_STDLIB
15709#ifdef I_STDLIB
15710#include <stdlib.h>
15711#endif
1d1be0dc
NC
15712#include <sys/types.h>
15713#include <signal.h>
15714#ifdef SIGFPE
15715$volatile int bletched = 0;
7090f861 15716$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15717#endif
b4eb6b3d
JH
15718int main() {
15719 $uvtype u = 0;
1d1be0dc 15720 $nvtype d;
b4eb6b3d
JH
15721 int n = 8 * $uvsize;
15722 int i;
1d1be0dc
NC
15723#ifdef SIGFPE
15724 signal(SIGFPE, blech);
15725#endif
15726
b4eb6b3d
JH
15727 for (i = 0; i < n; i++) {
15728 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15729 d = ($nvtype)u;
15730 if (($uvtype)d != u)
b4eb6b3d 15731 break;
1d1be0dc
NC
15732 if (d <= 0)
15733 break;
15734 d = ($nvtype)(u - 1);
15735 if (($uvtype)d != (u - 1))
15736 break;
15737#ifdef SIGFPE
22676560 15738 if (bletched)
1d1be0dc
NC
15739 break;
15740#endif
b4eb6b3d 15741 }
efd1522b 15742 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15743 exit(0);
15744}
15745EOP
1d1be0dc
NC
15746set try
15747
15748d_nv_preserves_uv="$undef"
15749if eval $compile; then
53133ed1 15750 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15751fi
53133ed1 15752case "$nv_preserves_uv_bits" in
5b813a60 15753\-[1-9]*)
53133ed1
NC
15754 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15755 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15756 d_nv_preserves_uv="$define"
b4eb6b3d 15757 ;;
53133ed1 15758[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15759 d_nv_preserves_uv="$undef" ;;
15760*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15761 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15762esac
5b813a60 15763$rm_try
1d1be0dc 15764
b68c599a
NC
15765$echo "Checking to find the largest integer value your NVs can hold..." >&4
15766: volatile so that the compiler has to store it out to memory.
15767if test X"$d_volatile" = X"$define"; then
15768 volatile=volatile
15769fi
15770$cat <<EOP >try.c
15771#include <stdio.h>
15772
15773typedef $nvtype NV;
15774
15775int
15776main() {
15777 NV value = 2;
15778 int count = 1;
15779
15780 while(count < 256) {
15781 $volatile NV up = value + 1.0;
15782 $volatile NV negated = -value;
15783 $volatile NV down = negated - 1.0;
15784 $volatile NV got_up = up - value;
15785 int up_good = got_up == 1.0;
15786 int got_down = down - negated;
15787 int down_good = got_down == -1.0;
15788
15789 if (down_good != up_good) {
15790 fprintf(stderr,
15791 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15792 up_good, (double) got_up, down_good, (double) got_down,
15793 count, (double) value);
15794 return 1;
15795 }
15796 if (!up_good) {
15797 while (1) {
15798 if (count > 8) {
15799 count -= 8;
15800 fputs("256.0", stdout);
15801 } else {
15802 count--;
15803 fputs("2.0", stdout);
15804 }
15805 if (!count) {
15806 puts("");
15807 return 0;
15808 }
15809 fputs("*", stdout);
15810 }
15811 }
15812 value *= 2;
15813 ++count;
15814 }
15815 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15816 count, (double) value);
15817 return 1;
15818}
15819EOP
15820set try
15821
15822nv_overflows_integers_at='0'
15823if eval $compile; then
15824 xxx="`$run ./try`"
15825 case "$?" in
15826 0)
15827 case "$xxx" in
15828 2*) cat >&4 <<EOM
15829The largest integer your NVs can preserve is equal to $xxx
15830EOM
15831 nv_overflows_integers_at="$xxx"
15832 ;;
15833 *) cat >&4 <<EOM
15834Cannot determine the largest integer value your NVs can hold, unexpected output
15835'$xxx'
15836EOM
15837 ;;
15838 esac
15839 ;;
15840 *) cat >&4 <<EOM
15841Cannot determine the largest integer value your NVs can hold
15842EOM
15843 ;;
15844 esac
15845fi
15846$rm_try
15847
f607920a
CB
15848$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15849: volatile so that the compiler has to store it out to memory.
15850if test X"$d_volatile" = X"$define"; then
15851 volatile=volatile
15852fi
15853$cat <<EOP >try.c
15854#include <stdio.h>
15855#$i_stdlib I_STDLIB
15856#ifdef I_STDLIB
15857#include <stdlib.h>
15858#endif
15859#$i_string I_STRING
15860#ifdef I_STRING
15861# include <string.h>
15862#else
15863# include <strings.h>
15864#endif
15865#include <sys/types.h>
15866#include <signal.h>
15867#ifdef SIGFPE
15868$volatile int bletched = 0;
7090f861 15869$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15870#endif
15871
15872int checkit($nvtype d, char *where) {
15873 unsigned char *p = (char *)&d;
15874 unsigned char *end = p + sizeof(d);
15875 int fail = 0;
15876
15877 while (p < end)
15878 fail += *p++;
15879
15880 if (!fail)
17f6277d 15881 return 0;
f607920a
CB
15882
15883 p = (char *)&d;
15884 printf("No - %s: 0x", where);
15885 while (p < end)
15886 printf ("%02X", *p++);
15887 printf("\n");
15888 return 1;
15889}
15890
15891int main(int argc, char **argv) {
15892 $nvtype d = 0.0;
15893 int fail = 0;
15894 fail += checkit(d, "0.0");
15895
15896 /* The compiler shouldn't be assuming that bletched is 0 */
15897 d = bletched;
15898
15899 fail += checkit(d, "bleched");
15900
15901#ifdef SIGFPE
15902 signal(SIGFPE, blech);
15903#endif
15904
15905 /* Paranoia - the compiler should have no way of knowing that ANSI says
15906 that argv[argc] will always be NULL. Actually, if it did assume this it
15907 would be buggy, as this is C and main() can be called from elsewhere in
15908 the program. */
15909 d = argv[argc] ? 1 : 0;
15910
15911 if (d) {
15912 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15913 }
15914
15915 fail += checkit(d, "ternary");
15916
15917 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15918
15919 if (d != 0.0) {
15920 printf("No - memset doesn't give 0.0\n");
15921 /* This might just blow up: */
15922 printf("(gives %g)\n", d);
15923 return 1;
15924 }
5b813a60 15925
f607920a
CB
15926#ifdef SIGFPE
15927 if (bletched) {
15928 printf("No - something bleched\n");
15929 return 1;
15930 }
15931#endif
15932 if (fail) {
15933 printf("No - %d fail(s)\n", fail);
15934 return 1;
15935 }
15936 printf("Yes\n");
15937 return 0;
15938}
15939EOP
15940set try
15941
15942d_nv_zero_is_allbits_zero="$undef"
15943if eval $compile; then
15944 xxx="`$run ./try`"
15945 case "$?" in
15946 0)
15947 case "$xxx" in
15948 Yes) cat >&4 <<EOM
159490.0 is represented as all bits zero in memory
15950EOM
15951 d_nv_zero_is_allbits_zero="$define"
15952 ;;
15953 *) cat >&4 <<EOM
159540.0 is not represented as all bits zero in memory
15955EOM
15956 d_nv_zero_is_allbits_zero="$undef"
15957 ;;
15958 esac
15959 ;;
15960 *) cat >&4 <<EOM
159610.0 is not represented as all bits zero in memory
15962EOM
15963 d_nv_zero_is_allbits_zero="$undef"
15964 ;;
15965 esac
15966fi
5b813a60 15967$rm_try
b4eb6b3d
JH
15968
15969: check for off64_t
15970echo " "
15971echo "Checking to see if you have off64_t..." >&4
15972$cat >try.c <<EOCP
15973#include <sys/types.h>
15974#include <unistd.h>
15975int main() { off64_t x = 7; }
15976EOCP
15977set try
15978if eval $compile; then
15979 val="$define"
15980 echo "You have off64_t."
15981else
15982 val="$undef"
15983 echo "You do not have off64_t."
15984 case "$lseeksize" in
15985 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15986 esac
15987fi
5b813a60 15988$rm_try
b4eb6b3d
JH
15989set d_off64_t
15990eval $setvar
15991
b4eb6b3d
JH
15992: how to create joinable pthreads
15993if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15994 echo " "
5b813a60 15995 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
15996 $cat >try.c <<'EOCP'
15997#include <pthread.h>
15998int main() {
15999 int detachstate = JOINABLE;
16000}
16001EOCP
16002 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16003 if eval $compile; then
16004 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16005 val="$undef" # Yes, undef.
16006 set d_old_pthread_create_joinable
16007 eval $setvar
16008 val=""
16009 set old_pthread_create_joinable
16010 eval $setvar
16011 else
16012 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16013 if eval $compile; then
16014 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16015 val="$define"
16016 set d_old_pthread_create_joinable
16017 eval $setvar
16018 val=PTHREAD_CREATE_UNDETACHED
16019 set old_pthread_create_joinable
16020 eval $setvar
5b813a60 16021 else
b4eb6b3d
JH
16022 set try -DJOINABLE=__UNDETACHED
16023 if eval $compile; then
16024 echo "You seem to use __UNDETACHED." >&4
16025 val="$define"
16026 set d_old_pthread_create_joinable
16027 eval $setvar
16028 val=__UNDETACHED
16029 set old_pthread_create_joinable
16030 eval $setvar
16031 else
16032 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
16033 val="$define"
16034 set d_old_pthread_create_joinable
16035 eval $setvar
16036 val=0
16037 set old_pthread_create_joinable
16038 eval $setvar
16039 fi
16040 fi
16041 fi
5b813a60 16042 $rm_try
b4eb6b3d
JH
16043else
16044 d_old_pthread_create_joinable="$undef"
16045 old_pthread_create_joinable=""
16046fi
16047
16048: see if pause exists
16049set pause d_pause
16050eval $inlibc
16051
b4eb6b3d
JH
16052: see if poll exists
16053set poll d_poll
16054eval $inlibc
16055
c796e3db
MB
16056: see if prctl exists
16057set prctl d_prctl
16058eval $inlibc
16059
16060: see if prctl supports PR_SET_NAME
16061d_prctl_set_name=$undef
16062case $d_prctl in
16063 $define)
16064 $cat >try.c <<EOM
16065#include <sys/prctl.h>
16066
16067int main (int argc, char *argv[])
16068{
16069 return (prctl (PR_SET_NAME, "Test"));
16070 } /* main */
16071EOM
16072 set try
16073 if eval $compile_ok && $run ./try; then
16074 echo "Your prctl (PR_SET_NAME, ...) works"
16075 d_prctl_set_name=$define
16076 fi
16077 $rm_try
16078 ;;
16079 esac
16080
c7aff470
NIS
16081: see if readlink exists
16082set readlink d_readlink
16083eval $inlibc
16084
613d6c3e 16085: Check if exe is symlink to abs path of executing program
c7aff470 16086echo " "
f24dbf84 16087procselfexe=''
c7aff470 16088val="$undef"
a33c94aa
JH
16089case "$d_readlink" in
16090"$define")
c7aff470
NIS
16091 if $issymlink /proc/self/exe ; then
16092 $ls -l /proc/self/exe > reflect
51660ed5 16093 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 16094 echo "You have Linux-like /proc/self/exe."
92236451 16095 procselfexe='"/proc/self/exe"'
f24dbf84 16096 val="$define"
f24dbf84
JH
16097 fi
16098 fi
16099 if $issymlink /proc/curproc/file ; then
16100 $ls -l /proc/curproc/file > reflect
16101 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16102 echo "You have BSD-like /proc/curproc/file."
92236451 16103 procselfexe='"/proc/curproc/file"'
f24dbf84 16104 val="$define"
c7aff470 16105 fi
c7aff470 16106 fi
a33c94aa
JH
16107 ;;
16108esac
428dc699 16109$rm -f reflect
c7aff470
NIS
16110set d_procselfexe
16111eval $setvar
16112
233e16ce
MB
16113: backward compatibility for d_hvfork
16114if test X$d_hvfork != X; then
16115 d_vfork="$d_hvfork"
16116 d_hvfork=''
16117fi
16118: see if there is a vfork
16119val=''
16120set vfork val
16121eval $inlibc
16122
16123d_pseudofork=$undef
16124
16125: Ok, but do we want to use it. vfork is reportedly unreliable in
16126: perl on Solaris 2.x, and probably elsewhere.
16127case "$val" in
16128$define)
16129 echo " "
16130 case "$usevfork" in
16131 false) dflt='n';;
16132 *) dflt='y';;
16133 esac
16134 cat <<'EOM'
16135
16136Perl can only use a vfork() that doesn't suffer from strict
16137restrictions on calling functions or modifying global data in
16138the child. For example, glibc-2.1 contains such a vfork()
16139that is unsuitable. If your system provides a proper fork()
16140call, chances are that you do NOT want perl to use vfork().
16141
16142EOM
16143 rp="Do you still want to use vfork()?"
16144 . ./myread
16145 case "$ans" in
16146 y|Y) ;;
16147 *)
16148 echo "Ok, we won't use vfork()."
16149 val="$undef"
16150 ;;
16151 esac
16152 ;;
16153esac
16154set d_vfork
16155eval $setvar
16156case "$d_vfork" in
16157$define) usevfork='true';;
16158*) usevfork='false';;
16159esac
16160
263fee3f
JH
16161: see whether the pthread_atfork exists
16162$cat >try.c <<EOP
16163#include <pthread.h>
16164#include <stdio.h>
16165int main() {
16166#ifdef PTHREAD_ATFORK
16167 pthread_atfork(NULL,NULL,NULL);
16168#endif
16169}
16170EOP
16171
d6483fcc 16172: see if pthread_atfork exists
263fee3f
JH
16173set try -DPTHREAD_ATFORK
16174if eval $compile; then
16175 val="$define"
16176else
16177 val="$undef"
16178fi
16179case "$usethreads" in
16180$define)
16181 case "$val" in
16182 $define) echo 'pthread_atfork found.' >&4 ;;
16183 *) echo 'pthread_atfork NOT found.' >&4 ;;
16184 esac
16185esac
16186set d_pthread_atfork
16187eval $setvar
d6483fcc 16188
58d975c3
JH
16189: see if pthread_attr_setscope exists
16190set pthread_attr_setscope d_pthread_attr_setscope
16191eval $inlibc
16192
b4eb6b3d
JH
16193: see whether the various POSIXish _yields exist
16194$cat >try.c <<EOP
16195#include <pthread.h>
16196#include <stdio.h>
16197int main() {
16198#ifdef SCHED_YIELD
16199 sched_yield();
16200#else
16201#ifdef PTHREAD_YIELD
16202 pthread_yield();
16203#else
16204#ifdef PTHREAD_YIELD_NULL
16205 pthread_yield(NULL);
16206#endif
16207#endif
16208#endif
16209}
16210EOP
16211: see if sched_yield exists
16212set try -DSCHED_YIELD
16213if eval $compile; then
16214 val="$define"
16215 sched_yield='sched_yield()'
16216else
16217 val="$undef"
16218fi
16219case "$usethreads" in
16220$define)
16221 case "$val" in
16222 $define) echo 'sched_yield() found.' >&4 ;;
16223 *) echo 'sched_yield() NOT found.' >&4 ;;
16224 esac
16225esac
10bc17b6
JH
16226set d_sched_yield
16227eval $setvar
b4eb6b3d 16228
10bc17b6
JH
16229: see if pthread_yield exists
16230set try -DPTHREAD_YIELD
16231if eval $compile; then
16232 val="$define"
16233 case "$sched_yield" in
16234 '') sched_yield='pthread_yield()' ;;
16235 esac
16236else
16237 set try -DPTHREAD_YIELD_NULL
16238 if eval $compile; then
16239 val="$define"
16240 case "$sched_yield" in
16241 '') sched_yield='pthread_yield(NULL)' ;;
16242 esac
16243 else
16244 val="$undef"
16245 fi
16246fi
16247case "$usethreads" in
16248$define)
16249 case "$val" in
16250 $define) echo 'pthread_yield() found.' >&4 ;;
16251 *) echo 'pthread_yield() NOT found.' >&4 ;;
16252 esac
16253 ;;
16254esac
16255set d_pthread_yield
16256eval $setvar
10bc17b6
JH
16257case "$sched_yield" in
16258'') sched_yield=undef ;;
16259esac
5b813a60 16260$rm_try
10bc17b6
JH
16261
16262: see if random_r exists
16263set random_r d_random_r
16264eval $inlibc
16265case "$d_random_r" in
16266"$define")
16267 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16268 case "$d_random_r_proto:$usethreads" in
16269 ":define") d_random_r_proto=define
a48ec845
JH
16270 set d_random_r_proto random_r $hdrs
16271 eval $hasproto ;;
16272 *) ;;
16273 esac
16274 case "$d_random_r_proto" in
16275 define)
10bc17b6
JH
16276 case "$random_r_proto" in
16277 ''|0) try='int random_r(int*, struct random_data*);'
61c26d18 16278 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
a845a0d4
JH
16279 esac
16280 case "$random_r_proto" in
16281 ''|0) try='int random_r(long*, struct random_data*);'
61c26d18 16282 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
a845a0d4
JH
16283 esac
16284 case "$random_r_proto" in
16285 ''|0) try='int random_r(struct random_data*, int32_t*);'
61c26d18 16286 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
16287 esac
16288 case "$random_r_proto" in
90e831dc 16289 ''|0) d_random_r=undef
10bc17b6 16290 random_r_proto=0
a48ec845 16291 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16292 * ) case "$random_r_proto" in
16293 REENTRANT_PROTO*) ;;
16294 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16295 esac
16296 echo "Prototype: $try" ;;
16297 esac
b4eb6b3d 16298 ;;
c18e646a
JH
16299 *) case "$usethreads" in
16300 define) echo "random_r has no prototype, not using it." >&4 ;;
16301 esac
90e831dc
SB
16302 d_random_r=undef
16303 random_r_proto=0
c18e646a 16304 ;;
a48ec845
JH
16305 esac
16306 ;;
10bc17b6 16307*) random_r_proto=0
b4eb6b3d
JH
16308 ;;
16309esac
16310
16311: see if readdir and friends exist
16312set readdir d_readdir
16313eval $inlibc
16314set seekdir d_seekdir
16315eval $inlibc
16316set telldir d_telldir
16317eval $inlibc
16318set rewinddir d_rewinddir
16319eval $inlibc
16320
10bc17b6
JH
16321: see if readdir64_r exists
16322set readdir64_r d_readdir64_r
16323eval $inlibc
16324case "$d_readdir64_r" in
16325"$define")
16326 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16327 case "$d_readdir64_r_proto:$usethreads" in
16328 ":define") d_readdir64_r_proto=define
a48ec845
JH
16329 set d_readdir64_r_proto readdir64_r $hdrs
16330 eval $hasproto ;;
16331 *) ;;
16332 esac
16333 case "$d_readdir64_r_proto" in
16334 define)
10bc17b6
JH
16335 case "$readdir64_r_proto" in
16336 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
61c26d18 16337 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
10bc17b6
JH
16338 esac
16339 case "$readdir64_r_proto" in
16340 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
61c26d18 16341 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
10bc17b6
JH
16342 esac
16343 case "$readdir64_r_proto" in
90e831dc 16344 ''|0) d_readdir64_r=undef
10bc17b6 16345 readdir64_r_proto=0
a48ec845 16346 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16347 * ) case "$readdir64_r_proto" in
16348 REENTRANT_PROTO*) ;;
16349 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16350 esac
16351 echo "Prototype: $try" ;;
16352 esac
16353 ;;
c18e646a
JH
16354 *) case "$usethreads" in
16355 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16356 esac
90e831dc
SB
16357 d_readdir64_r=undef
16358 readdir64_r_proto=0
c18e646a 16359 ;;
a48ec845
JH
16360 esac
16361 ;;
10bc17b6
JH
16362*) readdir64_r_proto=0
16363 ;;
16364esac
16365
16366: see if readdir_r exists
16367set readdir_r d_readdir_r
16368eval $inlibc
16369case "$d_readdir_r" in
16370"$define")
16371 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16372 case "$d_readdir_r_proto:$usethreads" in
16373 ":define") d_readdir_r_proto=define
a48ec845
JH
16374 set d_readdir_r_proto readdir_r $hdrs
16375 eval $hasproto ;;
16376 *) ;;
16377 esac
16378 case "$d_readdir_r_proto" in
16379 define)
10bc17b6
JH
16380 case "$readdir_r_proto" in
16381 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
61c26d18 16382 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
10bc17b6
JH
16383 esac
16384 case "$readdir_r_proto" in
16385 ''|0) try='int readdir_r(DIR*, struct dirent*);'
61c26d18 16386 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
10bc17b6
JH
16387 esac
16388 case "$readdir_r_proto" in
90e831dc 16389 ''|0) d_readdir_r=undef
10bc17b6 16390 readdir_r_proto=0
a48ec845 16391 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16392 * ) case "$readdir_r_proto" in
16393 REENTRANT_PROTO*) ;;
16394 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16395 esac
16396 echo "Prototype: $try" ;;
16397 esac
16398 ;;
c18e646a
JH
16399 *) case "$usethreads" in
16400 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16401 esac
90e831dc
SB
16402 d_readdir_r=undef
16403 readdir_r_proto=0
c18e646a 16404 ;;
a48ec845
JH
16405 esac
16406 ;;
10bc17b6
JH
16407*) readdir_r_proto=0
16408 ;;
16409esac
16410
4e0554ec
JH
16411: see if readv exists
16412set readv d_readv
16413eval $inlibc
16414
16415: see if recvmsg exists
16416set recvmsg d_recvmsg
16417eval $inlibc
16418
b4eb6b3d
JH
16419: see if rename exists
16420set rename d_rename
16421eval $inlibc
16422
16423: see if rmdir exists
16424set rmdir d_rmdir
16425eval $inlibc
16426
16427: see if memory.h is available.
16428val=''
16429set memory.h val
16430eval $inhdr
16431
16432: See if it conflicts with string.h
16433case "$val" in
16434$define)
16435 case "$strings" in
16436 '') ;;
16437 *)
16438 $cppstdin $cppflags $cppminus < $strings > mem.h
16439 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16440 echo " "
16441 echo "We won't be including <memory.h>."
16442 val="$undef"
16443 fi
16444 $rm -f mem.h
16445 ;;
16446 esac
16447esac
16448set i_memory
16449eval $setvar
16450
16451: can bcopy handle overlapping blocks?
b6cc3bc4 16452echo " "
b4eb6b3d 16453val="$undef"
b6cc3bc4
AD
16454case "$d_memmove" in
16455"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16456*) case "$d_bcopy" in
16457 "$define")
16458 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16459 $cat >try.c <<EOCP
b4eb6b3d
JH
16460#$i_memory I_MEMORY
16461#$i_stdlib I_STDLIB
16462#$i_string I_STRING
16463#$i_unistd I_UNISTD
16464EOCP
16465 $cat >>try.c <<'EOCP'
16466#include <stdio.h>
16467#ifdef I_MEMORY
16468# include <memory.h>
16469#endif
16470#ifdef I_STDLIB
16471# include <stdlib.h>
16472#endif
16473#ifdef I_STRING
16474# include <string.h>
16475#else
16476# include <strings.h>
16477#endif
16478#ifdef I_UNISTD
16479# include <unistd.h> /* Needed for NetBSD */
16480#endif
16481int main()
16482{
16483char buf[128], abc[128];
16484char *b;
16485int len;
16486int off;
16487int align;
16488
b6cc3bc4
AD
16489/* Copy "abcde..." string to char abc[] so that gcc doesn't
16490 try to store the string in read-only memory. */
b4eb6b3d
JH
16491bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16492
16493for (align = 7; align >= 0; align--) {
16494 for (len = 36; len; len--) {
16495 b = buf+align;
16496 bcopy(abc, b, len);
16497 for (off = 1; off <= len; off++) {
16498 bcopy(b, b+off, len);
16499 bcopy(b+off, b, len);
16500 if (bcmp(b, abc, len))
16501 exit(1);
16502 }
16503 }
16504}
16505exit(0);
16506}
16507EOCP
b6cc3bc4
AD
16508 set try
16509 if eval $compile_ok; then
43dddb59 16510 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16511 echo "Yes, it can."
16512 val="$define"
16513 else
16514 echo "It can't, sorry."
16515 fi
b4eb6b3d 16516 else
b6cc3bc4 16517 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16518 fi
b6cc3bc4
AD
16519 ;;
16520 esac
5b813a60 16521 $rm_try
b4eb6b3d
JH
16522 ;;
16523esac
b4eb6b3d
JH
16524set d_safebcpy
16525eval $setvar
16526
16527: can memcpy handle overlapping blocks?
b6cc3bc4 16528echo " "
b4eb6b3d 16529val="$undef"
b6cc3bc4
AD
16530case "$d_memmove" in
16531"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16532*) case "$d_memcpy" in
16533 "$define")
16534 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16535 $cat >try.c <<EOCP
b4eb6b3d
JH
16536#$i_memory I_MEMORY
16537#$i_stdlib I_STDLIB
16538#$i_string I_STRING
16539#$i_unistd I_UNISTD
16540EOCP
16541 $cat >>try.c <<'EOCP'
16542#include <stdio.h>
16543#ifdef I_MEMORY
16544# include <memory.h>
16545#endif
16546#ifdef I_STDLIB
16547# include <stdlib.h>
16548#endif
16549#ifdef I_STRING
16550# include <string.h>
16551#else
16552# include <strings.h>
16553#endif
16554#ifdef I_UNISTD
16555# include <unistd.h> /* Needed for NetBSD */
16556#endif
16557int main()
16558{
16559char buf[128], abc[128];
16560char *b;
16561int len;
16562int off;
16563int align;
16564
16565/* Copy "abcde..." string to char abc[] so that gcc doesn't
16566 try to store the string in read-only memory. */
16567memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16568
16569for (align = 7; align >= 0; align--) {
16570 for (len = 36; len; len--) {
16571 b = buf+align;
16572 memcpy(b, abc, len);
16573 for (off = 1; off <= len; off++) {
16574 memcpy(b+off, b, len);
16575 memcpy(b, b+off, len);
16576 if (memcmp(b, abc, len))
16577 exit(1);
16578 }
16579 }
16580}
16581exit(0);
16582}
16583EOCP
b6cc3bc4
AD
16584 set try
16585 if eval $compile_ok; then
43dddb59 16586 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16587 echo "Yes, it can."
16588 val="$define"
16589 else
16590 echo "It can't, sorry."
16591 fi
b4eb6b3d 16592 else
b6cc3bc4 16593 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16594 fi
b6cc3bc4
AD
16595 ;;
16596 esac
5b813a60 16597 $rm_try
b4eb6b3d
JH
16598 ;;
16599esac
b4eb6b3d
JH
16600set d_safemcpy
16601eval $setvar
16602
16603: can memcmp be trusted to compare relative magnitude?
16604val="$undef"
16605case "$d_memcmp" in
16606"$define")
16607 echo " "
16608 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16609 $cat >try.c <<EOCP
16610#$i_memory I_MEMORY
16611#$i_stdlib I_STDLIB
16612#$i_string I_STRING
16613#$i_unistd I_UNISTD
16614EOCP
16615 $cat >>try.c <<'EOCP'
16616#include <stdio.h>
16617#ifdef I_MEMORY
16618# include <memory.h>
16619#endif
16620#ifdef I_STDLIB
36adc09b 16621# include <stdlib.h>
b4eb6b3d
JH
16622#endif
16623#ifdef I_STRING
16624# include <string.h>
16625#else
16626# include <strings.h>
16627#endif
16628#ifdef I_UNISTD
16629# include <unistd.h> /* Needed for NetBSD */
16630#endif
16631int main()
16632{
16633char a = -1;
16634char b = 0;
16635if ((a < b) && memcmp(&a, &b, 1) < 0)
16636 exit(1);
16637exit(0);
16638}
16639EOCP
16640 set try
16641 if eval $compile_ok; then
5440bc8e 16642 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16643 echo "Yes, it can."
16644 val="$define"
16645 else
16646 echo "No, it can't (it uses signed chars)."
16647 fi
16648 else
16649 echo "(I can't compile the test program, so we'll assume not...)"
16650 fi
16651 ;;
16652esac
5b813a60 16653$rm_try
b4eb6b3d
JH
16654set d_sanemcmp
16655eval $setvar
16656
ef9f17be
JH
16657: see if prototype for sbrk is available
16658echo " "
16659set d_sbrkproto sbrk $i_unistd unistd.h
16660eval $hasproto
16661
b4eb6b3d
JH
16662: see if select exists
16663set select d_select
16664eval $inlibc
16665
16666: see if semctl exists
16667set semctl d_semctl
16668eval $inlibc
16669
16670: see if semget exists
16671set semget d_semget
16672eval $inlibc
16673
16674: see if semop exists
16675set semop d_semop
16676eval $inlibc
16677
16678: see how much of the 'sem*(2)' library is present.
16679h_sem=true
16680echo " "
16681case "$d_semctl$d_semget$d_semop" in
16682*"$undef"*) h_sem=false;;
16683esac
16684case "$osname" in
16685freebsd)
16686 case "`ipcs 2>&1`" in
16687 "SVID messages"*"not configured"*)
16688 echo "Your $osname does not have the sem*(2) configured." >&4
16689 h_sem=false
16690 val="$undef"
16691 set semctl d_semctl
16692 eval $setvar
16693 set semget d_semget
16694 eval $setvar
16695 set semop d_semop
16696 eval $setvar
16697 ;;
16698 esac
16699 ;;
16700esac
16701: we could also check for sys/ipc.h ...
16702if $h_sem && $test `./findhdr sys/sem.h`; then
16703 echo "You have the full sem*(2) library." >&4
16704 val="$define"
16705else
16706 echo "You don't have the full sem*(2) library." >&4
16707 val="$undef"
16708fi
16709set d_sem
16710eval $setvar
16711
16712: see whether sys/sem.h defines union semun
16713echo " "
16714$cat > try.c <<'END'
16715#include <sys/types.h>
16716#include <sys/ipc.h>
16717#include <sys/sem.h>
16718int main () { union semun semun; semun.buf = 0; }
16719END
16720set try
16721if eval $compile; then
16722 echo "You have union semun in <sys/sem.h>." >&4
16723 val="$define"
16724else
16725 echo "You do not have union semun in <sys/sem.h>." >&4
16726 val="$undef"
16727fi
5b813a60 16728$rm_try
b4eb6b3d
JH
16729set d_union_semun
16730eval $setvar
16731
16732: see how to do semctl IPC_STAT
16733case "$d_sem" in
16734$define)
b4eb6b3d 16735 echo " "
93451a0d 16736 $cat > tryh.h <<END
b4eb6b3d
JH
16737#ifndef S_IRUSR
16738# ifdef S_IREAD
16739# define S_IRUSR S_IREAD
16740# define S_IWUSR S_IWRITE
16741# define S_IXUSR S_IEXEC
16742# else
16743# define S_IRUSR 0400
16744# define S_IWUSR 0200
16745# define S_IXUSR 0100
16746# endif
16747# define S_IRGRP (S_IRUSR>>3)
16748# define S_IWGRP (S_IWUSR>>3)
16749# define S_IXGRP (S_IXUSR>>3)
16750# define S_IROTH (S_IRUSR>>6)
16751# define S_IWOTH (S_IWUSR>>6)
16752# define S_IXOTH (S_IXUSR>>6)
16753#endif
16754#ifndef S_IRWXU
16755# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16756# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16757# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16758#endif
16759END
2fad75a1 16760 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16761 case "$d_semctl_semun" in
16762 '')
35918792 16763 val="$undef"
2fad75a1 16764 $cat > try.c <<END
b4eb6b3d
JH
16765#include <sys/types.h>
16766#include <sys/ipc.h>
16767#include <sys/sem.h>
16768#include <sys/stat.h>
16769#include <stdio.h>
16770#include <errno.h>
93451a0d 16771#include "tryh.h"
b4eb6b3d
JH
16772#ifndef errno
16773extern int errno;
16774#endif
16775#$d_union_semun HAS_UNION_SEMUN
16776int main() {
16777 union semun
16778#ifndef HAS_UNION_SEMUN
16779 {
16780 int val;
16781 struct semid_ds *buf;
16782 unsigned short *array;
16783 }
16784#endif
16785 arg;
16786 int sem, st;
16787
16788#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16789 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16790 if (sem > -1) {
16791 struct semid_ds argbuf;
16792 arg.buf = &argbuf;
16793# ifdef IPC_STAT
16794 st = semctl(sem, 0, IPC_STAT, arg);
16795 if (st == 0)
16796 printf("semun\n");
16797 else
16798# endif /* IPC_STAT */
16799 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16800# ifdef IPC_RMID
16801 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16802# endif /* IPC_RMID */
b4eb6b3d
JH
16803 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16804 } else
16805#endif /* IPC_PRIVATE && ... */
16806 printf("semget failed: errno = %d\n", errno);
16807 return 0;
16808}
16809END
2fad75a1
JH
16810 set try
16811 if eval $compile; then
16812 xxx=`$run ./try`
16813 case "$xxx" in
16814 semun) val="$define" ;;
16815 esac
16816 fi
5b813a60 16817 $rm_try
35918792
YST
16818 set d_semctl_semun
16819 eval $setvar
2fad75a1
JH
16820 ;;
16821 esac
b4eb6b3d
JH
16822 case "$d_semctl_semun" in
16823 $define)
16824 echo "You can use union semun for semctl IPC_STAT." >&4
16825 also='also'
16826 ;;
16827 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16828 also=''
16829 ;;
16830 esac
16831
16832 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16833 case "$d_semctl_semid_ds" in
16834 '')
35918792 16835 val="$undef"
2fad75a1 16836 $cat > try.c <<'END'
b4eb6b3d
JH
16837#include <sys/types.h>
16838#include <sys/ipc.h>
16839#include <sys/sem.h>
16840#include <sys/stat.h>
93451a0d 16841#include "tryh.h"
b4eb6b3d
JH
16842#include <stdio.h>
16843#include <errno.h>
16844#ifndef errno
16845extern int errno;
16846#endif
16847int main() {
16848 struct semid_ds arg;
16849 int sem, st;
16850
16851#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16852 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16853 if (sem > -1) {
16854# ifdef IPC_STAT
16855 st = semctl(sem, 0, IPC_STAT, &arg);
16856 if (st == 0)
16857 printf("semid_ds\n");
16858 else
16859# endif /* IPC_STAT */
16860 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16861# ifdef IPC_RMID
16862 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16863# endif /* IPC_RMID */
16864 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16865 } else
16866#endif /* IPC_PRIVATE && ... */
16867 printf("semget failed: errno = %d\n", errno);
16868
16869 return 0;
16870}
16871END
2fad75a1
JH
16872 set try
16873 if eval $compile; then
16874 xxx=`$run ./try`
16875 case "$xxx" in
16876 semid_ds) val="$define" ;;
16877 esac
16878 fi
5b813a60 16879 $rm_try
35918792
YST
16880 set d_semctl_semid_ds
16881 eval $setvar
2fad75a1
JH
16882 ;;
16883 esac
b4eb6b3d
JH
16884 case "$d_semctl_semid_ds" in
16885 $define)
16886 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16887 ;;
16888 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16889 ;;
16890 esac
b4eb6b3d
JH
16891 ;;
16892*) val="$undef"
16893
16894 # We do not have the full sem*(2) library, so assume we can not
16895 # use either.
16896
16897 set d_semctl_semun
16898 eval $setvar
16899
16900 set d_semctl_semid_ds
16901 eval $setvar
16902 ;;
16903esac
93451a0d 16904$rm_try tryh.h
b4eb6b3d 16905
4e0554ec
JH
16906: see if sendmsg exists
16907set sendmsg d_sendmsg
16908eval $inlibc
16909
b4eb6b3d
JH
16910: see if setegid exists
16911set setegid d_setegid
16912eval $inlibc
16913
16914: see if seteuid exists
16915set seteuid d_seteuid
16916eval $inlibc
16917
16918: see if setgrent exists
16919set setgrent d_setgrent
16920eval $inlibc
16921
10bc17b6
JH
16922: see if setgrent_r exists
16923set setgrent_r d_setgrent_r
16924eval $inlibc
16925case "$d_setgrent_r" in
16926"$define")
16927 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16928 case "$d_setgrent_r_proto:$usethreads" in
16929 ":define") d_setgrent_r_proto=define
a48ec845
JH
16930 set d_setgrent_r_proto setgrent_r $hdrs
16931 eval $hasproto ;;
16932 *) ;;
16933 esac
16934 case "$d_setgrent_r_proto" in
16935 define)
10bc17b6
JH
16936 case "$setgrent_r_proto" in
16937 ''|0) try='int setgrent_r(FILE**);'
61c26d18 16938 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
10bc17b6
JH
16939 esac
16940 case "$setgrent_r_proto" in
16941 ''|0) try='void setgrent_r(FILE**);'
61c26d18 16942 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
10bc17b6
JH
16943 esac
16944 case "$setgrent_r_proto" in
90e831dc 16945 ''|0) d_setgrent_r=undef
10bc17b6 16946 setgrent_r_proto=0
a48ec845 16947 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16948 * ) case "$setgrent_r_proto" in
16949 REENTRANT_PROTO*) ;;
16950 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16951 esac
16952 echo "Prototype: $try" ;;
16953 esac
16954 ;;
c18e646a
JH
16955 *) case "$usethreads" in
16956 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16957 esac
90e831dc
SB
16958 d_setgrent_r=undef
16959 setgrent_r_proto=0
c18e646a 16960 ;;
a48ec845
JH
16961 esac
16962 ;;
10bc17b6
JH
16963*) setgrent_r_proto=0
16964 ;;
16965esac
16966
b4eb6b3d
JH
16967: see if sethostent exists
16968set sethostent d_sethent
16969eval $inlibc
16970
10bc17b6
JH
16971: see if sethostent_r exists
16972set sethostent_r d_sethostent_r
16973eval $inlibc
16974case "$d_sethostent_r" in
16975"$define")
16976 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16977 case "$d_sethostent_r_proto:$usethreads" in
16978 ":define") d_sethostent_r_proto=define
a48ec845
JH
16979 set d_sethostent_r_proto sethostent_r $hdrs
16980 eval $hasproto ;;
16981 *) ;;
16982 esac
16983 case "$d_sethostent_r_proto" in
16984 define)
10bc17b6
JH
16985 case "$sethostent_r_proto" in
16986 ''|0) try='int sethostent_r(int, struct hostent_data*);'
61c26d18 16987 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
10bc17b6
JH
16988 esac
16989 case "$sethostent_r_proto" in
16990 ''|0) try='void sethostent_r(int, struct hostent_data*);'
61c26d18 16991 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
10bc17b6
JH
16992 esac
16993 case "$sethostent_r_proto" in
90e831dc 16994 ''|0) d_sethostent_r=undef
10bc17b6 16995 sethostent_r_proto=0
a48ec845 16996 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16997 * ) case "$sethostent_r_proto" in
16998 REENTRANT_PROTO*) ;;
16999 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17000 esac
17001 echo "Prototype: $try" ;;
17002 esac
17003 ;;
c18e646a
JH
17004 *) case "$usethreads" in
17005 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17006 esac
90e831dc
SB
17007 d_sethostent_r=undef
17008 sethostent_r_proto=0
c18e646a 17009 ;;
a48ec845
JH
17010 esac
17011 ;;
10bc17b6
JH
17012*) sethostent_r_proto=0
17013 ;;
17014esac
17015
4e0554ec
JH
17016: see if setitimer exists
17017set setitimer d_setitimer
17018eval $inlibc
17019
b4eb6b3d
JH
17020: see if setlinebuf exists
17021set setlinebuf d_setlinebuf
17022eval $inlibc
17023
17024: see if setlocale exists
17025set setlocale d_setlocale
17026eval $inlibc
17027
10bc17b6
JH
17028: see if locale.h is available
17029set locale.h i_locale
17030eval $inhdr
17031
17032: see if setlocale_r exists
17033set setlocale_r d_setlocale_r
17034eval $inlibc
17035case "$d_setlocale_r" in
17036"$define")
17037 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
17038 case "$d_setlocale_r_proto:$usethreads" in
17039 ":define") d_setlocale_r_proto=define
a48ec845
JH
17040 set d_setlocale_r_proto setlocale_r $hdrs
17041 eval $hasproto ;;
17042 *) ;;
17043 esac
17044 case "$d_setlocale_r_proto" in
17045 define)
10bc17b6
JH
17046 case "$setlocale_r_proto" in
17047 ''|0) try='int setlocale_r(int, const char*, char*, int);'
61c26d18 17048 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
10bc17b6
JH
17049 esac
17050 case "$setlocale_r_proto" in
90e831dc 17051 ''|0) d_setlocale_r=undef
10bc17b6 17052 setlocale_r_proto=0
a48ec845 17053 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17054 * ) case "$setlocale_r_proto" in
17055 REENTRANT_PROTO*) ;;
17056 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17057 esac
17058 echo "Prototype: $try" ;;
17059 esac
17060 ;;
c18e646a
JH
17061 *) case "$usethreads" in
17062 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17063 esac
90e831dc
SB
17064 d_setlocale_r=undef
17065 setlocale_r_proto=0
c18e646a 17066 ;;
a48ec845
JH
17067 esac
17068 ;;
10bc17b6
JH
17069*) setlocale_r_proto=0
17070 ;;
17071esac
17072
b4eb6b3d
JH
17073: see if setnetent exists
17074set setnetent d_setnent
17075eval $inlibc
17076
10bc17b6
JH
17077: see if setnetent_r exists
17078set setnetent_r d_setnetent_r
17079eval $inlibc
17080case "$d_setnetent_r" in
17081"$define")
17082 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17083 case "$d_setnetent_r_proto:$usethreads" in
17084 ":define") d_setnetent_r_proto=define
a48ec845
JH
17085 set d_setnetent_r_proto setnetent_r $hdrs
17086 eval $hasproto ;;
17087 *) ;;
17088 esac
17089 case "$d_setnetent_r_proto" in
17090 define)
10bc17b6
JH
17091 case "$setnetent_r_proto" in
17092 ''|0) try='int setnetent_r(int, struct netent_data*);'
61c26d18 17093 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
10bc17b6
JH
17094 esac
17095 case "$setnetent_r_proto" in
17096 ''|0) try='void setnetent_r(int, struct netent_data*);'
61c26d18 17097 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
10bc17b6
JH
17098 esac
17099 case "$setnetent_r_proto" in
90e831dc 17100 ''|0) d_setnetent_r=undef
10bc17b6 17101 setnetent_r_proto=0
a48ec845 17102 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17103 * ) case "$setnetent_r_proto" in
17104 REENTRANT_PROTO*) ;;
17105 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17106 esac
17107 echo "Prototype: $try" ;;
17108 esac
17109 ;;
c18e646a
JH
17110 *) case "$usethreads" in
17111 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17112 esac
90e831dc
SB
17113 d_setnetent_r=undef
17114 setnetent_r_proto=0
c18e646a 17115 ;;
a48ec845
JH
17116 esac
17117 ;;
10bc17b6
JH
17118*) setnetent_r_proto=0
17119 ;;
17120esac
17121
b4eb6b3d
JH
17122: see if setprotoent exists
17123set setprotoent d_setpent
17124eval $inlibc
17125
17126: see if setpgid exists
17127set setpgid d_setpgid
17128eval $inlibc
17129
17130: see if setpgrp2 exists
17131set setpgrp2 d_setpgrp2
17132eval $inlibc
17133
17134: see if setpriority exists
17135set setpriority d_setprior
17136eval $inlibc
17137
17138: see if setproctitle exists
17139set setproctitle d_setproctitle
17140eval $inlibc
17141
10bc17b6
JH
17142: see if setprotoent_r exists
17143set setprotoent_r d_setprotoent_r
17144eval $inlibc
17145case "$d_setprotoent_r" in
17146"$define")
17147 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17148 case "$d_setprotoent_r_proto:$usethreads" in
17149 ":define") d_setprotoent_r_proto=define
a48ec845
JH
17150 set d_setprotoent_r_proto setprotoent_r $hdrs
17151 eval $hasproto ;;
17152 *) ;;
17153 esac
17154 case "$d_setprotoent_r_proto" in
17155 define)
10bc17b6
JH
17156 case "$setprotoent_r_proto" in
17157 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
61c26d18 17158 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
10bc17b6
JH
17159 esac
17160 case "$setprotoent_r_proto" in
17161 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
61c26d18 17162 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
10bc17b6
JH
17163 esac
17164 case "$setprotoent_r_proto" in
90e831dc 17165 ''|0) d_setprotoent_r=undef
10bc17b6 17166 setprotoent_r_proto=0
a48ec845 17167 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17168 * ) case "$setprotoent_r_proto" in
17169 REENTRANT_PROTO*) ;;
17170 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17171 esac
17172 echo "Prototype: $try" ;;
17173 esac
17174 ;;
c18e646a
JH
17175 *) case "$usethreads" in
17176 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17177 esac
90e831dc
SB
17178 d_setprotoent_r=undef
17179 setprotoent_r_proto=0
c18e646a 17180 ;;
a48ec845
JH
17181 esac
17182 ;;
10bc17b6
JH
17183*) setprotoent_r_proto=0
17184 ;;
17185esac
17186
b4eb6b3d
JH
17187: see if setpwent exists
17188set setpwent d_setpwent
17189eval $inlibc
17190
10bc17b6
JH
17191: see if setpwent_r exists
17192set setpwent_r d_setpwent_r
17193eval $inlibc
17194case "$d_setpwent_r" in
17195"$define")
17196 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
17197 case "$d_setpwent_r_proto:$usethreads" in
17198 ":define") d_setpwent_r_proto=define
a48ec845
JH
17199 set d_setpwent_r_proto setpwent_r $hdrs
17200 eval $hasproto ;;
17201 *) ;;
17202 esac
17203 case "$d_setpwent_r_proto" in
17204 define)
10bc17b6
JH
17205 case "$setpwent_r_proto" in
17206 ''|0) try='int setpwent_r(FILE**);'
61c26d18 17207 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
10bc17b6
JH
17208 esac
17209 case "$setpwent_r_proto" in
17210 ''|0) try='void setpwent_r(FILE**);'
61c26d18 17211 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
10bc17b6
JH
17212 esac
17213 case "$setpwent_r_proto" in
90e831dc 17214 ''|0) d_setpwent_r=undef
10bc17b6 17215 setpwent_r_proto=0
a48ec845 17216 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17217 * ) case "$setpwent_r_proto" in
17218 REENTRANT_PROTO*) ;;
17219 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17220 esac
17221 echo "Prototype: $try" ;;
17222 esac
17223 ;;
c18e646a
JH
17224 *) case "$usethreads" in
17225 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17226 esac
90e831dc
SB
17227 d_setpwent_r=undef
17228 setpwent_r_proto=0
c18e646a 17229 ;;
a48ec845
JH
17230 esac
17231 ;;
10bc17b6
JH
17232*) setpwent_r_proto=0
17233 ;;
17234esac
17235
b4eb6b3d
JH
17236: see if setregid exists
17237set setregid d_setregid
17238eval $inlibc
17239set setresgid d_setresgid
17240eval $inlibc
17241
17242: see if setreuid exists
17243set setreuid d_setreuid
17244eval $inlibc
17245set setresuid d_setresuid
17246eval $inlibc
17247
17248: see if setrgid exists
17249set setrgid d_setrgid
17250eval $inlibc
17251
17252: see if setruid exists
17253set setruid d_setruid
17254eval $inlibc
17255
17256: see if setservent exists
17257set setservent d_setsent
17258eval $inlibc
17259
10bc17b6
JH
17260: see if setservent_r exists
17261set setservent_r d_setservent_r
17262eval $inlibc
17263case "$d_setservent_r" in
17264"$define")
17265 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17266 case "$d_setservent_r_proto:$usethreads" in
17267 ":define") d_setservent_r_proto=define
a48ec845
JH
17268 set d_setservent_r_proto setservent_r $hdrs
17269 eval $hasproto ;;
17270 *) ;;
17271 esac
17272 case "$d_setservent_r_proto" in
17273 define)
10bc17b6
JH
17274 case "$setservent_r_proto" in
17275 ''|0) try='int setservent_r(int, struct servent_data*);'
61c26d18 17276 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
10bc17b6
JH
17277 esac
17278 case "$setservent_r_proto" in
17279 ''|0) try='void setservent_r(int, struct servent_data*);'
61c26d18 17280 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
10bc17b6
JH
17281 esac
17282 case "$setservent_r_proto" in
90e831dc 17283 ''|0) d_setservent_r=undef
10bc17b6 17284 setservent_r_proto=0
a48ec845 17285 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17286 * ) case "$setservent_r_proto" in
17287 REENTRANT_PROTO*) ;;
17288 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17289 esac
17290 echo "Prototype: $try" ;;
17291 esac
17292 ;;
c18e646a
JH
17293 *) case "$usethreads" in
17294 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17295 esac
90e831dc
SB
17296 d_setservent_r=undef
17297 setservent_r_proto=0
c18e646a 17298 ;;
a48ec845
JH
17299 esac
17300 ;;
10bc17b6
JH
17301*) setservent_r_proto=0
17302 ;;
17303esac
17304
b4eb6b3d
JH
17305: see if setsid exists
17306set setsid d_setsid
17307eval $inlibc
17308
17309: see if setvbuf exists
17310set setvbuf d_setvbuf
17311eval $inlibc
17312
17313: see if sfio.h is available
17314set sfio.h i_sfio
17315eval $inhdr
17316
b4eb6b3d
JH
17317: see if sfio library is available
17318case "$i_sfio" in
17319$define)
17320 val=''
17321 set sfreserve val
17322 eval $inlibc
17323 ;;
17324*)
17325 val="$undef"
17326 ;;
17327esac
17328: Ok, but do we want to use it.
17329case "$val" in
17330$define)
17331 case "$usesfio" in
17332 true|$define|[yY]*) dflt='y';;
17333 *) dflt='n';;
17334 esac
17335 echo "$package can use the sfio library, but it is experimental."
17336 case "$useperlio" in
17337 "$undef")
17338 echo "For sfio also the PerlIO abstraction layer is needed."
17339 echo "Earlier you said you wouldn't want that."
17340 ;;
17341 esac
17342 rp="You seem to have sfio available, do you want to try using it?"
17343 . ./myread
17344 case "$ans" in
17345 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
17346 useperlio="$define"
17347 val="$define"
17348 ;;
17349 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
17350 val="$undef"
b4eb6b3d
JH
17351 ;;
17352 esac
17353 ;;
17354*) case "$usesfio" in
17355 true|$define|[yY]*)
17356 echo "Sorry, cannot find sfio on this machine." >&4
17357 echo "Ignoring your setting of usesfio=$usesfio." >&4
17358 val="$undef"
17359 ;;
17360 esac
17361 ;;
17362esac
17363set d_sfio
17364eval $setvar
17365case "$d_sfio" in
17366$define) usesfio='true';;
17367*) usesfio='false';;
17368esac
3659ebf1
JH
17369case "$d_sfio" in
17370$define) ;;
17371*) : Remove sfio from list of libraries to use
7483f793
JH
17372 case "$libs" in
17373 *-lsfio*)
17374 echo "Removing unneeded -lsfio from library list" >&4
17375 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17376 shift
17377 libs="$*"
17378 echo "libs = $libs" >&4
17379 ;;
17380 esac
3659ebf1
JH
17381;;
17382esac
17383
b4eb6b3d
JH
17384
17385: see if shmctl exists
17386set shmctl d_shmctl
17387eval $inlibc
17388
17389: see if shmget exists
17390set shmget d_shmget
17391eval $inlibc
17392
17393: see if shmat exists
17394set shmat d_shmat
17395eval $inlibc
17396: see what shmat returns
17397case "$d_shmat" in
17398"$define")
17399 $cat >shmat.c <<'END'
17400#include <sys/shm.h>
17401void *shmat();
17402END
17403 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17404 shmattype='void *'
17405 else
17406 shmattype='char *'
17407 fi
17408 echo "and it returns ($shmattype)." >&4
17409 : see if a prototype for shmat is available
17410 xxx=`./findhdr sys/shm.h`
17411 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17412 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17413 val="$define"
17414 else
17415 val="$undef"
17416 fi
17417 $rm -f shmat.[co]
17418 ;;
17419*)
17420 val="$undef"
17421 ;;
17422esac
17423set d_shmatprototype
17424eval $setvar
17425
17426: see if shmdt exists
17427set shmdt d_shmdt
17428eval $inlibc
17429
17430: see how much of the 'shm*(2)' library is present.
17431h_shm=true
17432echo " "
17433case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17434*"$undef"*) h_shm=false;;
17435esac
17436case "$osname" in
17437freebsd)
17438 case "`ipcs 2>&1`" in
17439 "SVID shared memory"*"not configured"*)
17440 echo "Your $osname does not have the shm*(2) configured." >&4
17441 h_shm=false
17442 val="$undef"
17443 set shmctl d_shmctl
17444 evat $setvar
17445 set shmget d_shmget
17446 evat $setvar
17447 set shmat d_shmat
17448 evat $setvar
17449 set shmdt d_shmdt
17450 evat $setvar
17451 ;;
17452 esac
17453 ;;
17454esac
17455: we could also check for sys/ipc.h ...
17456if $h_shm && $test `./findhdr sys/shm.h`; then
17457 echo "You have the full shm*(2) library." >&4
17458 val="$define"
17459else
17460 echo "You don't have the full shm*(2) library." >&4
17461 val="$undef"
17462fi
17463set d_shm
17464eval $setvar
17465
b4eb6b3d 17466: see if we have sigaction
613d6c3e 17467echo " "
b4eb6b3d
JH
17468if set sigaction val -f d_sigaction; eval $csym; $val; then
17469 echo 'sigaction() found.' >&4
073b6de5 17470 $cat > try.c <<EOP
b4eb6b3d
JH
17471#include <stdio.h>
17472#include <sys/types.h>
17473#include <signal.h>
073b6de5
JH
17474#$i_stdlib I_STDLIB
17475#ifdef I_STDLIB
17476#include <stdlib.h>
17477#endif
b4eb6b3d
JH
17478int main()
17479{
17480 struct sigaction act, oact;
17481 act.sa_flags = 0;
17482 oact.sa_handler = 0;
17483 /* so that act and oact are used */
17484 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17485}
17486EOP
17487 set try
17488 if eval $compile_ok; then
17489 val="$define"
17490 else
17491 echo "But you don't seem to have a useable struct sigaction." >&4
17492 val="$undef"
17493 fi
17494else
17495 echo 'sigaction NOT found.' >&4
17496 val="$undef"
17497fi
17498set d_sigaction; eval $setvar
5b813a60 17499$rm_try
b4eb6b3d 17500
ed140128
AD
17501: see if this is a sunmath.h system
17502set sunmath.h i_sunmath
17503eval $inhdr
17504
17505: see if signbit exists
17506$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17507$cat >try.c <<EOCP
17508#$i_math I_MATH
17509#$i_sunmath I_SUNMATH
17510#ifdef I_MATH
17511# include <math.h>
17512#endif
17513#ifdef I_SUNMATH /* Solaris special math library */
17514# include <sunmath.h>
17515#endif
17516#define NV $nvtype
17517int main(int argc, char **argv)
17518{
17519 NV x = 0.0;
17520 NV y = -0.0;
17521 if ((signbit(x) == 0) && (signbit(y) != 0))
17522 return 0;
17523 else
17524 return 1;
17525}
17526EOCP
17527val="$undef"
17528set try
17529if eval $compile; then
17530 if $run ./try; then
17531 $echo "Yes." >&4
17532 val="$define"
17533 else
17534 $echo "Signbit seems to be available, but doesn't work as I expected."
17535 $echo "I won't use it." >&4
17536 val="$undef"
17537 fi
17538else
17539 $echo "Nope." >&4
17540 dflt="$undef"
17541fi
17542set d_signbit
17543eval $setvar
5b813a60 17544$rm_try
ed140128 17545
983dbef6
JH
17546: see if sigprocmask exists
17547set sigprocmask d_sigprocmask
17548eval $inlibc
17549
b4eb6b3d
JH
17550: see if sigsetjmp exists
17551echo " "
17552case "$d_sigsetjmp" in
17553'')
c727eafa 17554 $cat >try.c <<EOP
b4eb6b3d 17555#include <setjmp.h>
d1daaddf
JH
17556#$i_stdlib I_STDLIB
17557#ifdef I_STDLIB
17558#include <stdlib.h>
17559#endif
b4eb6b3d
JH
17560sigjmp_buf env;
17561int set = 1;
17562int main()
17563{
17564 if (sigsetjmp(env,1))
17565 exit(set);
17566 set = 0;
17567 siglongjmp(env, 1);
17568 exit(1);
17569}
17570EOP
17571 set try
17572 if eval $compile; then
5440bc8e 17573 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17574 echo "POSIX sigsetjmp found." >&4
17575 val="$define"
17576 else
17577 $cat >&4 <<EOM
17578Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17579I'll ignore them.
17580EOM
17581 val="$undef"
17582 fi
17583 else
17584 echo "sigsetjmp not found." >&4
17585 val="$undef"
17586 fi
17587 ;;
17588*) val="$d_sigsetjmp"
17589 case "$d_sigsetjmp" in
17590 $define) echo "POSIX sigsetjmp found." >&4;;
17591 $undef) echo "sigsetjmp not found." >&4;;
17592 esac
17593 ;;
17594esac
17595set d_sigsetjmp
17596eval $setvar
5b813a60 17597$rm_try
b4eb6b3d 17598
4f5da3e9
SP
17599: see if snprintf exists
17600set snprintf d_snprintf
17601eval $inlibc
17602
17603: see if vsnprintf exists
17604set vsnprintf d_vsnprintf
17605eval $inlibc
17606
2478f7a0
MB
17607case "$d_snprintf-$d_vsnprintf" in
17608"$define-$define")
17609 $cat <<EOM
17610Checking whether your snprintf() and vsnprintf() work okay...
17611EOM
17612 $cat >try.c <<'EOCP'
17613/* v?snprintf testing logic courtesy of Russ Allbery.
17614 * According to C99:
17615 * - if the buffer is too short it still must be \0-terminated
17616 * - if the buffer is too short the potentially required length
17617 * must be returned and not -1
17618 * - if the buffer is NULL the potentially required length
17619 * must be returned and not -1 or core dump
17620 */
17621#include <stdio.h>
17622#include <stdarg.h>
17623
17624char buf[2];
17625
17626int test (char *format, ...)
17627{
17628 va_list args;
17629 int count;
17630
17631 va_start (args, format);
17632 count = vsnprintf (buf, sizeof buf, format, args);
17633 va_end (args);
17634 return count;
17635}
17636
17637int main ()
17638{
17639 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17640 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17641}
17642EOCP
17643 set try
17644 if eval $compile; then
17645 `$run ./try`
17646 case "$?" in
17647 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17648 *) cat <<EOM >&4
17649Your snprintf() and snprintf() don't seem to be working okay.
17650EOM
17651 d_snprintf="$undef"
17652 d_vsnprintf="$undef"
17653 ;;
17654 esac
17655 else
17656 echo "(I can't seem to compile the test program--assuming they don't)"
17657 d_snprintf="$undef"
17658 d_vsnprintf="$undef"
17659 fi
5b813a60 17660 $rm_try
2478f7a0
MB
17661 ;;
17662esac
17663
49a78c82
JH
17664: see if sockatmark exists
17665set sockatmark d_sockatmark
17666eval $inlibc
17667
2ef53570
JH
17668: see if prototype for sockatmark is available
17669echo " "
17670set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17671eval $hasproto
17672
b4eb6b3d
JH
17673: see if socks5_init exists
17674set socks5_init d_socks5_init
17675eval $inlibc
17676
360321b3
YST
17677: see if sprintf returns the length of the string in the buffer as per ANSI
17678$echo "Checking whether sprintf returns the length of the string..." >&4
17679$cat <<EOP >try.c
17680#include <stdio.h>
17681#$i_stdlib I_STDLIB
17682#ifdef I_STDLIB
17683#include <stdlib.h>
17684#endif
17685#$i_string I_STRING
17686#ifdef I_STRING
17687# include <string.h>
17688#else
17689# include <strings.h>
17690#endif
17691#$i_math I_MATH
17692#ifdef I_MATH
17693#include <math.h>
17694#endif
17695
17696char buffer[256];
17697
17698int check (size_t expect, int test) {
17699 size_t got = strlen(buffer);
17700 if (expect == got)
17701 return 0;
17702
17703 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17704 test, buffer);
17705 exit (test);
17706}
17707
17708int main(int argc, char **argv) {
17709 int test = 0;
17710
17711 check(sprintf(buffer, ""), ++test);
17712 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17713 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17714
17715 return 0;
17716}
17717EOP
17718set try
17719
360321b3
YST
17720if eval $compile; then
17721 xxx="`$run ./try`"
17722 case "$?" in
17723 0) cat >&4 <<EOM
17724sprintf returns the length of the string (as ANSI says it should)
17725EOM
17726 d_sprintf_returns_strlen="$define"
17727 ;;
17728 *) cat >&4 <<EOM
17729sprintf does not return the length of the string (how old is this system?)
17730EOM
17731 d_sprintf_returns_strlen="$undef"
17732 ;;
17733 esac
d2821e72 17734else
36a30365
JH
17735 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17736 d_sprintf_returns_strlen="$undef"
360321b3 17737fi
5b813a60 17738$rm_try
360321b3 17739
10bc17b6
JH
17740: see if srand48_r exists
17741set srand48_r d_srand48_r
17742eval $inlibc
17743case "$d_srand48_r" in
17744"$define")
17745 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17746 case "$d_srand48_r_proto:$usethreads" in
17747 ":define") d_srand48_r_proto=define
a48ec845
JH
17748 set d_srand48_r_proto srand48_r $hdrs
17749 eval $hasproto ;;
17750 *) ;;
17751 esac
17752 case "$d_srand48_r_proto" in
17753 define)
10bc17b6
JH
17754 case "$srand48_r_proto" in
17755 ''|0) try='int srand48_r(long, struct drand48_data*);'
61c26d18 17756 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
10bc17b6
JH
17757 esac
17758 case "$srand48_r_proto" in
90e831dc 17759 ''|0) d_srand48_r=undef
10bc17b6 17760 srand48_r_proto=0
a48ec845 17761 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17762 * ) case "$srand48_r_proto" in
17763 REENTRANT_PROTO*) ;;
17764 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17765 esac
17766 echo "Prototype: $try" ;;
17767 esac
17768 ;;
c18e646a
JH
17769 *) case "$usethreads" in
17770 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17771 esac
90e831dc
SB
17772 d_srand48_r=undef
17773 srand48_r_proto=0
c18e646a 17774 ;;
a48ec845
JH
17775 esac
17776 ;;
10bc17b6
JH
17777*) srand48_r_proto=0
17778 ;;
17779esac
17780
17781: see if srandom_r exists
17782set srandom_r d_srandom_r
17783eval $inlibc
17784case "$d_srandom_r" in
17785"$define")
17786 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17787 case "$d_srandom_r_proto:$usethreads" in
17788 ":define") d_srandom_r_proto=define
a48ec845
JH
17789 set d_srandom_r_proto srandom_r $hdrs
17790 eval $hasproto ;;
17791 *) ;;
17792 esac
17793 case "$d_srandom_r_proto" in
17794 define)
10bc17b6
JH
17795 case "$srandom_r_proto" in
17796 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
61c26d18 17797 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
10bc17b6
JH
17798 esac
17799 case "$srandom_r_proto" in
90e831dc 17800 ''|0) d_srandom_r=undef
10bc17b6 17801 srandom_r_proto=0
a48ec845 17802 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17803 * ) case "$srandom_r_proto" in
17804 REENTRANT_PROTO*) ;;
17805 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17806 esac
17807 echo "Prototype: $try" ;;
17808 esac
17809 ;;
c18e646a
JH
17810 *) case "$usethreads" in
17811 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17812 esac
90e831dc
SB
17813 d_srandom_r=undef
17814 srandom_r_proto=0
c18e646a 17815 ;;
a48ec845
JH
17816 esac
17817 ;;
10bc17b6
JH
17818*) srandom_r_proto=0
17819 ;;
17820esac
17821
eef837ea
JH
17822: see if prototype for setresgid is available
17823echo " "
17824set d_sresgproto setresgid $i_unistd unistd.h
17825eval $hasproto
17826
640374d0
JH
17827: see if prototype for setresuid is available
17828echo " "
17829set d_sresuproto setresuid $i_unistd unistd.h
17830eval $hasproto
17831
b4eb6b3d
JH
17832: see if sys/stat.h is available
17833set sys/stat.h i_sysstat
17834eval $inhdr
17835
b4eb6b3d
JH
17836: see if stat knows about block sizes
17837echo " "
17838echo "Checking to see if your struct stat has st_blocks field..." >&4
17839set d_statblks stat st_blocks $i_sysstat sys/stat.h
17840eval $hasfield
17841
b4eb6b3d
JH
17842: see if this is a sys/vfs.h system
17843set sys/vfs.h i_sysvfs
17844eval $inhdr
17845
b4eb6b3d
JH
17846: see if this is a sys/statfs.h system
17847set sys/statfs.h i_sysstatfs
17848eval $inhdr
17849
34f1896b 17850: Check for statfs_s
b4eb6b3d
JH
17851echo " "
17852echo "Checking to see if your system supports struct statfs..." >&4
17853set 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
17854eval $hasstruct
17855case "$d_statfs_s" in
17856"$define") echo "Yes, it does." ;;
17857*) echo "No, it doesn't." ;;
17858esac
17859
17860
b4eb6b3d
JH
17861: see if struct statfs knows about f_flags
17862case "$d_statfs_s" in
34f1896b 17863define)
b4eb6b3d
JH
17864 echo " "
17865 echo "Checking to see if your struct statfs has f_flags field..." >&4
17866 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
17867 eval $hasfield
17868 ;;
17869*) val="$undef"
17870 set d_statfs_f_flags
17871 eval $setvar
17872 ;;
17873esac
17874case "$d_statfs_f_flags" in
17875"$define") echo "Yes, it does." ;;
17876*) echo "No, it doesn't." ;;
17877esac
17878
17a6c8e3
AD
17879: see what flavor, if any, of static inline is supported
17880echo " "
17881echo "Checking to see if your system supports static inline..."
17882$cat > try.c <<'EOCP'
17883#include <stdlib.h>
17884extern int f_via_a(int x);
17885extern int f_via_b(int x);
17886int main(int argc, char **argv)
17887{
17888 int y;
17889
17890 y = f_via_a(0);
17891#ifdef USE_B
17892 y = f_via_b(0);
17893#endif
17894 if (y == 42) {
17895 return EXIT_SUCCESS;
17896 }
17897 else {
17898 return EXIT_FAILURE;
17899 }
17900}
17901EOCP
17902$cat > a.c <<'EOCP'
17903static INLINE int f(int x) {
17904 int y;
17905 y = x + 42;
17906 return y;
17907}
17908
17909int f_via_a(int x)
17910{
17911 return f(x);
17912}
17913EOCP
17914$cat > b.c <<'EOCP'
17915extern int f(int x);
17916
17917int f_via_b(int x)
17918{
17919 return f(x);
17920}
17921EOCP
17922
17923# Respect a hint (or previous) value for perl_static_inline, if there is one.
17924case "$perl_static_inline" in
17925'') # Check the various possibilities, and break out on success.
17926 # For gcc, prefer __inline__, which will still permit
17927 # cflags.SH to add in -ansi.
17928 case "$gccversion" in
17929 '') xxx="inline __inline__ __inline _inline";;
17930 *) xxx="__inline__ inline __inline _inline";;
17931 esac
17932 for inline in $xxx; do
17933 set try -DINLINE=$inline a.c
17934 if eval $compile && $run ./try; then
17935 # Now make sure there is no external linkage of static
17936 # functions
17937 set try -DINLINE=$inline -DUSE_B a.c b.c
17938 if eval $compile && $run ./try; then
17939 $echo "Your compiler supports static $inline, " >&4
17940 $echo "but it also creates an external definition," >&4
17941 $echo "so I won't use it." >&4
17942 val=$undef
17943 else
17944 $echo "Your compiler supports static $inline." >&4
17945 val=$define
17946 perl_static_inline="static $inline";
17947 break;
17948 fi
17949 else
17950 $echo "Your compiler does NOT support static $inline." >&4
17951 val="$undef"
17952 fi
17953 done
17954 ;;
17955*inline*) # Some variant of inline exists.
17956 echo "Keeping your $hint value of $perl_static_inline."
17957 val=$define
17958 ;;
17959static) # No inline capabilities
17960 echo "Keeping your $hint value of $perl_static_inline."
17961 val=$undef
17962 ;;
17963*) # Unrecognized previous value -- blindly trust the supplied
17964 # value and hope it makes sense. Use old value for
17965 # d_static_inline, if there is one.
17966 echo "Keeping your $hint value of $perl_static_inline."
17967 case "$d_static_inline" in
17968 '') val=$define ;;
17969 *) val=$d_static_inline ;;
17970 esac
17971 ;;
17972esac
17973# Fallback to plain 'static' if nothing worked.
17974case "$perl_static_inline" in
17975'')
17976 perl_static_inline="static"
17977 val=$undef
17978 ;;
17979esac
17980set d_static_inline
17981eval $setvar
17982$rm -f a.[co] b.[co]
17983$rm_try
17984
613d6c3e 17985: Check stream access
b4eb6b3d
JH
17986$cat >&4 <<EOM
17987Checking how to access stdio streams by file descriptor number...
17988EOM
17989case "$stdio_stream_array" in
17990'') $cat >try.c <<EOCP
17991#include <stdio.h>
17992int main() {
17993 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17994 printf("yes\n");
17995}
17996EOCP
17997 for s in _iob __iob __sF
17998 do
17999 set try -DSTDIO_STREAM_ARRAY=$s
18000 if eval $compile; then
5440bc8e 18001 case "`$run ./try`" in
b4eb6b3d
JH
18002 yes) stdio_stream_array=$s; break ;;
18003 esac
18004 fi
18005 done
5b813a60 18006 $rm_try
b4eb6b3d
JH
18007esac
18008case "$stdio_stream_array" in
18009'') $cat >&4 <<EOM
18010I can't figure out how to access stdio streams by file descriptor number.
18011EOM
18012 d_stdio_stream_array="$undef"
18013 ;;
18014*) $cat >&4 <<EOM
18015You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18016EOM
18017 d_stdio_stream_array="$define"
18018 ;;
18019esac
18020
18021: see if strcoll exists
18022set strcoll d_strcoll
18023eval $inlibc
18024
18025: check for structure copying
18026echo " "
18027echo "Checking to see if your C compiler can copy structs..." >&4
18028$cat >try.c <<'EOCP'
76f47787 18029int main()
b4eb6b3d
JH
18030{
18031 struct blurfl {
18032 int dyick;
18033 } foo, bar;
18034
18035 foo = bar;
18036}
18037EOCP
18038if $cc -c try.c >/dev/null 2>&1 ; then
18039 val="$define"
18040 echo "Yup, it can."
18041else
18042 val="$undef"
18043 echo "Nope, it can't."
18044fi
18045set d_strctcpy
18046eval $setvar
5b813a60 18047$rm_try
b4eb6b3d
JH
18048
18049: see if strerror and/or sys_errlist[] exist
18050echo " "
18051if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18052 if set strerror val -f d_strerror; eval $csym; $val; then
18053 echo 'strerror() found.' >&4
18054 d_strerror="$define"
18055 d_strerrm='strerror(e)'
18056 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18057 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18058 d_syserrlst="$define"
18059 else
18060 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18061 d_syserrlst="$undef"
18062 fi
18063 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18064 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18065 echo 'strerror() found in string header.' >&4
18066 d_strerror="$define"
18067 d_strerrm='strerror(e)'
18068 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18069 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18070 d_syserrlst="$define"
18071 else
18072 echo "(You don't appear to have any sys_errlist[], how can this be?)"
18073 d_syserrlst="$undef"
18074 fi
18075 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18076 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18077 d_strerror="$undef"
18078 d_syserrlst="$define"
18079 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18080 else
18081 echo 'strerror() and sys_errlist[] NOT found.' >&4
18082 d_strerror="$undef"
18083 d_syserrlst="$undef"
18084 d_strerrm='"unknown"'
18085 fi
18086fi
18087
10bc17b6
JH
18088: see if strerror_r exists
18089set strerror_r d_strerror_r
18090eval $inlibc
18091case "$d_strerror_r" in
18092"$define")
18093 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
18094 case "$d_strerror_r_proto:$usethreads" in
18095 ":define") d_strerror_r_proto=define
a48ec845
JH
18096 set d_strerror_r_proto strerror_r $hdrs
18097 eval $hasproto ;;
18098 *) ;;
18099 esac
18100 case "$d_strerror_r_proto" in
18101 define)
10bc17b6
JH
18102 case "$strerror_r_proto" in
18103 ''|0) try='int strerror_r(int, char*, size_t);'
61c26d18 18104 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
10bc17b6
JH
18105 esac
18106 case "$strerror_r_proto" in
18107 ''|0) try='int strerror_r(int, char*, int);'
61c26d18 18108 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
10bc17b6
JH
18109 esac
18110 case "$strerror_r_proto" in
18111 ''|0) try='char* strerror_r(int, char*, size_t);'
61c26d18 18112 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
10bc17b6
JH
18113 esac
18114 case "$strerror_r_proto" in
90e831dc 18115 ''|0) d_strerror_r=undef
10bc17b6 18116 strerror_r_proto=0
a48ec845 18117 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18118 * ) case "$strerror_r_proto" in
18119 REENTRANT_PROTO*) ;;
18120 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18121 esac
18122 echo "Prototype: $try" ;;
18123 esac
18124 ;;
c18e646a
JH
18125 *) case "$usethreads" in
18126 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18127 esac
90e831dc
SB
18128 d_strerror_r=undef
18129 strerror_r_proto=0
c18e646a 18130 ;;
a48ec845
JH
18131 esac
18132 ;;
10bc17b6
JH
18133*) strerror_r_proto=0
18134 ;;
18135esac
18136
b3c85772
JH
18137: see if strftime exists
18138set strftime d_strftime
18139eval $inlibc
18140
08c92000
MB
18141: see if strlcat exists
18142set strlcat d_strlcat
18143eval $inlibc
18144
18145: see if strlcpy exists
18146set strlcpy d_strlcpy
18147eval $inlibc
18148
b4eb6b3d
JH
18149: see if strtod exists
18150set strtod d_strtod
18151eval $inlibc
18152
18153: see if strtol exists
18154set strtol d_strtol
18155eval $inlibc
18156
18157: see if strtold exists
18158set strtold d_strtold
18159eval $inlibc
18160
18161: see if strtoll exists
18162set strtoll d_strtoll
18163eval $inlibc
18164
18165case "$d_longlong-$d_strtoll" in
18166"$define-$define")
18167 $cat <<EOM
18168Checking whether your strtoll() works okay...
18169EOM
18170 $cat >try.c <<'EOCP'
18171#include <errno.h>
18172#ifdef __hpux
18173#define strtoll __strtoll
18174#endif
e75931a7
YST
18175#ifdef __EMX__
18176#define strtoll _strtoll
18177#endif
b4eb6b3d 18178#include <stdio.h>
613d6c3e 18179extern long long int strtoll(char *s, char **, int);
b4eb6b3d
JH
18180static int bad = 0;
18181int check(char *s, long long ell, int een) {
18182 long long gll;
18183 errno = 0;
18184 gll = strtoll(s, 0, 10);
18185 if (!((gll == ell) && (errno == een)))
18186 bad++;
18187}
18188int main() {
18189 check(" 1", 1LL, 0);
18190 check(" 0", 0LL, 0);
18191 check("-1", -1LL, 0);
18192 check("-9223372036854775808", -9223372036854775808LL, 0);
18193 check("-9223372036854775808", -9223372036854775808LL, 0);
18194 check(" 9223372036854775807", 9223372036854775807LL, 0);
18195 check("-9223372036854775808", -9223372036854775808LL, 0);
18196 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
18197 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18198 if (!bad)
18199 printf("ok\n");
18200}
18201EOCP
18202 set try
18203 if eval $compile; then
5440bc8e 18204 yyy=`$run ./try`
e75931a7 18205 case "$yyy" in
b4eb6b3d
JH
18206 ok) echo "Your strtoll() seems to be working okay." ;;
18207 *) cat <<EOM >&4
18208Your strtoll() doesn't seem to be working okay.
18209EOM
18210 d_strtoll="$undef"
18211 ;;
69eadf66 18212 esac
e75931a7
YST
18213 else
18214 echo "(I can't seem to compile the test program--assuming it doesn't)"
18215 d_strtoll="$undef"
b4eb6b3d
JH
18216 fi
18217 ;;
18218esac
18219
28e5dec8
JH
18220: see if strtoq exists
18221set strtoq d_strtoq
18222eval $inlibc
18223
b4eb6b3d
JH
18224: see if strtoul exists
18225set strtoul d_strtoul
18226eval $inlibc
18227
d0e6d399
NC
18228case "$d_strtoul" in
18229"$define")
18230 $cat <<EOM
18231Checking whether your strtoul() works okay...
18232EOM
18233 $cat >try.c <<'EOCP'
18234#include <errno.h>
18235#include <stdio.h>
613d6c3e 18236extern unsigned long int strtoul(char *s, char **, int);
d0e6d399
NC
18237static int bad = 0;
18238void check(char *s, unsigned long eul, int een) {
18239 unsigned long gul;
18240 errno = 0;
18241 gul = strtoul(s, 0, 10);
18242 if (!((gul == eul) && (errno == een)))
18243 bad++;
18244}
18245int main() {
18246 check(" 1", 1L, 0);
18247 check(" 0", 0L, 0);
18248EOCP
18249 case "$longsize" in
18250 8)
18251 $cat >>try.c <<'EOCP'
09c0d2c4
JH
18252 check("18446744073709551615", 18446744073709551615UL, 0);
18253 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 18254#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 18255 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
18256 check("-18446744073709551614", 2, 0);
18257 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
18258 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18259 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 18260#endif
d0e6d399
NC
18261EOCP
18262 ;;
18263 4)
18264 $cat >>try.c <<'EOCP'
18265 check("4294967295", 4294967295UL, 0);
18266 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 18267#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
18268 check("-1", 4294967295UL, 0);
18269 check("-4294967294", 2, 0);
18270 check("-4294967295", 1, 0);
18271 check("-4294967296", 4294967295UL, ERANGE);
18272 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 18273#endif
d0e6d399
NC
18274EOCP
18275 ;;
18276 *)
18277: Should we write these tests to be more portable by sprintf-ing
18278: ~0 and then manipulating that char string as input for strtol?
18279 ;;
18280 esac
18281 $cat >>try.c <<'EOCP'
18282 if (!bad)
18283 printf("ok\n");
18284 return 0;
18285}
18286EOCP
18287 set try
18288 if eval $compile; then
5440bc8e 18289 case "`$run ./try`" in
d0e6d399
NC
18290 ok) echo "Your strtoul() seems to be working okay." ;;
18291 *) cat <<EOM >&4
18292Your strtoul() doesn't seem to be working okay.
18293EOM
18294 d_strtoul="$undef"
18295 ;;
18296 esac
9597a80f
NC
18297 else
18298 echo "(I can't seem to compile the test program--assuming it doesn't)"
18299 d_strtoul="$undef"
d0e6d399
NC
18300 fi
18301 ;;
18302esac
18303
b4eb6b3d
JH
18304: see if strtoull exists
18305set strtoull d_strtoull
18306eval $inlibc
18307
18308case "$d_longlong-$d_strtoull" in
18309"$define-$define")
18310 $cat <<EOM
18311Checking whether your strtoull() works okay...
18312EOM
18313 $cat >try.c <<'EOCP'
18314#include <errno.h>
18315#ifdef __hpux
18316#define strtoull __strtoull
18317#endif
18318#include <stdio.h>
613d6c3e 18319extern unsigned long long int strtoull(char *s, char **, int);
b4eb6b3d
JH
18320static int bad = 0;
18321int check(char *s, long long eull, int een) {
18322 long long gull;
18323 errno = 0;
18324 gull = strtoull(s, 0, 10);
18325 if (!((gull == eull) && (errno == een)))
18326 bad++;
18327}
18328int main() {
d0e6d399
NC
18329 check(" 1", 1LL, 0);
18330 check(" 0", 0LL, 0);
18331 check("18446744073709551615", 18446744073709551615ULL, 0);
18332 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18333#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
18334 check("-1", 18446744073709551615ULL, 0);
18335 check("-18446744073709551614", 2LL, 0);
18336 check("-18446744073709551615", 1LL, 0);
18337 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18338 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18339#endif
b4eb6b3d
JH
18340 if (!bad)
18341 printf("ok\n");
18342}
18343EOCP
18344 set try
18345 if eval $compile; then
5440bc8e 18346 case "`$run ./try`" in
b4eb6b3d
JH
18347 ok) echo "Your strtoull() seems to be working okay." ;;
18348 *) cat <<EOM >&4
18349Your strtoull() doesn't seem to be working okay.
18350EOM
18351 d_strtoull="$undef"
18352 ;;
18353 esac
9597a80f
NC
18354 else
18355 echo "(I can't seem to compile the test program--assuming it doesn't)"
18356 d_strtoull="$undef"
b4eb6b3d
JH
18357 fi
18358 ;;
18359esac
18360
18361: see if strtouq exists
18362set strtouq d_strtouq
18363eval $inlibc
18364
d0e6d399
NC
18365case "$d_strtouq" in
18366"$define")
18367 $cat <<EOM
18368Checking whether your strtouq() works okay...
18369EOM
18370 $cat >try.c <<'EOCP'
18371#include <errno.h>
18372#include <stdio.h>
613d6c3e 18373extern unsigned long long int strtouq(char *s, char **, int);
d0e6d399
NC
18374static int bad = 0;
18375void check(char *s, unsigned long long eull, int een) {
18376 unsigned long long gull;
18377 errno = 0;
18378 gull = strtouq(s, 0, 10);
18379 if (!((gull == eull) && (errno == een)))
18380 bad++;
18381}
18382int main() {
18383 check(" 1", 1LL, 0);
18384 check(" 0", 0LL, 0);
18385 check("18446744073709551615", 18446744073709551615ULL, 0);
18386 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18387#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
18388 check("-1", 18446744073709551615ULL, 0);
18389 check("-18446744073709551614", 2LL, 0);
18390 check("-18446744073709551615", 1LL, 0);
18391 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18392 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18393#endif
d0e6d399
NC
18394 if (!bad)
18395 printf("ok\n");
18396 return 0;
18397}
18398EOCP
18399 set try
18400 if eval $compile; then
5440bc8e 18401 case "`$run ./try`" in
d0e6d399
NC
18402 ok) echo "Your strtouq() seems to be working okay." ;;
18403 *) cat <<EOM >&4
18404Your strtouq() doesn't seem to be working okay.
18405EOM
18406 d_strtouq="$undef"
18407 ;;
18408 esac
9597a80f
NC
18409 else
18410 echo "(I can't seem to compile the test program--assuming it doesn't)"
18411 d_strtouq="$undef"
d0e6d399
NC
18412 fi
18413 ;;
18414esac
18415
b4eb6b3d
JH
18416: see if strxfrm exists
18417set strxfrm d_strxfrm
18418eval $inlibc
18419
18420: see if symlink exists
18421set symlink d_symlink
18422eval $inlibc
18423
18424: see if syscall exists
18425set syscall d_syscall
18426eval $inlibc
18427
2ef53570
JH
18428: see if prototype for syscall is available
18429echo " "
18430set d_syscallproto syscall $i_unistd unistd.h
18431eval $hasproto
18432
b4eb6b3d
JH
18433: see if sysconf exists
18434set sysconf d_sysconf
18435eval $inlibc
18436
18437: see if system exists
18438set system d_system
18439eval $inlibc
18440
18441: see if tcgetpgrp exists
18442set tcgetpgrp d_tcgetpgrp
18443eval $inlibc
18444
18445: see if tcsetpgrp exists
18446set tcsetpgrp d_tcsetpgrp
18447eval $inlibc
18448
18449: see if prototype for telldir is available
18450echo " "
18451set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18452eval $hasproto
18453
ad493445
MB
18454: see if time exists
18455echo " "
18456if test "X$d_time" = X -o X"$timetype" = X; then
18457 if set time val -f d_time; eval $csym; $val; then
18458 echo 'time() found.' >&4
18459 val="$define"
18460 rp="What is the type returned by time() on this system?"
18461 set time_t timetype long stdio.h sys/types.h
18462 eval $typedef_ask
18463 else
18464 echo 'time() not found, hope that will do.' >&4
18465 val="$undef"
18466 timetype='int';
18467 fi
18468 set d_time
18469 eval $setvar
18470fi
18471
cbb9e8a7
MB
18472: see if timegm exists
18473set timegm d_timegm
18474eval $inlibc
18475
b4eb6b3d
JH
18476: see if this is a sys/times.h system
18477set sys/times.h i_systimes
18478eval $inhdr
18479
18480: see if times exists
18481echo " "
18482if set times val -f d_times; eval $csym; $val; then
18483 echo 'times() found.' >&4
18484 d_times="$define"
18485 inc=''
18486 case "$i_systimes" in
18487 "$define") inc='sys/times.h';;
18488 esac
18489 rp="What is the type returned by times() on this system?"
18490 set clock_t clocktype long stdio.h sys/types.h $inc
18491 eval $typedef_ask
18492else
18493 echo 'times() NOT found, hope that will do.' >&4
18494 d_times="$undef"
18495 clocktype='int'
18496fi
18497
10bc17b6
JH
18498: see if tmpnam_r exists
18499set tmpnam_r d_tmpnam_r
18500eval $inlibc
18501case "$d_tmpnam_r" in
18502"$define")
31ee0cb7 18503 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
18504 case "$d_tmpnam_r_proto:$usethreads" in
18505 ":define") d_tmpnam_r_proto=define
a48ec845
JH
18506 set d_tmpnam_r_proto tmpnam_r $hdrs
18507 eval $hasproto ;;
18508 *) ;;
18509 esac
18510 case "$d_tmpnam_r_proto" in
18511 define)
10bc17b6
JH
18512 case "$tmpnam_r_proto" in
18513 ''|0) try='char* tmpnam_r(char*);'
61c26d18 18514 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
10bc17b6
JH
18515 esac
18516 case "$tmpnam_r_proto" in
90e831dc 18517 ''|0) d_tmpnam_r=undef
10bc17b6 18518 tmpnam_r_proto=0
a48ec845 18519 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18520 * ) case "$tmpnam_r_proto" in
18521 REENTRANT_PROTO*) ;;
18522 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18523 esac
18524 echo "Prototype: $try" ;;
18525 esac
18526 ;;
c18e646a
JH
18527 *) case "$usethreads" in
18528 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18529 esac
90e831dc
SB
18530 d_tmpnam_r=undef
18531 tmpnam_r_proto=0
c18e646a 18532 ;;
a48ec845
JH
18533 esac
18534 ;;
10bc17b6
JH
18535*) tmpnam_r_proto=0
18536 ;;
18537esac
18538
b4eb6b3d
JH
18539: see if truncate exists
18540set truncate d_truncate
18541eval $inlibc
18542
10bc17b6
JH
18543: see if ttyname_r exists
18544set ttyname_r d_ttyname_r
18545eval $inlibc
18546case "$d_ttyname_r" in
18547"$define")
18548 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
18549 case "$d_ttyname_r_proto:$usethreads" in
18550 ":define") d_ttyname_r_proto=define
a48ec845
JH
18551 set d_ttyname_r_proto ttyname_r $hdrs
18552 eval $hasproto ;;
18553 *) ;;
18554 esac
18555 case "$d_ttyname_r_proto" in
18556 define)
10bc17b6
JH
18557 case "$ttyname_r_proto" in
18558 ''|0) try='int ttyname_r(int, char*, size_t);'
61c26d18 18559 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
10bc17b6
JH
18560 esac
18561 case "$ttyname_r_proto" in
18562 ''|0) try='int ttyname_r(int, char*, int);'
61c26d18 18563 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
10bc17b6
JH
18564 esac
18565 case "$ttyname_r_proto" in
18566 ''|0) try='char* ttyname_r(int, char*, int);'
61c26d18 18567 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
10bc17b6
JH
18568 esac
18569 case "$ttyname_r_proto" in
90e831dc 18570 ''|0) d_ttyname_r=undef
10bc17b6 18571 ttyname_r_proto=0
a48ec845 18572 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18573 * ) case "$ttyname_r_proto" in
18574 REENTRANT_PROTO*) ;;
18575 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18576 esac
18577 echo "Prototype: $try" ;;
18578 esac
18579 ;;
c18e646a
JH
18580 *) case "$usethreads" in
18581 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18582 esac
90e831dc
SB
18583 d_ttyname_r=undef
18584 ttyname_r_proto=0
c18e646a 18585 ;;
a48ec845
JH
18586 esac
18587 ;;
10bc17b6
JH
18588*) ttyname_r_proto=0
18589 ;;
18590esac
18591
b4eb6b3d
JH
18592: see if tzname[] exists
18593echo " "
18594if set tzname val -a d_tzname; eval $csym; $val; then
18595 val="$define"
18596 echo 'tzname[] found.' >&4
18597else
18598 val="$undef"
18599 echo 'tzname[] NOT found.' >&4
18600fi
18601set d_tzname
18602eval $setvar
18603
613d6c3e 18604: Check if is a multiplatform env
4e0554ec
JH
18605case "$osname" in
18606next|rhapsody|darwin) multiarch="$define" ;;
18607esac
18608case "$multiarch" in
18609''|[nN]*) multiarch="$undef" ;;
18610esac
18611
24412007 18612: check for ordering of bytes in a UV
4e0554ec 18613echo " "
5440bc8e 18614case "$usecrosscompile$multiarch" in
4e0554ec
JH
18615*$define*)
18616 $cat <<EOM
18617You seem to be either cross-compiling or doing a multiarchitecture build,
18618skipping the byteorder check.
18619
18620EOM
5440bc8e 18621 byteorder='ffff'
4e0554ec
JH
18622 ;;
18623*)
18624 case "$byteorder" in
18625 '')
18626 $cat <<'EOM'
18627In the following, larger digits indicate more significance. A big-endian
18628machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18629little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18630machines may have weird orders like 3412. A Cray will report 87654321,
18631an Alpha will report 12345678. If the test program works the default is
18632probably right.
18633I'm now running the test program...
18634EOM
24412007 18635 $cat >try.c <<EOCP
4e0554ec 18636#include <stdio.h>
55954f19
JH
18637#$i_stdlib I_STDLIB
18638#ifdef I_STDLIB
18639#include <stdlib.h>
18640#endif
24412007
JH
18641#include <sys/types.h>
18642typedef $uvtype UV;
4e0554ec
JH
18643int main()
18644{
18645 int i;
18646 union {
24412007
JH
18647 UV l;
18648 char c[$uvsize];
4e0554ec
JH
18649 } u;
18650
24412007 18651 if ($uvsize > 4)
b5ded3e5 18652 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18653 else
a4c53327 18654 u.l = (UV)0x04030201;
24412007 18655 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18656 printf("%c", u.c[i]+'0');
18657 printf("\n");
18658 exit(0);
18659}
18660EOCP
18661 xxx_prompt=y
18662 set try
43dddb59 18663 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18664 dflt=`$run ./try`
4e0554ec
JH
18665 case "$dflt" in
18666 [1-4][1-4][1-4][1-4]|12345678|87654321)
18667 echo "(The test program ran ok.)"
18668 echo "byteorder=$dflt"
18669 xxx_prompt=n
18670 ;;
18671 ????|????????) echo "(The test program ran ok.)" ;;
18672 *) echo "(The test program didn't run right for some reason.)" ;;
18673 esac
18674 else
18675 dflt='4321'
18676 cat <<'EOM'
18677(I can't seem to compile the test program. Guessing big-endian...)
18678EOM
18679 fi
18680 case "$xxx_prompt" in
18681 y)
24412007 18682 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18683 . ./myread
18684 byteorder="$ans"
18685 ;;
18686 *) byteorder=$dflt
18687 ;;
18688 esac
18689 ;;
18690 esac
5b813a60 18691 $rm_try
4e0554ec
JH
18692 ;;
18693esac
18694
613d6c3e 18695: Checking 32bit aligndness
4e0554ec
JH
18696$cat <<EOM
18697
18698Checking to see whether you can access character data unalignedly...
18699EOM
dc7b0a4f
JH
18700case "$d_u32align" in
18701'') $cat >try.c <<EOCP
4e0554ec 18702#include <stdio.h>
d1daaddf
JH
18703#$i_stdlib I_STDLIB
18704#ifdef I_STDLIB
18705#include <stdlib.h>
18706#endif
4e0554ec 18707#define U32 $u32type
d308175a
JH
18708#define BYTEORDER 0x$byteorder
18709#define U8 $u8type
9958dc3c
JH
18710#include <signal.h>
18711#ifdef SIGBUS
7090f861 18712$signal_t bletch(int s) { exit(4); }
9958dc3c 18713#endif
4e0554ec
JH
18714int main() {
18715#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
f1c7503b
MB
18716 volatile U8 buf[8];
18717 volatile U32 *up;
4e0554ec
JH
18718 int i;
18719
18720 if (sizeof(U32) != 4) {
18721 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18722 exit(1);
18723 }
18724
18725 fflush(stdout);
18726
9958dc3c
JH
18727#ifdef SIGBUS
18728 signal(SIGBUS, bletch);
18729#endif
18730
8906a23e
JH
18731 buf[0] = 0;
18732 buf[1] = 0;
18733 buf[2] = 0;
18734 buf[3] = 1;
7eac3fd6 18735 buf[4] = 0;
8906a23e
JH
18736 buf[5] = 0;
18737 buf[6] = 0;
7eac3fd6 18738 buf[7] = 1;
8906a23e 18739
4e0554ec
JH
18740 for (i = 0; i < 4; i++) {
18741 up = (U32*)(buf + i);
18742 if (! ((*up == 1 << (8*i)) || /* big-endian */
18743 (*up == 1 << (8*(3-i))) /* little-endian */
18744 )
18745 )
18746 {
18747 printf("read failed (%x)\n", *up);
18748 exit(2);
18749 }
18750 }
18751
18752 /* write test */
18753 for (i = 0; i < 4; i++) {
18754 up = (U32*)(buf + i);
18755 *up = 0xBeef;
18756 if (*up != 0xBeef) {
18757 printf("write failed (%x)\n", *up);
18758 exit(3);
18759 }
18760 }
18761
18762 exit(0);
18763#else
18764 printf("1\n");
18765 exit(1);
18766#endif
18767 return 0;
18768}
18769EOCP
18770set try
18771if eval $compile_ok; then
d308175a 18772 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18773 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18774 case "$?" in
18775 0) cat >&4 <<EOM
18776You can access character data pretty unalignedly.
18777EOM
18778 d_u32align="$undef"
18779 ;;
18780 *) cat >&4 <<EOM
18781It seems that you must access character data in an aligned manner.
18782EOM
18783 d_u32align="$define"
18784 ;;
18785 esac
4e0554ec
JH
18786else
18787 rp='Can you access character data at unaligned addresses?'
18788 dflt='n'
18789 . ./myread
18790 case "$ans" in
18791 [yY]*) d_u32align="$undef" ;;
18792 *) d_u32align="$define" ;;
18793 esac
18794fi
5b813a60 18795$rm_try
dc7b0a4f
JH
18796;;
18797esac
4e0554ec
JH
18798
18799: see if ualarm exists
18800set ualarm d_ualarm
18801eval $inlibc
18802
b4eb6b3d
JH
18803: see if umask exists
18804set umask d_umask
18805eval $inlibc
18806
758a5d79
JH
18807: see if unordered exists
18808set unordered d_unordered
18809eval $inlibc
18810
bdf33aa7
SP
18811: see if unsetenv exists
18812set unsetenv d_unsetenv
18813eval $inlibc
18814
4e0554ec
JH
18815: see if usleep exists
18816set usleep d_usleep
18817eval $inlibc
18818
2ef53570
JH
18819: see if prototype for usleep is available
18820echo " "
18821set d_usleepproto usleep $i_unistd unistd.h
18822eval $hasproto
18823
b4eb6b3d
JH
18824: see if ustat exists
18825set ustat d_ustat
18826eval $inlibc
18827
b4eb6b3d
JH
18828: see if closedir exists
18829set closedir d_closedir
18830eval $inlibc
18831
18832case "$d_closedir" in
18833"$define")
18834 echo " "
18835 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18836 cat > try.c <<EOM
b4eb6b3d
JH
18837#$i_dirent I_DIRENT /**/
18838#$i_sysdir I_SYS_DIR /**/
18839#$i_sysndir I_SYS_NDIR /**/
18840#$i_systypes I_SYS_TYPES /**/
18841
18842#if defined(I_SYS_TYPES)
18843#include <sys/types.h>
18844#endif
18845#if defined(I_DIRENT)
18846#include <dirent.h>
18847#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18848#include <sys/dir.h>
18849#endif
18850#else
18851#ifdef I_SYS_NDIR
18852#include <sys/ndir.h>
18853#else
18854#ifdef I_SYS_DIR
18855#ifdef hp9000s500
18856#include <ndir.h> /* may be wrong in the future */
18857#else
18858#include <sys/dir.h>
18859#endif
18860#endif
18861#endif
5b813a60 18862#endif
b4eb6b3d
JH
18863int main() { return closedir(opendir(".")); }
18864EOM
5440bc8e 18865 set try
b4eb6b3d 18866 if eval $compile_ok; then
5440bc8e 18867 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18868 echo "Yes, it does."
18869 val="$undef"
18870 else
18871 echo "No, it doesn't."
18872 val="$define"
18873 fi
18874 else
18875 echo "(I can't seem to compile the test program--assuming it doesn't)"
18876 val="$define"
18877 fi
18878 ;;
18879*)
18880 val="$undef";
18881 ;;
18882esac
18883set d_void_closedir
18884eval $setvar
5b813a60
MB
18885$rm_try
18886
b4eb6b3d
JH
18887: see if there is a wait4
18888set wait4 d_wait4
18889eval $inlibc
18890
18891: see if waitpid exists
18892set waitpid d_waitpid
18893eval $inlibc
18894
18895: see if wcstombs exists
18896set wcstombs d_wcstombs
18897eval $inlibc
18898
18899: see if wctomb exists
18900set wctomb d_wctomb
18901eval $inlibc
18902
4e0554ec
JH
18903: see if writev exists
18904set writev d_writev
18905eval $inlibc
18906
b4eb6b3d
JH
18907: preserve RCS keywords in files with variable substitution, grrr
18908Date='$Date'
18909Id='$Id'
18910Log='$Log'
18911RCSfile='$RCSfile'
18912Revision='$Revision'
18913
b4eb6b3d
JH
18914: check for alignment requirements
18915echo " "
5440bc8e 18916case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18917*$define*)
18918 $cat <<EOM
18919You seem to be either cross-compiling or doing a multiarchitecture build,
18920skipping the memory alignment check.
18921
18922EOM
18923 case "$alignbytes" in
18924 '') alignbytes=8 ;;
18925 esac
18926 ;;
18927*)
18928 case "$alignbytes" in
18929 '') echo "Checking alignment constraints..." >&4
18930 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18931 $cat >try.c <<'EOCP'
18932typedef long double NV;
18933EOCP
18934 else
18935 $cat >try.c <<'EOCP'
18936typedef double NV;
18937EOCP
18938 fi
18939 $cat >>try.c <<'EOCP'
18940#include <stdio.h>
18941struct foobar {
18942 char foo;
18943 NV bar;
18944} try_algn;
18945int main()
18946{
18947 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18948 return(0);
18949}
18950EOCP
18951 set try
18952 if eval $compile_ok; then
5440bc8e 18953 dflt=`$run ./try`
b4eb6b3d
JH
18954 else
18955 dflt='8'
18956 echo "(I can't seem to compile the test program...)"
18957 fi
18958 ;;
18959 *) dflt="$alignbytes"
18960 ;;
18961 esac
18962 rp="Doubles must be aligned on a how-many-byte boundary?"
18963 . ./myread
18964 alignbytes="$ans"
5b813a60 18965 $rm_try
b4eb6b3d
JH
18966 ;;
18967esac
18968
18969
18970: set the base revision
18971baserev=5.0
18972
89c1d914
MB
18973: length of character in bytes. Is always 1, otherwise it isnt C
18974: This used to be a test using sizeof
18975charsize=1
c193ef60
MB
18976
18977: Check for the number of bits in a character
18978case "$charbits" in
18979'') echo "Checking how long a character is (in bits)..." >&4
18980 $cat >try.c <<EOCP
18981#include <stdio.h>
18982int main ()
18983{
18984 int n;
18985 unsigned char c;
18986 for (c = 1, n = 0; c; c <<= 1, n++) ;
18987 printf ("%d\n", n);
18988 return (0);
18989 }
18990EOCP
18991 set try
18992 if eval $compile_ok; then
18993 dflt=`$run ./try`
18994 else
18995 dflt='8'
18996 echo "(I can't seem to compile the test program. Guessing...)"
18997 fi
18998 ;;
18999*)
19000 dflt="$charbits"
19001 ;;
19002esac
19003rp="What is the length of a character (in bits)?"
19004. ./myread
19005charbits="$ans"
19006$rm_try
19007case "$charbits" in
190088) ;;
19009*) cat >&4 << EOM
19010Your system has an unsigned character size of $charbits bits, which
19011is rather unusual (normally it is 8 bits). Perl likely will not work
19012correctly on your system, with subtle bugs in various places.
19013EOM
19014 rp='Do you really want to continue?'
19015 dflt='n'
19016 . ./myread
19017 case "$ans" in
19018 [yY]) echo >&4 "Okay, continuing." ;;
19019 *) exit 1 ;;
19020 esac
19021esac
19022
3099fc99 19023: how do we concatenate cpp tokens here?
b4eb6b3d 19024echo " "
3099fc99 19025echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
19026$cat >cpp_stuff.c <<'EOCP'
19027#define RCAT(a,b)a/**/b
19028#define ACAT(a,b)a ## b
19029RCAT(Rei,ser)
19030ACAT(Cir,cus)
19031EOCP
19032$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19033if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19034 echo "Oh! Smells like ANSI's been here." >&4
19035 echo "We can catify or stringify, separately or together!"
19036 cpp_stuff=42
19037elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19038 echo "Ah, yes! The good old days!" >&4
19039 echo "However, in the good old days we don't know how to stringify and"
19040 echo "catify at the same time."
19041 cpp_stuff=1
19042else
19043 $cat >&4 <<EOM
3099fc99
CW
19044Hmm, I don't seem to be able to concatenate tokens with your cpp.
19045You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
19046EOM
19047 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19048fi
19049$rm -f cpp_stuff.*
19050
19051: see if this is a db.h system
19052set db.h i_db
19053eval $inhdr
19054
19055case "$i_db" in
19056$define)
19057 : Check db version.
19058 echo " "
19059 echo "Checking Berkeley DB version ..." >&4
19060 $cat >try.c <<EOCP
19061#$d_const HASCONST
19062#ifndef HASCONST
19063#define const
19064#endif
19065#include <sys/types.h>
19066#include <stdio.h>
55954f19
JH
19067#$i_stdlib I_STDLIB
19068#ifdef I_STDLIB
19069#include <stdlib.h>
19070#endif
b4eb6b3d 19071#include <db.h>
640374d0 19072int main(int argc, char *argv[])
b4eb6b3d
JH
19073{
19074#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19075 int Major, Minor, Patch ;
19076 unsigned long Version ;
19077 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
19078 if (argc == 2) {
19079 printf("%d %d %d %d %d %d\n",
19080 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19081 Major, Minor, Patch);
19082 exit(0);
19083 }
19084 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
19085
19086 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19087 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19088 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19089 Major, Minor, Patch) ;
19090
19091 /* check that db.h & libdb are compatible */
19092 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 19093 printf("db.h and libdb are incompatible.\n") ;
5b813a60 19094 exit(3);
b4eb6b3d
JH
19095 }
19096
640374d0 19097 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
19098
19099 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19100 + DB_VERSION_PATCH ;
19101
19102 /* needs to be >= 2.3.4 */
19103 if (Version < 2003004) {
19104 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 19105 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 19106 exit(2);
b4eb6b3d
JH
19107 }
19108
19109 exit(0);
19110#else
19111#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
19112 if (argc == 2) {
19113 printf("1 0 0\n");
19114 exit(0);
19115 }
19116 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
19117 exit(0); /* DB version < 2: the coast is clear. */
19118#else
19119 exit(1); /* <db.h> not Berkeley DB? */
19120#endif
19121#endif
19122}
19123EOCP
19124 set try
5440bc8e 19125 if eval $compile_ok && $run ./try; then
b4eb6b3d 19126 echo 'Looks OK.' >&4
5440bc8e 19127 set `$run ./try 1`
640374d0
JH
19128 db_version_major=$1
19129 db_version_minor=$2
19130 db_version_patch=$3
b4eb6b3d
JH
19131 else
19132 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
19133 i_db=$undef
19134 case " $libs " in
19135 *"-ldb "*)
19136 : Remove db from list of libraries to use
19137 echo "Removing unusable -ldb from library list" >&4
19138 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19139 shift
19140 libs="$*"
19141 echo "libs = $libs" >&4
19142 ;;
19143 esac
19144 fi
5b813a60 19145 $rm_try
b4eb6b3d
JH
19146 ;;
19147esac
19148
19149case "$i_db" in
19150define)
5b813a60 19151 : Check the return type needed for hash
b4eb6b3d
JH
19152 echo " "
19153 echo "Checking return type needed for hash for Berkeley DB ..." >&4
19154 $cat >try.c <<EOCP
19155#$d_const HASCONST
19156#ifndef HASCONST
19157#define const
19158#endif
19159#include <sys/types.h>
19160#include <db.h>
19161
19162#ifndef DB_VERSION_MAJOR
19163u_int32_t hash_cb (ptr, size)
19164const void *ptr;
19165size_t size;
19166{
19167}
19168HASHINFO info;
19169int main()
19170{
19171 info.hash = hash_cb;
19172}
19173#endif
19174EOCP
19175 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19176 if $contains warning try.out >>/dev/null 2>&1 ; then
19177 db_hashtype='int'
19178 else
19179 db_hashtype='u_int32_t'
19180 fi
19181 else
19182 : XXX Maybe we should just give up here.
19183 db_hashtype=u_int32_t
19184 $cat try.out >&4
19185 echo "Help: I can't seem to compile the db test program." >&4
19186 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19187 fi
5b813a60 19188 $rm_try
b4eb6b3d
JH
19189 echo "Your version of Berkeley DB uses $db_hashtype for hash."
19190 ;;
19191*) db_hashtype=u_int32_t
19192 ;;
19193esac
19194case "$i_db" in
19195define)
5b813a60 19196 : Check the return type needed for prefix
b4eb6b3d
JH
19197 echo " "
19198 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19199 cat >try.c <<EOCP
19200#$d_const HASCONST
19201#ifndef HASCONST
19202#define const
19203#endif
19204#include <sys/types.h>
19205#include <db.h>
19206
19207#ifndef DB_VERSION_MAJOR
19208size_t prefix_cb (key1, key2)
19209const DBT *key1;
19210const DBT *key2;
19211{
19212}
19213BTREEINFO info;
19214int main()
19215{
19216 info.prefix = prefix_cb;
19217}
19218#endif
19219EOCP
19220 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19221 if $contains warning try.out >>/dev/null 2>&1 ; then
19222 db_prefixtype='int'
19223 else
19224 db_prefixtype='size_t'
19225 fi
19226 else
19227 db_prefixtype='size_t'
19228 : XXX Maybe we should just give up here.
19229 $cat try.out >&4
19230 echo "Help: I can't seem to compile the db test program." >&4
19231 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19232 fi
5b813a60 19233 $rm_try
b4eb6b3d
JH
19234 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19235 ;;
19236*) db_prefixtype='size_t'
19237 ;;
19238esac
19239
b4eb6b3d
JH
19240: How can we generate normalized random numbers ?
19241echo " "
19242echo "Looking for a random number function..." >&4
19243case "$randfunc" in
19244'')
19245 if set drand48 val -f; eval $csym; $val; then
19246 dflt="drand48"
19247 echo "Good, found drand48()." >&4
19248 elif set random val -f; eval $csym; $val; then
19249 dflt="random"
19250 echo "OK, found random()." >&4
19251 else
19252 dflt="rand"
19253 echo "Yick, looks like I have to use rand()." >&4
19254 fi
19255 echo " "
19256 ;;
19257*)
19258 dflt="$randfunc"
19259 ;;
19260esac
19261cont=true
19262
19263case "$ccflags" in
19264*-Dmy_rand=*|*-Dmy_srand=*)
19265 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19266 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19267 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19268 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19269 ;;
19270esac
19271
19272while $test "$cont"; do
19273 rp="Use which function to generate random numbers?"
19274 . ./myread
19275 if $test "$ans" = "$dflt"; then
19276 : null
19277 else
19278 randbits=''
19279 fi
19280 randfunc="$ans"
19281 if set $ans val -f; eval $csym; $val; then
19282 cont=''
19283 else
19284 dflt=y
19285 rp="I cannot find function $ans. Use that name anyway?"
19286 . ./myread
19287 dflt=rand
19288 case "$ans" in
19289 [yY]*) cont='';;
19290 esac
19291 fi
19292 case "$cont" in
19293 '')
19294 case "$randfunc" in
19295 drand48)
19296 drand01="drand48()"
19297 seedfunc="srand48"
19298 randbits=48
19299 randseedtype=long
19300 ;;
19301 rand|random)
19302 case "$randbits" in
19303 '')
19304echo "Checking to see how many bits your $randfunc() function produces..." >&4
19305 $cat >try.c <<EOCP
19306#$i_unistd I_UNISTD
19307#$i_stdlib I_STDLIB
19308#include <stdio.h>
19309#ifdef I_UNISTD
19310# include <unistd.h>
19311#endif
19312#ifdef I_STDLIB
19313# include <stdlib.h>
19314#endif
19315int main()
19316{
19317 register int i;
19318 register unsigned long tmp;
19319 register unsigned long max = 0L;
19320
19321 for (i = 1000; i; i--) {
19322 tmp = (unsigned long) $randfunc();
19323 if (tmp > max) max = tmp;
19324 }
19325 for (i = 0; max; i++)
19326 max /= 2;
19327 printf("%d\n",i);
19328}
19329EOCP
19330 set try
19331 if eval $compile_ok; then
19332 dflt=`try`
19333 else
19334 dflt='?'
19335 echo "(I can't seem to compile the test program...)"
19336 fi
19337 ;;
19338 *)
19339 dflt="$randbits"
19340 ;;
19341 esac
19342 rp="How many bits does your $randfunc() function produce?"
19343 . ./myread
19344 randbits="$ans"
5b813a60 19345 $rm_try
b4eb6b3d
JH
19346 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19347 seedfunc="s$randfunc"
19348 randseedtype=unsigned
19349 ;;
19350 *)
19351 dflt="31"
19352 rp="How many bits does your $randfunc() function produce?"
19353 . ./myread
19354 randbits="$ans"
19355 seedfunc="s$randfunc"
19356 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19357 if set $seedfunc val -f; eval $csym; $val; then
19358 echo "(Using $seedfunc() to seed random generator)"
19359 else
19360 echo "(Warning: no $seedfunc() to seed random generator)"
19361 seedfunc=rand
19362 fi
19363 randseedtype=unsigned
19364 ;;
19365 esac
19366 ;;
19367 esac
19368done
19369
613d6c3e 19370: Determine if this is an EBCDIC system
b4eb6b3d
JH
19371echo " "
19372echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 19373$cat >try.c <<'EOM'
b4eb6b3d
JH
19374int main()
19375{
19376 if ('M'==0xd4) return 0;
19377 return 1;
19378}
19379EOM
19380
19381val=$undef
5440bc8e 19382set try
b4eb6b3d 19383if eval $compile_ok; then
5440bc8e 19384 if $run ./try; then
b4eb6b3d
JH
19385 echo "You seem to speak EBCDIC." >&4
19386 val="$define"
19387 else
5440bc8e 19388 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
19389 fi
19390else
19391 echo "I'm unable to compile the test program." >&4
19392 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19393fi
5b813a60 19394$rm_try
b4eb6b3d
JH
19395set ebcdic
19396eval $setvar
19397
613d6c3e 19398: Check how to flush
b4eb6b3d
JH
19399echo " "
19400$cat >&4 <<EOM
19401Checking how to flush all pending stdio output...
19402EOM
19403# I only know how to find the first 32 possibly open files on SunOS.
19404# See also hints/sunos_4_1.sh and util.c --AD
19405case "$osname" in
19406sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19407esac
19408$cat >>try.c <<EOCP
19409#include <stdio.h>
55954f19
JH
19410#$i_stdlib I_STDLIB
19411#ifdef I_STDLIB
19412#include <stdlib.h>
19413#endif
b4eb6b3d
JH
19414#$i_unistd I_UNISTD
19415#ifdef I_UNISTD
19416# include <unistd.h>
19417#endif
19418#$d_sysconf HAS_SYSCONF
19419#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19420#ifdef HAS_STDIO_STREAM_ARRAY
19421# define STDIO_STREAM_ARRAY $stdio_stream_array
19422#endif
19423int main() {
5440bc8e
JH
19424 FILE* p;
19425 unlink("try.out");
19426 p = fopen("try.out", "w");
b4eb6b3d
JH
19427#ifdef TRY_FPUTC
19428 fputc('x', p);
19429#else
19430# ifdef TRY_FPRINTF
19431 fprintf(p, "x");
19432# endif
19433#endif
19434#ifdef TRY_FFLUSH_NULL
19435 fflush(NULL);
19436#endif
19437#ifdef TRY_FFLUSH_ALL
19438 {
19439 long open_max = -1;
19440# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19441 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19442# else
19443# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19444 open_max = sysconf(_SC_OPEN_MAX);
19445# else
19446# ifdef FOPEN_MAX
19447 open_max = FOPEN_MAX;
19448# else
19449# ifdef OPEN_MAX
19450 open_max = OPEN_MAX;
19451# else
19452# ifdef _NFILE
19453 open_max = _NFILE;
19454# endif
19455# endif
19456# endif
19457# endif
5b813a60 19458# endif
b4eb6b3d
JH
19459# ifdef HAS_STDIO_STREAM_ARRAY
19460 if (open_max > 0) {
19461 long i;
19462 for (i = 0; i < open_max; i++)
19463 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19464 STDIO_STREAM_ARRAY[i]._file < open_max &&
19465 STDIO_STREAM_ARRAY[i]._flag)
19466 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 19467 }
b4eb6b3d
JH
19468 }
19469# endif
19470#endif
19471 _exit(42);
19472}
19473EOCP
19474: first we have to find out how _not_ to flush
5440bc8e 19475$to try.c
b4eb6b3d
JH
19476if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19477 output=''
19478 set try -DTRY_FPUTC
19479 if eval $compile; then
fbe73d74 19480 $run ./try 2>/dev/null
28f5ac64 19481 code="$?"
5440bc8e 19482 $from try.out
28f5ac64 19483 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19484 output=-DTRY_FPUTC
19485 fi
19486 fi
19487 case "$output" in
19488 '')
19489 set try -DTRY_FPRINTF
b4eb6b3d 19490 if eval $compile; then
fbe73d74 19491 $run ./try 2>/dev/null
28f5ac64 19492 code="$?"
5440bc8e 19493 $from try.out
28f5ac64 19494 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19495 output=-DTRY_FPRINTF
19496 fi
19497 fi
19498 ;;
19499 esac
19500fi
19501: check for fflush NULL behaviour
19502case "$fflushNULL" in
19503'') set try -DTRY_FFLUSH_NULL $output
19504 if eval $compile; then
5440bc8e 19505 $run ./try 2>/dev/null
b4eb6b3d 19506 code="$?"
5440bc8e 19507 $from try.out
b4eb6b3d
JH
19508 if $test -s try.out -a "X$code" = X42; then
19509 fflushNULL="`$cat try.out`"
19510 else
19511 if $test "X$code" != X42; then
19512 $cat >&4 <<EOM
19513(If this test failed, don't worry, we'll try another method shortly.)
19514EOM
19515 fi
19516 fi
19517 fi
2c476adc 19518 $rm -f core try.core core.try.*
b4eb6b3d
JH
19519 case "$fflushNULL" in
19520 x) $cat >&4 <<EOM
19521Your fflush(NULL) works okay for output streams.
19522Let's see if it clobbers input pipes...
19523EOM
19524# As of mid-March 2000 all versions of Solaris appear to have a stdio
19525# bug that improperly flushes the input end of pipes. So we avoid the
19526# autoflush on fork/system/exec support for now. :-(
19527$cat >tryp.c <<EOCP
19528#include <stdio.h>
19529int
19530main(int argc, char **argv)
19531{
19532 char buf[1024];
19533 int i;
19534 char *bp = buf;
19535 while (1) {
19536 while ((i = getc(stdin)) != -1
19537 && (*bp++ = i) != '\n'
19538 && bp < &buf[1024])
19539 /* DO NOTHING */ ;
19540 *bp = '\0';
19541 fprintf(stdout, "%s", buf);
19542 fflush(NULL);
19543 if (i == -1)
19544 return 0;
19545 bp = buf;
19546 }
19547}
19548EOCP
19549 fflushNULL="$define"
19550 set tryp
19551 if eval $compile; then
19552 $rm -f tryp.out
5440bc8e 19553 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19554 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19555 $cat >&4 <<EOM
19556fflush(NULL) seems to behave okay with input streams.
19557EOM
19558 fflushNULL="$define"
19559 else
19560 $cat >&4 <<EOM
19561Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19562EOM
19563 fflushNULL="$undef"
19564 fi
19565 fi
19566 $rm -f core tryp.c tryp.core core.tryp.*
19567 ;;
19568 '') $cat >&4 <<EOM
19569Your fflush(NULL) isn't working (contrary to ANSI C).
19570EOM
19571 fflushNULL="$undef"
19572 ;;
19573 *) $cat >&4 <<EOM
19574Cannot figure out whether your fflush(NULL) works or not.
19575I'm assuming it doesn't (contrary to ANSI C).
19576EOM
19577 fflushNULL="$undef"
19578 ;;
19579 esac
19580 ;;
19581$define|true|[yY]*)
19582 fflushNULL="$define"
19583 ;;
19584*)
19585 fflushNULL="$undef"
19586 ;;
19587esac
19588: check explicit looping only if NULL did not work, and if the pipe
19589: bug does not show up on an explicit flush too
19590case "$fflushNULL" in
19591"$undef")
19592 $cat >tryp.c <<EOCP
19593#include <stdio.h>
19594int
19595main(int argc, char **argv)
19596{
19597 char buf[1024];
19598 int i;
19599 char *bp = buf;
19600 while (1) {
19601 while ((i = getc(stdin)) != -1
19602 && (*bp++ = i) != '\n'
19603 && bp < &buf[1024])
19604 /* DO NOTHING */ ;
19605 *bp = '\0';
19606 fprintf(stdout, "%s", buf);
19607 fflush(stdin);
19608 if (i == -1)
19609 return 0;
19610 bp = buf;
19611 }
19612}
19613EOCP
19614 set tryp
19615 if eval $compile; then
19616 $rm -f tryp.out
5440bc8e 19617 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19618 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19619 $cat >&4 <<EOM
19620Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19621EOM
19622 : now check for fflushall behaviour
19623 case "$fflushall" in
19624 '') set try -DTRY_FFLUSH_ALL $output
19625 if eval $compile; then
19626 $cat >&4 <<EOM
19627(Now testing the other method--but note that this also may fail.)
19628EOM
5440bc8e 19629 $run ./try 2>/dev/null
28f5ac64 19630 code=$?
fbe73d74 19631 $from try.out
28f5ac64 19632 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19633 fflushall="`$cat try.out`"
19634 fi
19635 fi
5b813a60 19636 $rm_try
b4eb6b3d
JH
19637 case "$fflushall" in
19638 x) $cat >&4 <<EOM
19639Whew. Flushing explicitly all the stdio streams works.
19640EOM
19641 fflushall="$define"
19642 ;;
19643 '') $cat >&4 <<EOM
19644Sigh. Flushing explicitly all the stdio streams doesn't work.
19645EOM
19646 fflushall="$undef"
19647 ;;
19648 *) $cat >&4 <<EOM
19649Cannot figure out whether flushing stdio streams explicitly works or not.
19650I'm assuming it doesn't.
19651EOM
19652 fflushall="$undef"
19653 ;;
19654 esac
19655 ;;
19656 "$define"|true|[yY]*)
19657 fflushall="$define"
19658 ;;
19659 *)
19660 fflushall="$undef"
19661 ;;
19662 esac
19663 else
19664 $cat >&4 <<EOM
19665All is futile. Even fflush(stdin) clobbers input pipes!
19666EOM
19667 fflushall="$undef"
19668 fi
19669 else
19670 fflushall="$undef"
19671 fi
19672 $rm -f core tryp.c tryp.core core.tryp.*
19673 ;;
19674*) fflushall="$undef"
19675 ;;
19676esac
19677
19678case "$fflushNULL$fflushall" in
19679undefundef)
19680 $cat <<EOM
19681OK, I give up. I cannot figure out how to flush pending stdio output.
19682We won't be flushing handles at all before fork/exec/popen.
19683EOM
19684 ;;
19685esac
34f1896b 19686$rm_try tryp
b4eb6b3d
JH
19687
19688: Store the full pathname to the ar program for use in the C program
19689: Respect a hint or command line value for full_ar.
19690case "$full_ar" in
19691'') full_ar=$ar ;;
19692esac
19693
19694: Store the full pathname to the sed program for use in the C program
19695full_sed=$sed
19696
19697: see what type gids are declared as in the kernel
19698echo " "
19699echo "Looking for the type for group ids returned by getgid()."
19700set gid_t gidtype xxx stdio.h sys/types.h
19701eval $typedef
19702case "$gidtype" in
19703xxx)
19704 xxx=`./findhdr sys/user.h`
19705 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19706 case $1 in
19707 unsigned) dflt="$1 $2" ;;
19708 *) dflt="$1" ;;
19709 esac
19710 ;;
19711*) dflt="$gidtype";;
19712esac
19713case "$gidtype" in
19714gid_t) echo "gid_t found." ;;
19715*) rp="What is the type for group ids returned by getgid()?"
19716 . ./myread
19717 gidtype="$ans"
19718 ;;
19719esac
19720
613d6c3e 19721: Check the size of GID
b4eb6b3d
JH
19722echo " "
19723case "$gidtype" in
19724*_t) zzz="$gidtype" ;;
19725*) zzz="gid" ;;
19726esac
613d6c3e 19727echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
19728cat > try.c <<EOCP
19729#include <sys/types.h>
19730#include <stdio.h>
d1daaddf
JH
19731#$i_stdlib I_STDLIB
19732#ifdef I_STDLIB
19733#include <stdlib.h>
19734#endif
b4eb6b3d
JH
19735int main() {
19736 printf("%d\n", (int)sizeof($gidtype));
19737 exit(0);
19738}
19739EOCP
19740set try
19741if eval $compile_ok; then
5440bc8e 19742 yyy=`$run ./try`
b4eb6b3d
JH
19743 case "$yyy" in
19744 '') gidsize=4
19745 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19746 ;;
19747 *) gidsize=$yyy
19748 echo "Your $zzz is $gidsize bytes long."
19749 ;;
19750 esac
19751else
19752 gidsize=4
19753 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19754fi
19755
19756
613d6c3e 19757: Check if GID is signed
b4eb6b3d
JH
19758echo " "
19759case "$gidtype" in
19760*_t) zzz="$gidtype" ;;
19761*) zzz="gid" ;;
19762esac
613d6c3e 19763echo "Checking the sign of $zzz..." >&4
b4eb6b3d
JH
19764cat > try.c <<EOCP
19765#include <sys/types.h>
19766#include <stdio.h>
19767int main() {
19768 $gidtype foo = -1;
19769 if (foo < 0)
19770 printf("-1\n");
19771 else
19772 printf("1\n");
19773}
19774EOCP
19775set try
19776if eval $compile; then
5440bc8e 19777 yyy=`$run ./try`
b4eb6b3d
JH
19778 case "$yyy" in
19779 '') gidsign=1
19780 echo "(I can't execute the test program--guessing unsigned.)" >&4
19781 ;;
19782 *) gidsign=$yyy
19783 case "$gidsign" in
19784 1) echo "Your $zzz is unsigned." ;;
19785 -1) echo "Your $zzz is signed." ;;
19786 esac
19787 ;;
19788 esac
19789else
19790 gidsign=1
19791 echo "(I can't compile the test program--guessing unsigned.)" >&4
19792fi
19793
19794
613d6c3e 19795: Check 64bit sizes
b4eb6b3d
JH
19796echo " "
19797
19798if $test X"$quadtype" != X; then
19799
19800echo "Checking how to print 64-bit integers..." >&4
19801
19802if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19803 $cat >try.c <<'EOCP'
19804#include <sys/types.h>
19805#include <stdio.h>
19806int main() {
19807 int q = 12345678901;
19808 printf("%ld\n", q);
19809}
19810EOCP
19811 set try
19812 if eval $compile; then
5440bc8e 19813 yyy=`$run ./try`
b4eb6b3d
JH
19814 case "$yyy" in
19815 12345678901)
19816 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19817 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19818 echo "We will use %d."
19819 ;;
19820 esac
19821 fi
19822fi
19823
19824if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19825 $cat >try.c <<'EOCP'
19826#include <sys/types.h>
19827#include <stdio.h>
19828int main() {
19829 long q = 12345678901;
19830 printf("%ld\n", q);
19831}
19832EOCP
19833 set try
19834 if eval $compile; then
5440bc8e 19835 yyy=`$run ./try`
b4eb6b3d
JH
19836 case "$yyy" in
19837 12345678901)
19838 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19839 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19840 echo "We will use %ld."
19841 ;;
19842 esac
19843 fi
19844fi
19845
19846if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19847 $cat >try.c <<'EOCP'
19848#include <sys/types.h>
19849#include <inttypes.h>
19850#include <stdio.h>
19851int main() {
19852 int64_t q = 12345678901;
19853 printf("%" PRId64 "\n", q);
19854}
19855EOCP
19856 set try
19857 if eval $compile; then
5440bc8e 19858 yyy=`$run ./try`
b4eb6b3d
JH
19859 case "$yyy" in
19860 12345678901)
19861 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19862 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19863 echo "We will use the C9X style."
19864 ;;
19865 esac
19866 fi
19867fi
19868
2ef53570
JH
19869if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19870 $cat >try.c <<EOCP
b4eb6b3d
JH
19871#include <sys/types.h>
19872#include <stdio.h>
19873int main() {
2ef53570
JH
19874 $quadtype q = 12345678901;
19875 printf("%Ld\n", q);
b4eb6b3d
JH
19876}
19877EOCP
19878 set try
19879 if eval $compile; then
5440bc8e 19880 yyy=`$run ./try`
b4eb6b3d
JH
19881 case "$yyy" in
19882 12345678901)
2ef53570
JH
19883 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19884 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19885 echo "We will use %Ld."
b4eb6b3d
JH
19886 ;;
19887 esac
19888 fi
19889fi
19890
2ef53570
JH
19891if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19892 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19893#include <sys/types.h>
19894#include <stdio.h>
19895int main() {
2ef53570
JH
19896 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19897 printf("%lld\n", q);
b4eb6b3d
JH
19898}
19899EOCP
19900 set try
19901 if eval $compile; then
5440bc8e 19902 yyy=`$run ./try`
b4eb6b3d
JH
19903 case "$yyy" in
19904 12345678901)
2ef53570
JH
19905 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19906 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19907 echo "We will use the %lld style."
b4eb6b3d
JH
19908 ;;
19909 esac
19910 fi
19911fi
19912
19913if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19914 $cat >try.c <<EOCP
19915#include <sys/types.h>
19916#include <stdio.h>
19917int main() {
19918 $quadtype q = 12345678901;
19919 printf("%qd\n", q);
19920}
19921EOCP
19922 set try
19923 if eval $compile; then
5440bc8e 19924 yyy=`$run ./try`
b4eb6b3d
JH
19925 case "$yyy" in
19926 12345678901)
19927 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19928 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19929 echo "We will use %qd."
19930 ;;
19931 esac
19932 fi
19933fi
19934
19935if $test X"$sPRId64" = X; then
19936 echo "Cannot figure out how to print 64-bit integers." >&4
19937fi
5b813a60 19938$rm_try
b4eb6b3d
JH
19939
19940fi
19941
19942case "$sPRId64" in
5b813a60
MB
19943'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19944 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 19945 ;;
5b813a60
MB
19946*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19947 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
19948 ;;
19949esac
19950
34f1896b 19951: Check format strings for internal types
b4eb6b3d
JH
19952echo " "
19953$echo "Checking the format strings to be used for Perl's internal types..." >&4
19954
19955if $test X"$ivsize" = X8; then
19956 ivdformat="$sPRId64"
19957 uvuformat="$sPRIu64"
19958 uvoformat="$sPRIo64"
19959 uvxformat="$sPRIx64"
19960 uvXUformat="$sPRIXU64"
19961else
19962 if $test X"$ivsize" = X"$longsize"; then
19963 ivdformat='"ld"'
19964 uvuformat='"lu"'
19965 uvoformat='"lo"'
19966 uvxformat='"lx"'
19967 uvXUformat='"lX"'
19968 else
19969 if $test X"$ivsize" = X"$intsize"; then
19970 ivdformat='"d"'
19971 uvuformat='"u"'
19972 uvoformat='"o"'
19973 uvxformat='"x"'
19974 uvXUformat='"X"'
19975 else
19976 : far out
19977 if $test X"$ivsize" = X"$shortsize"; then
19978 ivdformat='"hd"'
19979 uvuformat='"hu"'
19980 uvoformat='"ho"'
19981 uvxformat='"hx"'
19982 uvXUformat='"hX"'
19983 fi
19984 fi
19985 fi
19986fi
19987
19988if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19989 nveformat="$sPRIeldbl"
19990 nvfformat="$sPRIfldbl"
19991 nvgformat="$sPRIgldbl"
19992 nvEUformat="$sPRIEUldbl"
19993 nvFUformat="$sPRIFUldbl"
19994 nvGUformat="$sPRIGUldbl"
19995else
19996 nveformat='"e"'
19997 nvfformat='"f"'
19998 nvgformat='"g"'
19999 nvEUformat='"E"'
20000 nvFUformat='"F"'
20001 nvGUformat='"G"'
20002fi
20003
20004case "$ivdformat" in
3c728e00 20005'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
20006 exit 1
20007 ;;
20008esac
20009
34f1896b 20010: Check format string for GID
b4eb6b3d
JH
20011
20012echo " "
20013$echo "Checking the format string to be used for gids..." >&4
20014
20015case "$gidsign" in
20016-1) if $test X"$gidsize" = X"$ivsize"; then
20017 gidformat="$ivdformat"
20018 else
20019 if $test X"$gidsize" = X"$longsize"; then
20020 gidformat='"ld"'
20021 else
20022 if $test X"$gidsize" = X"$intsize"; then
20023 gidformat='"d"'
20024 else
20025 if $test X"$gidsize" = X"$shortsize"; then
20026 gidformat='"hd"'
20027 fi
20028 fi
20029 fi
20030 fi
20031 ;;
20032*) if $test X"$gidsize" = X"$uvsize"; then
20033 gidformat="$uvuformat"
20034 else
20035 if $test X"$gidsize" = X"$longsize"; then
20036 gidformat='"lu"'
20037 else
20038 if $test X"$gidsize" = X"$intsize"; then
20039 gidformat='"u"'
20040 else
20041 if $test X"$gidsize" = X"$shortsize"; then
20042 gidformat='"hu"'
20043 fi
20044 fi
20045 fi
20046 fi
20047 ;;
20048esac
20049
20050: see if getgroups exists
20051set getgroups d_getgrps
20052eval $inlibc
20053
20054: see if setgroups exists
20055set setgroups d_setgrps
20056eval $inlibc
20057
b4eb6b3d
JH
20058: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20059echo " "
20060case "$d_getgrps$d_setgrps" in
20061*define*)
20062 case "$groupstype" in
20063 '') dflt="$gidtype" ;;
20064 *) dflt="$groupstype" ;;
20065 esac
20066 $cat <<EOM
20067What type of pointer is the second argument to getgroups() and setgroups()?
20068Usually this is the same as group ids, $gidtype, but not always.
20069
20070EOM
20071 rp='What type pointer is the second argument to getgroups() and setgroups()?'
20072 . ./myread
20073 groupstype="$ans"
20074 ;;
20075*) groupstype="$gidtype";;
20076esac
20077
613d6c3e 20078: MAD = Misc Attribute Definition
d620c7b3 20079
fd655d33
NC
20080if $test $patchlevel -lt 9; then
20081: MAD is not available in 5.8.x or earlier.
20082 ans=n;
20083else
20084 case "$mad" in
20085 $define|true|[yY]*) dflt='y' ;;
20086 *) dflt='n' ;;
20087 esac
20088 cat <<EOM
d620c7b3
MB
20089
20090Would you like to build with Misc Attribute Decoration? This is development
20091work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20092overhead on the interpreter.
20093
20094If this doesn't make any sense to you, just accept the default '$dflt'.
20095EOM
fd655d33
NC
20096 rp='Build Perl with MAD?'
20097 . ./myread
20098fi
d620c7b3 20099case "$ans" in
00e74f14
NC
20100y|Y) val="$define"
20101 madlyh='madly.h madly.act madly.tab'
20102 madlysrc='madly.c'
20103 madlyobj="madly$_o" ;;
20104*) val="$undef"
20105 madlyh=''
20106 madlysrc=''
20107 madlyobj='' ;;
d620c7b3
MB
20108esac
20109set mad
20110eval $setvar
20111
216dac04 20112: check whether make sets MAKE
b4eb6b3d
JH
20113echo " "
20114echo "Checking if your $make program sets \$(MAKE)..." >&4
20115case "$make_set_make" in
20116'')
20117 $sed 's/^X //' > testmake.mak << 'EOF'
20118Xall:
20119X @echo 'maketemp="$(MAKE)"'
20120EOF
20121 case "`$make -f testmake.mak 2>/dev/null`" in
20122 *maketemp=*) make_set_make='#' ;;
20123 *) make_set_make="MAKE=$make" ;;
20124 esac
20125 $rm -f testmake.mak
20126 ;;
20127esac
20128case "$make_set_make" in
20129'#') echo "Yup, it does.";;
20130*) echo "Nope, it doesn't.";;
20131esac
20132
20133: see what type is used for mode_t
20134rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20135set mode_t modetype int stdio.h sys/types.h
20136eval $typedef_ask
20137
2cc61e15
DD
20138: see if we need va_copy
20139echo " "
20140case "$i_stdarg" in
20141"$define")
20142 $cat >try.c <<EOCP
20143#include <stdarg.h>
20144#include <stdio.h>
85c8a686
DD
20145#$i_stdlib I_STDLIB
20146#ifdef I_STDLIB
20147#include <stdlib.h>
20148#endif
20149#include <signal.h>
2cc61e15
DD
20150
20151int
20152ivfprintf(FILE *f, const char *fmt, va_list *valp)
20153{
20154 return vfprintf(f, fmt, *valp);
20155}
5b813a60
MB
20156
20157int
2cc61e15
DD
20158myvfprintf(FILE *f, const char *fmt, va_list val)
20159{
20160 return ivfprintf(f, fmt, &val);
20161}
5b813a60 20162
2cc61e15 20163int
5b813a60 20164myprintf(char *fmt, ...)
2cc61e15
DD
20165{
20166 va_list val;
20167 va_start(val, fmt);
5b813a60
MB
20168 return myvfprintf(stdout, fmt, val);
20169}
2cc61e15
DD
20170
20171int
20172main(int ac, char **av)
20173{
85c8a686
DD
20174 signal(SIGSEGV, exit);
20175
5b813a60
MB
20176 myprintf("%s%cs all right, then\n", "that", '\'');
20177 exit(0);
2cc61e15
DD
20178}
20179EOCP
20180 set try
5440bc8e
JH
20181 if eval $compile && $run ./try 2>&1 >/dev/null; then
20182 case "`$run ./try`" in
2cc61e15
DD
20183 "that's all right, then")
20184 okay=yes
20185 ;;
20186 esac
20187 fi
20188 case "$okay" in
20189 yes) echo "It seems that you don't need va_copy()." >&4
20190 need_va_copy="$undef"
20191 ;;
20192 *) echo "It seems that va_copy() or similar will be needed." >&4
20193 need_va_copy="$define"
20194 ;;
20195 esac
5b813a60 20196 $rm_try
2cc61e15
DD
20197 ;;
20198*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20199 ;;
20200esac
20201
b4eb6b3d
JH
20202: see what type is used for size_t
20203rp="What is the type used for the length parameter for string functions?"
20204set size_t sizetype 'unsigned int' stdio.h sys/types.h
20205eval $typedef_ask
20206
20207: check for type of arguments to gethostbyaddr.
20208if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20209 case "$d_gethbyaddr" in
20210 $define)
20211 $cat <<EOM
20212
20213Checking to see what type of arguments are accepted by gethostbyaddr().
20214EOM
20215 hdrs="$define sys/types.h
20216 $d_socket sys/socket.h
20217 $i_niin netinet/in.h
20218 $i_netdb netdb.h
20219 $i_unistd unistd.h"
20220 : The first arg can 'char *' or 'void *'
20221 : The second arg is some of integral type
20222 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20223 for yyy in size_t long int; do
20224 case "$netdb_host_type" in
61c26d18 20225 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
b4eb6b3d
JH
20226 if ./protochk "$try" $hdrs; then
20227 echo "Your system accepts $xxx for the first arg."
20228 echo "...and $yyy for the second arg."
20229 netdb_host_type="$xxx"
20230 netdb_hlen_type="$yyy"
20231 fi
20232 ;;
20233 esac
20234 done
20235 done
20236 : In case none of those worked, prompt the user.
20237 case "$netdb_host_type" in
20238 '') rp='What is the type for the 1st argument to gethostbyaddr?'
20239 dflt='char *'
20240 . ./myread
20241 netdb_host_type=$ans
20242 rp='What is the type for the 2nd argument to gethostbyaddr?'
20243 dflt="$sizetype"
20244 . ./myread
20245 netdb_hlen_type=$ans
20246 ;;
20247 esac
20248 ;;
20249 *) : no gethostbyaddr, so pick harmless defaults
20250 netdb_host_type='char *'
20251 netdb_hlen_type="$sizetype"
20252 ;;
20253 esac
20254 # Remove the "const" if needed. -- but then we'll have a
20255 # prototype clash!
20256 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20257fi
20258
20259: check for type of argument to gethostbyname.
20260if test "X$netdb_name_type" = X ; then
20261 case "$d_gethbyname" in
20262 $define)
20263 $cat <<EOM
20264
20265Checking to see what type of argument is accepted by gethostbyname().
20266EOM
20267 hdrs="$define sys/types.h
20268 $d_socket sys/socket.h
20269 $i_niin netinet/in.h
20270 $i_netdb netdb.h
20271 $i_unistd unistd.h"
20272 for xxx in "const char *" "char *"; do
20273 case "$netdb_name_type" in
61c26d18 20274 '') try="$extern_C struct hostent *gethostbyname($xxx);"
b4eb6b3d
JH
20275 if ./protochk "$try" $hdrs; then
20276 echo "Your system accepts $xxx."
20277 netdb_name_type="$xxx"
20278 fi
20279 ;;
20280 esac
20281 done
20282 : In case none of those worked, prompt the user.
20283 case "$netdb_name_type" in
20284 '') rp='What is the type for the 1st argument to gethostbyname?'
20285 dflt='char *'
20286 . ./myread
20287 netdb_name_type=$ans
20288 ;;
20289 esac
20290 ;;
20291 *) : no gethostbyname, so pick harmless default
20292 netdb_name_type='char *'
20293 ;;
20294 esac
20295fi
20296
20297: check for type of 1st argument to getnetbyaddr.
20298if test "X$netdb_net_type" = X ; then
20299 case "$d_getnbyaddr" in
20300 $define)
20301 $cat <<EOM
20302
20303Checking to see what type of 1st argument is accepted by getnetbyaddr().
20304EOM
20305 hdrs="$define sys/types.h
20306 $d_socket sys/socket.h
20307 $i_niin netinet/in.h
20308 $i_netdb netdb.h
20309 $i_unistd unistd.h"
20310 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20311 case "$netdb_net_type" in
61c26d18 20312 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
b4eb6b3d
JH
20313 if ./protochk "$try" $hdrs; then
20314 echo "Your system accepts $xxx."
20315 netdb_net_type="$xxx"
20316 fi
20317 ;;
20318 esac
20319 done
20320 : In case none of those worked, prompt the user.
20321 case "$netdb_net_type" in
20322 '') rp='What is the type for the 1st argument to getnetbyaddr?'
20323 dflt='long'
20324 . ./myread
20325 netdb_net_type=$ans
20326 ;;
20327 esac
20328 ;;
20329 *) : no getnetbyaddr, so pick harmless default
20330 netdb_net_type='long'
20331 ;;
20332 esac
20333fi
20334: locate the preferred pager for this system
d604bb53 20335fn=f/
b4eb6b3d
JH
20336case "$pager" in
20337'')
20338 dflt=''
20339 case "$pg" in
20340 /*) dflt=$pg;;
20341 [a-zA-Z]:/*) dflt=$pg;;
20342 esac
20343 case "$more" in
20344 /*) dflt=$more;;
20345 [a-zA-Z]:/*) dflt=$more;;
20346 esac
20347 case "$less" in
20348 /*) dflt=$less;;
20349 [a-zA-Z]:/*) dflt=$less;;
20350 esac
20351 case "$dflt" in
20352 '') dflt=/usr/ucb/more;;
20353 esac
20354 ;;
d604bb53 20355*) dflt="$pager"
d604bb53
JH
20356 fn="f/($pager)"
20357 ;;
b4eb6b3d
JH
20358esac
20359echo " "
b4eb6b3d
JH
20360rp='What pager is used on your system?'
20361. ./getfile
20362pager="$ans"
20363
20364: see what type pids are declared as in the kernel
20365rp="What is the type of process ids on this system?"
20366set pid_t pidtype int stdio.h sys/types.h
20367eval $typedef_ask
20368
b4eb6b3d
JH
20369: see if ar generates random libraries by itself
20370echo " "
20371echo "Checking how to generate random libraries on your machine..." >&4
20372echo 'int bar1() { return bar2(); }' > bar1.c
20373echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
20374$cat > foo.c <<EOP
20375#$i_stdlib I_STDLIB
20376#ifdef I_STDLIB
20377#include <stdlib.h>
20378#endif
b4eb6b3d
JH
20379int main() { printf("%d\n", bar1()); exit(0); }
20380EOP
20381$cc $ccflags -c bar1.c >/dev/null 2>&1
20382$cc $ccflags -c bar2.c >/dev/null 2>&1
20383$cc $ccflags -c foo.c >/dev/null 2>&1
20384$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 20385if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20386 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20387 echo "$ar appears to generate random libraries itself."
20388 orderlib=false
e39a9d84
LC
20389 if [ "X$ranlib" = "X" ]; then
20390 ranlib=":"
20391 fi
88d4d47b
PC
20392elif $ar s bar$_a >/dev/null 2>&1 &&
20393 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20394 $run ./foobar >/dev/null 2>&1; then
20395 echo "a table of contents needs to be added with '$ar s'."
20396 orderlib=false
20397 ranlib="$ar s"
b4eb6b3d 20398elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 20399 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20400 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20401 echo "a table of contents needs to be added with '$ar ts'."
20402 orderlib=false
20403 ranlib="$ar ts"
20404else
20405 case "$ranlib" in
20406 :) ranlib='';;
20407 '')
20408 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20409 $test -f $ranlib || ranlib=''
20410 ;;
20411 esac
20412 if $test -n "$ranlib"; then
20413 echo "your system has '$ranlib'; we'll use that."
20414 orderlib=false
20415 else
20416 echo "your system doesn't seem to support random libraries"
20417 echo "so we'll use lorder and tsort to order the libraries."
20418 orderlib=true
20419 ranlib=":"
20420 fi
20421fi
88d4d47b 20422$rm -f foo* bar*
b4eb6b3d 20423
92a3ac59
MB
20424: see if this is a values.h system
20425set values.h i_values
20426eval $inhdr
20427
73e6e416 20428: Check the max offset that gmtime and localtime accept
92a3ac59 20429echo "Checking max offsets that gmtime () accepts"
81c4fd9e 20430
92a3ac59
MB
20431case $i_values in
20432 define) yyy="#include <values.h>" ;;
20433 *) yyy="" ;;
20434 esac
20435
690aedd1
MB
20436case "$sGMTIME_min/$sGMTIME_max" in
20437 0/0|/)
20438 $cat >try.c <<EOCP
81c4fd9e
MB
20439#include <sys/types.h>
20440#include <stdio.h>
20441#include <time.h>
92a3ac59 20442$yyy
81c4fd9e 20443
92a3ac59
MB
20444int i;
20445struct tm *tmp;
20446time_t pt;
20447
1b289682 20448void gm_check (time_t t, int min_year, int max_year)
92a3ac59 20449{
81c4fd9e 20450 tmp = gmtime (&t);
1b289682
MB
20451 if ( tmp == NULL ||
20452 /* Check tm_year overflow */
20453 tmp->tm_year < min_year || tmp->tm_year > max_year)
92a3ac59
MB
20454 tmp = NULL;
20455 else
20456 pt = t;
20457 } /* gm_check */
81c4fd9e 20458
92a3ac59
MB
20459int check_max ()
20460{
73e6e416
MB
20461 tmp = NULL;
20462 pt = 0;
92a3ac59 20463#ifdef MAXLONG
1b289682 20464 gm_check (MAXLONG, 69, 0x7fffffff);
92a3ac59 20465#endif
73e6e416
MB
20466 if (tmp == NULL || tmp->tm_year < 0) {
20467 for (i = 63; i >= 0; i--) {
20468 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20469 if (x < 0 || x < pt) continue;
20470 gm_check (x, 69, 0x7fffffff);
73e6e416
MB
20471 }
20472 }
20473 printf ("sGMTIME_max=%ld\n", pt);
20474 return (0);
1b289682 20475 } /* check_max */
81c4fd9e 20476
92a3ac59
MB
20477int check_min ()
20478{
73e6e416
MB
20479 tmp = NULL;
20480 pt = 0;
92a3ac59 20481#ifdef MINLONG
1b289682 20482 gm_check (MINLONG, -1900, 70);
92a3ac59 20483#endif
73e6e416
MB
20484 if (tmp == NULL) {
20485 for (i = 36; i >= 0; i--) {
20486 time_t x = pt - ((time_t)1 << i);
20487 if (x > 0) continue;
1b289682 20488 gm_check (x, -1900, 70);
73e6e416
MB
20489 }
20490 }
20491 printf ("sGMTIME_min=%ld\n", pt);
20492 return (0);
20493 } /* check_min */
92a3ac59
MB
20494
20495int main (int argc, char *argv[])
20496{
73e6e416
MB
20497 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20498 check_max ();
20499 check_min ();
20500 return (0);
20501 } /* main */
81c4fd9e 20502EOCP
690aedd1
MB
20503 set try
20504 if eval $compile; then
20505 eval `$run ./try`
20506 else
20507 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20508 fi
20509 $rm_try
20510 ;;
20511 esac
81c4fd9e 20512
73e6e416
MB
20513echo "Checking max offsets that localtime () accepts"
20514
690aedd1
MB
20515case "$sLOCALTIME_min/$sLOCALTIME_max" in
20516 0/0|/)
20517 $cat >try.c <<EOCP
73e6e416
MB
20518#include <sys/types.h>
20519#include <stdio.h>
20520#include <time.h>
20521$yyy
20522
20523int i;
20524struct tm *tmp;
20525time_t pt;
20526
1b289682 20527void local_check (time_t t, int min_year, int max_year)
73e6e416 20528{
5bca5c48
MB
20529 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20530 tmp = NULL;
20531 else
20532 tmp = localtime (&t);
1b289682
MB
20533 if ( tmp == NULL ||
20534 /* Check tm_year overflow */
20535 tmp->tm_year < min_year || tmp->tm_year > max_year)
73e6e416
MB
20536 tmp = NULL;
20537 else
20538 pt = t;
20539 } /* local_check */
20540
20541int check_max ()
20542{
20543 tmp = NULL;
20544 pt = 0;
20545#ifdef MAXLONG
1b289682 20546 local_check (MAXLONG, 69, 0x7fffffff);
73e6e416
MB
20547#endif
20548 if (tmp == NULL || tmp->tm_year < 0) {
20549 for (i = 63; i >= 0; i--) {
20550 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20551 if (x < 0 || x < pt) continue;
20552 local_check (x, 69, 0x7fffffff);
73e6e416
MB
20553 }
20554 }
20555 printf ("sLOCALTIME_max=%ld\n", pt);
20556 return (0);
1b289682 20557 } /* check_max */
73e6e416
MB
20558
20559int check_min ()
20560{
20561 tmp = NULL;
20562 pt = 0;
20563#ifdef MINLONG
1b289682 20564 local_check (MINLONG, -1900, 70);
73e6e416
MB
20565#endif
20566 if (tmp == NULL) {
20567 for (i = 36; i >= 0; i--) {
20568 time_t x = pt - ((time_t)1 << i);
20569 if (x > 0) continue;
1b289682 20570 local_check (x, -1900, 70);
73e6e416
MB
20571 }
20572 }
20573 printf ("sLOCALTIME_min=%ld\n", pt);
20574 return (0);
20575 } /* check_min */
20576
20577int main (int argc, char *argv[])
20578{
20579 check_max ();
20580 check_min ();
20581 return (0);
20582 } /* main */
20583EOCP
690aedd1
MB
20584 set try
20585 if eval $compile; then
20586 eval `$run ./try`
20587 else
20588 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20589 fi
20590 $rm_try
20591 ;;
20592 esac
73e6e416 20593
c0bacbef 20594: check for type of arguments to select.
b4eb6b3d
JH
20595case "$selecttype" in
20596'') case "$d_select" in
20597 $define)
20598 echo " "
20599 $cat <<EOM
20600Checking to see what type of arguments are accepted by select().
20601EOM
20602 hdrs="$define sys/types.h
c0bacbef 20603 $i_systime sys/time.h
b4eb6b3d
JH
20604 $i_sysselct sys/select.h
20605 $d_socket sys/socket.h"
20606 : The first arg can be int, unsigned, or size_t
20607 : The last arg may or may not be 'const'
20608 val=''
20609 : void pointer has been seen but using that
20610 : breaks the selectminbits test
20611 for xxx in 'fd_set *' 'int *'; do
20612 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20613 for tmo in 'struct timeval *' 'const struct timeval *'; do
20614 case "$val" in
61c26d18 20615 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
b4eb6b3d
JH
20616 if ./protochk "$try" $hdrs; then
20617 echo "Your system accepts $xxx."
20618 val="$xxx"
20619 fi
20620 ;;
20621 esac
20622 done
20623 done
20624 done
20625 case "$val" in
20626 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20627 case "$d_fd_set" in
20628 $define) dflt="fd_set *" ;;
20629 *) dflt="int *" ;;
20630 esac
20631 . ./myread
20632 val=$ans
20633 ;;
20634 esac
20635 selecttype="$val"
20636 ;;
20637 *) : no select, so pick a harmless default
20638 selecttype='int *'
20639 ;;
20640 esac
20641 ;;
20642esac
20643
20644: check for the select 'width'
20645case "$selectminbits" in
e6e7e605
JH
20646'') safebits=`expr $ptrsize \* 8`
20647 case "$d_select" in
b4eb6b3d
JH
20648 $define)
20649 $cat <<EOM
20650
20651Checking to see on how many bits at a time your select() operates...
20652EOM
20653 $cat >try.c <<EOCP
20654#include <sys/types.h>
20655#$i_time I_TIME
20656#$i_systime I_SYS_TIME
20657#$i_systimek I_SYS_TIME_KERNEL
20658#ifdef I_TIME
20659# include <time.h>
20660#endif
20661#ifdef I_SYS_TIME
20662# ifdef I_SYS_TIME_KERNEL
20663# define KERNEL
20664# endif
20665# include <sys/time.h>
20666# ifdef I_SYS_TIME_KERNEL
20667# undef KERNEL
20668# endif
20669#endif
20670#$i_sysselct I_SYS_SELECT
20671#ifdef I_SYS_SELECT
20672#include <sys/select.h>
20673#endif
20674#$d_socket HAS_SOCKET
20675#ifdef HAS_SOCKET
20676# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20677#endif
20678#include <stdio.h>
d1daaddf
JH
20679#$i_stdlib I_STDLIB
20680#ifdef I_STDLIB
20681#include <stdlib.h>
20682#endif
b4eb6b3d
JH
20683$selecttype b;
20684#define S sizeof(*(b))
20685#define MINBITS 64
20686#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20687#define NBITS (NBYTES * 8)
20688int main() {
7090f861 20689 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
20690 struct timeval t;
20691 int i;
20692 FILE* fp;
20693 int fd;
20694
e6e7e605
JH
20695 if (!s)
20696 exit(1);
b4eb6b3d
JH
20697 fclose(stdin);
20698 fp = fopen("try.c", "r");
20699 if (fp == 0)
e6e7e605 20700 exit(2);
b4eb6b3d
JH
20701 fd = fileno(fp);
20702 if (fd < 0)
e6e7e605 20703 exit(3);
b4eb6b3d
JH
20704 b = ($selecttype)s;
20705 for (i = 0; i < NBITS; i++)
20706 FD_SET(i, b);
20707 t.tv_sec = 0;
20708 t.tv_usec = 0;
20709 select(fd + 1, b, 0, 0, &t);
20710 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 20711 free(s);
b4eb6b3d
JH
20712 printf("%d\n", i + 1);
20713 return 0;
20714}
20715EOCP
20716 set try
20717 if eval $compile_ok; then
5440bc8e 20718 selectminbits=`$run ./try`
b4eb6b3d
JH
20719 case "$selectminbits" in
20720 '') cat >&4 <<EOM
20721Cannot figure out on how many bits at a time your select() operates.
e6e7e605 20722I'll play safe and guess it is $safebits bits.
b4eb6b3d 20723EOM
e6e7e605
JH
20724 selectminbits=$safebits
20725 bits="$safebits bits"
b4eb6b3d
JH
20726 ;;
20727 1) bits="1 bit" ;;
20728 *) bits="$selectminbits bits" ;;
20729 esac
20730 echo "Your select() operates on $bits at a time." >&4
20731 else
20732 rp='What is the minimum number of bits your select() operates on?'
20733 case "$byteorder" in
e6e7e605
JH
20734 12345678) dflt=64 ;;
20735 1234) dflt=32 ;;
b4eb6b3d
JH
20736 *) dflt=1 ;;
20737 esac
20738 . ./myread
20739 val=$ans
20740 selectminbits="$val"
20741 fi
5b813a60 20742 $rm_try
b4eb6b3d
JH
20743 ;;
20744 *) : no select, so pick a harmless default
e6e7e605 20745 selectminbits=$safebits
b4eb6b3d
JH
20746 ;;
20747 esac
20748 ;;
20749esac
20750
20751: Trace out the files included by signal.h, then look for SIGxxx names.
b4eb6b3d
JH
20752if [ "X$fieldn" = X ]; then
20753 : Just make some guesses. We check them later.
20754 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20755else
20756 xxx=`echo '#include <signal.h>' |
20757 $cppstdin $cppminus $cppflags 2>/dev/null |
613d6c3e 20758 $grep '^[ ]*#.*include' |
776a38e3
MB
20759 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20760 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d 20761fi
b4eb6b3d
JH
20762xxxfiles=''
20763for xx in $xxx /dev/null ; do
20764 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20765done
b4eb6b3d
JH
20766case "$xxxfiles" in
20767'') xxxfiles=`./findhdr signal.h` ;;
20768esac
20769xxx=`awk '
20770$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20771 print substr($2, 4, 20)
20772}
20773$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20774 print substr($3, 4, 20)
20775}' $xxxfiles`
20776: Append some common names just in case the awk scan failed.
20777xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20778xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20779xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20780xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20781xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20782
20783: generate a few handy files for later
55954f19 20784$cat > signal.c <<EOCP
b4eb6b3d
JH
20785#include <sys/types.h>
20786#include <signal.h>
55954f19
JH
20787#$i_stdlib I_STDLIB
20788#ifdef I_STDLIB
20789#include <stdlib.h>
20790#endif
b4eb6b3d
JH
20791#include <stdio.h>
20792int main() {
20793
20794/* Strange style to avoid deeply-nested #if/#else/#endif */
20795#ifndef NSIG
20796# ifdef _NSIG
20797# define NSIG (_NSIG)
20798# endif
20799#endif
20800
20801#ifndef NSIG
20802# ifdef SIGMAX
20803# define NSIG (SIGMAX+1)
20804# endif
20805#endif
20806
20807#ifndef NSIG
20808# ifdef SIG_MAX
20809# define NSIG (SIG_MAX+1)
20810# endif
20811#endif
20812
20813#ifndef NSIG
3609ea0d
JH
20814# ifdef _SIG_MAX
20815# define NSIG (_SIG_MAX+1)
20816# endif
20817#endif
20818
20819#ifndef NSIG
b4eb6b3d
JH
20820# ifdef MAXSIG
20821# define NSIG (MAXSIG+1)
20822# endif
20823#endif
20824
20825#ifndef NSIG
20826# ifdef MAX_SIG
20827# define NSIG (MAX_SIG+1)
20828# endif
20829#endif
20830
20831#ifndef NSIG
20832# ifdef SIGARRAYSIZE
3609ea0d 20833# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
20834# endif
20835#endif
20836
20837#ifndef NSIG
20838# ifdef _sys_nsig
20839# define NSIG (_sys_nsig) /* Solaris 2.5 */
20840# endif
20841#endif
20842
20843/* Default to some arbitrary number that's big enough to get most
20844 of the common signals.
20845*/
20846#ifndef NSIG
20847# define NSIG 50
20848#endif
20849
20850printf("NSIG %d\n", NSIG);
20851
20852#ifndef JUST_NSIG
20853
20854EOCP
20855
20856echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20857{
20858 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 20859 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
20860 printf $1; printf ");\n"
20861 printf "#endif\n"
20862}
20863END {
20864 printf "#endif /* JUST_NSIG */\n";
20865 printf "exit(0);\n}\n";
20866}
20867' >>signal.c
20868$cat >signal.awk <<'EOP'
20869BEGIN { ndups = 0 }
65197d93 20870$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20871($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20872 if ($2 > maxsig) { maxsig = $2 }
20873 if (sig_name[$2]) {
20874 dup_name[ndups] = $1
20875 dup_num[ndups] = $2
613d6c3e 20876 ndups++
b4eb6b3d 20877 }
1ebe1ffb 20878 else {
65197d93
JH
20879 sig_name[$2] = $1
20880 sig_num[$2] = $2
b4eb6b3d
JH
20881 }
20882}
613d6c3e 20883END {
b4eb6b3d
JH
20884 if (nsig == 0) {
20885 nsig = maxsig + 1
20886 }
20887 printf("NSIG %d\n", nsig);
20888 for (n = 1; n < nsig; n++) {
20889 if (sig_name[n]) {
20890 printf("%s %d\n", sig_name[n], sig_num[n])
20891 }
20892 else {
613d6c3e 20893 printf("NUM%d %d\n", n, n)
b4eb6b3d
JH
20894 }
20895 }
20896 for (n = 0; n < ndups; n++) {
20897 printf("%s %d\n", dup_name[n], dup_num[n])
20898 }
20899}
20900EOP
20901$cat >signal_cmd <<EOS
20902$startsh
20903if $test -s signal.lst; then
20904 echo "Using your existing signal.lst file"
20905 exit 0
20906fi
20907xxx="$xxx"
20908EOS
20909$cat >>signal_cmd <<'EOS'
20910
20911set signal
20912if eval $compile_ok; then
776a38e3
MB
20913 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20914 $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20915else
20916 echo "(I can't seem be able to compile the whole test program)" >&4
20917 echo "(I'll try it in little pieces.)" >&4
20918 set signal -DJUST_NSIG
20919 if eval $compile_ok; then
5440bc8e 20920 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20921 $cat signal.nsg
20922 else
20923 echo "I can't seem to figure out how many signals you have." >&4
20924 echo "Guessing 50." >&4
20925 echo 'NSIG 50' > signal.nsg
20926 fi
20927 : Now look at all the signal names, one at a time.
20928 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20929 $cat > signal.c <<EOCP
20930#include <sys/types.h>
20931#include <signal.h>
20932#include <stdio.h>
20933int main() {
20934printf("$xx %d\n", SIG${xx});
20935return 0;
20936}
20937EOCP
20938 set signal
20939 if eval $compile; then
20940 echo "SIG${xx} found."
5440bc8e 20941 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20942 else
20943 echo "SIG${xx} NOT found."
20944 fi
20945 done
20946 if $test -s signal.ls1; then
20947 $cat signal.nsg signal.ls1 |
65197d93 20948 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20949 fi
20950
20951fi
20952if $test -s signal.lst; then
20953 :
20954else
20955 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20956 echo 'kill -l' >signal
20957 set X `csh -f <signal`
20958 $rm -f signal
20959 shift
20960 case $# in
20961 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20962 esac
20963 echo $@ | $tr ' ' $trnl | \
20964 $awk '{ printf "%s %d\n", $1, ++s; }
20965 END { printf "NSIG %d\n", ++s }' >signal.lst
20966fi
20967$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20968EOS
20969chmod a+x signal_cmd
20970$eunicefix signal_cmd
20971
20972: generate list of signal names
20973echo " "
20974case "$sig_name_init" in
20975'') doinit=yes ;;
20976*) case "$sig_num_init" in
20977 ''|*,*) doinit=yes ;;
20978 esac ;;
20979esac
20980case "$doinit" in
20981yes)
20982 echo "Generating a list of signal names and numbers..." >&4
20983 . ./signal_cmd
20984 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20985 sig_name=`$awk 'BEGIN { printf "ZERO " }
20986 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20987 sig_num=`$awk 'BEGIN { printf "0 " }
20988 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20989 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
20990 !/^NSIG/ { printf "\"%s\", ", $1 }
20991 END { printf "0\n" }' signal.lst`
20992 sig_num_init=`$awk 'BEGIN { printf "0, " }
20993 !/^NSIG/ { printf "%d, ", $2}
20994 END { printf "0\n"}' signal.lst`
20995 ;;
20996esac
20997echo "The following $sig_count signals are available:"
20998echo " "
20999echo $sig_name | $awk \
21000'BEGIN { linelen = 0 }
21001{
21002 for (i = 1; i <= NF; i++) {
21003 name = "SIG" $i " "
21004 linelen = linelen + length(name)
21005 if (linelen > 70) {
21006 printf "\n"
21007 linelen = length(name)
21008 }
21009 printf "%s", name
21010 }
21011 printf "\n"
21012}'
76d3c696 21013sig_size=`echo $sig_name | awk '{print NF}'`
c0bacbef 21014$rm -f signal signal.c signal.awk signal.lst signal_cmd
b4eb6b3d 21015
613d6c3e 21016: Check size of size
b4eb6b3d
JH
21017echo " "
21018case "$sizetype" in
21019*_t) zzz="$sizetype" ;;
21020*) zzz="filesize" ;;
21021esac
613d6c3e 21022echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21023cat > try.c <<EOCP
21024#include <sys/types.h>
21025#include <stdio.h>
d1daaddf
JH
21026#$i_stdlib I_STDLIB
21027#ifdef I_STDLIB
21028#include <stdlib.h>
21029#endif
b4eb6b3d
JH
21030int main() {
21031 printf("%d\n", (int)sizeof($sizetype));
21032 exit(0);
21033}
21034EOCP
21035set try
21036if eval $compile_ok; then
5440bc8e 21037 yyy=`$run ./try`
b4eb6b3d
JH
21038 case "$yyy" in
21039 '') sizesize=4
21040 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21041 ;;
21042 *) sizesize=$yyy
21043 echo "Your $zzz size is $sizesize bytes."
21044 ;;
21045 esac
21046else
21047 sizesize=4
21048 echo "(I can't compile the test program--guessing $sizesize.)" >&4
21049fi
21050
21051
21052: check for socklen_t
21053echo " "
21054echo "Checking to see if you have socklen_t..." >&4
21055$cat >try.c <<EOCP
21056#include <sys/types.h>
21057#$d_socket HAS_SOCKET
21058#ifdef HAS_SOCKET
21059#include <sys/socket.h>
21060#endif
21061int main() { socklen_t x = 16; }
21062EOCP
21063set try
21064if eval $compile; then
21065 val="$define"
21066 echo "You have socklen_t."
21067else
21068 val="$undef"
21069 echo "You do not have socklen_t."
21070 case "$sizetype" in
21071 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21072 esac
21073fi
5b813a60 21074$rm_try
b4eb6b3d
JH
21075set d_socklen_t
21076eval $setvar
21077
a7710f8d
JH
21078: see if this is a socks.h system
21079set socks.h i_socks
21080eval $inhdr
21081
b4eb6b3d
JH
21082: check for type of the size argument to socket calls
21083case "$d_socket" in
21084"$define")
21085 $cat <<EOM
21086
21087Checking to see what type is the last argument of accept().
21088EOM
b4eb6b3d
JH
21089 yyy=''
21090 case "$d_socklen_t" in
21091 "$define") yyy="$yyy socklen_t"
21092 esac
21093 yyy="$yyy $sizetype int long unsigned"
21094 for xxx in $yyy; do
21095 case "$socksizetype" in
61c26d18 21096 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
21097 case "$usesocks" in
21098 "$define")
21099 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21100 echo "Your system accepts '$xxx *' for the last argument of accept()."
21101 socksizetype="$xxx"
21102 fi
21103 ;;
21104 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
21105 echo "Your system accepts '$xxx *' for the last argument of accept()."
21106 socksizetype="$xxx"
21107 fi
21108 ;;
21109 esac
b4eb6b3d
JH
21110 ;;
21111 esac
21112 done
21113: In case none of those worked, prompt the user.
21114 case "$socksizetype" in
21115 '') rp='What is the type for socket address structure sizes?'
21116 dflt='int'
21117 . ./myread
21118 socksizetype=$ans
21119 ;;
21120 esac
21121 ;;
21122*) : no sockets, so pick relatively harmless default
21123 socksizetype='int'
21124 ;;
21125esac
21126
21127: see what type is used for signed size_t
21128set ssize_t ssizetype int stdio.h sys/types.h
21129eval $typedef
21130dflt="$ssizetype"
5440bc8e 21131$cat > try.c <<EOM
b4eb6b3d 21132#include <stdio.h>
d1daaddf
JH
21133#$i_stdlib I_STDLIB
21134#ifdef I_STDLIB
21135#include <stdlib.h>
21136#endif
b4eb6b3d
JH
21137#include <sys/types.h>
21138#define Size_t $sizetype
21139#define SSize_t $dflt
21140int main()
21141{
21142 if (sizeof(Size_t) == sizeof(SSize_t))
21143 printf("$dflt\n");
21144 else if (sizeof(Size_t) == sizeof(int))
21145 printf("int\n");
5b813a60 21146 else
b4eb6b3d
JH
21147 printf("long\n");
21148 exit(0);
21149}
21150EOM
21151echo " "
5440bc8e
JH
21152set try
21153if eval $compile_ok && $run ./try > /dev/null; then
21154 ssizetype=`$run ./try`
b4eb6b3d
JH
21155 echo "I'll be using $ssizetype for functions returning a byte count." >&4
21156else
21157 $cat >&4 <<EOM
21158Help! I can't compile and run the ssize_t test program: please enlighten me!
21159(This is probably a misconfiguration in your system or libraries, and
21160you really ought to fix it. Still, I'll try anyway.)
21161
21162I need a type that is the same size as $sizetype, but is guaranteed to
21163be signed. Common values are ssize_t, int and long.
21164
21165EOM
21166 rp="What signed type is the same size as $sizetype?"
21167 . ./myread
21168 ssizetype="$ans"
21169fi
5b813a60 21170$rm_try
b4eb6b3d
JH
21171
21172: see what type of char stdio uses.
21173echo " "
1d8eaf8c 21174echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
aa517f50 21175if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
21176 echo "Your stdio uses unsigned chars." >&4
21177 stdchar="unsigned char"
21178else
aa517f50
JH
21179 echo "Your stdio uses signed chars." >&4
21180 stdchar="char"
b4eb6b3d 21181fi
1d8eaf8c 21182$rm -f stdioh
b4eb6b3d 21183
b4eb6b3d
JH
21184: see what type uids are declared as in the kernel
21185echo " "
21186echo "Looking for the type for user ids returned by getuid()."
21187set uid_t uidtype xxx stdio.h sys/types.h
21188eval $typedef
21189case "$uidtype" in
21190xxx)
21191 xxx=`./findhdr sys/user.h`
21192 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21193 case $1 in
21194 unsigned) dflt="$1 $2" ;;
21195 *) dflt="$1" ;;
21196 esac
21197 ;;
21198*) dflt="$uidtype";;
21199esac
21200case "$uidtype" in
21201uid_t) echo "uid_t found." ;;
21202*) rp="What is the type for user ids returned by getuid()?"
21203 . ./myread
21204 uidtype="$ans"
21205 ;;
21206esac
21207
613d6c3e 21208: Check size of UID
b4eb6b3d
JH
21209echo " "
21210case "$uidtype" in
21211*_t) zzz="$uidtype" ;;
21212*) zzz="uid" ;;
21213esac
613d6c3e 21214echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21215cat > try.c <<EOCP
21216#include <sys/types.h>
21217#include <stdio.h>
d1daaddf
JH
21218#$i_stdlib I_STDLIB
21219#ifdef I_STDLIB
21220#include <stdlib.h>
21221#endif
b4eb6b3d
JH
21222int main() {
21223 printf("%d\n", (int)sizeof($uidtype));
21224 exit(0);
21225}
21226EOCP
21227set try
21228if eval $compile_ok; then
5440bc8e 21229 yyy=`$run ./try`
b4eb6b3d
JH
21230 case "$yyy" in
21231 '') uidsize=4
21232 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21233 ;;
21234 *) uidsize=$yyy
21235 echo "Your $zzz is $uidsize bytes long."
21236 ;;
21237 esac
21238else
21239 uidsize=4
21240 echo "(I can't compile the test program--guessing $uidsize.)" >&4
21241fi
21242
613d6c3e 21243: Check if UID is signed
b4eb6b3d
JH
21244echo " "
21245case "$uidtype" in
21246*_t) zzz="$uidtype" ;;
21247*) zzz="uid" ;;
21248esac
21249echo "Checking the sign of $zzz..." >&4
21250cat > try.c <<EOCP
21251#include <sys/types.h>
21252#include <stdio.h>
21253int main() {
21254 $uidtype foo = -1;
21255 if (foo < 0)
21256 printf("-1\n");
21257 else
21258 printf("1\n");
21259}
21260EOCP
21261set try
21262if eval $compile; then
5440bc8e 21263 yyy=`$run ./try`
b4eb6b3d
JH
21264 case "$yyy" in
21265 '') uidsign=1
21266 echo "(I can't execute the test program--guessing unsigned.)" >&4
21267 ;;
21268 *) uidsign=$yyy
21269 case "$uidsign" in
21270 1) echo "Your $zzz is unsigned." ;;
21271 -1) echo "Your $zzz is signed." ;;
21272 esac
21273 ;;
21274 esac
21275else
21276 uidsign=1
21277 echo "(I can't compile the test program--guessing unsigned.)" >&4
21278fi
21279
21280
34f1896b 21281: Check format string for UID
b4eb6b3d
JH
21282echo " "
21283$echo "Checking the format string to be used for uids..." >&4
21284
21285case "$uidsign" in
21286-1) if $test X"$uidsize" = X"$ivsize"; then
21287 uidformat="$ivdformat"
21288 else
21289 if $test X"$uidsize" = X"$longsize"; then
21290 uidformat='"ld"'
21291 else
21292 if $test X"$uidsize" = X"$intsize"; then
21293 uidformat='"d"'
21294 else
21295 if $test X"$uidsize" = X"$shortsize"; then
21296 uidformat='"hd"'
21297 fi
21298 fi
21299 fi
21300 fi
21301 ;;
21302*) if $test X"$uidsize" = X"$uvsize"; then
21303 uidformat="$uvuformat"
21304 else
21305 if $test X"$uidsize" = X"$longsize"; then
21306 uidformat='"lu"'
21307 else
21308 if $test X"$uidsize" = X"$intsize"; then
21309 uidformat='"u"'
21310 else
21311 if $test X"$uidsize" = X"$shortsize"; then
21312 uidformat='"hu"'
21313 fi
21314 fi
21315 fi
21316 fi
21317 ;;
21318esac
21319
34f1896b 21320: Check if site customization support was requested
4afd418c
MB
21321case "$usesitecustomize" in
21322 $define|true|[Yy]*)
21323 usesitecustomize="$define"
21324 ;;
21325 *)
21326 usesitecustomize="$undef"
21327 ;;
21328 esac
21329
d03b3b00
MB
21330: see if prototypes support variable argument declarations
21331echo " "
21332case "$prototype$i_stdarg" in
21333$define$define)
21334 echo "It appears we'll be able to prototype varargs functions." >&4
21335 val="$define"
21336 ;;
21337*)
21338 echo "Too bad... We won't be using prototyped varargs functions..." >&4
21339 val="$undef"
21340 ;;
21341esac
21342set vaproto
21343eval $setvar
21344
3659ebf1
JH
21345: determine compiler compiler
21346case "$yacc" in
21347'')
21348 dflt=yacc;;
21349*)
21350 dflt="$yacc";;
21351esac
21352echo " "
21353comp='yacc'
3c728e00 21354if $test -f "$byacc$_exe"; then
3659ebf1
JH
21355 dflt="$byacc"
21356 comp="byacc or $comp"
21357fi
3c728e00 21358if $test -f "$bison$_exe"; then
3659ebf1
JH
21359 comp="$comp or bison -y"
21360fi
21361rp="Which compiler compiler ($comp) shall I use?"
21362. ./myread
21363yacc="$ans"
21364case "$yacc" in
21365*bis*)
21366 case "$yacc" in
21367 *-y*) ;;
21368 *)
21369 yacc="$yacc -y"
21370 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21371 ;;
21372 esac
21373 ;;
21374esac
21375
c0bacbef
MB
21376: see if this is a assert.h system
21377set assert.h i_assert
21378eval $inhdr
21379
758a5d79
JH
21380: see if this is a fp.h system
21381set fp.h i_fp
21382eval $inhdr
21383
21384: see if this is a fp_class.h system
21385set fp_class.h i_fp_class
21386eval $inhdr
21387
13cfc98d
MB
21388: see if gdbm.h is available
21389set gdbm.h t_gdbm
21390eval $inhdr
21391case "$t_gdbm" in
21392$define)
21393 : see if gdbm_open exists
21394 set gdbm_open d_gdbm_open
21395 eval $inlibc
21396 case "$d_gdbm_open" in
21397 $undef)
21398 t_gdbm="$undef"
21399 echo "We won't be including <gdbm.h>"
21400 ;;
21401 esac
21402 ;;
21403esac
21404val="$t_gdbm"
21405set i_gdbm
21406eval $setvar
21407
b2f871ed
AD
21408: see if this is a ieeefp.h system
21409case "$i_ieeefp" in
21410'' ) set ieeefp.h i_ieeefp
21411 eval $inhdr
21412 ;;
21413esac
21414
21415: see if this is a libutil.h system
21416set libutil.h i_libutil
21417eval $inhdr
21418
21419: see if mach cthreads are available
21420if test "X$usethreads" = "X$define"; then
21421 set mach/cthreads.h i_machcthr
21422 eval $inhdr
21423else
21424 i_machcthr="$undef"
21425fi
21426
21427: see if this is a mntent.h system
21428set mntent.h i_mntent
21429eval $inhdr
21430
b4eb6b3d
JH
21431: see if net/errno.h is available
21432val=''
21433set net/errno.h val
21434eval $inhdr
21435
21436: Unfortunately, it causes problems on some systems. Arrgh.
21437case "$val" in
21438$define)
21439 cat > try.c <<'EOM'
21440#include <stdio.h>
21441#include <errno.h>
21442#include <net/errno.h>
21443int func()
21444{
21445 return ENOTSOCK;
21446}
21447EOM
21448 if $cc $ccflags -c try.c >/dev/null 2>&1; then
21449 echo "We'll be including <net/errno.h>." >&4
21450 else
21451 echo "We won't be including <net/errno.h>." >&4
21452 val="$undef"
21453 fi
5b813a60 21454 $rm_try
b4eb6b3d
JH
21455 ;;
21456esac
21457set i_neterrno
21458eval $setvar
21459
21460: see if netinet/tcp.h is available
21461set netinet/tcp.h i_netinettcp
21462eval $inhdr
21463
21464: see if this is a poll.h system
21465set poll.h i_poll
21466eval $inhdr
21467
21468: see if this is a prot.h system
21469set prot.h i_prot
21470eval $inhdr
21471
613d6c3e 21472: Preprocessor symbols
b4eb6b3d 21473echo " "
ddfca5da 21474$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
21475$cat <<'EOSH' > Cppsym.know
21476a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21477AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 21478alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
21479ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21480BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
21481BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21482bull c cadmus clipper CMU COFF COMPILER_VERSION
21483concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 21484CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
21485Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21486FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21487GLIBC GLIBC_MINOR
21488GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
21489H3050R H3050RX hbullx20 hcx host_mips
21490hp200 hp300 hp700 HP700 hp800 hp9000
21491hp9000s200 hp9000s300 hp9000s400 hp9000s500
21492hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21493i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 21494IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
21495INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21496LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21497LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 21498LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
21499LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21500M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21501M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21502M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21503MATH_HAS_NO_SIDE_EFFECTS
21504mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21505mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21506mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21507MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21508mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21509NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 21510news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
21511ns32016 ns32332 ns32k nsc32000
21512OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21513pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21514pc532 pdp11 PGC PIC plexus PORTAR posix
21515POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21516POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 21517PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 21518riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
21519SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21520sony sony_news sonyrisc sparc sparclite spectrum
21521stardent stdc STDC_EXT stratos sun sun3 sun386
21522Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21523SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21524SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21525sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 21526TM3200 TM5400 TM5600
b4eb6b3d
JH
21527tower tower32 tower32_200 tower32_600 tower32_700
21528tower32_800 tower32_850 tss
21529u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21530ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
21531unix UNIX95 UNIX99 unixpc unos
21532USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21533USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21534USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21535USGr4 USGr4_2
44c87379 21536Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
21537XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21538XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21539z8000
21540EOSH
21541# Maybe put other stuff here too.
21542cat <<EOSH >>Cppsym.know
21543$osname
21544EOSH
21545./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21546./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21547$cat Cppsym.know > Cppsym.c
381aa1ff 21548$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
21549$rm -f Cppsym.a Cppsym.b Cppsym.c
21550cat <<EOSH > Cppsym
21551$startsh
21552if $test \$# -gt 0; then
21553 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21554 if $test -s Cppsym.got; then
21555 $rm -f Cppsym.got
21556 exit 0
21557 fi
21558 $rm -f Cppsym.got
21559 exit 1
21560else
21561 $tr " " "$trnl" | ./Cppsym.try
21562 exit 0
21563fi
21564EOSH
21565chmod +x Cppsym
21566$eunicefix Cppsym
21567cat <<EOSH > Cppsym.try
21568$startsh
21569cat <<'EOCP' > try.c
21570#include <stdio.h>
360321b3
YST
21571#if cpp_stuff == 1
21572#define STRINGIFY(a) "a"
21573#endif
21574#if cpp_stuff == 42
21575#define StGiFy(a) #a
21576#define STRINGIFY(a) StGiFy(a)
21577#endif
21578#if $cpp_stuff != 1 && $cpp_stuff != 42
21579# include "Bletch: How does this C preprocessor stringify macros?"
21580#endif
b4eb6b3d
JH
21581int main() {
21582EOCP
21583$awk \\
21584EOSH
21585cat <<'EOSH' >> Cppsym.try
21586'length($1) > 0 {
360321b3
YST
21587 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21588 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21589 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21590 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 21591}' >> try.c
2ef53570 21592echo 'return 0;}' >> try.c
b4eb6b3d
JH
21593EOSH
21594cat <<EOSH >> Cppsym.try
21595ccflags="$ccflags"
21596case "$osname-$gccversion" in
21597irix-) ccflags="\$ccflags -woff 1178" ;;
21598os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21599esac
360321b3 21600$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
21601EOSH
21602chmod +x Cppsym.try
21603$eunicefix Cppsym.try
21604./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 21605: Add in any linux cpp "predefined macros":
b6a7163e 21606case "$osname::$gccversion" in
eeb92b76 21607 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
b6a7163e
MB
21608 tHdrH=_tmpHdr
21609 rm -f $tHdrH'.h' $tHdrH
21610 touch $tHdrH'.h'
6f5be6d1 21611 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
b6a7163e
MB
21612 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21613 if [ -s $tHdrH'_cppsym.real' ]; then
21614 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21615 fi
21616 fi
21617 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21618 ;;
21619esac
b4eb6b3d
JH
21620: now check the C compiler for additional symbols
21621postprocess_cc_v=''
21622case "$osname" in
21623aix) postprocess_cc_v="|$tr , ' '" ;;
21624esac
21625$cat >ccsym <<EOS
21626$startsh
21627$cat >tmp.c <<EOF
21628extern int foo;
21629EOF
21630for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21631do
21632 case "\$i" in
21633 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 21634 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
21635 esac
21636done
5b813a60 21637$rm_try
b4eb6b3d
JH
21638EOS
21639postprocess_cc_v=''
21640chmod +x ccsym
21641$eunicefix ccsym
21642./ccsym > ccsym1.raw
21643if $test -s ccsym1.raw; then
21644 $sort ccsym1.raw | $uniq >ccsym.raw
21645else
21646 mv ccsym1.raw ccsym.raw
21647fi
21648
21649$awk '/\=/ { print $0; next }
21650 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
21651$comm -13 Cppsym.true ccsym.list >ccsym.own
21652$comm -12 Cppsym.true ccsym.list >ccsym.com
21653$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
21654also=''
21655if $test -z ccsym.raw; then
21656 echo "Your C compiler doesn't seem to define any symbols!" >&4
21657 echo " "
21658 echo "However, your C preprocessor defines the following symbols:"
21659 $cat Cppsym.true
21660 ccsymbols=''
21661 cppsymbols=`$cat Cppsym.true`
21662 cppsymbols=`echo $cppsymbols`
21663 cppccsymbols="$cppsymbols"
21664else
21665 if $test -s ccsym.com; then
21666 echo "Your C compiler and pre-processor define these symbols:"
21667 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21668 also='also '
21669 symbols='ones'
21670 cppccsymbols=`$cat ccsym.com`
21671 cppccsymbols=`echo $cppccsymbols`
21672 $test "$silent" || sleep 1
21673 fi
21674 if $test -s ccsym.cpp; then
21675 $test "$also" && echo " "
21676 echo "Your C pre-processor ${also}defines the following symbols:"
21677 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21678 also='further '
21679 cppsymbols=`$cat ccsym.cpp`
21680 cppsymbols=`echo $cppsymbols`
21681 $test "$silent" || sleep 1
21682 fi
21683 if $test -s ccsym.own; then
21684 $test "$also" && echo " "
21685 echo "Your C compiler ${also}defines the following cpp symbols:"
21686 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21687 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21688 ccsymbols=`$cat ccsym.own`
21689 ccsymbols=`echo $ccsymbols`
21690 $test "$silent" || sleep 1
21691 fi
21692fi
b4eb6b3d
JH
21693
21694: see if this is a termio system
21695val="$undef"
21696val2="$undef"
21697val3="$undef"
21698if $test `./findhdr termios.h`; then
21699 set tcsetattr i_termios
21700 eval $inlibc
21701 val3="$i_termios"
21702fi
21703echo " "
21704case "$val3" in
21705"$define") echo "You have POSIX termios.h... good!" >&4;;
21706*) if ./Cppsym pyr; then
21707 case "`/bin/universe`" in
21708 ucb) if $test `./findhdr sgtty.h`; then
21709 val2="$define"
21710 echo "<sgtty.h> found." >&4
21711 else
21712 echo "System is pyramid with BSD universe."
216dac04 21713 ./warn "<sgtty.h> not found--you could have problems."
b4eb6b3d
JH
21714 fi;;
21715 *) if $test `./findhdr termio.h`; then
21716 val="$define"
21717 echo "<termio.h> found." >&4
21718 else
21719 echo "System is pyramid with USG universe."
216dac04 21720 ./warn "<termio.h> not found--you could have problems."
b4eb6b3d
JH
21721 fi;;
21722 esac
21723 elif ./usg; then
21724 if $test `./findhdr termio.h`; then
21725 echo "<termio.h> found." >&4
21726 val="$define"
21727 elif $test `./findhdr sgtty.h`; then
21728 echo "<sgtty.h> found." >&4
21729 val2="$define"
21730 else
216dac04 21731 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
b4eb6b3d
JH
21732 fi
21733 else
21734 if $test `./findhdr sgtty.h`; then
21735 echo "<sgtty.h> found." >&4
21736 val2="$define"
21737 elif $test `./findhdr termio.h`; then
21738 echo "<termio.h> found." >&4
21739 val="$define"
21740 else
216dac04 21741 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
b4eb6b3d
JH
21742 fi
21743 fi;;
21744esac
21745set i_termio; eval $setvar
21746val=$val2; set i_sgtty; eval $setvar
21747val=$val3; set i_termios; eval $setvar
21748
b4eb6b3d
JH
21749: see if stddef is available
21750set stddef.h i_stddef
21751eval $inhdr
923fc586 21752
b4eb6b3d
JH
21753: see if sys/access.h is available
21754set sys/access.h i_sysaccess
21755eval $inhdr
21756
21757: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21758set sys/filio.h i_sysfilio
21759eval $inhdr
21760echo " "
21761if $test `./findhdr sys/ioctl.h`; then
21762 val="$define"
21763 echo '<sys/ioctl.h> found.' >&4
21764else
21765 val="$undef"
21766 if $test $i_sysfilio = "$define"; then
21767 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 21768 else
b4eb6b3d
JH
21769 $test $i_sgtty = "$define" && xxx="sgtty.h"
21770 $test $i_termio = "$define" && xxx="termio.h"
21771 $test $i_termios = "$define" && xxx="termios.h"
21772echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21773 fi
21774fi
21775set i_sysioctl
21776eval $setvar
21777
49a78c82
JH
21778: see if socket ioctl defs are in sys/sockio.h
21779echo " "
21780xxx=`./findhdr sys/sockio.h`
21781if $test "$xxx"; then
21782 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21783 val="$define"
21784 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21785 else
21786 val="$undef"
21787 echo "No socket ioctls found in <sys/sockio.h>." >&4
21788 fi
21789else
21790 val="$undef"
21791 $cat <<EOM
21792<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21793EOM
21794fi
21795set i_syssockio
21796eval $setvar
21797
b4eb6b3d
JH
21798: see if this is a syslog.h system
21799set syslog.h i_syslog
21800eval $inhdr
21801
b4eb6b3d
JH
21802: see if this is a sys/mode.h system
21803set sys/mode.h i_sysmode
21804eval $inhdr
21805
216dac04
MB
21806: see if there is a sys/poll.h file
21807set sys/poll.h i_syspoll
21808eval $inhdr
21809
b4eb6b3d
JH
21810: see if sys/resource.h has to be included
21811set sys/resource.h i_sysresrc
21812eval $inhdr
21813
21814: see if sys/security.h is available
21815set sys/security.h i_syssecrt
21816eval $inhdr
21817
21818: see if this is a sys/statvfs.h system
21819set sys/statvfs.h i_sysstatvfs
21820eval $inhdr
21821
b4eb6b3d
JH
21822: see if this is a sys/un.h system
21823set sys/un.h i_sysun
21824eval $inhdr
21825
b4eb6b3d
JH
21826: see if this is a sys/utsname.h system
21827set sys/utsname.h i_sysutsname
21828eval $inhdr
21829
21830: see if this is a syswait system
21831set sys/wait.h i_syswait
21832eval $inhdr
21833
21834: see if this is a ustat.h system
21835set ustat.h i_ustat
21836eval $inhdr
21837
21838: see if this is an utime system
21839set utime.h i_utime
21840eval $inhdr
21841
b4eb6b3d
JH
21842: see if this is a vfork system
21843case "$d_vfork" in
21844"$define")
21845 set vfork.h i_vfork
21846 eval $inhdr
21847 ;;
21848*)
21849 i_vfork="$undef"
21850 ;;
21851esac
21852
613d6c3e 21853: Check extensions
b4eb6b3d
JH
21854echo " "
21855echo "Looking for extensions..." >&4
21856: If we are using the old config.sh, known_extensions may contain
21857: old or inaccurate or duplicate values.
21858known_extensions=''
21859nonxs_extensions=''
21860: We do not use find because it might not be available.
21861: We do not just use MANIFEST because the user may have dropped
21862: some additional extensions into the source tree and expect them
21863: to be built.
21864
38fddf8b
MB
21865: Function to recursively find available extensions, ignoring DynaLoader
21866: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
4cc80fc4 21867: In 5.10.1 and later, extensions are stored in directories
88a6f4fc 21868: like File-Glob instead of the older File/Glob/.
b4eb6b3d
JH
21869find_extensions='
21870 for xxx in *; do
822a6ee0
MB
21871 case "$xxx" in
21872 DynaLoader|dynaload) ;;
21873 *)
238a6851
NC
21874 this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21875 leaf=`echo $xxx | $sed -e s/.*-//`;
dd6c21be 21876 if $test -d File; then
38fddf8b
MB
21877 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21878 known_extensions="$known_extensions $1$this_ext";
21879 elif $test -f $xxx/Makefile.PL; then
21880 nonxs_extensions="$nonxs_extensions $1$this_ext";
21881 else
21882 if $test -d $xxx -a $# -lt 10; then
21883 set $1$xxx/ $*;
21884 cd "$xxx";
21885 eval $find_extensions;
21886 cd ..;
21887 shift;
21888 fi;
21889 fi;
dd6c21be
NC
21890 else
21891 $ls -1 $xxx > $$.tmp;
21892 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21893 known_extensions="$known_extensions $this_ext";
21894 elif $contains "\.c$" $$.tmp > /dev/null 2>&1; then
21895 known_extensions="$known_extensions $this_ext";
dd6c21be
NC
21896 elif $test -d $xxx; then
21897 nonxs_extensions="$nonxs_extensions $this_ext";
21898 fi;
21899 $rm -f $$.tmp;
822a6ee0
MB
21900 fi
21901 ;;
21902 esac;
b4eb6b3d
JH
21903 done'
21904tdir=`pwd`
dd6c21be
NC
21905cd "$rsrc/cpan"
21906set X
21907shift
21908eval $find_extensions
a193a2db
NC
21909cd "$rsrc/dist"
21910set X
21911shift
21912eval $find_extensions
6904989c 21913cd "$rsrc/ext"
b4eb6b3d
JH
21914set X
21915shift
21916eval $find_extensions
38fddf8b
MB
21917if $test -d File-Glob; then
21918 : All ext/ flattened
21919else
21920 # Special case: Add in modules that nest beyond the first level.
21921 # Currently threads/shared and Hash/Util/FieldHash, since they are
21922 # not picked up by the recursive find above (and adding in general
21923 # recursive finding breaks SDBM_File/sdbm).
21924 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21925 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21926fi
faae14e6
MB
21927set X $known_extensions
21928shift
a32b3e13 21929known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
b4eb6b3d
JH
21930set X $nonxs_extensions
21931shift
a32b3e13 21932nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
6904989c 21933cd "$tdir"
b4eb6b3d
JH
21934
21935: Now see which are supported on this system.
21936avail_ext=''
21937for xxx in $known_extensions ; do
21938 case "$xxx" in
21939 DB_File|db_file)
21940 case "$i_db" in
21941 $define) avail_ext="$avail_ext $xxx" ;;
21942 esac
21943 ;;
21944 GDBM_File|gdbm_fil)
7c345082 21945 case "$i_gdbm" in
b4eb6b3d
JH
21946 $define) avail_ext="$avail_ext $xxx" ;;
21947 esac
21948 ;;
1d59c593 21949 I18N/Langinfo|i18n_lan)
7c345082 21950 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
21951 $define$define) avail_ext="$avail_ext $xxx" ;;
21952 esac
21953 ;;
7978b0db
JH
21954 IPC/SysV|ipc/sysv)
21955 : XXX Do we need a useipcsysv variable here
21956 case "${d_msg}${d_sem}${d_shm}" in
21957 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21958 esac
21959 ;;
b4eb6b3d 21960 NDBM_File|ndbm_fil)
7894ad66 21961 case "$d_ndbm" in
b4eb6b3d
JH
21962 $define)
21963 case "$osname-$use64bitint" in
0be9fa5d 21964 hpux-define)
b4eb6b3d
JH
21965 case "$libs" in
21966 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21967 esac
21968 ;;
21969 *) avail_ext="$avail_ext $xxx" ;;
21970 esac
21971 ;;
21972 esac
21973 ;;
7c345082 21974 ODBM_File|odbm_fil)
b4eb6b3d
JH
21975 case "${i_dbm}${i_rpcsvcdbm}" in
21976 *"${define}"*)
7978b0db
JH
21977 case "$d_cplusplus" in
21978 define) ;; # delete as a function name will not work
21979 *) case "$osname-$use64bitint" in
21980 hpux-define)
21981 case "$libs" in
21982 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21983 esac
21984 ;;
21985 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
21986 esac
21987 ;;
b4eb6b3d
JH
21988 esac
21989 ;;
21990 esac
21991 ;;
7978b0db
JH
21992 Opcode|opcode)
21993 case "$useopcode" in
b4eb6b3d
JH
21994 true|define|y) avail_ext="$avail_ext $xxx" ;;
21995 esac
21996 ;;
7978b0db
JH
21997 POSIX|posix)
21998 case "$useposix" in
b4eb6b3d
JH
21999 true|define|y) avail_ext="$avail_ext $xxx" ;;
22000 esac
22001 ;;
22002 Socket|socket)
7c345082 22003 case "$d_socket" in
4a9f028c
JH
22004 true|$define|y)
22005 case "$osname" in
22006 beos) ;; # not unless BONE
22007 *) avail_ext="$avail_ext $xxx" ;;
22008 esac
22009 ;;
b4eb6b3d
JH
22010 esac
22011 ;;
22012 Sys/Syslog|sys/syslog)
22013 : XXX syslog requires socket
7c345082 22014 case "$d_socket" in
b4eb6b3d
JH
22015 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22016 esac
22017 ;;
22018 Thread|thread)
b00ec89b
AB
22019 case "$usethreads" in
22020 true|$define|y)
47f9f84c 22021 case "$use5005threads" in
3f30fabf 22022 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 22023 esac
b4eb6b3d
JH
22024 esac
22025 ;;
7978b0db
JH
22026 threads|threads/shared)
22027 # threads and threads::shared are special cases.
22028 # To stop people from asking "Perl 5.8.0 was supposed
22029 # to have this new fancy threads implementation but my
22030 # perl doesn't have it" and from people trying to
22031 # (re)install the threads module using CPAN.pm and
22032 # CPAN.pm then offering to reinstall Perl 5.8.0,
22033 # the threads.pm and threads/shared.pm will always be
22034 # there, croaking informatively ("you need to rebuild
22035 # all of Perl with threads, sorry") when threads haven't
22036 # been compiled in.
22037 # --jhi
22038 avail_ext="$avail_ext $xxx"
22039 ;;
aefe3e7e
NC
22040 VMS*)
22041 ;;
78ff2d7b 22042 Win32*)
b149d92d
JD
22043 case "$osname" in
22044 cygwin) avail_ext="$avail_ext $xxx" ;;
22045 esac
22046 ;;
f9b6ed1c
AD
22047 XS/APItest|xs/apitest)
22048 # This is just for testing. Skip it unless we have dynamic loading.
88e1f1a2
JV
22049
22050 case "$usedl" in
22051 $define) avail_ext="$avail_ext $xxx" ;;
22052 esac
22053 ;;
22054 XS/APItest/KeywordRPN|xs/apitest/keywordrpn)
22055 # This is just for testing. Skip it unless we have dynamic loading.
f9b6ed1c
AD
22056
22057 case "$usedl" in
22058 $define) avail_ext="$avail_ext $xxx" ;;
22059 esac
22060 ;;
22061 XS/Typemap|xs/typemap)
22062 # This is just for testing. Skip it unless we have dynamic loading.
22063 case "$usedl" in
22064 $define) avail_ext="$avail_ext $xxx" ;;
22065 esac
22066 ;;
b4eb6b3d 22067 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
22068 ;;
22069 esac
b4eb6b3d 22070done
5f80c64f 22071
b4eb6b3d
JH
22072set X $avail_ext
22073shift
22074avail_ext="$*"
5f80c64f 22075
ef0c5be8
JH
22076case "$onlyextensions" in
22077'') ;;
22078*) keepextensions=''
22079 echo "You have requested that only certains extensions be included..." >&4
22080 for i in $onlyextensions; do
22081 case " $avail_ext " in
22082 *" $i "*)
22083 echo "Keeping extension $i."
22084 keepextensions="$keepextensions $i"
22085 ;;
22086 *) echo "Ignoring extension $i." ;;
22087 esac
22088 done
22089 avail_ext="$keepextensions"
22090 ;;
22091esac
22092
22093case "$noextensions" in
22094'') ;;
22095*) keepextensions=''
22096 echo "You have requested that certain extensions be ignored..." >&4
22097 for i in $avail_ext; do
c3dadc13
AD
22098 case " $noextensions " in
22099 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
22100 *) echo "Keeping extension $i.";
22101 keepextensions="$keepextensions $i"
22102 ;;
22103 esac
22104 done
22105 avail_ext="$keepextensions"
22106 ;;
22107esac
22108
b4eb6b3d
JH
22109: Now see which nonxs extensions are supported on this system.
22110: For now assume all are.
22111nonxs_ext=''
22112for xxx in $nonxs_extensions ; do
22113 case "$xxx" in
22114 *) nonxs_ext="$nonxs_ext $xxx"
22115 ;;
22116 esac
22117done
5f80c64f 22118
b4eb6b3d
JH
22119set X $nonxs_ext
22120shift
22121nonxs_ext="$*"
22122
22123case $usedl in
22124$define)
22125 $cat <<EOM
22126A number of extensions are supplied with $package. You may choose to
22127compile these extensions for dynamic loading (the default), compile
22128them into the $package executable (static loading), or not include
22129them at all. Answer "none" to include no extensions.
22130Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
22131
22132EOM
b4eb6b3d 22133 case "$dynamic_ext" in
736accd3
YST
22134 '')
22135 : Exclude those listed in static_ext
22136 dflt=''
22137 for xxx in $avail_ext; do
22138 case " $static_ext " in
22139 *" $xxx "*) ;;
22140 *) dflt="$dflt $xxx" ;;
22141 esac
22142 done
22143 set X $dflt
22144 shift
22145 dflt="$*"
22146 ;;
b4eb6b3d
JH
22147 *) dflt="$dynamic_ext"
22148 # Perhaps we are reusing an old out-of-date config.sh.
22149 case "$hint" in
22150 previous)
22151 if test X"$dynamic_ext" != X"$avail_ext"; then
22152 $cat <<EOM
7c345082
RGS
22153NOTICE: Your previous config.sh list may be incorrect.
22154The extensions now available to you are
b4eb6b3d
JH
22155 ${avail_ext}
22156but the default list from your previous config.sh is
7c345082 22157 ${dynamic_ext}
9c839522 22158
b4eb6b3d
JH
22159EOM
22160 fi
9c839522
PM
22161 ;;
22162 esac
b4eb6b3d
JH
22163 ;;
22164 esac
5f80c64f 22165 case "$dflt" in
b4eb6b3d
JH
22166 '') dflt=none;;
22167 esac
22168 rp="What extensions do you wish to load dynamically?"
22169 . ./myread
22170 case "$ans" in
22171 none) dynamic_ext=' ' ;;
22172 *) dynamic_ext="$ans" ;;
5f80c64f 22173 esac
5f80c64f 22174
b4eb6b3d
JH
22175 case "$static_ext" in
22176 '')
22177 : Exclude those already listed in dynamic linking
22178 dflt=''
22179 for xxx in $avail_ext; do
22180 case " $dynamic_ext " in
22181 *" $xxx "*) ;;
22182 *) dflt="$dflt $xxx" ;;
22183 esac
22184 done
22185 set X $dflt
22186 shift
22187 dflt="$*"
22188 ;;
7c345082 22189 *) dflt="$static_ext"
b4eb6b3d
JH
22190 ;;
22191 esac
9c839522 22192
b4eb6b3d
JH
22193 case "$dflt" in
22194 '') dflt=none;;
22195 esac
22196 rp="What extensions do you wish to load statically?"
22197 . ./myread
22198 case "$ans" in
22199 none) static_ext=' ' ;;
22200 *) static_ext="$ans" ;;
22201 esac
22202 ;;
22203*)
22204 $cat <<EOM
7c345082
RGS
22205A number of extensions are supplied with $package. Answer "none"
22206to include no extensions.
b4eb6b3d 22207Note that DynaLoader is always built and need not be mentioned here.
9c839522 22208
b4eb6b3d
JH
22209EOM
22210 case "$static_ext" in
22211 '') dflt="$avail_ext" ;;
22212 *) dflt="$static_ext"
22213 # Perhaps we are reusing an old out-of-date config.sh.
22214 case "$hint" in
22215 previous)
22216 if test X"$static_ext" != X"$avail_ext"; then
22217 $cat <<EOM
7c345082
RGS
22218NOTICE: Your previous config.sh list may be incorrect.
22219The extensions now available to you are
b4eb6b3d
JH
22220 ${avail_ext}
22221but the default list from your previous config.sh is
7c345082 22222 ${static_ext}
5f80c64f
JH
22223
22224EOM
b4eb6b3d
JH
22225 fi
22226 ;;
22227 esac
22228 ;;
22229 esac
22230 : Exclude those that are not xs extensions
22231 case "$dflt" in
22232 '') dflt=none;;
22233 esac
22234 rp="What extensions do you wish to include?"
22235 . ./myread
22236 case "$ans" in
22237 none) static_ext=' ' ;;
22238 *) static_ext="$ans" ;;
22239 esac
22240 ;;
5f80c64f 22241esac
7c345082 22242#
f1f6834f
AD
22243# Encode is a special case. If we are building Encode as a static
22244# extension, we need to explicitly list its subextensions as well.
22245# For other nested extensions, this is handled automatically by
22246# the appropriate Makefile.PL.
22247case " $static_ext " in
22248 *" Encode "*) # Add the subextensions of Encode
22249 cd "$rsrc/ext"
22250 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22251 static_ext="$static_ext Encode/$xxx"
22252 done
22253 cd "$tdir"
22254 ;;
22255esac
5f80c64f 22256
b4eb6b3d
JH
22257set X $dynamic_ext $static_ext $nonxs_ext
22258shift
22259extensions="$*"
22260
93a2cd18
AD
22261# Sanity check: We require an extension suitable for use with
22262# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
22263# should show up as failures in the test suite, but it's helpful to
22264# catch them now.) The 'extensions' list is normally sorted
22265# alphabetically, so we need to accept either
22266# DB_File ... Fcntl ... IO ....
22267# or something like
22268# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
22269case " $extensions" in
22270*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22271*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22272*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
22273*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22274 echo "WARNING: The Perl you are building will be quite crippled." >& 4
22275 ;;
22276esac
22277
9c839522
PM
22278: Remove libraries needed only for extensions
22279: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
22280: The exception is SunOS 4.x, which needs them.
22281case "${osname}X${osvers}" in
22282sunos*X4*)
22283 perllibs="$libs"
22284 ;;
22285*) case "$usedl" in
22286 $define|true|[yY]*)
a33f2d9f 22287 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
eedaba54
PM
22288 shift
22289 perllibs="$*"
22290 ;;
22291 *) perllibs="$libs"
22292 ;;
22293 esac
22294 ;;
9c839522 22295esac
5f80c64f
JH
22296
22297: Remove build directory name from cppstdin so it can be used from
22298: either the present location or the final installed location.
22299echo " "
22300: Get out of the UU directory to get correct path name.
22301cd ..
22302case "$cppstdin" in
22303`pwd`/cppstdin)
22304 echo "Stripping down cppstdin path name"
22305 cppstdin=cppstdin
22306 ;;
22307esac
22308cd UU
22309
22310: end of configuration questions
22311echo " "
22312echo "End of configuration questions."
22313echo " "
22314
22315: back to where it started
22316if test -d ../UU; then
22317 cd ..
22318fi
22319
776a38e3 22320: configuration may be unconditionally patched via a 'config.arch' file
48370efc 22321if $test -f config.arch; then
776a38e3 22322 echo "I see a config.arch file, loading it." >&4
48370efc
JH
22323 . ./config.arch
22324fi
22325
5f80c64f
JH
22326: configuration may be patched via a 'config.over' file
22327if $test -f config.over; then
22328 echo " "
22329 dflt=y
22330 rp='I see a config.over file. Do you wish to load it?'
22331 . UU/myread
22332 case "$ans" in
22333 n*) echo "OK, I'll ignore it.";;
22334 *) . ./config.over
22335 echo "Configuration override changes have been loaded."
22336 ;;
22337 esac
22338fi
22339
22340: in case they want portability, strip down executable paths
22341case "$d_portable" in
22342"$define")
22343 echo " "
22344 echo "Stripping down executable paths..." >&4
22345 for file in $loclist $trylist; do
534ac15a
JH
22346 eval temp=\$$file
22347 eval $file=`basename $temp`
5f80c64f
JH
22348 done
22349 ;;
22350esac
22351
22352: create config.sh file
22353echo " "
22354echo "Creating config.sh..." >&4
22355$spitshell <<EOT >config.sh
22356$startsh
22357#
22358# This file was produced by running the Configure script. It holds all the
22359# definitions figured out by Configure. Should you modify one of these values,
22360# do not forget to propagate your changes by running "Configure -der". You may
22361# instead choose to run each of the .SH files by yourself, or "Configure -S".
22362#
22363
22364# Package name : $package
22365# Source directory : $src
22366# Configuration time: $cf_time
22367# Configured by : $cf_by
22368# Target system : $myuname
22369
776a38e3 22370EOT
94a9a4bc 22371: Add in command line options if available
776a38e3 22372$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
94a9a4bc 22373
776a38e3
MB
22374$spitshell <<EOT >>config.sh
22375
5f80c64f
JH
22376Author='$Author'
22377Date='$Date'
22378Header='$Header'
22379Id='$Id'
22380Locker='$Locker'
22381Log='$Log'
5f80c64f
JH
22382RCSfile='$RCSfile'
22383Revision='$Revision'
22384Source='$Source'
22385State='$State'
22386_a='$_a'
22387_exe='$_exe'
22388_o='$_o'
b4eb6b3d 22389afs='$afs'
a6d26a0d 22390afsroot='$afsroot'
b4eb6b3d
JH
22391alignbytes='$alignbytes'
22392ansi2knr='$ansi2knr'
22393aphostname='$aphostname'
22394api_revision='$api_revision'
22395api_subversion='$api_subversion'
22396api_version='$api_version'
22397api_versionstring='$api_versionstring'
5f80c64f 22398ar='$ar'
b4eb6b3d
JH
22399archlib='$archlib'
22400archlibexp='$archlibexp'
22401archname64='$archname64'
22402archname='$archname'
5f80c64f 22403archobjs='$archobjs'
10bc17b6 22404asctime_r_proto='$asctime_r_proto'
5f80c64f 22405awk='$awk'
b4eb6b3d 22406baserev='$baserev'
5f80c64f 22407bash='$bash'
b4eb6b3d 22408bin='$bin'
f1ce3bf1 22409bin_ELF='$bin_ELF'
b4eb6b3d 22410binexp='$binexp'
5f80c64f
JH
22411bison='$bison'
22412byacc='$byacc'
b4eb6b3d 22413byteorder='$byteorder'
5f80c64f 22414c='$c'
b4eb6b3d 22415castflags='$castflags'
5f80c64f
JH
22416cat='$cat'
22417cc='$cc'
22418cccdlflags='$cccdlflags'
22419ccdlflags='$ccdlflags'
22420ccflags='$ccflags'
b4eb6b3d 22421ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 22422ccname='$ccname'
b4eb6b3d 22423ccsymbols='$ccsymbols'
6b356c8e 22424ccversion='$ccversion'
5f80c64f 22425cf_by='$cf_by'
b4eb6b3d 22426cf_email='$cf_email'
5f80c64f 22427cf_time='$cf_time'
c193ef60
MB
22428charbits='$charbits'
22429charsize='$charsize'
5f80c64f
JH
22430chgrp='$chgrp'
22431chmod='$chmod'
22432chown='$chown'
b4eb6b3d 22433clocktype='$clocktype'
5f80c64f
JH
22434comm='$comm'
22435compress='$compress'
22436contains='$contains'
22437cp='$cp'
22438cpio='$cpio'
22439cpp='$cpp'
b4eb6b3d
JH
22440cpp_stuff='$cpp_stuff'
22441cppccsymbols='$cppccsymbols'
5f80c64f
JH
22442cppflags='$cppflags'
22443cpplast='$cpplast'
22444cppminus='$cppminus'
22445cpprun='$cpprun'
22446cppstdin='$cppstdin'
b4eb6b3d 22447cppsymbols='$cppsymbols'
10bc17b6 22448crypt_r_proto='$crypt_r_proto'
b4eb6b3d 22449cryptlib='$cryptlib'
5f80c64f 22450csh='$csh'
10bc17b6
JH
22451ctermid_r_proto='$ctermid_r_proto'
22452ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
22453d_Gconvert='$d_Gconvert'
22454d_PRIEUldbl='$d_PRIEUldbl'
22455d_PRIFUldbl='$d_PRIFUldbl'
22456d_PRIGUldbl='$d_PRIGUldbl'
22457d_PRIXU64='$d_PRIXU64'
22458d_PRId64='$d_PRId64'
22459d_PRIeldbl='$d_PRIeldbl'
22460d_PRIfldbl='$d_PRIfldbl'
22461d_PRIgldbl='$d_PRIgldbl'
22462d_PRIi64='$d_PRIi64'
22463d_PRIo64='$d_PRIo64'
22464d_PRIu64='$d_PRIu64'
22465d_PRIx64='$d_PRIx64'
22466d_SCNfldbl='$d_SCNfldbl'
74cac757 22467d__fwalk='$d__fwalk'
b4eb6b3d
JH
22468d_access='$d_access'
22469d_accessx='$d_accessx'
55954f19 22470d_aintl='$d_aintl'
b4eb6b3d
JH
22471d_alarm='$d_alarm'
22472d_archlib='$d_archlib'
96938616 22473d_asctime64='$d_asctime64'
10bc17b6 22474d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
22475d_atolf='$d_atolf'
22476d_atoll='$d_atoll'
fcdf39cf 22477d_attribute_deprecated='$d_attribute_deprecated'
0dbb1585
AL
22478d_attribute_format='$d_attribute_format'
22479d_attribute_malloc='$d_attribute_malloc'
22480d_attribute_nonnull='$d_attribute_nonnull'
22481d_attribute_noreturn='$d_attribute_noreturn'
22482d_attribute_pure='$d_attribute_pure'
22483d_attribute_unused='$d_attribute_unused'
22484d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
22485d_bcmp='$d_bcmp'
22486d_bcopy='$d_bcopy'
5f80c64f 22487d_bsd='$d_bsd'
b4eb6b3d
JH
22488d_bsdgetpgrp='$d_bsdgetpgrp'
22489d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
22490d_builtin_choose_expr='$d_builtin_choose_expr'
22491d_builtin_expect='$d_builtin_expect'
b4eb6b3d 22492d_bzero='$d_bzero'
a2d23ec2 22493d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
22494d_casti32='$d_casti32'
22495d_castneg='$d_castneg'
22496d_charvspr='$d_charvspr'
22497d_chown='$d_chown'
22498d_chroot='$d_chroot'
22499d_chsize='$d_chsize'
758a5d79 22500d_class='$d_class'
b0a2e8e6 22501d_clearenv='$d_clearenv'
b4eb6b3d 22502d_closedir='$d_closedir'
4e0554ec 22503d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 22504d_const='$d_const'
55954f19 22505d_copysignl='$d_copysignl'
666ea192 22506d_cplusplus='$d_cplusplus'
b4eb6b3d 22507d_crypt='$d_crypt'
10bc17b6 22508d_crypt_r='$d_crypt_r'
b4eb6b3d 22509d_csh='$d_csh'
13cfc98d 22510d_ctermid='$d_ctermid'
10bc17b6 22511d_ctermid_r='$d_ctermid_r'
96938616 22512d_ctime64='$d_ctime64'
10bc17b6 22513d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
22514d_cuserid='$d_cuserid'
22515d_dbl_dig='$d_dbl_dig'
2ef53570 22516d_dbminitproto='$d_dbminitproto'
96938616 22517d_difftime64='$d_difftime64'
b4eb6b3d 22518d_difftime='$d_difftime'
de52168c 22519d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 22520d_dirfd='$d_dirfd'
b4eb6b3d
JH
22521d_dirnamlen='$d_dirnamlen'
22522d_dlerror='$d_dlerror'
5f80c64f 22523d_dlopen='$d_dlopen'
b4eb6b3d
JH
22524d_dlsymun='$d_dlsymun'
22525d_dosuid='$d_dosuid'
10bc17b6 22526d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
22527d_drand48proto='$d_drand48proto'
22528d_dup2='$d_dup2'
22529d_eaccess='$d_eaccess'
22530d_endgrent='$d_endgrent'
10bc17b6 22531d_endgrent_r='$d_endgrent_r'
b4eb6b3d 22532d_endhent='$d_endhent'
10bc17b6 22533d_endhostent_r='$d_endhostent_r'
b4eb6b3d 22534d_endnent='$d_endnent'
10bc17b6 22535d_endnetent_r='$d_endnetent_r'
b4eb6b3d 22536d_endpent='$d_endpent'
10bc17b6 22537d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 22538d_endpwent='$d_endpwent'
10bc17b6 22539d_endpwent_r='$d_endpwent_r'
b4eb6b3d 22540d_endsent='$d_endsent'
10bc17b6 22541d_endservent_r='$d_endservent_r'
b4eb6b3d 22542d_eofnblk='$d_eofnblk'
5f80c64f 22543d_eunice='$d_eunice'
15b61c98 22544d_faststdio='$d_faststdio'
b363b713 22545d_fchdir='$d_fchdir'
b4eb6b3d
JH
22546d_fchmod='$d_fchmod'
22547d_fchown='$d_fchown'
22548d_fcntl='$d_fcntl'
9d9004a9 22549d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
22550d_fd_macros='$d_fd_macros'
22551d_fd_set='$d_fd_set'
22552d_fds_bits='$d_fds_bits'
22553d_fgetpos='$d_fgetpos'
758a5d79
JH
22554d_finite='$d_finite'
22555d_finitel='$d_finitel'
b4eb6b3d
JH
22556d_flexfnam='$d_flexfnam'
22557d_flock='$d_flock'
2ef53570 22558d_flockproto='$d_flockproto'
b4eb6b3d 22559d_fork='$d_fork'
758a5d79 22560d_fp_class='$d_fp_class'
b4eb6b3d 22561d_fpathconf='$d_fpathconf'
758a5d79
JH
22562d_fpclass='$d_fpclass'
22563d_fpclassify='$d_fpclassify'
22564d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
22565d_fpos64_t='$d_fpos64_t'
22566d_frexpl='$d_frexpl'
22567d_fs_data_s='$d_fs_data_s'
22568d_fseeko='$d_fseeko'
22569d_fsetpos='$d_fsetpos'
22570d_fstatfs='$d_fstatfs'
22571d_fstatvfs='$d_fstatvfs'
411ab01c 22572d_fsync='$d_fsync'
b4eb6b3d
JH
22573d_ftello='$d_ftello'
22574d_ftime='$d_ftime'
dc814df1 22575d_futimes='$d_futimes'
e74475c7
MHM
22576d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22577d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
5086dff9 22578d_getaddrinfo='$d_getaddrinfo'
b4eb6b3d
JH
22579d_getcwd='$d_getcwd'
22580d_getespwnam='$d_getespwnam'
22581d_getfsstat='$d_getfsstat'
22582d_getgrent='$d_getgrent'
10bc17b6
JH
22583d_getgrent_r='$d_getgrent_r'
22584d_getgrgid_r='$d_getgrgid_r'
22585d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
22586d_getgrps='$d_getgrps'
22587d_gethbyaddr='$d_gethbyaddr'
22588d_gethbyname='$d_gethbyname'
22589d_gethent='$d_gethent'
22590d_gethname='$d_gethname'
10bc17b6
JH
22591d_gethostbyaddr_r='$d_gethostbyaddr_r'
22592d_gethostbyname_r='$d_gethostbyname_r'
22593d_gethostent_r='$d_gethostent_r'
b4eb6b3d 22594d_gethostprotos='$d_gethostprotos'
4e0554ec 22595d_getitimer='$d_getitimer'
b4eb6b3d 22596d_getlogin='$d_getlogin'
10bc17b6 22597d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
22598d_getmnt='$d_getmnt'
22599d_getmntent='$d_getmntent'
5086dff9 22600d_getnameinfo='$d_getnameinfo'
b4eb6b3d
JH
22601d_getnbyaddr='$d_getnbyaddr'
22602d_getnbyname='$d_getnbyname'
22603d_getnent='$d_getnent'
10bc17b6
JH
22604d_getnetbyaddr_r='$d_getnetbyaddr_r'
22605d_getnetbyname_r='$d_getnetbyname_r'
22606d_getnetent_r='$d_getnetent_r'
b4eb6b3d 22607d_getnetprotos='$d_getnetprotos'
0c0643d0 22608d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
22609d_getpbyname='$d_getpbyname'
22610d_getpbynumber='$d_getpbynumber'
22611d_getpent='$d_getpent'
22612d_getpgid='$d_getpgid'
22613d_getpgrp2='$d_getpgrp2'
22614d_getpgrp='$d_getpgrp'
22615d_getppid='$d_getppid'
22616d_getprior='$d_getprior'
10bc17b6
JH
22617d_getprotobyname_r='$d_getprotobyname_r'
22618d_getprotobynumber_r='$d_getprotobynumber_r'
22619d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
22620d_getprotoprotos='$d_getprotoprotos'
22621d_getprpwnam='$d_getprpwnam'
22622d_getpwent='$d_getpwent'
10bc17b6
JH
22623d_getpwent_r='$d_getpwent_r'
22624d_getpwnam_r='$d_getpwnam_r'
22625d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
22626d_getsbyname='$d_getsbyname'
22627d_getsbyport='$d_getsbyport'
22628d_getsent='$d_getsent'
10bc17b6
JH
22629d_getservbyname_r='$d_getservbyname_r'
22630d_getservbyport_r='$d_getservbyport_r'
22631d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
22632d_getservprotos='$d_getservprotos'
22633d_getspnam='$d_getspnam'
10bc17b6 22634d_getspnam_r='$d_getspnam_r'
b4eb6b3d 22635d_gettimeod='$d_gettimeod'
96938616 22636d_gmtime64='$d_gmtime64'
10bc17b6 22637d_gmtime_r='$d_gmtime_r'
5f80c64f 22638d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
22639d_grpasswd='$d_grpasswd'
22640d_hasmntopt='$d_hasmntopt'
22641d_htonl='$d_htonl'
55954f19 22642d_ilogbl='$d_ilogbl'
f3f1a2d8 22643d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
22644d_index='$d_index'
22645d_inetaton='$d_inetaton'
5086dff9
MB
22646d_inetntop='$d_inetntop'
22647d_inetpton='$d_inetpton'
b4eb6b3d
JH
22648d_int64_t='$d_int64_t'
22649d_isascii='$d_isascii'
758a5d79
JH
22650d_isfinite='$d_isfinite'
22651d_isinf='$d_isinf'
b4eb6b3d
JH
22652d_isnan='$d_isnan'
22653d_isnanl='$d_isnanl'
22654d_killpg='$d_killpg'
22655d_lchown='$d_lchown'
22656d_ldbl_dig='$d_ldbl_dig'
0a0abfba 22657d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 22658d_link='$d_link'
96938616 22659d_localtime64='$d_localtime64'
10bc17b6 22660d_localtime_r='$d_localtime_r'
8572b25d 22661d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
22662d_locconv='$d_locconv'
22663d_lockf='$d_lockf'
22664d_longdbl='$d_longdbl'
22665d_longlong='$d_longlong'
22666d_lseekproto='$d_lseekproto'
22667d_lstat='$d_lstat'
22668d_madvise='$d_madvise'
7dd121ae
MB
22669d_malloc_good_size='$d_malloc_good_size'
22670d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
22671d_mblen='$d_mblen'
22672d_mbstowcs='$d_mbstowcs'
22673d_mbtowc='$d_mbtowc'
22674d_memchr='$d_memchr'
22675d_memcmp='$d_memcmp'
22676d_memcpy='$d_memcpy'
22677d_memmove='$d_memmove'
22678d_memset='$d_memset'
22679d_mkdir='$d_mkdir'
22680d_mkdtemp='$d_mkdtemp'
22681d_mkfifo='$d_mkfifo'
22682d_mkstemp='$d_mkstemp'
22683d_mkstemps='$d_mkstemps'
96938616 22684d_mktime64='$d_mktime64'
b4eb6b3d
JH
22685d_mktime='$d_mktime'
22686d_mmap='$d_mmap'
22687d_modfl='$d_modfl'
e67aeab1 22688d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 22689d_modflproto='$d_modflproto'
b4eb6b3d
JH
22690d_mprotect='$d_mprotect'
22691d_msg='$d_msg'
22692d_msg_ctrunc='$d_msg_ctrunc'
22693d_msg_dontroute='$d_msg_dontroute'
22694d_msg_oob='$d_msg_oob'
22695d_msg_peek='$d_msg_peek'
22696d_msg_proxy='$d_msg_proxy'
22697d_msgctl='$d_msgctl'
22698d_msgget='$d_msgget'
4e0554ec 22699d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
22700d_msgrcv='$d_msgrcv'
22701d_msgsnd='$d_msgsnd'
22702d_msync='$d_msync'
22703d_munmap='$d_munmap'
22704d_mymalloc='$d_mymalloc'
a33f2d9f 22705d_ndbm='$d_ndbm'
e74475c7 22706d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
b4eb6b3d 22707d_nice='$d_nice'
2765b840 22708d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 22709d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 22710d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
22711d_off64_t='$d_off64_t'
22712d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22713d_oldpthreads='$d_oldpthreads'
22714d_oldsock='$d_oldsock'
22715d_open3='$d_open3'
22716d_pathconf='$d_pathconf'
22717d_pause='$d_pause'
22718d_perl_otherlibdirs='$d_perl_otherlibdirs'
22719d_phostname='$d_phostname'
22720d_pipe='$d_pipe'
22721d_poll='$d_poll'
5f80c64f 22722d_portable='$d_portable'
c796e3db
MB
22723d_prctl='$d_prctl'
22724d_prctl_set_name='$d_prctl_set_name'
dcb594bc 22725d_printf_format_null='$d_printf_format_null'
c7aff470 22726d_procselfexe='$d_procselfexe'
233e16ce 22727d_pseudofork='$d_pseudofork'
d6483fcc 22728d_pthread_atfork='$d_pthread_atfork'
58d975c3 22729d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
22730d_pthread_yield='$d_pthread_yield'
22731d_pwage='$d_pwage'
22732d_pwchange='$d_pwchange'
22733d_pwclass='$d_pwclass'
22734d_pwcomment='$d_pwcomment'
22735d_pwexpire='$d_pwexpire'
22736d_pwgecos='$d_pwgecos'
22737d_pwpasswd='$d_pwpasswd'
22738d_pwquota='$d_pwquota'
22739d_qgcvt='$d_qgcvt'
22740d_quad='$d_quad'
10bc17b6
JH
22741d_random_r='$d_random_r'
22742d_readdir64_r='$d_readdir64_r'
b4eb6b3d 22743d_readdir='$d_readdir'
10bc17b6 22744d_readdir_r='$d_readdir_r'
b4eb6b3d 22745d_readlink='$d_readlink'
4e0554ec
JH
22746d_readv='$d_readv'
22747d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
22748d_rename='$d_rename'
22749d_rewinddir='$d_rewinddir'
22750d_rmdir='$d_rmdir'
22751d_safebcpy='$d_safebcpy'
22752d_safemcpy='$d_safemcpy'
22753d_sanemcmp='$d_sanemcmp'
ef9f17be 22754d_sbrkproto='$d_sbrkproto'
55954f19 22755d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
22756d_sched_yield='$d_sched_yield'
22757d_scm_rights='$d_scm_rights'
22758d_seekdir='$d_seekdir'
22759d_select='$d_select'
22760d_sem='$d_sem'
22761d_semctl='$d_semctl'
22762d_semctl_semid_ds='$d_semctl_semid_ds'
22763d_semctl_semun='$d_semctl_semun'
22764d_semget='$d_semget'
22765d_semop='$d_semop'
4e0554ec 22766d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
22767d_setegid='$d_setegid'
22768d_seteuid='$d_seteuid'
22769d_setgrent='$d_setgrent'
10bc17b6 22770d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
22771d_setgrps='$d_setgrps'
22772d_sethent='$d_sethent'
10bc17b6 22773d_sethostent_r='$d_sethostent_r'
4e0554ec 22774d_setitimer='$d_setitimer'
b4eb6b3d
JH
22775d_setlinebuf='$d_setlinebuf'
22776d_setlocale='$d_setlocale'
10bc17b6 22777d_setlocale_r='$d_setlocale_r'
b4eb6b3d 22778d_setnent='$d_setnent'
10bc17b6 22779d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
22780d_setpent='$d_setpent'
22781d_setpgid='$d_setpgid'
22782d_setpgrp2='$d_setpgrp2'
22783d_setpgrp='$d_setpgrp'
22784d_setprior='$d_setprior'
22785d_setproctitle='$d_setproctitle'
10bc17b6 22786d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 22787d_setpwent='$d_setpwent'
10bc17b6 22788d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
22789d_setregid='$d_setregid'
22790d_setresgid='$d_setresgid'
22791d_setresuid='$d_setresuid'
22792d_setreuid='$d_setreuid'
22793d_setrgid='$d_setrgid'
22794d_setruid='$d_setruid'
22795d_setsent='$d_setsent'
10bc17b6 22796d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
22797d_setsid='$d_setsid'
22798d_setvbuf='$d_setvbuf'
22799d_sfio='$d_sfio'
22800d_shm='$d_shm'
22801d_shmat='$d_shmat'
22802d_shmatprototype='$d_shmatprototype'
22803d_shmctl='$d_shmctl'
22804d_shmdt='$d_shmdt'
22805d_shmget='$d_shmget'
22806d_sigaction='$d_sigaction'
ed140128 22807d_signbit='$d_signbit'
983dbef6 22808d_sigprocmask='$d_sigprocmask'
b4eb6b3d 22809d_sigsetjmp='$d_sigsetjmp'
c95d0e17 22810d_sitearch='$d_sitearch'
4f5da3e9 22811d_snprintf='$d_snprintf'
49a78c82 22812d_sockatmark='$d_sockatmark'
2ef53570 22813d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
22814d_socket='$d_socket'
22815d_socklen_t='$d_socklen_t'
22816d_sockpair='$d_sockpair'
22817d_socks5_init='$d_socks5_init'
360321b3 22818d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 22819d_sqrtl='$d_sqrtl'
10bc17b6
JH
22820d_srand48_r='$d_srand48_r'
22821d_srandom_r='$d_srandom_r'
eef837ea 22822d_sresgproto='$d_sresgproto'
640374d0 22823d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
22824d_statblks='$d_statblks'
22825d_statfs_f_flags='$d_statfs_f_flags'
22826d_statfs_s='$d_statfs_s'
17a6c8e3 22827d_static_inline='$d_static_inline'
b4eb6b3d
JH
22828d_statvfs='$d_statvfs'
22829d_stdio_cnt_lval='$d_stdio_cnt_lval'
22830d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
22831d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22832d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
22833d_stdio_stream_array='$d_stdio_stream_array'
22834d_stdiobase='$d_stdiobase'
22835d_stdstdio='$d_stdstdio'
22836d_strchr='$d_strchr'
22837d_strcoll='$d_strcoll'
22838d_strctcpy='$d_strctcpy'
22839d_strerrm='$d_strerrm'
22840d_strerror='$d_strerror'
10bc17b6 22841d_strerror_r='$d_strerror_r'
b3c85772 22842d_strftime='$d_strftime'
08c92000
MB
22843d_strlcat='$d_strlcat'
22844d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
22845d_strtod='$d_strtod'
22846d_strtol='$d_strtol'
22847d_strtold='$d_strtold'
22848d_strtoll='$d_strtoll'
28e5dec8 22849d_strtoq='$d_strtoq'
b4eb6b3d
JH
22850d_strtoul='$d_strtoul'
22851d_strtoull='$d_strtoull'
22852d_strtouq='$d_strtouq'
22853d_strxfrm='$d_strxfrm'
22854d_suidsafe='$d_suidsafe'
22855d_symlink='$d_symlink'
22856d_syscall='$d_syscall'
2ef53570 22857d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
22858d_sysconf='$d_sysconf'
22859d_sysernlst='$d_sysernlst'
22860d_syserrlst='$d_syserrlst'
22861d_system='$d_system'
22862d_tcgetpgrp='$d_tcgetpgrp'
22863d_tcsetpgrp='$d_tcsetpgrp'
22864d_telldir='$d_telldir'
22865d_telldirproto='$d_telldirproto'
22866d_time='$d_time'
cbb9e8a7 22867d_timegm='$d_timegm'
b4eb6b3d 22868d_times='$d_times'
14b90194
JH
22869d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22870d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 22871d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 22872d_truncate='$d_truncate'
10bc17b6 22873d_ttyname_r='$d_ttyname_r'
b4eb6b3d 22874d_tzname='$d_tzname'
4e0554ec
JH
22875d_u32align='$d_u32align'
22876d_ualarm='$d_ualarm'
b4eb6b3d
JH
22877d_umask='$d_umask'
22878d_uname='$d_uname'
22879d_union_semun='$d_union_semun'
758a5d79 22880d_unordered='$d_unordered'
bdf33aa7 22881d_unsetenv='$d_unsetenv'
4e0554ec 22882d_usleep='$d_usleep'
2ef53570 22883d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
22884d_ustat='$d_ustat'
22885d_vendorarch='$d_vendorarch'
22886d_vendorbin='$d_vendorbin'
22887d_vendorlib='$d_vendorlib'
6e1038e0 22888d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
22889d_vfork='$d_vfork'
22890d_void_closedir='$d_void_closedir'
22891d_voidsig='$d_voidsig'
22892d_voidtty='$d_voidtty'
22893d_volatile='$d_volatile'
22894d_vprintf='$d_vprintf'
4f5da3e9 22895d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
22896d_wait4='$d_wait4'
22897d_waitpid='$d_waitpid'
22898d_wcstombs='$d_wcstombs'
22899d_wctomb='$d_wctomb'
4e0554ec 22900d_writev='$d_writev'
5f80c64f
JH
22901d_xenix='$d_xenix'
22902date='$date'
b4eb6b3d
JH
22903db_hashtype='$db_hashtype'
22904db_prefixtype='$db_prefixtype'
640374d0
JH
22905db_version_major='$db_version_major'
22906db_version_minor='$db_version_minor'
22907db_version_patch='$db_version_patch'
b4eb6b3d
JH
22908defvoidused='$defvoidused'
22909direntrytype='$direntrytype'
22910dlext='$dlext'
5f80c64f 22911dlsrc='$dlsrc'
b4eb6b3d
JH
22912doublesize='$doublesize'
22913drand01='$drand01'
10bc17b6 22914drand48_r_proto='$drand48_r_proto'
5ac1e9b2 22915dtrace='$dtrace'
b4eb6b3d
JH
22916dynamic_ext='$dynamic_ext'
22917eagain='$eagain'
22918ebcdic='$ebcdic'
5f80c64f
JH
22919echo='$echo'
22920egrep='$egrep'
22921emacs='$emacs'
10bc17b6
JH
22922endgrent_r_proto='$endgrent_r_proto'
22923endhostent_r_proto='$endhostent_r_proto'
22924endnetent_r_proto='$endnetent_r_proto'
22925endprotoent_r_proto='$endprotoent_r_proto'
22926endpwent_r_proto='$endpwent_r_proto'
22927endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
22928eunicefix='$eunicefix'
22929exe_ext='$exe_ext'
22930expr='$expr'
b4eb6b3d 22931extensions='$extensions'
61c26d18 22932extern_C='$extern_C'
6fcddf3b 22933extras='$extras'
b4eb6b3d
JH
22934fflushNULL='$fflushNULL'
22935fflushall='$fflushall'
5f80c64f
JH
22936find='$find'
22937firstmakefile='$firstmakefile'
22938flex='$flex'
b4eb6b3d
JH
22939fpossize='$fpossize'
22940fpostype='$fpostype'
22941freetype='$freetype'
5440bc8e 22942from='$from'
b4eb6b3d
JH
22943full_ar='$full_ar'
22944full_csh='$full_csh'
22945full_sed='$full_sed'
2d736872 22946gccansipedantic='$gccansipedantic'
5b463ca7 22947gccosandvers='$gccosandvers'
5f80c64f 22948gccversion='$gccversion'
10bc17b6
JH
22949getgrent_r_proto='$getgrent_r_proto'
22950getgrgid_r_proto='$getgrgid_r_proto'
22951getgrnam_r_proto='$getgrnam_r_proto'
22952gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22953gethostbyname_r_proto='$gethostbyname_r_proto'
22954gethostent_r_proto='$gethostent_r_proto'
22955getlogin_r_proto='$getlogin_r_proto'
22956getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22957getnetbyname_r_proto='$getnetbyname_r_proto'
22958getnetent_r_proto='$getnetent_r_proto'
22959getprotobyname_r_proto='$getprotobyname_r_proto'
22960getprotobynumber_r_proto='$getprotobynumber_r_proto'
22961getprotoent_r_proto='$getprotoent_r_proto'
22962getpwent_r_proto='$getpwent_r_proto'
22963getpwnam_r_proto='$getpwnam_r_proto'
22964getpwuid_r_proto='$getpwuid_r_proto'
22965getservbyname_r_proto='$getservbyname_r_proto'
22966getservbyport_r_proto='$getservbyport_r_proto'
22967getservent_r_proto='$getservent_r_proto'
22968getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
22969gidformat='$gidformat'
22970gidsign='$gidsign'
22971gidsize='$gidsize'
22972gidtype='$gidtype'
5f80c64f 22973glibpth='$glibpth'
3c728e00 22974gmake='$gmake'
10bc17b6 22975gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 22976gnulibc_version='$gnulibc_version'
5f80c64f 22977grep='$grep'
b4eb6b3d
JH
22978groupcat='$groupcat'
22979groupstype='$groupstype'
5f80c64f 22980gzip='$gzip'
b4eb6b3d
JH
22981h_fcntl='$h_fcntl'
22982h_sysfile='$h_sysfile'
5f80c64f 22983hint='$hint'
b4eb6b3d 22984hostcat='$hostcat'
6e1038e0
MB
22985html1dir='$html1dir'
22986html1direxp='$html1direxp'
22987html3dir='$html3dir'
22988html3direxp='$html3direxp'
b4eb6b3d
JH
22989i16size='$i16size'
22990i16type='$i16type'
22991i32size='$i32size'
22992i32type='$i32type'
22993i64size='$i64size'
22994i64type='$i64type'
22995i8size='$i8size'
22996i8type='$i8type'
22997i_arpainet='$i_arpainet'
2a0de2c5 22998i_assert='$i_assert'
b4eb6b3d 22999i_bsdioctl='$i_bsdioctl'
10bc17b6 23000i_crypt='$i_crypt'
b4eb6b3d
JH
23001i_db='$i_db'
23002i_dbm='$i_dbm'
23003i_dirent='$i_dirent'
5f80c64f 23004i_dld='$i_dld'
b4eb6b3d
JH
23005i_dlfcn='$i_dlfcn'
23006i_fcntl='$i_fcntl'
23007i_float='$i_float'
758a5d79
JH
23008i_fp='$i_fp'
23009i_fp_class='$i_fp_class'
b4eb6b3d 23010i_gdbm='$i_gdbm'
a33f2d9f
AD
23011i_gdbm_ndbm='$i_gdbm_ndbm'
23012i_gdbmndbm='$i_gdbmndbm'
b4eb6b3d 23013i_grp='$i_grp'
b4eb6b3d
JH
23014i_ieeefp='$i_ieeefp'
23015i_inttypes='$i_inttypes'
2765b840 23016i_langinfo='$i_langinfo'
b4eb6b3d
JH
23017i_libutil='$i_libutil'
23018i_limits='$i_limits'
23019i_locale='$i_locale'
23020i_machcthr='$i_machcthr'
23021i_malloc='$i_malloc'
1cd66f7c 23022i_mallocmalloc='$i_mallocmalloc'
b4eb6b3d
JH
23023i_math='$i_math'
23024i_memory='$i_memory'
23025i_mntent='$i_mntent'
23026i_ndbm='$i_ndbm'
23027i_netdb='$i_netdb'
23028i_neterrno='$i_neterrno'
23029i_netinettcp='$i_netinettcp'
23030i_niin='$i_niin'
23031i_poll='$i_poll'
23032i_prot='$i_prot'
23033i_pthread='$i_pthread'
23034i_pwd='$i_pwd'
23035i_rpcsvcdbm='$i_rpcsvcdbm'
23036i_sfio='$i_sfio'
23037i_sgtty='$i_sgtty'
23038i_shadow='$i_shadow'
23039i_socks='$i_socks'
23040i_stdarg='$i_stdarg'
23041i_stddef='$i_stddef'
23042i_stdlib='$i_stdlib'
23043i_string='$i_string'
23044i_sunmath='$i_sunmath'
23045i_sysaccess='$i_sysaccess'
23046i_sysdir='$i_sysdir'
23047i_sysfile='$i_sysfile'
23048i_sysfilio='$i_sysfilio'
23049i_sysin='$i_sysin'
23050i_sysioctl='$i_sysioctl'
23051i_syslog='$i_syslog'
23052i_sysmman='$i_sysmman'
23053i_sysmode='$i_sysmode'
23054i_sysmount='$i_sysmount'
23055i_sysndir='$i_sysndir'
23056i_sysparam='$i_sysparam'
216dac04 23057i_syspoll='$i_syspoll'
b4eb6b3d
JH
23058i_sysresrc='$i_sysresrc'
23059i_syssecrt='$i_syssecrt'
23060i_sysselct='$i_sysselct'
23061i_syssockio='$i_syssockio'
23062i_sysstat='$i_sysstat'
23063i_sysstatfs='$i_sysstatfs'
23064i_sysstatvfs='$i_sysstatvfs'
23065i_systime='$i_systime'
23066i_systimek='$i_systimek'
23067i_systimes='$i_systimes'
23068i_systypes='$i_systypes'
23069i_sysuio='$i_sysuio'
23070i_sysun='$i_sysun'
23071i_sysutsname='$i_sysutsname'
23072i_sysvfs='$i_sysvfs'
23073i_syswait='$i_syswait'
23074i_termio='$i_termio'
23075i_termios='$i_termios'
23076i_time='$i_time'
23077i_unistd='$i_unistd'
23078i_ustat='$i_ustat'
23079i_utime='$i_utime'
23080i_values='$i_values'
23081i_varargs='$i_varargs'
23082i_varhdr='$i_varhdr'
23083i_vfork='$i_vfork'
5f80c64f 23084ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
23085inc_version_list='$inc_version_list'
23086inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
23087incpath='$incpath'
23088inews='$inews'
f3f1a2d8 23089initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
23090installarchlib='$installarchlib'
23091installbin='$installbin'
6e1038e0
MB
23092installhtml1dir='$installhtml1dir'
23093installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
23094installman1dir='$installman1dir'
23095installman3dir='$installman3dir'
23096installprefix='$installprefix'
23097installprefixexp='$installprefixexp'
23098installprivlib='$installprivlib'
23099installscript='$installscript'
23100installsitearch='$installsitearch'
23101installsitebin='$installsitebin'
8d2cbf27
JH
23102installsitehtml1dir='$installsitehtml1dir'
23103installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 23104installsitelib='$installsitelib'
91e123a8
JH
23105installsiteman1dir='$installsiteman1dir'
23106installsiteman3dir='$installsiteman3dir'
6e1038e0 23107installsitescript='$installsitescript'
b4eb6b3d
JH
23108installstyle='$installstyle'
23109installusrbinperl='$installusrbinperl'
23110installvendorarch='$installvendorarch'
23111installvendorbin='$installvendorbin'
8d2cbf27
JH
23112installvendorhtml1dir='$installvendorhtml1dir'
23113installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 23114installvendorlib='$installvendorlib'
91e123a8
JH
23115installvendorman1dir='$installvendorman1dir'
23116installvendorman3dir='$installvendorman3dir'
6e1038e0 23117installvendorscript='$installvendorscript'
b4eb6b3d 23118intsize='$intsize'
4b661809 23119issymlink='$issymlink'
b4eb6b3d
JH
23120ivdformat='$ivdformat'
23121ivsize='$ivsize'
23122ivtype='$ivtype'
23123known_extensions='$known_extensions'
5f80c64f 23124ksh='$ksh'
5f80c64f
JH
23125ld='$ld'
23126lddlflags='$lddlflags'
23127ldflags='$ldflags'
b4eb6b3d
JH
23128ldflags_uselargefiles='$ldflags_uselargefiles'
23129ldlibpthname='$ldlibpthname'
5f80c64f
JH
23130less='$less'
23131lib_ext='$lib_ext'
23132libc='$libc'
b4eb6b3d 23133libperl='$libperl'
5f80c64f
JH
23134libpth='$libpth'
23135libs='$libs'
43999f95
JH
23136libsdirs='$libsdirs'
23137libsfiles='$libsfiles'
23138libsfound='$libsfound'
13b3f787 23139libspath='$libspath'
5f80c64f 23140libswanted='$libswanted'
b4eb6b3d 23141libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
23142line='$line'
23143lint='$lint'
23144lkflags='$lkflags'
23145ln='$ln'
23146lns='$lns'
10bc17b6 23147localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
23148locincpth='$locincpth'
23149loclibpth='$loclibpth'
b4eb6b3d
JH
23150longdblsize='$longdblsize'
23151longlongsize='$longlongsize'
23152longsize='$longsize'
5f80c64f
JH
23153lp='$lp'
23154lpr='$lpr'
23155ls='$ls'
b4eb6b3d
JH
23156lseeksize='$lseeksize'
23157lseektype='$lseektype'
a724edfe 23158mad='$mad'
f3f1a2d8
MB
23159madlyh='$madlyh'
23160madlyobj='$madlyobj'
23161madlysrc='$madlysrc'
5f80c64f
JH
23162mail='$mail'
23163mailx='$mailx'
23164make='$make'
23165make_set_make='$make_set_make'
b4eb6b3d
JH
23166mallocobj='$mallocobj'
23167mallocsrc='$mallocsrc'
23168malloctype='$malloctype'
23169man1dir='$man1dir'
23170man1direxp='$man1direxp'
23171man1ext='$man1ext'
23172man3dir='$man3dir'
23173man3direxp='$man3direxp'
23174man3ext='$man3ext'
5f80c64f 23175mips_type='$mips_type'
5129fff4 23176mistrustnm='$mistrustnm'
5f80c64f 23177mkdir='$mkdir'
b4eb6b3d
JH
23178mmaptype='$mmaptype'
23179modetype='$modetype'
5f80c64f 23180more='$more'
b4eb6b3d 23181multiarch='$multiarch'
5f80c64f 23182mv='$mv'
b4eb6b3d
JH
23183myarchname='$myarchname'
23184mydomain='$mydomain'
23185myhostname='$myhostname'
5f80c64f
JH
23186myuname='$myuname'
23187n='$n'
2cc61e15 23188need_va_copy='$need_va_copy'
b4eb6b3d
JH
23189netdb_hlen_type='$netdb_hlen_type'
23190netdb_host_type='$netdb_host_type'
23191netdb_name_type='$netdb_name_type'
23192netdb_net_type='$netdb_net_type'
5f80c64f
JH
23193nm='$nm'
23194nm_opt='$nm_opt'
23195nm_so_opt='$nm_so_opt'
b4eb6b3d 23196nonxs_ext='$nonxs_ext'
5f80c64f 23197nroff='$nroff'
b4eb6b3d
JH
23198nvEUformat='$nvEUformat'
23199nvFUformat='$nvFUformat'
23200nvGUformat='$nvGUformat'
b68c599a 23201nv_overflows_integers_at='$nv_overflows_integers_at'
53133ed1 23202nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
23203nveformat='$nveformat'
23204nvfformat='$nvfformat'
23205nvgformat='$nvgformat'
23206nvsize='$nvsize'
23207nvtype='$nvtype'
23208o_nonblock='$o_nonblock'
5f80c64f 23209obj_ext='$obj_ext'
b4eb6b3d 23210old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 23211optimize='$optimize'
b4eb6b3d 23212orderlib='$orderlib'
5f80c64f
JH
23213osname='$osname'
23214osvers='$osvers'
b4eb6b3d 23215otherlibdirs='$otherlibdirs'
5f80c64f 23216package='$package'
b4eb6b3d
JH
23217pager='$pager'
23218passcat='$passcat'
23219patchlevel='$patchlevel'
5f80c64f 23220path_sep='$path_sep'
b4eb6b3d 23221perl5='$perl5'
5f80c64f 23222perl='$perl'
151e6568 23223perl_patchlevel='$perl_patchlevel'
17a6c8e3 23224perl_static_inline='$perl_static_inline'
b4eb6b3d 23225perladmin='$perladmin'
9c839522 23226perllibs='$perllibs'
b4eb6b3d 23227perlpath='$perlpath'
5f80c64f 23228pg='$pg'
b4eb6b3d
JH
23229phostname='$phostname'
23230pidtype='$pidtype'
5f80c64f
JH
23231plibpth='$plibpth'
23232pmake='$pmake'
23233pr='$pr'
b4eb6b3d
JH
23234prefix='$prefix'
23235prefixexp='$prefixexp'
23236privlib='$privlib'
23237privlibexp='$privlibexp'
f24dbf84 23238procselfexe='$procselfexe'
b4eb6b3d
JH
23239prototype='$prototype'
23240ptrsize='$ptrsize'
23241quadkind='$quadkind'
23242quadtype='$quadtype'
23243randbits='$randbits'
23244randfunc='$randfunc'
10bc17b6 23245random_r_proto='$random_r_proto'
b4eb6b3d
JH
23246randseedtype='$randseedtype'
23247ranlib='$ranlib'
23248rd_nodata='$rd_nodata'
10bc17b6
JH
23249readdir64_r_proto='$readdir64_r_proto'
23250readdir_r_proto='$readdir_r_proto'
b4eb6b3d 23251revision='$revision'
5f80c64f 23252rm='$rm'
5b813a60 23253rm_try='$rm_try'
5f80c64f 23254rmail='$rmail'
5440bc8e 23255run='$run'
5f80c64f 23256runnm='$runnm'
81c4fd9e
MB
23257sGMTIME_max='$sGMTIME_max'
23258sGMTIME_min='$sGMTIME_min'
73e6e416
MB
23259sLOCALTIME_max='$sLOCALTIME_max'
23260sLOCALTIME_min='$sLOCALTIME_min'
b4eb6b3d
JH
23261sPRIEUldbl='$sPRIEUldbl'
23262sPRIFUldbl='$sPRIFUldbl'
23263sPRIGUldbl='$sPRIGUldbl'
23264sPRIXU64='$sPRIXU64'
23265sPRId64='$sPRId64'
23266sPRIeldbl='$sPRIeldbl'
23267sPRIfldbl='$sPRIfldbl'
23268sPRIgldbl='$sPRIgldbl'
23269sPRIi64='$sPRIi64'
23270sPRIo64='$sPRIo64'
23271sPRIu64='$sPRIu64'
23272sPRIx64='$sPRIx64'
23273sSCNfldbl='$sSCNfldbl'
23274sched_yield='$sched_yield'
23275scriptdir='$scriptdir'
23276scriptdirexp='$scriptdirexp'
5f80c64f 23277sed='$sed'
b4eb6b3d
JH
23278seedfunc='$seedfunc'
23279selectminbits='$selectminbits'
23280selecttype='$selecttype'
5f80c64f 23281sendmail='$sendmail'
10bc17b6
JH
23282setgrent_r_proto='$setgrent_r_proto'
23283sethostent_r_proto='$sethostent_r_proto'
23284setlocale_r_proto='$setlocale_r_proto'
23285setnetent_r_proto='$setnetent_r_proto'
23286setprotoent_r_proto='$setprotoent_r_proto'
23287setpwent_r_proto='$setpwent_r_proto'
23288setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
23289sh='$sh'
23290shar='$shar'
23291sharpbang='$sharpbang'
b4eb6b3d
JH
23292shmattype='$shmattype'
23293shortsize='$shortsize'
23294shrpenv='$shrpenv'
5f80c64f 23295shsharp='$shsharp'
b4eb6b3d
JH
23296sig_count='$sig_count'
23297sig_name='$sig_name'
23298sig_name_init='$sig_name_init'
23299sig_num='$sig_num'
23300sig_num_init='$sig_num_init'
76d3c696 23301sig_size='$sig_size'
b4eb6b3d
JH
23302signal_t='$signal_t'
23303sitearch='$sitearch'
23304sitearchexp='$sitearchexp'
23305sitebin='$sitebin'
23306sitebinexp='$sitebinexp'
8d2cbf27
JH
23307sitehtml1dir='$sitehtml1dir'
23308sitehtml1direxp='$sitehtml1direxp'
23309sitehtml3dir='$sitehtml3dir'
23310sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
23311sitelib='$sitelib'
23312sitelib_stem='$sitelib_stem'
23313sitelibexp='$sitelibexp'
91e123a8
JH
23314siteman1dir='$siteman1dir'
23315siteman1direxp='$siteman1direxp'
23316siteman3dir='$siteman3dir'
23317siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
23318siteprefix='$siteprefix'
23319siteprefixexp='$siteprefixexp'
6e1038e0
MB
23320sitescript='$sitescript'
23321sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
23322sizesize='$sizesize'
23323sizetype='$sizetype'
5f80c64f
JH
23324sleep='$sleep'
23325smail='$smail'
5f80c64f 23326so='$so'
b4eb6b3d
JH
23327sockethdr='$sockethdr'
23328socketlib='$socketlib'
23329socksizetype='$socksizetype'
5f80c64f
JH
23330sort='$sort'
23331spackage='$spackage'
23332spitshell='$spitshell'
10bc17b6
JH
23333srand48_r_proto='$srand48_r_proto'
23334srandom_r_proto='$srandom_r_proto'
5f80c64f 23335src='$src'
b4eb6b3d
JH
23336ssizetype='$ssizetype'
23337startperl='$startperl'
5f80c64f 23338startsh='$startsh'
b4eb6b3d
JH
23339static_ext='$static_ext'
23340stdchar='$stdchar'
23341stdio_base='$stdio_base'
23342stdio_bufsiz='$stdio_bufsiz'
23343stdio_cnt='$stdio_cnt'
23344stdio_filbuf='$stdio_filbuf'
23345stdio_ptr='$stdio_ptr'
23346stdio_stream_array='$stdio_stream_array'
10bc17b6 23347strerror_r_proto='$strerror_r_proto'
b4eb6b3d 23348strings='$strings'
5f80c64f 23349submit='$submit'
b4eb6b3d
JH
23350subversion='$subversion'
23351sysman='$sysman'
5f80c64f
JH
23352tail='$tail'
23353tar='$tar'
5440bc8e 23354targetarch='$targetarch'
5f80c64f
JH
23355tbl='$tbl'
23356tee='$tee'
23357test='$test'
b4eb6b3d
JH
23358timeincl='$timeincl'
23359timetype='$timetype'
10bc17b6 23360tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 23361to='$to'
5f80c64f
JH
23362touch='$touch'
23363tr='$tr'
23364trnl='$trnl'
23365troff='$troff'
10bc17b6 23366ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
23367u16size='$u16size'
23368u16type='$u16type'
23369u32size='$u32size'
23370u32type='$u32type'
23371u64size='$u64size'
23372u64type='$u64type'
23373u8size='$u8size'
23374u8type='$u8type'
23375uidformat='$uidformat'
23376uidsign='$uidsign'
23377uidsize='$uidsize'
23378uidtype='$uidtype'
5f80c64f
JH
23379uname='$uname'
23380uniq='$uniq'
b4eb6b3d
JH
23381uquadtype='$uquadtype'
23382use5005threads='$use5005threads'
23383use64bitall='$use64bitall'
23384use64bitint='$use64bitint'
5440bc8e 23385usecrosscompile='$usecrosscompile'
1be1b388 23386usedevel='$usedevel'
5f80c64f 23387usedl='$usedl'
5ac1e9b2 23388usedtrace='$usedtrace'
15b61c98 23389usefaststdio='$usefaststdio'
b4eb6b3d
JH
23390useithreads='$useithreads'
23391uselargefiles='$uselargefiles'
23392uselongdouble='$uselongdouble'
19a100ff 23393usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
23394usemorebits='$usemorebits'
23395usemultiplicity='$usemultiplicity'
23396usemymalloc='$usemymalloc'
5f80c64f 23397usenm='$usenm'
b4eb6b3d
JH
23398useopcode='$useopcode'
23399useperlio='$useperlio'
23400useposix='$useposix'
9514c62b 23401usereentrant='$usereentrant'
d51aaa9d 23402userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
23403usesfio='$usesfio'
23404useshrplib='$useshrplib'
5f106f9c 23405usesitecustomize='$usesitecustomize'
29209bc5 23406usesocks='$usesocks'
b4eb6b3d
JH
23407usethreads='$usethreads'
23408usevendorprefix='$usevendorprefix'
23409usevfork='$usevfork'
5f80c64f
JH
23410usrinc='$usrinc'
23411uuname='$uuname'
b4eb6b3d
JH
23412uvXUformat='$uvXUformat'
23413uvoformat='$uvoformat'
23414uvsize='$uvsize'
23415uvtype='$uvtype'
23416uvuformat='$uvuformat'
23417uvxformat='$uvxformat'
d03b3b00 23418vaproto='$vaproto'
b4eb6b3d
JH
23419vendorarch='$vendorarch'
23420vendorarchexp='$vendorarchexp'
23421vendorbin='$vendorbin'
23422vendorbinexp='$vendorbinexp'
8d2cbf27
JH
23423vendorhtml1dir='$vendorhtml1dir'
23424vendorhtml1direxp='$vendorhtml1direxp'
23425vendorhtml3dir='$vendorhtml3dir'
23426vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
23427vendorlib='$vendorlib'
23428vendorlib_stem='$vendorlib_stem'
23429vendorlibexp='$vendorlibexp'
91e123a8
JH
23430vendorman1dir='$vendorman1dir'
23431vendorman1direxp='$vendorman1direxp'
23432vendorman3dir='$vendorman3dir'
23433vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
23434vendorprefix='$vendorprefix'
23435vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
23436vendorscript='$vendorscript'
23437vendorscriptexp='$vendorscriptexp'
b4eb6b3d 23438version='$version'
861eb78d 23439version_patchlevel_string='$version_patchlevel_string'
d56c5707 23440versiononly='$versiononly'
5f80c64f 23441vi='$vi'
b4eb6b3d 23442voidflags='$voidflags'
5f80c64f 23443xlibpth='$xlibpth'
3659ebf1
JH
23444yacc='$yacc'
23445yaccflags='$yaccflags'
5f80c64f
JH
23446zcat='$zcat'
23447zip='$zip'
23448EOT
23449
5f80c64f
JH
23450: add special variables
23451$test -f $src/patchlevel.h && \
d9421656 23452awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
0f04e85f 23453echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
a02608de 23454echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
23455
23456: propagate old symbols
23457if $test -f UU/config.sh; then
381aa1ff 23458 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
776a38e3
MB
23459 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23460 config.sh config.sh UU/oldconfig.sh |\
23461 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
23462 set X `cat UU/oldsyms`
23463 shift
23464 case $# in
23465 0) ;;
23466 *)
23467 cat <<EOM
23468Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23469EOM
776a38e3 23470 echo ": Variables propagated from previous config.sh file." >>config.sh
5f80c64f
JH
23471 for sym in `cat UU/oldsyms`; do
23472 echo " Propagating $hint variable "'$'"$sym..."
23473 eval 'tmp="$'"${sym}"'"'
23474 echo "$tmp" | \
23475 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23476 done
23477 ;;
23478 esac
23479fi
23480
23481: Finish up by extracting the .SH files
23482case "$alldone" in
23483exit)
23484 $rm -rf UU
24ccb310 23485 echo "Extraction done."
5f80c64f
JH
23486 exit 0
23487 ;;
23488cont)
23489 ;;
23490'')
23491 dflt=''
23492 nostick=true
23493 $cat <<EOM
23494
23495If you'd like to make any changes to the config.sh file before I begin
23496to configure things, do it as a shell escape now (e.g. !vi config.sh).
23497
23498EOM
23499 rp="Press return or use a shell escape to edit config.sh:"
23500 . UU/myread
23501 nostick=''
23502 case "$ans" in
23503 '') ;;
23504 *) : in case they cannot read
23505 sh 1>&4 -c "$ans";;
23506 esac
23507 ;;
23508esac
23509
23510: if this fails, just run all the .SH files by hand
23511. ./config.sh
23512
23513echo " "
23514exec 1>&4
a43e8593 23515pwd=`pwd`
5f80c64f 23516. ./UU/extract
6904989c 23517cd "$pwd"
5f80c64f
JH
23518
23519if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23520 dflt=y
23521 case "$silent" in
23522 true) ;;
23523 *)
23524 $cat <<EOM
23525
23526Now you need to generate make dependencies by running "$make depend".
23527You might prefer to run it in background: "$make depend > makedepend.out &"
23528It can take a while, so you might not want to run it right now.
23529
23530EOM
23531 ;;
23532 esac
23533 rp="Run $make depend now?"
23534 . UU/myread
23535 case "$ans" in
23536 y*)
3d5d58b1 23537 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
23538 ;;
23539 *)
23540 echo "You must run '$make depend' then '$make'."
23541 ;;
23542 esac
23543elif test -f [Mm]akefile; then
23544 echo " "
23545 echo "Now you must run a $make."
23546else
24ccb310 23547 echo "Configure done."
5f80c64f
JH
23548fi
23549
23550if $test -f Policy.sh; then
23551 $cat <<EOM
23552
23553If you compile $package on a different machine or from a different object
23554directory, copy the Policy.sh file from this object directory to the
23555new one before you run Configure -- this will help you with most of
23556the policy defaults.
23557
23558EOM
23559fi
23560if $test -f config.msg; then
23561 echo "Hmm. I also noted the following information while running:"
23562 echo " "
23563 $cat config.msg >&4
23564 $rm -f config.msg
23565fi
23566$rm -f kit*isdone ark*isdone
23567$rm -rf UU
23568
23569: End of Configure
23570