This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Note that I TODID most of parallel testing in the core.
[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#
5cadb3f3
MB
19#
20# Though this script was generated by metaconfig, it is OK to send
21# patches against it. It's up to the Configure pumpkin to backport
22# the patch to the metaunits if it is accepted.
23# See Porting/pumpkin.pod for more information on metaconfig.
24#
2304df62 25
613d6c3e 26# $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
2304df62 27#
1d40d392 28# Generated on Fri Aug 8 16:16:43 CEST 2008 [metaconfig 3.5 PL0]
7f2de2d2 29# (with additional metaconfig patches by perlbug@perl.org)
2304df62 30
283fdd21 31cat >c1$$ <<EOF
2304df62
AD
32ARGGGHHHH!!!!!
33
34SCO csh still thinks true is false. Write to SCO today and tell them that next
35year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
38we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40[End of diatribe. We now return you to your regularly scheduled programming...]
41EOF
283fdd21 42cat >c2$$ <<EOF
2304df62
AD
43
44OOPS! You naughty creature! You didn't run Configure with sh!
45I will attempt to remedy the situation by running sh for you...
46EOF
47
283fdd21 48true || cat c1$$ c2$$
2304df62
AD
49true || exec sh $0 $argv:q
50
283fdd21 51(exit $?0) || cat c2$$
2304df62 52(exit $?0) || exec sh $0 $argv:q
283fdd21 53rm -f c1$$ c2$$
2304df62 54
f6538904 55if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
56 cat >&4 <<EOF
57***
58*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
60*** Please read the README.plan9 for further instructions.
61*** Cannot continue, aborting.
62***
63EOF
64 exit 1
65fi
66
f8e2af1d
MC
67if test ! -c /dev/null ; then
68 cat >&4 <<EOF
69***
70*** I'm sorry, but /dev/null appears to be a file rather than a device.
71*** Please consult your operating sytem's notes for making a device
72*** in /dev.
73*** Cannot continue, aborting.
74***
75EOF
76 exit 1
77fi
78
a0d0e21e
LW
79: compute my invocation name
80me=$0
81case "$0" in
82*/*)
83 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84 test "$me" || me=$0
85 ;;
86esac
87
dfe9444c 88: Proper separator for the PATH environment variable
8e07c86e 89p_=:
613d6c3e 90: On OS/2 this directory should exist if this is not floppy only system ":-]"
5c728af0 91if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
613d6c3e 92 if test -n "$OS2_SHELL"; then
dfe9444c
AD
93 p_=\;
94 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 96 is_os2=yes
c4f23d77 97 elif test -n "$DJGPP"; then
495e2cbe
MB
98 case "X${MACHTYPE:-nonesuchmach}" in
99 *cygwin) ;;
100 *) p_=\; ;;
101 esac
dfe9444c 102 fi
39e571d4 103fi
a0d0e21e
LW
104
105: Proper PATH setting
106paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 107paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 108paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 109paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 110paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 111paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
112paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 114paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
115
116for p in $paths
117do
8e07c86e
AD
118 case "$p_$PATH$p_" in
119 *$p_$p$p_*) ;;
120 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
121 esac
122done
123
8e07c86e 124PATH=.$p_$PATH
2304df62
AD
125export PATH
126
dfe9444c
AD
127: shall we be using ksh?
128inksh=''
129needksh=''
130avoidksh=''
131newsh=/bin/ksh
132changesh=''
ff0cee69 133if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
134 inksh=true
135fi
136if test -f /hp-ux -a -f /bin/ksh; then
137 needksh='to avoid sh bug in "here document" expansion'
138fi
139if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140 if test X`/usr/bin/uname -v` = X4; then
141 avoidksh="to avoid AIX 4's /bin/sh"
142 newsh=/usr/bin/bsh
2304df62 143 fi
dfe9444c 144fi
cf04f91f
JH
145if test -f /osf_boot -a -f /usr/sbin/setld; then
146 if test X`/usr/bin/uname -s` = XOSF1; then
613d6c3e
MB
147 avoidksh="to avoid Digital UNIX' ksh"
148 newsh=/bin/sh
149 unset BIN_SH
cf04f91f
JH
150 fi
151fi
dfe9444c
AD
152case "$inksh/$needksh" in
153/[a-z]*)
c4f23d77 154 ENV=''
dfe9444c
AD
155 changesh=true
156 reason="$needksh"
157 ;;
158esac
159case "$inksh/$avoidksh" in
160true/[a-z]*)
161 changesh=true
162 reason="$avoidksh"
163 ;;
164esac
165case "$inksh/$needksh-$avoidksh-" in
166true/--)
a0d0e21e
LW
167 cat <<EOM
168(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 169mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 170EOM
dfe9444c
AD
171 ;;
172esac
173case "$changesh" in
174true)
2e2a97a6 175 export newsh
dfe9444c
AD
176 echo "(Feeding myself to $newsh $reason.)"
177 case "$0" in
178 Configure|*/Configure) exec $newsh $0 "$@";;
179 *) exec $newsh Configure "$@";;
180 esac
181 ;;
182esac
7730b9f4 183test -x "${newsh}" || unset newsh
2304df62 184
613d6c3e 185: if needed, set CDPATH to a harmless value that is not chatty
bfb7748a
AD
186: avoid bash 2.02 problems with empty CDPATH.
187case "$CDPATH" in
188'') ;;
189*) case "$SHELL" in
613d6c3e
MB
190 *bash*) CDPATH='.' ;;
191 *) CDPATH='' ;;
bfb7748a
AD
192 esac
193 ;;
194esac
613d6c3e 195
2304df62
AD
196: Configure runs within the UU subdirectory
197test -d UU || mkdir UU
8e07c86e 198cd UU && rm -f ./*
2304df62 199
6b356c8e
JH
200ccname=''
201ccversion=''
b4eb6b3d
JH
202ccsymbols=''
203cppccsymbols=''
204cppsymbols=''
5440bc8e
JH
205from=''
206run=''
207targetarch=''
208to=''
209usecrosscompile=''
6b34ded5 210mistrustnm=''
9c839522 211perllibs=''
b4eb6b3d
JH
212dynamic_ext=''
213extensions=''
214known_extensions=''
215nonxs_ext=''
216static_ext=''
217useopcode=''
218useposix=''
6fcddf3b 219extras=''
ecfc5424 220d_bsd=''
40a7a20a 221d_eunice=''
2304df62
AD
222d_xenix=''
223eunicefix=''
dfe9444c 224ar=''
2304df62
AD
225awk=''
226bash=''
227bison=''
228byacc=''
229cat=''
230chgrp=''
231chmod=''
232chown=''
ecfc5424 233comm=''
2304df62
AD
234compress=''
235cp=''
236cpio=''
237cpp=''
238csh=''
239date=''
240echo=''
241egrep=''
242emacs=''
243expr=''
244find=''
245flex=''
3c728e00 246gmake=''
2304df62 247grep=''
8ff267be 248gzip=''
2304df62
AD
249inews=''
250ksh=''
251less=''
252line=''
253lint=''
254ln=''
255lp=''
256lpr=''
257ls=''
258mail=''
259mailx=''
dfe9444c 260make=''
2304df62
AD
261mkdir=''
262more=''
263mv=''
693762b4 264nm=''
2304df62
AD
265nroff=''
266perl=''
267pg=''
268pmake=''
269pr=''
270rm=''
271rmail=''
272sed=''
273sendmail=''
2304df62
AD
274shar=''
275sleep=''
276smail=''
277sort=''
278submit=''
279tail=''
280tar=''
281tbl=''
693762b4 282tee=''
2304df62
AD
283test=''
284touch=''
285tr=''
286troff=''
287uname=''
288uniq=''
289uuname=''
290vi=''
291zcat=''
8ff267be 292zip=''
b4eb6b3d
JH
293full_ar=''
294full_sed=''
a0d0e21e 295libswanted=''
2304df62
AD
296hint=''
297myuname=''
85e6fe83
LW
298osname=''
299osvers=''
2304df62
AD
300Author=''
301Date=''
302Header=''
303Id=''
304Locker=''
305Log=''
306RCSfile=''
307Revision=''
308Source=''
309State=''
dfe9444c
AD
310_a=''
311_exe=''
312_o=''
4633a7c4
LW
313archobjs=''
314exe_ext=''
315firstmakefile=''
316lib_ext=''
317obj_ext=''
318path_sep=''
5b813a60 319rm_try=''
b4eb6b3d 320afs=''
a6d26a0d 321afsroot=''
b4eb6b3d
JH
322alignbytes=''
323ansi2knr=''
324archlib=''
325archlibexp=''
326d_archlib=''
327installarchlib=''
328archname=''
329myarchname=''
330d_atolf=''
331d_atoll=''
332baserev=''
333bin=''
334binexp=''
f3f1a2d8 335initialinstalllocation=''
b4eb6b3d 336installbin=''
f3f1a2d8 337userelocatableinc=''
b4eb6b3d 338byteorder=''
2304df62 339cc=''
2304df62
AD
340ccflags=''
341cppflags=''
342ldflags=''
343lkflags=''
8e07c86e 344locincpth=''
2304df62 345optimize=''
b4eb6b3d 346cf_email=''
2304df62
AD
347cf_by=''
348cf_time=''
349contains=''
b4eb6b3d 350cpp_stuff=''
2304df62
AD
351cpplast=''
352cppminus=''
353cpprun=''
354cppstdin=''
74cac757 355d__fwalk=''
b4eb6b3d
JH
356d_access=''
357d_accessx=''
55954f19 358d_aintl=''
b4eb6b3d 359d_alarm=''
10bc17b6
JH
360asctime_r_proto=''
361d_asctime_r=''
0dbb1585
AL
362d_attribute_format=''
363d_attribute_malloc=''
364d_attribute_nonnull=''
365d_attribute_noreturn=''
366d_attribute_pure=''
367d_attribute_unused=''
368d_attribute_warn_unused_result=''
dcb594bc 369d_printf_format_null=''
b4eb6b3d
JH
370d_bcmp=''
371d_bcopy=''
635aebb7
AL
372d_builtin_choose_expr=''
373d_builtin_expect=''
b4eb6b3d 374d_bzero=''
a2d23ec2 375d_c99_variadic_macros=''
b4eb6b3d
JH
376d_casti32=''
377castflags=''
378d_castneg=''
379d_chown=''
380d_chroot=''
381d_chsize=''
758a5d79 382d_class=''
b0a2e8e6 383d_clearenv=''
b4eb6b3d
JH
384d_closedir=''
385d_void_closedir=''
4e0554ec 386d_cmsghdr_s=''
b4eb6b3d 387d_const=''
36adc09b 388d_copysignl=''
666ea192 389d_cplusplus=''
b4eb6b3d
JH
390cryptlib=''
391d_crypt=''
10bc17b6
JH
392crypt_r_proto=''
393d_crypt_r=''
b4eb6b3d
JH
394d_csh=''
395full_csh=''
13cfc98d 396d_ctermid=''
10bc17b6
JH
397ctermid_r_proto=''
398d_ctermid_r=''
399ctime_r_proto=''
400d_ctime_r=''
b4eb6b3d
JH
401d_cuserid=''
402d_dbl_dig=''
2ef53570 403d_dbminitproto=''
b4eb6b3d 404d_difftime=''
de52168c 405d_dir_dd_fd=''
ae0e3d3b 406d_dirfd=''
b4eb6b3d 407d_dlerror=''
a0d0e21e 408d_dlopen=''
b4eb6b3d
JH
409d_dlsymun=''
410d_dosuid=''
411d_suidsafe=''
10bc17b6
JH
412d_drand48_r=''
413drand48_r_proto=''
b4eb6b3d
JH
414d_drand48proto=''
415d_dup2=''
416d_eaccess=''
417d_endgrent=''
10bc17b6
JH
418d_endgrent_r=''
419endgrent_r_proto=''
b4eb6b3d 420d_endhent=''
10bc17b6
JH
421d_endhostent_r=''
422endhostent_r_proto=''
b4eb6b3d 423d_endnent=''
10bc17b6
JH
424d_endnetent_r=''
425endnetent_r_proto=''
b4eb6b3d 426d_endpent=''
10bc17b6
JH
427d_endprotoent_r=''
428endprotoent_r_proto=''
b4eb6b3d 429d_endpwent=''
10bc17b6
JH
430d_endpwent_r=''
431endpwent_r_proto=''
b4eb6b3d 432d_endsent=''
10bc17b6
JH
433d_endservent_r=''
434endservent_r_proto=''
15b61c98 435d_faststdio=''
b363b713 436d_fchdir=''
b4eb6b3d
JH
437d_fchmod=''
438d_fchown=''
439d_fcntl=''
9d9004a9 440d_fcntl_can_lock=''
b4eb6b3d
JH
441d_fd_macros=''
442d_fd_set=''
443d_fds_bits=''
444d_fgetpos=''
758a5d79
JH
445d_finite=''
446d_finitel=''
b4eb6b3d
JH
447d_flexfnam=''
448d_flock=''
2ef53570 449d_flockproto=''
b4eb6b3d 450d_fork=''
758a5d79
JH
451d_fp_class=''
452d_fpclass=''
453d_fpclassify=''
454d_fpclassl=''
b4eb6b3d
JH
455d_fpos64_t=''
456d_frexpl=''
457d_fs_data_s=''
458d_fseeko=''
459d_fsetpos=''
460d_fstatfs=''
411ab01c 461d_fsync=''
b4eb6b3d
JH
462d_ftello=''
463d_ftime=''
464d_gettimeod=''
dc814df1 465d_futimes=''
b4eb6b3d
JH
466d_Gconvert=''
467d_getcwd=''
468d_getespwnam=''
469d_getfsstat=''
470d_getgrent=''
10bc17b6
JH
471d_getgrent_r=''
472getgrent_r_proto=''
473d_getgrgid_r=''
474getgrgid_r_proto=''
475d_getgrnam_r=''
476getgrnam_r_proto=''
b4eb6b3d
JH
477d_getgrps=''
478d_gethbyaddr=''
479d_gethbyname=''
480d_gethent=''
481aphostname=''
482d_gethname=''
483d_phostname=''
484d_uname=''
10bc17b6
JH
485d_gethostbyaddr_r=''
486gethostbyaddr_r_proto=''
487d_gethostbyname_r=''
488gethostbyname_r_proto=''
489d_gethostent_r=''
490gethostent_r_proto=''
b4eb6b3d 491d_gethostprotos=''
4e0554ec 492d_getitimer=''
b4eb6b3d 493d_getlogin=''
10bc17b6
JH
494d_getlogin_r=''
495getlogin_r_proto=''
b4eb6b3d
JH
496d_getmnt=''
497d_getmntent=''
498d_getnbyaddr=''
499d_getnbyname=''
500d_getnent=''
10bc17b6
JH
501d_getnetbyaddr_r=''
502getnetbyaddr_r_proto=''
503d_getnetbyname_r=''
504getnetbyname_r_proto=''
505d_getnetent_r=''
506getnetent_r_proto=''
b4eb6b3d 507d_getnetprotos=''
0c0643d0 508d_getpagsz=''
b4eb6b3d
JH
509d_getpent=''
510d_getpgid=''
511d_getpgrp2=''
512d_bsdgetpgrp=''
513d_getpgrp=''
514d_getppid=''
515d_getprior=''
516d_getpbyname=''
517d_getpbynumber=''
10bc17b6
JH
518d_getprotobyname_r=''
519getprotobyname_r_proto=''
520d_getprotobynumber_r=''
521getprotobynumber_r_proto=''
522d_getprotoent_r=''
523getprotoent_r_proto=''
b4eb6b3d
JH
524d_getprotoprotos=''
525d_getprpwnam=''
526d_getpwent=''
10bc17b6
JH
527d_getpwent_r=''
528getpwent_r_proto=''
529d_getpwnam_r=''
530getpwnam_r_proto=''
531d_getpwuid_r=''
532getpwuid_r_proto=''
b4eb6b3d 533d_getsent=''
10bc17b6
JH
534d_getservbyname_r=''
535getservbyname_r_proto=''
536d_getservbyport_r=''
537getservbyport_r_proto=''
538d_getservent_r=''
539getservent_r_proto=''
b4eb6b3d
JH
540d_getservprotos=''
541d_getspnam=''
10bc17b6
JH
542d_getspnam_r=''
543getspnam_r_proto=''
b4eb6b3d
JH
544d_getsbyname=''
545d_getsbyport=''
10bc17b6
JH
546d_gmtime_r=''
547gmtime_r_proto=''
a4f3eea9 548d_gnulibc=''
5f6e0ee4 549gnulibc_version=''
b4eb6b3d
JH
550d_hasmntopt=''
551d_htonl=''
55954f19 552d_ilogbl=''
b4eb6b3d
JH
553d_inetaton=''
554d_int64_t=''
555d_isascii=''
758a5d79
JH
556d_isfinite=''
557d_isinf=''
b4eb6b3d
JH
558d_isnan=''
559d_isnanl=''
560d_killpg=''
561d_lchown=''
562d_ldbl_dig=''
0a0abfba 563d_libm_lib_version=''
b4eb6b3d 564d_link=''
10bc17b6 565d_localtime_r=''
8572b25d 566d_localtime_r_needs_tzset=''
10bc17b6 567localtime_r_proto=''
b4eb6b3d
JH
568d_locconv=''
569d_lockf=''
570d_longdbl=''
571longdblsize=''
572d_longlong=''
573longlongsize=''
574d_lseekproto=''
575d_lstat=''
576d_madvise=''
7dd121ae
MB
577d_malloc_good_size=''
578d_malloc_size=''
b4eb6b3d
JH
579d_mblen=''
580d_mbstowcs=''
581d_mbtowc=''
582d_memchr=''
583d_memcmp=''
584d_memcpy=''
585d_memmove=''
586d_memset=''
587d_mkdir=''
588d_mkdtemp=''
589d_mkfifo=''
590d_mkstemp=''
591d_mkstemps=''
592d_mktime=''
593d_mmap=''
594mmaptype=''
595d_modfl=''
e67aeab1 596d_modfl_pow32_bug=''
bc9a1b2c 597d_modflproto=''
b4eb6b3d
JH
598d_mprotect=''
599d_msg=''
600d_msgctl=''
601d_msgget=''
4e0554ec 602d_msghdr_s=''
b4eb6b3d
JH
603d_msgrcv=''
604d_msgsnd=''
605d_msync=''
606d_munmap=''
607d_nice=''
2765b840 608d_nl_langinfo=''
b4eb6b3d
JH
609d_off64_t=''
610d_open3=''
611d_fpathconf=''
612d_pathconf=''
613d_pause=''
614d_pipe=''
615d_poll=''
2304df62 616d_portable=''
a33c94aa 617d_procselfexe=''
f24dbf84 618procselfexe=''
b4eb6b3d
JH
619d_old_pthread_create_joinable=''
620old_pthread_create_joinable=''
d6483fcc 621d_pthread_atfork=''
58d975c3 622d_pthread_attr_setscope=''
b4eb6b3d
JH
623d_pthread_yield=''
624d_sched_yield=''
625sched_yield=''
626d_qgcvt=''
10bc17b6
JH
627d_random_r=''
628random_r_proto=''
629d_readdir64_r=''
630readdir64_r_proto=''
b4eb6b3d
JH
631d_readdir=''
632d_rewinddir=''
633d_seekdir=''
634d_telldir=''
10bc17b6
JH
635d_readdir_r=''
636readdir_r_proto=''
b4eb6b3d 637d_readlink=''
4e0554ec
JH
638d_readv=''
639d_recvmsg=''
b4eb6b3d
JH
640d_rename=''
641d_rmdir=''
642d_safebcpy=''
643d_safemcpy=''
644d_sanemcmp=''
ef9f17be 645d_sbrkproto=''
55954f19 646d_scalbnl=''
b4eb6b3d
JH
647d_select=''
648d_sem=''
649d_semctl=''
650d_semget=''
651d_semop=''
4e0554ec 652d_sendmsg=''
b4eb6b3d
JH
653d_setegid=''
654d_seteuid=''
655d_setgrent=''
10bc17b6
JH
656d_setgrent_r=''
657setgrent_r_proto=''
b4eb6b3d
JH
658d_setgrps=''
659d_sethent=''
10bc17b6
JH
660d_sethostent_r=''
661sethostent_r_proto=''
4e0554ec 662d_setitimer=''
b4eb6b3d
JH
663d_setlinebuf=''
664d_setlocale=''
10bc17b6
JH
665d_setlocale_r=''
666setlocale_r_proto=''
b4eb6b3d 667d_setnent=''
10bc17b6
JH
668d_setnetent_r=''
669setnetent_r_proto=''
b4eb6b3d
JH
670d_setpent=''
671d_setpgid=''
672d_setpgrp2=''
673d_bsdsetpgrp=''
674d_setpgrp=''
675d_setprior=''
676d_setproctitle=''
10bc17b6
JH
677d_setprotoent_r=''
678setprotoent_r_proto=''
b4eb6b3d 679d_setpwent=''
10bc17b6
JH
680d_setpwent_r=''
681setpwent_r_proto=''
b4eb6b3d
JH
682d_setregid=''
683d_setresgid=''
684d_setresuid=''
685d_setreuid=''
686d_setrgid=''
687d_setruid=''
688d_setsent=''
10bc17b6
JH
689d_setservent_r=''
690setservent_r_proto=''
b4eb6b3d
JH
691d_setsid=''
692d_setvbuf=''
693d_sfio=''
694usesfio=''
695d_shm=''
696d_shmat=''
697d_shmatprototype=''
698shmattype=''
699d_shmctl=''
700d_shmdt=''
701d_shmget=''
702d_sigaction=''
ed140128 703d_signbit=''
983dbef6 704d_sigprocmask=''
b4eb6b3d 705d_sigsetjmp=''
5f106f9c 706usesitecustomize=''
4f5da3e9
SP
707d_snprintf=''
708d_vsnprintf=''
49a78c82 709d_sockatmark=''
2ef53570 710d_sockatmarkproto=''
b4eb6b3d
JH
711d_msg_ctrunc=''
712d_msg_dontroute=''
713d_msg_oob=''
714d_msg_peek=''
715d_msg_proxy=''
716d_oldsock=''
717d_scm_rights=''
718d_socket=''
719d_sockpair=''
720sockethdr=''
721socketlib=''
722d_socklen_t=''
723d_socks5_init=''
360321b3 724d_sprintf_returns_strlen=''
b4eb6b3d 725d_sqrtl=''
10bc17b6
JH
726d_srand48_r=''
727srand48_r_proto=''
728d_srandom_r=''
729srandom_r_proto=''
eef837ea 730d_sresgproto=''
640374d0 731d_sresuproto=''
b4eb6b3d
JH
732d_statblks=''
733d_statfs_f_flags=''
734d_statfs_s=''
735d_fstatvfs=''
736d_statvfs=''
737d_stdio_cnt_lval=''
738d_stdio_ptr_lval=''
a7ffa9b9
NC
739d_stdio_ptr_lval_nochange_cnt=''
740d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
741d_stdiobase=''
742d_stdstdio=''
743stdio_base=''
744stdio_bufsiz=''
745stdio_cnt=''
746stdio_filbuf=''
747stdio_ptr=''
748d_index=''
749d_strchr=''
750d_strcoll=''
751d_strctcpy=''
752d_strerrm=''
753d_strerror=''
754d_sysernlst=''
755d_syserrlst=''
10bc17b6
JH
756d_strerror_r=''
757strerror_r_proto=''
b3c85772 758d_strftime=''
08c92000
MB
759d_strlcat=''
760d_strlcpy=''
b4eb6b3d
JH
761d_strtod=''
762d_strtol=''
763d_strtold=''
764d_strtoll=''
28e5dec8 765d_strtoq=''
b4eb6b3d
JH
766d_strtoul=''
767d_strtoull=''
768d_strtouq=''
769d_strxfrm=''
770d_symlink=''
771d_syscall=''
2ef53570 772d_syscallproto=''
b4eb6b3d
JH
773d_sysconf=''
774d_system=''
775d_tcgetpgrp=''
776d_tcsetpgrp=''
777d_telldirproto=''
778d_time=''
779timetype=''
cbb9e8a7 780d_timegm=''
b4eb6b3d
JH
781clocktype=''
782d_times=''
10bc17b6
JH
783d_tmpnam_r=''
784tmpnam_r_proto=''
b4eb6b3d 785d_truncate=''
10bc17b6
JH
786d_ttyname_r=''
787ttyname_r_proto=''
b4eb6b3d 788d_tzname=''
4e0554ec
JH
789d_u32align=''
790d_ualarm=''
b4eb6b3d
JH
791d_umask=''
792d_semctl_semid_ds=''
793d_semctl_semun=''
794d_union_semun=''
758a5d79 795d_unordered=''
bdf33aa7 796d_unsetenv=''
4e0554ec 797d_usleep=''
2ef53570 798d_usleepproto=''
b4eb6b3d 799d_ustat=''
233e16ce 800d_pseudofork=''
b4eb6b3d
JH
801d_vfork=''
802usevfork=''
803d_voidsig=''
804signal_t=''
805d_volatile=''
806d_charvspr=''
807d_vprintf=''
808d_wait4=''
809d_waitpid=''
810d_wcstombs=''
811d_wctomb=''
4e0554ec 812d_writev=''
b4eb6b3d 813dlext=''
85e6fe83
LW
814cccdlflags=''
815ccdlflags=''
2304df62 816dlsrc=''
232e078e 817ld=''
85e6fe83 818lddlflags=''
2304df62 819usedl=''
b4eb6b3d
JH
820doublesize=''
821ebcdic=''
822fflushNULL=''
823fflushall=''
824fpossize=''
825fpostype=''
2d736872 826gccansipedantic=''
5b463ca7 827gccosandvers=''
8a27cf78 828gccversion=''
b4eb6b3d
JH
829gidformat=''
830gidsign=''
831gidsize=''
832gidtype=''
833groupstype=''
834h_fcntl=''
835h_sysfile=''
6e1038e0
MB
836html1dir=''
837html1direxp=''
838installhtml1dir=''
839html3dir=''
840html3direxp=''
841installhtml3dir=''
b4eb6b3d 842i_arpainet=''
c0bacbef 843i_assert=''
10bc17b6 844i_crypt=''
b4eb6b3d
JH
845db_hashtype=''
846db_prefixtype=''
640374d0
JH
847db_version_major=''
848db_version_minor=''
849db_version_patch=''
b4eb6b3d
JH
850i_db=''
851i_dbm=''
852i_rpcsvcdbm=''
853d_dirnamlen=''
854direntrytype=''
855i_dirent=''
a0d0e21e 856i_dld=''
b4eb6b3d
JH
857i_dlfcn=''
858i_fcntl=''
859i_float=''
758a5d79
JH
860i_fp=''
861i_fp_class=''
b4eb6b3d
JH
862i_gdbm=''
863d_grpasswd=''
864i_grp=''
b4eb6b3d
JH
865i_ieeefp=''
866i_inttypes=''
2765b840 867i_langinfo=''
b4eb6b3d
JH
868i_libutil=''
869i_limits=''
870i_locale=''
871i_machcthr=''
872i_malloc=''
1cd66f7c 873i_mallocmalloc=''
b4eb6b3d
JH
874i_math=''
875i_memory=''
876i_mntent=''
a33f2d9f
AD
877d_ndbm=''
878i_gdbm_ndbm=''
879i_gdbmndbm=''
b4eb6b3d
JH
880i_ndbm=''
881i_netdb=''
882i_neterrno=''
883i_netinettcp=''
884i_niin=''
885i_sysin=''
886i_poll=''
887i_prot=''
888i_pthread=''
889d_pwage=''
890d_pwchange=''
891d_pwclass=''
892d_pwcomment=''
893d_pwexpire=''
894d_pwgecos=''
895d_pwpasswd=''
896d_pwquota=''
897i_pwd=''
898i_sfio=''
899i_shadow=''
900i_socks=''
901i_stddef=''
902i_stdlib=''
903i_string=''
904strings=''
905i_sunmath=''
906i_sysaccess=''
907i_sysdir=''
908i_sysfile=''
909d_voidtty=''
910i_bsdioctl=''
911i_sysfilio=''
912i_sysioctl=''
913i_syssockio=''
914i_syslog=''
915i_sysmman=''
916i_sysmode=''
917i_sysmount=''
918i_sysndir=''
919i_sysparam=''
216dac04 920i_syspoll=''
b4eb6b3d
JH
921i_sysresrc=''
922i_syssecrt=''
923i_sysselct=''
924i_sysstat=''
925i_sysstatfs=''
926i_sysstatvfs=''
927i_systimes=''
928i_systypes=''
929i_sysuio=''
930i_sysun=''
931i_sysutsname=''
932i_sysvfs=''
933i_syswait=''
934i_sgtty=''
935i_termio=''
936i_termios=''
14b90194
JH
937d_tm_tm_gmtoff=''
938d_tm_tm_zone=''
b4eb6b3d
JH
939i_systime=''
940i_systimek=''
941i_time=''
942timeincl=''
943i_unistd=''
944i_ustat=''
945i_utime=''
946i_values=''
947i_stdarg=''
948i_varargs=''
949i_varhdr=''
950i_vfork=''
f3f1a2d8 951d_inc_version_list=''
b4eb6b3d
JH
952inc_version_list=''
953inc_version_list_init=''
954installprefix=''
955installprefixexp=''
956installstyle=''
957installusrbinperl=''
958intsize=''
959longsize=''
960shortsize=''
4b661809 961issymlink=''
2304df62 962libc=''
b4eb6b3d
JH
963ldlibpthname=''
964libperl=''
965shrpenv=''
966useshrplib=''
a0d0e21e 967glibpth=''
2304df62 968libpth=''
8e07c86e 969loclibpth=''
2304df62
AD
970plibpth=''
971xlibpth=''
1cfa4ec7 972ignore_versioned_solibs=''
2304df62 973libs=''
43999f95
JH
974libsdirs=''
975libsfiles=''
976libsfound=''
13b3f787 977libspath=''
85e6fe83 978lns=''
b4eb6b3d
JH
979d_PRIEUldbl=''
980d_PRIFUldbl=''
981d_PRIGUldbl=''
982d_PRIeldbl=''
983d_PRIfldbl=''
984d_PRIgldbl=''
985d_SCNfldbl=''
986sPRIEUldbl=''
987sPRIFUldbl=''
988sPRIGUldbl=''
989sPRIeldbl=''
990sPRIfldbl=''
991sPRIgldbl=''
992sSCNfldbl=''
993lseeksize=''
994lseektype=''
d620c7b3 995mad=''
00e74f14
NC
996madlyh=''
997madlyobj=''
998madlysrc=''
f3f1a2d8
MB
999make_set_make=''
1000d_mymalloc=''
1001freetype=''
b4eb6b3d
JH
1002mallocobj=''
1003mallocsrc=''
1004malloctype=''
9df442c2 1005usemallocwrap=''
b4eb6b3d
JH
1006usemymalloc=''
1007installman1dir=''
1008man1dir=''
1009man1direxp=''
1010man1ext=''
1011installman3dir=''
1012man3dir=''
1013man3direxp=''
1014man3ext=''
1015modetype=''
1016multiarch=''
1017mydomain=''
1018myhostname=''
1019phostname=''
2304df62
AD
1020c=''
1021n=''
b4eb6b3d
JH
1022d_eofnblk=''
1023eagain=''
1024o_nonblock=''
1025rd_nodata=''
2cc61e15 1026need_va_copy=''
b4eb6b3d
JH
1027netdb_hlen_type=''
1028netdb_host_type=''
1029netdb_name_type=''
1030netdb_net_type=''
1031groupcat=''
1032hostcat=''
1033passcat=''
1034orderlib=''
1035ranlib=''
1036d_perl_otherlibdirs=''
1037otherlibdirs=''
2304df62
AD
1038package=''
1039spackage=''
b4eb6b3d
JH
1040pager=''
1041api_revision=''
1042api_subversion=''
1043api_version=''
1044api_versionstring=''
1045patchlevel=''
151e6568 1046perl_patchlevel=''
b4eb6b3d
JH
1047revision=''
1048subversion=''
1049version=''
861eb78d 1050version_patchlevel_string=''
b4eb6b3d
JH
1051perl5=''
1052perladmin=''
1053perlpath=''
1054d_nv_preserves_uv=''
f607920a 1055d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1056i16size=''
1057i16type=''
1058i32size=''
1059i32type=''
1060i64size=''
1061i64type=''
1062i8size=''
1063i8type=''
1064ivsize=''
1065ivtype=''
b68c599a 1066nv_overflows_integers_at=''
4137585d 1067nv_preserves_uv_bits=''
b4eb6b3d
JH
1068nvsize=''
1069nvtype=''
1070u16size=''
1071u16type=''
1072u32size=''
1073u32type=''
1074u64size=''
1075u64type=''
1076u8size=''
1077u8type=''
1078uvsize=''
1079uvtype=''
1080ivdformat=''
1081nvEUformat=''
1082nvFUformat=''
1083nvGUformat=''
1084nveformat=''
1085nvfformat=''
1086nvgformat=''
1087uvXUformat=''
1088uvoformat=''
1089uvuformat=''
1090uvxformat=''
1091pidtype=''
1092prefix=''
1093prefixexp=''
1094installprivlib=''
1095privlib=''
1096privlibexp=''
1097prototype=''
1098ptrsize=''
1099d_PRIXU64=''
1100d_PRId64=''
1101d_PRIi64=''
1102d_PRIo64=''
1103d_PRIu64=''
1104d_PRIx64=''
1105sPRIXU64=''
1106sPRId64=''
1107sPRIi64=''
1108sPRIo64=''
1109sPRIu64=''
1110sPRIx64=''
1111d_quad=''
1112quadkind=''
1113quadtype=''
1114uquadtype=''
1115drand01=''
1116randbits=''
1117randfunc=''
1118randseedtype=''
1119seedfunc=''
1120installscript=''
1121scriptdir=''
1122scriptdirexp=''
1123selectminbits=''
1124selecttype=''
8ff267be 1125sh=''
b4eb6b3d
JH
1126sig_count=''
1127sig_name=''
1128sig_name_init=''
1129sig_num=''
1130sig_num_init=''
76d3c696 1131sig_size=''
f3f1a2d8 1132d_sitearch=''
b4eb6b3d
JH
1133installsitearch=''
1134sitearch=''
1135sitearchexp=''
1136installsitebin=''
1137sitebin=''
1138sitebinexp=''
8d2cbf27
JH
1139installsitehtml1dir=''
1140sitehtml1dir=''
1141sitehtml1direxp=''
1142installsitehtml3dir=''
1143sitehtml3dir=''
1144sitehtml3direxp=''
b4eb6b3d
JH
1145installsitelib=''
1146sitelib=''
1147sitelib_stem=''
1148sitelibexp=''
91e123a8
JH
1149installsiteman1dir=''
1150siteman1dir=''
1151siteman1direxp=''
1152installsiteman3dir=''
1153siteman3dir=''
1154siteman3direxp=''
b4eb6b3d
JH
1155siteprefix=''
1156siteprefixexp=''
6e1038e0
MB
1157installsitescript=''
1158sitescript=''
1159sitescriptexp=''
b4eb6b3d
JH
1160sizesize=''
1161sizetype=''
a0d0e21e 1162so=''
b4eb6b3d 1163socksizetype=''
2304df62
AD
1164sharpbang=''
1165shsharp=''
1166spitshell=''
dfe9444c 1167src=''
b4eb6b3d
JH
1168ssizetype=''
1169startperl=''
2304df62 1170startsh=''
b4eb6b3d
JH
1171stdchar=''
1172d_stdio_stream_array=''
1173stdio_stream_array=''
1174sysman=''
81c4fd9e
MB
1175sGMTIME_max=''
1176sGMTIME_min=''
5ff3f7a4 1177trnl=''
b4eb6b3d
JH
1178uidformat=''
1179uidsign=''
1180uidsize=''
1181uidtype=''
1182archname64=''
1183use64bitall=''
1184use64bitint=''
34f1896b
MB
1185dtrace=''
1186usedtrace=''
15b61c98 1187usefaststdio=''
b4eb6b3d
JH
1188ccflags_uselargefiles=''
1189ldflags_uselargefiles=''
1190libswanted_uselargefiles=''
1191uselargefiles=''
1192uselongdouble=''
1193usemorebits=''
1194usemultiplicity=''
2304df62 1195nm_opt=''
40a7a20a 1196nm_so_opt=''
2304df62
AD
1197runnm=''
1198usenm=''
b4eb6b3d 1199useperlio=''
29209bc5 1200usesocks=''
b4eb6b3d
JH
1201d_oldpthreads=''
1202use5005threads=''
1203useithreads=''
9514c62b 1204usereentrant=''
b4eb6b3d 1205usethreads=''
2304df62 1206incpath=''
2304df62
AD
1207mips_type=''
1208usrinc=''
b4eb6b3d
JH
1209d_vendorarch=''
1210installvendorarch=''
1211vendorarch=''
1212vendorarchexp=''
1213d_vendorbin=''
1214installvendorbin=''
1215vendorbin=''
1216vendorbinexp=''
8d2cbf27
JH
1217installvendorhtml1dir=''
1218vendorhtml1dir=''
1219vendorhtml1direxp=''
1220installvendorhtml3dir=''
1221vendorhtml3dir=''
1222vendorhtml3direxp=''
b4eb6b3d
JH
1223d_vendorlib=''
1224installvendorlib=''
1225vendorlib=''
1226vendorlib_stem=''
1227vendorlibexp=''
91e123a8
JH
1228installvendorman1dir=''
1229vendorman1dir=''
1230vendorman1direxp=''
1231installvendorman3dir=''
1232vendorman3dir=''
1233vendorman3direxp=''
b4eb6b3d
JH
1234usevendorprefix=''
1235vendorprefix=''
1236vendorprefixexp=''
6e1038e0
MB
1237d_vendorscript=''
1238installvendorscript=''
1239vendorscript=''
1240vendorscriptexp=''
d56c5707 1241versiononly=''
b4eb6b3d
JH
1242defvoidused=''
1243voidflags=''
3659ebf1
JH
1244yacc=''
1245yaccflags=''
2304df62
AD
1246CONFIG=''
1247
34f1896b 1248: Detect odd OSs
ecfc5424
AD
1249define='define'
1250undef='undef'
1251smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1252rmlist=''
1253
1254: We must find out about Eunice early
1255eunicefix=':'
1256if test -f /etc/unixtovms; then
1257 eunicefix=/etc/unixtovms
1258fi
1259if test -f /etc/unixtovms.exe; then
1260 eunicefix=/etc/unixtovms.exe
1261fi
1262
cfb04860 1263: Set executable suffix now -- needed before hints available
6153ba32
PG
1264if test -f "/libs/version.library"; then
1265: Amiga OS
1266 _exe=""
1267elif test -f "/system/gnu_library/bin/ar.pm"; then
1268: Stratus VOS
cfb04860 1269 _exe=".pm"
6153ba32
PG
1270elif test -n "$DJGPP"; then
1271: DOS DJGPP
cfb04860 1272 _exe=".exe"
5c728af0 1273elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1274: OS/2 or cygwin
ba863942
JH
1275 _exe=".exe"
1276fi
868439a2 1277
1d8eaf8c 1278groupstype=''
b4eb6b3d 1279i_whoami=''
9da7673b
MB
1280: Trailing extension. Override this in a hint file, if needed.
1281: Extra object files, if any, needed on this platform.
1282archobjs=''
1283archname=''
64615a5e 1284libnames=''
732c9516
JH
1285: change the next line if compiling for Xenix/286 on Xenix/386
1286xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1287: Possible local library directories to search.
1288loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1289loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1290
1291: general looking path for locating libraries
5869b1f1 1292glibpth="/lib /usr/lib $xlibpth"
732c9516 1293glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1294test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1295test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1296test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1297
1298: Private path used by Configure to find libraries. Its value
1299: is prepended to libpth. This variable takes care of special
1300: machines, like the mips. Usually, it should be empty.
1301plibpth=''
1302
1cfa4ec7
GS
1303: default library list
1304libswanted=''
921b2963 1305: some systems want to use only the non-versioned libso:s
1cfa4ec7 1306ignore_versioned_solibs=''
ed140128
AD
1307: set usethreads on the Configure command line to enable threads.
1308usereentrant='undef'
1309: full support for void wanted by default
1310defvoidused=15
1311
1312: Possible local include directories to search.
1313: Set locincpth to "" in a hint file to defeat local include searches.
1314locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1315locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1316:
1317: no include file wanted by default
1318inclwanted=''
1319
1320: Enable -DEBUGGING and -DDEBUGGING from the command line
1321EBUGGING=''
1322DEBUGGING=old
1323
1324ccname=''
1325ccversion=''
1326perllibs=''
1327: set useposix=false in your hint file to disable the POSIX extension.
1328useposix=true
1329: set useopcode=false in your hint file to disable the Opcode extension.
1330useopcode=true
b4eb6b3d
JH
1331archname64=''
1332ccflags_uselargefiles=''
1333ldflags_uselargefiles=''
1334libswanted_uselargefiles=''
1335: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1336: set usesocks on the Configure command line to enable socks.
ecfc5424 1337: List of libraries we want.
15431986 1338: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef 1339libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8119684f 1340libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1341: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1342: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1343glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1344glibpth="/usr/shlib $glibpth"
1345: Do not use vfork unless overridden by a hint file.
1346usevfork=false
1347
8ff267be 1348: Find the basic shell for Bourne shell scripts
1349case "$sh" in
1350'')
8ff267be 1351 case "$SYSTYPE" in
1352 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1353 *) xxx='/bin/sh';;
1354 esac
1355 if test -f "$xxx"; then
1356 sh="$xxx"
1357 else
1358 : Build up a list and do a single loop so we can 'break' out.
1359 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1360 for xxx in sh bash ksh pdksh ash; do
1361 for p in $pth; do
1362 try="$try ${p}/${xxx}"
1363 done
1364 done
1365 for xxx in $try; do
1366 if test -f "$xxx"; then
1367 sh="$xxx";
8ff267be 1368 break
a5a94ea5
JH
1369 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1370 sh="$xxx";
1371 break
8ff267be 1372 elif test -f "$xxx.exe"; then
1373 sh="$xxx";
8ff267be 1374 break
1375 fi
1376 done
1377 fi
1378 ;;
1379esac
1380
1381case "$sh" in
a33c94aa 1382'') cat >&2 <<EOM
8ff267be 1383$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1384
8ff267be 1385Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1386Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1387we'll try to straighten this all out.
8ff267be 1388EOM
1389 exit 1
1390 ;;
1391esac
1392
760ac839 1393: see if sh knows # comments
73614538 1394if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1395 shsharp=true
1396 spitshell=cat
760ac839 1397 xcat=/bin/cat
a931254c
JH
1398 test -f $xcat$_exe || xcat=/usr/bin/cat
1399 if test ! -f $xcat$_exe; then
4bdb8fb5 1400 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1401 if test -f $p/cat$_exe; then
1deb0a86 1402 xcat=$p/cat
3c728e00
JH
1403 break
1404 fi
1405 done
1deb0a86
JH
1406 if test ! -f $xcat$_exe; then
1407 echo "Can't find cat anywhere!"
3c728e00
JH
1408 exit 1
1409 fi
1410 fi
5440bc8e
JH
1411 echo "#!$xcat" >sharp
1412 $eunicefix sharp
1413 chmod +x sharp
1d8eaf8c 1414 ./sharp > today 2>/dev/null
760ac839 1415 if test -s today; then
760ac839
LW
1416 sharpbang='#!'
1417 else
5440bc8e
JH
1418 echo "#! $xcat" > sharp
1419 $eunicefix sharp
1420 chmod +x sharp
1d8eaf8c 1421 ./sharp > today 2>/dev/null
760ac839 1422 if test -s today; then
760ac839
LW
1423 sharpbang='#! '
1424 else
760ac839
LW
1425 sharpbang=': use '
1426 fi
1427 fi
1428else
dfe9444c 1429 echo " "
8ff267be 1430 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1431 shsharp=false
1432 cd ..
1433 echo "exec grep -v '^[ ]*#'" >spitshell
1434 chmod +x spitshell
1435 $eunicefix spitshell
1436 spitshell=`pwd`/spitshell
1437 cd UU
1438 echo "I presume that if # doesn't work, #! won't work either!"
1439 sharpbang=': use '
1440fi
5440bc8e 1441rm -f sharp today
760ac839
LW
1442
1443: figure out how to guarantee sh startup
8ff267be 1444case "$startsh" in
1445'') startsh=${sharpbang}${sh} ;;
1446*)
760ac839 1447esac
5440bc8e 1448cat >sharp <<EOSS
760ac839
LW
1449$startsh
1450set abc
1451test "$?abc" != 1
1452EOSS
1453
5440bc8e
JH
1454chmod +x sharp
1455$eunicefix sharp
1456if ./sharp; then
8ff267be 1457 : echo "Yup, it does."
760ac839 1458else
dfe9444c
AD
1459 echo "Hmm... '$startsh' does not guarantee sh startup..."
1460 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1461fi
5440bc8e 1462rm -f sharp
760ac839 1463
aebf16e7
AD
1464: Save command line options in file UU/cmdline.opt for later use in
1465: generating config.sh.
1466cat > cmdline.opt <<EOSH
613d6c3e 1467: Configure command line arguments.
aebf16e7
AD
1468config_arg0='$0'
1469config_args='$*'
1470config_argc=$#
1471EOSH
1472argn=1
ee45ea83
IZ
1473args_exp=''
1474args_sep=''
aebf16e7
AD
1475for arg in "$@"; do
1476 cat >>cmdline.opt <<EOSH
1477config_arg$argn='$arg'
1478EOSH
ee45ea83
IZ
1479 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1480$arg
1481EOC
1482 arg_exp=`cat cmdl.opt`
1483 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1484 argn=`expr $argn + 1`
ee45ea83 1485 args_sep=' '
aebf16e7 1486done
ee45ea83 1487rm -f cmdl.opt
aebf16e7 1488
2304df62
AD
1489: produce awk script to parse command line options
1490cat >options.awk <<'EOF'
1491BEGIN {
02e93a22 1492 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1493
1494 len = length(optstr);
1495 for (i = 1; i <= len; i++) {
1496 c = substr(optstr, i, 1);
1497 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1498 if (a == ":") {
1499 arg[c] = 1;
1500 i++;
1501 }
1502 opt[c] = 1;
1503 }
1504}
1505{
1506 expect = 0;
1507 str = $0;
1508 if (substr(str, 1, 1) != "-") {
1509 printf("'%s'\n", str);
1510 next;
1511 }
1512 len = length($0);
1513 for (i = 2; i <= len; i++) {
1514 c = substr(str, i, 1);
1515 if (!opt[c]) {
1516 printf("-%s\n", substr(str, i));
1517 next;
1518 }
1519 printf("-%s\n", c);
1520 if (arg[c]) {
1521 if (i < len)
1522 printf("'%s'\n", substr(str, i + 1));
1523 else
1524 expect = 1;
1525 next;
1526 }
1527 }
1528}
1529END {
1530 if (expect)
1531 print "?";
1532}
1533EOF
1534
1535: process the command line options
4633a7c4
LW
1536set X `for arg in "$@"; do echo "X$arg"; done |
1537 sed -e s/X// | awk -f options.awk`
2304df62
AD
1538eval "set $*"
1539shift
1540rm -f options.awk
1541
1542: set up default values
1543fastread=''
1544reuseval=false
1545config_sh=''
1546alldone=''
1547error=''
1548silent=''
1549extractsh=''
ecfc5424 1550override=''
16d20bd9 1551knowitall=''
02e93a22 1552rm -f optdef.sh posthint.sh
28757baa 1553cat >optdef.sh <<EOS
1554$startsh
1555EOS
2304df62 1556
dfe9444c 1557
2304df62
AD
1558: option parsing
1559while test $# -gt 0; do
1560 case "$1" in
1561 -d) shift; fastread=yes;;
1562 -e) shift; alldone=cont;;
1563 -f)
1564 shift
1565 cd ..
1566 if test -r "$1"; then
1567 config_sh="$1"
1568 else
a0d0e21e 1569 echo "$me: cannot read config file $1." >&2
2304df62
AD
1570 error=true
1571 fi
1572 cd UU
1573 shift;;
3f30fabf 1574 --help|\
2304df62
AD
1575 -h) shift; error=true;;
1576 -r) shift; reuseval=true;;
dfe9444c 1577 -s) shift; silent=true; realsilent=true;;
2304df62 1578 -E) shift; alldone=exit;;
16d20bd9 1579 -K) shift; knowitall=true;;
ecfc5424 1580 -O) shift; override=true;;
dfe9444c 1581 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1582 -D)
1583 shift
1584 case "$1" in
1585 *=)
1586 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1587 echo "$me: ignoring -D $1" >&2
1588 ;;
ecfc5424 1589 *=*) echo "$1" | \
1aef975c
AD
1590 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1591 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1592 esac
1593 shift
1594 ;;
1595 -U)
1596 shift
1597 case "$1" in
1aef975c 1598 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1599 *=*)
1600 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1601 echo "$me: ignoring -U $1" >&2
1602 ;;
1aef975c 1603 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1604 esac
1605 shift
1606 ;;
02e93a22
JH
1607 -A)
1608 shift
1609 xxx=''
1610 yyy="$1"
02e93a22 1611 zzz=''
5f83a3e9 1612 uuu=undef
02e93a22 1613 case "$yyy" in
f7c31117 1614 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1615 case "$zzz" in
1616 *:*) zzz='' ;;
1617 *) xxx=append
613d6c3e 1618 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
f7c31117 1619 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1620 esac
1621 ;;
1622 esac
1623 case "$xxx" in
1624 '') case "$yyy" in
f7c31117
JH
1625 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1626 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1627 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1628 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1629 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1630 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9 1631 esac
613d6c3e 1632 ;;
5f83a3e9 1633 esac
02e93a22
JH
1634 case "$xxx" in
1635 append)
5f83a3e9 1636 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1637 clear)
5f83a3e9 1638 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1639 define)
1640 case "$zzz" in
1641 '') zzz=define ;;
1642 esac
5f83a3e9 1643 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1644 eval)
5f83a3e9 1645 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1646 prepend)
5f83a3e9 1647 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1648 undef)
1649 case "$zzz" in
1650 '') zzz="$uuu" ;;
1651 esac
5f83a3e9
JH
1652 echo "$yyy=$zzz" >> posthint.sh ;;
1653 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1654 esac
bde6b06b 1655 shift
02e93a22 1656 ;;
216dac04 1657 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
5f83a3e9 1658 exit 0;;
2304df62 1659 --) break;;
a0d0e21e 1660 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1661 *) break;;
1662 esac
1663done
1664
1665case "$error" in
1666true)
1667 cat >&2 <<EOM
2afac517 1668Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1669 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1670 -d : use defaults for all answers.
1671 -e : go on without questioning past the production of config.sh.
1672 -f : specify an alternate default configuration file.
1673 -h : print this help message and exit (with an error status).
1674 -r : reuse C symbols value if possible (skips costly nm extraction).
1675 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1676 -D : define symbol to have some value:
1677 -D symbol symbol gets the value 'define'
1678 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1679 common used examples (see INSTALL for more info):
1680 -Duse64bitint use 64bit integers
b79e0b55 1681 -Duse64bitall use 64bit integers and pointers
3f30fabf 1682 -Dusethreads use thread support
b79e0b55 1683 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1684 -DEBUGGING=none DEBUGGING options
1685 -Dcc=gcc choose your compiler
1686 -Dprefix=/opt/perl5 choose your destination
2304df62 1687 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1688 -K : do not use unless you know what you are doing.
ecfc5424 1689 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1690 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1691 -U : undefine symbol:
1692 -U symbol symbol gets the value 'undef'
1693 -U symbol= symbol gets completely empty
3f30fabf 1694 e.g.: -Uversiononly
02e93a22 1695 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1696 -A append:symbol=value append value to symbol
1697 -A symbol=value like append:, but with a separating space
1698 -A define:symbol=value define symbol to have value
1699 -A clear:symbol define symbol to be ''
1700 -A define:symbol define symbol to be 'define'
1701 -A eval:symbol=value define symbol to be eval of value
1702 -A prepend:symbol=value prepend value to symbol
1703 -A undef:symbol define symbol to be 'undef'
1704 -A undef:symbol= define symbol to be ''
3f30fabf 1705 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1706 -A ccflags=-DSOME_MACRO
2304df62
AD
1707 -V : print version number and exit (with a zero status).
1708EOM
1709 exit 1
1710 ;;
1711esac
1712
dfe9444c
AD
1713: Sanity checks
1714case "$fastread$alldone" in
1715yescont|yesexit) ;;
1716*)
aaeb8e51
GS
1717 case "$extractsh" in
1718 true) ;;
1719 *)
1720 if test ! -t 0; then
1721 echo "Say 'sh Configure', not 'sh <Configure'"
1722 exit 1
1723 fi
1724 ;;
1725 esac
dfe9444c
AD
1726 ;;
1727esac
1728
2304df62
AD
1729exec 4>&1
1730case "$silent" in
1731true) exec 1>/dev/null;;
1732esac
1733
ecfc5424 1734: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1735touch optdef.sh
1736. ./optdef.sh
02e93a22
JH
1737: create the posthint manipulation script and leave the file out there...
1738touch posthint.sh
a0d0e21e 1739
2304df62 1740: set package name
34f1896b 1741package='perl5'
b4eb6b3d
JH
1742first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1743last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1744case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1745ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1746*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1747esac
2304df62 1748
2304df62
AD
1749: Some greps do not return status, grrr.
1750echo "grimblepritz" >grimble
1751if grep blurfldyick grimble >/dev/null 2>&1 ; then
1752 contains=contains
1753elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1754 contains=grep
1755else
1756 contains=contains
1757fi
1758rm -f grimble
1759: the following should work in any shell
1760case "$contains" in
1761contains*)
1762 echo " "
1763 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1764 cat >contains <<'EOSS'
1765grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1766EOSS
1767chmod +x contains
1768esac
1769
dfe9444c
AD
1770: Find the path to the source tree
1771case "$src" in
1772'') case "$0" in
b233458b
JH
1773 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1774 case "$src" in
1775 /*) ;;
8504afb7 1776 .) ;;
b233458b
JH
1777 *) src=`cd ../$src && pwd` ;;
1778 esac
1779 ;;
dfe9444c
AD
1780 *) src='.';;
1781 esac;;
1782esac
1783case "$src" in
1784'') src=/
1785 rsrc=/
1786 ;;
34f1896b
MB
1787/*) rsrc="$src";;
1788*) rsrc="../$src";;
dfe9444c
AD
1789esac
1790if test -f $rsrc/Configure && \
34f1896b 1791 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
dfe9444c
AD
1792then
1793 : found it, so we are ok.
1794else
1795 rsrc=''
1796 for src in . .. ../.. ../../.. ../../../..; do
1797 if test -f ../$src/Configure && \
1798 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1799 then
1800 rsrc=../$src
1801 break
1802 fi
1803 done
1804fi
1805case "$rsrc" in
1806'')
1807 cat <<EOM >&4
1808
1809Sorry, I can't seem to locate the source dir for $package. Please start
1810Configure with an explicit path -- i.e. /some/path/Configure.
1811
1812EOM
1813 exit 1
1814 ;;
1815../.) rsrc='..';;
1816*)
1817 echo " "
1818 echo "Sources for $package found in \"$src\"." >&4
1819 ;;
1820esac
1821
1822: script used to extract .SH files with variable substitutions
1823cat >extract <<'EOS'
a02608de 1824PERL_CONFIG_SH=true
dfe9444c 1825echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1826if test -f MANIFEST; then
1827 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1828else
1829 echo "(Looking for .SH files under the source directory.)"
6904989c 1830 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1831fi
1832shift
1833case $# in
6904989c 18340) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1835esac
6904989c 1836if test ! -f "$src/$1"; then
dfe9444c
AD
1837 shift
1838fi
1839mkdir_p='
1840name=$1;
1841create="";
1842while test $name; do
1843 if test ! -d "$name"; then
1844 create="$name $create";
1845 name=`echo $name | sed -e "s|^[^/]*$||"`;
1846 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1847 else
1848 name="";
1849 fi;
1850done;
1851for file in $create; do
1852 mkdir $file;
1853done
1854'
1855for file in $*; do
1856 case "$src" in
1857 ".")
1858 case "$file" in
1859 */*)
1860 dir=`expr X$file : 'X\(.*\)/'`
1861 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1862 (cd "$dir" && . ./$file)
dfe9444c
AD
1863 ;;
1864 *)
1865 . ./$file
1866 ;;
1867 esac
1868 ;;
1869 *)
1870 case "$file" in
1871 */*)
1872 dir=`expr X$file : 'X\(.*\)/'`
1873 file=`expr X$file : 'X.*/\(.*\)'`
1874 (set x $dir; shift; eval $mkdir_p)
6904989c 1875 sh <"$src/$dir/$file"
dfe9444c
AD
1876 ;;
1877 *)
6904989c 1878 sh <"$src/$file"
dfe9444c
AD
1879 ;;
1880 esac
1881 ;;
1882 esac
1883done
6904989c 1884if test -f "$src/config_h.SH"; then
dfe9444c
AD
1885 if test ! -f config.h; then
1886 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1887 . "$src/config_h.SH"
dfe9444c
AD
1888 fi
1889fi
1890EOS
1891
1892: extract files and exit if asked to do so
1893case "$extractsh" in
1894true)
1895 case "$realsilent" in
1896 true) ;;
1897 *) exec 1>&4;;
1898 esac
1899 case "$config_sh" in
1900 '') config_sh='config.sh';;
1901 esac
1902 echo " "
1903 echo "Fetching answers from $config_sh..."
1904 cd ..
1905 . $config_sh
1906 test "$override" && . ./optdef.sh
1907 echo " "
1908 . UU/extract
1909 rm -rf UU
24ccb310 1910 echo "Extraction done."
dfe9444c
AD
1911 exit 0
1912 ;;
1913esac
1914
1915: Eunice requires " " instead of "", can you believe it
1916echo " "
1917: Here we go...
1918echo "Beginning of configuration questions for $package."
1919
1920trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1921
2304df62
AD
1922: first determine how to suppress newline on echo command
1923echo " "
1924echo "Checking echo to see how to suppress newlines..."
1925(echo "hi there\c" ; echo " ") >.echotmp
1926if $contains c .echotmp >/dev/null 2>&1 ; then
1927 echo "...using -n."
1928 n='-n'
1929 c=''
1930else
1931 cat <<'EOM'
1932...using \c
1933EOM
1934 n=''
1935 c='\c'
1936fi
1937echo $n "The star should be here-->$c"
1938echo '*'
1939rm -f .echotmp
1940
1941: Now test for existence of everything in MANIFEST
1942echo " "
6904989c 1943if test -f "$rsrc/MANIFEST"; then
2304df62 1944 echo "First let's make sure your kit is complete. Checking..." >&4
1d8eaf8c 1945 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
776a38e3 1946 (split -l 50 2>/dev/null || split -50)
2304df62 1947 rm -f missing
dfe9444c 1948 tmppwd=`pwd`
2304df62 1949 for filelist in x??; do
776a38e3
MB
1950 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1951 >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1952 done
1953 if test -s missing; then
1954 cat missing >&4
1955 cat >&4 <<'EOM'
1956
1957THIS PACKAGE SEEMS TO BE INCOMPLETE.
1958
1959You have the option of continuing the configuration process, despite the
1960distinct possibility that your kit is damaged, by typing 'y'es. If you
1961do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1962and contact the author (perlbug@perl.org).
2304df62
AD
1963
1964EOM
1965 echo $n "Continue? [n] $c" >&4
1966 read ans
1967 case "$ans" in
1968 y*)
1969 echo "Continuing..." >&4
1970 rm -f missing
1971 ;;
1972 *)
1973 echo "ABORTING..." >&4
1974 kill $$
1975 ;;
1976 esac
1977 else
dfe9444c 1978 echo "Looks good..."
2304df62
AD
1979 fi
1980else
1981 echo "There is no MANIFEST file. I hope your kit is complete !"
1982fi
1983rm -f missing x??
1984
5ff3f7a4 1985: Find the appropriate value for a newline for tr
613d6c3e 1986echo " "
5ff3f7a4
GS
1987if test -n "$DJGPP"; then
1988 trnl='\012'
1989fi
1990if test X"$trnl" = X; then
1991 case "`echo foo|tr '\n' x 2>/dev/null`" in
1992 foox) trnl='\n' ;;
1993 esac
1994fi
1995if test X"$trnl" = X; then
1996 case "`echo foo|tr '\012' x 2>/dev/null`" in
1997 foox) trnl='\012' ;;
1998 esac
1999fi
2000if test X"$trnl" = X; then
8be2c24c
JH
2001 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2002 fooxy) trnl='\n\r' ;;
2003 esac
2004fi
2005if test X"$trnl" = X; then
5ff3f7a4
GS
2006 cat <<EOM >&2
2007
2008$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2009
2010EOM
2011 exit 1
2012fi
2013
2304df62
AD
2014: compute the number of columns on the terminal for proper question formatting
2015case "$COLUMNS" in
2016'') COLUMNS='80';;
2017esac
2018
2019: set up the echo used in my read
2020myecho="case \"\$xxxm\" in
2021'') echo $n \"\$rp $c\" >&4;;
2022*) case \"\$rp\" in
2023 '') echo $n \"[\$xxxm] $c\";;
2024 *)
2025 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2026 echo \"\$rp\" >&4
2027 echo $n \"[\$xxxm] $c\" >&4
2028 else
2029 echo $n \"\$rp [\$xxxm] $c\" >&4
2030 fi
2031 ;;
2032 esac;;
2033esac"
2034
2035: now set up to do reads with possible shell escape and default assignment
2036cat <<EOSC >myread
28757baa 2037$startsh
2304df62
AD
2038xxxm=\$dflt
2039$myecho
2040ans='!'
2041case "\$fastread" in
2042yes) case "\$dflt" in
2043 '') ;;
2044 *) ans='';
2045 case "\$silent-\$rp" in
2046 true-) ;;
2047 *) echo " " >&4;;
2048 esac;;
2049 esac;;
2050*) case "\$silent" in
2051 true) case "\$rp" in
2052 '') ans='';;
2053 esac;;
2054 esac;;
2055esac
2056while expr "X\$ans" : "X!" >/dev/null; do
2057 read answ
2058 set x \$xxxm
2059 shift
dfe9444c 2060 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2061 case "\$answ" in
dfe9444c
AD
2062 "!")
2063 sh 1>&4
2064 echo " "
2065 $myecho
2066 ;;
2067 !*)
2068 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2069 shift
2070 sh 1>&4 -c "\$*"
2071 echo " "
2072 $myecho
2073 ;;
2304df62
AD
2074 "\$ans")
2075 case "\$ans" in
ecfc5424
AD
2076 \\&*)
2077 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2078 shift
2079 case "\$1" in
2080 -d)
2081 fastread=yes
40a7a20a 2082 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2083 ;;
2084 -*)
40a7a20a 2085 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2086 ;;
2087 esac
2088 $myecho
2089 ans=!
2090 ;;
2304df62
AD
2091 esac;;
2092 *)
2093 case "\$aok" in
2094 y)
2095 echo "*** Substitution done -- please confirm."
2096 xxxm="\$ans"
c9795ab7 2097 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2098 xxxm="\$ans"
2099 ans=!
2100 ;;
2101 *)
2102 echo "*** Error -- try again."
2103 ans=!
2104 ;;
2105 esac
2106 $myecho
2107 ;;
2108 esac
2109 case "\$ans\$xxxm\$nostick" in
2110 '')
2111 ans=!
2112 $myecho
2113 ;;
2114 esac
2115done
2116case "\$ans" in
2117'') ans="\$xxxm";;
2118esac
2119EOSC
2120
2121: create .config dir to save info across Configure sessions
2122test -d ../.config || mkdir ../.config
2123cat >../.config/README <<EOF
2124This directory created by Configure to save information that should
dfe9444c 2125persist across sessions for $package.
2304df62
AD
2126
2127You may safely delete it if you wish.
2128EOF
2129
613d6c3e 2130: See if we are using a devel version and want that
9507cadf 2131xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2132case "$usedevel" in
0107c034 2133$define|true|[yY]*) ;;
9507cadf 2134*) case "$xversion" in
0107c034
JH
2135 *[13579])
2136 cat >&4 <<EOH
2137*** WHOA THERE!!! ***
2138
2139 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2140 The version of this $package distribution is $xversion, that is, odd,
2141 (as opposed to even) and that signifies a development release.
3d5d58b1 2142 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2143
2144 Do ***NOT*** install this into production use.
2145 Data corruption and crashes are possible.
2146
2147 It is most seriously suggested that you do not continue any further
2148 unless you want to help in developing and debugging Perl.
2149
6adc6a45
JH
2150 If you *still* want to build perl, you can answer 'y' now,
2151 or pass -Dusedevel to Configure.
2152
0107c034
JH
2153EOH
2154 rp='Do you really want to continue?'
2155 dflt='n'
2156 . ./myread
2157 case "$ans" in
8feeef0e
JH
2158 [yY]) echo >&4 "Okay, continuing."
2159 usedevel="$define" ;;
0107c034
JH
2160 *) echo >&4 "Okay, bye."
2161 exit 1
2162 ;;
2163 esac
2164 ;;
2165 esac
2166 ;;
2167esac
8feeef0e
JH
2168case "$usedevel" in
2169$define|true|[yY]*)
2170 case "$versiononly" in
2171 '') versiononly="$define" ;;
2172 esac
2173 case "$installusrbinperl" in
2174 '') installusrbinperl="$undef" ;;
2175 esac
2176 ;;
2177esac
0107c034 2178
2304df62
AD
2179: general instructions
2180needman=true
2181firsttime=true
760ac839 2182user=`(logname) 2>/dev/null`
dfe9444c
AD
2183case "$user" in
2184'') user=`whoami 2>&1`;;
760ac839 2185esac
2304df62
AD
2186if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2187 firsttime=false
2188 echo " "
2189 rp='Would you like to see the instructions?'
2190 dflt=n
2191 . ./myread
2192 case "$ans" in
2193 [yY]*) ;;
2194 *) needman=false;;
2195 esac
2196fi
2197if $needman; then
2198 cat <<EOH
4e2a5f63 2199
2304df62 2200This installation shell script will examine your system and ask you questions
a0d0e21e 2201to determine how the perl5 package should be installed. If you get
2304df62
AD
2202stuck on a question, you may use a ! shell escape to start a subshell or
2203execute a command. Many of the questions will have default answers in square
2204brackets; typing carriage return will give you the default.
2205
2206On some of the questions which ask for file or directory names you are allowed
2207to use the ~name construct to specify the login directory belonging to "name",
2208even if you don't have a shell which knows about that. Questions where this is
2209allowed will be marked "(~name ok)".
2210
2211EOH
2212 rp=''
2213 dflt='Type carriage return to continue'
2214 . ./myread
2215 cat <<'EOH'
2216
2217The prompter used in this script allows you to use shell variables and
2218backticks in your answers. You may use $1, $2, etc... to refer to the words
2219in the default answer, as if the default line was a set of arguments given to a
2220script shell. This means you may also use $* to repeat the whole default line,
2221so you do not have to re-type everything to add something to the default.
2222
2223Everytime there is a substitution, you will have to confirm. If there is an
2224error (e.g. an unmatched backtick), the default answer will remain unchanged
2225and you will be prompted again.
2226
2227If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2228the questions and use the computed defaults (or the previous answers if there
2229was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2230You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2231on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2232
2233EOH
2234 . ./myread
2235 cat <<EOH
2236
2237Much effort has been expended to ensure that this shell script will run on any
2238Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2239Configure and run it again. If you can't run Configure for some reason,
2240you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2241have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2242
2243This installation script affects things in two ways:
2244
22451) it may do direct variable substitutions on some of the files included
2246 in this kit.
22472) it builds a config.h file for inclusion in C programs. You may edit
2248 any of these files as the need arises after running this script.
2249
2250If you make a mistake on a question, there is no easy way to back up to it
2251currently. The easiest thing to do is to edit config.sh and rerun all the SH
2252files. Configure will offer to let you do this before it runs the SH files.
2253
2254EOH
2255 dflt='Type carriage return to continue'
2256 . ./myread
2257 case "$firsttime" in
2258 true) echo $user >>../.config/instruct;;
2259 esac
2260fi
2261
2304df62
AD
2262: find out where common programs are
2263echo " "
2264echo "Locating common programs..." >&4
2265cat <<EOSC >loc
2266$startsh
2267case \$# in
22680) exit 1;;
2269esac
2270thing=\$1
2271shift
2272dflt=\$1
2273shift
2274for dir in \$*; do
2275 case "\$thing" in
2276 .)
2277 if test -d \$dir/\$thing; then
2278 echo \$dir
2279 exit 0
2280 fi
2281 ;;
2282 *)
a0d0e21e 2283 for thisthing in \$dir/\$thing; do
ecfc5424 2284 : just loop through to pick last item
a0d0e21e 2285 done
25f94b33 2286 if test -f \$thisthing; then
a0d0e21e 2287 echo \$thisthing
2304df62 2288 exit 0
a5a94ea5
JH
2289 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2290 echo \$thisthing
776a38e3 2291 exit 0
2304df62 2292 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2293 if test -n "$DJGPP"; then
2294 echo \$dir/\$thing.exe
b921d661 2295 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2296 : on Eunice apparently
2297 echo \$dir/\$thing
2298 fi
2d736872 2299 exit 0
2304df62
AD
2300 fi
2301 ;;
2302 esac
2303done
2304echo \$dflt
2305exit 1
2306EOSC
2307chmod +x loc
2308$eunicefix loc
2309loclist="
2310awk
2311cat
f8006fac 2312chmod
b4eb6b3d
JH
2313comm
2314cp
2304df62
AD
2315echo
2316expr
2317grep
a0d0e21e 2318ls
b4eb6b3d 2319mkdir
2304df62
AD
2320rm
2321sed
b4eb6b3d 2322sort
85e6fe83 2323touch
2304df62 2324tr
b4eb6b3d 2325uniq
2304df62
AD
2326"
2327trylist="
dfe9444c 2328ar
3659ebf1 2329bison
b4eb6b3d 2330byacc
2304df62 2331cpp
b4eb6b3d 2332csh
2304df62
AD
2333date
2334egrep
1fef16b3 2335gmake
8ff267be 2336gzip
b4eb6b3d 2337less
8ff267be 2338ln
3c728e00 2339make
b4eb6b3d 2340more
693762b4 2341nm
b4eb6b3d
JH
2342nroff
2343pg
2304df62
AD
2344test
2345uname
8ff267be 2346zip
2304df62 2347"
8e07c86e 2348pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2349pth="$pth /lib /usr/lib"
2350for file in $loclist; do
dfe9444c
AD
2351 eval xxx=\$$file
2352 case "$xxx" in
2353 /*|?:[\\/]*)
2354 if test -f "$xxx"; then
2355 : ok
2356 else
2357 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2358 xxx=`./loc $file $file $pth`
2359 fi
2360 ;;
2361 '') xxx=`./loc $file $file $pth`;;
2362 *) xxx=`./loc $xxx $xxx $pth`;;
2363 esac
a5a94ea5 2364 eval $file=$xxx$_exe
2304df62
AD
2365 eval _$file=$xxx
2366 case "$xxx" in
2367 /*)
2368 echo $file is in $xxx.
2369 ;;
8e07c86e
AD
2370 ?:[\\/]*)
2371 echo $file is in $xxx.
2372 ;;
2304df62 2373 *)
25f94b33
AD
2374 echo "I don't know where '$file' is, and my life depends on it." >&4
2375 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2376 exit 1
2304df62
AD
2377 ;;
2378 esac
2379done
2380echo " "
2381echo "Don't worry if any of the following aren't found..."
2382say=offhand
2383for file in $trylist; 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
306a8474 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
AD
2406 *)
2407 echo "I don't see $file out there, $say."
2408 say=either
2409 ;;
2410 esac
2411done
2412case "$egrep" in
1fef16b3 2413egrep)
2304df62
AD
2414 echo "Substituting grep for egrep."
2415 egrep=$grep
868439a2 2416 _egrep=$grep
2304df62
AD
2417 ;;
2418esac
8ff267be 2419case "$ln" in
1fef16b3 2420ln)
8ff267be 2421 echo "Substituting cp for ln."
2422 ln=$cp
868439a2 2423 _ln=$cp
8ff267be 2424 ;;
2425esac
2e26f1d5 2426case "$make" in
613d6c3e 2427make)
2e26f1d5
JH
2428 case "$gmake" in
2429 gmake)
2430 echo "I can't find make or gmake, and my life depends on it." >&4
2431 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2432 exit 1
2433 ;;
2434 esac
2435 ;;
613d6c3e 2436esac
2e26f1d5
JH
2437case "$gmake" in
2438gmake) ;;
2439*) # We can't have osname yet.
1fef16b3
JH
2440 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2441 # Assume that gmake, if found, is definitely GNU make
2442 # and prefer it over the system make.
2443 echo "Substituting gmake for make."
2444 make=$gmake
868439a2 2445 _make=$gmake
1fef16b3
JH
2446 fi
2447 ;;
a5a94ea5 2448esac
2304df62
AD
2449case "$test" in
2450test)
2451 echo "Hopefully test is built into your sh."
2452 ;;
2453*)
73614538 2454 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2455 echo "Using the test built into your sh."
2304df62
AD
2456 test=test
2457 _test=test
2458 fi
2459 ;;
2460esac
2461case "$echo" in
2462echo)
2463 echo "Hopefully echo is built into your sh."
2464 ;;
2465'') ;;
2466*)
2467 echo " "
2468echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2469 $echo $n "hi there$c" >foo1
2470 echo $n "hi there$c" >foo2
2471 if cmp foo1 foo2 >/dev/null 2>&1; then
2472 echo "They are compatible. In fact, they may be identical."
2473 else
2474 case "$n" in
2475 '-n') n='' c='\c';;
2476 *) n='-n' c='';;
2477 esac
2478 cat <<FOO
2479They are not compatible! You are probably running ksh on a non-USG system.
2480I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2481have echo built in and we may have to run some Bourne shell scripts. That
2482means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2483
2484FOO
2485 $echo $n "The star should be here-->$c"
2486 $echo "*"
2487 fi
2488 $rm -f foo1 foo2
2489 ;;
2490esac
2491
2f88d857
MB
2492# This question was auctioned at YAPC::Europe-2007 in Vienna
2493# I never promised you could answer it. I only auctioned the question.
2494cat <<FOO
2495The following message is sponsored by
2496
2497 Dresden.pm<--The stars should be here.
2498
2499Dear Perl user, system administrator or package
2500maintainer, the Perl community sends greetings to
2501you. Do you (emblematical) greet back [Y/n]? n
2502
2503FOO
2504
613d6c3e 2505: Check what type of C compiler we use
6b769f8f 2506cat <<EOS >trygcc
2573c5f9
JH
2507$startsh
2508EOS
6b769f8f 2509cat <<'EOSC' >>trygcc
2573c5f9
JH
2510case "$cc" in
2511'') ;;
2512*) $rm -f try try.*
2513 $cat >try.c <<EOM
2514int main(int argc, char *argv[]) {
2515 return 0;
2516}
2517EOM
e4778687 2518 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2519 :
2520 else
2521 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2522 despair=yes
2523 trygcc=yes
2524 case "$cc" in
2525 *gcc*) trygcc=no ;;
2526 esac
dce40316
AD
2527 # Skip this test because it gives a false match on output like:
2528 # ./trygcc: line 23: cc: command not found
2529 # case "`$cc -v -c try.c 2>&1`" in
2530 # *gcc*) trygcc=no ;;
2531 # esac
2573c5f9
JH
2532 if $test X"$trygcc" = Xyes; then
2533 if gcc -o try -c try.c; then
2534 echo " "
2535 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2536 # Switching compilers may undo the work of hints files.
2537 # The most common problem is -D_REENTRANT for threads.
2538 # This heuristic catches that case, but gets false positives
2539 # if -Dusethreads was not actually specified. Better to
2540 # bail out here with a useful message than fail
2541 # mysteriously later. Should we perhaps just try to
2542 # re-invoke Configure -Dcc=gcc config_args ?
2543 if $test -f usethreads.cbu; then
2544 $cat >&4 <<EOM
2545
2546*** However, any setting of the C compiler flags (e.g. for thread support)
2547*** will be lost. It may be necessary for you to restart Configure and
2548*** add -Dcc=gcc to your Configure command line.
2549
2550EOM
2551 rp="Would you like to go ahead and try gcc anyway?"
2552 dflt=n
2553 else
2554 rp="Would you like to use it?"
2555 dflt=y
2556 fi
2573c5f9
JH
2557 if $test -f myread; then
2558 . ./myread
2559 else
2560 if $test -f UU/myread; then
2561 . ./UU/myread
2562 else
2563 echo "Cannot find myread, sorry. Aborting." >&2
2564 exit 1
2565 fi
2566 fi
2567 case "$ans" in
6371411c 2568 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2569 esac
2570 fi
2571 fi
6b769f8f
RB
2572 fi
2573 $rm -f try try.*
2574 ;;
2575esac
2576EOSC
2577
2578cat <<EOS >checkcc
2579$startsh
2580EOS
2581cat <<'EOSC' >>checkcc
2582case "$cc" in
2583'') ;;
2584*) $rm -f try try.*
2585 $cat >try.c <<EOM
2586int main(int argc, char *argv[]) {
2587 return 0;
2588}
2589EOM
2590 if $cc -o try $ccflags $ldflags try.c; then
2591 :
2592 else
2573c5f9 2593 if $test X"$despair" = Xyes; then
6b769f8f
RB
2594 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2595 fi
2596 $cat >&4 <<EOM
5dd4fbdf
MB
2597You need to find a working C compiler.
2598Either (purchase and) install the C compiler supplied by your OS vendor,
2599or for a free C compiler try http://gcc.gnu.org/
2600I cannot continue any further, aborting.
2601EOM
6b769f8f 2602 exit 1
2573c5f9
JH
2603 fi
2604 $rm -f try try.*
2605 ;;
2606esac
2607EOSC
2608
a0d0e21e
LW
2609: determine whether symbolic links are supported
2610echo " "
2611$touch blurfl
2612if $ln -s blurfl sym > /dev/null 2>&1 ; then
2613 echo "Symbolic links are supported." >&4
818f00be 2614 lns="$ln -s"
a0d0e21e
LW
2615else
2616 echo "Symbolic links are NOT supported." >&4
2617 lns="$ln"
2618fi
2619$rm -f blurfl sym
2620
dafca956
JH
2621: determine whether symbolic links are supported
2622echo " "
2623case "$lns" in
18ea2752 2624*"ln"*" -s")
dafca956
JH
2625 echo "Checking how to test for symbolic links..." >&4
2626 $lns blurfl sym
4b661809 2627 if $test "X$issymlink" = X; then
2e2a97a6
JH
2628 case "$newsh" in
2629 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2630 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2631 esac
5d644a95
MB
2632 if test $? = 0; then
2633 issymlink="test -h"
2e2a97a6
JH
2634 else
2635 echo "Your builtin 'test -h' may be broken." >&4
2636 case "$test" in
2637 /*) ;;
2638 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2639 for p in $pth
2640 do
2641 if test -f "$p/$test"; then
2642 test="$p/$test"
2643 break
2644 fi
2645 done
2646 ;;
2647 esac
2648 case "$test" in
2649 /*)
2650 echo "Trying external '$test -h'." >&4
2651 issymlink="$test -h"
2652 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2653 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2654 issymlink=''
2655 fi
2656 ;;
2657 *) issymlink='' ;;
2658 esac
5d644a95
MB
2659 fi
2660 fi
4b661809 2661 if $test "X$issymlink" = X; then
dafca956 2662 if $test -L sym 2>/dev/null; then
5d644a95 2663 issymlink="$test -L"
2e2a97a6 2664 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2665 fi
2666 fi
4b661809 2667 if $test "X$issymlink" != X; then
5d644a95 2668 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2669 else
2670 echo "I do not know how you can test for symbolic links." >&4
2671 fi
2672 $rm -f blurfl sym
2673 ;;
2674*) echo "No symbolic links, so not testing for their testing..." >&4
2675 ;;
2676esac
2677echo " "
2678
34f1896b 2679: Make symlinks util
dafca956
JH
2680case "$mksymlinks" in
2681$define|true|[yY]*)
2682 case "$src" in
2683 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2684 exit 1
2685 ;;
4b661809 2686 *) case "$lns:$issymlink" in
f314eb9f 2687 *"ln"*" -s:"*"test -"?)
dafca956
JH
2688 echo "Creating the symbolic links..." >&4
2689 echo "(First creating the subdirectories...)" >&4
2690 cd ..
2691 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2692 read directory
2693 test -z "$directory" && break
2694 mkdir -p $directory
2695 done
2696 # Sanity check 1.
2697 if test ! -d t/base; then
2698 echo "Failed to create the subdirectories. Aborting." >&4
2699 exit 1
2700 fi
2701 echo "(Then creating the symlinks...)" >&4
2702 awk '{print $1}' $src/MANIFEST | while true; do
2703 read filename
2704 test -z "$filename" && break
2705 if test -f $filename; then
5d644a95 2706 if $issymlink $filename; then
dafca956
JH
2707 rm -f $filename
2708 fi
2709 fi
2710 if test -f $filename; then
2711 echo "$filename already exists, not symlinking."
2712 else
2713 ln -s $src/$filename $filename
2714 fi
2715 done
2716 # Sanity check 2.
a0d24b8a
JH
2717 if test ! -f t/base/lex.t; then
2718 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2719 exit 1
2720 fi
2721 cd UU
2722 ;;
2723 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2724 ;;
2725 esac
2726 ;;
2727 esac
2728 ;;
2729esac
2730
613d6c3e 2731: Check for Cross-Compilation
5440bc8e
JH
2732case "$usecrosscompile" in
2733$define|true|[yY]*)
93bc48fa 2734 $echo "Cross-compiling..."
5440bc8e
JH
2735 croak=''
2736 case "$cc" in
2737 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2738 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2739 ar=$targetarch-ar
2740 # leave out ld, choosing it is more complex
2741 nm=$targetarch-nm
2742 ranlib=$targetarch-ranlib
93bc48fa 2743 $echo 'extern int foo;' > try.c
f8006fac 2744 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2745 shift
2746 if $test $# -gt 0; then
2747 incpth="$incpth $*"
f8006fac
JH
2748 incpth="`$echo $incpth|$sed 's/^ //'`"
2749 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2750 for i in $*; do
f8006fac 2751 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2752 if $test -d $j; then
2753 libpth="$libpth $j"
2754 fi
2755 done
f8006fac
JH
2756 libpth="`$echo $libpth|$sed 's/^ //'`"
2757 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2758 fi
2759 $rm -f try.c
5440bc8e
JH
2760 ;;
2761 esac
2762 case "$targetarch" in
93bc48fa
JH
2763 '') echo "Targetarch not defined." >&4; croak=y ;;
2764 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2765 esac
2766 case "$incpth" in
93bc48fa 2767 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2768 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2769 esac
2770 case "$libpth" in
93bc48fa 2771 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2772 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2773 esac
93bc48fa
JH
2774 case "$usrinc" in
2775 '') for i in $incpth; do
2776 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2777 usrinc=$i
2778 echo "Guessing usrinc $usrinc." >&4
2779 break
2780 fi
2781 done
2782 case "$usrinc" in
2783 '') echo "Usrinc not defined." >&4; croak=y ;;
2784 esac
2785 ;;
2786 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2787 esac
93bc48fa
JH
2788 case "$targethost" in
2789 '') echo "Targethost not defined." >&4; croak=y ;;
2790 *) echo "Using targethost $targethost." >&4
5440bc8e 2791 esac
93bc48fa
JH
2792 locincpth=' '
2793 loclibpth=' '
5440bc8e 2794 case "$croak" in
93bc48fa 2795 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2796 esac
2797 case "$src" in
2798 /*) run=$src/Cross/run
93c0359c 2799 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2800 to=$src/Cross/to
2801 from=$src/Cross/from
2802 ;;
93bc48fa 2803 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2804 run=$pwd/Cross/run
f8006fac 2805 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2806 to=$pwd/Cross/to
2807 from=$pwd/Cross/from
2808 ;;
2809 esac
2810 case "$targetrun" in
2811 '') targetrun=ssh ;;
2812 esac
2813 case "$targetto" in
2814 '') targetto=scp ;;
2815 esac
2816 case "$targetfrom" in
2817 '') targetfrom=scp ;;
2818 esac
2819 run=$run-$targetrun
2820 to=$to-$targetto
2821 from=$from-$targetfrom
93bc48fa
JH
2822 case "$targetdir" in
2823 '') targetdir=/tmp
2824 echo "Guessing targetdir $targetdir." >&4
2825 ;;
2826 esac
5440bc8e 2827 case "$targetuser" in
93bc48fa
JH
2828 '') targetuser=root
2829 echo "Guessing targetuser $targetuser." >&4
2830 ;;
5440bc8e
JH
2831 esac
2832 case "$targetfrom" in
2833 scp) q=-q ;;
2834 *) q='' ;;
2835 esac
2836 case "$targetrun" in
2837 ssh|rsh)
2838 cat >$run <<EOF
2839#!/bin/sh
93c0359c
JH
2840case "\$1" in
2841-cwd)
2842 shift
2843 cwd=\$1
2844 shift
2845 ;;
2846esac
2847case "\$cwd" in
2848'') cwd=$targetdir ;;
2849esac
5440bc8e
JH
2850exe=\$1
2851shift
93c0359c
JH
2852if $test ! -f \$exe.xok; then
2853 $to \$exe
2854 $touch \$exe.xok
2855fi
2856$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2857EOF
2858 ;;
93bc48fa 2859 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2860 exit 1
2861 ;;
2862 esac
93c0359c
JH
2863 case "$targetmkdir" in
2864 */Cross/mkdir)
2865 cat >$targetmkdir <<EOF
2866#!/bin/sh
2867$targetrun -l $targetuser $targethost "mkdir -p \$@"
2868EOF
f8006fac 2869 $chmod a+rx $targetmkdir
93c0359c
JH
2870 ;;
2871 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2872 exit 1
2873 ;;
2874 esac
5440bc8e
JH
2875 case "$targetto" in
2876 scp|rcp)
2877 cat >$to <<EOF
2878#!/bin/sh
2879for f in \$@
2880do
93c0359c
JH
2881 case "\$f" in
2882 /*)
2883 $targetmkdir \`dirname \$f\`
2884 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2885 ;;
2886 *)
2887 $targetmkdir $targetdir/\`dirname \$f\`
2888 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2889 ;;
2890 esac
5440bc8e
JH
2891done
2892exit 0
2893EOF
2894 ;;
2895 cp) cat >$to <<EOF
2896#!/bin/sh
93c0359c
JH
2897for f in \$@
2898do
2899 case "\$f" in
2900 /*)
2901 $mkdir -p $targetdir/\`dirname \$f\`
2902 $cp \$f $targetdir/\$f || exit 1
2903 ;;
2904 *)
2905 $targetmkdir $targetdir/\`dirname \$f\`
2906 $cp \$f $targetdir/\$f || exit 1
2907 ;;
2908 esac
2909done
2910exit 0
5440bc8e
JH
2911EOF
2912 ;;
93bc48fa 2913 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2914 exit 1
2915 ;;
2916 esac
2917 case "$targetfrom" in
2918 scp|rcp)
2919 cat >$from <<EOF
2920#!/bin/sh
2921for f in \$@
2922do
93c0359c 2923 $rm -f \$f
5440bc8e
JH
2924 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2925done
2926exit 0
2927EOF
2928 ;;
2929 cp) cat >$from <<EOF
2930#!/bin/sh
2931for f in \$@
2932do
93c0359c 2933 $rm -f \$f
5440bc8e
JH
2934 cp $targetdir/\$f . || exit 1
2935done
2936exit 0
2937EOF
2938 ;;
93bc48fa 2939 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2940 exit 1
2941 ;;
2942 esac
93bc48fa
JH
2943 if $test ! -f $run; then
2944 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2945 else
f8006fac 2946 $chmod a+rx $run
5440bc8e 2947 fi
93bc48fa
JH
2948 if $test ! -f $to; then
2949 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2950 else
f8006fac 2951 $chmod a+rx $to
5440bc8e 2952 fi
93bc48fa
JH
2953 if $test ! -f $from; then
2954 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2955 else
f8006fac 2956 $chmod a+rx $from
5440bc8e 2957 fi
93bc48fa 2958 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2959 exit 1
2960 fi
2961 cat >&4 <<EOF
f8006fac
JH
2962Using '$run' for remote execution,
2963and '$from' and '$to'
93bc48fa 2964for remote file transfer.
5440bc8e
JH
2965EOF
2966 ;;
2967*) run=''
2968 to=:
2969 from=:
2970 usecrosscompile='undef'
2971 targetarch=''
2972 ;;
2973esac
2974
ecfc5424
AD
2975: see whether [:lower:] and [:upper:] are supported character classes
2976echo " "
ecfc5424
AD
2977case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2978ABYZ)
2979 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2980 up='[:upper:]'
2981 low='[:lower:]'
2982 ;;
416d0bea
MB
2983*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2984 # (0xd9 and 0xe2), therefore that is a nice testing point.
2985 if test "X$up" = X -o "X$low" = X; then
2986 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2987 rs) up='[A-Z]'
2988 low='[a-z]'
28e8609d
JH
2989 ;;
2990 esac
416d0bea 2991 fi
28e8609d 2992 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2993 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2994 rs) up='A-Z'
28e8609d
JH
2995 low='a-z'
2996 ;;
2997 esac
416d0bea 2998 fi
28e8609d 2999 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3000 case "`echo RS | od -x 2>/dev/null`" in
3001 *D9E2*|*d9e2*)
28e8609d
JH
3002 echo "Hey, this might be EBCDIC." >&4
3003 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3004 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3005 rs) up='[A-IJ-RS-Z]'
3006 low='[a-ij-rs-z]'
28e8609d
JH
3007 ;;
3008 esac
3009 fi
3010 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3011 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3012 rs) up='A-IJ-RS-Z'
3013 low='a-ij-rs-z'
28e8609d
JH
3014 ;;
3015 esac
3016 fi
3017 ;;
3018 esac
3019 fi
3020esac
416d0bea
MB
3021case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3022rs)
28e8609d
JH
3023 echo "Using $up and $low to convert case." >&4
3024 ;;
ecfc5424 3025*)
28e8609d
JH
3026 echo "I don't know how to translate letters from upper to lower case." >&4
3027 echo "Your tr is not acting any way I know of." >&4
3028 exit 1
3029 ;;
ecfc5424
AD
3030esac
3031: set up the translation script tr, must be called with ./tr of course
3032cat >tr <<EOSC
3033$startsh
3034case "\$1\$2" in
3035'[A-Z][a-z]') exec $tr '$up' '$low';;
3036'[a-z][A-Z]') exec $tr '$low' '$up';;
3037esac
3038exec $tr "\$@"
3039EOSC
3040chmod +x tr
3041$eunicefix tr
3042
2304df62
AD
3043: Try to determine whether config.sh was made on this system
3044case "$config_sh" in
3045'')
43999f95
JH
3046myuname=`$uname -a 2>/dev/null`
3047$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3048# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3049# because the A-Z/a-z are not consecutive.
34e09935 3050myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3eaeeeae 3051 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3052newmyuname="$myuname"
2304df62 3053dflt=n
16d20bd9
AD
3054case "$knowitall" in
3055'')
3056 if test -f ../config.sh; then
3057 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3058 eval "`grep myuname= ../config.sh`"
3059 fi
3060 if test "X$myuname" = "X$newmyuname"; then
3061 dflt=y
3062 fi
2304df62 3063 fi
16d20bd9
AD
3064 ;;
3065*) dflt=y;;
3066esac
2304df62
AD
3067
3068: Get old answers from old config file if Configure was run on the
3069: same system, otherwise use the hints.
3070hint=default
3071cd ..
3072if test -f config.sh; then
16d20bd9
AD
3073 echo " "
3074 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3075 . UU/myread
3076 case "$ans" in
f83701cd
AD
3077 n*|N*) echo "OK, I'll ignore it."
3078 mv config.sh config.sh.old
3079 myuname="$newmyuname"
3080 ;;
2304df62 3081 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3082 tmp_n="$n"
3083 tmp_c="$c"
85cad39c 3084 tmp_sh="$sh"
2304df62
AD
3085 . ./config.sh
3086 cp config.sh UU
ecfc5424
AD
3087 n="$tmp_n"
3088 c="$tmp_c"
85cad39c 3089 : Older versions did not always set $sh. Catch re-use of such
3090 : an old config.sh.
3091 case "$sh" in
3092 '') sh="$tmp_sh" ;;
3093 esac
2304df62
AD
3094 hint=previous
3095 ;;
3096 esac
3097fi
2573c5f9 3098. ./UU/checkcc
2304df62
AD
3099if test ! -f config.sh; then
3100 $cat <<EOM
3101
4e2a5f63
AD
3102First time through, eh? I have some defaults handy for some systems
3103that need some extra help getting the Configure answers right:
2304df62
AD
3104
3105EOM
dfe9444c 3106 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3107 dflt=''
3108 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3109 : tests or hints, please send them to perlbug@perl.org
2304df62 3110 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3111 $test -f /irix && osname=irix
85e6fe83
LW
3112 $test -f /xenix && osname=sco_xenix
3113 $test -f /dynix && osname=dynix
3114 $test -f /dnix && osname=dnix
5f05dabc 3115 $test -f /lynx.os && osname=lynxos
3116 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3117 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3118 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3119 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3120 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3121 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3122 $test -d /usr/apollo/bin && osname=apollo
3123 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3124 $test -d /usr/include/minix && osname=minix
d54344fc 3125 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3126 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3127 osname=machten
4633a7c4 3128 if $test -x /sbin/version; then
dfe9444c 3129 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3130 $sed -e 's/[A-Za-z]$//'`
3131 elif $test -x /usr/etc/version; then
dfe9444c 3132 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3133 $sed -e 's/[A-Za-z]$//'`
3134 else
3135 osvers="$2.$3"
3136 fi
3137 fi
aaacdc8b
GS
3138
3139 $test -f /sys/posix.dll &&
3140 $test -f /usr/bin/what &&
3141 set X `/usr/bin/what /sys/posix.dll` &&
3142 $test "$3" = UWIN &&
3143 osname=uwin &&
3144 osvers="$5"
3145
2304df62
AD
3146 if $test -f $uname; then
3147 set X $myuname
3148 shift
3149
2304df62 3150 case "$5" in
85e6fe83 3151 fps*) osname=fps ;;
2304df62
AD
3152 mips*)
3153 case "$4" in
85e6fe83
LW
3154 umips) osname=umips ;;
3155 *) osname=mips ;;
2304df62 3156 esac;;
85e6fe83
LW
3157 [23]100) osname=mips ;;
3158 next*) osname=next ;;
ecfc5424 3159 i386*)
c6912327
JH
3160 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3161 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3162 osname='sco'
3163 osvers=$tmp
3164 elif $test -f /etc/kconfig; then
ecfc5424 3165 osname=isc
bd628c73 3166 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3167 osvers=4
3168 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3169 osvers=3
2304df62 3170 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3171 osvers=2
ecfc5424
AD
3172 fi
3173 fi
2000072c 3174 tmp=''
ecfc5424 3175 ;;
c4f23d77
AD
3176 pc*)
3177 if test -n "$DJGPP"; then
3178 osname=dos
3179 osvers=djgpp
3180 fi
3181 ;;
2304df62
AD
3182 esac
3183
3184 case "$1" in
a0d0e21e
LW
3185 aix) osname=aix
3186 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3187 case "$tmp" in
e81c5c2a
NC
3188 # oslevel can fail with:
3189 # oslevel: Unable to acquire lock.
3190 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3191 '<3240'|'<>3240') osvers=3.2.0 ;;
3192 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3193 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3194 *) osvers=$tmp;;
a0d0e21e
LW
3195 esac
3196 ;;
aaacdc8b
GS
3197 bsd386) osname=bsd386
3198 osvers=`$uname -r`
3199 ;;
3200 cygwin*) osname=cygwin
3201 osvers="$3"
3202 ;;
23f87696
SZ
3203 *dc.osx) osname=dcosx
3204 osvers="$3"
3205 ;;
a0d0e21e
LW
3206 dnix) osname=dnix
3207 osvers="$3"
3208 ;;
3209 domainos) osname=apollo
3210 osvers="$3"
3211 ;;
a774dfe6
RSG
3212 dgux) osname=dgux
3213 osvers="$3"
3214 ;;
3215 dragonfly) osname=dragonfly
a0d0e21e
LW
3216 osvers="$3"
3217 ;;
760ac839 3218 dynixptx*) osname=dynixptx
e58e581d 3219 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3220 ;;
a774dfe6 3221 freebsd) osname=freebsd
a0d0e21e 3222 osvers="$3" ;;
761ee4e8
BD
3223 genix) osname=genix ;;
3224 gnu) osname=gnu
3225 osvers="$3" ;;
a774dfe6 3226 hp*) osname=hpux
bfb7748a 3227 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3228 ;;
761ee4e8 3229 irix*) osname=irix
a0d0e21e
LW
3230 case "$3" in
3231 4*) osvers=4 ;;
3232 5*) osvers=5 ;;
ecfc5424 3233 *) osvers="$3" ;;
a0d0e21e
LW
3234 esac
3235 ;;
761ee4e8 3236 linux) osname=linux
a0d0e21e 3237 case "$3" in
a0d0e21e
LW
3238 *) osvers="$3" ;;
3239 esac
3240 ;;
761ee4e8 3241 MiNT) osname=mint
28e8609d
JH
3242 ;;
3243 netbsd*) osname=netbsd
ecfc5424
AD
3244 osvers="$3"
3245 ;;
4e81affe
MM
3246 news-os) osvers="$3"
3247 case "$3" in
3248 4*) osname=newsos4 ;;
3249 *) osname=newsos ;;
3250 esac
3251 ;;
aaacdc8b 3252 next*) osname=next ;;
28bb1e2c 3253 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3254 openbsd) osname=openbsd
3255 osvers="$3"
3256 ;;
5c728af0
IZ
3257 os2) osname=os2
3258 osvers="$4"
3259 ;;
aaacdc8b
GS
3260 POSIX-BC | posix-bc ) osname=posix-bc
3261 osvers="$3"
a0d0e21e 3262 ;;
ae3afa4e
TH
3263 powerux | power_ux | powermax_os | powermaxos | \
3264 powerunix | power_unix) osname=powerux
3265 osvers="$3"
3266 ;;
aaacdc8b
GS
3267 qnx) osname=qnx
3268 osvers="$4"
3269 ;;
a0d0e21e
LW
3270 solaris) osname=solaris
3271 case "$3" in
3272 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3273 *) osvers="$3" ;;
a0d0e21e
LW
3274 esac
3275 ;;
85e6fe83
LW
3276 sunos) osname=sunos
3277 case "$3" in
85e6fe83
LW
3278 5*) osname=solaris
3279 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3280 *) osvers="$3" ;;
2304df62
AD
3281 esac
3282 ;;
a0d0e21e 3283 titanos) osname=titanos
85e6fe83 3284 case "$3" in
a0d0e21e
LW
3285 1*) osvers=1 ;;
3286 2*) osvers=2 ;;
3287 3*) osvers=3 ;;
3288 4*) osvers=4 ;;
ecfc5424 3289 *) osvers="$3" ;;
2304df62
AD
3290 esac
3291 ;;
85e6fe83 3292 ultrix) osname=ultrix
ecfc5424 3293 osvers="$3"
2304df62 3294 ;;
28757baa 3295 osf1|mls+) case "$5" in
fed7345c
AD
3296 alpha)
3297 osname=dec_osf
fdd85a03 3298 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3299 case "$osvers" in
3300 [1-9].[0-9]*) ;;
3301 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3302 esac
ecfc5424
AD
3303 ;;
3304 hp*) osname=hp_osf1 ;;
3305 mips) osname=mips_osf1 ;;
85e6fe83
LW
3306 esac
3307 ;;
af1ff193 3308 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3309 openunix|unixware) osname=svr5
0337d152
BG
3310 osvers="$4"
3311 ;;
3c728e00 3312 uts) osname=uts
a0d0e21e
LW
3313 osvers="$3"
3314 ;;
3c728e00
JH
3315 vos) osvers="$3"
3316 ;;
85e6fe83 3317 $2) case "$osname" in
2304df62 3318 *isc*) ;;
a0d0e21e 3319 *freebsd*) ;;
5f05dabc 3320 svr*)
a0d0e21e 3321 : svr4.x or possibly later
a774dfe6 3322 case "svr$3" in
a0d0e21e
LW
3323 ${osname}*)
3324 osname=svr$3
3325 osvers=$4
3326 ;;
3327 esac
3328 case "$osname" in
3329 svr4.0)
3330 : Check for ESIX
3331 if test -f /stand/boot ; then
3332 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3333 if test -n "$INITPROG" -a -f "$INITPROG"; then
3334 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3335 if test -n "$isesix"; then
a0d0e21e
LW
3336 osname=esix4
3337 fi
3338 fi
3339 fi
3340 ;;
3341 esac
3342 ;;
2304df62 3343 *) if test -f /etc/systemid; then
a0d0e21e
LW
3344 osname=sco
3345 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3346 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3347 osvers=$1.$2.$3
c4f23d77 3348 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3349 osvers=$1.$2
c4f23d77 3350 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3351 osvers=$1
2304df62 3352 fi
a0d0e21e
LW
3353 else
3354 case "$osname" in
3355 '') : Still unknown. Probably a generic Sys V.
3356 osname="sysv"
3357 osvers="$3"
3358 ;;
3359 esac
2304df62
AD
3360 fi
3361 ;;
3362 esac
3363 ;;
a0d0e21e
LW
3364 *) case "$osname" in
3365 '') : Still unknown. Probably a generic BSD.
3366 osname="$1"
3367 osvers="$3"
3368 ;;
3369 esac
3370 ;;
2304df62
AD
3371 esac
3372 else
dfe9444c
AD
3373 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3374 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3375 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3376 osname=news_os
2304df62 3377 fi
dfe9444c 3378 $rm -f UU/kernel.what
5c728af0 3379 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3380 set X $myuname
3381 osname=os2
3382 osvers="$5"
2304df62
AD
3383 fi
3384 fi
a774dfe6 3385
5440bc8e
JH
3386 case "$targetarch" in
3387 '') ;;
3388 *) hostarch=$osname
3389 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3390 osvers=''
3391 ;;
3392 esac
3393
a0d0e21e
LW
3394 : Now look for a hint file osname_osvers, unless one has been
3395 : specified already.
3396 case "$hintfile" in
3397 ''|' ')
1e127011 3398 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3399 : Also try without trailing minor version numbers.
1e127011
DD
3400 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3401 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3402 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3403 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3404 case "$file" in
3405 '') dflt=none ;;
3406 *) case "$osvers" in
3407 '') dflt=$file
3408 ;;
dfe9444c 3409 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3410 dflt=$file
dfe9444c 3411 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3412 dflt=$xfile
dfe9444c 3413 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3414 dflt=$xxfile
dfe9444c 3415 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3416 dflt=$xxxfile
dfe9444c 3417 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3418 dflt=$xxxxfile
dfe9444c 3419 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3420 dflt="${osname}"
3421 else
3422 dflt=none
3423 fi
3424 ;;
3425 esac
85e6fe83
LW
3426 ;;
3427 esac
4e2a5f63
AD
3428 if $test -f Policy.sh ; then
3429 case "$dflt" in
3430 *Policy*) ;;
3431 none) dflt="Policy" ;;
3432 *) dflt="Policy $dflt" ;;
3433 esac
3434 fi
85e6fe83 3435 ;;
a0d0e21e 3436 *)
ecfc5424 3437 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3438 ;;
2304df62 3439 esac
1aef975c 3440
4e2a5f63
AD
3441 if $test -f Policy.sh ; then
3442 $cat <<EOM
3443
3444There's also a Policy hint file available, which should make the
3445site-specific (policy) questions easier to answer.
3446EOM
3447
3448 fi
3449
2304df62
AD
3450 $cat <<EOM
3451
3452You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3453If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3454previous run of Configure, you may specify it as well as or instead of
3455OS-specific hints. If hints are provided for your OS, you should use them:
3456although Perl can probably be built without hints on many platforms, using
3457hints often improve performance and may enable features that Configure can't
3458set up on its own. If there are no hints that match your OS, specify "none";
3459DO NOT give a wrong version or a wrong OS.
2304df62
AD
3460
3461EOM
4e2a5f63 3462
2304df62 3463 rp="Which of these apply, if any?"
dfe9444c 3464 . UU/myread
85e6fe83
LW
3465 tans=$ans
3466 for file in $tans; do
4e2a5f63
AD
3467 if $test X$file = XPolicy -a -f Policy.sh; then
3468 . Policy.sh
3469 $cat Policy.sh >> UU/config.sh
3470 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3471 . $src/hints/$file.sh
3472 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3473 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3474 : nothing
3475 else
85e6fe83
LW
3476 : Give one chance to correct a possible typo.
3477 echo "$file.sh does not exist"
3478 dflt=$file
3479 rp="hint to use instead?"
dfe9444c 3480 . UU/myread
85e6fe83 3481 for file in $ans; do
dfe9444c
AD
3482 if $test -f "$src/hints/$file.sh"; then
3483 . $src/hints/$file.sh
3484 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3485 elif $test X$ans = X -o X$ans = Xnone ; then
3486 : nothing
3487 else
3488 echo "$file.sh does not exist -- ignored."
3489 fi
3490 done
2304df62
AD
3491 fi
3492 done
85e6fe83 3493
2304df62 3494 hint=recommended
85e6fe83 3495 : Remember our hint file for later.
dfe9444c 3496 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3497 hintfile="$file"
85e6fe83 3498 else
a0d0e21e 3499 hintfile=''
85e6fe83 3500 fi
2304df62
AD
3501fi
3502cd UU
3503;;
3504*)
3505 echo " "
3506 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3507 tmp_n="$n"
3508 tmp_c="$c"
2304df62
AD
3509 cd ..
3510 cp $config_sh config.sh 2>/dev/null
a78b0d02 3511 chmod +w config.sh
2304df62
AD
3512 . ./config.sh
3513 cd UU
3514 cp ../config.sh .
ecfc5424
AD
3515 n="$tmp_n"
3516 c="$tmp_c"
2304df62
AD
3517 hint=previous
3518 ;;
3519esac
1aef975c 3520test "$override" && . ./optdef.sh
2304df62
AD
3521
3522: Restore computed paths
3523for file in $loclist $trylist; do
3524 eval $file="\$_$file"
3525done
3526
85e6fe83 3527cat << EOM
a0d0e21e 3528
85e6fe83 3529Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3530The default value is probably right if the name rings a bell. Otherwise,
3531since spelling matters for me, either accept the default or answer "none"
3532to leave it blank.
a0d0e21e 3533
85e6fe83 3534EOM
85e6fe83 3535case "$osname" in
a0d0e21e 3536 ''|' ')
85e6fe83 3537 case "$hintfile" in
a0d0e21e 3538 ''|' '|none) dflt=none ;;
ecfc5424 3539 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3540 esac
3541 ;;
3542 *) dflt="$osname" ;;
3543esac
3544rp="Operating system name?"
3545. ./myread
3546case "$ans" in
ecfc5424
AD
3547none) osname='' ;;
3548*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3549esac
8ff267be 3550echo " "
3551case "$osvers" in
3552 ''|' ')
3553 case "$hintfile" in
3554 ''|' '|none) dflt=none ;;
3555 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3556 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3557 case "$dflt" in
3558 ''|' ') dflt=none ;;
3559 esac
3560 ;;
3561 esac
3562 ;;
3563 *) dflt="$osvers" ;;
3564esac
3565rp="Operating system version?"
3566. ./myread
3567case "$ans" in
3568none) osvers='' ;;
3569*) osvers="$ans" ;;
3570esac
3571
02e93a22
JH
3572
3573. ./posthint.sh
3574
2304df62 3575: who configured the system
59b83a6f 3576cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3577case "$cf_by" in
3578"")
7c04078e 3579 cf_by=`(logname) 2>/dev/null`
dfe9444c 3580 case "$cf_by" in
7c04078e
GA
3581 "")
3582 cf_by=`(whoami) 2>/dev/null`
3583 case "$cf_by" in
3584 "") cf_by=unknown ;;
3585 esac ;;
8ff267be 3586 esac ;;
3587esac
2304df62 3588
f3f1a2d8
MB
3589: decide how portable to be. Allow command line overrides.
3590case "$d_portable" in
3591"$undef") ;;
3592*) d_portable="$define" ;;
b4eb6b3d 3593esac
b4eb6b3d 3594
f3f1a2d8
MB
3595: set up shell script to do ~ expansion
3596cat >filexp <<EOSS
3597$startsh
3598: expand filename
3599case "\$1" in
f16e9d76 3600 \~/*|\~)
f3f1a2d8
MB
3601 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3602 ;;
4137585d 3603 \~*)
f3f1a2d8
MB
3604 if $test -f /bin/csh; then
3605 /bin/csh -f -c "glob \$1"
3606 failed=\$?
3607 echo ""
3608 exit \$failed
3609 else
3610 name=\`$expr x\$1 : '..\([^/]*\)'\`
3611 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3612 if $test ! -d "\$dir"; then
3613 me=\`basename \$0\`
3614 echo "\$me: can't locate home directory for: \$name" >&2
3615 exit 1
3616 fi
3617 case "\$1" in
3618 */*)
3619 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3620 ;;
3621 *)
3622 echo \$dir
3623 ;;
3624 esac
3625 fi
3626 ;;
3627*)
3628 echo \$1
3629 ;;
b29b105d 3630esac
f3f1a2d8
MB
3631EOSS
3632chmod +x filexp
3633$eunicefix filexp
b29b105d 3634
f3f1a2d8
MB
3635: now set up to get a file name
3636cat <<EOS >getfile
3637$startsh
3638EOS
3639cat <<'EOSC' >>getfile
3640tilde=''
3641fullpath=''
3642already=''
3643skip=''
3644none_ok=''
3645exp_file=''
3646nopath_ok=''
3647orig_rp="$rp"
3648orig_dflt="$dflt"
3649case "$gfpth" in
3650'') gfpth='.' ;;
b29b105d 3651esac
b29b105d 3652
f3f1a2d8
MB
3653case "$fn" in
3654*\(*)
3655 : getfile will accept an answer from the comma-separated list
3656 : enclosed in parentheses even if it does not meet other criteria.
3657 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3658 fn=`echo $fn | sed 's/(.*)//'`
3659 ;;
b29b105d
JH
3660esac
3661
f3f1a2d8
MB
3662case "$fn" in
3663*:*)
3664 loc_file=`expr $fn : '.*:\(.*\)'`
3665 fn=`expr $fn : '\(.*\):.*'`
3666 ;;
b29b105d 3667esac
b29b105d 3668
f3f1a2d8
MB
3669case "$fn" in
3670*~*) tilde=true;;
3671esac
3672case "$fn" in
3673*/*) fullpath=true;;
3674esac
3675case "$fn" in
3676*+*) skip=true;;
3677esac
3678case "$fn" in
3679*n*) none_ok=true;;
3680esac
3681case "$fn" in
3682*e*) exp_file=true;;
3683esac
3684case "$fn" in
3685*p*) nopath_ok=true;;
b29b105d 3686esac
b29b105d 3687
f3f1a2d8
MB
3688case "$fn" in
3689*f*) type='File';;
3690*d*) type='Directory';;
3691*l*) type='Locate';;
3692esac
b29b105d 3693
f3f1a2d8
MB
3694what="$type"
3695case "$what" in
3696Locate) what='File';;
3697esac
b29b105d 3698
f3f1a2d8
MB
3699case "$exp_file" in
3700'')
3701 case "$d_portable" in
3702 "$define") ;;
3703 *) exp_file=true;;
b29b105d
JH
3704 esac
3705 ;;
3706esac
3707
f3f1a2d8
MB
3708cd ..
3709while test "$type"; do
3710 redo=''
3711 rp="$orig_rp"
3712 dflt="$orig_dflt"
3713 case "$tilde" in
3714 true) rp="$rp (~name ok)";;
3715 esac
3716 . UU/myread
3717 if test -f UU/getfile.ok && \
3718 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3719 then
3720 value="$ans"
3721 ansexp="$ans"
3722 break
3723 fi
3724 case "$ans" in
3725 none)
3726 value=''
3727 ansexp=''
3728 case "$none_ok" in
3729 true) type='';;
b29b105d
JH
3730 esac
3731 ;;
f3f1a2d8
MB
3732 *)
3733 case "$tilde" in
3734 '') value="$ans"
3735 ansexp="$ans";;
3736 *)
3737 value=`UU/filexp $ans`
3738 case $? in
3739 0)
3740 if test "$ans" != "$value"; then
3741 echo "(That expands to $value on this system.)"
3742 fi
3743 ;;
3744 *) value="$ans";;
3745 esac
3746 ansexp="$value"
3747 case "$exp_file" in
3748 '') value="$ans";;
3749 esac
3750 ;;
3751 esac
3752 case "$fullpath" in
3753 true)
3754 case "$ansexp" in
3755 /*) value="$ansexp" ;;
3756 [a-zA-Z]:/*) value="$ansexp" ;;
3757 *)
3758 redo=true
3759 case "$already" in
3760 true)
3761 echo "I shall only accept a full path name, as in /bin/ls." >&4
3762 echo "Use a ! shell escape if you wish to check pathnames." >&4
3763 ;;
3764 *)
3765 echo "Please give a full path name, starting with slash." >&4
3766 case "$tilde" in
3767 true)
3768 echo "Note that using ~name is ok provided it expands well." >&4
3769 already=true
3770 ;;
3771 esac
3772 esac
3773 ;;
3774 esac
3775 ;;
3776 esac
3777 case "$redo" in
3778 '')
3779 case "$type" in
3780 File)
3781 for fp in $gfpth; do
3782 if test "X$fp" = X.; then
3783 pf="$ansexp"
3784 else
3785 pf="$fp/$ansexp"
3786 fi
3787 if test -f "$pf"; then
3788 type=''
3789 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3790 then
3791 echo "($value is not a plain file, but that's ok.)"
3792 type=''
3793 fi
3794 if test X"$type" = X; then
3795 value="$pf"
3796 break
3797 fi
3798 done
3799 ;;
3800 Directory)
3801 for fp in $gfpth; do
3802 if test "X$fp" = X.; then
3803 dir="$ans"
3804 direxp="$ansexp"
3805 else
3806 dir="$fp/$ansexp"
3807 direxp="$fp/$ansexp"
3808 fi
3809 if test -d "$direxp"; then
3810 type=''
3811 value="$dir"
3812 break
3813 fi
3814 done
3815 ;;
3816 Locate)
3817 if test -d "$ansexp"; then
3818 echo "(Looking for $loc_file in directory $value.)"
3819 value="$value/$loc_file"
3820 ansexp="$ansexp/$loc_file"
3821 fi
3822 if test -f "$ansexp"; then
3823 type=''
3824 fi
3825 case "$nopath_ok" in
3826 true) case "$value" in
3827 */*) ;;
3828 *) echo "Assuming $value will be in people's path."
3829 type=''
3830 ;;
3831 esac
3832 ;;
3833 esac
3834 ;;
3835 esac
b4eb6b3d 3836
f3f1a2d8
MB
3837 case "$skip" in
3838 true) type='';
3839 esac
3840
3841 case "$type" in
3842 '') ;;
3843 *)
3844 if test "$fastread" = yes; then
3845 dflt=y
3846 else
3847 dflt=n
3848 fi
3849 rp="$what $value doesn't exist. Use that name anyway?"
3850 . UU/myread
3851 dflt=''
3852 case "$ans" in
3853 y*) type='';;
3854 *) echo " ";;
3855 esac
3856 ;;
3857 esac
3858 ;;
3859 esac
3860 ;;
b4eb6b3d 3861 esac
f3f1a2d8
MB
3862done
3863cd UU
3864ans="$value"
3865rp="$orig_rp"
3866dflt="$orig_dflt"
3867rm -f getfile.ok
3868test "X$gfpthkeep" != Xy && gfpth=""
3869EOSC
3870
3871: determine root of directory hierarchy where package will be installed.
3872case "$prefix" in
3873'')
3874 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3875 ;;
3876*?/)
3877 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3878 ;;
3879*)
f3f1a2d8 3880 dflt="$prefix"
b4eb6b3d
JH
3881 ;;
3882esac
f3f1a2d8 3883$cat <<EOM
b4eb6b3d 3884
f3f1a2d8
MB
3885By default, $package will be installed in $dflt/bin, manual pages
3886under $dflt/man, etc..., i.e. with $dflt as prefix for all
3887installation directories. Typically this is something like /usr/local.
3888If you wish to have binaries under /usr/bin but other parts of the
3889installation under /usr/local, that's ok: you will be prompted
3890separately for each of the installation directories, the prefix being
3891only used to set the defaults.
c915ce7f
JH
3892
3893EOM
f3f1a2d8
MB
3894fn=d~
3895rp='Installation prefix to use?'
3896. ./getfile
3897oldprefix=''
3898case "$prefix" in
3899'') ;;
3900*)
3901 case "$ans" in
3902 "$prefix") ;;
3903 *) oldprefix="$prefix";;
3904 esac
c915ce7f
JH
3905 ;;
3906esac
f3f1a2d8
MB
3907prefix="$ans"
3908prefixexp="$ansexp"
c915ce7f 3909
776a38e3 3910: allow them to override the AFS root
f3f1a2d8
MB
3911case "$afsroot" in
3912'') afsroot=/afs ;;
3913*) afsroot=$afsroot ;;
b4eb6b3d 3914esac
b4eb6b3d 3915
776a38e3 3916: is AFS running?
f3f1a2d8
MB
3917echo " "
3918case "$afs" in
3919$define|true) afs=true ;;
3920$undef|false) afs=false ;;
776a38e3 3921*) if $test -d $afsroot; then
f3f1a2d8
MB
3922 afs=true
3923 else
3924 afs=false
3925 fi
b4eb6b3d 3926 ;;
f3f1a2d8
MB
3927esac
3928if $afs; then
3929 echo "AFS may be running... I'll be extra cautious then..." >&4
3930else
3931 echo "AFS does not seem to be running..." >&4
9da7673b 3932fi
b4eb6b3d 3933
f3f1a2d8
MB
3934: determine installation prefix for where package is to be installed.
3935if $afs; then
3936$cat <<EOM
3937
3938Since you are running AFS, I need to distinguish the directory in which
3939files will reside from the directory in which they are installed (and from
3940which they are presumably copied to the former directory by occult means).
b4eb6b3d 3941
b4eb6b3d 3942EOM
f3f1a2d8
MB
3943 case "$installprefix" in
3944 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3945 *) dflt="$installprefix";;
3946 esac
3947else
3948$cat <<EOM
b4eb6b3d 3949
f3f1a2d8
MB
3950In some special cases, particularly when building $package for distribution,
3951it is convenient to distinguish the directory in which files should be
3952installed from the directory ($prefix) in which they will
3953eventually reside. For most users, these two directories are the same.
3954
3955EOM
3956 case "$installprefix" in
3957 '') dflt=$prefix ;;
3958 *) dflt=$installprefix;;
3959 esac
3960fi
3961fn=d~
3962rp='What installation prefix should I use for installing files?'
3963. ./getfile
3964installprefix="$ans"
3965installprefixexp="$ansexp"
3966
3967: Perform the prefixexp/installprefixexp correction if necessary
3968cat <<EOS >installprefix
3969$startsh
3970EOS
3971cat <<'EOSC' >>installprefix
3972: Change installation prefix, if necessary.
3973if $test X"$prefix" != X"$installprefix"; then
3974 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3975else
3976 eval "install${prefixvar}=\"\$${prefixvar}exp\""
3977fi
3978EOSC
3979chmod +x installprefix
3980$eunicefix installprefix
3981
3982: Set variables such as privlib and privlibexp from the output of ./getfile
3983: performing the prefixexp/installprefixexp correction if necessary.
3984cat <<EOS >setprefixvar
3985$startsh
3986EOS
3987cat <<'EOSC' >>setprefixvar
3988eval "${prefixvar}=\"\$ans\""
3989eval "${prefixvar}exp=\"\$ansexp\""
3990. ./installprefix
3991EOSC
3992chmod +x setprefixvar
3993$eunicefix setprefixvar
3994
3995: set up the script used to warn in case of inconsistency
3996cat <<EOS >whoa
3997$startsh
3998EOS
3999cat <<'EOSC' >>whoa
4000dflt=y
dcb594bc
MB
4001case "$hint" in
4002 recommended)
4003 case "$hintfile" in
4004 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4005 ;;
4006 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4007 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4008 ;;
4009 esac
4010 ;;
4011 *) echo " "
4012 echo "*** WHOA THERE!!! ***" >&4
4013 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4014 ;;
4015esac
f3f1a2d8
MB
4016rp=" Keep the $hint value?"
4017. ./myread
4018case "$ans" in
4019y) td=$was; tu=$was;;
4020esac
4021EOSC
4022
216dac04 4023: function used to set '$1' to '$val'
f3f1a2d8
MB
4024setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4025case "$val$was" in
4026$define$undef) . ./whoa; eval "$var=\$td";;
4027$undef$define) . ./whoa; eval "$var=\$tu";;
4028*) eval "$var=$val";;
4029esac'
4030
34f1896b 4031: Check is we will use socks
f3f1a2d8
MB
4032case "$usesocks" in
4033$define|true|[yY]*) dflt='y';;
4034*) dflt='n';;
4035esac
4036cat <<EOM
4037
4038Perl can be built to use the SOCKS proxy protocol library. To do so,
4039Configure must be run with -Dusesocks. If you use SOCKS you also need
4040to use the PerlIO abstraction layer, this will be implicitly selected.
4041
4042If this doesn't make any sense to you, just accept the default '$dflt'.
4043EOM
4044rp='Build Perl for SOCKS?'
4045. ./myread
4046case "$ans" in
613d6c3e 4047y|Y) val="$define" ;;
f3f1a2d8
MB
4048*) val="$undef" ;;
4049esac
4050set usesocks
4051eval $setvar
4052
4053case "$usesocks" in
4054$define|true|[yY]*) useperlio="$define";;
4055esac
4056
34f1896b 4057: Check if we want perlio
f3f1a2d8
MB
4058case "$useperlio" in
4059$define|true|[yY]*|'') dflt='y';;
4060*) dflt='n';;
4061esac
4062cat <<EOM
4063
4064Previous version of $package used the standard IO mechanisms as
4065defined in <stdio.h>. Versions 5.003_02 and later of $package allow
4066alternate IO mechanisms via the PerlIO abstraction layer, but the
4067stdio mechanism is still available if needed. The abstraction layer
4068can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4069Using PerlIO with sfio may cause problems with some extension modules.
4070
4071If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 4072EOM
f3f1a2d8
MB
4073rp='Use the PerlIO abstraction layer?'
4074. ./myread
4075case "$ans" in
34f1896b 4076y|Y)
b4eb6b3d
JH
4077 val="$define"
4078 ;;
34f1896b 4079*)
f3f1a2d8
MB
4080 echo "Ok, doing things the stdio way."
4081 val="$undef"
4082 ;;
4083esac
4084set useperlio
34f1896b 4085eval $setvar
f3f1a2d8
MB
4086
4087case "$usesocks" in
4088$define|true|[yY]*)
4089 case "$useperlio" in
4090 $define|true|[yY]*) ;;
4091 *) cat >&4 <<EOM
4092
4093You are using the SOCKS proxy protocol library which means that you
4094should also use the PerlIO layer. You may be headed for trouble.
4095
4096EOM
4097 ;;
b4eb6b3d 4098 esac
f3f1a2d8
MB
4099 ;;
4100esac
4101
5c40187f
MB
4102: get the patchlevel
4103echo " "
4104echo "Getting the current patchlevel..." >&4
4105if $test -r $rsrc/patchlevel.h;then
4106 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4107 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4108 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4109 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4110 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4111 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4112 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4113else
4114 revision=0
4115 patchlevel=0
4116 subversion=0
4117 api_revision=0
4118 api_version=0
4119 api_subversion=0
4120 perl_patchlevel=0
4121 $echo "(You do not have patchlevel.h. Eek.)"
4122fi
4123if $test -r $rsrc/.patch ; then
4124 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4125 perl_patchlevel=`cat $rsrc/.patch`
4126 fi
4127fi
4128: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4129version_patchlevel_string="version $patchlevel subversion $subversion"
4130case "$perl_patchlevel" in
41310|'') ;;
4132*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4133esac
4134
4135$echo "(You have $package $version_patchlevel_string.)"
4136
4137case "$osname" in
4138dos|vms)
4139 : XXX Should be a Configure test for double-dots in filenames.
4140 version=`echo $revision $patchlevel $subversion | \
4141 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4142 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4143 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4144 ;;
4145*)
4146 version=`echo $revision $patchlevel $subversion | \
4147 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4148 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4149 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4150 ;;
4151esac
4152: Special case the 5.005_xx maintenance series, which used 5.005
4153: without any subversion label as a subdirectory in $sitelib
4154if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4155 api_versionstring='5.005'
4156fi
4157
613d6c3e 4158: Do we want threads support and if so, what type
f3f1a2d8
MB
4159case "$usethreads" in
4160$define|true|[yY]*) dflt='y';;
4161*) # Catch case where user specified ithreads or 5005threads but
4162 # forgot -Dusethreads (A.D. 4/2002)
4163 case "$useithreads$use5005threads" in
613d6c3e 4164 *$define*)
f3f1a2d8
MB
4165 case "$useperlio" in
4166 "$define") dflt='y' ;;
4167 *) dflt='n' ;;
4168 esac
4169 ;;
4170 *) dflt='n';;
4171 esac
4172 ;;
4173esac
4174cat <<EOM
4175
4176Perl can be built to take advantage of threads on some systems.
4177To do so, Configure can be run with -Dusethreads.
4178
4179Note that Perl built with threading support runs slightly slower
4180and uses more memory than plain Perl. The current implementation
4181is believed to be stable, but it is fairly new, and so should be
4182treated with caution.
4183
4184If this doesn't make any sense to you, just accept the default '$dflt'.
4185EOM
4186rp='Build a threading Perl?'
4187. ./myread
4188case "$ans" in
4189y|Y) val="$define" ;;
4190*) val="$undef" ;;
4191esac
4192set usethreads
4193eval $setvar
4194
5c40187f
MB
4195if $test $patchlevel -lt 9; then
4196 case "$usethreads" in
4197 $define)
f3f1a2d8
MB
4198 $cat <<EOM
4199
4200Since release 5.6, Perl has had two different threading implementations,
4201the newer interpreter-based version (ithreads) with one interpreter per
4202thread, and the older 5.005 version (5005threads).
4203The 5005threads version is effectively unmaintained and will probably be
4204removed in Perl 5.10, so there should be no need to build a Perl using it
4205unless needed for backwards compatibility with some existing 5.005threads
4206code.
4207
4208EOM
4209 : Default to ithreads unless overridden on command line or with
4210 : old config.sh
4211 dflt='y'
4212 case "$use5005threads" in
4213 $define|true|[yY]*) dflt='n';;
4214 esac
4215 case "$useithreads" in
4216 $undef|false|[nN]*) dflt='n';;
4217 esac
4218 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4219 . ./myread
4220 case "$ans" in
f3f1a2d8 4221 y|Y) val="$define" ;;
b4eb6b3d
JH
4222 *) val="$undef" ;;
4223 esac
f3f1a2d8
MB
4224 set useithreads
4225 eval $setvar
4226 : Now set use5005threads to the opposite value.
4227 case "$useithreads" in
4228 $define) val="$undef" ;;
4229 *) val="$define" ;;
4230 esac
4231 set use5005threads
4232 eval $setvar
4233 ;;
5c40187f 4234 *)
f3f1a2d8
MB
4235 useithreads="$undef"
4236 use5005threads="$undef"
b4eb6b3d 4237 ;;
5c40187f 4238 esac
b4eb6b3d 4239
5c40187f
MB
4240 case "$useithreads$use5005threads" in
4241 "$define$define")
f3f1a2d8 4242 $cat >&4 <<EOM
96056487 4243
f3f1a2d8
MB
4244You cannot have both the ithreads and the 5.005 threads enabled
4245at the same time. Disabling the 5.005 threads since they are
4246much less stable than the ithreads.
4247
4248EOM
4249 use5005threads="$undef"
96056487 4250 ;;
5c40187f
MB
4251 esac
4252
4253else
4254: perl-5.9.x and later
4255
47f9f84c 4256 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4257 case "$use5005threads" in
4258 $define|true|[yY]*)
4259 $cat >&4 <<EOM
47f9f84c
JH
4260
42615.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4262
47f9f84c 4263EOM
3f30fabf
MB
4264 ;;
4265 esac
47f9f84c 4266 fi
3f30fabf 4267
47f9f84c
JH
4268 use5005threads="$undef"
4269 useithreads="$usethreads"
5c40187f 4270fi
96056487 4271
f3f1a2d8
MB
4272if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4273 cat >&4 <<EOF
4274***
4275*** To build with ithreads you must also use the PerlIO layer.
4276*** Cannot continue, aborting.
4277***
4278EOF
4279 exit 1
4280fi
4281
4282case "$d_oldpthreads" in
4283'') : Configure tests would be welcome here. For now, assume undef.
4284 val="$undef" ;;
4285*) val="$d_oldpthreads" ;;
4286esac
4287set d_oldpthreads
4288eval $setvar
4289
4290
4291: Look for a hint-file generated 'call-back-unit'. If the
4292: user has specified that a threading perl is to be built,
4293: we may need to set or change some other defaults.
4294if $test -f usethreads.cbu; then
4295 echo "Your platform has some specific hints regarding threaded builds, using them..."
4296 . ./usethreads.cbu
4297else
4298 case "$usethreads" in
4299 "$define"|true|[yY]*)
4300 $cat <<EOM
4301(Your platform does not have any specific hints for threaded builds.
4302 Assuming POSIX threads, then.)
4303EOM
4304 ;;
4305 esac
4306fi
4307
34f1896b 4308: Check if multiplicity is required
f3f1a2d8
MB
4309cat <<EOM
4310
4311Perl can be built so that multiple Perl interpreters can coexist
4312within the same Perl executable.
4313EOM
4314
4315case "$useithreads" in
4316$define)
4317 cat <<EOM
4318This multiple interpreter support is required for interpreter-based threads.
4319EOM
4320 val="$define"
4321 ;;
4322*) case "$usemultiplicity" in
4323 $define|true|[yY]*) dflt='y';;
4324 *) dflt='n';;
4325 esac
4326 echo " "
4327 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4328 rp='Build Perl for multiplicity?'
4329 . ./myread
4330 case "$ans" in
4331 y|Y) val="$define" ;;
4332 *) val="$undef" ;;
4333 esac
4334 ;;
4335esac
4336set usemultiplicity
4337eval $setvar
4338
34f1896b 4339: Check if morebits is requested
f3f1a2d8
MB
4340case "$usemorebits" in
4341"$define"|true|[yY]*)
4342 use64bitint="$define"
4343 uselongdouble="$define"
4344 usemorebits="$define"
4345 ;;
4346*) usemorebits="$undef"
4347 ;;
4348esac
4349
776a38e3
MB
4350: Determine the C compiler to be used
4351echo " "
4352case "$cc" in
4353'') dflt=cc;;
4354*) dflt="$cc";;
4355esac
4356rp="Use which C compiler?"
4357. ./myread
4358cc="$ans"
4359
4360: See whether they have no cc but they do have gcc
4361. ./trygcc
4362if $test -f cc.cbu; then
4363 . ./cc.cbu
4364fi
4365. ./checkcc
4366
f3f1a2d8
MB
4367: make some quick guesses about what we are up against
4368echo " "
4369$echo $n "Hmm... $c"
4370echo exit 1 >bsd
4371echo exit 1 >usg
4372echo exit 1 >v7
4373echo exit 1 >osf1
4374echo exit 1 >eunice
4375echo exit 1 >xenix
4376echo exit 1 >venix
4377echo exit 1 >os2
4378d_bsd="$undef"
4379$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4380if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4381then
4382 echo "Looks kind of like an OSF/1 system, but we'll see..."
4383 echo exit 0 >osf1
381aa1ff 4384elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4385 xxx=`./loc addbib blurfl $pth`
4386 if $test -f $xxx; then
4387 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4388 echo exit 0 >bsd
4389 echo exit 0 >usg
4390 else
4391 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4392 echo "Looks kind of like an extended USG system, but we'll see..."
4393 else
4394 echo "Looks kind of like a USG system, but we'll see..."
4395 fi
4396 echo exit 0 >usg
4397 fi
4398elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4399 echo "Looks kind of like a BSD system, but we'll see..."
4400 d_bsd="$define"
4401 echo exit 0 >bsd
4402else
4403 echo "Looks kind of like a Version 7 system, but we'll see..."
4404 echo exit 0 >v7
4405fi
4406case "$eunicefix" in
4407*unixtovms*)
4408 $cat <<'EOI'
4409There is, however, a strange, musty smell in the air that reminds me of
4410something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4411EOI
4412 echo exit 0 >eunice
4413 d_eunice="$define"
4414: it so happens the Eunice I know will not run shell scripts in Unix format
4415 ;;
4416*)
4417 echo " "
4418 echo "Congratulations. You aren't running Eunice."
4419 d_eunice="$undef"
4420 ;;
4421esac
4422: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4423: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4424: semicolon as a patch separator
e5e20432
JH
4425case "$p_" in
4426:) ;;
4427*)
4428 $cat <<'EOI'
4429I have the feeling something is not exactly right, however...don't tell me...
4430lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4431(Or you may be running DOS with DJGPP.)
e5e20432
JH
4432EOI
4433 echo exit 0 >os2
4434 ;;
4435esac
4436if test -f /xenix; then
4437 echo "Actually, this looks more like a XENIX system..."
4438 echo exit 0 >xenix
4439 d_xenix="$define"
4440else
4441 echo " "
4442 echo "It's not Xenix..."
4443 d_xenix="$undef"
4444fi
4445chmod +x xenix
4446$eunicefix xenix
4447if test -f /venix; then
4448 echo "Actually, this looks more like a VENIX system..."
4449 echo exit 0 >venix
4450else
4451 echo " "
4452 if ./xenix; then
4453 : null
4454 else
4455 echo "Nor is it Venix..."
4456 fi
4457fi
4458chmod +x bsd usg v7 osf1 eunice xenix venix os2
4459$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4460$rm -f foo
4461
613d6c3e 4462: Check if we are using GNU gcc and what its version is
e5e20432
JH
4463echo " "
4464echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4465$cat >try.c <<EOM
e5e20432
JH
4466#include <stdio.h>
4467int main() {
7686528e 4468#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4469#ifdef __VERSION__
4470 printf("%s\n", __VERSION__);
4471#else
4472 printf("%s\n", "1");
4473#endif
4474#endif
073b6de5 4475 return(0);
e5e20432
JH
4476}
4477EOM
5440bc8e
JH
4478if $cc -o try $ccflags $ldflags try.c; then
4479 gccversion=`$run ./try`
f3f1a2d8
MB
4480 case "$gccversion" in
4481 '') echo "You are not using GNU cc." ;;
4482 *) echo "You are using GNU cc $gccversion."
4483 ccname=gcc
4484 ;;
4485 esac
4486else
4487 echo " "
4488 echo "*** WHOA THERE!!! ***" >&4
4489 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4490 case "$knowitall" in
4491 '')
4492 echo " You'd better start hunting for one and let me know about it." >&4
4493 exit 1
2304df62
AD
4494 ;;
4495 esac
f3f1a2d8
MB
4496fi
4497$rm -f try try.*
4498case "$gccversion" in
44991*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4500esac
4501case "$gccversion" in
4502'') gccosandvers='' ;;
4503*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4504 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4505 gccshortvers=''
4506 case "$gccosandvers" in
4507 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4508 $osname$osvers) ;; # looking good
4509 $osname*) cat <<EOM >&4
4510
4511*** WHOA THERE!!! ***
4512
4513 Your gcc has not been compiled for the exact release of
4514 your operating system ($gccosandvers versus $osname$osvers).
4515
4516 In general it is a good idea to keep gcc synchronized with
4517 the operating system because otherwise serious problems
4518 may ensue when trying to compile software, like Perl.
4519
4520 I'm trying to be optimistic here, though, and will continue.
4521 If later during the configuration and build icky compilation
4522 problems appear (headerfile conflicts being the most common
4523 manifestation), I suggest reinstalling the gcc to match
4524 your operating system release.
4525
4526EOM
4527 ;;
4528 *) gccosandvers='' ;; # failed to parse, better be silent
4529 esac
4530 ;;
4531esac
4532case "$ccname" in
4533'') ccname="$cc" ;;
4534esac
4535
4536# gcc 3.* complain about adding -Idirectories that they already know about,
4537# so we will take those off from locincpth.
4538case "$gccversion" in
45393*)
4540 echo "main(){}">try.c
4541 for incdir in $locincpth; do
4542 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4543 grep '^c[cp]p*[01]: warning: changing search order '`
4544 if test "X$warn" != X; then
4545 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4546 fi
4547 done
4548 $rm -f try try.*
4549esac
2304df62 4550
bd9b35c9
JH
4551: What should the include directory be ?
4552echo " "
4553$echo $n "Hmm... $c"
4554dflt='/usr/include'
4555incpath=''
4556mips_type=''
4557if $test -f /bin/mips && /bin/mips; then
4558 echo "Looks like a MIPS system..."
4559 $cat >usr.c <<'EOCP'
4560#ifdef SYSTYPE_BSD43
4561/bsd43
4562#endif
4563EOCP
8a27cf78 4564 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4565 dflt='/bsd43/usr/include'
4566 incpath='/bsd43'
4567 mips_type='BSD 4.3'
4568 else
4569 mips_type='System V'
4570 fi
4571 $rm -f usr.c usr.out
4572 echo "and you're compiling with the $mips_type compiler and libraries."
4573 xxx_prompt=y
4574 echo "exit 0" >mips
4575else
4576 echo "Doesn't look like a MIPS system."
4577 xxx_prompt=n
4578 echo "exit 1" >mips
4579fi
4580chmod +x mips
4581$eunicefix mips
4582case "$usrinc" in
4583'') ;;
4584*) dflt="$usrinc";;
4585esac
4586case "$xxx_prompt" in
4587y) fn=d/
4588 echo " "
4589 rp='Where are the include files you want to use?'
4590 . ./getfile
4591 usrinc="$ans"
8e07c86e 4592 ;;
bd9b35c9 4593*) usrinc="$dflt"
8e07c86e
AD
4594 ;;
4595esac
2304df62 4596
96056487
JH
4597: see how we invoke the C preprocessor
4598echo " "
4599echo "Now, how can we feed standard input to your C preprocessor..." >&4
4600cat <<'EOT' >testcpp.c
4601#define ABC abc
4602#define XYZ xyz
4603ABC.XYZ
4604EOT
4605cd ..
4606if test ! -f cppstdin; then
4607 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4608 # AIX cc -E doesn't show the absolute headerfile
4609 # locations but we'll cheat by using the -M flag.
4610 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
4611 else
4612 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4613 fi
4614else
4615 echo "Keeping your $hint cppstdin wrapper."
4616fi
4617chmod 755 cppstdin
4618wrapper=`pwd`/cppstdin
4619ok='false'
4620cd UU
4621
4622if $test "X$cppstdin" != "X" && \
4623 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4624 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4625then
4626 echo "You used to use $cppstdin $cppminus so we'll use that again."
4627 case "$cpprun" in
4628 '') echo "But let's see if we can live without a wrapper..." ;;
4629 *)
4630 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4631 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4632 then
4633 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4634 ok='true'
4635 else
4636 echo "(However, $cpprun $cpplast does not work, let's see...)"
4637 fi
4638 ;;
4639 esac
4640else
4641 case "$cppstdin" in
4642 '') ;;
4643 *)
4644 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4645 ;;
4646 esac
4647fi
4648
4649if $ok; then
4650 : nothing
4651elif echo 'Maybe "'"$cc"' -E" will work...'; \
4652 $cc -E <testcpp.c >testcpp.out 2>&1; \
4653 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4654 echo "Yup, it does."
4655 x_cpp="$cc -E"
4656 x_minus='';
4657elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4658 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4659 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4660 echo "Yup, it does."
4661 x_cpp="$cc -E"
4662 x_minus='-';
4663elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4664 $cc -P <testcpp.c >testcpp.out 2>&1; \
4665 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4666 echo "Yipee, that works!"
4667 x_cpp="$cc -P"
4668 x_minus='';
4669elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4670 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4671 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4672 echo "At long last!"
4673 x_cpp="$cc -P"
4674 x_minus='-';
4675elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4676 $cpp <testcpp.c >testcpp.out 2>&1; \
4677 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4678 echo "It works!"
4679 x_cpp="$cpp"
4680 x_minus='';
4681elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4682 $cpp - <testcpp.c >testcpp.out 2>&1; \
4683 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4684 echo "Hooray, it works! I was beginning to wonder."
4685 x_cpp="$cpp"
4686 x_minus='-';
4687elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4688 $wrapper <testcpp.c >testcpp.out 2>&1; \
4689 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4690 x_cpp="$wrapper"
4691 x_minus=''
4692 echo "Eureka!"
4693else
4694 dflt=''
4695 rp="No dice. I can't find a C preprocessor. Name one:"
4696 . ./myread
4697 x_cpp="$ans"
4698 x_minus=''
4699 $x_cpp <testcpp.c >testcpp.out 2>&1
4700 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4701 echo "OK, that will do." >&4
4702 else
4703echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4704 exit 1
4705 fi
4706fi
4707
4708case "$ok" in
4709false)
4710 cppstdin="$x_cpp"
4711 cppminus="$x_minus"
4712 cpprun="$x_cpp"
4713 cpplast="$x_minus"
4714 set X $x_cpp
4715 shift
4716 case "$1" in
4717 "$cpp")
4718 echo "Perhaps can we force $cc -E using a wrapper..."
4719 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4720 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4721 then
4722 echo "Yup, we can."
4723 cppstdin="$wrapper"
4724 cppminus='';
4725 else
4726 echo "Nope, we'll have to live without it..."
4727 fi
4728 ;;
4729 esac
4730 case "$cpprun" in
4731 "$wrapper")
4732 cpprun=''
4733 cpplast=''
4734 ;;
4735 esac
4736 ;;
4737esac
4738
4739case "$cppstdin" in
4740"$wrapper"|'cppstdin') ;;
4741*) $rm -f $wrapper;;
4742esac
4743$rm -f testcpp.c testcpp.out
4744
bd9b35c9
JH
4745: Set private lib path
4746case "$plibpth" in
4747'') if ./mips; then
4748 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4749 fi;;
4750esac
4751case "$libpth" in
4752' ') dlist='';;
4753'') dlist="$loclibpth $plibpth $glibpth";;
4754*) dlist="$libpth";;
4755esac
4756
4757: Now check and see which directories actually exist, avoiding duplicates
4758libpth=''
4759for xxx in $dlist
4760do
4761 if $test -d $xxx; then
4762 case " $libpth " in
4763 *" $xxx "*) ;;
4764 *) libpth="$libpth $xxx";;
4765 esac
4766 fi
4767done
4768$cat <<'EOM'
4769
4770Some systems have incompatible or broken versions of libraries. Among
4771the directories listed in the question below, please remove any you
4772know not to be holding relevant libraries, and add any that are needed.
4773Say "none" for none.
8e07c86e
AD
4774
4775EOM
bd9b35c9
JH
4776case "$libpth" in
4777'') dflt='none';;
8e07c86e 4778*)
bd9b35c9
JH
4779 set X $libpth
4780 shift
4781 dflt=${1+"$@"}
8e07c86e 4782 ;;
a0d0e21e 4783esac
bd9b35c9
JH
4784rp="Directories to use for library searches?"
4785. ./myread
4786case "$ans" in
4787none) libpth=' ';;
4788*) libpth="$ans";;
4789esac
a0d0e21e 4790
bd9b35c9
JH
4791: compute shared library extension
4792case "$so" in
4793'')
4794 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4795 dflt='sl'
dd4e71fd 4796 else
bd9b35c9 4797 dflt='so'
dd4e71fd
JH
4798 fi
4799 ;;
bd9b35c9 4800*) dflt="$so";;
dd4e71fd 4801esac
dd4e71fd
JH
4802$cat <<EOM
4803
bd9b35c9 4804On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4805you want to suppress searching of shared libraries for the remainder
bd9b35c9 4806of this configuration.
dd4e71fd
JH
4807
4808EOM
bd9b35c9
JH
4809rp='What is the file extension used for shared libraries?'
4810. ./myread
4811so="$ans"
dd4e71fd 4812
bd9b35c9
JH
4813: Define several unixisms.
4814: Hints files or command line option can be used to override them.
4815: The convoluted testing is in case hints files set either the old
4816: or the new name.
4817case "$_exe" in
4818'') case "$exe_ext" in
1fef16b3 4819 '') ;;
bd9b35c9 4820 *) _exe="$exe_ext" ;;
dd4e71fd 4821 esac
bd9b35c9 4822 ;;
bfb7748a 4823esac
bd9b35c9
JH
4824case "$_a" in
4825'') case "$lib_ext" in
4826 '') _a='.a';;
4827 *) _a="$lib_ext" ;;
dd4e71fd
JH
4828 esac
4829 ;;
dd4e71fd 4830esac
bd9b35c9
JH
4831case "$_o" in
4832'') case "$obj_ext" in
4833 '') _o='.o';;
4834 *) _o="$obj_ext";;
4835 esac
4836 ;;
4837esac
4838case "$p_" in
4839'') case "$path_sep" in
4840 '') p_=':';;
4841 *) p_="$path_sep";;
4842 esac
4843 ;;
4844esac
4845exe_ext=$_exe
4846lib_ext=$_a
4847obj_ext=$_o
4848path_sep=$p_
dd4e71fd 4849
5b813a60
MB
4850rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4851
b4eb6b3d
JH
4852: Which makefile gets called first. This is used by make depend.
4853case "$firstmakefile" in
4854'') firstmakefile='makefile';;
4633a7c4 4855esac
4633a7c4 4856
34f1896b 4857: Check for uselongdouble support
1f603089
JH
4858case "$ccflags" in
4859*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4860esac
4861
4862case "$uselongdouble" in
4863$define|true|[yY]*) dflt='y';;
4864*) dflt='n';;
4865esac
4866cat <<EOM
4867
4868Perl can be built to take advantage of long doubles which
4869(if available) may give more accuracy and range for floating point numbers.
4870
4871If this doesn't make any sense to you, just accept the default '$dflt'.
4872EOM
4873rp='Try to use long doubles if available?'
4874. ./myread
4875case "$ans" in
4876y|Y) val="$define" ;;
4877*) val="$undef" ;;
4878esac
4879set uselongdouble
4880eval $setvar
4881
4882case "$uselongdouble" in
4883true|[yY]*) uselongdouble="$define" ;;
4884esac
4885
1f603089
JH
4886: Look for a hint-file generated 'call-back-unit'. If the
4887: user has specified that long doubles should be used,
4888: we may need to set or change some other defaults.
9da7673b
MB
4889if $test -f uselongdouble.cbu; then
4890 echo "Your platform has some specific hints regarding long doubles, using them..."
4891 . ./uselongdouble.cbu
4892else
4893 case "$uselongdouble" in
4894 $define)
1f603089 4895 $cat <<EOM
9da7673b 4896(Your platform does not have any specific hints for long doubles.)
1f603089 4897EOM
1f603089 4898 ;;
9da7673b
MB
4899 esac
4900fi
1f603089 4901
bd9b35c9
JH
4902: Looking for optional libraries
4903echo " "
4904echo "Checking for optional libraries..." >&4
4905case "$libs" in
4906' '|'') dflt='';;
4907*) dflt="$libs";;
4908esac
4909case "$libswanted" in
4910'') libswanted='c_s';;
4911esac
4912case "$usesocks" in
923fc586 4913"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4914esac
68435ea7
JH
4915libsfound=''
4916libsfiles=''
4917libsdirs=''
13b3f787
JH
4918libspath=''
4919for thisdir in $libpth $xlibpth; do
4920 test -d $thisdir && libspath="$libspath $thisdir"
4921done
bd9b35c9 4922for thislib in $libswanted; do
13b3f787 4923 for thisdir in $libspath; do
f7dd4e7f
JH
4924 xxx=''
4925 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4926 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4927 $test -f "$xxx" && eval $libscheck
4928 $test -f "$xxx" && libstyle=shared
4929 fi
4930 if test ! -f "$xxx"; then
4931 xxx=$thisdir/lib$thislib.$so
4932 $test -f "$xxx" && eval $libscheck
4933 $test -f "$xxx" && libstyle=shared
613d6c3e 4934 fi
f7dd4e7f
JH
4935 if test ! -f "$xxx"; then
4936 xxx=$thisdir/lib$thislib$_a
4937 $test -f "$xxx" && eval $libscheck
4938 $test -f "$xxx" && libstyle=static
4939 fi
4940 if test ! -f "$xxx"; then
4941 xxx=$thisdir/$thislib$_a
4942 $test -f "$xxx" && eval $libscheck
4943 $test -f "$xxx" && libstyle=static
4944 fi
4945 if test ! -f "$xxx"; then
4946 xxx=$thisdir/lib${thislib}_s$_a
4947 $test -f "$xxx" && eval $libscheck
4948 $test -f "$xxx" && libstyle=static
09ea5ba9 4949 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4950 fi
4951 if test ! -f "$xxx"; then
4952 xxx=$thisdir/Slib$thislib$_a
4953 $test -f "$xxx" && eval $libscheck
4954 $test -f "$xxx" && libstyle=static
4955 fi
4956 if $test -f "$xxx"; then
43999f95 4957 case "$libstyle" in
f7dd4e7f
JH
4958 shared) echo "Found -l$thislib (shared)." ;;
4959 static) echo "Found -l$thislib." ;;
4960 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4961 esac
bd9b35c9
JH
4962 case " $dflt " in
4963 *"-l$thislib "*);;
f7dd4e7f 4964 *) dflt="$dflt -l$thislib"
43999f95
JH
4965 libsfound="$libsfound $xxx"
4966 yyy=`basename $xxx`
4967 libsfiles="$libsfiles $yyy"
1e127011 4968 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4969 case " $libsdirs " in
4970 *" $yyy "*) ;;
4971 *) libsdirs="$libsdirs $yyy" ;;
4972 esac
4973 ;;
bd9b35c9 4974 esac
f7dd4e7f 4975 break
613d6c3e 4976 fi
f7dd4e7f
JH
4977 done
4978 if $test ! -f "$xxx"; then
4979 echo "No -l$thislib."
bd9b35c9
JH
4980 fi
4981done
4982set X $dflt
4983shift
4984dflt="$*"
4985case "$libs" in
4986'') dflt="$dflt";;
4987*) dflt="$libs";;
4988esac
4989case "$dflt" in
4990' '|'') dflt='none';;
4991esac
4633a7c4 4992
bd9b35c9 4993$cat <<EOM
4633a7c4 4994
bd9b35c9
JH
4995In order to compile $package on your machine, a number of libraries
4996are usually needed. Include any other special libraries here as well.
4997Say "none" for none. The default list is almost always right.
8e07c86e 4998EOM
8e07c86e 4999
bd9b35c9
JH
5000echo " "
5001rp="What libraries to use?"
5002. ./myread
5003case "$ans" in
5004none) libs=' ';;
5005*) libs="$ans";;
5006esac
d71b2b6b 5007
bd9b35c9
JH
5008: determine optimization, if desired, or use for debug flag also
5009case "$optimize" in
5010' '|$undef) dflt='none';;
5011'') dflt='-O';;
5012*) dflt="$optimize";;
5013esac
5014$cat <<EOH
d71b2b6b 5015
bd9b35c9
JH
5016By default, $package compiles with the -O flag to use the optimizer.
5017Alternately, you might want to use the symbolic debugger, which uses
5018the -g flag (on traditional Unix systems). Either flag can be
5019specified here. To use neither flag, specify the word "none".
d71b2b6b 5020
bd9b35c9
JH
5021EOH
5022rp="What optimizer/debugger flag should be used?"
5023. ./myread
5024optimize="$ans"
5025case "$optimize" in
5026'none') optimize=" ";;
5027esac
5028
eaf812ae
MB
5029: Check what DEBUGGING is required from the command line
5030: -DEBUGGING or -DDEBUGGING or
5031: -DEBUGGING=both = -g + -DDEBUGGING
5032: -DEBUGGING=-g or -Doptimize=-g = -g
5033: -DEBUGGING=none or -UDEBUGGING =
5034: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5035case "$EBUGGING" in
5036'') ;;
5037*) DEBUGGING=$EBUGGING ;;
5038esac
5039
5040case "$DEBUGGING" in
5a7c70d6 5041-g|both|$define)
eaf812ae
MB
5042 case "$optimize" in
5043 *-g*) ;;
5044 *) optimize="$optimize -g" ;;
5045 esac ;;
5046none|$undef)
5047 case "$optimize" in
5048 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5049 shift
5050 optimize="$*"
5051 ;;
5052 esac ;;
5053esac
5054
bd9b35c9 5055dflt=''
eaf812ae
MB
5056case "$DEBUGGING" in
5057both|$define) dflt='-DDEBUGGING'
5058esac
5059
c34316b3
NC
5060: argument order is deliberate, as the flag will start with - which set could
5061: think is an option
6682be1c 5062checkccflag='check=$1; flag=$2; callback=$3;
c34316b3
NC
5063echo " ";
5064echo "Checking if your compiler accepts $flag" 2>&1;
5065echo "int main(void) { return 0; }" > gcctest.c;
04b62921 5066if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
c34316b3 5067 echo "Yes, it does." 2>&1;
580e570e 5068 if $test -s gcctest.out ; then
04b62921
MB
5069 echo "But your platform does not like it:";
5070 cat gcctest.out;
5071 else
5072 case "$ccflags" in
5073 *$check*)
5074 echo "Leaving current flags $ccflags alone." 2>&1
5075 ;;
5076 *) dflt="$dflt $flag";
5077 eval $callback
5078 ;;
5079 esac
5080 fi
c34316b3
NC
5081else
5082 echo "Nope, it does not, but that is ok." 2>&1;
5083fi
5084'
5085
bd9b35c9
JH
5086: We will not override a previous value, but we might want to
5087: augment a hint file
5088case "$hint" in
5089default|recommended)
5090 case "$gccversion" in
eaf812ae 5091 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5092 esac
eaf812ae
MB
5093 case "$optimize:$DEBUGGING" in
5094 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5095 esac
bd9b35c9 5096 case "$gccversion" in
580e570e 5097 2*) if $test -d /etc/conf/kconfig.d &&
bd9b35c9
JH
5098 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5099 then
00e89ad4 5100 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5101 dflt="$dflt -posix"
5102 fi
f0d04425 5103 ;;
bd9b35c9
JH
5104 esac
5105 case "$gccversion" in
5106 1*) ;;
5107 2.[0-8]*) ;;
c0bacbef 5108 ?*) set strict-aliasing -fno-strict-aliasing
c34316b3 5109 eval $checkccflag
f0d04425 5110 ;;
e5e20432 5111 esac
00e89ad4
AD
5112 # For gcc, adding -pipe speeds up compilations for some, but apparently
5113 # some assemblers can't read from stdin. (It also slows down compilations
5114 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5115 case "$gccversion" in
c34316b3
NC
5116 ?*) set pipe -pipe
5117 eval $checkccflag
00e89ad4
AD
5118 ;;
5119 esac
6682be1c
NC
5120
5121 # on x86_64 (at least) we require an extra library (libssp) in the
5122 # link command line. This library is not named, so I infer that it is
5123 # an implementation detail that may change. Hence the safest approach
5124 # is to add the flag to the flags passed to the compiler at link time,
5125 # as that way the compiler can do the right implementation dependant
5126 # thing. (NWC)
5127 case "$gccversion" in
8f68b0e6 5128 ?*) set stack-protector -fstack-protector
6682be1c
NC
5129 eval $checkccflag
5130 ;;
5131 esac
e5e20432
JH
5132 ;;
5133esac
5134
bd9b35c9
JH
5135case "$mips_type" in
5136*BSD*|'') inclwanted="$locincpth $usrinc";;
5137*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5138esac
5139for thisincl in $inclwanted; do
5140 if $test -d $thisincl; then
5141 if $test x$thisincl != x$usrinc; then
5142 case "$dflt" in
00e89ad4
AD
5143 *" -I$thisincl "*);;
5144 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5145 esac
5146 fi
5147 fi
5148done
40a7a20a 5149
bd9b35c9
JH
5150inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5151 xxx=true;
5152elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5153 xxx=true;
5154else
5155 xxx=false;
5156fi;
5157if $xxx; then
5158 case "$dflt" in
5159 *$2*);;
5160 *) dflt="$dflt -D$2";;
5161 esac;
5162fi'
40a7a20a 5163
bd9b35c9 5164set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5165
bd9b35c9
JH
5166case "$usesocks" in
5167$define)
5168 ccflags="$ccflags -DSOCKS"
5169 ;;
5170esac
40a7a20a 5171
bd9b35c9
JH
5172case "$hint" in
5173default|recommended) dflt="$ccflags $dflt" ;;
5174*) dflt="$ccflags";;
5175esac
40a7a20a 5176
bd9b35c9
JH
5177case "$dflt" in
5178''|' ') dflt=none;;
5179esac
422af00a 5180
bd9b35c9 5181$cat <<EOH
40a7a20a 5182
bd9b35c9
JH
5183Your C compiler may want other flags. For this question you should include
5184-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5185but you should NOT include libraries or ld flags like -lwhatever. If you
5186want $package to honor its debug switch, you should include -DDEBUGGING here.
5187Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5188
bd9b35c9 5189To use no flags, specify the word "none".
40a7a20a 5190
bd9b35c9
JH
5191EOH
5192set X $dflt
5193shift
5194dflt=${1+"$@"}
5195rp="Any additional cc flags?"
5196. ./myread
5197case "$ans" in
5198none) ccflags='';;
5199*) ccflags="$ans";;
5200esac
8e07c86e 5201
bd9b35c9 5202: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5203case "$cppflags" in
5204'') cppflags="$ccflags" ;;
5205*) cppflags="$cppflags $ccflags" ;;
5206esac
bd9b35c9
JH
5207case "$gccversion" in
52081*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5209esac
bd9b35c9
JH
5210case "$mips_type" in
5211'');;
5212*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5213esac
5214case "$cppflags" in
5215'');;
5216*)
5217 echo " "
5218 echo "Let me guess what the preprocessor flags are..." >&4
5219 set X $cppflags
5220 shift
5221 cppflags=''
5222 $cat >cpp.c <<'EOM'
5223#define BLURFL foo
8e07c86e 5224
bd9b35c9
JH
5225BLURFL xx LFRULB
5226EOM
5227 previous=''
5228 for flag in $*
5229 do
5230 case "$flag" in
5231 -*) ftry="$flag";;
5232 *) ftry="$previous $flag";;
5233 esac
5234 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5235 >cpp1.out 2>/dev/null && \
5236 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5237 >cpp2.out 2>/dev/null && \
5238 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5239 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5240 then
5241 cppflags="$cppflags $ftry"
5242 previous=''
5243 else
5244 previous="$flag"
5245 fi
5246 done
5247 set X $cppflags
5248 shift
5249 cppflags=${1+"$@"}
5250 case "$cppflags" in
5251 *-*) echo "They appear to be: $cppflags";;
5252 esac
5253 $rm -f cpp.c cpp?.out
2afac517 5254 ;;
5255esac
8e07c86e 5256
bd9b35c9
JH
5257: flags used in final linking phase
5258case "$ldflags" in
5259'') if ./venix; then
5260 dflt='-i -z'
10a23457 5261 else
bd9b35c9 5262 dflt=''
10a23457 5263 fi
bd9b35c9
JH
5264 case "$ccflags" in
5265 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5266 esac
bd9b35c9
JH
5267 ;;
5268*) dflt="$ldflags";;
5269esac
b2f871ed
AD
5270# See note above about -fstack-protector
5271case "$ccflags" in
5272*-fstack-protector*)
5273 case "$dflt" in
5274 *-fstack-protector*) ;; # Don't add it again
5275 *) dflt="$dflt -fstack-protector" ;;
5276 esac
5277 ;;
5278esac
bd9b35c9
JH
5279
5280: Try to guess additional flags to pick up local libraries.
5281for thislibdir in $libpth; do
5282 case " $loclibpth " in
5283 *" $thislibdir "*)
00e89ad4 5284 case "$dflt " in
bd9b35c9
JH
5285 *"-L$thislibdir "*) ;;
5286 *) dflt="$dflt -L$thislibdir" ;;
5287 esac
c4f23d77
AD
5288 ;;
5289 esac
bd9b35c9 5290done
c4f23d77 5291
bd9b35c9
JH
5292case "$dflt" in
5293'') dflt='none' ;;
5294esac
c4f23d77 5295
bd9b35c9
JH
5296$cat <<EOH
5297
5298Your C linker may need flags. For this question you should
5299include -L/whatever and any other flags used by the C linker, but you
5300should NOT include libraries like -lwhatever.
5301
5302Make sure you include the appropriate -L/path flags if your C linker
5303does not normally search all of the directories you specified above,
5304namely
5305 $libpth
5306To use no flags, specify the word "none".
5307
5308EOH
5309
5310rp="Any additional ld flags (NOT including libraries)?"
5311. ./myread
5312case "$ans" in
5313none) ldflags='';;
5314*) ldflags="$ans";;
5315esac
5316rmlist="$rmlist pdp11"
5317
5318: coherency check
5319echo " "
5320echo "Checking your choice of C compiler and flags for coherency..." >&4
5321$cat > try.c <<'EOF'
5322#include <stdio.h>
55954f19 5323int main() { printf("Ok\n"); return(0); }
bd9b35c9 5324EOF
7a282f6d 5325set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5326shift
5327$cat >try.msg <<'EOM'
5328I've tried to compile and run the following simple program:
5329
5330EOM
5331$cat try.c >> try.msg
5332
5333$cat >> try.msg <<EOM
5334
5335I used the command:
5336
5337 $*
5440bc8e 5338 $run ./try
bd9b35c9
JH
5339
5340and I got the following output:
5341
5342EOM
5343dflt=y
73614538 5344if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
613d6c3e 5345 if $sh -c "$run ./try " >>try.msg 2>&1; then
5440bc8e 5346 xxx=`$run ./try`
bd9b35c9
JH
5347 case "$xxx" in
5348 "Ok") dflt=n ;;
5349 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5350 case " $libs " in
5351 *" -lsfio "*)
5352 cat >> try.msg <<'EOQS'
5353If $libs contains -lsfio, and sfio is mis-configured, then it
5354sometimes (apparently) runs and exits with a 0 status, but with no
5355output! It may have to do with sfio's use of _exit vs. exit.
5356
5357EOQS
5358 rp="You have a big problem. Shall I abort Configure"
5359 dflt=y
5360 ;;
5361 esac
5362 ;;
5363 esac
5364 else
5365 echo "The program compiled OK, but exited with status $?." >>try.msg
5366 rp="You have a problem. Shall I abort Configure"
5367 dflt=y
5368 fi
5369else
5370 echo "I can't compile the test program." >>try.msg
5371 rp="You have a BIG problem. Shall I abort Configure"
5372 dflt=y
5373fi
5374case "$dflt" in
5375y)
5376 $cat try.msg >&4
5377 case "$knowitall" in
5378 '')
5379 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5380 ;;
bd9b35c9 5381 *) dflt=n;;
c4f23d77 5382 esac
bd9b35c9
JH
5383 echo " "
5384 . ./myread
5385 case "$ans" in
5386 n*|N*) ;;
5387 *) echo "Ok. Stopping Configure." >&4
5388 exit 1
c4f23d77
AD
5389 ;;
5390 esac
5391 ;;
bd9b35c9 5392n) echo "OK, that should do.";;
c4f23d77 5393esac
613d6c3e 5394$rm_try gcctest gcctest.out
c4f23d77 5395
bd9b35c9
JH
5396: define a shorthand compile call
5397compile='
5398mc_file=$1;
5399shift;
08593cf4
NC
5400case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5401echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5402exit 1;
5403fi;
5404esac;
08413ebc 5405$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5406: define a shorthand compile call for compilations that should be ok.
5407compile_ok='
5408mc_file=$1;
5409shift;
7a282f6d 5410$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5411
8dfa8df9
JH
5412: determine filename position in cpp output
5413echo " "
5414echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5415case "$osname" in
5416vos) testaccess=-e ;;
5417*) testaccess=-r ;;
5418esac
8dfa8df9
JH
5419echo '#include <stdio.h>' > foo.c
5420$cat >fieldn <<EOF
5421$startsh
5422$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5423$grep '^[ ]*#.*stdio\.h' | \
5424while read cline; do
5425 pos=1
5426 set \$cline
5427 while $test \$# -gt 0; do
a5a94ea5 5428 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5429 echo "\$pos"
5430 exit 0
5431 fi
5432 shift
5433 pos=\`expr \$pos + 1\`
5434 done
5435done
5436EOF
5437chmod +x fieldn
5438fieldn=`./fieldn`
5439$rm -f foo.c fieldn
5440case $fieldn in
5441'') pos='???';;
54421) pos=first;;
54432) pos=second;;
54443) pos=third;;
5445*) pos="${fieldn}th";;
5446esac
5447echo "Your cpp writes the filename in the $pos field of the line."
5448
3c728e00
JH
5449case "$osname" in
5450vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5451os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5452*) cppfilter='' ;;
5453esac
8dfa8df9
JH
5454: locate header file
5455$cat >findhdr <<EOF
5456$startsh
5457wanted=\$1
5458name=''
5459for usrincdir in $usrinc
5460do
5461 if test -f \$usrincdir/\$wanted; then
5462 echo "\$usrincdir/\$wanted"
5463 exit 0
5464 fi
5465done
5466awkprg='{ print \$$fieldn }'
5467echo "#include <\$wanted>" > foo\$\$.c
5468$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5469$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5470while read cline; do
5471 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5472 case "\$name" in
5473 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5474 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5475 *) exit 2;;
5476 esac;
5477done;
5478#
5479# status = 0: grep returned 0 lines, case statement not executed
5480# status = 1: headerfile found
5481# status = 2: while loop executed, no headerfile found
5482#
5483status=\$?
5484$rm -f foo\$\$.c;
5485if test \$status -eq 1; then
5486 exit 0;
5487fi
5488exit 1
5489EOF
5490chmod +x findhdr
5491
5492: define an alternate in-header-list? function
5493inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5494cont=true; xxf="echo \"<\$1> found.\" >&4";
5495case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5496*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5497esac;
5498case $# in 4) instead=instead;; *) instead="at last";; esac;
5499while $test "$cont"; do
5500 xxx=`./findhdr $1`
5501 var=$2; eval "was=\$$2";
5502 if $test "$xxx" && $test -r "$xxx";
5503 then eval $xxf;
5504 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5505 cont="";
5506 else eval $xxnf;
5507 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5508 set $yyy; shift; shift; yyy=$@;
5509 case $# in 0) cont="";;
5510 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5511 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5512 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5513 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5514 esac;
5515done;
5516while $test "$yyy";
5517do set $yyy; var=$2; eval "was=\$$2";
5518 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5519 set $yyy; shift; shift; yyy=$@;
5520done'
5521
d1daaddf
JH
5522: see if stdlib is available
5523set stdlib.h i_stdlib
5524eval $inhdr
5525
5526: check for lengths of integral types
5527echo " "
5528case "$intsize" in
5529'')
5530 echo "Checking to see how big your integers are..." >&4
c63dfae1 5531 $cat >try.c <<EOCP
d1daaddf
JH
5532#include <stdio.h>
5533#$i_stdlib I_STDLIB
5534#ifdef I_STDLIB
5535#include <stdlib.h>
5536#endif
5537int main()
5538{
5539 printf("intsize=%d;\n", (int)sizeof(int));
5540 printf("longsize=%d;\n", (int)sizeof(long));
5541 printf("shortsize=%d;\n", (int)sizeof(short));
5542 exit(0);
5543}
5544EOCP
5545 set try
5546 if eval $compile_ok && $run ./try > /dev/null; then
5547 eval `$run ./try`
5548 echo "Your integers are $intsize bytes long."
5549 echo "Your long integers are $longsize bytes long."
5550 echo "Your short integers are $shortsize bytes long."
5551 else
5552 $cat >&4 <<EOM
5553!
5554Help! I can't compile and run the intsize test program: please enlighten me!
5555(This is probably a misconfiguration in your system or libraries, and
5556you really ought to fix it. Still, I'll try anyway.)
5557!
5558EOM
5559 dflt=4
5560 rp="What is the size of an integer (in bytes)?"
5561 . ./myread
5562 intsize="$ans"
5563 dflt=$intsize
5564 rp="What is the size of a long integer (in bytes)?"
5565 . ./myread
5566 longsize="$ans"
5567 dflt=2
5568 rp="What is the size of a short integer (in bytes)?"
5569 . ./myread
5570 shortsize="$ans"
5571 fi
5572 ;;
5573esac
5b813a60 5574$rm_try
d1daaddf
JH
5575
5576: check for long long
5577echo " "
5578echo "Checking to see if you have long long..." >&4
5579echo 'int main() { long long x = 7; return 0; }' > try.c
5580set try
5581if eval $compile; then
5582 val="$define"
5583 echo "You have long long."
5584else
5585 val="$undef"
5586 echo "You do not have long long."
5587fi
5b813a60 5588$rm_try
d1daaddf
JH
5589set d_longlong
5590eval $setvar
5591
5592: check for length of long long
5593case "${d_longlong}${longlongsize}" in
5594$define)
5595 echo " "
5596 echo "Checking to see how big your long longs are..." >&4
5597 $cat >try.c <<'EOCP'
5598#include <stdio.h>
5599int main()
5600{
5601 printf("%d\n", (int)sizeof(long long));
5602 return(0);
5603}
5604EOCP
5605 set try
5606 if eval $compile_ok; then
5607 longlongsize=`$run ./try`
5608 echo "Your long longs are $longlongsize bytes long."
5609 else
5610 dflt='8'
5611 echo " "
5612 echo "(I can't seem to compile the test program. Guessing...)"
5613 rp="What is the size of a long long (in bytes)?"
5614 . ./myread
5615 longlongsize="$ans"
5616 fi
5617 if $test "X$longsize" = "X$longlongsize"; then
5618 echo "(That isn't any different from an ordinary long.)"
5b813a60 5619 fi
d1daaddf
JH
5620 ;;
5621esac
5b813a60 5622$rm_try
d1daaddf 5623
8dfa8df9
JH
5624: see if inttypes.h is available
5625: we want a real compile instead of Inhdr because some systems
5626: have an inttypes.h which includes non-existent headers
5627echo " "
5628$cat >try.c <<EOCP
5629#include <inttypes.h>
5630int main() {
5631 static int32_t foo32 = 0x12345678;
5632}
5633EOCP
5634set try
5635if eval $compile; then
5636 echo "<inttypes.h> found." >&4
5637 val="$define"
5638else
5639 echo "<inttypes.h> NOT found." >&4
5640 val="$undef"
5641fi
5b813a60 5642$rm_try
8dfa8df9
JH
5643set i_inttypes
5644eval $setvar
5645
5646: check for int64_t
5647echo " "
5648echo "Checking to see if you have int64_t..." >&4
5649$cat >try.c <<EOCP
5650#include <sys/types.h>
5651#$i_inttypes I_INTTYPES
5652#ifdef I_INTTYPES
5653#include <inttypes.h>
5654#endif
5655int main() { int64_t x = 7; }
5656EOCP
5657set try
5658if eval $compile; then
5659 val="$define"
5660 echo "You have int64_t."
5661else
5662 val="$undef"
5663 echo "You do not have int64_t."
5664fi
5b813a60 5665$rm_try
8dfa8df9
JH
5666set d_int64_t
5667eval $setvar
5668
613d6c3e 5669: Check if 64bit ints have a quad type
8dfa8df9
JH
5670echo " "
5671echo "Checking which 64-bit integer type we could use..." >&4
5672
5673case "$intsize" in
56748) val=int
5675 set quadtype
5676 eval $setvar
5677 val='"unsigned int"'
5678 set uquadtype
5679 eval $setvar
5680 quadkind=1
5681 ;;
5682*) case "$longsize" in
5683 8) val=long
5684 set quadtype
5685 eval $setvar
5686 val='"unsigned long"'
5687 set uquadtype
5688 eval $setvar
5689 quadkind=2
5690 ;;
5691 *) case "$d_longlong:$longlongsize" in
5692 define:8)
5693 val='"long long"'
5694 set quadtype
5695 eval $setvar
5696 val='"unsigned long long"'
5697 set uquadtype
5698 eval $setvar
5699 quadkind=3
5700 ;;
5701 *) case "$d_int64_t" in
5702 define)
5703 val=int64_t
5704 set quadtype
5705 eval $setvar
5706 val=uint64_t
5707 set uquadtype
5708 eval $setvar
5709 quadkind=4
5710 ;;
5711 esac
5712 ;;
5713 esac
5714 ;;
5715 esac
5716 ;;
5717esac
5718
5719case "$quadtype" in
5720'') echo "Alas, no 64-bit integer types in sight." >&4
5721 d_quad="$undef"
5722 ;;
5723*) echo "We could use '$quadtype' for 64-bit integers." >&4
5724 d_quad="$define"
5725 ;;
5726esac
5727
34f1896b 5728: Do we want 64bit support
b4eb6b3d
JH
5729case "$uselonglong" in
5730"$define"|true|[yY]*)
5731 cat <<EOM >&4
5732
5733*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5734EOM
5735 use64bitint="$define"
5736 ;;
613d6c3e 5737esac
b4eb6b3d
JH
5738case "$use64bits" in
5739"$define"|true|[yY]*)
5740 cat <<EOM >&4
5741
5742*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5743EOM
5744 use64bitint="$define"
5745 ;;
613d6c3e 5746esac
b4eb6b3d
JH
5747case "$use64bitints" in
5748"$define"|true|[yY]*)
5749 cat <<EOM >&4
5750
5751*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5752EOM
5753 use64bitint="$define"
5754 ;;
613d6c3e 5755esac
b4eb6b3d
JH
5756case "$use64bitsint" in
5757"$define"|true|[yY]*)
5758 cat <<EOM >&4
5759
5760*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5761EOM
5762 use64bitint="$define"
5763 ;;
613d6c3e 5764esac
b4eb6b3d
JH
5765case "$uselonglongs" in
5766"$define"|true|[yY]*)
5767 cat <<EOM >&4
5768
5769*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5770EOM
5771 use64bitint="$define"
5772 ;;
613d6c3e 5773esac
b4eb6b3d
JH
5774case "$use64bitsall" in
5775"$define"|true|[yY]*)
5776 cat <<EOM >&4
5777
5778*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5779EOM
5780 use64bitall="$define"
5781 ;;
613d6c3e 5782esac
b4eb6b3d
JH
5783
5784case "$ccflags" in
5785*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5786esac
5787case "$use64bitall" in
5788"$define"|true|[yY]*) use64bitint="$define" ;;
5789esac
5790
5791case "$longsize" in
57928) cat <<EOM
5793
5794You have natively 64-bit long integers.
5795EOM
5796 val="$define"
5797 ;;
5798*) case "$use64bitint" in
5799 "$define"|true|[yY]*) dflt='y';;
5800 *) dflt='n';;
5801 esac
8dfa8df9
JH
5802 case "$d_quad" in
5803 "$define") ;;
5804 *) dflt='n' ;;
5805 esac
b4eb6b3d
JH
5806 cat <<EOM
5807
5808Perl can be built to take advantage of 64-bit integer types
5809on some systems. To do so, Configure can be run with -Duse64bitint.
5810Choosing this option will most probably introduce binary incompatibilities.
5811
5812If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5813(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5814EOM
5815 rp='Try to use 64-bit integers, if available?'
5816 . ./myread
5817 case "$ans" in
5818 [yY]*) val="$define" ;;
5819 *) val="$undef" ;;
5820 esac
5821 ;;
5822esac
5823set use64bitint
5824eval $setvar
5825
5826case "$use64bitall" in
5827"$define"|true|[yY]*) dflt='y' ;;
5828*) case "$longsize" in
5829 8) dflt='y' ;;
5830 *) dflt='n' ;;
5831 esac
5832 ;;
613d6c3e 5833esac
b4eb6b3d
JH
5834cat <<EOM
5835
5836You may also choose to try maximal 64-bitness. It means using as much
583764-bitness as possible on the platform. This in turn means even more
5838binary incompatibilities. On the other hand, your platform may not
5839have any more 64-bitness available than what you already have chosen.
5840
5841If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5842(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5843EOM
5844rp='Try to use maximal 64-bit support, if available?'
5845. ./myread
5846case "$ans" in
5847[yY]*) val="$define" ;;
5848*) val="$undef" ;;
5849esac
5850set use64bitall
5851eval $setvar
5852case "$use64bitall" in
5853"$define")
5854 case "$use64bitint" in
5855 "$undef")
5856 cat <<EOM
5857
5858Since you have chosen a maximally 64-bit build, I'm also turning on
5859the use of 64-bit integers.
5860EOM
5861 use64bitint="$define" ;;
5862 esac
5863 ;;
5864esac
5865
b4eb6b3d
JH
5866: Look for a hint-file generated 'call-back-unit'. If the
5867: user has specified that a 64-bit perl is to be built,
5868: we may need to set or change some other defaults.
19a100ff 5869if $test -f use64bitint.cbu; then
9da7673b 5870 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5871 . ./use64bitint.cbu
5872fi
9da7673b
MB
5873case "$use64bitint" in
5874"$define"|true|[yY]*)
b4eb6b3d
JH
5875 case "$longsize" in
5876 4) case "$archname64" in
5877 '') archname64=64int ;;
5878 esac
5879 ;;
5880 esac
5881 ;;
5882esac
5883
b4eb6b3d
JH
5884: Look for a hint-file generated 'call-back-unit'. If the
5885: user has specified that a maximally 64-bit perl is to be built,
5886: we may need to set or change some other defaults.
19a100ff 5887if $test -f use64bitall.cbu; then
9da7673b 5888 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5889 . ./use64bitall.cbu
5890fi
9da7673b
MB
5891case "$use64bitall" in
5892"$define"|true|[yY]*)
b4eb6b3d
JH
5893 case "$longsize" in
5894 4) case "$archname64" in
5895 ''|64int) archname64=64all ;;
5896 esac
5897 ;;
5898 esac
5899 ;;
5900esac
5901
1911a026
JH
5902case "$d_quad:$use64bitint" in
5903$undef:$define)
5904 cat >&4 <<EOF
5905
5906*** You have chosen to use 64-bit integers,
19a100ff 5907*** but none can be found.
09b58c7b 5908*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5909*** Cannot continue, aborting.
5910
5911EOF
5912 exit 1
5913 ;;
5914esac
5915
36adc09b
JH
5916: check for length of double
5917echo " "
5918case "$doublesize" in
5919'')
5920 echo "Checking to see how big your double precision numbers are..." >&4
5921 $cat >try.c <<EOCP
5922#include <stdio.h>
1911a026
JH
5923#$i_stdlib I_STDLIB
5924#ifdef I_STDLIB
5925#include <stdlib.h>
5926#endif
36adc09b
JH
5927int main()
5928{
5929 printf("%d\n", (int)sizeof(double));
1911a026 5930 exit(0);
36adc09b
JH
5931}
5932EOCP
5933 set try
5934 if eval $compile_ok; then
5935 doublesize=`$run ./try`
5936 echo "Your double is $doublesize bytes long."
5937 else
5938 dflt='8'
5939 echo "(I can't seem to compile the test program. Guessing...)"
5940 rp="What is the size of a double precision number (in bytes)?"
5941 . ./myread
5942 doublesize="$ans"
5943 fi
5944 ;;
5945esac
5b813a60 5946$rm_try
36adc09b
JH
5947
5948: check for long doubles
5949echo " "
5950echo "Checking to see if you have long double..." >&4
5951echo 'int main() { long double x = 7.0; }' > try.c
5952set try
5953if eval $compile; then
5954 val="$define"
5955 echo "You have long double."
5956else
5957 val="$undef"
5958 echo "You do not have long double."
5959fi
5b813a60 5960$rm_try
36adc09b
JH
5961set d_longdbl
5962eval $setvar
5963
5964: check for length of long double
5965case "${d_longdbl}${longdblsize}" in
5966$define)
5967 echo " "
5968 echo "Checking to see how big your long doubles are..." >&4
5969 $cat >try.c <<'EOCP'
5970#include <stdio.h>
5971int main()
5972{
5973 printf("%d\n", sizeof(long double));
5974}
5975EOCP
5976 set try
5977 set try
5978 if eval $compile; then
5979 longdblsize=`$run ./try`
5980 echo "Your long doubles are $longdblsize bytes long."
5981 else
5982 dflt='8'
5983 echo " "
5984 echo "(I can't seem to compile the test program. Guessing...)" >&4
5985 rp="What is the size of a long double (in bytes)?"
5986 . ./myread
5987 longdblsize="$ans"
5988 fi
5989 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5990 echo "That isn't any different from an ordinary double."
5991 echo "I'll keep your setting anyway, but you may see some"
5992 echo "harmless compilation warnings."
5b813a60 5993 fi
36adc09b
JH
5994 ;;
5995esac
5b813a60 5996$rm_try
36adc09b 5997
89ce900e 5998: determine the architecture name
b4eb6b3d 5999echo " "
89ce900e
JH
6000if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6001 tarch=`arch`"-$osname"
6002elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6003 if uname -m > tmparch 2>&1 ; then
6004 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6005 -e 's/$/'"-$osname/" tmparch`
6006 else
6007 tarch="$osname"
6008 fi
6009 $rm -f tmparch
b4eb6b3d 6010else
89ce900e 6011 tarch="$osname"
b4eb6b3d 6012fi
89ce900e
JH
6013case "$myarchname" in
6014''|"$tarch") ;;
6015*)
6016 echo "(Your architecture name used to be $myarchname.)"
6017 archname=''
6018 ;;
6019esac
6020case "$targetarch" in
6021'') ;;
6022*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6023esac
6024myarchname="$tarch"
6025case "$archname" in
6026'') dflt="$tarch";;
6027*) dflt="$archname";;
6028esac
6029rp='What is your architecture name'
6030. ./myread
6031archname="$ans"
6032case "$usethreads" in
6033$define)
6034 echo "Threads selected." >&4
6035 case "$archname" in
6036 *-thread*) echo "...and architecture name already has -thread." >&4
6037 ;;
6038 *) archname="$archname-thread"
6039 echo "...setting architecture name to $archname." >&4
6040 ;;
6041 esac
6042 ;;
6043esac
6044case "$usemultiplicity" in
6045$define)
6046 echo "Multiplicity selected." >&4
6047 case "$archname" in
6048 *-multi*) echo "...and architecture name already has -multi." >&4
6049 ;;
6050 *) archname="$archname-multi"
6051 echo "...setting architecture name to $archname." >&4
6052 ;;
6053 esac
6054 ;;
6055esac
6056case "$use64bitint$use64bitall" in
6057*"$define"*)
6058 case "$archname64" in
6059 '')
6060 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6061 ;;
89ce900e
JH
6062 *)
6063 case "$use64bitint" in
6064 "$define") echo "64 bit integers selected." >&4 ;;
6065 esac
6066 case "$use64bitall" in
6067 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6068 esac
6069 case "$archname" in
6070 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6071 ;;
6072 *) archname="$archname-$archname64"
6073 echo "...setting architecture name to $archname." >&4
6074 ;;
6075 esac
c1a7f87b
JH
6076 ;;
6077 esac
89ce900e
JH
6078esac
6079case "$uselongdouble" in
6080$define)
6081 echo "Long doubles selected." >&4
6082 case "$longdblsize" in
6083 $doublesize)
6084 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6085 ;;
6086 *)
6087 case "$archname" in
6088 *-ld*) echo "...and architecture name already has -ld." >&4
6089 ;;
6090 *) archname="$archname-ld"
6091 echo "...setting architecture name to $archname." >&4
6092 ;;
6093 esac
bd9b35c9
JH
6094 ;;
6095 esac
bd9b35c9 6096 ;;
89ce900e
JH
6097esac
6098case "$useperlio" in
6099$define)
6100 echo "Perlio selected." >&4
6101 ;;
bd9b35c9 6102*)
89ce900e
JH
6103 echo "Perlio not selected, using stdio." >&4
6104 case "$archname" in
6105 *-stdio*) echo "...and architecture name already has -stdio." >&4
6106 ;;
6107 *) archname="$archname-stdio"
6108 echo "...setting architecture name to $archname." >&4
6109 ;;
6110 esac
bd9b35c9
JH
6111 ;;
6112esac
d2e0c6f7
JH
6113if $test -f archname.cbu; then
6114 echo "Your platform has some specific hints for architecture name, using them..."
6115 . ./archname.cbu
6116fi
bd9b35c9 6117
b4eb6b3d
JH
6118: set the prefixit variable, to compute a suitable default value
6119prefixit='case "$3" in
6120""|none)
6121 case "$oldprefix" in
6122 "") eval "$1=\"\$$2\"";;
6123 *)
6124 case "$3" in
6125 "") eval "$1=";;
6126 none)
6127 eval "tp=\"\$$2\"";
6128 case "$tp" in
6129 ""|" ") eval "$1=\"\$$2\"";;
6130 *) eval "$1=";;
6131 esac;;
6132 esac;;
6133 esac;;
6134*)
6135 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6136 case "$tp" in
6137 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6138 /*-$oldprefix/*|\~*-$oldprefix/*)
6139 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6140 *) eval "$1=\"\$$2\"";;
6141 esac;;
6142esac'
6143
f3f1a2d8
MB
6144: determine installation style
6145: For now, try to deduce it from prefix unless it is already set.
6146: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6147case "$installstyle" in
6148'') case "$prefix" in
6149 *perl*) dflt='lib';;
6150 *) dflt='lib/perl5' ;;
6151 esac
6152 ;;
6153*) dflt="$installstyle" ;;
4d20abad 6154esac
f3f1a2d8
MB
6155: Probably not worth prompting for this since we prompt for all
6156: the directories individually, and the prompt would be too long and
6157: confusing anyway.
6158installstyle=$dflt
4d20abad 6159
eaf812ae
MB
6160: determine where public executables go
6161echo " "
6162set dflt bin bin
6163eval $prefixit
6164fn=d~
6165rp='Pathname where the public executables will reside?'
6166. ./getfile
6167if $test "X$ansexp" != "X$binexp"; then
6168 installbin=''
6169fi
6170prefixvar=bin
6171: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6172: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6173: this via initialinstalllocation
eaf812ae
MB
6174. ./setprefixvar
6175
6176case "$userelocatableinc" in
6177$define|true|[yY]*) dflt='y' ;;
6178*) dflt='n' ;;
6179esac
6180cat <<EOM
6181
6182Would you like to build Perl so that the installation is relocatable, so that
6183library paths in @INC are determined relative to the path of the perl binary?
6184This is not advised for system Perl installs, or if you need to run setid
6185scripts or scripts under taint mode.
6186
6187If this doesn't make any sense to you, just accept the default '$dflt'.
6188EOM
6189rp='Use relocatable @INC?'
6190. ./myread
6191case "$ans" in
6192y|Y) val="$define" ;;
6193*) val="$undef" ;;
6194esac
6195set userelocatableinc
6196eval $setvar
6197
ea7d701d 6198initialinstalllocation="$binexp"
eaf812ae
MB
6199: Default prefix is now "up one level from where the binaries are"
6200case "$userelocatableinc" in
6201$define|true|[yY]*)
eaf812ae
MB
6202 bin=".../"
6203 binexp=".../"
6204 prefix=".../.."
6205 prefixexp=".../.."
6206 installprefixexp=".../.."
6207 ;;
6208esac
6209
b4eb6b3d
JH
6210: determine where private library files go
6211: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6212: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6213: /opt/perl/lib/perl5... would be redundant.
6214: The default "style" setting is made in installstyle.U
6215case "$installstyle" in
6216*lib/perl5*) set dflt privlib lib/$package/$version ;;
6217*) set dflt privlib lib/$version ;;
6218esac
6219eval $prefixit
6220$cat <<EOM
6221
6222There are some auxiliary files for $package that need to be put into a
6223private library directory that is accessible by everyone.
6224
6225EOM
eaf812ae 6226fn=$binexp
b4eb6b3d
JH
6227fn=d~+
6228rp='Pathname where the private library files will reside?'
6229. ./getfile
79522dd2
NC
6230prefixvar=privlib
6231. ./setprefixvar
b4eb6b3d
JH
6232
6233: set the prefixup variable, to restore leading tilda escape
6234prefixup='case "$prefixexp" in
6235"$prefix") ;;
6236*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6237esac'
6238
6239: determine where public architecture dependent libraries go
6240set archlib archlib
6241eval $prefixit
6242: privlib default is /usr/local/lib/$package/$version
6243: archlib default is /usr/local/lib/$package/$version/$archname
6244: privlib may have an optional trailing /share.
6245tdflt=`echo $privlib | $sed 's,/share$,,'`
6246tdflt=$tdflt/$archname
6247case "$archlib" in
6248'') dflt=$tdflt
6249 ;;
6250*) dflt="$archlib"
6251 ;;
6252esac
6253$cat <<EOM
6254
6255$spackage contains architecture-dependent library files. If you are
6256sharing libraries in a heterogeneous environment, you might store
6257these files in a separate location. Otherwise, you can just include
6258them with the rest of the public library files.
6259
6260EOM
eaf812ae 6261fn=$binexp
b4eb6b3d
JH
6262fn=d+~
6263rp='Where do you want to put the public architecture-dependent libraries?'
6264. ./getfile
79522dd2
NC
6265prefixvar=archlib
6266. ./setprefixvar
b4eb6b3d
JH
6267if $test X"$archlib" = X"$privlib"; then
6268 d_archlib="$undef"
6269else
6270 d_archlib="$define"
6271fi
b4eb6b3d 6272
b4eb6b3d
JH
6273: see if setuid scripts can be secure
6274$cat <<EOM
6275
6276Some kernels have a bug that prevents setuid #! scripts from being
6277secure. Some sites have disabled setuid #! scripts because of this.
6278
6279First let's decide if your kernel supports secure setuid #! scripts.
6280(If setuid #! scripts would be secure but have been disabled anyway,
6281don't say that they are secure if asked.)
6282
6283EOM
6284
6285val="$undef"
6286if $test -d /dev/fd; then
6287 echo "#!$ls" >reflect
6288 chmod +x,u+s reflect
6289 ./reflect >flect 2>&1
6290 if $contains "/dev/fd" flect >/dev/null; then
6291 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6292 val="$define"
6293 else
6294 $cat <<EOM
6295If you are not sure if they are secure, I can check but I'll need a
6296username and password different from the one you are using right now.
6297If you don't have such a username or don't want me to test, simply
6298enter 'none'.
6299
6300EOM
6301 rp='Other username to test security of setuid scripts with?'
6302 dflt='none'
6303 . ./myread
6304 case "$ans" in
6305 n|none)
6306 case "$d_suidsafe" in
6307 '') echo "I'll assume setuid scripts are *not* secure." >&4
6308 dflt=n;;
6309 "$undef")
6310 echo "Well, the $hint value is *not* secure." >&4
6311 dflt=n;;
6312 *) echo "Well, the $hint value *is* secure." >&4
6313 dflt=y;;
6314 esac
c1a7f87b 6315 ;;
b4eb6b3d
JH
6316 *)
6317 $rm -f reflect flect
6318 echo "#!$ls" >reflect
6319 chmod +x,u+s reflect
6320 echo >flect
6321 chmod a+w flect
6322 echo '"su" will (probably) prompt you for '"$ans's password."
6323 su $ans -c './reflect >flect'
6324 if $contains "/dev/fd" flect >/dev/null; then
6325 echo "Okay, it looks like setuid scripts are secure." >&4
6326 dflt=y
6327 else
6328 echo "I don't think setuid scripts are secure." >&4
6329 dflt=n
6330 fi
6331 ;;
6332 esac
6333 rp='Does your kernel have *secure* setuid scripts?'
6334 . ./myread
6335 case "$ans" in
6336 [yY]*) val="$define";;
6337 *) val="$undef";;
6338 esac
6339 fi
6340else
6341 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6342 echo "(That's for file descriptors, not floppy disks.)"
6343 val="$undef"
6344fi
6345set d_suidsafe
6346eval $setvar
6347
6348$rm -f reflect flect
6349
6350: now see if they want to do setuid emulation
6351echo " "
6352val="$undef"
6353case "$d_suidsafe" in
6354"$define")
6355 val="$undef"
3c728e00 6356 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6357 ;;
f3f1a2d8
MB
6358*)
6359 $cat <<EOM
6360Some systems have disabled setuid scripts, especially systems where
6361setuid scripts cannot be secure. On systems where setuid scripts have
6362been disabled, the setuid/setgid bits on scripts are currently
6363useless. It is possible for $package to detect those bits and emulate
6364setuid/setgid in a secure fashion. This emulation will only work if
6365setuid scripts have been disabled in your kernel.
6366
6367EOM
6368 case "$d_dosuid" in
6369 "$define") dflt=y ;;
6370 *) dflt=n ;;
6371 esac
6372 rp="Do you want to do setuid/setgid emulation?"
6373 . ./myread
6374 case "$ans" in
6375 [yY]*) val="$define";;
6376 *) val="$undef";;
6377 esac
6378 ;;
6379esac
6380set d_dosuid
6381eval $setvar
6382
f3f1a2d8
MB
6383: Find perl5.005 or later.
6384echo "Looking for a previously installed perl5.005 or later... "
6385case "$perl5" in
6386'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6387 : Check if this perl is recent and can load a simple module
6388 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6389 perl5=$tdir/perl
6390 break;
6391 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6392 perl5=$tdir/perl5
6393 break;
6394 fi
6395 done
6396 ;;
6397*) perl5="$perl5"
6398 ;;
6399esac
6400case "$perl5" in
6401'') echo "None found. That's ok.";;
6402*) echo "Using $perl5." ;;
6403esac
6404
613d6c3e 6405: Set the siteprefix variables
f3f1a2d8
MB
6406$cat <<EOM
6407
6408After $package is installed, you may wish to install various
6409add-on modules and utilities. Typically, these add-ons will
6410be installed under $prefix with the rest
6411of this package. However, you may wish to install such add-ons
6412elsewhere under a different prefix.
6413
6414If you do not wish to put everything under a single prefix, that's
6415ok. You will be prompted for the individual locations; this siteprefix
6416is only used to suggest the defaults.
6417
6418The default should be fine for most people.
6419
6420EOM
6421fn=d~+
6422rp='Installation prefix to use for add-on modules and utilities?'
6423: XXX Here might be another good place for an installstyle setting.
6424case "$siteprefix" in
6425'') dflt=$prefix ;;
6426*) dflt=$siteprefix ;;
6427esac
6428. ./getfile
6429: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6430oldsiteprefix=''
6431case "$siteprefix" in
6432'') ;;
6433*) case "$ans" in
6434 "$prefix") ;;
6435 *) oldsiteprefix="$prefix";;
6436 esac
6437 ;;
6438esac
6439siteprefix="$ans"
6440siteprefixexp="$ansexp"
6441
6442: determine where site specific libraries go.
6443: Usual default is /usr/local/lib/perl5/site_perl/$version
6444: The default "style" setting is made in installstyle.U
6445: XXX No longer works with Prefixit stuff.
6446prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6447case "$sitelib" in
6448'') case "$installstyle" in
6449 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6450 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6451 esac
6452 ;;
6453*) dflt="$sitelib"
6454 ;;
6455esac
6456$cat <<EOM
6457
6458The installation process will create a directory for
6459site-specific extensions and modules. Most users find it convenient
6460to place all site-specific files in this directory rather than in the
6461main distribution directory.
6462
6463EOM
6464fn=d~+
6465rp='Pathname for the site-specific library files?'
6466. ./getfile
6467prefixvar=sitelib
6468. ./setprefixvar
6469sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6470
6471: Determine list of previous versions to include in @INC
6472$cat > getverlist <<EOPL
6473#!$perl5 -w
6474use File::Basename;
6475\$api_versionstring = "$api_versionstring";
6476\$version = "$version";
6477\$stem = "$sitelib_stem";
6478\$archname = "$archname";
6479EOPL
6480 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6481# The list found is store twice for each entry: the original name, and
6482# the binary broken down version as pack "sss", so sorting is easy and
6483# unambiguous. This will work for all versions that have a maximum of
6484# three digit groups, separate by '.'s or '_'s. Names are extended with
6485# ".0.0" to ensure at least three elements for the pack.
6486# -- H.Merijn Brand (m)'06 23-10-2006
6487
f3f1a2d8
MB
6488# Can't have leading @ because metaconfig interprets it as a command!
6489;@inc_version_list=();
6490# XXX Redo to do opendir/readdir?
6491if (-d $stem) {
6492 chdir($stem);
13cfc98d
MB
6493 ;@candidates = map {
6494 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
f3f1a2d8
MB
6495}
6496else {
6497 ;@candidates = ();
6498}
6499
13cfc98d
MB
6500($pversion, $aversion, $vsn5005) = map {
6501 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6502foreach $d (@candidates) {
13cfc98d
MB
6503 if ($d->[1] lt $pversion) {
6504 if ($d->[1] ge $aversion) {
6505 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6506 }
13cfc98d
MB
6507 elsif ($d->[1] ge $vsn5005) {
6508 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6509 }
6510 }
6511 else {
6512 # Skip newer version. I.e. don't look in
6513 # 5.7.0 if we're installing 5.6.1.
6514 }
6515}
6516
6517if (@inc_version_list) {
6518 print join(' ', @inc_version_list);
6519}
6520else {
6521 # Blank space to preserve value for next Configure run.
6522 print " ";
6523}
6524EOPL
6525chmod +x getverlist
6526case "$inc_version_list" in
6527'') if test -x "$perl5$exe_ext"; then
6528 dflt=`$perl5 getverlist`
6529 else
6530 dflt='none'
6531 fi
6532 ;;
6533$undef) dflt='none' ;;
6534*) eval dflt=\"$inc_version_list\" ;;
6535esac
6536case "$dflt" in
6537''|' ') dflt=none ;;
6538esac
6539case "$dflt" in
65405.005) dflt=none ;;
6541esac
6542$cat <<EOM
6543
6544In order to ease the process of upgrading, this version of perl
6545can be configured to use modules built and installed with earlier
6546versions of perl that were installed under $prefix. Specify here
6547the list of earlier versions that this version of perl should check.
6548If Configure detected no earlier versions of perl installed under
6549$prefix, then the list will be empty. Answer 'none' to tell perl
6550to not search earlier versions.
b4eb6b3d 6551
f3f1a2d8
MB
6552The default should almost always be sensible, so if you're not sure,
6553just accept the default.
b4eb6b3d 6554EOM
f3f1a2d8
MB
6555
6556rp='List of earlier versions to include in @INC?'
6557. ./myread
6558case "$ans" in
6559[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6560*) inc_version_list="$ans" ;;
6561esac
6562case "$inc_version_list" in
6563''|' ')
6564 inc_version_list_init='0'
6565 d_inc_version_list="$undef"
6566 ;;
6567*) inc_version_list_init=`echo $inc_version_list |
6568 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6569 d_inc_version_list="$define"
b4eb6b3d
JH
6570 ;;
6571esac
f3f1a2d8 6572$rm -f getverlist
b4eb6b3d 6573
1cd66f7c
DD
6574: see if malloc/malloc.h has to be included
6575set malloc/malloc.h i_mallocmalloc
6576eval $inhdr
6577
b4eb6b3d 6578: see if this is a malloc.h system
01d07975
YST
6579: we want a real compile instead of Inhdr because some systems have a
6580: malloc.h that just gives a compile error saying to use stdlib.h instead
6581echo " "
6582$cat >try.c <<EOCP
6583#include <stdlib.h>
6584#include <malloc.h>
f25eda10 6585#$i_mallocmalloc I_MALLOCMALLOC
1cd66f7c
DD
6586#ifdef I_MALLOCMALLOC
6587# include <malloc/malloc.h>
6588#endif
6589
01d07975
YST
6590int main () { return 0; }
6591EOCP
6592set try
6593if eval $compile; then
6594 echo "<malloc.h> found." >&4
6595 val="$define"
6596else
6597 echo "<malloc.h> NOT found." >&4
6598 val="$undef"
6599fi
5b813a60 6600$rm_try
01d07975
YST
6601set i_malloc
6602eval $setvar
b4eb6b3d 6603
c8b93cf9
JH
6604: check for void type
6605echo " "
6606echo "Checking to see how well your C compiler groks the void type..." >&4
6607case "$voidflags" in
6608'')
c727eafa 6609 $cat >try.c <<EOCP
d1daaddf
JH
6610#$i_stdlib I_STDLIB
6611#ifdef I_STDLIB
6612#include <stdlib.h>
6613#endif
c8b93cf9
JH
6614#if TRY & 1
6615void sub() {
6616#else
6617sub() {
6618#endif
6619 extern void moo(); /* function returning void */
6620 void (*goo)(); /* ptr to func returning void */
6621#if TRY & 8
6622 void *hue; /* generic ptr */
6623#endif
6624#if TRY & 2
6625 void (*foo[10])();
6626#endif
6627
6628#if TRY & 4
6629 if(goo == moo) {
6630 exit(0);
6631 }
6632#endif
6633 exit(0);
6634}
6635int main() { sub(); }
6636EOCP
6637 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6638 voidflags=$defvoidused
6639 echo "Good. It appears to support void to the level $package wants.">&4
6640 if $contains warning .out >/dev/null 2>&1; then
6641 echo "However, you might get some warnings that look like this:"
6642 $cat .out
6643 fi
6644 else
6645echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6646 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6647 echo "It supports 1..."
6648 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6649 echo "It also supports 2..."
6650 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6651 voidflags=7
6652 echo "And it supports 4 but not 8 definitely."
6653 else
6654 echo "It doesn't support 4..."
6655 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6656 voidflags=11
6657 echo "But it supports 8."
6658 else
6659 voidflags=3
6660 echo "Neither does it support 8."
6661 fi
6662 fi
6663 else
6664 echo "It does not support 2..."
6665 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6666 voidflags=13
6667 echo "But it supports 4 and 8."
6668 else
6669 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6670 voidflags=5
6671 echo "And it supports 4 but has not heard about 8."
6672 else
6673 echo "However it supports 8 but not 4."
6674 fi
6675 fi
6676 fi
6677 else
6678 echo "There is no support at all for void."
6679 voidflags=0
6680 fi
6681 fi
6682esac
6683case "$voidflags" in
6684"$defvoidused") ;;
6685*) $cat >&4 <<'EOM'
6686 Support flag bits are:
6687 1: basic void declarations.
6688 2: arrays of pointers to functions returning void.
6689 4: operations between pointers to and addresses of void functions.
6690 8: generic void pointers.
6691EOM
6692 dflt="$voidflags";
6693 rp="Your void support flags add up to what?"
6694 . ./myread
6695 voidflags="$ans"
6696 ;;
6697esac
5b813a60 6698$rm_try
c8b93cf9
JH
6699
6700: check for length of pointer
6701echo " "
6702case "$ptrsize" in
6703'')
6704 echo "Checking to see how big your pointers are..." >&4
6705 if test "$voidflags" -gt 7; then
6706 echo '#define VOID_PTR char *' > try.c
6707 else
6708 echo '#define VOID_PTR void *' > try.c
6709 fi
74d00865 6710 $cat >>try.c <<EOCP
c8b93cf9 6711#include <stdio.h>
d1daaddf
JH
6712#$i_stdlib I_STDLIB
6713#ifdef I_STDLIB
6714#include <stdlib.h>
6715#endif
c8b93cf9
JH
6716int main()
6717{
6718 printf("%d\n", (int)sizeof(VOID_PTR));
6719 exit(0);
6720}
6721EOCP
6722 set try
6723 if eval $compile_ok; then
6724 ptrsize=`$run ./try`
6725 echo "Your pointers are $ptrsize bytes long."
6726 else
6727 dflt='4'
6728 echo "(I can't seem to compile the test program. Guessing...)" >&4
6729 rp="What is the size of a pointer (in bytes)?"
6730 . ./myread
6731 ptrsize="$ans"
6732 fi
6733 ;;
6734esac
5b813a60 6735$rm_try
c8b93cf9
JH
6736case "$use64bitall" in
6737"$define"|true|[yY]*)
6738 case "$ptrsize" in
6739 4) cat <<EOM >&4
6740
1911a026
JH
6741*** You have chosen a maximally 64-bit build,
6742*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6743*** Please rerun Configure without -Duse64bitall.
6744EOM
6745 case "$d_quad" in
6746 define)
6747 cat <<EOM >&4
6748*** Since you have quads, you could possibly try with -Duse64bitint.
6749EOM
6750 ;;
6751 esac
6752 cat <<EOM >&4
1911a026 6753*** Cannot continue, aborting.
c8b93cf9
JH
6754
6755EOM
09b58c7b 6756
1911a026 6757 exit 1
c8b93cf9
JH
6758 ;;
6759 esac
6760 ;;
6761esac
6762
19a100ff 6763
9df442c2
NC
6764: determine whether to use malloc wrapping
6765echo " "
6766case "$usemallocwrap" in
6767[yY]*|true|$define) dflt='y' ;;
6768[nN]*|false|$undef) dflt='n' ;;
6769*) case "$usedevel" in
6770 [yY]*|true|$define) dflt='y' ;;
6771 *) dflt='n' ;;
6772 esac
6773 ;;
6774esac
6775rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6776. ./myread
6777usemallocwrap="$ans"
6778case "$ans" in
6779y*|true)
6780 usemallocwrap="$define" ;;
6781*)
6782 usemallocwrap="$undef" ;;
6783esac
c8b93cf9 6784
b4eb6b3d
JH
6785: determine which malloc to compile in
6786echo " "
6787case "$usemymalloc" in
c4163172
JH
6788[yY]*|true|$define) dflt='y' ;;
6789[nN]*|false|$undef) dflt='n' ;;
6790*) case "$ptrsize" in
6791 4) dflt='y' ;;
6792 *) dflt='n' ;;
6793 esac
6794 ;;
8dfa8df9 6795esac
b4eb6b3d
JH
6796rp="Do you wish to attempt to use the malloc that comes with $package?"
6797. ./myread
6798usemymalloc="$ans"
6799case "$ans" in
6800y*|true)
6801 usemymalloc='y'
6802 mallocsrc='malloc.c'
6803 mallocobj="malloc$_o"
6804 d_mymalloc="$define"
6805 case "$libs" in
6806 *-lmalloc*)
6807 : Remove malloc from list of libraries to use
6808 echo "Removing unneeded -lmalloc from library list" >&4
6809 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6810 shift
6811 libs="$*"
6812 echo "libs = $libs" >&4
6813 ;;
6814 esac
6815 ;;
6816*)
6817 usemymalloc='n'
6818 mallocsrc=''
6819 mallocobj=''
6820 d_mymalloc="$undef"
6821 ;;
6822esac
6823
6824: compute the return types of malloc and free
6825echo " "
6826$cat >malloc.c <<END
6827#$i_malloc I_MALLOC
6828#$i_stdlib I_STDLIB
6829#include <stdio.h>
6830#include <sys/types.h>
6831#ifdef I_MALLOC
6832#include <malloc.h>
6833#endif
6834#ifdef I_STDLIB
6835#include <stdlib.h>
6836#endif
6837#ifdef TRY_MALLOC
6838void *malloc();
6839#endif
6840#ifdef TRY_FREE
6841void free();
6842#endif
6843END
6844case "$malloctype" in
6845'')
6846 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6847 malloctype='void *'
6848 else
6849 malloctype='char *'
6850 fi
6851 ;;
6852esac
6853echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6854
6855case "$freetype" in
6856'')
6857 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6858 freetype='void'
6859 else
6860 freetype='int'
6861 fi
6862 ;;
6863esac
6864echo "Your system uses $freetype free(), it would seem." >&4
6865$rm -f malloc.[co]
b4eb6b3d
JH
6866: determine where site specific architecture-dependent libraries go.
6867: sitelib default is /usr/local/lib/perl5/site_perl/$version
6868: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6869: sitelib may have an optional trailing /share.
6870case "$sitearch" in
6871'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6872 dflt="$dflt/$archname"
6873 ;;
6874*) dflt="$sitearch"
6875 ;;
6876esac
6877set sitearch sitearch none
6878eval $prefixit
6879$cat <<EOM
6880
6881The installation process will also create a directory for
6882architecture-dependent site-specific extensions and modules.
6883
6884EOM
6885fn=d~+
6886rp='Pathname for the site-specific architecture-dependent library files?'
6887. ./getfile
79522dd2
NC
6888prefixvar=sitearch
6889. ./setprefixvar
c95d0e17
GA
6890if $test X"$sitearch" = X"$sitelib"; then
6891 d_sitearch="$undef"
6892else
6893 d_sitearch="$define"
6894fi
b4eb6b3d 6895
613d6c3e 6896: Set the vendorprefix variables
b4eb6b3d
JH
6897$cat <<EOM
6898
6899The installation process will also create a directory for
6900vendor-supplied add-ons. Vendors who supply perl with their system
6901may find it convenient to place all vendor-supplied files in this
6902directory rather than in the main distribution directory. This will
6903ease upgrades between binary-compatible maintenance versions of perl.
6904
6905Of course you may also use these directories in whatever way you see
6906fit. For example, you might use them to access modules shared over a
6907company-wide network.
6908
6909The default answer should be fine for most people.
6910This causes further questions about vendor add-ons to be skipped
6911and no vendor-specific directories will be configured for perl.
6912
6913EOM
6914rp='Do you want to configure vendor-specific add-on directories?'
6915case "$usevendorprefix" in
6916define|true|[yY]*) dflt=y ;;
6917*) : User may have set vendorprefix directly on Configure command line.
6918 case "$vendorprefix" in
6919 ''|' ') dflt=n ;;
6920 *) dflt=y ;;
6921 esac
6922 ;;
6923esac
6924. ./myread
6925case "$ans" in
6926[yY]*) fn=d~+
6927 rp='Installation prefix to use for vendor-supplied add-ons?'
6928 case "$vendorprefix" in
6929 '') dflt='' ;;
6930 *) dflt=$vendorprefix ;;
6931 esac
6932 . ./getfile
6933 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6934 oldvendorprefix=''
6935 case "$vendorprefix" in
6936 '') ;;
6937 *) case "$ans" in
6938 "$prefix") ;;
6939 *) oldvendorprefix="$prefix";;
6940 esac
6941 ;;
6942 esac
6943 usevendorprefix="$define"
6944 vendorprefix="$ans"
6945 vendorprefixexp="$ansexp"
6946 ;;
6947*) usevendorprefix="$undef"
6948 vendorprefix=''
6949 vendorprefixexp=''
6950 ;;
6951esac
6952
613d6c3e 6953: Set the vendorlib variables
b4eb6b3d
JH
6954case "$vendorprefix" in
6955'') d_vendorlib="$undef"
6956 vendorlib=''
6957 vendorlibexp=''
6958 ;;
6959*) d_vendorlib="$define"
6960 : determine where vendor-supplied modules go.
6961 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6962 case "$vendorlib" in
6963 '')
6964 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6965 case "$installstyle" in
6966 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6967 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6968 esac
6969 ;;
6970 *) dflt="$vendorlib"
6971 ;;
6972 esac
6973 fn=d~+
6974 rp='Pathname for the vendor-supplied library files?'
6975 . ./getfile
6976 vendorlib="$ans"
6977 vendorlibexp="$ansexp"
6978 ;;
6979esac
6980vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6981prefixvar=vendorlib
6982. ./installprefix
b4eb6b3d 6983
613d6c3e 6984: Set the vendorarch variables
b4eb6b3d
JH
6985case "$vendorprefix" in
6986'') d_vendorarch="$undef"
6987 vendorarch=''
6988 vendorarchexp=''
6989 ;;
6990*) d_vendorarch="$define"
6991 : determine where vendor-supplied architecture-dependent libraries go.
6992 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6993 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6994 : vendorlib may have an optional trailing /share.
6995 case "$vendorarch" in
6996 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6997 dflt="$dflt/$archname"
6998 ;;
6999 *) dflt="$vendorarch" ;;
7000 esac
7001 fn=d~+
7002 rp='Pathname for vendor-supplied architecture-dependent files?'
7003 . ./getfile
7004 vendorarch="$ans"
7005 vendorarchexp="$ansexp"
7006 ;;
7007esac
a092d240
NC
7008prefixvar=vendorarch
7009. ./installprefix
b4eb6b3d
JH
7010
7011: Final catch-all directories to search
7012$cat <<EOM
7013
7014Lastly, you can have perl look in other directories for extensions and
7015modules in addition to those already specified.
7016These directories will be searched after
7017 $sitearch
7018 $sitelib
7019EOM
7020test X"$vendorlib" != "X" && echo ' ' $vendorlib
7021test X"$vendorarch" != "X" && echo ' ' $vendorarch
7022echo ' '
7023case "$otherlibdirs" in
7024''|' ') dflt='none' ;;
7025*) dflt="$otherlibdirs" ;;
7026esac
7027$cat <<EOM
7028Enter a colon-separated set of extra paths to include in perl's @INC
7029search path, or enter 'none' for no extra paths.
7030
7031EOM
7032
7033rp='Colon-separated list of additional directories for perl to search?'
7034. ./myread
7035case "$ans" in
7036' '|''|none) otherlibdirs=' ' ;;
7037*) otherlibdirs="$ans" ;;
7038esac
7039case "$otherlibdirs" in
7040' ') val=$undef ;;
7041*) val=$define ;;
7042esac
7043set d_perl_otherlibdirs
7044eval $setvar
7045
7046: Cruising for prototypes
7047echo " "
7048echo "Checking out function prototypes..." >&4
55954f19
JH
7049$cat >prototype.c <<EOCP
7050#$i_stdlib I_STDLIB
7051#ifdef I_STDLIB
7052#include <stdlib.h>
7053#endif
b4eb6b3d
JH
7054int main(int argc, char *argv[]) {
7055 exit(0);}
7056EOCP
7057if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7058 echo "Your C compiler appears to support function prototypes."
7059 val="$define"
7060else
7061 echo "Your C compiler doesn't seem to understand function prototypes."
7062 val="$undef"
7063fi
7064set prototype
7065eval $setvar
7066$rm -f prototype*
7067
613d6c3e 7068: Check if ansi2knr is required
b4eb6b3d
JH
7069case "$prototype" in
7070"$define") ;;
7071*) ansi2knr='ansi2knr'
7072 echo " "
7073 cat <<EOM >&4
7074
7075$me: FATAL ERROR:
7076This version of $package can only be compiled by a compiler that
7077understands function prototypes. Unfortunately, your C compiler
7078 $cc $ccflags
7079doesn't seem to understand them. Sorry about that.
7080
7081If GNU cc is available for your system, perhaps you could try that instead.
7082
7083Eventually, we hope to support building Perl with pre-ANSI compilers.
7084If you would like to help in that effort, please contact <perlbug@perl.org>.
7085
7086Aborting Configure now.
7087EOM
7088 exit 2
7089 ;;
7090esac
7091
34f1896b
MB
7092: DTrace support
7093dflt_dtrace='/usr/sbin/dtrace'
7094cat <<EOM
7095
7096Perl can be built to support DTrace on platforms that support it.
7097DTrace is a diagnosis and performance analysis tool from Sun.
7098
7099If this doesn't make any sense to you, just accept the default '$dflt'.
7100EOM
7101
7102while $test 1 ; do
7103 case "$usedtrace" in
7104 $define|true|[yY]*)
7105 dflt='y'
7106 ;;
7107 ?*)
7108 dflt='y'
7109 dflt_dtrace=$usedtrace
7110 ;;
7111 *)
7112 dflt='n'
7113 ;;
7114 esac
7115
7116 rp='Support DTrace if available?'
7117 . ./myread
7118 case "$ans" in
7119 y|Y) val="$define" ;;
7120 *) val="$undef" ;;
7121 esac
7122 set usedtrace
7123 eval $setvar
7124
7125 test "X$usedtrace" != "X$define" && break
7126
7127 echo " "
7128 rp='Where is the dtrace executable?'
7129 dflt=$dflt_dtrace
7130 . ./getfile
7131 val="$ans"
7132 set dtrace
7133 eval $setvar
7134
7135 if $test -f $dtrace
7136 then
7137 if $dtrace -h -s ../perldtrace.d \
7138 -o perldtrace.tmp >/dev/null 2>&1 \
7139 && rm -f perldtrace.tmp
7140 then
7141 echo " "
7142 echo "Good: your $dtrace knows about the -h flag."
7143 else
7144 cat >&2 <<EOM
7145
7146*** $me: Fatal Error: $dtrace doesn't support -h flag
7147***
7148*** Your installed dtrace doesn't support the -h switch to compile a D
7149*** program into a C header. Can't continue.
7150
7151EOM
7152 exit 1
7153 fi
7154 break;
7155 fi
7156
7157 case "$fastread" in
7158 yes)
7159 cat >&2 <<EOM
7160
7161*** $me: Fatal Error: $dtrace not found.
7162*** Can't continue.
7163
7164EOM
7165 exit 1
7166 ;;
7167 *)
7168 echo "*** $dtrace was not found."
7169 echo " "
7170 ;;
7171 esac
7172done
7173
613d6c3e 7174: See if we want extra modules installed
6fcddf3b 7175echo " "
6fcddf3b 7176case "$extras" in
bf35c3f6
JH
7177'') dflt='n';;
7178*) dflt='y';;
6fcddf3b
JH
7179esac
7180cat <<EOM
7181Perl can be built with extra modules or bundles of modules which
7182will be fetched from the CPAN and installed alongside Perl.
7183
7184Notice that you will need access to the CPAN; either via the Internet,
7185or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7186be asked later to configure the CPAN.pm module which will in turn do
7187the installation of the rest of the extra modules or bundles.)
7188
7189Notice also that if the modules require any external software such as
dd2de242
JH
7190libraries and headers (the libz library and the zlib.h header for the
7191Compress::Zlib module, for example) you MUST have any such software
7192already installed, this configuration process will NOT install such
7193things for you.
6fcddf3b
JH
7194
7195If this doesn't make any sense to you, just accept the default '$dflt'.
7196EOM
dd2de242 7197rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7198. ./myread
7199case "$ans" in
7200y|Y)
7201 cat <<EOM
7202
7203Please list any extra modules or bundles to be installed from CPAN,
7204with spaces between the names. The names can be in any format the
dd2de242
JH
7205'install' command of CPAN.pm will understand. (Answer 'none',
7206without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7207EOM
7208 rp='Extras?'
7209 dflt="$extras"
7210 . ./myread
7211 extras="$ans"
7212esac
7213case "$extras" in
7214''|'none')
7215 val=''
7216 $rm -f ../extras.lst
7217 ;;
7218*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7219 echo "$extras" > ../extras.lst
7220 val="'$extras'"
6fcddf3b
JH
7221 ;;
7222esac
7223set extras
7224eval $setvar
7225echo " "
7226
6e1038e0
MB
7227: determine where html pages for programs go
7228set html1dir html1dir none
7229eval $prefixit
7230$cat <<EOM
7231
f3f1a2d8 7232If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7233the appropriate directory here. To skip installing html files,
7234answer "none".
7235EOM
7236case "$html1dir" in
7237''|none|$undef|' ') dflt=none ;;
7238*) dflt=$html1dir ;;
7239esac
7240fn=dn+~
7241rp="Directory for the main $spackage html pages?"
7242. ./getfile
79522dd2
NC
7243prefixvar=html1dir
7244. ./setprefixvar
6e1038e0
MB
7245: Use ' ' for none so value is preserved next time through Configure
7246$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7247
7248: determine where html pages for libraries and modules go
7249set html3dir html3dir none
7250eval $prefixit
7251$cat <<EOM
7252
7253If you wish to install html files for modules associated with $spackage,
7254indicate the appropriate directory here. To skip installing html files,
7255answer "none".
7256EOM
7257: There is no obvious default. If they have specified html1dir, then
7258: try to key off that, possibly changing .../html1 into .../html3.
7259case "$html3dir" in
7260'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7261*) dflt=$html3dir ;;
7262esac
7263fn=dn+~
7264rp="Directory for the $spackage module html pages?"
7265. ./getfile
79522dd2
NC
7266prefixvar=html3dir
7267. ./setprefixvar
6e1038e0
MB
7268: Use ' ' for none so value is preserved next time through Configure
7269$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7270
89ce900e
JH
7271: determine whether to install perl also as /usr/bin/perl
7272
7273echo " "
7274if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7275 $cat <<EOM
7276Many scripts expect perl to be installed as /usr/bin/perl.
7277
7278If you want to, I can install the perl you are about to compile
7279as /usr/bin/perl (in addition to $bin/perl).
7280EOM
7281 if test -f /usr/bin/perl; then
7282 $cat <<EOM
7283
7284However, please note that because you already have a /usr/bin/perl,
7285overwriting that with a new Perl would very probably cause problems.
7286Therefore I'm assuming you don't want to do that (unless you insist).
7287
7288EOM
7289 case "$installusrbinperl" in
7290 "$define"|[yY]*) dflt='y';;
7291 *) dflt='n';;
7292 esac
7293 else
7294 $cat <<EOM
7295
7296Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7297
7298EOM
7299 case "$installusrbinperl" in
7300 "$undef"|[nN]*) dflt='n';;
7301 *) dflt='y';;
7302 esac
7303 fi
7304 rp="Do you want to install perl as /usr/bin/perl?"
7305 . ./myread
7306 case "$ans" in
7307 [yY]*) val="$define";;
7308 *) val="$undef" ;;
7309 esac
7310else
7311 val="$undef"
7312fi
7313set installusrbinperl
7314eval $setvar
7315
613d6c3e 7316: Check if we are using the GNU C library
89ce900e
JH
7317echo " "
7318echo "Checking for GNU C Library..." >&4
7319cat >try.c <<'EOCP'
7320/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7321 alone are insufficient to distinguish different versions, such as
7322 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7323 libc version 2.1.0. A. Dougherty, June 3, 2002.
7324*/
7325#include <stdio.h>
7326int main(void)
7327{
7328#ifdef __GLIBC__
7329# ifdef __GLIBC_MINOR__
4fb7dc7d 7330# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7331# include <gnu/libc-version.h>
7332 printf("%s\n", gnu_get_libc_version());
7333# else
7334 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7335# endif
7336# else
7337 printf("%d\n", __GLIBC__);
7338# endif
7339 return 0;
7340#else
7341 return 1;
7342#endif
7343}
7344EOCP
7345set try
7346if eval $compile_ok && $run ./try > glibc.ver; then
7347 val="$define"
7348 gnulibc_version=`$cat glibc.ver`
7349 echo "You are using the GNU C Library version $gnulibc_version"
7350else
7351 val="$undef"
7352 gnulibc_version=''
7353 echo "You are not using the GNU C Library"
7354fi
5b813a60 7355$rm_try glibc.ver
89ce900e
JH
7356set d_gnulibc
7357eval $setvar
7358
7359: see if nm is to be used to determine whether a symbol is defined or not
7360case "$usenm" in
7361'')
7362 dflt=''
7363 case "$d_gnulibc" in
7364 "$define")
7365 echo " "
7366 echo "nm probably won't work on the GNU C Library." >&4
7367 dflt=n
7368 ;;
7369 esac
7370 case "$dflt" in
7371 '')
7372 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7373 echo " "
7374 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7375 echo "'nm' won't be sufficient on this sytem." >&4
7376 dflt=n
7377 fi
7378 ;;
7379 esac
7380 case "$dflt" in
7381 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7382 if $test $dflt -gt 20; then
7383 dflt=y
7384 else
7385 dflt=n
7386 fi
7387 ;;
7388 esac
b4eb6b3d 7389 ;;
89ce900e
JH
7390*)
7391 case "$usenm" in
7392 true|$define) dflt=y;;
7393 *) dflt=n;;
7394 esac
b4eb6b3d
JH
7395 ;;
7396esac
89ce900e 7397$cat <<EOM
b4eb6b3d 7398
89ce900e
JH
7399I can use $nm to extract the symbols from your C libraries. This
7400is a time consuming task which may generate huge output on the disk (up
7401to 3 megabytes) but that should make the symbols extraction faster. The
7402alternative is to skip the 'nm' extraction part and to compile a small
7403test program instead to determine whether each symbol is present. If
7404you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7405this may be the best solution.
b4eb6b3d 7406
89ce900e 7407You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7408
89ce900e
JH
7409EOM
7410rp="Shall I use $nm to extract C symbols from the libraries?"
7411. ./myread
7412case "$ans" in
7413[Nn]*) usenm=false;;
7414*) usenm=true;;
b4eb6b3d 7415esac
89ce900e
JH
7416
7417runnm=$usenm
7418case "$reuseval" in
7419true) runnm=false;;
b4eb6b3d 7420esac
b4eb6b3d 7421
89ce900e
JH
7422: nm options which may be necessary
7423case "$nm_opt" in
7424'') if $test -f /mach_boot; then
7425 nm_opt='' # Mach
7426 elif $test -d /usr/ccs/lib; then
7427 nm_opt='-p' # Solaris (and SunOS?)
7428 elif $test -f /dgux; then
7429 nm_opt='-p' # DG-UX
7430 elif $test -f /lib64/rld; then
7431 nm_opt='-p' # 64-bit Irix
7432 else
7433 nm_opt=''
7434 fi;;
7435esac
b4eb6b3d 7436
89ce900e
JH
7437: nm options which may be necessary for shared libraries but illegal
7438: for archive libraries. Thank you, Linux.
7439case "$nm_so_opt" in
7440'') case "$myuname" in
fb2e1bc0 7441 *linux*|gnu*)
89ce900e
JH
7442 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7443 nm_so_opt='--dynamic'
7444 fi
7445 ;;
7446 esac
7447 ;;
7448esac
b4eb6b3d 7449
1d8eaf8c 7450: Figure out where the libc is located
89ce900e
JH
7451case "$runnm" in
7452true)
1d8eaf8c 7453: get list of predefined functions in a handy place
89ce900e
JH
7454echo " "
7455case "$libc" in
7456'') libc=unknown
7457 case "$libs" in
7458 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7459 esac
7460 ;;
b4eb6b3d 7461esac
89ce900e
JH
7462case "$libs" in
7463'') ;;
7464*) for thislib in $libs; do
7465 case "$thislib" in
7466 -lc|-lc_s)
7467 : Handle C library specially below.
7468 ;;
7469 -l*)
7470 thislib=`echo $thislib | $sed -e 's/^-l//'`
7471 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7472 :
7473 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7474 :
7475 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7476 :
7477 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7478 :
7479 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7480 :
7481 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7482 :
7483 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7484 :
7485 else
7486 try=''
7487 fi
7488 libnames="$libnames $try"
7489 ;;
7490 *) libnames="$libnames $thislib" ;;
7491 esac
7492 done
b4eb6b3d
JH
7493 ;;
7494esac
89ce900e
JH
7495xxx=normal
7496case "$libc" in
7497unknown)
7498 set /lib/libc.$so
7499 for xxx in $libpth; do
7500 $test -r $1 || set $xxx/libc.$so
7501 : The messy sed command sorts on library version numbers.
7502 $test -r $1 || \
7503 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7504 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7505 h
7506 s/[0-9][0-9]*/0000&/g
7507 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7508 G
7509 s/\n/ /' | \
7510 $sort | $sed -e 's/^.* //'`
7511 eval set \$$#
7512 done
7513 $test -r $1 || set /usr/ccs/lib/libc.$so
7514 $test -r $1 || set /lib/libsys_s$_a
7515 ;;
7516*)
7517 set blurfl
7518 ;;
7519esac
7520if $test -r "$1"; then
7521 echo "Your (shared) C library seems to be in $1."
7522 libc="$1"
7523elif $test -r /lib/libc && $test -r /lib/clib; then
7524 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7525 xxx=apollo
7526 libc='/lib/clib /lib/libc'
7527 if $test -r /lib/syslib; then
7528 echo "(Your math library is in /lib/syslib.)"
7529 libc="$libc /lib/syslib"
7530 fi
7531elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7532 echo "Your C library seems to be in $libc, as you said before."
7533elif $test -r $incpath/usr/lib/libc$_a; then
7534 libc=$incpath/usr/lib/libc$_a;
7535 echo "Your C library seems to be in $libc. That's fine."
7536elif $test -r /lib/libc$_a; then
7537 libc=/lib/libc$_a;
7538 echo "Your C library seems to be in $libc. You're normal."
7539else
7540 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7541 :
7542 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7543 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7544 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7545 :
7546 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7547 :
7548 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7549 :
7550 else
7551 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7552 fi
7553 if $test -r "$tans"; then
7554 echo "Your C library seems to be in $tans, of all places."
7555 libc=$tans
7556 else
7557 libc='blurfl'
7558 fi
7559fi
7560if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7561 dflt="$libc"
7562 cat <<EOM
b4eb6b3d 7563
89ce900e
JH
7564If the guess above is wrong (which it might be if you're using a strange
7565compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7566
89ce900e
JH
7567EOM
7568else
7569 dflt=''
7570 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7571 cat >&4 <<EOM
7572I can't seem to find your C library. I've looked in the following places:
5e366f65 7573
b4eb6b3d 7574EOM
89ce900e
JH
7575 $sed 's/^/ /' libpath
7576 cat <<EOM
5e366f65 7577
89ce900e 7578None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7579
7580EOM
89ce900e
JH
7581fi
7582fn=f
7583rp='Where is your C library?'
7584. ./getfile
7585libc="$ans"
5e366f65 7586
89ce900e
JH
7587echo " "
7588echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7589set X `cat libnames`
7590shift
7591xxx=files
7592case $# in 1) xxx=file; esac
7593echo "Extracting names from the following $xxx for later perusal:" >&4
7594echo " "
7595$sed 's/^/ /' libnames >&4
7596echo " "
7597$echo $n "This may take a while...$c" >&4
5e366f65 7598
89ce900e
JH
7599for file in $*; do
7600 case $file in
7601 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7602 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7603 esac
89ce900e
JH
7604done >libc.tmp
7605
7606$echo $n ".$c"
7607$grep fprintf libc.tmp > libc.ptf
7608xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7609xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7610xxx='[ADTSIW]'
ab900c53 7611if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7612 eval $xscan;\
7613 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7614 eval $xrun
7615elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7616 eval $xscan;\
7617 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7618 eval $xrun
7619elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7620 eval $xscan;\
7621 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7622 eval $xrun
7623elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7624 eval $xscan;\
7625 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7626 eval $xrun
7627elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7628 eval $xscan;\
7629 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630 eval $xrun
7631elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7632 eval $xscan;\
7633 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634 eval $xrun
7635elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7636 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7637 eval $xscan;\
7638 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7639 eval $xrun
7640elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7641 eval $xscan;\
7642 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643 eval $xrun
7644elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7645 eval $xscan;\
7646 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647 eval $xrun
7648elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7649 eval $xscan;\
7650 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651 eval $xrun
7652elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7653 eval $xscan;\
7654 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655 eval $xrun
7656elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7657 eval $xscan;\
7658 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659 eval $xrun
7660elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7661 eval $xscan;\
7662 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663 eval $xrun
7664elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7665 eval $xscan;\
7666 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7667 eval $xrun
b4eb6b3d 7668else
89ce900e
JH
7669 $nm -p $* 2>/dev/null >libc.tmp
7670 $grep fprintf libc.tmp > libc.ptf
7671 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7672 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7673 then
7674 nm_opt='-p'
7675 eval $xrun
7676 else
7677 echo " "
7678 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7679 com=''
1d8eaf8c
MB
7680 if $ar t $libc > libc.tmp && \
7681 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7682 then
89ce900e
JH
7683 for thisname in $libnames $libc; do
7684 $ar t $thisname >>libc.tmp
7685 done
7686 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7687 echo "Ok." >&4
7688 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
89ce900e
JH
7689 for thisname in $libnames $libc; do
7690 $ar tv $thisname >>libc.tmp
89ce900e
JH
7691 emximp -o tmp.imp $thisname \
7692 2>/dev/null && \
7693 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7694 < tmp.imp >>libc.tmp
1d8eaf8c 7695 $rm -f tmp.imp
89ce900e
JH
7696 done
7697 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7698 echo "Ok." >&4
7699 else
7700 echo "$ar didn't seem to work right." >&4
7701 echo "Maybe this is a Cray...trying bld instead..." >&4
1d8eaf8c
MB
7702 if bld t $libc | \
7703 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7704 $test -s libc.list
89ce900e
JH
7705 then
7706 for thisname in $libnames; do
7707 bld t $libnames | \
7708 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7709 $ar t $thisname >>libc.tmp
7710 done
7711 echo "Ok." >&4
7712 else
7713 echo "That didn't work either. Giving up." >&4
7714 exit 1
7715 fi
7716 fi
7717 fi
b4eb6b3d 7718fi
89ce900e
JH
7719nm_extract="$com"
7720case "$PASE" in
7721define)
7722 echo " "
7723 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7724 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7725 ;;
7726*) if $test -f /lib/syscalls.exp; then
7727 echo " "
7728 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
1d8eaf8c
MB
7729 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7730 /lib/syscalls.exp >>libc.list
89ce900e
JH
7731 fi
7732 ;;
7733esac
7734;;
7735esac
7736$rm -f libnames libpath
b4eb6b3d
JH
7737
7738: see if dld is available
7739set dld.h i_dld
7740eval $inhdr
7741
613d6c3e 7742: Check if we are using C++
43dddb59
MB
7743echo " "
7744echo "Checking for C++..." >&4
20e87299 7745$cat >try.c <<'EOCP'
43dddb59
MB
7746#include <stdio.h>
7747int main(void)
7748{
7749#ifdef __cplusplus
20e87299 7750 return 0;
43dddb59 7751#else
20e87299 7752 return 1;
43dddb59 7753#endif
43dddb59
MB
7754}
7755EOCP
7756set try
20e87299
AD
7757if eval $compile_ok && $run ./try; then
7758 val="$define"
43dddb59
MB
7759 echo "You are using a C++ compiler."
7760else
7761 val="$undef"
7762 echo "You are not using a C++ compiler."
7763fi
5b813a60 7764$rm_try cplusplus$$
43dddb59
MB
7765set d_cplusplus
7766eval $setvar
7767
89ce900e
JH
7768: is a C symbol defined?
7769csym='tlook=$1;
7770case "$3" in
373dfab3
JH
7771-v) tf=libc.tmp; tdc="";;
7772-a) tf=libc.tmp; tdc="[]";;
7773*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7774esac;
7775tx=yes;
7776case "$reuseval-$4" in
7777true-) ;;
7778true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7779esac;
7780case "$tx" in
7781yes)
43dddb59 7782 tval=false;
328aef96
NC
7783 case "$d_cplusplus" in
7784 $define) extern_C=\"C\";;
7785 esac;
5129fff4
JH
7786 if $test "$runnm" = true; then
7787 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7788 tval=true;
5129fff4 7789 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
328aef96 7790 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7791 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7792 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7793 $rm_try;
89ce900e 7794 fi;
5129fff4 7795 else
328aef96 7796 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7797 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5b813a60 7798 $rm_try;
ab900c53
AB
7799 fi;
7800 ;;
89ce900e
JH
7801*)
7802 case "$tval" in
7803 $define) tval=true;;
7804 *) tval=false;;
ab900c53
AB
7805 esac;
7806 ;;
89ce900e
JH
7807esac;
7808eval "$2=$tval"'
7809
7810: define an is-in-libc? function
7811inlibc='echo " "; td=$define; tu=$undef;
7812sym=$1; var=$2; eval "was=\$$2";
7813tx=yes;
7814case "$reuseval$was" in
7815true) ;;
7816true*) tx=no;;
7817esac;
7818case "$tx" in
7819yes)
7820 set $sym tres -f;
7821 eval $csym;
7822 case "$tres" in
7823 true)
7824 echo "$sym() found." >&4;
7825 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7826 *)
7827 echo "$sym() NOT found." >&4;
7828 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7829 esac;;
7830*)
7831 case "$was" in
7832 $define) echo "$sym() found." >&4;;
7833 *) echo "$sym() NOT found." >&4;;
7834 esac;;
7835esac'
7836
b4eb6b3d
JH
7837: see if dlopen exists
7838xxx_runnm="$runnm"
666ea192 7839xxx_ccflags="$ccflags"
b4eb6b3d 7840runnm=false
666ea192
JH
7841: with g++ one needs -shared to get is-in-libc to work for dlopen
7842case "$gccversion" in
7843'') ;;
7844*) case "$d_cplusplus" in
7845 "$define") ccflags="$ccflags -shared" ;;
7846 esac
7847 ;;
7848esac
b4eb6b3d
JH
7849set dlopen d_dlopen
7850eval $inlibc
7851runnm="$xxx_runnm"
666ea192 7852ccflags="$xxx_ccflags"
b4eb6b3d 7853
4fb7dc7d
JH
7854: see if this is a unistd.h system
7855set unistd.h i_unistd
7856eval $inhdr
7857
b4eb6b3d
JH
7858: determine which dynamic loading, if any, to compile in
7859echo " "
7860dldir="ext/DynaLoader"
7861case "$usedl" in
7862$define|y|true)
7863 dflt='y'
7864 usedl="$define"
7865 ;;
7866$undef|n|false)
7867 dflt='n'
7868 usedl="$undef"
7869 ;;
5b813a60 7870*)
b4eb6b3d
JH
7871 dflt='n'
7872 case "$d_dlopen" in
7873 $define) dflt='y' ;;
7874 esac
7875 case "$i_dld" in
7876 $define) dflt='y' ;;
7877 esac
7878 : Does a dl_xxx.xs file exist for this operating system
7879 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7880 ;;
7881esac
7882rp="Do you wish to use dynamic loading?"
7883. ./myread
7884usedl="$ans"
7885case "$ans" in
7886y*) usedl="$define"
7887 case "$dlsrc" in
7888 '')
7889 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7890 dflt="$dldir/dl_${osname}.xs"
7891 elif $test "$d_dlopen" = "$define" ; then
7892 dflt="$dldir/dl_dlopen.xs"
7893 elif $test "$i_dld" = "$define" ; then
7894 dflt="$dldir/dl_dld.xs"
7895 else
7896 dflt=''
7897 fi
7898 ;;
7899 *) dflt="$dldir/$dlsrc"
7900 ;;
7901 esac
7902 echo "The following dynamic loading files are available:"
7903 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7904 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7905 rp="Source file to use for dynamic loading"
7906 fn="fne"
7907 gfpth="$src"
7908 . ./getfile
7909 usedl="$define"
7910 : emulate basename
7911 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7912
7913 $cat << EOM
7914
7915Some systems may require passing special flags to $cc -c to
7916compile modules that will be used to create a shared library.
7917To use no flags, say "none".
7918
7919EOM
7920 case "$cccdlflags" in
7921 '') case "$gccversion" in
7922 '') case "$osname" in
7923 hpux) dflt='+z' ;;
7924 next) dflt='none' ;;
7925 irix*) dflt='-KPIC' ;;
48bcfe03 7926 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7927 sunos) dflt='-pic' ;;
7928 *) dflt='none' ;;
7929 esac
7930 ;;
7931 *) case "$osname" in
b6cc0f4c 7932 darwin) dflt='none' ;;
15fcae63 7933 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7934 *) dflt='-fpic' ;;
7935 esac ;;
7936 esac ;;
7937 ' ') dflt='none' ;;
7938 *) dflt="$cccdlflags" ;;
7939 esac
7940 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7941 . ./myread
7942 case "$ans" in
7943 none) cccdlflags=' ' ;;
7944 *) cccdlflags="$ans" ;;
7945 esac
7946
7947 cat << EOM
7948
7949Some systems use ld to create libraries that can be dynamically loaded,
7950while other systems (such as those using ELF) use $cc.
7951
7952EOM
7953 case "$ld" in
55954f19 7954 '') $cat >try.c <<EOM
b4eb6b3d
JH
7955/* Test for whether ELF binaries are produced */
7956#include <fcntl.h>
55954f19
JH
7957#$i_stdlib I_STDLIB
7958#ifdef I_STDLIB
b4eb6b3d 7959#include <stdlib.h>
55954f19 7960#endif
4fb7dc7d
JH
7961#$i_unistd I_UNISTD
7962#ifdef I_UNISTD
7963#include <unistd.h>
7964#endif
b4eb6b3d
JH
7965int main() {
7966 char b[4];
7967 int i = open("a.out",O_RDONLY);
5b813a60 7968 if(i == -1)
b4eb6b3d
JH
7969 exit(1); /* fail */
7970 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7971 exit(0); /* succeed (yes, it's ELF) */
7972 else
7973 exit(1); /* fail */
7974}
7975EOM
5440bc8e 7976 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7977 cat <<EOM
7978You appear to have ELF support. I'll use $cc to build dynamic libraries.
7979EOM
7980 dflt="$cc"
7981 else
7982 echo "I'll use ld to build dynamic libraries."
7983 dflt='ld'
7984 fi
5b813a60 7985 $rm_try
b4eb6b3d
JH
7986 ;;
7987 *) dflt="$ld"
7988 ;;
7989 esac
7990
7991 rp="What command should be used to create dynamic libraries?"
7992 . ./myread
7993 ld="$ans"
7994
7995 cat << EOM
7996
7997Some systems may require passing special flags to $ld to create a
7998library that can be dynamically loaded. If your ld flags include
7999-L/other/path options to locate libraries outside your loader's normal
8000search path, you may need to specify those -L options here as well. To
8001use no flags, say "none".
8002
8003EOM
8004 case "$lddlflags" in
8005 '') case "$osname" in
8006 beos) dflt='-nostart' ;;
8007 hpux) dflt='-b';
8008 case "$gccversion" in
8009 '') dflt="$dflt +vnocompatwarnings" ;;
8010 esac
5b813a60 8011 ;;
15fcae63 8012 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
8013 next) dflt='none' ;;
8014 solaris) dflt='-G' ;;
8015 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 8016 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
8017 *) dflt='none' ;;
8018 esac
8019 ;;
8020 *) dflt="$lddlflags" ;;
8021 esac
8022
8023 : Try to guess additional flags to pick up local libraries.
8024 : Be careful not to append to a plain 'none'
8025 case "$dflt" in
8026 none) dflt='' ;;
8027 esac
8028 for thisflag in $ldflags; do
8029 case "$thisflag" in
b5b9f165 8030 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
8031 case " $dflt " in
8032 *" $thisflag "*) ;;
8033 *) dflt="$dflt $thisflag" ;;
8034 esac
8035 ;;
8036 esac
8037 done
8038
8039 case "$dflt" in
8040 ''|' ') dflt='none' ;;
8041 esac
8042
8f68b0e6
AD
8043 case "$ldflags" in
8044 *-fstack-protector*)
8045 case "$dflt" in
8046 *-fstack-protector*) ;; # Don't add it again
8047 *) dflt="$dflt -fstack-protector" ;;
8048 esac
8049 ;;
8050 esac
8051
8052
b4eb6b3d
JH
8053 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8054 . ./myread
8055 case "$ans" in
8056 none) lddlflags=' ' ;;
8057 *) lddlflags="$ans" ;;
8058 esac
8059
8060 cat <<EOM
8061
8062Some systems may require passing special flags to $cc to indicate that
8063the resulting executable will use dynamic linking. To use no flags,
8064say "none".
8065
8066EOM
8067 case "$ccdlflags" in
8068 '') case "$osname" in
fb2e1bc0 8069 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
8070 next|sunos) dflt='none' ;;
8071 *) dflt='none' ;;
b4eb6b3d
JH
8072 esac ;;
8073 ' ') dflt='none' ;;
8074 *) dflt="$ccdlflags" ;;
8075 esac
8076 rp="Any special flags to pass to $cc to use dynamic linking?"
8077 . ./myread
8078 case "$ans" in
8079 none) ccdlflags=' ' ;;
8080 *) ccdlflags="$ans" ;;
8081 esac
8082 ;;
8083*) usedl="$undef"
8084 ld='ld'
8085 dlsrc='dl_none.xs'
8086 lddlflags=''
8087 ccdlflags=''
8088 ;;
8089esac
8090
34f1896b 8091: Do we want a shared libperl?
b4eb6b3d
JH
8092also=''
8093case "$usedl" in
8094$undef)
8095 # No dynamic loading being used, so don't bother even to prompt.
8096 useshrplib='false'
8097 ;;
8098*) case "$useshrplib" in
8099 '') case "$osname" in
48bcfe03 8100 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
8101 dflt=y
8102 also='Building a shared libperl is required for dynamic loading to work on your system.'
8103 ;;
8104 next*)
8105 case "$osvers" in
8106 4*) dflt=y
8107 also='Building a shared libperl is needed for MAB support.'
8108 ;;
8109 *) dflt=n
8110 ;;
8111 esac
8112 ;;
8113 *) dflt=n
8114 ;;
8115 esac
8116 ;;
8117 $define|true|[Yy]*)
8118 dflt=y
8119 ;;
8120 *) dflt=n
8121 ;;
8122 esac
8123 $cat << EOM
8124
8125The perl executable is normally obtained by linking perlmain.c with
8126libperl${_a}, any static extensions (usually just DynaLoader), and
8127any other libraries needed on this system (such as -lm, etc.). Since
8128your system supports dynamic loading, it is probably possible to build
8129a shared libperl.$so. If you will have more than one executable linked
8130to libperl.$so, this will significantly reduce the size of each
5cadb3f3 8131executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
8132default is probably sensible for your system.
8133$also
8134
8135EOM
8136 rp="Build a shared libperl.$so (y/n)"
8137 . ./myread
8138 case "$ans" in
8139 true|$define|[Yy]*)
8140 useshrplib='true' ;;
8141 *) useshrplib='false' ;;
8142 esac
8143 ;;
8144esac
8145
8146case "$useshrplib" in
8147true)
8148 case "$libperl" in
8149 '')
8150 # Figure out a good name for libperl.so. Since it gets stored in
8151 # a version-specific architecture-dependent library, the version
8152 # number isn't really that important, except for making cc/ld happy.
8153 #
8154 # A name such as libperl.so.3.1
8155 majmin="libperl.$so.$patchlevel.$subversion"
8156 # A name such as libperl.so.301
8157 majonly=`echo $patchlevel $subversion |
8158 $awk '{printf "%d%02d", $1, $2}'`
8159 majonly=libperl.$so.$majonly
8160 # I'd prefer to keep the os-specific stuff here to a minimum, and
8161 # rely on figuring it out from the naming of libc.
8162 case "${osname}${osvers}" in
8163 next4*)
8164 dflt=libperl.5.$so
8165 # XXX How handle the --version stuff for MAB?
8166 ;;
fb2e1bc0 8167 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8168 dflt=libperl.$so
8169 ;;
b53432e4
GH
8170 cygwin*) # ld links against an importlib
8171 dflt=libperl$lib_ext
b4eb6b3d
JH
8172 ;;
8173 *) # Try to guess based on whether libc has major.minor.
8174 case "$libc" in
8175 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8176 *libc.$so.[0-9]*) dflt=$majonly ;;
8177 *) dflt=libperl.$so ;;
8178 esac
8179 ;;
8180 esac
8181 ;;
8182 *) dflt=$libperl
8183 ;;
8184 esac
8185 cat << EOM
8186
8187I need to select a good name for the shared libperl. If your system uses
8188library names with major and minor numbers, then you might want something
8189like $majmin. Alternatively, if your system uses a single version
8190number for shared libraries, then you might want to use $majonly.
8191Or, your system might be quite happy with a simple libperl.$so.
8192
8193Since the shared libperl will get installed into a version-specific
8194architecture-dependent directory, the version number of the shared perl
8195library probably isn't important, so the default should be o.k.
8196
8197EOM
8198 rp='What name do you want to give to the shared libperl?'
8199 . ./myread
8200 libperl=$ans
8201 echo "Ok, I'll use $libperl"
8202 ;;
8203*)
8204 libperl="libperl${_a}"
8205 ;;
8206esac
8207
8208# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8209case "$shrpdir" in
8210'') ;;
8211*) $cat >&4 <<EOM
8212WARNING: Use of the shrpdir variable for the installation location of
8213the shared $libperl is not supported. It was never documented and
8214will not work in this version. Let me (perlbug@perl.org)
8215know of any problems this may cause.
8216
8217EOM
8218 case "$shrpdir" in
8219 "$archlibexp/CORE")
8220 $cat >&4 <<EOM
8221But your current setting of $shrpdir is
8222the default anyway, so it's harmless.
8223EOM
8224 ;;
8225 *)
8226 $cat >&4 <<EOM
8227Further, your current attempted setting of $shrpdir
8228conflicts with the value of $archlibexp/CORE
8229that installperl will use.
8230EOM
8231 ;;
8232 esac
8233 ;;
8234esac
8235
8236# How will the perl executable find the installed shared $libperl?
8237# Add $xxx to ccdlflags.
8238# If we can't figure out a command-line option, use $shrpenv to
8239# set env LD_RUN_PATH. The main perl makefile uses this.
8240shrpdir=$archlibexp/CORE
8241xxx=''
8242tmp_shrpenv=''
8243if "$useshrplib"; then
34f1896b 8244 case "$osname" in
b4eb6b3d
JH
8245 aix)
8246 # We'll set it in Makefile.SH...
8247 ;;
b5b9f165 8248 solaris)
b4eb6b3d
JH
8249 xxx="-R $shrpdir"
8250 ;;
a774dfe6 8251 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8252 xxx="-Wl,-R$shrpdir"
8253 ;;
fb2e1bc0 8254 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8255 xxx="-Wl,-rpath,$shrpdir"
8256 ;;
8257 next)
8258 # next doesn't like the default...
8259 ;;
8260 beos)
8261 # beos doesn't like the default, either.
8262 ;;
8263 hpux*)
8264 # hpux doesn't like the default, either.
8265 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8266 ;;
8267 *)
8268 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8269 ;;
8270 esac
8271 case "$xxx" in
8272 '') ;;
34f1896b 8273 *)
b4eb6b3d
JH
8274 # Only add $xxx if it isn't already in ccdlflags.
8275 case " $ccdlflags " in
8276 *" $xxx "*) ;;
8277 *) ccdlflags="$ccdlflags $xxx"
8278 cat <<EOM >&4
8279
8280Adding $xxx to the flags
34f1896b 8281passed to $ld so that the perl executable will find the
b4eb6b3d
JH
8282installed shared $libperl.
8283
8284EOM
8285 ;;
8286 esac
8287 ;;
8288 esac
8289fi
8290# Fix ccdlflags in AIX for building external extensions.
8291# (For building Perl itself bare -bE:perl.exp is needed,
8292# Makefile.SH takes care of this.)
8293case "$osname" in
8294aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8295esac
8296# Respect a hint or command-line value.
8297case "$shrpenv" in
8298'') shrpenv="$tmp_shrpenv" ;;
8299esac
8300case "$ldlibpthname" in
8301'') ldlibpthname=LD_LIBRARY_PATH ;;
8302none) ldlibpthname='' ;;
8303esac
8304
8305: determine where manual pages are on this system
8306echo " "
8307case "$sysman" in
8308'')
4a0a3829
SD
8309 syspath='/usr/share/man/man1 /usr/man/man1'
8310 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8311 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8312 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8313 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8314 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8315 sysman=`./loc . /usr/man/man1 $syspath`
8316 ;;
8317esac
8318if $test -d "$sysman"; then
8319 echo "System manual is in $sysman." >&4
8320else
8321 echo "Could not find manual pages in source form." >&4
8322fi
8323
8324: determine where manual pages go
8325set man1dir man1dir none
8326eval $prefixit
8327$cat <<EOM
8328
8329$spackage has manual pages available in source form.
8330EOM
8331case "$nroff" in
8332nroff)
8333 echo "However, you don't have nroff, so they're probably useless to you."
8334 case "$man1dir" in
8335 '') man1dir="none";;
8336 esac;;
8337esac
8338echo "If you don't want the manual sources installed, answer 'none'."
8339case "$man1dir" in
8340' ') dflt=none
8341 ;;
8342'')
4a0a3829
SD
8343 lookpath="$prefixexp/share/man/man1"
8344 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8345 lookpath="$lookpath $prefixexp/man/p_man/man1"
8346 lookpath="$lookpath $prefixexp/man/u_man/man1"
8347 lookpath="$lookpath $prefixexp/man/man.1"
8348 case "$sysman" in
8349 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8350 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8351 esac
8352 set dflt
8353 eval $prefixup
8354 ;;
8355*) dflt="$man1dir"
8356 ;;
8357esac
8358echo " "
8359fn=dn+~
8360rp="Where do the main $spackage manual pages (source) go?"
8361. ./getfile
8362if $test "X$man1direxp" != "X$ansexp"; then
8363 installman1dir=''
8364fi
79522dd2
NC
8365prefixvar=man1dir
8366. ./setprefixvar
8367
477140ee
NC
8368case "$man1dir" in
8369'') man1dir=' '
8370 installman1dir='';;
8371esac
b4eb6b3d
JH
8372
8373: What suffix to use on installed man pages
8374
8375case "$man1dir" in
8376' ')
8377 man1ext='0'
8378 ;;
8379*)
8380 rp="What suffix should be used for the main $spackage man pages?"
8381 case "$man1ext" in
8382 '') case "$man1dir" in
8383 *1) dflt=1 ;;
8384 *1p) dflt=1p ;;
8385 *1pm) dflt=1pm ;;
8386 *l) dflt=l;;
8387 *n) dflt=n;;
8388 *o) dflt=o;;
8389 *p) dflt=p;;
8390 *C) dflt=C;;
8391 *L) dflt=L;;
8392 *L1) dflt=L1;;
8393 *) dflt=1;;
8394 esac
8395 ;;
8396 *) dflt="$man1ext";;
8397 esac
8398 . ./myread
8399 man1ext="$ans"
8400 ;;
8401esac
8402
8403: see if we can have long filenames
8404echo " "
8405first=123456789abcdef
8406$rm -f $first
8407if (echo hi >$first) 2>/dev/null; then
8408 if $test -f 123456789abcde; then
8409 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8410 val="$undef"
8411 else
8412 echo 'You can have filenames longer than 14 characters.'>&4
8413 val="$define"
8414 fi
8415else
8416 $cat <<'EOM'
8417You can't have filenames longer than 14 chars.
8418You can't even think about them!
8419EOM
8420 val="$undef"
776a38e3 8421fi
b4eb6b3d
JH
8422set d_flexfnam
8423eval $setvar
8424$rm -rf 123456789abcde*
8425
8426: determine where library module manual pages go
8427set man3dir man3dir none
8428eval $prefixit
8429$cat <<EOM
8430
8431$spackage has manual pages for many of the library modules.
8432EOM
8433
8434case "$nroff" in
8435nroff)
8436 $cat <<'EOM'
8437However, you don't have nroff, so they're probably useless to you.
8438EOM
8439 case "$man3dir" in
8440 '') man3dir="none";;
8441 esac;;
8442esac
8443
8444case "$d_flexfnam" in
8445undef)
8446 $cat <<'EOM'
f3f1a2d8 8447However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8448EOM
8449 case "$man3dir" in
8450 '') man3dir="none";;
8451 esac;;
8452esac
8453
8454echo "If you don't want the manual sources installed, answer 'none'."
8455prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8456case "$man3dir" in
8457'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8458 if $test -d "$privlib/man/man3"; then
8459 cat <<EOM >&4
8460
8461WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8462$privlib/man/man3. This version will suggest a
8463new default of $dflt.
b4eb6b3d
JH
8464EOM
8465 tdflt=$dflt
8466 dflt='n'
8467 rp='Do you wish to preserve the old behavior?(y/n)'
8468 . ./myread
8469 case "$ans" in
8470 y*) dflt="$privlib/man/man3" ;;
8471 *) dflt=$tdflt ;;
8472 esac
8473 fi
8474 ;;
8475*) dflt="$man3dir" ;;
8476esac
8477case "$dflt" in
8478' ') dflt=none ;;
8479esac
8480echo " "
8481fn=dn+~
8482rp="Where do the $package library man pages (source) go?"
8483. ./getfile
79522dd2
NC
8484prefixvar=man3dir
8485. ./setprefixvar
8486
477140ee
NC
8487case "$man3dir" in
8488'') man3dir=' '
8489 installman3dir='';;
8490esac
b4eb6b3d
JH
8491
8492: What suffix to use on installed man pages
8493case "$man3dir" in
8494' ')
8495 man3ext='0'
8496 ;;
8497*)
8498 rp="What suffix should be used for the $package library man pages?"
8499 case "$man3ext" in
8500 '') case "$man3dir" in
8501 *3) dflt=3 ;;
8502 *3p) dflt=3p ;;
8503 *3pm) dflt=3pm ;;
8504 *l) dflt=l;;
8505 *n) dflt=n;;
8506 *o) dflt=o;;
8507 *p) dflt=p;;
8508 *C) dflt=C;;
8509 *L) dflt=L;;
8510 *L3) dflt=L3;;
8511 *) dflt=3;;
8512 esac
8513 ;;
8514 *) dflt="$man3ext";;
8515 esac
8516 . ./myread
8517 man3ext="$ans"
8518 ;;
8519esac
8520
8521: see if we have to deal with yellow pages, now NIS.
0384a54a 8522if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8523 if $test -f /usr/etc/nibindd; then
8524 echo " "
8525 echo "I'm fairly confident you're on a NeXT."
8526 echo " "
8527 rp='Do you get the hosts file via NetInfo?'
8528 dflt=y
8529 case "$hostcat" in
8530 nidump*) ;;
8531 '') ;;
8532 *) dflt=n;;
8533 esac
8534 . ./myread
8535 case "$ans" in
8536 y*) hostcat='nidump hosts .';;
8537 *) case "$hostcat" in
8538 nidump*) hostcat='';;
8539 esac
8540 ;;
8541 esac
8542 fi
8543 case "$hostcat" in
8544 nidump*) ;;
8545 *)
8546 case "$hostcat" in
8547 *ypcat*) dflt=y;;
8548 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8549 dflt=y
8550 else
8551 dflt=n
8552 fi;;
8553 *) dflt=n;;
8554 esac
8555 echo " "
8556 rp='Are you getting the hosts file via yellow pages?'
8557 . ./myread
8558 case "$ans" in
8559 y*) hostcat='ypcat hosts';;
8560 *) hostcat='cat /etc/hosts';;
8561 esac
8562 ;;
8563 esac
8564fi
8565case "$hostcat" in
8566'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8567esac
8568case "$groupcat" in
8569'') test -f /etc/group && groupcat='cat /etc/group';;
8570esac
8571case "$passcat" in
8572'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8573esac
8574
8575: now get the host name
8576echo " "
8577echo "Figuring out host name..." >&4
8578case "$myhostname" in
8579'') cont=true
8580 echo 'Maybe "hostname" will work...'
73614538 8581 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8582 myhostname=$tans
8583 phostname=hostname
8584 cont=''
8585 fi
8586 ;;
8587*) cont='';;
8588esac
8589if $test "$cont"; then
8590 if ./xenix; then
8591 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8592 if tans=`cat /etc/systemid 2>&1` ; then
8593 myhostname=$tans
8594 phostname='cat /etc/systemid'
8595 echo "Whadyaknow. Xenix always was a bit strange..."
8596 cont=''
8597 fi
8598 elif $test -r /etc/systemid; then
8599 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8600 fi
8601fi
8602if $test "$cont"; then
8603 echo 'No, maybe "uuname -l" will work...'
73614538 8604 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8605 myhostname=$tans
8606 phostname='uuname -l'
8607 else
8608 echo 'Strange. Maybe "uname -n" will work...'
73614538 8609 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8610 myhostname=$tans
8611 phostname='uname -n'
8612 else
8613 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8614 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8615 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8616 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8617 else
8618 case "$myhostname" in
8619 '') echo "Does this machine have an identity crisis or something?"
8620 phostname='';;
8621 *)
8622 echo "Well, you said $myhostname before..."
8623 phostname='echo $myhostname';;
8624 esac
8625 fi
8626 fi
8627 fi
8628fi
52a549d0
JH
8629case "$myhostname" in
8630'') myhostname=noname ;;
8631esac
b4eb6b3d
JH
8632: you do not want to know about this
8633set $myhostname
8634myhostname=$1
8635
8636: verify guess
8637if $test "$myhostname" ; then
8638 dflt=y
8639 rp='Your host name appears to be "'$myhostname'".'" Right?"
8640 . ./myread
8641 case "$ans" in
8642 y*) ;;
8643 *) myhostname='';;
8644 esac
8645fi
8646
8647: bad guess or no guess
8648while $test "X$myhostname" = X ; do
8649 dflt=''
8650 rp="Please type the (one word) name of your host:"
8651 . ./myread
8652 myhostname="$ans"
8653done
8654
8655: translate upper to lower if necessary
8656case "$myhostname" in
8657*[A-Z]*)
8658 echo "(Normalizing case in your host name)"
8659 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8660 ;;
8661esac
8662
8663case "$myhostname" in
8664*.*)
8665 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8666 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8667 echo "(Trimming domain name from host name--host name is now $myhostname)"
8668 ;;
8669*) case "$mydomain" in
8670 '')
8671 {
8672 test "X$hostcat" = "Xypcat hosts" &&
8673 ypmatch "$myhostname" hosts 2>/dev/null |\
8674 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8675 $test -s hosts
8676 } || {
8677 test "X$hostcat" != "X" &&
8678 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8679 /[ ]$myhostname[ . ]/p" > hosts
8680 }
8681 tmp_re="[ . ]"
f08cbdd1
PP
8682 if $test -f hosts; then
8683 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8684 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8685 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8686 hosts | $sort | $uniq | \
8687 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8688 case `$echo X$dflt` in
8689 X*\ *) echo "(Several hosts in the database matched hostname)"
8690 dflt=.
8691 ;;
8692 X.) echo "(You do not have fully-qualified names in the hosts database)"
8693 ;;
8694 esac
8695 else
8696 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8697 dflt=.
f08cbdd1 8698 fi
b4eb6b3d
JH
8699 case "$dflt" in
8700 .)
8701 tans=`./loc resolv.conf X /etc /usr/etc`
8702 if $test -f "$tans"; then
8703 echo "(Attempting domain name extraction from $tans)"
8704 dflt=.`$sed -n -e 's/ / /g' \
8705 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
1d40d392 8706 -e 1q 2>/dev/null`
b4eb6b3d
JH
8707 case "$dflt" in
8708 .) dflt=.`$sed -n -e 's/ / /g' \
8709 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
1d40d392 8710 -e 1q 2>/dev/null`
b4eb6b3d
JH
8711 ;;
8712 esac
8713 fi
8714 ;;
8715 esac
8716 case "$dflt" in
8717 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8718 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8719 case "$dflt" in
8720 '') dflt='.';;
8721 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8722 esac
8723 ;;
8724 esac
59c9e5d6
PP
8725 case "$dflt$osname" in
8726 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8727 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8728 ;;
8729 esac
b4eb6b3d
JH
8730 case "$dflt" in
8731 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8732 dflt='.nonet'
b4eb6b3d
JH
8733 ;;
8734 esac
8735 $rm -f hosts
8736 ;;
8737 *) dflt="$mydomain";;
8738 esac;;
8739esac
8740echo " "
8741rp="What is your domain name?"
8742. ./myread
8743tans="$ans"
8744case "$ans" in
8745'') ;;
8746.*) ;;
8747*) tans=".$tans";;
8748esac
8749mydomain="$tans"
8750
8751: translate upper to lower if necessary
8752case "$mydomain" in
8753*[A-Z]*)
8754 echo "(Normalizing case in your domain name)"
8755 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8756 ;;
8757esac
8758
8759: a little sanity check here
8760case "$phostname" in
8761'') ;;
8762*)
8763 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8764 $myhostname$mydomain|$myhostname) ;;
8765 *)
8766 case "$phostname" in
8767 sed*)
8768 echo "(That doesn't agree with your whoami.h file, by the way.)"
8769 ;;
8770 *)
8771 echo "(That doesn't agree with your $phostname command, by the way.)"
8772 ;;
8773 esac
8774 ;;
8775 esac
8776 ;;
8777esac
8778
776a38e3 8779: determine the e-mail address of the user who is running us
b4eb6b3d
JH
8780$cat <<EOM
8781
8782I need to get your e-mail address in Internet format if possible, i.e.
8783something like user@host.domain. Please answer accurately since I have
8784no easy means to double check it. The default value provided below
8785is most probably close to reality but may not be valid from outside
8786your organization...
8787
8788EOM
8789cont=x
8790while test "$cont"; do
8791 case "$cf_email" in
8792 '') dflt="$cf_by@$myhostname$mydomain";;
8793 *) dflt="$cf_email";;
8794 esac
8795 rp='What is your e-mail address?'
8796 . ./myread
8797 cf_email="$ans"
8798 case "$cf_email" in
8799 *@*.*) cont='' ;;
8800 *)
8801 rp='Address does not look like an Internet one. Use it anyway?'
8802 case "$fastread" in
8803 yes) dflt=y ;;
8804 *) dflt=n ;;
8805 esac
8806 . ./myread
8807 case "$ans" in
8808 y*) cont='' ;;
8809 *) echo " " ;;
8810 esac
8811 ;;
8812 esac
8813done
8814
34f1896b 8815: Ask e-mail of administrator
b4eb6b3d
JH
8816$cat <<EOM
8817
8818If you or somebody else will be maintaining perl at your site, please
8819fill in the correct e-mail address here so that they may be contacted
8820if necessary. Currently, the "perlbug" program included with perl
8821will send mail to this address in addition to perlbug@perl.org. You may
8822enter "none" for no administrator.
8823
8824EOM
8825case "$perladmin" in
8826'') dflt="$cf_email";;
8827*) dflt="$perladmin";;
8828esac
8829rp='Perl administrator e-mail address'
8830. ./myread
8831perladmin="$ans"
8832
674912d7
RB
8833: determine whether to only install version-specific parts.
8834echo " "
8835$cat <<EOM
8836Do you want to install only the version-specific parts of the perl
8837distribution? Usually you do *not* want to do this.
8838EOM
8839case "$versiononly" in
8840"$define"|[Yy]*|true) dflt='y' ;;
8841*) dflt='n';
8842esac
8843rp="Do you want to install only the version-specific parts of perl?"
8844. ./myread
8845case "$ans" in
8846[yY]*) val="$define";;
8847*) val="$undef" ;;
8848esac
8849set versiononly
8850eval $setvar
8851
ad493445
MB
8852case "$versiononly" in
8853"$define") inc_version_list=''
8854 inc_version_list_init=0
8855 ;;
8856esac
8857
b4eb6b3d 8858: figure out how to guarantee perl startup
d0e36aa9 8859: XXX Note that this currently takes advantage of the bug that binexp ignores
a2d23ec2
MB
8860: the Configure -Dinstallprefix setting, which in turn means that under
8861: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8862case "$startperl" in
8863'')
8864 case "$sharpbang" in
8865 *!)
8866 $cat <<EOH
8867
8868I can use the #! construct to start perl on your system. This will
8869make startup of perl scripts faster, but may cause problems if you
8870want to share those scripts and perl is not in a standard place
a2d23ec2
MB
8871($initialinstalllocation/perl) on all your platforms. The alternative
8872is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8873
8874EOH
674912d7 8875 case "$versiononly" in
a2d23ec2 8876 "$define") dflt="$initialinstalllocation/perl$version";;
d0e36aa9 8877 *) dflt="$initialinstalllocation/perl";;
674912d7 8878 esac
b4eb6b3d
JH
8879 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8880 . ./myread
8881 case "$ans" in
8882 none) startperl=": # use perl";;
8883 *) startperl="#!$ans"
8884 if $test 30 -lt `echo "$ans" | wc -c`; then
8885 $cat >&4 <<EOM
8886
8887WARNING: Some systems limit the #! command to 32 characters.
8888If you experience difficulty running Perl scripts with #!, try
8889installing Perl in a directory with a shorter pathname.
8890
8891EOM
8892 fi ;;
8893 esac
8894 ;;
8895 *) startperl=": # use perl"
8896 ;;
8897 esac
8898 ;;
8899esac
8900echo "I'll use $startperl to start perl scripts."
8901
8902: figure best path for perl in scripts
8903case "$perlpath" in
8904'')
5e20a8ca 8905 case "$versiononly" in
d0e36aa9
NC
8906 "$define") perlpath="$initialinstalllocation/perl$version";;
8907 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8908 esac
b4eb6b3d
JH
8909 case "$startperl" in
8910 *!*) ;;
8911 *)
8912 $cat <<EOH
8913
8914I will use the "eval 'exec'" idiom to start Perl on your system.
8915I can use the full path of your Perl binary for this purpose, but
8916doing so may cause problems if you want to share those scripts and
d0e36aa9 8917Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
8918
8919EOH
d0e36aa9 8920 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
8921 rp="What path shall I use in \"eval 'exec'\"?"
8922 . ./myread
8923 perlpath="$ans"
8924 ;;
8925 esac
8926 ;;
8927esac
8928case "$startperl" in
8929*!*) ;;
8930*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8931esac
8932
8933: determine where public executable scripts go
8934set scriptdir scriptdir
8935eval $prefixit
8936case "$scriptdir" in
8937'')
8938 dflt="$bin"
8939 : guess some guesses
8940 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8941 $test -d /usr/share/bin && dflt=/usr/share/bin
8942 $test -d /usr/local/script && dflt=/usr/local/script
8943 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8944 $test -d $prefixexp/script && dflt=$prefixexp/script
8945 set dflt
8946 eval $prefixup
8947 ;;
8948*) dflt="$scriptdir"
8949 ;;
8950esac
8951$cat <<EOM
f3f1a2d8 8952
b4eb6b3d
JH
8953Some installations have a separate directory just for executable scripts so
8954that they can mount it across multiple architectures but keep the scripts in
8955one spot. You might, for example, have a subdirectory of /usr/share for this.
8956Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8957
b4eb6b3d
JH
8958EOM
8959fn=d~
8960rp='Where do you keep publicly executable scripts?'
8961. ./getfile
8962if $test "X$ansexp" != "X$scriptdirexp"; then
8963 installscript=''
8964fi
f3f1a2d8 8965installscriptdir=''
79522dd2
NC
8966prefixvar=scriptdir
8967. ./setprefixvar
8968: A little fix up for an irregularly named variable.
8969installscript="$installscriptdir"
8970
b4eb6b3d
JH
8971: determine where add-on public executables go
8972case "$sitebin" in
8973'') dflt=$siteprefix/bin ;;
8974*) dflt=$sitebin ;;
8975esac
8976fn=d~
8977rp='Pathname where the add-on public executables should be installed?'
8978. ./getfile
79522dd2
NC
8979prefixvar=sitebin
8980. ./setprefixvar
b4eb6b3d 8981
6e1038e0 8982: determine where add-on html pages go
8d2cbf27 8983: There is no standard location, so try to copy the previously-selected
6e1038e0 8984: directory structure for the core html pages.
8d2cbf27
JH
8985case "$sitehtml1dir" in
8986'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8987*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8988esac
8989case "$dflt" in
8990''|' ') dflt=none ;;
8991esac
8992fn=dn+~
8993rp='Pathname where the site-specific html pages should be installed?'
8994. ./getfile
79522dd2
NC
8995prefixvar=sitehtml1dir
8996. ./setprefixvar
6e1038e0
MB
8997
8998: determine where add-on library html pages go
8999: There is no standard location, so try to copy the previously-selected
9000: directory structure for the core html pages.
8d2cbf27
JH
9001case "$sitehtml3dir" in
9002'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9003*) dflt=$sitehtml3dir ;;
6e1038e0
MB
9004esac
9005case "$dflt" in
9006''|' ') dflt=none ;;
9007esac
9008fn=dn+~
9009rp='Pathname where the site-specific library html pages should be installed?'
9010. ./getfile
79522dd2
NC
9011prefixvar=sitehtml3dir
9012. ./setprefixvar
6e1038e0
MB
9013
9014: determine where add-on manual pages go
91e123a8
JH
9015case "$siteman1dir" in
9016'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9017*) dflt=$siteman1dir ;;
6e1038e0 9018esac
257059b5
JH
9019case "$dflt" in
9020''|' ') dflt=none ;;
9021esac
6e1038e0
MB
9022fn=dn+~
9023rp='Pathname where the site-specific manual pages should be installed?'
9024. ./getfile
79522dd2
NC
9025prefixvar=siteman1dir
9026. ./setprefixvar
6e1038e0
MB
9027
9028: determine where add-on library man pages go
91e123a8
JH
9029case "$siteman3dir" in
9030'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9031*) dflt=$siteman3dir ;;
6e1038e0 9032esac
257059b5
JH
9033case "$dflt" in
9034''|' ') dflt=none ;;
9035esac
6e1038e0
MB
9036fn=dn+~
9037rp='Pathname where the site-specific library manual pages should be installed?'
9038. ./getfile
79522dd2
NC
9039prefixvar=siteman3dir
9040. ./setprefixvar
6e1038e0
MB
9041
9042: determine where add-on public executable scripts go
9043case "$sitescript" in
9044'') dflt=$siteprefix/script
9045 $test -d $dflt || dflt=$sitebin ;;
9046*) dflt="$sitescript" ;;
9047esac
9048fn=d~+
9049rp='Pathname where add-on public executable scripts should be installed?'
9050. ./getfile
79522dd2
NC
9051prefixvar=sitescript
9052. ./setprefixvar
6e1038e0 9053
34f1896b 9054: Check if faststdio is requested and available
15b61c98
JH
9055case "$usefaststdio" in
9056$define|true|[yY]*|'')
9057 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9058 case "$xversion" in
9059 [68]) dflt='y' ;;
9060 *) dflt='n' ;;
9061 esac
9062 ;;
9063*) dflt='n';;
9064esac
9065cat <<EOM
9066
9067Perl can be built to use 'fast stdio', which means using the stdio
9068library but also directly manipulating the stdio buffers to enable
9069faster I/O. Using stdio is better for backward compatibility (especially
9070for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9071interface has been preferred instead of stdio.
9072
9073If this doesn't make any sense to you, just accept the default '$dflt'.
9074EOM
9075rp='Use the "fast stdio" if available?'
9076. ./myread
9077case "$ans" in
34f1896b 9078y|Y) val="$define" ;;
15b61c98
JH
9079*) val="$undef" ;;
9080esac
9081set usefaststdio
9082eval $setvar
9083
9084
96056487
JH
9085: define an is-a-typedef? function
9086typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9087case "$inclist" in
9088"") inclist="sys/types.h";;
9089esac;
9090eval "varval=\$$var";
9091case "$varval" in
9092"")
9093 $rm -f temp.c;
9094 for inc in $inclist; do
9095 echo "#include <$inc>" >>temp.c;
9096 done;
9097 echo "#ifdef $type" >> temp.c;
9098 echo "printf(\"We have $type\");" >> temp.c;
9099 echo "#endif" >> temp.c;
9100 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9101 if $contains $type temp.E >/dev/null 2>&1; then
9102 eval "$var=\$type";
9103 else
9104 eval "$var=\$def";
9105 fi;
9106 $rm -f temp.?;;
9107*) eval "$var=\$varval";;
9108esac'
9109
9110: define an is-a-typedef? function that prompts if the type is not available.
9111typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9112case "$inclist" in
9113"") inclist="sys/types.h";;
9114esac;
9115eval "varval=\$$var";
9116case "$varval" in
9117"")
9118 $rm -f temp.c;
9119 for inc in $inclist; do
9120 echo "#include <$inc>" >>temp.c;
9121 done;
9122 echo "#ifdef $type" >> temp.c;
9123 echo "printf(\"We have $type\");" >> temp.c;
9124 echo "#endif" >> temp.c;
9125 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9126 echo " " ;
9127 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9128 if $contains $type temp.E >/dev/null 2>&1; then
9129 echo "$type found." >&4;
9130 eval "$var=\$type";
9131 else
9132 echo "$type NOT found." >&4;
9133 dflt="$def";
9134 . ./myread ;
9135 eval "$var=\$ans";
9136 fi;
9137 $rm -f temp.?;;
9138*) eval "$var=\$varval";;
9139esac'
9140
9141: see what type lseek is declared as in the kernel
9142rp="What is the type used for lseek's offset on this system?"
9143set off_t lseektype long stdio.h sys/types.h
9144eval $typedef_ask
9145
9146echo " "
9147echo "Checking to see how big your file offsets are..." >&4
9148$cat >try.c <<EOCP
9149#include <sys/types.h>
9150#include <stdio.h>
9151int main()
9152{
9153 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9154 return(0);
96056487
JH
9155}
9156EOCP
9157set try
9158if eval $compile_ok; then
9159 lseeksize=`$run ./try`
9160 echo "Your file offsets are $lseeksize bytes long."
9161else
9162 dflt=$longsize
9163 echo " "
9164 echo "(I can't seem to compile the test program. Guessing...)"
9165 rp="What is the size of your file offsets (in bytes)?"
9166 . ./myread
9167 lseeksize="$ans"
9168fi
5b813a60 9169$rm_try
96056487
JH
9170
9171: see what type file positions are declared as in the library
9172rp="What is the type for file position used by fsetpos()?"
9173set fpos_t fpostype long stdio.h sys/types.h
9174eval $typedef_ask
9175
613d6c3e 9176: Check size for Fpos_t
96056487
JH
9177echo " "
9178case "$fpostype" in
9179*_t) zzz="$fpostype" ;;
9180*) zzz="fpos_t" ;;
9181esac
613d6c3e 9182echo "Checking the size of $zzz..." >&4
96056487
JH
9183cat > try.c <<EOCP
9184#include <sys/types.h>
9185#include <stdio.h>
d1daaddf
JH
9186#$i_stdlib I_STDLIB
9187#ifdef I_STDLIB
9188#include <stdlib.h>
9189#endif
96056487
JH
9190int main() {
9191 printf("%d\n", (int)sizeof($fpostype));
9192 exit(0);
9193}
9194EOCP
9195set try
9196if eval $compile_ok; then
9197 yyy=`$run ./try`
9198 case "$yyy" in
9199 '') fpossize=4
9200 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9201 ;;
9202 *) fpossize=$yyy
9203 echo "Your $zzz is $fpossize bytes long."
9204 ;;
9205 esac
9206else
9207 dflt="$longsize"
9208 echo " " >&4
9209 echo "(I can't compile the test program. Guessing...)" >&4
9210 rp="What is the size of your file positions (in bytes)?"
9211 . ./myread
9212 fpossize="$ans"
9213fi
9214
613d6c3e 9215: Check for large file support
96056487
JH
9216# Backward compatibility (uselfs is deprecated).
9217case "$uselfs" in
9218"$define"|true|[yY]*)
9219 cat <<EOM >&4
9220
9221*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9222EOM
9223 uselargefiles="$define"
9224 ;;
5b813a60 9225esac
96056487
JH
9226
9227case "$lseeksize:$fpossize" in
92288:8) cat <<EOM
9229
9230You can have files larger than 2 gigabytes.
9231EOM
9232 val="$define" ;;
9233*) case "$uselargefiles" in
9234 "$undef"|false|[nN]*) dflt='n' ;;
9235 *) dflt='y' ;;
9236 esac
9237 cat <<EOM
9238
9239Perl can be built to understand large files (files larger than 2 gigabytes)
9240on some systems. To do so, Configure can be run with -Duselargefiles.
9241
9242If this doesn't make any sense to you, just accept the default '$dflt'.
9243EOM
9244 rp='Try to understand large files, if available?'
9245 . ./myread
9246 case "$ans" in
9247 y|Y) val="$define" ;;
9248 *) val="$undef" ;;
9249 esac
9250 ;;
9251esac
9252set uselargefiles
9253eval $setvar
96056487
JH
9254: Look for a hint-file generated 'call-back-unit'. If the
9255: user has specified that a large files perl is to be built,
9256: we may need to set or change some other defaults.
9da7673b
MB
9257if $test -f uselargefiles.cbu; then
9258 echo "Your platform has some specific hints regarding large file builds, using them..."
9259 . ./uselargefiles.cbu
9260fi
9261case "$uselargefiles" in
9262"$define")
96056487 9263 if $test -f uselargefiles.cbu; then
96056487
JH
9264 echo " "
9265 echo "Rechecking to see how big your file offsets are..." >&4
9266 $cat >try.c <<EOCP
9267#include <sys/types.h>
9268#include <stdio.h>
9269int main()
9270{
9271 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9272 return(0);
96056487
JH
9273}
9274EOCP
9275 set try
9276 if eval $compile_ok; then
9277 lseeksize=`$run ./try`
9278 $echo "Your file offsets are now $lseeksize bytes long."
9279 else
9280 dflt="$lseeksize"
9281 echo " "
9282 echo "(I can't seem to compile the test program. Guessing...)"
9283 rp="What is the size of your file offsets (in bytes)?"
9284 . ./myread
9285 lseeksize="$ans"
9286 fi
9287 case "$fpostype" in
9288 *_t) zzz="$fpostype" ;;
9289 *) zzz="fpos_t" ;;
9290 esac
5b813a60 9291 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9292 $cat > try.c <<EOCP
9293#include <sys/types.h>
9294#include <stdio.h>
55954f19
JH
9295#$i_stdlib I_STDLIB
9296#ifdef I_STDLIB
9297#include <stdlib.h>
9298#endif
96056487
JH
9299int main() {
9300 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9301 return(0);
96056487
JH
9302}
9303EOCP
9304 set try
9305 if eval $compile_ok; then
9306 yyy=`$run ./try`
9307 dflt="$lseeksize"
9308 case "$yyy" in
9309 '') echo " "
9310 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9311 ;;
9312 *) fpossize=$yyy
9313 echo " $fpossize bytes." >&4
9314 ;;
9315 esac
9316 else
9317 dflt="$fpossize"
9318 echo " "
9319 echo "(I can't compile the test program. Guessing...)" >&4
9320 rp="What is the size of your file positions (in bytes)?"
9321 . ./myread
9322 fpossize="$ans"
9323 fi
5b813a60 9324 $rm_try
96056487
JH
9325 fi
9326 ;;
9327esac
9328
613d6c3e 9329: Set the vendorbin variables
b4eb6b3d
JH
9330case "$vendorprefix" in
9331'') d_vendorbin="$undef"
9332 vendorbin=''
9333 vendorbinexp=''
9334 ;;
9335*) d_vendorbin="$define"
9336 : determine where vendor-supplied executables go.
9337 case "$vendorbin" in
9338 '') dflt=$vendorprefix/bin ;;
9339 *) dflt="$vendorbin" ;;
9340 esac
9341 fn=d~+
9342 rp='Pathname for the vendor-supplied executables directory?'
9343 . ./getfile
9344 vendorbin="$ans"
9345 vendorbinexp="$ansexp"
9346 ;;
9347esac
a092d240
NC
9348prefixvar=vendorbin
9349. ./installprefix
b4eb6b3d 9350
613d6c3e 9351: Set the vendorhtml1dir variables
6e1038e0 9352case "$vendorprefix" in
8d2cbf27
JH
9353'') vendorhtml1dir=''
9354 vendorhtml1direxp=''
6e1038e0
MB
9355 ;;
9356*) : determine where vendor-supplied html pages go.
9357 : There is no standard location, so try to copy the previously-selected
9358 : directory structure for the core html pages.
9359 : XXX Better default suggestions would be welcome.
8d2cbf27 9360 case "$vendorhtml1dir" in
6e1038e0 9361 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9362 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9363 esac
9364 case "$dflt" in
9365 ''|' ') dflt=none ;;
9366 esac
9367 fn=dn+~
9368 rp='Pathname for the vendor-supplied html pages?'
9369 . ./getfile
8d2cbf27
JH
9370 vendorhtml1dir="$ans"
9371 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9372 ;;
9373esac
9374: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9375$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9376prefixvar=vendorhtml1dir
9377. ./installprefix
6e1038e0 9378
613d6c3e 9379: Set the vendorhtml3dir variables
6e1038e0 9380case "$vendorprefix" in
8d2cbf27
JH
9381'') vendorhtml3dir=''
9382 vendorhtml3direxp=''
6e1038e0
MB
9383 ;;
9384*) : determine where vendor-supplied module html pages go.
9385 : There is no standard location, so try to copy the previously-selected
9386 : directory structure for the core html pages.
9387 : XXX Better default suggestions would be welcome.
8d2cbf27 9388 case "$vendorhtml3dir" in
6e1038e0 9389 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9390 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9391 esac
9392 case "$dflt" in
9393 ''|' ') dflt=none ;;
9394 esac
9395 fn=dn+~
9396 rp='Pathname for the vendor-supplied html pages?'
9397 . ./getfile
8d2cbf27
JH
9398 vendorhtml3dir="$ans"
9399 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9400 ;;
9401esac
9402: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9403$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9404prefixvar=vendorhtml3dir
9405. ./installprefix
6e1038e0 9406
613d6c3e 9407: Set the vendorman1dir variables
6e1038e0 9408case "$vendorprefix" in
91e123a8
JH
9409'') vendorman1dir=''
9410 vendorman1direxp=''
6e1038e0
MB
9411 ;;
9412*) : determine where vendor-supplied manual pages go.
91e123a8 9413 case "$vendorman1dir" in
6e1038e0 9414 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9415 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9416 esac
9417 case "$dflt" in
9418 ''|' ') dflt=none ;;
9419 esac
9420 fn=nd~+
9421 rp='Pathname for the vendor-supplied manual section 1 pages?'
9422 . ./getfile
91e123a8
JH
9423 vendorman1dir="$ans"
9424 vendorman1direxp="$ansexp"
6e1038e0
MB
9425 ;;
9426esac
9427: Use ' ' for none so value is preserved next time through Configure
91e123a8 9428$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9429prefixvar=vendorman1dir
9430. ./installprefix
6e1038e0 9431
613d6c3e 9432: Set the vendorman3dir variables
6e1038e0 9433case "$vendorprefix" in
91e123a8
JH
9434'') vendorman3dir=''
9435 vendorman3direxp=''
6e1038e0
MB
9436 ;;
9437*) : determine where vendor-supplied module manual pages go.
91e123a8 9438 case "$vendorman3dir" in
6e1038e0 9439 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9440 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9441 esac
9442 case "$dflt" in
9443 ''|' ') dflt=none ;;
9444 esac
9445 fn=nd~+
9446 rp='Pathname for the vendor-supplied manual section 3 pages?'
9447 . ./getfile
91e123a8
JH
9448 vendorman3dir="$ans"
9449 vendorman3direxp="$ansexp"
6e1038e0
MB
9450 ;;
9451esac
9452: Use ' ' for none so value is preserved next time through Configure
91e123a8 9453$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9454prefixvar=vendorman3dir
9455. ./installprefix
6e1038e0 9456
613d6c3e 9457: Set the vendorscript variables
6e1038e0
MB
9458case "$vendorprefix" in
9459'') d_vendorscript="$undef"
9460 vendorscript=''
9461 vendorscriptexp=''
9462 ;;
9463*) d_vendorscript="$define"
9464 : determine where vendor-supplied scripts go.
9465 case "$vendorscript" in
9466 '') dflt=$vendorprefix/script
9467 $test -d $dflt || dflt=$vendorbin ;;
9468 *) dflt="$vendorscript" ;;
9469 esac
9470 $cat <<EOM
9471
f3f1a2d8 9472The installation process will create a directory for
6e1038e0
MB
9473vendor-supplied scripts.
9474
9475EOM
9476 fn=d~+
9477 rp='Pathname for the vendor-supplied scripts directory?'
9478 . ./getfile
9479 vendorscript="$ans"
9480 vendorscriptexp="$ansexp"
9481 ;;
9482esac
a092d240
NC
9483prefixvar=vendorscript
9484. ./installprefix
6e1038e0 9485
b4eb6b3d
JH
9486: see if qgcvt exists
9487set qgcvt d_qgcvt
9488eval $inlibc
9489
613d6c3e 9490: Check print/scan long double stuff
89ce900e
JH
9491echo " "
9492
9493if $test X"$d_longdbl" = X"$define"; then
9494
9495echo "Checking how to print long doubles..." >&4
9496
9497if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9498 $cat >try.c <<'EOCP'
9499#include <sys/types.h>
9500#include <stdio.h>
9501int main() {
9502 double d = 123.456;
9503 printf("%.3f\n", d);
9504}
9505EOCP
9506 set try
9507 if eval $compile; then
9508 yyy=`$run ./try`
9509 case "$yyy" in
9510 123.456)
9511 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9512 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9513 echo "We will use %f."
9514 ;;
9515 esac
9516 fi
9517fi
9518
9519if $test X"$sPRIfldbl" = X; then
9520 $cat >try.c <<'EOCP'
9521#include <sys/types.h>
9522#include <stdio.h>
9523int main() {
9524 long double d = 123.456;
9525 printf("%.3Lf\n", d);
9526}
9527EOCP
9528 set try
9529 if eval $compile; then
9530 yyy=`$run ./try`
9531 case "$yyy" in
9532 123.456)
9533 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9534 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9535 echo "We will use %Lf."
9536 ;;
9537 esac
9538 fi
9539fi
9540
9541if $test X"$sPRIfldbl" = X; then
9542 $cat >try.c <<'EOCP'
9543#include <sys/types.h>
9544#include <stdio.h>
9545int main() {
9546 long double d = 123.456;
9547 printf("%.3llf\n", d);
9548}
9549EOCP
9550 set try
9551 if eval $compile; then
9552 yyy=`$run ./try`
9553 case "$yyy" in
9554 123.456)
9555 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9556 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9557 echo "We will use %llf."
9558 ;;
9559 esac
9560 fi
9561fi
9562
9563if $test X"$sPRIfldbl" = X; then
9564 $cat >try.c <<'EOCP'
9565#include <sys/types.h>
9566#include <stdio.h>
9567int main() {
9568 long double d = 123.456;
9569 printf("%.3lf\n", d);
9570}
9571EOCP
9572 set try
9573 if eval $compile; then
9574 yyy=`$run ./try`
9575 case "$yyy" in
9576 123.456)
9577 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9578 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9579 echo "We will use %lf."
9580 ;;
9581 esac
9582 fi
9583fi
9584
9585if $test X"$sPRIfldbl" = X; then
9586 echo "Cannot figure out how to print long doubles." >&4
9587else
9588 sSCNfldbl=$sPRIfldbl # expect consistency
9589fi
9590
5b813a60 9591$rm_try
89ce900e
JH
9592
9593fi # d_longdbl
9594
9595case "$sPRIfldbl" in
5b813a60
MB
9596'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9597 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9598 d_SCNfldbl="$undef";
9599 ;;
5b813a60
MB
9600*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9601 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9602 d_SCNfldbl="$define";
9603 ;;
9604esac
9605
b4eb6b3d 9606: Check how to convert floats to strings.
a5b10d80
YST
9607
9608if test "X$d_Gconvert" = X; then
9609
b4eb6b3d
JH
9610echo " "
9611echo "Checking for an efficient way to convert floats to strings."
9612echo " " > try.c
9613case "$uselongdouble" in
9614"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9615esac
9616case "$d_longdbl" in
9617"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9618esac
9619case "$d_PRIgldbl" in
9620"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9621esac
9622$cat >>try.c <<EOP
9623#ifdef TRY_gconvert
9624#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9625char *myname = "gconvert";
9626#endif
9627#ifdef TRY_gcvt
9628#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9629char *myname = "gcvt";
9630#endif
9631#ifdef TRY_qgcvt
9632#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9633char *myname = "qgcvt";
9634#define DOUBLETYPE long double
9635#endif
9636#ifdef TRY_sprintf
a5b10d80
YST
9637#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9638#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9639#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9640#else
a5b10d80
YST
9641#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9642#endif
9643#else
b4eb6b3d
JH
9644#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9645#endif
9646char *myname = "sprintf";
9647#endif
9648
9649#ifndef DOUBLETYPE
9650#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9651#define DOUBLETYPE long double
9652#else
9653#define DOUBLETYPE double
9654#endif
9655#endif
9656
9657#include <stdio.h>
9658
9659#define I_STDLIB $i_stdlib
9660#ifdef I_STDLIB
9661#include <stdlib.h>
9662#endif
9663
9664int
9665checkit(expect, got)
9666char *expect;
9667char *got;
9668{
9669 if (strcmp(expect, got)) {
9670 printf("%s oddity: Expected %s, got %s\n",
9671 myname, expect, got);
9672 exit(1);
9673 }
9674}
9675
9676int main()
5b813a60
MB
9677{
9678 char buf[64];
b4eb6b3d
JH
9679 buf[63] = '\0';
9680
9681 /* This must be 1st test on (which?) platform */
9682 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9683 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9684 checkit("0.1", buf);
9685
5b813a60 9686 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9687 checkit("0.01", buf);
9688
5b813a60 9689 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9690 checkit("0.001", buf);
9691
5b813a60 9692 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9693 checkit("0.0001", buf);
9694
9695 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9696 if (strlen(buf) > 5)
9697 checkit("9e-005", buf); /* for Microsoft ?? */
9698 else
9699 checkit("9e-05", buf);
9700
5b813a60 9701 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9702 checkit("1", buf);
9703
5b813a60 9704 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9705 checkit("1.1", buf);
9706
5b813a60 9707 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9708 checkit("1.01", buf);
9709
5b813a60 9710 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9711 checkit("1.001", buf);
9712
5b813a60 9713 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9714 checkit("1.0001", buf);
9715
5b813a60 9716 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9717 checkit("1.00001", buf);
9718
5b813a60 9719 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9720 checkit("1.000001", buf);
9721
5b813a60 9722 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9723 checkit("0", buf);
9724
5b813a60 9725 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9726 checkit("-1", buf);
9727
9728 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9729 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9730 checkit("100000", buf);
5b813a60 9731
b4eb6b3d 9732 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9733 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9734 checkit("-100000", buf);
9735
5b813a60 9736 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9737 checkit("123.456", buf);
9738
ab6ca9f4 9739 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9740 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9741 /* 34 should be enough to scare even long double
9742 * places into using the e notation. */
ab6ca9f4 9743 if (strlen(buf) > 5)
94b339ad 9744 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9745 else
94b339ad 9746 checkit("1e+34", buf);
8e2a5ede 9747
d1eb8299
YST
9748 /* For Perl, if you add additional tests here, also add them to
9749 * t/base/num.t for benefit of platforms not using Configure or
9750 * overriding d_Gconvert */
9751
b4eb6b3d
JH
9752 exit(0);
9753}
9754EOP
ab6ca9f4 9755: first add preferred functions to our list
a5b10d80 9756xxx_list=""
ab6ca9f4 9757for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9758 case $xxx_convert in
9759 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9760 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9761 esac
a5b10d80
YST
9762done
9763: then add any others
9764for xxx_convert in gconvert gcvt sprintf; do
9765 case "$xxx_list" in
9766 *$xxx_convert*) ;;
9767 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9768 esac
a5b10d80
YST
9769done
9770
9771case "$d_longdbl$uselongdouble" in
9772"$define$define")
9773 : again, add prefered functions to our list first
9774 xxx_ld_list=""
ab6ca9f4 9775 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9776 case $xxx_convert in
9777 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9778 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9779 esac
9780 done
9781 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9782 for xxx_convert in qgcvt sprintf $xxx_list; do
9783 case "$xxx_ld_list" in
9784 $xxx_convert*|*" $xxx_convert"*) ;;
9785 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9786 esac
9787 done
9788 : if sprintf cannot do long doubles, move it to the end
9789 if test "$d_PRIgldbl" != "$define"; then
9790 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9791 fi
9792 : if no qgcvt, remove it
9793 if test "$d_qgcvt" != "$define"; then
9794 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9795 fi
9796 : use the ld_list
9797 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9798 ;;
9799esac
9800
9801for xxx_convert in $xxx_list; do
9802 echo "Trying $xxx_convert..."
93451a0d 9803 $rm -f try try$_o core
b4eb6b3d
JH
9804 set try -DTRY_$xxx_convert
9805 if eval $compile; then
9806 echo "$xxx_convert() found." >&4
5440bc8e 9807 if $run ./try; then
b4eb6b3d
JH
9808 echo "I'll use $xxx_convert to convert floats into a string." >&4
9809 break;
9810 else
9811 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9812 xxx_convert=''
b4eb6b3d
JH
9813 fi
9814 else
9815 echo "$xxx_convert NOT found." >&4
9816 fi
9817done
ab6ca9f4 9818
a5b10d80
YST
9819if test X$xxx_convert = X; then
9820 echo "*** WHOA THERE!!! ***" >&4
9821 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9822 xxx_convert=sprintf
9823fi
9824
b4eb6b3d
JH
9825case "$xxx_convert" in
9826gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9827gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9828qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9829*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9830 "$define$define$define")
9831 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9832 "$define$define$undef")
9833 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9834 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9835 esac
5b813a60 9836 ;;
b4eb6b3d
JH
9837esac
9838
a5b10d80 9839fi
93451a0d 9840$rm_try
a5b10d80 9841
74cac757
JH
9842: see if _fwalk exists
9843set fwalk d__fwalk
9844eval $inlibc
9845
b4eb6b3d
JH
9846: Initialize h_fcntl
9847h_fcntl=false
9848
9849: Initialize h_sysfile
9850h_sysfile=false
9851
9852: access call always available on UNIX
9853set access d_access
9854eval $inlibc
9855
9856: locate the flags for 'access()'
9857case "$d_access" in
9858"$define")
9859 echo " "
55954f19 9860 $cat >access.c <<EOCP
b4eb6b3d
JH
9861#include <sys/types.h>
9862#ifdef I_FCNTL
9863#include <fcntl.h>
9864#endif
9865#ifdef I_SYS_FILE
9866#include <sys/file.h>
9867#endif
9868#ifdef I_UNISTD
9869#include <unistd.h>
9870#endif
55954f19
JH
9871#$i_stdlib I_STDLIB
9872#ifdef I_STDLIB
9873#include <stdlib.h>
9874#endif
b4eb6b3d
JH
9875int main() {
9876 exit(R_OK);
9877}
9878EOCP
9879 : check sys/file.h first, no particular reason here
9880 if $test `./findhdr sys/file.h` && \
7a282f6d 9881 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9882 h_sysfile=true;
9883 echo "<sys/file.h> defines the *_OK access constants." >&4
9884 elif $test `./findhdr fcntl.h` && \
7a282f6d 9885 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9886 h_fcntl=true;
9887 echo "<fcntl.h> defines the *_OK access constants." >&4
9888 elif $test `./findhdr unistd.h` && \
7a282f6d 9889 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9890 echo "<unistd.h> defines the *_OK access constants." >&4
9891 else
9892 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9893 fi
9894 ;;
9895esac
9896$rm -f access*
9897
9898: see if accessx exists
9899set accessx d_accessx
9900eval $inlibc
9901
89ce900e
JH
9902: see if aintl exists
9903set aintl d_aintl
9904eval $inlibc
9905
b4eb6b3d
JH
9906: see if alarm exists
9907set alarm d_alarm
9908eval $inlibc
9909
a9dade78
JH
9910: see if POSIX threads are available
9911set pthread.h i_pthread
9912eval $inhdr
9913
10bc17b6
JH
9914: define a fucntion to check prototypes
9915$cat > protochk <<EOSH
9916$startsh
9917cc="$cc"
9918optimize="$optimize"
9919ccflags="$ccflags"
9920prototype="$prototype"
9921define="$define"
c944cfb9 9922rm_try="$rm_try"
a9dade78
JH
9923usethreads=$usethreads
9924i_pthread=$i_pthread
9925pthread_h_first=$pthread_h_first
10bc17b6
JH
9926EOSH
9927
9928$cat >> protochk <<'EOSH'
9929
5b813a60 9930$rm_try
10bc17b6
JH
9931foo="$1"
9932shift
9933while test $# -ge 2; do
9934 case "$1" in
9935 $define) echo "#include <$2>" >> try.c ;;
9936 literal) echo "$2" >> try.c ;;
9937 esac
cce6a207
MB
9938 # Extra magic for the benefit of systems that need pthread.h
9939 # to be included early to correctly detect threadsafe functions.
9940 # Such functions must guarantee themselves, though, that the usethreads
9941 # and i_pthread have been defined, before calling protochk.
9942 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9943 echo "#include <pthread.h>" >> try.c
9944 pthread_h_done=yes
9945 fi
10bc17b6
JH
9946 shift 2
9947done
9948test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9949cat >> try.c <<'EOCP'
9950#ifdef CAN_PROTOTYPE
9951#define _(args) args
9952#else
9953#define _(args) ()
9954#endif
9955EOCP
9956echo "$foo" >> try.c
9957echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9958$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9959status=$?
5b813a60 9960$rm_try
10bc17b6
JH
9961exit $status
9962EOSH
9963chmod +x protochk
9964$eunicefix protochk
9965
34f1896b 9966: Define hasproto macro for Configure internal use
89ce900e
JH
9967hasproto='varname=$1; func=$2; shift; shift;
9968while $test $# -ge 2; do
9969 case "$1" in
9970 $define) echo "#include <$2>";;
9971 esac ;
9972 shift 2;
9973done > try.c;
9974$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9975if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9976 echo "$func() prototype found.";
9977 val="$define";
9978else
9979 echo "$func() prototype NOT found.";
9980 val="$undef";
9981fi;
9982set $varname;
9983eval $setvar;
5b813a60 9984$rm_try tryout.c'
89ce900e 9985
10bc17b6
JH
9986: see if sys/types.h has to be included
9987set sys/types.h i_systypes
9988eval $inhdr
9989
9990: see if sys/select.h has to be included
9991set sys/select.h i_sysselct
9992eval $inhdr
9993
34f1896b 9994: Define hasfield macro for Configure internal use
10bc17b6
JH
9995hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9996while $test $# -ge 2; do
9997 case "$1" in
9998 $define) echo "#include <$2>";;
9999 esac ;
10000 shift 2;
10001done > try.c;
10002echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10003set try;
10004if eval $compile; then
10005 val="$define";
10006else
10007 val="$undef";
10008fi;
10009set $varname;
10010eval $setvar;
5b813a60 10011$rm_try'
10bc17b6
JH
10012
10013: see if we should include time.h, sys/time.h, or both
10014echo " "
10015if test "X$timeincl" = X; then
10016 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10017 $echo $n "I'm now running the test program...$c"
55954f19 10018 $cat >try.c <<EOCP
10bc17b6
JH
10019#include <sys/types.h>
10020#ifdef I_TIME
10021#include <time.h>
10022#endif
10023#ifdef I_SYSTIME
10024#ifdef SYSTIMEKERNEL
10025#define KERNEL
10026#endif
10027#include <sys/time.h>
10028#endif
10029#ifdef I_SYSSELECT
10030#include <sys/select.h>
10031#endif
55954f19
JH
10032#$i_stdlib I_STDLIB
10033#ifdef I_STDLIB
10034#include <stdlib.h>
10035#endif
10bc17b6
JH
10036int main()
10037{
10038 struct tm foo;
10039#ifdef S_TIMEVAL
10040 struct timeval bar;
10041#endif
10042#ifdef S_TIMEZONE
10043 struct timezone tzp;
10044#endif
10045 if (foo.tm_sec == foo.tm_sec)
10046 exit(0);
10047#ifdef S_TIMEVAL
10048 if (bar.tv_sec == bar.tv_sec)
10049 exit(0);
10050#endif
10051 exit(1);
10052}
10053EOCP
10054 flags=''
10055 for s_timezone in '-DS_TIMEZONE' ''; do
10056 sysselect=''
10057 for s_timeval in '-DS_TIMEVAL' ''; do
10058 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10059 for i_time in '' '-DI_TIME'; do
10060 for i_systime in '-DI_SYSTIME' ''; do
10061 case "$flags" in
10062 '') $echo $n ".$c"
10063 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10064 if eval $compile; then
10065 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10066 shift
10067 flags="$*"
10068 echo " "
10069 $echo $n "Succeeded with $flags$c"
10070 fi
10071 ;;
10072 esac
10073 done
10074 done
10075 done
10076 done
10077 done
10078 timeincl=''
10079 echo " "
10080 case "$flags" in
10081 *SYSTIMEKERNEL*) i_systimek="$define"
10082 timeincl=`./findhdr sys/time.h`
10083 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10084 *) i_systimek="$undef";;
10085 esac
10086 case "$flags" in
10087 *I_TIME*) i_time="$define"
10088 timeincl=`./findhdr time.h`" $timeincl"
10089 echo "We'll include <time.h>." >&4;;
10090 *) i_time="$undef";;
10091 esac
10092 case "$flags" in
10093 *I_SYSTIME*) i_systime="$define"
10094 timeincl=`./findhdr sys/time.h`" $timeincl"
10095 echo "We'll include <sys/time.h>." >&4;;
10096 *) i_systime="$undef";;
10097 esac
5b813a60 10098 $rm_try
10bc17b6
JH
10099fi
10100: see if struct tm knows about tm_zone
10101case "$i_systime$i_time" in
5b813a60 10102*$define*)
10bc17b6
JH
10103 echo " "
10104 echo "Checking to see if your struct tm has tm_zone field..." >&4
10105 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10106 eval $hasfield
10107 ;;
10108*) val="$undef"
10109 set d_tm_tm_zone
10110 eval $setvar
10111 ;;
10112esac
10113case "$d_tm_tm_zone" in
10114"$define") echo "Yes, it does." ;;
10115*) echo "No, it doesn't." ;;
10116esac
10117: see if struct tm knows about tm_gmtoff
10118case "$i_systime$i_time" in
5b813a60 10119*$define*)
10bc17b6
JH
10120 echo " "
10121 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10122 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10123 eval $hasfield
10124 ;;
10125*) val="$undef"
10126 set d_tm_tm_gmtoff
10127 eval $setvar
10128 ;;
10129esac
10130case "$d_tm_tm_gmtoff" in
10131"$define") echo "Yes, it does." ;;
10132*) echo "No, it doesn't." ;;
10133esac
10134
10135: see if asctime_r exists
10136set asctime_r d_asctime_r
10137eval $inlibc
10138case "$d_asctime_r" in
10139"$define")
d63eadf0 10140 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10141 case "$d_asctime_r_proto:$usethreads" in
10142 ":define") d_asctime_r_proto=define
a48ec845
JH
10143 set d_asctime_r_proto asctime_r $hdrs
10144 eval $hasproto ;;
10145 *) ;;
10146 esac
10147 case "$d_asctime_r_proto" in
10148 define)
10bc17b6
JH
10149 case "$asctime_r_proto" in
10150 ''|0) try='char* asctime_r(const struct tm*, char*);'
10151 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10152 esac
10153 case "$asctime_r_proto" in
10154 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10155 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10156 esac
10157 case "$asctime_r_proto" in
10158 ''|0) try='int asctime_r(const struct tm*, char*);'
10159 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10160 esac
10161 case "$asctime_r_proto" in
10162 ''|0) try='int asctime_r(const struct tm*, char*, int);'
10163 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10164 esac
10165 case "$asctime_r_proto" in
90e831dc 10166 ''|0) d_asctime_r=undef
10bc17b6 10167 asctime_r_proto=0
a48ec845 10168 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10169 * ) case "$asctime_r_proto" in
10170 REENTRANT_PROTO*) ;;
10171 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10172 esac
10173 echo "Prototype: $try" ;;
10174 esac
10175 ;;
c18e646a
JH
10176 *) case "$usethreads" in
10177 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10178 esac
90e831dc
SB
10179 d_asctime_r=undef
10180 asctime_r_proto=0
c18e646a 10181 ;;
a48ec845
JH
10182 esac
10183 ;;
10bc17b6
JH
10184*) asctime_r_proto=0
10185 ;;
10186esac
10187
b4eb6b3d
JH
10188: see if atolf exists
10189set atolf d_atolf
10190eval $inlibc
10191
10192: see if atoll exists
10193set atoll d_atoll
10194eval $inlibc
10195
0dbb1585
AL
10196: Look for GCC-style attribute format
10197case "$d_attribute_format" in
bde30f85 10198'')
b4eb6b3d 10199echo " "
0dbb1585 10200echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10201$cat >attrib.c <<'EOCP'
10202#include <stdio.h>
0dbb1585 10203void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10204EOCP
10205if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10206 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10207 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10208 val="$undef"
10209 else
0dbb1585 10210 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10211 val="$define"
10212 fi
10213else
10214 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10215 val="$undef"
10216fi
bde30f85 10217;;
0dbb1585 10218*) val="$d_attribute_format" ;;
bde30f85 10219esac
0dbb1585
AL
10220set d_attribute_format
10221eval $setvar
10222$rm -f attrib*
10223
dcb594bc
MB
10224: Look for GCC-style attribute format with null format allowed
10225case "$d_printf_format_null" in
10226'') case "$d_attribute_format" in
10227 $define)
10228 echo " "
10229 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10230$cat >attrib.c <<EOCP
10231#include <stdio.h>
10232#$i_stdlib I_STDLIB
10233#ifdef I_STDLIB
10234#include <stdlib.h>
10235#endif
10236int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10237int null_printf (char* pat,...) { return (int)pat; }
10238int main () { exit(null_printf(NULL)); }
10239EOCP
10240 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10241 : run the executable in case it produces a run-time warning
10242 if $run ./attrib >>attrib.out 2>&1; then
10243 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10244 echo "Your C compiler doesn't allow __printf__ format to be null."
10245 val="$undef"
10246 else
10247 echo "Your C compiler allows __printf__ format to be null."
10248 val="$define"
10249 fi
10250 else
10251 echo "Your C compiler executable failed with __printf__ format null."
10252 val="$undef"
10253 fi
10254 else
10255 echo "Your C compiler fails with __printf__ format null."
10256 val="$undef"
10257 fi
10258 ;;
10259 *) val="$undef" ;;
10260 esac
10261;;
10262*) val="$d_printf_format_null" ;;
10263esac
10264set d_printf_format_null
10265eval $setvar
10266$rm -f attrib*
10267
0dbb1585
AL
10268: Look for GCC-style attribute malloc
10269case "$d_attribute_malloc" in
10270'')
10271echo " "
10272echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10273$cat >attrib.c <<'EOCP'
10274#include <stdio.h>
10275char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10276EOCP
10277if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10278 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10279 echo "Your C compiler doesn't support __attribute__((malloc))."
10280 val="$undef"
10281 else
10282 echo "Your C compiler supports __attribute__((malloc))."
10283 val="$define"
10284 fi
10285else
10286 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10287 val="$undef"
10288fi
10289;;
10290*) val="$d_attribute_malloc" ;;
10291esac
10292set d_attribute_malloc
10293eval $setvar
10294$rm -f attrib*
10295
10296: Look for GCC-style attribute nonnull
10297case "$d_attribute_nonnull" in
10298'')
10299echo " "
10300echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10301$cat >attrib.c <<'EOCP'
10302#include <stdio.h>
10303void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10304EOCP
10305if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10306 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10307 echo "Your C compiler doesn't support __attribute__((nonnull))."
10308 val="$undef"
10309 else
10310 echo "Your C compiler supports __attribute__((nonnull))."
10311 val="$define"
10312 fi
10313else
10314 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10315 val="$undef"
10316fi
10317;;
10318*) val="$d_attribute_nonnull" ;;
10319esac
10320set d_attribute_nonnull
10321eval $setvar
10322$rm -f attrib*
10323
10324: Look for GCC-style attribute noreturn
10325case "$d_attribute_noreturn" in
10326'')
10327echo " "
10328echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10329$cat >attrib.c <<'EOCP'
10330#include <stdio.h>
10331void fall_over_dead( void ) __attribute__((noreturn));
10332EOCP
10333if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10334 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10335 echo "Your C compiler doesn't support __attribute__((noreturn))."
10336 val="$undef"
10337 else
10338 echo "Your C compiler supports __attribute__((noreturn))."
10339 val="$define"
10340 fi
10341else
10342 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10343 val="$undef"
10344fi
10345;;
10346*) val="$d_attribute_noreturn" ;;
10347esac
10348set d_attribute_noreturn
10349eval $setvar
10350$rm -f attrib*
10351
10352: Look for GCC-style attribute pure
10353case "$d_attribute_pure" in
10354'')
10355echo " "
10356echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10357$cat >attrib.c <<'EOCP'
10358#include <stdio.h>
10359int square( int n ) __attribute__((pure));
10360EOCP
10361if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10362 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10363 echo "Your C compiler doesn't support __attribute__((pure))."
10364 val="$undef"
10365 else
10366 echo "Your C compiler supports __attribute__((pure))."
10367 val="$define"
10368 fi
10369else
10370 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10371 val="$undef"
10372fi
10373;;
10374*) val="$d_attribute_pure" ;;
10375esac
10376set d_attribute_pure
10377eval $setvar
10378$rm -f attrib*
10379
10380: Look for GCC-style attribute unused
10381case "$d_attribute_unused" in
10382'')
10383echo " "
10384echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10385$cat >attrib.c <<'EOCP'
10386#include <stdio.h>
10387int do_something( int dummy __attribute__((unused)), int n );
10388EOCP
10389if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10390 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10391 echo "Your C compiler doesn't support __attribute__((unused))."
10392 val="$undef"
10393 else
10394 echo "Your C compiler supports __attribute__((unused))."
10395 val="$define"
10396 fi
10397else
10398 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10399 val="$undef"
10400fi
10401;;
10402*) val="$d_attribute_unused" ;;
10403esac
10404set d_attribute_unused
10405eval $setvar
10406$rm -f attrib*
10407
10408: Look for GCC-style attribute warn_unused_result
10409case "$d_attribute_warn_unused_result" in
10410'')
10411echo " "
10412echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10413$cat >attrib.c <<'EOCP'
10414#include <stdio.h>
10415int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10416EOCP
10417if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10418 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10419 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10420 val="$undef"
10421 else
10422 echo "Your C compiler supports __attribute__((warn_unused_result))."
10423 val="$define"
10424 fi
10425else
10426 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10427 val="$undef"
10428fi
10429;;
10430*) val="$d_attribute_warn_unused_result" ;;
10431esac
10432set d_attribute_warn_unused_result
b4eb6b3d
JH
10433eval $setvar
10434$rm -f attrib*
10435
10436: see if bcmp exists
10437set bcmp d_bcmp
10438eval $inlibc
10439
10440: see if bcopy exists
10441set bcopy d_bcopy
10442eval $inlibc
10443
b4eb6b3d
JH
10444: see if getpgrp exists
10445set getpgrp d_getpgrp
10446eval $inlibc
10447
10448case "$d_getpgrp" in
10449"$define")
10450 echo " "
10451 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10452 $cat >try.c <<EOP
b4eb6b3d
JH
10453#$i_unistd I_UNISTD
10454#include <sys/types.h>
10455#ifdef I_UNISTD
10456# include <unistd.h>
10457#endif
55954f19
JH
10458#$i_stdlib I_STDLIB
10459#ifdef I_STDLIB
10460#include <stdlib.h>
10461#endif
b4eb6b3d
JH
10462int main()
10463{
10464 if (getuid() == 0) {
10465 printf("(I see you are running Configure as super-user...)\n");
10466 setuid(1);
10467 }
10468#ifdef TRY_BSD_PGRP
10469 if (getpgrp(1) == 0)
10470 exit(0);
10471#else
10472 if (getpgrp() > 0)
10473 exit(0);
10474#endif
10475 exit(1);
10476}
10477EOP
5440bc8e 10478 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10479 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10480 val="$define"
5440bc8e 10481 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10482 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10483 val="$undef"
10484 else
10485 echo "I can't seem to compile and run the test program."
10486 if ./usg; then
10487 xxx="a USG one, i.e. you use getpgrp()."
10488 else
10489 # SVR4 systems can appear rather BSD-ish.
10490 case "$i_unistd" in
10491 $undef)
10492 xxx="a BSD one, i.e. you use getpgrp(pid)."
10493 val="$define"
10494 ;;
10495 $define)
10496 xxx="probably a USG one, i.e. you use getpgrp()."
10497 val="$undef"
10498 ;;
10499 esac
10500 fi
10501 echo "Assuming your getpgrp is $xxx" >&4
10502 fi
10503 ;;
10504*) val="$undef";;
10505esac
10506set d_bsdgetpgrp
10507eval $setvar
5b813a60 10508$rm_try
b4eb6b3d
JH
10509
10510: see if setpgrp exists
10511set setpgrp d_setpgrp
10512eval $inlibc
10513
10514case "$d_setpgrp" in
10515"$define")
10516 echo " "
10517 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10518 $cat >try.c <<EOP
b4eb6b3d
JH
10519#$i_unistd I_UNISTD
10520#include <sys/types.h>
10521#ifdef I_UNISTD
10522# include <unistd.h>
10523#endif
55954f19
JH
10524#$i_stdlib I_STDLIB
10525#ifdef I_STDLIB
10526#include <stdlib.h>
10527#endif
b4eb6b3d
JH
10528int main()
10529{
10530 if (getuid() == 0) {
10531 printf("(I see you are running Configure as super-user...)\n");
10532 setuid(1);
10533 }
10534#ifdef TRY_BSD_PGRP
10535 if (-1 == setpgrp(1, 1))
10536 exit(0);
10537#else
10538 if (setpgrp() != -1)
10539 exit(0);
10540#endif
10541 exit(1);
10542}
10543EOP
5440bc8e 10544 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10545 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10546 val="$define"
5440bc8e 10547 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10548 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10549 val="$undef"
10550 else
10551 echo "(I can't seem to compile and run the test program.)"
10552 if ./usg; then
10553 xxx="a USG one, i.e. you use setpgrp()."
10554 else
10555 # SVR4 systems can appear rather BSD-ish.
10556 case "$i_unistd" in
10557 $undef)
10558 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10559 val="$define"
10560 ;;
10561 $define)
10562 xxx="probably a USG one, i.e. you use setpgrp()."
10563 val="$undef"
10564 ;;
10565 esac
10566 fi
10567 echo "Assuming your setpgrp is $xxx" >&4
10568 fi
10569 ;;
10570*) val="$undef";;
10571esac
10572set d_bsdsetpgrp
10573eval $setvar
5b813a60
MB
10574$rm_try
10575
635aebb7
AL
10576: Look for GCC-style __builtin_choose_expr
10577case "$d_builtin_choose_expr" in
10578'')
10579 echo " "
10580 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10581 $cat >try.c <<'EOCP'
10582#include <assert.h>
10583#include <stdlib.h>
10584#include <stdio.h>
10585
10586#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10587
10588int main(void) {
10589 assert( SYRINX(1) == 2112 );
10590 assert( SYRINX(1) != 5150 );
10591 assert( SYRINX(0) == 5150 );
10592 assert( SYRINX(0) != 2112 );
10593 puts( "All good!" );
10594 exit(0);
10595}
10596
10597EOCP
10598 set try
70ceb34a 10599 if eval $compile && $run ./try; then
635aebb7
AL
10600 echo "Your C compiler supports __builtin_choose_expr."
10601 val="$define"
10602 else
10603 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10604 val="$undef"
10605 fi
10606;;
10607*) val="$d_builtin_choose_expr" ;;
10608esac
10609
10610set d_builtin_choose_expr
10611eval $setvar
5b813a60 10612$rm_try
635aebb7
AL
10613
10614: Look for GCC-style __builtin_expect
10615case "$d_builtin_expect" in
10616'')
10617 echo " "
10618 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
70ceb34a 10619 $cat >try.c <<'EOCP'
635aebb7
AL
10620int main(void) {
10621 int n = 50;
10622 if ( __builtin_expect(n, 0) ) n = 1;
70ceb34a
NC
10623 /* Remember shell exit code truth is 0, C truth is non-zero */
10624 return !(n == 1);
635aebb7
AL
10625}
10626EOCP
10627 set try
70ceb34a
NC
10628 if eval $compile && $run ./try; then
10629 echo "Your C compiler supports __builtin_expect."
635aebb7
AL
10630 val="$define"
10631 else
70ceb34a 10632 echo "Your C compiler doesn't seem to understand __builtin_expect."
635aebb7
AL
10633 val="$undef"
10634 fi
10635 ;;
10636*) val="$d_builtin_expect" ;;
10637esac
10638
10639set d_builtin_expect
10640eval $setvar
5b813a60 10641$rm_try
635aebb7 10642
b4eb6b3d
JH
10643: see if bzero exists
10644set bzero d_bzero
10645eval $inlibc
10646
a2d23ec2
MB
10647: see if stdarg is available
10648echo " "
10649if $test `./findhdr stdarg.h`; then
10650 echo "<stdarg.h> found." >&4
10651 valstd="$define"
10652else
10653 echo "<stdarg.h> NOT found." >&4
10654 valstd="$undef"
10655fi
10656
10657: see if varags is available
10658echo " "
10659if $test `./findhdr varargs.h`; then
10660 echo "<varargs.h> found." >&4
10661else
10662 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10663fi
10664
10665: set up the varargs testing programs
10666$cat > varargs.c <<EOP
10667#ifdef I_STDARG
10668#include <stdarg.h>
10669#endif
10670#ifdef I_VARARGS
10671#include <varargs.h>
10672#endif
10673
10674#ifdef I_STDARG
10675int f(char *p, ...)
10676#else
10677int f(va_alist)
10678va_dcl
10679#endif
10680{
10681 va_list ap;
10682#ifndef I_STDARG
10683 char *p;
10684#endif
10685#ifdef I_STDARG
10686 va_start(ap,p);
10687#else
10688 va_start(ap);
10689 p = va_arg(ap, char *);
10690#endif
10691 va_end(ap);
4fb7dc7d 10692 return 0;
a2d23ec2
MB
10693}
10694EOP
10695$cat > varargs <<EOP
10696$startsh
10697if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10698 echo "true"
10699else
10700 echo "false"
10701fi
10702$rm -f varargs$_o
10703EOP
10704chmod +x varargs
10705
10706: now check which varargs header should be included
10707echo " "
10708i_varhdr=''
10709case "$valstd" in
10710"$define")
10711 if `./varargs I_STDARG`; then
10712 val='stdarg.h'
10713 elif `./varargs I_VARARGS`; then
10714 val='varargs.h'
10715 fi
10716 ;;
10717*)
10718 if `./varargs I_VARARGS`; then
10719 val='varargs.h'
10720 fi
10721 ;;
10722esac
10723case "$val" in
10724'')
10725echo "I could not find the definition for va_dcl... You have problems..." >&4
10726 val="$undef"; set i_stdarg; eval $setvar
10727 val="$undef"; set i_varargs; eval $setvar
10728 ;;
613d6c3e 10729*)
a2d23ec2
MB
10730 set i_varhdr
10731 eval $setvar
10732 case "$i_varhdr" in
10733 stdarg.h)
10734 val="$define"; set i_stdarg; eval $setvar
10735 val="$undef"; set i_varargs; eval $setvar
10736 ;;
10737 varargs.h)
10738 val="$undef"; set i_stdarg; eval $setvar
10739 val="$define"; set i_varargs; eval $setvar
10740 ;;
10741 esac
10742 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10743esac
10744$rm -f varargs*
10745
10746: see if the Compiler supports C99 variadic macros
10747case "$i_stdarg$i_stdlib" in
10748 "$define$define")
10749 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10750 $cat >try.c <<EOCP
10751#include <stdio.h>
10752#include <stdarg.h>
10753
10754#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10755
10756int main() {
10757 char buf[20];
10758 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10759 puts(buf);
10760 return 0;
10761}
10762EOCP
10763 set try
10764 if eval $compile && $run ./try 2>&1 >/dev/null; then
10765 case "`$run ./try`" in
10766 "123 456 789")
10767 echo "You have C99 variadic macros." >&4
10768 d_c99_variadic_macros="$define"
10769 ;;
10770 *)
10771 echo "You don't have functional C99 variadic macros." >&4
10772 d_c99_variadic_macros="$undef"
10773 ;;
10774 esac
10775 else
10776 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10777 d_c99_variadic_macros="$undef"
10778 fi
5b813a60 10779 $rm_try
a2d23ec2
MB
10780 ;;
10781 *)
10782 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10783 d_c99_variadic_macros="$undef"
10784 ;;
10785esac
10786
b4eb6b3d
JH
10787: see if signal is declared as pointer to function returning int or void
10788echo " "
10789xxx=`./findhdr signal.h`
10790$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10791if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10792 echo "You have int (*signal())() instead of void." >&4
10793 val="$undef"
10794elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10795 echo "You have void (*signal())()." >&4
10796 val="$define"
10797elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10798 echo "You have int (*signal())() instead of void." >&4
10799 val="$undef"
10800elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10801 echo "You have void (*signal())()." >&4
10802 val="$define"
10803else
10804 case "$d_voidsig" in
10805 '')
10806 echo "I can't determine whether signal handler returns void or int..." >&4
10807 dflt=void
10808 rp="What type does your signal handler return?"
10809 . ./myread
10810 case "$ans" in
10811 v*) val="$define";;
10812 *) val="$undef";;
10813 esac;;
10814 "$define")
10815 echo "As you already told me, signal handler returns void." >&4
10816 val="$define"
10817 ;;
10818 *) echo "As you already told me, signal handler returns int." >&4
10819 val="$undef"
10820 ;;
10821 esac
10822fi
10823set d_voidsig
10824eval $setvar
10825case "$d_voidsig" in
10826"$define") signal_t="void";;
10827*) signal_t="int";;
10828esac
10829$rm -f $$.tmp
10830
10831: check for ability to cast large floats to 32-bit ints.
10832echo " "
10833echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10834if $test "$intsize" -ge 4; then
10835 xxx=int
10836else
10837 xxx=long
10838fi
10839$cat >try.c <<EOCP
10840#include <stdio.h>
d1daaddf
JH
10841#$i_stdlib I_STDLIB
10842#ifdef I_STDLIB
10843#include <stdlib.h>
10844#endif
b4eb6b3d
JH
10845#include <sys/types.h>
10846#include <signal.h>
7090f861 10847$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10848int main()
10849{
10850 $xxx i32;
10851 double f, g;
10852 int result = 0;
10853 char str[16];
10854 signal(SIGFPE, blech);
10855
5b813a60 10856 /* Don't let compiler optimize the test away. Store the number
b4eb6b3d
JH
10857 in a writable string for gcc to pass to sscanf under HP/UX.
10858 */
10859 sprintf(str, "2147483647");
10860 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10861 g = 10 * f;
10862 i32 = ($xxx) g;
10863
10864 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10865 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10866 behavior here, which is to preserve the sign and give
10867 back 0x7fff ffff.
10868 */
10869 if (i32 != ($xxx) f)
10870 result |= 1;
10871 exit(result);
10872}
10873EOCP
10874set try
10875if eval $compile_ok; then
5440bc8e 10876 $run ./try
b4eb6b3d
JH
10877 yyy=$?
10878else
10879 echo "(I can't seem to compile the test program--assuming it can't)"
10880 yyy=1
10881fi
10882case "$yyy" in
108830) val="$define"
10884 echo "Yup, it can."
10885 ;;
10886*) val="$undef"
10887 echo "Nope, it can't."
10888 ;;
10889esac
10890set d_casti32
10891eval $setvar
5b813a60 10892$rm_try
b4eb6b3d
JH
10893
10894: check for ability to cast negative floats to unsigned
10895echo " "
10896echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10897$cat >try.c <<EOCP
10898#include <stdio.h>
d1daaddf
JH
10899#$i_stdlib I_STDLIB
10900#ifdef I_STDLIB
10901#include <stdlib.h>
10902#endif
b4eb6b3d
JH
10903#include <sys/types.h>
10904#include <signal.h>
7090f861
JH
10905$signal_t blech(int s) { exit(7); }
10906$signal_t blech_in_list(int s) { exit(4); }
10907unsigned long dummy_long(unsigned long p) { return p; }
10908unsigned int dummy_int(unsigned int p) { return p; }
10909unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
10910int main()
10911{
10912 double f;
10913 unsigned long along;
10914 unsigned int aint;
10915 unsigned short ashort;
10916 int result = 0;
10917 char str[16];
5b813a60 10918
b4eb6b3d
JH
10919 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10920 a direct f = -123. assignment. gcc-2.8.0 reportedly
10921 optimized the whole file away
10922 */
5b813a60 10923 /* Store the number in a writable string for gcc to pass to
b4eb6b3d
JH
10924 sscanf under HP/UX.
10925 */
10926 sprintf(str, "-123");
10927 sscanf(str, "%lf", &f); /* f = -123.; */
10928
10929 signal(SIGFPE, blech);
10930 along = (unsigned long)f;
10931 aint = (unsigned int)f;
10932 ashort = (unsigned short)f;
10933 if (along != (unsigned long)-123)
10934 result |= 1;
10935 if (aint != (unsigned int)-123)
10936 result |= 1;
10937 if (ashort != (unsigned short)-123)
10938 result |= 1;
10939 sprintf(str, "1073741824.");
10940 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10941 f = f + f;
10942 along = 0;
10943 along = (unsigned long)f;
10944 if (along != 0x80000000)
10945 result |= 2;
10946 f -= 1.;
10947 along = 0;
10948 along = (unsigned long)f;
10949 if (along != 0x7fffffff)
10950 result |= 1;
10951 f += 2.;
10952 along = 0;
10953 along = (unsigned long)f;
10954 if (along != 0x80000001)
10955 result |= 2;
10956 if (result)
10957 exit(result);
10958 signal(SIGFPE, blech_in_list);
10959 sprintf(str, "123.");
10960 sscanf(str, "%lf", &f); /* f = 123.; */
10961 along = dummy_long((unsigned long)f);
10962 aint = dummy_int((unsigned int)f);
10963 ashort = dummy_short((unsigned short)f);
10964 if (along != (unsigned long)123)
10965 result |= 4;
10966 if (aint != (unsigned int)123)
10967 result |= 4;
10968 if (ashort != (unsigned short)123)
10969 result |= 4;
10970 exit(result);
10971
10972}
10973EOCP
10974set try
10975if eval $compile_ok; then
5440bc8e 10976 $run ./try
b4eb6b3d
JH
10977 castflags=$?
10978else
10979 echo "(I can't seem to compile the test program--assuming it can't)"
10980 castflags=7
10981fi
10982case "$castflags" in
109830) val="$define"
10984 echo "Yup, it can."
10985 ;;
10986*) val="$undef"
10987 echo "Nope, it can't."
10988 ;;
10989esac
10990set d_castneg
10991eval $setvar
5b813a60 10992$rm_try
b4eb6b3d
JH
10993
10994: see if vprintf exists
10995echo " "
10996if set vprintf val -f d_vprintf; eval $csym; $val; then
10997 echo 'vprintf() found.' >&4
10998 val="$define"
55954f19 10999 $cat >try.c <<EOF
d0bc9cc8
AD
11000#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11001#$i_varargs I_VARARGS
11002
55954f19 11003#$i_stdlib I_STDLIB
d0bc9cc8
AD
11004#$i_unistd I_UNISTD
11005
11006#ifdef I_STDARG
11007# include <stdarg.h>
11008#else /* I_VARARGS */
11009# include <varargs.h>
11010#endif
11011
11012#ifdef I_UNISTD
11013# include <unistd.h>
11014#endif
11015
55954f19 11016#ifdef I_STDLIB
d0bc9cc8 11017# include <stdlib.h>
55954f19 11018#endif
b4eb6b3d 11019
d0bc9cc8
AD
11020#include <stdio.h> /* vsprintf prototype */
11021
11022#ifdef I_STDARG
11023void xxx(int n, ...)
11024{
11025 va_list args;
11026 char buf[10];
11027 va_start(args, n);
11028 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11029}
11030int main() { xxx(1, "foo"); }
11031
11032#else /* I_VARARGS */
b4eb6b3d
JH
11033
11034xxx(va_alist)
11035va_dcl
11036{
d0bc9cc8
AD
11037 va_list args;
11038 char buf[10];
11039 va_start(args);
11040 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 11041}
d0bc9cc8
AD
11042int main() { xxx("foo"); }
11043
11044#endif
11045
b4eb6b3d 11046EOF
5440bc8e 11047 set try
d0bc9cc8
AD
11048 if eval $compile_ok; then
11049 if $run ./try; then
11050 echo "Your vsprintf() returns (int)." >&4
11051 val2="$undef"
11052 else
11053 echo "Your vsprintf() returns (char*)." >&4
11054 val2="$define"
11055 fi
b4eb6b3d 11056 else
d0bc9cc8
AD
11057 echo 'I am unable to compile the vsprintf() test program.' >&4
11058 # We shouldn't get here. If we do, assume the standard signature,
11059 # not the old BSD one.
11060 echo 'Guessing that vsprintf() returns (int).' >&4
11061 val2="$undef"
b4eb6b3d
JH
11062 fi
11063else
11064 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
11065 val="$undef"
11066 val2="$undef"
b4eb6b3d 11067fi
5b813a60 11068$rm_try
b4eb6b3d
JH
11069set d_vprintf
11070eval $setvar
11071val=$val2
11072set d_charvspr
11073eval $setvar
11074
11075: see if chown exists
11076set chown d_chown
11077eval $inlibc
11078
11079: see if chroot exists
11080set chroot d_chroot
11081eval $inlibc
11082
11083: see if chsize exists
11084set chsize d_chsize
11085eval $inlibc
11086
758a5d79
JH
11087: see if class exists
11088set class d_class
11089eval $inlibc
11090
b0a2e8e6
MB
11091: see if clearenv exists
11092set clearenv d_clearenv
11093eval $inlibc
11094
34f1896b 11095: Define hasstruct macro for Configure internal use
4e0554ec
JH
11096hasstruct='varname=$1; struct=$2; shift; shift;
11097while $test $# -ge 2; do
11098 case "$1" in
11099 $define) echo "#include <$2>";;
11100 esac ;
11101 shift 2;
11102done > try.c;
11103echo "int main () { struct $struct foo; }" >> try.c;
11104set try;
11105if eval $compile; then
11106 val="$define";
11107else
11108 val="$undef";
11109fi;
11110set $varname;
11111eval $setvar;
5b813a60 11112$rm_try'
4e0554ec 11113
34f1896b 11114: see whether socket exists
4e0554ec
JH
11115socketlib=''
11116sockethdr=''
4e0554ec
JH
11117echo " "
11118$echo $n "Hmm... $c" >&4
11119if set socket val -f d_socket; eval $csym; $val; then
11120 echo "Looks like you have Berkeley networking support." >&4
11121 d_socket="$define"
11122 if set setsockopt val -f; eval $csym; $val; then
11123 d_oldsock="$undef"
11124 else
11125 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11126 d_oldsock="$define"
11127 fi
11128else
11129 if $contains socklib libc.list >/dev/null 2>&1; then
11130 echo "Looks like you have Berkeley networking support." >&4
11131 d_socket="$define"
11132 : we will have to assume that it supports the 4.2 BSD interface
11133 d_oldsock="$undef"
11134 else
11135 echo "You don't have Berkeley networking in libc$_a..." >&4
11136 if test "X$d_socket" = "X$define"; then
11137 echo "...but you seem to believe that you have sockets." >&4
11138 else
11139 for net in net socket
11140 do
11141 if test -f /usr/lib/lib$net$_a; then
11142 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
11143 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11144 if $contains socket libc.list >/dev/null 2>&1; then
11145 d_socket="$define"
11146 socketlib="-l$net"
11147 case "$net" in
11148 net)
11149 echo "...but the Wollongong group seems to have hacked it in." >&4
11150 sockethdr="-I/usr/netinclude"
11151 ;;
11152 esac
5b813a60 11153 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
11154 if $contains setsockopt libc.list >/dev/null 2>&1; then
11155 d_oldsock="$undef"
11156 else
11157 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11158 d_oldsock="$define"
11159 fi
11160 break
11161 fi
11162 fi
11163 done
11164 if test "X$d_socket" != "X$define"; then
11165 echo "or anywhere else I see." >&4
11166 d_socket="$undef"
11167 d_oldsock="$undef"
11168 fi
11169 fi
11170 fi
11171fi
11172
11173: see if socketpair exists
11174set socketpair d_sockpair
11175eval $inlibc
11176
11177
11178echo " "
3c728e00 11179echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11180for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11181 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11182 $cat >try.c <<EOF
11183#include <sys/types.h>
11184#include <sys/socket.h>
11185int main() {
11186 int i = $ENUM;
11187}
11188EOF
11189 val="$undef"
11190 set try; if eval $compile; then
11191 val="$define"
11192 fi
11193 set d_${enum}; eval $setvar
5b813a60 11194 $rm_try
4e0554ec
JH
11195done
11196
11197: see if this is a sys/uio.h system
11198set sys/uio.h i_sysuio
11199eval $inhdr
11200
34f1896b 11201: Check for cmsghdr support
4e0554ec
JH
11202echo " "
11203echo "Checking to see if your system supports struct cmsghdr..." >&4
11204set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11205eval $hasstruct
11206case "$d_cmsghdr_s" in
11207"$define") echo "Yes, it does." ;;
11208*) echo "No, it doesn't." ;;
11209esac
11210
11211
b4eb6b3d
JH
11212: check for const keyword
11213echo " "
11214echo 'Checking to see if your C compiler knows about "const"...' >&4
11215$cat >const.c <<'EOCP'
11216typedef struct spug { int drokk; } spug;
76f47787 11217int main()
b4eb6b3d
JH
11218{
11219 const char *foo;
666ea192 11220 const spug y = { 0 };
b4eb6b3d
JH
11221}
11222EOCP
11223if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11224 val="$define"
11225 echo "Yup, it does."
11226else
11227 val="$undef"
11228 echo "Nope, it doesn't."
11229fi
11230set d_const
11231eval $setvar
11232
89ce900e
JH
11233: see if copysignl exists
11234set copysignl d_copysignl
11235eval $inlibc
11236
b4eb6b3d
JH
11237: see if crypt exists
11238echo " "
a5a94ea5
JH
11239set crypt d_crypt
11240eval $inlibc
11241case "$d_crypt" in
11242$define) cryptlib='' ;;
11243*) if set crypt val -f d_crypt; eval $csym; $val; then
11244 echo 'crypt() found.' >&4
b4eb6b3d 11245 val="$define"
a5a94ea5
JH
11246 cryptlib=''
11247 else
11248 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11249 if $test -z "$cryptlib"; then
11250 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11251 else
11252 cryptlib=-lcrypt
11253 fi
11254 if $test -z "$cryptlib"; then
11255 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11256 else
11257 cryptlib=-lcrypt
11258 fi
11259 if $test -z "$cryptlib"; then
11260 cryptlib=`./loc libcrypt$_a "" $libpth`
11261 else
11262 cryptlib=-lcrypt
11263 fi
11264 if $test -z "$cryptlib"; then
11265 echo 'crypt() NOT found.' >&4
11266 val="$undef"
11267 else
11268 val="$define"
11269 fi
b4eb6b3d 11270 fi
a5a94ea5
JH
11271 set d_crypt
11272 eval $setvar
11273 ;;
11274esac
b4eb6b3d 11275
10bc17b6
JH
11276: see if this is a crypt.h system
11277set crypt.h i_crypt
11278eval $inhdr
11279
11280: see if crypt_r exists
11281set crypt_r d_crypt_r
11282eval $inlibc
11283case "$d_crypt_r" in
11284"$define")
11285 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11286 case "$d_crypt_r_proto:$usethreads" in
11287 ":define") d_crypt_r_proto=define
a48ec845
JH
11288 set d_crypt_r_proto crypt_r $hdrs
11289 eval $hasproto ;;
11290 *) ;;
11291 esac
11292 case "$d_crypt_r_proto" in
11293 define)
10bc17b6
JH
11294 case "$crypt_r_proto" in
11295 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11296 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11297 esac
11298 case "$crypt_r_proto" in
b430fd04
JH
11299 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11300 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11301 esac
11302 case "$crypt_r_proto" in
90e831dc 11303 ''|0) d_crypt_r=undef
10bc17b6 11304 crypt_r_proto=0
a48ec845 11305 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11306 * ) case "$crypt_r_proto" in
11307 REENTRANT_PROTO*) ;;
11308 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11309 esac
11310 echo "Prototype: $try" ;;
11311 esac
11312 ;;
c18e646a
JH
11313 *) case "$usethreads" in
11314 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11315 esac
90e831dc
SB
11316 d_crypt_r=undef
11317 crypt_r_proto=0
c18e646a 11318 ;;
a48ec845
JH
11319 esac
11320 ;;
10bc17b6
JH
11321*) crypt_r_proto=0
11322 ;;
11323esac
11324
b4eb6b3d
JH
11325: get csh whereabouts
11326case "$csh" in
11327'csh') val="$undef" ;;
11328*) val="$define" ;;
11329esac
11330set d_csh
11331eval $setvar
11332: Respect a hint or command line value for full_csh.
11333case "$full_csh" in
11334'') full_csh=$csh ;;
11335esac
11336
13cfc98d
MB
11337: see if ctermid exists
11338set ctermid d_ctermid
11339eval $inlibc
11340
10bc17b6
JH
11341: see if ctermid_r exists
11342set ctermid_r d_ctermid_r
11343eval $inlibc
11344case "$d_ctermid_r" in
11345"$define")
31ee0cb7 11346 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11347 case "$d_ctermid_r_proto:$usethreads" in
11348 ":define") d_ctermid_r_proto=define
a48ec845
JH
11349 set d_ctermid_r_proto ctermid_r $hdrs
11350 eval $hasproto ;;
11351 *) ;;
11352 esac
11353 case "$d_ctermid_r_proto" in
11354 define)
10bc17b6
JH
11355 case "$ctermid_r_proto" in
11356 ''|0) try='char* ctermid_r(char*);'
11357 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11358 esac
11359 case "$ctermid_r_proto" in
90e831dc 11360 ''|0) d_ctermid_r=undef
10bc17b6 11361 ctermid_r_proto=0
a48ec845 11362 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11363 * ) case "$ctermid_r_proto" in
11364 REENTRANT_PROTO*) ;;
11365 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11366 esac
11367 echo "Prototype: $try" ;;
11368 esac
11369 ;;
c18e646a
JH
11370 *) case "$usethreads" in
11371 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11372 esac
90e831dc
SB
11373 d_ctermid_r=undef
11374 ctermid_r_proto=0
c18e646a 11375 ;;
a48ec845
JH
11376 esac
11377 ;;
10bc17b6
JH
11378*) ctermid_r_proto=0
11379 ;;
11380esac
11381
11382: see if ctime_r exists
11383set ctime_r d_ctime_r
11384eval $inlibc
11385case "$d_ctime_r" in
11386"$define")
d63eadf0 11387 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11388 case "$d_ctime_r_proto:$usethreads" in
11389 ":define") d_ctime_r_proto=define
a48ec845
JH
11390 set d_ctime_r_proto ctime_r $hdrs
11391 eval $hasproto ;;
11392 *) ;;
11393 esac
11394 case "$d_ctime_r_proto" in
11395 define)
10bc17b6
JH
11396 case "$ctime_r_proto" in
11397 ''|0) try='char* ctime_r(const time_t*, char*);'
11398 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11399 esac
11400 case "$ctime_r_proto" in
11401 ''|0) try='char* ctime_r(const time_t*, char*, int);'
11402 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11403 esac
11404 case "$ctime_r_proto" in
11405 ''|0) try='int ctime_r(const time_t*, char*);'
11406 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11407 esac
11408 case "$ctime_r_proto" in
11409 ''|0) try='int ctime_r(const time_t*, char*, int);'
11410 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11411 esac
11412 case "$ctime_r_proto" in
90e831dc 11413 ''|0) d_ctime_r=undef
10bc17b6 11414 ctime_r_proto=0
a48ec845 11415 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11416 * ) case "$ctime_r_proto" in
11417 REENTRANT_PROTO*) ;;
11418 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11419 esac
11420 echo "Prototype: $try" ;;
11421 esac
11422 ;;
c18e646a
JH
11423 *) case "$usethreads" in
11424 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11425 esac
90e831dc
SB
11426 d_ctime_r=undef
11427 ctime_r_proto=0
c18e646a 11428 ;;
a48ec845
JH
11429 esac
11430 ;;
10bc17b6
JH
11431*) ctime_r_proto=0
11432 ;;
11433esac
11434
b4eb6b3d
JH
11435: see if cuserid exists
11436set cuserid d_cuserid
11437eval $inlibc
11438
11439: see if this is a limits.h system
11440set limits.h i_limits
11441eval $inhdr
11442
11443: see if this is a float.h system
11444set float.h i_float
11445eval $inhdr
11446
11447: See if number of significant digits in a double precision number is known
11448echo " "
11449$cat >dbl_dig.c <<EOM
11450#$i_limits I_LIMITS
11451#$i_float I_FLOAT
11452#ifdef I_LIMITS
11453#include <limits.h>
11454#endif
11455#ifdef I_FLOAT
11456#include <float.h>
11457#endif
11458#ifdef DBL_DIG
11459printf("Contains DBL_DIG");
11460#endif
11461EOM
11462$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11463if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11464 echo "DBL_DIG found." >&4
11465 val="$define"
11466else
11467 echo "DBL_DIG NOT found." >&4
11468 val="$undef"
11469fi
11470$rm -f dbl_dig.?
11471set d_dbl_dig
11472eval $setvar
11473
2ef53570
JH
11474: see if dbm.h is available
11475: see if dbmclose exists
11476set dbmclose d_dbmclose
11477eval $inlibc
11478
11479case "$d_dbmclose" in
11480$define)
11481 set dbm.h i_dbm
11482 eval $inhdr
11483 case "$i_dbm" in
11484 $define)
11485 val="$undef"
11486 set i_rpcsvcdbm
11487 eval $setvar
11488 ;;
11489 *) set rpcsvc/dbm.h i_rpcsvcdbm
11490 eval $inhdr
11491 ;;
11492 esac
11493 ;;
11494*) echo "We won't be including <dbm.h>"
11495 val="$undef"
11496 set i_dbm
11497 eval $setvar
11498 val="$undef"
11499 set i_rpcsvcdbm
11500 eval $setvar
11501 ;;
11502esac
11503
11504: see if prototype for dbminit is available
11505echo " "
11506set d_dbminitproto dbminit $i_dbm dbm.h
11507eval $hasproto
11508
b4eb6b3d
JH
11509: see if difftime exists
11510set difftime d_difftime
11511eval $inlibc
11512
11513: see if this is a dirent system
11514echo " "
11515if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11516 val="$define"
11517 echo "<dirent.h> found." >&4
11518else
11519 val="$undef"
11520 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11521 echo "<sys/dir.h> found." >&4
11522 echo " "
11523 else
11524 xinc=`./findhdr sys/ndir.h`
11525 fi
11526 echo "<dirent.h> NOT found." >&4
11527fi
11528set i_dirent
11529eval $setvar
11530
11531: Look for type of directory structure.
11532echo " "
11533$cppstdin $cppflags $cppminus < "$xinc" > try.c
11534
11535case "$direntrytype" in
11536''|' ')
11537 case "$i_dirent" in
11538 $define) guess1='struct dirent' ;;
11539 *) guess1='struct direct' ;;
11540 esac
11541 ;;
11542*) guess1="$direntrytype"
11543 ;;
11544esac
11545
11546case "$guess1" in
11547'struct dirent') guess2='struct direct' ;;
11548*) guess2='struct dirent' ;;
11549esac
5b813a60 11550
b4eb6b3d
JH
11551if $contains "$guess1" try.c >/dev/null 2>&1; then
11552 direntrytype="$guess1"
11553 echo "Your directory entries are $direntrytype." >&4
11554elif $contains "$guess2" try.c >/dev/null 2>&1; then
11555 direntrytype="$guess2"
11556 echo "Your directory entries seem to be $direntrytype." >&4
11557else
11558 echo "I don't recognize your system's directory entries." >&4
11559 rp="What type is used for directory entries on this system?"
11560 dflt="$guess1"
11561 . ./myread
11562 direntrytype="$ans"
11563fi
5b813a60 11564$rm_try
b4eb6b3d
JH
11565
11566: see if the directory entry stores field length
11567echo " "
11568$cppstdin $cppflags $cppminus < "$xinc" > try.c
11569if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11570 echo "Good, your directory entry keeps length information in d_namlen." >&4
11571 val="$define"
11572else
11573 echo "Your directory entry does not know about the d_namlen field." >&4
11574 val="$undef"
11575fi
11576set d_dirnamlen
11577eval $setvar
5b813a60 11578$rm_try
b4eb6b3d 11579
de52168c
SP
11580: Look for DIR.dd_fd
11581case "$i_dirent" in
11582"$define")
11583 echo "Checking to see if DIR has a dd_fd member variable" >&4
11584 $cat >try.c <<EOCP
11585#$i_stdlib I_STDLIB
11586#ifdef I_STDLIB
11587#include <stdlib.h>
11588#endif
11589#include <dirent.h>
11590
11591int main() {
11592 DIR dir;
11593 dir.dd_fd = 1;
11594 return 0;
11595}
11596EOCP
11597 val=$undef
11598 set try
11599 if eval $compile; then
11600 echo "Yes, it does."
11601 val="$define"
11602 else
11603 echo "No, it does not."
11604 val="$undef"
11605 fi
11606 ;;
11607*)
11608 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11609 val="$undef"
11610 ;;
11611esac
11612set d_dir_dd_fd
11613eval $setvar
5b813a60 11614$rm_try
de52168c 11615
ae0e3d3b
JH
11616: see if this is an sysdir system
11617set sys/dir.h i_sysdir
11618eval $inhdr
11619
11620: see if this is an sysndir system
11621set sys/ndir.h i_sysndir
11622eval $inhdr
11623
11624: Look for dirfd
11625echo " "
11626$cat >dirfd.c <<EOM
11627#include <stdio.h>
55954f19
JH
11628#$i_stdlib I_STDLIB
11629#ifdef I_STDLIB
11630#include <stdlib.h>
11631#endif
ae0e3d3b
JH
11632#$i_dirent I_DIRENT /**/
11633#$i_sysdir I_SYS_DIR /**/
11634#$i_sysndir I_SYS_NDIR /**/
11635#$i_systypes I_SYS_TYPES /**/
11636#if defined(I_SYS_TYPES)
11637#include <sys/types.h>
11638#endif
11639#if defined(I_DIRENT)
11640#include <dirent.h>
11641#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11642#include <sys/dir.h>
11643#endif
11644#else
11645#ifdef I_SYS_NDIR
11646#include <sys/ndir.h>
11647#else
11648#ifdef I_SYS_DIR
11649#ifdef hp9000s500
11650#include <ndir.h> /* may be wrong in the future */
11651#else
11652#include <sys/dir.h>
11653#endif
11654#endif
11655#endif
11656#endif
11657int main() {
11658 DIR *dirp = opendir(".");
11659 if (dirfd(dirp) >= 0)
11660 exit(0);
11661 else
11662 exit(1);
11663}
11664EOM
5cadb3f3 11665val=$undef
ae0e3d3b
JH
11666set dirfd
11667if eval $compile; then
11668 val="$define"
11669fi
11670case "$val" in
11671$define) echo "dirfd() found." >&4 ;;
11672*) echo "dirfd() NOT found." >&4 ;;
11673esac
11674set d_dirfd
11675eval $setvar
11676$rm -f dirfd*
11677
b4eb6b3d
JH
11678: see if dlerror exists
11679xxx_runnm="$runnm"
11680runnm=false
11681set dlerror d_dlerror
11682eval $inlibc
11683runnm="$xxx_runnm"
11684
11685: see if dlfcn is available
11686set dlfcn.h i_dlfcn
11687eval $inhdr
11688
34f1896b 11689: Check what extension to use for shared libs
b4eb6b3d
JH
11690case "$usedl" in
11691$define|y|true)
11692 $cat << EOM
11693
11694On a few systems, the dynamically loaded modules that perl generates and uses
11695will need a different extension than shared libs. The default will probably
11696be appropriate.
11697
11698EOM
11699 case "$dlext" in
11700 '') dflt="$so" ;;
11701 *) dflt="$dlext" ;;
11702 esac
11703 rp='What is the extension of dynamically loaded modules'
11704 . ./myread
11705 dlext="$ans"
11706 ;;
11707*)
11708 dlext="none"
11709 ;;
11710esac
11711
11712: Check if dlsym need a leading underscore
11713echo " "
11714val="$undef"
11715
11716case "$dlsrc" in
11717dl_dlopen.xs)
11718 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11719 $cat >dyna.c <<'EOM'
11720fred () { }
11721EOM
11722
11723$cat >fred.c<<EOM
11724
11725#include <stdio.h>
55954f19
JH
11726#$i_stdlib I_STDLIB
11727#ifdef I_STDLIB
11728#include <stdlib.h>
11729#endif
b4eb6b3d
JH
11730#$i_dlfcn I_DLFCN
11731#ifdef I_DLFCN
5440bc8e 11732#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11733#else
11734#include <sys/types.h>
11735#include <nlist.h>
11736#include <link.h>
11737#endif
11738
11739extern int fred() ;
11740
11741int main()
11742{
11743 void * handle ;
11744 void * symbol ;
11745#ifndef RTLD_LAZY
11746 int mode = 1 ;
11747#else
11748 int mode = RTLD_LAZY ;
11749#endif
11750 handle = dlopen("./dyna.$dlext", mode) ;
11751 if (handle == NULL) {
11752 printf ("1\n") ;
11753 fflush (stdout) ;
11754 exit(0);
11755 }
11756 symbol = dlsym(handle, "fred") ;
11757 if (symbol == NULL) {
11758 /* try putting a leading underscore */
11759 symbol = dlsym(handle, "_fred") ;
11760 if (symbol == NULL) {
11761 printf ("2\n") ;
11762 fflush (stdout) ;
11763 exit(0);
11764 }
11765 printf ("3\n") ;
11766 }
11767 else
11768 printf ("4\n") ;
11769 fflush (stdout) ;
11770 exit(0);
11771}
11772EOM
11773 : Call the object file tmp-dyna.o in case dlext=o.
613d6c3e
MB
11774 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11775 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11776 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11777 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11778 xxx=`$run ./fred`
b4eb6b3d
JH
11779 case $xxx in
11780 1) echo "Test program failed using dlopen." >&4
11781 echo "Perhaps you should not use dynamic loading." >&4;;
11782 2) echo "Test program failed using dlsym." >&4
11783 echo "Perhaps you should not use dynamic loading." >&4;;
11784 3) echo "dlsym needs a leading underscore" >&4
11785 val="$define" ;;
11786 4) echo "dlsym doesn't need a leading underscore." >&4;;
11787 esac
11788 else
11789 echo "I can't compile and run the test program." >&4
11790 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11791 fi
11792 ;;
11793esac
613d6c3e 11794
3c728e00 11795$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11796
11797set d_dlsymun
11798eval $setvar
11799
10bc17b6
JH
11800: see if drand48_r exists
11801set drand48_r d_drand48_r
11802eval $inlibc
11803case "$d_drand48_r" in
11804"$define")
11805 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11806 case "$d_drand48_r_proto:$usethreads" in
11807 ":define") d_drand48_r_proto=define
a48ec845
JH
11808 set d_drand48_r_proto drand48_r $hdrs
11809 eval $hasproto ;;
11810 *) ;;
11811 esac
11812 case "$d_drand48_r_proto" in
11813 define)
10bc17b6
JH
11814 case "$drand48_r_proto" in
11815 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11816 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11817 esac
11818 case "$drand48_r_proto" in
90e831dc 11819 ''|0) d_drand48_r=undef
10bc17b6 11820 drand48_r_proto=0
a48ec845 11821 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11822 * ) case "$drand48_r_proto" in
11823 REENTRANT_PROTO*) ;;
11824 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11825 esac
11826 echo "Prototype: $try" ;;
11827 esac
11828 ;;
c18e646a
JH
11829 *) case "$usethreads" in
11830 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11831 esac
90e831dc
SB
11832 d_drand48_r=undef
11833 drand48_r_proto=0
c18e646a 11834 ;;
a48ec845
JH
11835 esac
11836 ;;
10bc17b6
JH
11837*) drand48_r_proto=0
11838 ;;
11839esac
11840
11841: see if prototype for drand48 is available
11842echo " "
11843set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11844eval $hasproto
11845
b4eb6b3d
JH
11846: see if dup2 exists
11847set dup2 d_dup2
11848eval $inlibc
11849
11850: see if eaccess exists
11851set eaccess d_eaccess
11852eval $inlibc
11853
11854: see if endgrent exists
11855set endgrent d_endgrent
11856eval $inlibc
11857
10bc17b6
JH
11858: see if this is an grp system
11859set grp.h i_grp
11860eval $inhdr
11861
11862case "$i_grp" in
11863$define)
11864 xxx=`./findhdr grp.h`
11865 $cppstdin $cppflags $cppminus < $xxx >$$.h
11866
11867 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11868 val="$define"
11869 else
11870 val="$undef"
11871 fi
11872 set d_grpasswd
11873 eval $setvar
11874
11875 $rm -f $$.h
11876 ;;
11877*)
11878 val="$undef";
11879 set d_grpasswd; eval $setvar
11880 ;;
11881esac
11882
11883: see if endgrent_r exists
11884set endgrent_r d_endgrent_r
11885eval $inlibc
11886case "$d_endgrent_r" in
11887"$define")
11888 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11889 case "$d_endgrent_r_proto:$usethreads" in
11890 ":define") d_endgrent_r_proto=define
a48ec845
JH
11891 set d_endgrent_r_proto endgrent_r $hdrs
11892 eval $hasproto ;;
11893 *) ;;
11894 esac
11895 case "$d_endgrent_r_proto" in
11896 define)
10bc17b6
JH
11897 case "$endgrent_r_proto" in
11898 ''|0) try='int endgrent_r(FILE**);'
11899 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11900 esac
11901 case "$endgrent_r_proto" in
11902 ''|0) try='void endgrent_r(FILE**);'
11903 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11904 esac
11905 case "$endgrent_r_proto" in
90e831dc 11906 ''|0) d_endgrent_r=undef
10bc17b6 11907 endgrent_r_proto=0
a48ec845 11908 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11909 * ) case "$endgrent_r_proto" in
11910 REENTRANT_PROTO*) ;;
11911 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11912 esac
11913 echo "Prototype: $try" ;;
11914 esac
11915 ;;
c18e646a
JH
11916 *) case "$usethreads" in
11917 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11918 esac
90e831dc
SB
11919 d_endgrent_r=undef
11920 endgrent_r_proto=0
c18e646a 11921 ;;
a48ec845
JH
11922 esac
11923 ;;
10bc17b6
JH
11924*) endgrent_r_proto=0
11925 ;;
11926esac
11927
b4eb6b3d
JH
11928: see if endhostent exists
11929set endhostent d_endhent
11930eval $inlibc
11931
10bc17b6
JH
11932: see if this is a netdb.h system
11933set netdb.h i_netdb
11934eval $inhdr
11935
11936: see if endhostent_r exists
11937set endhostent_r d_endhostent_r
11938eval $inlibc
11939case "$d_endhostent_r" in
11940"$define")
11941 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11942 case "$d_endhostent_r_proto:$usethreads" in
11943 ":define") d_endhostent_r_proto=define
a48ec845
JH
11944 set d_endhostent_r_proto endhostent_r $hdrs
11945 eval $hasproto ;;
11946 *) ;;
11947 esac
11948 case "$d_endhostent_r_proto" in
11949 define)
10bc17b6
JH
11950 case "$endhostent_r_proto" in
11951 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11952 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11953 esac
11954 case "$endhostent_r_proto" in
11955 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11956 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11957 esac
11958 case "$endhostent_r_proto" in
90e831dc 11959 ''|0) d_endhostent_r=undef
10bc17b6 11960 endhostent_r_proto=0
a48ec845 11961 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11962 * ) case "$endhostent_r_proto" in
11963 REENTRANT_PROTO*) ;;
11964 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11965 esac
11966 echo "Prototype: $try" ;;
11967 esac
11968 ;;
c18e646a
JH
11969 *) case "$usethreads" in
11970 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11971 esac
90e831dc
SB
11972 d_endhostent_r=undef
11973 endhostent_r_proto=0
c18e646a 11974 ;;
a48ec845
JH
11975 esac
11976 ;;
10bc17b6
JH
11977*) endhostent_r_proto=0
11978 ;;
11979esac
11980
b4eb6b3d
JH
11981: see if endnetent exists
11982set endnetent d_endnent
11983eval $inlibc
11984
10bc17b6
JH
11985: see if endnetent_r exists
11986set endnetent_r d_endnetent_r
11987eval $inlibc
11988case "$d_endnetent_r" in
11989"$define")
11990 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11991 case "$d_endnetent_r_proto:$usethreads" in
11992 ":define") d_endnetent_r_proto=define
a48ec845
JH
11993 set d_endnetent_r_proto endnetent_r $hdrs
11994 eval $hasproto ;;
11995 *) ;;
11996 esac
11997 case "$d_endnetent_r_proto" in
11998 define)
10bc17b6
JH
11999 case "$endnetent_r_proto" in
12000 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 12001 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
12002 esac
12003 case "$endnetent_r_proto" in
12004 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 12005 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
12006 esac
12007 case "$endnetent_r_proto" in
90e831dc 12008 ''|0) d_endnetent_r=undef
10bc17b6 12009 endnetent_r_proto=0
a48ec845 12010 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12011 * ) case "$endnetent_r_proto" in
12012 REENTRANT_PROTO*) ;;
12013 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12014 esac
12015 echo "Prototype: $try" ;;
12016 esac
12017 ;;
c18e646a
JH
12018 *) case "$usethreads" in
12019 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12020 esac
90e831dc
SB
12021 d_endnetent_r=undef
12022 endnetent_r_proto=0
c18e646a 12023 ;;
a48ec845
JH
12024 esac
12025 ;;
10bc17b6
JH
12026*) endnetent_r_proto=0
12027 ;;
12028esac
12029
b4eb6b3d
JH
12030: see if endprotoent exists
12031set endprotoent d_endpent
12032eval $inlibc
12033
10bc17b6
JH
12034: see if endprotoent_r exists
12035set endprotoent_r d_endprotoent_r
12036eval $inlibc
12037case "$d_endprotoent_r" in
12038"$define")
12039 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12040 case "$d_endprotoent_r_proto:$usethreads" in
12041 ":define") d_endprotoent_r_proto=define
a48ec845
JH
12042 set d_endprotoent_r_proto endprotoent_r $hdrs
12043 eval $hasproto ;;
12044 *) ;;
12045 esac
12046 case "$d_endprotoent_r_proto" in
12047 define)
10bc17b6
JH
12048 case "$endprotoent_r_proto" in
12049 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 12050 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
12051 esac
12052 case "$endprotoent_r_proto" in
12053 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 12054 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
12055 esac
12056 case "$endprotoent_r_proto" in
90e831dc 12057 ''|0) d_endprotoent_r=undef
10bc17b6 12058 endprotoent_r_proto=0
a48ec845 12059 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12060 * ) case "$endprotoent_r_proto" in
12061 REENTRANT_PROTO*) ;;
12062 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12063 esac
12064 echo "Prototype: $try" ;;
12065 esac
12066 ;;
c18e646a
JH
12067 *) case "$usethreads" in
12068 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12069 esac
90e831dc
SB
12070 d_endprotoent_r=undef
12071 endprotoent_r_proto=0
c18e646a 12072 ;;
a48ec845
JH
12073 esac
12074 ;;
10bc17b6
JH
12075*) endprotoent_r_proto=0
12076 ;;
12077esac
12078
b4eb6b3d
JH
12079: see if endpwent exists
12080set endpwent d_endpwent
12081eval $inlibc
12082
10bc17b6
JH
12083: see if this is a pwd.h system
12084set pwd.h i_pwd
12085eval $inhdr
12086
12087case "$i_pwd" in
12088$define)
12089 xxx=`./findhdr pwd.h`
12090 $cppstdin $cppflags $cppminus < $xxx >$$.h
12091
12092 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12093 val="$define"
12094 else
12095 val="$undef"
12096 fi
12097 set d_pwquota
12098 eval $setvar
12099
12100 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12101 val="$define"
12102 else
12103 val="$undef"
12104 fi
12105 set d_pwage
12106 eval $setvar
12107
12108 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12109 val="$define"
12110 else
12111 val="$undef"
12112 fi
12113 set d_pwchange
12114 eval $setvar
12115
12116 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12117 val="$define"
12118 else
12119 val="$undef"
12120 fi
12121 set d_pwclass
12122 eval $setvar
12123
12124 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12125 val="$define"
12126 else
12127 val="$undef"
12128 fi
12129 set d_pwexpire
12130 eval $setvar
12131
12132 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12133 val="$define"
12134 else
12135 val="$undef"
12136 fi
12137 set d_pwcomment
12138 eval $setvar
12139
12140 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12141 val="$define"
12142 else
12143 val="$undef"
12144 fi
12145 set d_pwgecos
12146 eval $setvar
12147
12148 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12149 val="$define"
12150 else
12151 val="$undef"
12152 fi
12153 set d_pwpasswd
12154 eval $setvar
12155
12156 $rm -f $$.h
12157 ;;
12158*)
12159 val="$undef";
12160 set d_pwquota; eval $setvar
12161 set d_pwage; eval $setvar
12162 set d_pwchange; eval $setvar
12163 set d_pwclass; eval $setvar
12164 set d_pwexpire; eval $setvar
12165 set d_pwcomment; eval $setvar
12166 set d_pwgecos; eval $setvar
12167 set d_pwpasswd; eval $setvar
12168 ;;
12169esac
12170
12171: see if endpwent_r exists
12172set endpwent_r d_endpwent_r
12173eval $inlibc
12174case "$d_endpwent_r" in
12175"$define")
12176 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12177 case "$d_endpwent_r_proto:$usethreads" in
12178 ":define") d_endpwent_r_proto=define
a48ec845
JH
12179 set d_endpwent_r_proto endpwent_r $hdrs
12180 eval $hasproto ;;
12181 *) ;;
12182 esac
12183 case "$d_endpwent_r_proto" in
12184 define)
10bc17b6
JH
12185 case "$endpwent_r_proto" in
12186 ''|0) try='int endpwent_r(FILE**);'
12187 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12188 esac
12189 case "$endpwent_r_proto" in
12190 ''|0) try='void endpwent_r(FILE**);'
12191 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12192 esac
12193 case "$endpwent_r_proto" in
90e831dc 12194 ''|0) d_endpwent_r=undef
10bc17b6 12195 endpwent_r_proto=0
a48ec845 12196 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12197 * ) case "$endpwent_r_proto" in
12198 REENTRANT_PROTO*) ;;
12199 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12200 esac
12201 echo "Prototype: $try" ;;
12202 esac
12203 ;;
c18e646a
JH
12204 *) case "$usethreads" in
12205 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12206 esac
90e831dc
SB
12207 d_endpwent_r=undef
12208 endpwent_r_proto=0
c18e646a 12209 ;;
a48ec845
JH
12210 esac
12211 ;;
10bc17b6
JH
12212*) endpwent_r_proto=0
12213 ;;
12214esac
12215
b4eb6b3d
JH
12216: see if endservent exists
12217set endservent d_endsent
12218eval $inlibc
12219
10bc17b6
JH
12220: see if endservent_r exists
12221set endservent_r d_endservent_r
12222eval $inlibc
12223case "$d_endservent_r" in
12224"$define")
12225 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12226 case "$d_endservent_r_proto:$usethreads" in
12227 ":define") d_endservent_r_proto=define
a48ec845
JH
12228 set d_endservent_r_proto endservent_r $hdrs
12229 eval $hasproto ;;
12230 *) ;;
12231 esac
12232 case "$d_endservent_r_proto" in
12233 define)
10bc17b6
JH
12234 case "$endservent_r_proto" in
12235 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 12236 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12237 esac
12238 case "$endservent_r_proto" in
12239 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 12240 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12241 esac
12242 case "$endservent_r_proto" in
90e831dc 12243 ''|0) d_endservent_r=undef
10bc17b6 12244 endservent_r_proto=0
a48ec845 12245 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12246 * ) case "$endservent_r_proto" in
12247 REENTRANT_PROTO*) ;;
12248 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12249 esac
12250 echo "Prototype: $try" ;;
12251 esac
12252 ;;
c18e646a
JH
12253 *) case "$usethreads" in
12254 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12255 esac
90e831dc
SB
12256 d_endservent_r=undef
12257 endservent_r_proto=0
c18e646a 12258 ;;
a48ec845
JH
12259 esac
12260 ;;
10bc17b6
JH
12261*) endservent_r_proto=0
12262 ;;
12263esac
12264
b4eb6b3d
JH
12265: Locate the flags for 'open()'
12266echo " "
55954f19 12267$cat >try.c <<EOCP
b4eb6b3d
JH
12268#include <sys/types.h>
12269#ifdef I_FCNTL
12270#include <fcntl.h>
12271#endif
12272#ifdef I_SYS_FILE
12273#include <sys/file.h>
12274#endif
55954f19
JH
12275#$i_stdlib I_STDLIB
12276#ifdef I_STDLIB
12277#include <stdlib.h>
12278#endif
b4eb6b3d
JH
12279int main() {
12280 if(O_RDONLY);
12281#ifdef O_TRUNC
12282 exit(0);
12283#else
12284 exit(1);
12285#endif
12286}
12287EOCP
12288: check sys/file.h first to get FREAD on Sun
12289if $test `./findhdr sys/file.h` && \
5440bc8e 12290 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12291 h_sysfile=true;
12292 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12293 if $run ./try; then
b4eb6b3d
JH
12294 echo "and you have the 3 argument form of open()." >&4
12295 val="$define"
12296 else
12297 echo "but not the 3 argument form of open(). Oh, well." >&4
12298 val="$undef"
12299 fi
12300elif $test `./findhdr fcntl.h` && \
5440bc8e 12301 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12302 h_fcntl=true;
12303 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12304 if $run ./try; then
b4eb6b3d
JH
12305 echo "and you have the 3 argument form of open()." >&4
12306 val="$define"
12307 else
12308 echo "but not the 3 argument form of open(). Oh, well." >&4
12309 val="$undef"
12310 fi
12311else
12312 val="$undef"
12313 echo "I can't find the O_* constant definitions! You got problems." >&4
12314fi
12315set d_open3
12316eval $setvar
5b813a60 12317$rm_try
b4eb6b3d 12318
216dac04
MB
12319: script used to emit important warnings
12320cat >warn <<EOS
12321$startsh
12322if test \$# -gt 0; then
12323 echo "\$@" >msg
12324else
12325 cat >msg
12326fi
12327echo "*** WARNING:" >&4
12328sed -e 's/^/*** /' <msg >&4
12329echo "*** " >&4
12330cat msg >>config.msg
12331echo " " >>config.msg
12332rm -f msg
12333EOS
12334chmod +x warn
12335$eunicefix warn
12336
b4eb6b3d
JH
12337: see which of string.h or strings.h is needed
12338echo " "
12339strings=`./findhdr string.h`
12340if $test "$strings" && $test -r "$strings"; then
12341 echo "Using <string.h> instead of <strings.h>." >&4
12342 val="$define"
12343else
12344 val="$undef"
12345 strings=`./findhdr strings.h`
12346 if $test "$strings" && $test -r "$strings"; then
12347 echo "Using <strings.h> instead of <string.h>." >&4
12348 else
216dac04 12349 ./warn "No string header found -- You'll surely have problems."
b4eb6b3d
JH
12350 fi
12351fi
12352set i_string
12353eval $setvar
12354case "$i_string" in
12355"$undef") strings=`./findhdr strings.h`;;
12356*) strings=`./findhdr string.h`;;
12357esac
12358
3c728e00
JH
12359: see if this is a sys/file.h system
12360val=''
12361set sys/file.h val
12362eval $inhdr
12363
12364: do we need to include sys/file.h ?
12365case "$val" in
12366"$define")
12367 echo " "
12368 if $h_sysfile; then
12369 val="$define"
12370 echo "We'll be including <sys/file.h>." >&4
12371 else
12372 val="$undef"
12373 echo "We won't be including <sys/file.h>." >&4
12374 fi
12375 ;;
12376*)
12377 h_sysfile=false
12378 ;;
12379esac
12380set i_sysfile
12381eval $setvar
12382
12383: see if fcntl.h is there
12384val=''
12385set fcntl.h val
12386eval $inhdr
12387
12388: see if we can include fcntl.h
12389case "$val" in
12390"$define")
12391 echo " "
12392 if $h_fcntl; then
12393 val="$define"
12394 echo "We'll be including <fcntl.h>." >&4
12395 else
12396 val="$undef"
12397 if $h_sysfile; then
12398 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12399 else
12400 echo "We won't be including <fcntl.h>." >&4
12401 fi
12402 fi
12403 ;;
12404*)
12405 h_fcntl=false
12406 val="$undef"
12407 ;;
12408esac
12409set i_fcntl
12410eval $setvar
12411
4dd8f9b3
JH
12412: see if fork exists
12413set fork d_fork
12414eval $inlibc
12415
12416: see if pipe exists
12417set pipe d_pipe
12418eval $inlibc
12419
b4eb6b3d
JH
12420: check for non-blocking I/O stuff
12421case "$h_sysfile" in
a0acbdc3
JH
12422true) echo "#include <sys/file.h>" > head.c;;
12423*)
12424 case "$h_fcntl" in
12425 true) echo "#include <fcntl.h>" > head.c;;
12426 *) echo "#include <sys/fcntl.h>" > head.c;;
12427 esac
12428 ;;
b4eb6b3d
JH
12429esac
12430echo " "
12431echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12432case "$o_nonblock" in
12433'')
12434 $cat head.c > try.c
3c728e00 12435 $cat >>try.c <<EOCP
b4eb6b3d 12436#include <stdio.h>
55954f19
JH
12437#$i_stdlib I_STDLIB
12438#ifdef I_STDLIB
80b3ef99 12439#include <stdlib.h>
55954f19 12440#endif
3c728e00
JH
12441#$i_fcntl I_FCNTL
12442#ifdef I_FCNTL
12443#include <fcntl.h>
12444#endif
b4eb6b3d
JH
12445int main() {
12446#ifdef O_NONBLOCK
12447 printf("O_NONBLOCK\n");
12448 exit(0);
12449#endif
12450#ifdef O_NDELAY
12451 printf("O_NDELAY\n");
12452 exit(0);
12453#endif
12454#ifdef FNDELAY
12455 printf("FNDELAY\n");
12456 exit(0);
12457#endif
12458 exit(0);
12459}
12460EOCP
12461 set try
12462 if eval $compile_ok; then
5440bc8e 12463 o_nonblock=`$run ./try`
b4eb6b3d
JH
12464 case "$o_nonblock" in
12465 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12466 *) echo "Seems like we can use $o_nonblock.";;
12467 esac
12468 else
12469 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12470 fi
12471 ;;
12472*) echo "Using $hint value $o_nonblock.";;
12473esac
5b813a60 12474$rm_try
b4eb6b3d
JH
12475
12476echo " "
12477echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12478case "$eagain" in
12479'')
4dd8f9b3
JH
12480 case "$d_fork:$d_pipe" in
12481 define:define)
b4eb6b3d
JH
12482 $cat head.c > try.c
12483 $cat >>try.c <<EOCP
12484#include <errno.h>
12485#include <sys/types.h>
12486#include <signal.h>
5b813a60 12487#include <stdio.h>
55954f19
JH
12488#$i_stdlib I_STDLIB
12489#ifdef I_STDLIB
12490#include <stdlib.h>
12491#endif
1deb0a86
JH
12492#$i_fcntl I_FCNTL
12493#ifdef I_FCNTL
12494#include <fcntl.h>
12495#endif
b4eb6b3d
JH
12496#define MY_O_NONBLOCK $o_nonblock
12497#ifndef errno /* XXX need better Configure test */
12498extern int errno;
12499#endif
12500#$i_unistd I_UNISTD
12501#ifdef I_UNISTD
12502#include <unistd.h>
12503#endif
12504#$i_string I_STRING
12505#ifdef I_STRING
12506#include <string.h>
12507#else
12508#include <strings.h>
12509#endif
7090f861 12510$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12511EOCP
12512 $cat >> try.c <<'EOCP'
12513int main()
12514{
12515 int pd[2];
12516 int pu[2];
12517 char buf[1];
12518 char string[100];
12519
12520 pipe(pd); /* Down: child -> parent */
12521 pipe(pu); /* Up: parent -> child */
12522 if (0 != fork()) {
12523 int ret;
12524 close(pd[1]); /* Parent reads from pd[0] */
12525 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12526#ifdef F_SETFL
b4eb6b3d
JH
12527 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12528 exit(1);
a0acbdc3
JH
12529#else
12530 exit(4);
12531#endif
b4eb6b3d
JH
12532 signal(SIGALRM, blech);
12533 alarm(5);
12534 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12535 exit(2);
12536 sprintf(string, "%d\n", ret);
12537 write(2, string, strlen(string));
12538 alarm(0);
12539#ifdef EAGAIN
12540 if (errno == EAGAIN) {
12541 printf("EAGAIN\n");
12542 goto ok;
12543 }
12544#endif
12545#ifdef EWOULDBLOCK
12546 if (errno == EWOULDBLOCK)
12547 printf("EWOULDBLOCK\n");
12548#endif
12549 ok:
12550 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12551 sleep(2); /* Give it time to close our pipe */
12552 alarm(5);
12553 ret = read(pd[0], buf, 1); /* Should read EOF */
12554 alarm(0);
12555 sprintf(string, "%d\n", ret);
868439a2 12556 write(4, string, strlen(string));
b4eb6b3d
JH
12557 exit(0);
12558 }
12559
12560 close(pd[0]); /* We write to pd[1] */
12561 close(pu[1]); /* We read from pu[0] */
12562 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12563 close(pd[1]); /* Pipe pd is now fully closed! */
12564 exit(0); /* Bye bye, thank you for playing! */
12565}
12566EOCP
12567 set try
12568 if eval $compile_ok; then
12569 echo "$startsh" >mtry
868439a2 12570 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12571 chmod +x mtry
12572 ./mtry >/dev/null 2>&1
12573 case $? in
12574 0) eagain=`$cat try.out`;;
12575 1) echo "Could not perform non-blocking setting!";;
12576 2) echo "I did a successful read() for something that was not there!";;
12577 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12578 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12579 *) echo "Something terribly wrong happened during testing.";;
12580 esac
12581 rd_nodata=`$cat try.ret`
12582 echo "A read() system call with no data present returns $rd_nodata."
12583 case "$rd_nodata" in
12584 0|-1) ;;
12585 *)
12586 echo "(That's peculiar, fixing that to be -1.)"
12587 rd_nodata=-1
12588 ;;
12589 esac
12590 case "$eagain" in
12591 '')
12592 echo "Forcing errno EAGAIN on read() with no data available."
12593 eagain=EAGAIN
12594 ;;
12595 *)
12596 echo "Your read() sets errno to $eagain when no data is available."
12597 ;;
12598 esac
12599 status=`$cat try.err`
12600 case "$status" in
12601 0) echo "And it correctly returns 0 to signal EOF.";;
12602 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12603 *) echo "However, your read() returns '$status' on EOF??";;
12604 esac
12605 val="$define"
12606 if test "$status" = "$rd_nodata"; then
12607 echo "WARNING: you can't distinguish between EOF and no data!"
12608 val="$undef"
12609 fi
12610 else
12611 echo "I can't compile the test program--assuming errno EAGAIN will do."
12612 eagain=EAGAIN
12613 fi
4dd8f9b3
JH
12614 ;;
12615 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12616 eagain=EAGAIN
12617 val="$define"
12618 ;;
12619 esac
b4eb6b3d
JH
12620 set d_eofnblk
12621 eval $setvar
12622 ;;
12623*)
12624 echo "Using $hint value $eagain."
12625 echo "Your read() returns $rd_nodata when no data is present."
12626 case "$d_eofnblk" in
12627 "$define") echo "And you can see EOF because read() returns 0.";;
12628 "$undef") echo "But you can't see EOF status from read() returned value.";;
12629 *)
12630 echo "(Assuming you can't see EOF status from read anyway.)"
12631 d_eofnblk=$undef
12632 ;;
12633 esac
12634 ;;
12635esac
5b813a60 12636$rm_try head.c mtry
b4eb6b3d 12637
15b61c98
JH
12638: see if _ptr and _cnt from stdio act std
12639echo " "
b4eb6b3d 12640
15b61c98
JH
12641if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12642 echo "(Looks like you have stdio.h from BSD.)"
12643 case "$stdio_ptr" in
12644 '') stdio_ptr='((fp)->_p)'
12645 ptr_lval=$define
12646 ;;
12647 *) ptr_lval=$d_stdio_ptr_lval;;
12648 esac
12649 case "$stdio_cnt" in
12650 '') stdio_cnt='((fp)->_r)'
12651 cnt_lval=$define
12652 ;;
12653 *) cnt_lval=$d_stdio_cnt_lval;;
12654 esac
12655 case "$stdio_base" in
12656 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12657 esac
12658 case "$stdio_bufsiz" in
12659 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12660 esac
12661elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12662 echo "(Looks like you have stdio.h from Linux.)"
12663 case "$stdio_ptr" in
12664 '') stdio_ptr='((fp)->_IO_read_ptr)'
12665 ptr_lval=$define
12666 ;;
12667 *) ptr_lval=$d_stdio_ptr_lval;;
12668 esac
12669 case "$stdio_cnt" in
12670 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12671 cnt_lval=$undef
12672 ;;
12673 *) cnt_lval=$d_stdio_cnt_lval;;
12674 esac
12675 case "$stdio_base" in
12676 '') stdio_base='((fp)->_IO_read_base)';;
12677 esac
12678 case "$stdio_bufsiz" in
12679 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12680 esac
12681else
12682 case "$stdio_ptr" in
12683 '') stdio_ptr='((fp)->_ptr)'
12684 ptr_lval=$define
12685 ;;
12686 *) ptr_lval=$d_stdio_ptr_lval;;
12687 esac
12688 case "$stdio_cnt" in
12689 '') stdio_cnt='((fp)->_cnt)'
12690 cnt_lval=$define
12691 ;;
12692 *) cnt_lval=$d_stdio_cnt_lval;;
12693 esac
12694 case "$stdio_base" in
12695 '') stdio_base='((fp)->_base)';;
12696 esac
12697 case "$stdio_bufsiz" in
12698 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12699 esac
12700fi
b4eb6b3d 12701
15b61c98
JH
12702: test whether _ptr and _cnt really work
12703echo "Checking how std your stdio is..." >&4
12704$cat >try.c <<EOP
12705#include <stdio.h>
55954f19
JH
12706#$i_stdlib I_STDLIB
12707#ifdef I_STDLIB
9d9004a9 12708#include <stdlib.h>
55954f19 12709#endif
15b61c98
JH
12710#define FILE_ptr(fp) $stdio_ptr
12711#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12712int main() {
15b61c98
JH
12713 FILE *fp = fopen("try.c", "r");
12714 char c = getc(fp);
12715 if (
12716 18 <= FILE_cnt(fp) &&
12717 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12718 )
12719 exit(0);
12720 exit(1);
9d9004a9 12721}
15b61c98
JH
12722EOP
12723val="$undef"
12724set try
12725if eval $compile && $to try.c; then
12726 if $run ./try; then
12727 echo "Your stdio acts pretty std."
12728 val="$define"
9d9004a9 12729 else
15b61c98 12730 echo "Your stdio isn't very std."
9d9004a9 12731 fi
15b61c98
JH
12732else
12733 echo "Your stdio doesn't appear very std."
12734fi
5b813a60 12735$rm_try
15b61c98
JH
12736
12737# glibc 2.2.90 and above apparently change stdio streams so Perl's
12738# direct buffer manipulation no longer works. The Configure tests
12739# should be changed to correctly detect this, but until then,
12740# the following check should at least let perl compile and run.
12741# (This quick fix should be updated before 5.8.1.)
12742# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12743# A. Dougherty, June 3, 2002.
12744case "$d_gnulibc" in
12745$define)
12746 case "$gnulibc_version" in
12747 2.[01]*) ;;
12748 2.2) ;;
12749 2.2.[0-9]) ;;
12750 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12751 val="$undef"
12752 ;;
12753 esac
9d9004a9
AD
12754 ;;
12755esac
15b61c98 12756set d_stdstdio
9d9004a9 12757eval $setvar
9d9004a9 12758
15b61c98
JH
12759: Can _ptr be used as an lvalue?
12760case "$d_stdstdio$ptr_lval" in
12761$define$define) val=$define ;;
12762*) val=$undef ;;
12763esac
12764set d_stdio_ptr_lval
12765eval $setvar
9d9004a9 12766
15b61c98
JH
12767: Can _cnt be used as an lvalue?
12768case "$d_stdstdio$cnt_lval" in
12769$define$define) val=$define ;;
12770*) val=$undef ;;
12771esac
12772set d_stdio_cnt_lval
12773eval $setvar
b4eb6b3d 12774
15b61c98
JH
12775
12776: test whether setting _ptr sets _cnt as a side effect
12777d_stdio_ptr_lval_sets_cnt="$undef"
12778d_stdio_ptr_lval_nochange_cnt="$undef"
12779case "$d_stdio_ptr_lval$d_stdstdio" in
12780$define$define)
12781 echo "Checking to see what happens if we set the stdio ptr..." >&4
12782$cat >try.c <<EOP
12783#include <stdio.h>
12784/* Can we scream? */
12785/* Eat dust sed :-) */
12786/* In the buffer space, no one can hear you scream. */
55954f19
JH
12787#$i_stdlib I_STDLIB
12788#ifdef I_STDLIB
12789#include <stdlib.h>
12790#endif
15b61c98
JH
12791#define FILE_ptr(fp) $stdio_ptr
12792#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12793#include <sys/types.h>
b4eb6b3d 12794int main() {
15b61c98
JH
12795 FILE *fp = fopen("try.c", "r");
12796 int c;
12797 char *ptr;
12798 size_t cnt;
12799 if (!fp) {
12800 puts("Fail even to read");
12801 exit(1);
12802 }
12803 c = getc(fp); /* Read away the first # */
12804 if (c == EOF) {
12805 puts("Fail even to read");
12806 exit(1);
12807 }
12808 if (!(
12809 18 <= FILE_cnt(fp) &&
12810 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12811 )) {
12812 puts("Fail even to read");
12813 exit (1);
12814 }
12815 ptr = (char*) FILE_ptr(fp);
12816 cnt = (size_t)FILE_cnt(fp);
12817
12818 FILE_ptr(fp) += 42;
12819
12820 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12821 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12822 exit (1);
12823 }
12824 if (FILE_cnt(fp) <= 20) {
12825 printf ("Fail (<20 chars to test)");
12826 exit (1);
12827 }
12828 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12829 puts("Fail compare");
12830 exit (1);
12831 }
12832 if (cnt == FILE_cnt(fp)) {
12833 puts("Pass_unchanged");
12834 exit (0);
5b813a60 12835 }
15b61c98
JH
12836 if (FILE_cnt(fp) == (cnt - 42)) {
12837 puts("Pass_changed");
12838 exit (0);
12839 }
12840 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12841 return 1;
12842
12843}
12844EOP
12845 set try
12846 if eval $compile && $to try.c; then
12847 case `$run ./try` in
12848 Pass_changed)
12849 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12850 d_stdio_ptr_lval_sets_cnt="$define" ;;
12851 Pass_unchanged)
12852 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12853 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12854 Fail*)
12855 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12856 *)
12857 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12858 esac
12859 else
12860 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12861 fi
5b813a60 12862 $rm_try
15b61c98
JH
12863 ;;
12864esac
12865
12866: see if _base is also standard
12867val="$undef"
12868case "$d_stdstdio" in
12869$define)
12870 $cat >try.c <<EOP
12871#include <stdio.h>
12872#$i_stdlib I_STDLIB
12873#ifdef I_STDLIB
12874#include <stdlib.h>
12875#endif
12876#define FILE_base(fp) $stdio_base
12877#define FILE_bufsiz(fp) $stdio_bufsiz
12878int main() {
12879 FILE *fp = fopen("try.c", "r");
12880 char c = getc(fp);
12881 if (
12882 19 <= FILE_bufsiz(fp) &&
12883 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12884 )
12885 exit(0);
12886 exit(1);
12887}
12888EOP
12889 set try
12890 if eval $compile && $to try.c; then
12891 if $run ./try; then
12892 echo "And its _base field acts std."
12893 val="$define"
12894 else
12895 echo "But its _base field isn't std."
12896 fi
12897 else
12898 echo "However, it seems to be lacking the _base field."
12899 fi
5b813a60 12900 $rm_try
15b61c98
JH
12901 ;;
12902esac
12903set d_stdiobase
12904eval $setvar
12905
12906: see if fast_stdio exists
12907val="$undef"
12908case "$d_stdstdio:$d_stdio_ptr_lval" in
12909"$define:$define")
12910 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12911 *$define*)
12912 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12913 val="$define"
12914 ;;
12915 esac
12916 ;;
12917esac
12918set d_faststdio
12919eval $setvar
12920
12921
12922
12923: see if fchdir exists
12924set fchdir d_fchdir
12925eval $inlibc
12926
12927: see if fchmod exists
12928set fchmod d_fchmod
12929eval $inlibc
12930
12931: see if fchown exists
12932set fchown d_fchown
12933eval $inlibc
12934
12935: see if this is an fcntl system
12936set fcntl d_fcntl
12937eval $inlibc
12938
15b61c98 12939: See if fcntl-based locking works.
613d6c3e 12940echo " "
15b61c98
JH
12941$cat >try.c <<EOCP
12942#$i_stdlib I_STDLIB
12943#ifdef I_STDLIB
12944#include <stdlib.h>
12945#endif
12946#include <unistd.h>
12947#include <fcntl.h>
12948#include <signal.h>
7090f861 12949$signal_t blech(int x) { exit(3); }
15b61c98
JH
12950int main() {
12951#if defined(F_SETLK) && defined(F_SETLKW)
12952 struct flock flock;
12953 int retval, fd;
12954 fd = open("try.c", O_RDONLY);
12955 flock.l_type = F_RDLCK;
12956 flock.l_whence = SEEK_SET;
12957 flock.l_start = flock.l_len = 0;
12958 signal(SIGALRM, blech);
12959 alarm(10);
12960 retval = fcntl(fd, F_SETLK, &flock);
12961 close(fd);
12962 (retval < 0 ? exit(2) : exit(0));
12963#else
12964 exit(2);
12965#endif
12966}
12967EOCP
12968echo "Checking if fcntl-based file locking works... "
12969case "$d_fcntl" in
12970"$define")
12971 set try
12972 if eval $compile_ok; then
12973 if $run ./try; then
12974 echo "Yes, it seems to work."
12975 val="$define"
12976 else
12977 echo "Nope, it didn't work."
12978 val="$undef"
12979 case "$?" in
12980 3) $cat >&4 <<EOM
12981***
12982*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12983*** This is (almost) impossible.
12984*** If your NFS lock daemons are not feeling well, something like
12985*** this may happen, please investigate. Cannot continue, aborting.
12986***
12987EOM
12988 exit 1
12989 ;;
12990 esac
12991 fi
12992 else
12993 echo "I'm unable to compile the test program, so I'll assume not."
12994 val="$undef"
12995 fi
12996 ;;
12997*) val="$undef";
12998 echo "Nope, since you don't even have fcntl()."
12999 ;;
13000esac
13001set d_fcntl_can_lock
13002eval $setvar
5b813a60 13003$rm_try
15b61c98
JH
13004
13005: check for fd_set items
13006$cat <<EOM
13007
13008Checking to see how well your C compiler handles fd_set and friends ...
13009EOM
13010$cat >try.c <<EOCP
13011#$i_stdlib I_STDLIB
13012#ifdef I_STDLIB
13013#include <stdlib.h>
13014#endif
13015#$i_systime I_SYS_TIME
13016#$i_sysselct I_SYS_SELECT
13017#$d_socket HAS_SOCKET
13018#include <sys/types.h>
13019#ifdef HAS_SOCKET
13020#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13021#endif
13022#ifdef I_SYS_TIME
13023#include <sys/time.h>
13024#endif
13025#ifdef I_SYS_SELECT
13026#include <sys/select.h>
13027#endif
13028int main() {
13029 fd_set fds;
13030
13031#ifdef TRYBITS
13032 if(fds.fds_bits);
13033#endif
13034
13035#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13036 exit(0);
13037#else
13038 exit(1);
13039#endif
13040}
13041EOCP
13042set try -DTRYBITS
13043if eval $compile; then
13044 d_fds_bits="$define"
13045 d_fd_set="$define"
13046 echo "Well, your system knows about the normal fd_set typedef..." >&4
13047 if $run ./try; then
b4eb6b3d
JH
13048 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13049 d_fd_macros="$define"
13050 else
13051 $cat >&4 <<'EOM'
13052but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13053EOM
13054 d_fd_macros="$undef"
13055 fi
13056else
13057 $cat <<'EOM'
13058Hmm, your compiler has some difficulty with fd_set. Checking further...
13059EOM
5440bc8e 13060 set try
b4eb6b3d
JH
13061 if eval $compile; then
13062 d_fds_bits="$undef"
13063 d_fd_set="$define"
13064 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 13065 if $run ./try; then
b4eb6b3d
JH
13066 echo "and you have the normal fd_set macros." >&4
13067 d_fd_macros="$define"
13068 else
13069 $cat <<'EOM'
13070but not the normal fd_set macros! Gross! More work for me...
13071EOM
13072 d_fd_macros="$undef"
13073 fi
13074 else
13075 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13076 d_fd_set="$undef"
13077 d_fds_bits="$undef"
13078 d_fd_macros="$undef"
13079 fi
13080fi
5b813a60 13081$rm_try
b4eb6b3d
JH
13082
13083: see if fgetpos exists
13084set fgetpos d_fgetpos
13085eval $inlibc
13086
758a5d79
JH
13087: see if finite exists
13088set finite d_finite
13089eval $inlibc
13090
13091: see if finitel exists
13092set finitel d_finitel
13093eval $inlibc
13094
b4eb6b3d
JH
13095: see if flock exists
13096set flock d_flock
13097eval $inlibc
13098
2ef53570
JH
13099: see if prototype for flock is available
13100echo " "
13101set d_flockproto flock $i_sysfile sys/file.h
13102eval $hasproto
13103
758a5d79
JH
13104: see if fp_class exists
13105set fp_class d_fp_class
13106eval $inlibc
13107
b4eb6b3d
JH
13108: see if pathconf exists
13109set pathconf d_pathconf
13110eval $inlibc
13111
13112: see if fpathconf exists
13113set fpathconf d_fpathconf
13114eval $inlibc
13115
758a5d79
JH
13116: see if fpclass exists
13117set fpclass d_fpclass
13118eval $inlibc
13119
13120: see if fpclassify exists
13121set fpclassify d_fpclassify
13122eval $inlibc
13123
13124: see if fpclassl exists
13125set fpclassl d_fpclassl
13126eval $inlibc
13127
b4eb6b3d
JH
13128: check for fpos64_t
13129echo " "
13130echo "Checking to see if you have fpos64_t..." >&4
13131$cat >try.c <<EOCP
13132#include <stdio.h>
13133int main() { fpos64_t x = 7; }
13134EOCP
13135set try
13136if eval $compile; then
13137 val="$define"
13138 echo "You have fpos64_t."
13139else
13140 val="$undef"
13141 echo "You do not have fpos64_t."
13142 case "$fpossize" in
13143 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13144 esac
13145fi
5b813a60 13146$rm_try
b4eb6b3d
JH
13147set d_fpos64_t
13148eval $setvar
13149
13150: see if frexpl exists
13151set frexpl d_frexpl
13152eval $inlibc
13153
b4eb6b3d
JH
13154: see if this is a sys/param system
13155set sys/param.h i_sysparam
13156eval $inhdr
13157
13158: see if this is a sys/mount.h system
13159set sys/mount.h i_sysmount
13160eval $inhdr
13161
34f1896b 13162: Check for fs_data_s
b4eb6b3d
JH
13163echo " "
13164echo "Checking to see if your system supports struct fs_data..." >&4
13165set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13166eval $hasstruct
13167case "$d_fs_data_s" in
13168"$define") echo "Yes, it does." ;;
13169*) echo "No, it doesn't." ;;
13170esac
13171
13172: see if fseeko exists
13173set fseeko d_fseeko
13174eval $inlibc
13175case "$longsize" in
131768) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13177esac
13178
13179: see if fsetpos exists
13180set fsetpos d_fsetpos
13181eval $inlibc
13182
b4eb6b3d
JH
13183: see if fstatfs exists
13184set fstatfs d_fstatfs
13185eval $inlibc
13186
b4eb6b3d
JH
13187: see if statvfs exists
13188set statvfs d_statvfs
13189eval $inlibc
13190
13191: see if fstatvfs exists
13192set fstatvfs d_fstatvfs
13193eval $inlibc
13194
13195
411ab01c
JH
13196: see if fsync exists
13197set fsync d_fsync
13198eval $inlibc
13199
b4eb6b3d
JH
13200: see if ftello exists
13201set ftello d_ftello
13202eval $inlibc
13203case "$longsize" in
132048) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13205esac
13206
bff98e24 13207: check for a working futimes
613d6c3e 13208d_futimes="$undef"
bff98e24 13209echo " "
5b813a60 13210echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13211$cat >try.c <<EOCP
13212#include <stdio.h>
13213#include <sys/time.h>
13214#include <errno.h>
13215#include <fcntl.h>
13216
13217int main ()
13218{
13219 int fd, rv;
13220 fd = open ("try.c", O_RDWR);
13221 if (-1 == fd) exit (1);
13222 rv = futimes (fd, NULL);
13223 exit (rv == -1 ? errno : 0);
13224}
13225EOCP
13226set try
13227if eval $compile; then
13228 `$run ./try`
13229 rc=$?
13230 case "$rc" in
5b813a60 13231 0) echo "Yes, you have" >&4
bff98e24
SP
13232 d_futimes="$define"
13233 ;;
5b813a60 13234 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13235 ;;
13236 esac
13237else
43dddb59 13238 echo "No, it does not (probably harmless)" >&4
bff98e24 13239fi
5b813a60 13240$rm_try
dc814df1 13241
b4eb6b3d
JH
13242: see if getcwd exists
13243set getcwd d_getcwd
13244eval $inlibc
13245
13246: see if getespwnam exists
13247set getespwnam d_getespwnam
13248eval $inlibc
13249
b4eb6b3d
JH
13250: see if getfsstat exists
13251set getfsstat d_getfsstat
13252eval $inlibc
13253
13254: see if getgrent exists
13255set getgrent d_getgrent
13256eval $inlibc
13257
10bc17b6
JH
13258: see if getgrent_r exists
13259set getgrent_r d_getgrent_r
13260eval $inlibc
13261case "$d_getgrent_r" in
13262"$define")
13263 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13264 case "$d_getgrent_r_proto:$usethreads" in
13265 ":define") d_getgrent_r_proto=define
a48ec845
JH
13266 set d_getgrent_r_proto getgrent_r $hdrs
13267 eval $hasproto ;;
13268 *) ;;
13269 esac
13270 case "$d_getgrent_r_proto" in
13271 define)
10bc17b6
JH
13272 case "$getgrent_r_proto" in
13273 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13274 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13275 esac
13276 case "$getgrent_r_proto" in
13277 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13278 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13279 esac
13280 case "$getgrent_r_proto" in
13281 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13282 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13283 esac
13284 case "$getgrent_r_proto" in
13285 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13286 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13287 esac
13288 case "$getgrent_r_proto" in
13289 ''|0) try='int getgrent_r(struct group*, char*, int);'
13290 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13291 esac
13292 case "$getgrent_r_proto" in
13293 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13294 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13295 esac
13296 case "$getgrent_r_proto" in
90e831dc 13297 ''|0) d_getgrent_r=undef
10bc17b6 13298 getgrent_r_proto=0
a48ec845 13299 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13300 * ) case "$getgrent_r_proto" in
13301 REENTRANT_PROTO*) ;;
13302 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13303 esac
13304 echo "Prototype: $try" ;;
13305 esac
13306 ;;
c18e646a
JH
13307 *) case "$usethreads" in
13308 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13309 esac
90e831dc
SB
13310 d_getgrent_r=undef
13311 getgrent_r_proto=0
c18e646a 13312 ;;
a48ec845
JH
13313 esac
13314 ;;
10bc17b6
JH
13315*) getgrent_r_proto=0
13316 ;;
13317esac
13318
13319: see if getgrgid_r exists
13320set getgrgid_r d_getgrgid_r
13321eval $inlibc
13322case "$d_getgrgid_r" in
13323"$define")
13324 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13325 case "$d_getgrgid_r_proto:$usethreads" in
13326 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13327 set d_getgrgid_r_proto getgrgid_r $hdrs
13328 eval $hasproto ;;
13329 *) ;;
13330 esac
13331 case "$d_getgrgid_r_proto" in
13332 define)
10bc17b6
JH
13333 case "$getgrgid_r_proto" in
13334 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13335 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13336 esac
13337 case "$getgrgid_r_proto" in
13338 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13339 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13340 esac
13341 case "$getgrgid_r_proto" in
13342 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13343 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13344 esac
13345 case "$getgrgid_r_proto" in
13346 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13347 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13348 esac
13349 case "$getgrgid_r_proto" in
90e831dc 13350 ''|0) d_getgrgid_r=undef
10bc17b6 13351 getgrgid_r_proto=0
a48ec845 13352 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13353 * ) case "$getgrgid_r_proto" in
13354 REENTRANT_PROTO*) ;;
13355 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13356 esac
13357 echo "Prototype: $try" ;;
13358 esac
13359 ;;
c18e646a
JH
13360 *) case "$usethreads" in
13361 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13362 esac
90e831dc
SB
13363 d_getgrgid_r=undef
13364 getgrgid_r_proto=0
c18e646a 13365 ;;
a48ec845
JH
13366 esac
13367 ;;
10bc17b6
JH
13368*) getgrgid_r_proto=0
13369 ;;
13370esac
13371
13372: see if getgrnam_r exists
13373set getgrnam_r d_getgrnam_r
13374eval $inlibc
13375case "$d_getgrnam_r" in
13376"$define")
13377 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13378 case "$d_getgrnam_r_proto:$usethreads" in
13379 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13380 set d_getgrnam_r_proto getgrnam_r $hdrs
13381 eval $hasproto ;;
13382 *) ;;
13383 esac
13384 case "$d_getgrnam_r_proto" in
13385 define)
10bc17b6
JH
13386 case "$getgrnam_r_proto" in
13387 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13388 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13389 esac
13390 case "$getgrnam_r_proto" in
13391 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13392 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13393 esac
13394 case "$getgrnam_r_proto" in
13395 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13396 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13397 esac
13398 case "$getgrnam_r_proto" in
13399 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13400 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13401 esac
13402 case "$getgrnam_r_proto" in
13403 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13404 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13405 esac
13406 case "$getgrnam_r_proto" in
90e831dc 13407 ''|0) d_getgrnam_r=undef
10bc17b6 13408 getgrnam_r_proto=0
a48ec845 13409 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13410 * ) case "$getgrnam_r_proto" in
13411 REENTRANT_PROTO*) ;;
13412 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13413 esac
13414 echo "Prototype: $try" ;;
13415 esac
13416 ;;
c18e646a
JH
13417 *) case "$usethreads" in
13418 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13419 esac
90e831dc
SB
13420 d_getgrnam_r=undef
13421 getgrnam_r_proto=0
c18e646a 13422 ;;
a48ec845
JH
13423 esac
13424 ;;
10bc17b6
JH
13425*) getgrnam_r_proto=0
13426 ;;
13427esac
13428
b4eb6b3d
JH
13429: see if gethostbyaddr exists
13430set gethostbyaddr d_gethbyaddr
13431eval $inlibc
13432
13433: see if gethostbyname exists
13434set gethostbyname d_gethbyname
13435eval $inlibc
13436
13437: see if gethostent exists
13438set gethostent d_gethent
13439eval $inlibc
13440
13441: see how we will look up host name
13442echo " "
13443call=''
13444if set gethostname val -f d_gethname; eval $csym; $val; then
13445 echo 'gethostname() found.' >&4
13446 d_gethname="$define"
13447 call=gethostname
13448fi
13449if set uname val -f d_uname; eval $csym; $val; then
13450 if ./xenix; then
13451 $cat <<'EOM'
13452uname() was found, but you're running xenix, and older versions of xenix
13453have a broken uname(). If you don't really know whether your xenix is old
13454enough to have a broken system call, use the default answer.
13455
13456EOM
13457 dflt=y
13458 case "$d_uname" in
13459 "$define") dflt=n;;
13460 esac
13461 rp='Is your uname() broken?'
13462 . ./myread
13463 case "$ans" in
13464 n*) d_uname="$define"; call=uname;;
13465 esac
13466 else
13467 echo 'uname() found.' >&4
13468 d_uname="$define"
13469 case "$call" in
13470 '') call=uname ;;
13471 esac
13472 fi
13473fi
13474case "$d_gethname" in
13475'') d_gethname="$undef";;
13476esac
13477case "$d_uname" in
13478'') d_uname="$undef";;
13479esac
13480case "$d_uname$d_gethname" in
13481*define*)
13482 dflt=n
13483 cat <<EOM
613d6c3e 13484
b4eb6b3d
JH
13485Every now and then someone has a $call() that lies about the hostname
13486but can't be fixed for political or economic reasons. If you wish, I can
13487pretend $call() isn't there and maybe compute hostname at run-time
13488thanks to the '$phostname' command.
13489
13490EOM
13491 rp="Shall I ignore $call() from now on?"
13492 . ./myread
13493 case "$ans" in
13494 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13495 esac;;
13496esac
13497case "$phostname" in
13498'') aphostname='';;
13499*) case "$aphostname" in
13500 /*) ;;
13501 *) set X $phostname
13502 shift
13503 file=$1
13504 shift
13505 file=`./loc $file $file $pth`
13506 aphostname=`echo $file $*`
13507 ;;
13508 esac
13509 ;;
13510esac
13511case "$d_uname$d_gethname" in
13512*define*) ;;
13513*)
13514 case "$phostname" in
13515 '')
13516 echo "There will be no way for $package to get your hostname." >&4;;
13517 *)
13518 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13519 ;;
13520 esac;;
13521esac
13522case "$d_phostname" in
13523'') d_phostname="$undef";;
13524esac
13525
10bc17b6
JH
13526: see if gethostbyaddr_r exists
13527set gethostbyaddr_r d_gethostbyaddr_r
13528eval $inlibc
13529case "$d_gethostbyaddr_r" in
13530"$define")
13531 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13532 case "$d_gethostbyaddr_r_proto:$usethreads" in
13533 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13534 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13535 eval $hasproto ;;
13536 *) ;;
13537 esac
13538 case "$d_gethostbyaddr_r_proto" in
13539 define)
10bc17b6
JH
13540 case "$gethostbyaddr_r_proto" in
13541 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13542 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13543 esac
13544 case "$gethostbyaddr_r_proto" in
13545 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13546 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13547 esac
13548 case "$gethostbyaddr_r_proto" in
13549 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13550 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13551 esac
13552 case "$gethostbyaddr_r_proto" in
13553 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13554 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13555 esac
13556 case "$gethostbyaddr_r_proto" in
13557 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13558 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13559 esac
13560 case "$gethostbyaddr_r_proto" in
13561 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13562 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13563 esac
13564 case "$gethostbyaddr_r_proto" in
13565 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13566 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13567 esac
13568 case "$gethostbyaddr_r_proto" in
13569 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13570 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13571 esac
13572 case "$gethostbyaddr_r_proto" in
13573 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13574 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13575 esac
13576 case "$gethostbyaddr_r_proto" in
13577 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13578 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13579 esac
13580 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
13581 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13582 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13583 esac
13584 case "$gethostbyaddr_r_proto" in
90e831dc 13585 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13586 gethostbyaddr_r_proto=0
a48ec845 13587 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13588 * ) case "$gethostbyaddr_r_proto" in
13589 REENTRANT_PROTO*) ;;
13590 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13591 esac
13592 echo "Prototype: $try" ;;
13593 esac
13594 ;;
c18e646a
JH
13595 *) case "$usethreads" in
13596 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13597 esac
90e831dc
SB
13598 d_gethostbyaddr_r=undef
13599 gethostbyaddr_r_proto=0
c18e646a 13600 ;;
a48ec845
JH
13601 esac
13602 ;;
10bc17b6
JH
13603*) gethostbyaddr_r_proto=0
13604 ;;
13605esac
13606
13607: see if gethostbyname_r exists
13608set gethostbyname_r d_gethostbyname_r
13609eval $inlibc
13610case "$d_gethostbyname_r" in
13611"$define")
13612 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13613 case "$d_gethostbyname_r_proto:$usethreads" in
13614 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13615 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13616 eval $hasproto ;;
13617 *) ;;
13618 esac
13619 case "$d_gethostbyname_r_proto" in
13620 define)
10bc17b6
JH
13621 case "$gethostbyname_r_proto" in
13622 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13623 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13624 esac
13625 case "$gethostbyname_r_proto" in
13626 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13627 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13628 esac
13629 case "$gethostbyname_r_proto" in
13630 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13631 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13632 esac
13633 case "$gethostbyname_r_proto" in
90e831dc 13634 ''|0) d_gethostbyname_r=undef
10bc17b6 13635 gethostbyname_r_proto=0
a48ec845 13636 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13637 * ) case "$gethostbyname_r_proto" in
13638 REENTRANT_PROTO*) ;;
13639 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13640 esac
13641 echo "Prototype: $try" ;;
13642 esac
13643 ;;
c18e646a
JH
13644 *) case "$usethreads" in
13645 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13646 esac
90e831dc
SB
13647 d_gethostbyname_r=undef
13648 gethostbyname_r_proto=0
c18e646a 13649 ;;
a48ec845
JH
13650 esac
13651 ;;
10bc17b6
JH
13652*) gethostbyname_r_proto=0
13653 ;;
13654esac
13655
13656: see if gethostent_r exists
13657set gethostent_r d_gethostent_r
13658eval $inlibc
13659case "$d_gethostent_r" in
13660"$define")
13661 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13662 case "$d_gethostent_r_proto:$usethreads" in
13663 ":define") d_gethostent_r_proto=define
a48ec845
JH
13664 set d_gethostent_r_proto gethostent_r $hdrs
13665 eval $hasproto ;;
13666 *) ;;
13667 esac
13668 case "$d_gethostent_r_proto" in
13669 define)
10bc17b6
JH
13670 case "$gethostent_r_proto" in
13671 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13672 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13673 esac
13674 case "$gethostent_r_proto" in
13675 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13676 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13677 esac
13678 case "$gethostent_r_proto" in
13679 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13680 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13681 esac
13682 case "$gethostent_r_proto" in
13683 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13684 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13685 esac
13686 case "$gethostent_r_proto" in
13687 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13688 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13689 esac
13690 case "$gethostent_r_proto" in
13691 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13692 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13693 esac
13694 case "$gethostent_r_proto" in
90e831dc 13695 ''|0) d_gethostent_r=undef
10bc17b6 13696 gethostent_r_proto=0
a48ec845 13697 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13698 * ) case "$gethostent_r_proto" in
13699 REENTRANT_PROTO*) ;;
13700 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13701 esac
13702 echo "Prototype: $try" ;;
13703 esac
13704 ;;
c18e646a
JH
13705 *) case "$usethreads" in
13706 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13707 esac
90e831dc
SB
13708 d_gethostent_r=undef
13709 gethostent_r_proto=0
c18e646a 13710 ;;
a48ec845
JH
13711 esac
13712 ;;
10bc17b6
JH
13713*) gethostent_r_proto=0
13714 ;;
13715esac
b4eb6b3d
JH
13716
13717: see if prototypes for various gethostxxx netdb.h functions are available
13718echo " "
13719set d_gethostprotos gethostent $i_netdb netdb.h
13720eval $hasproto
13721
4e0554ec
JH
13722: see if getitimer exists
13723set getitimer d_getitimer
13724eval $inlibc
13725
b4eb6b3d
JH
13726: see if getlogin exists
13727set getlogin d_getlogin
13728eval $inlibc
13729
10bc17b6
JH
13730: see if getlogin_r exists
13731set getlogin_r d_getlogin_r
13732eval $inlibc
13733case "$d_getlogin_r" in
13734"$define")
13735 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13736 case "$d_getlogin_r_proto:$usethreads" in
13737 ":define") d_getlogin_r_proto=define
a48ec845
JH
13738 set d_getlogin_r_proto getlogin_r $hdrs
13739 eval $hasproto ;;
13740 *) ;;
13741 esac
13742 case "$d_getlogin_r_proto" in
13743 define)
10bc17b6
JH
13744 case "$getlogin_r_proto" in
13745 ''|0) try='int getlogin_r(char*, size_t);'
13746 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13747 esac
13748 case "$getlogin_r_proto" in
13749 ''|0) try='int getlogin_r(char*, int);'
13750 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13751 esac
13752 case "$getlogin_r_proto" in
13753 ''|0) try='char* getlogin_r(char*, size_t);'
13754 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13755 esac
13756 case "$getlogin_r_proto" in
13757 ''|0) try='char* getlogin_r(char*, int);'
13758 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13759 esac
13760 case "$getlogin_r_proto" in
90e831dc 13761 ''|0) d_getlogin_r=undef
10bc17b6 13762 getlogin_r_proto=0
a48ec845 13763 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13764 * ) case "$getlogin_r_proto" in
13765 REENTRANT_PROTO*) ;;
13766 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13767 esac
13768 echo "Prototype: $try" ;;
13769 esac
13770 ;;
c18e646a
JH
13771 *) case "$usethreads" in
13772 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13773 esac
90e831dc
SB
13774 d_getlogin_r=undef
13775 getlogin_r_proto=0
c18e646a 13776 ;;
a48ec845
JH
13777 esac
13778 ;;
10bc17b6
JH
13779*) getlogin_r_proto=0
13780 ;;
13781esac
13782
b4eb6b3d
JH
13783: see if getmnt exists
13784set getmnt d_getmnt
13785eval $inlibc
13786
13787: see if getmntent exists
13788set getmntent d_getmntent
13789eval $inlibc
13790
13791: see if getnetbyaddr exists
13792set getnetbyaddr d_getnbyaddr
13793eval $inlibc
13794
13795: see if getnetbyname exists
13796set getnetbyname d_getnbyname
13797eval $inlibc
13798
13799: see if getnetent exists
13800set getnetent d_getnent
13801eval $inlibc
13802
10bc17b6
JH
13803: see if getnetbyaddr_r exists
13804set getnetbyaddr_r d_getnetbyaddr_r
13805eval $inlibc
13806case "$d_getnetbyaddr_r" in
13807"$define")
13808 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13809 case "$d_getnetbyaddr_r_proto:$usethreads" in
13810 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13811 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13812 eval $hasproto ;;
13813 *) ;;
13814 esac
13815 case "$d_getnetbyaddr_r_proto" in
13816 define)
10bc17b6
JH
13817 case "$getnetbyaddr_r_proto" in
13818 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13819 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13820 esac
13821 case "$getnetbyaddr_r_proto" in
13822 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13823 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13824 esac
13825 case "$getnetbyaddr_r_proto" in
13826 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13827 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13828 esac
13829 case "$getnetbyaddr_r_proto" in
13830 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13831 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13832 esac
13833 case "$getnetbyaddr_r_proto" in
13834 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13835 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13836 esac
13837 case "$getnetbyaddr_r_proto" in
13838 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13839 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13840 esac
13841 case "$getnetbyaddr_r_proto" in
13842 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13843 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13844 esac
13845 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13846 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13847 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13848 esac
13849 case "$getnetbyaddr_r_proto" in
90e831dc 13850 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13851 getnetbyaddr_r_proto=0
a48ec845 13852 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13853 * ) case "$getnetbyaddr_r_proto" in
13854 REENTRANT_PROTO*) ;;
13855 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13856 esac
13857 echo "Prototype: $try" ;;
13858 esac
13859 ;;
c18e646a
JH
13860 *) case "$usethreads" in
13861 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13862 esac
90e831dc
SB
13863 d_getnetbyaddr_r=undef
13864 getnetbyaddr_r_proto=0
c18e646a 13865 ;;
a48ec845
JH
13866 esac
13867 ;;
10bc17b6
JH
13868*) getnetbyaddr_r_proto=0
13869 ;;
13870esac
13871
13872: see if getnetbyname_r exists
13873set getnetbyname_r d_getnetbyname_r
13874eval $inlibc
13875case "$d_getnetbyname_r" in
13876"$define")
13877 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13878 case "$d_getnetbyname_r_proto:$usethreads" in
13879 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13880 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13881 eval $hasproto ;;
13882 *) ;;
13883 esac
13884 case "$d_getnetbyname_r_proto" in
13885 define)
10bc17b6
JH
13886 case "$getnetbyname_r_proto" in
13887 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13888 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13889 esac
13890 case "$getnetbyname_r_proto" in
13891 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13892 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13893 esac
13894 case "$getnetbyname_r_proto" in
13895 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13896 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13897 esac
13898 case "$getnetbyname_r_proto" in
13899 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13900 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13901 esac
13902 case "$getnetbyname_r_proto" in
90e831dc 13903 ''|0) d_getnetbyname_r=undef
10bc17b6 13904 getnetbyname_r_proto=0
a48ec845 13905 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13906 * ) case "$getnetbyname_r_proto" in
13907 REENTRANT_PROTO*) ;;
13908 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13909 esac
13910 echo "Prototype: $try" ;;
13911 esac
13912 ;;
c18e646a
JH
13913 *) case "$usethreads" in
13914 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13915 esac
90e831dc
SB
13916 d_getnetbyname_r=undef
13917 getnetbyname_r_proto=0
c18e646a 13918 ;;
a48ec845
JH
13919 esac
13920 ;;
10bc17b6
JH
13921*) getnetbyname_r_proto=0
13922 ;;
13923esac
13924
13925: see if getnetent_r exists
13926set getnetent_r d_getnetent_r
13927eval $inlibc
13928case "$d_getnetent_r" in
13929"$define")
13930 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13931 case "$d_getnetent_r_proto:$usethreads" in
13932 ":define") d_getnetent_r_proto=define
a48ec845
JH
13933 set d_getnetent_r_proto getnetent_r $hdrs
13934 eval $hasproto ;;
13935 *) ;;
13936 esac
13937 case "$d_getnetent_r_proto" in
13938 define)
10bc17b6
JH
13939 case "$getnetent_r_proto" in
13940 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13941 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13942 esac
13943 case "$getnetent_r_proto" in
13944 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13945 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13946 esac
13947 case "$getnetent_r_proto" in
13948 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13949 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13950 esac
13951 case "$getnetent_r_proto" in
13952 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13953 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13954 esac
13955 case "$getnetent_r_proto" in
13956 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13957 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13958 esac
13959 case "$getnetent_r_proto" in
13960 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13961 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13962 esac
13963 case "$getnetent_r_proto" in
90e831dc 13964 ''|0) d_getnetent_r=undef
10bc17b6 13965 getnetent_r_proto=0
a48ec845 13966 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13967 * ) case "$getnetent_r_proto" in
13968 REENTRANT_PROTO*) ;;
13969 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13970 esac
13971 echo "Prototype: $try" ;;
13972 esac
13973 ;;
c18e646a
JH
13974 *) case "$usethreads" in
13975 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13976 esac
90e831dc
SB
13977 d_getnetent_r=undef
13978 getnetent_r_proto=0
c18e646a 13979 ;;
a48ec845
JH
13980 esac
13981 ;;
10bc17b6
JH
13982*) getnetent_r_proto=0
13983 ;;
13984esac
13985
b4eb6b3d
JH
13986: see if prototypes for various getnetxxx netdb.h functions are available
13987echo " "
13988set d_getnetprotos getnetent $i_netdb netdb.h
13989eval $hasproto
13990
0c0643d0
JH
13991: see if getpagesize exists
13992set getpagesize d_getpagsz
13993eval $inlibc
13994
34f1896b 13995: Optional checks for getprotobyname and getprotobynumber
b4eb6b3d
JH
13996
13997: see if getprotobyname exists
13998set getprotobyname d_getpbyname
13999eval $inlibc
14000
14001: see if getprotobynumber exists
14002set getprotobynumber d_getpbynumber
14003eval $inlibc
14004
14005: see if getprotoent exists
14006set getprotoent d_getpent
14007eval $inlibc
14008
14009: see if getpgid exists
14010set getpgid d_getpgid
14011eval $inlibc
14012
14013: see if getpgrp2 exists
14014set getpgrp2 d_getpgrp2
14015eval $inlibc
14016
14017: see if getppid exists
14018set getppid d_getppid
14019eval $inlibc
14020
14021: see if getpriority exists
14022set getpriority d_getprior
14023eval $inlibc
14024
10bc17b6
JH
14025: see if getprotobyname_r exists
14026set getprotobyname_r d_getprotobyname_r
14027eval $inlibc
14028case "$d_getprotobyname_r" in
14029"$define")
14030 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14031 case "$d_getprotobyname_r_proto:$usethreads" in
14032 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
14033 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14034 eval $hasproto ;;
14035 *) ;;
14036 esac
14037 case "$d_getprotobyname_r_proto" in
14038 define)
10bc17b6
JH
14039 case "$getprotobyname_r_proto" in
14040 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14041 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14042 esac
14043 case "$getprotobyname_r_proto" in
14044 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14045 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14046 esac
14047 case "$getprotobyname_r_proto" in
14048 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14049 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14050 esac
14051 case "$getprotobyname_r_proto" in
90e831dc 14052 ''|0) d_getprotobyname_r=undef
10bc17b6 14053 getprotobyname_r_proto=0
a48ec845 14054 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14055 * ) case "$getprotobyname_r_proto" in
14056 REENTRANT_PROTO*) ;;
14057 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14058 esac
14059 echo "Prototype: $try" ;;
14060 esac
14061 ;;
c18e646a
JH
14062 *) case "$usethreads" in
14063 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14064 esac
90e831dc
SB
14065 d_getprotobyname_r=undef
14066 getprotobyname_r_proto=0
c18e646a 14067 ;;
a48ec845
JH
14068 esac
14069 ;;
10bc17b6
JH
14070*) getprotobyname_r_proto=0
14071 ;;
14072esac
14073
14074: see if getprotobynumber_r exists
14075set getprotobynumber_r d_getprotobynumber_r
14076eval $inlibc
14077case "$d_getprotobynumber_r" in
14078"$define")
14079 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14080 case "$d_getprotobynumber_r_proto:$usethreads" in
14081 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
14082 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14083 eval $hasproto ;;
14084 *) ;;
14085 esac
14086 case "$d_getprotobynumber_r_proto" in
14087 define)
10bc17b6
JH
14088 case "$getprotobynumber_r_proto" in
14089 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14090 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14091 esac
14092 case "$getprotobynumber_r_proto" in
14093 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14094 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14095 esac
14096 case "$getprotobynumber_r_proto" in
14097 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14098 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14099 esac
14100 case "$getprotobynumber_r_proto" in
90e831dc 14101 ''|0) d_getprotobynumber_r=undef
10bc17b6 14102 getprotobynumber_r_proto=0
a48ec845 14103 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14104 * ) case "$getprotobynumber_r_proto" in
14105 REENTRANT_PROTO*) ;;
14106 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14107 esac
14108 echo "Prototype: $try" ;;
14109 esac
14110 ;;
c18e646a
JH
14111 *) case "$usethreads" in
14112 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14113 esac
90e831dc
SB
14114 d_getprotobynumber_r=undef
14115 getprotobynumber_r_proto=0
c18e646a 14116 ;;
a48ec845
JH
14117 esac
14118 ;;
10bc17b6
JH
14119*) getprotobynumber_r_proto=0
14120 ;;
14121esac
14122
14123: see if getprotoent_r exists
14124set getprotoent_r d_getprotoent_r
14125eval $inlibc
14126case "$d_getprotoent_r" in
14127"$define")
14128 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14129 case "$d_getprotoent_r_proto:$usethreads" in
14130 ":define") d_getprotoent_r_proto=define
a48ec845
JH
14131 set d_getprotoent_r_proto getprotoent_r $hdrs
14132 eval $hasproto ;;
14133 *) ;;
14134 esac
14135 case "$d_getprotoent_r_proto" in
14136 define)
10bc17b6
JH
14137 case "$getprotoent_r_proto" in
14138 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14139 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14140 esac
14141 case "$getprotoent_r_proto" in
14142 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14143 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14144 esac
14145 case "$getprotoent_r_proto" in
14146 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14147 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14148 esac
14149 case "$getprotoent_r_proto" in
14150 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14151 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14152 esac
14153 case "$getprotoent_r_proto" in
90e831dc 14154 ''|0) d_getprotoent_r=undef
10bc17b6 14155 getprotoent_r_proto=0
a48ec845 14156 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14157 * ) case "$getprotoent_r_proto" in
14158 REENTRANT_PROTO*) ;;
14159 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14160 esac
14161 echo "Prototype: $try" ;;
14162 esac
14163 ;;
c18e646a
JH
14164 *) case "$usethreads" in
14165 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14166 esac
90e831dc
SB
14167 d_getprotoent_r=undef
14168 getprotoent_r_proto=0
c18e646a 14169 ;;
a48ec845
JH
14170 esac
14171 ;;
10bc17b6
JH
14172*) getprotoent_r_proto=0
14173 ;;
14174esac
14175
b4eb6b3d
JH
14176: see if prototypes for various getprotoxxx netdb.h functions are available
14177echo " "
14178set d_getprotoprotos getprotoent $i_netdb netdb.h
14179eval $hasproto
14180
14181: see if getprpwnam exists
14182set getprpwnam d_getprpwnam
14183eval $inlibc
14184
14185: see if getpwent exists
14186set getpwent d_getpwent
14187eval $inlibc
14188
10bc17b6
JH
14189: see if getpwent_r exists
14190set getpwent_r d_getpwent_r
14191eval $inlibc
14192case "$d_getpwent_r" in
14193"$define")
14194 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14195 case "$d_getpwent_r_proto:$usethreads" in
14196 ":define") d_getpwent_r_proto=define
a48ec845
JH
14197 set d_getpwent_r_proto getpwent_r $hdrs
14198 eval $hasproto ;;
14199 *) ;;
14200 esac
14201 case "$d_getpwent_r_proto" in
14202 define)
10bc17b6
JH
14203 case "$getpwent_r_proto" in
14204 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14205 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14206 esac
14207 case "$getpwent_r_proto" in
14208 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14209 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14210 esac
14211 case "$getpwent_r_proto" in
14212 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14213 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14214 esac
14215 case "$getpwent_r_proto" in
14216 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14217 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14218 esac
14219 case "$getpwent_r_proto" in
14220 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14221 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14222 esac
14223 case "$getpwent_r_proto" in
14224 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14225 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14226 esac
14227 case "$getpwent_r_proto" in
90e831dc 14228 ''|0) d_getpwent_r=undef
10bc17b6 14229 getpwent_r_proto=0
a48ec845 14230 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14231 * ) case "$getpwent_r_proto" in
14232 REENTRANT_PROTO*) ;;
14233 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14234 esac
14235 echo "Prototype: $try" ;;
14236 esac
14237 ;;
c18e646a
JH
14238 *) case "$usethreads" in
14239 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14240 esac
90e831dc
SB
14241 d_getpwent_r=undef
14242 getpwent_r_proto=0
c18e646a 14243 ;;
a48ec845
JH
14244 esac
14245 ;;
10bc17b6
JH
14246*) getpwent_r_proto=0
14247 ;;
14248esac
14249
14250: see if getpwnam_r exists
14251set getpwnam_r d_getpwnam_r
14252eval $inlibc
14253case "$d_getpwnam_r" in
14254"$define")
14255 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14256 case "$d_getpwnam_r_proto:$usethreads" in
14257 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14258 set d_getpwnam_r_proto getpwnam_r $hdrs
14259 eval $hasproto ;;
14260 *) ;;
14261 esac
14262 case "$d_getpwnam_r_proto" in
14263 define)
10bc17b6
JH
14264 case "$getpwnam_r_proto" in
14265 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14266 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14267 esac
14268 case "$getpwnam_r_proto" in
14269 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14270 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14271 esac
14272 case "$getpwnam_r_proto" in
14273 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14274 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14275 esac
14276 case "$getpwnam_r_proto" in
14277 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14278 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14279 esac
14280 case "$getpwnam_r_proto" in
90e831dc 14281 ''|0) d_getpwnam_r=undef
10bc17b6 14282 getpwnam_r_proto=0
a48ec845 14283 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14284 * ) case "$getpwnam_r_proto" in
14285 REENTRANT_PROTO*) ;;
14286 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14287 esac
14288 echo "Prototype: $try" ;;
14289 esac
14290 ;;
c18e646a
JH
14291 *) case "$usethreads" in
14292 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14293 esac
90e831dc
SB
14294 d_getpwnam_r=undef
14295 getpwnam_r_proto=0
c18e646a 14296 ;;
a48ec845
JH
14297 esac
14298 ;;
10bc17b6
JH
14299*) getpwnam_r_proto=0
14300 ;;
14301esac
14302
14303: see if getpwuid_r exists
14304set getpwuid_r d_getpwuid_r
14305eval $inlibc
14306case "$d_getpwuid_r" in
14307"$define")
14308 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14309 case "$d_getpwuid_r_proto:$usethreads" in
14310 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14311 set d_getpwuid_r_proto getpwuid_r $hdrs
14312 eval $hasproto ;;
14313 *) ;;
14314 esac
14315 case "$d_getpwuid_r_proto" in
14316 define)
10bc17b6
JH
14317 case "$getpwuid_r_proto" in
14318 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14319 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14320 esac
14321 case "$getpwuid_r_proto" in
14322 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14323 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14324 esac
14325 case "$getpwuid_r_proto" in
14326 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14327 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14328 esac
14329 case "$getpwuid_r_proto" in
14330 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14331 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14332 esac
14333 case "$getpwuid_r_proto" in
90e831dc 14334 ''|0) d_getpwuid_r=undef
10bc17b6 14335 getpwuid_r_proto=0
a48ec845 14336 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14337 * ) case "$getpwuid_r_proto" in
14338 REENTRANT_PROTO*) ;;
14339 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14340 esac
14341 echo "Prototype: $try" ;;
14342 esac
14343 ;;
c18e646a
JH
14344 *) case "$usethreads" in
14345 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14346 esac
90e831dc
SB
14347 d_getpwuid_r=undef
14348 getpwuid_r_proto=0
c18e646a 14349 ;;
a48ec845
JH
14350 esac
14351 ;;
10bc17b6
JH
14352*) getpwuid_r_proto=0
14353 ;;
14354esac
14355
34f1896b 14356: Optional checks for getsbyname and getsbyport
b4eb6b3d
JH
14357
14358: see if getservbyname exists
14359set getservbyname d_getsbyname
14360eval $inlibc
14361
14362: see if getservbyport exists
14363set getservbyport d_getsbyport
14364eval $inlibc
14365
14366: see if getservent exists
14367set getservent d_getsent
14368eval $inlibc
14369
10bc17b6
JH
14370: see if getservbyname_r exists
14371set getservbyname_r d_getservbyname_r
14372eval $inlibc
14373case "$d_getservbyname_r" in
14374"$define")
14375 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14376 case "$d_getservbyname_r_proto:$usethreads" in
14377 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14378 set d_getservbyname_r_proto getservbyname_r $hdrs
14379 eval $hasproto ;;
14380 *) ;;
14381 esac
14382 case "$d_getservbyname_r_proto" in
14383 define)
10bc17b6
JH
14384 case "$getservbyname_r_proto" in
14385 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14386 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14387 esac
14388 case "$getservbyname_r_proto" in
14389 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14390 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14391 esac
14392 case "$getservbyname_r_proto" in
14393 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14394 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14395 esac
14396 case "$getservbyname_r_proto" in
90e831dc 14397 ''|0) d_getservbyname_r=undef
10bc17b6 14398 getservbyname_r_proto=0
a48ec845 14399 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14400 * ) case "$getservbyname_r_proto" in
14401 REENTRANT_PROTO*) ;;
14402 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14403 esac
14404 echo "Prototype: $try" ;;
14405 esac
14406 ;;
c18e646a
JH
14407 *) case "$usethreads" in
14408 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14409 esac
90e831dc
SB
14410 d_getservbyname_r=undef
14411 getservbyname_r_proto=0
c18e646a 14412 ;;
a48ec845
JH
14413 esac
14414 ;;
10bc17b6
JH
14415*) getservbyname_r_proto=0
14416 ;;
14417esac
14418
14419: see if getservbyport_r exists
14420set getservbyport_r d_getservbyport_r
14421eval $inlibc
14422case "$d_getservbyport_r" in
14423"$define")
14424 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14425 case "$d_getservbyport_r_proto:$usethreads" in
14426 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14427 set d_getservbyport_r_proto getservbyport_r $hdrs
14428 eval $hasproto ;;
14429 *) ;;
14430 esac
14431 case "$d_getservbyport_r_proto" in
14432 define)
10bc17b6
JH
14433 case "$getservbyport_r_proto" in
14434 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14435 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14436 esac
14437 case "$getservbyport_r_proto" in
14438 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14439 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14440 esac
14441 case "$getservbyport_r_proto" in
14442 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14443 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14444 esac
14445 case "$getservbyport_r_proto" in
90e831dc 14446 ''|0) d_getservbyport_r=undef
10bc17b6 14447 getservbyport_r_proto=0
a48ec845 14448 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14449 * ) case "$getservbyport_r_proto" in
14450 REENTRANT_PROTO*) ;;
14451 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14452 esac
14453 echo "Prototype: $try" ;;
14454 esac
14455 ;;
c18e646a
JH
14456 *) case "$usethreads" in
14457 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14458 esac
90e831dc
SB
14459 d_getservbyport_r=undef
14460 getservbyport_r_proto=0
c18e646a 14461 ;;
a48ec845
JH
14462 esac
14463 ;;
10bc17b6
JH
14464*) getservbyport_r_proto=0
14465 ;;
14466esac
14467
14468: see if getservent_r exists
14469set getservent_r d_getservent_r
14470eval $inlibc
14471case "$d_getservent_r" in
14472"$define")
14473 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14474 case "$d_getservent_r_proto:$usethreads" in
14475 ":define") d_getservent_r_proto=define
a48ec845
JH
14476 set d_getservent_r_proto getservent_r $hdrs
14477 eval $hasproto ;;
14478 *) ;;
14479 esac
14480 case "$d_getservent_r_proto" in
14481 define)
10bc17b6
JH
14482 case "$getservent_r_proto" in
14483 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14484 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14485 esac
14486 case "$getservent_r_proto" in
14487 ''|0) try='int getservent_r(struct servent*, char*, int);'
14488 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14489 esac
14490 case "$getservent_r_proto" in
14491 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14492 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14493 esac
14494 case "$getservent_r_proto" in
14495 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14496 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14497 esac
14498 case "$getservent_r_proto" in
90e831dc 14499 ''|0) d_getservent_r=undef
10bc17b6 14500 getservent_r_proto=0
a48ec845 14501 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14502 * ) case "$getservent_r_proto" in
14503 REENTRANT_PROTO*) ;;
14504 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14505 esac
14506 echo "Prototype: $try" ;;
14507 esac
14508 ;;
c18e646a
JH
14509 *) case "$usethreads" in
14510 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14511 esac
90e831dc
SB
14512 d_getservent_r=undef
14513 getservent_r_proto=0
c18e646a 14514 ;;
a48ec845
JH
14515 esac
14516 ;;
10bc17b6
JH
14517*) getservent_r_proto=0
14518 ;;
14519esac
14520
b4eb6b3d
JH
14521: see if prototypes for various getservxxx netdb.h functions are available
14522echo " "
14523set d_getservprotos getservent $i_netdb netdb.h
14524eval $hasproto
14525
14526: see if getspnam exists
14527set getspnam d_getspnam
14528eval $inlibc
14529
10bc17b6
JH
14530: see if this is a shadow.h system
14531set shadow.h i_shadow
14532eval $inhdr
14533
14534: see if getspnam_r exists
14535set getspnam_r d_getspnam_r
14536eval $inlibc
14537case "$d_getspnam_r" in
14538"$define")
14539 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14540 case "$d_getspnam_r_proto:$usethreads" in
14541 ":define") d_getspnam_r_proto=define
a48ec845
JH
14542 set d_getspnam_r_proto getspnam_r $hdrs
14543 eval $hasproto ;;
14544 *) ;;
14545 esac
14546 case "$d_getspnam_r_proto" in
14547 define)
10bc17b6
JH
14548 case "$getspnam_r_proto" in
14549 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14550 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14551 esac
14552 case "$getspnam_r_proto" in
14553 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14554 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14555 esac
14556 case "$getspnam_r_proto" in
90e831dc 14557 ''|0) d_getspnam_r=undef
10bc17b6 14558 getspnam_r_proto=0
a48ec845 14559 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14560 * ) case "$getspnam_r_proto" in
14561 REENTRANT_PROTO*) ;;
14562 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14563 esac
14564 echo "Prototype: $try" ;;
14565 esac
14566 ;;
c18e646a
JH
14567 *) case "$usethreads" in
14568 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14569 esac
90e831dc
SB
14570 d_getspnam_r=undef
14571 getspnam_r_proto=0
c18e646a 14572 ;;
a48ec845
JH
14573 esac
14574 ;;
10bc17b6
JH
14575*) getspnam_r_proto=0
14576 ;;
14577esac
14578
b4eb6b3d
JH
14579: see if gettimeofday or ftime exists
14580set gettimeofday d_gettimeod
14581eval $inlibc
14582case "$d_gettimeod" in
14583"$undef")
14584 set ftime d_ftime
14585 eval $inlibc
14586 ;;
14587*)
14588 val="$undef"; set d_ftime; eval $setvar
14589 ;;
14590esac
14591case "$d_gettimeod$d_ftime" in
14592"$undef$undef")
14593 echo " "
14594 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14595 ;;
14596esac
14597
10bc17b6
JH
14598: see if gmtime_r exists
14599set gmtime_r d_gmtime_r
14600eval $inlibc
14601case "$d_gmtime_r" in
14602"$define")
d63eadf0 14603 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14604 case "$d_gmtime_r_proto:$usethreads" in
14605 ":define") d_gmtime_r_proto=define
a48ec845
JH
14606 set d_gmtime_r_proto gmtime_r $hdrs
14607 eval $hasproto ;;
14608 *) ;;
14609 esac
14610 case "$d_gmtime_r_proto" in
14611 define)
10bc17b6
JH
14612 case "$gmtime_r_proto" in
14613 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14614 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14615 esac
14616 case "$gmtime_r_proto" in
14617 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14618 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14619 esac
14620 case "$gmtime_r_proto" in
90e831dc 14621 ''|0) d_gmtime_r=undef
10bc17b6 14622 gmtime_r_proto=0
a48ec845 14623 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14624 * ) case "$gmtime_r_proto" in
14625 REENTRANT_PROTO*) ;;
14626 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14627 esac
14628 echo "Prototype: $try" ;;
14629 esac
b4eb6b3d 14630 ;;
c18e646a
JH
14631 *) case "$usethreads" in
14632 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14633 esac
90e831dc
SB
14634 d_gmtime_r=undef
14635 gmtime_r_proto=0
c18e646a 14636 ;;
a48ec845
JH
14637 esac
14638 ;;
10bc17b6 14639*) gmtime_r_proto=0
b4eb6b3d
JH
14640 ;;
14641esac
14642
14643: see if hasmntopt exists
14644set hasmntopt d_hasmntopt
14645eval $inlibc
14646
14647: see if this is a netinet/in.h or sys/in.h system
14648set netinet/in.h i_niin sys/in.h i_sysin
14649eval $inhdr
14650
14651: see if arpa/inet.h has to be included
14652set arpa/inet.h i_arpainet
14653eval $inhdr
14654
14655: see if htonl --and friends-- exists
14656val=''
14657set htonl val
14658eval $inlibc
14659
14660: Maybe they are macros.
14661case "$val" in
14662$undef)
14663 $cat >htonl.c <<EOM
14664#include <stdio.h>
14665#include <sys/types.h>
14666#$i_niin I_NETINET_IN
14667#$i_sysin I_SYS_IN
14668#$i_arpainet I_ARPA_INET
14669#ifdef I_NETINET_IN
14670#include <netinet/in.h>
14671#endif
14672#ifdef I_SYS_IN
14673#include <sys/in.h>
14674#endif
14675#ifdef I_ARPA_INET
14676#include <arpa/inet.h>
14677#endif
14678#ifdef htonl
14679printf("Defined as a macro.");
14680#endif
14681EOM
14682 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14683 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14684 val="$define"
14685 echo "But it seems to be defined as a macro." >&4
14686 fi
14687 $rm -f htonl.?
14688 ;;
14689esac
14690set d_htonl
14691eval $setvar
14692
36adc09b
JH
14693: see if ilogbl exists
14694set ilogbl d_ilogbl
14695eval $inlibc
14696
b4eb6b3d
JH
14697: index or strchr
14698echo " "
14699if set index val -f; eval $csym; $val; then
14700 if set strchr val -f d_strchr; eval $csym; $val; then
14701 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14702 val="$define"
14703 vali="$undef"
14704 echo "strchr() found." >&4
14705 else
14706 val="$undef"
14707 vali="$define"
14708 echo "index() found." >&4
14709 fi
14710 else
14711 val="$undef"
14712 vali="$define"
8dfa8df9
JH
14713 echo "index() found." >&4
14714 fi
b4eb6b3d 14715else
8dfa8df9
JH
14716 if set strchr val -f d_strchr; eval $csym; $val; then
14717 val="$define"
14718 vali="$undef"
14719 echo "strchr() found." >&4
14720 else
14721 echo "No index() or strchr() found!" >&4
14722 val="$undef"
14723 vali="$undef"
14724 fi
b4eb6b3d 14725fi
8dfa8df9
JH
14726set d_strchr; eval $setvar
14727val="$vali"
14728set d_index; eval $setvar
14729
14730: check whether inet_aton exists
14731set inet_aton d_inetaton
14732eval $inlibc
b4eb6b3d
JH
14733
14734: Look for isascii
14735echo " "
36adc09b 14736$cat >isascii.c <<EOCP
b4eb6b3d
JH
14737#include <stdio.h>
14738#include <ctype.h>
55954f19
JH
14739#$i_stdlib I_STDLIB
14740#ifdef I_STDLIB
14741#include <stdlib.h>
14742#endif
b4eb6b3d
JH
14743int main() {
14744 int c = 'A';
14745 if (isascii(c))
14746 exit(0);
14747 else
14748 exit(1);
14749}
14750EOCP
14751set isascii
14752if eval $compile; then
14753 echo "isascii() found." >&4
14754 val="$define"
14755else
14756 echo "isascii() NOT found." >&4
14757 val="$undef"
14758fi
14759set d_isascii
14760eval $setvar
14761$rm -f isascii*
14762
758a5d79
JH
14763: see if isfinite exists
14764set isfinite d_isfinite
14765eval $inlibc
14766
14767: see if isinf exists
14768set isinf d_isinf
14769eval $inlibc
14770
b4eb6b3d
JH
14771: see if isnan exists
14772set isnan d_isnan
14773eval $inlibc
14774
14775: see if isnanl exists
14776set isnanl d_isnanl
14777eval $inlibc
14778
14779: see if killpg exists
14780set killpg d_killpg
14781eval $inlibc
14782
14783: see if lchown exists
14784echo " "
14785$cat > try.c <<'EOCP'
14786/* System header to define __stub macros and hopefully few prototypes,
14787 which can conflict with char lchown(); below. */
14788#include <assert.h>
14789/* Override any gcc2 internal prototype to avoid an error. */
14790/* We use char because int might match the return type of a gcc2
14791 builtin and then its argument prototype would still apply. */
14792char lchown();
14793int main() {
14794 /* The GNU C library defines this for functions which it implements
14795 to always fail with ENOSYS. Some functions are actually named
14796 something starting with __ and the normal name is an alias. */
14797#if defined (__stub_lchown) || defined (__stub___lchown)
14798choke me
14799#else
14800lchown();
14801#endif
14802; return 0; }
14803EOCP
14804set try
14805if eval $compile; then
14806 $echo "lchown() found." >&4
14807 val="$define"
14808else
14809 $echo "lchown() NOT found." >&4
14810 val="$undef"
14811fi
14812set d_lchown
14813eval $setvar
14814
14815: See if number of significant digits in a double precision number is known
14816echo " "
14817$cat >ldbl_dig.c <<EOM
14818#$i_limits I_LIMITS
14819#$i_float I_FLOAT
14820#ifdef I_LIMITS
14821#include <limits.h>
14822#endif
14823#ifdef I_FLOAT
14824#include <float.h>
14825#endif
14826#ifdef LDBL_DIG
14827printf("Contains LDBL_DIG");
14828#endif
14829EOM
14830$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14831if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14832 echo "LDBL_DIG found." >&4
14833 val="$define"
14834else
14835 echo "LDBL_DIG NOT found." >&4
14836 val="$undef"
14837fi
14838$rm -f ldbl_dig.?
14839set d_ldbl_dig
14840eval $setvar
14841
0a0abfba
MB
14842: see if this is a math.h system
14843set math.h i_math
14844eval $inhdr
14845
613d6c3e 14846: check to see if math.h defines _LIB_VERSION
0a0abfba
MB
14847d_libm_lib_version="$undef"
14848case $i_math in
14849 $define)
0a0abfba
MB
14850 echo " "
14851 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14852 $cat >try.c <<EOCP
14853#include <unistd.h>
14854#include <math.h>
14855int main (int argc, char *argv[])
14856{
14857 printf ("%d\n", _LIB_VERSION);
14858 return (0);
14859 } /* main */
14860EOCP
14861 set try
14862 if eval $compile; then
14863 foo=`$run ./try`
14864 echo "Yes, it does ($foo)" >&4
14865 d_libm_lib_version="$define"
14866 else
4dd8f9b3 14867 echo "No, it does not (probably harmless)" >&4
0a0abfba 14868 fi
5b813a60 14869 $rm_try
0a0abfba
MB
14870 ;;
14871
14872 esac
14873
b4eb6b3d
JH
14874: see if link exists
14875set link d_link
14876eval $inlibc
14877
10bc17b6
JH
14878: see if localtime_r exists
14879set localtime_r d_localtime_r
14880eval $inlibc
14881case "$d_localtime_r" in
14882"$define")
d63eadf0 14883 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14884 case "$d_localtime_r_proto:$usethreads" in
14885 ":define") d_localtime_r_proto=define
a48ec845
JH
14886 set d_localtime_r_proto localtime_r $hdrs
14887 eval $hasproto ;;
14888 *) ;;
14889 esac
14890 case "$d_localtime_r_proto" in
14891 define)
10bc17b6
JH
14892 case "$localtime_r_proto" in
14893 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14894 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14895 esac
14896 case "$localtime_r_proto" in
14897 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14898 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14899 esac
14900 case "$localtime_r_proto" in
90e831dc 14901 ''|0) d_localtime_r=undef
10bc17b6 14902 localtime_r_proto=0
a48ec845 14903 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14904 * ) case "$localtime_r_proto" in
14905 REENTRANT_PROTO*) ;;
14906 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14907 esac
14908 echo "Prototype: $try" ;;
14909 esac
14910 ;;
c18e646a
JH
14911 *) case "$usethreads" in
14912 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14913 esac
90e831dc
SB
14914 d_localtime_r=undef
14915 localtime_r_proto=0
c18e646a 14916 ;;
a48ec845
JH
14917 esac
14918 ;;
10bc17b6
JH
14919*) localtime_r_proto=0
14920 ;;
14921esac
14922
8572b25d
BH
14923: see if localtime_r calls tzset
14924case "$localtime_r_proto" in
14925REENTRANT_PROTO*)
14926 $cat >try.c <<EOCP
14927/* Does our libc's localtime_r call tzset ?
14928 * return 0 if so, 1 otherwise.
14929 */
14930#include <sys/types.h>
14931#include <unistd.h>
14932#include <time.h>
14933#include <string.h>
14934#include <malloc.h>
14935int main()
14936{
14937 time_t t = time(0L);
14938 char w_tz[]="TZ" "=GMT+5",
14939 e_tz[]="TZ" "=GMT-5",
14940 *tz_e = (char*)malloc(16),
14941 *tz_w = (char*)malloc(16);
14942 struct tm tm_e, tm_w;
14943 memset(&tm_e,'\0',sizeof(struct tm));
14944 memset(&tm_w,'\0',sizeof(struct tm));
14945 strcpy(tz_e,e_tz);
14946 strcpy(tz_w,w_tz);
14947
14948 putenv(tz_e);
14949 localtime_r(&t, &tm_e);
14950
14951 putenv(tz_w);
14952 localtime_r(&t, &tm_w);
14953
14954 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14955 return 1;
14956 return 0;
14957}
14958EOCP
14959 set try
14960 if eval $compile; then
43dddb59 14961 if $run ./try; then
8572b25d
BH
14962 d_localtime_r_needs_tzset=undef;
14963 else
14964 d_localtime_r_needs_tzset=define;
14965 fi;
14966 else
14967 d_localtime_r_needs_tzset=undef;
14968 fi;
14969 ;;
14970 *)
14971 d_localtime_r_needs_tzset=undef;
14972 ;;
14973esac
5b813a60 14974$rm_try
8572b25d 14975
b4eb6b3d
JH
14976: see if localeconv exists
14977set localeconv d_locconv
14978eval $inlibc
14979
14980: see if lockf exists
14981set lockf d_lockf
14982eval $inlibc
14983
b4eb6b3d
JH
14984: see if prototype for lseek is available
14985echo " "
4786929f 14986set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14987eval $hasproto
14988
14989: see if lstat exists
14990set lstat d_lstat
14991eval $inlibc
14992
14993: see if madvise exists
14994set madvise d_madvise
14995eval $inlibc
14996
7dd121ae
MB
14997: see if malloc_size exists
14998set malloc_size d_malloc_size
14999eval $inlibc
15000
15001: see if malloc_size_good exists
15002set malloc_good_size d_malloc_good_size
15003eval $inlibc
15004
b4eb6b3d
JH
15005: see if mblen exists
15006set mblen d_mblen
15007eval $inlibc
15008
15009: see if mbstowcs exists
15010set mbstowcs d_mbstowcs
15011eval $inlibc
15012
15013: see if mbtowc exists
15014set mbtowc d_mbtowc
15015eval $inlibc
15016
15017: see if memchr exists
15018set memchr d_memchr
15019eval $inlibc
15020
15021: see if memcmp exists
15022set memcmp d_memcmp
15023eval $inlibc
15024
15025: see if memcpy exists
15026set memcpy d_memcpy
15027eval $inlibc
15028
15029: see if memmove exists
15030set memmove d_memmove
15031eval $inlibc
15032
15033: see if memset exists
15034set memset d_memset
15035eval $inlibc
15036
15037: see if mkdir exists
15038set mkdir d_mkdir
15039eval $inlibc
15040
15041: see if mkdtemp exists
15042set mkdtemp d_mkdtemp
15043eval $inlibc
15044
15045: see if mkfifo exists
15046set mkfifo d_mkfifo
15047eval $inlibc
15048
15049: see if mkstemp exists
15050set mkstemp d_mkstemp
15051eval $inlibc
15052
15053: see if mkstemps exists
15054set mkstemps d_mkstemps
15055eval $inlibc
15056
15057: see if mktime exists
15058set mktime d_mktime
15059eval $inlibc
15060
15061: see if this is a sys/mman.h system
15062set sys/mman.h i_sysmman
15063eval $inhdr
15064
15065: see if mmap exists
15066set mmap d_mmap
15067eval $inlibc
15068: see what shmat returns
15069: default to something harmless
15070mmaptype='void *'
15071case "$i_sysmman$d_mmap" in
15072"$define$define")
15073 $cat >mmap.c <<'END'
15074#include <sys/mman.h>
15075void *mmap();
15076END
15077 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15078 mmaptype='void *'
15079 else
15080 mmaptype='caddr_t'
15081 fi
15082 echo "and it returns ($mmaptype)." >&4
15083 ;;
15084esac
15085
15086
15087
89ce900e
JH
15088: see if sqrtl exists
15089set sqrtl d_sqrtl
15090eval $inlibc
15091
af1ff193
JH
15092: see if scalbnl exists
15093set scalbnl d_scalbnl
15094eval $inlibc
15095
89ce900e
JH
15096: see if modfl exists
15097set modfl d_modfl
15098eval $inlibc
15099
15100: see if prototype for modfl is available
15101echo " "
3a794506 15102set d_modflproto modfl $i_math math.h
89ce900e
JH
15103eval $hasproto
15104
15105d_modfl_pow32_bug="$undef"
15106
15107case "$d_longdbl$d_modfl" in
15108$define$define)
15109 $cat <<EOM
15110Checking to see whether your modfl() is okay for large values...
15111EOM
15112$cat >try.c <<EOCP
5b813a60 15113#include <math.h>
89ce900e
JH
15114#include <stdio.h>
15115EOCP
15116if $test "X$d_modflproto" != "X$define"; then
15117 $cat >>try.c <<EOCP
5b813a60 15118/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
15119long double modfl (long double, long double *);
15120EOCP
15121fi
15122$cat >>try.c <<EOCP
15123int main() {
15124 long double nv = 4294967303.15;
15125 long double v, w;
5b813a60 15126 v = modfl(nv, &w);
89ce900e
JH
15127#ifdef __GLIBC__
15128 printf("glibc");
15129#endif
15130 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15131 return 0;
15132}
15133EOCP
15134 case "$osname:$gccversion" in
15135 aix:) saveccflags="$ccflags"
15136 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15137 esac
15138 set try
15139 if eval $compile; then
15140 foo=`$run ./try`
15141 case "$foo" in
15142 *" 4294967303.150000 1.150000 4294967302.000000")
15143 echo >&4 "Your modfl() is broken for large values."
15144 d_modfl_pow32_bug="$define"
15145 case "$foo" in
15146 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15147 ;;
15148 esac
15149 ;;
15150 *" 4294967303.150000 0.150000 4294967303.000000")
15151 echo >&4 "Your modfl() seems okay for large values."
15152 ;;
15153 *) echo >&4 "I don't understand your modfl() at all."
15154 d_modfl="$undef"
15155 ;;
15156 esac
5b813a60 15157 $rm_try
89ce900e
JH
15158 else
15159 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15160 d_modfl="$undef"
15161 fi
15162 case "$osname:$gccversion" in
15163 aix:) ccflags="$saveccflags" ;; # restore
15164 esac
15165 ;;
15166esac
15167
15168if $test "$uselongdouble" = "$define"; then
af1ff193
JH
15169 message=""
15170 if $test "$d_sqrtl" != "$define"; then
15171 message="$message sqrtl"
15172 fi
15173 if $test "$d_modfl" != "$define"; then
89ce900e
JH
15174 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15175 echo "You have both aintl and copysignl, so I can emulate modfl."
15176 else
af1ff193 15177 message="$message modfl"
89ce900e 15178 fi
af1ff193
JH
15179 fi
15180 if $test "$d_frexpl" != "$define"; then
15181 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15182 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15183 else
15184 message="$message frexpl"
15185 fi
15186 fi
89ce900e 15187
af1ff193 15188 if $test "$message" != ""; then
89ce900e
JH
15189 $cat <<EOM >&4
15190
15191*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15192*** the following mathematical functions needed for long double support:
15193*** $message
fe63a0b4
JH
15194*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15195*** Cannot continue, aborting.
89ce900e
JH
15196
15197EOM
15198
fe63a0b4 15199 exit 1
89ce900e
JH
15200 fi
15201fi
15202
b4eb6b3d
JH
15203: see if mprotect exists
15204set mprotect d_mprotect
15205eval $inlibc
15206
15207: see if msgctl exists
15208set msgctl d_msgctl
15209eval $inlibc
15210
15211: see if msgget exists
15212set msgget d_msgget
15213eval $inlibc
15214
15215: see if msgsnd exists
15216set msgsnd d_msgsnd
15217eval $inlibc
15218
15219: see if msgrcv exists
15220set msgrcv d_msgrcv
15221eval $inlibc
15222
15223: see how much of the 'msg*(2)' library is present.
15224h_msg=true
15225echo " "
15226case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15227*"$undef"*) h_msg=false;;
15228esac
15229case "$osname" in
15230freebsd)
15231 case "`ipcs 2>&1`" in
15232 "SVID messages"*"not configured"*)
15233 echo "Your $osname does not have the msg*(2) configured." >&4
15234 h_msg=false
15235 val="$undef"
15236 set msgctl d_msgctl
15237 eval $setvar
15238 set msgget d_msgget
15239 eval $setvar
15240 set msgsnd d_msgsnd
15241 eval $setvar
15242 set msgrcv d_msgrcv
15243 eval $setvar
15244 ;;
15245 esac
15246 ;;
15247esac
15248: we could also check for sys/ipc.h ...
15249if $h_msg && $test `./findhdr sys/msg.h`; then
15250 echo "You have the full msg*(2) library." >&4
15251 val="$define"
15252else
15253 echo "You don't have the full msg*(2) library." >&4
15254 val="$undef"
15255fi
15256set d_msg
15257eval $setvar
15258
34f1896b 15259: Check for msghdr_s
4e0554ec
JH
15260echo " "
15261echo "Checking to see if your system supports struct msghdr..." >&4
15262set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15263eval $hasstruct
15264case "$d_msghdr_s" in
15265"$define") echo "Yes, it does." ;;
15266*) echo "No, it doesn't." ;;
15267esac
15268
15269
b4eb6b3d
JH
15270: see if msync exists
15271set msync d_msync
15272eval $inlibc
15273
15274: see if munmap exists
15275set munmap d_munmap
15276eval $inlibc
15277
15278: see if nice exists
15279set nice d_nice
15280eval $inlibc
15281
2765b840
JH
15282: see if this is a langinfo.h system
15283set langinfo.h i_langinfo
15284eval $inhdr
15285
15286: see if nl_langinfo exists
15287set nl_langinfo d_nl_langinfo
15288eval $inlibc
15289
1d1be0dc
NC
15290: check for volatile keyword
15291echo " "
15292echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15293$cat >try.c <<'EOCP'
76f47787 15294int main()
1d1be0dc
NC
15295{
15296 typedef struct _goo_struct goo_struct;
15297 goo_struct * volatile goo = ((goo_struct *)0);
15298 struct _goo_struct {
15299 long long_int;
15300 int reg_int;
15301 char char_var;
15302 };
15303 typedef unsigned short foo_t;
15304 char *volatile foo;
15305 volatile int bar;
15306 volatile foo_t blech;
15307 foo = foo;
15308}
15309EOCP
15310if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15311 val="$define"
15312 echo "Yup, it does."
15313else
15314 val="$undef"
15315 echo "Nope, it doesn't."
15316fi
15317set d_volatile
15318eval $setvar
5b813a60 15319$rm_try
1d1be0dc 15320
613d6c3e 15321: Check basic sizes
b4eb6b3d
JH
15322echo " "
15323$echo "Choosing the C types to be used for Perl's internal types..." >&4
15324
15325case "$use64bitint:$d_quad:$quadtype" in
15326define:define:?*)
15327 ivtype="$quadtype"
15328 uvtype="$uquadtype"
15329 ivsize=8
15330 uvsize=8
15331 ;;
15332*) ivtype="long"
15333 uvtype="unsigned long"
15334 ivsize=$longsize
15335 uvsize=$longsize
15336 ;;
15337esac
15338
15339case "$uselongdouble:$d_longdbl" in
15340define:define)
15341 nvtype="long double"
15342 nvsize=$longdblsize
15343 ;;
15344*) nvtype=double
15345 nvsize=$doublesize
15346 ;;
15347esac
15348
15349$echo "(IV will be "$ivtype", $ivsize bytes)"
15350$echo "(UV will be "$uvtype", $uvsize bytes)"
15351$echo "(NV will be "$nvtype", $nvsize bytes)"
15352
15353$cat >try.c <<EOCP
15354#$i_inttypes I_INTTYPES
15355#ifdef I_INTTYPES
15356#include <inttypes.h>
15357#endif
15358#include <stdio.h>
15359int main() {
15360#ifdef INT8
15361 int8_t i = INT8_MAX;
15362 uint8_t u = UINT8_MAX;
15363 printf("int8_t\n");
15364#endif
15365#ifdef INT16
15366 int16_t i = INT16_MAX;
15367 uint16_t i = UINT16_MAX;
15368 printf("int16_t\n");
15369#endif
15370#ifdef INT32
15371 int32_t i = INT32_MAX;
15372 uint32_t u = UINT32_MAX;
15373 printf("int32_t\n");
15374#endif
15375}
15376EOCP
15377
13187456 15378i8type="signed char"
0ab0821a
MB
15379u8type="unsigned char"
15380i8size=1
15381u8size=1
b4eb6b3d
JH
15382
15383case "$i16type" in
15384'') case "$shortsize" in
15385 2) i16type=short
15386 u16type="unsigned short"
15387 i16size=$shortsize
15388 u16size=$shortsize
15389 ;;
15390 esac
15391 ;;
15392esac
15393case "$i16type" in
15394'') set try -DINT16
15395 if eval $compile; then
5440bc8e 15396 case "`$run ./try`" in
b4eb6b3d
JH
15397 int16_t)
15398 i16type=int16_t
15399 u16type=uint16_t
15400 i16size=2
15401 u16size=2
15402 ;;
15403 esac
15404 fi
15405 ;;
15406esac
15407case "$i16type" in
15408'') if $test $shortsize -ge 2; then
15409 i16type=short
15410 u16type="unsigned short"
15411 i16size=$shortsize
15412 u16size=$shortsize
15413 fi
15414 ;;
15415esac
15416
15417case "$i32type" in
15418'') case "$longsize" in
15419 4) i32type=long
15420 u32type="unsigned long"
15421 i32size=$longsize
15422 u32size=$longsize
15423 ;;
15424 *) case "$intsize" in
15425 4) i32type=int
15426 u32type="unsigned int"
15427 i32size=$intsize
15428 u32size=$intsize
15429 ;;
15430 esac
15431 ;;
15432 esac
15433 ;;
15434esac
15435case "$i32type" in
15436'') set try -DINT32
15437 if eval $compile; then
5440bc8e 15438 case "`$run ./try`" in
b4eb6b3d
JH
15439 int32_t)
15440 i32type=int32_t
15441 u32type=uint32_t
15442 i32size=4
15443 u32size=4
15444 ;;
15445 esac
15446 fi
15447 ;;
15448esac
15449case "$i32type" in
15450'') if $test $intsize -ge 4; then
15451 i32type=int
15452 u32type="unsigned int"
15453 i32size=$intsize
15454 u32size=$intsize
15455 fi
15456 ;;
15457esac
15458
15459case "$i64type" in
15460'') case "$d_quad:$quadtype" in
15461 define:?*)
15462 i64type="$quadtype"
15463 u64type="$uquadtype"
15464 i64size=8
15465 u64size=8
15466 ;;
15467 esac
15468 ;;
15469esac
15470
1d1be0dc
NC
15471$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15472: volatile so that the compiler has to store it out to memory.
15473if test X"$d_volatile" = X"$define"; then
15474 volatile=volatile
15475fi
b4eb6b3d
JH
15476$cat <<EOP >try.c
15477#include <stdio.h>
55954f19
JH
15478#$i_stdlib I_STDLIB
15479#ifdef I_STDLIB
15480#include <stdlib.h>
15481#endif
1d1be0dc
NC
15482#include <sys/types.h>
15483#include <signal.h>
15484#ifdef SIGFPE
15485$volatile int bletched = 0;
7090f861 15486$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15487#endif
b4eb6b3d
JH
15488int main() {
15489 $uvtype u = 0;
1d1be0dc 15490 $nvtype d;
b4eb6b3d
JH
15491 int n = 8 * $uvsize;
15492 int i;
1d1be0dc
NC
15493#ifdef SIGFPE
15494 signal(SIGFPE, blech);
15495#endif
15496
b4eb6b3d
JH
15497 for (i = 0; i < n; i++) {
15498 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15499 d = ($nvtype)u;
15500 if (($uvtype)d != u)
b4eb6b3d 15501 break;
1d1be0dc
NC
15502 if (d <= 0)
15503 break;
15504 d = ($nvtype)(u - 1);
15505 if (($uvtype)d != (u - 1))
15506 break;
15507#ifdef SIGFPE
22676560 15508 if (bletched)
1d1be0dc
NC
15509 break;
15510#endif
b4eb6b3d 15511 }
efd1522b 15512 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15513 exit(0);
15514}
15515EOP
1d1be0dc
NC
15516set try
15517
15518d_nv_preserves_uv="$undef"
15519if eval $compile; then
53133ed1 15520 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15521fi
53133ed1 15522case "$nv_preserves_uv_bits" in
5b813a60 15523\-[1-9]*)
53133ed1
NC
15524 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15525 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15526 d_nv_preserves_uv="$define"
b4eb6b3d 15527 ;;
53133ed1 15528[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15529 d_nv_preserves_uv="$undef" ;;
15530*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15531 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15532esac
5b813a60 15533$rm_try
1d1be0dc 15534
b68c599a
NC
15535$echo "Checking to find the largest integer value your NVs can hold..." >&4
15536: volatile so that the compiler has to store it out to memory.
15537if test X"$d_volatile" = X"$define"; then
15538 volatile=volatile
15539fi
15540$cat <<EOP >try.c
15541#include <stdio.h>
15542
15543typedef $nvtype NV;
15544
15545int
15546main() {
15547 NV value = 2;
15548 int count = 1;
15549
15550 while(count < 256) {
15551 $volatile NV up = value + 1.0;
15552 $volatile NV negated = -value;
15553 $volatile NV down = negated - 1.0;
15554 $volatile NV got_up = up - value;
15555 int up_good = got_up == 1.0;
15556 int got_down = down - negated;
15557 int down_good = got_down == -1.0;
15558
15559 if (down_good != up_good) {
15560 fprintf(stderr,
15561 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15562 up_good, (double) got_up, down_good, (double) got_down,
15563 count, (double) value);
15564 return 1;
15565 }
15566 if (!up_good) {
15567 while (1) {
15568 if (count > 8) {
15569 count -= 8;
15570 fputs("256.0", stdout);
15571 } else {
15572 count--;
15573 fputs("2.0", stdout);
15574 }
15575 if (!count) {
15576 puts("");
15577 return 0;
15578 }
15579 fputs("*", stdout);
15580 }
15581 }
15582 value *= 2;
15583 ++count;
15584 }
15585 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15586 count, (double) value);
15587 return 1;
15588}
15589EOP
15590set try
15591
15592nv_overflows_integers_at='0'
15593if eval $compile; then
15594 xxx="`$run ./try`"
15595 case "$?" in
15596 0)
15597 case "$xxx" in
15598 2*) cat >&4 <<EOM
15599The largest integer your NVs can preserve is equal to $xxx
15600EOM
15601 nv_overflows_integers_at="$xxx"
15602 ;;
15603 *) cat >&4 <<EOM
15604Cannot determine the largest integer value your NVs can hold, unexpected output
15605'$xxx'
15606EOM
15607 ;;
15608 esac
15609 ;;
15610 *) cat >&4 <<EOM
15611Cannot determine the largest integer value your NVs can hold
15612EOM
15613 ;;
15614 esac
15615fi
15616$rm_try
15617
f607920a
CB
15618$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15619: volatile so that the compiler has to store it out to memory.
15620if test X"$d_volatile" = X"$define"; then
15621 volatile=volatile
15622fi
15623$cat <<EOP >try.c
15624#include <stdio.h>
15625#$i_stdlib I_STDLIB
15626#ifdef I_STDLIB
15627#include <stdlib.h>
15628#endif
15629#$i_string I_STRING
15630#ifdef I_STRING
15631# include <string.h>
15632#else
15633# include <strings.h>
15634#endif
15635#include <sys/types.h>
15636#include <signal.h>
15637#ifdef SIGFPE
15638$volatile int bletched = 0;
7090f861 15639$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15640#endif
15641
15642int checkit($nvtype d, char *where) {
15643 unsigned char *p = (char *)&d;
15644 unsigned char *end = p + sizeof(d);
15645 int fail = 0;
15646
15647 while (p < end)
15648 fail += *p++;
15649
15650 if (!fail)
17f6277d 15651 return 0;
f607920a
CB
15652
15653 p = (char *)&d;
15654 printf("No - %s: 0x", where);
15655 while (p < end)
15656 printf ("%02X", *p++);
15657 printf("\n");
15658 return 1;
15659}
15660
15661int main(int argc, char **argv) {
15662 $nvtype d = 0.0;
15663 int fail = 0;
15664 fail += checkit(d, "0.0");
15665
15666 /* The compiler shouldn't be assuming that bletched is 0 */
15667 d = bletched;
15668
15669 fail += checkit(d, "bleched");
15670
15671#ifdef SIGFPE
15672 signal(SIGFPE, blech);
15673#endif
15674
15675 /* Paranoia - the compiler should have no way of knowing that ANSI says
15676 that argv[argc] will always be NULL. Actually, if it did assume this it
15677 would be buggy, as this is C and main() can be called from elsewhere in
15678 the program. */
15679 d = argv[argc] ? 1 : 0;
15680
15681 if (d) {
15682 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15683 }
15684
15685 fail += checkit(d, "ternary");
15686
15687 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15688
15689 if (d != 0.0) {
15690 printf("No - memset doesn't give 0.0\n");
15691 /* This might just blow up: */
15692 printf("(gives %g)\n", d);
15693 return 1;
15694 }
5b813a60 15695
f607920a
CB
15696#ifdef SIGFPE
15697 if (bletched) {
15698 printf("No - something bleched\n");
15699 return 1;
15700 }
15701#endif
15702 if (fail) {
15703 printf("No - %d fail(s)\n", fail);
15704 return 1;
15705 }
15706 printf("Yes\n");
15707 return 0;
15708}
15709EOP
15710set try
15711
15712d_nv_zero_is_allbits_zero="$undef"
15713if eval $compile; then
15714 xxx="`$run ./try`"
15715 case "$?" in
15716 0)
15717 case "$xxx" in
15718 Yes) cat >&4 <<EOM
157190.0 is represented as all bits zero in memory
15720EOM
15721 d_nv_zero_is_allbits_zero="$define"
15722 ;;
15723 *) cat >&4 <<EOM
157240.0 is not represented as all bits zero in memory
15725EOM
15726 d_nv_zero_is_allbits_zero="$undef"
15727 ;;
15728 esac
15729 ;;
15730 *) cat >&4 <<EOM
157310.0 is not represented as all bits zero in memory
15732EOM
15733 d_nv_zero_is_allbits_zero="$undef"
15734 ;;
15735 esac
15736fi
5b813a60 15737$rm_try
b4eb6b3d
JH
15738
15739: check for off64_t
15740echo " "
15741echo "Checking to see if you have off64_t..." >&4
15742$cat >try.c <<EOCP
15743#include <sys/types.h>
15744#include <unistd.h>
15745int main() { off64_t x = 7; }
15746EOCP
15747set try
15748if eval $compile; then
15749 val="$define"
15750 echo "You have off64_t."
15751else
15752 val="$undef"
15753 echo "You do not have off64_t."
15754 case "$lseeksize" in
15755 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15756 esac
15757fi
5b813a60 15758$rm_try
b4eb6b3d
JH
15759set d_off64_t
15760eval $setvar
15761
b4eb6b3d
JH
15762: how to create joinable pthreads
15763if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15764 echo " "
5b813a60 15765 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
15766 $cat >try.c <<'EOCP'
15767#include <pthread.h>
15768int main() {
15769 int detachstate = JOINABLE;
15770}
15771EOCP
15772 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15773 if eval $compile; then
15774 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15775 val="$undef" # Yes, undef.
15776 set d_old_pthread_create_joinable
15777 eval $setvar
15778 val=""
15779 set old_pthread_create_joinable
15780 eval $setvar
15781 else
15782 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15783 if eval $compile; then
15784 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15785 val="$define"
15786 set d_old_pthread_create_joinable
15787 eval $setvar
15788 val=PTHREAD_CREATE_UNDETACHED
15789 set old_pthread_create_joinable
15790 eval $setvar
5b813a60 15791 else
b4eb6b3d
JH
15792 set try -DJOINABLE=__UNDETACHED
15793 if eval $compile; then
15794 echo "You seem to use __UNDETACHED." >&4
15795 val="$define"
15796 set d_old_pthread_create_joinable
15797 eval $setvar
15798 val=__UNDETACHED
15799 set old_pthread_create_joinable
15800 eval $setvar
15801 else
15802 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15803 val="$define"
15804 set d_old_pthread_create_joinable
15805 eval $setvar
15806 val=0
15807 set old_pthread_create_joinable
15808 eval $setvar
15809 fi
15810 fi
15811 fi
5b813a60 15812 $rm_try
b4eb6b3d
JH
15813else
15814 d_old_pthread_create_joinable="$undef"
15815 old_pthread_create_joinable=""
15816fi
15817
15818: see if pause exists
15819set pause d_pause
15820eval $inlibc
15821
b4eb6b3d
JH
15822: see if poll exists
15823set poll d_poll
15824eval $inlibc
15825
c7aff470
NIS
15826: see if readlink exists
15827set readlink d_readlink
15828eval $inlibc
15829
613d6c3e 15830: Check if exe is symlink to abs path of executing program
c7aff470 15831echo " "
f24dbf84 15832procselfexe=''
c7aff470 15833val="$undef"
a33c94aa
JH
15834case "$d_readlink" in
15835"$define")
c7aff470
NIS
15836 if $issymlink /proc/self/exe ; then
15837 $ls -l /proc/self/exe > reflect
51660ed5 15838 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15839 echo "You have Linux-like /proc/self/exe."
92236451 15840 procselfexe='"/proc/self/exe"'
f24dbf84 15841 val="$define"
f24dbf84
JH
15842 fi
15843 fi
15844 if $issymlink /proc/curproc/file ; then
15845 $ls -l /proc/curproc/file > reflect
15846 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15847 echo "You have BSD-like /proc/curproc/file."
92236451 15848 procselfexe='"/proc/curproc/file"'
f24dbf84 15849 val="$define"
c7aff470 15850 fi
c7aff470 15851 fi
a33c94aa
JH
15852 ;;
15853esac
428dc699 15854$rm -f reflect
c7aff470
NIS
15855set d_procselfexe
15856eval $setvar
15857
233e16ce
MB
15858: backward compatibility for d_hvfork
15859if test X$d_hvfork != X; then
15860 d_vfork="$d_hvfork"
15861 d_hvfork=''
15862fi
15863: see if there is a vfork
15864val=''
15865set vfork val
15866eval $inlibc
15867
15868d_pseudofork=$undef
15869
15870: Ok, but do we want to use it. vfork is reportedly unreliable in
15871: perl on Solaris 2.x, and probably elsewhere.
15872case "$val" in
15873$define)
15874 echo " "
15875 case "$usevfork" in
15876 false) dflt='n';;
15877 *) dflt='y';;
15878 esac
15879 cat <<'EOM'
15880
15881Perl can only use a vfork() that doesn't suffer from strict
15882restrictions on calling functions or modifying global data in
15883the child. For example, glibc-2.1 contains such a vfork()
15884that is unsuitable. If your system provides a proper fork()
15885call, chances are that you do NOT want perl to use vfork().
15886
15887EOM
15888 rp="Do you still want to use vfork()?"
15889 . ./myread
15890 case "$ans" in
15891 y|Y) ;;
15892 *)
15893 echo "Ok, we won't use vfork()."
15894 val="$undef"
15895 ;;
15896 esac
15897 ;;
15898esac
15899set d_vfork
15900eval $setvar
15901case "$d_vfork" in
15902$define) usevfork='true';;
15903*) usevfork='false';;
15904esac
15905
263fee3f
JH
15906: see whether the pthread_atfork exists
15907$cat >try.c <<EOP
15908#include <pthread.h>
15909#include <stdio.h>
15910int main() {
15911#ifdef PTHREAD_ATFORK
15912 pthread_atfork(NULL,NULL,NULL);
15913#endif
15914}
15915EOP
15916
d6483fcc 15917: see if pthread_atfork exists
263fee3f
JH
15918set try -DPTHREAD_ATFORK
15919if eval $compile; then
15920 val="$define"
15921else
15922 val="$undef"
15923fi
15924case "$usethreads" in
15925$define)
15926 case "$val" in
15927 $define) echo 'pthread_atfork found.' >&4 ;;
15928 *) echo 'pthread_atfork NOT found.' >&4 ;;
15929 esac
15930esac
15931set d_pthread_atfork
15932eval $setvar
d6483fcc 15933
58d975c3
JH
15934: see if pthread_attr_setscope exists
15935set pthread_attr_setscope d_pthread_attr_setscope
15936eval $inlibc
15937
b4eb6b3d
JH
15938: see whether the various POSIXish _yields exist
15939$cat >try.c <<EOP
15940#include <pthread.h>
15941#include <stdio.h>
15942int main() {
15943#ifdef SCHED_YIELD
15944 sched_yield();
15945#else
15946#ifdef PTHREAD_YIELD
15947 pthread_yield();
15948#else
15949#ifdef PTHREAD_YIELD_NULL
15950 pthread_yield(NULL);
15951#endif
15952#endif
15953#endif
15954}
15955EOP
15956: see if sched_yield exists
15957set try -DSCHED_YIELD
15958if eval $compile; then
15959 val="$define"
15960 sched_yield='sched_yield()'
15961else
15962 val="$undef"
15963fi
15964case "$usethreads" in
15965$define)
15966 case "$val" in
15967 $define) echo 'sched_yield() found.' >&4 ;;
15968 *) echo 'sched_yield() NOT found.' >&4 ;;
15969 esac
15970esac
10bc17b6
JH
15971set d_sched_yield
15972eval $setvar
b4eb6b3d 15973
10bc17b6
JH
15974: see if pthread_yield exists
15975set try -DPTHREAD_YIELD
15976if eval $compile; then
15977 val="$define"
15978 case "$sched_yield" in
15979 '') sched_yield='pthread_yield()' ;;
15980 esac
15981else
15982 set try -DPTHREAD_YIELD_NULL
15983 if eval $compile; then
15984 val="$define"
15985 case "$sched_yield" in
15986 '') sched_yield='pthread_yield(NULL)' ;;
15987 esac
15988 else
15989 val="$undef"
15990 fi
15991fi
15992case "$usethreads" in
15993$define)
15994 case "$val" in
15995 $define) echo 'pthread_yield() found.' >&4 ;;
15996 *) echo 'pthread_yield() NOT found.' >&4 ;;
15997 esac
15998 ;;
15999esac
16000set d_pthread_yield
16001eval $setvar
10bc17b6
JH
16002case "$sched_yield" in
16003'') sched_yield=undef ;;
16004esac
5b813a60 16005$rm_try
10bc17b6
JH
16006
16007: see if random_r exists
16008set random_r d_random_r
16009eval $inlibc
16010case "$d_random_r" in
16011"$define")
16012 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16013 case "$d_random_r_proto:$usethreads" in
16014 ":define") d_random_r_proto=define
a48ec845
JH
16015 set d_random_r_proto random_r $hdrs
16016 eval $hasproto ;;
16017 *) ;;
16018 esac
16019 case "$d_random_r_proto" in
16020 define)
10bc17b6
JH
16021 case "$random_r_proto" in
16022 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
16023 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
16024 esac
16025 case "$random_r_proto" in
16026 ''|0) try='int random_r(long*, struct random_data*);'
16027 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
16028 esac
16029 case "$random_r_proto" in
16030 ''|0) try='int random_r(struct random_data*, int32_t*);'
16031 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
16032 esac
16033 case "$random_r_proto" in
90e831dc 16034 ''|0) d_random_r=undef
10bc17b6 16035 random_r_proto=0
a48ec845 16036 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16037 * ) case "$random_r_proto" in
16038 REENTRANT_PROTO*) ;;
16039 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16040 esac
16041 echo "Prototype: $try" ;;
16042 esac
b4eb6b3d 16043 ;;
c18e646a
JH
16044 *) case "$usethreads" in
16045 define) echo "random_r has no prototype, not using it." >&4 ;;
16046 esac
90e831dc
SB
16047 d_random_r=undef
16048 random_r_proto=0
c18e646a 16049 ;;
a48ec845
JH
16050 esac
16051 ;;
10bc17b6 16052*) random_r_proto=0
b4eb6b3d
JH
16053 ;;
16054esac
16055
16056: see if readdir and friends exist
16057set readdir d_readdir
16058eval $inlibc
16059set seekdir d_seekdir
16060eval $inlibc
16061set telldir d_telldir
16062eval $inlibc
16063set rewinddir d_rewinddir
16064eval $inlibc
16065
10bc17b6
JH
16066: see if readdir64_r exists
16067set readdir64_r d_readdir64_r
16068eval $inlibc
16069case "$d_readdir64_r" in
16070"$define")
16071 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16072 case "$d_readdir64_r_proto:$usethreads" in
16073 ":define") d_readdir64_r_proto=define
a48ec845
JH
16074 set d_readdir64_r_proto readdir64_r $hdrs
16075 eval $hasproto ;;
16076 *) ;;
16077 esac
16078 case "$d_readdir64_r_proto" in
16079 define)
10bc17b6
JH
16080 case "$readdir64_r_proto" in
16081 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16082 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
16083 esac
16084 case "$readdir64_r_proto" in
16085 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16086 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
16087 esac
16088 case "$readdir64_r_proto" in
90e831dc 16089 ''|0) d_readdir64_r=undef
10bc17b6 16090 readdir64_r_proto=0
a48ec845 16091 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16092 * ) case "$readdir64_r_proto" in
16093 REENTRANT_PROTO*) ;;
16094 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16095 esac
16096 echo "Prototype: $try" ;;
16097 esac
16098 ;;
c18e646a
JH
16099 *) case "$usethreads" in
16100 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16101 esac
90e831dc
SB
16102 d_readdir64_r=undef
16103 readdir64_r_proto=0
c18e646a 16104 ;;
a48ec845
JH
16105 esac
16106 ;;
10bc17b6
JH
16107*) readdir64_r_proto=0
16108 ;;
16109esac
16110
16111: see if readdir_r exists
16112set readdir_r d_readdir_r
16113eval $inlibc
16114case "$d_readdir_r" in
16115"$define")
16116 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16117 case "$d_readdir_r_proto:$usethreads" in
16118 ":define") d_readdir_r_proto=define
a48ec845
JH
16119 set d_readdir_r_proto readdir_r $hdrs
16120 eval $hasproto ;;
16121 *) ;;
16122 esac
16123 case "$d_readdir_r_proto" in
16124 define)
10bc17b6
JH
16125 case "$readdir_r_proto" in
16126 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16127 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
16128 esac
16129 case "$readdir_r_proto" in
16130 ''|0) try='int readdir_r(DIR*, struct dirent*);'
16131 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
16132 esac
16133 case "$readdir_r_proto" in
90e831dc 16134 ''|0) d_readdir_r=undef
10bc17b6 16135 readdir_r_proto=0
a48ec845 16136 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16137 * ) case "$readdir_r_proto" in
16138 REENTRANT_PROTO*) ;;
16139 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16140 esac
16141 echo "Prototype: $try" ;;
16142 esac
16143 ;;
c18e646a
JH
16144 *) case "$usethreads" in
16145 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16146 esac
90e831dc
SB
16147 d_readdir_r=undef
16148 readdir_r_proto=0
c18e646a 16149 ;;
a48ec845
JH
16150 esac
16151 ;;
10bc17b6
JH
16152*) readdir_r_proto=0
16153 ;;
16154esac
16155
4e0554ec
JH
16156: see if readv exists
16157set readv d_readv
16158eval $inlibc
16159
16160: see if recvmsg exists
16161set recvmsg d_recvmsg
16162eval $inlibc
16163
b4eb6b3d
JH
16164: see if rename exists
16165set rename d_rename
16166eval $inlibc
16167
16168: see if rmdir exists
16169set rmdir d_rmdir
16170eval $inlibc
16171
16172: see if memory.h is available.
16173val=''
16174set memory.h val
16175eval $inhdr
16176
16177: See if it conflicts with string.h
16178case "$val" in
16179$define)
16180 case "$strings" in
16181 '') ;;
16182 *)
16183 $cppstdin $cppflags $cppminus < $strings > mem.h
16184 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16185 echo " "
16186 echo "We won't be including <memory.h>."
16187 val="$undef"
16188 fi
16189 $rm -f mem.h
16190 ;;
16191 esac
16192esac
16193set i_memory
16194eval $setvar
16195
16196: can bcopy handle overlapping blocks?
b6cc3bc4 16197echo " "
b4eb6b3d 16198val="$undef"
b6cc3bc4
AD
16199case "$d_memmove" in
16200"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16201*) case "$d_bcopy" in
16202 "$define")
16203 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16204 $cat >try.c <<EOCP
b4eb6b3d
JH
16205#$i_memory I_MEMORY
16206#$i_stdlib I_STDLIB
16207#$i_string I_STRING
16208#$i_unistd I_UNISTD
16209EOCP
16210 $cat >>try.c <<'EOCP'
16211#include <stdio.h>
16212#ifdef I_MEMORY
16213# include <memory.h>
16214#endif
16215#ifdef I_STDLIB
16216# include <stdlib.h>
16217#endif
16218#ifdef I_STRING
16219# include <string.h>
16220#else
16221# include <strings.h>
16222#endif
16223#ifdef I_UNISTD
16224# include <unistd.h> /* Needed for NetBSD */
16225#endif
16226int main()
16227{
16228char buf[128], abc[128];
16229char *b;
16230int len;
16231int off;
16232int align;
16233
b6cc3bc4
AD
16234/* Copy "abcde..." string to char abc[] so that gcc doesn't
16235 try to store the string in read-only memory. */
b4eb6b3d
JH
16236bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16237
16238for (align = 7; align >= 0; align--) {
16239 for (len = 36; len; len--) {
16240 b = buf+align;
16241 bcopy(abc, b, len);
16242 for (off = 1; off <= len; off++) {
16243 bcopy(b, b+off, len);
16244 bcopy(b+off, b, len);
16245 if (bcmp(b, abc, len))
16246 exit(1);
16247 }
16248 }
16249}
16250exit(0);
16251}
16252EOCP
b6cc3bc4
AD
16253 set try
16254 if eval $compile_ok; then
43dddb59 16255 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16256 echo "Yes, it can."
16257 val="$define"
16258 else
16259 echo "It can't, sorry."
16260 fi
b4eb6b3d 16261 else
b6cc3bc4 16262 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16263 fi
b6cc3bc4
AD
16264 ;;
16265 esac
5b813a60 16266 $rm_try
b4eb6b3d
JH
16267 ;;
16268esac
b4eb6b3d
JH
16269set d_safebcpy
16270eval $setvar
16271
16272: can memcpy handle overlapping blocks?
b6cc3bc4 16273echo " "
b4eb6b3d 16274val="$undef"
b6cc3bc4
AD
16275case "$d_memmove" in
16276"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16277*) case "$d_memcpy" in
16278 "$define")
16279 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16280 $cat >try.c <<EOCP
b4eb6b3d
JH
16281#$i_memory I_MEMORY
16282#$i_stdlib I_STDLIB
16283#$i_string I_STRING
16284#$i_unistd I_UNISTD
16285EOCP
16286 $cat >>try.c <<'EOCP'
16287#include <stdio.h>
16288#ifdef I_MEMORY
16289# include <memory.h>
16290#endif
16291#ifdef I_STDLIB
16292# include <stdlib.h>
16293#endif
16294#ifdef I_STRING
16295# include <string.h>
16296#else
16297# include <strings.h>
16298#endif
16299#ifdef I_UNISTD
16300# include <unistd.h> /* Needed for NetBSD */
16301#endif
16302int main()
16303{
16304char buf[128], abc[128];
16305char *b;
16306int len;
16307int off;
16308int align;
16309
16310/* Copy "abcde..." string to char abc[] so that gcc doesn't
16311 try to store the string in read-only memory. */
16312memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16313
16314for (align = 7; align >= 0; align--) {
16315 for (len = 36; len; len--) {
16316 b = buf+align;
16317 memcpy(b, abc, len);
16318 for (off = 1; off <= len; off++) {
16319 memcpy(b+off, b, len);
16320 memcpy(b, b+off, len);
16321 if (memcmp(b, abc, len))
16322 exit(1);
16323 }
16324 }
16325}
16326exit(0);
16327}
16328EOCP
b6cc3bc4
AD
16329 set try
16330 if eval $compile_ok; then
43dddb59 16331 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16332 echo "Yes, it can."
16333 val="$define"
16334 else
16335 echo "It can't, sorry."
16336 fi
b4eb6b3d 16337 else
b6cc3bc4 16338 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16339 fi
b6cc3bc4
AD
16340 ;;
16341 esac
5b813a60 16342 $rm_try
b4eb6b3d
JH
16343 ;;
16344esac
b4eb6b3d
JH
16345set d_safemcpy
16346eval $setvar
16347
16348: can memcmp be trusted to compare relative magnitude?
16349val="$undef"
16350case "$d_memcmp" in
16351"$define")
16352 echo " "
16353 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16354 $cat >try.c <<EOCP
16355#$i_memory I_MEMORY
16356#$i_stdlib I_STDLIB
16357#$i_string I_STRING
16358#$i_unistd I_UNISTD
16359EOCP
16360 $cat >>try.c <<'EOCP'
16361#include <stdio.h>
16362#ifdef I_MEMORY
16363# include <memory.h>
16364#endif
16365#ifdef I_STDLIB
36adc09b 16366# include <stdlib.h>
b4eb6b3d
JH
16367#endif
16368#ifdef I_STRING
16369# include <string.h>
16370#else
16371# include <strings.h>
16372#endif
16373#ifdef I_UNISTD
16374# include <unistd.h> /* Needed for NetBSD */
16375#endif
16376int main()
16377{
16378char a = -1;
16379char b = 0;
16380if ((a < b) && memcmp(&a, &b, 1) < 0)
16381 exit(1);
16382exit(0);
16383}
16384EOCP
16385 set try
16386 if eval $compile_ok; then
5440bc8e 16387 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16388 echo "Yes, it can."
16389 val="$define"
16390 else
16391 echo "No, it can't (it uses signed chars)."
16392 fi
16393 else
16394 echo "(I can't compile the test program, so we'll assume not...)"
16395 fi
16396 ;;
16397esac
5b813a60 16398$rm_try
b4eb6b3d
JH
16399set d_sanemcmp
16400eval $setvar
16401
ef9f17be
JH
16402: see if prototype for sbrk is available
16403echo " "
16404set d_sbrkproto sbrk $i_unistd unistd.h
16405eval $hasproto
16406
b4eb6b3d
JH
16407: see if select exists
16408set select d_select
16409eval $inlibc
16410
16411: see if semctl exists
16412set semctl d_semctl
16413eval $inlibc
16414
16415: see if semget exists
16416set semget d_semget
16417eval $inlibc
16418
16419: see if semop exists
16420set semop d_semop
16421eval $inlibc
16422
16423: see how much of the 'sem*(2)' library is present.
16424h_sem=true
16425echo " "
16426case "$d_semctl$d_semget$d_semop" in
16427*"$undef"*) h_sem=false;;
16428esac
16429case "$osname" in
16430freebsd)
16431 case "`ipcs 2>&1`" in
16432 "SVID messages"*"not configured"*)
16433 echo "Your $osname does not have the sem*(2) configured." >&4
16434 h_sem=false
16435 val="$undef"
16436 set semctl d_semctl
16437 eval $setvar
16438 set semget d_semget
16439 eval $setvar
16440 set semop d_semop
16441 eval $setvar
16442 ;;
16443 esac
16444 ;;
16445esac
16446: we could also check for sys/ipc.h ...
16447if $h_sem && $test `./findhdr sys/sem.h`; then
16448 echo "You have the full sem*(2) library." >&4
16449 val="$define"
16450else
16451 echo "You don't have the full sem*(2) library." >&4
16452 val="$undef"
16453fi
16454set d_sem
16455eval $setvar
16456
16457: see whether sys/sem.h defines union semun
16458echo " "
16459$cat > try.c <<'END'
16460#include <sys/types.h>
16461#include <sys/ipc.h>
16462#include <sys/sem.h>
16463int main () { union semun semun; semun.buf = 0; }
16464END
16465set try
16466if eval $compile; then
16467 echo "You have union semun in <sys/sem.h>." >&4
16468 val="$define"
16469else
16470 echo "You do not have union semun in <sys/sem.h>." >&4
16471 val="$undef"
16472fi
5b813a60 16473$rm_try
b4eb6b3d
JH
16474set d_union_semun
16475eval $setvar
16476
16477: see how to do semctl IPC_STAT
16478case "$d_sem" in
16479$define)
b4eb6b3d 16480 echo " "
93451a0d 16481 $cat > tryh.h <<END
b4eb6b3d
JH
16482#ifndef S_IRUSR
16483# ifdef S_IREAD
16484# define S_IRUSR S_IREAD
16485# define S_IWUSR S_IWRITE
16486# define S_IXUSR S_IEXEC
16487# else
16488# define S_IRUSR 0400
16489# define S_IWUSR 0200
16490# define S_IXUSR 0100
16491# endif
16492# define S_IRGRP (S_IRUSR>>3)
16493# define S_IWGRP (S_IWUSR>>3)
16494# define S_IXGRP (S_IXUSR>>3)
16495# define S_IROTH (S_IRUSR>>6)
16496# define S_IWOTH (S_IWUSR>>6)
16497# define S_IXOTH (S_IXUSR>>6)
16498#endif
16499#ifndef S_IRWXU
16500# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16501# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16502# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16503#endif
16504END
2fad75a1 16505 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16506 case "$d_semctl_semun" in
16507 '')
35918792 16508 val="$undef"
2fad75a1 16509 $cat > try.c <<END
b4eb6b3d
JH
16510#include <sys/types.h>
16511#include <sys/ipc.h>
16512#include <sys/sem.h>
16513#include <sys/stat.h>
16514#include <stdio.h>
16515#include <errno.h>
93451a0d 16516#include "tryh.h"
b4eb6b3d
JH
16517#ifndef errno
16518extern int errno;
16519#endif
16520#$d_union_semun HAS_UNION_SEMUN
16521int main() {
16522 union semun
16523#ifndef HAS_UNION_SEMUN
16524 {
16525 int val;
16526 struct semid_ds *buf;
16527 unsigned short *array;
16528 }
16529#endif
16530 arg;
16531 int sem, st;
16532
16533#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16534 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16535 if (sem > -1) {
16536 struct semid_ds argbuf;
16537 arg.buf = &argbuf;
16538# ifdef IPC_STAT
16539 st = semctl(sem, 0, IPC_STAT, arg);
16540 if (st == 0)
16541 printf("semun\n");
16542 else
16543# endif /* IPC_STAT */
16544 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16545# ifdef IPC_RMID
16546 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16547# endif /* IPC_RMID */
b4eb6b3d
JH
16548 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16549 } else
16550#endif /* IPC_PRIVATE && ... */
16551 printf("semget failed: errno = %d\n", errno);
16552 return 0;
16553}
16554END
2fad75a1
JH
16555 set try
16556 if eval $compile; then
16557 xxx=`$run ./try`
16558 case "$xxx" in
16559 semun) val="$define" ;;
16560 esac
16561 fi
5b813a60 16562 $rm_try
35918792
YST
16563 set d_semctl_semun
16564 eval $setvar
2fad75a1
JH
16565 ;;
16566 esac
b4eb6b3d
JH
16567 case "$d_semctl_semun" in
16568 $define)
16569 echo "You can use union semun for semctl IPC_STAT." >&4
16570 also='also'
16571 ;;
16572 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16573 also=''
16574 ;;
16575 esac
16576
16577 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16578 case "$d_semctl_semid_ds" in
16579 '')
35918792 16580 val="$undef"
2fad75a1 16581 $cat > try.c <<'END'
b4eb6b3d
JH
16582#include <sys/types.h>
16583#include <sys/ipc.h>
16584#include <sys/sem.h>
16585#include <sys/stat.h>
93451a0d 16586#include "tryh.h"
b4eb6b3d
JH
16587#include <stdio.h>
16588#include <errno.h>
16589#ifndef errno
16590extern int errno;
16591#endif
16592int main() {
16593 struct semid_ds arg;
16594 int sem, st;
16595
16596#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16597 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16598 if (sem > -1) {
16599# ifdef IPC_STAT
16600 st = semctl(sem, 0, IPC_STAT, &arg);
16601 if (st == 0)
16602 printf("semid_ds\n");
16603 else
16604# endif /* IPC_STAT */
16605 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16606# ifdef IPC_RMID
16607 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16608# endif /* IPC_RMID */
16609 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16610 } else
16611#endif /* IPC_PRIVATE && ... */
16612 printf("semget failed: errno = %d\n", errno);
16613
16614 return 0;
16615}
16616END
2fad75a1
JH
16617 set try
16618 if eval $compile; then
16619 xxx=`$run ./try`
16620 case "$xxx" in
16621 semid_ds) val="$define" ;;
16622 esac
16623 fi
5b813a60 16624 $rm_try
35918792
YST
16625 set d_semctl_semid_ds
16626 eval $setvar
2fad75a1
JH
16627 ;;
16628 esac
b4eb6b3d
JH
16629 case "$d_semctl_semid_ds" in
16630 $define)
16631 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16632 ;;
16633 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16634 ;;
16635 esac
b4eb6b3d
JH
16636 ;;
16637*) val="$undef"
16638
16639 # We do not have the full sem*(2) library, so assume we can not
16640 # use either.
16641
16642 set d_semctl_semun
16643 eval $setvar
16644
16645 set d_semctl_semid_ds
16646 eval $setvar
16647 ;;
16648esac
93451a0d 16649$rm_try tryh.h
b4eb6b3d 16650
4e0554ec
JH
16651: see if sendmsg exists
16652set sendmsg d_sendmsg
16653eval $inlibc
16654
b4eb6b3d
JH
16655: see if setegid exists
16656set setegid d_setegid
16657eval $inlibc
16658
16659: see if seteuid exists
16660set seteuid d_seteuid
16661eval $inlibc
16662
16663: see if setgrent exists
16664set setgrent d_setgrent
16665eval $inlibc
16666
10bc17b6
JH
16667: see if setgrent_r exists
16668set setgrent_r d_setgrent_r
16669eval $inlibc
16670case "$d_setgrent_r" in
16671"$define")
16672 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16673 case "$d_setgrent_r_proto:$usethreads" in
16674 ":define") d_setgrent_r_proto=define
a48ec845
JH
16675 set d_setgrent_r_proto setgrent_r $hdrs
16676 eval $hasproto ;;
16677 *) ;;
16678 esac
16679 case "$d_setgrent_r_proto" in
16680 define)
10bc17b6
JH
16681 case "$setgrent_r_proto" in
16682 ''|0) try='int setgrent_r(FILE**);'
16683 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16684 esac
16685 case "$setgrent_r_proto" in
16686 ''|0) try='void setgrent_r(FILE**);'
16687 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16688 esac
16689 case "$setgrent_r_proto" in
90e831dc 16690 ''|0) d_setgrent_r=undef
10bc17b6 16691 setgrent_r_proto=0
a48ec845 16692 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16693 * ) case "$setgrent_r_proto" in
16694 REENTRANT_PROTO*) ;;
16695 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16696 esac
16697 echo "Prototype: $try" ;;
16698 esac
16699 ;;
c18e646a
JH
16700 *) case "$usethreads" in
16701 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16702 esac
90e831dc
SB
16703 d_setgrent_r=undef
16704 setgrent_r_proto=0
c18e646a 16705 ;;
a48ec845
JH
16706 esac
16707 ;;
10bc17b6
JH
16708*) setgrent_r_proto=0
16709 ;;
16710esac
16711
b4eb6b3d
JH
16712: see if sethostent exists
16713set sethostent d_sethent
16714eval $inlibc
16715
10bc17b6
JH
16716: see if sethostent_r exists
16717set sethostent_r d_sethostent_r
16718eval $inlibc
16719case "$d_sethostent_r" in
16720"$define")
16721 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16722 case "$d_sethostent_r_proto:$usethreads" in
16723 ":define") d_sethostent_r_proto=define
a48ec845
JH
16724 set d_sethostent_r_proto sethostent_r $hdrs
16725 eval $hasproto ;;
16726 *) ;;
16727 esac
16728 case "$d_sethostent_r_proto" in
16729 define)
10bc17b6
JH
16730 case "$sethostent_r_proto" in
16731 ''|0) try='int sethostent_r(int, struct hostent_data*);'
16732 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16733 esac
16734 case "$sethostent_r_proto" in
16735 ''|0) try='void sethostent_r(int, struct hostent_data*);'
16736 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16737 esac
16738 case "$sethostent_r_proto" in
90e831dc 16739 ''|0) d_sethostent_r=undef
10bc17b6 16740 sethostent_r_proto=0
a48ec845 16741 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16742 * ) case "$sethostent_r_proto" in
16743 REENTRANT_PROTO*) ;;
16744 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16745 esac
16746 echo "Prototype: $try" ;;
16747 esac
16748 ;;
c18e646a
JH
16749 *) case "$usethreads" in
16750 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16751 esac
90e831dc
SB
16752 d_sethostent_r=undef
16753 sethostent_r_proto=0
c18e646a 16754 ;;
a48ec845
JH
16755 esac
16756 ;;
10bc17b6
JH
16757*) sethostent_r_proto=0
16758 ;;
16759esac
16760
4e0554ec
JH
16761: see if setitimer exists
16762set setitimer d_setitimer
16763eval $inlibc
16764
b4eb6b3d
JH
16765: see if setlinebuf exists
16766set setlinebuf d_setlinebuf
16767eval $inlibc
16768
16769: see if setlocale exists
16770set setlocale d_setlocale
16771eval $inlibc
16772
10bc17b6
JH
16773: see if locale.h is available
16774set locale.h i_locale
16775eval $inhdr
16776
16777: see if setlocale_r exists
16778set setlocale_r d_setlocale_r
16779eval $inlibc
16780case "$d_setlocale_r" in
16781"$define")
16782 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16783 case "$d_setlocale_r_proto:$usethreads" in
16784 ":define") d_setlocale_r_proto=define
a48ec845
JH
16785 set d_setlocale_r_proto setlocale_r $hdrs
16786 eval $hasproto ;;
16787 *) ;;
16788 esac
16789 case "$d_setlocale_r_proto" in
16790 define)
10bc17b6
JH
16791 case "$setlocale_r_proto" in
16792 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16793 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16794 esac
16795 case "$setlocale_r_proto" in
90e831dc 16796 ''|0) d_setlocale_r=undef
10bc17b6 16797 setlocale_r_proto=0
a48ec845 16798 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16799 * ) case "$setlocale_r_proto" in
16800 REENTRANT_PROTO*) ;;
16801 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16802 esac
16803 echo "Prototype: $try" ;;
16804 esac
16805 ;;
c18e646a
JH
16806 *) case "$usethreads" in
16807 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16808 esac
90e831dc
SB
16809 d_setlocale_r=undef
16810 setlocale_r_proto=0
c18e646a 16811 ;;
a48ec845
JH
16812 esac
16813 ;;
10bc17b6
JH
16814*) setlocale_r_proto=0
16815 ;;
16816esac
16817
b4eb6b3d
JH
16818: see if setnetent exists
16819set setnetent d_setnent
16820eval $inlibc
16821
10bc17b6
JH
16822: see if setnetent_r exists
16823set setnetent_r d_setnetent_r
16824eval $inlibc
16825case "$d_setnetent_r" in
16826"$define")
16827 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16828 case "$d_setnetent_r_proto:$usethreads" in
16829 ":define") d_setnetent_r_proto=define
a48ec845
JH
16830 set d_setnetent_r_proto setnetent_r $hdrs
16831 eval $hasproto ;;
16832 *) ;;
16833 esac
16834 case "$d_setnetent_r_proto" in
16835 define)
10bc17b6
JH
16836 case "$setnetent_r_proto" in
16837 ''|0) try='int setnetent_r(int, struct netent_data*);'
16838 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16839 esac
16840 case "$setnetent_r_proto" in
16841 ''|0) try='void setnetent_r(int, struct netent_data*);'
16842 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16843 esac
16844 case "$setnetent_r_proto" in
90e831dc 16845 ''|0) d_setnetent_r=undef
10bc17b6 16846 setnetent_r_proto=0
a48ec845 16847 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16848 * ) case "$setnetent_r_proto" in
16849 REENTRANT_PROTO*) ;;
16850 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16851 esac
16852 echo "Prototype: $try" ;;
16853 esac
16854 ;;
c18e646a
JH
16855 *) case "$usethreads" in
16856 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16857 esac
90e831dc
SB
16858 d_setnetent_r=undef
16859 setnetent_r_proto=0
c18e646a 16860 ;;
a48ec845
JH
16861 esac
16862 ;;
10bc17b6
JH
16863*) setnetent_r_proto=0
16864 ;;
16865esac
16866
b4eb6b3d
JH
16867: see if setprotoent exists
16868set setprotoent d_setpent
16869eval $inlibc
16870
16871: see if setpgid exists
16872set setpgid d_setpgid
16873eval $inlibc
16874
16875: see if setpgrp2 exists
16876set setpgrp2 d_setpgrp2
16877eval $inlibc
16878
16879: see if setpriority exists
16880set setpriority d_setprior
16881eval $inlibc
16882
16883: see if setproctitle exists
16884set setproctitle d_setproctitle
16885eval $inlibc
16886
10bc17b6
JH
16887: see if setprotoent_r exists
16888set setprotoent_r d_setprotoent_r
16889eval $inlibc
16890case "$d_setprotoent_r" in
16891"$define")
16892 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16893 case "$d_setprotoent_r_proto:$usethreads" in
16894 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16895 set d_setprotoent_r_proto setprotoent_r $hdrs
16896 eval $hasproto ;;
16897 *) ;;
16898 esac
16899 case "$d_setprotoent_r_proto" in
16900 define)
10bc17b6
JH
16901 case "$setprotoent_r_proto" in
16902 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16903 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16904 esac
16905 case "$setprotoent_r_proto" in
16906 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16907 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16908 esac
16909 case "$setprotoent_r_proto" in
90e831dc 16910 ''|0) d_setprotoent_r=undef
10bc17b6 16911 setprotoent_r_proto=0
a48ec845 16912 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16913 * ) case "$setprotoent_r_proto" in
16914 REENTRANT_PROTO*) ;;
16915 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16916 esac
16917 echo "Prototype: $try" ;;
16918 esac
16919 ;;
c18e646a
JH
16920 *) case "$usethreads" in
16921 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16922 esac
90e831dc
SB
16923 d_setprotoent_r=undef
16924 setprotoent_r_proto=0
c18e646a 16925 ;;
a48ec845
JH
16926 esac
16927 ;;
10bc17b6
JH
16928*) setprotoent_r_proto=0
16929 ;;
16930esac
16931
b4eb6b3d
JH
16932: see if setpwent exists
16933set setpwent d_setpwent
16934eval $inlibc
16935
10bc17b6
JH
16936: see if setpwent_r exists
16937set setpwent_r d_setpwent_r
16938eval $inlibc
16939case "$d_setpwent_r" in
16940"$define")
16941 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16942 case "$d_setpwent_r_proto:$usethreads" in
16943 ":define") d_setpwent_r_proto=define
a48ec845
JH
16944 set d_setpwent_r_proto setpwent_r $hdrs
16945 eval $hasproto ;;
16946 *) ;;
16947 esac
16948 case "$d_setpwent_r_proto" in
16949 define)
10bc17b6
JH
16950 case "$setpwent_r_proto" in
16951 ''|0) try='int setpwent_r(FILE**);'
16952 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16953 esac
16954 case "$setpwent_r_proto" in
16955 ''|0) try='void setpwent_r(FILE**);'
16956 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16957 esac
16958 case "$setpwent_r_proto" in
90e831dc 16959 ''|0) d_setpwent_r=undef
10bc17b6 16960 setpwent_r_proto=0
a48ec845 16961 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16962 * ) case "$setpwent_r_proto" in
16963 REENTRANT_PROTO*) ;;
16964 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16965 esac
16966 echo "Prototype: $try" ;;
16967 esac
16968 ;;
c18e646a
JH
16969 *) case "$usethreads" in
16970 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16971 esac
90e831dc
SB
16972 d_setpwent_r=undef
16973 setpwent_r_proto=0
c18e646a 16974 ;;
a48ec845
JH
16975 esac
16976 ;;
10bc17b6
JH
16977*) setpwent_r_proto=0
16978 ;;
16979esac
16980
b4eb6b3d
JH
16981: see if setregid exists
16982set setregid d_setregid
16983eval $inlibc
16984set setresgid d_setresgid
16985eval $inlibc
16986
16987: see if setreuid exists
16988set setreuid d_setreuid
16989eval $inlibc
16990set setresuid d_setresuid
16991eval $inlibc
16992
16993: see if setrgid exists
16994set setrgid d_setrgid
16995eval $inlibc
16996
16997: see if setruid exists
16998set setruid d_setruid
16999eval $inlibc
17000
17001: see if setservent exists
17002set setservent d_setsent
17003eval $inlibc
17004
10bc17b6
JH
17005: see if setservent_r exists
17006set setservent_r d_setservent_r
17007eval $inlibc
17008case "$d_setservent_r" in
17009"$define")
17010 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17011 case "$d_setservent_r_proto:$usethreads" in
17012 ":define") d_setservent_r_proto=define
a48ec845
JH
17013 set d_setservent_r_proto setservent_r $hdrs
17014 eval $hasproto ;;
17015 *) ;;
17016 esac
17017 case "$d_setservent_r_proto" in
17018 define)
10bc17b6
JH
17019 case "$setservent_r_proto" in
17020 ''|0) try='int setservent_r(int, struct servent_data*);'
17021 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
17022 esac
17023 case "$setservent_r_proto" in
17024 ''|0) try='void setservent_r(int, struct servent_data*);'
17025 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
17026 esac
17027 case "$setservent_r_proto" in
90e831dc 17028 ''|0) d_setservent_r=undef
10bc17b6 17029 setservent_r_proto=0
a48ec845 17030 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17031 * ) case "$setservent_r_proto" in
17032 REENTRANT_PROTO*) ;;
17033 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17034 esac
17035 echo "Prototype: $try" ;;
17036 esac
17037 ;;
c18e646a
JH
17038 *) case "$usethreads" in
17039 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17040 esac
90e831dc
SB
17041 d_setservent_r=undef
17042 setservent_r_proto=0
c18e646a 17043 ;;
a48ec845
JH
17044 esac
17045 ;;
10bc17b6
JH
17046*) setservent_r_proto=0
17047 ;;
17048esac
17049
b4eb6b3d
JH
17050: see if setsid exists
17051set setsid d_setsid
17052eval $inlibc
17053
17054: see if setvbuf exists
17055set setvbuf d_setvbuf
17056eval $inlibc
17057
17058: see if sfio.h is available
17059set sfio.h i_sfio
17060eval $inhdr
17061
b4eb6b3d
JH
17062: see if sfio library is available
17063case "$i_sfio" in
17064$define)
17065 val=''
17066 set sfreserve val
17067 eval $inlibc
17068 ;;
17069*)
17070 val="$undef"
17071 ;;
17072esac
17073: Ok, but do we want to use it.
17074case "$val" in
17075$define)
17076 case "$usesfio" in
17077 true|$define|[yY]*) dflt='y';;
17078 *) dflt='n';;
17079 esac
17080 echo "$package can use the sfio library, but it is experimental."
17081 case "$useperlio" in
17082 "$undef")
17083 echo "For sfio also the PerlIO abstraction layer is needed."
17084 echo "Earlier you said you wouldn't want that."
17085 ;;
17086 esac
17087 rp="You seem to have sfio available, do you want to try using it?"
17088 . ./myread
17089 case "$ans" in
17090 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
17091 useperlio="$define"
17092 val="$define"
17093 ;;
17094 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
17095 val="$undef"
b4eb6b3d
JH
17096 ;;
17097 esac
17098 ;;
17099*) case "$usesfio" in
17100 true|$define|[yY]*)
17101 echo "Sorry, cannot find sfio on this machine." >&4
17102 echo "Ignoring your setting of usesfio=$usesfio." >&4
17103 val="$undef"
17104 ;;
17105 esac
17106 ;;
17107esac
17108set d_sfio
17109eval $setvar
17110case "$d_sfio" in
17111$define) usesfio='true';;
17112*) usesfio='false';;
17113esac
3659ebf1
JH
17114case "$d_sfio" in
17115$define) ;;
17116*) : Remove sfio from list of libraries to use
7483f793
JH
17117 case "$libs" in
17118 *-lsfio*)
17119 echo "Removing unneeded -lsfio from library list" >&4
17120 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17121 shift
17122 libs="$*"
17123 echo "libs = $libs" >&4
17124 ;;
17125 esac
3659ebf1
JH
17126;;
17127esac
17128
b4eb6b3d
JH
17129
17130: see if shmctl exists
17131set shmctl d_shmctl
17132eval $inlibc
17133
17134: see if shmget exists
17135set shmget d_shmget
17136eval $inlibc
17137
17138: see if shmat exists
17139set shmat d_shmat
17140eval $inlibc
17141: see what shmat returns
17142case "$d_shmat" in
17143"$define")
17144 $cat >shmat.c <<'END'
17145#include <sys/shm.h>
17146void *shmat();
17147END
17148 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17149 shmattype='void *'
17150 else
17151 shmattype='char *'
17152 fi
17153 echo "and it returns ($shmattype)." >&4
17154 : see if a prototype for shmat is available
17155 xxx=`./findhdr sys/shm.h`
17156 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17157 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17158 val="$define"
17159 else
17160 val="$undef"
17161 fi
17162 $rm -f shmat.[co]
17163 ;;
17164*)
17165 val="$undef"
17166 ;;
17167esac
17168set d_shmatprototype
17169eval $setvar
17170
17171: see if shmdt exists
17172set shmdt d_shmdt
17173eval $inlibc
17174
17175: see how much of the 'shm*(2)' library is present.
17176h_shm=true
17177echo " "
17178case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17179*"$undef"*) h_shm=false;;
17180esac
17181case "$osname" in
17182freebsd)
17183 case "`ipcs 2>&1`" in
17184 "SVID shared memory"*"not configured"*)
17185 echo "Your $osname does not have the shm*(2) configured." >&4
17186 h_shm=false
17187 val="$undef"
17188 set shmctl d_shmctl
17189 evat $setvar
17190 set shmget d_shmget
17191 evat $setvar
17192 set shmat d_shmat
17193 evat $setvar
17194 set shmdt d_shmdt
17195 evat $setvar
17196 ;;
17197 esac
17198 ;;
17199esac
17200: we could also check for sys/ipc.h ...
17201if $h_shm && $test `./findhdr sys/shm.h`; then
17202 echo "You have the full shm*(2) library." >&4
17203 val="$define"
17204else
17205 echo "You don't have the full shm*(2) library." >&4
17206 val="$undef"
17207fi
17208set d_shm
17209eval $setvar
17210
b4eb6b3d 17211: see if we have sigaction
613d6c3e 17212echo " "
b4eb6b3d
JH
17213if set sigaction val -f d_sigaction; eval $csym; $val; then
17214 echo 'sigaction() found.' >&4
073b6de5 17215 $cat > try.c <<EOP
b4eb6b3d
JH
17216#include <stdio.h>
17217#include <sys/types.h>
17218#include <signal.h>
073b6de5
JH
17219#$i_stdlib I_STDLIB
17220#ifdef I_STDLIB
17221#include <stdlib.h>
17222#endif
b4eb6b3d
JH
17223int main()
17224{
17225 struct sigaction act, oact;
17226 act.sa_flags = 0;
17227 oact.sa_handler = 0;
17228 /* so that act and oact are used */
17229 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17230}
17231EOP
17232 set try
17233 if eval $compile_ok; then
17234 val="$define"
17235 else
17236 echo "But you don't seem to have a useable struct sigaction." >&4
17237 val="$undef"
17238 fi
17239else
17240 echo 'sigaction NOT found.' >&4
17241 val="$undef"
17242fi
17243set d_sigaction; eval $setvar
5b813a60 17244$rm_try
b4eb6b3d 17245
ed140128
AD
17246: see if this is a sunmath.h system
17247set sunmath.h i_sunmath
17248eval $inhdr
17249
17250: see if signbit exists
17251$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17252$cat >try.c <<EOCP
17253#$i_math I_MATH
17254#$i_sunmath I_SUNMATH
17255#ifdef I_MATH
17256# include <math.h>
17257#endif
17258#ifdef I_SUNMATH /* Solaris special math library */
17259# include <sunmath.h>
17260#endif
17261#define NV $nvtype
17262int main(int argc, char **argv)
17263{
17264 NV x = 0.0;
17265 NV y = -0.0;
17266 if ((signbit(x) == 0) && (signbit(y) != 0))
17267 return 0;
17268 else
17269 return 1;
17270}
17271EOCP
17272val="$undef"
17273set try
17274if eval $compile; then
17275 if $run ./try; then
17276 $echo "Yes." >&4
17277 val="$define"
17278 else
17279 $echo "Signbit seems to be available, but doesn't work as I expected."
17280 $echo "I won't use it." >&4
17281 val="$undef"
17282 fi
17283else
17284 $echo "Nope." >&4
17285 dflt="$undef"
17286fi
17287set d_signbit
17288eval $setvar
5b813a60 17289$rm_try
ed140128 17290
983dbef6
JH
17291: see if sigprocmask exists
17292set sigprocmask d_sigprocmask
17293eval $inlibc
17294
b4eb6b3d
JH
17295: see if sigsetjmp exists
17296echo " "
17297case "$d_sigsetjmp" in
17298'')
c727eafa 17299 $cat >try.c <<EOP
b4eb6b3d 17300#include <setjmp.h>
d1daaddf
JH
17301#$i_stdlib I_STDLIB
17302#ifdef I_STDLIB
17303#include <stdlib.h>
17304#endif
b4eb6b3d
JH
17305sigjmp_buf env;
17306int set = 1;
17307int main()
17308{
17309 if (sigsetjmp(env,1))
17310 exit(set);
17311 set = 0;
17312 siglongjmp(env, 1);
17313 exit(1);
17314}
17315EOP
17316 set try
17317 if eval $compile; then
5440bc8e 17318 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17319 echo "POSIX sigsetjmp found." >&4
17320 val="$define"
17321 else
17322 $cat >&4 <<EOM
17323Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17324I'll ignore them.
17325EOM
17326 val="$undef"
17327 fi
17328 else
17329 echo "sigsetjmp not found." >&4
17330 val="$undef"
17331 fi
17332 ;;
17333*) val="$d_sigsetjmp"
17334 case "$d_sigsetjmp" in
17335 $define) echo "POSIX sigsetjmp found." >&4;;
17336 $undef) echo "sigsetjmp not found." >&4;;
17337 esac
17338 ;;
17339esac
17340set d_sigsetjmp
17341eval $setvar
5b813a60 17342$rm_try
b4eb6b3d 17343
4f5da3e9
SP
17344: see if snprintf exists
17345set snprintf d_snprintf
17346eval $inlibc
17347
17348: see if vsnprintf exists
17349set vsnprintf d_vsnprintf
17350eval $inlibc
17351
2478f7a0
MB
17352case "$d_snprintf-$d_vsnprintf" in
17353"$define-$define")
17354 $cat <<EOM
17355Checking whether your snprintf() and vsnprintf() work okay...
17356EOM
17357 $cat >try.c <<'EOCP'
17358/* v?snprintf testing logic courtesy of Russ Allbery.
17359 * According to C99:
17360 * - if the buffer is too short it still must be \0-terminated
17361 * - if the buffer is too short the potentially required length
17362 * must be returned and not -1
17363 * - if the buffer is NULL the potentially required length
17364 * must be returned and not -1 or core dump
17365 */
17366#include <stdio.h>
17367#include <stdarg.h>
17368
17369char buf[2];
17370
17371int test (char *format, ...)
17372{
17373 va_list args;
17374 int count;
17375
17376 va_start (args, format);
17377 count = vsnprintf (buf, sizeof buf, format, args);
17378 va_end (args);
17379 return count;
17380}
17381
17382int main ()
17383{
17384 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17385 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17386}
17387EOCP
17388 set try
17389 if eval $compile; then
17390 `$run ./try`
17391 case "$?" in
17392 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17393 *) cat <<EOM >&4
17394Your snprintf() and snprintf() don't seem to be working okay.
17395EOM
17396 d_snprintf="$undef"
17397 d_vsnprintf="$undef"
17398 ;;
17399 esac
17400 else
17401 echo "(I can't seem to compile the test program--assuming they don't)"
17402 d_snprintf="$undef"
17403 d_vsnprintf="$undef"
17404 fi
5b813a60 17405 $rm_try
2478f7a0
MB
17406 ;;
17407esac
17408
49a78c82
JH
17409: see if sockatmark exists
17410set sockatmark d_sockatmark
17411eval $inlibc
17412
2ef53570
JH
17413: see if prototype for sockatmark is available
17414echo " "
17415set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17416eval $hasproto
17417
b4eb6b3d
JH
17418: see if socks5_init exists
17419set socks5_init d_socks5_init
17420eval $inlibc
17421
360321b3
YST
17422: see if sprintf returns the length of the string in the buffer as per ANSI
17423$echo "Checking whether sprintf returns the length of the string..." >&4
17424$cat <<EOP >try.c
17425#include <stdio.h>
17426#$i_stdlib I_STDLIB
17427#ifdef I_STDLIB
17428#include <stdlib.h>
17429#endif
17430#$i_string I_STRING
17431#ifdef I_STRING
17432# include <string.h>
17433#else
17434# include <strings.h>
17435#endif
17436#$i_math I_MATH
17437#ifdef I_MATH
17438#include <math.h>
17439#endif
17440
17441char buffer[256];
17442
17443int check (size_t expect, int test) {
17444 size_t got = strlen(buffer);
17445 if (expect == got)
17446 return 0;
17447
17448 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17449 test, buffer);
17450 exit (test);
17451}
17452
17453int main(int argc, char **argv) {
17454 int test = 0;
17455
17456 check(sprintf(buffer, ""), ++test);
17457 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17458 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17459
17460 return 0;
17461}
17462EOP
17463set try
17464
360321b3
YST
17465if eval $compile; then
17466 xxx="`$run ./try`"
17467 case "$?" in
17468 0) cat >&4 <<EOM
17469sprintf returns the length of the string (as ANSI says it should)
17470EOM
17471 d_sprintf_returns_strlen="$define"
17472 ;;
17473 *) cat >&4 <<EOM
17474sprintf does not return the length of the string (how old is this system?)
17475EOM
17476 d_sprintf_returns_strlen="$undef"
17477 ;;
17478 esac
d2821e72 17479else
36a30365
JH
17480 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17481 d_sprintf_returns_strlen="$undef"
360321b3 17482fi
5b813a60 17483$rm_try
360321b3 17484
10bc17b6
JH
17485: see if srand48_r exists
17486set srand48_r d_srand48_r
17487eval $inlibc
17488case "$d_srand48_r" in
17489"$define")
17490 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17491 case "$d_srand48_r_proto:$usethreads" in
17492 ":define") d_srand48_r_proto=define
a48ec845
JH
17493 set d_srand48_r_proto srand48_r $hdrs
17494 eval $hasproto ;;
17495 *) ;;
17496 esac
17497 case "$d_srand48_r_proto" in
17498 define)
10bc17b6
JH
17499 case "$srand48_r_proto" in
17500 ''|0) try='int srand48_r(long, struct drand48_data*);'
17501 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17502 esac
17503 case "$srand48_r_proto" in
90e831dc 17504 ''|0) d_srand48_r=undef
10bc17b6 17505 srand48_r_proto=0
a48ec845 17506 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17507 * ) case "$srand48_r_proto" in
17508 REENTRANT_PROTO*) ;;
17509 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17510 esac
17511 echo "Prototype: $try" ;;
17512 esac
17513 ;;
c18e646a
JH
17514 *) case "$usethreads" in
17515 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17516 esac
90e831dc
SB
17517 d_srand48_r=undef
17518 srand48_r_proto=0
c18e646a 17519 ;;
a48ec845
JH
17520 esac
17521 ;;
10bc17b6
JH
17522*) srand48_r_proto=0
17523 ;;
17524esac
17525
17526: see if srandom_r exists
17527set srandom_r d_srandom_r
17528eval $inlibc
17529case "$d_srandom_r" in
17530"$define")
17531 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17532 case "$d_srandom_r_proto:$usethreads" in
17533 ":define") d_srandom_r_proto=define
a48ec845
JH
17534 set d_srandom_r_proto srandom_r $hdrs
17535 eval $hasproto ;;
17536 *) ;;
17537 esac
17538 case "$d_srandom_r_proto" in
17539 define)
10bc17b6
JH
17540 case "$srandom_r_proto" in
17541 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17542 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17543 esac
17544 case "$srandom_r_proto" in
90e831dc 17545 ''|0) d_srandom_r=undef
10bc17b6 17546 srandom_r_proto=0
a48ec845 17547 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17548 * ) case "$srandom_r_proto" in
17549 REENTRANT_PROTO*) ;;
17550 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17551 esac
17552 echo "Prototype: $try" ;;
17553 esac
17554 ;;
c18e646a
JH
17555 *) case "$usethreads" in
17556 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17557 esac
90e831dc
SB
17558 d_srandom_r=undef
17559 srandom_r_proto=0
c18e646a 17560 ;;
a48ec845
JH
17561 esac
17562 ;;
10bc17b6
JH
17563*) srandom_r_proto=0
17564 ;;
17565esac
17566
eef837ea
JH
17567: see if prototype for setresgid is available
17568echo " "
17569set d_sresgproto setresgid $i_unistd unistd.h
17570eval $hasproto
17571
640374d0
JH
17572: see if prototype for setresuid is available
17573echo " "
17574set d_sresuproto setresuid $i_unistd unistd.h
17575eval $hasproto
17576
b4eb6b3d
JH
17577: see if sys/stat.h is available
17578set sys/stat.h i_sysstat
17579eval $inhdr
17580
b4eb6b3d
JH
17581: see if stat knows about block sizes
17582echo " "
17583echo "Checking to see if your struct stat has st_blocks field..." >&4
17584set d_statblks stat st_blocks $i_sysstat sys/stat.h
17585eval $hasfield
17586
b4eb6b3d
JH
17587: see if this is a sys/vfs.h system
17588set sys/vfs.h i_sysvfs
17589eval $inhdr
17590
b4eb6b3d
JH
17591: see if this is a sys/statfs.h system
17592set sys/statfs.h i_sysstatfs
17593eval $inhdr
17594
34f1896b 17595: Check for statfs_s
b4eb6b3d
JH
17596echo " "
17597echo "Checking to see if your system supports struct statfs..." >&4
17598set 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
17599eval $hasstruct
17600case "$d_statfs_s" in
17601"$define") echo "Yes, it does." ;;
17602*) echo "No, it doesn't." ;;
17603esac
17604
17605
b4eb6b3d
JH
17606: see if struct statfs knows about f_flags
17607case "$d_statfs_s" in
34f1896b 17608define)
b4eb6b3d
JH
17609 echo " "
17610 echo "Checking to see if your struct statfs has f_flags field..." >&4
17611 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
17612 eval $hasfield
17613 ;;
17614*) val="$undef"
17615 set d_statfs_f_flags
17616 eval $setvar
17617 ;;
17618esac
17619case "$d_statfs_f_flags" in
17620"$define") echo "Yes, it does." ;;
17621*) echo "No, it doesn't." ;;
17622esac
17623
613d6c3e 17624: Check stream access
b4eb6b3d
JH
17625$cat >&4 <<EOM
17626Checking how to access stdio streams by file descriptor number...
17627EOM
17628case "$stdio_stream_array" in
17629'') $cat >try.c <<EOCP
17630#include <stdio.h>
17631int main() {
17632 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17633 printf("yes\n");
17634}
17635EOCP
17636 for s in _iob __iob __sF
17637 do
17638 set try -DSTDIO_STREAM_ARRAY=$s
17639 if eval $compile; then
5440bc8e 17640 case "`$run ./try`" in
b4eb6b3d
JH
17641 yes) stdio_stream_array=$s; break ;;
17642 esac
17643 fi
17644 done
5b813a60 17645 $rm_try
b4eb6b3d
JH
17646esac
17647case "$stdio_stream_array" in
17648'') $cat >&4 <<EOM
17649I can't figure out how to access stdio streams by file descriptor number.
17650EOM
17651 d_stdio_stream_array="$undef"
17652 ;;
17653*) $cat >&4 <<EOM
17654You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17655EOM
17656 d_stdio_stream_array="$define"
17657 ;;
17658esac
17659
17660: see if strcoll exists
17661set strcoll d_strcoll
17662eval $inlibc
17663
17664: check for structure copying
17665echo " "
17666echo "Checking to see if your C compiler can copy structs..." >&4
17667$cat >try.c <<'EOCP'
76f47787 17668int main()
b4eb6b3d
JH
17669{
17670 struct blurfl {
17671 int dyick;
17672 } foo, bar;
17673
17674 foo = bar;
17675}
17676EOCP
17677if $cc -c try.c >/dev/null 2>&1 ; then
17678 val="$define"
17679 echo "Yup, it can."
17680else
17681 val="$undef"
17682 echo "Nope, it can't."
17683fi
17684set d_strctcpy
17685eval $setvar
5b813a60 17686$rm_try
b4eb6b3d
JH
17687
17688: see if strerror and/or sys_errlist[] exist
17689echo " "
17690if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17691 if set strerror val -f d_strerror; eval $csym; $val; then
17692 echo 'strerror() found.' >&4
17693 d_strerror="$define"
17694 d_strerrm='strerror(e)'
17695 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17696 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17697 d_syserrlst="$define"
17698 else
17699 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17700 d_syserrlst="$undef"
17701 fi
17702 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17703 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17704 echo 'strerror() found in string header.' >&4
17705 d_strerror="$define"
17706 d_strerrm='strerror(e)'
17707 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17708 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17709 d_syserrlst="$define"
17710 else
17711 echo "(You don't appear to have any sys_errlist[], how can this be?)"
17712 d_syserrlst="$undef"
17713 fi
17714 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17715 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17716 d_strerror="$undef"
17717 d_syserrlst="$define"
17718 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17719 else
17720 echo 'strerror() and sys_errlist[] NOT found.' >&4
17721 d_strerror="$undef"
17722 d_syserrlst="$undef"
17723 d_strerrm='"unknown"'
17724 fi
17725fi
17726
10bc17b6
JH
17727: see if strerror_r exists
17728set strerror_r d_strerror_r
17729eval $inlibc
17730case "$d_strerror_r" in
17731"$define")
17732 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
17733 case "$d_strerror_r_proto:$usethreads" in
17734 ":define") d_strerror_r_proto=define
a48ec845
JH
17735 set d_strerror_r_proto strerror_r $hdrs
17736 eval $hasproto ;;
17737 *) ;;
17738 esac
17739 case "$d_strerror_r_proto" in
17740 define)
10bc17b6
JH
17741 case "$strerror_r_proto" in
17742 ''|0) try='int strerror_r(int, char*, size_t);'
17743 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17744 esac
17745 case "$strerror_r_proto" in
17746 ''|0) try='int strerror_r(int, char*, int);'
17747 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17748 esac
17749 case "$strerror_r_proto" in
17750 ''|0) try='char* strerror_r(int, char*, size_t);'
17751 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17752 esac
17753 case "$strerror_r_proto" in
90e831dc 17754 ''|0) d_strerror_r=undef
10bc17b6 17755 strerror_r_proto=0
a48ec845 17756 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17757 * ) case "$strerror_r_proto" in
17758 REENTRANT_PROTO*) ;;
17759 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17760 esac
17761 echo "Prototype: $try" ;;
17762 esac
17763 ;;
c18e646a
JH
17764 *) case "$usethreads" in
17765 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17766 esac
90e831dc
SB
17767 d_strerror_r=undef
17768 strerror_r_proto=0
c18e646a 17769 ;;
a48ec845
JH
17770 esac
17771 ;;
10bc17b6
JH
17772*) strerror_r_proto=0
17773 ;;
17774esac
17775
b3c85772
JH
17776: see if strftime exists
17777set strftime d_strftime
17778eval $inlibc
17779
08c92000
MB
17780: see if strlcat exists
17781set strlcat d_strlcat
17782eval $inlibc
17783
17784: see if strlcpy exists
17785set strlcpy d_strlcpy
17786eval $inlibc
17787
b4eb6b3d
JH
17788: see if strtod exists
17789set strtod d_strtod
17790eval $inlibc
17791
17792: see if strtol exists
17793set strtol d_strtol
17794eval $inlibc
17795
17796: see if strtold exists
17797set strtold d_strtold
17798eval $inlibc
17799
17800: see if strtoll exists
17801set strtoll d_strtoll
17802eval $inlibc
17803
17804case "$d_longlong-$d_strtoll" in
17805"$define-$define")
17806 $cat <<EOM
17807Checking whether your strtoll() works okay...
17808EOM
17809 $cat >try.c <<'EOCP'
17810#include <errno.h>
17811#ifdef __hpux
17812#define strtoll __strtoll
17813#endif
e75931a7
YST
17814#ifdef __EMX__
17815#define strtoll _strtoll
17816#endif
b4eb6b3d 17817#include <stdio.h>
613d6c3e 17818extern long long int strtoll(char *s, char **, int);
b4eb6b3d
JH
17819static int bad = 0;
17820int check(char *s, long long ell, int een) {
17821 long long gll;
17822 errno = 0;
17823 gll = strtoll(s, 0, 10);
17824 if (!((gll == ell) && (errno == een)))
17825 bad++;
17826}
17827int main() {
17828 check(" 1", 1LL, 0);
17829 check(" 0", 0LL, 0);
17830 check("-1", -1LL, 0);
17831 check("-9223372036854775808", -9223372036854775808LL, 0);
17832 check("-9223372036854775808", -9223372036854775808LL, 0);
17833 check(" 9223372036854775807", 9223372036854775807LL, 0);
17834 check("-9223372036854775808", -9223372036854775808LL, 0);
17835 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17836 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17837 if (!bad)
17838 printf("ok\n");
17839}
17840EOCP
17841 set try
17842 if eval $compile; then
5440bc8e 17843 yyy=`$run ./try`
e75931a7 17844 case "$yyy" in
b4eb6b3d
JH
17845 ok) echo "Your strtoll() seems to be working okay." ;;
17846 *) cat <<EOM >&4
17847Your strtoll() doesn't seem to be working okay.
17848EOM
17849 d_strtoll="$undef"
17850 ;;
69eadf66 17851 esac
e75931a7
YST
17852 else
17853 echo "(I can't seem to compile the test program--assuming it doesn't)"
17854 d_strtoll="$undef"
b4eb6b3d
JH
17855 fi
17856 ;;
17857esac
17858
28e5dec8
JH
17859: see if strtoq exists
17860set strtoq d_strtoq
17861eval $inlibc
17862
b4eb6b3d
JH
17863: see if strtoul exists
17864set strtoul d_strtoul
17865eval $inlibc
17866
d0e6d399
NC
17867case "$d_strtoul" in
17868"$define")
17869 $cat <<EOM
17870Checking whether your strtoul() works okay...
17871EOM
17872 $cat >try.c <<'EOCP'
17873#include <errno.h>
17874#include <stdio.h>
613d6c3e 17875extern unsigned long int strtoul(char *s, char **, int);
d0e6d399
NC
17876static int bad = 0;
17877void check(char *s, unsigned long eul, int een) {
17878 unsigned long gul;
17879 errno = 0;
17880 gul = strtoul(s, 0, 10);
17881 if (!((gul == eul) && (errno == een)))
17882 bad++;
17883}
17884int main() {
17885 check(" 1", 1L, 0);
17886 check(" 0", 0L, 0);
17887EOCP
17888 case "$longsize" in
17889 8)
17890 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17891 check("18446744073709551615", 18446744073709551615UL, 0);
17892 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17893#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17894 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17895 check("-18446744073709551614", 2, 0);
17896 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17897 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17898 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17899#endif
d0e6d399
NC
17900EOCP
17901 ;;
17902 4)
17903 $cat >>try.c <<'EOCP'
17904 check("4294967295", 4294967295UL, 0);
17905 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17906#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17907 check("-1", 4294967295UL, 0);
17908 check("-4294967294", 2, 0);
17909 check("-4294967295", 1, 0);
17910 check("-4294967296", 4294967295UL, ERANGE);
17911 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17912#endif
d0e6d399
NC
17913EOCP
17914 ;;
17915 *)
17916: Should we write these tests to be more portable by sprintf-ing
17917: ~0 and then manipulating that char string as input for strtol?
17918 ;;
17919 esac
17920 $cat >>try.c <<'EOCP'
17921 if (!bad)
17922 printf("ok\n");
17923 return 0;
17924}
17925EOCP
17926 set try
17927 if eval $compile; then
5440bc8e 17928 case "`$run ./try`" in
d0e6d399
NC
17929 ok) echo "Your strtoul() seems to be working okay." ;;
17930 *) cat <<EOM >&4
17931Your strtoul() doesn't seem to be working okay.
17932EOM
17933 d_strtoul="$undef"
17934 ;;
17935 esac
9597a80f
NC
17936 else
17937 echo "(I can't seem to compile the test program--assuming it doesn't)"
17938 d_strtoul="$undef"
d0e6d399
NC
17939 fi
17940 ;;
17941esac
17942
b4eb6b3d
JH
17943: see if strtoull exists
17944set strtoull d_strtoull
17945eval $inlibc
17946
17947case "$d_longlong-$d_strtoull" in
17948"$define-$define")
17949 $cat <<EOM
17950Checking whether your strtoull() works okay...
17951EOM
17952 $cat >try.c <<'EOCP'
17953#include <errno.h>
17954#ifdef __hpux
17955#define strtoull __strtoull
17956#endif
17957#include <stdio.h>
613d6c3e 17958extern unsigned long long int strtoull(char *s, char **, int);
b4eb6b3d
JH
17959static int bad = 0;
17960int check(char *s, long long eull, int een) {
17961 long long gull;
17962 errno = 0;
17963 gull = strtoull(s, 0, 10);
17964 if (!((gull == eull) && (errno == een)))
17965 bad++;
17966}
17967int main() {
d0e6d399
NC
17968 check(" 1", 1LL, 0);
17969 check(" 0", 0LL, 0);
17970 check("18446744073709551615", 18446744073709551615ULL, 0);
17971 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17972#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17973 check("-1", 18446744073709551615ULL, 0);
17974 check("-18446744073709551614", 2LL, 0);
17975 check("-18446744073709551615", 1LL, 0);
17976 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17977 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17978#endif
b4eb6b3d
JH
17979 if (!bad)
17980 printf("ok\n");
17981}
17982EOCP
17983 set try
17984 if eval $compile; then
5440bc8e 17985 case "`$run ./try`" in
b4eb6b3d
JH
17986 ok) echo "Your strtoull() seems to be working okay." ;;
17987 *) cat <<EOM >&4
17988Your strtoull() doesn't seem to be working okay.
17989EOM
17990 d_strtoull="$undef"
17991 ;;
17992 esac
9597a80f
NC
17993 else
17994 echo "(I can't seem to compile the test program--assuming it doesn't)"
17995 d_strtoull="$undef"
b4eb6b3d
JH
17996 fi
17997 ;;
17998esac
17999
18000: see if strtouq exists
18001set strtouq d_strtouq
18002eval $inlibc
18003
d0e6d399
NC
18004case "$d_strtouq" in
18005"$define")
18006 $cat <<EOM
18007Checking whether your strtouq() works okay...
18008EOM
18009 $cat >try.c <<'EOCP'
18010#include <errno.h>
18011#include <stdio.h>
613d6c3e 18012extern unsigned long long int strtouq(char *s, char **, int);
d0e6d399
NC
18013static int bad = 0;
18014void check(char *s, unsigned long long eull, int een) {
18015 unsigned long long gull;
18016 errno = 0;
18017 gull = strtouq(s, 0, 10);
18018 if (!((gull == eull) && (errno == een)))
18019 bad++;
18020}
18021int main() {
18022 check(" 1", 1LL, 0);
18023 check(" 0", 0LL, 0);
18024 check("18446744073709551615", 18446744073709551615ULL, 0);
18025 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18026#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
18027 check("-1", 18446744073709551615ULL, 0);
18028 check("-18446744073709551614", 2LL, 0);
18029 check("-18446744073709551615", 1LL, 0);
18030 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18031 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18032#endif
d0e6d399
NC
18033 if (!bad)
18034 printf("ok\n");
18035 return 0;
18036}
18037EOCP
18038 set try
18039 if eval $compile; then
5440bc8e 18040 case "`$run ./try`" in
d0e6d399
NC
18041 ok) echo "Your strtouq() seems to be working okay." ;;
18042 *) cat <<EOM >&4
18043Your strtouq() doesn't seem to be working okay.
18044EOM
18045 d_strtouq="$undef"
18046 ;;
18047 esac
9597a80f
NC
18048 else
18049 echo "(I can't seem to compile the test program--assuming it doesn't)"
18050 d_strtouq="$undef"
d0e6d399
NC
18051 fi
18052 ;;
18053esac
18054
b4eb6b3d
JH
18055: see if strxfrm exists
18056set strxfrm d_strxfrm
18057eval $inlibc
18058
18059: see if symlink exists
18060set symlink d_symlink
18061eval $inlibc
18062
18063: see if syscall exists
18064set syscall d_syscall
18065eval $inlibc
18066
2ef53570
JH
18067: see if prototype for syscall is available
18068echo " "
18069set d_syscallproto syscall $i_unistd unistd.h
18070eval $hasproto
18071
b4eb6b3d
JH
18072: see if sysconf exists
18073set sysconf d_sysconf
18074eval $inlibc
18075
18076: see if system exists
18077set system d_system
18078eval $inlibc
18079
18080: see if tcgetpgrp exists
18081set tcgetpgrp d_tcgetpgrp
18082eval $inlibc
18083
18084: see if tcsetpgrp exists
18085set tcsetpgrp d_tcsetpgrp
18086eval $inlibc
18087
18088: see if prototype for telldir is available
18089echo " "
18090set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18091eval $hasproto
18092
ad493445
MB
18093: see if time exists
18094echo " "
18095if test "X$d_time" = X -o X"$timetype" = X; then
18096 if set time val -f d_time; eval $csym; $val; then
18097 echo 'time() found.' >&4
18098 val="$define"
18099 rp="What is the type returned by time() on this system?"
18100 set time_t timetype long stdio.h sys/types.h
18101 eval $typedef_ask
18102 else
18103 echo 'time() not found, hope that will do.' >&4
18104 val="$undef"
18105 timetype='int';
18106 fi
18107 set d_time
18108 eval $setvar
18109fi
18110
cbb9e8a7
MB
18111: see if timegm exists
18112set timegm d_timegm
18113eval $inlibc
18114
b4eb6b3d
JH
18115: see if this is a sys/times.h system
18116set sys/times.h i_systimes
18117eval $inhdr
18118
18119: see if times exists
18120echo " "
18121if set times val -f d_times; eval $csym; $val; then
18122 echo 'times() found.' >&4
18123 d_times="$define"
18124 inc=''
18125 case "$i_systimes" in
18126 "$define") inc='sys/times.h';;
18127 esac
18128 rp="What is the type returned by times() on this system?"
18129 set clock_t clocktype long stdio.h sys/types.h $inc
18130 eval $typedef_ask
18131else
18132 echo 'times() NOT found, hope that will do.' >&4
18133 d_times="$undef"
18134 clocktype='int'
18135fi
18136
10bc17b6
JH
18137: see if tmpnam_r exists
18138set tmpnam_r d_tmpnam_r
18139eval $inlibc
18140case "$d_tmpnam_r" in
18141"$define")
31ee0cb7 18142 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
18143 case "$d_tmpnam_r_proto:$usethreads" in
18144 ":define") d_tmpnam_r_proto=define
a48ec845
JH
18145 set d_tmpnam_r_proto tmpnam_r $hdrs
18146 eval $hasproto ;;
18147 *) ;;
18148 esac
18149 case "$d_tmpnam_r_proto" in
18150 define)
10bc17b6
JH
18151 case "$tmpnam_r_proto" in
18152 ''|0) try='char* tmpnam_r(char*);'
18153 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18154 esac
18155 case "$tmpnam_r_proto" in
90e831dc 18156 ''|0) d_tmpnam_r=undef
10bc17b6 18157 tmpnam_r_proto=0
a48ec845 18158 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18159 * ) case "$tmpnam_r_proto" in
18160 REENTRANT_PROTO*) ;;
18161 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18162 esac
18163 echo "Prototype: $try" ;;
18164 esac
18165 ;;
c18e646a
JH
18166 *) case "$usethreads" in
18167 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18168 esac
90e831dc
SB
18169 d_tmpnam_r=undef
18170 tmpnam_r_proto=0
c18e646a 18171 ;;
a48ec845
JH
18172 esac
18173 ;;
10bc17b6
JH
18174*) tmpnam_r_proto=0
18175 ;;
18176esac
18177
b4eb6b3d
JH
18178: see if truncate exists
18179set truncate d_truncate
18180eval $inlibc
18181
10bc17b6
JH
18182: see if ttyname_r exists
18183set ttyname_r d_ttyname_r
18184eval $inlibc
18185case "$d_ttyname_r" in
18186"$define")
18187 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
18188 case "$d_ttyname_r_proto:$usethreads" in
18189 ":define") d_ttyname_r_proto=define
a48ec845
JH
18190 set d_ttyname_r_proto ttyname_r $hdrs
18191 eval $hasproto ;;
18192 *) ;;
18193 esac
18194 case "$d_ttyname_r_proto" in
18195 define)
10bc17b6
JH
18196 case "$ttyname_r_proto" in
18197 ''|0) try='int ttyname_r(int, char*, size_t);'
18198 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18199 esac
18200 case "$ttyname_r_proto" in
18201 ''|0) try='int ttyname_r(int, char*, int);'
18202 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18203 esac
18204 case "$ttyname_r_proto" in
18205 ''|0) try='char* ttyname_r(int, char*, int);'
18206 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18207 esac
18208 case "$ttyname_r_proto" in
90e831dc 18209 ''|0) d_ttyname_r=undef
10bc17b6 18210 ttyname_r_proto=0
a48ec845 18211 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18212 * ) case "$ttyname_r_proto" in
18213 REENTRANT_PROTO*) ;;
18214 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18215 esac
18216 echo "Prototype: $try" ;;
18217 esac
18218 ;;
c18e646a
JH
18219 *) case "$usethreads" in
18220 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18221 esac
90e831dc
SB
18222 d_ttyname_r=undef
18223 ttyname_r_proto=0
c18e646a 18224 ;;
a48ec845
JH
18225 esac
18226 ;;
10bc17b6
JH
18227*) ttyname_r_proto=0
18228 ;;
18229esac
18230
b4eb6b3d
JH
18231: see if tzname[] exists
18232echo " "
18233if set tzname val -a d_tzname; eval $csym; $val; then
18234 val="$define"
18235 echo 'tzname[] found.' >&4
18236else
18237 val="$undef"
18238 echo 'tzname[] NOT found.' >&4
18239fi
18240set d_tzname
18241eval $setvar
18242
613d6c3e 18243: Check if is a multiplatform env
4e0554ec
JH
18244case "$osname" in
18245next|rhapsody|darwin) multiarch="$define" ;;
18246esac
18247case "$multiarch" in
18248''|[nN]*) multiarch="$undef" ;;
18249esac
18250
24412007 18251: check for ordering of bytes in a UV
4e0554ec 18252echo " "
5440bc8e 18253case "$usecrosscompile$multiarch" in
4e0554ec
JH
18254*$define*)
18255 $cat <<EOM
18256You seem to be either cross-compiling or doing a multiarchitecture build,
18257skipping the byteorder check.
18258
18259EOM
5440bc8e 18260 byteorder='ffff'
4e0554ec
JH
18261 ;;
18262*)
18263 case "$byteorder" in
18264 '')
18265 $cat <<'EOM'
18266In the following, larger digits indicate more significance. A big-endian
18267machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18268little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18269machines may have weird orders like 3412. A Cray will report 87654321,
18270an Alpha will report 12345678. If the test program works the default is
18271probably right.
18272I'm now running the test program...
18273EOM
24412007 18274 $cat >try.c <<EOCP
4e0554ec 18275#include <stdio.h>
55954f19
JH
18276#$i_stdlib I_STDLIB
18277#ifdef I_STDLIB
18278#include <stdlib.h>
18279#endif
24412007
JH
18280#include <sys/types.h>
18281typedef $uvtype UV;
4e0554ec
JH
18282int main()
18283{
18284 int i;
18285 union {
24412007
JH
18286 UV l;
18287 char c[$uvsize];
4e0554ec
JH
18288 } u;
18289
24412007 18290 if ($uvsize > 4)
b5ded3e5 18291 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18292 else
a4c53327 18293 u.l = (UV)0x04030201;
24412007 18294 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18295 printf("%c", u.c[i]+'0');
18296 printf("\n");
18297 exit(0);
18298}
18299EOCP
18300 xxx_prompt=y
18301 set try
43dddb59 18302 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18303 dflt=`$run ./try`
4e0554ec
JH
18304 case "$dflt" in
18305 [1-4][1-4][1-4][1-4]|12345678|87654321)
18306 echo "(The test program ran ok.)"
18307 echo "byteorder=$dflt"
18308 xxx_prompt=n
18309 ;;
18310 ????|????????) echo "(The test program ran ok.)" ;;
18311 *) echo "(The test program didn't run right for some reason.)" ;;
18312 esac
18313 else
18314 dflt='4321'
18315 cat <<'EOM'
18316(I can't seem to compile the test program. Guessing big-endian...)
18317EOM
18318 fi
18319 case "$xxx_prompt" in
18320 y)
24412007 18321 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18322 . ./myread
18323 byteorder="$ans"
18324 ;;
18325 *) byteorder=$dflt
18326 ;;
18327 esac
18328 ;;
18329 esac
5b813a60 18330 $rm_try
4e0554ec
JH
18331 ;;
18332esac
18333
613d6c3e 18334: Checking 32bit aligndness
4e0554ec
JH
18335$cat <<EOM
18336
18337Checking to see whether you can access character data unalignedly...
18338EOM
dc7b0a4f
JH
18339case "$d_u32align" in
18340'') $cat >try.c <<EOCP
4e0554ec 18341#include <stdio.h>
d1daaddf
JH
18342#$i_stdlib I_STDLIB
18343#ifdef I_STDLIB
18344#include <stdlib.h>
18345#endif
4e0554ec 18346#define U32 $u32type
d308175a
JH
18347#define BYTEORDER 0x$byteorder
18348#define U8 $u8type
9958dc3c
JH
18349#include <signal.h>
18350#ifdef SIGBUS
7090f861 18351$signal_t bletch(int s) { exit(4); }
9958dc3c 18352#endif
4e0554ec
JH
18353int main() {
18354#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 18355 U8 buf[8];
4e0554ec
JH
18356 U32 *up;
18357 int i;
18358
18359 if (sizeof(U32) != 4) {
18360 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18361 exit(1);
18362 }
18363
18364 fflush(stdout);
18365
9958dc3c
JH
18366#ifdef SIGBUS
18367 signal(SIGBUS, bletch);
18368#endif
18369
8906a23e
JH
18370 buf[0] = 0;
18371 buf[1] = 0;
18372 buf[2] = 0;
18373 buf[3] = 1;
7eac3fd6 18374 buf[4] = 0;
8906a23e
JH
18375 buf[5] = 0;
18376 buf[6] = 0;
7eac3fd6 18377 buf[7] = 1;
8906a23e 18378
4e0554ec
JH
18379 for (i = 0; i < 4; i++) {
18380 up = (U32*)(buf + i);
18381 if (! ((*up == 1 << (8*i)) || /* big-endian */
18382 (*up == 1 << (8*(3-i))) /* little-endian */
18383 )
18384 )
18385 {
18386 printf("read failed (%x)\n", *up);
18387 exit(2);
18388 }
18389 }
18390
18391 /* write test */
18392 for (i = 0; i < 4; i++) {
18393 up = (U32*)(buf + i);
18394 *up = 0xBeef;
18395 if (*up != 0xBeef) {
18396 printf("write failed (%x)\n", *up);
18397 exit(3);
18398 }
18399 }
18400
18401 exit(0);
18402#else
18403 printf("1\n");
18404 exit(1);
18405#endif
18406 return 0;
18407}
18408EOCP
18409set try
18410if eval $compile_ok; then
d308175a 18411 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18412 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18413 case "$?" in
18414 0) cat >&4 <<EOM
18415You can access character data pretty unalignedly.
18416EOM
18417 d_u32align="$undef"
18418 ;;
18419 *) cat >&4 <<EOM
18420It seems that you must access character data in an aligned manner.
18421EOM
18422 d_u32align="$define"
18423 ;;
18424 esac
4e0554ec
JH
18425else
18426 rp='Can you access character data at unaligned addresses?'
18427 dflt='n'
18428 . ./myread
18429 case "$ans" in
18430 [yY]*) d_u32align="$undef" ;;
18431 *) d_u32align="$define" ;;
18432 esac
18433fi
5b813a60 18434$rm_try
dc7b0a4f
JH
18435;;
18436esac
4e0554ec
JH
18437
18438: see if ualarm exists
18439set ualarm d_ualarm
18440eval $inlibc
18441
b4eb6b3d
JH
18442: see if umask exists
18443set umask d_umask
18444eval $inlibc
18445
758a5d79
JH
18446: see if unordered exists
18447set unordered d_unordered
18448eval $inlibc
18449
bdf33aa7
SP
18450: see if unsetenv exists
18451set unsetenv d_unsetenv
18452eval $inlibc
18453
4e0554ec
JH
18454: see if usleep exists
18455set usleep d_usleep
18456eval $inlibc
18457
2ef53570
JH
18458: see if prototype for usleep is available
18459echo " "
18460set d_usleepproto usleep $i_unistd unistd.h
18461eval $hasproto
18462
b4eb6b3d
JH
18463: see if ustat exists
18464set ustat d_ustat
18465eval $inlibc
18466
b4eb6b3d
JH
18467: see if closedir exists
18468set closedir d_closedir
18469eval $inlibc
18470
18471case "$d_closedir" in
18472"$define")
18473 echo " "
18474 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18475 cat > try.c <<EOM
b4eb6b3d
JH
18476#$i_dirent I_DIRENT /**/
18477#$i_sysdir I_SYS_DIR /**/
18478#$i_sysndir I_SYS_NDIR /**/
18479#$i_systypes I_SYS_TYPES /**/
18480
18481#if defined(I_SYS_TYPES)
18482#include <sys/types.h>
18483#endif
18484#if defined(I_DIRENT)
18485#include <dirent.h>
18486#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18487#include <sys/dir.h>
18488#endif
18489#else
18490#ifdef I_SYS_NDIR
18491#include <sys/ndir.h>
18492#else
18493#ifdef I_SYS_DIR
18494#ifdef hp9000s500
18495#include <ndir.h> /* may be wrong in the future */
18496#else
18497#include <sys/dir.h>
18498#endif
18499#endif
18500#endif
5b813a60 18501#endif
b4eb6b3d
JH
18502int main() { return closedir(opendir(".")); }
18503EOM
5440bc8e 18504 set try
b4eb6b3d 18505 if eval $compile_ok; then
5440bc8e 18506 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18507 echo "Yes, it does."
18508 val="$undef"
18509 else
18510 echo "No, it doesn't."
18511 val="$define"
18512 fi
18513 else
18514 echo "(I can't seem to compile the test program--assuming it doesn't)"
18515 val="$define"
18516 fi
18517 ;;
18518*)
18519 val="$undef";
18520 ;;
18521esac
18522set d_void_closedir
18523eval $setvar
5b813a60
MB
18524$rm_try
18525
b4eb6b3d
JH
18526: see if there is a wait4
18527set wait4 d_wait4
18528eval $inlibc
18529
18530: see if waitpid exists
18531set waitpid d_waitpid
18532eval $inlibc
18533
18534: see if wcstombs exists
18535set wcstombs d_wcstombs
18536eval $inlibc
18537
18538: see if wctomb exists
18539set wctomb d_wctomb
18540eval $inlibc
18541
4e0554ec
JH
18542: see if writev exists
18543set writev d_writev
18544eval $inlibc
18545
b4eb6b3d
JH
18546: preserve RCS keywords in files with variable substitution, grrr
18547Date='$Date'
18548Id='$Id'
18549Log='$Log'
18550RCSfile='$RCSfile'
18551Revision='$Revision'
18552
b4eb6b3d
JH
18553: check for alignment requirements
18554echo " "
5440bc8e 18555case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18556*$define*)
18557 $cat <<EOM
18558You seem to be either cross-compiling or doing a multiarchitecture build,
18559skipping the memory alignment check.
18560
18561EOM
18562 case "$alignbytes" in
18563 '') alignbytes=8 ;;
18564 esac
18565 ;;
18566*)
18567 case "$alignbytes" in
18568 '') echo "Checking alignment constraints..." >&4
18569 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18570 $cat >try.c <<'EOCP'
18571typedef long double NV;
18572EOCP
18573 else
18574 $cat >try.c <<'EOCP'
18575typedef double NV;
18576EOCP
18577 fi
18578 $cat >>try.c <<'EOCP'
18579#include <stdio.h>
18580struct foobar {
18581 char foo;
18582 NV bar;
18583} try_algn;
18584int main()
18585{
18586 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18587 return(0);
18588}
18589EOCP
18590 set try
18591 if eval $compile_ok; then
5440bc8e 18592 dflt=`$run ./try`
b4eb6b3d
JH
18593 else
18594 dflt='8'
18595 echo "(I can't seem to compile the test program...)"
18596 fi
18597 ;;
18598 *) dflt="$alignbytes"
18599 ;;
18600 esac
18601 rp="Doubles must be aligned on a how-many-byte boundary?"
18602 . ./myread
18603 alignbytes="$ans"
5b813a60 18604 $rm_try
b4eb6b3d
JH
18605 ;;
18606esac
18607
18608
18609: set the base revision
18610baserev=5.0
18611
3099fc99 18612: how do we concatenate cpp tokens here?
b4eb6b3d 18613echo " "
3099fc99 18614echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
18615$cat >cpp_stuff.c <<'EOCP'
18616#define RCAT(a,b)a/**/b
18617#define ACAT(a,b)a ## b
18618RCAT(Rei,ser)
18619ACAT(Cir,cus)
18620EOCP
18621$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18622if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18623 echo "Oh! Smells like ANSI's been here." >&4
18624 echo "We can catify or stringify, separately or together!"
18625 cpp_stuff=42
18626elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18627 echo "Ah, yes! The good old days!" >&4
18628 echo "However, in the good old days we don't know how to stringify and"
18629 echo "catify at the same time."
18630 cpp_stuff=1
18631else
18632 $cat >&4 <<EOM
3099fc99
CW
18633Hmm, I don't seem to be able to concatenate tokens with your cpp.
18634You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
18635EOM
18636 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18637fi
18638$rm -f cpp_stuff.*
18639
18640: see if this is a db.h system
18641set db.h i_db
18642eval $inhdr
18643
18644case "$i_db" in
18645$define)
18646 : Check db version.
18647 echo " "
18648 echo "Checking Berkeley DB version ..." >&4
18649 $cat >try.c <<EOCP
18650#$d_const HASCONST
18651#ifndef HASCONST
18652#define const
18653#endif
18654#include <sys/types.h>
18655#include <stdio.h>
55954f19
JH
18656#$i_stdlib I_STDLIB
18657#ifdef I_STDLIB
18658#include <stdlib.h>
18659#endif
b4eb6b3d 18660#include <db.h>
640374d0 18661int main(int argc, char *argv[])
b4eb6b3d
JH
18662{
18663#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18664 int Major, Minor, Patch ;
18665 unsigned long Version ;
18666 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
18667 if (argc == 2) {
18668 printf("%d %d %d %d %d %d\n",
18669 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18670 Major, Minor, Patch);
18671 exit(0);
18672 }
18673 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
18674
18675 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18676 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18677 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18678 Major, Minor, Patch) ;
18679
18680 /* check that db.h & libdb are compatible */
18681 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 18682 printf("db.h and libdb are incompatible.\n") ;
5b813a60 18683 exit(3);
b4eb6b3d
JH
18684 }
18685
640374d0 18686 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
18687
18688 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18689 + DB_VERSION_PATCH ;
18690
18691 /* needs to be >= 2.3.4 */
18692 if (Version < 2003004) {
18693 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 18694 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 18695 exit(2);
b4eb6b3d
JH
18696 }
18697
18698 exit(0);
18699#else
18700#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
18701 if (argc == 2) {
18702 printf("1 0 0\n");
18703 exit(0);
18704 }
18705 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
18706 exit(0); /* DB version < 2: the coast is clear. */
18707#else
18708 exit(1); /* <db.h> not Berkeley DB? */
18709#endif
18710#endif
18711}
18712EOCP
18713 set try
5440bc8e 18714 if eval $compile_ok && $run ./try; then
b4eb6b3d 18715 echo 'Looks OK.' >&4
5440bc8e 18716 set `$run ./try 1`
640374d0
JH
18717 db_version_major=$1
18718 db_version_minor=$2
18719 db_version_patch=$3
b4eb6b3d
JH
18720 else
18721 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
18722 i_db=$undef
18723 case " $libs " in
18724 *"-ldb "*)
18725 : Remove db from list of libraries to use
18726 echo "Removing unusable -ldb from library list" >&4
18727 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18728 shift
18729 libs="$*"
18730 echo "libs = $libs" >&4
18731 ;;
18732 esac
18733 fi
5b813a60 18734 $rm_try
b4eb6b3d
JH
18735 ;;
18736esac
18737
18738case "$i_db" in
18739define)
5b813a60 18740 : Check the return type needed for hash
b4eb6b3d
JH
18741 echo " "
18742 echo "Checking return type needed for hash for Berkeley DB ..." >&4
18743 $cat >try.c <<EOCP
18744#$d_const HASCONST
18745#ifndef HASCONST
18746#define const
18747#endif
18748#include <sys/types.h>
18749#include <db.h>
18750
18751#ifndef DB_VERSION_MAJOR
18752u_int32_t hash_cb (ptr, size)
18753const void *ptr;
18754size_t size;
18755{
18756}
18757HASHINFO info;
18758int main()
18759{
18760 info.hash = hash_cb;
18761}
18762#endif
18763EOCP
18764 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18765 if $contains warning try.out >>/dev/null 2>&1 ; then
18766 db_hashtype='int'
18767 else
18768 db_hashtype='u_int32_t'
18769 fi
18770 else
18771 : XXX Maybe we should just give up here.
18772 db_hashtype=u_int32_t
18773 $cat try.out >&4
18774 echo "Help: I can't seem to compile the db test program." >&4
18775 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18776 fi
5b813a60 18777 $rm_try
b4eb6b3d
JH
18778 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18779 ;;
18780*) db_hashtype=u_int32_t
18781 ;;
18782esac
18783case "$i_db" in
18784define)
5b813a60 18785 : Check the return type needed for prefix
b4eb6b3d
JH
18786 echo " "
18787 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18788 cat >try.c <<EOCP
18789#$d_const HASCONST
18790#ifndef HASCONST
18791#define const
18792#endif
18793#include <sys/types.h>
18794#include <db.h>
18795
18796#ifndef DB_VERSION_MAJOR
18797size_t prefix_cb (key1, key2)
18798const DBT *key1;
18799const DBT *key2;
18800{
18801}
18802BTREEINFO info;
18803int main()
18804{
18805 info.prefix = prefix_cb;
18806}
18807#endif
18808EOCP
18809 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18810 if $contains warning try.out >>/dev/null 2>&1 ; then
18811 db_prefixtype='int'
18812 else
18813 db_prefixtype='size_t'
18814 fi
18815 else
18816 db_prefixtype='size_t'
18817 : XXX Maybe we should just give up here.
18818 $cat try.out >&4
18819 echo "Help: I can't seem to compile the db test program." >&4
18820 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18821 fi
5b813a60 18822 $rm_try
b4eb6b3d
JH
18823 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18824 ;;
18825*) db_prefixtype='size_t'
18826 ;;
18827esac
18828
b4eb6b3d
JH
18829: How can we generate normalized random numbers ?
18830echo " "
18831echo "Looking for a random number function..." >&4
18832case "$randfunc" in
18833'')
18834 if set drand48 val -f; eval $csym; $val; then
18835 dflt="drand48"
18836 echo "Good, found drand48()." >&4
18837 elif set random val -f; eval $csym; $val; then
18838 dflt="random"
18839 echo "OK, found random()." >&4
18840 else
18841 dflt="rand"
18842 echo "Yick, looks like I have to use rand()." >&4
18843 fi
18844 echo " "
18845 ;;
18846*)
18847 dflt="$randfunc"
18848 ;;
18849esac
18850cont=true
18851
18852case "$ccflags" in
18853*-Dmy_rand=*|*-Dmy_srand=*)
18854 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18855 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18856 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18857 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18858 ;;
18859esac
18860
18861while $test "$cont"; do
18862 rp="Use which function to generate random numbers?"
18863 . ./myread
18864 if $test "$ans" = "$dflt"; then
18865 : null
18866 else
18867 randbits=''
18868 fi
18869 randfunc="$ans"
18870 if set $ans val -f; eval $csym; $val; then
18871 cont=''
18872 else
18873 dflt=y
18874 rp="I cannot find function $ans. Use that name anyway?"
18875 . ./myread
18876 dflt=rand
18877 case "$ans" in
18878 [yY]*) cont='';;
18879 esac
18880 fi
18881 case "$cont" in
18882 '')
18883 case "$randfunc" in
18884 drand48)
18885 drand01="drand48()"
18886 seedfunc="srand48"
18887 randbits=48
18888 randseedtype=long
18889 ;;
18890 rand|random)
18891 case "$randbits" in
18892 '')
18893echo "Checking to see how many bits your $randfunc() function produces..." >&4
18894 $cat >try.c <<EOCP
18895#$i_unistd I_UNISTD
18896#$i_stdlib I_STDLIB
18897#include <stdio.h>
18898#ifdef I_UNISTD
18899# include <unistd.h>
18900#endif
18901#ifdef I_STDLIB
18902# include <stdlib.h>
18903#endif
18904int main()
18905{
18906 register int i;
18907 register unsigned long tmp;
18908 register unsigned long max = 0L;
18909
18910 for (i = 1000; i; i--) {
18911 tmp = (unsigned long) $randfunc();
18912 if (tmp > max) max = tmp;
18913 }
18914 for (i = 0; max; i++)
18915 max /= 2;
18916 printf("%d\n",i);
18917}
18918EOCP
18919 set try
18920 if eval $compile_ok; then
18921 dflt=`try`
18922 else
18923 dflt='?'
18924 echo "(I can't seem to compile the test program...)"
18925 fi
18926 ;;
18927 *)
18928 dflt="$randbits"
18929 ;;
18930 esac
18931 rp="How many bits does your $randfunc() function produce?"
18932 . ./myread
18933 randbits="$ans"
5b813a60 18934 $rm_try
b4eb6b3d
JH
18935 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18936 seedfunc="s$randfunc"
18937 randseedtype=unsigned
18938 ;;
18939 *)
18940 dflt="31"
18941 rp="How many bits does your $randfunc() function produce?"
18942 . ./myread
18943 randbits="$ans"
18944 seedfunc="s$randfunc"
18945 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18946 if set $seedfunc val -f; eval $csym; $val; then
18947 echo "(Using $seedfunc() to seed random generator)"
18948 else
18949 echo "(Warning: no $seedfunc() to seed random generator)"
18950 seedfunc=rand
18951 fi
18952 randseedtype=unsigned
18953 ;;
18954 esac
18955 ;;
18956 esac
18957done
18958
613d6c3e 18959: Determine if this is an EBCDIC system
b4eb6b3d
JH
18960echo " "
18961echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18962$cat >try.c <<'EOM'
b4eb6b3d
JH
18963int main()
18964{
18965 if ('M'==0xd4) return 0;
18966 return 1;
18967}
18968EOM
18969
18970val=$undef
5440bc8e 18971set try
b4eb6b3d 18972if eval $compile_ok; then
5440bc8e 18973 if $run ./try; then
b4eb6b3d
JH
18974 echo "You seem to speak EBCDIC." >&4
18975 val="$define"
18976 else
5440bc8e 18977 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18978 fi
18979else
18980 echo "I'm unable to compile the test program." >&4
18981 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18982fi
5b813a60 18983$rm_try
b4eb6b3d
JH
18984set ebcdic
18985eval $setvar
18986
613d6c3e 18987: Check how to flush
b4eb6b3d
JH
18988echo " "
18989$cat >&4 <<EOM
18990Checking how to flush all pending stdio output...
18991EOM
18992# I only know how to find the first 32 possibly open files on SunOS.
18993# See also hints/sunos_4_1.sh and util.c --AD
18994case "$osname" in
18995sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18996esac
18997$cat >>try.c <<EOCP
18998#include <stdio.h>
55954f19
JH
18999#$i_stdlib I_STDLIB
19000#ifdef I_STDLIB
19001#include <stdlib.h>
19002#endif
b4eb6b3d
JH
19003#$i_unistd I_UNISTD
19004#ifdef I_UNISTD
19005# include <unistd.h>
19006#endif
19007#$d_sysconf HAS_SYSCONF
19008#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19009#ifdef HAS_STDIO_STREAM_ARRAY
19010# define STDIO_STREAM_ARRAY $stdio_stream_array
19011#endif
19012int main() {
5440bc8e
JH
19013 FILE* p;
19014 unlink("try.out");
19015 p = fopen("try.out", "w");
b4eb6b3d
JH
19016#ifdef TRY_FPUTC
19017 fputc('x', p);
19018#else
19019# ifdef TRY_FPRINTF
19020 fprintf(p, "x");
19021# endif
19022#endif
19023#ifdef TRY_FFLUSH_NULL
19024 fflush(NULL);
19025#endif
19026#ifdef TRY_FFLUSH_ALL
19027 {
19028 long open_max = -1;
19029# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19030 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19031# else
19032# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19033 open_max = sysconf(_SC_OPEN_MAX);
19034# else
19035# ifdef FOPEN_MAX
19036 open_max = FOPEN_MAX;
19037# else
19038# ifdef OPEN_MAX
19039 open_max = OPEN_MAX;
19040# else
19041# ifdef _NFILE
19042 open_max = _NFILE;
19043# endif
19044# endif
19045# endif
19046# endif
5b813a60 19047# endif
b4eb6b3d
JH
19048# ifdef HAS_STDIO_STREAM_ARRAY
19049 if (open_max > 0) {
19050 long i;
19051 for (i = 0; i < open_max; i++)
19052 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19053 STDIO_STREAM_ARRAY[i]._file < open_max &&
19054 STDIO_STREAM_ARRAY[i]._flag)
19055 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 19056 }
b4eb6b3d
JH
19057 }
19058# endif
19059#endif
19060 _exit(42);
19061}
19062EOCP
19063: first we have to find out how _not_ to flush
5440bc8e 19064$to try.c
b4eb6b3d
JH
19065if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19066 output=''
19067 set try -DTRY_FPUTC
19068 if eval $compile; then
fbe73d74 19069 $run ./try 2>/dev/null
28f5ac64 19070 code="$?"
5440bc8e 19071 $from try.out
28f5ac64 19072 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19073 output=-DTRY_FPUTC
19074 fi
19075 fi
19076 case "$output" in
19077 '')
19078 set try -DTRY_FPRINTF
b4eb6b3d 19079 if eval $compile; then
fbe73d74 19080 $run ./try 2>/dev/null
28f5ac64 19081 code="$?"
5440bc8e 19082 $from try.out
28f5ac64 19083 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19084 output=-DTRY_FPRINTF
19085 fi
19086 fi
19087 ;;
19088 esac
19089fi
19090: check for fflush NULL behaviour
19091case "$fflushNULL" in
19092'') set try -DTRY_FFLUSH_NULL $output
19093 if eval $compile; then
5440bc8e 19094 $run ./try 2>/dev/null
b4eb6b3d 19095 code="$?"
5440bc8e 19096 $from try.out
b4eb6b3d
JH
19097 if $test -s try.out -a "X$code" = X42; then
19098 fflushNULL="`$cat try.out`"
19099 else
19100 if $test "X$code" != X42; then
19101 $cat >&4 <<EOM
19102(If this test failed, don't worry, we'll try another method shortly.)
19103EOM
19104 fi
19105 fi
19106 fi
2c476adc 19107 $rm -f core try.core core.try.*
b4eb6b3d
JH
19108 case "$fflushNULL" in
19109 x) $cat >&4 <<EOM
19110Your fflush(NULL) works okay for output streams.
19111Let's see if it clobbers input pipes...
19112EOM
19113# As of mid-March 2000 all versions of Solaris appear to have a stdio
19114# bug that improperly flushes the input end of pipes. So we avoid the
19115# autoflush on fork/system/exec support for now. :-(
19116$cat >tryp.c <<EOCP
19117#include <stdio.h>
19118int
19119main(int argc, char **argv)
19120{
19121 char buf[1024];
19122 int i;
19123 char *bp = buf;
19124 while (1) {
19125 while ((i = getc(stdin)) != -1
19126 && (*bp++ = i) != '\n'
19127 && bp < &buf[1024])
19128 /* DO NOTHING */ ;
19129 *bp = '\0';
19130 fprintf(stdout, "%s", buf);
19131 fflush(NULL);
19132 if (i == -1)
19133 return 0;
19134 bp = buf;
19135 }
19136}
19137EOCP
19138 fflushNULL="$define"
19139 set tryp
19140 if eval $compile; then
19141 $rm -f tryp.out
5440bc8e 19142 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19143 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19144 $cat >&4 <<EOM
19145fflush(NULL) seems to behave okay with input streams.
19146EOM
19147 fflushNULL="$define"
19148 else
19149 $cat >&4 <<EOM
19150Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19151EOM
19152 fflushNULL="$undef"
19153 fi
19154 fi
19155 $rm -f core tryp.c tryp.core core.tryp.*
19156 ;;
19157 '') $cat >&4 <<EOM
19158Your fflush(NULL) isn't working (contrary to ANSI C).
19159EOM
19160 fflushNULL="$undef"
19161 ;;
19162 *) $cat >&4 <<EOM
19163Cannot figure out whether your fflush(NULL) works or not.
19164I'm assuming it doesn't (contrary to ANSI C).
19165EOM
19166 fflushNULL="$undef"
19167 ;;
19168 esac
19169 ;;
19170$define|true|[yY]*)
19171 fflushNULL="$define"
19172 ;;
19173*)
19174 fflushNULL="$undef"
19175 ;;
19176esac
19177: check explicit looping only if NULL did not work, and if the pipe
19178: bug does not show up on an explicit flush too
19179case "$fflushNULL" in
19180"$undef")
19181 $cat >tryp.c <<EOCP
19182#include <stdio.h>
19183int
19184main(int argc, char **argv)
19185{
19186 char buf[1024];
19187 int i;
19188 char *bp = buf;
19189 while (1) {
19190 while ((i = getc(stdin)) != -1
19191 && (*bp++ = i) != '\n'
19192 && bp < &buf[1024])
19193 /* DO NOTHING */ ;
19194 *bp = '\0';
19195 fprintf(stdout, "%s", buf);
19196 fflush(stdin);
19197 if (i == -1)
19198 return 0;
19199 bp = buf;
19200 }
19201}
19202EOCP
19203 set tryp
19204 if eval $compile; then
19205 $rm -f tryp.out
5440bc8e 19206 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19207 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19208 $cat >&4 <<EOM
19209Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19210EOM
19211 : now check for fflushall behaviour
19212 case "$fflushall" in
19213 '') set try -DTRY_FFLUSH_ALL $output
19214 if eval $compile; then
19215 $cat >&4 <<EOM
19216(Now testing the other method--but note that this also may fail.)
19217EOM
5440bc8e 19218 $run ./try 2>/dev/null
28f5ac64 19219 code=$?
fbe73d74 19220 $from try.out
28f5ac64 19221 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19222 fflushall="`$cat try.out`"
19223 fi
19224 fi
5b813a60 19225 $rm_try
b4eb6b3d
JH
19226 case "$fflushall" in
19227 x) $cat >&4 <<EOM
19228Whew. Flushing explicitly all the stdio streams works.
19229EOM
19230 fflushall="$define"
19231 ;;
19232 '') $cat >&4 <<EOM
19233Sigh. Flushing explicitly all the stdio streams doesn't work.
19234EOM
19235 fflushall="$undef"
19236 ;;
19237 *) $cat >&4 <<EOM
19238Cannot figure out whether flushing stdio streams explicitly works or not.
19239I'm assuming it doesn't.
19240EOM
19241 fflushall="$undef"
19242 ;;
19243 esac
19244 ;;
19245 "$define"|true|[yY]*)
19246 fflushall="$define"
19247 ;;
19248 *)
19249 fflushall="$undef"
19250 ;;
19251 esac
19252 else
19253 $cat >&4 <<EOM
19254All is futile. Even fflush(stdin) clobbers input pipes!
19255EOM
19256 fflushall="$undef"
19257 fi
19258 else
19259 fflushall="$undef"
19260 fi
19261 $rm -f core tryp.c tryp.core core.tryp.*
19262 ;;
19263*) fflushall="$undef"
19264 ;;
19265esac
19266
19267case "$fflushNULL$fflushall" in
19268undefundef)
19269 $cat <<EOM
19270OK, I give up. I cannot figure out how to flush pending stdio output.
19271We won't be flushing handles at all before fork/exec/popen.
19272EOM
19273 ;;
19274esac
34f1896b 19275$rm_try tryp
b4eb6b3d
JH
19276
19277: Store the full pathname to the ar program for use in the C program
19278: Respect a hint or command line value for full_ar.
19279case "$full_ar" in
19280'') full_ar=$ar ;;
19281esac
19282
19283: Store the full pathname to the sed program for use in the C program
19284full_sed=$sed
19285
19286: see what type gids are declared as in the kernel
19287echo " "
19288echo "Looking for the type for group ids returned by getgid()."
19289set gid_t gidtype xxx stdio.h sys/types.h
19290eval $typedef
19291case "$gidtype" in
19292xxx)
19293 xxx=`./findhdr sys/user.h`
19294 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19295 case $1 in
19296 unsigned) dflt="$1 $2" ;;
19297 *) dflt="$1" ;;
19298 esac
19299 ;;
19300*) dflt="$gidtype";;
19301esac
19302case "$gidtype" in
19303gid_t) echo "gid_t found." ;;
19304*) rp="What is the type for group ids returned by getgid()?"
19305 . ./myread
19306 gidtype="$ans"
19307 ;;
19308esac
19309
613d6c3e 19310: Check the size of GID
b4eb6b3d
JH
19311echo " "
19312case "$gidtype" in
19313*_t) zzz="$gidtype" ;;
19314*) zzz="gid" ;;
19315esac
613d6c3e 19316echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
19317cat > try.c <<EOCP
19318#include <sys/types.h>
19319#include <stdio.h>
d1daaddf
JH
19320#$i_stdlib I_STDLIB
19321#ifdef I_STDLIB
19322#include <stdlib.h>
19323#endif
b4eb6b3d
JH
19324int main() {
19325 printf("%d\n", (int)sizeof($gidtype));
19326 exit(0);
19327}
19328EOCP
19329set try
19330if eval $compile_ok; then
5440bc8e 19331 yyy=`$run ./try`
b4eb6b3d
JH
19332 case "$yyy" in
19333 '') gidsize=4
19334 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19335 ;;
19336 *) gidsize=$yyy
19337 echo "Your $zzz is $gidsize bytes long."
19338 ;;
19339 esac
19340else
19341 gidsize=4
19342 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19343fi
19344
19345
613d6c3e 19346: Check if GID is signed
b4eb6b3d
JH
19347echo " "
19348case "$gidtype" in
19349*_t) zzz="$gidtype" ;;
19350*) zzz="gid" ;;
19351esac
613d6c3e 19352echo "Checking the sign of $zzz..." >&4
b4eb6b3d
JH
19353cat > try.c <<EOCP
19354#include <sys/types.h>
19355#include <stdio.h>
19356int main() {
19357 $gidtype foo = -1;
19358 if (foo < 0)
19359 printf("-1\n");
19360 else
19361 printf("1\n");
19362}
19363EOCP
19364set try
19365if eval $compile; then
5440bc8e 19366 yyy=`$run ./try`
b4eb6b3d
JH
19367 case "$yyy" in
19368 '') gidsign=1
19369 echo "(I can't execute the test program--guessing unsigned.)" >&4
19370 ;;
19371 *) gidsign=$yyy
19372 case "$gidsign" in
19373 1) echo "Your $zzz is unsigned." ;;
19374 -1) echo "Your $zzz is signed." ;;
19375 esac
19376 ;;
19377 esac
19378else
19379 gidsign=1
19380 echo "(I can't compile the test program--guessing unsigned.)" >&4
19381fi
19382
19383
613d6c3e 19384: Check 64bit sizes
b4eb6b3d
JH
19385echo " "
19386
19387if $test X"$quadtype" != X; then
19388
19389echo "Checking how to print 64-bit integers..." >&4
19390
19391if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19392 $cat >try.c <<'EOCP'
19393#include <sys/types.h>
19394#include <stdio.h>
19395int main() {
19396 int q = 12345678901;
19397 printf("%ld\n", q);
19398}
19399EOCP
19400 set try
19401 if eval $compile; then
5440bc8e 19402 yyy=`$run ./try`
b4eb6b3d
JH
19403 case "$yyy" in
19404 12345678901)
19405 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19406 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19407 echo "We will use %d."
19408 ;;
19409 esac
19410 fi
19411fi
19412
19413if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19414 $cat >try.c <<'EOCP'
19415#include <sys/types.h>
19416#include <stdio.h>
19417int main() {
19418 long q = 12345678901;
19419 printf("%ld\n", q);
19420}
19421EOCP
19422 set try
19423 if eval $compile; then
5440bc8e 19424 yyy=`$run ./try`
b4eb6b3d
JH
19425 case "$yyy" in
19426 12345678901)
19427 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19428 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19429 echo "We will use %ld."
19430 ;;
19431 esac
19432 fi
19433fi
19434
19435if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19436 $cat >try.c <<'EOCP'
19437#include <sys/types.h>
19438#include <inttypes.h>
19439#include <stdio.h>
19440int main() {
19441 int64_t q = 12345678901;
19442 printf("%" PRId64 "\n", q);
19443}
19444EOCP
19445 set try
19446 if eval $compile; then
5440bc8e 19447 yyy=`$run ./try`
b4eb6b3d
JH
19448 case "$yyy" in
19449 12345678901)
19450 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19451 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19452 echo "We will use the C9X style."
19453 ;;
19454 esac
19455 fi
19456fi
19457
2ef53570
JH
19458if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19459 $cat >try.c <<EOCP
b4eb6b3d
JH
19460#include <sys/types.h>
19461#include <stdio.h>
19462int main() {
2ef53570
JH
19463 $quadtype q = 12345678901;
19464 printf("%Ld\n", q);
b4eb6b3d
JH
19465}
19466EOCP
19467 set try
19468 if eval $compile; then
5440bc8e 19469 yyy=`$run ./try`
b4eb6b3d
JH
19470 case "$yyy" in
19471 12345678901)
2ef53570
JH
19472 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19473 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19474 echo "We will use %Ld."
b4eb6b3d
JH
19475 ;;
19476 esac
19477 fi
19478fi
19479
2ef53570
JH
19480if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19481 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19482#include <sys/types.h>
19483#include <stdio.h>
19484int main() {
2ef53570
JH
19485 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19486 printf("%lld\n", q);
b4eb6b3d
JH
19487}
19488EOCP
19489 set try
19490 if eval $compile; then
5440bc8e 19491 yyy=`$run ./try`
b4eb6b3d
JH
19492 case "$yyy" in
19493 12345678901)
2ef53570
JH
19494 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19495 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19496 echo "We will use the %lld style."
b4eb6b3d
JH
19497 ;;
19498 esac
19499 fi
19500fi
19501
19502if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19503 $cat >try.c <<EOCP
19504#include <sys/types.h>
19505#include <stdio.h>
19506int main() {
19507 $quadtype q = 12345678901;
19508 printf("%qd\n", q);
19509}
19510EOCP
19511 set try
19512 if eval $compile; then
5440bc8e 19513 yyy=`$run ./try`
b4eb6b3d
JH
19514 case "$yyy" in
19515 12345678901)
19516 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19517 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19518 echo "We will use %qd."
19519 ;;
19520 esac
19521 fi
19522fi
19523
19524if $test X"$sPRId64" = X; then
19525 echo "Cannot figure out how to print 64-bit integers." >&4
19526fi
5b813a60 19527$rm_try
b4eb6b3d
JH
19528
19529fi
19530
19531case "$sPRId64" in
5b813a60
MB
19532'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19533 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 19534 ;;
5b813a60
MB
19535*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19536 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
19537 ;;
19538esac
19539
34f1896b 19540: Check format strings for internal types
b4eb6b3d
JH
19541echo " "
19542$echo "Checking the format strings to be used for Perl's internal types..." >&4
19543
19544if $test X"$ivsize" = X8; then
19545 ivdformat="$sPRId64"
19546 uvuformat="$sPRIu64"
19547 uvoformat="$sPRIo64"
19548 uvxformat="$sPRIx64"
19549 uvXUformat="$sPRIXU64"
19550else
19551 if $test X"$ivsize" = X"$longsize"; then
19552 ivdformat='"ld"'
19553 uvuformat='"lu"'
19554 uvoformat='"lo"'
19555 uvxformat='"lx"'
19556 uvXUformat='"lX"'
19557 else
19558 if $test X"$ivsize" = X"$intsize"; then
19559 ivdformat='"d"'
19560 uvuformat='"u"'
19561 uvoformat='"o"'
19562 uvxformat='"x"'
19563 uvXUformat='"X"'
19564 else
19565 : far out
19566 if $test X"$ivsize" = X"$shortsize"; then
19567 ivdformat='"hd"'
19568 uvuformat='"hu"'
19569 uvoformat='"ho"'
19570 uvxformat='"hx"'
19571 uvXUformat='"hX"'
19572 fi
19573 fi
19574 fi
19575fi
19576
19577if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19578 nveformat="$sPRIeldbl"
19579 nvfformat="$sPRIfldbl"
19580 nvgformat="$sPRIgldbl"
19581 nvEUformat="$sPRIEUldbl"
19582 nvFUformat="$sPRIFUldbl"
19583 nvGUformat="$sPRIGUldbl"
19584else
19585 nveformat='"e"'
19586 nvfformat='"f"'
19587 nvgformat='"g"'
19588 nvEUformat='"E"'
19589 nvFUformat='"F"'
19590 nvGUformat='"G"'
19591fi
19592
19593case "$ivdformat" in
3c728e00 19594'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19595 exit 1
19596 ;;
19597esac
19598
34f1896b 19599: Check format string for GID
b4eb6b3d
JH
19600
19601echo " "
19602$echo "Checking the format string to be used for gids..." >&4
19603
19604case "$gidsign" in
19605-1) if $test X"$gidsize" = X"$ivsize"; then
19606 gidformat="$ivdformat"
19607 else
19608 if $test X"$gidsize" = X"$longsize"; then
19609 gidformat='"ld"'
19610 else
19611 if $test X"$gidsize" = X"$intsize"; then
19612 gidformat='"d"'
19613 else
19614 if $test X"$gidsize" = X"$shortsize"; then
19615 gidformat='"hd"'
19616 fi
19617 fi
19618 fi
19619 fi
19620 ;;
19621*) if $test X"$gidsize" = X"$uvsize"; then
19622 gidformat="$uvuformat"
19623 else
19624 if $test X"$gidsize" = X"$longsize"; then
19625 gidformat='"lu"'
19626 else
19627 if $test X"$gidsize" = X"$intsize"; then
19628 gidformat='"u"'
19629 else
19630 if $test X"$gidsize" = X"$shortsize"; then
19631 gidformat='"hu"'
19632 fi
19633 fi
19634 fi
19635 fi
19636 ;;
19637esac
19638
19639: see if getgroups exists
19640set getgroups d_getgrps
19641eval $inlibc
19642
19643: see if setgroups exists
19644set setgroups d_setgrps
19645eval $inlibc
19646
b4eb6b3d
JH
19647: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19648echo " "
19649case "$d_getgrps$d_setgrps" in
19650*define*)
19651 case "$groupstype" in
19652 '') dflt="$gidtype" ;;
19653 *) dflt="$groupstype" ;;
19654 esac
19655 $cat <<EOM
19656What type of pointer is the second argument to getgroups() and setgroups()?
19657Usually this is the same as group ids, $gidtype, but not always.
19658
19659EOM
19660 rp='What type pointer is the second argument to getgroups() and setgroups()?'
19661 . ./myread
19662 groupstype="$ans"
19663 ;;
19664*) groupstype="$gidtype";;
19665esac
19666
613d6c3e 19667: MAD = Misc Attribute Definition
d620c7b3 19668
fd655d33
NC
19669if $test $patchlevel -lt 9; then
19670: MAD is not available in 5.8.x or earlier.
19671 ans=n;
19672else
19673 case "$mad" in
19674 $define|true|[yY]*) dflt='y' ;;
19675 *) dflt='n' ;;
19676 esac
19677 cat <<EOM
d620c7b3
MB
19678
19679Would you like to build with Misc Attribute Decoration? This is development
19680work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19681overhead on the interpreter.
19682
19683If this doesn't make any sense to you, just accept the default '$dflt'.
19684EOM
fd655d33
NC
19685 rp='Build Perl with MAD?'
19686 . ./myread
19687fi
d620c7b3 19688case "$ans" in
00e74f14
NC
19689y|Y) val="$define"
19690 madlyh='madly.h madly.act madly.tab'
19691 madlysrc='madly.c'
19692 madlyobj="madly$_o" ;;
19693*) val="$undef"
19694 madlyh=''
19695 madlysrc=''
19696 madlyobj='' ;;
d620c7b3
MB
19697esac
19698set mad
19699eval $setvar
19700
216dac04 19701: check whether make sets MAKE
b4eb6b3d
JH
19702echo " "
19703echo "Checking if your $make program sets \$(MAKE)..." >&4
19704case "$make_set_make" in
19705'')
19706 $sed 's/^X //' > testmake.mak << 'EOF'
19707Xall:
19708X @echo 'maketemp="$(MAKE)"'
19709EOF
19710 case "`$make -f testmake.mak 2>/dev/null`" in
19711 *maketemp=*) make_set_make='#' ;;
19712 *) make_set_make="MAKE=$make" ;;
19713 esac
19714 $rm -f testmake.mak
19715 ;;
19716esac
19717case "$make_set_make" in
19718'#') echo "Yup, it does.";;
19719*) echo "Nope, it doesn't.";;
19720esac
19721
19722: see what type is used for mode_t
19723rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19724set mode_t modetype int stdio.h sys/types.h
19725eval $typedef_ask
19726
2cc61e15
DD
19727: see if we need va_copy
19728echo " "
19729case "$i_stdarg" in
19730"$define")
19731 $cat >try.c <<EOCP
19732#include <stdarg.h>
19733#include <stdio.h>
85c8a686
DD
19734#$i_stdlib I_STDLIB
19735#ifdef I_STDLIB
19736#include <stdlib.h>
19737#endif
19738#include <signal.h>
2cc61e15
DD
19739
19740int
19741ivfprintf(FILE *f, const char *fmt, va_list *valp)
19742{
19743 return vfprintf(f, fmt, *valp);
19744}
5b813a60
MB
19745
19746int
2cc61e15
DD
19747myvfprintf(FILE *f, const char *fmt, va_list val)
19748{
19749 return ivfprintf(f, fmt, &val);
19750}
5b813a60 19751
2cc61e15 19752int
5b813a60 19753myprintf(char *fmt, ...)
2cc61e15
DD
19754{
19755 va_list val;
19756 va_start(val, fmt);
5b813a60
MB
19757 return myvfprintf(stdout, fmt, val);
19758}
2cc61e15
DD
19759
19760int
19761main(int ac, char **av)
19762{
85c8a686
DD
19763 signal(SIGSEGV, exit);
19764
5b813a60
MB
19765 myprintf("%s%cs all right, then\n", "that", '\'');
19766 exit(0);
2cc61e15
DD
19767}
19768EOCP
19769 set try
5440bc8e
JH
19770 if eval $compile && $run ./try 2>&1 >/dev/null; then
19771 case "`$run ./try`" in
2cc61e15
DD
19772 "that's all right, then")
19773 okay=yes
19774 ;;
19775 esac
19776 fi
19777 case "$okay" in
19778 yes) echo "It seems that you don't need va_copy()." >&4
19779 need_va_copy="$undef"
19780 ;;
19781 *) echo "It seems that va_copy() or similar will be needed." >&4
19782 need_va_copy="$define"
19783 ;;
19784 esac
5b813a60 19785 $rm_try
2cc61e15
DD
19786 ;;
19787*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19788 ;;
19789esac
19790
b4eb6b3d
JH
19791: see what type is used for size_t
19792rp="What is the type used for the length parameter for string functions?"
19793set size_t sizetype 'unsigned int' stdio.h sys/types.h
19794eval $typedef_ask
19795
19796: check for type of arguments to gethostbyaddr.
19797if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19798 case "$d_gethbyaddr" in
19799 $define)
19800 $cat <<EOM
19801
19802Checking to see what type of arguments are accepted by gethostbyaddr().
19803EOM
19804 hdrs="$define sys/types.h
19805 $d_socket sys/socket.h
19806 $i_niin netinet/in.h
19807 $i_netdb netdb.h
19808 $i_unistd unistd.h"
19809 : The first arg can 'char *' or 'void *'
19810 : The second arg is some of integral type
19811 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19812 for yyy in size_t long int; do
19813 case "$netdb_host_type" in
19814 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19815 if ./protochk "$try" $hdrs; then
19816 echo "Your system accepts $xxx for the first arg."
19817 echo "...and $yyy for the second arg."
19818 netdb_host_type="$xxx"
19819 netdb_hlen_type="$yyy"
19820 fi
19821 ;;
19822 esac
19823 done
19824 done
19825 : In case none of those worked, prompt the user.
19826 case "$netdb_host_type" in
19827 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19828 dflt='char *'
19829 . ./myread
19830 netdb_host_type=$ans
19831 rp='What is the type for the 2nd argument to gethostbyaddr?'
19832 dflt="$sizetype"
19833 . ./myread
19834 netdb_hlen_type=$ans
19835 ;;
19836 esac
19837 ;;
19838 *) : no gethostbyaddr, so pick harmless defaults
19839 netdb_host_type='char *'
19840 netdb_hlen_type="$sizetype"
19841 ;;
19842 esac
19843 # Remove the "const" if needed. -- but then we'll have a
19844 # prototype clash!
19845 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19846fi
19847
19848: check for type of argument to gethostbyname.
19849if test "X$netdb_name_type" = X ; then
19850 case "$d_gethbyname" in
19851 $define)
19852 $cat <<EOM
19853
19854Checking to see what type of argument is accepted by gethostbyname().
19855EOM
19856 hdrs="$define sys/types.h
19857 $d_socket sys/socket.h
19858 $i_niin netinet/in.h
19859 $i_netdb netdb.h
19860 $i_unistd unistd.h"
19861 for xxx in "const char *" "char *"; do
19862 case "$netdb_name_type" in
19863 '') try="extern struct hostent *gethostbyname($xxx);"
19864 if ./protochk "$try" $hdrs; then
19865 echo "Your system accepts $xxx."
19866 netdb_name_type="$xxx"
19867 fi
19868 ;;
19869 esac
19870 done
19871 : In case none of those worked, prompt the user.
19872 case "$netdb_name_type" in
19873 '') rp='What is the type for the 1st argument to gethostbyname?'
19874 dflt='char *'
19875 . ./myread
19876 netdb_name_type=$ans
19877 ;;
19878 esac
19879 ;;
19880 *) : no gethostbyname, so pick harmless default
19881 netdb_name_type='char *'
19882 ;;
19883 esac
19884fi
19885
19886: check for type of 1st argument to getnetbyaddr.
19887if test "X$netdb_net_type" = X ; then
19888 case "$d_getnbyaddr" in
19889 $define)
19890 $cat <<EOM
19891
19892Checking to see what type of 1st argument is accepted by getnetbyaddr().
19893EOM
19894 hdrs="$define sys/types.h
19895 $d_socket sys/socket.h
19896 $i_niin netinet/in.h
19897 $i_netdb netdb.h
19898 $i_unistd unistd.h"
19899 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19900 case "$netdb_net_type" in
19901 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19902 if ./protochk "$try" $hdrs; then
19903 echo "Your system accepts $xxx."
19904 netdb_net_type="$xxx"
19905 fi
19906 ;;
19907 esac
19908 done
19909 : In case none of those worked, prompt the user.
19910 case "$netdb_net_type" in
19911 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19912 dflt='long'
19913 . ./myread
19914 netdb_net_type=$ans
19915 ;;
19916 esac
19917 ;;
19918 *) : no getnetbyaddr, so pick harmless default
19919 netdb_net_type='long'
19920 ;;
19921 esac
19922fi
19923: locate the preferred pager for this system
d604bb53 19924fn=f/
b4eb6b3d
JH
19925case "$pager" in
19926'')
19927 dflt=''
19928 case "$pg" in
19929 /*) dflt=$pg;;
19930 [a-zA-Z]:/*) dflt=$pg;;
19931 esac
19932 case "$more" in
19933 /*) dflt=$more;;
19934 [a-zA-Z]:/*) dflt=$more;;
19935 esac
19936 case "$less" in
19937 /*) dflt=$less;;
19938 [a-zA-Z]:/*) dflt=$less;;
19939 esac
19940 case "$dflt" in
19941 '') dflt=/usr/ucb/more;;
19942 esac
19943 ;;
d604bb53 19944*) dflt="$pager"
d604bb53
JH
19945 fn="f/($pager)"
19946 ;;
b4eb6b3d
JH
19947esac
19948echo " "
b4eb6b3d
JH
19949rp='What pager is used on your system?'
19950. ./getfile
19951pager="$ans"
19952
19953: see what type pids are declared as in the kernel
19954rp="What is the type of process ids on this system?"
19955set pid_t pidtype int stdio.h sys/types.h
19956eval $typedef_ask
19957
b4eb6b3d
JH
19958: see if ar generates random libraries by itself
19959echo " "
19960echo "Checking how to generate random libraries on your machine..." >&4
19961echo 'int bar1() { return bar2(); }' > bar1.c
19962echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19963$cat > foo.c <<EOP
19964#$i_stdlib I_STDLIB
19965#ifdef I_STDLIB
19966#include <stdlib.h>
19967#endif
b4eb6b3d
JH
19968int main() { printf("%d\n", bar1()); exit(0); }
19969EOP
19970$cc $ccflags -c bar1.c >/dev/null 2>&1
19971$cc $ccflags -c bar2.c >/dev/null 2>&1
19972$cc $ccflags -c foo.c >/dev/null 2>&1
19973$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19974if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19975 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19976 echo "$ar appears to generate random libraries itself."
19977 orderlib=false
e39a9d84
LC
19978 if [ "X$ranlib" = "X" ]; then
19979 ranlib=":"
19980 fi
88d4d47b
PC
19981elif $ar s bar$_a >/dev/null 2>&1 &&
19982 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19983 $run ./foobar >/dev/null 2>&1; then
19984 echo "a table of contents needs to be added with '$ar s'."
19985 orderlib=false
19986 ranlib="$ar s"
b4eb6b3d 19987elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19988 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19989 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19990 echo "a table of contents needs to be added with '$ar ts'."
19991 orderlib=false
19992 ranlib="$ar ts"
19993else
19994 case "$ranlib" in
19995 :) ranlib='';;
19996 '')
19997 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19998 $test -f $ranlib || ranlib=''
19999 ;;
20000 esac
20001 if $test -n "$ranlib"; then
20002 echo "your system has '$ranlib'; we'll use that."
20003 orderlib=false
20004 else
20005 echo "your system doesn't seem to support random libraries"
20006 echo "so we'll use lorder and tsort to order the libraries."
20007 orderlib=true
20008 ranlib=":"
20009 fi
20010fi
88d4d47b 20011$rm -f foo* bar*
b4eb6b3d 20012
92a3ac59
MB
20013: see if this is a values.h system
20014set values.h i_values
20015eval $inhdr
20016
81c4fd9e 20017: Check the max offset that gmtime accepts
92a3ac59 20018echo "Checking max offsets that gmtime () accepts"
81c4fd9e 20019
92a3ac59
MB
20020case $i_values in
20021 define) yyy="#include <values.h>" ;;
20022 *) yyy="" ;;
20023 esac
20024
20025$cat >try.c <<EOCP
81c4fd9e
MB
20026#include <sys/types.h>
20027#include <stdio.h>
20028#include <time.h>
92a3ac59 20029$yyy
81c4fd9e 20030
92a3ac59
MB
20031int i;
20032struct tm *tmp;
20033time_t pt;
20034
20035void gm_check (time_t t)
20036{
81c4fd9e 20037 tmp = gmtime (&t);
92a3ac59
MB
20038 if (tmp == NULL || tmp->tm_year < -1900)
20039 tmp = NULL;
20040 else
20041 pt = t;
20042 } /* gm_check */
81c4fd9e 20043
92a3ac59
MB
20044int check_max ()
20045{
20046 tmp = NULL;
20047 pt = 0;
20048#ifdef MAXLONG
20049 gm_check (MAXLONG);
20050#endif
20051 if (tmp == NULL || tmp->tm_year < 0) {
20052 for (i = 63; i >= 0; i--) {
20053 time_t x = pt | ((time_t)1 << i);
20054 if (x < 0) continue;
20055 gm_check (x);
20056 }
81c4fd9e 20057 }
92a3ac59 20058 printf ("sGMTIME_max=%ld\n", pt);
81c4fd9e
MB
20059 return (0);
20060 }
81c4fd9e 20061
92a3ac59
MB
20062int check_min ()
20063{
20064 tmp = NULL;
20065 pt = 0;
20066#ifdef MINLONG
20067 gm_check (MINLONG);
20068#endif
20069 if (tmp == NULL) {
20070 for (i = 36; i >= 0; i--) {
20071 time_t x = pt - ((time_t)1 << i);
20072 if (x > 0) continue;
20073 gm_check (x);
81c4fd9e 20074 }
81c4fd9e 20075 }
92a3ac59 20076 printf ("sGMTIME_min=%ld\n", pt);
81c4fd9e
MB
20077 return (0);
20078 }
92a3ac59
MB
20079
20080int main (int argc, char *argv[])
20081{
20082 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20083 check_max ();
20084 check_min ();
20085 return (0);
20086 } /* main */
81c4fd9e
MB
20087EOCP
20088set try
20089if eval $compile; then
92a3ac59
MB
20090 yyy=`$run ./try`
20091 eval $yyy
81c4fd9e 20092else
92a3ac59 20093 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
81c4fd9e
MB
20094 fi
20095$rm_try
20096
c0bacbef 20097: check for type of arguments to select.
b4eb6b3d
JH
20098case "$selecttype" in
20099'') case "$d_select" in
20100 $define)
20101 echo " "
20102 $cat <<EOM
20103Checking to see what type of arguments are accepted by select().
20104EOM
20105 hdrs="$define sys/types.h
c0bacbef 20106 $i_systime sys/time.h
b4eb6b3d
JH
20107 $i_sysselct sys/select.h
20108 $d_socket sys/socket.h"
20109 : The first arg can be int, unsigned, or size_t
20110 : The last arg may or may not be 'const'
20111 val=''
20112 : void pointer has been seen but using that
20113 : breaks the selectminbits test
20114 for xxx in 'fd_set *' 'int *'; do
20115 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20116 for tmo in 'struct timeval *' 'const struct timeval *'; do
20117 case "$val" in
20118 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20119 if ./protochk "$try" $hdrs; then
20120 echo "Your system accepts $xxx."
20121 val="$xxx"
20122 fi
20123 ;;
20124 esac
20125 done
20126 done
20127 done
20128 case "$val" in
20129 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20130 case "$d_fd_set" in
20131 $define) dflt="fd_set *" ;;
20132 *) dflt="int *" ;;
20133 esac
20134 . ./myread
20135 val=$ans
20136 ;;
20137 esac
20138 selecttype="$val"
20139 ;;
20140 *) : no select, so pick a harmless default
20141 selecttype='int *'
20142 ;;
20143 esac
20144 ;;
20145esac
20146
20147: check for the select 'width'
20148case "$selectminbits" in
e6e7e605
JH
20149'') safebits=`expr $ptrsize \* 8`
20150 case "$d_select" in
b4eb6b3d
JH
20151 $define)
20152 $cat <<EOM
20153
20154Checking to see on how many bits at a time your select() operates...
20155EOM
20156 $cat >try.c <<EOCP
20157#include <sys/types.h>
20158#$i_time I_TIME
20159#$i_systime I_SYS_TIME
20160#$i_systimek I_SYS_TIME_KERNEL
20161#ifdef I_TIME
20162# include <time.h>
20163#endif
20164#ifdef I_SYS_TIME
20165# ifdef I_SYS_TIME_KERNEL
20166# define KERNEL
20167# endif
20168# include <sys/time.h>
20169# ifdef I_SYS_TIME_KERNEL
20170# undef KERNEL
20171# endif
20172#endif
20173#$i_sysselct I_SYS_SELECT
20174#ifdef I_SYS_SELECT
20175#include <sys/select.h>
20176#endif
20177#$d_socket HAS_SOCKET
20178#ifdef HAS_SOCKET
20179# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20180#endif
20181#include <stdio.h>
d1daaddf
JH
20182#$i_stdlib I_STDLIB
20183#ifdef I_STDLIB
20184#include <stdlib.h>
20185#endif
b4eb6b3d
JH
20186$selecttype b;
20187#define S sizeof(*(b))
20188#define MINBITS 64
20189#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20190#define NBITS (NBYTES * 8)
20191int main() {
7090f861 20192 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
20193 struct timeval t;
20194 int i;
20195 FILE* fp;
20196 int fd;
20197
e6e7e605
JH
20198 if (!s)
20199 exit(1);
b4eb6b3d
JH
20200 fclose(stdin);
20201 fp = fopen("try.c", "r");
20202 if (fp == 0)
e6e7e605 20203 exit(2);
b4eb6b3d
JH
20204 fd = fileno(fp);
20205 if (fd < 0)
e6e7e605 20206 exit(3);
b4eb6b3d
JH
20207 b = ($selecttype)s;
20208 for (i = 0; i < NBITS; i++)
20209 FD_SET(i, b);
20210 t.tv_sec = 0;
20211 t.tv_usec = 0;
20212 select(fd + 1, b, 0, 0, &t);
20213 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 20214 free(s);
b4eb6b3d
JH
20215 printf("%d\n", i + 1);
20216 return 0;
20217}
20218EOCP
20219 set try
20220 if eval $compile_ok; then
5440bc8e 20221 selectminbits=`$run ./try`
b4eb6b3d
JH
20222 case "$selectminbits" in
20223 '') cat >&4 <<EOM
20224Cannot figure out on how many bits at a time your select() operates.
e6e7e605 20225I'll play safe and guess it is $safebits bits.
b4eb6b3d 20226EOM
e6e7e605
JH
20227 selectminbits=$safebits
20228 bits="$safebits bits"
b4eb6b3d
JH
20229 ;;
20230 1) bits="1 bit" ;;
20231 *) bits="$selectminbits bits" ;;
20232 esac
20233 echo "Your select() operates on $bits at a time." >&4
20234 else
20235 rp='What is the minimum number of bits your select() operates on?'
20236 case "$byteorder" in
e6e7e605
JH
20237 12345678) dflt=64 ;;
20238 1234) dflt=32 ;;
b4eb6b3d
JH
20239 *) dflt=1 ;;
20240 esac
20241 . ./myread
20242 val=$ans
20243 selectminbits="$val"
20244 fi
5b813a60 20245 $rm_try
b4eb6b3d
JH
20246 ;;
20247 *) : no select, so pick a harmless default
e6e7e605 20248 selectminbits=$safebits
b4eb6b3d
JH
20249 ;;
20250 esac
20251 ;;
20252esac
20253
20254: Trace out the files included by signal.h, then look for SIGxxx names.
b4eb6b3d
JH
20255if [ "X$fieldn" = X ]; then
20256 : Just make some guesses. We check them later.
20257 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20258else
20259 xxx=`echo '#include <signal.h>' |
20260 $cppstdin $cppminus $cppflags 2>/dev/null |
613d6c3e 20261 $grep '^[ ]*#.*include' |
776a38e3
MB
20262 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20263 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d 20264fi
b4eb6b3d
JH
20265xxxfiles=''
20266for xx in $xxx /dev/null ; do
20267 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20268done
b4eb6b3d
JH
20269case "$xxxfiles" in
20270'') xxxfiles=`./findhdr signal.h` ;;
20271esac
20272xxx=`awk '
20273$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20274 print substr($2, 4, 20)
20275}
20276$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20277 print substr($3, 4, 20)
20278}' $xxxfiles`
20279: Append some common names just in case the awk scan failed.
20280xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20281xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20282xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20283xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20284xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20285
20286: generate a few handy files for later
55954f19 20287$cat > signal.c <<EOCP
b4eb6b3d
JH
20288#include <sys/types.h>
20289#include <signal.h>
55954f19
JH
20290#$i_stdlib I_STDLIB
20291#ifdef I_STDLIB
20292#include <stdlib.h>
20293#endif
b4eb6b3d
JH
20294#include <stdio.h>
20295int main() {
20296
20297/* Strange style to avoid deeply-nested #if/#else/#endif */
20298#ifndef NSIG
20299# ifdef _NSIG
20300# define NSIG (_NSIG)
20301# endif
20302#endif
20303
20304#ifndef NSIG
20305# ifdef SIGMAX
20306# define NSIG (SIGMAX+1)
20307# endif
20308#endif
20309
20310#ifndef NSIG
20311# ifdef SIG_MAX
20312# define NSIG (SIG_MAX+1)
20313# endif
20314#endif
20315
20316#ifndef NSIG
3609ea0d
JH
20317# ifdef _SIG_MAX
20318# define NSIG (_SIG_MAX+1)
20319# endif
20320#endif
20321
20322#ifndef NSIG
b4eb6b3d
JH
20323# ifdef MAXSIG
20324# define NSIG (MAXSIG+1)
20325# endif
20326#endif
20327
20328#ifndef NSIG
20329# ifdef MAX_SIG
20330# define NSIG (MAX_SIG+1)
20331# endif
20332#endif
20333
20334#ifndef NSIG
20335# ifdef SIGARRAYSIZE
3609ea0d 20336# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
20337# endif
20338#endif
20339
20340#ifndef NSIG
20341# ifdef _sys_nsig
20342# define NSIG (_sys_nsig) /* Solaris 2.5 */
20343# endif
20344#endif
20345
20346/* Default to some arbitrary number that's big enough to get most
20347 of the common signals.
20348*/
20349#ifndef NSIG
20350# define NSIG 50
20351#endif
20352
20353printf("NSIG %d\n", NSIG);
20354
20355#ifndef JUST_NSIG
20356
20357EOCP
20358
20359echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20360{
20361 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 20362 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
20363 printf $1; printf ");\n"
20364 printf "#endif\n"
20365}
20366END {
20367 printf "#endif /* JUST_NSIG */\n";
20368 printf "exit(0);\n}\n";
20369}
20370' >>signal.c
20371$cat >signal.awk <<'EOP'
20372BEGIN { ndups = 0 }
65197d93 20373$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20374($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20375 if ($2 > maxsig) { maxsig = $2 }
20376 if (sig_name[$2]) {
20377 dup_name[ndups] = $1
20378 dup_num[ndups] = $2
613d6c3e 20379 ndups++
b4eb6b3d 20380 }
1ebe1ffb 20381 else {
65197d93
JH
20382 sig_name[$2] = $1
20383 sig_num[$2] = $2
b4eb6b3d
JH
20384 }
20385}
613d6c3e 20386END {
b4eb6b3d
JH
20387 if (nsig == 0) {
20388 nsig = maxsig + 1
20389 }
20390 printf("NSIG %d\n", nsig);
20391 for (n = 1; n < nsig; n++) {
20392 if (sig_name[n]) {
20393 printf("%s %d\n", sig_name[n], sig_num[n])
20394 }
20395 else {
613d6c3e 20396 printf("NUM%d %d\n", n, n)
b4eb6b3d
JH
20397 }
20398 }
20399 for (n = 0; n < ndups; n++) {
20400 printf("%s %d\n", dup_name[n], dup_num[n])
20401 }
20402}
20403EOP
20404$cat >signal_cmd <<EOS
20405$startsh
20406if $test -s signal.lst; then
20407 echo "Using your existing signal.lst file"
20408 exit 0
20409fi
20410xxx="$xxx"
20411EOS
20412$cat >>signal_cmd <<'EOS'
20413
20414set signal
20415if eval $compile_ok; then
776a38e3
MB
20416 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20417 $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20418else
20419 echo "(I can't seem be able to compile the whole test program)" >&4
20420 echo "(I'll try it in little pieces.)" >&4
20421 set signal -DJUST_NSIG
20422 if eval $compile_ok; then
5440bc8e 20423 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20424 $cat signal.nsg
20425 else
20426 echo "I can't seem to figure out how many signals you have." >&4
20427 echo "Guessing 50." >&4
20428 echo 'NSIG 50' > signal.nsg
20429 fi
20430 : Now look at all the signal names, one at a time.
20431 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20432 $cat > signal.c <<EOCP
20433#include <sys/types.h>
20434#include <signal.h>
20435#include <stdio.h>
20436int main() {
20437printf("$xx %d\n", SIG${xx});
20438return 0;
20439}
20440EOCP
20441 set signal
20442 if eval $compile; then
20443 echo "SIG${xx} found."
5440bc8e 20444 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20445 else
20446 echo "SIG${xx} NOT found."
20447 fi
20448 done
20449 if $test -s signal.ls1; then
20450 $cat signal.nsg signal.ls1 |
65197d93 20451 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20452 fi
20453
20454fi
20455if $test -s signal.lst; then
20456 :
20457else
20458 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20459 echo 'kill -l' >signal
20460 set X `csh -f <signal`
20461 $rm -f signal
20462 shift
20463 case $# in
20464 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20465 esac
20466 echo $@ | $tr ' ' $trnl | \
20467 $awk '{ printf "%s %d\n", $1, ++s; }
20468 END { printf "NSIG %d\n", ++s }' >signal.lst
20469fi
20470$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20471EOS
20472chmod a+x signal_cmd
20473$eunicefix signal_cmd
20474
20475: generate list of signal names
20476echo " "
20477case "$sig_name_init" in
20478'') doinit=yes ;;
20479*) case "$sig_num_init" in
20480 ''|*,*) doinit=yes ;;
20481 esac ;;
20482esac
20483case "$doinit" in
20484yes)
20485 echo "Generating a list of signal names and numbers..." >&4
20486 . ./signal_cmd
20487 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20488 sig_name=`$awk 'BEGIN { printf "ZERO " }
20489 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20490 sig_num=`$awk 'BEGIN { printf "0 " }
20491 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20492 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
20493 !/^NSIG/ { printf "\"%s\", ", $1 }
20494 END { printf "0\n" }' signal.lst`
20495 sig_num_init=`$awk 'BEGIN { printf "0, " }
20496 !/^NSIG/ { printf "%d, ", $2}
20497 END { printf "0\n"}' signal.lst`
20498 ;;
20499esac
20500echo "The following $sig_count signals are available:"
20501echo " "
20502echo $sig_name | $awk \
20503'BEGIN { linelen = 0 }
20504{
20505 for (i = 1; i <= NF; i++) {
20506 name = "SIG" $i " "
20507 linelen = linelen + length(name)
20508 if (linelen > 70) {
20509 printf "\n"
20510 linelen = length(name)
20511 }
20512 printf "%s", name
20513 }
20514 printf "\n"
20515}'
76d3c696 20516sig_size=`echo $sig_name | awk '{print NF}'`
c0bacbef 20517$rm -f signal signal.c signal.awk signal.lst signal_cmd
b4eb6b3d 20518
613d6c3e 20519: Check size of size
b4eb6b3d
JH
20520echo " "
20521case "$sizetype" in
20522*_t) zzz="$sizetype" ;;
20523*) zzz="filesize" ;;
20524esac
613d6c3e 20525echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
20526cat > try.c <<EOCP
20527#include <sys/types.h>
20528#include <stdio.h>
d1daaddf
JH
20529#$i_stdlib I_STDLIB
20530#ifdef I_STDLIB
20531#include <stdlib.h>
20532#endif
b4eb6b3d
JH
20533int main() {
20534 printf("%d\n", (int)sizeof($sizetype));
20535 exit(0);
20536}
20537EOCP
20538set try
20539if eval $compile_ok; then
5440bc8e 20540 yyy=`$run ./try`
b4eb6b3d
JH
20541 case "$yyy" in
20542 '') sizesize=4
20543 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20544 ;;
20545 *) sizesize=$yyy
20546 echo "Your $zzz size is $sizesize bytes."
20547 ;;
20548 esac
20549else
20550 sizesize=4
20551 echo "(I can't compile the test program--guessing $sizesize.)" >&4
20552fi
20553
20554
20555: check for socklen_t
20556echo " "
20557echo "Checking to see if you have socklen_t..." >&4
20558$cat >try.c <<EOCP
20559#include <sys/types.h>
20560#$d_socket HAS_SOCKET
20561#ifdef HAS_SOCKET
20562#include <sys/socket.h>
20563#endif
20564int main() { socklen_t x = 16; }
20565EOCP
20566set try
20567if eval $compile; then
20568 val="$define"
20569 echo "You have socklen_t."
20570else
20571 val="$undef"
20572 echo "You do not have socklen_t."
20573 case "$sizetype" in
20574 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20575 esac
20576fi
5b813a60 20577$rm_try
b4eb6b3d
JH
20578set d_socklen_t
20579eval $setvar
20580
a7710f8d
JH
20581: see if this is a socks.h system
20582set socks.h i_socks
20583eval $inhdr
20584
b4eb6b3d
JH
20585: check for type of the size argument to socket calls
20586case "$d_socket" in
20587"$define")
20588 $cat <<EOM
20589
20590Checking to see what type is the last argument of accept().
20591EOM
b4eb6b3d
JH
20592 yyy=''
20593 case "$d_socklen_t" in
20594 "$define") yyy="$yyy socklen_t"
20595 esac
20596 yyy="$yyy $sizetype int long unsigned"
20597 for xxx in $yyy; do
20598 case "$socksizetype" in
20599 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
20600 case "$usesocks" in
20601 "$define")
20602 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20603 echo "Your system accepts '$xxx *' for the last argument of accept()."
20604 socksizetype="$xxx"
20605 fi
20606 ;;
20607 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
20608 echo "Your system accepts '$xxx *' for the last argument of accept()."
20609 socksizetype="$xxx"
20610 fi
20611 ;;
20612 esac
b4eb6b3d
JH
20613 ;;
20614 esac
20615 done
20616: In case none of those worked, prompt the user.
20617 case "$socksizetype" in
20618 '') rp='What is the type for socket address structure sizes?'
20619 dflt='int'
20620 . ./myread
20621 socksizetype=$ans
20622 ;;
20623 esac
20624 ;;
20625*) : no sockets, so pick relatively harmless default
20626 socksizetype='int'
20627 ;;
20628esac
20629
20630: see what type is used for signed size_t
20631set ssize_t ssizetype int stdio.h sys/types.h
20632eval $typedef
20633dflt="$ssizetype"
5440bc8e 20634$cat > try.c <<EOM
b4eb6b3d 20635#include <stdio.h>
d1daaddf
JH
20636#$i_stdlib I_STDLIB
20637#ifdef I_STDLIB
20638#include <stdlib.h>
20639#endif
b4eb6b3d
JH
20640#include <sys/types.h>
20641#define Size_t $sizetype
20642#define SSize_t $dflt
20643int main()
20644{
20645 if (sizeof(Size_t) == sizeof(SSize_t))
20646 printf("$dflt\n");
20647 else if (sizeof(Size_t) == sizeof(int))
20648 printf("int\n");
5b813a60 20649 else
b4eb6b3d
JH
20650 printf("long\n");
20651 exit(0);
20652}
20653EOM
20654echo " "
5440bc8e
JH
20655set try
20656if eval $compile_ok && $run ./try > /dev/null; then
20657 ssizetype=`$run ./try`
b4eb6b3d
JH
20658 echo "I'll be using $ssizetype for functions returning a byte count." >&4
20659else
20660 $cat >&4 <<EOM
20661Help! I can't compile and run the ssize_t test program: please enlighten me!
20662(This is probably a misconfiguration in your system or libraries, and
20663you really ought to fix it. Still, I'll try anyway.)
20664
20665I need a type that is the same size as $sizetype, but is guaranteed to
20666be signed. Common values are ssize_t, int and long.
20667
20668EOM
20669 rp="What signed type is the same size as $sizetype?"
20670 . ./myread
20671 ssizetype="$ans"
20672fi
5b813a60 20673$rm_try
b4eb6b3d
JH
20674
20675: see what type of char stdio uses.
20676echo " "
1d8eaf8c 20677echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
aa517f50 20678if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
20679 echo "Your stdio uses unsigned chars." >&4
20680 stdchar="unsigned char"
20681else
aa517f50
JH
20682 echo "Your stdio uses signed chars." >&4
20683 stdchar="char"
b4eb6b3d 20684fi
1d8eaf8c 20685$rm -f stdioh
b4eb6b3d 20686
b4eb6b3d
JH
20687: see what type uids are declared as in the kernel
20688echo " "
20689echo "Looking for the type for user ids returned by getuid()."
20690set uid_t uidtype xxx stdio.h sys/types.h
20691eval $typedef
20692case "$uidtype" in
20693xxx)
20694 xxx=`./findhdr sys/user.h`
20695 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20696 case $1 in
20697 unsigned) dflt="$1 $2" ;;
20698 *) dflt="$1" ;;
20699 esac
20700 ;;
20701*) dflt="$uidtype";;
20702esac
20703case "$uidtype" in
20704uid_t) echo "uid_t found." ;;
20705*) rp="What is the type for user ids returned by getuid()?"
20706 . ./myread
20707 uidtype="$ans"
20708 ;;
20709esac
20710
613d6c3e 20711: Check size of UID
b4eb6b3d
JH
20712echo " "
20713case "$uidtype" in
20714*_t) zzz="$uidtype" ;;
20715*) zzz="uid" ;;
20716esac
613d6c3e 20717echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
20718cat > try.c <<EOCP
20719#include <sys/types.h>
20720#include <stdio.h>
d1daaddf
JH
20721#$i_stdlib I_STDLIB
20722#ifdef I_STDLIB
20723#include <stdlib.h>
20724#endif
b4eb6b3d
JH
20725int main() {
20726 printf("%d\n", (int)sizeof($uidtype));
20727 exit(0);
20728}
20729EOCP
20730set try
20731if eval $compile_ok; then
5440bc8e 20732 yyy=`$run ./try`
b4eb6b3d
JH
20733 case "$yyy" in
20734 '') uidsize=4
20735 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20736 ;;
20737 *) uidsize=$yyy
20738 echo "Your $zzz is $uidsize bytes long."
20739 ;;
20740 esac
20741else
20742 uidsize=4
20743 echo "(I can't compile the test program--guessing $uidsize.)" >&4
20744fi
20745
613d6c3e 20746: Check if UID is signed
b4eb6b3d
JH
20747echo " "
20748case "$uidtype" in
20749*_t) zzz="$uidtype" ;;
20750*) zzz="uid" ;;
20751esac
20752echo "Checking the sign of $zzz..." >&4
20753cat > try.c <<EOCP
20754#include <sys/types.h>
20755#include <stdio.h>
20756int main() {
20757 $uidtype foo = -1;
20758 if (foo < 0)
20759 printf("-1\n");
20760 else
20761 printf("1\n");
20762}
20763EOCP
20764set try
20765if eval $compile; then
5440bc8e 20766 yyy=`$run ./try`
b4eb6b3d
JH
20767 case "$yyy" in
20768 '') uidsign=1
20769 echo "(I can't execute the test program--guessing unsigned.)" >&4
20770 ;;
20771 *) uidsign=$yyy
20772 case "$uidsign" in
20773 1) echo "Your $zzz is unsigned." ;;
20774 -1) echo "Your $zzz is signed." ;;
20775 esac
20776 ;;
20777 esac
20778else
20779 uidsign=1
20780 echo "(I can't compile the test program--guessing unsigned.)" >&4
20781fi
20782
20783
34f1896b 20784: Check format string for UID
b4eb6b3d
JH
20785echo " "
20786$echo "Checking the format string to be used for uids..." >&4
20787
20788case "$uidsign" in
20789-1) if $test X"$uidsize" = X"$ivsize"; then
20790 uidformat="$ivdformat"
20791 else
20792 if $test X"$uidsize" = X"$longsize"; then
20793 uidformat='"ld"'
20794 else
20795 if $test X"$uidsize" = X"$intsize"; then
20796 uidformat='"d"'
20797 else
20798 if $test X"$uidsize" = X"$shortsize"; then
20799 uidformat='"hd"'
20800 fi
20801 fi
20802 fi
20803 fi
20804 ;;
20805*) if $test X"$uidsize" = X"$uvsize"; then
20806 uidformat="$uvuformat"
20807 else
20808 if $test X"$uidsize" = X"$longsize"; then
20809 uidformat='"lu"'
20810 else
20811 if $test X"$uidsize" = X"$intsize"; then
20812 uidformat='"u"'
20813 else
20814 if $test X"$uidsize" = X"$shortsize"; then
20815 uidformat='"hu"'
20816 fi
20817 fi
20818 fi
20819 fi
20820 ;;
20821esac
20822
34f1896b 20823: Check if site customization support was requested
4afd418c
MB
20824case "$usesitecustomize" in
20825 $define|true|[Yy]*)
20826 usesitecustomize="$define"
20827 ;;
20828 *)
20829 usesitecustomize="$undef"
20830 ;;
20831 esac
20832
3659ebf1
JH
20833: determine compiler compiler
20834case "$yacc" in
20835'')
20836 dflt=yacc;;
20837*)
20838 dflt="$yacc";;
20839esac
20840echo " "
20841comp='yacc'
3c728e00 20842if $test -f "$byacc$_exe"; then
3659ebf1
JH
20843 dflt="$byacc"
20844 comp="byacc or $comp"
20845fi
3c728e00 20846if $test -f "$bison$_exe"; then
3659ebf1
JH
20847 comp="$comp or bison -y"
20848fi
20849rp="Which compiler compiler ($comp) shall I use?"
20850. ./myread
20851yacc="$ans"
20852case "$yacc" in
20853*bis*)
20854 case "$yacc" in
20855 *-y*) ;;
20856 *)
20857 yacc="$yacc -y"
20858 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20859 ;;
20860 esac
20861 ;;
20862esac
20863
c0bacbef
MB
20864: see if this is a assert.h system
20865set assert.h i_assert
20866eval $inhdr
20867
758a5d79
JH
20868: see if this is a fp.h system
20869set fp.h i_fp
20870eval $inhdr
20871
20872: see if this is a fp_class.h system
20873set fp_class.h i_fp_class
20874eval $inhdr
20875
13cfc98d
MB
20876: see if gdbm.h is available
20877set gdbm.h t_gdbm
20878eval $inhdr
20879case "$t_gdbm" in
20880$define)
20881 : see if gdbm_open exists
20882 set gdbm_open d_gdbm_open
20883 eval $inlibc
20884 case "$d_gdbm_open" in
20885 $undef)
20886 t_gdbm="$undef"
20887 echo "We won't be including <gdbm.h>"
20888 ;;
20889 esac
20890 ;;
20891esac
20892val="$t_gdbm"
20893set i_gdbm
20894eval $setvar
20895
b4eb6b3d 20896: see if ndbm.h is available
a33f2d9f
AD
20897set ndbm.h i_ndbm
20898eval $inhdr
20899: Compatibility location for RedHat 7.1
20900set gdbm/ndbm.h i_gdbmndbm
20901eval $inhdr
20902: Compatibility location for Debian 4.0
20903set gdbm-ndbm.h i_gdbm_ndbm
b4eb6b3d 20904eval $inhdr
1c6861ad 20905
a33f2d9f 20906if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
b4eb6b3d
JH
20907 : see if dbm_open exists
20908 set dbm_open d_dbm_open
20909 eval $inlibc
20910 case "$d_dbm_open" in
20911 $undef)
a33f2d9f
AD
20912 i_ndbm="$undef"
20913 i_gdbmndbm="$undef"
20914 i_gdbm_ndbm="$undef"
b4eb6b3d 20915 echo "We won't be including <ndbm.h>"
a33f2d9f 20916 val="$undef"
b4eb6b3d 20917 ;;
a33f2d9f
AD
20918 *) val="$define"
20919 ;;
b4eb6b3d 20920 esac
a33f2d9f
AD
20921fi
20922set d_ndbm
b4eb6b3d
JH
20923eval $setvar
20924
b2f871ed
AD
20925: see if this is a ieeefp.h system
20926case "$i_ieeefp" in
20927'' ) set ieeefp.h i_ieeefp
20928 eval $inhdr
20929 ;;
20930esac
20931
20932: see if this is a libutil.h system
20933set libutil.h i_libutil
20934eval $inhdr
20935
20936: see if mach cthreads are available
20937if test "X$usethreads" = "X$define"; then
20938 set mach/cthreads.h i_machcthr
20939 eval $inhdr
20940else
20941 i_machcthr="$undef"
20942fi
20943
20944: see if this is a mntent.h system
20945set mntent.h i_mntent
20946eval $inhdr
20947
b4eb6b3d
JH
20948: see if net/errno.h is available
20949val=''
20950set net/errno.h val
20951eval $inhdr
20952
20953: Unfortunately, it causes problems on some systems. Arrgh.
20954case "$val" in
20955$define)
20956 cat > try.c <<'EOM'
20957#include <stdio.h>
20958#include <errno.h>
20959#include <net/errno.h>
20960int func()
20961{
20962 return ENOTSOCK;
20963}
20964EOM
20965 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20966 echo "We'll be including <net/errno.h>." >&4
20967 else
20968 echo "We won't be including <net/errno.h>." >&4
20969 val="$undef"
20970 fi
5b813a60 20971 $rm_try
b4eb6b3d
JH
20972 ;;
20973esac
20974set i_neterrno
20975eval $setvar
20976
20977: see if netinet/tcp.h is available
20978set netinet/tcp.h i_netinettcp
20979eval $inhdr
20980
20981: see if this is a poll.h system
20982set poll.h i_poll
20983eval $inhdr
20984
20985: see if this is a prot.h system
20986set prot.h i_prot
20987eval $inhdr
20988
613d6c3e 20989: Preprocessor symbols
b4eb6b3d 20990echo " "
ddfca5da 20991$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
20992$cat <<'EOSH' > Cppsym.know
20993a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20994AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 20995alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20996ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20997BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20998BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20999bull c cadmus clipper CMU COFF COMPILER_VERSION
21000concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 21001CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
21002Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21003FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21004GLIBC GLIBC_MINOR
21005GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
21006H3050R H3050RX hbullx20 hcx host_mips
21007hp200 hp300 hp700 HP700 hp800 hp9000
21008hp9000s200 hp9000s300 hp9000s400 hp9000s500
21009hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21010i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 21011IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
21012INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21013LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21014LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 21015LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
21016LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21017M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21018M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21019M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21020MATH_HAS_NO_SIDE_EFFECTS
21021mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21022mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21023mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21024MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21025mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21026NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 21027news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
21028ns32016 ns32332 ns32k nsc32000
21029OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21030pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21031pc532 pdp11 PGC PIC plexus PORTAR posix
21032POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21033POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 21034PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 21035riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
21036SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21037sony sony_news sonyrisc sparc sparclite spectrum
21038stardent stdc STDC_EXT stratos sun sun3 sun386
21039Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21040SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21041SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21042sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 21043TM3200 TM5400 TM5600
b4eb6b3d
JH
21044tower tower32 tower32_200 tower32_600 tower32_700
21045tower32_800 tower32_850 tss
21046u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21047ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
21048unix UNIX95 UNIX99 unixpc unos
21049USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21050USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21051USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21052USGr4 USGr4_2
44c87379 21053Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
21054XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21055XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21056z8000
21057EOSH
21058# Maybe put other stuff here too.
21059cat <<EOSH >>Cppsym.know
21060$osname
21061EOSH
21062./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21063./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21064$cat Cppsym.know > Cppsym.c
381aa1ff 21065$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
21066$rm -f Cppsym.a Cppsym.b Cppsym.c
21067cat <<EOSH > Cppsym
21068$startsh
21069if $test \$# -gt 0; then
21070 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21071 if $test -s Cppsym.got; then
21072 $rm -f Cppsym.got
21073 exit 0
21074 fi
21075 $rm -f Cppsym.got
21076 exit 1
21077else
21078 $tr " " "$trnl" | ./Cppsym.try
21079 exit 0
21080fi
21081EOSH
21082chmod +x Cppsym
21083$eunicefix Cppsym
21084cat <<EOSH > Cppsym.try
21085$startsh
21086cat <<'EOCP' > try.c
21087#include <stdio.h>
360321b3
YST
21088#if cpp_stuff == 1
21089#define STRINGIFY(a) "a"
21090#endif
21091#if cpp_stuff == 42
21092#define StGiFy(a) #a
21093#define STRINGIFY(a) StGiFy(a)
21094#endif
21095#if $cpp_stuff != 1 && $cpp_stuff != 42
21096# include "Bletch: How does this C preprocessor stringify macros?"
21097#endif
b4eb6b3d
JH
21098int main() {
21099EOCP
21100$awk \\
21101EOSH
21102cat <<'EOSH' >> Cppsym.try
21103'length($1) > 0 {
360321b3
YST
21104 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21105 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21106 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21107 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 21108}' >> try.c
2ef53570 21109echo 'return 0;}' >> try.c
b4eb6b3d
JH
21110EOSH
21111cat <<EOSH >> Cppsym.try
21112ccflags="$ccflags"
21113case "$osname-$gccversion" in
21114irix-) ccflags="\$ccflags -woff 1178" ;;
21115os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21116esac
360321b3 21117$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
21118EOSH
21119chmod +x Cppsym.try
21120$eunicefix Cppsym.try
21121./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 21122: Add in any linux cpp "predefined macros":
b6a7163e
MB
21123case "$osname::$gccversion" in
21124 *linux*::*.*)
21125 tHdrH=_tmpHdr
21126 rm -f $tHdrH'.h' $tHdrH
21127 touch $tHdrH'.h'
21128 if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21129 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21130 if [ -s $tHdrH'_cppsym.real' ]; then
21131 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21132 fi
21133 fi
21134 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21135 ;;
21136esac
b4eb6b3d
JH
21137: now check the C compiler for additional symbols
21138postprocess_cc_v=''
21139case "$osname" in
21140aix) postprocess_cc_v="|$tr , ' '" ;;
21141esac
21142$cat >ccsym <<EOS
21143$startsh
21144$cat >tmp.c <<EOF
21145extern int foo;
21146EOF
21147for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21148do
21149 case "\$i" in
21150 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 21151 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
21152 esac
21153done
5b813a60 21154$rm_try
b4eb6b3d
JH
21155EOS
21156postprocess_cc_v=''
21157chmod +x ccsym
21158$eunicefix ccsym
21159./ccsym > ccsym1.raw
21160if $test -s ccsym1.raw; then
21161 $sort ccsym1.raw | $uniq >ccsym.raw
21162else
21163 mv ccsym1.raw ccsym.raw
21164fi
21165
21166$awk '/\=/ { print $0; next }
21167 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
21168$comm -13 Cppsym.true ccsym.list >ccsym.own
21169$comm -12 Cppsym.true ccsym.list >ccsym.com
21170$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
21171also=''
21172if $test -z ccsym.raw; then
21173 echo "Your C compiler doesn't seem to define any symbols!" >&4
21174 echo " "
21175 echo "However, your C preprocessor defines the following symbols:"
21176 $cat Cppsym.true
21177 ccsymbols=''
21178 cppsymbols=`$cat Cppsym.true`
21179 cppsymbols=`echo $cppsymbols`
21180 cppccsymbols="$cppsymbols"
21181else
21182 if $test -s ccsym.com; then
21183 echo "Your C compiler and pre-processor define these symbols:"
21184 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21185 also='also '
21186 symbols='ones'
21187 cppccsymbols=`$cat ccsym.com`
21188 cppccsymbols=`echo $cppccsymbols`
21189 $test "$silent" || sleep 1
21190 fi
21191 if $test -s ccsym.cpp; then
21192 $test "$also" && echo " "
21193 echo "Your C pre-processor ${also}defines the following symbols:"
21194 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21195 also='further '
21196 cppsymbols=`$cat ccsym.cpp`
21197 cppsymbols=`echo $cppsymbols`
21198 $test "$silent" || sleep 1
21199 fi
21200 if $test -s ccsym.own; then
21201 $test "$also" && echo " "
21202 echo "Your C compiler ${also}defines the following cpp symbols:"
21203 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21204 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21205 ccsymbols=`$cat ccsym.own`
21206 ccsymbols=`echo $ccsymbols`
21207 $test "$silent" || sleep 1
21208 fi
21209fi
b4eb6b3d
JH
21210
21211: see if this is a termio system
21212val="$undef"
21213val2="$undef"
21214val3="$undef"
21215if $test `./findhdr termios.h`; then
21216 set tcsetattr i_termios
21217 eval $inlibc
21218 val3="$i_termios"
21219fi
21220echo " "
21221case "$val3" in
21222"$define") echo "You have POSIX termios.h... good!" >&4;;
21223*) if ./Cppsym pyr; then
21224 case "`/bin/universe`" in
21225 ucb) if $test `./findhdr sgtty.h`; then
21226 val2="$define"
21227 echo "<sgtty.h> found." >&4
21228 else
21229 echo "System is pyramid with BSD universe."
216dac04 21230 ./warn "<sgtty.h> not found--you could have problems."
b4eb6b3d
JH
21231 fi;;
21232 *) if $test `./findhdr termio.h`; then
21233 val="$define"
21234 echo "<termio.h> found." >&4
21235 else
21236 echo "System is pyramid with USG universe."
216dac04 21237 ./warn "<termio.h> not found--you could have problems."
b4eb6b3d
JH
21238 fi;;
21239 esac
21240 elif ./usg; then
21241 if $test `./findhdr termio.h`; then
21242 echo "<termio.h> found." >&4
21243 val="$define"
21244 elif $test `./findhdr sgtty.h`; then
21245 echo "<sgtty.h> found." >&4
21246 val2="$define"
21247 else
216dac04 21248 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
b4eb6b3d
JH
21249 fi
21250 else
21251 if $test `./findhdr sgtty.h`; then
21252 echo "<sgtty.h> found." >&4
21253 val2="$define"
21254 elif $test `./findhdr termio.h`; then
21255 echo "<termio.h> found." >&4
21256 val="$define"
21257 else
216dac04 21258 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
b4eb6b3d
JH
21259 fi
21260 fi;;
21261esac
21262set i_termio; eval $setvar
21263val=$val2; set i_sgtty; eval $setvar
21264val=$val3; set i_termios; eval $setvar
21265
b4eb6b3d
JH
21266: see if stddef is available
21267set stddef.h i_stddef
21268eval $inhdr
923fc586 21269
b4eb6b3d
JH
21270: see if sys/access.h is available
21271set sys/access.h i_sysaccess
21272eval $inhdr
21273
21274: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21275set sys/filio.h i_sysfilio
21276eval $inhdr
21277echo " "
21278if $test `./findhdr sys/ioctl.h`; then
21279 val="$define"
21280 echo '<sys/ioctl.h> found.' >&4
21281else
21282 val="$undef"
21283 if $test $i_sysfilio = "$define"; then
21284 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 21285 else
b4eb6b3d
JH
21286 $test $i_sgtty = "$define" && xxx="sgtty.h"
21287 $test $i_termio = "$define" && xxx="termio.h"
21288 $test $i_termios = "$define" && xxx="termios.h"
21289echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21290 fi
21291fi
21292set i_sysioctl
21293eval $setvar
21294
49a78c82
JH
21295: see if socket ioctl defs are in sys/sockio.h
21296echo " "
21297xxx=`./findhdr sys/sockio.h`
21298if $test "$xxx"; then
21299 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21300 val="$define"
21301 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21302 else
21303 val="$undef"
21304 echo "No socket ioctls found in <sys/sockio.h>." >&4
21305 fi
21306else
21307 val="$undef"
21308 $cat <<EOM
21309<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21310EOM
21311fi
21312set i_syssockio
21313eval $setvar
21314
b4eb6b3d
JH
21315: see if this is a syslog.h system
21316set syslog.h i_syslog
21317eval $inhdr
21318
b4eb6b3d
JH
21319: see if this is a sys/mode.h system
21320set sys/mode.h i_sysmode
21321eval $inhdr
21322
216dac04
MB
21323: see if there is a sys/poll.h file
21324set sys/poll.h i_syspoll
21325eval $inhdr
21326
b4eb6b3d
JH
21327: see if sys/resource.h has to be included
21328set sys/resource.h i_sysresrc
21329eval $inhdr
21330
21331: see if sys/security.h is available
21332set sys/security.h i_syssecrt
21333eval $inhdr
21334
21335: see if this is a sys/statvfs.h system
21336set sys/statvfs.h i_sysstatvfs
21337eval $inhdr
21338
b4eb6b3d
JH
21339: see if this is a sys/un.h system
21340set sys/un.h i_sysun
21341eval $inhdr
21342
b4eb6b3d
JH
21343: see if this is a sys/utsname.h system
21344set sys/utsname.h i_sysutsname
21345eval $inhdr
21346
21347: see if this is a syswait system
21348set sys/wait.h i_syswait
21349eval $inhdr
21350
21351: see if this is a ustat.h system
21352set ustat.h i_ustat
21353eval $inhdr
21354
21355: see if this is an utime system
21356set utime.h i_utime
21357eval $inhdr
21358
b4eb6b3d
JH
21359: see if this is a vfork system
21360case "$d_vfork" in
21361"$define")
21362 set vfork.h i_vfork
21363 eval $inhdr
21364 ;;
21365*)
21366 i_vfork="$undef"
21367 ;;
21368esac
21369
613d6c3e 21370: Check extensions
b4eb6b3d
JH
21371echo " "
21372echo "Looking for extensions..." >&4
21373: If we are using the old config.sh, known_extensions may contain
21374: old or inaccurate or duplicate values.
21375known_extensions=''
21376nonxs_extensions=''
21377: We do not use find because it might not be available.
21378: We do not just use MANIFEST because the user may have dropped
21379: some additional extensions into the source tree and expect them
21380: to be built.
21381
21382: Function to recursively find available extensions, ignoring DynaLoader
21383: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21384find_extensions='
21385 for xxx in *; do
822a6ee0
MB
21386 case "$xxx" in
21387 DynaLoader|dynaload) ;;
21388 *)
78ff2d7b 21389 if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
822a6ee0
MB
21390 known_extensions="$known_extensions $1$xxx";
21391 elif $test -f $xxx/Makefile.PL; then
21392 nonxs_extensions="$nonxs_extensions $1$xxx";
21393 else
21394 if $test -d $xxx -a $# -lt 10; then
21395 set $1$xxx/ $*;
21396 cd "$xxx";
21397 eval $find_extensions;
21398 cd ..;
21399 shift;
21400 fi;
21401 fi
21402 ;;
21403 esac;
b4eb6b3d
JH
21404 done'
21405tdir=`pwd`
6904989c 21406cd "$rsrc/ext"
b4eb6b3d
JH
21407set X
21408shift
21409eval $find_extensions
2685328b
AG
21410# Special case: Add in modules that nest beyond the first level.
21411# Currently threads/shared and Hash/Util/FieldHash, since they are
21412# not picked up by the recursive find above (and adding in general
21413# recursive finding breaks SDBM_File/sdbm).
21414# A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21415known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
faae14e6
MB
21416set X $known_extensions
21417shift
21418known_extensions="$*"
b4eb6b3d
JH
21419set X $nonxs_extensions
21420shift
21421nonxs_extensions="$*"
6904989c 21422cd "$tdir"
b4eb6b3d
JH
21423
21424: Now see which are supported on this system.
21425avail_ext=''
21426for xxx in $known_extensions ; do
21427 case "$xxx" in
21428 DB_File|db_file)
21429 case "$i_db" in
21430 $define) avail_ext="$avail_ext $xxx" ;;
21431 esac
21432 ;;
21433 GDBM_File|gdbm_fil)
7c345082 21434 case "$i_gdbm" in
b4eb6b3d
JH
21435 $define) avail_ext="$avail_ext $xxx" ;;
21436 esac
21437 ;;
1d59c593 21438 I18N/Langinfo|i18n_lan)
7c345082 21439 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
21440 $define$define) avail_ext="$avail_ext $xxx" ;;
21441 esac
21442 ;;
7978b0db
JH
21443 IPC/SysV|ipc/sysv)
21444 : XXX Do we need a useipcsysv variable here
21445 case "${d_msg}${d_sem}${d_shm}" in
21446 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21447 esac
21448 ;;
b4eb6b3d
JH
21449 NDBM_File|ndbm_fil)
21450 case "$i_ndbm" in
21451 $define)
21452 case "$osname-$use64bitint" in
0be9fa5d 21453 hpux-define)
b4eb6b3d
JH
21454 case "$libs" in
21455 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21456 esac
21457 ;;
21458 *) avail_ext="$avail_ext $xxx" ;;
21459 esac
21460 ;;
21461 esac
21462 ;;
7c345082 21463 ODBM_File|odbm_fil)
b4eb6b3d
JH
21464 case "${i_dbm}${i_rpcsvcdbm}" in
21465 *"${define}"*)
7978b0db
JH
21466 case "$d_cplusplus" in
21467 define) ;; # delete as a function name will not work
21468 *) case "$osname-$use64bitint" in
21469 hpux-define)
21470 case "$libs" in
21471 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21472 esac
21473 ;;
21474 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
21475 esac
21476 ;;
b4eb6b3d
JH
21477 esac
21478 ;;
21479 esac
21480 ;;
7978b0db
JH
21481 Opcode|opcode)
21482 case "$useopcode" in
b4eb6b3d
JH
21483 true|define|y) avail_ext="$avail_ext $xxx" ;;
21484 esac
21485 ;;
7978b0db
JH
21486 POSIX|posix)
21487 case "$useposix" in
b4eb6b3d
JH
21488 true|define|y) avail_ext="$avail_ext $xxx" ;;
21489 esac
21490 ;;
21491 Socket|socket)
7c345082 21492 case "$d_socket" in
4a9f028c
JH
21493 true|$define|y)
21494 case "$osname" in
21495 beos) ;; # not unless BONE
21496 *) avail_ext="$avail_ext $xxx" ;;
21497 esac
21498 ;;
b4eb6b3d
JH
21499 esac
21500 ;;
21501 Sys/Syslog|sys/syslog)
21502 : XXX syslog requires socket
7c345082 21503 case "$d_socket" in
b4eb6b3d
JH
21504 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21505 esac
21506 ;;
21507 Thread|thread)
b00ec89b
AB
21508 case "$usethreads" in
21509 true|$define|y)
47f9f84c 21510 case "$use5005threads" in
3f30fabf 21511 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 21512 esac
b4eb6b3d
JH
21513 esac
21514 ;;
7978b0db
JH
21515 threads|threads/shared)
21516 # threads and threads::shared are special cases.
21517 # To stop people from asking "Perl 5.8.0 was supposed
21518 # to have this new fancy threads implementation but my
21519 # perl doesn't have it" and from people trying to
21520 # (re)install the threads module using CPAN.pm and
21521 # CPAN.pm then offering to reinstall Perl 5.8.0,
21522 # the threads.pm and threads/shared.pm will always be
21523 # there, croaking informatively ("you need to rebuild
21524 # all of Perl with threads, sorry") when threads haven't
21525 # been compiled in.
21526 # --jhi
21527 avail_ext="$avail_ext $xxx"
21528 ;;
78ff2d7b 21529 Win32*)
b149d92d
JD
21530 case "$osname" in
21531 cygwin) avail_ext="$avail_ext $xxx" ;;
21532 esac
21533 ;;
f9b6ed1c
AD
21534 XS/APItest|xs/apitest)
21535 # This is just for testing. Skip it unless we have dynamic loading.
21536
21537 case "$usedl" in
21538 $define) avail_ext="$avail_ext $xxx" ;;
21539 esac
21540 ;;
21541 XS/Typemap|xs/typemap)
21542 # This is just for testing. Skip it unless we have dynamic loading.
21543 case "$usedl" in
21544 $define) avail_ext="$avail_ext $xxx" ;;
21545 esac
21546 ;;
b4eb6b3d 21547 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
21548 ;;
21549 esac
b4eb6b3d 21550done
5f80c64f 21551
b4eb6b3d
JH
21552set X $avail_ext
21553shift
21554avail_ext="$*"
5f80c64f 21555
ef0c5be8
JH
21556case "$onlyextensions" in
21557'') ;;
21558*) keepextensions=''
21559 echo "You have requested that only certains extensions be included..." >&4
21560 for i in $onlyextensions; do
21561 case " $avail_ext " in
21562 *" $i "*)
21563 echo "Keeping extension $i."
21564 keepextensions="$keepextensions $i"
21565 ;;
21566 *) echo "Ignoring extension $i." ;;
21567 esac
21568 done
21569 avail_ext="$keepextensions"
21570 ;;
21571esac
21572
21573case "$noextensions" in
21574'') ;;
21575*) keepextensions=''
21576 echo "You have requested that certain extensions be ignored..." >&4
21577 for i in $avail_ext; do
c3dadc13
AD
21578 case " $noextensions " in
21579 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
21580 *) echo "Keeping extension $i.";
21581 keepextensions="$keepextensions $i"
21582 ;;
21583 esac
21584 done
21585 avail_ext="$keepextensions"
21586 ;;
21587esac
21588
b4eb6b3d
JH
21589: Now see which nonxs extensions are supported on this system.
21590: For now assume all are.
21591nonxs_ext=''
21592for xxx in $nonxs_extensions ; do
21593 case "$xxx" in
21594 *) nonxs_ext="$nonxs_ext $xxx"
21595 ;;
21596 esac
21597done
5f80c64f 21598
b4eb6b3d
JH
21599set X $nonxs_ext
21600shift
21601nonxs_ext="$*"
21602
21603case $usedl in
21604$define)
21605 $cat <<EOM
21606A number of extensions are supplied with $package. You may choose to
21607compile these extensions for dynamic loading (the default), compile
21608them into the $package executable (static loading), or not include
21609them at all. Answer "none" to include no extensions.
21610Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
21611
21612EOM
b4eb6b3d 21613 case "$dynamic_ext" in
736accd3
YST
21614 '')
21615 : Exclude those listed in static_ext
21616 dflt=''
21617 for xxx in $avail_ext; do
21618 case " $static_ext " in
21619 *" $xxx "*) ;;
21620 *) dflt="$dflt $xxx" ;;
21621 esac
21622 done
21623 set X $dflt
21624 shift
21625 dflt="$*"
21626 ;;
b4eb6b3d
JH
21627 *) dflt="$dynamic_ext"
21628 # Perhaps we are reusing an old out-of-date config.sh.
21629 case "$hint" in
21630 previous)
21631 if test X"$dynamic_ext" != X"$avail_ext"; then
21632 $cat <<EOM
7c345082
RGS
21633NOTICE: Your previous config.sh list may be incorrect.
21634The extensions now available to you are
b4eb6b3d
JH
21635 ${avail_ext}
21636but the default list from your previous config.sh is
7c345082 21637 ${dynamic_ext}
9c839522 21638
b4eb6b3d
JH
21639EOM
21640 fi
9c839522
PM
21641 ;;
21642 esac
b4eb6b3d
JH
21643 ;;
21644 esac
5f80c64f 21645 case "$dflt" in
b4eb6b3d
JH
21646 '') dflt=none;;
21647 esac
21648 rp="What extensions do you wish to load dynamically?"
21649 . ./myread
21650 case "$ans" in
21651 none) dynamic_ext=' ' ;;
21652 *) dynamic_ext="$ans" ;;
5f80c64f 21653 esac
5f80c64f 21654
b4eb6b3d
JH
21655 case "$static_ext" in
21656 '')
21657 : Exclude those already listed in dynamic linking
21658 dflt=''
21659 for xxx in $avail_ext; do
21660 case " $dynamic_ext " in
21661 *" $xxx "*) ;;
21662 *) dflt="$dflt $xxx" ;;
21663 esac
21664 done
21665 set X $dflt
21666 shift
21667 dflt="$*"
21668 ;;
7c345082 21669 *) dflt="$static_ext"
b4eb6b3d
JH
21670 ;;
21671 esac
9c839522 21672
b4eb6b3d
JH
21673 case "$dflt" in
21674 '') dflt=none;;
21675 esac
21676 rp="What extensions do you wish to load statically?"
21677 . ./myread
21678 case "$ans" in
21679 none) static_ext=' ' ;;
21680 *) static_ext="$ans" ;;
21681 esac
21682 ;;
21683*)
21684 $cat <<EOM
7c345082
RGS
21685A number of extensions are supplied with $package. Answer "none"
21686to include no extensions.
b4eb6b3d 21687Note that DynaLoader is always built and need not be mentioned here.
9c839522 21688
b4eb6b3d
JH
21689EOM
21690 case "$static_ext" in
21691 '') dflt="$avail_ext" ;;
21692 *) dflt="$static_ext"
21693 # Perhaps we are reusing an old out-of-date config.sh.
21694 case "$hint" in
21695 previous)
21696 if test X"$static_ext" != X"$avail_ext"; then
21697 $cat <<EOM
7c345082
RGS
21698NOTICE: Your previous config.sh list may be incorrect.
21699The extensions now available to you are
b4eb6b3d
JH
21700 ${avail_ext}
21701but the default list from your previous config.sh is
7c345082 21702 ${static_ext}
5f80c64f
JH
21703
21704EOM
b4eb6b3d
JH
21705 fi
21706 ;;
21707 esac
21708 ;;
21709 esac
21710 : Exclude those that are not xs extensions
21711 case "$dflt" in
21712 '') dflt=none;;
21713 esac
21714 rp="What extensions do you wish to include?"
21715 . ./myread
21716 case "$ans" in
21717 none) static_ext=' ' ;;
21718 *) static_ext="$ans" ;;
21719 esac
21720 ;;
5f80c64f 21721esac
7c345082 21722#
f1f6834f
AD
21723# Encode is a special case. If we are building Encode as a static
21724# extension, we need to explicitly list its subextensions as well.
21725# For other nested extensions, this is handled automatically by
21726# the appropriate Makefile.PL.
21727case " $static_ext " in
21728 *" Encode "*) # Add the subextensions of Encode
21729 cd "$rsrc/ext"
21730 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21731 static_ext="$static_ext Encode/$xxx"
21732 done
21733 cd "$tdir"
21734 ;;
21735esac
5f80c64f 21736
b4eb6b3d
JH
21737set X $dynamic_ext $static_ext $nonxs_ext
21738shift
21739extensions="$*"
21740
93a2cd18
AD
21741# Sanity check: We require an extension suitable for use with
21742# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
21743# should show up as failures in the test suite, but it's helpful to
21744# catch them now.) The 'extensions' list is normally sorted
21745# alphabetically, so we need to accept either
21746# DB_File ... Fcntl ... IO ....
21747# or something like
21748# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
21749case " $extensions" in
21750*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21751*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21752*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
21753*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21754 echo "WARNING: The Perl you are building will be quite crippled." >& 4
21755 ;;
21756esac
21757
9c839522
PM
21758: Remove libraries needed only for extensions
21759: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
21760: The exception is SunOS 4.x, which needs them.
21761case "${osname}X${osvers}" in
21762sunos*X4*)
21763 perllibs="$libs"
21764 ;;
21765*) case "$usedl" in
21766 $define|true|[yY]*)
a33f2d9f 21767 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
eedaba54
PM
21768 shift
21769 perllibs="$*"
21770 ;;
21771 *) perllibs="$libs"
21772 ;;
21773 esac
21774 ;;
9c839522 21775esac
5f80c64f
JH
21776
21777: Remove build directory name from cppstdin so it can be used from
21778: either the present location or the final installed location.
21779echo " "
21780: Get out of the UU directory to get correct path name.
21781cd ..
21782case "$cppstdin" in
21783`pwd`/cppstdin)
21784 echo "Stripping down cppstdin path name"
21785 cppstdin=cppstdin
21786 ;;
21787esac
21788cd UU
21789
21790: end of configuration questions
21791echo " "
21792echo "End of configuration questions."
21793echo " "
21794
21795: back to where it started
21796if test -d ../UU; then
21797 cd ..
21798fi
21799
776a38e3 21800: configuration may be unconditionally patched via a 'config.arch' file
48370efc 21801if $test -f config.arch; then
776a38e3 21802 echo "I see a config.arch file, loading it." >&4
48370efc
JH
21803 . ./config.arch
21804fi
21805
5f80c64f
JH
21806: configuration may be patched via a 'config.over' file
21807if $test -f config.over; then
21808 echo " "
21809 dflt=y
21810 rp='I see a config.over file. Do you wish to load it?'
21811 . UU/myread
21812 case "$ans" in
21813 n*) echo "OK, I'll ignore it.";;
21814 *) . ./config.over
21815 echo "Configuration override changes have been loaded."
21816 ;;
21817 esac
21818fi
21819
21820: in case they want portability, strip down executable paths
21821case "$d_portable" in
21822"$define")
21823 echo " "
21824 echo "Stripping down executable paths..." >&4
21825 for file in $loclist $trylist; do
534ac15a
JH
21826 eval temp=\$$file
21827 eval $file=`basename $temp`
5f80c64f
JH
21828 done
21829 ;;
21830esac
21831
21832: create config.sh file
21833echo " "
21834echo "Creating config.sh..." >&4
21835$spitshell <<EOT >config.sh
21836$startsh
21837#
21838# This file was produced by running the Configure script. It holds all the
21839# definitions figured out by Configure. Should you modify one of these values,
21840# do not forget to propagate your changes by running "Configure -der". You may
21841# instead choose to run each of the .SH files by yourself, or "Configure -S".
21842#
21843
21844# Package name : $package
21845# Source directory : $src
21846# Configuration time: $cf_time
21847# Configured by : $cf_by
21848# Target system : $myuname
21849
776a38e3
MB
21850EOT
21851$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21852$spitshell <<EOT >>config.sh
21853
5f80c64f
JH
21854Author='$Author'
21855Date='$Date'
21856Header='$Header'
21857Id='$Id'
21858Locker='$Locker'
21859Log='$Log'
5f80c64f
JH
21860RCSfile='$RCSfile'
21861Revision='$Revision'
21862Source='$Source'
21863State='$State'
21864_a='$_a'
21865_exe='$_exe'
21866_o='$_o'
b4eb6b3d 21867afs='$afs'
a6d26a0d 21868afsroot='$afsroot'
b4eb6b3d
JH
21869alignbytes='$alignbytes'
21870ansi2knr='$ansi2knr'
21871aphostname='$aphostname'
21872api_revision='$api_revision'
21873api_subversion='$api_subversion'
21874api_version='$api_version'
21875api_versionstring='$api_versionstring'
5f80c64f 21876ar='$ar'
b4eb6b3d
JH
21877archlib='$archlib'
21878archlibexp='$archlibexp'
21879archname64='$archname64'
21880archname='$archname'
5f80c64f 21881archobjs='$archobjs'
10bc17b6 21882asctime_r_proto='$asctime_r_proto'
5f80c64f 21883awk='$awk'
b4eb6b3d 21884baserev='$baserev'
5f80c64f 21885bash='$bash'
b4eb6b3d 21886bin='$bin'
b4eb6b3d 21887binexp='$binexp'
5f80c64f
JH
21888bison='$bison'
21889byacc='$byacc'
b4eb6b3d 21890byteorder='$byteorder'
5f80c64f 21891c='$c'
b4eb6b3d 21892castflags='$castflags'
5f80c64f
JH
21893cat='$cat'
21894cc='$cc'
21895cccdlflags='$cccdlflags'
21896ccdlflags='$ccdlflags'
21897ccflags='$ccflags'
b4eb6b3d 21898ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21899ccname='$ccname'
b4eb6b3d 21900ccsymbols='$ccsymbols'
6b356c8e 21901ccversion='$ccversion'
5f80c64f 21902cf_by='$cf_by'
b4eb6b3d 21903cf_email='$cf_email'
5f80c64f
JH
21904cf_time='$cf_time'
21905chgrp='$chgrp'
21906chmod='$chmod'
21907chown='$chown'
b4eb6b3d 21908clocktype='$clocktype'
5f80c64f
JH
21909comm='$comm'
21910compress='$compress'
21911contains='$contains'
21912cp='$cp'
21913cpio='$cpio'
21914cpp='$cpp'
b4eb6b3d
JH
21915cpp_stuff='$cpp_stuff'
21916cppccsymbols='$cppccsymbols'
5f80c64f
JH
21917cppflags='$cppflags'
21918cpplast='$cpplast'
21919cppminus='$cppminus'
21920cpprun='$cpprun'
21921cppstdin='$cppstdin'
b4eb6b3d 21922cppsymbols='$cppsymbols'
10bc17b6 21923crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21924cryptlib='$cryptlib'
5f80c64f 21925csh='$csh'
10bc17b6
JH
21926ctermid_r_proto='$ctermid_r_proto'
21927ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21928d_Gconvert='$d_Gconvert'
21929d_PRIEUldbl='$d_PRIEUldbl'
21930d_PRIFUldbl='$d_PRIFUldbl'
21931d_PRIGUldbl='$d_PRIGUldbl'
21932d_PRIXU64='$d_PRIXU64'
21933d_PRId64='$d_PRId64'
21934d_PRIeldbl='$d_PRIeldbl'
21935d_PRIfldbl='$d_PRIfldbl'
21936d_PRIgldbl='$d_PRIgldbl'
21937d_PRIi64='$d_PRIi64'
21938d_PRIo64='$d_PRIo64'
21939d_PRIu64='$d_PRIu64'
21940d_PRIx64='$d_PRIx64'
21941d_SCNfldbl='$d_SCNfldbl'
74cac757 21942d__fwalk='$d__fwalk'
b4eb6b3d
JH
21943d_access='$d_access'
21944d_accessx='$d_accessx'
55954f19 21945d_aintl='$d_aintl'
b4eb6b3d
JH
21946d_alarm='$d_alarm'
21947d_archlib='$d_archlib'
10bc17b6 21948d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21949d_atolf='$d_atolf'
21950d_atoll='$d_atoll'
0dbb1585
AL
21951d_attribute_format='$d_attribute_format'
21952d_attribute_malloc='$d_attribute_malloc'
21953d_attribute_nonnull='$d_attribute_nonnull'
21954d_attribute_noreturn='$d_attribute_noreturn'
21955d_attribute_pure='$d_attribute_pure'
21956d_attribute_unused='$d_attribute_unused'
21957d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21958d_bcmp='$d_bcmp'
21959d_bcopy='$d_bcopy'
5f80c64f 21960d_bsd='$d_bsd'
b4eb6b3d
JH
21961d_bsdgetpgrp='$d_bsdgetpgrp'
21962d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
21963d_builtin_choose_expr='$d_builtin_choose_expr'
21964d_builtin_expect='$d_builtin_expect'
b4eb6b3d 21965d_bzero='$d_bzero'
a2d23ec2 21966d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
21967d_casti32='$d_casti32'
21968d_castneg='$d_castneg'
21969d_charvspr='$d_charvspr'
21970d_chown='$d_chown'
21971d_chroot='$d_chroot'
21972d_chsize='$d_chsize'
758a5d79 21973d_class='$d_class'
b0a2e8e6 21974d_clearenv='$d_clearenv'
b4eb6b3d 21975d_closedir='$d_closedir'
4e0554ec 21976d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21977d_const='$d_const'
55954f19 21978d_copysignl='$d_copysignl'
666ea192 21979d_cplusplus='$d_cplusplus'
b4eb6b3d 21980d_crypt='$d_crypt'
10bc17b6 21981d_crypt_r='$d_crypt_r'
b4eb6b3d 21982d_csh='$d_csh'
13cfc98d 21983d_ctermid='$d_ctermid'
10bc17b6
JH
21984d_ctermid_r='$d_ctermid_r'
21985d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21986d_cuserid='$d_cuserid'
21987d_dbl_dig='$d_dbl_dig'
2ef53570 21988d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21989d_difftime='$d_difftime'
de52168c 21990d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 21991d_dirfd='$d_dirfd'
b4eb6b3d
JH
21992d_dirnamlen='$d_dirnamlen'
21993d_dlerror='$d_dlerror'
5f80c64f 21994d_dlopen='$d_dlopen'
b4eb6b3d
JH
21995d_dlsymun='$d_dlsymun'
21996d_dosuid='$d_dosuid'
10bc17b6 21997d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21998d_drand48proto='$d_drand48proto'
21999d_dup2='$d_dup2'
22000d_eaccess='$d_eaccess'
22001d_endgrent='$d_endgrent'
10bc17b6 22002d_endgrent_r='$d_endgrent_r'
b4eb6b3d 22003d_endhent='$d_endhent'
10bc17b6 22004d_endhostent_r='$d_endhostent_r'
b4eb6b3d 22005d_endnent='$d_endnent'
10bc17b6 22006d_endnetent_r='$d_endnetent_r'
b4eb6b3d 22007d_endpent='$d_endpent'
10bc17b6 22008d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 22009d_endpwent='$d_endpwent'
10bc17b6 22010d_endpwent_r='$d_endpwent_r'
b4eb6b3d 22011d_endsent='$d_endsent'
10bc17b6 22012d_endservent_r='$d_endservent_r'
b4eb6b3d 22013d_eofnblk='$d_eofnblk'
5f80c64f 22014d_eunice='$d_eunice'
15b61c98 22015d_faststdio='$d_faststdio'
b363b713 22016d_fchdir='$d_fchdir'
b4eb6b3d
JH
22017d_fchmod='$d_fchmod'
22018d_fchown='$d_fchown'
22019d_fcntl='$d_fcntl'
9d9004a9 22020d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
22021d_fd_macros='$d_fd_macros'
22022d_fd_set='$d_fd_set'
22023d_fds_bits='$d_fds_bits'
22024d_fgetpos='$d_fgetpos'
758a5d79
JH
22025d_finite='$d_finite'
22026d_finitel='$d_finitel'
b4eb6b3d
JH
22027d_flexfnam='$d_flexfnam'
22028d_flock='$d_flock'
2ef53570 22029d_flockproto='$d_flockproto'
b4eb6b3d 22030d_fork='$d_fork'
758a5d79 22031d_fp_class='$d_fp_class'
b4eb6b3d 22032d_fpathconf='$d_fpathconf'
758a5d79
JH
22033d_fpclass='$d_fpclass'
22034d_fpclassify='$d_fpclassify'
22035d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
22036d_fpos64_t='$d_fpos64_t'
22037d_frexpl='$d_frexpl'
22038d_fs_data_s='$d_fs_data_s'
22039d_fseeko='$d_fseeko'
22040d_fsetpos='$d_fsetpos'
22041d_fstatfs='$d_fstatfs'
22042d_fstatvfs='$d_fstatvfs'
411ab01c 22043d_fsync='$d_fsync'
b4eb6b3d
JH
22044d_ftello='$d_ftello'
22045d_ftime='$d_ftime'
dc814df1 22046d_futimes='$d_futimes'
b4eb6b3d
JH
22047d_getcwd='$d_getcwd'
22048d_getespwnam='$d_getespwnam'
22049d_getfsstat='$d_getfsstat'
22050d_getgrent='$d_getgrent'
10bc17b6
JH
22051d_getgrent_r='$d_getgrent_r'
22052d_getgrgid_r='$d_getgrgid_r'
22053d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
22054d_getgrps='$d_getgrps'
22055d_gethbyaddr='$d_gethbyaddr'
22056d_gethbyname='$d_gethbyname'
22057d_gethent='$d_gethent'
22058d_gethname='$d_gethname'
10bc17b6
JH
22059d_gethostbyaddr_r='$d_gethostbyaddr_r'
22060d_gethostbyname_r='$d_gethostbyname_r'
22061d_gethostent_r='$d_gethostent_r'
b4eb6b3d 22062d_gethostprotos='$d_gethostprotos'
4e0554ec 22063d_getitimer='$d_getitimer'
b4eb6b3d 22064d_getlogin='$d_getlogin'
10bc17b6 22065d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
22066d_getmnt='$d_getmnt'
22067d_getmntent='$d_getmntent'
22068d_getnbyaddr='$d_getnbyaddr'
22069d_getnbyname='$d_getnbyname'
22070d_getnent='$d_getnent'
10bc17b6
JH
22071d_getnetbyaddr_r='$d_getnetbyaddr_r'
22072d_getnetbyname_r='$d_getnetbyname_r'
22073d_getnetent_r='$d_getnetent_r'
b4eb6b3d 22074d_getnetprotos='$d_getnetprotos'
0c0643d0 22075d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
22076d_getpbyname='$d_getpbyname'
22077d_getpbynumber='$d_getpbynumber'
22078d_getpent='$d_getpent'
22079d_getpgid='$d_getpgid'
22080d_getpgrp2='$d_getpgrp2'
22081d_getpgrp='$d_getpgrp'
22082d_getppid='$d_getppid'
22083d_getprior='$d_getprior'
10bc17b6
JH
22084d_getprotobyname_r='$d_getprotobyname_r'
22085d_getprotobynumber_r='$d_getprotobynumber_r'
22086d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
22087d_getprotoprotos='$d_getprotoprotos'
22088d_getprpwnam='$d_getprpwnam'
22089d_getpwent='$d_getpwent'
10bc17b6
JH
22090d_getpwent_r='$d_getpwent_r'
22091d_getpwnam_r='$d_getpwnam_r'
22092d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
22093d_getsbyname='$d_getsbyname'
22094d_getsbyport='$d_getsbyport'
22095d_getsent='$d_getsent'
10bc17b6
JH
22096d_getservbyname_r='$d_getservbyname_r'
22097d_getservbyport_r='$d_getservbyport_r'
22098d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
22099d_getservprotos='$d_getservprotos'
22100d_getspnam='$d_getspnam'
10bc17b6 22101d_getspnam_r='$d_getspnam_r'
b4eb6b3d 22102d_gettimeod='$d_gettimeod'
10bc17b6 22103d_gmtime_r='$d_gmtime_r'
5f80c64f 22104d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
22105d_grpasswd='$d_grpasswd'
22106d_hasmntopt='$d_hasmntopt'
22107d_htonl='$d_htonl'
55954f19 22108d_ilogbl='$d_ilogbl'
f3f1a2d8 22109d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
22110d_index='$d_index'
22111d_inetaton='$d_inetaton'
22112d_int64_t='$d_int64_t'
22113d_isascii='$d_isascii'
758a5d79
JH
22114d_isfinite='$d_isfinite'
22115d_isinf='$d_isinf'
b4eb6b3d
JH
22116d_isnan='$d_isnan'
22117d_isnanl='$d_isnanl'
22118d_killpg='$d_killpg'
22119d_lchown='$d_lchown'
22120d_ldbl_dig='$d_ldbl_dig'
0a0abfba 22121d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 22122d_link='$d_link'
10bc17b6 22123d_localtime_r='$d_localtime_r'
8572b25d 22124d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
22125d_locconv='$d_locconv'
22126d_lockf='$d_lockf'
22127d_longdbl='$d_longdbl'
22128d_longlong='$d_longlong'
22129d_lseekproto='$d_lseekproto'
22130d_lstat='$d_lstat'
22131d_madvise='$d_madvise'
7dd121ae
MB
22132d_malloc_good_size='$d_malloc_good_size'
22133d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
22134d_mblen='$d_mblen'
22135d_mbstowcs='$d_mbstowcs'
22136d_mbtowc='$d_mbtowc'
22137d_memchr='$d_memchr'
22138d_memcmp='$d_memcmp'
22139d_memcpy='$d_memcpy'
22140d_memmove='$d_memmove'
22141d_memset='$d_memset'
22142d_mkdir='$d_mkdir'
22143d_mkdtemp='$d_mkdtemp'
22144d_mkfifo='$d_mkfifo'
22145d_mkstemp='$d_mkstemp'
22146d_mkstemps='$d_mkstemps'
22147d_mktime='$d_mktime'
22148d_mmap='$d_mmap'
22149d_modfl='$d_modfl'
e67aeab1 22150d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 22151d_modflproto='$d_modflproto'
b4eb6b3d
JH
22152d_mprotect='$d_mprotect'
22153d_msg='$d_msg'
22154d_msg_ctrunc='$d_msg_ctrunc'
22155d_msg_dontroute='$d_msg_dontroute'
22156d_msg_oob='$d_msg_oob'
22157d_msg_peek='$d_msg_peek'
22158d_msg_proxy='$d_msg_proxy'
22159d_msgctl='$d_msgctl'
22160d_msgget='$d_msgget'
4e0554ec 22161d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
22162d_msgrcv='$d_msgrcv'
22163d_msgsnd='$d_msgsnd'
22164d_msync='$d_msync'
22165d_munmap='$d_munmap'
22166d_mymalloc='$d_mymalloc'
a33f2d9f 22167d_ndbm='$d_ndbm'
b4eb6b3d 22168d_nice='$d_nice'
2765b840 22169d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 22170d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 22171d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
22172d_off64_t='$d_off64_t'
22173d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22174d_oldpthreads='$d_oldpthreads'
22175d_oldsock='$d_oldsock'
22176d_open3='$d_open3'
22177d_pathconf='$d_pathconf'
22178d_pause='$d_pause'
22179d_perl_otherlibdirs='$d_perl_otherlibdirs'
22180d_phostname='$d_phostname'
22181d_pipe='$d_pipe'
22182d_poll='$d_poll'
5f80c64f 22183d_portable='$d_portable'
dcb594bc 22184d_printf_format_null='$d_printf_format_null'
c7aff470 22185d_procselfexe='$d_procselfexe'
233e16ce 22186d_pseudofork='$d_pseudofork'
d6483fcc 22187d_pthread_atfork='$d_pthread_atfork'
58d975c3 22188d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
22189d_pthread_yield='$d_pthread_yield'
22190d_pwage='$d_pwage'
22191d_pwchange='$d_pwchange'
22192d_pwclass='$d_pwclass'
22193d_pwcomment='$d_pwcomment'
22194d_pwexpire='$d_pwexpire'
22195d_pwgecos='$d_pwgecos'
22196d_pwpasswd='$d_pwpasswd'
22197d_pwquota='$d_pwquota'
22198d_qgcvt='$d_qgcvt'
22199d_quad='$d_quad'
10bc17b6
JH
22200d_random_r='$d_random_r'
22201d_readdir64_r='$d_readdir64_r'
b4eb6b3d 22202d_readdir='$d_readdir'
10bc17b6 22203d_readdir_r='$d_readdir_r'
b4eb6b3d 22204d_readlink='$d_readlink'
4e0554ec
JH
22205d_readv='$d_readv'
22206d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
22207d_rename='$d_rename'
22208d_rewinddir='$d_rewinddir'
22209d_rmdir='$d_rmdir'
22210d_safebcpy='$d_safebcpy'
22211d_safemcpy='$d_safemcpy'
22212d_sanemcmp='$d_sanemcmp'
ef9f17be 22213d_sbrkproto='$d_sbrkproto'
55954f19 22214d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
22215d_sched_yield='$d_sched_yield'
22216d_scm_rights='$d_scm_rights'
22217d_seekdir='$d_seekdir'
22218d_select='$d_select'
22219d_sem='$d_sem'
22220d_semctl='$d_semctl'
22221d_semctl_semid_ds='$d_semctl_semid_ds'
22222d_semctl_semun='$d_semctl_semun'
22223d_semget='$d_semget'
22224d_semop='$d_semop'
4e0554ec 22225d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
22226d_setegid='$d_setegid'
22227d_seteuid='$d_seteuid'
22228d_setgrent='$d_setgrent'
10bc17b6 22229d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
22230d_setgrps='$d_setgrps'
22231d_sethent='$d_sethent'
10bc17b6 22232d_sethostent_r='$d_sethostent_r'
4e0554ec 22233d_setitimer='$d_setitimer'
b4eb6b3d
JH
22234d_setlinebuf='$d_setlinebuf'
22235d_setlocale='$d_setlocale'
10bc17b6 22236d_setlocale_r='$d_setlocale_r'
b4eb6b3d 22237d_setnent='$d_setnent'
10bc17b6 22238d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
22239d_setpent='$d_setpent'
22240d_setpgid='$d_setpgid'
22241d_setpgrp2='$d_setpgrp2'
22242d_setpgrp='$d_setpgrp'
22243d_setprior='$d_setprior'
22244d_setproctitle='$d_setproctitle'
10bc17b6 22245d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 22246d_setpwent='$d_setpwent'
10bc17b6 22247d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
22248d_setregid='$d_setregid'
22249d_setresgid='$d_setresgid'
22250d_setresuid='$d_setresuid'
22251d_setreuid='$d_setreuid'
22252d_setrgid='$d_setrgid'
22253d_setruid='$d_setruid'
22254d_setsent='$d_setsent'
10bc17b6 22255d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
22256d_setsid='$d_setsid'
22257d_setvbuf='$d_setvbuf'
22258d_sfio='$d_sfio'
22259d_shm='$d_shm'
22260d_shmat='$d_shmat'
22261d_shmatprototype='$d_shmatprototype'
22262d_shmctl='$d_shmctl'
22263d_shmdt='$d_shmdt'
22264d_shmget='$d_shmget'
22265d_sigaction='$d_sigaction'
ed140128 22266d_signbit='$d_signbit'
983dbef6 22267d_sigprocmask='$d_sigprocmask'
b4eb6b3d 22268d_sigsetjmp='$d_sigsetjmp'
c95d0e17 22269d_sitearch='$d_sitearch'
4f5da3e9 22270d_snprintf='$d_snprintf'
49a78c82 22271d_sockatmark='$d_sockatmark'
2ef53570 22272d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
22273d_socket='$d_socket'
22274d_socklen_t='$d_socklen_t'
22275d_sockpair='$d_sockpair'
22276d_socks5_init='$d_socks5_init'
360321b3 22277d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 22278d_sqrtl='$d_sqrtl'
10bc17b6
JH
22279d_srand48_r='$d_srand48_r'
22280d_srandom_r='$d_srandom_r'
eef837ea 22281d_sresgproto='$d_sresgproto'
640374d0 22282d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
22283d_statblks='$d_statblks'
22284d_statfs_f_flags='$d_statfs_f_flags'
22285d_statfs_s='$d_statfs_s'
22286d_statvfs='$d_statvfs'
22287d_stdio_cnt_lval='$d_stdio_cnt_lval'
22288d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
22289d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22290d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
22291d_stdio_stream_array='$d_stdio_stream_array'
22292d_stdiobase='$d_stdiobase'
22293d_stdstdio='$d_stdstdio'
22294d_strchr='$d_strchr'
22295d_strcoll='$d_strcoll'
22296d_strctcpy='$d_strctcpy'
22297d_strerrm='$d_strerrm'
22298d_strerror='$d_strerror'
10bc17b6 22299d_strerror_r='$d_strerror_r'
b3c85772 22300d_strftime='$d_strftime'
08c92000
MB
22301d_strlcat='$d_strlcat'
22302d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
22303d_strtod='$d_strtod'
22304d_strtol='$d_strtol'
22305d_strtold='$d_strtold'
22306d_strtoll='$d_strtoll'
28e5dec8 22307d_strtoq='$d_strtoq'
b4eb6b3d
JH
22308d_strtoul='$d_strtoul'
22309d_strtoull='$d_strtoull'
22310d_strtouq='$d_strtouq'
22311d_strxfrm='$d_strxfrm'
22312d_suidsafe='$d_suidsafe'
22313d_symlink='$d_symlink'
22314d_syscall='$d_syscall'
2ef53570 22315d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
22316d_sysconf='$d_sysconf'
22317d_sysernlst='$d_sysernlst'
22318d_syserrlst='$d_syserrlst'
22319d_system='$d_system'
22320d_tcgetpgrp='$d_tcgetpgrp'
22321d_tcsetpgrp='$d_tcsetpgrp'
22322d_telldir='$d_telldir'
22323d_telldirproto='$d_telldirproto'
22324d_time='$d_time'
cbb9e8a7 22325d_timegm='$d_timegm'
b4eb6b3d 22326d_times='$d_times'
14b90194
JH
22327d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22328d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 22329d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 22330d_truncate='$d_truncate'
10bc17b6 22331d_ttyname_r='$d_ttyname_r'
b4eb6b3d 22332d_tzname='$d_tzname'
4e0554ec
JH
22333d_u32align='$d_u32align'
22334d_ualarm='$d_ualarm'
b4eb6b3d
JH
22335d_umask='$d_umask'
22336d_uname='$d_uname'
22337d_union_semun='$d_union_semun'
758a5d79 22338d_unordered='$d_unordered'
bdf33aa7 22339d_unsetenv='$d_unsetenv'
4e0554ec 22340d_usleep='$d_usleep'
2ef53570 22341d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
22342d_ustat='$d_ustat'
22343d_vendorarch='$d_vendorarch'
22344d_vendorbin='$d_vendorbin'
22345d_vendorlib='$d_vendorlib'
6e1038e0 22346d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
22347d_vfork='$d_vfork'
22348d_void_closedir='$d_void_closedir'
22349d_voidsig='$d_voidsig'
22350d_voidtty='$d_voidtty'
22351d_volatile='$d_volatile'
22352d_vprintf='$d_vprintf'
4f5da3e9 22353d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
22354d_wait4='$d_wait4'
22355d_waitpid='$d_waitpid'
22356d_wcstombs='$d_wcstombs'
22357d_wctomb='$d_wctomb'
4e0554ec 22358d_writev='$d_writev'
5f80c64f
JH
22359d_xenix='$d_xenix'
22360date='$date'
b4eb6b3d
JH
22361db_hashtype='$db_hashtype'
22362db_prefixtype='$db_prefixtype'
640374d0
JH
22363db_version_major='$db_version_major'
22364db_version_minor='$db_version_minor'
22365db_version_patch='$db_version_patch'
b4eb6b3d
JH
22366defvoidused='$defvoidused'
22367direntrytype='$direntrytype'
22368dlext='$dlext'
5f80c64f 22369dlsrc='$dlsrc'
b4eb6b3d
JH
22370doublesize='$doublesize'
22371drand01='$drand01'
10bc17b6 22372drand48_r_proto='$drand48_r_proto'
5ac1e9b2 22373dtrace='$dtrace'
b4eb6b3d
JH
22374dynamic_ext='$dynamic_ext'
22375eagain='$eagain'
22376ebcdic='$ebcdic'
5f80c64f
JH
22377echo='$echo'
22378egrep='$egrep'
22379emacs='$emacs'
10bc17b6
JH
22380endgrent_r_proto='$endgrent_r_proto'
22381endhostent_r_proto='$endhostent_r_proto'
22382endnetent_r_proto='$endnetent_r_proto'
22383endprotoent_r_proto='$endprotoent_r_proto'
22384endpwent_r_proto='$endpwent_r_proto'
22385endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
22386eunicefix='$eunicefix'
22387exe_ext='$exe_ext'
22388expr='$expr'
b4eb6b3d 22389extensions='$extensions'
6fcddf3b 22390extras='$extras'
b4eb6b3d
JH
22391fflushNULL='$fflushNULL'
22392fflushall='$fflushall'
5f80c64f
JH
22393find='$find'
22394firstmakefile='$firstmakefile'
22395flex='$flex'
b4eb6b3d
JH
22396fpossize='$fpossize'
22397fpostype='$fpostype'
22398freetype='$freetype'
5440bc8e 22399from='$from'
b4eb6b3d
JH
22400full_ar='$full_ar'
22401full_csh='$full_csh'
22402full_sed='$full_sed'
2d736872 22403gccansipedantic='$gccansipedantic'
5b463ca7 22404gccosandvers='$gccosandvers'
5f80c64f 22405gccversion='$gccversion'
10bc17b6
JH
22406getgrent_r_proto='$getgrent_r_proto'
22407getgrgid_r_proto='$getgrgid_r_proto'
22408getgrnam_r_proto='$getgrnam_r_proto'
22409gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22410gethostbyname_r_proto='$gethostbyname_r_proto'
22411gethostent_r_proto='$gethostent_r_proto'
22412getlogin_r_proto='$getlogin_r_proto'
22413getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22414getnetbyname_r_proto='$getnetbyname_r_proto'
22415getnetent_r_proto='$getnetent_r_proto'
22416getprotobyname_r_proto='$getprotobyname_r_proto'
22417getprotobynumber_r_proto='$getprotobynumber_r_proto'
22418getprotoent_r_proto='$getprotoent_r_proto'
22419getpwent_r_proto='$getpwent_r_proto'
22420getpwnam_r_proto='$getpwnam_r_proto'
22421getpwuid_r_proto='$getpwuid_r_proto'
22422getservbyname_r_proto='$getservbyname_r_proto'
22423getservbyport_r_proto='$getservbyport_r_proto'
22424getservent_r_proto='$getservent_r_proto'
22425getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
22426gidformat='$gidformat'
22427gidsign='$gidsign'
22428gidsize='$gidsize'
22429gidtype='$gidtype'
5f80c64f 22430glibpth='$glibpth'
3c728e00 22431gmake='$gmake'
10bc17b6 22432gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 22433gnulibc_version='$gnulibc_version'
5f80c64f 22434grep='$grep'
b4eb6b3d
JH
22435groupcat='$groupcat'
22436groupstype='$groupstype'
5f80c64f 22437gzip='$gzip'
b4eb6b3d
JH
22438h_fcntl='$h_fcntl'
22439h_sysfile='$h_sysfile'
5f80c64f 22440hint='$hint'
b4eb6b3d 22441hostcat='$hostcat'
6e1038e0
MB
22442html1dir='$html1dir'
22443html1direxp='$html1direxp'
22444html3dir='$html3dir'
22445html3direxp='$html3direxp'
b4eb6b3d
JH
22446i16size='$i16size'
22447i16type='$i16type'
22448i32size='$i32size'
22449i32type='$i32type'
22450i64size='$i64size'
22451i64type='$i64type'
22452i8size='$i8size'
22453i8type='$i8type'
22454i_arpainet='$i_arpainet'
2a0de2c5 22455i_assert='$i_assert'
b4eb6b3d 22456i_bsdioctl='$i_bsdioctl'
10bc17b6 22457i_crypt='$i_crypt'
b4eb6b3d
JH
22458i_db='$i_db'
22459i_dbm='$i_dbm'
22460i_dirent='$i_dirent'
5f80c64f 22461i_dld='$i_dld'
b4eb6b3d
JH
22462i_dlfcn='$i_dlfcn'
22463i_fcntl='$i_fcntl'
22464i_float='$i_float'
758a5d79
JH
22465i_fp='$i_fp'
22466i_fp_class='$i_fp_class'
b4eb6b3d 22467i_gdbm='$i_gdbm'
a33f2d9f
AD
22468i_gdbm_ndbm='$i_gdbm_ndbm'
22469i_gdbmndbm='$i_gdbmndbm'
b4eb6b3d 22470i_grp='$i_grp'
b4eb6b3d
JH
22471i_ieeefp='$i_ieeefp'
22472i_inttypes='$i_inttypes'
2765b840 22473i_langinfo='$i_langinfo'
b4eb6b3d
JH
22474i_libutil='$i_libutil'
22475i_limits='$i_limits'
22476i_locale='$i_locale'
22477i_machcthr='$i_machcthr'
22478i_malloc='$i_malloc'
1cd66f7c 22479i_mallocmalloc='$i_mallocmalloc'
b4eb6b3d
JH
22480i_math='$i_math'
22481i_memory='$i_memory'
22482i_mntent='$i_mntent'
22483i_ndbm='$i_ndbm'
22484i_netdb='$i_netdb'
22485i_neterrno='$i_neterrno'
22486i_netinettcp='$i_netinettcp'
22487i_niin='$i_niin'
22488i_poll='$i_poll'
22489i_prot='$i_prot'
22490i_pthread='$i_pthread'
22491i_pwd='$i_pwd'
22492i_rpcsvcdbm='$i_rpcsvcdbm'
22493i_sfio='$i_sfio'
22494i_sgtty='$i_sgtty'
22495i_shadow='$i_shadow'
22496i_socks='$i_socks'
22497i_stdarg='$i_stdarg'
22498i_stddef='$i_stddef'
22499i_stdlib='$i_stdlib'
22500i_string='$i_string'
22501i_sunmath='$i_sunmath'
22502i_sysaccess='$i_sysaccess'
22503i_sysdir='$i_sysdir'
22504i_sysfile='$i_sysfile'
22505i_sysfilio='$i_sysfilio'
22506i_sysin='$i_sysin'
22507i_sysioctl='$i_sysioctl'
22508i_syslog='$i_syslog'
22509i_sysmman='$i_sysmman'
22510i_sysmode='$i_sysmode'
22511i_sysmount='$i_sysmount'
22512i_sysndir='$i_sysndir'
22513i_sysparam='$i_sysparam'
216dac04 22514i_syspoll='$i_syspoll'
b4eb6b3d
JH
22515i_sysresrc='$i_sysresrc'
22516i_syssecrt='$i_syssecrt'
22517i_sysselct='$i_sysselct'
22518i_syssockio='$i_syssockio'
22519i_sysstat='$i_sysstat'
22520i_sysstatfs='$i_sysstatfs'
22521i_sysstatvfs='$i_sysstatvfs'
22522i_systime='$i_systime'
22523i_systimek='$i_systimek'
22524i_systimes='$i_systimes'
22525i_systypes='$i_systypes'
22526i_sysuio='$i_sysuio'
22527i_sysun='$i_sysun'
22528i_sysutsname='$i_sysutsname'
22529i_sysvfs='$i_sysvfs'
22530i_syswait='$i_syswait'
22531i_termio='$i_termio'
22532i_termios='$i_termios'
22533i_time='$i_time'
22534i_unistd='$i_unistd'
22535i_ustat='$i_ustat'
22536i_utime='$i_utime'
22537i_values='$i_values'
22538i_varargs='$i_varargs'
22539i_varhdr='$i_varhdr'
22540i_vfork='$i_vfork'
5f80c64f 22541ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
22542inc_version_list='$inc_version_list'
22543inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
22544incpath='$incpath'
22545inews='$inews'
f3f1a2d8 22546initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
22547installarchlib='$installarchlib'
22548installbin='$installbin'
6e1038e0
MB
22549installhtml1dir='$installhtml1dir'
22550installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
22551installman1dir='$installman1dir'
22552installman3dir='$installman3dir'
22553installprefix='$installprefix'
22554installprefixexp='$installprefixexp'
22555installprivlib='$installprivlib'
22556installscript='$installscript'
22557installsitearch='$installsitearch'
22558installsitebin='$installsitebin'
8d2cbf27
JH
22559installsitehtml1dir='$installsitehtml1dir'
22560installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 22561installsitelib='$installsitelib'
91e123a8
JH
22562installsiteman1dir='$installsiteman1dir'
22563installsiteman3dir='$installsiteman3dir'
6e1038e0 22564installsitescript='$installsitescript'
b4eb6b3d
JH
22565installstyle='$installstyle'
22566installusrbinperl='$installusrbinperl'
22567installvendorarch='$installvendorarch'
22568installvendorbin='$installvendorbin'
8d2cbf27
JH
22569installvendorhtml1dir='$installvendorhtml1dir'
22570installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 22571installvendorlib='$installvendorlib'
91e123a8
JH
22572installvendorman1dir='$installvendorman1dir'
22573installvendorman3dir='$installvendorman3dir'
6e1038e0 22574installvendorscript='$installvendorscript'
b4eb6b3d 22575intsize='$intsize'
4b661809 22576issymlink='$issymlink'
b4eb6b3d
JH
22577ivdformat='$ivdformat'
22578ivsize='$ivsize'
22579ivtype='$ivtype'
22580known_extensions='$known_extensions'
5f80c64f 22581ksh='$ksh'
5f80c64f
JH
22582ld='$ld'
22583lddlflags='$lddlflags'
22584ldflags='$ldflags'
b4eb6b3d
JH
22585ldflags_uselargefiles='$ldflags_uselargefiles'
22586ldlibpthname='$ldlibpthname'
5f80c64f
JH
22587less='$less'
22588lib_ext='$lib_ext'
22589libc='$libc'
b4eb6b3d 22590libperl='$libperl'
5f80c64f
JH
22591libpth='$libpth'
22592libs='$libs'
43999f95
JH
22593libsdirs='$libsdirs'
22594libsfiles='$libsfiles'
22595libsfound='$libsfound'
13b3f787 22596libspath='$libspath'
5f80c64f 22597libswanted='$libswanted'
b4eb6b3d 22598libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
22599line='$line'
22600lint='$lint'
22601lkflags='$lkflags'
22602ln='$ln'
22603lns='$lns'
10bc17b6 22604localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
22605locincpth='$locincpth'
22606loclibpth='$loclibpth'
b4eb6b3d
JH
22607longdblsize='$longdblsize'
22608longlongsize='$longlongsize'
22609longsize='$longsize'
5f80c64f
JH
22610lp='$lp'
22611lpr='$lpr'
22612ls='$ls'
b4eb6b3d
JH
22613lseeksize='$lseeksize'
22614lseektype='$lseektype'
a724edfe 22615mad='$mad'
f3f1a2d8
MB
22616madlyh='$madlyh'
22617madlyobj='$madlyobj'
22618madlysrc='$madlysrc'
5f80c64f
JH
22619mail='$mail'
22620mailx='$mailx'
22621make='$make'
22622make_set_make='$make_set_make'
b4eb6b3d
JH
22623mallocobj='$mallocobj'
22624mallocsrc='$mallocsrc'
22625malloctype='$malloctype'
22626man1dir='$man1dir'
22627man1direxp='$man1direxp'
22628man1ext='$man1ext'
22629man3dir='$man3dir'
22630man3direxp='$man3direxp'
22631man3ext='$man3ext'
5f80c64f 22632mips_type='$mips_type'
5129fff4 22633mistrustnm='$mistrustnm'
5f80c64f 22634mkdir='$mkdir'
b4eb6b3d
JH
22635mmaptype='$mmaptype'
22636modetype='$modetype'
5f80c64f 22637more='$more'
b4eb6b3d 22638multiarch='$multiarch'
5f80c64f 22639mv='$mv'
b4eb6b3d
JH
22640myarchname='$myarchname'
22641mydomain='$mydomain'
22642myhostname='$myhostname'
5f80c64f
JH
22643myuname='$myuname'
22644n='$n'
2cc61e15 22645need_va_copy='$need_va_copy'
b4eb6b3d
JH
22646netdb_hlen_type='$netdb_hlen_type'
22647netdb_host_type='$netdb_host_type'
22648netdb_name_type='$netdb_name_type'
22649netdb_net_type='$netdb_net_type'
5f80c64f
JH
22650nm='$nm'
22651nm_opt='$nm_opt'
22652nm_so_opt='$nm_so_opt'
b4eb6b3d 22653nonxs_ext='$nonxs_ext'
5f80c64f 22654nroff='$nroff'
b4eb6b3d
JH
22655nvEUformat='$nvEUformat'
22656nvFUformat='$nvFUformat'
22657nvGUformat='$nvGUformat'
b68c599a 22658nv_overflows_integers_at='$nv_overflows_integers_at'
53133ed1 22659nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
22660nveformat='$nveformat'
22661nvfformat='$nvfformat'
22662nvgformat='$nvgformat'
22663nvsize='$nvsize'
22664nvtype='$nvtype'
22665o_nonblock='$o_nonblock'
5f80c64f 22666obj_ext='$obj_ext'
b4eb6b3d 22667old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 22668optimize='$optimize'
b4eb6b3d 22669orderlib='$orderlib'
5f80c64f
JH
22670osname='$osname'
22671osvers='$osvers'
b4eb6b3d 22672otherlibdirs='$otherlibdirs'
5f80c64f 22673package='$package'
b4eb6b3d
JH
22674pager='$pager'
22675passcat='$passcat'
22676patchlevel='$patchlevel'
5f80c64f 22677path_sep='$path_sep'
b4eb6b3d 22678perl5='$perl5'
5f80c64f 22679perl='$perl'
151e6568 22680perl_patchlevel='$perl_patchlevel'
b4eb6b3d 22681perladmin='$perladmin'
9c839522 22682perllibs='$perllibs'
b4eb6b3d 22683perlpath='$perlpath'
5f80c64f 22684pg='$pg'
b4eb6b3d
JH
22685phostname='$phostname'
22686pidtype='$pidtype'
5f80c64f
JH
22687plibpth='$plibpth'
22688pmake='$pmake'
22689pr='$pr'
b4eb6b3d
JH
22690prefix='$prefix'
22691prefixexp='$prefixexp'
22692privlib='$privlib'
22693privlibexp='$privlibexp'
f24dbf84 22694procselfexe='$procselfexe'
b4eb6b3d
JH
22695prototype='$prototype'
22696ptrsize='$ptrsize'
22697quadkind='$quadkind'
22698quadtype='$quadtype'
22699randbits='$randbits'
22700randfunc='$randfunc'
10bc17b6 22701random_r_proto='$random_r_proto'
b4eb6b3d
JH
22702randseedtype='$randseedtype'
22703ranlib='$ranlib'
22704rd_nodata='$rd_nodata'
10bc17b6
JH
22705readdir64_r_proto='$readdir64_r_proto'
22706readdir_r_proto='$readdir_r_proto'
b4eb6b3d 22707revision='$revision'
5f80c64f 22708rm='$rm'
5b813a60 22709rm_try='$rm_try'
5f80c64f 22710rmail='$rmail'
5440bc8e 22711run='$run'
5f80c64f 22712runnm='$runnm'
81c4fd9e
MB
22713sGMTIME_max='$sGMTIME_max'
22714sGMTIME_min='$sGMTIME_min'
b4eb6b3d
JH
22715sPRIEUldbl='$sPRIEUldbl'
22716sPRIFUldbl='$sPRIFUldbl'
22717sPRIGUldbl='$sPRIGUldbl'
22718sPRIXU64='$sPRIXU64'
22719sPRId64='$sPRId64'
22720sPRIeldbl='$sPRIeldbl'
22721sPRIfldbl='$sPRIfldbl'
22722sPRIgldbl='$sPRIgldbl'
22723sPRIi64='$sPRIi64'
22724sPRIo64='$sPRIo64'
22725sPRIu64='$sPRIu64'
22726sPRIx64='$sPRIx64'
22727sSCNfldbl='$sSCNfldbl'
22728sched_yield='$sched_yield'
22729scriptdir='$scriptdir'
22730scriptdirexp='$scriptdirexp'
5f80c64f 22731sed='$sed'
b4eb6b3d
JH
22732seedfunc='$seedfunc'
22733selectminbits='$selectminbits'
22734selecttype='$selecttype'
5f80c64f 22735sendmail='$sendmail'
10bc17b6
JH
22736setgrent_r_proto='$setgrent_r_proto'
22737sethostent_r_proto='$sethostent_r_proto'
22738setlocale_r_proto='$setlocale_r_proto'
22739setnetent_r_proto='$setnetent_r_proto'
22740setprotoent_r_proto='$setprotoent_r_proto'
22741setpwent_r_proto='$setpwent_r_proto'
22742setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
22743sh='$sh'
22744shar='$shar'
22745sharpbang='$sharpbang'
b4eb6b3d
JH
22746shmattype='$shmattype'
22747shortsize='$shortsize'
22748shrpenv='$shrpenv'
5f80c64f 22749shsharp='$shsharp'
b4eb6b3d
JH
22750sig_count='$sig_count'
22751sig_name='$sig_name'
22752sig_name_init='$sig_name_init'
22753sig_num='$sig_num'
22754sig_num_init='$sig_num_init'
76d3c696 22755sig_size='$sig_size'
b4eb6b3d
JH
22756signal_t='$signal_t'
22757sitearch='$sitearch'
22758sitearchexp='$sitearchexp'
22759sitebin='$sitebin'
22760sitebinexp='$sitebinexp'
8d2cbf27
JH
22761sitehtml1dir='$sitehtml1dir'
22762sitehtml1direxp='$sitehtml1direxp'
22763sitehtml3dir='$sitehtml3dir'
22764sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
22765sitelib='$sitelib'
22766sitelib_stem='$sitelib_stem'
22767sitelibexp='$sitelibexp'
91e123a8
JH
22768siteman1dir='$siteman1dir'
22769siteman1direxp='$siteman1direxp'
22770siteman3dir='$siteman3dir'
22771siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
22772siteprefix='$siteprefix'
22773siteprefixexp='$siteprefixexp'
6e1038e0
MB
22774sitescript='$sitescript'
22775sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
22776sizesize='$sizesize'
22777sizetype='$sizetype'
5f80c64f
JH
22778sleep='$sleep'
22779smail='$smail'
5f80c64f 22780so='$so'
b4eb6b3d
JH
22781sockethdr='$sockethdr'
22782socketlib='$socketlib'
22783socksizetype='$socksizetype'
5f80c64f
JH
22784sort='$sort'
22785spackage='$spackage'
22786spitshell='$spitshell'
10bc17b6
JH
22787srand48_r_proto='$srand48_r_proto'
22788srandom_r_proto='$srandom_r_proto'
5f80c64f 22789src='$src'
b4eb6b3d
JH
22790ssizetype='$ssizetype'
22791startperl='$startperl'
5f80c64f 22792startsh='$startsh'
b4eb6b3d
JH
22793static_ext='$static_ext'
22794stdchar='$stdchar'
22795stdio_base='$stdio_base'
22796stdio_bufsiz='$stdio_bufsiz'
22797stdio_cnt='$stdio_cnt'
22798stdio_filbuf='$stdio_filbuf'
22799stdio_ptr='$stdio_ptr'
22800stdio_stream_array='$stdio_stream_array'
10bc17b6 22801strerror_r_proto='$strerror_r_proto'
b4eb6b3d 22802strings='$strings'
5f80c64f 22803submit='$submit'
b4eb6b3d
JH
22804subversion='$subversion'
22805sysman='$sysman'
5f80c64f
JH
22806tail='$tail'
22807tar='$tar'
5440bc8e 22808targetarch='$targetarch'
5f80c64f
JH
22809tbl='$tbl'
22810tee='$tee'
22811test='$test'
b4eb6b3d
JH
22812timeincl='$timeincl'
22813timetype='$timetype'
10bc17b6 22814tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 22815to='$to'
5f80c64f
JH
22816touch='$touch'
22817tr='$tr'
22818trnl='$trnl'
22819troff='$troff'
10bc17b6 22820ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
22821u16size='$u16size'
22822u16type='$u16type'
22823u32size='$u32size'
22824u32type='$u32type'
22825u64size='$u64size'
22826u64type='$u64type'
22827u8size='$u8size'
22828u8type='$u8type'
22829uidformat='$uidformat'
22830uidsign='$uidsign'
22831uidsize='$uidsize'
22832uidtype='$uidtype'
5f80c64f
JH
22833uname='$uname'
22834uniq='$uniq'
b4eb6b3d
JH
22835uquadtype='$uquadtype'
22836use5005threads='$use5005threads'
22837use64bitall='$use64bitall'
22838use64bitint='$use64bitint'
5440bc8e 22839usecrosscompile='$usecrosscompile'
5f80c64f 22840usedl='$usedl'
5ac1e9b2 22841usedtrace='$usedtrace'
15b61c98 22842usefaststdio='$usefaststdio'
b4eb6b3d
JH
22843useithreads='$useithreads'
22844uselargefiles='$uselargefiles'
22845uselongdouble='$uselongdouble'
19a100ff 22846usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
22847usemorebits='$usemorebits'
22848usemultiplicity='$usemultiplicity'
22849usemymalloc='$usemymalloc'
5f80c64f 22850usenm='$usenm'
b4eb6b3d
JH
22851useopcode='$useopcode'
22852useperlio='$useperlio'
22853useposix='$useposix'
9514c62b 22854usereentrant='$usereentrant'
d51aaa9d 22855userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
22856usesfio='$usesfio'
22857useshrplib='$useshrplib'
5f106f9c 22858usesitecustomize='$usesitecustomize'
29209bc5 22859usesocks='$usesocks'
b4eb6b3d
JH
22860usethreads='$usethreads'
22861usevendorprefix='$usevendorprefix'
22862usevfork='$usevfork'
5f80c64f
JH
22863usrinc='$usrinc'
22864uuname='$uuname'
b4eb6b3d
JH
22865uvXUformat='$uvXUformat'
22866uvoformat='$uvoformat'
22867uvsize='$uvsize'
22868uvtype='$uvtype'
22869uvuformat='$uvuformat'
22870uvxformat='$uvxformat'
22871vendorarch='$vendorarch'
22872vendorarchexp='$vendorarchexp'
22873vendorbin='$vendorbin'
22874vendorbinexp='$vendorbinexp'
8d2cbf27
JH
22875vendorhtml1dir='$vendorhtml1dir'
22876vendorhtml1direxp='$vendorhtml1direxp'
22877vendorhtml3dir='$vendorhtml3dir'
22878vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
22879vendorlib='$vendorlib'
22880vendorlib_stem='$vendorlib_stem'
22881vendorlibexp='$vendorlibexp'
91e123a8
JH
22882vendorman1dir='$vendorman1dir'
22883vendorman1direxp='$vendorman1direxp'
22884vendorman3dir='$vendorman3dir'
22885vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
22886vendorprefix='$vendorprefix'
22887vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
22888vendorscript='$vendorscript'
22889vendorscriptexp='$vendorscriptexp'
b4eb6b3d 22890version='$version'
861eb78d 22891version_patchlevel_string='$version_patchlevel_string'
d56c5707 22892versiononly='$versiononly'
5f80c64f 22893vi='$vi'
b4eb6b3d 22894voidflags='$voidflags'
5f80c64f 22895xlibpth='$xlibpth'
3659ebf1
JH
22896yacc='$yacc'
22897yaccflags='$yaccflags'
5f80c64f
JH
22898zcat='$zcat'
22899zip='$zip'
22900EOT
22901
22902: Add in command line options if available
22903$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22904
22905: add special variables
22906$test -f $src/patchlevel.h && \
d00b958f 22907awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 22908echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 22909echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22910
22911: propagate old symbols
22912if $test -f UU/config.sh; then
381aa1ff 22913 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
776a38e3
MB
22914 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22915 config.sh config.sh UU/oldconfig.sh |\
22916 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22917 set X `cat UU/oldsyms`
22918 shift
22919 case $# in
22920 0) ;;
22921 *)
22922 cat <<EOM
22923Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22924EOM
776a38e3 22925 echo ": Variables propagated from previous config.sh file." >>config.sh
5f80c64f
JH
22926 for sym in `cat UU/oldsyms`; do
22927 echo " Propagating $hint variable "'$'"$sym..."
22928 eval 'tmp="$'"${sym}"'"'
22929 echo "$tmp" | \
22930 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22931 done
22932 ;;
22933 esac
22934fi
22935
22936: Finish up by extracting the .SH files
22937case "$alldone" in
22938exit)
22939 $rm -rf UU
24ccb310 22940 echo "Extraction done."
5f80c64f
JH
22941 exit 0
22942 ;;
22943cont)
22944 ;;
22945'')
22946 dflt=''
22947 nostick=true
22948 $cat <<EOM
22949
22950If you'd like to make any changes to the config.sh file before I begin
22951to configure things, do it as a shell escape now (e.g. !vi config.sh).
22952
22953EOM
22954 rp="Press return or use a shell escape to edit config.sh:"
22955 . UU/myread
22956 nostick=''
22957 case "$ans" in
22958 '') ;;
22959 *) : in case they cannot read
22960 sh 1>&4 -c "$ans";;
22961 esac
22962 ;;
22963esac
22964
22965: if this fails, just run all the .SH files by hand
22966. ./config.sh
22967
22968echo " "
22969exec 1>&4
a43e8593 22970pwd=`pwd`
5f80c64f 22971. ./UU/extract
6904989c 22972cd "$pwd"
5f80c64f
JH
22973
22974if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22975 dflt=y
22976 case "$silent" in
22977 true) ;;
22978 *)
22979 $cat <<EOM
22980
22981Now you need to generate make dependencies by running "$make depend".
22982You might prefer to run it in background: "$make depend > makedepend.out &"
22983It can take a while, so you might not want to run it right now.
22984
22985EOM
22986 ;;
22987 esac
22988 rp="Run $make depend now?"
22989 . UU/myread
22990 case "$ans" in
22991 y*)
3d5d58b1 22992 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22993 ;;
22994 *)
22995 echo "You must run '$make depend' then '$make'."
22996 ;;
22997 esac
22998elif test -f [Mm]akefile; then
22999 echo " "
23000 echo "Now you must run a $make."
23001else
24ccb310 23002 echo "Configure done."
5f80c64f
JH
23003fi
23004
23005if $test -f Policy.sh; then
23006 $cat <<EOM
23007
23008If you compile $package on a different machine or from a different object
23009directory, copy the Policy.sh file from this object directory to the
23010new one before you run Configure -- this will help you with most of
23011the policy defaults.
23012
23013EOM
23014fi
23015if $test -f config.msg; then
23016 echo "Hmm. I also noted the following information while running:"
23017 echo " "
23018 $cat config.msg >&4
23019 $rm -f config.msg
23020fi
23021$rm -f kit*isdone ark*isdone
23022$rm -rf UU
23023
23024: End of Configure
23025