This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PATCH: 2 vms specific build files in perl @ 27383
[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#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62 19#
5cadb3f3
MB
20#
21# Though this script was generated by metaconfig, it is OK to send
22# patches against it. It's up to the Configure pumpkin to backport
23# the patch to the metaunits if it is accepted.
24# See Porting/pumpkin.pod for more information on metaconfig.
25#
2304df62 26
dfe9444c 27# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 28#
635aebb7 29# Generated on Fri Mar 3 17:34:44 CET 2006 [metaconfig 3.0 PL70]
7f2de2d2 30# (with additional metaconfig patches by perlbug@perl.org)
2304df62 31
283fdd21 32cat >c1$$ <<EOF
2304df62
AD
33ARGGGHHHH!!!!!
34
35SCO csh still thinks true is false. Write to SCO today and tell them that next
36year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
39we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41[End of diatribe. We now return you to your regularly scheduled programming...]
42EOF
283fdd21 43cat >c2$$ <<EOF
2304df62
AD
44
45OOPS! You naughty creature! You didn't run Configure with sh!
46I will attempt to remedy the situation by running sh for you...
47EOF
48
283fdd21 49true || cat c1$$ c2$$
2304df62
AD
50true || exec sh $0 $argv:q
51
283fdd21 52(exit $?0) || cat c2$$
2304df62 53(exit $?0) || exec sh $0 $argv:q
283fdd21 54rm -f c1$$ c2$$
2304df62 55
f6538904 56if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
57 cat >&4 <<EOF
58***
59*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
61*** Please read the README.plan9 for further instructions.
62*** Cannot continue, aborting.
63***
64EOF
65 exit 1
66fi
67
a0d0e21e
LW
68: compute my invocation name
69me=$0
70case "$0" in
71*/*)
72 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73 test "$me" || me=$0
74 ;;
75esac
76
dfe9444c 77: Proper separator for the PATH environment variable
8e07c86e
AD
78p_=:
79: On OS/2 this directory should exist if this is not floppy only system :-]
5c728af0 80if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
81 if test -n "$OS2_SHELL"; then
82 p_=\;
83 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 85 is_os2=yes
c4f23d77 86 elif test -n "$DJGPP"; then
495e2cbe
MB
87 case "X${MACHTYPE:-nonesuchmach}" in
88 *cygwin) ;;
89 *) p_=\; ;;
90 esac
dfe9444c 91 fi
39e571d4 92fi
a0d0e21e
LW
93
94: Proper PATH setting
95paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 96paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 97paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 98paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 99paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 100paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
101paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 103paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
104
105for p in $paths
106do
8e07c86e
AD
107 case "$p_$PATH$p_" in
108 *$p_$p$p_*) ;;
109 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
110 esac
111done
112
8e07c86e 113PATH=.$p_$PATH
2304df62
AD
114export PATH
115
dfe9444c
AD
116: shall we be using ksh?
117inksh=''
118needksh=''
119avoidksh=''
120newsh=/bin/ksh
121changesh=''
ff0cee69 122if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
123 inksh=true
124fi
125if test -f /hp-ux -a -f /bin/ksh; then
126 needksh='to avoid sh bug in "here document" expansion'
127fi
128if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129 if test X`/usr/bin/uname -v` = X4; then
130 avoidksh="to avoid AIX 4's /bin/sh"
131 newsh=/usr/bin/bsh
2304df62 132 fi
dfe9444c 133fi
cf04f91f
JH
134if test -f /osf_boot -a -f /usr/sbin/setld; then
135 if test X`/usr/bin/uname -s` = XOSF1; then
136 avoidksh="to avoid Digital UNIX' ksh"
137 newsh=/bin/sh
138 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139 fi
140fi
dfe9444c
AD
141case "$inksh/$needksh" in
142/[a-z]*)
c4f23d77 143 ENV=''
dfe9444c
AD
144 changesh=true
145 reason="$needksh"
146 ;;
147esac
148case "$inksh/$avoidksh" in
149true/[a-z]*)
150 changesh=true
151 reason="$avoidksh"
152 ;;
153esac
154case "$inksh/$needksh-$avoidksh-" in
155true/--)
a0d0e21e
LW
156 cat <<EOM
157(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 158mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 159EOM
dfe9444c
AD
160 ;;
161esac
162case "$changesh" in
163true)
2e2a97a6 164 export newsh
dfe9444c
AD
165 echo "(Feeding myself to $newsh $reason.)"
166 case "$0" in
167 Configure|*/Configure) exec $newsh $0 "$@";;
168 *) exec $newsh Configure "$@";;
169 esac
170 ;;
171esac
2304df62 172
bfb7748a
AD
173: if needed set CDPATH to a harmless value that is not chatty
174: avoid bash 2.02 problems with empty CDPATH.
175case "$CDPATH" in
176'') ;;
177*) case "$SHELL" in
178 *bash*) CDPATH='.' ;;
179 *) CDPATH='' ;;
180 esac
181 ;;
182esac
2304df62
AD
183: Configure runs within the UU subdirectory
184test -d UU || mkdir UU
8e07c86e 185cd UU && rm -f ./*
2304df62 186
6b356c8e
JH
187ccname=''
188ccversion=''
b4eb6b3d
JH
189ccsymbols=''
190cppccsymbols=''
191cppsymbols=''
5440bc8e
JH
192from=''
193run=''
194targetarch=''
195to=''
196usecrosscompile=''
6b34ded5 197mistrustnm=''
9c839522 198perllibs=''
b4eb6b3d
JH
199dynamic_ext=''
200extensions=''
201known_extensions=''
202nonxs_ext=''
203static_ext=''
204useopcode=''
205useposix=''
6fcddf3b 206extras=''
ecfc5424 207d_bsd=''
40a7a20a 208d_eunice=''
2304df62
AD
209d_xenix=''
210eunicefix=''
211Mcc=''
dfe9444c 212ar=''
2304df62
AD
213awk=''
214bash=''
215bison=''
216byacc=''
217cat=''
218chgrp=''
219chmod=''
220chown=''
ecfc5424 221comm=''
2304df62
AD
222compress=''
223cp=''
224cpio=''
225cpp=''
226csh=''
227date=''
228echo=''
229egrep=''
230emacs=''
231expr=''
232find=''
233flex=''
3c728e00 234gmake=''
2304df62 235grep=''
8ff267be 236gzip=''
2304df62
AD
237inews=''
238ksh=''
239less=''
240line=''
241lint=''
242ln=''
243lp=''
244lpr=''
245ls=''
246mail=''
247mailx=''
dfe9444c 248make=''
2304df62
AD
249mkdir=''
250more=''
251mv=''
693762b4 252nm=''
2304df62
AD
253nroff=''
254perl=''
255pg=''
256pmake=''
257pr=''
258rm=''
259rmail=''
260sed=''
261sendmail=''
2304df62
AD
262shar=''
263sleep=''
264smail=''
265sort=''
266submit=''
267tail=''
268tar=''
269tbl=''
693762b4 270tee=''
2304df62
AD
271test=''
272touch=''
273tr=''
274troff=''
275uname=''
276uniq=''
277uuname=''
278vi=''
279zcat=''
8ff267be 280zip=''
b4eb6b3d
JH
281full_ar=''
282full_sed=''
a0d0e21e 283libswanted=''
2304df62
AD
284hint=''
285myuname=''
85e6fe83
LW
286osname=''
287osvers=''
2304df62
AD
288Author=''
289Date=''
290Header=''
291Id=''
292Locker=''
293Log=''
294RCSfile=''
295Revision=''
296Source=''
297State=''
dfe9444c
AD
298_a=''
299_exe=''
300_o=''
4633a7c4
LW
301archobjs=''
302exe_ext=''
303firstmakefile=''
304lib_ext=''
305obj_ext=''
306path_sep=''
b4eb6b3d 307afs=''
a6d26a0d 308afsroot=''
b4eb6b3d
JH
309alignbytes=''
310ansi2knr=''
311archlib=''
312archlibexp=''
313d_archlib=''
314installarchlib=''
315archname=''
316myarchname=''
317d_atolf=''
318d_atoll=''
319baserev=''
320bin=''
321binexp=''
322installbin=''
b4eb6b3d 323byteorder=''
2304df62 324cc=''
2304df62
AD
325ccflags=''
326cppflags=''
327ldflags=''
328lkflags=''
8e07c86e 329locincpth=''
2304df62 330optimize=''
b4eb6b3d 331cf_email=''
2304df62
AD
332cf_by=''
333cf_time=''
b4eb6b3d 334charsize=''
2304df62 335contains=''
b4eb6b3d 336cpp_stuff=''
2304df62
AD
337cpplast=''
338cppminus=''
339cpprun=''
340cppstdin=''
74cac757 341d__fwalk=''
b4eb6b3d
JH
342d_access=''
343d_accessx=''
55954f19 344d_aintl=''
b4eb6b3d 345d_alarm=''
10bc17b6
JH
346asctime_r_proto=''
347d_asctime_r=''
0dbb1585
AL
348d_attribute_format=''
349d_attribute_malloc=''
350d_attribute_nonnull=''
351d_attribute_noreturn=''
352d_attribute_pure=''
353d_attribute_unused=''
354d_attribute_warn_unused_result=''
b4eb6b3d
JH
355d_bcmp=''
356d_bcopy=''
635aebb7
AL
357d_builtin_choose_expr=''
358d_builtin_expect=''
b4eb6b3d
JH
359d_bzero=''
360d_casti32=''
361castflags=''
362d_castneg=''
363d_chown=''
364d_chroot=''
365d_chsize=''
758a5d79 366d_class=''
b0a2e8e6 367d_clearenv=''
b4eb6b3d
JH
368d_closedir=''
369d_void_closedir=''
4e0554ec 370d_cmsghdr_s=''
b4eb6b3d 371d_const=''
36adc09b 372d_copysignl=''
b4eb6b3d
JH
373cryptlib=''
374d_crypt=''
10bc17b6
JH
375crypt_r_proto=''
376d_crypt_r=''
b4eb6b3d
JH
377d_csh=''
378full_csh=''
10bc17b6
JH
379ctermid_r_proto=''
380d_ctermid_r=''
381ctime_r_proto=''
382d_ctime_r=''
b4eb6b3d
JH
383d_cuserid=''
384d_dbl_dig=''
2ef53570 385d_dbminitproto=''
b4eb6b3d 386d_difftime=''
ae0e3d3b 387d_dirfd=''
b4eb6b3d 388d_dlerror=''
a0d0e21e 389d_dlopen=''
b4eb6b3d
JH
390d_dlsymun=''
391d_dosuid=''
392d_suidsafe=''
10bc17b6
JH
393d_drand48_r=''
394drand48_r_proto=''
b4eb6b3d
JH
395d_drand48proto=''
396d_dup2=''
397d_eaccess=''
398d_endgrent=''
10bc17b6
JH
399d_endgrent_r=''
400endgrent_r_proto=''
b4eb6b3d 401d_endhent=''
10bc17b6
JH
402d_endhostent_r=''
403endhostent_r_proto=''
b4eb6b3d 404d_endnent=''
10bc17b6
JH
405d_endnetent_r=''
406endnetent_r_proto=''
b4eb6b3d 407d_endpent=''
10bc17b6
JH
408d_endprotoent_r=''
409endprotoent_r_proto=''
b4eb6b3d 410d_endpwent=''
10bc17b6
JH
411d_endpwent_r=''
412endpwent_r_proto=''
b4eb6b3d 413d_endsent=''
10bc17b6
JH
414d_endservent_r=''
415endservent_r_proto=''
15b61c98 416d_faststdio=''
b363b713 417d_fchdir=''
b4eb6b3d
JH
418d_fchmod=''
419d_fchown=''
420d_fcntl=''
9d9004a9 421d_fcntl_can_lock=''
b4eb6b3d
JH
422d_fd_macros=''
423d_fd_set=''
424d_fds_bits=''
425d_fgetpos=''
758a5d79
JH
426d_finite=''
427d_finitel=''
b4eb6b3d
JH
428d_flexfnam=''
429d_flock=''
2ef53570 430d_flockproto=''
b4eb6b3d 431d_fork=''
758a5d79
JH
432d_fp_class=''
433d_fpclass=''
434d_fpclassify=''
435d_fpclassl=''
b4eb6b3d
JH
436d_fpos64_t=''
437d_frexpl=''
438d_fs_data_s=''
439d_fseeko=''
440d_fsetpos=''
441d_fstatfs=''
411ab01c 442d_fsync=''
b4eb6b3d
JH
443d_ftello=''
444d_ftime=''
445d_gettimeod=''
dc814df1 446d_futimes=''
b4eb6b3d
JH
447d_Gconvert=''
448d_getcwd=''
449d_getespwnam=''
450d_getfsstat=''
451d_getgrent=''
10bc17b6
JH
452d_getgrent_r=''
453getgrent_r_proto=''
454d_getgrgid_r=''
455getgrgid_r_proto=''
456d_getgrnam_r=''
457getgrnam_r_proto=''
b4eb6b3d
JH
458d_getgrps=''
459d_gethbyaddr=''
460d_gethbyname=''
461d_gethent=''
462aphostname=''
463d_gethname=''
464d_phostname=''
465d_uname=''
10bc17b6
JH
466d_gethostbyaddr_r=''
467gethostbyaddr_r_proto=''
468d_gethostbyname_r=''
469gethostbyname_r_proto=''
470d_gethostent_r=''
471gethostent_r_proto=''
b4eb6b3d 472d_gethostprotos=''
4e0554ec 473d_getitimer=''
b4eb6b3d 474d_getlogin=''
10bc17b6
JH
475d_getlogin_r=''
476getlogin_r_proto=''
b4eb6b3d
JH
477d_getmnt=''
478d_getmntent=''
479d_getnbyaddr=''
480d_getnbyname=''
481d_getnent=''
10bc17b6
JH
482d_getnetbyaddr_r=''
483getnetbyaddr_r_proto=''
484d_getnetbyname_r=''
485getnetbyname_r_proto=''
486d_getnetent_r=''
487getnetent_r_proto=''
b4eb6b3d 488d_getnetprotos=''
0c0643d0 489d_getpagsz=''
b4eb6b3d
JH
490d_getpent=''
491d_getpgid=''
492d_getpgrp2=''
493d_bsdgetpgrp=''
494d_getpgrp=''
495d_getppid=''
496d_getprior=''
497d_getpbyname=''
498d_getpbynumber=''
10bc17b6
JH
499d_getprotobyname_r=''
500getprotobyname_r_proto=''
501d_getprotobynumber_r=''
502getprotobynumber_r_proto=''
503d_getprotoent_r=''
504getprotoent_r_proto=''
b4eb6b3d
JH
505d_getprotoprotos=''
506d_getprpwnam=''
507d_getpwent=''
10bc17b6
JH
508d_getpwent_r=''
509getpwent_r_proto=''
510d_getpwnam_r=''
511getpwnam_r_proto=''
512d_getpwuid_r=''
513getpwuid_r_proto=''
b4eb6b3d 514d_getsent=''
10bc17b6
JH
515d_getservbyname_r=''
516getservbyname_r_proto=''
517d_getservbyport_r=''
518getservbyport_r_proto=''
519d_getservent_r=''
520getservent_r_proto=''
b4eb6b3d
JH
521d_getservprotos=''
522d_getspnam=''
10bc17b6
JH
523d_getspnam_r=''
524getspnam_r_proto=''
b4eb6b3d
JH
525d_getsbyname=''
526d_getsbyport=''
10bc17b6
JH
527d_gmtime_r=''
528gmtime_r_proto=''
a4f3eea9 529d_gnulibc=''
5f6e0ee4 530gnulibc_version=''
b4eb6b3d
JH
531d_hasmntopt=''
532d_htonl=''
55954f19 533d_ilogbl=''
b4eb6b3d
JH
534d_inetaton=''
535d_int64_t=''
536d_isascii=''
758a5d79
JH
537d_isfinite=''
538d_isinf=''
b4eb6b3d
JH
539d_isnan=''
540d_isnanl=''
541d_killpg=''
542d_lchown=''
543d_ldbl_dig=''
0a0abfba 544d_libm_lib_version=''
b4eb6b3d 545d_link=''
10bc17b6
JH
546d_localtime_r=''
547localtime_r_proto=''
b4eb6b3d
JH
548d_locconv=''
549d_lockf=''
550d_longdbl=''
551longdblsize=''
552d_longlong=''
553longlongsize=''
554d_lseekproto=''
555d_lstat=''
556d_madvise=''
7dd121ae
MB
557d_malloc_good_size=''
558d_malloc_size=''
b4eb6b3d
JH
559d_mblen=''
560d_mbstowcs=''
561d_mbtowc=''
562d_memchr=''
563d_memcmp=''
564d_memcpy=''
565d_memmove=''
566d_memset=''
567d_mkdir=''
568d_mkdtemp=''
569d_mkfifo=''
570d_mkstemp=''
571d_mkstemps=''
572d_mktime=''
573d_mmap=''
574mmaptype=''
575d_modfl=''
e67aeab1 576d_modfl_pow32_bug=''
bc9a1b2c 577d_modflproto=''
b4eb6b3d
JH
578d_mprotect=''
579d_msg=''
580d_msgctl=''
581d_msgget=''
4e0554ec 582d_msghdr_s=''
b4eb6b3d
JH
583d_msgrcv=''
584d_msgsnd=''
585d_msync=''
586d_munmap=''
587d_nice=''
2765b840 588d_nl_langinfo=''
b4eb6b3d
JH
589d_off64_t=''
590d_open3=''
591d_fpathconf=''
592d_pathconf=''
593d_pause=''
594d_pipe=''
595d_poll=''
2304df62 596d_portable=''
a33c94aa 597d_procselfexe=''
f24dbf84 598procselfexe=''
b4eb6b3d
JH
599d_old_pthread_create_joinable=''
600old_pthread_create_joinable=''
d6483fcc 601d_pthread_atfork=''
58d975c3 602d_pthread_attr_setscope=''
b4eb6b3d
JH
603d_pthread_yield=''
604d_sched_yield=''
605sched_yield=''
606d_qgcvt=''
10bc17b6
JH
607d_random_r=''
608random_r_proto=''
609d_readdir64_r=''
610readdir64_r_proto=''
b4eb6b3d
JH
611d_readdir=''
612d_rewinddir=''
613d_seekdir=''
614d_telldir=''
10bc17b6
JH
615d_readdir_r=''
616readdir_r_proto=''
b4eb6b3d 617d_readlink=''
4e0554ec
JH
618d_readv=''
619d_recvmsg=''
b4eb6b3d
JH
620d_rename=''
621d_rmdir=''
622d_safebcpy=''
623d_safemcpy=''
624d_sanemcmp=''
ef9f17be 625d_sbrkproto=''
55954f19 626d_scalbnl=''
b4eb6b3d
JH
627d_select=''
628d_sem=''
629d_semctl=''
630d_semget=''
631d_semop=''
4e0554ec 632d_sendmsg=''
b4eb6b3d
JH
633d_setegid=''
634d_seteuid=''
635d_setgrent=''
10bc17b6
JH
636d_setgrent_r=''
637setgrent_r_proto=''
b4eb6b3d
JH
638d_setgrps=''
639d_sethent=''
10bc17b6
JH
640d_sethostent_r=''
641sethostent_r_proto=''
4e0554ec 642d_setitimer=''
b4eb6b3d
JH
643d_setlinebuf=''
644d_setlocale=''
10bc17b6
JH
645d_setlocale_r=''
646setlocale_r_proto=''
b4eb6b3d 647d_setnent=''
10bc17b6
JH
648d_setnetent_r=''
649setnetent_r_proto=''
b4eb6b3d
JH
650d_setpent=''
651d_setpgid=''
652d_setpgrp2=''
653d_bsdsetpgrp=''
654d_setpgrp=''
655d_setprior=''
656d_setproctitle=''
10bc17b6
JH
657d_setprotoent_r=''
658setprotoent_r_proto=''
b4eb6b3d 659d_setpwent=''
10bc17b6
JH
660d_setpwent_r=''
661setpwent_r_proto=''
b4eb6b3d
JH
662d_setregid=''
663d_setresgid=''
664d_setresuid=''
665d_setreuid=''
666d_setrgid=''
667d_setruid=''
668d_setsent=''
10bc17b6
JH
669d_setservent_r=''
670setservent_r_proto=''
b4eb6b3d
JH
671d_setsid=''
672d_setvbuf=''
673d_sfio=''
674usesfio=''
675d_shm=''
676d_shmat=''
677d_shmatprototype=''
678shmattype=''
679d_shmctl=''
680d_shmdt=''
681d_shmget=''
682d_sigaction=''
983dbef6 683d_sigprocmask=''
b4eb6b3d 684d_sigsetjmp=''
5f106f9c 685usesitecustomize=''
4f5da3e9
SP
686d_snprintf=''
687d_vsnprintf=''
49a78c82 688d_sockatmark=''
2ef53570 689d_sockatmarkproto=''
b4eb6b3d
JH
690d_msg_ctrunc=''
691d_msg_dontroute=''
692d_msg_oob=''
693d_msg_peek=''
694d_msg_proxy=''
695d_oldsock=''
696d_scm_rights=''
697d_socket=''
698d_sockpair=''
699sockethdr=''
700socketlib=''
701d_socklen_t=''
702d_socks5_init=''
360321b3 703d_sprintf_returns_strlen=''
b4eb6b3d 704d_sqrtl=''
10bc17b6
JH
705d_srand48_r=''
706srand48_r_proto=''
707d_srandom_r=''
708srandom_r_proto=''
eef837ea 709d_sresgproto=''
640374d0 710d_sresuproto=''
b4eb6b3d
JH
711d_statblks=''
712d_statfs_f_flags=''
713d_statfs_s=''
714d_fstatvfs=''
715d_statvfs=''
716d_stdio_cnt_lval=''
717d_stdio_ptr_lval=''
a7ffa9b9
NC
718d_stdio_ptr_lval_nochange_cnt=''
719d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
720d_stdiobase=''
721d_stdstdio=''
722stdio_base=''
723stdio_bufsiz=''
724stdio_cnt=''
725stdio_filbuf=''
726stdio_ptr=''
727d_index=''
728d_strchr=''
729d_strcoll=''
730d_strctcpy=''
731d_strerrm=''
732d_strerror=''
733d_sysernlst=''
734d_syserrlst=''
10bc17b6
JH
735d_strerror_r=''
736strerror_r_proto=''
b3c85772 737d_strftime=''
08c92000
MB
738d_strlcat=''
739d_strlcpy=''
b4eb6b3d
JH
740d_strtod=''
741d_strtol=''
742d_strtold=''
743d_strtoll=''
28e5dec8 744d_strtoq=''
b4eb6b3d
JH
745d_strtoul=''
746d_strtoull=''
747d_strtouq=''
748d_strxfrm=''
749d_symlink=''
750d_syscall=''
2ef53570 751d_syscallproto=''
b4eb6b3d
JH
752d_sysconf=''
753d_system=''
754d_tcgetpgrp=''
755d_tcsetpgrp=''
756d_telldirproto=''
757d_time=''
758timetype=''
759clocktype=''
760d_times=''
10bc17b6
JH
761d_tmpnam_r=''
762tmpnam_r_proto=''
b4eb6b3d 763d_truncate=''
10bc17b6
JH
764d_ttyname_r=''
765ttyname_r_proto=''
b4eb6b3d 766d_tzname=''
4e0554ec
JH
767d_u32align=''
768d_ualarm=''
b4eb6b3d
JH
769d_umask=''
770d_semctl_semid_ds=''
771d_semctl_semun=''
772d_union_semun=''
758a5d79 773d_unordered=''
bdf33aa7 774d_unsetenv=''
4e0554ec 775d_usleep=''
2ef53570 776d_usleepproto=''
b4eb6b3d
JH
777d_ustat=''
778d_vfork=''
779usevfork=''
780d_voidsig=''
781signal_t=''
782d_volatile=''
783d_charvspr=''
784d_vprintf=''
785d_wait4=''
786d_waitpid=''
787d_wcstombs=''
788d_wctomb=''
4e0554ec 789d_writev=''
b4eb6b3d 790dlext=''
85e6fe83
LW
791cccdlflags=''
792ccdlflags=''
2304df62 793dlsrc=''
232e078e 794ld=''
85e6fe83 795lddlflags=''
2304df62 796usedl=''
b4eb6b3d
JH
797doublesize=''
798ebcdic=''
799fflushNULL=''
800fflushall=''
801fpossize=''
802fpostype=''
2d736872 803gccansipedantic=''
5b463ca7 804gccosandvers=''
8a27cf78 805gccversion=''
b4eb6b3d
JH
806gidformat=''
807gidsign=''
808gidsize=''
809gidtype=''
810groupstype=''
811h_fcntl=''
812h_sysfile=''
6e1038e0
MB
813html1dir=''
814html1direxp=''
815installhtml1dir=''
816html3dir=''
817html3direxp=''
818installhtml3dir=''
b4eb6b3d 819i_arpainet=''
10bc17b6 820i_crypt=''
b4eb6b3d
JH
821db_hashtype=''
822db_prefixtype=''
640374d0
JH
823db_version_major=''
824db_version_minor=''
825db_version_patch=''
b4eb6b3d
JH
826i_db=''
827i_dbm=''
828i_rpcsvcdbm=''
829d_dirnamlen=''
830direntrytype=''
831i_dirent=''
a0d0e21e 832i_dld=''
b4eb6b3d
JH
833i_dlfcn=''
834i_fcntl=''
835i_float=''
758a5d79
JH
836i_fp=''
837i_fp_class=''
b4eb6b3d
JH
838i_gdbm=''
839d_grpasswd=''
840i_grp=''
b4eb6b3d
JH
841i_ieeefp=''
842i_inttypes=''
2765b840 843i_langinfo=''
b4eb6b3d
JH
844i_libutil=''
845i_limits=''
846i_locale=''
847i_machcthr=''
848i_malloc=''
849i_math=''
850i_memory=''
851i_mntent=''
852i_ndbm=''
853i_netdb=''
854i_neterrno=''
855i_netinettcp=''
856i_niin=''
857i_sysin=''
858i_poll=''
859i_prot=''
860i_pthread=''
861d_pwage=''
862d_pwchange=''
863d_pwclass=''
864d_pwcomment=''
865d_pwexpire=''
866d_pwgecos=''
867d_pwpasswd=''
868d_pwquota=''
869i_pwd=''
870i_sfio=''
871i_shadow=''
872i_socks=''
873i_stddef=''
874i_stdlib=''
875i_string=''
876strings=''
877i_sunmath=''
878i_sysaccess=''
879i_sysdir=''
880i_sysfile=''
881d_voidtty=''
882i_bsdioctl=''
883i_sysfilio=''
884i_sysioctl=''
885i_syssockio=''
886i_syslog=''
887i_sysmman=''
888i_sysmode=''
889i_sysmount=''
890i_sysndir=''
891i_sysparam=''
892i_sysresrc=''
893i_syssecrt=''
894i_sysselct=''
895i_sysstat=''
896i_sysstatfs=''
897i_sysstatvfs=''
898i_systimes=''
899i_systypes=''
900i_sysuio=''
901i_sysun=''
902i_sysutsname=''
903i_sysvfs=''
904i_syswait=''
905i_sgtty=''
906i_termio=''
907i_termios=''
14b90194
JH
908d_tm_tm_gmtoff=''
909d_tm_tm_zone=''
b4eb6b3d
JH
910i_systime=''
911i_systimek=''
912i_time=''
913timeincl=''
914i_unistd=''
915i_ustat=''
916i_utime=''
917i_values=''
918i_stdarg=''
919i_varargs=''
920i_varhdr=''
921i_vfork=''
922inc_version_list=''
923inc_version_list_init=''
924installprefix=''
925installprefixexp=''
926installstyle=''
927installusrbinperl=''
928intsize=''
929longsize=''
930shortsize=''
4b661809 931issymlink=''
2304df62 932libc=''
b4eb6b3d
JH
933ldlibpthname=''
934libperl=''
935shrpenv=''
936useshrplib=''
a0d0e21e 937glibpth=''
2304df62 938libpth=''
8e07c86e 939loclibpth=''
2304df62
AD
940plibpth=''
941xlibpth=''
1cfa4ec7 942ignore_versioned_solibs=''
2304df62 943libs=''
43999f95
JH
944libsdirs=''
945libsfiles=''
946libsfound=''
13b3f787 947libspath=''
85e6fe83 948lns=''
b4eb6b3d
JH
949d_PRIEUldbl=''
950d_PRIFUldbl=''
951d_PRIGUldbl=''
952d_PRIeldbl=''
953d_PRIfldbl=''
954d_PRIgldbl=''
955d_SCNfldbl=''
956sPRIEUldbl=''
957sPRIFUldbl=''
958sPRIGUldbl=''
959sPRIeldbl=''
960sPRIfldbl=''
961sPRIgldbl=''
962sSCNfldbl=''
963lseeksize=''
964lseektype=''
8ff267be 965make_set_make=''
b4eb6b3d
JH
966d_mymalloc=''
967freetype=''
968mallocobj=''
969mallocsrc=''
970malloctype=''
9df442c2 971usemallocwrap=''
b4eb6b3d
JH
972usemymalloc=''
973installman1dir=''
974man1dir=''
975man1direxp=''
976man1ext=''
977installman3dir=''
978man3dir=''
979man3direxp=''
980man3ext=''
981modetype=''
982multiarch=''
983mydomain=''
984myhostname=''
985phostname=''
2304df62
AD
986c=''
987n=''
b4eb6b3d
JH
988d_eofnblk=''
989eagain=''
990o_nonblock=''
991rd_nodata=''
2cc61e15 992need_va_copy=''
b4eb6b3d
JH
993netdb_hlen_type=''
994netdb_host_type=''
995netdb_name_type=''
996netdb_net_type=''
997groupcat=''
998hostcat=''
999passcat=''
1000orderlib=''
1001ranlib=''
1002d_perl_otherlibdirs=''
1003otherlibdirs=''
2304df62
AD
1004package=''
1005spackage=''
b4eb6b3d
JH
1006pager=''
1007api_revision=''
1008api_subversion=''
1009api_version=''
1010api_versionstring=''
1011patchlevel=''
151e6568 1012perl_patchlevel=''
b4eb6b3d
JH
1013revision=''
1014subversion=''
1015version=''
861eb78d 1016version_patchlevel_string=''
b4eb6b3d
JH
1017perl5=''
1018perladmin=''
1019perlpath=''
1020d_nv_preserves_uv=''
f607920a 1021d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1022i16size=''
1023i16type=''
1024i32size=''
1025i32type=''
1026i64size=''
1027i64type=''
1028i8size=''
1029i8type=''
1030ivsize=''
1031ivtype=''
53133ed1 1032nv_preserves_uv_bits=''
b4eb6b3d
JH
1033nvsize=''
1034nvtype=''
1035u16size=''
1036u16type=''
1037u32size=''
1038u32type=''
1039u64size=''
1040u64type=''
1041u8size=''
1042u8type=''
1043uvsize=''
1044uvtype=''
1045ivdformat=''
1046nvEUformat=''
1047nvFUformat=''
1048nvGUformat=''
1049nveformat=''
1050nvfformat=''
1051nvgformat=''
1052uvXUformat=''
1053uvoformat=''
1054uvuformat=''
1055uvxformat=''
1056pidtype=''
1057prefix=''
1058prefixexp=''
1059installprivlib=''
1060privlib=''
1061privlibexp=''
1062prototype=''
1063ptrsize=''
1064d_PRIXU64=''
1065d_PRId64=''
1066d_PRIi64=''
1067d_PRIo64=''
1068d_PRIu64=''
1069d_PRIx64=''
1070sPRIXU64=''
1071sPRId64=''
1072sPRIi64=''
1073sPRIo64=''
1074sPRIu64=''
1075sPRIx64=''
1076d_quad=''
1077quadkind=''
1078quadtype=''
1079uquadtype=''
1080drand01=''
1081randbits=''
1082randfunc=''
1083randseedtype=''
1084seedfunc=''
1085installscript=''
1086scriptdir=''
1087scriptdirexp=''
1088selectminbits=''
1089selecttype=''
8ff267be 1090sh=''
b4eb6b3d
JH
1091sig_count=''
1092sig_name=''
1093sig_name_init=''
1094sig_num=''
1095sig_num_init=''
76d3c696 1096sig_size=''
b4eb6b3d
JH
1097installsitearch=''
1098sitearch=''
1099sitearchexp=''
1100installsitebin=''
1101sitebin=''
1102sitebinexp=''
8d2cbf27
JH
1103installsitehtml1dir=''
1104sitehtml1dir=''
1105sitehtml1direxp=''
1106installsitehtml3dir=''
1107sitehtml3dir=''
1108sitehtml3direxp=''
b4eb6b3d
JH
1109installsitelib=''
1110sitelib=''
1111sitelib_stem=''
1112sitelibexp=''
91e123a8
JH
1113installsiteman1dir=''
1114siteman1dir=''
1115siteman1direxp=''
1116installsiteman3dir=''
1117siteman3dir=''
1118siteman3direxp=''
b4eb6b3d
JH
1119siteprefix=''
1120siteprefixexp=''
6e1038e0
MB
1121installsitescript=''
1122sitescript=''
1123sitescriptexp=''
b4eb6b3d
JH
1124sizesize=''
1125sizetype=''
a0d0e21e 1126so=''
b4eb6b3d 1127socksizetype=''
2304df62
AD
1128sharpbang=''
1129shsharp=''
1130spitshell=''
dfe9444c 1131src=''
b4eb6b3d
JH
1132ssizetype=''
1133startperl=''
2304df62 1134startsh=''
b4eb6b3d
JH
1135stdchar=''
1136d_stdio_stream_array=''
1137stdio_stream_array=''
1138sysman=''
5ff3f7a4 1139trnl=''
b4eb6b3d
JH
1140uidformat=''
1141uidsign=''
1142uidsize=''
1143uidtype=''
1144archname64=''
1145use64bitall=''
1146use64bitint=''
15b61c98 1147usefaststdio=''
b4eb6b3d
JH
1148ccflags_uselargefiles=''
1149ldflags_uselargefiles=''
1150libswanted_uselargefiles=''
1151uselargefiles=''
1152uselongdouble=''
1153usemorebits=''
1154usemultiplicity=''
2304df62 1155nm_opt=''
40a7a20a 1156nm_so_opt=''
2304df62
AD
1157runnm=''
1158usenm=''
b4eb6b3d 1159useperlio=''
db0f2be4 1160userelocatableinc=''
29209bc5 1161usesocks=''
b4eb6b3d
JH
1162d_oldpthreads=''
1163use5005threads=''
1164useithreads=''
9514c62b 1165usereentrant=''
b4eb6b3d 1166usethreads=''
2304df62 1167incpath=''
2304df62
AD
1168mips_type=''
1169usrinc=''
b4eb6b3d
JH
1170d_vendorarch=''
1171installvendorarch=''
1172vendorarch=''
1173vendorarchexp=''
1174d_vendorbin=''
1175installvendorbin=''
1176vendorbin=''
1177vendorbinexp=''
8d2cbf27
JH
1178installvendorhtml1dir=''
1179vendorhtml1dir=''
1180vendorhtml1direxp=''
1181installvendorhtml3dir=''
1182vendorhtml3dir=''
1183vendorhtml3direxp=''
b4eb6b3d
JH
1184d_vendorlib=''
1185installvendorlib=''
1186vendorlib=''
1187vendorlib_stem=''
1188vendorlibexp=''
91e123a8
JH
1189installvendorman1dir=''
1190vendorman1dir=''
1191vendorman1direxp=''
1192installvendorman3dir=''
1193vendorman3dir=''
1194vendorman3direxp=''
b4eb6b3d
JH
1195usevendorprefix=''
1196vendorprefix=''
1197vendorprefixexp=''
6e1038e0
MB
1198d_vendorscript=''
1199installvendorscript=''
1200vendorscript=''
1201vendorscriptexp=''
d56c5707 1202versiononly=''
b4eb6b3d
JH
1203defvoidused=''
1204voidflags=''
3659ebf1
JH
1205yacc=''
1206yaccflags=''
2304df62
AD
1207CONFIG=''
1208
ecfc5424
AD
1209define='define'
1210undef='undef'
1211smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1212rmlist=''
1213
1214: We must find out about Eunice early
1215eunicefix=':'
1216if test -f /etc/unixtovms; then
1217 eunicefix=/etc/unixtovms
1218fi
1219if test -f /etc/unixtovms.exe; then
1220 eunicefix=/etc/unixtovms.exe
1221fi
1222
cfb04860 1223: Set executable suffix now -- needed before hints available
6153ba32
PG
1224if test -f "/libs/version.library"; then
1225: Amiga OS
1226 _exe=""
1227elif test -f "/system/gnu_library/bin/ar.pm"; then
1228: Stratus VOS
cfb04860 1229 _exe=".pm"
6153ba32
PG
1230elif test -n "$DJGPP"; then
1231: DOS DJGPP
cfb04860 1232 _exe=".exe"
5c728af0 1233elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1234: OS/2 or cygwin
ba863942
JH
1235 _exe=".exe"
1236fi
868439a2 1237
b4eb6b3d 1238i_whoami=''
9da7673b
MB
1239ccname=''
1240ccversion=''
1241perllibs=''
1242: set useposix=false in your hint file to disable the POSIX extension.
1243useposix=true
1244: set useopcode=false in your hint file to disable the Opcode extension.
1245useopcode=true
1246: Trailing extension. Override this in a hint file, if needed.
1247: Extra object files, if any, needed on this platform.
1248archobjs=''
1249archname=''
ff935051
JH
1250: Possible local include directories to search.
1251: Set locincpth to "" in a hint file to defeat local include searches.
1252locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1253locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1254:
1255: no include file wanted by default
1256inclwanted=''
1257
b4eb6b3d 1258groupstype=''
64615a5e 1259libnames=''
732c9516
JH
1260: change the next line if compiling for Xenix/286 on Xenix/386
1261xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1262: Possible local library directories to search.
1263loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1264loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1265
1266: general looking path for locating libraries
5869b1f1 1267glibpth="/lib /usr/lib $xlibpth"
732c9516 1268glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1269test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1270test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1271
1272: Private path used by Configure to find libraries. Its value
1273: is prepended to libpth. This variable takes care of special
1274: machines, like the mips. Usually, it should be empty.
1275plibpth=''
1276
1cfa4ec7
GS
1277: default library list
1278libswanted=''
921b2963 1279: some systems want to use only the non-versioned libso:s
1cfa4ec7 1280ignore_versioned_solibs=''
9da7673b
MB
1281siteman1dir=''
1282siteman3dir=''
1283sitescript=''
b4eb6b3d
JH
1284archname64=''
1285ccflags_uselargefiles=''
1286ldflags_uselargefiles=''
1287libswanted_uselargefiles=''
1288: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1289: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1290: set usethreads on the Configure command line to enable threads.
cd040c5e 1291usereentrant='undef'
9da7673b
MB
1292: full support for void wanted by default
1293defvoidused=15
1294
ecfc5424 1295: List of libraries we want.
15431986 1296: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1297libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1298libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1299: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1300: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1301glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1302glibpth="/usr/shlib $glibpth"
1303: Do not use vfork unless overridden by a hint file.
1304usevfork=false
1305
8ff267be 1306: Find the basic shell for Bourne shell scripts
1307case "$sh" in
1308'')
8ff267be 1309 case "$SYSTYPE" in
1310 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1311 *) xxx='/bin/sh';;
1312 esac
1313 if test -f "$xxx"; then
1314 sh="$xxx"
1315 else
1316 : Build up a list and do a single loop so we can 'break' out.
1317 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1318 for xxx in sh bash ksh pdksh ash; do
1319 for p in $pth; do
1320 try="$try ${p}/${xxx}"
1321 done
1322 done
1323 for xxx in $try; do
1324 if test -f "$xxx"; then
1325 sh="$xxx";
8ff267be 1326 break
a5a94ea5
JH
1327 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1328 sh="$xxx";
1329 break
8ff267be 1330 elif test -f "$xxx.exe"; then
1331 sh="$xxx";
8ff267be 1332 break
1333 fi
1334 done
1335 fi
1336 ;;
1337esac
1338
1339case "$sh" in
a33c94aa 1340'') cat >&2 <<EOM
8ff267be 1341$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1342
8ff267be 1343Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1344Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1345we'll try to straighten this all out.
8ff267be 1346EOM
1347 exit 1
1348 ;;
1349esac
1350
760ac839 1351: see if sh knows # comments
73614538 1352if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1353 shsharp=true
1354 spitshell=cat
760ac839 1355 xcat=/bin/cat
a931254c
JH
1356 test -f $xcat$_exe || xcat=/usr/bin/cat
1357 if test ! -f $xcat$_exe; then
4bdb8fb5 1358 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1359 if test -f $p/cat$_exe; then
1deb0a86 1360 xcat=$p/cat
3c728e00
JH
1361 break
1362 fi
1363 done
1deb0a86
JH
1364 if test ! -f $xcat$_exe; then
1365 echo "Can't find cat anywhere!"
3c728e00
JH
1366 exit 1
1367 fi
1368 fi
5440bc8e
JH
1369 echo "#!$xcat" >sharp
1370 $eunicefix sharp
1371 chmod +x sharp
1372 ./sharp > today
760ac839 1373 if test -s today; then
760ac839
LW
1374 sharpbang='#!'
1375 else
5440bc8e
JH
1376 echo "#! $xcat" > sharp
1377 $eunicefix sharp
1378 chmod +x sharp
1379 ./sharp > today
760ac839 1380 if test -s today; then
760ac839
LW
1381 sharpbang='#! '
1382 else
760ac839
LW
1383 sharpbang=': use '
1384 fi
1385 fi
1386else
dfe9444c 1387 echo " "
8ff267be 1388 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1389 shsharp=false
1390 cd ..
1391 echo "exec grep -v '^[ ]*#'" >spitshell
1392 chmod +x spitshell
1393 $eunicefix spitshell
1394 spitshell=`pwd`/spitshell
1395 cd UU
1396 echo "I presume that if # doesn't work, #! won't work either!"
1397 sharpbang=': use '
1398fi
5440bc8e 1399rm -f sharp today
760ac839
LW
1400
1401: figure out how to guarantee sh startup
8ff267be 1402case "$startsh" in
1403'') startsh=${sharpbang}${sh} ;;
1404*)
760ac839 1405esac
5440bc8e 1406cat >sharp <<EOSS
760ac839
LW
1407$startsh
1408set abc
1409test "$?abc" != 1
1410EOSS
1411
5440bc8e
JH
1412chmod +x sharp
1413$eunicefix sharp
1414if ./sharp; then
8ff267be 1415 : echo "Yup, it does."
760ac839 1416else
dfe9444c
AD
1417 echo "Hmm... '$startsh' does not guarantee sh startup..."
1418 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1419fi
5440bc8e 1420rm -f sharp
760ac839 1421
aebf16e7
AD
1422
1423: Save command line options in file UU/cmdline.opt for later use in
1424: generating config.sh.
1425cat > cmdline.opt <<EOSH
1426# Configure command line arguments.
1427config_arg0='$0'
1428config_args='$*'
1429config_argc=$#
1430EOSH
1431argn=1
ee45ea83
IZ
1432args_exp=''
1433args_sep=''
aebf16e7
AD
1434for arg in "$@"; do
1435 cat >>cmdline.opt <<EOSH
1436config_arg$argn='$arg'
1437EOSH
ee45ea83
IZ
1438 # Extreme backslashitis: replace each ' by '"'"'
1439 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1440$arg
1441EOC
1442 arg_exp=`cat cmdl.opt`
1443 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1444 argn=`expr $argn + 1`
ee45ea83 1445 args_sep=' '
aebf16e7 1446done
ee45ea83
IZ
1447# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1448# used by ./hints/os2.sh
1449rm -f cmdl.opt
aebf16e7 1450
2304df62
AD
1451: produce awk script to parse command line options
1452cat >options.awk <<'EOF'
1453BEGIN {
02e93a22 1454 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1455
1456 len = length(optstr);
1457 for (i = 1; i <= len; i++) {
1458 c = substr(optstr, i, 1);
1459 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1460 if (a == ":") {
1461 arg[c] = 1;
1462 i++;
1463 }
1464 opt[c] = 1;
1465 }
1466}
1467{
1468 expect = 0;
1469 str = $0;
1470 if (substr(str, 1, 1) != "-") {
1471 printf("'%s'\n", str);
1472 next;
1473 }
1474 len = length($0);
1475 for (i = 2; i <= len; i++) {
1476 c = substr(str, i, 1);
1477 if (!opt[c]) {
1478 printf("-%s\n", substr(str, i));
1479 next;
1480 }
1481 printf("-%s\n", c);
1482 if (arg[c]) {
1483 if (i < len)
1484 printf("'%s'\n", substr(str, i + 1));
1485 else
1486 expect = 1;
1487 next;
1488 }
1489 }
1490}
1491END {
1492 if (expect)
1493 print "?";
1494}
1495EOF
1496
1497: process the command line options
4633a7c4
LW
1498set X `for arg in "$@"; do echo "X$arg"; done |
1499 sed -e s/X// | awk -f options.awk`
2304df62
AD
1500eval "set $*"
1501shift
1502rm -f options.awk
1503
1504: set up default values
1505fastread=''
1506reuseval=false
1507config_sh=''
1508alldone=''
1509error=''
1510silent=''
1511extractsh=''
ecfc5424 1512override=''
16d20bd9 1513knowitall=''
02e93a22 1514rm -f optdef.sh posthint.sh
28757baa 1515cat >optdef.sh <<EOS
1516$startsh
1517EOS
2304df62 1518
dfe9444c 1519
2304df62
AD
1520: option parsing
1521while test $# -gt 0; do
1522 case "$1" in
1523 -d) shift; fastread=yes;;
1524 -e) shift; alldone=cont;;
1525 -f)
1526 shift
1527 cd ..
1528 if test -r "$1"; then
1529 config_sh="$1"
1530 else
a0d0e21e 1531 echo "$me: cannot read config file $1." >&2
2304df62
AD
1532 error=true
1533 fi
1534 cd UU
1535 shift;;
1536 -h) shift; error=true;;
1537 -r) shift; reuseval=true;;
dfe9444c 1538 -s) shift; silent=true; realsilent=true;;
2304df62 1539 -E) shift; alldone=exit;;
16d20bd9 1540 -K) shift; knowitall=true;;
ecfc5424 1541 -O) shift; override=true;;
dfe9444c 1542 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1543 -D)
1544 shift
1545 case "$1" in
1546 *=)
1547 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1548 echo "$me: ignoring -D $1" >&2
1549 ;;
ecfc5424 1550 *=*) echo "$1" | \
1aef975c
AD
1551 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1552 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1553 esac
1554 shift
1555 ;;
1556 -U)
1557 shift
1558 case "$1" in
1aef975c 1559 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1560 *=*)
1561 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1562 echo "$me: ignoring -U $1" >&2
1563 ;;
1aef975c 1564 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1565 esac
1566 shift
1567 ;;
02e93a22
JH
1568 -A)
1569 shift
1570 xxx=''
1571 yyy="$1"
02e93a22 1572 zzz=''
5f83a3e9 1573 uuu=undef
02e93a22 1574 case "$yyy" in
f7c31117 1575 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1576 case "$zzz" in
1577 *:*) zzz='' ;;
1578 *) xxx=append
f7c31117
JH
1579 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1580 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1581 esac
1582 ;;
1583 esac
1584 case "$xxx" in
1585 '') case "$yyy" in
f7c31117
JH
1586 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1587 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1588 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1589 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1590 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1591 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1592 esac
1593 ;;
1594 esac
02e93a22
JH
1595 case "$xxx" in
1596 append)
5f83a3e9 1597 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1598 clear)
5f83a3e9 1599 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1600 define)
1601 case "$zzz" in
1602 '') zzz=define ;;
1603 esac
5f83a3e9 1604 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1605 eval)
5f83a3e9 1606 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1607 prepend)
5f83a3e9 1608 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1609 undef)
1610 case "$zzz" in
1611 '') zzz="$uuu" ;;
1612 esac
5f83a3e9
JH
1613 echo "$yyy=$zzz" >> posthint.sh ;;
1614 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1615 esac
bde6b06b 1616 shift
02e93a22 1617 ;;
dfe9444c 1618 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1619 exit 0;;
2304df62 1620 --) break;;
a0d0e21e 1621 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1622 *) break;;
1623 esac
1624done
1625
1626case "$error" in
1627true)
1628 cat >&2 <<EOM
2afac517 1629Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1630 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1631 -d : use defaults for all answers.
1632 -e : go on without questioning past the production of config.sh.
1633 -f : specify an alternate default configuration file.
1634 -h : print this help message and exit (with an error status).
1635 -r : reuse C symbols value if possible (skips costly nm extraction).
1636 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1637 -D : define symbol to have some value:
1638 -D symbol symbol gets the value 'define'
1639 -D symbol=value symbol gets the value 'value'
2304df62 1640 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1641 -K : do not use unless you know what you are doing.
ecfc5424 1642 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1643 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1644 -U : undefine symbol:
1645 -U symbol symbol gets the value 'undef'
1646 -U symbol= symbol gets completely empty
02e93a22 1647 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1648 -A symbol=value append " "value to symbol
02e93a22
JH
1649 -A append:symbol=value append value to symbol
1650 -A define:symbol=value define symbol to have value
02e93a22
JH
1651 -A clear:symbol define symbol to be ''
1652 -A define:symbol define symbol to be 'define'
1653 -A eval:symbol=value define symbol to be eval of value
1654 -A prepend:symbol=value prepend value to symbol
1655 -A undef:symbol define symbol to be 'undef'
1656 -A undef:symbol= define symbol to be ''
2304df62
AD
1657 -V : print version number and exit (with a zero status).
1658EOM
1659 exit 1
1660 ;;
1661esac
1662
dfe9444c
AD
1663: Sanity checks
1664case "$fastread$alldone" in
1665yescont|yesexit) ;;
1666*)
aaeb8e51
GS
1667 case "$extractsh" in
1668 true) ;;
1669 *)
1670 if test ! -t 0; then
1671 echo "Say 'sh Configure', not 'sh <Configure'"
1672 exit 1
1673 fi
1674 ;;
1675 esac
dfe9444c
AD
1676 ;;
1677esac
1678
2304df62
AD
1679exec 4>&1
1680case "$silent" in
1681true) exec 1>/dev/null;;
1682esac
1683
ecfc5424 1684: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1685touch optdef.sh
1686. ./optdef.sh
02e93a22
JH
1687: create the posthint manipulation script and leave the file out there...
1688touch posthint.sh
a0d0e21e 1689
2304df62 1690: set package name
85e6fe83 1691package=perl5
b4eb6b3d
JH
1692first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1693last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1694case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1695ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1696*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1697esac
2304df62 1698
2304df62
AD
1699: Some greps do not return status, grrr.
1700echo "grimblepritz" >grimble
1701if grep blurfldyick grimble >/dev/null 2>&1 ; then
1702 contains=contains
1703elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1704 contains=grep
1705else
1706 contains=contains
1707fi
1708rm -f grimble
1709: the following should work in any shell
1710case "$contains" in
1711contains*)
1712 echo " "
1713 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1714 cat >contains <<'EOSS'
1715grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1716EOSS
1717chmod +x contains
1718esac
1719
dfe9444c
AD
1720: Find the path to the source tree
1721case "$src" in
1722'') case "$0" in
b233458b
JH
1723 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1724 case "$src" in
1725 /*) ;;
8504afb7 1726 .) ;;
b233458b
JH
1727 *) src=`cd ../$src && pwd` ;;
1728 esac
1729 ;;
dfe9444c
AD
1730 *) src='.';;
1731 esac;;
1732esac
1733case "$src" in
1734'') src=/
1735 rsrc=/
1736 ;;
1737/*) rsrc="$src";;
1738*) rsrc="../$src";;
1739esac
1740if test -f $rsrc/Configure && \
1741 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1742then
1743 : found it, so we are ok.
1744else
1745 rsrc=''
1746 for src in . .. ../.. ../../.. ../../../..; do
1747 if test -f ../$src/Configure && \
1748 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1749 then
1750 rsrc=../$src
1751 break
1752 fi
1753 done
1754fi
1755case "$rsrc" in
1756'')
1757 cat <<EOM >&4
1758
1759Sorry, I can't seem to locate the source dir for $package. Please start
1760Configure with an explicit path -- i.e. /some/path/Configure.
1761
1762EOM
1763 exit 1
1764 ;;
1765../.) rsrc='..';;
1766*)
1767 echo " "
1768 echo "Sources for $package found in \"$src\"." >&4
1769 ;;
1770esac
1771
1772: script used to extract .SH files with variable substitutions
1773cat >extract <<'EOS'
a02608de 1774PERL_CONFIG_SH=true
dfe9444c 1775echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1776if test -f MANIFEST; then
1777 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1778else
1779 echo "(Looking for .SH files under the source directory.)"
6904989c 1780 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1781fi
1782shift
1783case $# in
6904989c 17840) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1785esac
6904989c 1786if test ! -f "$src/$1"; then
dfe9444c
AD
1787 shift
1788fi
1789mkdir_p='
1790name=$1;
1791create="";
1792while test $name; do
1793 if test ! -d "$name"; then
1794 create="$name $create";
1795 name=`echo $name | sed -e "s|^[^/]*$||"`;
1796 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1797 else
1798 name="";
1799 fi;
1800done;
1801for file in $create; do
1802 mkdir $file;
1803done
1804'
1805for file in $*; do
1806 case "$src" in
1807 ".")
1808 case "$file" in
1809 */*)
1810 dir=`expr X$file : 'X\(.*\)/'`
1811 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1812 (cd "$dir" && . ./$file)
dfe9444c
AD
1813 ;;
1814 *)
1815 . ./$file
1816 ;;
1817 esac
1818 ;;
1819 *)
1820 case "$file" in
1821 */*)
1822 dir=`expr X$file : 'X\(.*\)/'`
1823 file=`expr X$file : 'X.*/\(.*\)'`
1824 (set x $dir; shift; eval $mkdir_p)
6904989c 1825 sh <"$src/$dir/$file"
dfe9444c
AD
1826 ;;
1827 *)
6904989c 1828 sh <"$src/$file"
dfe9444c
AD
1829 ;;
1830 esac
1831 ;;
1832 esac
1833done
6904989c 1834if test -f "$src/config_h.SH"; then
dfe9444c
AD
1835 if test ! -f config.h; then
1836 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1837 . "$src/config_h.SH"
dfe9444c
AD
1838 fi
1839fi
1840EOS
1841
1842: extract files and exit if asked to do so
1843case "$extractsh" in
1844true)
1845 case "$realsilent" in
1846 true) ;;
1847 *) exec 1>&4;;
1848 esac
1849 case "$config_sh" in
1850 '') config_sh='config.sh';;
1851 esac
1852 echo " "
1853 echo "Fetching answers from $config_sh..."
1854 cd ..
1855 . $config_sh
1856 test "$override" && . ./optdef.sh
1857 echo " "
1858 . UU/extract
1859 rm -rf UU
24ccb310 1860 echo "Extraction done."
dfe9444c
AD
1861 exit 0
1862 ;;
1863esac
1864
1865: Eunice requires " " instead of "", can you believe it
1866echo " "
1867: Here we go...
1868echo "Beginning of configuration questions for $package."
1869
1870trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1871
2304df62
AD
1872: first determine how to suppress newline on echo command
1873echo " "
1874echo "Checking echo to see how to suppress newlines..."
1875(echo "hi there\c" ; echo " ") >.echotmp
1876if $contains c .echotmp >/dev/null 2>&1 ; then
1877 echo "...using -n."
1878 n='-n'
1879 c=''
1880else
1881 cat <<'EOM'
1882...using \c
1883EOM
1884 n=''
1885 c='\c'
1886fi
1887echo $n "The star should be here-->$c"
1888echo '*'
1889rm -f .echotmp
1890
1891: Now test for existence of everything in MANIFEST
1892echo " "
6904989c 1893if test -f "$rsrc/MANIFEST"; then
2304df62 1894 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1895 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1896 rm -f missing
dfe9444c 1897 tmppwd=`pwd`
2304df62 1898 for filelist in x??; do
6904989c 1899 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1900 done
1901 if test -s missing; then
1902 cat missing >&4
1903 cat >&4 <<'EOM'
1904
1905THIS PACKAGE SEEMS TO BE INCOMPLETE.
1906
1907You have the option of continuing the configuration process, despite the
1908distinct possibility that your kit is damaged, by typing 'y'es. If you
1909do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1910and contact the author (perlbug@perl.org).
2304df62
AD
1911
1912EOM
1913 echo $n "Continue? [n] $c" >&4
1914 read ans
1915 case "$ans" in
1916 y*)
1917 echo "Continuing..." >&4
1918 rm -f missing
1919 ;;
1920 *)
1921 echo "ABORTING..." >&4
1922 kill $$
1923 ;;
1924 esac
1925 else
dfe9444c 1926 echo "Looks good..."
2304df62
AD
1927 fi
1928else
1929 echo "There is no MANIFEST file. I hope your kit is complete !"
1930fi
1931rm -f missing x??
1932
5ff3f7a4
GS
1933echo " "
1934: Find the appropriate value for a newline for tr
1935if test -n "$DJGPP"; then
1936 trnl='\012'
1937fi
1938if test X"$trnl" = X; then
1939 case "`echo foo|tr '\n' x 2>/dev/null`" in
1940 foox) trnl='\n' ;;
1941 esac
1942fi
1943if test X"$trnl" = X; then
1944 case "`echo foo|tr '\012' x 2>/dev/null`" in
1945 foox) trnl='\012' ;;
1946 esac
1947fi
1948if test X"$trnl" = X; then
8be2c24c
JH
1949 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1950 fooxy) trnl='\n\r' ;;
1951 esac
1952fi
1953if test X"$trnl" = X; then
5ff3f7a4
GS
1954 cat <<EOM >&2
1955
1956$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1957
1958EOM
1959 exit 1
1960fi
1961
2304df62
AD
1962: compute the number of columns on the terminal for proper question formatting
1963case "$COLUMNS" in
1964'') COLUMNS='80';;
1965esac
1966
1967: set up the echo used in my read
1968myecho="case \"\$xxxm\" in
1969'') echo $n \"\$rp $c\" >&4;;
1970*) case \"\$rp\" in
1971 '') echo $n \"[\$xxxm] $c\";;
1972 *)
1973 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1974 echo \"\$rp\" >&4
1975 echo $n \"[\$xxxm] $c\" >&4
1976 else
1977 echo $n \"\$rp [\$xxxm] $c\" >&4
1978 fi
1979 ;;
1980 esac;;
1981esac"
1982
1983: now set up to do reads with possible shell escape and default assignment
1984cat <<EOSC >myread
28757baa 1985$startsh
2304df62
AD
1986xxxm=\$dflt
1987$myecho
1988ans='!'
1989case "\$fastread" in
1990yes) case "\$dflt" in
1991 '') ;;
1992 *) ans='';
1993 case "\$silent-\$rp" in
1994 true-) ;;
1995 *) echo " " >&4;;
1996 esac;;
1997 esac;;
1998*) case "\$silent" in
1999 true) case "\$rp" in
2000 '') ans='';;
2001 esac;;
2002 esac;;
2003esac
2004while expr "X\$ans" : "X!" >/dev/null; do
2005 read answ
2006 set x \$xxxm
2007 shift
dfe9444c 2008 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2009 case "\$answ" in
dfe9444c
AD
2010 "!")
2011 sh 1>&4
2012 echo " "
2013 $myecho
2014 ;;
2015 !*)
2016 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2017 shift
2018 sh 1>&4 -c "\$*"
2019 echo " "
2020 $myecho
2021 ;;
2304df62
AD
2022 "\$ans")
2023 case "\$ans" in
ecfc5424
AD
2024 \\&*)
2025 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2026 shift
2027 case "\$1" in
2028 -d)
2029 fastread=yes
40a7a20a 2030 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2031 ;;
2032 -*)
40a7a20a 2033 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2034 ;;
2035 esac
2036 $myecho
2037 ans=!
2038 ;;
2304df62
AD
2039 esac;;
2040 *)
2041 case "\$aok" in
2042 y)
2043 echo "*** Substitution done -- please confirm."
2044 xxxm="\$ans"
c9795ab7 2045 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2046 xxxm="\$ans"
2047 ans=!
2048 ;;
2049 *)
2050 echo "*** Error -- try again."
2051 ans=!
2052 ;;
2053 esac
2054 $myecho
2055 ;;
2056 esac
2057 case "\$ans\$xxxm\$nostick" in
2058 '')
2059 ans=!
2060 $myecho
2061 ;;
2062 esac
2063done
2064case "\$ans" in
2065'') ans="\$xxxm";;
2066esac
2067EOSC
2068
2069: create .config dir to save info across Configure sessions
2070test -d ../.config || mkdir ../.config
2071cat >../.config/README <<EOF
2072This directory created by Configure to save information that should
dfe9444c 2073persist across sessions for $package.
2304df62
AD
2074
2075You may safely delete it if you wish.
2076EOF
2077
9507cadf 2078xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2079case "$usedevel" in
0107c034 2080$define|true|[yY]*) ;;
9507cadf 2081*) case "$xversion" in
0107c034
JH
2082 *[13579])
2083 cat >&4 <<EOH
2084*** WHOA THERE!!! ***
2085
2086 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2087 The version of this $package distribution is $xversion, that is, odd,
2088 (as opposed to even) and that signifies a development release.
3d5d58b1 2089 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2090
2091 Do ***NOT*** install this into production use.
2092 Data corruption and crashes are possible.
2093
2094 It is most seriously suggested that you do not continue any further
2095 unless you want to help in developing and debugging Perl.
2096
6adc6a45
JH
2097 If you *still* want to build perl, you can answer 'y' now,
2098 or pass -Dusedevel to Configure.
2099
0107c034
JH
2100EOH
2101 rp='Do you really want to continue?'
2102 dflt='n'
2103 . ./myread
2104 case "$ans" in
8feeef0e
JH
2105 [yY]) echo >&4 "Okay, continuing."
2106 usedevel="$define" ;;
0107c034
JH
2107 *) echo >&4 "Okay, bye."
2108 exit 1
2109 ;;
2110 esac
2111 ;;
2112 esac
2113 ;;
2114esac
8feeef0e
JH
2115case "$usedevel" in
2116$define|true|[yY]*)
2117 case "$versiononly" in
2118 '') versiononly="$define" ;;
2119 esac
2120 case "$installusrbinperl" in
2121 '') installusrbinperl="$undef" ;;
2122 esac
2123 ;;
2124esac
0107c034 2125
2304df62
AD
2126: general instructions
2127needman=true
2128firsttime=true
760ac839 2129user=`(logname) 2>/dev/null`
dfe9444c
AD
2130case "$user" in
2131'') user=`whoami 2>&1`;;
760ac839 2132esac
2304df62
AD
2133if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2134 firsttime=false
2135 echo " "
2136 rp='Would you like to see the instructions?'
2137 dflt=n
2138 . ./myread
2139 case "$ans" in
2140 [yY]*) ;;
2141 *) needman=false;;
2142 esac
2143fi
2144if $needman; then
2145 cat <<EOH
4e2a5f63 2146
2304df62 2147This installation shell script will examine your system and ask you questions
a0d0e21e 2148to determine how the perl5 package should be installed. If you get
2304df62
AD
2149stuck on a question, you may use a ! shell escape to start a subshell or
2150execute a command. Many of the questions will have default answers in square
2151brackets; typing carriage return will give you the default.
2152
2153On some of the questions which ask for file or directory names you are allowed
2154to use the ~name construct to specify the login directory belonging to "name",
2155even if you don't have a shell which knows about that. Questions where this is
2156allowed will be marked "(~name ok)".
2157
2158EOH
2159 rp=''
2160 dflt='Type carriage return to continue'
2161 . ./myread
2162 cat <<'EOH'
2163
2164The prompter used in this script allows you to use shell variables and
2165backticks in your answers. You may use $1, $2, etc... to refer to the words
2166in the default answer, as if the default line was a set of arguments given to a
2167script shell. This means you may also use $* to repeat the whole default line,
2168so you do not have to re-type everything to add something to the default.
2169
2170Everytime there is a substitution, you will have to confirm. If there is an
2171error (e.g. an unmatched backtick), the default answer will remain unchanged
2172and you will be prompted again.
2173
2174If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2175the questions and use the computed defaults (or the previous answers if there
2176was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2177You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2178on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2179
2180EOH
2181 . ./myread
2182 cat <<EOH
2183
2184Much effort has been expended to ensure that this shell script will run on any
2185Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2186Configure and run it again. If you can't run Configure for some reason,
2187you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2188have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2189
2190This installation script affects things in two ways:
2191
21921) it may do direct variable substitutions on some of the files included
2193 in this kit.
21942) it builds a config.h file for inclusion in C programs. You may edit
2195 any of these files as the need arises after running this script.
2196
2197If you make a mistake on a question, there is no easy way to back up to it
2198currently. The easiest thing to do is to edit config.sh and rerun all the SH
2199files. Configure will offer to let you do this before it runs the SH files.
2200
2201EOH
2202 dflt='Type carriage return to continue'
2203 . ./myread
2204 case "$firsttime" in
2205 true) echo $user >>../.config/instruct;;
2206 esac
2207fi
2208
2304df62
AD
2209: find out where common programs are
2210echo " "
2211echo "Locating common programs..." >&4
2212cat <<EOSC >loc
2213$startsh
2214case \$# in
22150) exit 1;;
2216esac
2217thing=\$1
2218shift
2219dflt=\$1
2220shift
2221for dir in \$*; do
2222 case "\$thing" in
2223 .)
2224 if test -d \$dir/\$thing; then
2225 echo \$dir
2226 exit 0
2227 fi
2228 ;;
2229 *)
a0d0e21e 2230 for thisthing in \$dir/\$thing; do
ecfc5424 2231 : just loop through to pick last item
a0d0e21e 2232 done
25f94b33 2233 if test -f \$thisthing; then
a0d0e21e 2234 echo \$thisthing
2304df62 2235 exit 0
a5a94ea5
JH
2236 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2237 echo \$thisthing
2238 exit 0
2304df62 2239 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2240 if test -n "$DJGPP"; then
2241 echo \$dir/\$thing.exe
b921d661 2242 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2243 : on Eunice apparently
2244 echo \$dir/\$thing
b921d661 2245 exit 0
c4f23d77 2246 fi
2d736872 2247 exit 0
2304df62
AD
2248 fi
2249 ;;
2250 esac
2251done
2252echo \$dflt
2253exit 1
2254EOSC
2255chmod +x loc
2256$eunicefix loc
2257loclist="
2258awk
2259cat
f8006fac 2260chmod
b4eb6b3d
JH
2261comm
2262cp
2304df62
AD
2263echo
2264expr
2265grep
a0d0e21e 2266ls
b4eb6b3d 2267mkdir
2304df62
AD
2268rm
2269sed
b4eb6b3d 2270sort
85e6fe83 2271touch
2304df62 2272tr
b4eb6b3d 2273uniq
2304df62
AD
2274"
2275trylist="
2276Mcc
dfe9444c 2277ar
3659ebf1 2278bison
b4eb6b3d 2279byacc
2304df62 2280cpp
b4eb6b3d 2281csh
2304df62
AD
2282date
2283egrep
1fef16b3 2284gmake
8ff267be 2285gzip
b4eb6b3d 2286less
8ff267be 2287ln
3c728e00 2288make
b4eb6b3d 2289more
693762b4 2290nm
b4eb6b3d
JH
2291nroff
2292pg
2304df62
AD
2293test
2294uname
8ff267be 2295zip
2304df62 2296"
8e07c86e 2297pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2298pth="$pth /lib /usr/lib"
2299for file in $loclist; do
dfe9444c
AD
2300 eval xxx=\$$file
2301 case "$xxx" in
2302 /*|?:[\\/]*)
2303 if test -f "$xxx"; then
2304 : ok
2305 else
2306 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2307 xxx=`./loc $file $file $pth`
2308 fi
2309 ;;
2310 '') xxx=`./loc $file $file $pth`;;
2311 *) xxx=`./loc $xxx $xxx $pth`;;
2312 esac
a5a94ea5 2313 eval $file=$xxx$_exe
2304df62
AD
2314 eval _$file=$xxx
2315 case "$xxx" in
2316 /*)
2317 echo $file is in $xxx.
2318 ;;
8e07c86e
AD
2319 ?:[\\/]*)
2320 echo $file is in $xxx.
2321 ;;
2304df62 2322 *)
25f94b33
AD
2323 echo "I don't know where '$file' is, and my life depends on it." >&4
2324 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2325 exit 1
2304df62
AD
2326 ;;
2327 esac
2328done
2329echo " "
2330echo "Don't worry if any of the following aren't found..."
2331say=offhand
2332for file in $trylist; do
dfe9444c
AD
2333 eval xxx=\$$file
2334 case "$xxx" in
2335 /*|?:[\\/]*)
2336 if test -f "$xxx"; then
2337 : ok
2338 else
2339 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2340 xxx=`./loc $file $file $pth`
2341 fi
2342 ;;
2343 '') xxx=`./loc $file $file $pth`;;
2344 *) xxx=`./loc $xxx $xxx $pth`;;
2345 esac
306a8474 2346 eval $file=$xxx$_exe
2304df62
AD
2347 eval _$file=$xxx
2348 case "$xxx" in
2349 /*)
2350 echo $file is in $xxx.
2351 ;;
8e07c86e
AD
2352 ?:[\\/]*)
2353 echo $file is in $xxx.
2354 ;;
2304df62
AD
2355 *)
2356 echo "I don't see $file out there, $say."
2357 say=either
2358 ;;
2359 esac
2360done
2361case "$egrep" in
1fef16b3 2362egrep)
2304df62
AD
2363 echo "Substituting grep for egrep."
2364 egrep=$grep
868439a2 2365 _egrep=$grep
2304df62
AD
2366 ;;
2367esac
8ff267be 2368case "$ln" in
1fef16b3 2369ln)
8ff267be 2370 echo "Substituting cp for ln."
2371 ln=$cp
868439a2 2372 _ln=$cp
8ff267be 2373 ;;
2374esac
2e26f1d5
JH
2375case "$make" in
2376make)
2377 case "$gmake" in
2378 gmake)
2379 echo "I can't find make or gmake, and my life depends on it." >&4
2380 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2381 exit 1
2382 ;;
2383 esac
2384 ;;
2385esac
2386case "$gmake" in
2387gmake) ;;
2388*) # We can't have osname yet.
1fef16b3
JH
2389 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2390 # Assume that gmake, if found, is definitely GNU make
2391 # and prefer it over the system make.
2392 echo "Substituting gmake for make."
2393 make=$gmake
868439a2 2394 _make=$gmake
1fef16b3
JH
2395 fi
2396 ;;
a5a94ea5 2397esac
2304df62
AD
2398case "$test" in
2399test)
2400 echo "Hopefully test is built into your sh."
2401 ;;
2402*)
73614538 2403 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2404 echo "Using the test built into your sh."
2304df62
AD
2405 test=test
2406 _test=test
2407 fi
2408 ;;
2409esac
2410case "$echo" in
2411echo)
2412 echo "Hopefully echo is built into your sh."
2413 ;;
2414'') ;;
2415*)
2416 echo " "
2417echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2418 $echo $n "hi there$c" >foo1
2419 echo $n "hi there$c" >foo2
2420 if cmp foo1 foo2 >/dev/null 2>&1; then
2421 echo "They are compatible. In fact, they may be identical."
2422 else
2423 case "$n" in
2424 '-n') n='' c='\c';;
2425 *) n='-n' c='';;
2426 esac
2427 cat <<FOO
2428They are not compatible! You are probably running ksh on a non-USG system.
2429I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2430have echo built in and we may have to run some Bourne shell scripts. That
2431means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2432
2433FOO
2434 $echo $n "The star should be here-->$c"
2435 $echo "*"
2436 fi
2437 $rm -f foo1 foo2
2438 ;;
2439esac
2440
6b769f8f 2441cat <<EOS >trygcc
2573c5f9
JH
2442$startsh
2443EOS
6b769f8f 2444cat <<'EOSC' >>trygcc
2573c5f9
JH
2445case "$cc" in
2446'') ;;
2447*) $rm -f try try.*
2448 $cat >try.c <<EOM
2449int main(int argc, char *argv[]) {
2450 return 0;
2451}
2452EOM
e4778687 2453 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2454 :
2455 else
2456 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2457 despair=yes
2458 trygcc=yes
2459 case "$cc" in
2460 *gcc*) trygcc=no ;;
2461 esac
2462 case "`$cc -v -c try.c 2>&1`" in
2463 *gcc*) trygcc=no ;;
2464 esac
2465 if $test X"$trygcc" = Xyes; then
2466 if gcc -o try -c try.c; then
2467 echo " "
2468 echo "You seem to have a working gcc, though." >&4
2469 rp="Would you like to use it?"
2470 dflt=y
2471 if $test -f myread; then
2472 . ./myread
2473 else
2474 if $test -f UU/myread; then
2475 . ./UU/myread
2476 else
2477 echo "Cannot find myread, sorry. Aborting." >&2
2478 exit 1
2479 fi
2480 fi
2481 case "$ans" in
6371411c
RB
2482 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2483 if $test -f usethreads.cbu; then
2484 $cat >&4 <<EOM
2485
2486*** However, any setting of the C compiler flags (e.g. for thread support)
2487*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2488*** (together with e.g. -Dusethreads).
2489
2490EOM
2491 fi;;
2573c5f9
JH
2492 esac
2493 fi
2494 fi
6b769f8f
RB
2495 fi
2496 $rm -f try try.*
2497 ;;
2498esac
2499EOSC
2500
2501cat <<EOS >checkcc
2502$startsh
2503EOS
2504cat <<'EOSC' >>checkcc
2505case "$cc" in
2506'') ;;
2507*) $rm -f try try.*
2508 $cat >try.c <<EOM
2509int main(int argc, char *argv[]) {
2510 return 0;
2511}
2512EOM
2513 if $cc -o try $ccflags $ldflags try.c; then
2514 :
2515 else
2573c5f9 2516 if $test X"$despair" = Xyes; then
6b769f8f
RB
2517 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2518 fi
2519 $cat >&4 <<EOM
5dd4fbdf
MB
2520You need to find a working C compiler.
2521Either (purchase and) install the C compiler supplied by your OS vendor,
2522or for a free C compiler try http://gcc.gnu.org/
2523I cannot continue any further, aborting.
2524EOM
6b769f8f 2525 exit 1
2573c5f9
JH
2526 fi
2527 $rm -f try try.*
2528 ;;
2529esac
2530EOSC
2531
a0d0e21e
LW
2532: determine whether symbolic links are supported
2533echo " "
2534$touch blurfl
2535if $ln -s blurfl sym > /dev/null 2>&1 ; then
2536 echo "Symbolic links are supported." >&4
818f00be 2537 lns="$ln -s"
a0d0e21e
LW
2538else
2539 echo "Symbolic links are NOT supported." >&4
2540 lns="$ln"
2541fi
2542$rm -f blurfl sym
2543
dafca956
JH
2544: determine whether symbolic links are supported
2545echo " "
2546case "$lns" in
18ea2752 2547*"ln"*" -s")
dafca956
JH
2548 echo "Checking how to test for symbolic links..." >&4
2549 $lns blurfl sym
4b661809 2550 if $test "X$issymlink" = X; then
2e2a97a6
JH
2551 case "$newsh" in
2552 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2553 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2554 esac
5d644a95
MB
2555 if test $? = 0; then
2556 issymlink="test -h"
2e2a97a6
JH
2557 else
2558 echo "Your builtin 'test -h' may be broken." >&4
2559 case "$test" in
2560 /*) ;;
2561 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2562 for p in $pth
2563 do
2564 if test -f "$p/$test"; then
2565 test="$p/$test"
2566 break
2567 fi
2568 done
2569 ;;
2570 esac
2571 case "$test" in
2572 /*)
2573 echo "Trying external '$test -h'." >&4
2574 issymlink="$test -h"
2575 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2576 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2577 issymlink=''
2578 fi
2579 ;;
2580 *) issymlink='' ;;
2581 esac
5d644a95
MB
2582 fi
2583 fi
4b661809 2584 if $test "X$issymlink" = X; then
dafca956 2585 if $test -L sym 2>/dev/null; then
5d644a95 2586 issymlink="$test -L"
2e2a97a6 2587 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2588 fi
2589 fi
4b661809 2590 if $test "X$issymlink" != X; then
5d644a95 2591 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2592 else
2593 echo "I do not know how you can test for symbolic links." >&4
2594 fi
2595 $rm -f blurfl sym
2596 ;;
2597*) echo "No symbolic links, so not testing for their testing..." >&4
2598 ;;
2599esac
2600echo " "
2601
2602
2603case "$mksymlinks" in
2604$define|true|[yY]*)
2605 case "$src" in
2606 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2607 exit 1
2608 ;;
4b661809 2609 *) case "$lns:$issymlink" in
f314eb9f 2610 *"ln"*" -s:"*"test -"?)
dafca956
JH
2611 echo "Creating the symbolic links..." >&4
2612 echo "(First creating the subdirectories...)" >&4
2613 cd ..
2614 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2615 read directory
2616 test -z "$directory" && break
2617 mkdir -p $directory
2618 done
2619 # Sanity check 1.
2620 if test ! -d t/base; then
2621 echo "Failed to create the subdirectories. Aborting." >&4
2622 exit 1
2623 fi
2624 echo "(Then creating the symlinks...)" >&4
2625 awk '{print $1}' $src/MANIFEST | while true; do
2626 read filename
2627 test -z "$filename" && break
2628 if test -f $filename; then
5d644a95 2629 if $issymlink $filename; then
dafca956
JH
2630 rm -f $filename
2631 fi
2632 fi
2633 if test -f $filename; then
2634 echo "$filename already exists, not symlinking."
2635 else
2636 ln -s $src/$filename $filename
2637 fi
2638 done
2639 # Sanity check 2.
a0d24b8a
JH
2640 if test ! -f t/base/lex.t; then
2641 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2642 exit 1
2643 fi
2644 cd UU
2645 ;;
2646 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2647 ;;
2648 esac
2649 ;;
2650 esac
2651 ;;
2652esac
2653
5440bc8e
JH
2654
2655case "$usecrosscompile" in
2656$define|true|[yY]*)
93bc48fa 2657 $echo "Cross-compiling..."
5440bc8e
JH
2658 croak=''
2659 case "$cc" in
2660 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2661 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2662 ar=$targetarch-ar
2663 # leave out ld, choosing it is more complex
2664 nm=$targetarch-nm
2665 ranlib=$targetarch-ranlib
93bc48fa 2666 $echo 'extern int foo;' > try.c
f8006fac 2667 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2668 shift
2669 if $test $# -gt 0; then
2670 incpth="$incpth $*"
f8006fac
JH
2671 incpth="`$echo $incpth|$sed 's/^ //'`"
2672 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2673 for i in $*; do
f8006fac 2674 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2675 if $test -d $j; then
2676 libpth="$libpth $j"
2677 fi
2678 done
f8006fac
JH
2679 libpth="`$echo $libpth|$sed 's/^ //'`"
2680 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2681 fi
2682 $rm -f try.c
5440bc8e
JH
2683 ;;
2684 esac
2685 case "$targetarch" in
93bc48fa
JH
2686 '') echo "Targetarch not defined." >&4; croak=y ;;
2687 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2688 esac
2689 case "$incpth" in
93bc48fa 2690 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2691 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2692 esac
2693 case "$libpth" in
93bc48fa 2694 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2695 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2696 esac
93bc48fa
JH
2697 case "$usrinc" in
2698 '') for i in $incpth; do
2699 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2700 usrinc=$i
2701 echo "Guessing usrinc $usrinc." >&4
2702 break
2703 fi
2704 done
2705 case "$usrinc" in
2706 '') echo "Usrinc not defined." >&4; croak=y ;;
2707 esac
2708 ;;
2709 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2710 esac
93bc48fa
JH
2711 case "$targethost" in
2712 '') echo "Targethost not defined." >&4; croak=y ;;
2713 *) echo "Using targethost $targethost." >&4
5440bc8e 2714 esac
93bc48fa
JH
2715 locincpth=' '
2716 loclibpth=' '
5440bc8e 2717 case "$croak" in
93bc48fa 2718 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2719 esac
2720 case "$src" in
2721 /*) run=$src/Cross/run
93c0359c 2722 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2723 to=$src/Cross/to
2724 from=$src/Cross/from
2725 ;;
93bc48fa 2726 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2727 run=$pwd/Cross/run
f8006fac 2728 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2729 to=$pwd/Cross/to
2730 from=$pwd/Cross/from
2731 ;;
2732 esac
2733 case "$targetrun" in
2734 '') targetrun=ssh ;;
2735 esac
2736 case "$targetto" in
2737 '') targetto=scp ;;
2738 esac
2739 case "$targetfrom" in
2740 '') targetfrom=scp ;;
2741 esac
2742 run=$run-$targetrun
2743 to=$to-$targetto
2744 from=$from-$targetfrom
93bc48fa
JH
2745 case "$targetdir" in
2746 '') targetdir=/tmp
2747 echo "Guessing targetdir $targetdir." >&4
2748 ;;
2749 esac
5440bc8e 2750 case "$targetuser" in
93bc48fa
JH
2751 '') targetuser=root
2752 echo "Guessing targetuser $targetuser." >&4
2753 ;;
5440bc8e
JH
2754 esac
2755 case "$targetfrom" in
2756 scp) q=-q ;;
2757 *) q='' ;;
2758 esac
2759 case "$targetrun" in
2760 ssh|rsh)
2761 cat >$run <<EOF
2762#!/bin/sh
93c0359c
JH
2763case "\$1" in
2764-cwd)
2765 shift
2766 cwd=\$1
2767 shift
2768 ;;
2769esac
2770case "\$cwd" in
2771'') cwd=$targetdir ;;
2772esac
5440bc8e
JH
2773exe=\$1
2774shift
93c0359c
JH
2775if $test ! -f \$exe.xok; then
2776 $to \$exe
2777 $touch \$exe.xok
2778fi
2779$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2780EOF
2781 ;;
93bc48fa 2782 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2783 exit 1
2784 ;;
2785 esac
93c0359c
JH
2786 case "$targetmkdir" in
2787 */Cross/mkdir)
2788 cat >$targetmkdir <<EOF
2789#!/bin/sh
2790$targetrun -l $targetuser $targethost "mkdir -p \$@"
2791EOF
f8006fac 2792 $chmod a+rx $targetmkdir
93c0359c
JH
2793 ;;
2794 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2795 exit 1
2796 ;;
2797 esac
5440bc8e
JH
2798 case "$targetto" in
2799 scp|rcp)
2800 cat >$to <<EOF
2801#!/bin/sh
2802for f in \$@
2803do
93c0359c
JH
2804 case "\$f" in
2805 /*)
2806 $targetmkdir \`dirname \$f\`
2807 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2808 ;;
2809 *)
2810 $targetmkdir $targetdir/\`dirname \$f\`
2811 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2812 ;;
2813 esac
5440bc8e
JH
2814done
2815exit 0
2816EOF
2817 ;;
2818 cp) cat >$to <<EOF
2819#!/bin/sh
93c0359c
JH
2820for f in \$@
2821do
2822 case "\$f" in
2823 /*)
2824 $mkdir -p $targetdir/\`dirname \$f\`
2825 $cp \$f $targetdir/\$f || exit 1
2826 ;;
2827 *)
2828 $targetmkdir $targetdir/\`dirname \$f\`
2829 $cp \$f $targetdir/\$f || exit 1
2830 ;;
2831 esac
2832done
2833exit 0
5440bc8e
JH
2834EOF
2835 ;;
93bc48fa 2836 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2837 exit 1
2838 ;;
2839 esac
2840 case "$targetfrom" in
2841 scp|rcp)
2842 cat >$from <<EOF
2843#!/bin/sh
2844for f in \$@
2845do
93c0359c 2846 $rm -f \$f
5440bc8e
JH
2847 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2848done
2849exit 0
2850EOF
2851 ;;
2852 cp) cat >$from <<EOF
2853#!/bin/sh
2854for f in \$@
2855do
93c0359c 2856 $rm -f \$f
5440bc8e
JH
2857 cp $targetdir/\$f . || exit 1
2858done
2859exit 0
2860EOF
2861 ;;
93bc48fa 2862 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2863 exit 1
2864 ;;
2865 esac
93bc48fa
JH
2866 if $test ! -f $run; then
2867 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2868 else
f8006fac 2869 $chmod a+rx $run
5440bc8e 2870 fi
93bc48fa
JH
2871 if $test ! -f $to; then
2872 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2873 else
f8006fac 2874 $chmod a+rx $to
5440bc8e 2875 fi
93bc48fa
JH
2876 if $test ! -f $from; then
2877 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2878 else
f8006fac 2879 $chmod a+rx $from
5440bc8e 2880 fi
93bc48fa 2881 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2882 exit 1
2883 fi
2884 cat >&4 <<EOF
f8006fac
JH
2885Using '$run' for remote execution,
2886and '$from' and '$to'
93bc48fa 2887for remote file transfer.
5440bc8e
JH
2888EOF
2889 ;;
2890*) run=''
2891 to=:
2892 from=:
2893 usecrosscompile='undef'
2894 targetarch=''
2895 ;;
2896esac
2897
ecfc5424
AD
2898: see whether [:lower:] and [:upper:] are supported character classes
2899echo " "
ecfc5424
AD
2900case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2901ABYZ)
2902 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2903 up='[:upper:]'
2904 low='[:lower:]'
2905 ;;
416d0bea
MB
2906*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2907 # (0xd9 and 0xe2), therefore that is a nice testing point.
2908 if test "X$up" = X -o "X$low" = X; then
2909 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2910 rs) up='[A-Z]'
2911 low='[a-z]'
28e8609d
JH
2912 ;;
2913 esac
416d0bea 2914 fi
28e8609d 2915 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2916 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2917 rs) up='A-Z'
28e8609d
JH
2918 low='a-z'
2919 ;;
2920 esac
416d0bea 2921 fi
28e8609d 2922 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2923 case "`echo RS | od -x 2>/dev/null`" in
2924 *D9E2*|*d9e2*)
28e8609d
JH
2925 echo "Hey, this might be EBCDIC." >&4
2926 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2927 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2928 rs) up='[A-IJ-RS-Z]'
2929 low='[a-ij-rs-z]'
28e8609d
JH
2930 ;;
2931 esac
2932 fi
2933 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2934 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2935 rs) up='A-IJ-RS-Z'
2936 low='a-ij-rs-z'
28e8609d
JH
2937 ;;
2938 esac
2939 fi
2940 ;;
2941 esac
2942 fi
2943esac
416d0bea
MB
2944case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2945rs)
28e8609d
JH
2946 echo "Using $up and $low to convert case." >&4
2947 ;;
ecfc5424 2948*)
28e8609d
JH
2949 echo "I don't know how to translate letters from upper to lower case." >&4
2950 echo "Your tr is not acting any way I know of." >&4
2951 exit 1
2952 ;;
ecfc5424
AD
2953esac
2954: set up the translation script tr, must be called with ./tr of course
2955cat >tr <<EOSC
2956$startsh
2957case "\$1\$2" in
2958'[A-Z][a-z]') exec $tr '$up' '$low';;
2959'[a-z][A-Z]') exec $tr '$low' '$up';;
2960esac
2961exec $tr "\$@"
2962EOSC
2963chmod +x tr
2964$eunicefix tr
2965
2304df62
AD
2966: Try to determine whether config.sh was made on this system
2967case "$config_sh" in
2968'')
43999f95
JH
2969myuname=`$uname -a 2>/dev/null`
2970$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2971# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2972# because the A-Z/a-z are not consecutive.
a0d0e21e 2973myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2974 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2975newmyuname="$myuname"
2304df62 2976dflt=n
16d20bd9
AD
2977case "$knowitall" in
2978'')
2979 if test -f ../config.sh; then
2980 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2981 eval "`grep myuname= ../config.sh`"
2982 fi
2983 if test "X$myuname" = "X$newmyuname"; then
2984 dflt=y
2985 fi
2304df62 2986 fi
16d20bd9
AD
2987 ;;
2988*) dflt=y;;
2989esac
2304df62
AD
2990
2991: Get old answers from old config file if Configure was run on the
2992: same system, otherwise use the hints.
2993hint=default
2994cd ..
2995if test -f config.sh; then
16d20bd9
AD
2996 echo " "
2997 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2998 . UU/myread
2999 case "$ans" in
f83701cd
AD
3000 n*|N*) echo "OK, I'll ignore it."
3001 mv config.sh config.sh.old
3002 myuname="$newmyuname"
3003 ;;
2304df62 3004 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3005 tmp_n="$n"
3006 tmp_c="$c"
85cad39c 3007 tmp_sh="$sh"
2304df62
AD
3008 . ./config.sh
3009 cp config.sh UU
ecfc5424
AD
3010 n="$tmp_n"
3011 c="$tmp_c"
85cad39c 3012 : Older versions did not always set $sh. Catch re-use of such
3013 : an old config.sh.
3014 case "$sh" in
3015 '') sh="$tmp_sh" ;;
3016 esac
2304df62
AD
3017 hint=previous
3018 ;;
3019 esac
3020fi
2573c5f9 3021. ./UU/checkcc
2304df62
AD
3022if test ! -f config.sh; then
3023 $cat <<EOM
3024
4e2a5f63
AD
3025First time through, eh? I have some defaults handy for some systems
3026that need some extra help getting the Configure answers right:
2304df62
AD
3027
3028EOM
dfe9444c 3029 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3030 dflt=''
3031 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3032 : tests or hints, please send them to perlbug@perl.org
2304df62 3033 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3034 $test -f /irix && osname=irix
85e6fe83
LW
3035 $test -f /xenix && osname=sco_xenix
3036 $test -f /dynix && osname=dynix
3037 $test -f /dnix && osname=dnix
5f05dabc 3038 $test -f /lynx.os && osname=lynxos
3039 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3040 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3041 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3042 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3043 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3044 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3045 $test -d /usr/apollo/bin && osname=apollo
3046 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3047 $test -d /usr/include/minix && osname=minix
d54344fc 3048 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3049 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3050 osname=machten
4633a7c4 3051 if $test -x /sbin/version; then
dfe9444c 3052 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3053 $sed -e 's/[A-Za-z]$//'`
3054 elif $test -x /usr/etc/version; then
dfe9444c 3055 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3056 $sed -e 's/[A-Za-z]$//'`
3057 else
3058 osvers="$2.$3"
3059 fi
3060 fi
aaacdc8b
GS
3061
3062 $test -f /sys/posix.dll &&
3063 $test -f /usr/bin/what &&
3064 set X `/usr/bin/what /sys/posix.dll` &&
3065 $test "$3" = UWIN &&
3066 osname=uwin &&
3067 osvers="$5"
3068
2304df62
AD
3069 if $test -f $uname; then
3070 set X $myuname
3071 shift
3072
2304df62 3073 case "$5" in
85e6fe83 3074 fps*) osname=fps ;;
2304df62
AD
3075 mips*)
3076 case "$4" in
85e6fe83
LW
3077 umips) osname=umips ;;
3078 *) osname=mips ;;
2304df62 3079 esac;;
85e6fe83
LW
3080 [23]100) osname=mips ;;
3081 next*) osname=next ;;
ecfc5424 3082 i386*)
c6912327
JH
3083 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3084 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3085 osname='sco'
3086 osvers=$tmp
3087 elif $test -f /etc/kconfig; then
ecfc5424 3088 osname=isc
bd628c73 3089 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3090 osvers=4
3091 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3092 osvers=3
2304df62 3093 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3094 osvers=2
ecfc5424
AD
3095 fi
3096 fi
2000072c 3097 tmp=''
ecfc5424 3098 ;;
c4f23d77
AD
3099 pc*)
3100 if test -n "$DJGPP"; then
3101 osname=dos
3102 osvers=djgpp
3103 fi
3104 ;;
2304df62
AD
3105 esac
3106
3107 case "$1" in
a0d0e21e
LW
3108 aix) osname=aix
3109 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3110 case "$tmp" in
e81c5c2a
NC
3111 # oslevel can fail with:
3112 # oslevel: Unable to acquire lock.
3113 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3114 '<3240'|'<>3240') osvers=3.2.0 ;;
3115 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3116 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3117 *) osvers=$tmp;;
a0d0e21e
LW
3118 esac
3119 ;;
aaacdc8b
GS
3120 bsd386) osname=bsd386
3121 osvers=`$uname -r`
3122 ;;
3123 cygwin*) osname=cygwin
3124 osvers="$3"
3125 ;;
23f87696
SZ
3126 *dc.osx) osname=dcosx
3127 osvers="$3"
3128 ;;
a0d0e21e
LW
3129 dnix) osname=dnix
3130 osvers="$3"
3131 ;;
3132 domainos) osname=apollo
3133 osvers="$3"
3134 ;;
a774dfe6
RSG
3135 dgux) osname=dgux
3136 osvers="$3"
3137 ;;
3138 dragonfly) osname=dragonfly
a0d0e21e
LW
3139 osvers="$3"
3140 ;;
760ac839 3141 dynixptx*) osname=dynixptx
e58e581d 3142 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3143 ;;
a774dfe6 3144 freebsd) osname=freebsd
a0d0e21e 3145 osvers="$3" ;;
761ee4e8
BD
3146 genix) osname=genix ;;
3147 gnu) osname=gnu
3148 osvers="$3" ;;
a774dfe6 3149 hp*) osname=hpux
bfb7748a 3150 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3151 ;;
761ee4e8 3152 irix*) osname=irix
a0d0e21e
LW
3153 case "$3" in
3154 4*) osvers=4 ;;
3155 5*) osvers=5 ;;
ecfc5424 3156 *) osvers="$3" ;;
a0d0e21e
LW
3157 esac
3158 ;;
761ee4e8 3159 linux) osname=linux
a0d0e21e 3160 case "$3" in
a0d0e21e
LW
3161 *) osvers="$3" ;;
3162 esac
3163 ;;
761ee4e8 3164 MiNT) osname=mint
28e8609d
JH
3165 ;;
3166 netbsd*) osname=netbsd
ecfc5424
AD
3167 osvers="$3"
3168 ;;
4e81affe
MM
3169 news-os) osvers="$3"
3170 case "$3" in
3171 4*) osname=newsos4 ;;
3172 *) osname=newsos ;;
3173 esac
3174 ;;
aaacdc8b 3175 next*) osname=next ;;
28bb1e2c 3176 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3177 openbsd) osname=openbsd
3178 osvers="$3"
3179 ;;
5c728af0
IZ
3180 os2) osname=os2
3181 osvers="$4"
3182 ;;
aaacdc8b
GS
3183 POSIX-BC | posix-bc ) osname=posix-bc
3184 osvers="$3"
a0d0e21e 3185 ;;
ae3afa4e
TH
3186 powerux | power_ux | powermax_os | powermaxos | \
3187 powerunix | power_unix) osname=powerux
3188 osvers="$3"
3189 ;;
aaacdc8b
GS
3190 qnx) osname=qnx
3191 osvers="$4"
3192 ;;
a0d0e21e
LW
3193 solaris) osname=solaris
3194 case "$3" in
3195 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3196 *) osvers="$3" ;;
a0d0e21e
LW
3197 esac
3198 ;;
85e6fe83
LW
3199 sunos) osname=sunos
3200 case "$3" in
85e6fe83
LW
3201 5*) osname=solaris
3202 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3203 *) osvers="$3" ;;
2304df62
AD
3204 esac
3205 ;;
a0d0e21e 3206 titanos) osname=titanos
85e6fe83 3207 case "$3" in
a0d0e21e
LW
3208 1*) osvers=1 ;;
3209 2*) osvers=2 ;;
3210 3*) osvers=3 ;;
3211 4*) osvers=4 ;;
ecfc5424 3212 *) osvers="$3" ;;
2304df62
AD
3213 esac
3214 ;;
85e6fe83 3215 ultrix) osname=ultrix
ecfc5424 3216 osvers="$3"
2304df62 3217 ;;
28757baa 3218 osf1|mls+) case "$5" in
fed7345c
AD
3219 alpha)
3220 osname=dec_osf
fdd85a03 3221 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3222 case "$osvers" in
3223 [1-9].[0-9]*) ;;
3224 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3225 esac
ecfc5424
AD
3226 ;;
3227 hp*) osname=hp_osf1 ;;
3228 mips) osname=mips_osf1 ;;
85e6fe83
LW
3229 esac
3230 ;;
af1ff193 3231 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3232 openunix|unixware) osname=svr5
0337d152
BG
3233 osvers="$4"
3234 ;;
3c728e00 3235 uts) osname=uts
a0d0e21e
LW
3236 osvers="$3"
3237 ;;
3c728e00
JH
3238 vos) osvers="$3"
3239 ;;
85e6fe83 3240 $2) case "$osname" in
2304df62 3241 *isc*) ;;
a0d0e21e 3242 *freebsd*) ;;
5f05dabc 3243 svr*)
a0d0e21e 3244 : svr4.x or possibly later
a774dfe6 3245 case "svr$3" in
a0d0e21e
LW
3246 ${osname}*)
3247 osname=svr$3
3248 osvers=$4
3249 ;;
3250 esac
3251 case "$osname" in
3252 svr4.0)
3253 : Check for ESIX
3254 if test -f /stand/boot ; then
3255 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3256 if test -n "$INITPROG" -a -f "$INITPROG"; then
3257 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3258 if test -n "$isesix"; then
a0d0e21e
LW
3259 osname=esix4
3260 fi
3261 fi
3262 fi
3263 ;;
3264 esac
3265 ;;
2304df62 3266 *) if test -f /etc/systemid; then
a0d0e21e
LW
3267 osname=sco
3268 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3269 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3270 osvers=$1.$2.$3
c4f23d77 3271 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3272 osvers=$1.$2
c4f23d77 3273 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3274 osvers=$1
2304df62 3275 fi
a0d0e21e
LW
3276 else
3277 case "$osname" in
3278 '') : Still unknown. Probably a generic Sys V.
3279 osname="sysv"
3280 osvers="$3"
3281 ;;
3282 esac
2304df62
AD
3283 fi
3284 ;;
3285 esac
3286 ;;
a0d0e21e
LW
3287 *) case "$osname" in
3288 '') : Still unknown. Probably a generic BSD.
3289 osname="$1"
3290 osvers="$3"
3291 ;;
3292 esac
3293 ;;
2304df62
AD
3294 esac
3295 else
dfe9444c
AD
3296 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3297 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3298 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3299 osname=news_os
2304df62 3300 fi
dfe9444c 3301 $rm -f UU/kernel.what
5c728af0 3302 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3303 set X $myuname
3304 osname=os2
3305 osvers="$5"
2304df62
AD
3306 fi
3307 fi
a774dfe6 3308
5440bc8e
JH
3309 case "$targetarch" in
3310 '') ;;
3311 *) hostarch=$osname
3312 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3313 osvers=''
3314 ;;
3315 esac
3316
a0d0e21e
LW
3317 : Now look for a hint file osname_osvers, unless one has been
3318 : specified already.
3319 case "$hintfile" in
3320 ''|' ')
1e127011 3321 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3322 : Also try without trailing minor version numbers.
1e127011
DD
3323 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3324 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3325 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3326 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3327 case "$file" in
3328 '') dflt=none ;;
3329 *) case "$osvers" in
3330 '') dflt=$file
3331 ;;
dfe9444c 3332 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3333 dflt=$file
dfe9444c 3334 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3335 dflt=$xfile
dfe9444c 3336 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3337 dflt=$xxfile
dfe9444c 3338 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3339 dflt=$xxxfile
dfe9444c 3340 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3341 dflt=$xxxxfile
dfe9444c 3342 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3343 dflt="${osname}"
3344 else
3345 dflt=none
3346 fi
3347 ;;
3348 esac
85e6fe83
LW
3349 ;;
3350 esac
4e2a5f63
AD
3351 if $test -f Policy.sh ; then
3352 case "$dflt" in
3353 *Policy*) ;;
3354 none) dflt="Policy" ;;
3355 *) dflt="Policy $dflt" ;;
3356 esac
3357 fi
85e6fe83 3358 ;;
a0d0e21e 3359 *)
ecfc5424 3360 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3361 ;;
2304df62 3362 esac
1aef975c 3363
4e2a5f63
AD
3364 if $test -f Policy.sh ; then
3365 $cat <<EOM
3366
3367There's also a Policy hint file available, which should make the
3368site-specific (policy) questions easier to answer.
3369EOM
3370
3371 fi
3372
2304df62
AD
3373 $cat <<EOM
3374
3375You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3376A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3377is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3378
3379EOM
4e2a5f63 3380
2304df62 3381 rp="Which of these apply, if any?"
dfe9444c 3382 . UU/myread
85e6fe83
LW
3383 tans=$ans
3384 for file in $tans; do
4e2a5f63
AD
3385 if $test X$file = XPolicy -a -f Policy.sh; then
3386 . Policy.sh
3387 $cat Policy.sh >> UU/config.sh
3388 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3389 . $src/hints/$file.sh
3390 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3391 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3392 : nothing
3393 else
85e6fe83
LW
3394 : Give one chance to correct a possible typo.
3395 echo "$file.sh does not exist"
3396 dflt=$file
3397 rp="hint to use instead?"
dfe9444c 3398 . UU/myread
85e6fe83 3399 for file in $ans; do
dfe9444c
AD
3400 if $test -f "$src/hints/$file.sh"; then
3401 . $src/hints/$file.sh
3402 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3403 elif $test X$ans = X -o X$ans = Xnone ; then
3404 : nothing
3405 else
3406 echo "$file.sh does not exist -- ignored."
3407 fi
3408 done
2304df62
AD
3409 fi
3410 done
85e6fe83 3411
2304df62 3412 hint=recommended
85e6fe83 3413 : Remember our hint file for later.
dfe9444c 3414 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3415 hintfile="$file"
85e6fe83 3416 else
a0d0e21e 3417 hintfile=''
85e6fe83 3418 fi
2304df62
AD
3419fi
3420cd UU
3421;;
3422*)
3423 echo " "
3424 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3425 tmp_n="$n"
3426 tmp_c="$c"
2304df62
AD
3427 cd ..
3428 cp $config_sh config.sh 2>/dev/null
a78b0d02 3429 chmod +w config.sh
2304df62
AD
3430 . ./config.sh
3431 cd UU
3432 cp ../config.sh .
ecfc5424
AD
3433 n="$tmp_n"
3434 c="$tmp_c"
2304df62
AD
3435 hint=previous
3436 ;;
3437esac
1aef975c 3438test "$override" && . ./optdef.sh
2304df62
AD
3439
3440: Restore computed paths
3441for file in $loclist $trylist; do
3442 eval $file="\$_$file"
3443done
3444
85e6fe83 3445cat << EOM
a0d0e21e 3446
85e6fe83 3447Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3448The default value is probably right if the name rings a bell. Otherwise,
3449since spelling matters for me, either accept the default or answer "none"
3450to leave it blank.
a0d0e21e 3451
85e6fe83 3452EOM
85e6fe83 3453case "$osname" in
a0d0e21e 3454 ''|' ')
85e6fe83 3455 case "$hintfile" in
a0d0e21e 3456 ''|' '|none) dflt=none ;;
ecfc5424 3457 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3458 esac
3459 ;;
3460 *) dflt="$osname" ;;
3461esac
3462rp="Operating system name?"
3463. ./myread
3464case "$ans" in
ecfc5424
AD
3465none) osname='' ;;
3466*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3467esac
8ff267be 3468echo " "
3469case "$osvers" in
3470 ''|' ')
3471 case "$hintfile" in
3472 ''|' '|none) dflt=none ;;
3473 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3474 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3475 case "$dflt" in
3476 ''|' ') dflt=none ;;
3477 esac
3478 ;;
3479 esac
3480 ;;
3481 *) dflt="$osvers" ;;
3482esac
3483rp="Operating system version?"
3484. ./myread
3485case "$ans" in
3486none) osvers='' ;;
3487*) osvers="$ans" ;;
3488esac
3489
02e93a22
JH
3490
3491. ./posthint.sh
3492
2304df62 3493: who configured the system
59b83a6f 3494cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3495case "$cf_by" in
3496"")
7c04078e 3497 cf_by=`(logname) 2>/dev/null`
dfe9444c 3498 case "$cf_by" in
7c04078e
GA
3499 "")
3500 cf_by=`(whoami) 2>/dev/null`
3501 case "$cf_by" in
3502 "") cf_by=unknown ;;
3503 esac ;;
8ff267be 3504 esac ;;
3505esac
2304df62 3506
b4eb6b3d
JH
3507: set up the script used to warn in case of inconsistency
3508cat <<EOS >whoa
3509$startsh
3510EOS
3511cat <<'EOSC' >>whoa
3512dflt=y
3513echo " "
3514echo "*** WHOA THERE!!! ***" >&4
3515echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3516rp=" Keep the $hint value?"
3517. ./myread
3518case "$ans" in
3519y) td=$was; tu=$was;;
3520esac
3521EOSC
3522
3523: function used to set $1 to $val
3524setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3525case "$val$was" in
3526$define$undef) . ./whoa; eval "$var=\$td";;
3527$undef$define) . ./whoa; eval "$var=\$tu";;
3528*) eval "$var=$val";;
3529esac'
3530
b29b105d
JH
3531case "$usesocks" in
3532$define|true|[yY]*) dflt='y';;
3533*) dflt='n';;
3534esac
3535cat <<EOM
3536
3537Perl can be built to use the SOCKS proxy protocol library. To do so,
3538Configure must be run with -Dusesocks. If you use SOCKS you also need
3539to use the PerlIO abstraction layer, this will be implicitly selected.
3540
3541If this doesn't make any sense to you, just accept the default '$dflt'.
3542EOM
3543rp='Build Perl for SOCKS?'
3544. ./myread
3545case "$ans" in
3546y|Y) val="$define" ;;
3547*) val="$undef" ;;
3548esac
3549set usesocks
3550eval $setvar
3551
3552case "$usesocks" in
3553$define|true|[yY]*) useperlio="$define";;
3554esac
3555
3556case "$useperlio" in
3557$define|true|[yY]*|'') dflt='y';;
3558*) dflt='n';;
3559esac
3560cat <<EOM
3561
3562Previous version of $package used the standard IO mechanisms as
3563defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3564alternate IO mechanisms via the PerlIO abstraction layer, but the
3565stdio mechanism is still available if needed. The abstraction layer
3566can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3567Using PerlIO with sfio may cause problems with some extension modules.
3568
3569If this doesn't make any sense to you, just accept the default '$dflt'.
3570EOM
3571rp='Use the PerlIO abstraction layer?'
3572. ./myread
3573case "$ans" in
3574y|Y)
3575 val="$define"
3576 ;;
3577*)
3578 echo "Ok, doing things the stdio way."
3579 val="$undef"
3580 ;;
3581esac
3582set useperlio
3583eval $setvar
3584
3585case "$usesocks" in
3586$define|true|[yY]*)
3587 case "$useperlio" in
3588 $define|true|[yY]*) ;;
3589 *) cat >&4 <<EOM
3590
3591You are using the SOCKS proxy protocol library which means that you
3592should also use the PerlIO layer. You may be headed for trouble.
3593
3594EOM
3595 ;;
3596 esac
3597 ;;
3598esac
3599
3600
b4eb6b3d
JH
3601case "$usethreads" in
3602$define|true|[yY]*) dflt='y';;
8e285145
AD
3603*) # Catch case where user specified ithreads or 5005threads but
3604 # forgot -Dusethreads (A.D. 4/2002)
3605 case "$useithreads$use5005threads" in
b29b105d
JH
3606 *$define*)
3607 case "$useperlio" in
3608 "$define") dflt='y' ;;
3609 *) dflt='n' ;;
3610 esac
3611 ;;
3612 *) dflt='n';;
8e285145
AD
3613 esac
3614 ;;
b4eb6b3d
JH
3615esac
3616cat <<EOM
3617
3618Perl can be built to take advantage of threads on some systems.
3619To do so, Configure can be run with -Dusethreads.
3620
bfce6503
DM
3621Note that Perl built with threading support runs slightly slower
3622and uses more memory than plain Perl. The current implementation
3623is believed to be stable, but it is fairly new, and so should be
3624treated with caution.
b4eb6b3d
JH
3625
3626If this doesn't make any sense to you, just accept the default '$dflt'.
3627EOM
3628rp='Build a threading Perl?'
3629. ./myread
3630case "$ans" in
3631y|Y) val="$define" ;;
3632*) val="$undef" ;;
3633esac
3634set usethreads
3635eval $setvar
3636
3637case "$usethreads" in
3638$define)
3639 $cat <<EOM
3640
bfce6503
DM
3641Since release 5.6, Perl has had two different threading implementations,
3642the newer interpreter-based version (ithreads) with one interpreter per
3643thread, and the older 5.005 version (5005threads).
3644The 5005threads version is effectively unmaintained and will probably be
3645removed in Perl 5.10, so there should be no need to build a Perl using it
3646unless needed for backwards compatibility with some existing 5.005threads
3647code.
b4eb6b3d 3648
b4eb6b3d
JH
3649EOM
3650 : Default to ithreads unless overridden on command line or with
3651 : old config.sh
3652 dflt='y'
3653 case "$use5005threads" in
3654 $define|true|[yY]*) dflt='n';;
3655 esac
3656 case "$useithreads" in
3657 $undef|false|[nN]*) dflt='n';;
3658 esac
bfce6503 3659 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
3660 . ./myread
3661 case "$ans" in
3662 y|Y) val="$define" ;;
3663 *) val="$undef" ;;
3664 esac
3665 set useithreads
3666 eval $setvar
3667 : Now set use5005threads to the opposite value.
3668 case "$useithreads" in
3669 $define) val="$undef" ;;
3670 *) val="$define" ;;
3671 esac
3672 set use5005threads
3673 eval $setvar
3674 ;;
3675*)
3676 useithreads="$undef"
3677 use5005threads="$undef"
3678 ;;
3679esac
3680
c915ce7f
JH
3681case "$useithreads$use5005threads" in
3682"$define$define")
3683 $cat >&4 <<EOM
3684
3685You cannot have both the ithreads and the 5.005 threads enabled
3686at the same time. Disabling the 5.005 threads since they are
3687much less stable than the ithreads.
3688
3689EOM
3690 use5005threads="$undef"
3691 ;;
3692esac
3693
b29b105d
JH
3694if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3695 cat >&4 <<EOF
3696***
3697*** To build with ithreads you must also use the PerlIO layer.
3698*** Cannot continue, aborting.
3699***
3700EOF
3701 exit 1
3702fi
3703
b4eb6b3d
JH
3704case "$d_oldpthreads" in
3705'') : Configure tests would be welcome here. For now, assume undef.
3706 val="$undef" ;;
3707*) val="$d_oldpthreads" ;;
3708esac
3709set d_oldpthreads
3710eval $setvar
3711
3712
b4eb6b3d
JH
3713: Look for a hint-file generated 'call-back-unit'. If the
3714: user has specified that a threading perl is to be built,
3715: we may need to set or change some other defaults.
9da7673b
MB
3716if $test -f usethreads.cbu; then
3717 echo "Your platform has some specific hints regarding threaded builds, using them..."
3718 . ./usethreads.cbu
3719else
3720 case "$usethreads" in
3721 "$define"|true|[yY]*)
b4eb6b3d 3722 $cat <<EOM
9da7673b 3723(Your platform does not have any specific hints for threaded builds.
b4eb6b3d
JH
3724 Assuming POSIX threads, then.)
3725EOM
b4eb6b3d 3726 ;;
9da7673b
MB
3727 esac
3728fi
b4eb6b3d
JH
3729
3730cat <<EOM
3731
3732Perl can be built so that multiple Perl interpreters can coexist
3733within the same Perl executable.
3734EOM
3735
3736case "$useithreads" in
3737$define)
3738 cat <<EOM
3739This multiple interpreter support is required for interpreter-based threads.
3740EOM
3741 val="$define"
3742 ;;
3743*) case "$usemultiplicity" in
3744 $define|true|[yY]*) dflt='y';;
3745 *) dflt='n';;
3746 esac
3747 echo " "
3748 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3749 rp='Build Perl for multiplicity?'
3750 . ./myread
3751 case "$ans" in
3752 y|Y) val="$define" ;;
3753 *) val="$undef" ;;
3754 esac
3755 ;;
3756esac
3757set usemultiplicity
3758eval $setvar
3759
96056487
JH
3760
3761case "$usemorebits" in
3762"$define"|true|[yY]*)
3763 use64bitint="$define"
3764 uselongdouble="$define"
3765 usemorebits="$define"
3766 ;;
3767*) usemorebits="$undef"
3768 ;;
3769esac
3770
e5e20432
JH
3771: make some quick guesses about what we are up against
3772echo " "
3773$echo $n "Hmm... $c"
3774echo exit 1 >bsd
3775echo exit 1 >usg
3776echo exit 1 >v7
3777echo exit 1 >osf1
3778echo exit 1 >eunice
3779echo exit 1 >xenix
3780echo exit 1 >venix
3781echo exit 1 >os2
3782d_bsd="$undef"
3783$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3784if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3785then
3786 echo "Looks kind of like an OSF/1 system, but we'll see..."
3787 echo exit 0 >osf1
381aa1ff 3788elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3789 xxx=`./loc addbib blurfl $pth`
3790 if $test -f $xxx; then
3791 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3792 echo exit 0 >bsd
3793 echo exit 0 >usg
3794 else
3795 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3796 echo "Looks kind of like an extended USG system, but we'll see..."
3797 else
3798 echo "Looks kind of like a USG system, but we'll see..."
3799 fi
3800 echo exit 0 >usg
3801 fi
3802elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3803 echo "Looks kind of like a BSD system, but we'll see..."
3804 d_bsd="$define"
3805 echo exit 0 >bsd
3806else
3807 echo "Looks kind of like a Version 7 system, but we'll see..."
3808 echo exit 0 >v7
3809fi
3810case "$eunicefix" in
3811*unixtovms*)
3812 $cat <<'EOI'
3813There is, however, a strange, musty smell in the air that reminds me of
3814something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3815EOI
3816 echo exit 0 >eunice
3817 d_eunice="$define"
3818: it so happens the Eunice I know will not run shell scripts in Unix format
3819 ;;
3820*)
3821 echo " "
3822 echo "Congratulations. You aren't running Eunice."
3823 d_eunice="$undef"
3824 ;;
3825esac
3826: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3827: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3828: semicolon as a patch separator
e5e20432
JH
3829case "$p_" in
3830:) ;;
3831*)
3832 $cat <<'EOI'
3833I have the feeling something is not exactly right, however...don't tell me...
3834lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3835(Or you may be running DOS with DJGPP.)
e5e20432
JH
3836EOI
3837 echo exit 0 >os2
3838 ;;
3839esac
3840if test -f /xenix; then
3841 echo "Actually, this looks more like a XENIX system..."
3842 echo exit 0 >xenix
3843 d_xenix="$define"
3844else
3845 echo " "
3846 echo "It's not Xenix..."
3847 d_xenix="$undef"
3848fi
3849chmod +x xenix
3850$eunicefix xenix
3851if test -f /venix; then
3852 echo "Actually, this looks more like a VENIX system..."
3853 echo exit 0 >venix
3854else
3855 echo " "
3856 if ./xenix; then
3857 : null
3858 else
3859 echo "Nor is it Venix..."
3860 fi
3861fi
3862chmod +x bsd usg v7 osf1 eunice xenix venix os2
3863$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3864$rm -f foo
3865
5869b1f1
JH
3866case "$cc" in
3867'') dflt=cc;;
3868*) dflt="$cc";;
3869esac
3870rp="Use which C compiler?"
3871. ./myread
3872cc="$ans"
6b769f8f
RB
3873
3874: See if they have not cc but they do have gcc
3875. ./trygcc
e5e20432
JH
3876: Look for a hint-file generated 'call-back-unit'. Now that the
3877: user has specified the compiler, we may need to set or change some
3878: other defaults.
3879if $test -f cc.cbu; then
3880 . ./cc.cbu
3881fi
2573c5f9 3882. ./checkcc
8a27cf78 3883
e5e20432
JH
3884echo " "
3885echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3886$cat >try.c <<EOM
e5e20432
JH
3887#include <stdio.h>
3888int main() {
3889#ifdef __GNUC__
3890#ifdef __VERSION__
3891 printf("%s\n", __VERSION__);
3892#else
3893 printf("%s\n", "1");
3894#endif
3895#endif
073b6de5 3896 return(0);
e5e20432
JH
3897}
3898EOM
5440bc8e
JH
3899if $cc -o try $ccflags $ldflags try.c; then
3900 gccversion=`$run ./try`
e5e20432
JH
3901 case "$gccversion" in
3902 '') echo "You are not using GNU cc." ;;
fc68435e 3903 *) echo "You are using GNU cc $gccversion."
48fe685d 3904 ccname=gcc
fc68435e 3905 ;;
e5e20432
JH
3906 esac
3907else
3908 echo " "
3909 echo "*** WHOA THERE!!! ***" >&4
3910 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3911 case "$knowitall" in
3912 '')
3913 echo " You'd better start hunting for one and let me know about it." >&4
3914 exit 1
3915 ;;
3916 esac
3917fi
5440bc8e 3918$rm -f try try.*
e5e20432
JH
3919case "$gccversion" in
39201*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3921esac
5b463ca7
KS
3922case "$gccversion" in
3923'') gccosandvers='' ;;
10b4ebb5
JH
3924*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3925 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3926 gccshortvers=''
5b463ca7 3927 case "$gccosandvers" in
02903077
JH
3928 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3929 $osname$osvers) ;; # looking good
5b463ca7
KS
3930 $osname*) cat <<EOM >&4
3931
3932*** WHOA THERE!!! ***
3933
3934 Your gcc has not been compiled for the exact release of
3935 your operating system ($gccosandvers versus $osname$osvers).
3936
3937 In general it is a good idea to keep gcc synchronized with
3938 the operating system because otherwise serious problems
3939 may ensue when trying to compile software, like Perl.
3940
3941 I'm trying to be optimistic here, though, and will continue.
3942 If later during the configuration and build icky compilation
02903077
JH
3943 problems appear (headerfile conflicts being the most common
3944 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3945 your operating system release.
3946
3947EOM
3948 ;;
81575342 3949 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3950 esac
3951 ;;
3952esac
e723fc21
JH
3953case "$ccname" in
3954'') ccname="$cc" ;;
3955esac
e5e20432 3956
224cb7cb 3957# gcc 3.* complain about adding -Idirectories that they already know about,
76589481
JH
3958# so we will take those off from locincpth.
3959case "$gccversion" in
39603*)
3961 echo "main(){}">try.c
224cb7cb
JH
3962 for incdir in $locincpth; do
3963 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
48fe685d 3964 grep '^c[cp]p*[01]: warning: changing search order '`
224cb7cb 3965 if test "X$warn" != X; then
44b94491 3966 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
224cb7cb 3967 fi
76589481
JH
3968 done
3969 $rm -f try try.*
3970esac
640374d0 3971
bd9b35c9
JH
3972: decide how portable to be. Allow command line overrides.
3973case "$d_portable" in
3974"$undef") ;;
3975*) d_portable="$define" ;;
104d25b7 3976esac
85ab1d1d 3977
bd9b35c9
JH
3978: set up shell script to do ~ expansion
3979cat >filexp <<EOSS
3980$startsh
3981: expand filename
3982case "\$1" in
3983 ~/*|~)
3984 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3985 ;;
3986 ~*)
3987 if $test -f /bin/csh; then
3988 /bin/csh -f -c "glob \$1"
3989 failed=\$?
3990 echo ""
3991 exit \$failed
e5e20432 3992 else
bd9b35c9
JH
3993 name=\`$expr x\$1 : '..\([^/]*\)'\`
3994 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3995 if $test ! -d "\$dir"; then
3996 me=\`basename \$0\`
3997 echo "\$me: can't locate home directory for: \$name" >&2
3998 exit 1
3999 fi
4000 case "\$1" in
4001 */*)
4002 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
4003 ;;
4004 *)
4005 echo \$dir
e5e20432
JH
4006 ;;
4007 esac
4008 fi
b691c02f 4009 ;;
4633a7c4 4010*)
bd9b35c9 4011 echo \$1
2304df62
AD
4012 ;;
4013esac
4633a7c4
LW
4014EOSS
4015chmod +x filexp
4016$eunicefix filexp
2304df62
AD
4017
4018: now set up to get a file name
28757baa 4019cat <<EOS >getfile
4020$startsh
4021EOS
4022cat <<'EOSC' >>getfile
2304df62
AD
4023tilde=''
4024fullpath=''
4025already=''
4026skip=''
4027none_ok=''
4028exp_file=''
a0d0e21e 4029nopath_ok=''
2304df62
AD
4030orig_rp="$rp"
4031orig_dflt="$dflt"
b233458b
JH
4032case "$gfpth" in
4033'') gfpth='.' ;;
4034esac
2304df62
AD
4035
4036case "$fn" in
ecfc5424 4037*\(*)
d604bb53
JH
4038 : getfile will accept an answer from the comma-separated list
4039 : enclosed in parentheses even if it does not meet other criteria.
4040 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
ecfc5424
AD
4041 fn=`echo $fn | sed 's/(.*)//'`
4042 ;;
4043esac
4044
4045case "$fn" in
a0d0e21e
LW
4046*:*)
4047 loc_file=`expr $fn : '.*:\(.*\)'`
4048 fn=`expr $fn : '\(.*\):.*'`
4049 ;;
4050esac
4051
4052case "$fn" in
2304df62
AD
4053*~*) tilde=true;;
4054esac
4055case "$fn" in
4056*/*) fullpath=true;;
4057esac
4058case "$fn" in
4059*+*) skip=true;;
4060esac
4061case "$fn" in
4062*n*) none_ok=true;;
4063esac
4064case "$fn" in
4065*e*) exp_file=true;;
4066esac
a0d0e21e
LW
4067case "$fn" in
4068*p*) nopath_ok=true;;
4069esac
2304df62
AD
4070
4071case "$fn" in
4072*f*) type='File';;
4073*d*) type='Directory';;
a0d0e21e 4074*l*) type='Locate';;
2304df62
AD
4075esac
4076
4077what="$type"
4078case "$what" in
4079Locate) what='File';;
4080esac
4081
4082case "$exp_file" in
4083'')
4084 case "$d_portable" in
4085 "$define") ;;
4086 *) exp_file=true;;
4087 esac
4088 ;;
4089esac
4090
4091cd ..
4092while test "$type"; do
4093 redo=''
4094 rp="$orig_rp"
4095 dflt="$orig_dflt"
4096 case "$tilde" in
4097 true) rp="$rp (~name ok)";;
4098 esac
4099 . UU/myread
ecfc5424
AD
4100 if test -f UU/getfile.ok && \
4101 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4102 then
4103 value="$ans"
4104 ansexp="$ans"
4105 break
4106 fi
2304df62
AD
4107 case "$ans" in
4108 none)
4109 value=''
4110 ansexp=''
4111 case "$none_ok" in
4112 true) type='';;
4113 esac
4114 ;;
4115 *)
4116 case "$tilde" in
4117 '') value="$ans"
4118 ansexp="$ans";;
4119 *)
4120 value=`UU/filexp $ans`
4121 case $? in
4122 0)
4123 if test "$ans" != "$value"; then
ecfc5424 4124 echo "(That expands to $value on this system.)"
2304df62
AD
4125 fi
4126 ;;
4127 *) value="$ans";;
4128 esac
4129 ansexp="$value"
4130 case "$exp_file" in
4131 '') value="$ans";;
4132 esac
4133 ;;
4134 esac
4135 case "$fullpath" in
4136 true)
4137 case "$ansexp" in
4138 /*) value="$ansexp" ;;
23da6c43 4139 [a-zA-Z]:/*) value="$ansexp" ;;
2304df62
AD
4140 *)
4141 redo=true
4142 case "$already" in
4143 true)
4144 echo "I shall only accept a full path name, as in /bin/ls." >&4
4145 echo "Use a ! shell escape if you wish to check pathnames." >&4
4146 ;;
4147 *)
4148 echo "Please give a full path name, starting with slash." >&4
4149 case "$tilde" in
4150 true)
4151 echo "Note that using ~name is ok provided it expands well." >&4
4152 already=true
4153 ;;
4154 esac
4155 esac
4156 ;;
4157 esac
4158 ;;
4159 esac
4160 case "$redo" in
4161 '')
4162 case "$type" in
4163 File)
b233458b
JH
4164 for fp in $gfpth; do
4165 if test "X$fp" = X.; then
4166 pf="$ansexp"
4167 else
4168 pf="$fp/$ansexp"
4169 fi
4170 if test -f "$pf"; then
4171 type=''
4172 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4173 then
4174 echo "($value is not a plain file, but that's ok.)"
4175 type=''
4176 fi
4177 if test X"$type" = X; then
4178 value="$pf"
4179 break
4180 fi
4181 done
2304df62
AD
4182 ;;
4183 Directory)
b233458b
JH
4184 for fp in $gfpth; do
4185 if test "X$fp" = X.; then
f78bfc9c
JH
4186 dir="$ans"
4187 direxp="$ansexp"
b233458b 4188 else
dd858076 4189 dir="$fp/$ansexp"
f78bfc9c 4190 direxp="$fp/$ansexp"
b233458b 4191 fi
f78bfc9c 4192 if test -d "$direxp"; then
b233458b 4193 type=''
f78bfc9c 4194 value="$dir"
b233458b
JH
4195 break
4196 fi
4197 done
2304df62
AD
4198 ;;
4199 Locate)
40000a8c 4200 if test -d "$ansexp"; then
a0d0e21e
LW
4201 echo "(Looking for $loc_file in directory $value.)"
4202 value="$value/$loc_file"
40000a8c 4203 ansexp="$ansexp/$loc_file"
2304df62 4204 fi
40000a8c 4205 if test -f "$ansexp"; then
2304df62
AD
4206 type=''
4207 fi
a0d0e21e
LW
4208 case "$nopath_ok" in
4209 true) case "$value" in
4210 */*) ;;
4211 *) echo "Assuming $value will be in people's path."
4212 type=''
4213 ;;
4214 esac
4215 ;;
4216 esac
2304df62
AD
4217 ;;
4218 esac
4219
4220 case "$skip" in
4221 true) type='';
4222 esac
4223
4224 case "$type" in
4225 '') ;;
4226 *)
4227 if test "$fastread" = yes; then
4228 dflt=y
4229 else
4230 dflt=n
4231 fi
4232 rp="$what $value doesn't exist. Use that name anyway?"
4233 . UU/myread
4234 dflt=''
4235 case "$ans" in
4236 y*) type='';;
4237 *) echo " ";;
4238 esac
4239 ;;
4240 esac
4241 ;;
4242 esac
4243 ;;
4244 esac
4245done
4246cd UU
4247ans="$value"
4248rp="$orig_rp"
4249dflt="$orig_dflt"
ecfc5424 4250rm -f getfile.ok
b233458b 4251test "X$gfpthkeep" != Xy && gfpth=""
2304df62
AD
4252EOSC
4253
bd9b35c9
JH
4254: What should the include directory be ?
4255echo " "
4256$echo $n "Hmm... $c"
4257dflt='/usr/include'
4258incpath=''
4259mips_type=''
4260if $test -f /bin/mips && /bin/mips; then
4261 echo "Looks like a MIPS system..."
4262 $cat >usr.c <<'EOCP'
4263#ifdef SYSTYPE_BSD43
4264/bsd43
4265#endif
4266EOCP
8a27cf78 4267 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4268 dflt='/bsd43/usr/include'
4269 incpath='/bsd43'
4270 mips_type='BSD 4.3'
4271 else
4272 mips_type='System V'
4273 fi
4274 $rm -f usr.c usr.out
4275 echo "and you're compiling with the $mips_type compiler and libraries."
4276 xxx_prompt=y
4277 echo "exit 0" >mips
4278else
4279 echo "Doesn't look like a MIPS system."
4280 xxx_prompt=n
4281 echo "exit 1" >mips
4282fi
4283chmod +x mips
4284$eunicefix mips
4285case "$usrinc" in
4286'') ;;
4287*) dflt="$usrinc";;
4288esac
4289case "$xxx_prompt" in
4290y) fn=d/
4291 echo " "
4292 rp='Where are the include files you want to use?'
4293 . ./getfile
4294 usrinc="$ans"
8e07c86e 4295 ;;
bd9b35c9 4296*) usrinc="$dflt"
8e07c86e
AD
4297 ;;
4298esac
2304df62 4299
96056487
JH
4300: see how we invoke the C preprocessor
4301echo " "
4302echo "Now, how can we feed standard input to your C preprocessor..." >&4
4303cat <<'EOT' >testcpp.c
4304#define ABC abc
4305#define XYZ xyz
4306ABC.XYZ
4307EOT
4308cd ..
4309if test ! -f cppstdin; then
4310 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4311 # AIX cc -E doesn't show the absolute headerfile
4312 # locations but we'll cheat by using the -M flag.
4313 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
4314 else
4315 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4316 fi
4317else
4318 echo "Keeping your $hint cppstdin wrapper."
4319fi
4320chmod 755 cppstdin
4321wrapper=`pwd`/cppstdin
4322ok='false'
4323cd UU
4324
4325if $test "X$cppstdin" != "X" && \
4326 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4327 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4328then
4329 echo "You used to use $cppstdin $cppminus so we'll use that again."
4330 case "$cpprun" in
4331 '') echo "But let's see if we can live without a wrapper..." ;;
4332 *)
4333 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4334 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4335 then
4336 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4337 ok='true'
4338 else
4339 echo "(However, $cpprun $cpplast does not work, let's see...)"
4340 fi
4341 ;;
4342 esac
4343else
4344 case "$cppstdin" in
4345 '') ;;
4346 *)
4347 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4348 ;;
4349 esac
4350fi
4351
4352if $ok; then
4353 : nothing
4354elif echo 'Maybe "'"$cc"' -E" will work...'; \
4355 $cc -E <testcpp.c >testcpp.out 2>&1; \
4356 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4357 echo "Yup, it does."
4358 x_cpp="$cc -E"
4359 x_minus='';
4360elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4361 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4362 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4363 echo "Yup, it does."
4364 x_cpp="$cc -E"
4365 x_minus='-';
4366elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4367 $cc -P <testcpp.c >testcpp.out 2>&1; \
4368 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4369 echo "Yipee, that works!"
4370 x_cpp="$cc -P"
4371 x_minus='';
4372elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4373 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4374 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4375 echo "At long last!"
4376 x_cpp="$cc -P"
4377 x_minus='-';
4378elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4379 $cpp <testcpp.c >testcpp.out 2>&1; \
4380 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4381 echo "It works!"
4382 x_cpp="$cpp"
4383 x_minus='';
4384elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4385 $cpp - <testcpp.c >testcpp.out 2>&1; \
4386 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4387 echo "Hooray, it works! I was beginning to wonder."
4388 x_cpp="$cpp"
4389 x_minus='-';
4390elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4391 $wrapper <testcpp.c >testcpp.out 2>&1; \
4392 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4393 x_cpp="$wrapper"
4394 x_minus=''
4395 echo "Eureka!"
4396else
4397 dflt=''
4398 rp="No dice. I can't find a C preprocessor. Name one:"
4399 . ./myread
4400 x_cpp="$ans"
4401 x_minus=''
4402 $x_cpp <testcpp.c >testcpp.out 2>&1
4403 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4404 echo "OK, that will do." >&4
4405 else
4406echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4407 exit 1
4408 fi
4409fi
4410
4411case "$ok" in
4412false)
4413 cppstdin="$x_cpp"
4414 cppminus="$x_minus"
4415 cpprun="$x_cpp"
4416 cpplast="$x_minus"
4417 set X $x_cpp
4418 shift
4419 case "$1" in
4420 "$cpp")
4421 echo "Perhaps can we force $cc -E using a wrapper..."
4422 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4423 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4424 then
4425 echo "Yup, we can."
4426 cppstdin="$wrapper"
4427 cppminus='';
4428 else
4429 echo "Nope, we'll have to live without it..."
4430 fi
4431 ;;
4432 esac
4433 case "$cpprun" in
4434 "$wrapper")
4435 cpprun=''
4436 cpplast=''
4437 ;;
4438 esac
4439 ;;
4440esac
4441
4442case "$cppstdin" in
4443"$wrapper"|'cppstdin') ;;
4444*) $rm -f $wrapper;;
4445esac
4446$rm -f testcpp.c testcpp.out
4447
bd9b35c9
JH
4448: Set private lib path
4449case "$plibpth" in
4450'') if ./mips; then
4451 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4452 fi;;
4453esac
4454case "$libpth" in
4455' ') dlist='';;
4456'') dlist="$loclibpth $plibpth $glibpth";;
4457*) dlist="$libpth";;
4458esac
4459
4460: Now check and see which directories actually exist, avoiding duplicates
4461libpth=''
4462for xxx in $dlist
4463do
4464 if $test -d $xxx; then
4465 case " $libpth " in
4466 *" $xxx "*) ;;
4467 *) libpth="$libpth $xxx";;
4468 esac
4469 fi
4470done
4471$cat <<'EOM'
4472
4473Some systems have incompatible or broken versions of libraries. Among
4474the directories listed in the question below, please remove any you
4475know not to be holding relevant libraries, and add any that are needed.
4476Say "none" for none.
8e07c86e
AD
4477
4478EOM
bd9b35c9
JH
4479case "$libpth" in
4480'') dflt='none';;
8e07c86e 4481*)
bd9b35c9
JH
4482 set X $libpth
4483 shift
4484 dflt=${1+"$@"}
8e07c86e 4485 ;;
a0d0e21e 4486esac
bd9b35c9
JH
4487rp="Directories to use for library searches?"
4488. ./myread
4489case "$ans" in
4490none) libpth=' ';;
4491*) libpth="$ans";;
4492esac
a0d0e21e 4493
bd9b35c9
JH
4494: compute shared library extension
4495case "$so" in
4496'')
4497 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4498 dflt='sl'
dd4e71fd 4499 else
bd9b35c9 4500 dflt='so'
dd4e71fd
JH
4501 fi
4502 ;;
bd9b35c9 4503*) dflt="$so";;
dd4e71fd 4504esac
dd4e71fd
JH
4505$cat <<EOM
4506
bd9b35c9 4507On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4508you want to suppress searching of shared libraries for the remainder
bd9b35c9 4509of this configuration.
dd4e71fd
JH
4510
4511EOM
bd9b35c9
JH
4512rp='What is the file extension used for shared libraries?'
4513. ./myread
4514so="$ans"
dd4e71fd 4515
bd9b35c9
JH
4516: Define several unixisms.
4517: Hints files or command line option can be used to override them.
4518: The convoluted testing is in case hints files set either the old
4519: or the new name.
4520case "$_exe" in
4521'') case "$exe_ext" in
1fef16b3 4522 '') ;;
bd9b35c9 4523 *) _exe="$exe_ext" ;;
dd4e71fd 4524 esac
bd9b35c9 4525 ;;
bfb7748a 4526esac
bd9b35c9
JH
4527case "$_a" in
4528'') case "$lib_ext" in
4529 '') _a='.a';;
4530 *) _a="$lib_ext" ;;
dd4e71fd
JH
4531 esac
4532 ;;
dd4e71fd 4533esac
bd9b35c9
JH
4534case "$_o" in
4535'') case "$obj_ext" in
4536 '') _o='.o';;
4537 *) _o="$obj_ext";;
4538 esac
4539 ;;
4540esac
4541case "$p_" in
4542'') case "$path_sep" in
4543 '') p_=':';;
4544 *) p_="$path_sep";;
4545 esac
4546 ;;
4547esac
4548exe_ext=$_exe
4549lib_ext=$_a
4550obj_ext=$_o
4551path_sep=$p_
dd4e71fd 4552
b4eb6b3d
JH
4553: Which makefile gets called first. This is used by make depend.
4554case "$firstmakefile" in
4555'') firstmakefile='makefile';;
4633a7c4 4556esac
4633a7c4 4557
1f603089
JH
4558case "$ccflags" in
4559*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4560esac
4561
4562case "$uselongdouble" in
4563$define|true|[yY]*) dflt='y';;
4564*) dflt='n';;
4565esac
4566cat <<EOM
4567
4568Perl can be built to take advantage of long doubles which
4569(if available) may give more accuracy and range for floating point numbers.
4570
4571If this doesn't make any sense to you, just accept the default '$dflt'.
4572EOM
4573rp='Try to use long doubles if available?'
4574. ./myread
4575case "$ans" in
4576y|Y) val="$define" ;;
4577*) val="$undef" ;;
4578esac
4579set uselongdouble
4580eval $setvar
4581
4582case "$uselongdouble" in
4583true|[yY]*) uselongdouble="$define" ;;
4584esac
4585
1f603089
JH
4586: Look for a hint-file generated 'call-back-unit'. If the
4587: user has specified that long doubles should be used,
4588: we may need to set or change some other defaults.
9da7673b
MB
4589if $test -f uselongdouble.cbu; then
4590 echo "Your platform has some specific hints regarding long doubles, using them..."
4591 . ./uselongdouble.cbu
4592else
4593 case "$uselongdouble" in
4594 $define)
1f603089 4595 $cat <<EOM
9da7673b 4596(Your platform does not have any specific hints for long doubles.)
1f603089 4597EOM
1f603089 4598 ;;
9da7673b
MB
4599 esac
4600fi
1f603089 4601
bd9b35c9
JH
4602: Looking for optional libraries
4603echo " "
4604echo "Checking for optional libraries..." >&4
4605case "$libs" in
4606' '|'') dflt='';;
4607*) dflt="$libs";;
4608esac
4609case "$libswanted" in
4610'') libswanted='c_s';;
4611esac
4612case "$usesocks" in
923fc586 4613"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4614esac
68435ea7
JH
4615libsfound=''
4616libsfiles=''
4617libsdirs=''
13b3f787
JH
4618libspath=''
4619for thisdir in $libpth $xlibpth; do
4620 test -d $thisdir && libspath="$libspath $thisdir"
4621done
bd9b35c9 4622for thislib in $libswanted; do
13b3f787 4623 for thisdir in $libspath; do
f7dd4e7f
JH
4624 xxx=''
4625 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4626 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4627 $test -f "$xxx" && eval $libscheck
4628 $test -f "$xxx" && libstyle=shared
4629 fi
4630 if test ! -f "$xxx"; then
4631 xxx=$thisdir/lib$thislib.$so
4632 $test -f "$xxx" && eval $libscheck
4633 $test -f "$xxx" && libstyle=shared
4634 fi
4635 if test ! -f "$xxx"; then
4636 xxx=$thisdir/lib$thislib$_a
4637 $test -f "$xxx" && eval $libscheck
4638 $test -f "$xxx" && libstyle=static
4639 fi
4640 if test ! -f "$xxx"; then
4641 xxx=$thisdir/$thislib$_a
4642 $test -f "$xxx" && eval $libscheck
4643 $test -f "$xxx" && libstyle=static
4644 fi
4645 if test ! -f "$xxx"; then
4646 xxx=$thisdir/lib${thislib}_s$_a
4647 $test -f "$xxx" && eval $libscheck
4648 $test -f "$xxx" && libstyle=static
09ea5ba9 4649 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4650 fi
4651 if test ! -f "$xxx"; then
4652 xxx=$thisdir/Slib$thislib$_a
4653 $test -f "$xxx" && eval $libscheck
4654 $test -f "$xxx" && libstyle=static
4655 fi
4656 if $test -f "$xxx"; then
43999f95 4657 case "$libstyle" in
f7dd4e7f
JH
4658 shared) echo "Found -l$thislib (shared)." ;;
4659 static) echo "Found -l$thislib." ;;
4660 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4661 esac
bd9b35c9
JH
4662 case " $dflt " in
4663 *"-l$thislib "*);;
f7dd4e7f 4664 *) dflt="$dflt -l$thislib"
43999f95
JH
4665 libsfound="$libsfound $xxx"
4666 yyy=`basename $xxx`
4667 libsfiles="$libsfiles $yyy"
1e127011 4668 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4669 case " $libsdirs " in
4670 *" $yyy "*) ;;
4671 *) libsdirs="$libsdirs $yyy" ;;
4672 esac
4673 ;;
bd9b35c9 4674 esac
f7dd4e7f
JH
4675 break
4676 fi
4677 done
4678 if $test ! -f "$xxx"; then
4679 echo "No -l$thislib."
bd9b35c9
JH
4680 fi
4681done
4682set X $dflt
4683shift
4684dflt="$*"
4685case "$libs" in
4686'') dflt="$dflt";;
4687*) dflt="$libs";;
4688esac
4689case "$dflt" in
4690' '|'') dflt='none';;
4691esac
4633a7c4 4692
bd9b35c9 4693$cat <<EOM
4633a7c4 4694
bd9b35c9
JH
4695In order to compile $package on your machine, a number of libraries
4696are usually needed. Include any other special libraries here as well.
4697Say "none" for none. The default list is almost always right.
8e07c86e 4698EOM
8e07c86e 4699
bd9b35c9
JH
4700echo " "
4701rp="What libraries to use?"
4702. ./myread
4703case "$ans" in
4704none) libs=' ';;
4705*) libs="$ans";;
4706esac
d71b2b6b 4707
bd9b35c9
JH
4708: determine optimization, if desired, or use for debug flag also
4709case "$optimize" in
4710' '|$undef) dflt='none';;
4711'') dflt='-O';;
4712*) dflt="$optimize";;
4713esac
4714$cat <<EOH
d71b2b6b 4715
bd9b35c9
JH
4716By default, $package compiles with the -O flag to use the optimizer.
4717Alternately, you might want to use the symbolic debugger, which uses
4718the -g flag (on traditional Unix systems). Either flag can be
4719specified here. To use neither flag, specify the word "none".
d71b2b6b 4720
bd9b35c9
JH
4721EOH
4722rp="What optimizer/debugger flag should be used?"
4723. ./myread
4724optimize="$ans"
4725case "$optimize" in
4726'none') optimize=" ";;
4727esac
4728
4729dflt=''
4730: We will not override a previous value, but we might want to
4731: augment a hint file
4732case "$hint" in
4733default|recommended)
4734 case "$gccversion" in
4735 1*) dflt='-fpcc-struct-return' ;;
d71b2b6b 4736 esac
bd9b35c9
JH
4737 case "$optimize" in
4738 *-g*) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4739 esac
bd9b35c9
JH
4740 case "$gccversion" in
4741 2*) if test -d /etc/conf/kconfig.d &&
4742 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4743 then
00e89ad4 4744 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
4745 dflt="$dflt -posix"
4746 fi
f0d04425 4747 ;;
bd9b35c9
JH
4748 esac
4749 case "$gccversion" in
4750 1*) ;;
4751 2.[0-8]*) ;;
4752 ?*) echo " "
4753 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4754 echo 'int main(void) { return 0; }' > gcctest.c
4755 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4756 echo "Yes, it does." 2>&1
4757 case "$ccflags" in
00e89ad4 4758 *strict-aliasing*)
bd9b35c9
JH
4759 echo "Leaving current flags $ccflags alone." 2>&1
4760 ;;
4761 *) dflt="$dflt -fno-strict-aliasing" ;;
4762 esac
4763 else
4764 echo "Nope, it doesn't, but that's ok." 2>&1
4765 fi
f0d04425 4766 ;;
e5e20432 4767 esac
00e89ad4
AD
4768 # For gcc, adding -pipe speeds up compilations for some, but apparently
4769 # some assemblers can't read from stdin. (It also slows down compilations
4770 # in other cases, but those are apparently rarer these days.) AD 5/2004.
4771 case "$gccversion" in
4772 ?*) echo " "
4773 echo "Checking if your compiler accepts -pipe" 2>&1
4774 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 4775 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
4776 echo "Yes, it does." 2>&1
4777 case "$ccflags" in
4778 *-pipe*)
4779 echo "Leaving current flags $ccflags alone." 2>&1
4780 ;;
4781 *) dflt="$dflt -pipe" ;;
4782 esac
4783 else
4784 echo "Nope, it doesn't, but that's ok." 2>&1
4785 fi
6347b5be
SP
4786
4787 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4788 echo 'int main(void) { return 0; }' > gcctest.c
4789 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4790 echo "Yes, it does." 2>&1
4791 case "$ccflags" in
4792 *-Wdeclaration-after-statement*)
4793 echo "Leaving current flags $ccflags alone." 2>&1
4794 ;;
4795 *) dflt="$dflt -Wdeclaration-after-statement" ;;
4796 esac
4797 else
4798 echo "Nope, it doesn't, but that's ok." 2>&1
4799 fi
00e89ad4
AD
4800 ;;
4801 esac
e5e20432
JH
4802 ;;
4803esac
4804
bd9b35c9
JH
4805case "$mips_type" in
4806*BSD*|'') inclwanted="$locincpth $usrinc";;
4807*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4808esac
4809for thisincl in $inclwanted; do
4810 if $test -d $thisincl; then
4811 if $test x$thisincl != x$usrinc; then
4812 case "$dflt" in
00e89ad4
AD
4813 *" -I$thisincl "*);;
4814 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4815 esac
4816 fi
4817 fi
4818done
40a7a20a 4819
bd9b35c9
JH
4820inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4821 xxx=true;
4822elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4823 xxx=true;
4824else
4825 xxx=false;
4826fi;
4827if $xxx; then
4828 case "$dflt" in
4829 *$2*);;
4830 *) dflt="$dflt -D$2";;
4831 esac;
4832fi'
40a7a20a 4833
bd9b35c9 4834set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4835
bd9b35c9
JH
4836case "$usesocks" in
4837$define)
4838 ccflags="$ccflags -DSOCKS"
4839 ;;
4840esac
40a7a20a 4841
bd9b35c9
JH
4842case "$hint" in
4843default|recommended) dflt="$ccflags $dflt" ;;
4844*) dflt="$ccflags";;
4845esac
40a7a20a 4846
bd9b35c9
JH
4847case "$dflt" in
4848''|' ') dflt=none;;
4849esac
422af00a 4850
bd9b35c9 4851$cat <<EOH
40a7a20a 4852
bd9b35c9
JH
4853Your C compiler may want other flags. For this question you should include
4854-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4855but you should NOT include libraries or ld flags like -lwhatever. If you
4856want $package to honor its debug switch, you should include -DDEBUGGING here.
4857Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 4858
bd9b35c9 4859To use no flags, specify the word "none".
40a7a20a 4860
bd9b35c9
JH
4861EOH
4862set X $dflt
4863shift
4864dflt=${1+"$@"}
4865rp="Any additional cc flags?"
4866. ./myread
4867case "$ans" in
4868none) ccflags='';;
4869*) ccflags="$ans";;
4870esac
8e07c86e 4871
bd9b35c9 4872: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
4873case "$cppflags" in
4874'') cppflags="$ccflags" ;;
4875*) cppflags="$cppflags $ccflags" ;;
4876esac
bd9b35c9
JH
4877case "$gccversion" in
48781*) cppflags="$cppflags -D__GNUC__"
4633a7c4 4879esac
bd9b35c9
JH
4880case "$mips_type" in
4881'');;
4882*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4883esac
4884case "$cppflags" in
4885'');;
4886*)
4887 echo " "
4888 echo "Let me guess what the preprocessor flags are..." >&4
4889 set X $cppflags
4890 shift
4891 cppflags=''
4892 $cat >cpp.c <<'EOM'
4893#define BLURFL foo
8e07c86e 4894
bd9b35c9
JH
4895BLURFL xx LFRULB
4896EOM
4897 previous=''
4898 for flag in $*
4899 do
4900 case "$flag" in
4901 -*) ftry="$flag";;
4902 *) ftry="$previous $flag";;
4903 esac
4904 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4905 >cpp1.out 2>/dev/null && \
4906 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4907 >cpp2.out 2>/dev/null && \
4908 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4909 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4910 then
4911 cppflags="$cppflags $ftry"
4912 previous=''
4913 else
4914 previous="$flag"
4915 fi
4916 done
4917 set X $cppflags
4918 shift
4919 cppflags=${1+"$@"}
4920 case "$cppflags" in
4921 *-*) echo "They appear to be: $cppflags";;
4922 esac
4923 $rm -f cpp.c cpp?.out
2afac517 4924 ;;
4925esac
8e07c86e 4926
bd9b35c9
JH
4927: flags used in final linking phase
4928case "$ldflags" in
4929'') if ./venix; then
4930 dflt='-i -z'
10a23457 4931 else
bd9b35c9 4932 dflt=''
10a23457 4933 fi
bd9b35c9
JH
4934 case "$ccflags" in
4935 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 4936 esac
bd9b35c9
JH
4937 ;;
4938*) dflt="$ldflags";;
4939esac
4940
4941: Try to guess additional flags to pick up local libraries.
4942for thislibdir in $libpth; do
4943 case " $loclibpth " in
4944 *" $thislibdir "*)
00e89ad4 4945 case "$dflt " in
bd9b35c9
JH
4946 *"-L$thislibdir "*) ;;
4947 *) dflt="$dflt -L$thislibdir" ;;
4948 esac
c4f23d77
AD
4949 ;;
4950 esac
bd9b35c9 4951done
c4f23d77 4952
bd9b35c9
JH
4953case "$dflt" in
4954'') dflt='none' ;;
4955esac
c4f23d77 4956
bd9b35c9
JH
4957$cat <<EOH
4958
4959Your C linker may need flags. For this question you should
4960include -L/whatever and any other flags used by the C linker, but you
4961should NOT include libraries like -lwhatever.
4962
4963Make sure you include the appropriate -L/path flags if your C linker
4964does not normally search all of the directories you specified above,
4965namely
4966 $libpth
4967To use no flags, specify the word "none".
4968
4969EOH
4970
4971rp="Any additional ld flags (NOT including libraries)?"
4972. ./myread
4973case "$ans" in
4974none) ldflags='';;
4975*) ldflags="$ans";;
4976esac
4977rmlist="$rmlist pdp11"
4978
4979: coherency check
4980echo " "
4981echo "Checking your choice of C compiler and flags for coherency..." >&4
4982$cat > try.c <<'EOF'
4983#include <stdio.h>
55954f19 4984int main() { printf("Ok\n"); return(0); }
bd9b35c9 4985EOF
7a282f6d 4986set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
4987shift
4988$cat >try.msg <<'EOM'
4989I've tried to compile and run the following simple program:
4990
4991EOM
4992$cat try.c >> try.msg
4993
4994$cat >> try.msg <<EOM
4995
4996I used the command:
4997
4998 $*
5440bc8e 4999 $run ./try
bd9b35c9
JH
5000
5001and I got the following output:
5002
5003EOM
5004dflt=y
73614538 5005if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
5006 if $sh -c "$run ./try" >>try.msg 2>&1; then
5007 xxx=`$run ./try`
bd9b35c9
JH
5008 case "$xxx" in
5009 "Ok") dflt=n ;;
5010 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5011 case " $libs " in
5012 *" -lsfio "*)
5013 cat >> try.msg <<'EOQS'
5014If $libs contains -lsfio, and sfio is mis-configured, then it
5015sometimes (apparently) runs and exits with a 0 status, but with no
5016output! It may have to do with sfio's use of _exit vs. exit.
5017
5018EOQS
5019 rp="You have a big problem. Shall I abort Configure"
5020 dflt=y
5021 ;;
5022 esac
5023 ;;
5024 esac
5025 else
5026 echo "The program compiled OK, but exited with status $?." >>try.msg
5027 rp="You have a problem. Shall I abort Configure"
5028 dflt=y
5029 fi
5030else
5031 echo "I can't compile the test program." >>try.msg
5032 rp="You have a BIG problem. Shall I abort Configure"
5033 dflt=y
5034fi
5035case "$dflt" in
5036y)
5037 $cat try.msg >&4
5038 case "$knowitall" in
5039 '')
5040 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5041 ;;
bd9b35c9 5042 *) dflt=n;;
c4f23d77 5043 esac
bd9b35c9
JH
5044 echo " "
5045 . ./myread
5046 case "$ans" in
5047 n*|N*) ;;
5048 *) echo "Ok. Stopping Configure." >&4
5049 exit 1
c4f23d77
AD
5050 ;;
5051 esac
5052 ;;
bd9b35c9 5053n) echo "OK, that should do.";;
c4f23d77 5054esac
bd9b35c9 5055$rm -f try try.* core
c4f23d77 5056
bd9b35c9
JH
5057: define a shorthand compile call
5058compile='
5059mc_file=$1;
5060shift;
08413ebc 5061$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5062: define a shorthand compile call for compilations that should be ok.
5063compile_ok='
5064mc_file=$1;
5065shift;
7a282f6d 5066$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5067
8dfa8df9
JH
5068: determine filename position in cpp output
5069echo " "
5070echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5071case "$osname" in
5072vos) testaccess=-e ;;
5073*) testaccess=-r ;;
5074esac
8dfa8df9
JH
5075echo '#include <stdio.h>' > foo.c
5076$cat >fieldn <<EOF
5077$startsh
5078$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5079$grep '^[ ]*#.*stdio\.h' | \
5080while read cline; do
5081 pos=1
5082 set \$cline
5083 while $test \$# -gt 0; do
a5a94ea5 5084 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5085 echo "\$pos"
5086 exit 0
5087 fi
5088 shift
5089 pos=\`expr \$pos + 1\`
5090 done
5091done
5092EOF
5093chmod +x fieldn
5094fieldn=`./fieldn`
5095$rm -f foo.c fieldn
5096case $fieldn in
5097'') pos='???';;
50981) pos=first;;
50992) pos=second;;
51003) pos=third;;
5101*) pos="${fieldn}th";;
5102esac
5103echo "Your cpp writes the filename in the $pos field of the line."
5104
3c728e00
JH
5105case "$osname" in
5106vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5107os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5108*) cppfilter='' ;;
5109esac
8dfa8df9
JH
5110: locate header file
5111$cat >findhdr <<EOF
5112$startsh
5113wanted=\$1
5114name=''
5115for usrincdir in $usrinc
5116do
5117 if test -f \$usrincdir/\$wanted; then
5118 echo "\$usrincdir/\$wanted"
5119 exit 0
5120 fi
5121done
5122awkprg='{ print \$$fieldn }'
5123echo "#include <\$wanted>" > foo\$\$.c
5124$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5125$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5126while read cline; do
5127 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5128 case "\$name" in
5129 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5130 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5131 *) exit 2;;
5132 esac;
5133done;
5134#
5135# status = 0: grep returned 0 lines, case statement not executed
5136# status = 1: headerfile found
5137# status = 2: while loop executed, no headerfile found
5138#
5139status=\$?
5140$rm -f foo\$\$.c;
5141if test \$status -eq 1; then
5142 exit 0;
5143fi
5144exit 1
5145EOF
5146chmod +x findhdr
5147
5148: define an alternate in-header-list? function
5149inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5150cont=true; xxf="echo \"<\$1> found.\" >&4";
5151case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5152*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5153esac;
5154case $# in 4) instead=instead;; *) instead="at last";; esac;
5155while $test "$cont"; do
5156 xxx=`./findhdr $1`
5157 var=$2; eval "was=\$$2";
5158 if $test "$xxx" && $test -r "$xxx";
5159 then eval $xxf;
5160 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5161 cont="";
5162 else eval $xxnf;
5163 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5164 set $yyy; shift; shift; yyy=$@;
5165 case $# in 0) cont="";;
5166 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5167 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5168 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5169 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5170 esac;
5171done;
5172while $test "$yyy";
5173do set $yyy; var=$2; eval "was=\$$2";
5174 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5175 set $yyy; shift; shift; yyy=$@;
5176done'
5177
d1daaddf
JH
5178: see if stdlib is available
5179set stdlib.h i_stdlib
5180eval $inhdr
5181
5182: check for lengths of integral types
5183echo " "
5184case "$intsize" in
5185'')
5186 echo "Checking to see how big your integers are..." >&4
c63dfae1 5187 $cat >try.c <<EOCP
d1daaddf
JH
5188#include <stdio.h>
5189#$i_stdlib I_STDLIB
5190#ifdef I_STDLIB
5191#include <stdlib.h>
5192#endif
5193int main()
5194{
5195 printf("intsize=%d;\n", (int)sizeof(int));
5196 printf("longsize=%d;\n", (int)sizeof(long));
5197 printf("shortsize=%d;\n", (int)sizeof(short));
5198 exit(0);
5199}
5200EOCP
5201 set try
5202 if eval $compile_ok && $run ./try > /dev/null; then
5203 eval `$run ./try`
5204 echo "Your integers are $intsize bytes long."
5205 echo "Your long integers are $longsize bytes long."
5206 echo "Your short integers are $shortsize bytes long."
5207 else
5208 $cat >&4 <<EOM
5209!
5210Help! I can't compile and run the intsize test program: please enlighten me!
5211(This is probably a misconfiguration in your system or libraries, and
5212you really ought to fix it. Still, I'll try anyway.)
5213!
5214EOM
5215 dflt=4
5216 rp="What is the size of an integer (in bytes)?"
5217 . ./myread
5218 intsize="$ans"
5219 dflt=$intsize
5220 rp="What is the size of a long integer (in bytes)?"
5221 . ./myread
5222 longsize="$ans"
5223 dflt=2
5224 rp="What is the size of a short integer (in bytes)?"
5225 . ./myread
5226 shortsize="$ans"
5227 fi
5228 ;;
5229esac
5230$rm -f try try.*
5231
5232: check for long long
5233echo " "
5234echo "Checking to see if you have long long..." >&4
5235echo 'int main() { long long x = 7; return 0; }' > try.c
5236set try
5237if eval $compile; then
5238 val="$define"
5239 echo "You have long long."
5240else
5241 val="$undef"
5242 echo "You do not have long long."
5243fi
5244$rm try.*
5245set d_longlong
5246eval $setvar
5247
5248: check for length of long long
5249case "${d_longlong}${longlongsize}" in
5250$define)
5251 echo " "
5252 echo "Checking to see how big your long longs are..." >&4
5253 $cat >try.c <<'EOCP'
5254#include <stdio.h>
5255int main()
5256{
5257 printf("%d\n", (int)sizeof(long long));
5258 return(0);
5259}
5260EOCP
5261 set try
5262 if eval $compile_ok; then
5263 longlongsize=`$run ./try`
5264 echo "Your long longs are $longlongsize bytes long."
5265 else
5266 dflt='8'
5267 echo " "
5268 echo "(I can't seem to compile the test program. Guessing...)"
5269 rp="What is the size of a long long (in bytes)?"
5270 . ./myread
5271 longlongsize="$ans"
5272 fi
5273 if $test "X$longsize" = "X$longlongsize"; then
5274 echo "(That isn't any different from an ordinary long.)"
5275 fi
5276 ;;
5277esac
5278$rm -f try.* try
5279
8dfa8df9
JH
5280: see if inttypes.h is available
5281: we want a real compile instead of Inhdr because some systems
5282: have an inttypes.h which includes non-existent headers
5283echo " "
5284$cat >try.c <<EOCP
5285#include <inttypes.h>
5286int main() {
5287 static int32_t foo32 = 0x12345678;
5288}
5289EOCP
5290set try
5291if eval $compile; then
5292 echo "<inttypes.h> found." >&4
5293 val="$define"
5294else
5295 echo "<inttypes.h> NOT found." >&4
5296 val="$undef"
5297fi
5298$rm -f try.c try
5299set i_inttypes
5300eval $setvar
5301
5302: check for int64_t
5303echo " "
5304echo "Checking to see if you have int64_t..." >&4
5305$cat >try.c <<EOCP
5306#include <sys/types.h>
5307#$i_inttypes I_INTTYPES
5308#ifdef I_INTTYPES
5309#include <inttypes.h>
5310#endif
5311int main() { int64_t x = 7; }
5312EOCP
5313set try
5314if eval $compile; then
5315 val="$define"
5316 echo "You have int64_t."
5317else
5318 val="$undef"
5319 echo "You do not have int64_t."
5320fi
5321$rm -f try try.*
5322set d_int64_t
5323eval $setvar
5324
5325
5326echo " "
5327echo "Checking which 64-bit integer type we could use..." >&4
5328
5329case "$intsize" in
53308) val=int
5331 set quadtype
5332 eval $setvar
5333 val='"unsigned int"'
5334 set uquadtype
5335 eval $setvar
5336 quadkind=1
5337 ;;
5338*) case "$longsize" in
5339 8) val=long
5340 set quadtype
5341 eval $setvar
5342 val='"unsigned long"'
5343 set uquadtype
5344 eval $setvar
5345 quadkind=2
5346 ;;
5347 *) case "$d_longlong:$longlongsize" in
5348 define:8)
5349 val='"long long"'
5350 set quadtype
5351 eval $setvar
5352 val='"unsigned long long"'
5353 set uquadtype
5354 eval $setvar
5355 quadkind=3
5356 ;;
5357 *) case "$d_int64_t" in
5358 define)
5359 val=int64_t
5360 set quadtype
5361 eval $setvar
5362 val=uint64_t
5363 set uquadtype
5364 eval $setvar
5365 quadkind=4
5366 ;;
5367 esac
5368 ;;
5369 esac
5370 ;;
5371 esac
5372 ;;
5373esac
5374
5375case "$quadtype" in
5376'') echo "Alas, no 64-bit integer types in sight." >&4
5377 d_quad="$undef"
5378 ;;
5379*) echo "We could use '$quadtype' for 64-bit integers." >&4
5380 d_quad="$define"
5381 ;;
5382esac
5383
b4eb6b3d
JH
5384
5385case "$uselonglong" in
5386"$define"|true|[yY]*)
5387 cat <<EOM >&4
5388
5389*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5390EOM
5391 use64bitint="$define"
5392 ;;
5393esac
5394case "$use64bits" in
5395"$define"|true|[yY]*)
5396 cat <<EOM >&4
5397
5398*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5399EOM
5400 use64bitint="$define"
5401 ;;
5402esac
5403case "$use64bitints" in
5404"$define"|true|[yY]*)
5405 cat <<EOM >&4
5406
5407*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5408EOM
5409 use64bitint="$define"
5410 ;;
5411esac
5412case "$use64bitsint" in
5413"$define"|true|[yY]*)
5414 cat <<EOM >&4
5415
5416*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5417EOM
5418 use64bitint="$define"
5419 ;;
5420esac
5421case "$uselonglongs" in
5422"$define"|true|[yY]*)
5423 cat <<EOM >&4
5424
5425*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5426EOM
5427 use64bitint="$define"
5428 ;;
5429esac
5430case "$use64bitsall" in
5431"$define"|true|[yY]*)
5432 cat <<EOM >&4
5433
5434*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5435EOM
5436 use64bitall="$define"
5437 ;;
5438esac
5439
5440case "$ccflags" in
5441*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5442esac
5443case "$use64bitall" in
5444"$define"|true|[yY]*) use64bitint="$define" ;;
5445esac
5446
5447case "$longsize" in
54488) cat <<EOM
5449
5450You have natively 64-bit long integers.
5451EOM
5452 val="$define"
5453 ;;
5454*) case "$use64bitint" in
5455 "$define"|true|[yY]*) dflt='y';;
5456 *) dflt='n';;
5457 esac
8dfa8df9
JH
5458 case "$d_quad" in
5459 "$define") ;;
5460 *) dflt='n' ;;
5461 esac
b4eb6b3d
JH
5462 cat <<EOM
5463
5464Perl can be built to take advantage of 64-bit integer types
5465on some systems. To do so, Configure can be run with -Duse64bitint.
5466Choosing this option will most probably introduce binary incompatibilities.
5467
5468If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5469(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5470EOM
5471 rp='Try to use 64-bit integers, if available?'
5472 . ./myread
5473 case "$ans" in
5474 [yY]*) val="$define" ;;
5475 *) val="$undef" ;;
5476 esac
5477 ;;
5478esac
5479set use64bitint
5480eval $setvar
5481
5482case "$use64bitall" in
5483"$define"|true|[yY]*) dflt='y' ;;
5484*) case "$longsize" in
5485 8) dflt='y' ;;
5486 *) dflt='n' ;;
5487 esac
5488 ;;
5489esac
5490cat <<EOM
5491
5492You may also choose to try maximal 64-bitness. It means using as much
549364-bitness as possible on the platform. This in turn means even more
5494binary incompatibilities. On the other hand, your platform may not
5495have any more 64-bitness available than what you already have chosen.
5496
5497If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5498(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5499EOM
5500rp='Try to use maximal 64-bit support, if available?'
5501. ./myread
5502case "$ans" in
5503[yY]*) val="$define" ;;
5504*) val="$undef" ;;
5505esac
5506set use64bitall
5507eval $setvar
5508case "$use64bitall" in
5509"$define")
5510 case "$use64bitint" in
5511 "$undef")
5512 cat <<EOM
5513
5514Since you have chosen a maximally 64-bit build, I'm also turning on
5515the use of 64-bit integers.
5516EOM
5517 use64bitint="$define" ;;
5518 esac
5519 ;;
5520esac
5521
b4eb6b3d
JH
5522: Look for a hint-file generated 'call-back-unit'. If the
5523: user has specified that a 64-bit perl is to be built,
5524: we may need to set or change some other defaults.
19a100ff 5525if $test -f use64bitint.cbu; then
9da7673b 5526 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5527 . ./use64bitint.cbu
5528fi
9da7673b
MB
5529case "$use64bitint" in
5530"$define"|true|[yY]*)
b4eb6b3d
JH
5531 case "$longsize" in
5532 4) case "$archname64" in
5533 '') archname64=64int ;;
5534 esac
5535 ;;
5536 esac
5537 ;;
5538esac
5539
b4eb6b3d
JH
5540: Look for a hint-file generated 'call-back-unit'. If the
5541: user has specified that a maximally 64-bit perl is to be built,
5542: we may need to set or change some other defaults.
19a100ff 5543if $test -f use64bitall.cbu; then
9da7673b 5544 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5545 . ./use64bitall.cbu
5546fi
9da7673b
MB
5547case "$use64bitall" in
5548"$define"|true|[yY]*)
b4eb6b3d
JH
5549 case "$longsize" in
5550 4) case "$archname64" in
5551 ''|64int) archname64=64all ;;
5552 esac
5553 ;;
5554 esac
5555 ;;
5556esac
5557
1911a026
JH
5558case "$d_quad:$use64bitint" in
5559$undef:$define)
5560 cat >&4 <<EOF
5561
5562*** You have chosen to use 64-bit integers,
19a100ff 5563*** but none can be found.
09b58c7b 5564*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5565*** Cannot continue, aborting.
5566
5567EOF
5568 exit 1
5569 ;;
5570esac
5571
36adc09b
JH
5572: check for length of double
5573echo " "
5574case "$doublesize" in
5575'')
5576 echo "Checking to see how big your double precision numbers are..." >&4
5577 $cat >try.c <<EOCP
5578#include <stdio.h>
1911a026
JH
5579#$i_stdlib I_STDLIB
5580#ifdef I_STDLIB
5581#include <stdlib.h>
5582#endif
36adc09b
JH
5583int main()
5584{
5585 printf("%d\n", (int)sizeof(double));
1911a026 5586 exit(0);
36adc09b
JH
5587}
5588EOCP
5589 set try
5590 if eval $compile_ok; then
5591 doublesize=`$run ./try`
5592 echo "Your double is $doublesize bytes long."
5593 else
5594 dflt='8'
5595 echo "(I can't seem to compile the test program. Guessing...)"
5596 rp="What is the size of a double precision number (in bytes)?"
5597 . ./myread
5598 doublesize="$ans"
5599 fi
5600 ;;
5601esac
5602$rm -f try.c try
5603
5604: check for long doubles
5605echo " "
5606echo "Checking to see if you have long double..." >&4
5607echo 'int main() { long double x = 7.0; }' > try.c
5608set try
5609if eval $compile; then
5610 val="$define"
5611 echo "You have long double."
5612else
5613 val="$undef"
5614 echo "You do not have long double."
5615fi
5616$rm try.*
5617set d_longdbl
5618eval $setvar
5619
5620: check for length of long double
5621case "${d_longdbl}${longdblsize}" in
5622$define)
5623 echo " "
5624 echo "Checking to see how big your long doubles are..." >&4
5625 $cat >try.c <<'EOCP'
5626#include <stdio.h>
5627int main()
5628{
5629 printf("%d\n", sizeof(long double));
5630}
5631EOCP
5632 set try
5633 set try
5634 if eval $compile; then
5635 longdblsize=`$run ./try`
5636 echo "Your long doubles are $longdblsize bytes long."
5637 else
5638 dflt='8'
5639 echo " "
5640 echo "(I can't seem to compile the test program. Guessing...)" >&4
5641 rp="What is the size of a long double (in bytes)?"
5642 . ./myread
5643 longdblsize="$ans"
5644 fi
5645 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5646 echo "That isn't any different from an ordinary double."
5647 echo "I'll keep your setting anyway, but you may see some"
5648 echo "harmless compilation warnings."
36adc09b
JH
5649 fi
5650 ;;
5651esac
5652$rm -f try.* try
5653
89ce900e 5654: determine the architecture name
b4eb6b3d 5655echo " "
89ce900e
JH
5656if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5657 tarch=`arch`"-$osname"
5658elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5659 if uname -m > tmparch 2>&1 ; then
5660 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5661 -e 's/$/'"-$osname/" tmparch`
5662 else
5663 tarch="$osname"
5664 fi
5665 $rm -f tmparch
b4eb6b3d 5666else
89ce900e 5667 tarch="$osname"
b4eb6b3d 5668fi
89ce900e
JH
5669case "$myarchname" in
5670''|"$tarch") ;;
5671*)
5672 echo "(Your architecture name used to be $myarchname.)"
5673 archname=''
5674 ;;
5675esac
5676case "$targetarch" in
5677'') ;;
5678*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5679esac
5680myarchname="$tarch"
5681case "$archname" in
5682'') dflt="$tarch";;
5683*) dflt="$archname";;
5684esac
5685rp='What is your architecture name'
5686. ./myread
5687archname="$ans"
5688case "$usethreads" in
5689$define)
5690 echo "Threads selected." >&4
5691 case "$archname" in
5692 *-thread*) echo "...and architecture name already has -thread." >&4
5693 ;;
5694 *) archname="$archname-thread"
5695 echo "...setting architecture name to $archname." >&4
5696 ;;
5697 esac
5698 ;;
5699esac
5700case "$usemultiplicity" in
5701$define)
5702 echo "Multiplicity selected." >&4
5703 case "$archname" in
5704 *-multi*) echo "...and architecture name already has -multi." >&4
5705 ;;
5706 *) archname="$archname-multi"
5707 echo "...setting architecture name to $archname." >&4
5708 ;;
5709 esac
5710 ;;
5711esac
5712case "$use64bitint$use64bitall" in
5713*"$define"*)
5714 case "$archname64" in
5715 '')
5716 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5717 ;;
89ce900e
JH
5718 *)
5719 case "$use64bitint" in
5720 "$define") echo "64 bit integers selected." >&4 ;;
5721 esac
5722 case "$use64bitall" in
5723 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5724 esac
5725 case "$archname" in
5726 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5727 ;;
5728 *) archname="$archname-$archname64"
5729 echo "...setting architecture name to $archname." >&4
5730 ;;
5731 esac
c1a7f87b
JH
5732 ;;
5733 esac
89ce900e
JH
5734esac
5735case "$uselongdouble" in
5736$define)
5737 echo "Long doubles selected." >&4
5738 case "$longdblsize" in
5739 $doublesize)
5740 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5741 ;;
5742 *)
5743 case "$archname" in
5744 *-ld*) echo "...and architecture name already has -ld." >&4
5745 ;;
5746 *) archname="$archname-ld"
5747 echo "...setting architecture name to $archname." >&4
5748 ;;
5749 esac
bd9b35c9
JH
5750 ;;
5751 esac
bd9b35c9 5752 ;;
89ce900e
JH
5753esac
5754case "$useperlio" in
5755$define)
5756 echo "Perlio selected." >&4
5757 ;;
bd9b35c9 5758*)
89ce900e
JH
5759 echo "Perlio not selected, using stdio." >&4
5760 case "$archname" in
5761 *-stdio*) echo "...and architecture name already has -stdio." >&4
5762 ;;
5763 *) archname="$archname-stdio"
5764 echo "...setting architecture name to $archname." >&4
5765 ;;
5766 esac
bd9b35c9
JH
5767 ;;
5768esac
d2e0c6f7
JH
5769if $test -f archname.cbu; then
5770 echo "Your platform has some specific hints for architecture name, using them..."
5771 . ./archname.cbu
5772fi
bd9b35c9 5773
89ce900e
JH
5774: determine root of directory hierarchy where package will be installed.
5775case "$prefix" in
5776'')
5777 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5778 ;;
5779*?/)
5780 dflt=`echo "$prefix" | sed 's/.$//'`
5781 ;;
5782*)
5783 dflt="$prefix"
5784 ;;
5785esac
5786$cat <<EOM
c1a7f87b 5787
89ce900e
JH
5788By default, $package will be installed in $dflt/bin, manual pages
5789under $dflt/man, etc..., i.e. with $dflt as prefix for all
5790installation directories. Typically this is something like /usr/local.
5791If you wish to have binaries under /usr/bin but other parts of the
5792installation under /usr/local, that's ok: you will be prompted
5793separately for each of the installation directories, the prefix being
5794only used to set the defaults.
bd9b35c9
JH
5795
5796EOM
89ce900e
JH
5797fn=d~
5798rp='Installation prefix to use?'
5799. ./getfile
5800oldprefix=''
5801case "$prefix" in
5802'') ;;
5803*)
5804 case "$ans" in
5805 "$prefix") ;;
5806 *) oldprefix="$prefix";;
5807 esac
5808 ;;
bd9b35c9 5809esac
89ce900e
JH
5810prefix="$ans"
5811prefixexp="$ansexp"
bd9b35c9 5812
89ce900e
JH
5813case "$afsroot" in
5814'') afsroot=/afs ;;
5815*) afsroot=$afsroot ;;
8e07c86e 5816esac
29209bc5 5817
89ce900e
JH
5818: is AFS running?
5819echo " "
5820case "$afs" in
5821$define|true) afs=true ;;
5822$undef|false) afs=false ;;
5823*) if test -d $afsroot; then
5824 afs=true
c1a7f87b 5825 else
89ce900e
JH
5826 afs=false
5827 fi
5828 ;;
c1a7f87b 5829esac
89ce900e
JH
5830if $afs; then
5831 echo "AFS may be running... I'll be extra cautious then..." >&4
5832else
5833 echo "AFS does not seem to be running..." >&4
5834fi
b4eb6b3d
JH
5835
5836: determine installation prefix for where package is to be installed.
5837if $afs; then
5838$cat <<EOM
5839
5840Since you are running AFS, I need to distinguish the directory in which
5841files will reside from the directory in which they are installed (and from
5842which they are presumably copied to the former directory by occult means).
5843
5844EOM
5845 case "$installprefix" in
5846 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5847 *) dflt="$installprefix";;
5848 esac
5849else
5850$cat <<EOM
5851
5852In some special cases, particularly when building $package for distribution,
c2bfb7b1
MB
5853it is convenient to distinguish the directory in which files should be
5854installed from the directory ($prefix) in which they will
5855eventually reside. For most users, these two directories are the same.
b4eb6b3d
JH
5856
5857EOM
5858 case "$installprefix" in
5859 '') dflt=$prefix ;;
5860 *) dflt=$installprefix;;
5861 esac
5862fi
5863fn=d~
5864rp='What installation prefix should I use for installing files?'
5865. ./getfile
5866installprefix="$ans"
5867installprefixexp="$ansexp"
5868
5869: set the prefixit variable, to compute a suitable default value
5870prefixit='case "$3" in
5871""|none)
5872 case "$oldprefix" in
5873 "") eval "$1=\"\$$2\"";;
5874 *)
5875 case "$3" in
5876 "") eval "$1=";;
5877 none)
5878 eval "tp=\"\$$2\"";
5879 case "$tp" in
5880 ""|" ") eval "$1=\"\$$2\"";;
5881 *) eval "$1=";;
5882 esac;;
5883 esac;;
5884 esac;;
5885*)
5886 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5887 case "$tp" in
5888 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5889 /*-$oldprefix/*|\~*-$oldprefix/*)
5890 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5891 *) eval "$1=\"\$$2\"";;
5892 esac;;
5893esac'
5894
b4eb6b3d
JH
5895: get the patchlevel
5896echo " "
5897echo "Getting the current patchlevel..." >&4
5898if $test -r $rsrc/patchlevel.h;then
5899 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5900 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5901 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5902 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5903 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5904 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
35918792 5905 perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
b4eb6b3d
JH
5906else
5907 revision=0
5908 patchlevel=0
5909 subversion=0
5910 api_revision=0
5911 api_version=0
5912 api_subversion=0
151e6568
MB
5913 perl_patchlevel=0
5914 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 5915fi
35918792
YST
5916if $test -r $rsrc/.patch ; then
5917 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
151e6568
MB
5918 perl_patchlevel=`cat $rsrc/.patch`
5919 fi
5920fi
861eb78d
AD
5921: Define a handy string here to avoid duplication in myconfig.SH and configpm.
5922version_patchlevel_string="version $patchlevel subversion $subversion"
151e6568 5923case "$perl_patchlevel" in
861eb78d
AD
59240|'') ;;
5925*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
151e6568 5926esac
861eb78d
AD
5927
5928$echo "(You have $package $version_patchlevel_string.)"
5929
b4eb6b3d
JH
5930case "$osname" in
5931dos|vms)
5932 : XXX Should be a Configure test for double-dots in filenames.
5933 version=`echo $revision $patchlevel $subversion | \
5934 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5935 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5936 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5937 ;;
5938*)
5939 version=`echo $revision $patchlevel $subversion | \
5940 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5941 api_versionstring=`echo $api_revision $api_version $api_subversion | \
5942 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5943 ;;
5944esac
5945: Special case the 5.005_xx maintenance series, which used 5.005
5946: without any subversion label as a subdirectory in $sitelib
5947if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5948 api_versionstring='5.005'
5949fi
5950
5951: determine installation style
5952: For now, try to deduce it from prefix unless it is already set.
5953: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5954case "$installstyle" in
5955'') case "$prefix" in
5956 *perl*) dflt='lib';;
5957 *) dflt='lib/perl5' ;;
5958 esac
5959 ;;
5960*) dflt="$installstyle" ;;
5961esac
5962: Probably not worth prompting for this since we prompt for all
5963: the directories individually, and the prompt would be too long and
5964: confusing anyway.
5965installstyle=$dflt
5966
5967: determine where private library files go
5968: Usual default is /usr/local/lib/perl5/$version.
5969: Also allow things like /opt/perl/lib/$version, since
5970: /opt/perl/lib/perl5... would be redundant.
5971: The default "style" setting is made in installstyle.U
5972case "$installstyle" in
5973*lib/perl5*) set dflt privlib lib/$package/$version ;;
5974*) set dflt privlib lib/$version ;;
5975esac
5976eval $prefixit
5977$cat <<EOM
5978
5979There are some auxiliary files for $package that need to be put into a
5980private library directory that is accessible by everyone.
5981
5982EOM
5983fn=d~+
5984rp='Pathname where the private library files will reside?'
5985. ./getfile
5986privlib="$ans"
5987privlibexp="$ansexp"
5988: Change installation prefix, if necessary.
5989if $test X"$prefix" != X"$installprefix"; then
5990 installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5991else
5992 installprivlib="$privlibexp"
5993fi
5994
5995: set the prefixup variable, to restore leading tilda escape
5996prefixup='case "$prefixexp" in
5997"$prefix") ;;
5998*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5999esac'
6000
6001: determine where public architecture dependent libraries go
6002set archlib archlib
6003eval $prefixit
6004: privlib default is /usr/local/lib/$package/$version
6005: archlib default is /usr/local/lib/$package/$version/$archname
6006: privlib may have an optional trailing /share.
6007tdflt=`echo $privlib | $sed 's,/share$,,'`
6008tdflt=$tdflt/$archname
6009case "$archlib" in
6010'') dflt=$tdflt
6011 ;;
6012*) dflt="$archlib"
6013 ;;
6014esac
6015$cat <<EOM
6016
6017$spackage contains architecture-dependent library files. If you are
6018sharing libraries in a heterogeneous environment, you might store
6019these files in a separate location. Otherwise, you can just include
6020them with the rest of the public library files.
6021
6022EOM
6023fn=d+~
6024rp='Where do you want to put the public architecture-dependent libraries?'
6025. ./getfile
6026archlib="$ans"
6027archlibexp="$ansexp"
6028if $test X"$archlib" = X"$privlib"; then
6029 d_archlib="$undef"
6030else
6031 d_archlib="$define"
6032fi
6033: Change installation prefix, if necessary.
6034if $test X"$prefix" != X"$installprefix"; then
6035 installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6036else
6037 installarchlib="$archlibexp"
6038fi
6039
b4eb6b3d
JH
6040: see if setuid scripts can be secure
6041$cat <<EOM
6042
6043Some kernels have a bug that prevents setuid #! scripts from being
6044secure. Some sites have disabled setuid #! scripts because of this.
6045
6046First let's decide if your kernel supports secure setuid #! scripts.
6047(If setuid #! scripts would be secure but have been disabled anyway,
6048don't say that they are secure if asked.)
6049
6050EOM
6051
6052val="$undef"
6053if $test -d /dev/fd; then
6054 echo "#!$ls" >reflect
6055 chmod +x,u+s reflect
6056 ./reflect >flect 2>&1
6057 if $contains "/dev/fd" flect >/dev/null; then
6058 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6059 val="$define"
6060 else
6061 $cat <<EOM
6062If you are not sure if they are secure, I can check but I'll need a
6063username and password different from the one you are using right now.
6064If you don't have such a username or don't want me to test, simply
6065enter 'none'.
6066
6067EOM
6068 rp='Other username to test security of setuid scripts with?'
6069 dflt='none'
6070 . ./myread
6071 case "$ans" in
6072 n|none)
6073 case "$d_suidsafe" in
6074 '') echo "I'll assume setuid scripts are *not* secure." >&4
6075 dflt=n;;
6076 "$undef")
6077 echo "Well, the $hint value is *not* secure." >&4
6078 dflt=n;;
6079 *) echo "Well, the $hint value *is* secure." >&4
6080 dflt=y;;
6081 esac
c1a7f87b 6082 ;;
b4eb6b3d
JH
6083 *)
6084 $rm -f reflect flect
6085 echo "#!$ls" >reflect
6086 chmod +x,u+s reflect
6087 echo >flect
6088 chmod a+w flect
6089 echo '"su" will (probably) prompt you for '"$ans's password."
6090 su $ans -c './reflect >flect'
6091 if $contains "/dev/fd" flect >/dev/null; then
6092 echo "Okay, it looks like setuid scripts are secure." >&4
6093 dflt=y
6094 else
6095 echo "I don't think setuid scripts are secure." >&4
6096 dflt=n
6097 fi
6098 ;;
6099 esac
6100 rp='Does your kernel have *secure* setuid scripts?'
6101 . ./myread
6102 case "$ans" in
6103 [yY]*) val="$define";;
6104 *) val="$undef";;
6105 esac
6106 fi
6107else
6108 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6109 echo "(That's for file descriptors, not floppy disks.)"
6110 val="$undef"
6111fi
6112set d_suidsafe
6113eval $setvar
6114
6115$rm -f reflect flect
6116
6117: now see if they want to do setuid emulation
6118echo " "
6119val="$undef"
6120case "$d_suidsafe" in
6121"$define")
6122 val="$undef"
3c728e00 6123 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d
JH
6124 ;;
6125*)
6126 $cat <<EOM
6127Some systems have disabled setuid scripts, especially systems where
6128setuid scripts cannot be secure. On systems where setuid scripts have
6129been disabled, the setuid/setgid bits on scripts are currently
6130useless. It is possible for $package to detect those bits and emulate
6131setuid/setgid in a secure fashion. This emulation will only work if
6132setuid scripts have been disabled in your kernel.
6133
6134EOM
6135 case "$d_dosuid" in
6136 "$define") dflt=y ;;
6137 *) dflt=n ;;
6138 esac
6139 rp="Do you want to do setuid/setgid emulation?"
6140 . ./myread
6141 case "$ans" in
6142 [yY]*) val="$define";;
6143 *) val="$undef";;
6144 esac
6145 ;;
6146esac
6147set d_dosuid
6148eval $setvar
6149
b4eb6b3d 6150: see if this is a malloc.h system
01d07975
YST
6151: we want a real compile instead of Inhdr because some systems have a
6152: malloc.h that just gives a compile error saying to use stdlib.h instead
6153echo " "
6154$cat >try.c <<EOCP
6155#include <stdlib.h>
6156#include <malloc.h>
6157int main () { return 0; }
6158EOCP
6159set try
6160if eval $compile; then
6161 echo "<malloc.h> found." >&4
6162 val="$define"
6163else
6164 echo "<malloc.h> NOT found." >&4
6165 val="$undef"
6166fi
6167$rm -f try.c try
6168set i_malloc
6169eval $setvar
b4eb6b3d 6170
c8b93cf9
JH
6171: check for void type
6172echo " "
6173echo "Checking to see how well your C compiler groks the void type..." >&4
6174case "$voidflags" in
6175'')
c727eafa 6176 $cat >try.c <<EOCP
d1daaddf
JH
6177#$i_stdlib I_STDLIB
6178#ifdef I_STDLIB
6179#include <stdlib.h>
6180#endif
c8b93cf9
JH
6181#if TRY & 1
6182void sub() {
6183#else
6184sub() {
6185#endif
6186 extern void moo(); /* function returning void */
6187 void (*goo)(); /* ptr to func returning void */
6188#if TRY & 8
6189 void *hue; /* generic ptr */
6190#endif
6191#if TRY & 2
6192 void (*foo[10])();
6193#endif
6194
6195#if TRY & 4
6196 if(goo == moo) {
6197 exit(0);
6198 }
6199#endif
6200 exit(0);
6201}
6202int main() { sub(); }
6203EOCP
6204 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6205 voidflags=$defvoidused
6206 echo "Good. It appears to support void to the level $package wants.">&4
6207 if $contains warning .out >/dev/null 2>&1; then
6208 echo "However, you might get some warnings that look like this:"
6209 $cat .out
6210 fi
6211 else
6212echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6213 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6214 echo "It supports 1..."
6215 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6216 echo "It also supports 2..."
6217 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6218 voidflags=7
6219 echo "And it supports 4 but not 8 definitely."
6220 else
6221 echo "It doesn't support 4..."
6222 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6223 voidflags=11
6224 echo "But it supports 8."
6225 else
6226 voidflags=3
6227 echo "Neither does it support 8."
6228 fi
6229 fi
6230 else
6231 echo "It does not support 2..."
6232 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6233 voidflags=13
6234 echo "But it supports 4 and 8."
6235 else
6236 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6237 voidflags=5
6238 echo "And it supports 4 but has not heard about 8."
6239 else
6240 echo "However it supports 8 but not 4."
6241 fi
6242 fi
6243 fi
6244 else
6245 echo "There is no support at all for void."
6246 voidflags=0
6247 fi
6248 fi
6249esac
6250case "$voidflags" in
6251"$defvoidused") ;;
6252*) $cat >&4 <<'EOM'
6253 Support flag bits are:
6254 1: basic void declarations.
6255 2: arrays of pointers to functions returning void.
6256 4: operations between pointers to and addresses of void functions.
6257 8: generic void pointers.
6258EOM
6259 dflt="$voidflags";
6260 rp="Your void support flags add up to what?"
6261 . ./myread
6262 voidflags="$ans"
6263 ;;
6264esac
6265$rm -f try.* .out
6266
6267: check for length of pointer
6268echo " "
6269case "$ptrsize" in
6270'')
6271 echo "Checking to see how big your pointers are..." >&4
6272 if test "$voidflags" -gt 7; then
6273 echo '#define VOID_PTR char *' > try.c
6274 else
6275 echo '#define VOID_PTR void *' > try.c
6276 fi
74d00865 6277 $cat >>try.c <<EOCP
c8b93cf9 6278#include <stdio.h>
d1daaddf
JH
6279#$i_stdlib I_STDLIB
6280#ifdef I_STDLIB
6281#include <stdlib.h>
6282#endif
c8b93cf9
JH
6283int main()
6284{
6285 printf("%d\n", (int)sizeof(VOID_PTR));
6286 exit(0);
6287}
6288EOCP
6289 set try
6290 if eval $compile_ok; then
6291 ptrsize=`$run ./try`
6292 echo "Your pointers are $ptrsize bytes long."
6293 else
6294 dflt='4'
6295 echo "(I can't seem to compile the test program. Guessing...)" >&4
6296 rp="What is the size of a pointer (in bytes)?"
6297 . ./myread
6298 ptrsize="$ans"
6299 fi
6300 ;;
6301esac
6302$rm -f try.c try
6303case "$use64bitall" in
6304"$define"|true|[yY]*)
6305 case "$ptrsize" in
6306 4) cat <<EOM >&4
6307
1911a026
JH
6308*** You have chosen a maximally 64-bit build,
6309*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6310*** Please rerun Configure without -Duse64bitall.
6311EOM
6312 case "$d_quad" in
6313 define)
6314 cat <<EOM >&4
6315*** Since you have quads, you could possibly try with -Duse64bitint.
6316EOM
6317 ;;
6318 esac
6319 cat <<EOM >&4
1911a026 6320*** Cannot continue, aborting.
c8b93cf9
JH
6321
6322EOM
09b58c7b 6323
1911a026 6324 exit 1
c8b93cf9
JH
6325 ;;
6326 esac
6327 ;;
6328esac
6329
19a100ff 6330
9df442c2
NC
6331: determine whether to use malloc wrapping
6332echo " "
6333case "$usemallocwrap" in
6334[yY]*|true|$define) dflt='y' ;;
6335[nN]*|false|$undef) dflt='n' ;;
6336*) case "$usedevel" in
6337 [yY]*|true|$define) dflt='y' ;;
6338 *) dflt='n' ;;
6339 esac
6340 ;;
6341esac
6342rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6343. ./myread
6344usemallocwrap="$ans"
6345case "$ans" in
6346y*|true)
6347 usemallocwrap="$define" ;;
6348*)
6349 usemallocwrap="$undef" ;;
6350esac
c8b93cf9 6351
b4eb6b3d
JH
6352: determine which malloc to compile in
6353echo " "
6354case "$usemymalloc" in
c4163172
JH
6355[yY]*|true|$define) dflt='y' ;;
6356[nN]*|false|$undef) dflt='n' ;;
6357*) case "$ptrsize" in
6358 4) dflt='y' ;;
6359 *) dflt='n' ;;
6360 esac
6361 ;;
8dfa8df9 6362esac
b4eb6b3d
JH
6363rp="Do you wish to attempt to use the malloc that comes with $package?"
6364. ./myread
6365usemymalloc="$ans"
6366case "$ans" in
6367y*|true)
6368 usemymalloc='y'
6369 mallocsrc='malloc.c'
6370 mallocobj="malloc$_o"
6371 d_mymalloc="$define"
6372 case "$libs" in
6373 *-lmalloc*)
6374 : Remove malloc from list of libraries to use
6375 echo "Removing unneeded -lmalloc from library list" >&4
6376 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6377 shift
6378 libs="$*"
6379 echo "libs = $libs" >&4
6380 ;;
6381 esac
6382 ;;
6383*)
6384 usemymalloc='n'
6385 mallocsrc=''
6386 mallocobj=''
6387 d_mymalloc="$undef"
6388 ;;
6389esac
6390
6391: compute the return types of malloc and free
6392echo " "
6393$cat >malloc.c <<END
6394#$i_malloc I_MALLOC
6395#$i_stdlib I_STDLIB
6396#include <stdio.h>
6397#include <sys/types.h>
6398#ifdef I_MALLOC
6399#include <malloc.h>
6400#endif
6401#ifdef I_STDLIB
6402#include <stdlib.h>
6403#endif
6404#ifdef TRY_MALLOC
6405void *malloc();
6406#endif
6407#ifdef TRY_FREE
6408void free();
6409#endif
6410END
6411case "$malloctype" in
6412'')
6413 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6414 malloctype='void *'
6415 else
6416 malloctype='char *'
6417 fi
6418 ;;
6419esac
6420echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6421
6422case "$freetype" in
6423'')
6424 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6425 freetype='void'
6426 else
6427 freetype='int'
6428 fi
6429 ;;
6430esac
6431echo "Your system uses $freetype free(), it would seem." >&4
6432$rm -f malloc.[co]
6433$cat <<EOM
6434
6435After $package is installed, you may wish to install various
6436add-on modules and utilities. Typically, these add-ons will
6437be installed under $prefix with the rest
6438of this package. However, you may wish to install such add-ons
6439elsewhere under a different prefix.
6440
6441If you do not wish to put everything under a single prefix, that's
6442ok. You will be prompted for the individual locations; this siteprefix
6443is only used to suggest the defaults.
6444
6445The default should be fine for most people.
6446
6447EOM
6448fn=d~+
6449rp='Installation prefix to use for add-on modules and utilities?'
6450: XXX Here might be another good place for an installstyle setting.
6451case "$siteprefix" in
6452'') dflt=$prefix ;;
6453*) dflt=$siteprefix ;;
6454esac
6455. ./getfile
6456: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6457oldsiteprefix=''
6458case "$siteprefix" in
6459'') ;;
6460*) case "$ans" in
6461 "$prefix") ;;
6462 *) oldsiteprefix="$prefix";;
6463 esac
6464 ;;
6465esac
6466siteprefix="$ans"
6467siteprefixexp="$ansexp"
6468
6469: determine where site specific libraries go.
6470: Usual default is /usr/local/lib/perl5/site_perl/$version
6471: The default "style" setting is made in installstyle.U
6472: XXX No longer works with Prefixit stuff.
6473prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6474case "$sitelib" in
6475'') case "$installstyle" in
6476 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6477 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6478 esac
6479 ;;
6480*) dflt="$sitelib"
6481 ;;
6482esac
6483$cat <<EOM
6484
6485The installation process will create a directory for
6486site-specific extensions and modules. Most users find it convenient
6487to place all site-specific files in this directory rather than in the
6488main distribution directory.
6489
6490EOM
6491fn=d~+
6492rp='Pathname for the site-specific library files?'
6493. ./getfile
6494sitelib="$ans"
6495sitelibexp="$ansexp"
6496sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6497: Change installation prefix, if necessary.
6498if $test X"$prefix" != X"$installprefix"; then
6499 installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6500else
6501 installsitelib="$sitelibexp"
6502fi
6503
6504: determine where site specific architecture-dependent libraries go.
6505: sitelib default is /usr/local/lib/perl5/site_perl/$version
6506: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6507: sitelib may have an optional trailing /share.
6508case "$sitearch" in
6509'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6510 dflt="$dflt/$archname"
6511 ;;
6512*) dflt="$sitearch"
6513 ;;
6514esac
6515set sitearch sitearch none
6516eval $prefixit
6517$cat <<EOM
6518
6519The installation process will also create a directory for
6520architecture-dependent site-specific extensions and modules.
6521
6522EOM
6523fn=d~+
6524rp='Pathname for the site-specific architecture-dependent library files?'
6525. ./getfile
6526sitearch="$ans"
6527sitearchexp="$ansexp"
6528: Change installation prefix, if necessary.
6529if $test X"$prefix" != X"$installprefix"; then
6530 installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6531else
6532 installsitearch="$sitearchexp"
6533fi
6534
6535$cat <<EOM
6536
6537The installation process will also create a directory for
6538vendor-supplied add-ons. Vendors who supply perl with their system
6539may find it convenient to place all vendor-supplied files in this
6540directory rather than in the main distribution directory. This will
6541ease upgrades between binary-compatible maintenance versions of perl.
6542
6543Of course you may also use these directories in whatever way you see
6544fit. For example, you might use them to access modules shared over a
6545company-wide network.
6546
6547The default answer should be fine for most people.
6548This causes further questions about vendor add-ons to be skipped
6549and no vendor-specific directories will be configured for perl.
6550
6551EOM
6552rp='Do you want to configure vendor-specific add-on directories?'
6553case "$usevendorprefix" in
6554define|true|[yY]*) dflt=y ;;
6555*) : User may have set vendorprefix directly on Configure command line.
6556 case "$vendorprefix" in
6557 ''|' ') dflt=n ;;
6558 *) dflt=y ;;
6559 esac
6560 ;;
6561esac
6562. ./myread
6563case "$ans" in
6564[yY]*) fn=d~+
6565 rp='Installation prefix to use for vendor-supplied add-ons?'
6566 case "$vendorprefix" in
6567 '') dflt='' ;;
6568 *) dflt=$vendorprefix ;;
6569 esac
6570 . ./getfile
6571 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6572 oldvendorprefix=''
6573 case "$vendorprefix" in
6574 '') ;;
6575 *) case "$ans" in
6576 "$prefix") ;;
6577 *) oldvendorprefix="$prefix";;
6578 esac
6579 ;;
6580 esac
6581 usevendorprefix="$define"
6582 vendorprefix="$ans"
6583 vendorprefixexp="$ansexp"
6584 ;;
6585*) usevendorprefix="$undef"
6586 vendorprefix=''
6587 vendorprefixexp=''
6588 ;;
6589esac
6590
6591case "$vendorprefix" in
6592'') d_vendorlib="$undef"
6593 vendorlib=''
6594 vendorlibexp=''
6595 ;;
6596*) d_vendorlib="$define"
6597 : determine where vendor-supplied modules go.
6598 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6599 case "$vendorlib" in
6600 '')
6601 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6602 case "$installstyle" in
6603 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6604 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6605 esac
6606 ;;
6607 *) dflt="$vendorlib"
6608 ;;
6609 esac
6610 fn=d~+
6611 rp='Pathname for the vendor-supplied library files?'
6612 . ./getfile
6613 vendorlib="$ans"
6614 vendorlibexp="$ansexp"
6615 ;;
6616esac
6617vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6618: Change installation prefix, if necessary.
6619if $test X"$prefix" != X"$installprefix"; then
6620 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6621else
6622 installvendorlib="$vendorlibexp"
6623fi
6624
6625case "$vendorprefix" in
6626'') d_vendorarch="$undef"
6627 vendorarch=''
6628 vendorarchexp=''
6629 ;;
6630*) d_vendorarch="$define"
6631 : determine where vendor-supplied architecture-dependent libraries go.
6632 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6633 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6634 : vendorlib may have an optional trailing /share.
6635 case "$vendorarch" in
6636 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6637 dflt="$dflt/$archname"
6638 ;;
6639 *) dflt="$vendorarch" ;;
6640 esac
6641 fn=d~+
6642 rp='Pathname for vendor-supplied architecture-dependent files?'
6643 . ./getfile
6644 vendorarch="$ans"
6645 vendorarchexp="$ansexp"
6646 ;;
6647esac
6648: Change installation prefix, if necessary.
6649if $test X"$prefix" != X"$installprefix"; then
6650 installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6651else
6652 installvendorarch="$vendorarchexp"
6653fi
6654
6655: Final catch-all directories to search
6656$cat <<EOM
6657
6658Lastly, you can have perl look in other directories for extensions and
6659modules in addition to those already specified.
6660These directories will be searched after
6661 $sitearch
6662 $sitelib
6663EOM
6664test X"$vendorlib" != "X" && echo ' ' $vendorlib
6665test X"$vendorarch" != "X" && echo ' ' $vendorarch
6666echo ' '
6667case "$otherlibdirs" in
6668''|' ') dflt='none' ;;
6669*) dflt="$otherlibdirs" ;;
6670esac
6671$cat <<EOM
6672Enter a colon-separated set of extra paths to include in perl's @INC
6673search path, or enter 'none' for no extra paths.
6674
6675EOM
6676
6677rp='Colon-separated list of additional directories for perl to search?'
6678. ./myread
6679case "$ans" in
6680' '|''|none) otherlibdirs=' ' ;;
6681*) otherlibdirs="$ans" ;;
6682esac
6683case "$otherlibdirs" in
6684' ') val=$undef ;;
6685*) val=$define ;;
6686esac
6687set d_perl_otherlibdirs
6688eval $setvar
6689
6690: Cruising for prototypes
6691echo " "
6692echo "Checking out function prototypes..." >&4
55954f19
JH
6693$cat >prototype.c <<EOCP
6694#$i_stdlib I_STDLIB
6695#ifdef I_STDLIB
6696#include <stdlib.h>
6697#endif
b4eb6b3d
JH
6698int main(int argc, char *argv[]) {
6699 exit(0);}
6700EOCP
6701if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6702 echo "Your C compiler appears to support function prototypes."
6703 val="$define"
6704else
6705 echo "Your C compiler doesn't seem to understand function prototypes."
6706 val="$undef"
6707fi
6708set prototype
6709eval $setvar
6710$rm -f prototype*
6711
6712case "$prototype" in
6713"$define") ;;
6714*) ansi2knr='ansi2knr'
6715 echo " "
6716 cat <<EOM >&4
6717
6718$me: FATAL ERROR:
6719This version of $package can only be compiled by a compiler that
6720understands function prototypes. Unfortunately, your C compiler
6721 $cc $ccflags
6722doesn't seem to understand them. Sorry about that.
6723
6724If GNU cc is available for your system, perhaps you could try that instead.
6725
6726Eventually, we hope to support building Perl with pre-ANSI compilers.
6727If you would like to help in that effort, please contact <perlbug@perl.org>.
6728
6729Aborting Configure now.
6730EOM
6731 exit 2
6732 ;;
6733esac
6734
6735: determine where public executables go
6736echo " "
6737set dflt bin bin
6738eval $prefixit
6739fn=d~
6740rp='Pathname where the public executables will reside?'
6741. ./getfile
6742if $test "X$ansexp" != "X$binexp"; then
6743 installbin=''
6744fi
6745bin="$ans"
6746binexp="$ansexp"
6747: Change installation prefix, if necessary.
6748: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6749if $test X"$prefix" != X"$installprefix"; then
6750 installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6751else
6752 installbin="$binexp"
6753fi
6754
6fcddf3b 6755echo " "
6fcddf3b 6756case "$extras" in
bf35c3f6
JH
6757'') dflt='n';;
6758*) dflt='y';;
6fcddf3b
JH
6759esac
6760cat <<EOM
6761Perl can be built with extra modules or bundles of modules which
6762will be fetched from the CPAN and installed alongside Perl.
6763
6764Notice that you will need access to the CPAN; either via the Internet,
6765or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6766be asked later to configure the CPAN.pm module which will in turn do
6767the installation of the rest of the extra modules or bundles.)
6768
6769Notice also that if the modules require any external software such as
dd2de242
JH
6770libraries and headers (the libz library and the zlib.h header for the
6771Compress::Zlib module, for example) you MUST have any such software
6772already installed, this configuration process will NOT install such
6773things for you.
6fcddf3b
JH
6774
6775If this doesn't make any sense to you, just accept the default '$dflt'.
6776EOM
dd2de242 6777rp='Install any extra modules (y or n)?'
6fcddf3b
JH
6778. ./myread
6779case "$ans" in
6780y|Y)
6781 cat <<EOM
6782
6783Please list any extra modules or bundles to be installed from CPAN,
6784with spaces between the names. The names can be in any format the
dd2de242
JH
6785'install' command of CPAN.pm will understand. (Answer 'none',
6786without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
6787EOM
6788 rp='Extras?'
6789 dflt="$extras"
6790 . ./myread
6791 extras="$ans"
6792esac
6793case "$extras" in
6794''|'none')
6795 val=''
6796 $rm -f ../extras.lst
6797 ;;
6798*) echo "(Saving the list of extras for later...)"
dd2de242
JH
6799 echo "$extras" > ../extras.lst
6800 val="'$extras'"
6fcddf3b
JH
6801 ;;
6802esac
6803set extras
6804eval $setvar
6805echo " "
6806
6e1038e0
MB
6807: determine where html pages for programs go
6808set html1dir html1dir none
6809eval $prefixit
6810$cat <<EOM
6811
6812If you wish to install html files for programs in $spackage, indicate
6813the appropriate directory here. To skip installing html files,
6814answer "none".
6815EOM
6816case "$html1dir" in
6817''|none|$undef|' ') dflt=none ;;
6818*) dflt=$html1dir ;;
6819esac
6820fn=dn+~
6821rp="Directory for the main $spackage html pages?"
6822. ./getfile
6823html1dir="$ans"
6824html1direxp="$ansexp"
6825: Use ' ' for none so value is preserved next time through Configure
6826$test X"$html1dir" = "X" && html1dir=' '
6827: Change installation prefix, if necessary.
6828if $test X"$prefix" != X"$installprefix"; then
6829 installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6830else
6831 installhtml1dir="$html1direxp"
6832fi
6833
6834: determine where html pages for libraries and modules go
6835set html3dir html3dir none
6836eval $prefixit
6837$cat <<EOM
6838
6839If you wish to install html files for modules associated with $spackage,
6840indicate the appropriate directory here. To skip installing html files,
6841answer "none".
6842EOM
6843: There is no obvious default. If they have specified html1dir, then
6844: try to key off that, possibly changing .../html1 into .../html3.
6845case "$html3dir" in
6846'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6847*) dflt=$html3dir ;;
6848esac
6849fn=dn+~
6850rp="Directory for the $spackage module html pages?"
6851. ./getfile
6852html3dir="$ans"
6853html3direxp="$ansexp"
6854: Use ' ' for none so value is preserved next time through Configure
6855$test X"$html3dir" = "X" && html3dir=' '
6856: Change installation prefix, if necessary.
6857if $test X"$prefix" != X"$installprefix"; then
6858 installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6859else
6860 installhtml3dir="$html3direxp"
6861fi
6862
b4eb6b3d
JH
6863: Find perl5.005 or later.
6864echo "Looking for a previously installed perl5.005 or later... "
6865case "$perl5" in
a938a3bb 6866'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
b4eb6b3d 6867 : Check if this perl is recent and can load a simple module
a938a3bb 6868 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
b4eb6b3d
JH
6869 perl5=$tdir/perl
6870 break;
a938a3bb
IZ
6871 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6872 perl5=$tdir/perl5
b4eb6b3d
JH
6873 break;
6874 fi
89ce900e
JH
6875 done
6876 ;;
6877*) perl5="$perl5"
6878 ;;
6879esac
6880case "$perl5" in
6881'') echo "None found. That's ok.";;
6882*) echo "Using $perl5." ;;
6883esac
6884
6885: Determine list of previous versions to include in @INC
6886$cat > getverlist <<EOPL
6887#!$perl5 -w
6888use File::Basename;
6889\$api_versionstring = "$api_versionstring";
6890\$version = "$version";
6891\$stem = "$sitelib_stem";
6892\$archname = "$archname";
6893EOPL
6894 $cat >> getverlist <<'EOPL'
6895# Can't have leading @ because metaconfig interprets it as a command!
6896;@inc_version_list=();
6897# XXX Redo to do opendir/readdir?
6898if (-d $stem) {
6899 chdir($stem);
6900 ;@candidates = glob("5.*");
6901}
6902else {
6903 ;@candidates = ();
6904}
6905
6906# XXX ToDo: These comparisons must be reworked when two-digit
6907# subversions come along, so that 5.7.10 compares as greater than
6908# 5.7.3! By that time, hope that 5.6.x is sufficiently
6909# widespread that we can use the built-in version vectors rather
6910# than reinventing them here. For 5.6.0, however, we must
6911# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6912foreach $d (@candidates) {
6913 if ($d lt $version) {
6914 if ($d ge $api_versionstring) {
6915 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6916 }
6917 elsif ($d ge "5.005") {
6918 unshift(@inc_version_list, grep { -d } $d);
6919 }
6920 }
6921 else {
6922 # Skip newer version. I.e. don't look in
6923 # 5.7.0 if we're installing 5.6.1.
6924 }
6925}
6926
6927if (@inc_version_list) {
6928 print join(' ', @inc_version_list);
6929}
6930else {
6931 # Blank space to preserve value for next Configure run.
6932 print " ";
6933}
6934EOPL
6935chmod +x getverlist
6936case "$inc_version_list" in
6937'') if test -x "$perl5$exe_ext"; then
6938 dflt=`$perl5 getverlist`
6939 else
6940 dflt='none'
6941 fi
6942 ;;
6943$undef) dflt='none' ;;
6944*) eval dflt=\"$inc_version_list\" ;;
6945esac
6946case "$dflt" in
6947''|' ') dflt=none ;;
6948esac
6949case "$dflt" in
69505.005) dflt=none ;;
6951esac
6952$cat <<EOM
6953
6954In order to ease the process of upgrading, this version of perl
6955can be configured to use modules built and installed with earlier
6956versions of perl that were installed under $prefix. Specify here
6957the list of earlier versions that this version of perl should check.
6958If Configure detected no earlier versions of perl installed under
6959$prefix, then the list will be empty. Answer 'none' to tell perl
6960to not search earlier versions.
6961
6962The default should almost always be sensible, so if you're not sure,
6963just accept the default.
6964EOM
6965
6966rp='List of earlier versions to include in @INC?'
6967. ./myread
6968case "$ans" in
d2556f21 6969[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
89ce900e
JH
6970*) inc_version_list="$ans" ;;
6971esac
6972case "$inc_version_list" in
6973''|' ')
6974 inc_version_list_init='0';;
6975*) inc_version_list_init=`echo $inc_version_list |
6976 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6977 ;;
6978esac
6979$rm -f getverlist
6980
6981: determine whether to install perl also as /usr/bin/perl
6982
6983echo " "
6984if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6985 $cat <<EOM
6986Many scripts expect perl to be installed as /usr/bin/perl.
6987
6988If you want to, I can install the perl you are about to compile
6989as /usr/bin/perl (in addition to $bin/perl).
6990EOM
6991 if test -f /usr/bin/perl; then
6992 $cat <<EOM
6993
6994However, please note that because you already have a /usr/bin/perl,
6995overwriting that with a new Perl would very probably cause problems.
6996Therefore I'm assuming you don't want to do that (unless you insist).
6997
6998EOM
6999 case "$installusrbinperl" in
7000 "$define"|[yY]*) dflt='y';;
7001 *) dflt='n';;
7002 esac
7003 else
7004 $cat <<EOM
7005
7006Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7007
7008EOM
7009 case "$installusrbinperl" in
7010 "$undef"|[nN]*) dflt='n';;
7011 *) dflt='y';;
7012 esac
7013 fi
7014 rp="Do you want to install perl as /usr/bin/perl?"
7015 . ./myread
7016 case "$ans" in
7017 [yY]*) val="$define";;
7018 *) val="$undef" ;;
7019 esac
7020else
7021 val="$undef"
7022fi
7023set installusrbinperl
7024eval $setvar
7025
7026echo " "
7027echo "Checking for GNU C Library..." >&4
7028cat >try.c <<'EOCP'
7029/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7030 alone are insufficient to distinguish different versions, such as
7031 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7032 libc version 2.1.0. A. Dougherty, June 3, 2002.
7033*/
7034#include <stdio.h>
7035int main(void)
7036{
7037#ifdef __GLIBC__
7038# ifdef __GLIBC_MINOR__
7039# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7040# include <gnu/libc-version.h>
7041 printf("%s\n", gnu_get_libc_version());
7042# else
7043 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7044# endif
7045# else
7046 printf("%d\n", __GLIBC__);
7047# endif
7048 return 0;
7049#else
7050 return 1;
7051#endif
7052}
7053EOCP
7054set try
7055if eval $compile_ok && $run ./try > glibc.ver; then
7056 val="$define"
7057 gnulibc_version=`$cat glibc.ver`
7058 echo "You are using the GNU C Library version $gnulibc_version"
7059else
7060 val="$undef"
7061 gnulibc_version=''
7062 echo "You are not using the GNU C Library"
7063fi
7064$rm -f try try.* glibc.ver
7065set d_gnulibc
7066eval $setvar
7067
7068: see if nm is to be used to determine whether a symbol is defined or not
7069case "$usenm" in
7070'')
7071 dflt=''
7072 case "$d_gnulibc" in
7073 "$define")
7074 echo " "
7075 echo "nm probably won't work on the GNU C Library." >&4
7076 dflt=n
7077 ;;
7078 esac
7079 case "$dflt" in
7080 '')
7081 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7082 echo " "
7083 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7084 echo "'nm' won't be sufficient on this sytem." >&4
7085 dflt=n
7086 fi
7087 ;;
7088 esac
7089 case "$dflt" in
7090 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7091 if $test $dflt -gt 20; then
7092 dflt=y
7093 else
7094 dflt=n
7095 fi
7096 ;;
7097 esac
b4eb6b3d 7098 ;;
89ce900e
JH
7099*)
7100 case "$usenm" in
7101 true|$define) dflt=y;;
7102 *) dflt=n;;
7103 esac
b4eb6b3d
JH
7104 ;;
7105esac
89ce900e 7106$cat <<EOM
b4eb6b3d 7107
89ce900e
JH
7108I can use $nm to extract the symbols from your C libraries. This
7109is a time consuming task which may generate huge output on the disk (up
7110to 3 megabytes) but that should make the symbols extraction faster. The
7111alternative is to skip the 'nm' extraction part and to compile a small
7112test program instead to determine whether each symbol is present. If
7113you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7114this may be the best solution.
b4eb6b3d 7115
89ce900e 7116You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7117
89ce900e
JH
7118EOM
7119rp="Shall I use $nm to extract C symbols from the libraries?"
7120. ./myread
7121case "$ans" in
7122[Nn]*) usenm=false;;
7123*) usenm=true;;
b4eb6b3d 7124esac
89ce900e
JH
7125
7126runnm=$usenm
7127case "$reuseval" in
7128true) runnm=false;;
b4eb6b3d 7129esac
b4eb6b3d 7130
89ce900e
JH
7131: nm options which may be necessary
7132case "$nm_opt" in
7133'') if $test -f /mach_boot; then
7134 nm_opt='' # Mach
7135 elif $test -d /usr/ccs/lib; then
7136 nm_opt='-p' # Solaris (and SunOS?)
7137 elif $test -f /dgux; then
7138 nm_opt='-p' # DG-UX
7139 elif $test -f /lib64/rld; then
7140 nm_opt='-p' # 64-bit Irix
7141 else
7142 nm_opt=''
7143 fi;;
7144esac
b4eb6b3d 7145
89ce900e
JH
7146: nm options which may be necessary for shared libraries but illegal
7147: for archive libraries. Thank you, Linux.
7148case "$nm_so_opt" in
7149'') case "$myuname" in
fb2e1bc0 7150 *linux*|gnu*)
89ce900e
JH
7151 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7152 nm_so_opt='--dynamic'
7153 fi
7154 ;;
7155 esac
7156 ;;
7157esac
b4eb6b3d 7158
89ce900e
JH
7159case "$runnm" in
7160true)
7161: get list of predefined functions in a handy place
7162echo " "
7163case "$libc" in
7164'') libc=unknown
7165 case "$libs" in
7166 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7167 esac
7168 ;;
b4eb6b3d 7169esac
89ce900e
JH
7170case "$libs" in
7171'') ;;
7172*) for thislib in $libs; do
7173 case "$thislib" in
7174 -lc|-lc_s)
7175 : Handle C library specially below.
7176 ;;
7177 -l*)
7178 thislib=`echo $thislib | $sed -e 's/^-l//'`
7179 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7180 :
7181 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7182 :
7183 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7184 :
7185 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7186 :
7187 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7188 :
7189 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7190 :
7191 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7192 :
7193 else
7194 try=''
7195 fi
7196 libnames="$libnames $try"
7197 ;;
7198 *) libnames="$libnames $thislib" ;;
7199 esac
7200 done
b4eb6b3d
JH
7201 ;;
7202esac
89ce900e
JH
7203xxx=normal
7204case "$libc" in
7205unknown)
7206 set /lib/libc.$so
7207 for xxx in $libpth; do
7208 $test -r $1 || set $xxx/libc.$so
7209 : The messy sed command sorts on library version numbers.
7210 $test -r $1 || \
7211 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7212 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7213 h
7214 s/[0-9][0-9]*/0000&/g
7215 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7216 G
7217 s/\n/ /' | \
7218 $sort | $sed -e 's/^.* //'`
7219 eval set \$$#
7220 done
7221 $test -r $1 || set /usr/ccs/lib/libc.$so
7222 $test -r $1 || set /lib/libsys_s$_a
7223 ;;
7224*)
7225 set blurfl
7226 ;;
7227esac
7228if $test -r "$1"; then
7229 echo "Your (shared) C library seems to be in $1."
7230 libc="$1"
7231elif $test -r /lib/libc && $test -r /lib/clib; then
7232 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7233 xxx=apollo
7234 libc='/lib/clib /lib/libc'
7235 if $test -r /lib/syslib; then
7236 echo "(Your math library is in /lib/syslib.)"
7237 libc="$libc /lib/syslib"
7238 fi
7239elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7240 echo "Your C library seems to be in $libc, as you said before."
7241elif $test -r $incpath/usr/lib/libc$_a; then
7242 libc=$incpath/usr/lib/libc$_a;
7243 echo "Your C library seems to be in $libc. That's fine."
7244elif $test -r /lib/libc$_a; then
7245 libc=/lib/libc$_a;
7246 echo "Your C library seems to be in $libc. You're normal."
7247else
7248 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7249 :
7250 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7251 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7252 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7253 :
7254 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7255 :
7256 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7257 :
7258 else
7259 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7260 fi
7261 if $test -r "$tans"; then
7262 echo "Your C library seems to be in $tans, of all places."
7263 libc=$tans
7264 else
7265 libc='blurfl'
7266 fi
7267fi
7268if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7269 dflt="$libc"
7270 cat <<EOM
b4eb6b3d 7271
89ce900e
JH
7272If the guess above is wrong (which it might be if you're using a strange
7273compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7274
89ce900e
JH
7275EOM
7276else
7277 dflt=''
7278 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7279 cat >&4 <<EOM
7280I can't seem to find your C library. I've looked in the following places:
5e366f65 7281
b4eb6b3d 7282EOM
89ce900e
JH
7283 $sed 's/^/ /' libpath
7284 cat <<EOM
5e366f65 7285
89ce900e 7286None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7287
7288EOM
89ce900e
JH
7289fi
7290fn=f
7291rp='Where is your C library?'
7292. ./getfile
7293libc="$ans"
5e366f65 7294
89ce900e
JH
7295echo " "
7296echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7297set X `cat libnames`
7298shift
7299xxx=files
7300case $# in 1) xxx=file; esac
7301echo "Extracting names from the following $xxx for later perusal:" >&4
7302echo " "
7303$sed 's/^/ /' libnames >&4
7304echo " "
7305$echo $n "This may take a while...$c" >&4
5e366f65 7306
89ce900e
JH
7307for file in $*; do
7308 case $file in
7309 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7310 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7311 esac
89ce900e
JH
7312done >libc.tmp
7313
7314$echo $n ".$c"
7315$grep fprintf libc.tmp > libc.ptf
7316xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7317xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7318xxx='[ADTSIW]'
ab900c53 7319if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7320 eval $xscan;\
7321 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7322 eval $xrun
7323elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7324 eval $xscan;\
7325 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7326 eval $xrun
7327elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7328 eval $xscan;\
7329 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7330 eval $xrun
7331elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7332 eval $xscan;\
7333 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7334 eval $xrun
7335elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7336 eval $xscan;\
7337 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7338 eval $xrun
7339elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7340 eval $xscan;\
7341 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7342 eval $xrun
7343elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7344 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7345 eval $xscan;\
7346 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7347 eval $xrun
7348elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7349 eval $xscan;\
7350 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7351 eval $xrun
7352elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7353 eval $xscan;\
7354 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7355 eval $xrun
7356elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7357 eval $xscan;\
7358 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7359 eval $xrun
7360elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7361 eval $xscan;\
7362 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7363 eval $xrun
7364elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7365 eval $xscan;\
7366 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7367 eval $xrun
7368elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7369 eval $xscan;\
7370 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7371 eval $xrun
7372elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7373 eval $xscan;\
7374 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7375 eval $xrun
b4eb6b3d 7376else
89ce900e
JH
7377 $nm -p $* 2>/dev/null >libc.tmp
7378 $grep fprintf libc.tmp > libc.ptf
7379 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7380 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7381 then
7382 nm_opt='-p'
7383 eval $xrun
7384 else
7385 echo " "
7386 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7387 com=''
7388 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7389 for thisname in $libnames $libc; do
7390 $ar t $thisname >>libc.tmp
7391 done
7392 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7393 echo "Ok." >&4
7394 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7395 # Repeat libc to extract forwarders to DLL entries too
7396 for thisname in $libnames $libc; do
7397 $ar tv $thisname >>libc.tmp
7398 # Revision 50 of EMX has bug in $ar.
7399 # it will not extract forwarders to DLL entries
7400 # Use emximp which will extract exactly them.
7401 emximp -o tmp.imp $thisname \
7402 2>/dev/null && \
7403 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7404 < tmp.imp >>libc.tmp
7405 $rm tmp.imp
7406 done
7407 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7408 echo "Ok." >&4
7409 else
7410 echo "$ar didn't seem to work right." >&4
7411 echo "Maybe this is a Cray...trying bld instead..." >&4
7412 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7413 then
7414 for thisname in $libnames; do
7415 bld t $libnames | \
7416 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7417 $ar t $thisname >>libc.tmp
7418 done
7419 echo "Ok." >&4
7420 else
7421 echo "That didn't work either. Giving up." >&4
7422 exit 1
7423 fi
7424 fi
7425 fi
b4eb6b3d 7426fi
89ce900e
JH
7427nm_extract="$com"
7428case "$PASE" in
7429define)
7430 echo " "
7431 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7432 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7433 ;;
7434*) if $test -f /lib/syscalls.exp; then
7435 echo " "
7436 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7437 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7438 fi
7439 ;;
7440esac
7441;;
7442esac
7443$rm -f libnames libpath
b4eb6b3d
JH
7444
7445: see if dld is available
7446set dld.h i_dld
7447eval $inhdr
7448
89ce900e
JH
7449: is a C symbol defined?
7450csym='tlook=$1;
7451case "$3" in
373dfab3
JH
7452-v) tf=libc.tmp; tdc="";;
7453-a) tf=libc.tmp; tdc="[]";;
7454*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7455esac;
7456tx=yes;
7457case "$reuseval-$4" in
7458true-) ;;
7459true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7460esac;
7461case "$tx" in
7462yes)
ab900c53 7463 tval=false;
5129fff4
JH
7464 if $test "$runnm" = true; then
7465 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7466 tval=true;
5129fff4 7467 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
373dfab3 7468 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7469 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3
JH
7470 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7471 $rm -f try$_exe try.c core core.* try.core;
89ce900e 7472 fi;
5129fff4 7473 else
373dfab3 7474 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7475 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
373dfab3 7476 $rm -f try$_exe try.c;
ab900c53
AB
7477 fi;
7478 ;;
89ce900e
JH
7479*)
7480 case "$tval" in
7481 $define) tval=true;;
7482 *) tval=false;;
ab900c53
AB
7483 esac;
7484 ;;
89ce900e
JH
7485esac;
7486eval "$2=$tval"'
7487
7488: define an is-in-libc? function
7489inlibc='echo " "; td=$define; tu=$undef;
7490sym=$1; var=$2; eval "was=\$$2";
7491tx=yes;
7492case "$reuseval$was" in
7493true) ;;
7494true*) tx=no;;
7495esac;
7496case "$tx" in
7497yes)
7498 set $sym tres -f;
7499 eval $csym;
7500 case "$tres" in
7501 true)
7502 echo "$sym() found." >&4;
7503 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7504 *)
7505 echo "$sym() NOT found." >&4;
7506 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7507 esac;;
7508*)
7509 case "$was" in
7510 $define) echo "$sym() found." >&4;;
7511 *) echo "$sym() NOT found." >&4;;
7512 esac;;
7513esac'
7514
b4eb6b3d
JH
7515: see if dlopen exists
7516xxx_runnm="$runnm"
7517runnm=false
7518set dlopen d_dlopen
7519eval $inlibc
7520runnm="$xxx_runnm"
7521
7522: determine which dynamic loading, if any, to compile in
7523echo " "
7524dldir="ext/DynaLoader"
7525case "$usedl" in
7526$define|y|true)
7527 dflt='y'
7528 usedl="$define"
7529 ;;
7530$undef|n|false)
7531 dflt='n'
7532 usedl="$undef"
7533 ;;
7534*)
7535 dflt='n'
7536 case "$d_dlopen" in
7537 $define) dflt='y' ;;
7538 esac
7539 case "$i_dld" in
7540 $define) dflt='y' ;;
7541 esac
7542 : Does a dl_xxx.xs file exist for this operating system
7543 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7544 ;;
7545esac
7546rp="Do you wish to use dynamic loading?"
7547. ./myread
7548usedl="$ans"
7549case "$ans" in
7550y*) usedl="$define"
7551 case "$dlsrc" in
7552 '')
7553 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7554 dflt="$dldir/dl_${osname}.xs"
7555 elif $test "$d_dlopen" = "$define" ; then
7556 dflt="$dldir/dl_dlopen.xs"
7557 elif $test "$i_dld" = "$define" ; then
7558 dflt="$dldir/dl_dld.xs"
7559 else
7560 dflt=''
7561 fi
7562 ;;
7563 *) dflt="$dldir/$dlsrc"
7564 ;;
7565 esac
7566 echo "The following dynamic loading files are available:"
7567 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7568 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7569 rp="Source file to use for dynamic loading"
7570 fn="fne"
7571 gfpth="$src"
7572 . ./getfile
7573 usedl="$define"
7574 : emulate basename
7575 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7576
7577 $cat << EOM
7578
7579Some systems may require passing special flags to $cc -c to
7580compile modules that will be used to create a shared library.
7581To use no flags, say "none".
7582
7583EOM
7584 case "$cccdlflags" in
7585 '') case "$gccversion" in
7586 '') case "$osname" in
7587 hpux) dflt='+z' ;;
7588 next) dflt='none' ;;
7589 irix*) dflt='-KPIC' ;;
48bcfe03 7590 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7591 sunos) dflt='-pic' ;;
7592 *) dflt='none' ;;
7593 esac
7594 ;;
7595 *) case "$osname" in
b6cc0f4c 7596 darwin) dflt='none' ;;
48bcfe03 7597 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7598 *) dflt='-fpic' ;;
7599 esac ;;
7600 esac ;;
7601 ' ') dflt='none' ;;
7602 *) dflt="$cccdlflags" ;;
7603 esac
7604 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7605 . ./myread
7606 case "$ans" in
7607 none) cccdlflags=' ' ;;
7608 *) cccdlflags="$ans" ;;
7609 esac
7610
7611 cat << EOM
7612
7613Some systems use ld to create libraries that can be dynamically loaded,
7614while other systems (such as those using ELF) use $cc.
7615
7616EOM
7617 case "$ld" in
55954f19 7618 '') $cat >try.c <<EOM
b4eb6b3d
JH
7619/* Test for whether ELF binaries are produced */
7620#include <fcntl.h>
55954f19
JH
7621#$i_stdlib I_STDLIB
7622#ifdef I_STDLIB
b4eb6b3d 7623#include <stdlib.h>
55954f19 7624#endif
b4eb6b3d
JH
7625int main() {
7626 char b[4];
7627 int i = open("a.out",O_RDONLY);
7628 if(i == -1)
7629 exit(1); /* fail */
7630 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7631 exit(0); /* succeed (yes, it's ELF) */
7632 else
7633 exit(1); /* fail */
7634}
7635EOM
5440bc8e 7636 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7637 cat <<EOM
7638You appear to have ELF support. I'll use $cc to build dynamic libraries.
7639EOM
7640 dflt="$cc"
7641 else
7642 echo "I'll use ld to build dynamic libraries."
7643 dflt='ld'
7644 fi
7645 rm -f try.c a.out
7646 ;;
7647 *) dflt="$ld"
7648 ;;
7649 esac
7650
7651 rp="What command should be used to create dynamic libraries?"
7652 . ./myread
7653 ld="$ans"
7654
7655 cat << EOM
7656
7657Some systems may require passing special flags to $ld to create a
7658library that can be dynamically loaded. If your ld flags include
7659-L/other/path options to locate libraries outside your loader's normal
7660search path, you may need to specify those -L options here as well. To
7661use no flags, say "none".
7662
7663EOM
7664 case "$lddlflags" in
7665 '') case "$osname" in
7666 beos) dflt='-nostart' ;;
7667 hpux) dflt='-b';
7668 case "$gccversion" in
7669 '') dflt="$dflt +vnocompatwarnings" ;;
7670 esac
7671 ;;
fb2e1bc0 7672 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7673 next) dflt='none' ;;
7674 solaris) dflt='-G' ;;
7675 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7676 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7677 *) dflt='none' ;;
7678 esac
7679 ;;
7680 *) dflt="$lddlflags" ;;
7681 esac
7682
7683 : Try to guess additional flags to pick up local libraries.
7684 : Be careful not to append to a plain 'none'
7685 case "$dflt" in
7686 none) dflt='' ;;
7687 esac
7688 for thisflag in $ldflags; do
7689 case "$thisflag" in
b5b9f165 7690 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7691 case " $dflt " in
7692 *" $thisflag "*) ;;
7693 *) dflt="$dflt $thisflag" ;;
7694 esac
7695 ;;
7696 esac
7697 done
7698
7699 case "$dflt" in
7700 ''|' ') dflt='none' ;;
7701 esac
7702
7703 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7704 . ./myread
7705 case "$ans" in
7706 none) lddlflags=' ' ;;
7707 *) lddlflags="$ans" ;;
7708 esac
7709
7710 cat <<EOM
7711
7712Some systems may require passing special flags to $cc to indicate that
7713the resulting executable will use dynamic linking. To use no flags,
7714say "none".
7715
7716EOM
7717 case "$ccdlflags" in
7718 '') case "$osname" in
fb2e1bc0 7719 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7720 next|sunos) dflt='none' ;;
7721 *) dflt='none' ;;
b4eb6b3d
JH
7722 esac ;;
7723 ' ') dflt='none' ;;
7724 *) dflt="$ccdlflags" ;;
7725 esac
7726 rp="Any special flags to pass to $cc to use dynamic linking?"
7727 . ./myread
7728 case "$ans" in
7729 none) ccdlflags=' ' ;;
7730 *) ccdlflags="$ans" ;;
7731 esac
7732 ;;
7733*) usedl="$undef"
7734 ld='ld'
7735 dlsrc='dl_none.xs'
7736 lddlflags=''
7737 ccdlflags=''
7738 ;;
7739esac
7740
7741also=''
7742case "$usedl" in
7743$undef)
7744 # No dynamic loading being used, so don't bother even to prompt.
7745 useshrplib='false'
7746 ;;
7747*) case "$useshrplib" in
7748 '') case "$osname" in
48bcfe03 7749 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7750 dflt=y
7751 also='Building a shared libperl is required for dynamic loading to work on your system.'
7752 ;;
7753 next*)
7754 case "$osvers" in
7755 4*) dflt=y
7756 also='Building a shared libperl is needed for MAB support.'
7757 ;;
7758 *) dflt=n
7759 ;;
7760 esac
7761 ;;
7762 *) dflt=n
7763 ;;
7764 esac
7765 ;;
7766 $define|true|[Yy]*)
7767 dflt=y
7768 ;;
7769 *) dflt=n
7770 ;;
7771 esac
7772 $cat << EOM
7773
7774The perl executable is normally obtained by linking perlmain.c with
7775libperl${_a}, any static extensions (usually just DynaLoader), and
7776any other libraries needed on this system (such as -lm, etc.). Since
7777your system supports dynamic loading, it is probably possible to build
7778a shared libperl.$so. If you will have more than one executable linked
7779to libperl.$so, this will significantly reduce the size of each
5cadb3f3 7780executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
7781default is probably sensible for your system.
7782$also
7783
7784EOM
7785 rp="Build a shared libperl.$so (y/n)"
7786 . ./myread
7787 case "$ans" in
7788 true|$define|[Yy]*)
7789 useshrplib='true' ;;
7790 *) useshrplib='false' ;;
7791 esac
7792 ;;
7793esac
7794
7795case "$useshrplib" in
7796true)
7797 case "$libperl" in
7798 '')
7799 # Figure out a good name for libperl.so. Since it gets stored in
7800 # a version-specific architecture-dependent library, the version
7801 # number isn't really that important, except for making cc/ld happy.
7802 #
7803 # A name such as libperl.so.3.1
7804 majmin="libperl.$so.$patchlevel.$subversion"
7805 # A name such as libperl.so.301
7806 majonly=`echo $patchlevel $subversion |
7807 $awk '{printf "%d%02d", $1, $2}'`
7808 majonly=libperl.$so.$majonly
7809 # I'd prefer to keep the os-specific stuff here to a minimum, and
7810 # rely on figuring it out from the naming of libc.
7811 case "${osname}${osvers}" in
7812 next4*)
7813 dflt=libperl.5.$so
7814 # XXX How handle the --version stuff for MAB?
7815 ;;
fb2e1bc0 7816 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7817 dflt=libperl.$so
7818 ;;
b53432e4
GH
7819 cygwin*) # ld links against an importlib
7820 dflt=libperl$lib_ext
b4eb6b3d
JH
7821 ;;
7822 *) # Try to guess based on whether libc has major.minor.
7823 case "$libc" in
7824 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7825 *libc.$so.[0-9]*) dflt=$majonly ;;
7826 *) dflt=libperl.$so ;;
7827 esac
7828 ;;
7829 esac
7830 ;;
7831 *) dflt=$libperl
7832 ;;
7833 esac
7834 cat << EOM
7835
7836I need to select a good name for the shared libperl. If your system uses
7837library names with major and minor numbers, then you might want something
7838like $majmin. Alternatively, if your system uses a single version
7839number for shared libraries, then you might want to use $majonly.
7840Or, your system might be quite happy with a simple libperl.$so.
7841
7842Since the shared libperl will get installed into a version-specific
7843architecture-dependent directory, the version number of the shared perl
7844library probably isn't important, so the default should be o.k.
7845
7846EOM
7847 rp='What name do you want to give to the shared libperl?'
7848 . ./myread
7849 libperl=$ans
7850 echo "Ok, I'll use $libperl"
7851 ;;
7852*)
7853 libperl="libperl${_a}"
7854 ;;
7855esac
7856
7857# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7858case "$shrpdir" in
7859'') ;;
7860*) $cat >&4 <<EOM
7861WARNING: Use of the shrpdir variable for the installation location of
7862the shared $libperl is not supported. It was never documented and
7863will not work in this version. Let me (perlbug@perl.org)
7864know of any problems this may cause.
7865
7866EOM
7867 case "$shrpdir" in
7868 "$archlibexp/CORE")
7869 $cat >&4 <<EOM
7870But your current setting of $shrpdir is
7871the default anyway, so it's harmless.
7872EOM
7873 ;;
7874 *)
7875 $cat >&4 <<EOM
7876Further, your current attempted setting of $shrpdir
7877conflicts with the value of $archlibexp/CORE
7878that installperl will use.
7879EOM
7880 ;;
7881 esac
7882 ;;
7883esac
7884
7885# How will the perl executable find the installed shared $libperl?
7886# Add $xxx to ccdlflags.
7887# If we can't figure out a command-line option, use $shrpenv to
7888# set env LD_RUN_PATH. The main perl makefile uses this.
7889shrpdir=$archlibexp/CORE
7890xxx=''
7891tmp_shrpenv=''
7892if "$useshrplib"; then
7893 case "$osname" in
7894 aix)
7895 # We'll set it in Makefile.SH...
7896 ;;
b5b9f165 7897 solaris)
b4eb6b3d
JH
7898 xxx="-R $shrpdir"
7899 ;;
a774dfe6 7900 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
7901 xxx="-Wl,-R$shrpdir"
7902 ;;
fb2e1bc0 7903 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
7904 xxx="-Wl,-rpath,$shrpdir"
7905 ;;
7906 next)
7907 # next doesn't like the default...
7908 ;;
7909 beos)
7910 # beos doesn't like the default, either.
7911 ;;
7912 hpux*)
7913 # hpux doesn't like the default, either.
7914 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7915 ;;
7916 *)
7917 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7918 ;;
7919 esac
7920 case "$xxx" in
7921 '') ;;
7922 *)
7923 # Only add $xxx if it isn't already in ccdlflags.
7924 case " $ccdlflags " in
7925 *" $xxx "*) ;;
7926 *) ccdlflags="$ccdlflags $xxx"
7927 cat <<EOM >&4
7928
7929Adding $xxx to the flags
7930passed to $ld so that the perl executable will find the
7931installed shared $libperl.
7932
7933EOM
7934 ;;
7935 esac
7936 ;;
7937 esac
7938fi
7939# Fix ccdlflags in AIX for building external extensions.
7940# (For building Perl itself bare -bE:perl.exp is needed,
7941# Makefile.SH takes care of this.)
7942case "$osname" in
7943aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7944esac
7945# Respect a hint or command-line value.
7946case "$shrpenv" in
7947'') shrpenv="$tmp_shrpenv" ;;
7948esac
7949case "$ldlibpthname" in
7950'') ldlibpthname=LD_LIBRARY_PATH ;;
7951none) ldlibpthname='' ;;
7952esac
7953
7954: determine where manual pages are on this system
7955echo " "
7956case "$sysman" in
7957'')
4a0a3829
SD
7958 syspath='/usr/share/man/man1 /usr/man/man1'
7959 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7960 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
7961 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7962 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7963 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7964 sysman=`./loc . /usr/man/man1 $syspath`
7965 ;;
7966esac
7967if $test -d "$sysman"; then
7968 echo "System manual is in $sysman." >&4
7969else
7970 echo "Could not find manual pages in source form." >&4
7971fi
7972
7973: determine where manual pages go
7974set man1dir man1dir none
7975eval $prefixit
7976$cat <<EOM
7977
7978$spackage has manual pages available in source form.
7979EOM
7980case "$nroff" in
7981nroff)
7982 echo "However, you don't have nroff, so they're probably useless to you."
7983 case "$man1dir" in
7984 '') man1dir="none";;
7985 esac;;
7986esac
7987echo "If you don't want the manual sources installed, answer 'none'."
7988case "$man1dir" in
7989' ') dflt=none
7990 ;;
7991'')
4a0a3829
SD
7992 lookpath="$prefixexp/share/man/man1"
7993 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
7994 lookpath="$lookpath $prefixexp/man/p_man/man1"
7995 lookpath="$lookpath $prefixexp/man/u_man/man1"
7996 lookpath="$lookpath $prefixexp/man/man.1"
7997 case "$sysman" in
7998 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7999 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8000 esac
8001 set dflt
8002 eval $prefixup
8003 ;;
8004*) dflt="$man1dir"
8005 ;;
8006esac
8007echo " "
8008fn=dn+~
8009rp="Where do the main $spackage manual pages (source) go?"
8010. ./getfile
8011if $test "X$man1direxp" != "X$ansexp"; then
8012 installman1dir=''
8013fi
8014man1dir="$ans"
8015man1direxp="$ansexp"
8016case "$man1dir" in
8017'') man1dir=' '
8018 installman1dir='';;
8019esac
8020
8021: Change installation prefix, if necessary.
8022if $test X"$prefix" != X"$installprefix"; then
8023 installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8024else
8025 installman1dir="$man1direxp"
8026fi
8027
8028: What suffix to use on installed man pages
8029
8030case "$man1dir" in
8031' ')
8032 man1ext='0'
8033 ;;
8034*)
8035 rp="What suffix should be used for the main $spackage man pages?"
8036 case "$man1ext" in
8037 '') case "$man1dir" in
8038 *1) dflt=1 ;;
8039 *1p) dflt=1p ;;
8040 *1pm) dflt=1pm ;;
8041 *l) dflt=l;;
8042 *n) dflt=n;;
8043 *o) dflt=o;;
8044 *p) dflt=p;;
8045 *C) dflt=C;;
8046 *L) dflt=L;;
8047 *L1) dflt=L1;;
8048 *) dflt=1;;
8049 esac
8050 ;;
8051 *) dflt="$man1ext";;
8052 esac
8053 . ./myread
8054 man1ext="$ans"
8055 ;;
8056esac
8057
8058: see if we can have long filenames
8059echo " "
8060first=123456789abcdef
8061$rm -f $first
8062if (echo hi >$first) 2>/dev/null; then
8063 if $test -f 123456789abcde; then
8064 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8065 val="$undef"
8066 else
8067 echo 'You can have filenames longer than 14 characters.'>&4
8068 val="$define"
8069 fi
8070else
8071 $cat <<'EOM'
8072You can't have filenames longer than 14 chars.
8073You can't even think about them!
8074EOM
8075 val="$undef"
8076fi
8077set d_flexfnam
8078eval $setvar
8079$rm -rf 123456789abcde*
8080
8081: determine where library module manual pages go
8082set man3dir man3dir none
8083eval $prefixit
8084$cat <<EOM
8085
8086$spackage has manual pages for many of the library modules.
8087EOM
8088
8089case "$nroff" in
8090nroff)
8091 $cat <<'EOM'
8092However, you don't have nroff, so they're probably useless to you.
8093EOM
8094 case "$man3dir" in
8095 '') man3dir="none";;
8096 esac;;
8097esac
8098
8099case "$d_flexfnam" in
8100undef)
8101 $cat <<'EOM'
8102However, your system can't handle the long file names like File::Basename.3.
8103EOM
8104 case "$man3dir" in
8105 '') man3dir="none";;
8106 esac;;
8107esac
8108
8109echo "If you don't want the manual sources installed, answer 'none'."
8110prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8111case "$man3dir" in
8112'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8113 if $test -d "$privlib/man/man3"; then
8114 cat <<EOM >&4
8115
8116WARNING: Previous versions of perl installed man3 pages into
8117$privlib/man/man3. This version will suggest a
8118new default of $dflt.
8119EOM
8120 tdflt=$dflt
8121 dflt='n'
8122 rp='Do you wish to preserve the old behavior?(y/n)'
8123 . ./myread
8124 case "$ans" in
8125 y*) dflt="$privlib/man/man3" ;;
8126 *) dflt=$tdflt ;;
8127 esac
8128 fi
8129 ;;
8130*) dflt="$man3dir" ;;
8131esac
8132case "$dflt" in
8133' ') dflt=none ;;
8134esac
8135echo " "
8136fn=dn+~
8137rp="Where do the $package library man pages (source) go?"
8138. ./getfile
8139man3dir="$ans"
8140man3direxp="$ansexp"
8141case "$man3dir" in
8142'') man3dir=' '
8143 installman3dir='';;
8144esac
8145
8146: Change installation prefix, if necessary.
8147if $test X"$prefix" != X"$installprefix"; then
8148 installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8149else
8150 installman3dir="$man3direxp"
8151fi
8152
8153: What suffix to use on installed man pages
8154case "$man3dir" in
8155' ')
8156 man3ext='0'
8157 ;;
8158*)
8159 rp="What suffix should be used for the $package library man pages?"
8160 case "$man3ext" in
8161 '') case "$man3dir" in
8162 *3) dflt=3 ;;
8163 *3p) dflt=3p ;;
8164 *3pm) dflt=3pm ;;
8165 *l) dflt=l;;
8166 *n) dflt=n;;
8167 *o) dflt=o;;
8168 *p) dflt=p;;
8169 *C) dflt=C;;
8170 *L) dflt=L;;
8171 *L3) dflt=L3;;
8172 *) dflt=3;;
8173 esac
8174 ;;
8175 *) dflt="$man3ext";;
8176 esac
8177 . ./myread
8178 man3ext="$ans"
8179 ;;
8180esac
8181
8182: see if we have to deal with yellow pages, now NIS.
0384a54a 8183if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8184 if $test -f /usr/etc/nibindd; then
8185 echo " "
8186 echo "I'm fairly confident you're on a NeXT."
8187 echo " "
8188 rp='Do you get the hosts file via NetInfo?'
8189 dflt=y
8190 case "$hostcat" in
8191 nidump*) ;;
8192 '') ;;
8193 *) dflt=n;;
8194 esac
8195 . ./myread
8196 case "$ans" in
8197 y*) hostcat='nidump hosts .';;
8198 *) case "$hostcat" in
8199 nidump*) hostcat='';;
8200 esac
8201 ;;
8202 esac
8203 fi
8204 case "$hostcat" in
8205 nidump*) ;;
8206 *)
8207 case "$hostcat" in
8208 *ypcat*) dflt=y;;
8209 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8210 dflt=y
8211 else
8212 dflt=n
8213 fi;;
8214 *) dflt=n;;
8215 esac
8216 echo " "
8217 rp='Are you getting the hosts file via yellow pages?'
8218 . ./myread
8219 case "$ans" in
8220 y*) hostcat='ypcat hosts';;
8221 *) hostcat='cat /etc/hosts';;
8222 esac
8223 ;;
8224 esac
8225fi
8226case "$hostcat" in
8227'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8228esac
8229case "$groupcat" in
8230'') test -f /etc/group && groupcat='cat /etc/group';;
8231esac
8232case "$passcat" in
8233'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8234esac
8235
8236: now get the host name
8237echo " "
8238echo "Figuring out host name..." >&4
8239case "$myhostname" in
8240'') cont=true
8241 echo 'Maybe "hostname" will work...'
73614538 8242 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8243 myhostname=$tans
8244 phostname=hostname
8245 cont=''
8246 fi
8247 ;;
8248*) cont='';;
8249esac
8250if $test "$cont"; then
8251 if ./xenix; then
8252 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8253 if tans=`cat /etc/systemid 2>&1` ; then
8254 myhostname=$tans
8255 phostname='cat /etc/systemid'
8256 echo "Whadyaknow. Xenix always was a bit strange..."
8257 cont=''
8258 fi
8259 elif $test -r /etc/systemid; then
8260 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8261 fi
8262fi
8263if $test "$cont"; then
8264 echo 'No, maybe "uuname -l" will work...'
73614538 8265 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8266 myhostname=$tans
8267 phostname='uuname -l'
8268 else
8269 echo 'Strange. Maybe "uname -n" will work...'
73614538 8270 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8271 myhostname=$tans
8272 phostname='uname -n'
8273 else
8274 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8275 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8276 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8277 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8278 else
8279 case "$myhostname" in
8280 '') echo "Does this machine have an identity crisis or something?"
8281 phostname='';;
8282 *)
8283 echo "Well, you said $myhostname before..."
8284 phostname='echo $myhostname';;
8285 esac
8286 fi
8287 fi
8288 fi
8289fi
52a549d0
JH
8290case "$myhostname" in
8291'') myhostname=noname ;;
8292esac
b4eb6b3d
JH
8293: you do not want to know about this
8294set $myhostname
8295myhostname=$1
8296
8297: verify guess
8298if $test "$myhostname" ; then
8299 dflt=y
8300 rp='Your host name appears to be "'$myhostname'".'" Right?"
8301 . ./myread
8302 case "$ans" in
8303 y*) ;;
8304 *) myhostname='';;
8305 esac
8306fi
8307
8308: bad guess or no guess
8309while $test "X$myhostname" = X ; do
8310 dflt=''
8311 rp="Please type the (one word) name of your host:"
8312 . ./myread
8313 myhostname="$ans"
8314done
8315
8316: translate upper to lower if necessary
8317case "$myhostname" in
8318*[A-Z]*)
8319 echo "(Normalizing case in your host name)"
8320 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8321 ;;
8322esac
8323
8324case "$myhostname" in
8325*.*)
8326 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8327 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8328 echo "(Trimming domain name from host name--host name is now $myhostname)"
8329 ;;
8330*) case "$mydomain" in
8331 '')
8332 {
8333 test "X$hostcat" = "Xypcat hosts" &&
8334 ypmatch "$myhostname" hosts 2>/dev/null |\
8335 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8336 $test -s hosts
8337 } || {
8338 test "X$hostcat" != "X" &&
8339 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8340 /[ ]$myhostname[ . ]/p" > hosts
8341 }
8342 tmp_re="[ . ]"
f08cbdd1
PP
8343 if $test -f hosts; then
8344 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8345 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8346 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8347 hosts | $sort | $uniq | \
8348 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8349 case `$echo X$dflt` in
8350 X*\ *) echo "(Several hosts in the database matched hostname)"
8351 dflt=.
8352 ;;
8353 X.) echo "(You do not have fully-qualified names in the hosts database)"
8354 ;;
8355 esac
8356 else
8357 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8358 dflt=.
f08cbdd1 8359 fi
b4eb6b3d
JH
8360 case "$dflt" in
8361 .)
8362 tans=`./loc resolv.conf X /etc /usr/etc`
8363 if $test -f "$tans"; then
8364 echo "(Attempting domain name extraction from $tans)"
8365 dflt=.`$sed -n -e 's/ / /g' \
8366 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8367 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8368 case "$dflt" in
8369 .) dflt=.`$sed -n -e 's/ / /g' \
8370 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8371 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8372 ;;
8373 esac
8374 fi
8375 ;;
8376 esac
8377 case "$dflt" in
8378 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8379 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8380 case "$dflt" in
8381 '') dflt='.';;
8382 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8383 esac
8384 ;;
8385 esac
59c9e5d6
PP
8386 case "$dflt$osname" in
8387 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8388 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8389 ;;
8390 esac
b4eb6b3d
JH
8391 case "$dflt" in
8392 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8393 dflt='.nonet'
b4eb6b3d
JH
8394 ;;
8395 esac
8396 $rm -f hosts
8397 ;;
8398 *) dflt="$mydomain";;
8399 esac;;
8400esac
8401echo " "
8402rp="What is your domain name?"
8403. ./myread
8404tans="$ans"
8405case "$ans" in
8406'') ;;
8407.*) ;;
8408*) tans=".$tans";;
8409esac
8410mydomain="$tans"
8411
8412: translate upper to lower if necessary
8413case "$mydomain" in
8414*[A-Z]*)
8415 echo "(Normalizing case in your domain name)"
8416 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8417 ;;
8418esac
8419
8420: a little sanity check here
8421case "$phostname" in
8422'') ;;
8423*)
8424 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8425 $myhostname$mydomain|$myhostname) ;;
8426 *)
8427 case "$phostname" in
8428 sed*)
8429 echo "(That doesn't agree with your whoami.h file, by the way.)"
8430 ;;
8431 *)
8432 echo "(That doesn't agree with your $phostname command, by the way.)"
8433 ;;
8434 esac
8435 ;;
8436 esac
8437 ;;
8438esac
8439
8440$cat <<EOM
8441
8442I need to get your e-mail address in Internet format if possible, i.e.
8443something like user@host.domain. Please answer accurately since I have
8444no easy means to double check it. The default value provided below
8445is most probably close to reality but may not be valid from outside
8446your organization...
8447
8448EOM
8449cont=x
8450while test "$cont"; do
8451 case "$cf_email" in
8452 '') dflt="$cf_by@$myhostname$mydomain";;
8453 *) dflt="$cf_email";;
8454 esac
8455 rp='What is your e-mail address?'
8456 . ./myread
8457 cf_email="$ans"
8458 case "$cf_email" in
8459 *@*.*) cont='' ;;
8460 *)
8461 rp='Address does not look like an Internet one. Use it anyway?'
8462 case "$fastread" in
8463 yes) dflt=y ;;
8464 *) dflt=n ;;
8465 esac
8466 . ./myread
8467 case "$ans" in
8468 y*) cont='' ;;
8469 *) echo " " ;;
8470 esac
8471 ;;
8472 esac
8473done
8474
8475$cat <<EOM
8476
8477If you or somebody else will be maintaining perl at your site, please
8478fill in the correct e-mail address here so that they may be contacted
8479if necessary. Currently, the "perlbug" program included with perl
8480will send mail to this address in addition to perlbug@perl.org. You may
8481enter "none" for no administrator.
8482
8483EOM
8484case "$perladmin" in
8485'') dflt="$cf_email";;
8486*) dflt="$perladmin";;
8487esac
8488rp='Perl administrator e-mail address'
8489. ./myread
8490perladmin="$ans"
8491
674912d7
RB
8492: determine whether to only install version-specific parts.
8493echo " "
8494$cat <<EOM
8495Do you want to install only the version-specific parts of the perl
8496distribution? Usually you do *not* want to do this.
8497EOM
8498case "$versiononly" in
8499"$define"|[Yy]*|true) dflt='y' ;;
8500*) dflt='n';
8501esac
8502rp="Do you want to install only the version-specific parts of perl?"
8503. ./myread
8504case "$ans" in
8505[yY]*) val="$define";;
8506*) val="$undef" ;;
8507esac
8508set versiononly
8509eval $setvar
8510
ad493445
MB
8511case "$versiononly" in
8512"$define") inc_version_list=''
8513 inc_version_list_init=0
8514 ;;
8515esac
8516
b4eb6b3d
JH
8517: figure out how to guarantee perl startup
8518case "$startperl" in
8519'')
8520 case "$sharpbang" in
8521 *!)
8522 $cat <<EOH
8523
8524I can use the #! construct to start perl on your system. This will
8525make startup of perl scripts faster, but may cause problems if you
8526want to share those scripts and perl is not in a standard place
8527($binexp/perl) on all your platforms. The alternative is to force
8528a shell by starting the script with a single ':' character.
8529
8530EOH
674912d7
RB
8531 case "$versiononly" in
8532 "$define") dflt="$binexp/perl$version";;
8533 *) dflt="$binexp/perl";;
8534 esac
b4eb6b3d
JH
8535 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8536 . ./myread
8537 case "$ans" in
8538 none) startperl=": # use perl";;
8539 *) startperl="#!$ans"
8540 if $test 30 -lt `echo "$ans" | wc -c`; then
8541 $cat >&4 <<EOM
8542
8543WARNING: Some systems limit the #! command to 32 characters.
8544If you experience difficulty running Perl scripts with #!, try
8545installing Perl in a directory with a shorter pathname.
8546
8547EOM
8548 fi ;;
8549 esac
8550 ;;
8551 *) startperl=": # use perl"
8552 ;;
8553 esac
8554 ;;
8555esac
8556echo "I'll use $startperl to start perl scripts."
8557
8558: figure best path for perl in scripts
8559case "$perlpath" in
8560'')
5e20a8ca
RGS
8561 case "$versiononly" in
8562 "$define") perlpath="$binexp/perl$version";;
8563 *) perlpath="$binexp/perl";;
8564 esac
b4eb6b3d
JH
8565 case "$startperl" in
8566 *!*) ;;
8567 *)
8568 $cat <<EOH
8569
8570I will use the "eval 'exec'" idiom to start Perl on your system.
8571I can use the full path of your Perl binary for this purpose, but
8572doing so may cause problems if you want to share those scripts and
8573Perl is not always in a standard place ($binexp/perl).
8574
8575EOH
8576 dflt="$binexp/perl"
8577 rp="What path shall I use in \"eval 'exec'\"?"
8578 . ./myread
8579 perlpath="$ans"
8580 ;;
8581 esac
8582 ;;
8583esac
8584case "$startperl" in
8585*!*) ;;
8586*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8587esac
8588
8589: determine where public executable scripts go
8590set scriptdir scriptdir
8591eval $prefixit
8592case "$scriptdir" in
8593'')
8594 dflt="$bin"
8595 : guess some guesses
8596 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8597 $test -d /usr/share/bin && dflt=/usr/share/bin
8598 $test -d /usr/local/script && dflt=/usr/local/script
8599 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8600 $test -d $prefixexp/script && dflt=$prefixexp/script
8601 set dflt
8602 eval $prefixup
8603 ;;
8604*) dflt="$scriptdir"
8605 ;;
8606esac
8607$cat <<EOM
8608
8609Some installations have a separate directory just for executable scripts so
8610that they can mount it across multiple architectures but keep the scripts in
8611one spot. You might, for example, have a subdirectory of /usr/share for this.
8612Or you might just lump your scripts in with all your other executables.
8613
8614EOM
8615fn=d~
8616rp='Where do you keep publicly executable scripts?'
8617. ./getfile
8618if $test "X$ansexp" != "X$scriptdirexp"; then
8619 installscript=''
8620fi
8621scriptdir="$ans"
8622scriptdirexp="$ansexp"
8623: Change installation prefix, if necessary.
8624if $test X"$prefix" != X"$installprefix"; then
8625 installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8626else
8627 installscript="$scriptdirexp"
8628fi
8629
8630: determine where add-on public executables go
8631case "$sitebin" in
8632'') dflt=$siteprefix/bin ;;
8633*) dflt=$sitebin ;;
8634esac
8635fn=d~
8636rp='Pathname where the add-on public executables should be installed?'
8637. ./getfile
8638sitebin="$ans"
8639sitebinexp="$ansexp"
8640: Change installation prefix, if necessary.
8641if $test X"$prefix" != X"$installprefix"; then
8642 installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8643else
8644 installsitebin="$sitebinexp"
8645fi
8646
6e1038e0 8647: determine where add-on html pages go
8d2cbf27 8648: There is no standard location, so try to copy the previously-selected
6e1038e0 8649: directory structure for the core html pages.
8d2cbf27
JH
8650case "$sitehtml1dir" in
8651'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8652*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8653esac
8654case "$dflt" in
8655''|' ') dflt=none ;;
8656esac
8657fn=dn+~
8658rp='Pathname where the site-specific html pages should be installed?'
8659. ./getfile
8d2cbf27
JH
8660sitehtml1dir="$ans"
8661sitehtml1direxp="$ansexp"
6e1038e0
MB
8662: Change installation prefix, if necessary.
8663if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 8664 installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8665else
8d2cbf27 8666 installsitehtml1dir="$sitehtml1direxp"
6e1038e0
MB
8667fi
8668
8669: determine where add-on library html pages go
8670: There is no standard location, so try to copy the previously-selected
8671: directory structure for the core html pages.
8d2cbf27
JH
8672case "$sitehtml3dir" in
8673'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8674*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8675esac
8676case "$dflt" in
8677''|' ') dflt=none ;;
8678esac
8679fn=dn+~
8680rp='Pathname where the site-specific library html pages should be installed?'
8681. ./getfile
8d2cbf27
JH
8682sitehtml3dir="$ans"
8683sitehtml3direxp="$ansexp"
6e1038e0
MB
8684: Change installation prefix, if necessary.
8685if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 8686 installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8687else
8d2cbf27 8688 installsitehtml3dir="$sitehtml3direxp"
6e1038e0
MB
8689fi
8690
8691: determine where add-on manual pages go
91e123a8
JH
8692case "$siteman1dir" in
8693'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8694*) dflt=$siteman1dir ;;
6e1038e0 8695esac
257059b5
JH
8696case "$dflt" in
8697''|' ') dflt=none ;;
8698esac
6e1038e0
MB
8699fn=dn+~
8700rp='Pathname where the site-specific manual pages should be installed?'
8701. ./getfile
91e123a8
JH
8702siteman1dir="$ans"
8703siteman1direxp="$ansexp"
6e1038e0
MB
8704: Change installation prefix, if necessary.
8705if $test X"$prefix" != X"$installprefix"; then
91e123a8 8706 installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8707else
91e123a8 8708 installsiteman1dir="$siteman1direxp"
6e1038e0
MB
8709fi
8710
8711: determine where add-on library man pages go
91e123a8
JH
8712case "$siteman3dir" in
8713'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8714*) dflt=$siteman3dir ;;
6e1038e0 8715esac
257059b5
JH
8716case "$dflt" in
8717''|' ') dflt=none ;;
8718esac
6e1038e0
MB
8719fn=dn+~
8720rp='Pathname where the site-specific library manual pages should be installed?'
8721. ./getfile
91e123a8
JH
8722siteman3dir="$ans"
8723siteman3direxp="$ansexp"
6e1038e0
MB
8724: Change installation prefix, if necessary.
8725if $test X"$prefix" != X"$installprefix"; then
91e123a8 8726 installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 8727else
91e123a8 8728 installsiteman3dir="$siteman3direxp"
6e1038e0
MB
8729fi
8730
8731: determine where add-on public executable scripts go
8732case "$sitescript" in
8733'') dflt=$siteprefix/script
8734 $test -d $dflt || dflt=$sitebin ;;
8735*) dflt="$sitescript" ;;
8736esac
8737fn=d~+
8738rp='Pathname where add-on public executable scripts should be installed?'
8739. ./getfile
8740sitescript="$ans"
8741sitescriptexp="$ansexp"
8742: Change installation prefix, if necessary.
8743if $test X"$prefix" != X"$installprefix"; then
8744 installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8745else
8746 installsitescript="$sitescriptexp"
8747fi
8748
15b61c98
JH
8749case "$usefaststdio" in
8750$define|true|[yY]*|'')
8751 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8752 case "$xversion" in
8753 [68]) dflt='y' ;;
8754 *) dflt='n' ;;
8755 esac
8756 ;;
8757*) dflt='n';;
8758esac
8759cat <<EOM
8760
8761Perl can be built to use 'fast stdio', which means using the stdio
8762library but also directly manipulating the stdio buffers to enable
8763faster I/O. Using stdio is better for backward compatibility (especially
8764for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8765interface has been preferred instead of stdio.
8766
8767If this doesn't make any sense to you, just accept the default '$dflt'.
8768EOM
8769rp='Use the "fast stdio" if available?'
8770. ./myread
8771case "$ans" in
8772y|Y) val="$define" ;;
8773*) val="$undef" ;;
8774esac
8775set usefaststdio
8776eval $setvar
8777
8778
96056487
JH
8779: define an is-a-typedef? function
8780typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8781case "$inclist" in
8782"") inclist="sys/types.h";;
8783esac;
8784eval "varval=\$$var";
8785case "$varval" in
8786"")
8787 $rm -f temp.c;
8788 for inc in $inclist; do
8789 echo "#include <$inc>" >>temp.c;
8790 done;
8791 echo "#ifdef $type" >> temp.c;
8792 echo "printf(\"We have $type\");" >> temp.c;
8793 echo "#endif" >> temp.c;
8794 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8795 if $contains $type temp.E >/dev/null 2>&1; then
8796 eval "$var=\$type";
8797 else
8798 eval "$var=\$def";
8799 fi;
8800 $rm -f temp.?;;
8801*) eval "$var=\$varval";;
8802esac'
8803
8804: define an is-a-typedef? function that prompts if the type is not available.
8805typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8806case "$inclist" in
8807"") inclist="sys/types.h";;
8808esac;
8809eval "varval=\$$var";
8810case "$varval" in
8811"")
8812 $rm -f temp.c;
8813 for inc in $inclist; do
8814 echo "#include <$inc>" >>temp.c;
8815 done;
8816 echo "#ifdef $type" >> temp.c;
8817 echo "printf(\"We have $type\");" >> temp.c;
8818 echo "#endif" >> temp.c;
8819 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8820 echo " " ;
8821 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8822 if $contains $type temp.E >/dev/null 2>&1; then
8823 echo "$type found." >&4;
8824 eval "$var=\$type";
8825 else
8826 echo "$type NOT found." >&4;
8827 dflt="$def";
8828 . ./myread ;
8829 eval "$var=\$ans";
8830 fi;
8831 $rm -f temp.?;;
8832*) eval "$var=\$varval";;
8833esac'
8834
8835: see what type lseek is declared as in the kernel
8836rp="What is the type used for lseek's offset on this system?"
8837set off_t lseektype long stdio.h sys/types.h
8838eval $typedef_ask
8839
8840echo " "
8841echo "Checking to see how big your file offsets are..." >&4
8842$cat >try.c <<EOCP
8843#include <sys/types.h>
8844#include <stdio.h>
8845int main()
8846{
8847 printf("%d\n", (int)sizeof($lseektype));
8848 return(0);
8849}
8850EOCP
8851set try
8852if eval $compile_ok; then
8853 lseeksize=`$run ./try`
8854 echo "Your file offsets are $lseeksize bytes long."
8855else
8856 dflt=$longsize
8857 echo " "
8858 echo "(I can't seem to compile the test program. Guessing...)"
8859 rp="What is the size of your file offsets (in bytes)?"
8860 . ./myread
8861 lseeksize="$ans"
8862fi
8863$rm -f try.c try
8864
8865: see what type file positions are declared as in the library
8866rp="What is the type for file position used by fsetpos()?"
8867set fpos_t fpostype long stdio.h sys/types.h
8868eval $typedef_ask
8869
8870echo " "
8871case "$fpostype" in
8872*_t) zzz="$fpostype" ;;
8873*) zzz="fpos_t" ;;
8874esac
8875echo "Checking the size of $zzz..." >&4
8876cat > try.c <<EOCP
8877#include <sys/types.h>
8878#include <stdio.h>
d1daaddf
JH
8879#$i_stdlib I_STDLIB
8880#ifdef I_STDLIB
8881#include <stdlib.h>
8882#endif
96056487
JH
8883int main() {
8884 printf("%d\n", (int)sizeof($fpostype));
8885 exit(0);
8886}
8887EOCP
8888set try
8889if eval $compile_ok; then
8890 yyy=`$run ./try`
8891 case "$yyy" in
8892 '') fpossize=4
8893 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8894 ;;
8895 *) fpossize=$yyy
8896 echo "Your $zzz is $fpossize bytes long."
8897 ;;
8898 esac
8899else
8900 dflt="$longsize"
8901 echo " " >&4
8902 echo "(I can't compile the test program. Guessing...)" >&4
8903 rp="What is the size of your file positions (in bytes)?"
8904 . ./myread
8905 fpossize="$ans"
8906fi
8907
96056487
JH
8908# Backward compatibility (uselfs is deprecated).
8909case "$uselfs" in
8910"$define"|true|[yY]*)
8911 cat <<EOM >&4
8912
8913*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8914EOM
8915 uselargefiles="$define"
8916 ;;
8917esac
8918
8919case "$lseeksize:$fpossize" in
89208:8) cat <<EOM
8921
8922You can have files larger than 2 gigabytes.
8923EOM
8924 val="$define" ;;
8925*) case "$uselargefiles" in
8926 "$undef"|false|[nN]*) dflt='n' ;;
8927 *) dflt='y' ;;
8928 esac
8929 cat <<EOM
8930
8931Perl can be built to understand large files (files larger than 2 gigabytes)
8932on some systems. To do so, Configure can be run with -Duselargefiles.
8933
8934If this doesn't make any sense to you, just accept the default '$dflt'.
8935EOM
8936 rp='Try to understand large files, if available?'
8937 . ./myread
8938 case "$ans" in
8939 y|Y) val="$define" ;;
8940 *) val="$undef" ;;
8941 esac
8942 ;;
8943esac
8944set uselargefiles
8945eval $setvar
96056487
JH
8946: Look for a hint-file generated 'call-back-unit'. If the
8947: user has specified that a large files perl is to be built,
8948: we may need to set or change some other defaults.
9da7673b
MB
8949if $test -f uselargefiles.cbu; then
8950 echo "Your platform has some specific hints regarding large file builds, using them..."
8951 . ./uselargefiles.cbu
8952fi
8953case "$uselargefiles" in
8954"$define")
96056487 8955 if $test -f uselargefiles.cbu; then
96056487
JH
8956 echo " "
8957 echo "Rechecking to see how big your file offsets are..." >&4
8958 $cat >try.c <<EOCP
8959#include <sys/types.h>
8960#include <stdio.h>
8961int main()
8962{
8963 printf("%d\n", (int)sizeof($lseektype));
8964 return(0);
8965}
8966EOCP
8967 set try
8968 if eval $compile_ok; then
8969 lseeksize=`$run ./try`
8970 $echo "Your file offsets are now $lseeksize bytes long."
8971 else
8972 dflt="$lseeksize"
8973 echo " "
8974 echo "(I can't seem to compile the test program. Guessing...)"
8975 rp="What is the size of your file offsets (in bytes)?"
8976 . ./myread
8977 lseeksize="$ans"
8978 fi
8979 case "$fpostype" in
8980 *_t) zzz="$fpostype" ;;
8981 *) zzz="fpos_t" ;;
8982 esac
8983 $echo $n "Rechecking the size of $zzz...$c" >&4
8984 $cat > try.c <<EOCP
8985#include <sys/types.h>
8986#include <stdio.h>
55954f19
JH
8987#$i_stdlib I_STDLIB
8988#ifdef I_STDLIB
8989#include <stdlib.h>
8990#endif
96056487
JH
8991int main() {
8992 printf("%d\n", (int)sizeof($fpostype));
073b6de5 8993 return(0);
96056487
JH
8994}
8995EOCP
8996 set try
8997 if eval $compile_ok; then
8998 yyy=`$run ./try`
8999 dflt="$lseeksize"
9000 case "$yyy" in
9001 '') echo " "
9002 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9003 ;;
9004 *) fpossize=$yyy
9005 echo " $fpossize bytes." >&4
9006 ;;
9007 esac
9008 else
9009 dflt="$fpossize"
9010 echo " "
9011 echo "(I can't compile the test program. Guessing...)" >&4
9012 rp="What is the size of your file positions (in bytes)?"
9013 . ./myread
9014 fpossize="$ans"
9015 fi
9016 $rm -f try.c try
9017 fi
9018 ;;
9019esac
9020
db0f2be4
MB
9021# probably will refer to
9022# $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9023need_relocation=0
9024userelocatableinc=undef
9025
b4eb6b3d
JH
9026case "$vendorprefix" in
9027'') d_vendorbin="$undef"
9028 vendorbin=''
9029 vendorbinexp=''
9030 ;;
9031*) d_vendorbin="$define"
9032 : determine where vendor-supplied executables go.
9033 case "$vendorbin" in
9034 '') dflt=$vendorprefix/bin ;;
9035 *) dflt="$vendorbin" ;;
9036 esac
9037 fn=d~+
9038 rp='Pathname for the vendor-supplied executables directory?'
9039 . ./getfile
9040 vendorbin="$ans"
9041 vendorbinexp="$ansexp"
9042 ;;
9043esac
9044: Change installation prefix, if necessary.
9045if $test X"$prefix" != X"$installprefix"; then
9046 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9047else
9048 installvendorbin="$vendorbinexp"
9049fi
9050
6e1038e0 9051case "$vendorprefix" in
8d2cbf27
JH
9052'') vendorhtml1dir=''
9053 vendorhtml1direxp=''
6e1038e0
MB
9054 ;;
9055*) : determine where vendor-supplied html pages go.
9056 : There is no standard location, so try to copy the previously-selected
9057 : directory structure for the core html pages.
9058 : XXX Better default suggestions would be welcome.
8d2cbf27 9059 case "$vendorhtml1dir" in
6e1038e0 9060 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9061 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9062 esac
9063 case "$dflt" in
9064 ''|' ') dflt=none ;;
9065 esac
9066 fn=dn+~
9067 rp='Pathname for the vendor-supplied html pages?'
9068 . ./getfile
8d2cbf27
JH
9069 vendorhtml1dir="$ans"
9070 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9071 ;;
9072esac
9073: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9074$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
6e1038e0
MB
9075: Change installation prefix, if necessary.
9076if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 9077 installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9078else
8d2cbf27 9079 installvendorhtml1dir="$vendorhtml1direxp"
6e1038e0
MB
9080fi
9081
9082case "$vendorprefix" in
8d2cbf27
JH
9083'') vendorhtml3dir=''
9084 vendorhtml3direxp=''
6e1038e0
MB
9085 ;;
9086*) : determine where vendor-supplied module html pages go.
9087 : There is no standard location, so try to copy the previously-selected
9088 : directory structure for the core html pages.
9089 : XXX Better default suggestions would be welcome.
8d2cbf27 9090 case "$vendorhtml3dir" in
6e1038e0 9091 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9092 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9093 esac
9094 case "$dflt" in
9095 ''|' ') dflt=none ;;
9096 esac
9097 fn=dn+~
9098 rp='Pathname for the vendor-supplied html pages?'
9099 . ./getfile
8d2cbf27
JH
9100 vendorhtml3dir="$ans"
9101 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9102 ;;
9103esac
9104: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9105$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
6e1038e0
MB
9106: Change installation prefix, if necessary.
9107if $test X"$prefix" != X"$installprefix"; then
8d2cbf27 9108 installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9109else
8d2cbf27 9110 installvendorhtml3dir="$vendorhtml3direxp"
6e1038e0
MB
9111fi
9112
9113case "$vendorprefix" in
91e123a8
JH
9114'') vendorman1dir=''
9115 vendorman1direxp=''
6e1038e0
MB
9116 ;;
9117*) : determine where vendor-supplied manual pages go.
91e123a8 9118 case "$vendorman1dir" in
6e1038e0 9119 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9120 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9121 esac
9122 case "$dflt" in
9123 ''|' ') dflt=none ;;
9124 esac
9125 fn=nd~+
9126 rp='Pathname for the vendor-supplied manual section 1 pages?'
9127 . ./getfile
91e123a8
JH
9128 vendorman1dir="$ans"
9129 vendorman1direxp="$ansexp"
6e1038e0
MB
9130 ;;
9131esac
9132: Use ' ' for none so value is preserved next time through Configure
91e123a8 9133$test X"$vendorman1dir" = "X" && vendorman1dir=' '
6e1038e0
MB
9134: Change installation prefix, if necessary.
9135if $test X"$prefix" != X"$installprefix"; then
91e123a8 9136 installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9137else
91e123a8 9138 installvendorman1dir="$vendorman1direxp"
6e1038e0
MB
9139fi
9140
9141case "$vendorprefix" in
91e123a8
JH
9142'') vendorman3dir=''
9143 vendorman3direxp=''
6e1038e0
MB
9144 ;;
9145*) : determine where vendor-supplied module manual pages go.
91e123a8 9146 case "$vendorman3dir" in
6e1038e0 9147 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9148 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9149 esac
9150 case "$dflt" in
9151 ''|' ') dflt=none ;;
9152 esac
9153 fn=nd~+
9154 rp='Pathname for the vendor-supplied manual section 3 pages?'
9155 . ./getfile
91e123a8
JH
9156 vendorman3dir="$ans"
9157 vendorman3direxp="$ansexp"
6e1038e0
MB
9158 ;;
9159esac
9160: Use ' ' for none so value is preserved next time through Configure
91e123a8 9161$test X"$vendorman3dir" = "X" && vendorman3dir=' '
6e1038e0
MB
9162: Change installation prefix, if necessary.
9163if $test X"$prefix" != X"$installprefix"; then
91e123a8 9164 installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
6e1038e0 9165else
91e123a8 9166 installvendorman3dir="$vendorman3direxp"
6e1038e0
MB
9167fi
9168
9169case "$vendorprefix" in
9170'') d_vendorscript="$undef"
9171 vendorscript=''
9172 vendorscriptexp=''
9173 ;;
9174*) d_vendorscript="$define"
9175 : determine where vendor-supplied scripts go.
9176 case "$vendorscript" in
9177 '') dflt=$vendorprefix/script
9178 $test -d $dflt || dflt=$vendorbin ;;
9179 *) dflt="$vendorscript" ;;
9180 esac
9181 $cat <<EOM
9182
9183The installation process will create a directory for
9184vendor-supplied scripts.
9185
9186EOM
9187 fn=d~+
9188 rp='Pathname for the vendor-supplied scripts directory?'
9189 . ./getfile
9190 vendorscript="$ans"
9191 vendorscriptexp="$ansexp"
9192 ;;
9193esac
9194: Change installation prefix, if necessary.
9195if $test X"$prefix" != X"$installprefix"; then
9196 installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9197else
9198 installvendorscript="$vendorscriptexp"
9199fi
9200
b4eb6b3d
JH
9201: see if qgcvt exists
9202set qgcvt d_qgcvt
9203eval $inlibc
9204
89ce900e
JH
9205echo " "
9206
9207if $test X"$d_longdbl" = X"$define"; then
9208
9209echo "Checking how to print long doubles..." >&4
9210
9211if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9212 $cat >try.c <<'EOCP'
9213#include <sys/types.h>
9214#include <stdio.h>
9215int main() {
9216 double d = 123.456;
9217 printf("%.3f\n", d);
9218}
9219EOCP
9220 set try
9221 if eval $compile; then
9222 yyy=`$run ./try`
9223 case "$yyy" in
9224 123.456)
9225 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9226 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9227 echo "We will use %f."
9228 ;;
9229 esac
9230 fi
9231fi
9232
9233if $test X"$sPRIfldbl" = X; then
9234 $cat >try.c <<'EOCP'
9235#include <sys/types.h>
9236#include <stdio.h>
9237int main() {
9238 long double d = 123.456;
9239 printf("%.3Lf\n", d);
9240}
9241EOCP
9242 set try
9243 if eval $compile; then
9244 yyy=`$run ./try`
9245 case "$yyy" in
9246 123.456)
9247 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9248 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9249 echo "We will use %Lf."
9250 ;;
9251 esac
9252 fi
9253fi
9254
9255if $test X"$sPRIfldbl" = X; then
9256 $cat >try.c <<'EOCP'
9257#include <sys/types.h>
9258#include <stdio.h>
9259int main() {
9260 long double d = 123.456;
9261 printf("%.3llf\n", d);
9262}
9263EOCP
9264 set try
9265 if eval $compile; then
9266 yyy=`$run ./try`
9267 case "$yyy" in
9268 123.456)
9269 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9270 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9271 echo "We will use %llf."
9272 ;;
9273 esac
9274 fi
9275fi
9276
9277if $test X"$sPRIfldbl" = X; then
9278 $cat >try.c <<'EOCP'
9279#include <sys/types.h>
9280#include <stdio.h>
9281int main() {
9282 long double d = 123.456;
9283 printf("%.3lf\n", d);
9284}
9285EOCP
9286 set try
9287 if eval $compile; then
9288 yyy=`$run ./try`
9289 case "$yyy" in
9290 123.456)
9291 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9292 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9293 echo "We will use %lf."
9294 ;;
9295 esac
9296 fi
9297fi
9298
9299if $test X"$sPRIfldbl" = X; then
9300 echo "Cannot figure out how to print long doubles." >&4
9301else
9302 sSCNfldbl=$sPRIfldbl # expect consistency
9303fi
9304
9305$rm -f try try.*
9306
9307fi # d_longdbl
9308
9309case "$sPRIfldbl" in
9310'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9311 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9312 d_SCNfldbl="$undef";
9313 ;;
9314*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9315 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9316 d_SCNfldbl="$define";
9317 ;;
9318esac
9319
b4eb6b3d 9320: Check how to convert floats to strings.
a5b10d80
YST
9321
9322if test "X$d_Gconvert" = X; then
9323
b4eb6b3d
JH
9324echo " "
9325echo "Checking for an efficient way to convert floats to strings."
9326echo " " > try.c
9327case "$uselongdouble" in
9328"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9329esac
9330case "$d_longdbl" in
9331"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9332esac
9333case "$d_PRIgldbl" in
9334"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9335esac
9336$cat >>try.c <<EOP
9337#ifdef TRY_gconvert
9338#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9339char *myname = "gconvert";
9340#endif
9341#ifdef TRY_gcvt
9342#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9343char *myname = "gcvt";
9344#endif
9345#ifdef TRY_qgcvt
9346#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9347char *myname = "qgcvt";
9348#define DOUBLETYPE long double
9349#endif
9350#ifdef TRY_sprintf
a5b10d80
YST
9351#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9352#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9353#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9354#else
a5b10d80
YST
9355#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9356#endif
9357#else
b4eb6b3d
JH
9358#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9359#endif
9360char *myname = "sprintf";
9361#endif
9362
9363#ifndef DOUBLETYPE
9364#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9365#define DOUBLETYPE long double
9366#else
9367#define DOUBLETYPE double
9368#endif
9369#endif
9370
9371#include <stdio.h>
9372
9373#define I_STDLIB $i_stdlib
9374#ifdef I_STDLIB
9375#include <stdlib.h>
9376#endif
9377
9378int
9379checkit(expect, got)
9380char *expect;
9381char *got;
9382{
9383 if (strcmp(expect, got)) {
9384 printf("%s oddity: Expected %s, got %s\n",
9385 myname, expect, got);
9386 exit(1);
9387 }
9388}
9389
9390int main()
9391{
9392 char buf[64];
9393 buf[63] = '\0';
9394
9395 /* This must be 1st test on (which?) platform */
9396 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9397 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9398 checkit("0.1", buf);
9399
a5b10d80
YST
9400 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9401 checkit("0.01", buf);
9402
9403 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9404 checkit("0.001", buf);
9405
9406 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9407 checkit("0.0001", buf);
9408
9409 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9410 if (strlen(buf) > 5)
9411 checkit("9e-005", buf); /* for Microsoft ?? */
9412 else
9413 checkit("9e-05", buf);
9414
b4eb6b3d
JH
9415 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9416 checkit("1", buf);
9417
9418 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9419 checkit("1.1", buf);
9420
9421 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9422 checkit("1.01", buf);
9423
9424 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9425 checkit("1.001", buf);
9426
9427 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9428 checkit("1.0001", buf);
9429
9430 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9431 checkit("1.00001", buf);
9432
9433 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9434 checkit("1.000001", buf);
9435
9436 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9437 checkit("0", buf);
9438
9439 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9440 checkit("-1", buf);
9441
9442 /* Some Linux gcvt's give 1.e+5 here. */
9443 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9444 checkit("100000", buf);
9445
9446 /* Some Linux gcvt's give -1.e+5 here. */
9447 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9448 checkit("-100000", buf);
9449
9450 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9451 checkit("123.456", buf);
9452
ab6ca9f4 9453 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9454 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9455 /* 34 should be enough to scare even long double
9456 * places into using the e notation. */
ab6ca9f4 9457 if (strlen(buf) > 5)
94b339ad 9458 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9459 else
94b339ad 9460 checkit("1e+34", buf);
8e2a5ede 9461
d1eb8299
YST
9462 /* For Perl, if you add additional tests here, also add them to
9463 * t/base/num.t for benefit of platforms not using Configure or
9464 * overriding d_Gconvert */
9465
b4eb6b3d
JH
9466 exit(0);
9467}
9468EOP
ab6ca9f4 9469: first add preferred functions to our list
a5b10d80 9470xxx_list=""
ab6ca9f4 9471for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9472 case $xxx_convert in
9473 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9474 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9475 esac
9476done
9477: then add any others
9478for xxx_convert in gconvert gcvt sprintf; do
9479 case "$xxx_list" in
9480 *$xxx_convert*) ;;
9481 *) xxx_list="$xxx_list $xxx_convert" ;;
9482 esac
9483done
9484
9485case "$d_longdbl$uselongdouble" in
9486"$define$define")
9487 : again, add prefered functions to our list first
9488 xxx_ld_list=""
ab6ca9f4 9489 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9490 case $xxx_convert in
9491 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9492 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9493 esac
9494 done
9495 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9496 for xxx_convert in qgcvt sprintf $xxx_list; do
9497 case "$xxx_ld_list" in
9498 $xxx_convert*|*" $xxx_convert"*) ;;
9499 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9500 esac
9501 done
9502 : if sprintf cannot do long doubles, move it to the end
9503 if test "$d_PRIgldbl" != "$define"; then
9504 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9505 fi
9506 : if no qgcvt, remove it
9507 if test "$d_qgcvt" != "$define"; then
9508 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9509 fi
9510 : use the ld_list
9511 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9512 ;;
9513esac
9514
9515for xxx_convert in $xxx_list; do
9516 echo "Trying $xxx_convert..."
9517 $rm -f try try$_o
9518 set try -DTRY_$xxx_convert
9519 if eval $compile; then
9520 echo "$xxx_convert() found." >&4
5440bc8e 9521 if $run ./try; then
b4eb6b3d
JH
9522 echo "I'll use $xxx_convert to convert floats into a string." >&4
9523 break;
9524 else
9525 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9526 xxx_convert=''
b4eb6b3d
JH
9527 fi
9528 else
9529 echo "$xxx_convert NOT found." >&4
9530 fi
9531done
ab6ca9f4 9532
a5b10d80
YST
9533if test X$xxx_convert = X; then
9534 echo "*** WHOA THERE!!! ***" >&4
9535 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9536 xxx_convert=sprintf
9537fi
9538
b4eb6b3d
JH
9539case "$xxx_convert" in
9540gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9541gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9542qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9543*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9544 "$define$define$define")
9545 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9546 "$define$define$undef")
9547 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9548 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9549 esac
9550 ;;
9551esac
9552
a5b10d80
YST
9553fi
9554
74cac757
JH
9555: see if _fwalk exists
9556set fwalk d__fwalk
9557eval $inlibc
9558
b4eb6b3d
JH
9559: Initialize h_fcntl
9560h_fcntl=false
9561
9562: Initialize h_sysfile
9563h_sysfile=false
9564
9565: access call always available on UNIX
9566set access d_access
9567eval $inlibc
9568
9569: locate the flags for 'access()'
9570case "$d_access" in
9571"$define")
9572 echo " "
55954f19 9573 $cat >access.c <<EOCP
b4eb6b3d
JH
9574#include <sys/types.h>
9575#ifdef I_FCNTL
9576#include <fcntl.h>
9577#endif
9578#ifdef I_SYS_FILE
9579#include <sys/file.h>
9580#endif
9581#ifdef I_UNISTD
9582#include <unistd.h>
9583#endif
55954f19
JH
9584#$i_stdlib I_STDLIB
9585#ifdef I_STDLIB
9586#include <stdlib.h>
9587#endif
b4eb6b3d
JH
9588int main() {
9589 exit(R_OK);
9590}
9591EOCP
9592 : check sys/file.h first, no particular reason here
9593 if $test `./findhdr sys/file.h` && \
7a282f6d 9594 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9595 h_sysfile=true;
9596 echo "<sys/file.h> defines the *_OK access constants." >&4
9597 elif $test `./findhdr fcntl.h` && \
7a282f6d 9598 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9599 h_fcntl=true;
9600 echo "<fcntl.h> defines the *_OK access constants." >&4
9601 elif $test `./findhdr unistd.h` && \
7a282f6d 9602 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9603 echo "<unistd.h> defines the *_OK access constants." >&4
9604 else
9605 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9606 fi
9607 ;;
9608esac
9609$rm -f access*
9610
9611: see if accessx exists
9612set accessx d_accessx
9613eval $inlibc
9614
89ce900e
JH
9615: see if aintl exists
9616set aintl d_aintl
9617eval $inlibc
9618
b4eb6b3d
JH
9619: see if alarm exists
9620set alarm d_alarm
9621eval $inlibc
9622
a9dade78
JH
9623: see if POSIX threads are available
9624set pthread.h i_pthread
9625eval $inhdr
9626
10bc17b6
JH
9627: define a fucntion to check prototypes
9628$cat > protochk <<EOSH
9629$startsh
9630cc="$cc"
9631optimize="$optimize"
9632ccflags="$ccflags"
9633prototype="$prototype"
9634define="$define"
9635rm=$rm
a9dade78
JH
9636usethreads=$usethreads
9637i_pthread=$i_pthread
9638pthread_h_first=$pthread_h_first
10bc17b6
JH
9639EOSH
9640
9641$cat >> protochk <<'EOSH'
9642
9643$rm -f try.c
9644foo="$1"
9645shift
9646while test $# -ge 2; do
9647 case "$1" in
9648 $define) echo "#include <$2>" >> try.c ;;
9649 literal) echo "$2" >> try.c ;;
9650 esac
cce6a207
MB
9651 # Extra magic for the benefit of systems that need pthread.h
9652 # to be included early to correctly detect threadsafe functions.
9653 # Such functions must guarantee themselves, though, that the usethreads
9654 # and i_pthread have been defined, before calling protochk.
9655 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9656 echo "#include <pthread.h>" >> try.c
9657 pthread_h_done=yes
9658 fi
10bc17b6
JH
9659 shift 2
9660done
9661test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9662cat >> try.c <<'EOCP'
9663#ifdef CAN_PROTOTYPE
9664#define _(args) args
9665#else
9666#define _(args) ()
9667#endif
9668EOCP
9669echo "$foo" >> try.c
9670echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9671$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9672status=$?
9673$rm -f try.[co]
9674exit $status
9675EOSH
9676chmod +x protochk
9677$eunicefix protochk
9678
89ce900e
JH
9679hasproto='varname=$1; func=$2; shift; shift;
9680while $test $# -ge 2; do
9681 case "$1" in
9682 $define) echo "#include <$2>";;
9683 esac ;
9684 shift 2;
9685done > try.c;
9686$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9687if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9688 echo "$func() prototype found.";
9689 val="$define";
9690else
9691 echo "$func() prototype NOT found.";
9692 val="$undef";
9693fi;
9694set $varname;
9695eval $setvar;
9696$rm -f try.c tryout.c'
9697
10bc17b6
JH
9698: see if sys/types.h has to be included
9699set sys/types.h i_systypes
9700eval $inhdr
9701
9702: see if sys/select.h has to be included
9703set sys/select.h i_sysselct
9704eval $inhdr
9705
9706hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9707while $test $# -ge 2; do
9708 case "$1" in
9709 $define) echo "#include <$2>";;
9710 esac ;
9711 shift 2;
9712done > try.c;
9713echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9714set try;
9715if eval $compile; then
9716 val="$define";
9717else
9718 val="$undef";
9719fi;
9720set $varname;
9721eval $setvar;
9722$rm -f try.c try.o'
9723
9724: see if we should include time.h, sys/time.h, or both
9725echo " "
9726if test "X$timeincl" = X; then
9727 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9728 $echo $n "I'm now running the test program...$c"
55954f19 9729 $cat >try.c <<EOCP
10bc17b6
JH
9730#include <sys/types.h>
9731#ifdef I_TIME
9732#include <time.h>
9733#endif
9734#ifdef I_SYSTIME
9735#ifdef SYSTIMEKERNEL
9736#define KERNEL
9737#endif
9738#include <sys/time.h>
9739#endif
9740#ifdef I_SYSSELECT
9741#include <sys/select.h>
9742#endif
55954f19
JH
9743#$i_stdlib I_STDLIB
9744#ifdef I_STDLIB
9745#include <stdlib.h>
9746#endif
10bc17b6
JH
9747int main()
9748{
9749 struct tm foo;
9750#ifdef S_TIMEVAL
9751 struct timeval bar;
9752#endif
9753#ifdef S_TIMEZONE
9754 struct timezone tzp;
9755#endif
9756 if (foo.tm_sec == foo.tm_sec)
9757 exit(0);
9758#ifdef S_TIMEVAL
9759 if (bar.tv_sec == bar.tv_sec)
9760 exit(0);
9761#endif
9762 exit(1);
9763}
9764EOCP
9765 flags=''
9766 for s_timezone in '-DS_TIMEZONE' ''; do
9767 sysselect=''
9768 for s_timeval in '-DS_TIMEVAL' ''; do
9769 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9770 for i_time in '' '-DI_TIME'; do
9771 for i_systime in '-DI_SYSTIME' ''; do
9772 case "$flags" in
9773 '') $echo $n ".$c"
9774 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9775 if eval $compile; then
9776 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9777 shift
9778 flags="$*"
9779 echo " "
9780 $echo $n "Succeeded with $flags$c"
9781 fi
9782 ;;
9783 esac
9784 done
9785 done
9786 done
9787 done
9788 done
9789 timeincl=''
9790 echo " "
9791 case "$flags" in
9792 *SYSTIMEKERNEL*) i_systimek="$define"
9793 timeincl=`./findhdr sys/time.h`
9794 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9795 *) i_systimek="$undef";;
9796 esac
9797 case "$flags" in
9798 *I_TIME*) i_time="$define"
9799 timeincl=`./findhdr time.h`" $timeincl"
9800 echo "We'll include <time.h>." >&4;;
9801 *) i_time="$undef";;
9802 esac
9803 case "$flags" in
9804 *I_SYSTIME*) i_systime="$define"
9805 timeincl=`./findhdr sys/time.h`" $timeincl"
9806 echo "We'll include <sys/time.h>." >&4;;
9807 *) i_systime="$undef";;
9808 esac
9809 $rm -f try.c try
9810fi
9811: see if struct tm knows about tm_zone
9812case "$i_systime$i_time" in
9813*$define*)
9814 echo " "
9815 echo "Checking to see if your struct tm has tm_zone field..." >&4
9816 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9817 eval $hasfield
9818 ;;
9819*) val="$undef"
9820 set d_tm_tm_zone
9821 eval $setvar
9822 ;;
9823esac
9824case "$d_tm_tm_zone" in
9825"$define") echo "Yes, it does." ;;
9826*) echo "No, it doesn't." ;;
9827esac
9828: see if struct tm knows about tm_gmtoff
9829case "$i_systime$i_time" in
9830*$define*)
9831 echo " "
9832 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9833 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9834 eval $hasfield
9835 ;;
9836*) val="$undef"
9837 set d_tm_tm_gmtoff
9838 eval $setvar
9839 ;;
9840esac
9841case "$d_tm_tm_gmtoff" in
9842"$define") echo "Yes, it does." ;;
9843*) echo "No, it doesn't." ;;
9844esac
9845
9846: see if asctime_r exists
9847set asctime_r d_asctime_r
9848eval $inlibc
9849case "$d_asctime_r" in
9850"$define")
d63eadf0 9851 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9852 case "$d_asctime_r_proto:$usethreads" in
9853 ":define") d_asctime_r_proto=define
a48ec845
JH
9854 set d_asctime_r_proto asctime_r $hdrs
9855 eval $hasproto ;;
9856 *) ;;
9857 esac
9858 case "$d_asctime_r_proto" in
9859 define)
10bc17b6
JH
9860 case "$asctime_r_proto" in
9861 ''|0) try='char* asctime_r(const struct tm*, char*);'
9862 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9863 esac
9864 case "$asctime_r_proto" in
9865 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9866 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9867 esac
9868 case "$asctime_r_proto" in
9869 ''|0) try='int asctime_r(const struct tm*, char*);'
9870 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9871 esac
9872 case "$asctime_r_proto" in
9873 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9874 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9875 esac
9876 case "$asctime_r_proto" in
90e831dc 9877 ''|0) d_asctime_r=undef
10bc17b6 9878 asctime_r_proto=0
a48ec845 9879 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9880 * ) case "$asctime_r_proto" in
9881 REENTRANT_PROTO*) ;;
9882 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9883 esac
9884 echo "Prototype: $try" ;;
9885 esac
9886 ;;
c18e646a
JH
9887 *) case "$usethreads" in
9888 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9889 esac
90e831dc
SB
9890 d_asctime_r=undef
9891 asctime_r_proto=0
c18e646a 9892 ;;
a48ec845
JH
9893 esac
9894 ;;
10bc17b6
JH
9895*) asctime_r_proto=0
9896 ;;
9897esac
9898
b4eb6b3d
JH
9899: see if atolf exists
9900set atolf d_atolf
9901eval $inlibc
9902
9903: see if atoll exists
9904set atoll d_atoll
9905eval $inlibc
9906
0dbb1585
AL
9907: Look for GCC-style attribute format
9908case "$d_attribute_format" in
bde30f85 9909'')
b4eb6b3d 9910echo " "
0dbb1585 9911echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
9912$cat >attrib.c <<'EOCP'
9913#include <stdio.h>
0dbb1585 9914void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
9915EOCP
9916if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9917 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 9918 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
9919 val="$undef"
9920 else
0dbb1585 9921 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
9922 val="$define"
9923 fi
9924else
9925 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9926 val="$undef"
9927fi
bde30f85 9928;;
0dbb1585 9929*) val="$d_attribute_format" ;;
bde30f85 9930esac
0dbb1585
AL
9931set d_attribute_format
9932eval $setvar
9933$rm -f attrib*
9934
9935: Look for GCC-style attribute malloc
9936case "$d_attribute_malloc" in
9937'')
9938echo " "
9939echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9940$cat >attrib.c <<'EOCP'
9941#include <stdio.h>
9942char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9943EOCP
9944if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9945 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9946 echo "Your C compiler doesn't support __attribute__((malloc))."
9947 val="$undef"
9948 else
9949 echo "Your C compiler supports __attribute__((malloc))."
9950 val="$define"
9951 fi
9952else
9953 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9954 val="$undef"
9955fi
9956;;
9957*) val="$d_attribute_malloc" ;;
9958esac
9959set d_attribute_malloc
9960eval $setvar
9961$rm -f attrib*
9962
9963: Look for GCC-style attribute nonnull
9964case "$d_attribute_nonnull" in
9965'')
9966echo " "
9967echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9968$cat >attrib.c <<'EOCP'
9969#include <stdio.h>
9970void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9971EOCP
9972if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9973 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9974 echo "Your C compiler doesn't support __attribute__((nonnull))."
9975 val="$undef"
9976 else
9977 echo "Your C compiler supports __attribute__((nonnull))."
9978 val="$define"
9979 fi
9980else
9981 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9982 val="$undef"
9983fi
9984;;
9985*) val="$d_attribute_nonnull" ;;
9986esac
9987set d_attribute_nonnull
9988eval $setvar
9989$rm -f attrib*
9990
9991: Look for GCC-style attribute noreturn
9992case "$d_attribute_noreturn" in
9993'')
9994echo " "
9995echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9996$cat >attrib.c <<'EOCP'
9997#include <stdio.h>
9998void fall_over_dead( void ) __attribute__((noreturn));
9999EOCP
10000if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10001 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10002 echo "Your C compiler doesn't support __attribute__((noreturn))."
10003 val="$undef"
10004 else
10005 echo "Your C compiler supports __attribute__((noreturn))."
10006 val="$define"
10007 fi
10008else
10009 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10010 val="$undef"
10011fi
10012;;
10013*) val="$d_attribute_noreturn" ;;
10014esac
10015set d_attribute_noreturn
10016eval $setvar
10017$rm -f attrib*
10018
10019: Look for GCC-style attribute pure
10020case "$d_attribute_pure" in
10021'')
10022echo " "
10023echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10024$cat >attrib.c <<'EOCP'
10025#include <stdio.h>
10026int square( int n ) __attribute__((pure));
10027EOCP
10028if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10029 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10030 echo "Your C compiler doesn't support __attribute__((pure))."
10031 val="$undef"
10032 else
10033 echo "Your C compiler supports __attribute__((pure))."
10034 val="$define"
10035 fi
10036else
10037 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10038 val="$undef"
10039fi
10040;;
10041*) val="$d_attribute_pure" ;;
10042esac
10043set d_attribute_pure
10044eval $setvar
10045$rm -f attrib*
10046
10047: Look for GCC-style attribute unused
10048case "$d_attribute_unused" in
10049'')
10050echo " "
10051echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10052$cat >attrib.c <<'EOCP'
10053#include <stdio.h>
10054int do_something( int dummy __attribute__((unused)), int n );
10055EOCP
10056if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10057 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10058 echo "Your C compiler doesn't support __attribute__((unused))."
10059 val="$undef"
10060 else
10061 echo "Your C compiler supports __attribute__((unused))."
10062 val="$define"
10063 fi
10064else
10065 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10066 val="$undef"
10067fi
10068;;
10069*) val="$d_attribute_unused" ;;
10070esac
10071set d_attribute_unused
10072eval $setvar
10073$rm -f attrib*
10074
10075: Look for GCC-style attribute warn_unused_result
10076case "$d_attribute_warn_unused_result" in
10077'')
10078echo " "
10079echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10080$cat >attrib.c <<'EOCP'
10081#include <stdio.h>
10082int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10083EOCP
10084if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10085 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10086 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10087 val="$undef"
10088 else
10089 echo "Your C compiler supports __attribute__((warn_unused_result))."
10090 val="$define"
10091 fi
10092else
10093 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10094 val="$undef"
10095fi
10096;;
10097*) val="$d_attribute_warn_unused_result" ;;
10098esac
10099set d_attribute_warn_unused_result
b4eb6b3d
JH
10100eval $setvar
10101$rm -f attrib*
10102
10103: see if bcmp exists
10104set bcmp d_bcmp
10105eval $inlibc
10106
10107: see if bcopy exists
10108set bcopy d_bcopy
10109eval $inlibc
10110
10111: see if this is a unistd.h system
10112set unistd.h i_unistd
10113eval $inhdr
10114
10115: see if getpgrp exists
10116set getpgrp d_getpgrp
10117eval $inlibc
10118
10119case "$d_getpgrp" in
10120"$define")
10121 echo " "
10122 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10123 $cat >try.c <<EOP
b4eb6b3d
JH
10124#$i_unistd I_UNISTD
10125#include <sys/types.h>
10126#ifdef I_UNISTD
10127# include <unistd.h>
10128#endif
55954f19
JH
10129#$i_stdlib I_STDLIB
10130#ifdef I_STDLIB
10131#include <stdlib.h>
10132#endif
b4eb6b3d
JH
10133int main()
10134{
10135 if (getuid() == 0) {
10136 printf("(I see you are running Configure as super-user...)\n");
10137 setuid(1);
10138 }
10139#ifdef TRY_BSD_PGRP
10140 if (getpgrp(1) == 0)
10141 exit(0);
10142#else
10143 if (getpgrp() > 0)
10144 exit(0);
10145#endif
10146 exit(1);
10147}
10148EOP
5440bc8e 10149 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10150 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10151 val="$define"
5440bc8e 10152 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10153 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10154 val="$undef"
10155 else
10156 echo "I can't seem to compile and run the test program."
10157 if ./usg; then
10158 xxx="a USG one, i.e. you use getpgrp()."
10159 else
10160 # SVR4 systems can appear rather BSD-ish.
10161 case "$i_unistd" in
10162 $undef)
10163 xxx="a BSD one, i.e. you use getpgrp(pid)."
10164 val="$define"
10165 ;;
10166 $define)
10167 xxx="probably a USG one, i.e. you use getpgrp()."
10168 val="$undef"
10169 ;;
10170 esac
10171 fi
10172 echo "Assuming your getpgrp is $xxx" >&4
10173 fi
10174 ;;
10175*) val="$undef";;
10176esac
10177set d_bsdgetpgrp
10178eval $setvar
5440bc8e 10179$rm -f try try.*
b4eb6b3d
JH
10180
10181: see if setpgrp exists
10182set setpgrp d_setpgrp
10183eval $inlibc
10184
10185case "$d_setpgrp" in
10186"$define")
10187 echo " "
10188 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10189 $cat >try.c <<EOP
b4eb6b3d
JH
10190#$i_unistd I_UNISTD
10191#include <sys/types.h>
10192#ifdef I_UNISTD
10193# include <unistd.h>
10194#endif
55954f19
JH
10195#$i_stdlib I_STDLIB
10196#ifdef I_STDLIB
10197#include <stdlib.h>
10198#endif
b4eb6b3d
JH
10199int main()
10200{
10201 if (getuid() == 0) {
10202 printf("(I see you are running Configure as super-user...)\n");
10203 setuid(1);
10204 }
10205#ifdef TRY_BSD_PGRP
10206 if (-1 == setpgrp(1, 1))
10207 exit(0);
10208#else
10209 if (setpgrp() != -1)
10210 exit(0);
10211#endif
10212 exit(1);
10213}
10214EOP
5440bc8e 10215 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10216 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10217 val="$define"
5440bc8e 10218 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10219 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10220 val="$undef"
10221 else
10222 echo "(I can't seem to compile and run the test program.)"
10223 if ./usg; then
10224 xxx="a USG one, i.e. you use setpgrp()."
10225 else
10226 # SVR4 systems can appear rather BSD-ish.
10227 case "$i_unistd" in
10228 $undef)
10229 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10230 val="$define"
10231 ;;
10232 $define)
10233 xxx="probably a USG one, i.e. you use setpgrp()."
10234 val="$undef"
10235 ;;
10236 esac
10237 fi
10238 echo "Assuming your setpgrp is $xxx" >&4
10239 fi
10240 ;;
10241*) val="$undef";;
10242esac
10243set d_bsdsetpgrp
10244eval $setvar
5440bc8e 10245$rm -f try try.*
635aebb7
AL
10246: Look for GCC-style __builtin_choose_expr
10247case "$d_builtin_choose_expr" in
10248'')
10249 echo " "
10250 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10251 $cat >try.c <<'EOCP'
10252#include <assert.h>
10253#include <stdlib.h>
10254#include <stdio.h>
10255
10256#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10257
10258int main(void) {
10259 assert( SYRINX(1) == 2112 );
10260 assert( SYRINX(1) != 5150 );
10261 assert( SYRINX(0) == 5150 );
10262 assert( SYRINX(0) != 2112 );
10263 puts( "All good!" );
10264 exit(0);
10265}
10266
10267EOCP
10268 set try
10269 if eval $compile; then
10270 echo "Your C compiler supports __builtin_choose_expr."
10271 val="$define"
10272 else
10273 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10274 val="$undef"
10275 fi
10276;;
10277*) val="$d_builtin_choose_expr" ;;
10278esac
10279
10280set d_builtin_choose_expr
10281eval $setvar
10282$rm -f try.* try core core.try.*
10283
10284: Look for GCC-style __builtin_expect
10285case "$d_builtin_expect" in
10286'')
10287 echo " "
10288 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10289 $cat >builtin.c <<'EOCP'
10290int main(void) {
10291 int n = 50;
10292 if ( __builtin_expect(n, 0) ) n = 1;
10293}
10294EOCP
10295 set try
10296 if eval $compile; then
10297 echo "Your C compiler supports __builtin_choose_expr."
10298 val="$define"
10299 else
10300 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10301 val="$undef"
10302 fi
10303 ;;
10304*) val="$d_builtin_expect" ;;
10305esac
10306
10307set d_builtin_expect
10308eval $setvar
10309$rm -f try.* try core core.try.*
10310
b4eb6b3d
JH
10311: see if bzero exists
10312set bzero d_bzero
10313eval $inlibc
10314
10315: see if signal is declared as pointer to function returning int or void
10316echo " "
10317xxx=`./findhdr signal.h`
10318$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10319if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10320 echo "You have int (*signal())() instead of void." >&4
10321 val="$undef"
10322elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10323 echo "You have void (*signal())()." >&4
10324 val="$define"
10325elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10326 echo "You have int (*signal())() instead of void." >&4
10327 val="$undef"
10328elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10329 echo "You have void (*signal())()." >&4
10330 val="$define"
10331else
10332 case "$d_voidsig" in
10333 '')
10334 echo "I can't determine whether signal handler returns void or int..." >&4
10335 dflt=void
10336 rp="What type does your signal handler return?"
10337 . ./myread
10338 case "$ans" in
10339 v*) val="$define";;
10340 *) val="$undef";;
10341 esac;;
10342 "$define")
10343 echo "As you already told me, signal handler returns void." >&4
10344 val="$define"
10345 ;;
10346 *) echo "As you already told me, signal handler returns int." >&4
10347 val="$undef"
10348 ;;
10349 esac
10350fi
10351set d_voidsig
10352eval $setvar
10353case "$d_voidsig" in
10354"$define") signal_t="void";;
10355*) signal_t="int";;
10356esac
10357$rm -f $$.tmp
10358
10359: check for ability to cast large floats to 32-bit ints.
10360echo " "
10361echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10362if $test "$intsize" -ge 4; then
10363 xxx=int
10364else
10365 xxx=long
10366fi
10367$cat >try.c <<EOCP
10368#include <stdio.h>
d1daaddf
JH
10369#$i_stdlib I_STDLIB
10370#ifdef I_STDLIB
10371#include <stdlib.h>
10372#endif
b4eb6b3d
JH
10373#include <sys/types.h>
10374#include <signal.h>
10375$signal_t blech(s) int s; { exit(3); }
10376int main()
10377{
10378 $xxx i32;
10379 double f, g;
10380 int result = 0;
10381 char str[16];
10382 signal(SIGFPE, blech);
10383
10384 /* Don't let compiler optimize the test away. Store the number
10385 in a writable string for gcc to pass to sscanf under HP/UX.
10386 */
10387 sprintf(str, "2147483647");
10388 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10389 g = 10 * f;
10390 i32 = ($xxx) g;
10391
10392 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10393 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10394 behavior here, which is to preserve the sign and give
10395 back 0x7fff ffff.
10396 */
10397 if (i32 != ($xxx) f)
10398 result |= 1;
10399 exit(result);
10400}
10401EOCP
10402set try
10403if eval $compile_ok; then
5440bc8e 10404 $run ./try
b4eb6b3d
JH
10405 yyy=$?
10406else
10407 echo "(I can't seem to compile the test program--assuming it can't)"
10408 yyy=1
10409fi
10410case "$yyy" in
104110) val="$define"
10412 echo "Yup, it can."
10413 ;;
10414*) val="$undef"
10415 echo "Nope, it can't."
10416 ;;
10417esac
10418set d_casti32
10419eval $setvar
10420$rm -f try try.*
10421
10422: check for ability to cast negative floats to unsigned
10423echo " "
10424echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10425$cat >try.c <<EOCP
10426#include <stdio.h>
d1daaddf
JH
10427#$i_stdlib I_STDLIB
10428#ifdef I_STDLIB
10429#include <stdlib.h>
10430#endif
b4eb6b3d
JH
10431#include <sys/types.h>
10432#include <signal.h>
10433$signal_t blech(s) int s; { exit(7); }
10434$signal_t blech_in_list(s) int s; { exit(4); }
10435unsigned long dummy_long(p) unsigned long p; { return p; }
10436unsigned int dummy_int(p) unsigned int p; { return p; }
10437unsigned short dummy_short(p) unsigned short p; { return p; }
10438int main()
10439{
10440 double f;
10441 unsigned long along;
10442 unsigned int aint;
10443 unsigned short ashort;
10444 int result = 0;
10445 char str[16];
10446
10447 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10448 a direct f = -123. assignment. gcc-2.8.0 reportedly
10449 optimized the whole file away
10450 */
10451 /* Store the number in a writable string for gcc to pass to
10452 sscanf under HP/UX.
10453 */
10454 sprintf(str, "-123");
10455 sscanf(str, "%lf", &f); /* f = -123.; */
10456
10457 signal(SIGFPE, blech);
10458 along = (unsigned long)f;
10459 aint = (unsigned int)f;
10460 ashort = (unsigned short)f;
10461 if (along != (unsigned long)-123)
10462 result |= 1;
10463 if (aint != (unsigned int)-123)
10464 result |= 1;
10465 if (ashort != (unsigned short)-123)
10466 result |= 1;
10467 sprintf(str, "1073741824.");
10468 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10469 f = f + f;
10470 along = 0;
10471 along = (unsigned long)f;
10472 if (along != 0x80000000)
10473 result |= 2;
10474 f -= 1.;
10475 along = 0;
10476 along = (unsigned long)f;
10477 if (along != 0x7fffffff)
10478 result |= 1;
10479 f += 2.;
10480 along = 0;
10481 along = (unsigned long)f;
10482 if (along != 0x80000001)
10483 result |= 2;
10484 if (result)
10485 exit(result);
10486 signal(SIGFPE, blech_in_list);
10487 sprintf(str, "123.");
10488 sscanf(str, "%lf", &f); /* f = 123.; */
10489 along = dummy_long((unsigned long)f);
10490 aint = dummy_int((unsigned int)f);
10491 ashort = dummy_short((unsigned short)f);
10492 if (along != (unsigned long)123)
10493 result |= 4;
10494 if (aint != (unsigned int)123)
10495 result |= 4;
10496 if (ashort != (unsigned short)123)
10497 result |= 4;
10498 exit(result);
10499
10500}
10501EOCP
10502set try
10503if eval $compile_ok; then
5440bc8e 10504 $run ./try
b4eb6b3d
JH
10505 castflags=$?
10506else
10507 echo "(I can't seem to compile the test program--assuming it can't)"
10508 castflags=7
10509fi
10510case "$castflags" in
105110) val="$define"
10512 echo "Yup, it can."
10513 ;;
10514*) val="$undef"
10515 echo "Nope, it can't."
10516 ;;
10517esac
10518set d_castneg
10519eval $setvar
10520$rm -f try.*
10521
10522: see if vprintf exists
10523echo " "
10524if set vprintf val -f d_vprintf; eval $csym; $val; then
10525 echo 'vprintf() found.' >&4
10526 val="$define"
55954f19 10527 $cat >try.c <<EOF
b4eb6b3d 10528#include <varargs.h>
55954f19
JH
10529#$i_stdlib I_STDLIB
10530#ifdef I_STDLIB
10531#include <stdlib.h>
10532#endif
b4eb6b3d
JH
10533
10534int main() { xxx("foo"); }
10535
10536xxx(va_alist)
10537va_dcl
10538{
10539 va_list args;
10540 char buf[10];
10541
10542 va_start(args);
10543 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10544}
10545EOF
5440bc8e
JH
10546 set try
10547 if eval $compile && $run ./try; then
b4eb6b3d
JH
10548 echo "Your vsprintf() returns (int)." >&4
10549 val2="$undef"
10550 else
10551 echo "Your vsprintf() returns (char*)." >&4
10552 val2="$define"
10553 fi
10554else
10555 echo 'vprintf() NOT found.' >&4
10556 val="$undef"
10557 val2="$undef"
10558fi
5440bc8e 10559$rm -f try try.*
b4eb6b3d
JH
10560set d_vprintf
10561eval $setvar
10562val=$val2
10563set d_charvspr
10564eval $setvar
10565
10566: see if chown exists
10567set chown d_chown
10568eval $inlibc
10569
10570: see if chroot exists
10571set chroot d_chroot
10572eval $inlibc
10573
10574: see if chsize exists
10575set chsize d_chsize
10576eval $inlibc
10577
758a5d79
JH
10578: see if class exists
10579set class d_class
10580eval $inlibc
10581
b0a2e8e6
MB
10582: see if clearenv exists
10583set clearenv d_clearenv
10584eval $inlibc
10585
4e0554ec
JH
10586hasstruct='varname=$1; struct=$2; shift; shift;
10587while $test $# -ge 2; do
10588 case "$1" in
10589 $define) echo "#include <$2>";;
10590 esac ;
10591 shift 2;
10592done > try.c;
10593echo "int main () { struct $struct foo; }" >> try.c;
10594set try;
10595if eval $compile; then
10596 val="$define";
10597else
10598 val="$undef";
10599fi;
10600set $varname;
10601eval $setvar;
10602$rm -f try.c try.o'
10603
4e0554ec
JH
10604socketlib=''
10605sockethdr=''
10606: see whether socket exists
10607echo " "
10608$echo $n "Hmm... $c" >&4
10609if set socket val -f d_socket; eval $csym; $val; then
10610 echo "Looks like you have Berkeley networking support." >&4
10611 d_socket="$define"
10612 if set setsockopt val -f; eval $csym; $val; then
10613 d_oldsock="$undef"
10614 else
10615 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10616 d_oldsock="$define"
10617 fi
10618else
10619 if $contains socklib libc.list >/dev/null 2>&1; then
10620 echo "Looks like you have Berkeley networking support." >&4
10621 d_socket="$define"
10622 : we will have to assume that it supports the 4.2 BSD interface
10623 d_oldsock="$undef"
10624 else
10625 echo "You don't have Berkeley networking in libc$_a..." >&4
10626 if test "X$d_socket" = "X$define"; then
10627 echo "...but you seem to believe that you have sockets." >&4
10628 else
10629 for net in net socket
10630 do
10631 if test -f /usr/lib/lib$net$_a; then
10632 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10633 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10634 if $contains socket libc.list >/dev/null 2>&1; then
10635 d_socket="$define"
10636 socketlib="-l$net"
10637 case "$net" in
10638 net)
10639 echo "...but the Wollongong group seems to have hacked it in." >&4
10640 sockethdr="-I/usr/netinclude"
10641 ;;
10642 esac
3c728e00 10643 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10644 if $contains setsockopt libc.list >/dev/null 2>&1; then
10645 d_oldsock="$undef"
10646 else
10647 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10648 d_oldsock="$define"
10649 fi
10650 break
10651 fi
10652 fi
10653 done
10654 if test "X$d_socket" != "X$define"; then
10655 echo "or anywhere else I see." >&4
10656 d_socket="$undef"
10657 d_oldsock="$undef"
10658 fi
10659 fi
10660 fi
10661fi
10662
10663: see if socketpair exists
10664set socketpair d_sockpair
10665eval $inlibc
10666
10667
10668echo " "
3c728e00 10669echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10670for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10671 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10672 $cat >try.c <<EOF
10673#include <sys/types.h>
10674#include <sys/socket.h>
10675int main() {
10676 int i = $ENUM;
10677}
10678EOF
10679 val="$undef"
10680 set try; if eval $compile; then
10681 val="$define"
10682 fi
10683 set d_${enum}; eval $setvar
10684 $rm -f try.c try
10685done
10686
10687: see if this is a sys/uio.h system
10688set sys/uio.h i_sysuio
10689eval $inhdr
10690
10691
10692echo " "
10693echo "Checking to see if your system supports struct cmsghdr..." >&4
10694set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10695eval $hasstruct
10696case "$d_cmsghdr_s" in
10697"$define") echo "Yes, it does." ;;
10698*) echo "No, it doesn't." ;;
10699esac
10700
10701
b4eb6b3d
JH
10702: check for const keyword
10703echo " "
10704echo 'Checking to see if your C compiler knows about "const"...' >&4
10705$cat >const.c <<'EOCP'
10706typedef struct spug { int drokk; } spug;
76f47787 10707int main()
b4eb6b3d
JH
10708{
10709 const char *foo;
10710 const spug y;
10711}
10712EOCP
10713if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10714 val="$define"
10715 echo "Yup, it does."
10716else
10717 val="$undef"
10718 echo "Nope, it doesn't."
10719fi
10720set d_const
10721eval $setvar
10722
89ce900e
JH
10723: see if copysignl exists
10724set copysignl d_copysignl
10725eval $inlibc
10726
b4eb6b3d
JH
10727: see if crypt exists
10728echo " "
a5a94ea5
JH
10729set crypt d_crypt
10730eval $inlibc
10731case "$d_crypt" in
10732$define) cryptlib='' ;;
10733*) if set crypt val -f d_crypt; eval $csym; $val; then
10734 echo 'crypt() found.' >&4
b4eb6b3d 10735 val="$define"
a5a94ea5
JH
10736 cryptlib=''
10737 else
10738 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10739 if $test -z "$cryptlib"; then
10740 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10741 else
10742 cryptlib=-lcrypt
10743 fi
10744 if $test -z "$cryptlib"; then
10745 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10746 else
10747 cryptlib=-lcrypt
10748 fi
10749 if $test -z "$cryptlib"; then
10750 cryptlib=`./loc libcrypt$_a "" $libpth`
10751 else
10752 cryptlib=-lcrypt
10753 fi
10754 if $test -z "$cryptlib"; then
10755 echo 'crypt() NOT found.' >&4
10756 val="$undef"
10757 else
10758 val="$define"
10759 fi
b4eb6b3d 10760 fi
a5a94ea5
JH
10761 set d_crypt
10762 eval $setvar
10763 ;;
10764esac
b4eb6b3d 10765
10bc17b6
JH
10766: see if this is a crypt.h system
10767set crypt.h i_crypt
10768eval $inhdr
10769
10770: see if crypt_r exists
10771set crypt_r d_crypt_r
10772eval $inlibc
10773case "$d_crypt_r" in
10774"$define")
10775 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10776 case "$d_crypt_r_proto:$usethreads" in
10777 ":define") d_crypt_r_proto=define
a48ec845
JH
10778 set d_crypt_r_proto crypt_r $hdrs
10779 eval $hasproto ;;
10780 *) ;;
10781 esac
10782 case "$d_crypt_r_proto" in
10783 define)
10bc17b6
JH
10784 case "$crypt_r_proto" in
10785 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10786 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10787 esac
10788 case "$crypt_r_proto" in
b430fd04
JH
10789 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10790 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10791 esac
10792 case "$crypt_r_proto" in
90e831dc 10793 ''|0) d_crypt_r=undef
10bc17b6 10794 crypt_r_proto=0
a48ec845 10795 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10796 * ) case "$crypt_r_proto" in
10797 REENTRANT_PROTO*) ;;
10798 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10799 esac
10800 echo "Prototype: $try" ;;
10801 esac
10802 ;;
c18e646a
JH
10803 *) case "$usethreads" in
10804 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10805 esac
90e831dc
SB
10806 d_crypt_r=undef
10807 crypt_r_proto=0
c18e646a 10808 ;;
a48ec845
JH
10809 esac
10810 ;;
10bc17b6
JH
10811*) crypt_r_proto=0
10812 ;;
10813esac
10814
b4eb6b3d
JH
10815: get csh whereabouts
10816case "$csh" in
10817'csh') val="$undef" ;;
10818*) val="$define" ;;
10819esac
10820set d_csh
10821eval $setvar
10822: Respect a hint or command line value for full_csh.
10823case "$full_csh" in
10824'') full_csh=$csh ;;
10825esac
10826
10bc17b6
JH
10827: see if ctermid_r exists
10828set ctermid_r d_ctermid_r
10829eval $inlibc
10830case "$d_ctermid_r" in
10831"$define")
31ee0cb7 10832 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
10833 case "$d_ctermid_r_proto:$usethreads" in
10834 ":define") d_ctermid_r_proto=define
a48ec845
JH
10835 set d_ctermid_r_proto ctermid_r $hdrs
10836 eval $hasproto ;;
10837 *) ;;
10838 esac
10839 case "$d_ctermid_r_proto" in
10840 define)
10bc17b6
JH
10841 case "$ctermid_r_proto" in
10842 ''|0) try='char* ctermid_r(char*);'
10843 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10844 esac
10845 case "$ctermid_r_proto" in
90e831dc 10846 ''|0) d_ctermid_r=undef
10bc17b6 10847 ctermid_r_proto=0
a48ec845 10848 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10849 * ) case "$ctermid_r_proto" in
10850 REENTRANT_PROTO*) ;;
10851 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10852 esac
10853 echo "Prototype: $try" ;;
10854 esac
10855 ;;
c18e646a
JH
10856 *) case "$usethreads" in
10857 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10858 esac
90e831dc
SB
10859 d_ctermid_r=undef
10860 ctermid_r_proto=0
c18e646a 10861 ;;
a48ec845
JH
10862 esac
10863 ;;
10bc17b6
JH
10864*) ctermid_r_proto=0
10865 ;;
10866esac
10867
10868: see if ctime_r exists
10869set ctime_r d_ctime_r
10870eval $inlibc
10871case "$d_ctime_r" in
10872"$define")
d63eadf0 10873 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10874 case "$d_ctime_r_proto:$usethreads" in
10875 ":define") d_ctime_r_proto=define
a48ec845
JH
10876 set d_ctime_r_proto ctime_r $hdrs
10877 eval $hasproto ;;
10878 *) ;;
10879 esac
10880 case "$d_ctime_r_proto" in
10881 define)
10bc17b6
JH
10882 case "$ctime_r_proto" in
10883 ''|0) try='char* ctime_r(const time_t*, char*);'
10884 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10885 esac
10886 case "$ctime_r_proto" in
10887 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10888 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10889 esac
10890 case "$ctime_r_proto" in
10891 ''|0) try='int ctime_r(const time_t*, char*);'
10892 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10893 esac
10894 case "$ctime_r_proto" in
10895 ''|0) try='int ctime_r(const time_t*, char*, int);'
10896 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10897 esac
10898 case "$ctime_r_proto" in
90e831dc 10899 ''|0) d_ctime_r=undef
10bc17b6 10900 ctime_r_proto=0
a48ec845 10901 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10902 * ) case "$ctime_r_proto" in
10903 REENTRANT_PROTO*) ;;
10904 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10905 esac
10906 echo "Prototype: $try" ;;
10907 esac
10908 ;;
c18e646a
JH
10909 *) case "$usethreads" in
10910 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10911 esac
90e831dc
SB
10912 d_ctime_r=undef
10913 ctime_r_proto=0
c18e646a 10914 ;;
a48ec845
JH
10915 esac
10916 ;;
10bc17b6
JH
10917*) ctime_r_proto=0
10918 ;;
10919esac
10920
b4eb6b3d
JH
10921: see if cuserid exists
10922set cuserid d_cuserid
10923eval $inlibc
10924
10925: see if this is a limits.h system
10926set limits.h i_limits
10927eval $inhdr
10928
10929: see if this is a float.h system
10930set float.h i_float
10931eval $inhdr
10932
10933: See if number of significant digits in a double precision number is known
10934echo " "
10935$cat >dbl_dig.c <<EOM
10936#$i_limits I_LIMITS
10937#$i_float I_FLOAT
10938#ifdef I_LIMITS
10939#include <limits.h>
10940#endif
10941#ifdef I_FLOAT
10942#include <float.h>
10943#endif
10944#ifdef DBL_DIG
10945printf("Contains DBL_DIG");
10946#endif
10947EOM
10948$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10949if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10950 echo "DBL_DIG found." >&4
10951 val="$define"
10952else
10953 echo "DBL_DIG NOT found." >&4
10954 val="$undef"
10955fi
10956$rm -f dbl_dig.?
10957set d_dbl_dig
10958eval $setvar
10959
2ef53570
JH
10960: see if dbm.h is available
10961: see if dbmclose exists
10962set dbmclose d_dbmclose
10963eval $inlibc
10964
10965case "$d_dbmclose" in
10966$define)
10967 set dbm.h i_dbm
10968 eval $inhdr
10969 case "$i_dbm" in
10970 $define)
10971 val="$undef"
10972 set i_rpcsvcdbm
10973 eval $setvar
10974 ;;
10975 *) set rpcsvc/dbm.h i_rpcsvcdbm
10976 eval $inhdr
10977 ;;
10978 esac
10979 ;;
10980*) echo "We won't be including <dbm.h>"
10981 val="$undef"
10982 set i_dbm
10983 eval $setvar
10984 val="$undef"
10985 set i_rpcsvcdbm
10986 eval $setvar
10987 ;;
10988esac
10989
10990: see if prototype for dbminit is available
10991echo " "
10992set d_dbminitproto dbminit $i_dbm dbm.h
10993eval $hasproto
10994
b4eb6b3d
JH
10995: see if difftime exists
10996set difftime d_difftime
10997eval $inlibc
10998
10999: see if this is a dirent system
11000echo " "
11001if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11002 val="$define"
11003 echo "<dirent.h> found." >&4
11004else
11005 val="$undef"
11006 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11007 echo "<sys/dir.h> found." >&4
11008 echo " "
11009 else
11010 xinc=`./findhdr sys/ndir.h`
11011 fi
11012 echo "<dirent.h> NOT found." >&4
11013fi
11014set i_dirent
11015eval $setvar
11016
11017: Look for type of directory structure.
11018echo " "
11019$cppstdin $cppflags $cppminus < "$xinc" > try.c
11020
11021case "$direntrytype" in
11022''|' ')
11023 case "$i_dirent" in
11024 $define) guess1='struct dirent' ;;
11025 *) guess1='struct direct' ;;
11026 esac
11027 ;;
11028*) guess1="$direntrytype"
11029 ;;
11030esac
11031
11032case "$guess1" in
11033'struct dirent') guess2='struct direct' ;;
11034*) guess2='struct dirent' ;;
11035esac
11036
11037if $contains "$guess1" try.c >/dev/null 2>&1; then
11038 direntrytype="$guess1"
11039 echo "Your directory entries are $direntrytype." >&4
11040elif $contains "$guess2" try.c >/dev/null 2>&1; then
11041 direntrytype="$guess2"
11042 echo "Your directory entries seem to be $direntrytype." >&4
11043else
11044 echo "I don't recognize your system's directory entries." >&4
11045 rp="What type is used for directory entries on this system?"
11046 dflt="$guess1"
11047 . ./myread
11048 direntrytype="$ans"
11049fi
11050$rm -f try.c
11051
11052
11053: see if the directory entry stores field length
11054echo " "
11055$cppstdin $cppflags $cppminus < "$xinc" > try.c
11056if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11057 echo "Good, your directory entry keeps length information in d_namlen." >&4
11058 val="$define"
11059else
11060 echo "Your directory entry does not know about the d_namlen field." >&4
11061 val="$undef"
11062fi
11063set d_dirnamlen
11064eval $setvar
11065$rm -f try.c
11066
ae0e3d3b
JH
11067: see if this is an sysdir system
11068set sys/dir.h i_sysdir
11069eval $inhdr
11070
11071: see if this is an sysndir system
11072set sys/ndir.h i_sysndir
11073eval $inhdr
11074
11075: Look for dirfd
11076echo " "
11077$cat >dirfd.c <<EOM
11078#include <stdio.h>
55954f19
JH
11079#$i_stdlib I_STDLIB
11080#ifdef I_STDLIB
11081#include <stdlib.h>
11082#endif
ae0e3d3b
JH
11083#$i_dirent I_DIRENT /**/
11084#$i_sysdir I_SYS_DIR /**/
11085#$i_sysndir I_SYS_NDIR /**/
11086#$i_systypes I_SYS_TYPES /**/
11087#if defined(I_SYS_TYPES)
11088#include <sys/types.h>
11089#endif
11090#if defined(I_DIRENT)
11091#include <dirent.h>
11092#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11093#include <sys/dir.h>
11094#endif
11095#else
11096#ifdef I_SYS_NDIR
11097#include <sys/ndir.h>
11098#else
11099#ifdef I_SYS_DIR
11100#ifdef hp9000s500
11101#include <ndir.h> /* may be wrong in the future */
11102#else
11103#include <sys/dir.h>
11104#endif
11105#endif
11106#endif
11107#endif
11108int main() {
11109 DIR *dirp = opendir(".");
11110 if (dirfd(dirp) >= 0)
11111 exit(0);
11112 else
11113 exit(1);
11114}
11115EOM
5cadb3f3 11116val=$undef
ae0e3d3b
JH
11117set dirfd
11118if eval $compile; then
11119 val="$define"
11120fi
11121case "$val" in
11122$define) echo "dirfd() found." >&4 ;;
11123*) echo "dirfd() NOT found." >&4 ;;
11124esac
11125set d_dirfd
11126eval $setvar
11127$rm -f dirfd*
11128
b4eb6b3d
JH
11129: see if dlerror exists
11130xxx_runnm="$runnm"
11131runnm=false
11132set dlerror d_dlerror
11133eval $inlibc
11134runnm="$xxx_runnm"
11135
11136: see if dlfcn is available
11137set dlfcn.h i_dlfcn
11138eval $inhdr
11139
11140case "$usedl" in
11141$define|y|true)
11142 $cat << EOM
11143
11144On a few systems, the dynamically loaded modules that perl generates and uses
11145will need a different extension than shared libs. The default will probably
11146be appropriate.
11147
11148EOM
11149 case "$dlext" in
11150 '') dflt="$so" ;;
11151 *) dflt="$dlext" ;;
11152 esac
11153 rp='What is the extension of dynamically loaded modules'
11154 . ./myread
11155 dlext="$ans"
11156 ;;
11157*)
11158 dlext="none"
11159 ;;
11160esac
11161
11162: Check if dlsym need a leading underscore
11163echo " "
11164val="$undef"
11165
11166case "$dlsrc" in
11167dl_dlopen.xs)
11168 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11169 $cat >dyna.c <<'EOM'
11170fred () { }
11171EOM
11172
11173$cat >fred.c<<EOM
11174
11175#include <stdio.h>
55954f19
JH
11176#$i_stdlib I_STDLIB
11177#ifdef I_STDLIB
11178#include <stdlib.h>
11179#endif
b4eb6b3d
JH
11180#$i_dlfcn I_DLFCN
11181#ifdef I_DLFCN
5440bc8e 11182#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11183#else
11184#include <sys/types.h>
11185#include <nlist.h>
11186#include <link.h>
11187#endif
11188
11189extern int fred() ;
11190
11191int main()
11192{
11193 void * handle ;
11194 void * symbol ;
11195#ifndef RTLD_LAZY
11196 int mode = 1 ;
11197#else
11198 int mode = RTLD_LAZY ;
11199#endif
11200 handle = dlopen("./dyna.$dlext", mode) ;
11201 if (handle == NULL) {
11202 printf ("1\n") ;
11203 fflush (stdout) ;
11204 exit(0);
11205 }
11206 symbol = dlsym(handle, "fred") ;
11207 if (symbol == NULL) {
11208 /* try putting a leading underscore */
11209 symbol = dlsym(handle, "_fred") ;
11210 if (symbol == NULL) {
11211 printf ("2\n") ;
11212 fflush (stdout) ;
11213 exit(0);
11214 }
11215 printf ("3\n") ;
11216 }
11217 else
11218 printf ("4\n") ;
11219 fflush (stdout) ;
11220 exit(0);
11221}
11222EOM
11223 : Call the object file tmp-dyna.o in case dlext=o.
11224 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11225 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11226 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11227 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11228 xxx=`$run ./fred`
b4eb6b3d
JH
11229 case $xxx in
11230 1) echo "Test program failed using dlopen." >&4
11231 echo "Perhaps you should not use dynamic loading." >&4;;
11232 2) echo "Test program failed using dlsym." >&4
11233 echo "Perhaps you should not use dynamic loading." >&4;;
11234 3) echo "dlsym needs a leading underscore" >&4
11235 val="$define" ;;
11236 4) echo "dlsym doesn't need a leading underscore." >&4;;
11237 esac
11238 else
11239 echo "I can't compile and run the test program." >&4
11240 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11241 fi
11242 ;;
11243esac
11244
3c728e00 11245$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11246
11247set d_dlsymun
11248eval $setvar
11249
10bc17b6
JH
11250: see if drand48_r exists
11251set drand48_r d_drand48_r
11252eval $inlibc
11253case "$d_drand48_r" in
11254"$define")
11255 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11256 case "$d_drand48_r_proto:$usethreads" in
11257 ":define") d_drand48_r_proto=define
a48ec845
JH
11258 set d_drand48_r_proto drand48_r $hdrs
11259 eval $hasproto ;;
11260 *) ;;
11261 esac
11262 case "$d_drand48_r_proto" in
11263 define)
10bc17b6
JH
11264 case "$drand48_r_proto" in
11265 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11266 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11267 esac
11268 case "$drand48_r_proto" in
90e831dc 11269 ''|0) d_drand48_r=undef
10bc17b6 11270 drand48_r_proto=0
a48ec845 11271 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11272 * ) case "$drand48_r_proto" in
11273 REENTRANT_PROTO*) ;;
11274 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11275 esac
11276 echo "Prototype: $try" ;;
11277 esac
11278 ;;
c18e646a
JH
11279 *) case "$usethreads" in
11280 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11281 esac
90e831dc
SB
11282 d_drand48_r=undef
11283 drand48_r_proto=0
c18e646a 11284 ;;
a48ec845
JH
11285 esac
11286 ;;
10bc17b6
JH
11287*) drand48_r_proto=0
11288 ;;
11289esac
11290
11291: see if prototype for drand48 is available
11292echo " "
11293set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11294eval $hasproto
11295
b4eb6b3d
JH
11296: see if dup2 exists
11297set dup2 d_dup2
11298eval $inlibc
11299
11300: see if eaccess exists
11301set eaccess d_eaccess
11302eval $inlibc
11303
11304: see if endgrent exists
11305set endgrent d_endgrent
11306eval $inlibc
11307
10bc17b6
JH
11308: see if this is an grp system
11309set grp.h i_grp
11310eval $inhdr
11311
11312case "$i_grp" in
11313$define)
11314 xxx=`./findhdr grp.h`
11315 $cppstdin $cppflags $cppminus < $xxx >$$.h
11316
11317 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11318 val="$define"
11319 else
11320 val="$undef"
11321 fi
11322 set d_grpasswd
11323 eval $setvar
11324
11325 $rm -f $$.h
11326 ;;
11327*)
11328 val="$undef";
11329 set d_grpasswd; eval $setvar
11330 ;;
11331esac
11332
11333: see if endgrent_r exists
11334set endgrent_r d_endgrent_r
11335eval $inlibc
11336case "$d_endgrent_r" in
11337"$define")
11338 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11339 case "$d_endgrent_r_proto:$usethreads" in
11340 ":define") d_endgrent_r_proto=define
a48ec845
JH
11341 set d_endgrent_r_proto endgrent_r $hdrs
11342 eval $hasproto ;;
11343 *) ;;
11344 esac
11345 case "$d_endgrent_r_proto" in
11346 define)
10bc17b6
JH
11347 case "$endgrent_r_proto" in
11348 ''|0) try='int endgrent_r(FILE**);'
11349 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11350 esac
11351 case "$endgrent_r_proto" in
11352 ''|0) try='void endgrent_r(FILE**);'
11353 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11354 esac
11355 case "$endgrent_r_proto" in
90e831dc 11356 ''|0) d_endgrent_r=undef
10bc17b6 11357 endgrent_r_proto=0
a48ec845 11358 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11359 * ) case "$endgrent_r_proto" in
11360 REENTRANT_PROTO*) ;;
11361 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11362 esac
11363 echo "Prototype: $try" ;;
11364 esac
11365 ;;
c18e646a
JH
11366 *) case "$usethreads" in
11367 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11368 esac
90e831dc
SB
11369 d_endgrent_r=undef
11370 endgrent_r_proto=0
c18e646a 11371 ;;
a48ec845
JH
11372 esac
11373 ;;
10bc17b6
JH
11374*) endgrent_r_proto=0
11375 ;;
11376esac
11377
b4eb6b3d
JH
11378: see if endhostent exists
11379set endhostent d_endhent
11380eval $inlibc
11381
10bc17b6
JH
11382: see if this is a netdb.h system
11383set netdb.h i_netdb
11384eval $inhdr
11385
11386: see if endhostent_r exists
11387set endhostent_r d_endhostent_r
11388eval $inlibc
11389case "$d_endhostent_r" in
11390"$define")
11391 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11392 case "$d_endhostent_r_proto:$usethreads" in
11393 ":define") d_endhostent_r_proto=define
a48ec845
JH
11394 set d_endhostent_r_proto endhostent_r $hdrs
11395 eval $hasproto ;;
11396 *) ;;
11397 esac
11398 case "$d_endhostent_r_proto" in
11399 define)
10bc17b6
JH
11400 case "$endhostent_r_proto" in
11401 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11402 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11403 esac
11404 case "$endhostent_r_proto" in
11405 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11406 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11407 esac
11408 case "$endhostent_r_proto" in
90e831dc 11409 ''|0) d_endhostent_r=undef
10bc17b6 11410 endhostent_r_proto=0
a48ec845 11411 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11412 * ) case "$endhostent_r_proto" in
11413 REENTRANT_PROTO*) ;;
11414 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11415 esac
11416 echo "Prototype: $try" ;;
11417 esac
11418 ;;
c18e646a
JH
11419 *) case "$usethreads" in
11420 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11421 esac
90e831dc
SB
11422 d_endhostent_r=undef
11423 endhostent_r_proto=0
c18e646a 11424 ;;
a48ec845
JH
11425 esac
11426 ;;
10bc17b6
JH
11427*) endhostent_r_proto=0
11428 ;;
11429esac
11430
b4eb6b3d
JH
11431: see if endnetent exists
11432set endnetent d_endnent
11433eval $inlibc
11434
10bc17b6
JH
11435: see if endnetent_r exists
11436set endnetent_r d_endnetent_r
11437eval $inlibc
11438case "$d_endnetent_r" in
11439"$define")
11440 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11441 case "$d_endnetent_r_proto:$usethreads" in
11442 ":define") d_endnetent_r_proto=define
a48ec845
JH
11443 set d_endnetent_r_proto endnetent_r $hdrs
11444 eval $hasproto ;;
11445 *) ;;
11446 esac
11447 case "$d_endnetent_r_proto" in
11448 define)
10bc17b6
JH
11449 case "$endnetent_r_proto" in
11450 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11451 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11452 esac
11453 case "$endnetent_r_proto" in
11454 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11455 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11456 esac
11457 case "$endnetent_r_proto" in
90e831dc 11458 ''|0) d_endnetent_r=undef
10bc17b6 11459 endnetent_r_proto=0
a48ec845 11460 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11461 * ) case "$endnetent_r_proto" in
11462 REENTRANT_PROTO*) ;;
11463 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11464 esac
11465 echo "Prototype: $try" ;;
11466 esac
11467 ;;
c18e646a
JH
11468 *) case "$usethreads" in
11469 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11470 esac
90e831dc
SB
11471 d_endnetent_r=undef
11472 endnetent_r_proto=0
c18e646a 11473 ;;
a48ec845
JH
11474 esac
11475 ;;
10bc17b6
JH
11476*) endnetent_r_proto=0
11477 ;;
11478esac
11479
b4eb6b3d
JH
11480: see if endprotoent exists
11481set endprotoent d_endpent
11482eval $inlibc
11483
10bc17b6
JH
11484: see if endprotoent_r exists
11485set endprotoent_r d_endprotoent_r
11486eval $inlibc
11487case "$d_endprotoent_r" in
11488"$define")
11489 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11490 case "$d_endprotoent_r_proto:$usethreads" in
11491 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11492 set d_endprotoent_r_proto endprotoent_r $hdrs
11493 eval $hasproto ;;
11494 *) ;;
11495 esac
11496 case "$d_endprotoent_r_proto" in
11497 define)
10bc17b6
JH
11498 case "$endprotoent_r_proto" in
11499 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11500 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11501 esac
11502 case "$endprotoent_r_proto" in
11503 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11504 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11505 esac
11506 case "$endprotoent_r_proto" in
90e831dc 11507 ''|0) d_endprotoent_r=undef
10bc17b6 11508 endprotoent_r_proto=0
a48ec845 11509 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11510 * ) case "$endprotoent_r_proto" in
11511 REENTRANT_PROTO*) ;;
11512 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11513 esac
11514 echo "Prototype: $try" ;;
11515 esac
11516 ;;
c18e646a
JH
11517 *) case "$usethreads" in
11518 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11519 esac
90e831dc
SB
11520 d_endprotoent_r=undef
11521 endprotoent_r_proto=0
c18e646a 11522 ;;
a48ec845
JH
11523 esac
11524 ;;
10bc17b6
JH
11525*) endprotoent_r_proto=0
11526 ;;
11527esac
11528
b4eb6b3d
JH
11529: see if endpwent exists
11530set endpwent d_endpwent
11531eval $inlibc
11532
10bc17b6
JH
11533: see if this is a pwd.h system
11534set pwd.h i_pwd
11535eval $inhdr
11536
11537case "$i_pwd" in
11538$define)
11539 xxx=`./findhdr pwd.h`
11540 $cppstdin $cppflags $cppminus < $xxx >$$.h
11541
11542 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11543 val="$define"
11544 else
11545 val="$undef"
11546 fi
11547 set d_pwquota
11548 eval $setvar
11549
11550 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11551 val="$define"
11552 else
11553 val="$undef"
11554 fi
11555 set d_pwage
11556 eval $setvar
11557
11558 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11559 val="$define"
11560 else
11561 val="$undef"
11562 fi
11563 set d_pwchange
11564 eval $setvar
11565
11566 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11567 val="$define"
11568 else
11569 val="$undef"
11570 fi
11571 set d_pwclass
11572 eval $setvar
11573
11574 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11575 val="$define"
11576 else
11577 val="$undef"
11578 fi
11579 set d_pwexpire
11580 eval $setvar
11581
11582 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11583 val="$define"
11584 else
11585 val="$undef"
11586 fi
11587 set d_pwcomment
11588 eval $setvar
11589
11590 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11591 val="$define"
11592 else
11593 val="$undef"
11594 fi
11595 set d_pwgecos
11596 eval $setvar
11597
11598 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11599 val="$define"
11600 else
11601 val="$undef"
11602 fi
11603 set d_pwpasswd
11604 eval $setvar
11605
11606 $rm -f $$.h
11607 ;;
11608*)
11609 val="$undef";
11610 set d_pwquota; eval $setvar
11611 set d_pwage; eval $setvar
11612 set d_pwchange; eval $setvar
11613 set d_pwclass; eval $setvar
11614 set d_pwexpire; eval $setvar
11615 set d_pwcomment; eval $setvar
11616 set d_pwgecos; eval $setvar
11617 set d_pwpasswd; eval $setvar
11618 ;;
11619esac
11620
11621: see if endpwent_r exists
11622set endpwent_r d_endpwent_r
11623eval $inlibc
11624case "$d_endpwent_r" in
11625"$define")
11626 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11627 case "$d_endpwent_r_proto:$usethreads" in
11628 ":define") d_endpwent_r_proto=define
a48ec845
JH
11629 set d_endpwent_r_proto endpwent_r $hdrs
11630 eval $hasproto ;;
11631 *) ;;
11632 esac
11633 case "$d_endpwent_r_proto" in
11634 define)
10bc17b6
JH
11635 case "$endpwent_r_proto" in
11636 ''|0) try='int endpwent_r(FILE**);'
11637 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11638 esac
11639 case "$endpwent_r_proto" in
11640 ''|0) try='void endpwent_r(FILE**);'
11641 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11642 esac
11643 case "$endpwent_r_proto" in
90e831dc 11644 ''|0) d_endpwent_r=undef
10bc17b6 11645 endpwent_r_proto=0
a48ec845 11646 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11647 * ) case "$endpwent_r_proto" in
11648 REENTRANT_PROTO*) ;;
11649 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11650 esac
11651 echo "Prototype: $try" ;;
11652 esac
11653 ;;
c18e646a
JH
11654 *) case "$usethreads" in
11655 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11656 esac
90e831dc
SB
11657 d_endpwent_r=undef
11658 endpwent_r_proto=0
c18e646a 11659 ;;
a48ec845
JH
11660 esac
11661 ;;
10bc17b6
JH
11662*) endpwent_r_proto=0
11663 ;;
11664esac
11665
b4eb6b3d
JH
11666: see if endservent exists
11667set endservent d_endsent
11668eval $inlibc
11669
10bc17b6
JH
11670: see if endservent_r exists
11671set endservent_r d_endservent_r
11672eval $inlibc
11673case "$d_endservent_r" in
11674"$define")
11675 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11676 case "$d_endservent_r_proto:$usethreads" in
11677 ":define") d_endservent_r_proto=define
a48ec845
JH
11678 set d_endservent_r_proto endservent_r $hdrs
11679 eval $hasproto ;;
11680 *) ;;
11681 esac
11682 case "$d_endservent_r_proto" in
11683 define)
10bc17b6
JH
11684 case "$endservent_r_proto" in
11685 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11686 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11687 esac
11688 case "$endservent_r_proto" in
11689 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11690 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11691 esac
11692 case "$endservent_r_proto" in
90e831dc 11693 ''|0) d_endservent_r=undef
10bc17b6 11694 endservent_r_proto=0
a48ec845 11695 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11696 * ) case "$endservent_r_proto" in
11697 REENTRANT_PROTO*) ;;
11698 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11699 esac
11700 echo "Prototype: $try" ;;
11701 esac
11702 ;;
c18e646a
JH
11703 *) case "$usethreads" in
11704 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11705 esac
90e831dc
SB
11706 d_endservent_r=undef
11707 endservent_r_proto=0
c18e646a 11708 ;;
a48ec845
JH
11709 esac
11710 ;;
10bc17b6
JH
11711*) endservent_r_proto=0
11712 ;;
11713esac
11714
b4eb6b3d
JH
11715: Locate the flags for 'open()'
11716echo " "
55954f19 11717$cat >try.c <<EOCP
b4eb6b3d
JH
11718#include <sys/types.h>
11719#ifdef I_FCNTL
11720#include <fcntl.h>
11721#endif
11722#ifdef I_SYS_FILE
11723#include <sys/file.h>
11724#endif
55954f19
JH
11725#$i_stdlib I_STDLIB
11726#ifdef I_STDLIB
11727#include <stdlib.h>
11728#endif
b4eb6b3d
JH
11729int main() {
11730 if(O_RDONLY);
11731#ifdef O_TRUNC
11732 exit(0);
11733#else
11734 exit(1);
11735#endif
11736}
11737EOCP
11738: check sys/file.h first to get FREAD on Sun
11739if $test `./findhdr sys/file.h` && \
5440bc8e 11740 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11741 h_sysfile=true;
11742 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11743 if $run ./try; then
b4eb6b3d
JH
11744 echo "and you have the 3 argument form of open()." >&4
11745 val="$define"
11746 else
11747 echo "but not the 3 argument form of open(). Oh, well." >&4
11748 val="$undef"
11749 fi
11750elif $test `./findhdr fcntl.h` && \
5440bc8e 11751 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11752 h_fcntl=true;
11753 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11754 if $run ./try; then
b4eb6b3d
JH
11755 echo "and you have the 3 argument form of open()." >&4
11756 val="$define"
11757 else
11758 echo "but not the 3 argument form of open(). Oh, well." >&4
11759 val="$undef"
11760 fi
11761else
11762 val="$undef"
11763 echo "I can't find the O_* constant definitions! You got problems." >&4
11764fi
11765set d_open3
11766eval $setvar
5440bc8e 11767$rm -f try try.*
b4eb6b3d
JH
11768
11769: see which of string.h or strings.h is needed
11770echo " "
11771strings=`./findhdr string.h`
11772if $test "$strings" && $test -r "$strings"; then
11773 echo "Using <string.h> instead of <strings.h>." >&4
11774 val="$define"
11775else
11776 val="$undef"
11777 strings=`./findhdr strings.h`
11778 if $test "$strings" && $test -r "$strings"; then
11779 echo "Using <strings.h> instead of <string.h>." >&4
11780 else
11781 echo "No string header found -- You'll surely have problems." >&4
11782 fi
11783fi
11784set i_string
11785eval $setvar
11786case "$i_string" in
11787"$undef") strings=`./findhdr strings.h`;;
11788*) strings=`./findhdr string.h`;;
11789esac
11790
3c728e00
JH
11791: see if this is a sys/file.h system
11792val=''
11793set sys/file.h val
11794eval $inhdr
11795
11796: do we need to include sys/file.h ?
11797case "$val" in
11798"$define")
11799 echo " "
11800 if $h_sysfile; then
11801 val="$define"
11802 echo "We'll be including <sys/file.h>." >&4
11803 else
11804 val="$undef"
11805 echo "We won't be including <sys/file.h>." >&4
11806 fi
11807 ;;
11808*)
11809 h_sysfile=false
11810 ;;
11811esac
11812set i_sysfile
11813eval $setvar
11814
11815: see if fcntl.h is there
11816val=''
11817set fcntl.h val
11818eval $inhdr
11819
11820: see if we can include fcntl.h
11821case "$val" in
11822"$define")
11823 echo " "
11824 if $h_fcntl; then
11825 val="$define"
11826 echo "We'll be including <fcntl.h>." >&4
11827 else
11828 val="$undef"
11829 if $h_sysfile; then
11830 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11831 else
11832 echo "We won't be including <fcntl.h>." >&4
11833 fi
11834 fi
11835 ;;
11836*)
11837 h_fcntl=false
11838 val="$undef"
11839 ;;
11840esac
11841set i_fcntl
11842eval $setvar
11843
b4eb6b3d
JH
11844: check for non-blocking I/O stuff
11845case "$h_sysfile" in
a0acbdc3
JH
11846true) echo "#include <sys/file.h>" > head.c;;
11847*)
11848 case "$h_fcntl" in
11849 true) echo "#include <fcntl.h>" > head.c;;
11850 *) echo "#include <sys/fcntl.h>" > head.c;;
11851 esac
11852 ;;
b4eb6b3d
JH
11853esac
11854echo " "
11855echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11856case "$o_nonblock" in
11857'')
11858 $cat head.c > try.c
3c728e00 11859 $cat >>try.c <<EOCP
b4eb6b3d 11860#include <stdio.h>
55954f19
JH
11861#$i_stdlib I_STDLIB
11862#ifdef I_STDLIB
80b3ef99 11863#include <stdlib.h>
55954f19 11864#endif
3c728e00
JH
11865#$i_fcntl I_FCNTL
11866#ifdef I_FCNTL
11867#include <fcntl.h>
11868#endif
b4eb6b3d
JH
11869int main() {
11870#ifdef O_NONBLOCK
11871 printf("O_NONBLOCK\n");
11872 exit(0);
11873#endif
11874#ifdef O_NDELAY
11875 printf("O_NDELAY\n");
11876 exit(0);
11877#endif
11878#ifdef FNDELAY
11879 printf("FNDELAY\n");
11880 exit(0);
11881#endif
11882 exit(0);
11883}
11884EOCP
11885 set try
11886 if eval $compile_ok; then
5440bc8e 11887 o_nonblock=`$run ./try`
b4eb6b3d
JH
11888 case "$o_nonblock" in
11889 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11890 *) echo "Seems like we can use $o_nonblock.";;
11891 esac
11892 else
11893 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11894 fi
11895 ;;
11896*) echo "Using $hint value $o_nonblock.";;
11897esac
11898$rm -f try try.* .out core
11899
11900echo " "
11901echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11902case "$eagain" in
11903'')
11904 $cat head.c > try.c
11905 $cat >>try.c <<EOCP
11906#include <errno.h>
11907#include <sys/types.h>
11908#include <signal.h>
11909#include <stdio.h>
55954f19
JH
11910#$i_stdlib I_STDLIB
11911#ifdef I_STDLIB
11912#include <stdlib.h>
11913#endif
1deb0a86
JH
11914#$i_fcntl I_FCNTL
11915#ifdef I_FCNTL
11916#include <fcntl.h>
11917#endif
b4eb6b3d
JH
11918#define MY_O_NONBLOCK $o_nonblock
11919#ifndef errno /* XXX need better Configure test */
11920extern int errno;
11921#endif
11922#$i_unistd I_UNISTD
11923#ifdef I_UNISTD
11924#include <unistd.h>
11925#endif
11926#$i_string I_STRING
11927#ifdef I_STRING
11928#include <string.h>
11929#else
11930#include <strings.h>
11931#endif
11932$signal_t blech(x) int x; { exit(3); }
11933EOCP
11934 $cat >> try.c <<'EOCP'
11935int main()
11936{
11937 int pd[2];
11938 int pu[2];
11939 char buf[1];
11940 char string[100];
11941
11942 pipe(pd); /* Down: child -> parent */
11943 pipe(pu); /* Up: parent -> child */
11944 if (0 != fork()) {
11945 int ret;
11946 close(pd[1]); /* Parent reads from pd[0] */
11947 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11948#ifdef F_SETFL
b4eb6b3d
JH
11949 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11950 exit(1);
a0acbdc3
JH
11951#else
11952 exit(4);
11953#endif
b4eb6b3d
JH
11954 signal(SIGALRM, blech);
11955 alarm(5);
11956 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11957 exit(2);
11958 sprintf(string, "%d\n", ret);
11959 write(2, string, strlen(string));
11960 alarm(0);
11961#ifdef EAGAIN
11962 if (errno == EAGAIN) {
11963 printf("EAGAIN\n");
11964 goto ok;
11965 }
11966#endif
11967#ifdef EWOULDBLOCK
11968 if (errno == EWOULDBLOCK)
11969 printf("EWOULDBLOCK\n");
11970#endif
11971 ok:
11972 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11973 sleep(2); /* Give it time to close our pipe */
11974 alarm(5);
11975 ret = read(pd[0], buf, 1); /* Should read EOF */
11976 alarm(0);
11977 sprintf(string, "%d\n", ret);
868439a2 11978 write(4, string, strlen(string));
b4eb6b3d
JH
11979 exit(0);
11980 }
11981
11982 close(pd[0]); /* We write to pd[1] */
11983 close(pu[1]); /* We read from pu[0] */
11984 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11985 close(pd[1]); /* Pipe pd is now fully closed! */
11986 exit(0); /* Bye bye, thank you for playing! */
11987}
11988EOCP
11989 set try
11990 if eval $compile_ok; then
11991 echo "$startsh" >mtry
868439a2 11992 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11993 chmod +x mtry
11994 ./mtry >/dev/null 2>&1
11995 case $? in
11996 0) eagain=`$cat try.out`;;
11997 1) echo "Could not perform non-blocking setting!";;
11998 2) echo "I did a successful read() for something that was not there!";;
11999 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12000 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12001 *) echo "Something terribly wrong happened during testing.";;
12002 esac
12003 rd_nodata=`$cat try.ret`
12004 echo "A read() system call with no data present returns $rd_nodata."
12005 case "$rd_nodata" in
12006 0|-1) ;;
12007 *)
12008 echo "(That's peculiar, fixing that to be -1.)"
12009 rd_nodata=-1
12010 ;;
12011 esac
12012 case "$eagain" in
12013 '')
12014 echo "Forcing errno EAGAIN on read() with no data available."
12015 eagain=EAGAIN
12016 ;;
12017 *)
12018 echo "Your read() sets errno to $eagain when no data is available."
12019 ;;
12020 esac
12021 status=`$cat try.err`
12022 case "$status" in
12023 0) echo "And it correctly returns 0 to signal EOF.";;
12024 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12025 *) echo "However, your read() returns '$status' on EOF??";;
12026 esac
12027 val="$define"
12028 if test "$status" = "$rd_nodata"; then
12029 echo "WARNING: you can't distinguish between EOF and no data!"
12030 val="$undef"
12031 fi
12032 else
12033 echo "I can't compile the test program--assuming errno EAGAIN will do."
12034 eagain=EAGAIN
12035 fi
12036 set d_eofnblk
12037 eval $setvar
12038 ;;
12039*)
12040 echo "Using $hint value $eagain."
12041 echo "Your read() returns $rd_nodata when no data is present."
12042 case "$d_eofnblk" in
12043 "$define") echo "And you can see EOF because read() returns 0.";;
12044 "$undef") echo "But you can't see EOF status from read() returned value.";;
12045 *)
12046 echo "(Assuming you can't see EOF status from read anyway.)"
12047 d_eofnblk=$undef
12048 ;;
12049 esac
12050 ;;
12051esac
12052$rm -f try try.* .out core head.c mtry
12053
15b61c98
JH
12054: see if _ptr and _cnt from stdio act std
12055echo " "
b4eb6b3d 12056
15b61c98
JH
12057if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12058 echo "(Looks like you have stdio.h from BSD.)"
12059 case "$stdio_ptr" in
12060 '') stdio_ptr='((fp)->_p)'
12061 ptr_lval=$define
12062 ;;
12063 *) ptr_lval=$d_stdio_ptr_lval;;
12064 esac
12065 case "$stdio_cnt" in
12066 '') stdio_cnt='((fp)->_r)'
12067 cnt_lval=$define
12068 ;;
12069 *) cnt_lval=$d_stdio_cnt_lval;;
12070 esac
12071 case "$stdio_base" in
12072 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12073 esac
12074 case "$stdio_bufsiz" in
12075 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12076 esac
12077elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12078 echo "(Looks like you have stdio.h from Linux.)"
12079 case "$stdio_ptr" in
12080 '') stdio_ptr='((fp)->_IO_read_ptr)'
12081 ptr_lval=$define
12082 ;;
12083 *) ptr_lval=$d_stdio_ptr_lval;;
12084 esac
12085 case "$stdio_cnt" in
12086 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12087 cnt_lval=$undef
12088 ;;
12089 *) cnt_lval=$d_stdio_cnt_lval;;
12090 esac
12091 case "$stdio_base" in
12092 '') stdio_base='((fp)->_IO_read_base)';;
12093 esac
12094 case "$stdio_bufsiz" in
12095 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12096 esac
12097else
12098 case "$stdio_ptr" in
12099 '') stdio_ptr='((fp)->_ptr)'
12100 ptr_lval=$define
12101 ;;
12102 *) ptr_lval=$d_stdio_ptr_lval;;
12103 esac
12104 case "$stdio_cnt" in
12105 '') stdio_cnt='((fp)->_cnt)'
12106 cnt_lval=$define
12107 ;;
12108 *) cnt_lval=$d_stdio_cnt_lval;;
12109 esac
12110 case "$stdio_base" in
12111 '') stdio_base='((fp)->_base)';;
12112 esac
12113 case "$stdio_bufsiz" in
12114 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12115 esac
12116fi
b4eb6b3d 12117
15b61c98
JH
12118: test whether _ptr and _cnt really work
12119echo "Checking how std your stdio is..." >&4
12120$cat >try.c <<EOP
12121#include <stdio.h>
55954f19
JH
12122#$i_stdlib I_STDLIB
12123#ifdef I_STDLIB
9d9004a9 12124#include <stdlib.h>
55954f19 12125#endif
15b61c98
JH
12126#define FILE_ptr(fp) $stdio_ptr
12127#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12128int main() {
15b61c98
JH
12129 FILE *fp = fopen("try.c", "r");
12130 char c = getc(fp);
12131 if (
12132 18 <= FILE_cnt(fp) &&
12133 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12134 )
12135 exit(0);
12136 exit(1);
9d9004a9 12137}
15b61c98
JH
12138EOP
12139val="$undef"
12140set try
12141if eval $compile && $to try.c; then
12142 if $run ./try; then
12143 echo "Your stdio acts pretty std."
12144 val="$define"
9d9004a9 12145 else
15b61c98 12146 echo "Your stdio isn't very std."
9d9004a9 12147 fi
15b61c98
JH
12148else
12149 echo "Your stdio doesn't appear very std."
12150fi
12151$rm -f try.c try
12152
12153# glibc 2.2.90 and above apparently change stdio streams so Perl's
12154# direct buffer manipulation no longer works. The Configure tests
12155# should be changed to correctly detect this, but until then,
12156# the following check should at least let perl compile and run.
12157# (This quick fix should be updated before 5.8.1.)
12158# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12159# A. Dougherty, June 3, 2002.
12160case "$d_gnulibc" in
12161$define)
12162 case "$gnulibc_version" in
12163 2.[01]*) ;;
12164 2.2) ;;
12165 2.2.[0-9]) ;;
12166 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12167 val="$undef"
12168 ;;
12169 esac
9d9004a9
AD
12170 ;;
12171esac
15b61c98 12172set d_stdstdio
9d9004a9 12173eval $setvar
9d9004a9 12174
15b61c98
JH
12175: Can _ptr be used as an lvalue?
12176case "$d_stdstdio$ptr_lval" in
12177$define$define) val=$define ;;
12178*) val=$undef ;;
12179esac
12180set d_stdio_ptr_lval
12181eval $setvar
9d9004a9 12182
15b61c98
JH
12183: Can _cnt be used as an lvalue?
12184case "$d_stdstdio$cnt_lval" in
12185$define$define) val=$define ;;
12186*) val=$undef ;;
12187esac
12188set d_stdio_cnt_lval
12189eval $setvar
b4eb6b3d 12190
15b61c98
JH
12191
12192: test whether setting _ptr sets _cnt as a side effect
12193d_stdio_ptr_lval_sets_cnt="$undef"
12194d_stdio_ptr_lval_nochange_cnt="$undef"
12195case "$d_stdio_ptr_lval$d_stdstdio" in
12196$define$define)
12197 echo "Checking to see what happens if we set the stdio ptr..." >&4
12198$cat >try.c <<EOP
12199#include <stdio.h>
12200/* Can we scream? */
12201/* Eat dust sed :-) */
12202/* In the buffer space, no one can hear you scream. */
55954f19
JH
12203#$i_stdlib I_STDLIB
12204#ifdef I_STDLIB
12205#include <stdlib.h>
12206#endif
15b61c98
JH
12207#define FILE_ptr(fp) $stdio_ptr
12208#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12209#include <sys/types.h>
b4eb6b3d 12210int main() {
15b61c98
JH
12211 FILE *fp = fopen("try.c", "r");
12212 int c;
12213 char *ptr;
12214 size_t cnt;
12215 if (!fp) {
12216 puts("Fail even to read");
12217 exit(1);
12218 }
12219 c = getc(fp); /* Read away the first # */
12220 if (c == EOF) {
12221 puts("Fail even to read");
12222 exit(1);
12223 }
12224 if (!(
12225 18 <= FILE_cnt(fp) &&
12226 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12227 )) {
12228 puts("Fail even to read");
12229 exit (1);
12230 }
12231 ptr = (char*) FILE_ptr(fp);
12232 cnt = (size_t)FILE_cnt(fp);
12233
12234 FILE_ptr(fp) += 42;
12235
12236 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12237 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12238 exit (1);
12239 }
12240 if (FILE_cnt(fp) <= 20) {
12241 printf ("Fail (<20 chars to test)");
12242 exit (1);
12243 }
12244 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12245 puts("Fail compare");
12246 exit (1);
12247 }
12248 if (cnt == FILE_cnt(fp)) {
12249 puts("Pass_unchanged");
12250 exit (0);
12251 }
12252 if (FILE_cnt(fp) == (cnt - 42)) {
12253 puts("Pass_changed");
12254 exit (0);
12255 }
12256 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12257 return 1;
12258
12259}
12260EOP
12261 set try
12262 if eval $compile && $to try.c; then
12263 case `$run ./try` in
12264 Pass_changed)
12265 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12266 d_stdio_ptr_lval_sets_cnt="$define" ;;
12267 Pass_unchanged)
12268 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12269 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12270 Fail*)
12271 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12272 *)
12273 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12274 esac
12275 else
12276 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12277 fi
12278 $rm -f try.c try
12279 ;;
12280esac
12281
12282: see if _base is also standard
12283val="$undef"
12284case "$d_stdstdio" in
12285$define)
12286 $cat >try.c <<EOP
12287#include <stdio.h>
12288#$i_stdlib I_STDLIB
12289#ifdef I_STDLIB
12290#include <stdlib.h>
12291#endif
12292#define FILE_base(fp) $stdio_base
12293#define FILE_bufsiz(fp) $stdio_bufsiz
12294int main() {
12295 FILE *fp = fopen("try.c", "r");
12296 char c = getc(fp);
12297 if (
12298 19 <= FILE_bufsiz(fp) &&
12299 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12300 )
12301 exit(0);
12302 exit(1);
12303}
12304EOP
12305 set try
12306 if eval $compile && $to try.c; then
12307 if $run ./try; then
12308 echo "And its _base field acts std."
12309 val="$define"
12310 else
12311 echo "But its _base field isn't std."
12312 fi
12313 else
12314 echo "However, it seems to be lacking the _base field."
12315 fi
12316 $rm -f try.c try
12317 ;;
12318esac
12319set d_stdiobase
12320eval $setvar
12321
12322: see if fast_stdio exists
12323val="$undef"
12324case "$d_stdstdio:$d_stdio_ptr_lval" in
12325"$define:$define")
12326 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12327 *$define*)
12328 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12329 val="$define"
12330 ;;
12331 esac
12332 ;;
12333esac
12334set d_faststdio
12335eval $setvar
12336
12337
12338
12339: see if fchdir exists
12340set fchdir d_fchdir
12341eval $inlibc
12342
12343: see if fchmod exists
12344set fchmod d_fchmod
12345eval $inlibc
12346
12347: see if fchown exists
12348set fchown d_fchown
12349eval $inlibc
12350
12351: see if this is an fcntl system
12352set fcntl d_fcntl
12353eval $inlibc
12354
12355echo " "
12356: See if fcntl-based locking works.
12357$cat >try.c <<EOCP
12358#$i_stdlib I_STDLIB
12359#ifdef I_STDLIB
12360#include <stdlib.h>
12361#endif
12362#include <unistd.h>
12363#include <fcntl.h>
12364#include <signal.h>
12365$signal_t blech(x) int x; { exit(3); }
12366int main() {
12367#if defined(F_SETLK) && defined(F_SETLKW)
12368 struct flock flock;
12369 int retval, fd;
12370 fd = open("try.c", O_RDONLY);
12371 flock.l_type = F_RDLCK;
12372 flock.l_whence = SEEK_SET;
12373 flock.l_start = flock.l_len = 0;
12374 signal(SIGALRM, blech);
12375 alarm(10);
12376 retval = fcntl(fd, F_SETLK, &flock);
12377 close(fd);
12378 (retval < 0 ? exit(2) : exit(0));
12379#else
12380 exit(2);
12381#endif
12382}
12383EOCP
12384echo "Checking if fcntl-based file locking works... "
12385case "$d_fcntl" in
12386"$define")
12387 set try
12388 if eval $compile_ok; then
12389 if $run ./try; then
12390 echo "Yes, it seems to work."
12391 val="$define"
12392 else
12393 echo "Nope, it didn't work."
12394 val="$undef"
12395 case "$?" in
12396 3) $cat >&4 <<EOM
12397***
12398*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12399*** This is (almost) impossible.
12400*** If your NFS lock daemons are not feeling well, something like
12401*** this may happen, please investigate. Cannot continue, aborting.
12402***
12403EOM
12404 exit 1
12405 ;;
12406 esac
12407 fi
12408 else
12409 echo "I'm unable to compile the test program, so I'll assume not."
12410 val="$undef"
12411 fi
12412 ;;
12413*) val="$undef";
12414 echo "Nope, since you don't even have fcntl()."
12415 ;;
12416esac
12417set d_fcntl_can_lock
12418eval $setvar
12419$rm -f try*
12420
12421
12422: check for fd_set items
12423$cat <<EOM
12424
12425Checking to see how well your C compiler handles fd_set and friends ...
12426EOM
12427$cat >try.c <<EOCP
12428#$i_stdlib I_STDLIB
12429#ifdef I_STDLIB
12430#include <stdlib.h>
12431#endif
12432#$i_systime I_SYS_TIME
12433#$i_sysselct I_SYS_SELECT
12434#$d_socket HAS_SOCKET
12435#include <sys/types.h>
12436#ifdef HAS_SOCKET
12437#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12438#endif
12439#ifdef I_SYS_TIME
12440#include <sys/time.h>
12441#endif
12442#ifdef I_SYS_SELECT
12443#include <sys/select.h>
12444#endif
12445int main() {
12446 fd_set fds;
12447
12448#ifdef TRYBITS
12449 if(fds.fds_bits);
12450#endif
12451
12452#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12453 exit(0);
12454#else
12455 exit(1);
12456#endif
12457}
12458EOCP
12459set try -DTRYBITS
12460if eval $compile; then
12461 d_fds_bits="$define"
12462 d_fd_set="$define"
12463 echo "Well, your system knows about the normal fd_set typedef..." >&4
12464 if $run ./try; then
b4eb6b3d
JH
12465 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12466 d_fd_macros="$define"
12467 else
12468 $cat >&4 <<'EOM'
12469but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12470EOM
12471 d_fd_macros="$undef"
12472 fi
12473else
12474 $cat <<'EOM'
12475Hmm, your compiler has some difficulty with fd_set. Checking further...
12476EOM
5440bc8e 12477 set try
b4eb6b3d
JH
12478 if eval $compile; then
12479 d_fds_bits="$undef"
12480 d_fd_set="$define"
12481 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12482 if $run ./try; then
b4eb6b3d
JH
12483 echo "and you have the normal fd_set macros." >&4
12484 d_fd_macros="$define"
12485 else
12486 $cat <<'EOM'
12487but not the normal fd_set macros! Gross! More work for me...
12488EOM
12489 d_fd_macros="$undef"
12490 fi
12491 else
12492 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12493 d_fd_set="$undef"
12494 d_fds_bits="$undef"
12495 d_fd_macros="$undef"
12496 fi
12497fi
5440bc8e 12498$rm -f try try.*
b4eb6b3d
JH
12499
12500: see if fgetpos exists
12501set fgetpos d_fgetpos
12502eval $inlibc
12503
758a5d79
JH
12504: see if finite exists
12505set finite d_finite
12506eval $inlibc
12507
12508: see if finitel exists
12509set finitel d_finitel
12510eval $inlibc
12511
b4eb6b3d
JH
12512: see if flock exists
12513set flock d_flock
12514eval $inlibc
12515
2ef53570
JH
12516: see if prototype for flock is available
12517echo " "
12518set d_flockproto flock $i_sysfile sys/file.h
12519eval $hasproto
12520
b4eb6b3d
JH
12521: see if fork exists
12522set fork d_fork
12523eval $inlibc
12524
758a5d79
JH
12525: see if fp_class exists
12526set fp_class d_fp_class
12527eval $inlibc
12528
b4eb6b3d
JH
12529: see if pathconf exists
12530set pathconf d_pathconf
12531eval $inlibc
12532
12533: see if fpathconf exists
12534set fpathconf d_fpathconf
12535eval $inlibc
12536
758a5d79
JH
12537: see if fpclass exists
12538set fpclass d_fpclass
12539eval $inlibc
12540
12541: see if fpclassify exists
12542set fpclassify d_fpclassify
12543eval $inlibc
12544
12545: see if fpclassl exists
12546set fpclassl d_fpclassl
12547eval $inlibc
12548
b4eb6b3d
JH
12549
12550: check for fpos64_t
12551echo " "
12552echo "Checking to see if you have fpos64_t..." >&4
12553$cat >try.c <<EOCP
12554#include <stdio.h>
12555int main() { fpos64_t x = 7; }
12556EOCP
12557set try
12558if eval $compile; then
12559 val="$define"
12560 echo "You have fpos64_t."
12561else
12562 val="$undef"
12563 echo "You do not have fpos64_t."
12564 case "$fpossize" in
12565 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12566 esac
12567fi
12568$rm -f try.* try
12569set d_fpos64_t
12570eval $setvar
12571
12572: see if frexpl exists
12573set frexpl d_frexpl
12574eval $inlibc
12575
b4eb6b3d
JH
12576: see if this is a sys/param system
12577set sys/param.h i_sysparam
12578eval $inhdr
12579
12580: see if this is a sys/mount.h system
12581set sys/mount.h i_sysmount
12582eval $inhdr
12583
b4eb6b3d
JH
12584
12585echo " "
12586echo "Checking to see if your system supports struct fs_data..." >&4
12587set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12588eval $hasstruct
12589case "$d_fs_data_s" in
12590"$define") echo "Yes, it does." ;;
12591*) echo "No, it doesn't." ;;
12592esac
12593
12594: see if fseeko exists
12595set fseeko d_fseeko
12596eval $inlibc
12597case "$longsize" in
125988) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12599esac
12600
12601: see if fsetpos exists
12602set fsetpos d_fsetpos
12603eval $inlibc
12604
12605
12606: see if fstatfs exists
12607set fstatfs d_fstatfs
12608eval $inlibc
12609
12610
12611: see if statvfs exists
12612set statvfs d_statvfs
12613eval $inlibc
12614
12615: see if fstatvfs exists
12616set fstatvfs d_fstatvfs
12617eval $inlibc
12618
12619
411ab01c
JH
12620: see if fsync exists
12621set fsync d_fsync
12622eval $inlibc
12623
b4eb6b3d
JH
12624: see if ftello exists
12625set ftello d_ftello
12626eval $inlibc
12627case "$longsize" in
126288) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12629esac
12630
bff98e24
SP
12631d_futimes="$undef"
12632: check for a working futimes
12633echo " "
12634echo "Checking for a working futimes()" >&4
12635$cat >try.c <<EOCP
12636#include <stdio.h>
12637#include <sys/time.h>
12638#include <errno.h>
12639#include <fcntl.h>
12640
12641int main ()
12642{
12643 int fd, rv;
12644 fd = open ("try.c", O_RDWR);
12645 if (-1 == fd) exit (1);
12646 rv = futimes (fd, NULL);
12647 exit (rv == -1 ? errno : 0);
12648}
12649EOCP
12650set try
12651if eval $compile; then
12652 `$run ./try`
12653 rc=$?
12654 case "$rc" in
12655 0) echo "Yes, it does" >&4
12656 d_futimes="$define"
12657 ;;
12658 *) echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12659 ;;
12660 esac
12661else
12662 echo "No, it does not (probably harmless)\n" >&4
12663fi
12664$rm -f try.* try core core.try.*
dc814df1 12665
b4eb6b3d
JH
12666: see if getcwd exists
12667set getcwd d_getcwd
12668eval $inlibc
12669
12670: see if getespwnam exists
12671set getespwnam d_getespwnam
12672eval $inlibc
12673
12674
12675: see if getfsstat exists
12676set getfsstat d_getfsstat
12677eval $inlibc
12678
12679: see if getgrent exists
12680set getgrent d_getgrent
12681eval $inlibc
12682
10bc17b6
JH
12683: see if getgrent_r exists
12684set getgrent_r d_getgrent_r
12685eval $inlibc
12686case "$d_getgrent_r" in
12687"$define")
12688 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12689 case "$d_getgrent_r_proto:$usethreads" in
12690 ":define") d_getgrent_r_proto=define
a48ec845
JH
12691 set d_getgrent_r_proto getgrent_r $hdrs
12692 eval $hasproto ;;
12693 *) ;;
12694 esac
12695 case "$d_getgrent_r_proto" in
12696 define)
10bc17b6
JH
12697 case "$getgrent_r_proto" in
12698 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12699 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12700 esac
12701 case "$getgrent_r_proto" in
12702 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12703 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12704 esac
12705 case "$getgrent_r_proto" in
12706 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12707 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12708 esac
12709 case "$getgrent_r_proto" in
12710 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12711 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12712 esac
12713 case "$getgrent_r_proto" in
12714 ''|0) try='int getgrent_r(struct group*, char*, int);'
12715 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12716 esac
12717 case "$getgrent_r_proto" in
12718 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12719 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12720 esac
12721 case "$getgrent_r_proto" in
90e831dc 12722 ''|0) d_getgrent_r=undef
10bc17b6 12723 getgrent_r_proto=0
a48ec845 12724 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12725 * ) case "$getgrent_r_proto" in
12726 REENTRANT_PROTO*) ;;
12727 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12728 esac
12729 echo "Prototype: $try" ;;
12730 esac
12731 ;;
c18e646a
JH
12732 *) case "$usethreads" in
12733 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12734 esac
90e831dc
SB
12735 d_getgrent_r=undef
12736 getgrent_r_proto=0
c18e646a 12737 ;;
a48ec845
JH
12738 esac
12739 ;;
10bc17b6
JH
12740*) getgrent_r_proto=0
12741 ;;
12742esac
12743
12744: see if getgrgid_r exists
12745set getgrgid_r d_getgrgid_r
12746eval $inlibc
12747case "$d_getgrgid_r" in
12748"$define")
12749 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12750 case "$d_getgrgid_r_proto:$usethreads" in
12751 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12752 set d_getgrgid_r_proto getgrgid_r $hdrs
12753 eval $hasproto ;;
12754 *) ;;
12755 esac
12756 case "$d_getgrgid_r_proto" in
12757 define)
10bc17b6
JH
12758 case "$getgrgid_r_proto" in
12759 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12760 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12761 esac
12762 case "$getgrgid_r_proto" in
12763 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12764 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12765 esac
12766 case "$getgrgid_r_proto" in
12767 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12768 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12769 esac
12770 case "$getgrgid_r_proto" in
12771 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12772 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12773 esac
12774 case "$getgrgid_r_proto" in
90e831dc 12775 ''|0) d_getgrgid_r=undef
10bc17b6 12776 getgrgid_r_proto=0
a48ec845 12777 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12778 * ) case "$getgrgid_r_proto" in
12779 REENTRANT_PROTO*) ;;
12780 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12781 esac
12782 echo "Prototype: $try" ;;
12783 esac
12784 ;;
c18e646a
JH
12785 *) case "$usethreads" in
12786 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12787 esac
90e831dc
SB
12788 d_getgrgid_r=undef
12789 getgrgid_r_proto=0
c18e646a 12790 ;;
a48ec845
JH
12791 esac
12792 ;;
10bc17b6
JH
12793*) getgrgid_r_proto=0
12794 ;;
12795esac
12796
12797: see if getgrnam_r exists
12798set getgrnam_r d_getgrnam_r
12799eval $inlibc
12800case "$d_getgrnam_r" in
12801"$define")
12802 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12803 case "$d_getgrnam_r_proto:$usethreads" in
12804 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12805 set d_getgrnam_r_proto getgrnam_r $hdrs
12806 eval $hasproto ;;
12807 *) ;;
12808 esac
12809 case "$d_getgrnam_r_proto" in
12810 define)
10bc17b6
JH
12811 case "$getgrnam_r_proto" in
12812 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12813 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12814 esac
12815 case "$getgrnam_r_proto" in
12816 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12817 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12818 esac
12819 case "$getgrnam_r_proto" in
12820 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12821 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12822 esac
12823 case "$getgrnam_r_proto" in
12824 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12825 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12826 esac
12827 case "$getgrnam_r_proto" in
12828 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12829 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12830 esac
12831 case "$getgrnam_r_proto" in
90e831dc 12832 ''|0) d_getgrnam_r=undef
10bc17b6 12833 getgrnam_r_proto=0
a48ec845 12834 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12835 * ) case "$getgrnam_r_proto" in
12836 REENTRANT_PROTO*) ;;
12837 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12838 esac
12839 echo "Prototype: $try" ;;
12840 esac
12841 ;;
c18e646a
JH
12842 *) case "$usethreads" in
12843 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12844 esac
90e831dc
SB
12845 d_getgrnam_r=undef
12846 getgrnam_r_proto=0
c18e646a 12847 ;;
a48ec845
JH
12848 esac
12849 ;;
10bc17b6
JH
12850*) getgrnam_r_proto=0
12851 ;;
12852esac
12853
b4eb6b3d
JH
12854: see if gethostbyaddr exists
12855set gethostbyaddr d_gethbyaddr
12856eval $inlibc
12857
12858: see if gethostbyname exists
12859set gethostbyname d_gethbyname
12860eval $inlibc
12861
12862: see if gethostent exists
12863set gethostent d_gethent
12864eval $inlibc
12865
12866: see how we will look up host name
12867echo " "
12868call=''
12869if set gethostname val -f d_gethname; eval $csym; $val; then
12870 echo 'gethostname() found.' >&4
12871 d_gethname="$define"
12872 call=gethostname
12873fi
12874if set uname val -f d_uname; eval $csym; $val; then
12875 if ./xenix; then
12876 $cat <<'EOM'
12877uname() was found, but you're running xenix, and older versions of xenix
12878have a broken uname(). If you don't really know whether your xenix is old
12879enough to have a broken system call, use the default answer.
12880
12881EOM
12882 dflt=y
12883 case "$d_uname" in
12884 "$define") dflt=n;;
12885 esac
12886 rp='Is your uname() broken?'
12887 . ./myread
12888 case "$ans" in
12889 n*) d_uname="$define"; call=uname;;
12890 esac
12891 else
12892 echo 'uname() found.' >&4
12893 d_uname="$define"
12894 case "$call" in
12895 '') call=uname ;;
12896 esac
12897 fi
12898fi
12899case "$d_gethname" in
12900'') d_gethname="$undef";;
12901esac
12902case "$d_uname" in
12903'') d_uname="$undef";;
12904esac
12905case "$d_uname$d_gethname" in
12906*define*)
12907 dflt=n
12908 cat <<EOM
12909
12910Every now and then someone has a $call() that lies about the hostname
12911but can't be fixed for political or economic reasons. If you wish, I can
12912pretend $call() isn't there and maybe compute hostname at run-time
12913thanks to the '$phostname' command.
12914
12915EOM
12916 rp="Shall I ignore $call() from now on?"
12917 . ./myread
12918 case "$ans" in
12919 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12920 esac;;
12921esac
12922case "$phostname" in
12923'') aphostname='';;
12924*) case "$aphostname" in
12925 /*) ;;
12926 *) set X $phostname
12927 shift
12928 file=$1
12929 shift
12930 file=`./loc $file $file $pth`
12931 aphostname=`echo $file $*`
12932 ;;
12933 esac
12934 ;;
12935esac
12936case "$d_uname$d_gethname" in
12937*define*) ;;
12938*)
12939 case "$phostname" in
12940 '')
12941 echo "There will be no way for $package to get your hostname." >&4;;
12942 *)
12943 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12944 ;;
12945 esac;;
12946esac
12947case "$d_phostname" in
12948'') d_phostname="$undef";;
12949esac
12950
10bc17b6
JH
12951: see if gethostbyaddr_r exists
12952set gethostbyaddr_r d_gethostbyaddr_r
12953eval $inlibc
12954case "$d_gethostbyaddr_r" in
12955"$define")
12956 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12957 case "$d_gethostbyaddr_r_proto:$usethreads" in
12958 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
12959 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12960 eval $hasproto ;;
12961 *) ;;
12962 esac
12963 case "$d_gethostbyaddr_r_proto" in
12964 define)
10bc17b6
JH
12965 case "$gethostbyaddr_r_proto" in
12966 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12967 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12968 esac
12969 case "$gethostbyaddr_r_proto" in
12970 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12971 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12972 esac
12973 case "$gethostbyaddr_r_proto" in
12974 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12975 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12976 esac
12977 case "$gethostbyaddr_r_proto" in
12978 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12979 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12980 esac
12981 case "$gethostbyaddr_r_proto" in
12982 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12983 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12984 esac
12985 case "$gethostbyaddr_r_proto" in
12986 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12987 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12988 esac
12989 case "$gethostbyaddr_r_proto" in
12990 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12991 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12992 esac
12993 case "$gethostbyaddr_r_proto" in
12994 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12995 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12996 esac
12997 case "$gethostbyaddr_r_proto" in
12998 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12999 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13000 esac
13001 case "$gethostbyaddr_r_proto" in
13002 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13003 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13004 esac
13005 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
13006 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13007 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13008 esac
13009 case "$gethostbyaddr_r_proto" in
90e831dc 13010 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13011 gethostbyaddr_r_proto=0
a48ec845 13012 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13013 * ) case "$gethostbyaddr_r_proto" in
13014 REENTRANT_PROTO*) ;;
13015 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13016 esac
13017 echo "Prototype: $try" ;;
13018 esac
13019 ;;
c18e646a
JH
13020 *) case "$usethreads" in
13021 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13022 esac
90e831dc
SB
13023 d_gethostbyaddr_r=undef
13024 gethostbyaddr_r_proto=0
c18e646a 13025 ;;
a48ec845
JH
13026 esac
13027 ;;
10bc17b6
JH
13028*) gethostbyaddr_r_proto=0
13029 ;;
13030esac
13031
13032: see if gethostbyname_r exists
13033set gethostbyname_r d_gethostbyname_r
13034eval $inlibc
13035case "$d_gethostbyname_r" in
13036"$define")
13037 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13038 case "$d_gethostbyname_r_proto:$usethreads" in
13039 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13040 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13041 eval $hasproto ;;
13042 *) ;;
13043 esac
13044 case "$d_gethostbyname_r_proto" in
13045 define)
10bc17b6
JH
13046 case "$gethostbyname_r_proto" in
13047 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13048 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13049 esac
13050 case "$gethostbyname_r_proto" in
13051 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13052 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13053 esac
13054 case "$gethostbyname_r_proto" in
13055 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13056 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13057 esac
13058 case "$gethostbyname_r_proto" in
90e831dc 13059 ''|0) d_gethostbyname_r=undef
10bc17b6 13060 gethostbyname_r_proto=0
a48ec845 13061 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13062 * ) case "$gethostbyname_r_proto" in
13063 REENTRANT_PROTO*) ;;
13064 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13065 esac
13066 echo "Prototype: $try" ;;
13067 esac
13068 ;;
c18e646a
JH
13069 *) case "$usethreads" in
13070 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13071 esac
90e831dc
SB
13072 d_gethostbyname_r=undef
13073 gethostbyname_r_proto=0
c18e646a 13074 ;;
a48ec845
JH
13075 esac
13076 ;;
10bc17b6
JH
13077*) gethostbyname_r_proto=0
13078 ;;
13079esac
13080
13081: see if gethostent_r exists
13082set gethostent_r d_gethostent_r
13083eval $inlibc
13084case "$d_gethostent_r" in
13085"$define")
13086 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13087 case "$d_gethostent_r_proto:$usethreads" in
13088 ":define") d_gethostent_r_proto=define
a48ec845
JH
13089 set d_gethostent_r_proto gethostent_r $hdrs
13090 eval $hasproto ;;
13091 *) ;;
13092 esac
13093 case "$d_gethostent_r_proto" in
13094 define)
10bc17b6
JH
13095 case "$gethostent_r_proto" in
13096 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13097 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13098 esac
13099 case "$gethostent_r_proto" in
13100 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13101 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13102 esac
13103 case "$gethostent_r_proto" in
13104 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13105 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13106 esac
13107 case "$gethostent_r_proto" in
13108 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13109 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13110 esac
13111 case "$gethostent_r_proto" in
13112 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13113 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13114 esac
13115 case "$gethostent_r_proto" in
13116 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13117 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13118 esac
13119 case "$gethostent_r_proto" in
90e831dc 13120 ''|0) d_gethostent_r=undef
10bc17b6 13121 gethostent_r_proto=0
a48ec845 13122 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13123 * ) case "$gethostent_r_proto" in
13124 REENTRANT_PROTO*) ;;
13125 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13126 esac
13127 echo "Prototype: $try" ;;
13128 esac
13129 ;;
c18e646a
JH
13130 *) case "$usethreads" in
13131 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13132 esac
90e831dc
SB
13133 d_gethostent_r=undef
13134 gethostent_r_proto=0
c18e646a 13135 ;;
a48ec845
JH
13136 esac
13137 ;;
10bc17b6
JH
13138*) gethostent_r_proto=0
13139 ;;
13140esac
b4eb6b3d
JH
13141
13142: see if prototypes for various gethostxxx netdb.h functions are available
13143echo " "
13144set d_gethostprotos gethostent $i_netdb netdb.h
13145eval $hasproto
13146
4e0554ec
JH
13147: see if getitimer exists
13148set getitimer d_getitimer
13149eval $inlibc
13150
b4eb6b3d
JH
13151: see if getlogin exists
13152set getlogin d_getlogin
13153eval $inlibc
13154
10bc17b6
JH
13155: see if getlogin_r exists
13156set getlogin_r d_getlogin_r
13157eval $inlibc
13158case "$d_getlogin_r" in
13159"$define")
13160 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13161 case "$d_getlogin_r_proto:$usethreads" in
13162 ":define") d_getlogin_r_proto=define
a48ec845
JH
13163 set d_getlogin_r_proto getlogin_r $hdrs
13164 eval $hasproto ;;
13165 *) ;;
13166 esac
13167 case "$d_getlogin_r_proto" in
13168 define)
10bc17b6
JH
13169 case "$getlogin_r_proto" in
13170 ''|0) try='int getlogin_r(char*, size_t);'
13171 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13172 esac
13173 case "$getlogin_r_proto" in
13174 ''|0) try='int getlogin_r(char*, int);'
13175 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13176 esac
13177 case "$getlogin_r_proto" in
13178 ''|0) try='char* getlogin_r(char*, size_t);'
13179 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13180 esac
13181 case "$getlogin_r_proto" in
13182 ''|0) try='char* getlogin_r(char*, int);'
13183 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13184 esac
13185 case "$getlogin_r_proto" in
90e831dc 13186 ''|0) d_getlogin_r=undef
10bc17b6 13187 getlogin_r_proto=0
a48ec845 13188 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13189 * ) case "$getlogin_r_proto" in
13190 REENTRANT_PROTO*) ;;
13191 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13192 esac
13193 echo "Prototype: $try" ;;
13194 esac
13195 ;;
c18e646a
JH
13196 *) case "$usethreads" in
13197 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13198 esac
90e831dc
SB
13199 d_getlogin_r=undef
13200 getlogin_r_proto=0
c18e646a 13201 ;;
a48ec845
JH
13202 esac
13203 ;;
10bc17b6
JH
13204*) getlogin_r_proto=0
13205 ;;
13206esac
13207
b4eb6b3d
JH
13208: see if getmnt exists
13209set getmnt d_getmnt
13210eval $inlibc
13211
13212: see if getmntent exists
13213set getmntent d_getmntent
13214eval $inlibc
13215
13216: see if getnetbyaddr exists
13217set getnetbyaddr d_getnbyaddr
13218eval $inlibc
13219
13220: see if getnetbyname exists
13221set getnetbyname d_getnbyname
13222eval $inlibc
13223
13224: see if getnetent exists
13225set getnetent d_getnent
13226eval $inlibc
13227
10bc17b6
JH
13228: see if getnetbyaddr_r exists
13229set getnetbyaddr_r d_getnetbyaddr_r
13230eval $inlibc
13231case "$d_getnetbyaddr_r" in
13232"$define")
13233 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13234 case "$d_getnetbyaddr_r_proto:$usethreads" in
13235 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13236 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13237 eval $hasproto ;;
13238 *) ;;
13239 esac
13240 case "$d_getnetbyaddr_r_proto" in
13241 define)
10bc17b6
JH
13242 case "$getnetbyaddr_r_proto" in
13243 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13244 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13245 esac
13246 case "$getnetbyaddr_r_proto" in
13247 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13248 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13249 esac
13250 case "$getnetbyaddr_r_proto" in
13251 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13252 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13253 esac
13254 case "$getnetbyaddr_r_proto" in
13255 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13256 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13257 esac
13258 case "$getnetbyaddr_r_proto" in
13259 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13260 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13261 esac
13262 case "$getnetbyaddr_r_proto" in
13263 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13264 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13265 esac
13266 case "$getnetbyaddr_r_proto" in
13267 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13268 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13269 esac
13270 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13271 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13272 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13273 esac
13274 case "$getnetbyaddr_r_proto" in
90e831dc 13275 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13276 getnetbyaddr_r_proto=0
a48ec845 13277 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13278 * ) case "$getnetbyaddr_r_proto" in
13279 REENTRANT_PROTO*) ;;
13280 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13281 esac
13282 echo "Prototype: $try" ;;
13283 esac
13284 ;;
c18e646a
JH
13285 *) case "$usethreads" in
13286 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13287 esac
90e831dc
SB
13288 d_getnetbyaddr_r=undef
13289 getnetbyaddr_r_proto=0
c18e646a 13290 ;;
a48ec845
JH
13291 esac
13292 ;;
10bc17b6
JH
13293*) getnetbyaddr_r_proto=0
13294 ;;
13295esac
13296
13297: see if getnetbyname_r exists
13298set getnetbyname_r d_getnetbyname_r
13299eval $inlibc
13300case "$d_getnetbyname_r" in
13301"$define")
13302 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13303 case "$d_getnetbyname_r_proto:$usethreads" in
13304 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13305 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13306 eval $hasproto ;;
13307 *) ;;
13308 esac
13309 case "$d_getnetbyname_r_proto" in
13310 define)
10bc17b6
JH
13311 case "$getnetbyname_r_proto" in
13312 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13313 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13314 esac
13315 case "$getnetbyname_r_proto" in
13316 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13317 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13318 esac
13319 case "$getnetbyname_r_proto" in
13320 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13321 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13322 esac
13323 case "$getnetbyname_r_proto" in
13324 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13325 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13326 esac
13327 case "$getnetbyname_r_proto" in
90e831dc 13328 ''|0) d_getnetbyname_r=undef
10bc17b6 13329 getnetbyname_r_proto=0
a48ec845 13330 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13331 * ) case "$getnetbyname_r_proto" in
13332 REENTRANT_PROTO*) ;;
13333 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13334 esac
13335 echo "Prototype: $try" ;;
13336 esac
13337 ;;
c18e646a
JH
13338 *) case "$usethreads" in
13339 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13340 esac
90e831dc
SB
13341 d_getnetbyname_r=undef
13342 getnetbyname_r_proto=0
c18e646a 13343 ;;
a48ec845
JH
13344 esac
13345 ;;
10bc17b6
JH
13346*) getnetbyname_r_proto=0
13347 ;;
13348esac
13349
13350: see if getnetent_r exists
13351set getnetent_r d_getnetent_r
13352eval $inlibc
13353case "$d_getnetent_r" in
13354"$define")
13355 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13356 case "$d_getnetent_r_proto:$usethreads" in
13357 ":define") d_getnetent_r_proto=define
a48ec845
JH
13358 set d_getnetent_r_proto getnetent_r $hdrs
13359 eval $hasproto ;;
13360 *) ;;
13361 esac
13362 case "$d_getnetent_r_proto" in
13363 define)
10bc17b6
JH
13364 case "$getnetent_r_proto" in
13365 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13366 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13367 esac
13368 case "$getnetent_r_proto" in
13369 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13370 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13371 esac
13372 case "$getnetent_r_proto" in
13373 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13374 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13375 esac
13376 case "$getnetent_r_proto" in
13377 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13378 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13379 esac
13380 case "$getnetent_r_proto" in
13381 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13382 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13383 esac
13384 case "$getnetent_r_proto" in
13385 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13386 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13387 esac
13388 case "$getnetent_r_proto" in
90e831dc 13389 ''|0) d_getnetent_r=undef
10bc17b6 13390 getnetent_r_proto=0
a48ec845 13391 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13392 * ) case "$getnetent_r_proto" in
13393 REENTRANT_PROTO*) ;;
13394 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13395 esac
13396 echo "Prototype: $try" ;;
13397 esac
13398 ;;
c18e646a
JH
13399 *) case "$usethreads" in
13400 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13401 esac
90e831dc
SB
13402 d_getnetent_r=undef
13403 getnetent_r_proto=0
c18e646a 13404 ;;
a48ec845
JH
13405 esac
13406 ;;
10bc17b6
JH
13407*) getnetent_r_proto=0
13408 ;;
13409esac
13410
b4eb6b3d
JH
13411: see if prototypes for various getnetxxx netdb.h functions are available
13412echo " "
13413set d_getnetprotos getnetent $i_netdb netdb.h
13414eval $hasproto
13415
0c0643d0
JH
13416: see if getpagesize exists
13417set getpagesize d_getpagsz
13418eval $inlibc
13419
b4eb6b3d
JH
13420
13421: see if getprotobyname exists
13422set getprotobyname d_getpbyname
13423eval $inlibc
13424
13425: see if getprotobynumber exists
13426set getprotobynumber d_getpbynumber
13427eval $inlibc
13428
13429: see if getprotoent exists
13430set getprotoent d_getpent
13431eval $inlibc
13432
13433: see if getpgid exists
13434set getpgid d_getpgid
13435eval $inlibc
13436
13437: see if getpgrp2 exists
13438set getpgrp2 d_getpgrp2
13439eval $inlibc
13440
13441: see if getppid exists
13442set getppid d_getppid
13443eval $inlibc
13444
13445: see if getpriority exists
13446set getpriority d_getprior
13447eval $inlibc
13448
10bc17b6
JH
13449: see if getprotobyname_r exists
13450set getprotobyname_r d_getprotobyname_r
13451eval $inlibc
13452case "$d_getprotobyname_r" in
13453"$define")
13454 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13455 case "$d_getprotobyname_r_proto:$usethreads" in
13456 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13457 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13458 eval $hasproto ;;
13459 *) ;;
13460 esac
13461 case "$d_getprotobyname_r_proto" in
13462 define)
10bc17b6
JH
13463 case "$getprotobyname_r_proto" in
13464 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13465 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13466 esac
13467 case "$getprotobyname_r_proto" in
13468 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13469 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13470 esac
13471 case "$getprotobyname_r_proto" in
13472 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13473 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13474 esac
13475 case "$getprotobyname_r_proto" in
90e831dc 13476 ''|0) d_getprotobyname_r=undef
10bc17b6 13477 getprotobyname_r_proto=0
a48ec845 13478 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13479 * ) case "$getprotobyname_r_proto" in
13480 REENTRANT_PROTO*) ;;
13481 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13482 esac
13483 echo "Prototype: $try" ;;
13484 esac
13485 ;;
c18e646a
JH
13486 *) case "$usethreads" in
13487 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13488 esac
90e831dc
SB
13489 d_getprotobyname_r=undef
13490 getprotobyname_r_proto=0
c18e646a 13491 ;;
a48ec845
JH
13492 esac
13493 ;;
10bc17b6
JH
13494*) getprotobyname_r_proto=0
13495 ;;
13496esac
13497
13498: see if getprotobynumber_r exists
13499set getprotobynumber_r d_getprotobynumber_r
13500eval $inlibc
13501case "$d_getprotobynumber_r" in
13502"$define")
13503 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13504 case "$d_getprotobynumber_r_proto:$usethreads" in
13505 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13506 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13507 eval $hasproto ;;
13508 *) ;;
13509 esac
13510 case "$d_getprotobynumber_r_proto" in
13511 define)
10bc17b6
JH
13512 case "$getprotobynumber_r_proto" in
13513 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13514 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13515 esac
13516 case "$getprotobynumber_r_proto" in
13517 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13518 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13519 esac
13520 case "$getprotobynumber_r_proto" in
13521 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13522 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13523 esac
13524 case "$getprotobynumber_r_proto" in
90e831dc 13525 ''|0) d_getprotobynumber_r=undef
10bc17b6 13526 getprotobynumber_r_proto=0
a48ec845 13527 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13528 * ) case "$getprotobynumber_r_proto" in
13529 REENTRANT_PROTO*) ;;
13530 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13531 esac
13532 echo "Prototype: $try" ;;
13533 esac
13534 ;;
c18e646a
JH
13535 *) case "$usethreads" in
13536 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13537 esac
90e831dc
SB
13538 d_getprotobynumber_r=undef
13539 getprotobynumber_r_proto=0
c18e646a 13540 ;;
a48ec845
JH
13541 esac
13542 ;;
10bc17b6
JH
13543*) getprotobynumber_r_proto=0
13544 ;;
13545esac
13546
13547: see if getprotoent_r exists
13548set getprotoent_r d_getprotoent_r
13549eval $inlibc
13550case "$d_getprotoent_r" in
13551"$define")
13552 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13553 case "$d_getprotoent_r_proto:$usethreads" in
13554 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13555 set d_getprotoent_r_proto getprotoent_r $hdrs
13556 eval $hasproto ;;
13557 *) ;;
13558 esac
13559 case "$d_getprotoent_r_proto" in
13560 define)
10bc17b6
JH
13561 case "$getprotoent_r_proto" in
13562 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13563 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13564 esac
13565 case "$getprotoent_r_proto" in
13566 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13567 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13568 esac
13569 case "$getprotoent_r_proto" in
13570 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13571 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13572 esac
13573 case "$getprotoent_r_proto" in
13574 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13575 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13576 esac
13577 case "$getprotoent_r_proto" in
90e831dc 13578 ''|0) d_getprotoent_r=undef
10bc17b6 13579 getprotoent_r_proto=0
a48ec845 13580 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13581 * ) case "$getprotoent_r_proto" in
13582 REENTRANT_PROTO*) ;;
13583 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13584 esac
13585 echo "Prototype: $try" ;;
13586 esac
13587 ;;
c18e646a
JH
13588 *) case "$usethreads" in
13589 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13590 esac
90e831dc
SB
13591 d_getprotoent_r=undef
13592 getprotoent_r_proto=0
c18e646a 13593 ;;
a48ec845
JH
13594 esac
13595 ;;
10bc17b6
JH
13596*) getprotoent_r_proto=0
13597 ;;
13598esac
13599
b4eb6b3d
JH
13600: see if prototypes for various getprotoxxx netdb.h functions are available
13601echo " "
13602set d_getprotoprotos getprotoent $i_netdb netdb.h
13603eval $hasproto
13604
13605: see if getprpwnam exists
13606set getprpwnam d_getprpwnam
13607eval $inlibc
13608
13609: see if getpwent exists
13610set getpwent d_getpwent
13611eval $inlibc
13612
10bc17b6
JH
13613: see if getpwent_r exists
13614set getpwent_r d_getpwent_r
13615eval $inlibc
13616case "$d_getpwent_r" in
13617"$define")
13618 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13619 case "$d_getpwent_r_proto:$usethreads" in
13620 ":define") d_getpwent_r_proto=define
a48ec845
JH
13621 set d_getpwent_r_proto getpwent_r $hdrs
13622 eval $hasproto ;;
13623 *) ;;
13624 esac
13625 case "$d_getpwent_r_proto" in
13626 define)
10bc17b6
JH
13627 case "$getpwent_r_proto" in
13628 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13629 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13630 esac
13631 case "$getpwent_r_proto" in
13632 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13633 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13634 esac
13635 case "$getpwent_r_proto" in
13636 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13637 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13638 esac
13639 case "$getpwent_r_proto" in
13640 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13641 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13642 esac
13643 case "$getpwent_r_proto" in
13644 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13645 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13646 esac
13647 case "$getpwent_r_proto" in
13648 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13649 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13650 esac
13651 case "$getpwent_r_proto" in
90e831dc 13652 ''|0) d_getpwent_r=undef
10bc17b6 13653 getpwent_r_proto=0
a48ec845 13654 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13655 * ) case "$getpwent_r_proto" in
13656 REENTRANT_PROTO*) ;;
13657 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13658 esac
13659 echo "Prototype: $try" ;;
13660 esac
13661 ;;
c18e646a
JH
13662 *) case "$usethreads" in
13663 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13664 esac
90e831dc
SB
13665 d_getpwent_r=undef
13666 getpwent_r_proto=0
c18e646a 13667 ;;
a48ec845
JH
13668 esac
13669 ;;
10bc17b6
JH
13670*) getpwent_r_proto=0
13671 ;;
13672esac
13673
13674: see if getpwnam_r exists
13675set getpwnam_r d_getpwnam_r
13676eval $inlibc
13677case "$d_getpwnam_r" in
13678"$define")
13679 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13680 case "$d_getpwnam_r_proto:$usethreads" in
13681 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13682 set d_getpwnam_r_proto getpwnam_r $hdrs
13683 eval $hasproto ;;
13684 *) ;;
13685 esac
13686 case "$d_getpwnam_r_proto" in
13687 define)
10bc17b6
JH
13688 case "$getpwnam_r_proto" in
13689 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13690 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13691 esac
13692 case "$getpwnam_r_proto" in
13693 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13694 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13695 esac
13696 case "$getpwnam_r_proto" in
13697 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13698 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13699 esac
13700 case "$getpwnam_r_proto" in
13701 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13702 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13703 esac
13704 case "$getpwnam_r_proto" in
90e831dc 13705 ''|0) d_getpwnam_r=undef
10bc17b6 13706 getpwnam_r_proto=0
a48ec845 13707 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13708 * ) case "$getpwnam_r_proto" in
13709 REENTRANT_PROTO*) ;;
13710 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13711 esac
13712 echo "Prototype: $try" ;;
13713 esac
13714 ;;
c18e646a
JH
13715 *) case "$usethreads" in
13716 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13717 esac
90e831dc
SB
13718 d_getpwnam_r=undef
13719 getpwnam_r_proto=0
c18e646a 13720 ;;
a48ec845
JH
13721 esac
13722 ;;
10bc17b6
JH
13723*) getpwnam_r_proto=0
13724 ;;
13725esac
13726
13727: see if getpwuid_r exists
13728set getpwuid_r d_getpwuid_r
13729eval $inlibc
13730case "$d_getpwuid_r" in
13731"$define")
13732 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13733 case "$d_getpwuid_r_proto:$usethreads" in
13734 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13735 set d_getpwuid_r_proto getpwuid_r $hdrs
13736 eval $hasproto ;;
13737 *) ;;
13738 esac
13739 case "$d_getpwuid_r_proto" in
13740 define)
10bc17b6
JH
13741 case "$getpwuid_r_proto" in
13742 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13743 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13744 esac
13745 case "$getpwuid_r_proto" in
13746 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13747 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13748 esac
13749 case "$getpwuid_r_proto" in
13750 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13751 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13752 esac
13753 case "$getpwuid_r_proto" in
13754 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13755 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13756 esac
13757 case "$getpwuid_r_proto" in
90e831dc 13758 ''|0) d_getpwuid_r=undef
10bc17b6 13759 getpwuid_r_proto=0
a48ec845 13760 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13761 * ) case "$getpwuid_r_proto" in
13762 REENTRANT_PROTO*) ;;
13763 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13764 esac
13765 echo "Prototype: $try" ;;
13766 esac
13767 ;;
c18e646a
JH
13768 *) case "$usethreads" in
13769 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13770 esac
90e831dc
SB
13771 d_getpwuid_r=undef
13772 getpwuid_r_proto=0
c18e646a 13773 ;;
a48ec845
JH
13774 esac
13775 ;;
10bc17b6
JH
13776*) getpwuid_r_proto=0
13777 ;;
13778esac
13779
b4eb6b3d
JH
13780
13781: see if getservbyname exists
13782set getservbyname d_getsbyname
13783eval $inlibc
13784
13785: see if getservbyport exists
13786set getservbyport d_getsbyport
13787eval $inlibc
13788
13789: see if getservent exists
13790set getservent d_getsent
13791eval $inlibc
13792
10bc17b6
JH
13793: see if getservbyname_r exists
13794set getservbyname_r d_getservbyname_r
13795eval $inlibc
13796case "$d_getservbyname_r" in
13797"$define")
13798 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13799 case "$d_getservbyname_r_proto:$usethreads" in
13800 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13801 set d_getservbyname_r_proto getservbyname_r $hdrs
13802 eval $hasproto ;;
13803 *) ;;
13804 esac
13805 case "$d_getservbyname_r_proto" in
13806 define)
10bc17b6
JH
13807 case "$getservbyname_r_proto" in
13808 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13809 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13810 esac
13811 case "$getservbyname_r_proto" in
13812 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13813 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13814 esac
13815 case "$getservbyname_r_proto" in
13816 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13817 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13818 esac
13819 case "$getservbyname_r_proto" in
90e831dc 13820 ''|0) d_getservbyname_r=undef
10bc17b6 13821 getservbyname_r_proto=0
a48ec845 13822 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13823 * ) case "$getservbyname_r_proto" in
13824 REENTRANT_PROTO*) ;;
13825 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13826 esac
13827 echo "Prototype: $try" ;;
13828 esac
13829 ;;
c18e646a
JH
13830 *) case "$usethreads" in
13831 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13832 esac
90e831dc
SB
13833 d_getservbyname_r=undef
13834 getservbyname_r_proto=0
c18e646a 13835 ;;
a48ec845
JH
13836 esac
13837 ;;
10bc17b6
JH
13838*) getservbyname_r_proto=0
13839 ;;
13840esac
13841
13842: see if getservbyport_r exists
13843set getservbyport_r d_getservbyport_r
13844eval $inlibc
13845case "$d_getservbyport_r" in
13846"$define")
13847 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13848 case "$d_getservbyport_r_proto:$usethreads" in
13849 ":define") d_getservbyport_r_proto=define
a48ec845
JH
13850 set d_getservbyport_r_proto getservbyport_r $hdrs
13851 eval $hasproto ;;
13852 *) ;;
13853 esac
13854 case "$d_getservbyport_r_proto" in
13855 define)
10bc17b6
JH
13856 case "$getservbyport_r_proto" in
13857 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13858 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13859 esac
13860 case "$getservbyport_r_proto" in
13861 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13862 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13863 esac
13864 case "$getservbyport_r_proto" in
13865 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13866 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13867 esac
13868 case "$getservbyport_r_proto" in
90e831dc 13869 ''|0) d_getservbyport_r=undef
10bc17b6 13870 getservbyport_r_proto=0
a48ec845 13871 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13872 * ) case "$getservbyport_r_proto" in
13873 REENTRANT_PROTO*) ;;
13874 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13875 esac
13876 echo "Prototype: $try" ;;
13877 esac
13878 ;;
c18e646a
JH
13879 *) case "$usethreads" in
13880 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13881 esac
90e831dc
SB
13882 d_getservbyport_r=undef
13883 getservbyport_r_proto=0
c18e646a 13884 ;;
a48ec845
JH
13885 esac
13886 ;;
10bc17b6
JH
13887*) getservbyport_r_proto=0
13888 ;;
13889esac
13890
13891: see if getservent_r exists
13892set getservent_r d_getservent_r
13893eval $inlibc
13894case "$d_getservent_r" in
13895"$define")
13896 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13897 case "$d_getservent_r_proto:$usethreads" in
13898 ":define") d_getservent_r_proto=define
a48ec845
JH
13899 set d_getservent_r_proto getservent_r $hdrs
13900 eval $hasproto ;;
13901 *) ;;
13902 esac
13903 case "$d_getservent_r_proto" in
13904 define)
10bc17b6
JH
13905 case "$getservent_r_proto" in
13906 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13907 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13908 esac
13909 case "$getservent_r_proto" in
13910 ''|0) try='int getservent_r(struct servent*, char*, int);'
13911 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13912 esac
13913 case "$getservent_r_proto" in
13914 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13915 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13916 esac
13917 case "$getservent_r_proto" in
13918 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13919 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13920 esac
13921 case "$getservent_r_proto" in
90e831dc 13922 ''|0) d_getservent_r=undef
10bc17b6 13923 getservent_r_proto=0
a48ec845 13924 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13925 * ) case "$getservent_r_proto" in
13926 REENTRANT_PROTO*) ;;
13927 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13928 esac
13929 echo "Prototype: $try" ;;
13930 esac
13931 ;;
c18e646a
JH
13932 *) case "$usethreads" in
13933 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13934 esac
90e831dc
SB
13935 d_getservent_r=undef
13936 getservent_r_proto=0
c18e646a 13937 ;;
a48ec845
JH
13938 esac
13939 ;;
10bc17b6
JH
13940*) getservent_r_proto=0
13941 ;;
13942esac
13943
b4eb6b3d
JH
13944: see if prototypes for various getservxxx netdb.h functions are available
13945echo " "
13946set d_getservprotos getservent $i_netdb netdb.h
13947eval $hasproto
13948
13949: see if getspnam exists
13950set getspnam d_getspnam
13951eval $inlibc
13952
10bc17b6
JH
13953: see if this is a shadow.h system
13954set shadow.h i_shadow
13955eval $inhdr
13956
13957: see if getspnam_r exists
13958set getspnam_r d_getspnam_r
13959eval $inlibc
13960case "$d_getspnam_r" in
13961"$define")
13962 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
13963 case "$d_getspnam_r_proto:$usethreads" in
13964 ":define") d_getspnam_r_proto=define
a48ec845
JH
13965 set d_getspnam_r_proto getspnam_r $hdrs
13966 eval $hasproto ;;
13967 *) ;;
13968 esac
13969 case "$d_getspnam_r_proto" in
13970 define)
10bc17b6
JH
13971 case "$getspnam_r_proto" in
13972 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13973 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13974 esac
13975 case "$getspnam_r_proto" in
13976 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13977 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13978 esac
13979 case "$getspnam_r_proto" in
90e831dc 13980 ''|0) d_getspnam_r=undef
10bc17b6 13981 getspnam_r_proto=0
a48ec845 13982 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13983 * ) case "$getspnam_r_proto" in
13984 REENTRANT_PROTO*) ;;
13985 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13986 esac
13987 echo "Prototype: $try" ;;
13988 esac
13989 ;;
c18e646a
JH
13990 *) case "$usethreads" in
13991 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13992 esac
90e831dc
SB
13993 d_getspnam_r=undef
13994 getspnam_r_proto=0
c18e646a 13995 ;;
a48ec845
JH
13996 esac
13997 ;;
10bc17b6
JH
13998*) getspnam_r_proto=0
13999 ;;
14000esac
14001
b4eb6b3d
JH
14002: see if gettimeofday or ftime exists
14003set gettimeofday d_gettimeod
14004eval $inlibc
14005case "$d_gettimeod" in
14006"$undef")
14007 set ftime d_ftime
14008 eval $inlibc
14009 ;;
14010*)
14011 val="$undef"; set d_ftime; eval $setvar
14012 ;;
14013esac
14014case "$d_gettimeod$d_ftime" in
14015"$undef$undef")
14016 echo " "
14017 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14018 ;;
14019esac
14020
10bc17b6
JH
14021: see if gmtime_r exists
14022set gmtime_r d_gmtime_r
14023eval $inlibc
14024case "$d_gmtime_r" in
14025"$define")
d63eadf0 14026 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14027 case "$d_gmtime_r_proto:$usethreads" in
14028 ":define") d_gmtime_r_proto=define
a48ec845
JH
14029 set d_gmtime_r_proto gmtime_r $hdrs
14030 eval $hasproto ;;
14031 *) ;;
14032 esac
14033 case "$d_gmtime_r_proto" in
14034 define)
10bc17b6
JH
14035 case "$gmtime_r_proto" in
14036 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14037 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14038 esac
14039 case "$gmtime_r_proto" in
14040 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14041 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14042 esac
14043 case "$gmtime_r_proto" in
90e831dc 14044 ''|0) d_gmtime_r=undef
10bc17b6 14045 gmtime_r_proto=0
a48ec845 14046 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14047 * ) case "$gmtime_r_proto" in
14048 REENTRANT_PROTO*) ;;
14049 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14050 esac
14051 echo "Prototype: $try" ;;
14052 esac
b4eb6b3d 14053 ;;
c18e646a
JH
14054 *) case "$usethreads" in
14055 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14056 esac
90e831dc
SB
14057 d_gmtime_r=undef
14058 gmtime_r_proto=0
c18e646a 14059 ;;
a48ec845
JH
14060 esac
14061 ;;
10bc17b6 14062*) gmtime_r_proto=0
b4eb6b3d
JH
14063 ;;
14064esac
14065
14066: see if hasmntopt exists
14067set hasmntopt d_hasmntopt
14068eval $inlibc
14069
14070: see if this is a netinet/in.h or sys/in.h system
14071set netinet/in.h i_niin sys/in.h i_sysin
14072eval $inhdr
14073
14074: see if arpa/inet.h has to be included
14075set arpa/inet.h i_arpainet
14076eval $inhdr
14077
14078: see if htonl --and friends-- exists
14079val=''
14080set htonl val
14081eval $inlibc
14082
14083: Maybe they are macros.
14084case "$val" in
14085$undef)
14086 $cat >htonl.c <<EOM
14087#include <stdio.h>
14088#include <sys/types.h>
14089#$i_niin I_NETINET_IN
14090#$i_sysin I_SYS_IN
14091#$i_arpainet I_ARPA_INET
14092#ifdef I_NETINET_IN
14093#include <netinet/in.h>
14094#endif
14095#ifdef I_SYS_IN
14096#include <sys/in.h>
14097#endif
14098#ifdef I_ARPA_INET
14099#include <arpa/inet.h>
14100#endif
14101#ifdef htonl
14102printf("Defined as a macro.");
14103#endif
14104EOM
14105 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14106 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14107 val="$define"
14108 echo "But it seems to be defined as a macro." >&4
14109 fi
14110 $rm -f htonl.?
14111 ;;
14112esac
14113set d_htonl
14114eval $setvar
14115
36adc09b
JH
14116: see if ilogbl exists
14117set ilogbl d_ilogbl
14118eval $inlibc
14119
b4eb6b3d
JH
14120: index or strchr
14121echo " "
14122if set index val -f; eval $csym; $val; then
14123 if set strchr val -f d_strchr; eval $csym; $val; then
14124 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14125 val="$define"
14126 vali="$undef"
14127 echo "strchr() found." >&4
14128 else
14129 val="$undef"
14130 vali="$define"
14131 echo "index() found." >&4
14132 fi
14133 else
14134 val="$undef"
14135 vali="$define"
8dfa8df9
JH
14136 echo "index() found." >&4
14137 fi
b4eb6b3d 14138else
8dfa8df9
JH
14139 if set strchr val -f d_strchr; eval $csym; $val; then
14140 val="$define"
14141 vali="$undef"
14142 echo "strchr() found." >&4
14143 else
14144 echo "No index() or strchr() found!" >&4
14145 val="$undef"
14146 vali="$undef"
14147 fi
b4eb6b3d 14148fi
8dfa8df9
JH
14149set d_strchr; eval $setvar
14150val="$vali"
14151set d_index; eval $setvar
14152
14153: check whether inet_aton exists
14154set inet_aton d_inetaton
14155eval $inlibc
b4eb6b3d
JH
14156
14157: Look for isascii
14158echo " "
36adc09b 14159$cat >isascii.c <<EOCP
b4eb6b3d
JH
14160#include <stdio.h>
14161#include <ctype.h>
55954f19
JH
14162#$i_stdlib I_STDLIB
14163#ifdef I_STDLIB
14164#include <stdlib.h>
14165#endif
b4eb6b3d
JH
14166int main() {
14167 int c = 'A';
14168 if (isascii(c))
14169 exit(0);
14170 else
14171 exit(1);
14172}
14173EOCP
14174set isascii
14175if eval $compile; then
14176 echo "isascii() found." >&4
14177 val="$define"
14178else
14179 echo "isascii() NOT found." >&4
14180 val="$undef"
14181fi
14182set d_isascii
14183eval $setvar
14184$rm -f isascii*
14185
758a5d79
JH
14186: see if isfinite exists
14187set isfinite d_isfinite
14188eval $inlibc
14189
14190: see if isinf exists
14191set isinf d_isinf
14192eval $inlibc
14193
b4eb6b3d
JH
14194: see if isnan exists
14195set isnan d_isnan
14196eval $inlibc
14197
14198: see if isnanl exists
14199set isnanl d_isnanl
14200eval $inlibc
14201
14202: see if killpg exists
14203set killpg d_killpg
14204eval $inlibc
14205
14206: see if lchown exists
14207echo " "
14208$cat > try.c <<'EOCP'
14209/* System header to define __stub macros and hopefully few prototypes,
14210 which can conflict with char lchown(); below. */
14211#include <assert.h>
14212/* Override any gcc2 internal prototype to avoid an error. */
14213/* We use char because int might match the return type of a gcc2
14214 builtin and then its argument prototype would still apply. */
14215char lchown();
14216int main() {
14217 /* The GNU C library defines this for functions which it implements
14218 to always fail with ENOSYS. Some functions are actually named
14219 something starting with __ and the normal name is an alias. */
14220#if defined (__stub_lchown) || defined (__stub___lchown)
14221choke me
14222#else
14223lchown();
14224#endif
14225; return 0; }
14226EOCP
14227set try
14228if eval $compile; then
14229 $echo "lchown() found." >&4
14230 val="$define"
14231else
14232 $echo "lchown() NOT found." >&4
14233 val="$undef"
14234fi
14235set d_lchown
14236eval $setvar
14237
14238: See if number of significant digits in a double precision number is known
14239echo " "
14240$cat >ldbl_dig.c <<EOM
14241#$i_limits I_LIMITS
14242#$i_float I_FLOAT
14243#ifdef I_LIMITS
14244#include <limits.h>
14245#endif
14246#ifdef I_FLOAT
14247#include <float.h>
14248#endif
14249#ifdef LDBL_DIG
14250printf("Contains LDBL_DIG");
14251#endif
14252EOM
14253$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14254if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14255 echo "LDBL_DIG found." >&4
14256 val="$define"
14257else
14258 echo "LDBL_DIG NOT found." >&4
14259 val="$undef"
14260fi
14261$rm -f ldbl_dig.?
14262set d_ldbl_dig
14263eval $setvar
14264
0a0abfba
MB
14265: see if this is a math.h system
14266set math.h i_math
14267eval $inhdr
14268
14269d_libm_lib_version="$undef"
14270case $i_math in
14271 $define)
14272 : check to see if math.h defines _LIB_VERSION
14273 echo " "
14274 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14275 $cat >try.c <<EOCP
14276#include <unistd.h>
14277#include <math.h>
14278int main (int argc, char *argv[])
14279{
14280 printf ("%d\n", _LIB_VERSION);
14281 return (0);
14282 } /* main */
14283EOCP
14284 set try
14285 if eval $compile; then
14286 foo=`$run ./try`
14287 echo "Yes, it does ($foo)" >&4
14288 d_libm_lib_version="$define"
14289 else
14290 echo "No, it does not (probably harmless)\n" >&4
14291 fi
14292 $rm -f try.* try core core.try.*
14293 ;;
14294
14295 esac
14296
b4eb6b3d
JH
14297: see if link exists
14298set link d_link
14299eval $inlibc
14300
10bc17b6
JH
14301: see if localtime_r exists
14302set localtime_r d_localtime_r
14303eval $inlibc
14304case "$d_localtime_r" in
14305"$define")
d63eadf0 14306 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14307 case "$d_localtime_r_proto:$usethreads" in
14308 ":define") d_localtime_r_proto=define
a48ec845
JH
14309 set d_localtime_r_proto localtime_r $hdrs
14310 eval $hasproto ;;
14311 *) ;;
14312 esac
14313 case "$d_localtime_r_proto" in
14314 define)
10bc17b6
JH
14315 case "$localtime_r_proto" in
14316 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14317 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14318 esac
14319 case "$localtime_r_proto" in
14320 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14321 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14322 esac
14323 case "$localtime_r_proto" in
90e831dc 14324 ''|0) d_localtime_r=undef
10bc17b6 14325 localtime_r_proto=0
a48ec845 14326 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14327 * ) case "$localtime_r_proto" in
14328 REENTRANT_PROTO*) ;;
14329 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14330 esac
14331 echo "Prototype: $try" ;;
14332 esac
14333 ;;
c18e646a
JH
14334 *) case "$usethreads" in
14335 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14336 esac
90e831dc
SB
14337 d_localtime_r=undef
14338 localtime_r_proto=0
c18e646a 14339 ;;
a48ec845
JH
14340 esac
14341 ;;
10bc17b6
JH
14342*) localtime_r_proto=0
14343 ;;
14344esac
14345
b4eb6b3d
JH
14346: see if localeconv exists
14347set localeconv d_locconv
14348eval $inlibc
14349
14350: see if lockf exists
14351set lockf d_lockf
14352eval $inlibc
14353
b4eb6b3d
JH
14354: see if prototype for lseek is available
14355echo " "
4786929f 14356set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14357eval $hasproto
14358
14359: see if lstat exists
14360set lstat d_lstat
14361eval $inlibc
14362
14363: see if madvise exists
14364set madvise d_madvise
14365eval $inlibc
14366
7dd121ae
MB
14367: see if malloc_size exists
14368set malloc_size d_malloc_size
14369eval $inlibc
14370
14371: see if malloc_size_good exists
14372set malloc_good_size d_malloc_good_size
14373eval $inlibc
14374
b4eb6b3d
JH
14375: see if mblen exists
14376set mblen d_mblen
14377eval $inlibc
14378
14379: see if mbstowcs exists
14380set mbstowcs d_mbstowcs
14381eval $inlibc
14382
14383: see if mbtowc exists
14384set mbtowc d_mbtowc
14385eval $inlibc
14386
14387: see if memchr exists
14388set memchr d_memchr
14389eval $inlibc
14390
14391: see if memcmp exists
14392set memcmp d_memcmp
14393eval $inlibc
14394
14395: see if memcpy exists
14396set memcpy d_memcpy
14397eval $inlibc
14398
14399: see if memmove exists
14400set memmove d_memmove
14401eval $inlibc
14402
14403: see if memset exists
14404set memset d_memset
14405eval $inlibc
14406
14407: see if mkdir exists
14408set mkdir d_mkdir
14409eval $inlibc
14410
14411: see if mkdtemp exists
14412set mkdtemp d_mkdtemp
14413eval $inlibc
14414
14415: see if mkfifo exists
14416set mkfifo d_mkfifo
14417eval $inlibc
14418
14419: see if mkstemp exists
14420set mkstemp d_mkstemp
14421eval $inlibc
14422
14423: see if mkstemps exists
14424set mkstemps d_mkstemps
14425eval $inlibc
14426
14427: see if mktime exists
14428set mktime d_mktime
14429eval $inlibc
14430
14431: see if this is a sys/mman.h system
14432set sys/mman.h i_sysmman
14433eval $inhdr
14434
14435: see if mmap exists
14436set mmap d_mmap
14437eval $inlibc
14438: see what shmat returns
14439: default to something harmless
14440mmaptype='void *'
14441case "$i_sysmman$d_mmap" in
14442"$define$define")
14443 $cat >mmap.c <<'END'
14444#include <sys/mman.h>
14445void *mmap();
14446END
14447 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14448 mmaptype='void *'
14449 else
14450 mmaptype='caddr_t'
14451 fi
14452 echo "and it returns ($mmaptype)." >&4
14453 ;;
14454esac
14455
14456
14457
89ce900e
JH
14458: see if sqrtl exists
14459set sqrtl d_sqrtl
14460eval $inlibc
14461
af1ff193
JH
14462: see if scalbnl exists
14463set scalbnl d_scalbnl
14464eval $inlibc
14465
89ce900e
JH
14466: see if modfl exists
14467set modfl d_modfl
14468eval $inlibc
14469
14470: see if prototype for modfl is available
14471echo " "
3a794506 14472set d_modflproto modfl $i_math math.h
89ce900e
JH
14473eval $hasproto
14474
14475d_modfl_pow32_bug="$undef"
14476
14477case "$d_longdbl$d_modfl" in
14478$define$define)
14479 $cat <<EOM
14480Checking to see whether your modfl() is okay for large values...
14481EOM
14482$cat >try.c <<EOCP
14483#include <math.h>
14484#include <stdio.h>
14485EOCP
14486if $test "X$d_modflproto" != "X$define"; then
14487 $cat >>try.c <<EOCP
14488/* Sigh. many current glibcs provide the function, but do not prototype it. */
14489long double modfl (long double, long double *);
14490EOCP
14491fi
14492$cat >>try.c <<EOCP
14493int main() {
14494 long double nv = 4294967303.15;
14495 long double v, w;
14496 v = modfl(nv, &w);
14497#ifdef __GLIBC__
14498 printf("glibc");
14499#endif
14500 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14501 return 0;
14502}
14503EOCP
14504 case "$osname:$gccversion" in
14505 aix:) saveccflags="$ccflags"
14506 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14507 esac
14508 set try
14509 if eval $compile; then
14510 foo=`$run ./try`
14511 case "$foo" in
14512 *" 4294967303.150000 1.150000 4294967302.000000")
14513 echo >&4 "Your modfl() is broken for large values."
14514 d_modfl_pow32_bug="$define"
14515 case "$foo" in
14516 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14517 ;;
14518 esac
14519 ;;
14520 *" 4294967303.150000 0.150000 4294967303.000000")
14521 echo >&4 "Your modfl() seems okay for large values."
14522 ;;
14523 *) echo >&4 "I don't understand your modfl() at all."
14524 d_modfl="$undef"
14525 ;;
14526 esac
14527 $rm -f try.* try core core.try.*
14528 else
14529 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14530 d_modfl="$undef"
14531 fi
14532 case "$osname:$gccversion" in
14533 aix:) ccflags="$saveccflags" ;; # restore
14534 esac
14535 ;;
14536esac
14537
14538if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14539 message=""
14540 if $test "$d_sqrtl" != "$define"; then
14541 message="$message sqrtl"
14542 fi
14543 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14544 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14545 echo "You have both aintl and copysignl, so I can emulate modfl."
14546 else
af1ff193 14547 message="$message modfl"
89ce900e 14548 fi
af1ff193
JH
14549 fi
14550 if $test "$d_frexpl" != "$define"; then
14551 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14552 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14553 else
14554 message="$message frexpl"
14555 fi
14556 fi
89ce900e 14557
af1ff193 14558 if $test "$message" != ""; then
89ce900e
JH
14559 $cat <<EOM >&4
14560
14561*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14562*** the following mathematical functions needed for long double support:
14563*** $message
fe63a0b4
JH
14564*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14565*** Cannot continue, aborting.
89ce900e
JH
14566
14567EOM
14568
fe63a0b4 14569 exit 1
89ce900e
JH
14570 fi
14571fi
14572
b4eb6b3d
JH
14573: see if mprotect exists
14574set mprotect d_mprotect
14575eval $inlibc
14576
14577: see if msgctl exists
14578set msgctl d_msgctl
14579eval $inlibc
14580
14581: see if msgget exists
14582set msgget d_msgget
14583eval $inlibc
14584
14585: see if msgsnd exists
14586set msgsnd d_msgsnd
14587eval $inlibc
14588
14589: see if msgrcv exists
14590set msgrcv d_msgrcv
14591eval $inlibc
14592
14593: see how much of the 'msg*(2)' library is present.
14594h_msg=true
14595echo " "
14596case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14597*"$undef"*) h_msg=false;;
14598esac
14599case "$osname" in
14600freebsd)
14601 case "`ipcs 2>&1`" in
14602 "SVID messages"*"not configured"*)
14603 echo "Your $osname does not have the msg*(2) configured." >&4
14604 h_msg=false
14605 val="$undef"
14606 set msgctl d_msgctl
14607 eval $setvar
14608 set msgget d_msgget
14609 eval $setvar
14610 set msgsnd d_msgsnd
14611 eval $setvar
14612 set msgrcv d_msgrcv
14613 eval $setvar
14614 ;;
14615 esac
14616 ;;
14617esac
14618: we could also check for sys/ipc.h ...
14619if $h_msg && $test `./findhdr sys/msg.h`; then
14620 echo "You have the full msg*(2) library." >&4
14621 val="$define"
14622else
14623 echo "You don't have the full msg*(2) library." >&4
14624 val="$undef"
14625fi
14626set d_msg
14627eval $setvar
14628
4e0554ec
JH
14629
14630echo " "
14631echo "Checking to see if your system supports struct msghdr..." >&4
14632set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14633eval $hasstruct
14634case "$d_msghdr_s" in
14635"$define") echo "Yes, it does." ;;
14636*) echo "No, it doesn't." ;;
14637esac
14638
14639
b4eb6b3d
JH
14640: see if msync exists
14641set msync d_msync
14642eval $inlibc
14643
14644: see if munmap exists
14645set munmap d_munmap
14646eval $inlibc
14647
14648: see if nice exists
14649set nice d_nice
14650eval $inlibc
14651
2765b840
JH
14652: see if this is a langinfo.h system
14653set langinfo.h i_langinfo
14654eval $inhdr
14655
14656: see if nl_langinfo exists
14657set nl_langinfo d_nl_langinfo
14658eval $inlibc
14659
b4eb6b3d
JH
14660: check for length of character
14661echo " "
14662case "$charsize" in
14663'')
14664 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 14665 $cat >try.c <<EOCP
b4eb6b3d 14666#include <stdio.h>
d1daaddf
JH
14667#$i_stdlib I_STDLIB
14668#ifdef I_STDLIB
14669#include <stdlib.h>
14670#endif
b4eb6b3d
JH
14671int main()
14672{
14673 printf("%d\n", (int)sizeof(char));
14674 exit(0);
14675}
14676EOCP
14677 set try
14678 if eval $compile_ok; then
5440bc8e 14679 dflt=`$run ./try`
b4eb6b3d
JH
14680 else
14681 dflt='1'
14682 echo "(I can't seem to compile the test program. Guessing...)"
14683 fi
14684 ;;
14685*)
14686 dflt="$charsize"
14687 ;;
14688esac
14689rp="What is the size of a character (in bytes)?"
14690. ./myread
14691charsize="$ans"
14692$rm -f try.c try
14693
1d1be0dc
NC
14694: check for volatile keyword
14695echo " "
14696echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14697$cat >try.c <<'EOCP'
76f47787 14698int main()
1d1be0dc
NC
14699{
14700 typedef struct _goo_struct goo_struct;
14701 goo_struct * volatile goo = ((goo_struct *)0);
14702 struct _goo_struct {
14703 long long_int;
14704 int reg_int;
14705 char char_var;
14706 };
14707 typedef unsigned short foo_t;
14708 char *volatile foo;
14709 volatile int bar;
14710 volatile foo_t blech;
14711 foo = foo;
14712}
14713EOCP
14714if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14715 val="$define"
14716 echo "Yup, it does."
14717else
14718 val="$undef"
14719 echo "Nope, it doesn't."
14720fi
14721set d_volatile
14722eval $setvar
14723$rm -f try.*
14724
b4eb6b3d
JH
14725
14726echo " "
14727$echo "Choosing the C types to be used for Perl's internal types..." >&4
14728
14729case "$use64bitint:$d_quad:$quadtype" in
14730define:define:?*)
14731 ivtype="$quadtype"
14732 uvtype="$uquadtype"
14733 ivsize=8
14734 uvsize=8
14735 ;;
14736*) ivtype="long"
14737 uvtype="unsigned long"
14738 ivsize=$longsize
14739 uvsize=$longsize
14740 ;;
14741esac
14742
14743case "$uselongdouble:$d_longdbl" in
14744define:define)
14745 nvtype="long double"
14746 nvsize=$longdblsize
14747 ;;
14748*) nvtype=double
14749 nvsize=$doublesize
14750 ;;
14751esac
14752
14753$echo "(IV will be "$ivtype", $ivsize bytes)"
14754$echo "(UV will be "$uvtype", $uvsize bytes)"
14755$echo "(NV will be "$nvtype", $nvsize bytes)"
14756
14757$cat >try.c <<EOCP
14758#$i_inttypes I_INTTYPES
14759#ifdef I_INTTYPES
14760#include <inttypes.h>
14761#endif
14762#include <stdio.h>
14763int main() {
14764#ifdef INT8
14765 int8_t i = INT8_MAX;
14766 uint8_t u = UINT8_MAX;
14767 printf("int8_t\n");
14768#endif
14769#ifdef INT16
14770 int16_t i = INT16_MAX;
14771 uint16_t i = UINT16_MAX;
14772 printf("int16_t\n");
14773#endif
14774#ifdef INT32
14775 int32_t i = INT32_MAX;
14776 uint32_t u = UINT32_MAX;
14777 printf("int32_t\n");
14778#endif
14779}
14780EOCP
14781
14782case "$i8type" in
14783'') case "$charsize" in
14784 1) i8type=char
14785 u8type="unsigned char"
14786 i8size=$charsize
14787 u8size=$charsize
14788 ;;
14789 esac
14790 ;;
14791esac
14792case "$i8type" in
14793'') set try -DINT8
14794 if eval $compile; then
5440bc8e 14795 case "`$run ./try`" in
b4eb6b3d
JH
14796 int8_t) i8type=int8_t
14797 u8type=uint8_t
14798 i8size=1
14799 u8size=1
14800 ;;
14801 esac
14802 fi
14803 ;;
14804esac
14805case "$i8type" in
14806'') if $test $charsize -ge 1; then
14807 i8type=char
14808 u8type="unsigned char"
14809 i8size=$charsize
14810 u8size=$charsize
14811 fi
14812 ;;
14813esac
14814
14815case "$i16type" in
14816'') case "$shortsize" in
14817 2) i16type=short
14818 u16type="unsigned short"
14819 i16size=$shortsize
14820 u16size=$shortsize
14821 ;;
14822 esac
14823 ;;
14824esac
14825case "$i16type" in
14826'') set try -DINT16
14827 if eval $compile; then
5440bc8e 14828 case "`$run ./try`" in
b4eb6b3d
JH
14829 int16_t)
14830 i16type=int16_t
14831 u16type=uint16_t
14832 i16size=2
14833 u16size=2
14834 ;;
14835 esac
14836 fi
14837 ;;
14838esac
14839case "$i16type" in
14840'') if $test $shortsize -ge 2; then
14841 i16type=short
14842 u16type="unsigned short"
14843 i16size=$shortsize
14844 u16size=$shortsize
14845 fi
14846 ;;
14847esac
14848
14849case "$i32type" in
14850'') case "$longsize" in
14851 4) i32type=long
14852 u32type="unsigned long"
14853 i32size=$longsize
14854 u32size=$longsize
14855 ;;
14856 *) case "$intsize" in
14857 4) i32type=int
14858 u32type="unsigned int"
14859 i32size=$intsize
14860 u32size=$intsize
14861 ;;
14862 esac
14863 ;;
14864 esac
14865 ;;
14866esac
14867case "$i32type" in
14868'') set try -DINT32
14869 if eval $compile; then
5440bc8e 14870 case "`$run ./try`" in
b4eb6b3d
JH
14871 int32_t)
14872 i32type=int32_t
14873 u32type=uint32_t
14874 i32size=4
14875 u32size=4
14876 ;;
14877 esac
14878 fi
14879 ;;
14880esac
14881case "$i32type" in
14882'') if $test $intsize -ge 4; then
14883 i32type=int
14884 u32type="unsigned int"
14885 i32size=$intsize
14886 u32size=$intsize
14887 fi
14888 ;;
14889esac
14890
14891case "$i64type" in
14892'') case "$d_quad:$quadtype" in
14893 define:?*)
14894 i64type="$quadtype"
14895 u64type="$uquadtype"
14896 i64size=8
14897 u64size=8
14898 ;;
14899 esac
14900 ;;
14901esac
14902
1d1be0dc
NC
14903$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14904: volatile so that the compiler has to store it out to memory.
14905if test X"$d_volatile" = X"$define"; then
14906 volatile=volatile
14907fi
b4eb6b3d
JH
14908$cat <<EOP >try.c
14909#include <stdio.h>
55954f19
JH
14910#$i_stdlib I_STDLIB
14911#ifdef I_STDLIB
14912#include <stdlib.h>
14913#endif
1d1be0dc
NC
14914#include <sys/types.h>
14915#include <signal.h>
14916#ifdef SIGFPE
14917$volatile int bletched = 0;
14918$signal_t blech(s) int s; { bletched = 1; }
14919#endif
b4eb6b3d
JH
14920int main() {
14921 $uvtype u = 0;
1d1be0dc 14922 $nvtype d;
b4eb6b3d
JH
14923 int n = 8 * $uvsize;
14924 int i;
1d1be0dc
NC
14925#ifdef SIGFPE
14926 signal(SIGFPE, blech);
14927#endif
14928
b4eb6b3d
JH
14929 for (i = 0; i < n; i++) {
14930 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
14931 d = ($nvtype)u;
14932 if (($uvtype)d != u)
b4eb6b3d 14933 break;
1d1be0dc
NC
14934 if (d <= 0)
14935 break;
14936 d = ($nvtype)(u - 1);
14937 if (($uvtype)d != (u - 1))
14938 break;
14939#ifdef SIGFPE
14940 if (bletched) {
14941 break;
14942#endif
14943 }
b4eb6b3d 14944 }
efd1522b 14945 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
14946 exit(0);
14947}
14948EOP
1d1be0dc
NC
14949set try
14950
14951d_nv_preserves_uv="$undef"
14952if eval $compile; then
53133ed1 14953 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 14954fi
53133ed1 14955case "$nv_preserves_uv_bits" in
1d1be0dc 14956\-[1-9]*)
53133ed1
NC
14957 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14958 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 14959 d_nv_preserves_uv="$define"
b4eb6b3d 14960 ;;
53133ed1 14961[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
14962 d_nv_preserves_uv="$undef" ;;
14963*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 14964 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
14965esac
14966
1d1be0dc
NC
14967$rm -f try.* try
14968
f607920a
CB
14969$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14970: volatile so that the compiler has to store it out to memory.
14971if test X"$d_volatile" = X"$define"; then
14972 volatile=volatile
14973fi
14974$cat <<EOP >try.c
14975#include <stdio.h>
14976#$i_stdlib I_STDLIB
14977#ifdef I_STDLIB
14978#include <stdlib.h>
14979#endif
14980#$i_string I_STRING
14981#ifdef I_STRING
14982# include <string.h>
14983#else
14984# include <strings.h>
14985#endif
14986#include <sys/types.h>
14987#include <signal.h>
14988#ifdef SIGFPE
14989$volatile int bletched = 0;
14990$signal_t blech(s) int s; { bletched = 1; }
14991#endif
14992
14993int checkit($nvtype d, char *where) {
14994 unsigned char *p = (char *)&d;
14995 unsigned char *end = p + sizeof(d);
14996 int fail = 0;
14997
14998 while (p < end)
14999 fail += *p++;
15000
15001 if (!fail)
17f6277d 15002 return 0;
f607920a
CB
15003
15004 p = (char *)&d;
15005 printf("No - %s: 0x", where);
15006 while (p < end)
15007 printf ("%02X", *p++);
15008 printf("\n");
15009 return 1;
15010}
15011
15012int main(int argc, char **argv) {
15013 $nvtype d = 0.0;
15014 int fail = 0;
15015 fail += checkit(d, "0.0");
15016
15017 /* The compiler shouldn't be assuming that bletched is 0 */
15018 d = bletched;
15019
15020 fail += checkit(d, "bleched");
15021
15022#ifdef SIGFPE
15023 signal(SIGFPE, blech);
15024#endif
15025
15026 /* Paranoia - the compiler should have no way of knowing that ANSI says
15027 that argv[argc] will always be NULL. Actually, if it did assume this it
15028 would be buggy, as this is C and main() can be called from elsewhere in
15029 the program. */
15030 d = argv[argc] ? 1 : 0;
15031
15032 if (d) {
15033 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15034 }
15035
15036 fail += checkit(d, "ternary");
15037
15038 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15039
15040 if (d != 0.0) {
15041 printf("No - memset doesn't give 0.0\n");
15042 /* This might just blow up: */
15043 printf("(gives %g)\n", d);
15044 return 1;
15045 }
15046
15047#ifdef SIGFPE
15048 if (bletched) {
15049 printf("No - something bleched\n");
15050 return 1;
15051 }
15052#endif
15053 if (fail) {
15054 printf("No - %d fail(s)\n", fail);
15055 return 1;
15056 }
15057 printf("Yes\n");
15058 return 0;
15059}
15060EOP
15061set try
15062
15063d_nv_zero_is_allbits_zero="$undef"
15064if eval $compile; then
15065 xxx="`$run ./try`"
15066 case "$?" in
15067 0)
15068 case "$xxx" in
15069 Yes) cat >&4 <<EOM
150700.0 is represented as all bits zero in memory
15071EOM
15072 d_nv_zero_is_allbits_zero="$define"
15073 ;;
15074 *) cat >&4 <<EOM
150750.0 is not represented as all bits zero in memory
15076EOM
15077 d_nv_zero_is_allbits_zero="$undef"
15078 ;;
15079 esac
15080 ;;
15081 *) cat >&4 <<EOM
150820.0 is not represented as all bits zero in memory
15083EOM
15084 d_nv_zero_is_allbits_zero="$undef"
15085 ;;
15086 esac
15087fi
15088
15089$rm -f try.* try
15090
b4eb6b3d
JH
15091
15092: check for off64_t
15093echo " "
15094echo "Checking to see if you have off64_t..." >&4
15095$cat >try.c <<EOCP
15096#include <sys/types.h>
15097#include <unistd.h>
15098int main() { off64_t x = 7; }
15099EOCP
15100set try
15101if eval $compile; then
15102 val="$define"
15103 echo "You have off64_t."
15104else
15105 val="$undef"
15106 echo "You do not have off64_t."
15107 case "$lseeksize" in
15108 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15109 esac
15110fi
15111$rm -f try.* try
15112set d_off64_t
15113eval $setvar
15114
b4eb6b3d
JH
15115: how to create joinable pthreads
15116if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15117 echo " "
15118 echo "Checking what constant to use for creating joinable pthreads..." >&4
15119 $cat >try.c <<'EOCP'
15120#include <pthread.h>
15121int main() {
15122 int detachstate = JOINABLE;
15123}
15124EOCP
15125 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15126 if eval $compile; then
15127 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15128 val="$undef" # Yes, undef.
15129 set d_old_pthread_create_joinable
15130 eval $setvar
15131 val=""
15132 set old_pthread_create_joinable
15133 eval $setvar
15134 else
15135 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15136 if eval $compile; then
15137 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15138 val="$define"
15139 set d_old_pthread_create_joinable
15140 eval $setvar
15141 val=PTHREAD_CREATE_UNDETACHED
15142 set old_pthread_create_joinable
15143 eval $setvar
15144 else
15145 set try -DJOINABLE=__UNDETACHED
15146 if eval $compile; then
15147 echo "You seem to use __UNDETACHED." >&4
15148 val="$define"
15149 set d_old_pthread_create_joinable
15150 eval $setvar
15151 val=__UNDETACHED
15152 set old_pthread_create_joinable
15153 eval $setvar
15154 else
15155 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15156 val="$define"
15157 set d_old_pthread_create_joinable
15158 eval $setvar
15159 val=0
15160 set old_pthread_create_joinable
15161 eval $setvar
15162 fi
15163 fi
15164 fi
15165 $rm -f try try.*
15166else
15167 d_old_pthread_create_joinable="$undef"
15168 old_pthread_create_joinable=""
15169fi
15170
15171: see if pause exists
15172set pause d_pause
15173eval $inlibc
15174
15175: see if pipe exists
15176set pipe d_pipe
15177eval $inlibc
15178
15179: see if poll exists
15180set poll d_poll
15181eval $inlibc
15182
c7aff470
NIS
15183: see if readlink exists
15184set readlink d_readlink
15185eval $inlibc
15186
15187echo " "
f24dbf84 15188procselfexe=''
c7aff470 15189val="$undef"
a33c94aa
JH
15190case "$d_readlink" in
15191"$define")
c7aff470
NIS
15192 if $issymlink /proc/self/exe ; then
15193 $ls -l /proc/self/exe > reflect
51660ed5 15194 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15195 echo "You have Linux-like /proc/self/exe."
92236451 15196 procselfexe='"/proc/self/exe"'
f24dbf84 15197 val="$define"
f24dbf84
JH
15198 fi
15199 fi
15200 if $issymlink /proc/curproc/file ; then
15201 $ls -l /proc/curproc/file > reflect
15202 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15203 echo "You have BSD-like /proc/curproc/file."
92236451 15204 procselfexe='"/proc/curproc/file"'
f24dbf84 15205 val="$define"
c7aff470 15206 fi
c7aff470 15207 fi
a33c94aa
JH
15208 ;;
15209esac
428dc699 15210$rm -f reflect
c7aff470
NIS
15211set d_procselfexe
15212eval $setvar
15213
263fee3f
JH
15214: see whether the pthread_atfork exists
15215$cat >try.c <<EOP
15216#include <pthread.h>
15217#include <stdio.h>
15218int main() {
15219#ifdef PTHREAD_ATFORK
15220 pthread_atfork(NULL,NULL,NULL);
15221#endif
15222}
15223EOP
15224
d6483fcc 15225: see if pthread_atfork exists
263fee3f
JH
15226set try -DPTHREAD_ATFORK
15227if eval $compile; then
15228 val="$define"
15229else
15230 val="$undef"
15231fi
15232case "$usethreads" in
15233$define)
15234 case "$val" in
15235 $define) echo 'pthread_atfork found.' >&4 ;;
15236 *) echo 'pthread_atfork NOT found.' >&4 ;;
15237 esac
15238esac
15239set d_pthread_atfork
15240eval $setvar
d6483fcc 15241
58d975c3
JH
15242: see if pthread_attr_setscope exists
15243set pthread_attr_setscope d_pthread_attr_setscope
15244eval $inlibc
15245
b4eb6b3d
JH
15246
15247: see whether the various POSIXish _yields exist
15248$cat >try.c <<EOP
15249#include <pthread.h>
15250#include <stdio.h>
15251int main() {
15252#ifdef SCHED_YIELD
15253 sched_yield();
15254#else
15255#ifdef PTHREAD_YIELD
15256 pthread_yield();
15257#else
15258#ifdef PTHREAD_YIELD_NULL
15259 pthread_yield(NULL);
15260#endif
15261#endif
15262#endif
15263}
15264EOP
15265: see if sched_yield exists
15266set try -DSCHED_YIELD
15267if eval $compile; then
15268 val="$define"
15269 sched_yield='sched_yield()'
15270else
15271 val="$undef"
15272fi
15273case "$usethreads" in
15274$define)
15275 case "$val" in
15276 $define) echo 'sched_yield() found.' >&4 ;;
15277 *) echo 'sched_yield() NOT found.' >&4 ;;
15278 esac
15279esac
10bc17b6
JH
15280set d_sched_yield
15281eval $setvar
b4eb6b3d 15282
10bc17b6
JH
15283: see if pthread_yield exists
15284set try -DPTHREAD_YIELD
15285if eval $compile; then
15286 val="$define"
15287 case "$sched_yield" in
15288 '') sched_yield='pthread_yield()' ;;
15289 esac
15290else
15291 set try -DPTHREAD_YIELD_NULL
15292 if eval $compile; then
15293 val="$define"
15294 case "$sched_yield" in
15295 '') sched_yield='pthread_yield(NULL)' ;;
15296 esac
15297 else
15298 val="$undef"
15299 fi
15300fi
15301case "$usethreads" in
15302$define)
15303 case "$val" in
15304 $define) echo 'pthread_yield() found.' >&4 ;;
15305 *) echo 'pthread_yield() NOT found.' >&4 ;;
15306 esac
15307 ;;
15308esac
15309set d_pthread_yield
15310eval $setvar
b4eb6b3d 15311
10bc17b6
JH
15312case "$sched_yield" in
15313'') sched_yield=undef ;;
15314esac
b4eb6b3d 15315
10bc17b6
JH
15316$rm -f try try.*
15317
15318: see if random_r exists
15319set random_r d_random_r
15320eval $inlibc
15321case "$d_random_r" in
15322"$define")
15323 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15324 case "$d_random_r_proto:$usethreads" in
15325 ":define") d_random_r_proto=define
a48ec845
JH
15326 set d_random_r_proto random_r $hdrs
15327 eval $hasproto ;;
15328 *) ;;
15329 esac
15330 case "$d_random_r_proto" in
15331 define)
10bc17b6
JH
15332 case "$random_r_proto" in
15333 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15334 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15335 esac
15336 case "$random_r_proto" in
15337 ''|0) try='int random_r(long*, struct random_data*);'
15338 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15339 esac
15340 case "$random_r_proto" in
15341 ''|0) try='int random_r(struct random_data*, int32_t*);'
15342 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15343 esac
15344 case "$random_r_proto" in
90e831dc 15345 ''|0) d_random_r=undef
10bc17b6 15346 random_r_proto=0
a48ec845 15347 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15348 * ) case "$random_r_proto" in
15349 REENTRANT_PROTO*) ;;
15350 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15351 esac
15352 echo "Prototype: $try" ;;
15353 esac
b4eb6b3d 15354 ;;
c18e646a
JH
15355 *) case "$usethreads" in
15356 define) echo "random_r has no prototype, not using it." >&4 ;;
15357 esac
90e831dc
SB
15358 d_random_r=undef
15359 random_r_proto=0
c18e646a 15360 ;;
a48ec845
JH
15361 esac
15362 ;;
10bc17b6 15363*) random_r_proto=0
b4eb6b3d
JH
15364 ;;
15365esac
15366
15367: see if readdir and friends exist
15368set readdir d_readdir
15369eval $inlibc
15370set seekdir d_seekdir
15371eval $inlibc
15372set telldir d_telldir
15373eval $inlibc
15374set rewinddir d_rewinddir
15375eval $inlibc
15376
10bc17b6
JH
15377: see if readdir64_r exists
15378set readdir64_r d_readdir64_r
15379eval $inlibc
15380case "$d_readdir64_r" in
15381"$define")
15382 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15383 case "$d_readdir64_r_proto:$usethreads" in
15384 ":define") d_readdir64_r_proto=define
a48ec845
JH
15385 set d_readdir64_r_proto readdir64_r $hdrs
15386 eval $hasproto ;;
15387 *) ;;
15388 esac
15389 case "$d_readdir64_r_proto" in
15390 define)
10bc17b6
JH
15391 case "$readdir64_r_proto" in
15392 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15393 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15394 esac
15395 case "$readdir64_r_proto" in
15396 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15397 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15398 esac
15399 case "$readdir64_r_proto" in
90e831dc 15400 ''|0) d_readdir64_r=undef
10bc17b6 15401 readdir64_r_proto=0
a48ec845 15402 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15403 * ) case "$readdir64_r_proto" in
15404 REENTRANT_PROTO*) ;;
15405 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15406 esac
15407 echo "Prototype: $try" ;;
15408 esac
15409 ;;
c18e646a
JH
15410 *) case "$usethreads" in
15411 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15412 esac
90e831dc
SB
15413 d_readdir64_r=undef
15414 readdir64_r_proto=0
c18e646a 15415 ;;
a48ec845
JH
15416 esac
15417 ;;
10bc17b6
JH
15418*) readdir64_r_proto=0
15419 ;;
15420esac
15421
15422: see if readdir_r exists
15423set readdir_r d_readdir_r
15424eval $inlibc
15425case "$d_readdir_r" in
15426"$define")
15427 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15428 case "$d_readdir_r_proto:$usethreads" in
15429 ":define") d_readdir_r_proto=define
a48ec845
JH
15430 set d_readdir_r_proto readdir_r $hdrs
15431 eval $hasproto ;;
15432 *) ;;
15433 esac
15434 case "$d_readdir_r_proto" in
15435 define)
10bc17b6
JH
15436 case "$readdir_r_proto" in
15437 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15438 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15439 esac
15440 case "$readdir_r_proto" in
15441 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15442 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15443 esac
15444 case "$readdir_r_proto" in
90e831dc 15445 ''|0) d_readdir_r=undef
10bc17b6 15446 readdir_r_proto=0
a48ec845 15447 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15448 * ) case "$readdir_r_proto" in
15449 REENTRANT_PROTO*) ;;
15450 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15451 esac
15452 echo "Prototype: $try" ;;
15453 esac
15454 ;;
c18e646a
JH
15455 *) case "$usethreads" in
15456 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15457 esac
90e831dc
SB
15458 d_readdir_r=undef
15459 readdir_r_proto=0
c18e646a 15460 ;;
a48ec845
JH
15461 esac
15462 ;;
10bc17b6
JH
15463*) readdir_r_proto=0
15464 ;;
15465esac
15466
4e0554ec
JH
15467: see if readv exists
15468set readv d_readv
15469eval $inlibc
15470
15471: see if recvmsg exists
15472set recvmsg d_recvmsg
15473eval $inlibc
15474
b4eb6b3d
JH
15475: see if rename exists
15476set rename d_rename
15477eval $inlibc
15478
15479: see if rmdir exists
15480set rmdir d_rmdir
15481eval $inlibc
15482
15483: see if memory.h is available.
15484val=''
15485set memory.h val
15486eval $inhdr
15487
15488: See if it conflicts with string.h
15489case "$val" in
15490$define)
15491 case "$strings" in
15492 '') ;;
15493 *)
15494 $cppstdin $cppflags $cppminus < $strings > mem.h
15495 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15496 echo " "
15497 echo "We won't be including <memory.h>."
15498 val="$undef"
15499 fi
15500 $rm -f mem.h
15501 ;;
15502 esac
15503esac
15504set i_memory
15505eval $setvar
15506
15507: can bcopy handle overlapping blocks?
b6cc3bc4 15508echo " "
b4eb6b3d 15509val="$undef"
b6cc3bc4
AD
15510case "$d_memmove" in
15511"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15512*) case "$d_bcopy" in
15513 "$define")
15514 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15515 $cat >try.c <<EOCP
b4eb6b3d
JH
15516#$i_memory I_MEMORY
15517#$i_stdlib I_STDLIB
15518#$i_string I_STRING
15519#$i_unistd I_UNISTD
15520EOCP
15521 $cat >>try.c <<'EOCP'
15522#include <stdio.h>
15523#ifdef I_MEMORY
15524# include <memory.h>
15525#endif
15526#ifdef I_STDLIB
15527# include <stdlib.h>
15528#endif
15529#ifdef I_STRING
15530# include <string.h>
15531#else
15532# include <strings.h>
15533#endif
15534#ifdef I_UNISTD
15535# include <unistd.h> /* Needed for NetBSD */
15536#endif
15537int main()
15538{
15539char buf[128], abc[128];
15540char *b;
15541int len;
15542int off;
15543int align;
15544
b6cc3bc4
AD
15545/* Copy "abcde..." string to char abc[] so that gcc doesn't
15546 try to store the string in read-only memory. */
b4eb6b3d
JH
15547bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15548
15549for (align = 7; align >= 0; align--) {
15550 for (len = 36; len; len--) {
15551 b = buf+align;
15552 bcopy(abc, b, len);
15553 for (off = 1; off <= len; off++) {
15554 bcopy(b, b+off, len);
15555 bcopy(b+off, b, len);
15556 if (bcmp(b, abc, len))
15557 exit(1);
15558 }
15559 }
15560}
15561exit(0);
15562}
15563EOCP
b6cc3bc4
AD
15564 set try
15565 if eval $compile_ok; then
15566 if ./try 2>/dev/null; then
15567 echo "Yes, it can."
15568 val="$define"
15569 else
15570 echo "It can't, sorry."
15571 fi
b4eb6b3d 15572 else
b6cc3bc4 15573 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15574 fi
b6cc3bc4
AD
15575 ;;
15576 esac
15577 $rm -f try.* try core
b4eb6b3d
JH
15578 ;;
15579esac
b4eb6b3d
JH
15580set d_safebcpy
15581eval $setvar
15582
15583: can memcpy handle overlapping blocks?
b6cc3bc4 15584echo " "
b4eb6b3d 15585val="$undef"
b6cc3bc4
AD
15586case "$d_memmove" in
15587"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15588*) case "$d_memcpy" in
15589 "$define")
15590 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15591 $cat >try.c <<EOCP
b4eb6b3d
JH
15592#$i_memory I_MEMORY
15593#$i_stdlib I_STDLIB
15594#$i_string I_STRING
15595#$i_unistd I_UNISTD
15596EOCP
15597 $cat >>try.c <<'EOCP'
15598#include <stdio.h>
15599#ifdef I_MEMORY
15600# include <memory.h>
15601#endif
15602#ifdef I_STDLIB
15603# include <stdlib.h>
15604#endif
15605#ifdef I_STRING
15606# include <string.h>
15607#else
15608# include <strings.h>
15609#endif
15610#ifdef I_UNISTD
15611# include <unistd.h> /* Needed for NetBSD */
15612#endif
15613int main()
15614{
15615char buf[128], abc[128];
15616char *b;
15617int len;
15618int off;
15619int align;
15620
15621/* Copy "abcde..." string to char abc[] so that gcc doesn't
15622 try to store the string in read-only memory. */
15623memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15624
15625for (align = 7; align >= 0; align--) {
15626 for (len = 36; len; len--) {
15627 b = buf+align;
15628 memcpy(b, abc, len);
15629 for (off = 1; off <= len; off++) {
15630 memcpy(b+off, b, len);
15631 memcpy(b, b+off, len);
15632 if (memcmp(b, abc, len))
15633 exit(1);
15634 }
15635 }
15636}
15637exit(0);
15638}
15639EOCP
b6cc3bc4
AD
15640 set try
15641 if eval $compile_ok; then
15642 if ./try 2>/dev/null; then
15643 echo "Yes, it can."
15644 val="$define"
15645 else
15646 echo "It can't, sorry."
15647 fi
b4eb6b3d 15648 else
b6cc3bc4 15649 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15650 fi
b6cc3bc4
AD
15651 ;;
15652 esac
15653 $rm -f try.* try core
b4eb6b3d
JH
15654 ;;
15655esac
b4eb6b3d
JH
15656set d_safemcpy
15657eval $setvar
15658
15659: can memcmp be trusted to compare relative magnitude?
15660val="$undef"
15661case "$d_memcmp" in
15662"$define")
15663 echo " "
15664 echo "Checking if your memcmp() can compare relative magnitude..." >&4
15665 $cat >try.c <<EOCP
15666#$i_memory I_MEMORY
15667#$i_stdlib I_STDLIB
15668#$i_string I_STRING
15669#$i_unistd I_UNISTD
15670EOCP
15671 $cat >>try.c <<'EOCP'
15672#include <stdio.h>
15673#ifdef I_MEMORY
15674# include <memory.h>
15675#endif
15676#ifdef I_STDLIB
36adc09b 15677# include <stdlib.h>
b4eb6b3d
JH
15678#endif
15679#ifdef I_STRING
15680# include <string.h>
15681#else
15682# include <strings.h>
15683#endif
15684#ifdef I_UNISTD
15685# include <unistd.h> /* Needed for NetBSD */
15686#endif
15687int main()
15688{
15689char a = -1;
15690char b = 0;
15691if ((a < b) && memcmp(&a, &b, 1) < 0)
15692 exit(1);
15693exit(0);
15694}
15695EOCP
15696 set try
15697 if eval $compile_ok; then
5440bc8e 15698 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
15699 echo "Yes, it can."
15700 val="$define"
15701 else
15702 echo "No, it can't (it uses signed chars)."
15703 fi
15704 else
15705 echo "(I can't compile the test program, so we'll assume not...)"
15706 fi
15707 ;;
15708esac
15709$rm -f try.* try core
15710set d_sanemcmp
15711eval $setvar
15712
ef9f17be
JH
15713: see if prototype for sbrk is available
15714echo " "
15715set d_sbrkproto sbrk $i_unistd unistd.h
15716eval $hasproto
15717
b4eb6b3d
JH
15718: see if select exists
15719set select d_select
15720eval $inlibc
15721
15722: see if semctl exists
15723set semctl d_semctl
15724eval $inlibc
15725
15726: see if semget exists
15727set semget d_semget
15728eval $inlibc
15729
15730: see if semop exists
15731set semop d_semop
15732eval $inlibc
15733
15734: see how much of the 'sem*(2)' library is present.
15735h_sem=true
15736echo " "
15737case "$d_semctl$d_semget$d_semop" in
15738*"$undef"*) h_sem=false;;
15739esac
15740case "$osname" in
15741freebsd)
15742 case "`ipcs 2>&1`" in
15743 "SVID messages"*"not configured"*)
15744 echo "Your $osname does not have the sem*(2) configured." >&4
15745 h_sem=false
15746 val="$undef"
15747 set semctl d_semctl
15748 eval $setvar
15749 set semget d_semget
15750 eval $setvar
15751 set semop d_semop
15752 eval $setvar
15753 ;;
15754 esac
15755 ;;
15756esac
15757: we could also check for sys/ipc.h ...
15758if $h_sem && $test `./findhdr sys/sem.h`; then
15759 echo "You have the full sem*(2) library." >&4
15760 val="$define"
15761else
15762 echo "You don't have the full sem*(2) library." >&4
15763 val="$undef"
15764fi
15765set d_sem
15766eval $setvar
15767
15768: see whether sys/sem.h defines union semun
15769echo " "
15770$cat > try.c <<'END'
15771#include <sys/types.h>
15772#include <sys/ipc.h>
15773#include <sys/sem.h>
15774int main () { union semun semun; semun.buf = 0; }
15775END
15776set try
15777if eval $compile; then
15778 echo "You have union semun in <sys/sem.h>." >&4
15779 val="$define"
15780else
15781 echo "You do not have union semun in <sys/sem.h>." >&4
15782 val="$undef"
15783fi
2fad75a1 15784$rm -f try try.c
b4eb6b3d
JH
15785set d_union_semun
15786eval $setvar
15787
15788: see how to do semctl IPC_STAT
15789case "$d_sem" in
15790$define)
b4eb6b3d
JH
15791 echo " "
15792 $cat > try.h <<END
15793#ifndef S_IRUSR
15794# ifdef S_IREAD
15795# define S_IRUSR S_IREAD
15796# define S_IWUSR S_IWRITE
15797# define S_IXUSR S_IEXEC
15798# else
15799# define S_IRUSR 0400
15800# define S_IWUSR 0200
15801# define S_IXUSR 0100
15802# endif
15803# define S_IRGRP (S_IRUSR>>3)
15804# define S_IWGRP (S_IWUSR>>3)
15805# define S_IXGRP (S_IXUSR>>3)
15806# define S_IROTH (S_IRUSR>>6)
15807# define S_IWOTH (S_IWUSR>>6)
15808# define S_IXOTH (S_IXUSR>>6)
15809#endif
15810#ifndef S_IRWXU
15811# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15812# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15813# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15814#endif
15815END
2fad75a1 15816 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
15817 case "$d_semctl_semun" in
15818 '')
35918792 15819 val="$undef"
2fad75a1 15820 $cat > try.c <<END
b4eb6b3d
JH
15821#include <sys/types.h>
15822#include <sys/ipc.h>
15823#include <sys/sem.h>
15824#include <sys/stat.h>
15825#include <stdio.h>
15826#include <errno.h>
15827#include "try.h"
15828#ifndef errno
15829extern int errno;
15830#endif
15831#$d_union_semun HAS_UNION_SEMUN
15832int main() {
15833 union semun
15834#ifndef HAS_UNION_SEMUN
15835 {
15836 int val;
15837 struct semid_ds *buf;
15838 unsigned short *array;
15839 }
15840#endif
15841 arg;
15842 int sem, st;
15843
15844#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15845 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15846 if (sem > -1) {
15847 struct semid_ds argbuf;
15848 arg.buf = &argbuf;
15849# ifdef IPC_STAT
15850 st = semctl(sem, 0, IPC_STAT, arg);
15851 if (st == 0)
15852 printf("semun\n");
15853 else
15854# endif /* IPC_STAT */
15855 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15856# ifdef IPC_RMID
15857 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 15858# endif /* IPC_RMID */
b4eb6b3d
JH
15859 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15860 } else
15861#endif /* IPC_PRIVATE && ... */
15862 printf("semget failed: errno = %d\n", errno);
15863 return 0;
15864}
15865END
2fad75a1
JH
15866 set try
15867 if eval $compile; then
15868 xxx=`$run ./try`
15869 case "$xxx" in
15870 semun) val="$define" ;;
15871 esac
15872 fi
15873 $rm -f try try.c
35918792
YST
15874 set d_semctl_semun
15875 eval $setvar
2fad75a1
JH
15876 ;;
15877 esac
b4eb6b3d
JH
15878 case "$d_semctl_semun" in
15879 $define)
15880 echo "You can use union semun for semctl IPC_STAT." >&4
15881 also='also'
15882 ;;
15883 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
15884 also=''
15885 ;;
15886 esac
15887
15888 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
15889 case "$d_semctl_semid_ds" in
15890 '')
35918792 15891 val="$undef"
2fad75a1 15892 $cat > try.c <<'END'
b4eb6b3d
JH
15893#include <sys/types.h>
15894#include <sys/ipc.h>
15895#include <sys/sem.h>
15896#include <sys/stat.h>
15897#include "try.h"
15898#include <stdio.h>
15899#include <errno.h>
15900#ifndef errno
15901extern int errno;
15902#endif
15903int main() {
15904 struct semid_ds arg;
15905 int sem, st;
15906
15907#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15908 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15909 if (sem > -1) {
15910# ifdef IPC_STAT
15911 st = semctl(sem, 0, IPC_STAT, &arg);
15912 if (st == 0)
15913 printf("semid_ds\n");
15914 else
15915# endif /* IPC_STAT */
15916 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15917# ifdef IPC_RMID
15918 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15919# endif /* IPC_RMID */
15920 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15921 } else
15922#endif /* IPC_PRIVATE && ... */
15923 printf("semget failed: errno = %d\n", errno);
15924
15925 return 0;
15926}
15927END
2fad75a1
JH
15928 set try
15929 if eval $compile; then
15930 xxx=`$run ./try`
15931 case "$xxx" in
15932 semid_ds) val="$define" ;;
15933 esac
15934 fi
15935 $rm -f try try.c
35918792
YST
15936 set d_semctl_semid_ds
15937 eval $setvar
2fad75a1
JH
15938 ;;
15939 esac
b4eb6b3d
JH
15940 case "$d_semctl_semid_ds" in
15941 $define)
15942 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15943 ;;
15944 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15945 ;;
15946 esac
15947 $rm -f try.h
15948 ;;
15949*) val="$undef"
15950
15951 # We do not have the full sem*(2) library, so assume we can not
15952 # use either.
15953
15954 set d_semctl_semun
15955 eval $setvar
15956
15957 set d_semctl_semid_ds
15958 eval $setvar
15959 ;;
15960esac
15961
4e0554ec
JH
15962: see if sendmsg exists
15963set sendmsg d_sendmsg
15964eval $inlibc
15965
b4eb6b3d
JH
15966: see if setegid exists
15967set setegid d_setegid
15968eval $inlibc
15969
15970: see if seteuid exists
15971set seteuid d_seteuid
15972eval $inlibc
15973
15974: see if setgrent exists
15975set setgrent d_setgrent
15976eval $inlibc
15977
10bc17b6
JH
15978: see if setgrent_r exists
15979set setgrent_r d_setgrent_r
15980eval $inlibc
15981case "$d_setgrent_r" in
15982"$define")
15983 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
15984 case "$d_setgrent_r_proto:$usethreads" in
15985 ":define") d_setgrent_r_proto=define
a48ec845
JH
15986 set d_setgrent_r_proto setgrent_r $hdrs
15987 eval $hasproto ;;
15988 *) ;;
15989 esac
15990 case "$d_setgrent_r_proto" in
15991 define)
10bc17b6
JH
15992 case "$setgrent_r_proto" in
15993 ''|0) try='int setgrent_r(FILE**);'
15994 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15995 esac
15996 case "$setgrent_r_proto" in
15997 ''|0) try='void setgrent_r(FILE**);'
15998 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15999 esac
16000 case "$setgrent_r_proto" in
90e831dc 16001 ''|0) d_setgrent_r=undef
10bc17b6 16002 setgrent_r_proto=0
a48ec845 16003 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16004 * ) case "$setgrent_r_proto" in
16005 REENTRANT_PROTO*) ;;
16006 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16007 esac
16008 echo "Prototype: $try" ;;
16009 esac
16010 ;;
c18e646a
JH
16011 *) case "$usethreads" in
16012 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16013 esac
90e831dc
SB
16014 d_setgrent_r=undef
16015 setgrent_r_proto=0
c18e646a 16016 ;;
a48ec845
JH
16017 esac
16018 ;;
10bc17b6
JH
16019*) setgrent_r_proto=0
16020 ;;
16021esac
16022
b4eb6b3d
JH
16023: see if sethostent exists
16024set sethostent d_sethent
16025eval $inlibc
16026
10bc17b6
JH
16027: see if sethostent_r exists
16028set sethostent_r d_sethostent_r
16029eval $inlibc
16030case "$d_sethostent_r" in
16031"$define")
16032 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16033 case "$d_sethostent_r_proto:$usethreads" in
16034 ":define") d_sethostent_r_proto=define
a48ec845
JH
16035 set d_sethostent_r_proto sethostent_r $hdrs
16036 eval $hasproto ;;
16037 *) ;;
16038 esac
16039 case "$d_sethostent_r_proto" in
16040 define)
10bc17b6
JH
16041 case "$sethostent_r_proto" in
16042 ''|0) try='int sethostent_r(int, struct hostent_data*);'
16043 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16044 esac
16045 case "$sethostent_r_proto" in
16046 ''|0) try='void sethostent_r(int, struct hostent_data*);'
16047 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16048 esac
16049 case "$sethostent_r_proto" in
90e831dc 16050 ''|0) d_sethostent_r=undef
10bc17b6 16051 sethostent_r_proto=0
a48ec845 16052 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16053 * ) case "$sethostent_r_proto" in
16054 REENTRANT_PROTO*) ;;
16055 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16056 esac
16057 echo "Prototype: $try" ;;
16058 esac
16059 ;;
c18e646a
JH
16060 *) case "$usethreads" in
16061 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16062 esac
90e831dc
SB
16063 d_sethostent_r=undef
16064 sethostent_r_proto=0
c18e646a 16065 ;;
a48ec845
JH
16066 esac
16067 ;;
10bc17b6
JH
16068*) sethostent_r_proto=0
16069 ;;
16070esac
16071
4e0554ec
JH
16072: see if setitimer exists
16073set setitimer d_setitimer
16074eval $inlibc
16075
b4eb6b3d
JH
16076: see if setlinebuf exists
16077set setlinebuf d_setlinebuf
16078eval $inlibc
16079
16080: see if setlocale exists
16081set setlocale d_setlocale
16082eval $inlibc
16083
10bc17b6
JH
16084: see if locale.h is available
16085set locale.h i_locale
16086eval $inhdr
16087
16088: see if setlocale_r exists
16089set setlocale_r d_setlocale_r
16090eval $inlibc
16091case "$d_setlocale_r" in
16092"$define")
16093 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16094 case "$d_setlocale_r_proto:$usethreads" in
16095 ":define") d_setlocale_r_proto=define
a48ec845
JH
16096 set d_setlocale_r_proto setlocale_r $hdrs
16097 eval $hasproto ;;
16098 *) ;;
16099 esac
16100 case "$d_setlocale_r_proto" in
16101 define)
10bc17b6
JH
16102 case "$setlocale_r_proto" in
16103 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16104 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16105 esac
16106 case "$setlocale_r_proto" in
90e831dc 16107 ''|0) d_setlocale_r=undef
10bc17b6 16108 setlocale_r_proto=0
a48ec845 16109 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16110 * ) case "$setlocale_r_proto" in
16111 REENTRANT_PROTO*) ;;
16112 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16113 esac
16114 echo "Prototype: $try" ;;
16115 esac
16116 ;;
c18e646a
JH
16117 *) case "$usethreads" in
16118 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16119 esac
90e831dc
SB
16120 d_setlocale_r=undef
16121 setlocale_r_proto=0
c18e646a 16122 ;;
a48ec845
JH
16123 esac
16124 ;;
10bc17b6
JH
16125*) setlocale_r_proto=0
16126 ;;
16127esac
16128
b4eb6b3d
JH
16129: see if setnetent exists
16130set setnetent d_setnent
16131eval $inlibc
16132
10bc17b6
JH
16133: see if setnetent_r exists
16134set setnetent_r d_setnetent_r
16135eval $inlibc
16136case "$d_setnetent_r" in
16137"$define")
16138 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16139 case "$d_setnetent_r_proto:$usethreads" in
16140 ":define") d_setnetent_r_proto=define
a48ec845
JH
16141 set d_setnetent_r_proto setnetent_r $hdrs
16142 eval $hasproto ;;
16143 *) ;;
16144 esac
16145 case "$d_setnetent_r_proto" in
16146 define)
10bc17b6
JH
16147 case "$setnetent_r_proto" in
16148 ''|0) try='int setnetent_r(int, struct netent_data*);'
16149 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16150 esac
16151 case "$setnetent_r_proto" in
16152 ''|0) try='void setnetent_r(int, struct netent_data*);'
16153 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16154 esac
16155 case "$setnetent_r_proto" in
90e831dc 16156 ''|0) d_setnetent_r=undef
10bc17b6 16157 setnetent_r_proto=0
a48ec845 16158 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16159 * ) case "$setnetent_r_proto" in
16160 REENTRANT_PROTO*) ;;
16161 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16162 esac
16163 echo "Prototype: $try" ;;
16164 esac
16165 ;;
c18e646a
JH
16166 *) case "$usethreads" in
16167 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16168 esac
90e831dc
SB
16169 d_setnetent_r=undef
16170 setnetent_r_proto=0
c18e646a 16171 ;;
a48ec845
JH
16172 esac
16173 ;;
10bc17b6
JH
16174*) setnetent_r_proto=0
16175 ;;
16176esac
16177
b4eb6b3d
JH
16178: see if setprotoent exists
16179set setprotoent d_setpent
16180eval $inlibc
16181
16182: see if setpgid exists
16183set setpgid d_setpgid
16184eval $inlibc
16185
16186: see if setpgrp2 exists
16187set setpgrp2 d_setpgrp2
16188eval $inlibc
16189
16190: see if setpriority exists
16191set setpriority d_setprior
16192eval $inlibc
16193
16194: see if setproctitle exists
16195set setproctitle d_setproctitle
16196eval $inlibc
16197
10bc17b6
JH
16198: see if setprotoent_r exists
16199set setprotoent_r d_setprotoent_r
16200eval $inlibc
16201case "$d_setprotoent_r" in
16202"$define")
16203 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16204 case "$d_setprotoent_r_proto:$usethreads" in
16205 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16206 set d_setprotoent_r_proto setprotoent_r $hdrs
16207 eval $hasproto ;;
16208 *) ;;
16209 esac
16210 case "$d_setprotoent_r_proto" in
16211 define)
10bc17b6
JH
16212 case "$setprotoent_r_proto" in
16213 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16214 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16215 esac
16216 case "$setprotoent_r_proto" in
16217 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16218 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16219 esac
16220 case "$setprotoent_r_proto" in
90e831dc 16221 ''|0) d_setprotoent_r=undef
10bc17b6 16222 setprotoent_r_proto=0
a48ec845 16223 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16224 * ) case "$setprotoent_r_proto" in
16225 REENTRANT_PROTO*) ;;
16226 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16227 esac
16228 echo "Prototype: $try" ;;
16229 esac
16230 ;;
c18e646a
JH
16231 *) case "$usethreads" in
16232 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16233 esac
90e831dc
SB
16234 d_setprotoent_r=undef
16235 setprotoent_r_proto=0
c18e646a 16236 ;;
a48ec845
JH
16237 esac
16238 ;;
10bc17b6
JH
16239*) setprotoent_r_proto=0
16240 ;;
16241esac
16242
b4eb6b3d
JH
16243: see if setpwent exists
16244set setpwent d_setpwent
16245eval $inlibc
16246
10bc17b6
JH
16247: see if setpwent_r exists
16248set setpwent_r d_setpwent_r
16249eval $inlibc
16250case "$d_setpwent_r" in
16251"$define")
16252 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16253 case "$d_setpwent_r_proto:$usethreads" in
16254 ":define") d_setpwent_r_proto=define
a48ec845
JH
16255 set d_setpwent_r_proto setpwent_r $hdrs
16256 eval $hasproto ;;
16257 *) ;;
16258 esac
16259 case "$d_setpwent_r_proto" in
16260 define)
10bc17b6
JH
16261 case "$setpwent_r_proto" in
16262 ''|0) try='int setpwent_r(FILE**);'
16263 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16264 esac
16265 case "$setpwent_r_proto" in
16266 ''|0) try='void setpwent_r(FILE**);'
16267 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16268 esac
16269 case "$setpwent_r_proto" in
90e831dc 16270 ''|0) d_setpwent_r=undef
10bc17b6 16271 setpwent_r_proto=0
a48ec845 16272 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16273 * ) case "$setpwent_r_proto" in
16274 REENTRANT_PROTO*) ;;
16275 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16276 esac
16277 echo "Prototype: $try" ;;
16278 esac
16279 ;;
c18e646a
JH
16280 *) case "$usethreads" in
16281 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16282 esac
90e831dc
SB
16283 d_setpwent_r=undef
16284 setpwent_r_proto=0
c18e646a 16285 ;;
a48ec845
JH
16286 esac
16287 ;;
10bc17b6
JH
16288*) setpwent_r_proto=0
16289 ;;
16290esac
16291
b4eb6b3d
JH
16292: see if setregid exists
16293set setregid d_setregid
16294eval $inlibc
16295set setresgid d_setresgid
16296eval $inlibc
16297
16298: see if setreuid exists
16299set setreuid d_setreuid
16300eval $inlibc
16301set setresuid d_setresuid
16302eval $inlibc
16303
16304: see if setrgid exists
16305set setrgid d_setrgid
16306eval $inlibc
16307
16308: see if setruid exists
16309set setruid d_setruid
16310eval $inlibc
16311
16312: see if setservent exists
16313set setservent d_setsent
16314eval $inlibc
16315
10bc17b6
JH
16316: see if setservent_r exists
16317set setservent_r d_setservent_r
16318eval $inlibc
16319case "$d_setservent_r" in
16320"$define")
16321 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16322 case "$d_setservent_r_proto:$usethreads" in
16323 ":define") d_setservent_r_proto=define
a48ec845
JH
16324 set d_setservent_r_proto setservent_r $hdrs
16325 eval $hasproto ;;
16326 *) ;;
16327 esac
16328 case "$d_setservent_r_proto" in
16329 define)
10bc17b6
JH
16330 case "$setservent_r_proto" in
16331 ''|0) try='int setservent_r(int, struct servent_data*);'
16332 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16333 esac
16334 case "$setservent_r_proto" in
16335 ''|0) try='void setservent_r(int, struct servent_data*);'
16336 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16337 esac
16338 case "$setservent_r_proto" in
90e831dc 16339 ''|0) d_setservent_r=undef
10bc17b6 16340 setservent_r_proto=0
a48ec845 16341 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16342 * ) case "$setservent_r_proto" in
16343 REENTRANT_PROTO*) ;;
16344 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16345 esac
16346 echo "Prototype: $try" ;;
16347 esac
16348 ;;
c18e646a
JH
16349 *) case "$usethreads" in
16350 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16351 esac
90e831dc
SB
16352 d_setservent_r=undef
16353 setservent_r_proto=0
c18e646a 16354 ;;
a48ec845
JH
16355 esac
16356 ;;
10bc17b6
JH
16357*) setservent_r_proto=0
16358 ;;
16359esac
16360
b4eb6b3d
JH
16361: see if setsid exists
16362set setsid d_setsid
16363eval $inlibc
16364
16365: see if setvbuf exists
16366set setvbuf d_setvbuf
16367eval $inlibc
16368
16369: see if sfio.h is available
16370set sfio.h i_sfio
16371eval $inhdr
16372
16373
16374: see if sfio library is available
16375case "$i_sfio" in
16376$define)
16377 val=''
16378 set sfreserve val
16379 eval $inlibc
16380 ;;
16381*)
16382 val="$undef"
16383 ;;
16384esac
16385: Ok, but do we want to use it.
16386case "$val" in
16387$define)
16388 case "$usesfio" in
16389 true|$define|[yY]*) dflt='y';;
16390 *) dflt='n';;
16391 esac
16392 echo "$package can use the sfio library, but it is experimental."
16393 case "$useperlio" in
16394 "$undef")
16395 echo "For sfio also the PerlIO abstraction layer is needed."
16396 echo "Earlier you said you wouldn't want that."
16397 ;;
16398 esac
16399 rp="You seem to have sfio available, do you want to try using it?"
16400 . ./myread
16401 case "$ans" in
16402 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16403 useperlio="$define"
16404 val="$define"
16405 ;;
16406 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16407 val="$undef"
b4eb6b3d
JH
16408 ;;
16409 esac
16410 ;;
16411*) case "$usesfio" in
16412 true|$define|[yY]*)
16413 echo "Sorry, cannot find sfio on this machine." >&4
16414 echo "Ignoring your setting of usesfio=$usesfio." >&4
16415 val="$undef"
16416 ;;
16417 esac
16418 ;;
16419esac
16420set d_sfio
16421eval $setvar
16422case "$d_sfio" in
16423$define) usesfio='true';;
16424*) usesfio='false';;
16425esac
3659ebf1
JH
16426case "$d_sfio" in
16427$define) ;;
16428*) : Remove sfio from list of libraries to use
7483f793
JH
16429 case "$libs" in
16430 *-lsfio*)
16431 echo "Removing unneeded -lsfio from library list" >&4
16432 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16433 shift
16434 libs="$*"
16435 echo "libs = $libs" >&4
16436 ;;
16437 esac
3659ebf1
JH
16438;;
16439esac
16440
b4eb6b3d
JH
16441
16442: see if shmctl exists
16443set shmctl d_shmctl
16444eval $inlibc
16445
16446: see if shmget exists
16447set shmget d_shmget
16448eval $inlibc
16449
16450: see if shmat exists
16451set shmat d_shmat
16452eval $inlibc
16453: see what shmat returns
16454case "$d_shmat" in
16455"$define")
16456 $cat >shmat.c <<'END'
16457#include <sys/shm.h>
16458void *shmat();
16459END
16460 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16461 shmattype='void *'
16462 else
16463 shmattype='char *'
16464 fi
16465 echo "and it returns ($shmattype)." >&4
16466 : see if a prototype for shmat is available
16467 xxx=`./findhdr sys/shm.h`
16468 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16469 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16470 val="$define"
16471 else
16472 val="$undef"
16473 fi
16474 $rm -f shmat.[co]
16475 ;;
16476*)
16477 val="$undef"
16478 ;;
16479esac
16480set d_shmatprototype
16481eval $setvar
16482
16483: see if shmdt exists
16484set shmdt d_shmdt
16485eval $inlibc
16486
16487: see how much of the 'shm*(2)' library is present.
16488h_shm=true
16489echo " "
16490case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16491*"$undef"*) h_shm=false;;
16492esac
16493case "$osname" in
16494freebsd)
16495 case "`ipcs 2>&1`" in
16496 "SVID shared memory"*"not configured"*)
16497 echo "Your $osname does not have the shm*(2) configured." >&4
16498 h_shm=false
16499 val="$undef"
16500 set shmctl d_shmctl
16501 evat $setvar
16502 set shmget d_shmget
16503 evat $setvar
16504 set shmat d_shmat
16505 evat $setvar
16506 set shmdt d_shmdt
16507 evat $setvar
16508 ;;
16509 esac
16510 ;;
16511esac
16512: we could also check for sys/ipc.h ...
16513if $h_shm && $test `./findhdr sys/shm.h`; then
16514 echo "You have the full shm*(2) library." >&4
16515 val="$define"
16516else
16517 echo "You don't have the full shm*(2) library." >&4
16518 val="$undef"
16519fi
16520set d_shm
16521eval $setvar
16522
16523echo " "
16524: see if we have sigaction
16525if set sigaction val -f d_sigaction; eval $csym; $val; then
16526 echo 'sigaction() found.' >&4
073b6de5 16527 $cat > try.c <<EOP
b4eb6b3d
JH
16528#include <stdio.h>
16529#include <sys/types.h>
16530#include <signal.h>
073b6de5
JH
16531#$i_stdlib I_STDLIB
16532#ifdef I_STDLIB
16533#include <stdlib.h>
16534#endif
b4eb6b3d
JH
16535int main()
16536{
16537 struct sigaction act, oact;
16538 act.sa_flags = 0;
16539 oact.sa_handler = 0;
16540 /* so that act and oact are used */
16541 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16542}
16543EOP
16544 set try
16545 if eval $compile_ok; then
16546 val="$define"
16547 else
16548 echo "But you don't seem to have a useable struct sigaction." >&4
16549 val="$undef"
16550 fi
16551else
16552 echo 'sigaction NOT found.' >&4
16553 val="$undef"
16554fi
16555set d_sigaction; eval $setvar
16556$rm -f try try$_o try.c
16557
983dbef6
JH
16558: see if sigprocmask exists
16559set sigprocmask d_sigprocmask
16560eval $inlibc
16561
b4eb6b3d
JH
16562: see if sigsetjmp exists
16563echo " "
16564case "$d_sigsetjmp" in
16565'')
c727eafa 16566 $cat >try.c <<EOP
b4eb6b3d 16567#include <setjmp.h>
d1daaddf
JH
16568#$i_stdlib I_STDLIB
16569#ifdef I_STDLIB
16570#include <stdlib.h>
16571#endif
b4eb6b3d
JH
16572sigjmp_buf env;
16573int set = 1;
16574int main()
16575{
16576 if (sigsetjmp(env,1))
16577 exit(set);
16578 set = 0;
16579 siglongjmp(env, 1);
16580 exit(1);
16581}
16582EOP
16583 set try
16584 if eval $compile; then
5440bc8e 16585 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16586 echo "POSIX sigsetjmp found." >&4
16587 val="$define"
16588 else
16589 $cat >&4 <<EOM
16590Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16591I'll ignore them.
16592EOM
16593 val="$undef"
16594 fi
16595 else
16596 echo "sigsetjmp not found." >&4
16597 val="$undef"
16598 fi
16599 ;;
16600*) val="$d_sigsetjmp"
16601 case "$d_sigsetjmp" in
16602 $define) echo "POSIX sigsetjmp found." >&4;;
16603 $undef) echo "sigsetjmp not found." >&4;;
16604 esac
16605 ;;
16606esac
16607set d_sigsetjmp
16608eval $setvar
16609$rm -f try.c try
16610
4f5da3e9
SP
16611: see if snprintf exists
16612set snprintf d_snprintf
16613eval $inlibc
16614
16615: see if vsnprintf exists
16616set vsnprintf d_vsnprintf
16617eval $inlibc
16618
2478f7a0
MB
16619case "$d_snprintf-$d_vsnprintf" in
16620"$define-$define")
16621 $cat <<EOM
16622Checking whether your snprintf() and vsnprintf() work okay...
16623EOM
16624 $cat >try.c <<'EOCP'
16625/* v?snprintf testing logic courtesy of Russ Allbery.
16626 * According to C99:
16627 * - if the buffer is too short it still must be \0-terminated
16628 * - if the buffer is too short the potentially required length
16629 * must be returned and not -1
16630 * - if the buffer is NULL the potentially required length
16631 * must be returned and not -1 or core dump
16632 */
16633#include <stdio.h>
16634#include <stdarg.h>
16635
16636char buf[2];
16637
16638int test (char *format, ...)
16639{
16640 va_list args;
16641 int count;
16642
16643 va_start (args, format);
16644 count = vsnprintf (buf, sizeof buf, format, args);
16645 va_end (args);
16646 return count;
16647}
16648
16649int main ()
16650{
16651 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16652 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16653}
16654EOCP
16655 set try
16656 if eval $compile; then
16657 `$run ./try`
16658 case "$?" in
16659 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16660 *) cat <<EOM >&4
16661Your snprintf() and snprintf() don't seem to be working okay.
16662EOM
16663 d_snprintf="$undef"
16664 d_vsnprintf="$undef"
16665 ;;
16666 esac
16667 else
16668 echo "(I can't seem to compile the test program--assuming they don't)"
16669 d_snprintf="$undef"
16670 d_vsnprintf="$undef"
16671 fi
16672 $rm -f try.* try core core.try.*
16673 ;;
16674esac
16675
49a78c82
JH
16676: see if sockatmark exists
16677set sockatmark d_sockatmark
16678eval $inlibc
16679
2ef53570
JH
16680: see if prototype for sockatmark is available
16681echo " "
16682set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16683eval $hasproto
16684
b4eb6b3d
JH
16685: see if socks5_init exists
16686set socks5_init d_socks5_init
16687eval $inlibc
16688
360321b3
YST
16689: see if sprintf returns the length of the string in the buffer as per ANSI
16690$echo "Checking whether sprintf returns the length of the string..." >&4
16691$cat <<EOP >try.c
16692#include <stdio.h>
16693#$i_stdlib I_STDLIB
16694#ifdef I_STDLIB
16695#include <stdlib.h>
16696#endif
16697#$i_string I_STRING
16698#ifdef I_STRING
16699# include <string.h>
16700#else
16701# include <strings.h>
16702#endif
16703#$i_math I_MATH
16704#ifdef I_MATH
16705#include <math.h>
16706#endif
16707
16708char buffer[256];
16709
16710int check (size_t expect, int test) {
16711 size_t got = strlen(buffer);
16712 if (expect == got)
16713 return 0;
16714
16715 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16716 test, buffer);
16717 exit (test);
16718}
16719
16720int main(int argc, char **argv) {
16721 int test = 0;
16722
16723 check(sprintf(buffer, ""), ++test);
16724 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16725 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16726
16727 return 0;
16728}
16729EOP
16730set try
16731
16732d_sprintf_returns_strlen="$undef"
16733if eval $compile; then
16734 xxx="`$run ./try`"
16735 case "$?" in
16736 0) cat >&4 <<EOM
16737sprintf returns the length of the string (as ANSI says it should)
16738EOM
16739 d_sprintf_returns_strlen="$define"
16740 ;;
16741 *) cat >&4 <<EOM
16742sprintf does not return the length of the string (how old is this system?)
16743EOM
16744 d_sprintf_returns_strlen="$undef"
16745 ;;
16746 esac
16747fi
16748
16749$rm -f try.* try
16750
10bc17b6
JH
16751: see if srand48_r exists
16752set srand48_r d_srand48_r
16753eval $inlibc
16754case "$d_srand48_r" in
16755"$define")
16756 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16757 case "$d_srand48_r_proto:$usethreads" in
16758 ":define") d_srand48_r_proto=define
a48ec845
JH
16759 set d_srand48_r_proto srand48_r $hdrs
16760 eval $hasproto ;;
16761 *) ;;
16762 esac
16763 case "$d_srand48_r_proto" in
16764 define)
10bc17b6
JH
16765 case "$srand48_r_proto" in
16766 ''|0) try='int srand48_r(long, struct drand48_data*);'
16767 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16768 esac
16769 case "$srand48_r_proto" in
90e831dc 16770 ''|0) d_srand48_r=undef
10bc17b6 16771 srand48_r_proto=0
a48ec845 16772 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16773 * ) case "$srand48_r_proto" in
16774 REENTRANT_PROTO*) ;;
16775 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16776 esac
16777 echo "Prototype: $try" ;;
16778 esac
16779 ;;
c18e646a
JH
16780 *) case "$usethreads" in
16781 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16782 esac
90e831dc
SB
16783 d_srand48_r=undef
16784 srand48_r_proto=0
c18e646a 16785 ;;
a48ec845
JH
16786 esac
16787 ;;
10bc17b6
JH
16788*) srand48_r_proto=0
16789 ;;
16790esac
16791
16792: see if srandom_r exists
16793set srandom_r d_srandom_r
16794eval $inlibc
16795case "$d_srandom_r" in
16796"$define")
16797 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16798 case "$d_srandom_r_proto:$usethreads" in
16799 ":define") d_srandom_r_proto=define
a48ec845
JH
16800 set d_srandom_r_proto srandom_r $hdrs
16801 eval $hasproto ;;
16802 *) ;;
16803 esac
16804 case "$d_srandom_r_proto" in
16805 define)
10bc17b6
JH
16806 case "$srandom_r_proto" in
16807 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16808 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16809 esac
16810 case "$srandom_r_proto" in
90e831dc 16811 ''|0) d_srandom_r=undef
10bc17b6 16812 srandom_r_proto=0
a48ec845 16813 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16814 * ) case "$srandom_r_proto" in
16815 REENTRANT_PROTO*) ;;
16816 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16817 esac
16818 echo "Prototype: $try" ;;
16819 esac
16820 ;;
c18e646a
JH
16821 *) case "$usethreads" in
16822 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16823 esac
90e831dc
SB
16824 d_srandom_r=undef
16825 srandom_r_proto=0
c18e646a 16826 ;;
a48ec845
JH
16827 esac
16828 ;;
10bc17b6
JH
16829*) srandom_r_proto=0
16830 ;;
16831esac
16832
eef837ea
JH
16833: see if prototype for setresgid is available
16834echo " "
16835set d_sresgproto setresgid $i_unistd unistd.h
16836eval $hasproto
16837
640374d0
JH
16838: see if prototype for setresuid is available
16839echo " "
16840set d_sresuproto setresuid $i_unistd unistd.h
16841eval $hasproto
16842
b4eb6b3d
JH
16843: see if sys/stat.h is available
16844set sys/stat.h i_sysstat
16845eval $inhdr
16846
16847
16848: see if stat knows about block sizes
16849echo " "
16850echo "Checking to see if your struct stat has st_blocks field..." >&4
16851set d_statblks stat st_blocks $i_sysstat sys/stat.h
16852eval $hasfield
16853
16854
16855: see if this is a sys/vfs.h system
16856set sys/vfs.h i_sysvfs
16857eval $inhdr
16858
16859
16860: see if this is a sys/statfs.h system
16861set sys/statfs.h i_sysstatfs
16862eval $inhdr
16863
16864
16865echo " "
16866echo "Checking to see if your system supports struct statfs..." >&4
16867set 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
16868eval $hasstruct
16869case "$d_statfs_s" in
16870"$define") echo "Yes, it does." ;;
16871*) echo "No, it doesn't." ;;
16872esac
16873
16874
16875
16876: see if struct statfs knows about f_flags
16877case "$d_statfs_s" in
16878define)
16879 echo " "
16880 echo "Checking to see if your struct statfs has f_flags field..." >&4
16881 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
16882 eval $hasfield
16883 ;;
16884*) val="$undef"
16885 set d_statfs_f_flags
16886 eval $setvar
16887 ;;
16888esac
16889case "$d_statfs_f_flags" in
16890"$define") echo "Yes, it does." ;;
16891*) echo "No, it doesn't." ;;
16892esac
16893
b4eb6b3d
JH
16894$cat >&4 <<EOM
16895Checking how to access stdio streams by file descriptor number...
16896EOM
16897case "$stdio_stream_array" in
16898'') $cat >try.c <<EOCP
16899#include <stdio.h>
16900int main() {
16901 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16902 printf("yes\n");
16903}
16904EOCP
16905 for s in _iob __iob __sF
16906 do
16907 set try -DSTDIO_STREAM_ARRAY=$s
16908 if eval $compile; then
5440bc8e 16909 case "`$run ./try`" in
b4eb6b3d
JH
16910 yes) stdio_stream_array=$s; break ;;
16911 esac
16912 fi
16913 done
16914 $rm -f try.* try$exe_ext
16915esac
16916case "$stdio_stream_array" in
16917'') $cat >&4 <<EOM
16918I can't figure out how to access stdio streams by file descriptor number.
16919EOM
16920 d_stdio_stream_array="$undef"
16921 ;;
16922*) $cat >&4 <<EOM
16923You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16924EOM
16925 d_stdio_stream_array="$define"
16926 ;;
16927esac
16928
16929: see if strcoll exists
16930set strcoll d_strcoll
16931eval $inlibc
16932
16933: check for structure copying
16934echo " "
16935echo "Checking to see if your C compiler can copy structs..." >&4
16936$cat >try.c <<'EOCP'
76f47787 16937int main()
b4eb6b3d
JH
16938{
16939 struct blurfl {
16940 int dyick;
16941 } foo, bar;
16942
16943 foo = bar;
16944}
16945EOCP
16946if $cc -c try.c >/dev/null 2>&1 ; then
16947 val="$define"
16948 echo "Yup, it can."
16949else
16950 val="$undef"
16951 echo "Nope, it can't."
16952fi
16953set d_strctcpy
16954eval $setvar
16955$rm -f try.*
16956
16957: see if strerror and/or sys_errlist[] exist
16958echo " "
16959if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16960 if set strerror val -f d_strerror; eval $csym; $val; then
16961 echo 'strerror() found.' >&4
16962 d_strerror="$define"
16963 d_strerrm='strerror(e)'
16964 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16965 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
16966 d_syserrlst="$define"
16967 else
16968 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16969 d_syserrlst="$undef"
16970 fi
16971 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16972 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16973 echo 'strerror() found in string header.' >&4
16974 d_strerror="$define"
16975 d_strerrm='strerror(e)'
16976 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16977 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16978 d_syserrlst="$define"
16979 else
16980 echo "(You don't appear to have any sys_errlist[], how can this be?)"
16981 d_syserrlst="$undef"
16982 fi
16983 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16984 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16985 d_strerror="$undef"
16986 d_syserrlst="$define"
16987 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16988 else
16989 echo 'strerror() and sys_errlist[] NOT found.' >&4
16990 d_strerror="$undef"
16991 d_syserrlst="$undef"
16992 d_strerrm='"unknown"'
16993 fi
16994fi
16995
10bc17b6
JH
16996: see if strerror_r exists
16997set strerror_r d_strerror_r
16998eval $inlibc
16999case "$d_strerror_r" in
17000"$define")
17001 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
17002 case "$d_strerror_r_proto:$usethreads" in
17003 ":define") d_strerror_r_proto=define
a48ec845
JH
17004 set d_strerror_r_proto strerror_r $hdrs
17005 eval $hasproto ;;
17006 *) ;;
17007 esac
17008 case "$d_strerror_r_proto" in
17009 define)
10bc17b6
JH
17010 case "$strerror_r_proto" in
17011 ''|0) try='int strerror_r(int, char*, size_t);'
17012 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17013 esac
17014 case "$strerror_r_proto" in
17015 ''|0) try='int strerror_r(int, char*, int);'
17016 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17017 esac
17018 case "$strerror_r_proto" in
17019 ''|0) try='char* strerror_r(int, char*, size_t);'
17020 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17021 esac
17022 case "$strerror_r_proto" in
90e831dc 17023 ''|0) d_strerror_r=undef
10bc17b6 17024 strerror_r_proto=0
a48ec845 17025 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17026 * ) case "$strerror_r_proto" in
17027 REENTRANT_PROTO*) ;;
17028 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17029 esac
17030 echo "Prototype: $try" ;;
17031 esac
17032 ;;
c18e646a
JH
17033 *) case "$usethreads" in
17034 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17035 esac
90e831dc
SB
17036 d_strerror_r=undef
17037 strerror_r_proto=0
c18e646a 17038 ;;
a48ec845
JH
17039 esac
17040 ;;
10bc17b6
JH
17041*) strerror_r_proto=0
17042 ;;
17043esac
17044
b3c85772
JH
17045: see if strftime exists
17046set strftime d_strftime
17047eval $inlibc
17048
08c92000
MB
17049: see if strlcat exists
17050set strlcat d_strlcat
17051eval $inlibc
17052
17053: see if strlcpy exists
17054set strlcpy d_strlcpy
17055eval $inlibc
17056
b4eb6b3d
JH
17057: see if strtod exists
17058set strtod d_strtod
17059eval $inlibc
17060
17061: see if strtol exists
17062set strtol d_strtol
17063eval $inlibc
17064
17065: see if strtold exists
17066set strtold d_strtold
17067eval $inlibc
17068
17069: see if strtoll exists
17070set strtoll d_strtoll
17071eval $inlibc
17072
17073case "$d_longlong-$d_strtoll" in
17074"$define-$define")
17075 $cat <<EOM
17076Checking whether your strtoll() works okay...
17077EOM
17078 $cat >try.c <<'EOCP'
17079#include <errno.h>
17080#ifdef __hpux
17081#define strtoll __strtoll
17082#endif
e75931a7
YST
17083#ifdef __EMX__
17084#define strtoll _strtoll
17085#endif
b4eb6b3d
JH
17086#include <stdio.h>
17087extern long long int strtoll(char *s, char **, int);
17088static int bad = 0;
17089int check(char *s, long long ell, int een) {
17090 long long gll;
17091 errno = 0;
17092 gll = strtoll(s, 0, 10);
17093 if (!((gll == ell) && (errno == een)))
17094 bad++;
17095}
17096int main() {
17097 check(" 1", 1LL, 0);
17098 check(" 0", 0LL, 0);
17099 check("-1", -1LL, 0);
17100 check("-9223372036854775808", -9223372036854775808LL, 0);
17101 check("-9223372036854775808", -9223372036854775808LL, 0);
17102 check(" 9223372036854775807", 9223372036854775807LL, 0);
17103 check("-9223372036854775808", -9223372036854775808LL, 0);
17104 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17105 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17106 if (!bad)
17107 printf("ok\n");
17108}
17109EOCP
17110 set try
17111 if eval $compile; then
5440bc8e 17112 yyy=`$run ./try`
e75931a7 17113 case "$yyy" in
b4eb6b3d
JH
17114 ok) echo "Your strtoll() seems to be working okay." ;;
17115 *) cat <<EOM >&4
17116Your strtoll() doesn't seem to be working okay.
17117EOM
17118 d_strtoll="$undef"
17119 ;;
69eadf66 17120 esac
e75931a7
YST
17121 else
17122 echo "(I can't seem to compile the test program--assuming it doesn't)"
17123 d_strtoll="$undef"
b4eb6b3d
JH
17124 fi
17125 ;;
17126esac
17127
28e5dec8
JH
17128: see if strtoq exists
17129set strtoq d_strtoq
17130eval $inlibc
17131
b4eb6b3d
JH
17132: see if strtoul exists
17133set strtoul d_strtoul
17134eval $inlibc
17135
d0e6d399
NC
17136case "$d_strtoul" in
17137"$define")
17138 $cat <<EOM
17139Checking whether your strtoul() works okay...
17140EOM
17141 $cat >try.c <<'EOCP'
17142#include <errno.h>
17143#include <stdio.h>
17144extern unsigned long int strtoul(char *s, char **, int);
17145static int bad = 0;
17146void check(char *s, unsigned long eul, int een) {
17147 unsigned long gul;
17148 errno = 0;
17149 gul = strtoul(s, 0, 10);
17150 if (!((gul == eul) && (errno == een)))
17151 bad++;
17152}
17153int main() {
17154 check(" 1", 1L, 0);
17155 check(" 0", 0L, 0);
17156EOCP
17157 case "$longsize" in
17158 8)
17159 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17160 check("18446744073709551615", 18446744073709551615UL, 0);
17161 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17162#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17163 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17164 check("-18446744073709551614", 2, 0);
17165 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17166 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17167 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17168#endif
d0e6d399
NC
17169EOCP
17170 ;;
17171 4)
17172 $cat >>try.c <<'EOCP'
17173 check("4294967295", 4294967295UL, 0);
17174 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17175#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17176 check("-1", 4294967295UL, 0);
17177 check("-4294967294", 2, 0);
17178 check("-4294967295", 1, 0);
17179 check("-4294967296", 4294967295UL, ERANGE);
17180 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17181#endif
d0e6d399
NC
17182EOCP
17183 ;;
17184 *)
17185: Should we write these tests to be more portable by sprintf-ing
17186: ~0 and then manipulating that char string as input for strtol?
17187 ;;
17188 esac
17189 $cat >>try.c <<'EOCP'
17190 if (!bad)
17191 printf("ok\n");
17192 return 0;
17193}
17194EOCP
17195 set try
17196 if eval $compile; then
5440bc8e 17197 case "`$run ./try`" in
d0e6d399
NC
17198 ok) echo "Your strtoul() seems to be working okay." ;;
17199 *) cat <<EOM >&4
17200Your strtoul() doesn't seem to be working okay.
17201EOM
17202 d_strtoul="$undef"
17203 ;;
17204 esac
17205 fi
17206 ;;
17207esac
17208
b4eb6b3d
JH
17209: see if strtoull exists
17210set strtoull d_strtoull
17211eval $inlibc
17212
17213case "$d_longlong-$d_strtoull" in
17214"$define-$define")
17215 $cat <<EOM
17216Checking whether your strtoull() works okay...
17217EOM
17218 $cat >try.c <<'EOCP'
17219#include <errno.h>
17220#ifdef __hpux
17221#define strtoull __strtoull
17222#endif
17223#include <stdio.h>
17224extern unsigned long long int strtoull(char *s, char **, int);
17225static int bad = 0;
17226int check(char *s, long long eull, int een) {
17227 long long gull;
17228 errno = 0;
17229 gull = strtoull(s, 0, 10);
17230 if (!((gull == eull) && (errno == een)))
17231 bad++;
17232}
17233int main() {
d0e6d399
NC
17234 check(" 1", 1LL, 0);
17235 check(" 0", 0LL, 0);
17236 check("18446744073709551615", 18446744073709551615ULL, 0);
17237 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17238#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17239 check("-1", 18446744073709551615ULL, 0);
17240 check("-18446744073709551614", 2LL, 0);
17241 check("-18446744073709551615", 1LL, 0);
17242 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17243 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17244#endif
b4eb6b3d
JH
17245 if (!bad)
17246 printf("ok\n");
17247}
17248EOCP
17249 set try
17250 if eval $compile; then
5440bc8e 17251 case "`$run ./try`" in
b4eb6b3d
JH
17252 ok) echo "Your strtoull() seems to be working okay." ;;
17253 *) cat <<EOM >&4
17254Your strtoull() doesn't seem to be working okay.
17255EOM
17256 d_strtoull="$undef"
17257 ;;
17258 esac
17259 fi
17260 ;;
17261esac
17262
17263: see if strtouq exists
17264set strtouq d_strtouq
17265eval $inlibc
17266
d0e6d399
NC
17267case "$d_strtouq" in
17268"$define")
17269 $cat <<EOM
17270Checking whether your strtouq() works okay...
17271EOM
17272 $cat >try.c <<'EOCP'
17273#include <errno.h>
17274#include <stdio.h>
17275extern unsigned long long int strtouq(char *s, char **, int);
17276static int bad = 0;
17277void check(char *s, unsigned long long eull, int een) {
17278 unsigned long long gull;
17279 errno = 0;
17280 gull = strtouq(s, 0, 10);
17281 if (!((gull == eull) && (errno == een)))
17282 bad++;
17283}
17284int main() {
17285 check(" 1", 1LL, 0);
17286 check(" 0", 0LL, 0);
17287 check("18446744073709551615", 18446744073709551615ULL, 0);
17288 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17289#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17290 check("-1", 18446744073709551615ULL, 0);
17291 check("-18446744073709551614", 2LL, 0);
17292 check("-18446744073709551615", 1LL, 0);
17293 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17294 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17295#endif
d0e6d399
NC
17296 if (!bad)
17297 printf("ok\n");
17298 return 0;
17299}
17300EOCP
17301 set try
17302 if eval $compile; then
5440bc8e 17303 case "`$run ./try`" in
d0e6d399
NC
17304 ok) echo "Your strtouq() seems to be working okay." ;;
17305 *) cat <<EOM >&4
17306Your strtouq() doesn't seem to be working okay.
17307EOM
17308 d_strtouq="$undef"
17309 ;;
17310 esac
17311 fi
17312 ;;
17313esac
17314
b4eb6b3d
JH
17315: see if strxfrm exists
17316set strxfrm d_strxfrm
17317eval $inlibc
17318
17319: see if symlink exists
17320set symlink d_symlink
17321eval $inlibc
17322
17323: see if syscall exists
17324set syscall d_syscall
17325eval $inlibc
17326
2ef53570
JH
17327: see if prototype for syscall is available
17328echo " "
17329set d_syscallproto syscall $i_unistd unistd.h
17330eval $hasproto
17331
b4eb6b3d
JH
17332: see if sysconf exists
17333set sysconf d_sysconf
17334eval $inlibc
17335
17336: see if system exists
17337set system d_system
17338eval $inlibc
17339
17340: see if tcgetpgrp exists
17341set tcgetpgrp d_tcgetpgrp
17342eval $inlibc
17343
17344: see if tcsetpgrp exists
17345set tcsetpgrp d_tcsetpgrp
17346eval $inlibc
17347
17348: see if prototype for telldir is available
17349echo " "
17350set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17351eval $hasproto
17352
ad493445
MB
17353: see if time exists
17354echo " "
17355if test "X$d_time" = X -o X"$timetype" = X; then
17356 if set time val -f d_time; eval $csym; $val; then
17357 echo 'time() found.' >&4
17358 val="$define"
17359 rp="What is the type returned by time() on this system?"
17360 set time_t timetype long stdio.h sys/types.h
17361 eval $typedef_ask
17362 else
17363 echo 'time() not found, hope that will do.' >&4
17364 val="$undef"
17365 timetype='int';
17366 fi
17367 set d_time
17368 eval $setvar
17369fi
17370
b4eb6b3d
JH
17371: see if this is a sys/times.h system
17372set sys/times.h i_systimes
17373eval $inhdr
17374
17375: see if times exists
17376echo " "
17377if set times val -f d_times; eval $csym; $val; then
17378 echo 'times() found.' >&4
17379 d_times="$define"
17380 inc=''
17381 case "$i_systimes" in
17382 "$define") inc='sys/times.h';;
17383 esac
17384 rp="What is the type returned by times() on this system?"
17385 set clock_t clocktype long stdio.h sys/types.h $inc
17386 eval $typedef_ask
17387else
17388 echo 'times() NOT found, hope that will do.' >&4
17389 d_times="$undef"
17390 clocktype='int'
17391fi
17392
10bc17b6
JH
17393: see if tmpnam_r exists
17394set tmpnam_r d_tmpnam_r
17395eval $inlibc
17396case "$d_tmpnam_r" in
17397"$define")
31ee0cb7 17398 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17399 case "$d_tmpnam_r_proto:$usethreads" in
17400 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17401 set d_tmpnam_r_proto tmpnam_r $hdrs
17402 eval $hasproto ;;
17403 *) ;;
17404 esac
17405 case "$d_tmpnam_r_proto" in
17406 define)
10bc17b6
JH
17407 case "$tmpnam_r_proto" in
17408 ''|0) try='char* tmpnam_r(char*);'
17409 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17410 esac
17411 case "$tmpnam_r_proto" in
90e831dc 17412 ''|0) d_tmpnam_r=undef
10bc17b6 17413 tmpnam_r_proto=0
a48ec845 17414 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17415 * ) case "$tmpnam_r_proto" in
17416 REENTRANT_PROTO*) ;;
17417 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17418 esac
17419 echo "Prototype: $try" ;;
17420 esac
17421 ;;
c18e646a
JH
17422 *) case "$usethreads" in
17423 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17424 esac
90e831dc
SB
17425 d_tmpnam_r=undef
17426 tmpnam_r_proto=0
c18e646a 17427 ;;
a48ec845
JH
17428 esac
17429 ;;
10bc17b6
JH
17430*) tmpnam_r_proto=0
17431 ;;
17432esac
17433
b4eb6b3d
JH
17434: see if truncate exists
17435set truncate d_truncate
17436eval $inlibc
17437
10bc17b6
JH
17438: see if ttyname_r exists
17439set ttyname_r d_ttyname_r
17440eval $inlibc
17441case "$d_ttyname_r" in
17442"$define")
17443 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17444 case "$d_ttyname_r_proto:$usethreads" in
17445 ":define") d_ttyname_r_proto=define
a48ec845
JH
17446 set d_ttyname_r_proto ttyname_r $hdrs
17447 eval $hasproto ;;
17448 *) ;;
17449 esac
17450 case "$d_ttyname_r_proto" in
17451 define)
10bc17b6
JH
17452 case "$ttyname_r_proto" in
17453 ''|0) try='int ttyname_r(int, char*, size_t);'
17454 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17455 esac
17456 case "$ttyname_r_proto" in
17457 ''|0) try='int ttyname_r(int, char*, int);'
17458 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17459 esac
17460 case "$ttyname_r_proto" in
17461 ''|0) try='char* ttyname_r(int, char*, int);'
17462 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17463 esac
17464 case "$ttyname_r_proto" in
90e831dc 17465 ''|0) d_ttyname_r=undef
10bc17b6 17466 ttyname_r_proto=0
a48ec845 17467 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17468 * ) case "$ttyname_r_proto" in
17469 REENTRANT_PROTO*) ;;
17470 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17471 esac
17472 echo "Prototype: $try" ;;
17473 esac
17474 ;;
c18e646a
JH
17475 *) case "$usethreads" in
17476 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17477 esac
90e831dc
SB
17478 d_ttyname_r=undef
17479 ttyname_r_proto=0
c18e646a 17480 ;;
a48ec845
JH
17481 esac
17482 ;;
10bc17b6
JH
17483*) ttyname_r_proto=0
17484 ;;
17485esac
17486
b4eb6b3d
JH
17487: see if tzname[] exists
17488echo " "
17489if set tzname val -a d_tzname; eval $csym; $val; then
17490 val="$define"
17491 echo 'tzname[] found.' >&4
17492else
17493 val="$undef"
17494 echo 'tzname[] NOT found.' >&4
17495fi
17496set d_tzname
17497eval $setvar
17498
4e0554ec
JH
17499case "$osname" in
17500next|rhapsody|darwin) multiarch="$define" ;;
17501esac
17502case "$multiarch" in
17503''|[nN]*) multiarch="$undef" ;;
17504esac
17505
24412007 17506: check for ordering of bytes in a UV
4e0554ec 17507echo " "
5440bc8e 17508case "$usecrosscompile$multiarch" in
4e0554ec
JH
17509*$define*)
17510 $cat <<EOM
17511You seem to be either cross-compiling or doing a multiarchitecture build,
17512skipping the byteorder check.
17513
17514EOM
5440bc8e 17515 byteorder='ffff'
4e0554ec
JH
17516 ;;
17517*)
17518 case "$byteorder" in
17519 '')
17520 $cat <<'EOM'
17521In the following, larger digits indicate more significance. A big-endian
17522machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17523little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17524machines may have weird orders like 3412. A Cray will report 87654321,
17525an Alpha will report 12345678. If the test program works the default is
17526probably right.
17527I'm now running the test program...
17528EOM
24412007 17529 $cat >try.c <<EOCP
4e0554ec 17530#include <stdio.h>
55954f19
JH
17531#$i_stdlib I_STDLIB
17532#ifdef I_STDLIB
17533#include <stdlib.h>
17534#endif
24412007
JH
17535#include <sys/types.h>
17536typedef $uvtype UV;
4e0554ec
JH
17537int main()
17538{
17539 int i;
17540 union {
24412007
JH
17541 UV l;
17542 char c[$uvsize];
4e0554ec
JH
17543 } u;
17544
24412007 17545 if ($uvsize > 4)
b5ded3e5 17546 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 17547 else
a4c53327 17548 u.l = (UV)0x04030201;
24412007 17549 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
17550 printf("%c", u.c[i]+'0');
17551 printf("\n");
17552 exit(0);
17553}
17554EOCP
17555 xxx_prompt=y
17556 set try
17557 if eval $compile && ./try > /dev/null; then
5440bc8e 17558 dflt=`$run ./try`
4e0554ec
JH
17559 case "$dflt" in
17560 [1-4][1-4][1-4][1-4]|12345678|87654321)
17561 echo "(The test program ran ok.)"
17562 echo "byteorder=$dflt"
17563 xxx_prompt=n
17564 ;;
17565 ????|????????) echo "(The test program ran ok.)" ;;
17566 *) echo "(The test program didn't run right for some reason.)" ;;
17567 esac
17568 else
17569 dflt='4321'
17570 cat <<'EOM'
17571(I can't seem to compile the test program. Guessing big-endian...)
17572EOM
17573 fi
17574 case "$xxx_prompt" in
17575 y)
24412007 17576 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17577 . ./myread
17578 byteorder="$ans"
17579 ;;
17580 *) byteorder=$dflt
17581 ;;
17582 esac
17583 ;;
17584 esac
17585 $rm -f try.c try
17586 ;;
17587esac
17588
17589
17590$cat <<EOM
17591
17592Checking to see whether you can access character data unalignedly...
17593EOM
dc7b0a4f
JH
17594case "$d_u32align" in
17595'') $cat >try.c <<EOCP
4e0554ec 17596#include <stdio.h>
d1daaddf
JH
17597#$i_stdlib I_STDLIB
17598#ifdef I_STDLIB
17599#include <stdlib.h>
17600#endif
4e0554ec 17601#define U32 $u32type
d308175a
JH
17602#define BYTEORDER 0x$byteorder
17603#define U8 $u8type
9958dc3c
JH
17604#include <signal.h>
17605#ifdef SIGBUS
17606$signal_t bletch(s) int s; { exit(4); }
17607#endif
4e0554ec
JH
17608int main() {
17609#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 17610 U8 buf[8];
4e0554ec
JH
17611 U32 *up;
17612 int i;
17613
17614 if (sizeof(U32) != 4) {
17615 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17616 exit(1);
17617 }
17618
17619 fflush(stdout);
17620
9958dc3c
JH
17621#ifdef SIGBUS
17622 signal(SIGBUS, bletch);
17623#endif
17624
8906a23e
JH
17625 buf[0] = 0;
17626 buf[1] = 0;
17627 buf[2] = 0;
17628 buf[3] = 1;
7eac3fd6 17629 buf[4] = 0;
8906a23e
JH
17630 buf[5] = 0;
17631 buf[6] = 0;
7eac3fd6 17632 buf[7] = 1;
8906a23e 17633
4e0554ec
JH
17634 for (i = 0; i < 4; i++) {
17635 up = (U32*)(buf + i);
17636 if (! ((*up == 1 << (8*i)) || /* big-endian */
17637 (*up == 1 << (8*(3-i))) /* little-endian */
17638 )
17639 )
17640 {
17641 printf("read failed (%x)\n", *up);
17642 exit(2);
17643 }
17644 }
17645
17646 /* write test */
17647 for (i = 0; i < 4; i++) {
17648 up = (U32*)(buf + i);
17649 *up = 0xBeef;
17650 if (*up != 0xBeef) {
17651 printf("write failed (%x)\n", *up);
17652 exit(3);
17653 }
17654 }
17655
17656 exit(0);
17657#else
17658 printf("1\n");
17659 exit(1);
17660#endif
17661 return 0;
17662}
17663EOCP
17664set try
17665if eval $compile_ok; then
d308175a 17666 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 17667 $run ./try 2>&1 >/dev/null
4e0554ec
JH
17668 case "$?" in
17669 0) cat >&4 <<EOM
17670You can access character data pretty unalignedly.
17671EOM
17672 d_u32align="$undef"
17673 ;;
17674 *) cat >&4 <<EOM
17675It seems that you must access character data in an aligned manner.
17676EOM
17677 d_u32align="$define"
17678 ;;
17679 esac
4e0554ec
JH
17680else
17681 rp='Can you access character data at unaligned addresses?'
17682 dflt='n'
17683 . ./myread
17684 case "$ans" in
17685 [yY]*) d_u32align="$undef" ;;
17686 *) d_u32align="$define" ;;
17687 esac
17688fi
e36b5403 17689$rm -f core core.try.* try.core
dc7b0a4f
JH
17690;;
17691esac
4e0554ec
JH
17692
17693: see if ualarm exists
17694set ualarm d_ualarm
17695eval $inlibc
17696
b4eb6b3d
JH
17697: see if umask exists
17698set umask d_umask
17699eval $inlibc
17700
758a5d79
JH
17701: see if unordered exists
17702set unordered d_unordered
17703eval $inlibc
17704
bdf33aa7
SP
17705: see if unsetenv exists
17706set unsetenv d_unsetenv
17707eval $inlibc
17708
4e0554ec
JH
17709: see if usleep exists
17710set usleep d_usleep
17711eval $inlibc
17712
2ef53570
JH
17713: see if prototype for usleep is available
17714echo " "
17715set d_usleepproto usleep $i_unistd unistd.h
17716eval $hasproto
17717
b4eb6b3d
JH
17718: see if ustat exists
17719set ustat d_ustat
17720eval $inlibc
17721
17722: backward compatibility for d_hvfork
17723if test X$d_hvfork != X; then
17724 d_vfork="$d_hvfork"
17725 d_hvfork=''
17726fi
17727: see if there is a vfork
17728val=''
17729set vfork val
17730eval $inlibc
17731
17732: Ok, but do we want to use it. vfork is reportedly unreliable in
17733: perl on Solaris 2.x, and probably elsewhere.
17734case "$val" in
17735$define)
17736 echo " "
17737 case "$usevfork" in
17738 false) dflt='n';;
17739 *) dflt='y';;
17740 esac
17741 cat <<'EOM'
17742
17743Perl can only use a vfork() that doesn't suffer from strict
17744restrictions on calling functions or modifying global data in
17745the child. For example, glibc-2.1 contains such a vfork()
17746that is unsuitable. If your system provides a proper fork()
17747call, chances are that you do NOT want perl to use vfork().
17748
17749EOM
17750 rp="Do you still want to use vfork()?"
17751 . ./myread
17752 case "$ans" in
17753 y|Y) ;;
17754 *)
17755 echo "Ok, we won't use vfork()."
17756 val="$undef"
17757 ;;
17758 esac
17759 ;;
17760esac
17761set d_vfork
17762eval $setvar
17763case "$d_vfork" in
17764$define) usevfork='true';;
17765*) usevfork='false';;
17766esac
17767
b4eb6b3d
JH
17768: see if closedir exists
17769set closedir d_closedir
17770eval $inlibc
17771
17772case "$d_closedir" in
17773"$define")
17774 echo " "
17775 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 17776 cat > try.c <<EOM
b4eb6b3d
JH
17777#$i_dirent I_DIRENT /**/
17778#$i_sysdir I_SYS_DIR /**/
17779#$i_sysndir I_SYS_NDIR /**/
17780#$i_systypes I_SYS_TYPES /**/
17781
17782#if defined(I_SYS_TYPES)
17783#include <sys/types.h>
17784#endif
17785#if defined(I_DIRENT)
17786#include <dirent.h>
17787#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17788#include <sys/dir.h>
17789#endif
17790#else
17791#ifdef I_SYS_NDIR
17792#include <sys/ndir.h>
17793#else
17794#ifdef I_SYS_DIR
17795#ifdef hp9000s500
17796#include <ndir.h> /* may be wrong in the future */
17797#else
17798#include <sys/dir.h>
17799#endif
17800#endif
17801#endif
17802#endif
17803int main() { return closedir(opendir(".")); }
17804EOM
5440bc8e 17805 set try
b4eb6b3d 17806 if eval $compile_ok; then
5440bc8e 17807 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
17808 echo "Yes, it does."
17809 val="$undef"
17810 else
17811 echo "No, it doesn't."
17812 val="$define"
17813 fi
17814 else
17815 echo "(I can't seem to compile the test program--assuming it doesn't)"
17816 val="$define"
17817 fi
17818 ;;
17819*)
17820 val="$undef";
17821 ;;
17822esac
17823set d_void_closedir
17824eval $setvar
5440bc8e 17825$rm -f try try.*
b4eb6b3d
JH
17826: see if there is a wait4
17827set wait4 d_wait4
17828eval $inlibc
17829
17830: see if waitpid exists
17831set waitpid d_waitpid
17832eval $inlibc
17833
17834: see if wcstombs exists
17835set wcstombs d_wcstombs
17836eval $inlibc
17837
17838: see if wctomb exists
17839set wctomb d_wctomb
17840eval $inlibc
17841
4e0554ec
JH
17842: see if writev exists
17843set writev d_writev
17844eval $inlibc
17845
b4eb6b3d
JH
17846: preserve RCS keywords in files with variable substitution, grrr
17847Date='$Date'
17848Id='$Id'
17849Log='$Log'
17850RCSfile='$RCSfile'
17851Revision='$Revision'
17852
b4eb6b3d
JH
17853: check for alignment requirements
17854echo " "
5440bc8e 17855case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
17856*$define*)
17857 $cat <<EOM
17858You seem to be either cross-compiling or doing a multiarchitecture build,
17859skipping the memory alignment check.
17860
17861EOM
17862 case "$alignbytes" in
17863 '') alignbytes=8 ;;
17864 esac
17865 ;;
17866*)
17867 case "$alignbytes" in
17868 '') echo "Checking alignment constraints..." >&4
17869 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17870 $cat >try.c <<'EOCP'
17871typedef long double NV;
17872EOCP
17873 else
17874 $cat >try.c <<'EOCP'
17875typedef double NV;
17876EOCP
17877 fi
17878 $cat >>try.c <<'EOCP'
17879#include <stdio.h>
17880struct foobar {
17881 char foo;
17882 NV bar;
17883} try_algn;
17884int main()
17885{
17886 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17887 return(0);
17888}
17889EOCP
17890 set try
17891 if eval $compile_ok; then
5440bc8e 17892 dflt=`$run ./try`
b4eb6b3d
JH
17893 else
17894 dflt='8'
17895 echo "(I can't seem to compile the test program...)"
17896 fi
17897 ;;
17898 *) dflt="$alignbytes"
17899 ;;
17900 esac
17901 rp="Doubles must be aligned on a how-many-byte boundary?"
17902 . ./myread
17903 alignbytes="$ans"
17904 $rm -f try.c try
17905 ;;
17906esac
17907
17908
17909: set the base revision
17910baserev=5.0
17911
3099fc99 17912: how do we concatenate cpp tokens here?
b4eb6b3d 17913echo " "
3099fc99 17914echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
17915$cat >cpp_stuff.c <<'EOCP'
17916#define RCAT(a,b)a/**/b
17917#define ACAT(a,b)a ## b
17918RCAT(Rei,ser)
17919ACAT(Cir,cus)
17920EOCP
17921$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17922if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17923 echo "Oh! Smells like ANSI's been here." >&4
17924 echo "We can catify or stringify, separately or together!"
17925 cpp_stuff=42
17926elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17927 echo "Ah, yes! The good old days!" >&4
17928 echo "However, in the good old days we don't know how to stringify and"
17929 echo "catify at the same time."
17930 cpp_stuff=1
17931else
17932 $cat >&4 <<EOM
3099fc99
CW
17933Hmm, I don't seem to be able to concatenate tokens with your cpp.
17934You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
17935EOM
17936 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17937fi
17938$rm -f cpp_stuff.*
17939
17940: see if this is a db.h system
17941set db.h i_db
17942eval $inhdr
17943
17944case "$i_db" in
17945$define)
17946 : Check db version.
17947 echo " "
17948 echo "Checking Berkeley DB version ..." >&4
17949 $cat >try.c <<EOCP
17950#$d_const HASCONST
17951#ifndef HASCONST
17952#define const
17953#endif
17954#include <sys/types.h>
17955#include <stdio.h>
55954f19
JH
17956#$i_stdlib I_STDLIB
17957#ifdef I_STDLIB
17958#include <stdlib.h>
17959#endif
b4eb6b3d 17960#include <db.h>
640374d0 17961int main(int argc, char *argv[])
b4eb6b3d
JH
17962{
17963#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17964 int Major, Minor, Patch ;
17965 unsigned long Version ;
17966 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
17967 if (argc == 2) {
17968 printf("%d %d %d %d %d %d\n",
17969 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17970 Major, Minor, Patch);
17971 exit(0);
17972 }
17973 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
17974
17975 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17976 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17977 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17978 Major, Minor, Patch) ;
17979
17980 /* check that db.h & libdb are compatible */
17981 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 17982 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
17983 exit(3);
17984 }
17985
640374d0 17986 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
17987
17988 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17989 + DB_VERSION_PATCH ;
17990
17991 /* needs to be >= 2.3.4 */
17992 if (Version < 2003004) {
17993 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 17994 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
17995 exit(2);
17996 }
17997
17998 exit(0);
17999#else
18000#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
18001 if (argc == 2) {
18002 printf("1 0 0\n");
18003 exit(0);
18004 }
18005 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
18006 exit(0); /* DB version < 2: the coast is clear. */
18007#else
18008 exit(1); /* <db.h> not Berkeley DB? */
18009#endif
18010#endif
18011}
18012EOCP
18013 set try
5440bc8e 18014 if eval $compile_ok && $run ./try; then
b4eb6b3d 18015 echo 'Looks OK.' >&4
5440bc8e 18016 set `$run ./try 1`
640374d0
JH
18017 db_version_major=$1
18018 db_version_minor=$2
18019 db_version_patch=$3
b4eb6b3d
JH
18020 else
18021 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
18022 i_db=$undef
18023 case " $libs " in
18024 *"-ldb "*)
18025 : Remove db from list of libraries to use
18026 echo "Removing unusable -ldb from library list" >&4
18027 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18028 shift
18029 libs="$*"
18030 echo "libs = $libs" >&4
18031 ;;
18032 esac
18033 fi
18034 $rm -f try.*
18035 ;;
18036esac
18037
18038case "$i_db" in
18039define)
18040 : Check the return type needed for hash
18041 echo " "
18042 echo "Checking return type needed for hash for Berkeley DB ..." >&4
18043 $cat >try.c <<EOCP
18044#$d_const HASCONST
18045#ifndef HASCONST
18046#define const
18047#endif
18048#include <sys/types.h>
18049#include <db.h>
18050
18051#ifndef DB_VERSION_MAJOR
18052u_int32_t hash_cb (ptr, size)
18053const void *ptr;
18054size_t size;
18055{
18056}
18057HASHINFO info;
18058int main()
18059{
18060 info.hash = hash_cb;
18061}
18062#endif
18063EOCP
18064 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18065 if $contains warning try.out >>/dev/null 2>&1 ; then
18066 db_hashtype='int'
18067 else
18068 db_hashtype='u_int32_t'
18069 fi
18070 else
18071 : XXX Maybe we should just give up here.
18072 db_hashtype=u_int32_t
18073 $cat try.out >&4
18074 echo "Help: I can't seem to compile the db test program." >&4
18075 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18076 fi
18077 $rm -f try.*
18078 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18079 ;;
18080*) db_hashtype=u_int32_t
18081 ;;
18082esac
18083case "$i_db" in
18084define)
18085 : Check the return type needed for prefix
18086 echo " "
18087 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18088 cat >try.c <<EOCP
18089#$d_const HASCONST
18090#ifndef HASCONST
18091#define const
18092#endif
18093#include <sys/types.h>
18094#include <db.h>
18095
18096#ifndef DB_VERSION_MAJOR
18097size_t prefix_cb (key1, key2)
18098const DBT *key1;
18099const DBT *key2;
18100{
18101}
18102BTREEINFO info;
18103int main()
18104{
18105 info.prefix = prefix_cb;
18106}
18107#endif
18108EOCP
18109 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18110 if $contains warning try.out >>/dev/null 2>&1 ; then
18111 db_prefixtype='int'
18112 else
18113 db_prefixtype='size_t'
18114 fi
18115 else
18116 db_prefixtype='size_t'
18117 : XXX Maybe we should just give up here.
18118 $cat try.out >&4
18119 echo "Help: I can't seem to compile the db test program." >&4
18120 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18121 fi
18122 $rm -f try.*
18123 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18124 ;;
18125*) db_prefixtype='size_t'
18126 ;;
18127esac
18128
b4eb6b3d
JH
18129
18130: How can we generate normalized random numbers ?
18131echo " "
18132echo "Looking for a random number function..." >&4
18133case "$randfunc" in
18134'')
18135 if set drand48 val -f; eval $csym; $val; then
18136 dflt="drand48"
18137 echo "Good, found drand48()." >&4
18138 elif set random val -f; eval $csym; $val; then
18139 dflt="random"
18140 echo "OK, found random()." >&4
18141 else
18142 dflt="rand"
18143 echo "Yick, looks like I have to use rand()." >&4
18144 fi
18145 echo " "
18146 ;;
18147*)
18148 dflt="$randfunc"
18149 ;;
18150esac
18151cont=true
18152
18153case "$ccflags" in
18154*-Dmy_rand=*|*-Dmy_srand=*)
18155 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18156 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18157 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18158 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18159 ;;
18160esac
18161
18162while $test "$cont"; do
18163 rp="Use which function to generate random numbers?"
18164 . ./myread
18165 if $test "$ans" = "$dflt"; then
18166 : null
18167 else
18168 randbits=''
18169 fi
18170 randfunc="$ans"
18171 if set $ans val -f; eval $csym; $val; then
18172 cont=''
18173 else
18174 dflt=y
18175 rp="I cannot find function $ans. Use that name anyway?"
18176 . ./myread
18177 dflt=rand
18178 case "$ans" in
18179 [yY]*) cont='';;
18180 esac
18181 fi
18182 case "$cont" in
18183 '')
18184 case "$randfunc" in
18185 drand48)
18186 drand01="drand48()"
18187 seedfunc="srand48"
18188 randbits=48
18189 randseedtype=long
18190 ;;
18191 rand|random)
18192 case "$randbits" in
18193 '')
18194echo "Checking to see how many bits your $randfunc() function produces..." >&4
18195 $cat >try.c <<EOCP
18196#$i_unistd I_UNISTD
18197#$i_stdlib I_STDLIB
18198#include <stdio.h>
18199#ifdef I_UNISTD
18200# include <unistd.h>
18201#endif
18202#ifdef I_STDLIB
18203# include <stdlib.h>
18204#endif
18205int main()
18206{
18207 register int i;
18208 register unsigned long tmp;
18209 register unsigned long max = 0L;
18210
18211 for (i = 1000; i; i--) {
18212 tmp = (unsigned long) $randfunc();
18213 if (tmp > max) max = tmp;
18214 }
18215 for (i = 0; max; i++)
18216 max /= 2;
18217 printf("%d\n",i);
18218}
18219EOCP
18220 set try
18221 if eval $compile_ok; then
18222 dflt=`try`
18223 else
18224 dflt='?'
18225 echo "(I can't seem to compile the test program...)"
18226 fi
18227 ;;
18228 *)
18229 dflt="$randbits"
18230 ;;
18231 esac
18232 rp="How many bits does your $randfunc() function produce?"
18233 . ./myread
18234 randbits="$ans"
18235 $rm -f try.c try
18236 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18237 seedfunc="s$randfunc"
18238 randseedtype=unsigned
18239 ;;
18240 *)
18241 dflt="31"
18242 rp="How many bits does your $randfunc() function produce?"
18243 . ./myread
18244 randbits="$ans"
18245 seedfunc="s$randfunc"
18246 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18247 if set $seedfunc val -f; eval $csym; $val; then
18248 echo "(Using $seedfunc() to seed random generator)"
18249 else
18250 echo "(Warning: no $seedfunc() to seed random generator)"
18251 seedfunc=rand
18252 fi
18253 randseedtype=unsigned
18254 ;;
18255 esac
18256 ;;
18257 esac
18258done
18259
18260echo " "
18261echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18262$cat >try.c <<'EOM'
b4eb6b3d
JH
18263int main()
18264{
18265 if ('M'==0xd4) return 0;
18266 return 1;
18267}
18268EOM
18269
18270val=$undef
5440bc8e 18271set try
b4eb6b3d 18272if eval $compile_ok; then
5440bc8e 18273 if $run ./try; then
b4eb6b3d
JH
18274 echo "You seem to speak EBCDIC." >&4
18275 val="$define"
18276 else
5440bc8e 18277 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18278 fi
18279else
18280 echo "I'm unable to compile the test program." >&4
18281 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18282fi
5440bc8e 18283$rm -f try try.*
b4eb6b3d
JH
18284set ebcdic
18285eval $setvar
18286
18287echo " "
18288$cat >&4 <<EOM
18289Checking how to flush all pending stdio output...
18290EOM
18291# I only know how to find the first 32 possibly open files on SunOS.
18292# See also hints/sunos_4_1.sh and util.c --AD
18293case "$osname" in
18294sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18295esac
18296$cat >>try.c <<EOCP
18297#include <stdio.h>
55954f19
JH
18298#$i_stdlib I_STDLIB
18299#ifdef I_STDLIB
18300#include <stdlib.h>
18301#endif
b4eb6b3d
JH
18302#$i_unistd I_UNISTD
18303#ifdef I_UNISTD
18304# include <unistd.h>
18305#endif
18306#$d_sysconf HAS_SYSCONF
18307#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18308#ifdef HAS_STDIO_STREAM_ARRAY
18309# define STDIO_STREAM_ARRAY $stdio_stream_array
18310#endif
18311int main() {
5440bc8e
JH
18312 FILE* p;
18313 unlink("try.out");
18314 p = fopen("try.out", "w");
b4eb6b3d
JH
18315#ifdef TRY_FPUTC
18316 fputc('x', p);
18317#else
18318# ifdef TRY_FPRINTF
18319 fprintf(p, "x");
18320# endif
18321#endif
18322#ifdef TRY_FFLUSH_NULL
18323 fflush(NULL);
18324#endif
18325#ifdef TRY_FFLUSH_ALL
18326 {
18327 long open_max = -1;
18328# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18329 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18330# else
18331# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18332 open_max = sysconf(_SC_OPEN_MAX);
18333# else
18334# ifdef FOPEN_MAX
18335 open_max = FOPEN_MAX;
18336# else
18337# ifdef OPEN_MAX
18338 open_max = OPEN_MAX;
18339# else
18340# ifdef _NFILE
18341 open_max = _NFILE;
18342# endif
18343# endif
18344# endif
18345# endif
18346# endif
18347# ifdef HAS_STDIO_STREAM_ARRAY
18348 if (open_max > 0) {
18349 long i;
18350 for (i = 0; i < open_max; i++)
18351 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18352 STDIO_STREAM_ARRAY[i]._file < open_max &&
18353 STDIO_STREAM_ARRAY[i]._flag)
18354 fflush(&STDIO_STREAM_ARRAY[i]);
18355 }
18356 }
18357# endif
18358#endif
18359 _exit(42);
18360}
18361EOCP
18362: first we have to find out how _not_ to flush
5440bc8e 18363$to try.c
b4eb6b3d
JH
18364if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18365 output=''
18366 set try -DTRY_FPUTC
18367 if eval $compile; then
fbe73d74 18368 $run ./try 2>/dev/null
28f5ac64 18369 code="$?"
5440bc8e 18370 $from try.out
28f5ac64 18371 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18372 output=-DTRY_FPUTC
18373 fi
18374 fi
18375 case "$output" in
18376 '')
18377 set try -DTRY_FPRINTF
b4eb6b3d 18378 if eval $compile; then
fbe73d74 18379 $run ./try 2>/dev/null
28f5ac64 18380 code="$?"
5440bc8e 18381 $from try.out
28f5ac64 18382 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18383 output=-DTRY_FPRINTF
18384 fi
18385 fi
18386 ;;
18387 esac
18388fi
18389: check for fflush NULL behaviour
18390case "$fflushNULL" in
18391'') set try -DTRY_FFLUSH_NULL $output
18392 if eval $compile; then
5440bc8e 18393 $run ./try 2>/dev/null
b4eb6b3d 18394 code="$?"
5440bc8e 18395 $from try.out
b4eb6b3d
JH
18396 if $test -s try.out -a "X$code" = X42; then
18397 fflushNULL="`$cat try.out`"
18398 else
18399 if $test "X$code" != X42; then
18400 $cat >&4 <<EOM
18401(If this test failed, don't worry, we'll try another method shortly.)
18402EOM
18403 fi
18404 fi
18405 fi
18406 $rm -f core try.core core.try.*
18407 case "$fflushNULL" in
18408 x) $cat >&4 <<EOM
18409Your fflush(NULL) works okay for output streams.
18410Let's see if it clobbers input pipes...
18411EOM
18412# As of mid-March 2000 all versions of Solaris appear to have a stdio
18413# bug that improperly flushes the input end of pipes. So we avoid the
18414# autoflush on fork/system/exec support for now. :-(
18415$cat >tryp.c <<EOCP
18416#include <stdio.h>
18417int
18418main(int argc, char **argv)
18419{
18420 char buf[1024];
18421 int i;
18422 char *bp = buf;
18423 while (1) {
18424 while ((i = getc(stdin)) != -1
18425 && (*bp++ = i) != '\n'
18426 && bp < &buf[1024])
18427 /* DO NOTHING */ ;
18428 *bp = '\0';
18429 fprintf(stdout, "%s", buf);
18430 fflush(NULL);
18431 if (i == -1)
18432 return 0;
18433 bp = buf;
18434 }
18435}
18436EOCP
18437 fflushNULL="$define"
18438 set tryp
18439 if eval $compile; then
18440 $rm -f tryp.out
5440bc8e 18441 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18442 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18443 $cat >&4 <<EOM
18444fflush(NULL) seems to behave okay with input streams.
18445EOM
18446 fflushNULL="$define"
18447 else
18448 $cat >&4 <<EOM
18449Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18450EOM
18451 fflushNULL="$undef"
18452 fi
18453 fi
18454 $rm -f core tryp.c tryp.core core.tryp.*
18455 ;;
18456 '') $cat >&4 <<EOM
18457Your fflush(NULL) isn't working (contrary to ANSI C).
18458EOM
18459 fflushNULL="$undef"
18460 ;;
18461 *) $cat >&4 <<EOM
18462Cannot figure out whether your fflush(NULL) works or not.
18463I'm assuming it doesn't (contrary to ANSI C).
18464EOM
18465 fflushNULL="$undef"
18466 ;;
18467 esac
18468 ;;
18469$define|true|[yY]*)
18470 fflushNULL="$define"
18471 ;;
18472*)
18473 fflushNULL="$undef"
18474 ;;
18475esac
18476: check explicit looping only if NULL did not work, and if the pipe
18477: bug does not show up on an explicit flush too
18478case "$fflushNULL" in
18479"$undef")
18480 $cat >tryp.c <<EOCP
18481#include <stdio.h>
18482int
18483main(int argc, char **argv)
18484{
18485 char buf[1024];
18486 int i;
18487 char *bp = buf;
18488 while (1) {
18489 while ((i = getc(stdin)) != -1
18490 && (*bp++ = i) != '\n'
18491 && bp < &buf[1024])
18492 /* DO NOTHING */ ;
18493 *bp = '\0';
18494 fprintf(stdout, "%s", buf);
18495 fflush(stdin);
18496 if (i == -1)
18497 return 0;
18498 bp = buf;
18499 }
18500}
18501EOCP
18502 set tryp
18503 if eval $compile; then
18504 $rm -f tryp.out
5440bc8e 18505 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18506 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18507 $cat >&4 <<EOM
18508Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18509EOM
18510 : now check for fflushall behaviour
18511 case "$fflushall" in
18512 '') set try -DTRY_FFLUSH_ALL $output
18513 if eval $compile; then
18514 $cat >&4 <<EOM
18515(Now testing the other method--but note that this also may fail.)
18516EOM
5440bc8e 18517 $run ./try 2>/dev/null
28f5ac64 18518 code=$?
fbe73d74 18519 $from try.out
28f5ac64 18520 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18521 fflushall="`$cat try.out`"
18522 fi
18523 fi
18524 $rm -f core try.core core.try.*
18525 case "$fflushall" in
18526 x) $cat >&4 <<EOM
18527Whew. Flushing explicitly all the stdio streams works.
18528EOM
18529 fflushall="$define"
18530 ;;
18531 '') $cat >&4 <<EOM
18532Sigh. Flushing explicitly all the stdio streams doesn't work.
18533EOM
18534 fflushall="$undef"
18535 ;;
18536 *) $cat >&4 <<EOM
18537Cannot figure out whether flushing stdio streams explicitly works or not.
18538I'm assuming it doesn't.
18539EOM
18540 fflushall="$undef"
18541 ;;
18542 esac
18543 ;;
18544 "$define"|true|[yY]*)
18545 fflushall="$define"
18546 ;;
18547 *)
18548 fflushall="$undef"
18549 ;;
18550 esac
18551 else
18552 $cat >&4 <<EOM
18553All is futile. Even fflush(stdin) clobbers input pipes!
18554EOM
18555 fflushall="$undef"
18556 fi
18557 else
18558 fflushall="$undef"
18559 fi
18560 $rm -f core tryp.c tryp.core core.tryp.*
18561 ;;
18562*) fflushall="$undef"
18563 ;;
18564esac
18565
18566case "$fflushNULL$fflushall" in
18567undefundef)
18568 $cat <<EOM
18569OK, I give up. I cannot figure out how to flush pending stdio output.
18570We won't be flushing handles at all before fork/exec/popen.
18571EOM
18572 ;;
18573esac
18574$rm -f try.* try$exe_ext
18575
18576: Store the full pathname to the ar program for use in the C program
18577: Respect a hint or command line value for full_ar.
18578case "$full_ar" in
18579'') full_ar=$ar ;;
18580esac
18581
18582: Store the full pathname to the sed program for use in the C program
18583full_sed=$sed
18584
18585: see what type gids are declared as in the kernel
18586echo " "
18587echo "Looking for the type for group ids returned by getgid()."
18588set gid_t gidtype xxx stdio.h sys/types.h
18589eval $typedef
18590case "$gidtype" in
18591xxx)
18592 xxx=`./findhdr sys/user.h`
18593 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18594 case $1 in
18595 unsigned) dflt="$1 $2" ;;
18596 *) dflt="$1" ;;
18597 esac
18598 ;;
18599*) dflt="$gidtype";;
18600esac
18601case "$gidtype" in
18602gid_t) echo "gid_t found." ;;
18603*) rp="What is the type for group ids returned by getgid()?"
18604 . ./myread
18605 gidtype="$ans"
18606 ;;
18607esac
18608
18609echo " "
18610case "$gidtype" in
18611*_t) zzz="$gidtype" ;;
18612*) zzz="gid" ;;
18613esac
18614echo "Checking the size of $zzz..." >&4
18615cat > try.c <<EOCP
18616#include <sys/types.h>
18617#include <stdio.h>
d1daaddf
JH
18618#$i_stdlib I_STDLIB
18619#ifdef I_STDLIB
18620#include <stdlib.h>
18621#endif
b4eb6b3d
JH
18622int main() {
18623 printf("%d\n", (int)sizeof($gidtype));
18624 exit(0);
18625}
18626EOCP
18627set try
18628if eval $compile_ok; then
5440bc8e 18629 yyy=`$run ./try`
b4eb6b3d
JH
18630 case "$yyy" in
18631 '') gidsize=4
18632 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18633 ;;
18634 *) gidsize=$yyy
18635 echo "Your $zzz is $gidsize bytes long."
18636 ;;
18637 esac
18638else
18639 gidsize=4
18640 echo "(I can't compile the test program--guessing $gidsize.)" >&4
18641fi
18642
18643
18644echo " "
18645case "$gidtype" in
18646*_t) zzz="$gidtype" ;;
18647*) zzz="gid" ;;
18648esac
18649echo "Checking the sign of $zzz..." >&4
18650cat > try.c <<EOCP
18651#include <sys/types.h>
18652#include <stdio.h>
18653int main() {
18654 $gidtype foo = -1;
18655 if (foo < 0)
18656 printf("-1\n");
18657 else
18658 printf("1\n");
18659}
18660EOCP
18661set try
18662if eval $compile; then
5440bc8e 18663 yyy=`$run ./try`
b4eb6b3d
JH
18664 case "$yyy" in
18665 '') gidsign=1
18666 echo "(I can't execute the test program--guessing unsigned.)" >&4
18667 ;;
18668 *) gidsign=$yyy
18669 case "$gidsign" in
18670 1) echo "Your $zzz is unsigned." ;;
18671 -1) echo "Your $zzz is signed." ;;
18672 esac
18673 ;;
18674 esac
18675else
18676 gidsign=1
18677 echo "(I can't compile the test program--guessing unsigned.)" >&4
18678fi
18679
18680
18681echo " "
18682
18683if $test X"$quadtype" != X; then
18684
18685echo "Checking how to print 64-bit integers..." >&4
18686
18687if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18688 $cat >try.c <<'EOCP'
18689#include <sys/types.h>
18690#include <stdio.h>
18691int main() {
18692 int q = 12345678901;
18693 printf("%ld\n", q);
18694}
18695EOCP
18696 set try
18697 if eval $compile; then
5440bc8e 18698 yyy=`$run ./try`
b4eb6b3d
JH
18699 case "$yyy" in
18700 12345678901)
18701 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18702 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18703 echo "We will use %d."
18704 ;;
18705 esac
18706 fi
18707fi
18708
18709if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18710 $cat >try.c <<'EOCP'
18711#include <sys/types.h>
18712#include <stdio.h>
18713int main() {
18714 long q = 12345678901;
18715 printf("%ld\n", q);
18716}
18717EOCP
18718 set try
18719 if eval $compile; then
5440bc8e 18720 yyy=`$run ./try`
b4eb6b3d
JH
18721 case "$yyy" in
18722 12345678901)
18723 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18724 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18725 echo "We will use %ld."
18726 ;;
18727 esac
18728 fi
18729fi
18730
18731if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18732 $cat >try.c <<'EOCP'
18733#include <sys/types.h>
18734#include <inttypes.h>
18735#include <stdio.h>
18736int main() {
18737 int64_t q = 12345678901;
18738 printf("%" PRId64 "\n", q);
18739}
18740EOCP
18741 set try
18742 if eval $compile; then
5440bc8e 18743 yyy=`$run ./try`
b4eb6b3d
JH
18744 case "$yyy" in
18745 12345678901)
18746 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18747 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18748 echo "We will use the C9X style."
18749 ;;
18750 esac
18751 fi
18752fi
18753
2ef53570
JH
18754if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18755 $cat >try.c <<EOCP
b4eb6b3d
JH
18756#include <sys/types.h>
18757#include <stdio.h>
18758int main() {
2ef53570
JH
18759 $quadtype q = 12345678901;
18760 printf("%Ld\n", q);
b4eb6b3d
JH
18761}
18762EOCP
18763 set try
18764 if eval $compile; then
5440bc8e 18765 yyy=`$run ./try`
b4eb6b3d
JH
18766 case "$yyy" in
18767 12345678901)
2ef53570
JH
18768 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18769 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18770 echo "We will use %Ld."
b4eb6b3d
JH
18771 ;;
18772 esac
18773 fi
18774fi
18775
2ef53570
JH
18776if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18777 $cat >try.c <<'EOCP'
b4eb6b3d
JH
18778#include <sys/types.h>
18779#include <stdio.h>
18780int main() {
2ef53570
JH
18781 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18782 printf("%lld\n", q);
b4eb6b3d
JH
18783}
18784EOCP
18785 set try
18786 if eval $compile; then
5440bc8e 18787 yyy=`$run ./try`
b4eb6b3d
JH
18788 case "$yyy" in
18789 12345678901)
2ef53570
JH
18790 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18791 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18792 echo "We will use the %lld style."
b4eb6b3d
JH
18793 ;;
18794 esac
18795 fi
18796fi
18797
18798if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18799 $cat >try.c <<EOCP
18800#include <sys/types.h>
18801#include <stdio.h>
18802int main() {
18803 $quadtype q = 12345678901;
18804 printf("%qd\n", q);
18805}
18806EOCP
18807 set try
18808 if eval $compile; then
5440bc8e 18809 yyy=`$run ./try`
b4eb6b3d
JH
18810 case "$yyy" in
18811 12345678901)
18812 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18813 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18814 echo "We will use %qd."
18815 ;;
18816 esac
18817 fi
18818fi
18819
18820if $test X"$sPRId64" = X; then
18821 echo "Cannot figure out how to print 64-bit integers." >&4
18822fi
18823
18824$rm -f try try.*
18825
18826fi
18827
18828case "$sPRId64" in
18829'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
18830 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
18831 ;;
18832*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
18833 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
18834 ;;
18835esac
18836
18837
18838echo " "
18839$echo "Checking the format strings to be used for Perl's internal types..." >&4
18840
18841if $test X"$ivsize" = X8; then
18842 ivdformat="$sPRId64"
18843 uvuformat="$sPRIu64"
18844 uvoformat="$sPRIo64"
18845 uvxformat="$sPRIx64"
18846 uvXUformat="$sPRIXU64"
18847else
18848 if $test X"$ivsize" = X"$longsize"; then
18849 ivdformat='"ld"'
18850 uvuformat='"lu"'
18851 uvoformat='"lo"'
18852 uvxformat='"lx"'
18853 uvXUformat='"lX"'
18854 else
18855 if $test X"$ivsize" = X"$intsize"; then
18856 ivdformat='"d"'
18857 uvuformat='"u"'
18858 uvoformat='"o"'
18859 uvxformat='"x"'
18860 uvXUformat='"X"'
18861 else
18862 : far out
18863 if $test X"$ivsize" = X"$shortsize"; then
18864 ivdformat='"hd"'
18865 uvuformat='"hu"'
18866 uvoformat='"ho"'
18867 uvxformat='"hx"'
18868 uvXUformat='"hX"'
18869 fi
18870 fi
18871 fi
18872fi
18873
18874if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18875 nveformat="$sPRIeldbl"
18876 nvfformat="$sPRIfldbl"
18877 nvgformat="$sPRIgldbl"
18878 nvEUformat="$sPRIEUldbl"
18879 nvFUformat="$sPRIFUldbl"
18880 nvGUformat="$sPRIGUldbl"
18881else
18882 nveformat='"e"'
18883 nvfformat='"f"'
18884 nvgformat='"g"'
18885 nvEUformat='"E"'
18886 nvFUformat='"F"'
18887 nvGUformat='"G"'
18888fi
18889
18890case "$ivdformat" in
3c728e00 18891'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
18892 exit 1
18893 ;;
18894esac
18895
18896
18897echo " "
18898$echo "Checking the format string to be used for gids..." >&4
18899
18900case "$gidsign" in
18901-1) if $test X"$gidsize" = X"$ivsize"; then
18902 gidformat="$ivdformat"
18903 else
18904 if $test X"$gidsize" = X"$longsize"; then
18905 gidformat='"ld"'
18906 else
18907 if $test X"$gidsize" = X"$intsize"; then
18908 gidformat='"d"'
18909 else
18910 if $test X"$gidsize" = X"$shortsize"; then
18911 gidformat='"hd"'
18912 fi
18913 fi
18914 fi
18915 fi
18916 ;;
18917*) if $test X"$gidsize" = X"$uvsize"; then
18918 gidformat="$uvuformat"
18919 else
18920 if $test X"$gidsize" = X"$longsize"; then
18921 gidformat='"lu"'
18922 else
18923 if $test X"$gidsize" = X"$intsize"; then
18924 gidformat='"u"'
18925 else
18926 if $test X"$gidsize" = X"$shortsize"; then
18927 gidformat='"hu"'
18928 fi
18929 fi
18930 fi
18931 fi
18932 ;;
18933esac
18934
18935: see if getgroups exists
18936set getgroups d_getgrps
18937eval $inlibc
18938
18939: see if setgroups exists
18940set setgroups d_setgrps
18941eval $inlibc
18942
18943
18944: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18945echo " "
18946case "$d_getgrps$d_setgrps" in
18947*define*)
18948 case "$groupstype" in
18949 '') dflt="$gidtype" ;;
18950 *) dflt="$groupstype" ;;
18951 esac
18952 $cat <<EOM
18953What type of pointer is the second argument to getgroups() and setgroups()?
18954Usually this is the same as group ids, $gidtype, but not always.
18955
18956EOM
18957 rp='What type pointer is the second argument to getgroups() and setgroups()?'
18958 . ./myread
18959 groupstype="$ans"
18960 ;;
18961*) groupstype="$gidtype";;
18962esac
18963
18964echo " "
18965echo "Checking if your $make program sets \$(MAKE)..." >&4
18966case "$make_set_make" in
18967'')
18968 $sed 's/^X //' > testmake.mak << 'EOF'
18969Xall:
18970X @echo 'maketemp="$(MAKE)"'
18971EOF
18972 case "`$make -f testmake.mak 2>/dev/null`" in
18973 *maketemp=*) make_set_make='#' ;;
18974 *) make_set_make="MAKE=$make" ;;
18975 esac
18976 $rm -f testmake.mak
18977 ;;
18978esac
18979case "$make_set_make" in
18980'#') echo "Yup, it does.";;
18981*) echo "Nope, it doesn't.";;
18982esac
18983
18984: see what type is used for mode_t
18985rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18986set mode_t modetype int stdio.h sys/types.h
18987eval $typedef_ask
18988
2cc61e15
DD
18989: see if stdarg is available
18990echo " "
18991if $test `./findhdr stdarg.h`; then
18992 echo "<stdarg.h> found." >&4
18993 valstd="$define"
18994else
18995 echo "<stdarg.h> NOT found." >&4
18996 valstd="$undef"
18997fi
18998
18999: see if varags is available
19000echo " "
19001if $test `./findhdr varargs.h`; then
19002 echo "<varargs.h> found." >&4
19003else
19004 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
19005fi
19006
19007: set up the varargs testing programs
19008$cat > varargs.c <<EOP
19009#ifdef I_STDARG
19010#include <stdarg.h>
19011#endif
19012#ifdef I_VARARGS
19013#include <varargs.h>
19014#endif
19015
19016#ifdef I_STDARG
19017int f(char *p, ...)
19018#else
19019int f(va_alist)
19020va_dcl
19021#endif
19022{
19023 va_list ap;
19024#ifndef I_STDARG
19025 char *p;
19026#endif
19027#ifdef I_STDARG
19028 va_start(ap,p);
19029#else
19030 va_start(ap);
19031 p = va_arg(ap, char *);
19032#endif
19033 va_end(ap);
19034}
19035EOP
19036$cat > varargs <<EOP
19037$startsh
19038if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19039 echo "true"
19040else
19041 echo "false"
19042fi
19043$rm -f varargs$_o
19044EOP
19045chmod +x varargs
19046
19047: now check which varargs header should be included
19048echo " "
19049i_varhdr=''
19050case "$valstd" in
19051"$define")
19052 if `./varargs I_STDARG`; then
19053 val='stdarg.h'
19054 elif `./varargs I_VARARGS`; then
19055 val='varargs.h'
19056 fi
19057 ;;
19058*)
19059 if `./varargs I_VARARGS`; then
19060 val='varargs.h'
19061 fi
19062 ;;
19063esac
19064case "$val" in
19065'')
19066echo "I could not find the definition for va_dcl... You have problems..." >&4
19067 val="$undef"; set i_stdarg; eval $setvar
19068 val="$undef"; set i_varargs; eval $setvar
19069 ;;
19070*)
19071 set i_varhdr
19072 eval $setvar
19073 case "$i_varhdr" in
19074 stdarg.h)
19075 val="$define"; set i_stdarg; eval $setvar
19076 val="$undef"; set i_varargs; eval $setvar
19077 ;;
19078 varargs.h)
19079 val="$undef"; set i_stdarg; eval $setvar
19080 val="$define"; set i_varargs; eval $setvar
19081 ;;
19082 esac
19083 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19084esac
19085$rm -f varargs*
19086
19087: see if we need va_copy
19088echo " "
19089case "$i_stdarg" in
19090"$define")
19091 $cat >try.c <<EOCP
19092#include <stdarg.h>
19093#include <stdio.h>
85c8a686
DD
19094#$i_stdlib I_STDLIB
19095#ifdef I_STDLIB
19096#include <stdlib.h>
19097#endif
19098#include <signal.h>
2cc61e15
DD
19099
19100int
19101ivfprintf(FILE *f, const char *fmt, va_list *valp)
19102{
19103 return vfprintf(f, fmt, *valp);
19104}
19105
19106int
19107myvfprintf(FILE *f, const char *fmt, va_list val)
19108{
19109 return ivfprintf(f, fmt, &val);
19110}
19111
19112int
19113myprintf(char *fmt, ...)
19114{
19115 va_list val;
19116 va_start(val, fmt);
19117 return myvfprintf(stdout, fmt, val);
19118}
19119
19120int
19121main(int ac, char **av)
19122{
85c8a686
DD
19123 signal(SIGSEGV, exit);
19124
2cc61e15
DD
19125 myprintf("%s%cs all right, then\n", "that", '\'');
19126 exit(0);
19127}
19128EOCP
19129 set try
5440bc8e
JH
19130 if eval $compile && $run ./try 2>&1 >/dev/null; then
19131 case "`$run ./try`" in
2cc61e15
DD
19132 "that's all right, then")
19133 okay=yes
19134 ;;
19135 esac
19136 fi
19137 case "$okay" in
19138 yes) echo "It seems that you don't need va_copy()." >&4
19139 need_va_copy="$undef"
19140 ;;
19141 *) echo "It seems that va_copy() or similar will be needed." >&4
19142 need_va_copy="$define"
19143 ;;
19144 esac
19145 $rm -f try.* core core.* *.core *.core.*
19146 ;;
19147*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19148 ;;
19149esac
19150
b4eb6b3d
JH
19151: see what type is used for size_t
19152rp="What is the type used for the length parameter for string functions?"
19153set size_t sizetype 'unsigned int' stdio.h sys/types.h
19154eval $typedef_ask
19155
19156: check for type of arguments to gethostbyaddr.
19157if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19158 case "$d_gethbyaddr" in
19159 $define)
19160 $cat <<EOM
19161
19162Checking to see what type of arguments are accepted by gethostbyaddr().
19163EOM
19164 hdrs="$define sys/types.h
19165 $d_socket sys/socket.h
19166 $i_niin netinet/in.h
19167 $i_netdb netdb.h
19168 $i_unistd unistd.h"
19169 : The first arg can 'char *' or 'void *'
19170 : The second arg is some of integral type
19171 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19172 for yyy in size_t long int; do
19173 case "$netdb_host_type" in
19174 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19175 if ./protochk "$try" $hdrs; then
19176 echo "Your system accepts $xxx for the first arg."
19177 echo "...and $yyy for the second arg."
19178 netdb_host_type="$xxx"
19179 netdb_hlen_type="$yyy"
19180 fi
19181 ;;
19182 esac
19183 done
19184 done
19185 : In case none of those worked, prompt the user.
19186 case "$netdb_host_type" in
19187 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19188 dflt='char *'
19189 . ./myread
19190 netdb_host_type=$ans
19191 rp='What is the type for the 2nd argument to gethostbyaddr?'
19192 dflt="$sizetype"
19193 . ./myread
19194 netdb_hlen_type=$ans
19195 ;;
19196 esac
19197 ;;
19198 *) : no gethostbyaddr, so pick harmless defaults
19199 netdb_host_type='char *'
19200 netdb_hlen_type="$sizetype"
19201 ;;
19202 esac
19203 # Remove the "const" if needed. -- but then we'll have a
19204 # prototype clash!
19205 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19206fi
19207
19208: check for type of argument to gethostbyname.
19209if test "X$netdb_name_type" = X ; then
19210 case "$d_gethbyname" in
19211 $define)
19212 $cat <<EOM
19213
19214Checking to see what type of argument is accepted by gethostbyname().
19215EOM
19216 hdrs="$define sys/types.h
19217 $d_socket sys/socket.h
19218 $i_niin netinet/in.h
19219 $i_netdb netdb.h
19220 $i_unistd unistd.h"
19221 for xxx in "const char *" "char *"; do
19222 case "$netdb_name_type" in
19223 '') try="extern struct hostent *gethostbyname($xxx);"
19224 if ./protochk "$try" $hdrs; then
19225 echo "Your system accepts $xxx."
19226 netdb_name_type="$xxx"
19227 fi
19228 ;;
19229 esac
19230 done
19231 : In case none of those worked, prompt the user.
19232 case "$netdb_name_type" in
19233 '') rp='What is the type for the 1st argument to gethostbyname?'
19234 dflt='char *'
19235 . ./myread
19236 netdb_name_type=$ans
19237 ;;
19238 esac
19239 ;;
19240 *) : no gethostbyname, so pick harmless default
19241 netdb_name_type='char *'
19242 ;;
19243 esac
19244fi
19245
19246: check for type of 1st argument to getnetbyaddr.
19247if test "X$netdb_net_type" = X ; then
19248 case "$d_getnbyaddr" in
19249 $define)
19250 $cat <<EOM
19251
19252Checking to see what type of 1st argument is accepted by getnetbyaddr().
19253EOM
19254 hdrs="$define sys/types.h
19255 $d_socket sys/socket.h
19256 $i_niin netinet/in.h
19257 $i_netdb netdb.h
19258 $i_unistd unistd.h"
19259 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19260 case "$netdb_net_type" in
19261 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19262 if ./protochk "$try" $hdrs; then
19263 echo "Your system accepts $xxx."
19264 netdb_net_type="$xxx"
19265 fi
19266 ;;
19267 esac
19268 done
19269 : In case none of those worked, prompt the user.
19270 case "$netdb_net_type" in
19271 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19272 dflt='long'
19273 . ./myread
19274 netdb_net_type=$ans
19275 ;;
19276 esac
19277 ;;
19278 *) : no getnetbyaddr, so pick harmless default
19279 netdb_net_type='long'
19280 ;;
19281 esac
19282fi
19283: locate the preferred pager for this system
d604bb53 19284fn=f/
b4eb6b3d
JH
19285case "$pager" in
19286'')
19287 dflt=''
19288 case "$pg" in
19289 /*) dflt=$pg;;
19290 [a-zA-Z]:/*) dflt=$pg;;
19291 esac
19292 case "$more" in
19293 /*) dflt=$more;;
19294 [a-zA-Z]:/*) dflt=$more;;
19295 esac
19296 case "$less" in
19297 /*) dflt=$less;;
19298 [a-zA-Z]:/*) dflt=$less;;
19299 esac
19300 case "$dflt" in
19301 '') dflt=/usr/ucb/more;;
19302 esac
19303 ;;
d604bb53
JH
19304*) dflt="$pager"
19305 : Instruct ./getfile to trust the hinted or previous pager value,
19306 : even if it does not begin with a slash. For example, on os2,
19307 : pager might be cmd /c more. See comments in UU/getfile.
19308 fn="f/($pager)"
19309 ;;
b4eb6b3d
JH
19310esac
19311echo " "
b4eb6b3d
JH
19312rp='What pager is used on your system?'
19313. ./getfile
19314pager="$ans"
19315
19316: see what type pids are declared as in the kernel
19317rp="What is the type of process ids on this system?"
19318set pid_t pidtype int stdio.h sys/types.h
19319eval $typedef_ask
19320
b4eb6b3d
JH
19321: see if ar generates random libraries by itself
19322echo " "
19323echo "Checking how to generate random libraries on your machine..." >&4
19324echo 'int bar1() { return bar2(); }' > bar1.c
19325echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19326$cat > foo.c <<EOP
19327#$i_stdlib I_STDLIB
19328#ifdef I_STDLIB
19329#include <stdlib.h>
19330#endif
b4eb6b3d
JH
19331int main() { printf("%d\n", bar1()); exit(0); }
19332EOP
19333$cc $ccflags -c bar1.c >/dev/null 2>&1
19334$cc $ccflags -c bar2.c >/dev/null 2>&1
19335$cc $ccflags -c foo.c >/dev/null 2>&1
19336$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19337if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19338 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19339 echo "$ar appears to generate random libraries itself."
19340 orderlib=false
e39a9d84
LC
19341 if [ "X$ranlib" = "X" ]; then
19342 ranlib=":"
19343 fi
88d4d47b
PC
19344elif $ar s bar$_a >/dev/null 2>&1 &&
19345 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19346 $run ./foobar >/dev/null 2>&1; then
19347 echo "a table of contents needs to be added with '$ar s'."
19348 orderlib=false
19349 ranlib="$ar s"
b4eb6b3d 19350elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19351 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19352 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19353 echo "a table of contents needs to be added with '$ar ts'."
19354 orderlib=false
19355 ranlib="$ar ts"
19356else
19357 case "$ranlib" in
19358 :) ranlib='';;
19359 '')
19360 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19361 $test -f $ranlib || ranlib=''
19362 ;;
19363 esac
19364 if $test -n "$ranlib"; then
19365 echo "your system has '$ranlib'; we'll use that."
19366 orderlib=false
19367 else
19368 echo "your system doesn't seem to support random libraries"
19369 echo "so we'll use lorder and tsort to order the libraries."
19370 orderlib=true
19371 ranlib=":"
19372 fi
19373fi
88d4d47b 19374$rm -f foo* bar*
b4eb6b3d
JH
19375
19376: check for type of arguments to select.
19377case "$selecttype" in
19378'') case "$d_select" in
19379 $define)
19380 echo " "
19381 $cat <<EOM
19382Checking to see what type of arguments are accepted by select().
19383EOM
19384 hdrs="$define sys/types.h
19385 $i_systime sys/time.h
19386 $i_sysselct sys/select.h
19387 $d_socket sys/socket.h"
19388 : The first arg can be int, unsigned, or size_t
19389 : The last arg may or may not be 'const'
19390 val=''
19391 : void pointer has been seen but using that
19392 : breaks the selectminbits test
19393 for xxx in 'fd_set *' 'int *'; do
19394 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19395 for tmo in 'struct timeval *' 'const struct timeval *'; do
19396 case "$val" in
19397 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19398 if ./protochk "$try" $hdrs; then
19399 echo "Your system accepts $xxx."
19400 val="$xxx"
19401 fi
19402 ;;
19403 esac
19404 done
19405 done
19406 done
19407 case "$val" in
19408 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19409 case "$d_fd_set" in
19410 $define) dflt="fd_set *" ;;
19411 *) dflt="int *" ;;
19412 esac
19413 . ./myread
19414 val=$ans
19415 ;;
19416 esac
19417 selecttype="$val"
19418 ;;
19419 *) : no select, so pick a harmless default
19420 selecttype='int *'
19421 ;;
19422 esac
19423 ;;
19424esac
19425
19426: check for the select 'width'
19427case "$selectminbits" in
e6e7e605
JH
19428'') safebits=`expr $ptrsize \* 8`
19429 case "$d_select" in
b4eb6b3d
JH
19430 $define)
19431 $cat <<EOM
19432
19433Checking to see on how many bits at a time your select() operates...
19434EOM
19435 $cat >try.c <<EOCP
19436#include <sys/types.h>
19437#$i_time I_TIME
19438#$i_systime I_SYS_TIME
19439#$i_systimek I_SYS_TIME_KERNEL
19440#ifdef I_TIME
19441# include <time.h>
19442#endif
19443#ifdef I_SYS_TIME
19444# ifdef I_SYS_TIME_KERNEL
19445# define KERNEL
19446# endif
19447# include <sys/time.h>
19448# ifdef I_SYS_TIME_KERNEL
19449# undef KERNEL
19450# endif
19451#endif
19452#$i_sysselct I_SYS_SELECT
19453#ifdef I_SYS_SELECT
19454#include <sys/select.h>
19455#endif
19456#$d_socket HAS_SOCKET
19457#ifdef HAS_SOCKET
19458# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19459#endif
19460#include <stdio.h>
d1daaddf
JH
19461#$i_stdlib I_STDLIB
19462#ifdef I_STDLIB
19463#include <stdlib.h>
19464#endif
b4eb6b3d
JH
19465$selecttype b;
19466#define S sizeof(*(b))
19467#define MINBITS 64
19468#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19469#define NBITS (NBYTES * 8)
19470int main() {
e6e7e605 19471 char *s = malloc(NBYTES);
b4eb6b3d
JH
19472 struct timeval t;
19473 int i;
19474 FILE* fp;
19475 int fd;
19476
e6e7e605
JH
19477 if (!s)
19478 exit(1);
b4eb6b3d
JH
19479 fclose(stdin);
19480 fp = fopen("try.c", "r");
19481 if (fp == 0)
e6e7e605 19482 exit(2);
b4eb6b3d
JH
19483 fd = fileno(fp);
19484 if (fd < 0)
e6e7e605 19485 exit(3);
b4eb6b3d
JH
19486 b = ($selecttype)s;
19487 for (i = 0; i < NBITS; i++)
19488 FD_SET(i, b);
19489 t.tv_sec = 0;
19490 t.tv_usec = 0;
19491 select(fd + 1, b, 0, 0, &t);
19492 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19493 free(s);
b4eb6b3d
JH
19494 printf("%d\n", i + 1);
19495 return 0;
19496}
19497EOCP
19498 set try
19499 if eval $compile_ok; then
5440bc8e 19500 selectminbits=`$run ./try`
b4eb6b3d
JH
19501 case "$selectminbits" in
19502 '') cat >&4 <<EOM
19503Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19504I'll play safe and guess it is $safebits bits.
b4eb6b3d 19505EOM
e6e7e605
JH
19506 selectminbits=$safebits
19507 bits="$safebits bits"
b4eb6b3d
JH
19508 ;;
19509 1) bits="1 bit" ;;
19510 *) bits="$selectminbits bits" ;;
19511 esac
19512 echo "Your select() operates on $bits at a time." >&4
19513 else
19514 rp='What is the minimum number of bits your select() operates on?'
19515 case "$byteorder" in
e6e7e605
JH
19516 12345678) dflt=64 ;;
19517 1234) dflt=32 ;;
b4eb6b3d
JH
19518 *) dflt=1 ;;
19519 esac
19520 . ./myread
19521 val=$ans
19522 selectminbits="$val"
19523 fi
19524 $rm -f try.* try
19525 ;;
19526 *) : no select, so pick a harmless default
e6e7e605 19527 selectminbits=$safebits
b4eb6b3d
JH
19528 ;;
19529 esac
19530 ;;
19531esac
19532
19533: Trace out the files included by signal.h, then look for SIGxxx names.
19534: Remove SIGARRAYSIZE used by HPUX.
19535: Remove SIGSTKSIZE used by Linux.
19536: Remove SIGSTKSZ used by Posix.
19537: Remove SIGTYP void lines used by OS2.
19538: Some cpps, like os390, dont give the file name anywhere
19539if [ "X$fieldn" = X ]; then
19540 : Just make some guesses. We check them later.
19541 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19542else
19543 xxx=`echo '#include <signal.h>' |
19544 $cppstdin $cppminus $cppflags 2>/dev/null |
19545 $grep '^[ ]*#.*include' |
a938a3bb 19546 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19547fi
19548: Check this list of files to be sure we have parsed the cpp output ok.
19549: This will also avoid potentially non-existent files, such
19550: as ../foo/bar.h
19551xxxfiles=''
19552for xx in $xxx /dev/null ; do
19553 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19554done
19555: If we have found no files, at least try signal.h
19556case "$xxxfiles" in
19557'') xxxfiles=`./findhdr signal.h` ;;
19558esac
19559xxx=`awk '
19560$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19561 print substr($2, 4, 20)
19562}
19563$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19564 print substr($3, 4, 20)
19565}' $xxxfiles`
19566: Append some common names just in case the awk scan failed.
19567xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19568xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19569xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19570xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19571xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19572
19573: generate a few handy files for later
55954f19 19574$cat > signal.c <<EOCP
b4eb6b3d
JH
19575#include <sys/types.h>
19576#include <signal.h>
55954f19
JH
19577#$i_stdlib I_STDLIB
19578#ifdef I_STDLIB
19579#include <stdlib.h>
19580#endif
b4eb6b3d
JH
19581#include <stdio.h>
19582int main() {
19583
19584/* Strange style to avoid deeply-nested #if/#else/#endif */
19585#ifndef NSIG
19586# ifdef _NSIG
19587# define NSIG (_NSIG)
19588# endif
19589#endif
19590
19591#ifndef NSIG
19592# ifdef SIGMAX
19593# define NSIG (SIGMAX+1)
19594# endif
19595#endif
19596
19597#ifndef NSIG
19598# ifdef SIG_MAX
19599# define NSIG (SIG_MAX+1)
19600# endif
19601#endif
19602
19603#ifndef NSIG
3609ea0d
JH
19604# ifdef _SIG_MAX
19605# define NSIG (_SIG_MAX+1)
19606# endif
19607#endif
19608
19609#ifndef NSIG
b4eb6b3d
JH
19610# ifdef MAXSIG
19611# define NSIG (MAXSIG+1)
19612# endif
19613#endif
19614
19615#ifndef NSIG
19616# ifdef MAX_SIG
19617# define NSIG (MAX_SIG+1)
19618# endif
19619#endif
19620
19621#ifndef NSIG
19622# ifdef SIGARRAYSIZE
3609ea0d 19623# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
19624# endif
19625#endif
19626
19627#ifndef NSIG
19628# ifdef _sys_nsig
19629# define NSIG (_sys_nsig) /* Solaris 2.5 */
19630# endif
19631#endif
19632
19633/* Default to some arbitrary number that's big enough to get most
19634 of the common signals.
19635*/
19636#ifndef NSIG
19637# define NSIG 50
19638#endif
19639
19640printf("NSIG %d\n", NSIG);
19641
19642#ifndef JUST_NSIG
19643
19644EOCP
19645
19646echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19647{
19648 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19649 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19650 printf $1; printf ");\n"
19651 printf "#endif\n"
19652}
19653END {
19654 printf "#endif /* JUST_NSIG */\n";
19655 printf "exit(0);\n}\n";
19656}
19657' >>signal.c
19658$cat >signal.awk <<'EOP'
19659BEGIN { ndups = 0 }
65197d93 19660$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 19661($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19662 if ($2 > maxsig) { maxsig = $2 }
19663 if (sig_name[$2]) {
19664 dup_name[ndups] = $1
19665 dup_num[ndups] = $2
b4eb6b3d
JH
19666 ndups++
19667 }
1ebe1ffb 19668 else {
65197d93
JH
19669 sig_name[$2] = $1
19670 sig_num[$2] = $2
b4eb6b3d
JH
19671 }
19672}
19673END {
19674 if (nsig == 0) {
19675 nsig = maxsig + 1
19676 }
19677 printf("NSIG %d\n", nsig);
19678 for (n = 1; n < nsig; n++) {
19679 if (sig_name[n]) {
19680 printf("%s %d\n", sig_name[n], sig_num[n])
19681 }
19682 else {
19683 printf("NUM%d %d\n", n, n)
19684 }
19685 }
19686 for (n = 0; n < ndups; n++) {
19687 printf("%s %d\n", dup_name[n], dup_num[n])
19688 }
19689}
19690EOP
19691$cat >signal_cmd <<EOS
19692$startsh
19693if $test -s signal.lst; then
19694 echo "Using your existing signal.lst file"
19695 exit 0
19696fi
19697xxx="$xxx"
19698EOS
19699$cat >>signal_cmd <<'EOS'
19700
19701set signal
19702if eval $compile_ok; then
1eb9ad5b 19703 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19704else
19705 echo "(I can't seem be able to compile the whole test program)" >&4
19706 echo "(I'll try it in little pieces.)" >&4
19707 set signal -DJUST_NSIG
19708 if eval $compile_ok; then
5440bc8e 19709 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
19710 $cat signal.nsg
19711 else
19712 echo "I can't seem to figure out how many signals you have." >&4
19713 echo "Guessing 50." >&4
19714 echo 'NSIG 50' > signal.nsg
19715 fi
19716 : Now look at all the signal names, one at a time.
19717 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19718 $cat > signal.c <<EOCP
19719#include <sys/types.h>
19720#include <signal.h>
19721#include <stdio.h>
19722int main() {
19723printf("$xx %d\n", SIG${xx});
19724return 0;
19725}
19726EOCP
19727 set signal
19728 if eval $compile; then
19729 echo "SIG${xx} found."
5440bc8e 19730 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
19731 else
19732 echo "SIG${xx} NOT found."
19733 fi
19734 done
19735 if $test -s signal.ls1; then
19736 $cat signal.nsg signal.ls1 |
65197d93 19737 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19738 fi
19739
19740fi
19741if $test -s signal.lst; then
19742 :
19743else
19744 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19745 echo 'kill -l' >signal
19746 set X `csh -f <signal`
19747 $rm -f signal
19748 shift
19749 case $# in
19750 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19751 esac
19752 echo $@ | $tr ' ' $trnl | \
19753 $awk '{ printf "%s %d\n", $1, ++s; }
19754 END { printf "NSIG %d\n", ++s }' >signal.lst
19755fi
19756$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19757EOS
19758chmod a+x signal_cmd
19759$eunicefix signal_cmd
19760
19761: generate list of signal names
19762echo " "
19763case "$sig_name_init" in
19764'') doinit=yes ;;
19765*) case "$sig_num_init" in
19766 ''|*,*) doinit=yes ;;
19767 esac ;;
19768esac
19769case "$doinit" in
19770yes)
19771 echo "Generating a list of signal names and numbers..." >&4
19772 . ./signal_cmd
19773 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19774 sig_name=`$awk 'BEGIN { printf "ZERO " }
19775 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19776 sig_num=`$awk 'BEGIN { printf "0 " }
19777 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19778 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
19779 !/^NSIG/ { printf "\"%s\", ", $1 }
19780 END { printf "0\n" }' signal.lst`
19781 sig_num_init=`$awk 'BEGIN { printf "0, " }
19782 !/^NSIG/ { printf "%d, ", $2}
19783 END { printf "0\n"}' signal.lst`
19784 ;;
19785esac
19786echo "The following $sig_count signals are available:"
19787echo " "
19788echo $sig_name | $awk \
19789'BEGIN { linelen = 0 }
19790{
19791 for (i = 1; i <= NF; i++) {
19792 name = "SIG" $i " "
19793 linelen = linelen + length(name)
19794 if (linelen > 70) {
19795 printf "\n"
19796 linelen = length(name)
19797 }
19798 printf "%s", name
19799 }
19800 printf "\n"
19801}'
76d3c696 19802sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
19803$rm -f signal signal.c signal.awk signal.lst signal_cmd
19804
19805echo " "
19806case "$sizetype" in
19807*_t) zzz="$sizetype" ;;
19808*) zzz="filesize" ;;
19809esac
19810echo "Checking the size of $zzz..." >&4
19811cat > try.c <<EOCP
19812#include <sys/types.h>
19813#include <stdio.h>
d1daaddf
JH
19814#$i_stdlib I_STDLIB
19815#ifdef I_STDLIB
19816#include <stdlib.h>
19817#endif
b4eb6b3d
JH
19818int main() {
19819 printf("%d\n", (int)sizeof($sizetype));
19820 exit(0);
19821}
19822EOCP
19823set try
19824if eval $compile_ok; then
5440bc8e 19825 yyy=`$run ./try`
b4eb6b3d
JH
19826 case "$yyy" in
19827 '') sizesize=4
19828 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19829 ;;
19830 *) sizesize=$yyy
19831 echo "Your $zzz size is $sizesize bytes."
19832 ;;
19833 esac
19834else
19835 sizesize=4
19836 echo "(I can't compile the test program--guessing $sizesize.)" >&4
19837fi
19838
19839
19840: check for socklen_t
19841echo " "
19842echo "Checking to see if you have socklen_t..." >&4
19843$cat >try.c <<EOCP
19844#include <sys/types.h>
19845#$d_socket HAS_SOCKET
19846#ifdef HAS_SOCKET
19847#include <sys/socket.h>
19848#endif
19849int main() { socklen_t x = 16; }
19850EOCP
19851set try
19852if eval $compile; then
19853 val="$define"
19854 echo "You have socklen_t."
19855else
19856 val="$undef"
19857 echo "You do not have socklen_t."
19858 case "$sizetype" in
19859 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19860 esac
19861fi
19862$rm -f try try.*
19863set d_socklen_t
19864eval $setvar
19865
a7710f8d
JH
19866: see if this is a socks.h system
19867set socks.h i_socks
19868eval $inhdr
19869
b4eb6b3d
JH
19870: check for type of the size argument to socket calls
19871case "$d_socket" in
19872"$define")
19873 $cat <<EOM
19874
19875Checking to see what type is the last argument of accept().
19876EOM
b4eb6b3d
JH
19877 yyy=''
19878 case "$d_socklen_t" in
19879 "$define") yyy="$yyy socklen_t"
19880 esac
19881 yyy="$yyy $sizetype int long unsigned"
19882 for xxx in $yyy; do
19883 case "$socksizetype" in
19884 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
19885 case "$usesocks" in
19886 "$define")
19887 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19888 echo "Your system accepts '$xxx *' for the last argument of accept()."
19889 socksizetype="$xxx"
19890 fi
19891 ;;
19892 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
19893 echo "Your system accepts '$xxx *' for the last argument of accept()."
19894 socksizetype="$xxx"
19895 fi
19896 ;;
19897 esac
b4eb6b3d
JH
19898 ;;
19899 esac
19900 done
19901: In case none of those worked, prompt the user.
19902 case "$socksizetype" in
19903 '') rp='What is the type for socket address structure sizes?'
19904 dflt='int'
19905 . ./myread
19906 socksizetype=$ans
19907 ;;
19908 esac
19909 ;;
19910*) : no sockets, so pick relatively harmless default
19911 socksizetype='int'
19912 ;;
19913esac
19914
19915: see what type is used for signed size_t
19916set ssize_t ssizetype int stdio.h sys/types.h
19917eval $typedef
19918dflt="$ssizetype"
5440bc8e 19919$cat > try.c <<EOM
b4eb6b3d 19920#include <stdio.h>
d1daaddf
JH
19921#$i_stdlib I_STDLIB
19922#ifdef I_STDLIB
19923#include <stdlib.h>
19924#endif
b4eb6b3d
JH
19925#include <sys/types.h>
19926#define Size_t $sizetype
19927#define SSize_t $dflt
19928int main()
19929{
19930 if (sizeof(Size_t) == sizeof(SSize_t))
19931 printf("$dflt\n");
19932 else if (sizeof(Size_t) == sizeof(int))
19933 printf("int\n");
19934 else
19935 printf("long\n");
19936 exit(0);
19937}
19938EOM
19939echo " "
5440bc8e
JH
19940set try
19941if eval $compile_ok && $run ./try > /dev/null; then
19942 ssizetype=`$run ./try`
b4eb6b3d
JH
19943 echo "I'll be using $ssizetype for functions returning a byte count." >&4
19944else
19945 $cat >&4 <<EOM
19946Help! I can't compile and run the ssize_t test program: please enlighten me!
19947(This is probably a misconfiguration in your system or libraries, and
19948you really ought to fix it. Still, I'll try anyway.)
19949
19950I need a type that is the same size as $sizetype, but is guaranteed to
19951be signed. Common values are ssize_t, int and long.
19952
19953EOM
19954 rp="What signed type is the same size as $sizetype?"
19955 . ./myread
19956 ssizetype="$ans"
19957fi
5440bc8e 19958$rm -f try try.*
b4eb6b3d
JH
19959
19960: see what type of char stdio uses.
19961echo " "
359842a5
JH
19962echo '#include <stdio.h>' > stdio.c
19963$cppstdin $cppminus < stdio.c > stdioh
aa517f50 19964if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
19965 echo "Your stdio uses unsigned chars." >&4
19966 stdchar="unsigned char"
19967else
aa517f50
JH
19968 echo "Your stdio uses signed chars." >&4
19969 stdchar="char"
b4eb6b3d 19970fi
359842a5 19971$rm -f stdio.* stdioh
b4eb6b3d 19972
b4eb6b3d
JH
19973: see what type uids are declared as in the kernel
19974echo " "
19975echo "Looking for the type for user ids returned by getuid()."
19976set uid_t uidtype xxx stdio.h sys/types.h
19977eval $typedef
19978case "$uidtype" in
19979xxx)
19980 xxx=`./findhdr sys/user.h`
19981 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19982 case $1 in
19983 unsigned) dflt="$1 $2" ;;
19984 *) dflt="$1" ;;
19985 esac
19986 ;;
19987*) dflt="$uidtype";;
19988esac
19989case "$uidtype" in
19990uid_t) echo "uid_t found." ;;
19991*) rp="What is the type for user ids returned by getuid()?"
19992 . ./myread
19993 uidtype="$ans"
19994 ;;
19995esac
19996
19997echo " "
19998case "$uidtype" in
19999*_t) zzz="$uidtype" ;;
20000*) zzz="uid" ;;
20001esac
20002echo "Checking the size of $zzz..." >&4
20003cat > try.c <<EOCP
20004#include <sys/types.h>
20005#include <stdio.h>
d1daaddf
JH
20006#$i_stdlib I_STDLIB
20007#ifdef I_STDLIB
20008#include <stdlib.h>
20009#endif
b4eb6b3d
JH
20010int main() {
20011 printf("%d\n", (int)sizeof($uidtype));
20012 exit(0);
20013}
20014EOCP
20015set try
20016if eval $compile_ok; then
5440bc8e 20017 yyy=`$run ./try`
b4eb6b3d
JH
20018 case "$yyy" in
20019 '') uidsize=4
20020 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20021 ;;
20022 *) uidsize=$yyy
20023 echo "Your $zzz is $uidsize bytes long."
20024 ;;
20025 esac
20026else
20027 uidsize=4
20028 echo "(I can't compile the test program--guessing $uidsize.)" >&4
20029fi
20030
20031echo " "
20032case "$uidtype" in
20033*_t) zzz="$uidtype" ;;
20034*) zzz="uid" ;;
20035esac
20036echo "Checking the sign of $zzz..." >&4
20037cat > try.c <<EOCP
20038#include <sys/types.h>
20039#include <stdio.h>
20040int main() {
20041 $uidtype foo = -1;
20042 if (foo < 0)
20043 printf("-1\n");
20044 else
20045 printf("1\n");
20046}
20047EOCP
20048set try
20049if eval $compile; then
5440bc8e 20050 yyy=`$run ./try`
b4eb6b3d
JH
20051 case "$yyy" in
20052 '') uidsign=1
20053 echo "(I can't execute the test program--guessing unsigned.)" >&4
20054 ;;
20055 *) uidsign=$yyy
20056 case "$uidsign" in
20057 1) echo "Your $zzz is unsigned." ;;
20058 -1) echo "Your $zzz is signed." ;;
20059 esac
20060 ;;
20061 esac
20062else
20063 uidsign=1
20064 echo "(I can't compile the test program--guessing unsigned.)" >&4
20065fi
20066
20067
20068
20069echo " "
20070$echo "Checking the format string to be used for uids..." >&4
20071
20072case "$uidsign" in
20073-1) if $test X"$uidsize" = X"$ivsize"; then
20074 uidformat="$ivdformat"
20075 else
20076 if $test X"$uidsize" = X"$longsize"; then
20077 uidformat='"ld"'
20078 else
20079 if $test X"$uidsize" = X"$intsize"; then
20080 uidformat='"d"'
20081 else
20082 if $test X"$uidsize" = X"$shortsize"; then
20083 uidformat='"hd"'
20084 fi
20085 fi
20086 fi
20087 fi
20088 ;;
20089*) if $test X"$uidsize" = X"$uvsize"; then
20090 uidformat="$uvuformat"
20091 else
20092 if $test X"$uidsize" = X"$longsize"; then
20093 uidformat='"lu"'
20094 else
20095 if $test X"$uidsize" = X"$intsize"; then
20096 uidformat='"u"'
20097 else
20098 if $test X"$uidsize" = X"$shortsize"; then
20099 uidformat='"hu"'
20100 fi
20101 fi
20102 fi
20103 fi
20104 ;;
20105esac
20106
4afd418c
MB
20107
20108case "$usesitecustomize" in
20109 $define|true|[Yy]*)
20110 usesitecustomize="$define"
20111 ;;
20112 *)
20113 usesitecustomize="$undef"
20114 ;;
20115 esac
20116
3659ebf1
JH
20117: determine compiler compiler
20118case "$yacc" in
20119'')
20120 dflt=yacc;;
20121*)
20122 dflt="$yacc";;
20123esac
20124echo " "
20125comp='yacc'
3c728e00 20126if $test -f "$byacc$_exe"; then
3659ebf1
JH
20127 dflt="$byacc"
20128 comp="byacc or $comp"
20129fi
3c728e00 20130if $test -f "$bison$_exe"; then
3659ebf1
JH
20131 comp="$comp or bison -y"
20132fi
20133rp="Which compiler compiler ($comp) shall I use?"
20134. ./myread
20135yacc="$ans"
20136case "$yacc" in
20137*bis*)
20138 case "$yacc" in
20139 *-y*) ;;
20140 *)
20141 yacc="$yacc -y"
20142 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20143 ;;
20144 esac
20145 ;;
20146esac
20147
758a5d79
JH
20148: see if this is a fp.h system
20149set fp.h i_fp
20150eval $inhdr
20151
20152: see if this is a fp_class.h system
20153set fp_class.h i_fp_class
20154eval $inhdr
20155
b4eb6b3d 20156: see if this is a ieeefp.h system
b5b9f165
JH
20157case "$i_ieeefp" in
20158'' ) set ieeefp.h i_ieeefp
20159 eval $inhdr
20160 ;;
20161esac
b4eb6b3d
JH
20162
20163: see if this is a libutil.h system
20164set libutil.h i_libutil
20165eval $inhdr
20166
b4eb6b3d
JH
20167: see if mach cthreads are available
20168if test "X$usethreads" = "X$define"; then
20169 set mach/cthreads.h i_machcthr
20170 eval $inhdr
20171else
20172 i_machcthr="$undef"
20173fi
20174
20175
20176
b4eb6b3d
JH
20177: see if this is a mntent.h system
20178set mntent.h i_mntent
20179eval $inhdr
20180
20181: see if ndbm.h is available
20182set ndbm.h t_ndbm
20183eval $inhdr
1c6861ad
JS
20184
20185case "$t_ndbm" in
20186$undef)
20187 # Some Linux distributions such as RedHat 7.1 put the
20188 # ndbm.h header in /usr/include/gdbm/ndbm.h.
20189 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 20190 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
20191 ccflags="$ccflags -I/usr/include/gdbm"
20192 cppflags="$cppflags -I/usr/include/gdbm"
20193 t_ndbm=$define
20194 fi
20195 ;;
20196esac
20197
b4eb6b3d
JH
20198case "$t_ndbm" in
20199$define)
20200 : see if dbm_open exists
20201 set dbm_open d_dbm_open
20202 eval $inlibc
20203 case "$d_dbm_open" in
20204 $undef)
20205 t_ndbm="$undef"
20206 echo "We won't be including <ndbm.h>"
20207 ;;
20208 esac
20209 ;;
20210esac
20211val="$t_ndbm"
20212set i_ndbm
20213eval $setvar
20214
20215: see if net/errno.h is available
20216val=''
20217set net/errno.h val
20218eval $inhdr
20219
20220: Unfortunately, it causes problems on some systems. Arrgh.
20221case "$val" in
20222$define)
20223 cat > try.c <<'EOM'
20224#include <stdio.h>
20225#include <errno.h>
20226#include <net/errno.h>
20227int func()
20228{
20229 return ENOTSOCK;
20230}
20231EOM
20232 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20233 echo "We'll be including <net/errno.h>." >&4
20234 else
20235 echo "We won't be including <net/errno.h>." >&4
20236 val="$undef"
20237 fi
20238 $rm -f try.* try
20239 ;;
20240esac
20241set i_neterrno
20242eval $setvar
20243
20244: see if netinet/tcp.h is available
20245set netinet/tcp.h i_netinettcp
20246eval $inhdr
20247
20248: see if this is a poll.h system
20249set poll.h i_poll
20250eval $inhdr
20251
20252: see if this is a prot.h system
20253set prot.h i_prot
20254eval $inhdr
20255
20256echo " "
ddfca5da 20257$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
20258$cat <<'EOSH' > Cppsym.know
20259a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20260AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 20261alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20262ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20263BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20264BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20265bull c cadmus clipper CMU COFF COMPILER_VERSION
20266concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 20267CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
20268Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20269FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20270GLIBC GLIBC_MINOR
20271GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
20272H3050R H3050RX hbullx20 hcx host_mips
20273hp200 hp300 hp700 HP700 hp800 hp9000
20274hp9000s200 hp9000s300 hp9000s400 hp9000s500
20275hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20276i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20277IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20278INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20279LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20280LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20281Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20282LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20283M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20284M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20285M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20286MATH_HAS_NO_SIDE_EFFECTS
20287mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20288mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20289mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20290MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20291mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20292NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20293news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20294ns32016 ns32332 ns32k nsc32000
20295OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20296pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20297pc532 pdp11 PGC PIC plexus PORTAR posix
20298POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20299POSIX_C_SOURCE POSIX_SOURCE POWER
20300PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20301riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20302SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20303sony sony_news sonyrisc sparc sparclite spectrum
20304stardent stdc STDC_EXT stratos sun sun3 sun386
20305Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20306SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20307SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20308sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20309TM3200 TM5400 TM5600
b4eb6b3d
JH
20310tower tower32 tower32_200 tower32_600 tower32_700
20311tower32_800 tower32_850 tss
20312u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20313ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20314unix UNIX95 UNIX99 unixpc unos
20315USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20316USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20317USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20318USGr4 USGr4_2
44c87379 20319Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
20320XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20321XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20322z8000
20323EOSH
20324# Maybe put other stuff here too.
20325cat <<EOSH >>Cppsym.know
20326$osname
20327EOSH
20328./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20329./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20330$cat Cppsym.know > Cppsym.c
381aa1ff 20331$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20332$rm -f Cppsym.a Cppsym.b Cppsym.c
20333cat <<EOSH > Cppsym
20334$startsh
20335if $test \$# -gt 0; then
20336 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20337 if $test -s Cppsym.got; then
20338 $rm -f Cppsym.got
20339 exit 0
20340 fi
20341 $rm -f Cppsym.got
20342 exit 1
20343else
20344 $tr " " "$trnl" | ./Cppsym.try
20345 exit 0
20346fi
20347EOSH
20348chmod +x Cppsym
20349$eunicefix Cppsym
20350cat <<EOSH > Cppsym.try
20351$startsh
20352cat <<'EOCP' > try.c
20353#include <stdio.h>
360321b3
YST
20354#if cpp_stuff == 1
20355#define STRINGIFY(a) "a"
20356#endif
20357#if cpp_stuff == 42
20358#define StGiFy(a) #a
20359#define STRINGIFY(a) StGiFy(a)
20360#endif
20361#if $cpp_stuff != 1 && $cpp_stuff != 42
20362# include "Bletch: How does this C preprocessor stringify macros?"
20363#endif
b4eb6b3d
JH
20364int main() {
20365EOCP
20366$awk \\
20367EOSH
20368cat <<'EOSH' >> Cppsym.try
20369'length($1) > 0 {
360321b3
YST
20370 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20371 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20372 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20373 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 20374}' >> try.c
2ef53570 20375echo 'return 0;}' >> try.c
b4eb6b3d
JH
20376EOSH
20377cat <<EOSH >> Cppsym.try
20378ccflags="$ccflags"
20379case "$osname-$gccversion" in
20380irix-) ccflags="\$ccflags -woff 1178" ;;
20381os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20382esac
360321b3 20383$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
20384EOSH
20385chmod +x Cppsym.try
20386$eunicefix Cppsym.try
20387./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 20388: Add in any linux cpp "predefined macros":
b6a7163e
MB
20389case "$osname::$gccversion" in
20390 *linux*::*.*)
20391 tHdrH=_tmpHdr
20392 rm -f $tHdrH'.h' $tHdrH
20393 touch $tHdrH'.h'
20394 if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20395 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20396 if [ -s $tHdrH'_cppsym.real' ]; then
20397 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20398 fi
20399 fi
20400 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20401 ;;
20402esac
b4eb6b3d
JH
20403: now check the C compiler for additional symbols
20404postprocess_cc_v=''
20405case "$osname" in
20406aix) postprocess_cc_v="|$tr , ' '" ;;
20407esac
20408$cat >ccsym <<EOS
20409$startsh
20410$cat >tmp.c <<EOF
20411extern int foo;
20412EOF
20413for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20414do
20415 case "\$i" in
20416 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20417 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20418 esac
20419done
20420$rm -f try.c
20421EOS
20422postprocess_cc_v=''
20423chmod +x ccsym
20424$eunicefix ccsym
20425./ccsym > ccsym1.raw
20426if $test -s ccsym1.raw; then
20427 $sort ccsym1.raw | $uniq >ccsym.raw
20428else
20429 mv ccsym1.raw ccsym.raw
20430fi
20431
20432$awk '/\=/ { print $0; next }
20433 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
20434$comm -13 Cppsym.true ccsym.list >ccsym.own
20435$comm -12 Cppsym.true ccsym.list >ccsym.com
20436$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
20437also=''
20438if $test -z ccsym.raw; then
20439 echo "Your C compiler doesn't seem to define any symbols!" >&4
20440 echo " "
20441 echo "However, your C preprocessor defines the following symbols:"
20442 $cat Cppsym.true
20443 ccsymbols=''
20444 cppsymbols=`$cat Cppsym.true`
20445 cppsymbols=`echo $cppsymbols`
20446 cppccsymbols="$cppsymbols"
20447else
20448 if $test -s ccsym.com; then
20449 echo "Your C compiler and pre-processor define these symbols:"
20450 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20451 also='also '
20452 symbols='ones'
20453 cppccsymbols=`$cat ccsym.com`
20454 cppccsymbols=`echo $cppccsymbols`
20455 $test "$silent" || sleep 1
20456 fi
20457 if $test -s ccsym.cpp; then
20458 $test "$also" && echo " "
20459 echo "Your C pre-processor ${also}defines the following symbols:"
20460 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20461 also='further '
20462 cppsymbols=`$cat ccsym.cpp`
20463 cppsymbols=`echo $cppsymbols`
20464 $test "$silent" || sleep 1
20465 fi
20466 if $test -s ccsym.own; then
20467 $test "$also" && echo " "
20468 echo "Your C compiler ${also}defines the following cpp symbols:"
20469 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20470 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20471 ccsymbols=`$cat ccsym.own`
20472 ccsymbols=`echo $ccsymbols`
20473 $test "$silent" || sleep 1
20474 fi
20475fi
b4eb6b3d
JH
20476
20477: see if this is a termio system
20478val="$undef"
20479val2="$undef"
20480val3="$undef"
20481if $test `./findhdr termios.h`; then
20482 set tcsetattr i_termios
20483 eval $inlibc
20484 val3="$i_termios"
20485fi
20486echo " "
20487case "$val3" in
20488"$define") echo "You have POSIX termios.h... good!" >&4;;
20489*) if ./Cppsym pyr; then
20490 case "`/bin/universe`" in
20491 ucb) if $test `./findhdr sgtty.h`; then
20492 val2="$define"
20493 echo "<sgtty.h> found." >&4
20494 else
20495 echo "System is pyramid with BSD universe."
20496 echo "<sgtty.h> not found--you could have problems." >&4
20497 fi;;
20498 *) if $test `./findhdr termio.h`; then
20499 val="$define"
20500 echo "<termio.h> found." >&4
20501 else
20502 echo "System is pyramid with USG universe."
20503 echo "<termio.h> not found--you could have problems." >&4
20504 fi;;
20505 esac
20506 elif ./usg; then
20507 if $test `./findhdr termio.h`; then
20508 echo "<termio.h> found." >&4
20509 val="$define"
20510 elif $test `./findhdr sgtty.h`; then
20511 echo "<sgtty.h> found." >&4
20512 val2="$define"
20513 else
20514echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20515 fi
20516 else
20517 if $test `./findhdr sgtty.h`; then
20518 echo "<sgtty.h> found." >&4
20519 val2="$define"
20520 elif $test `./findhdr termio.h`; then
20521 echo "<termio.h> found." >&4
20522 val="$define"
20523 else
20524echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20525 fi
20526 fi;;
20527esac
20528set i_termio; eval $setvar
20529val=$val2; set i_sgtty; eval $setvar
20530val=$val3; set i_termios; eval $setvar
20531
b4eb6b3d
JH
20532: see if stddef is available
20533set stddef.h i_stddef
20534eval $inhdr
923fc586 20535
b4eb6b3d
JH
20536: see if this is a sunmath.h system
20537set sunmath.h i_sunmath
20538eval $inhdr
5f80c64f 20539
b4eb6b3d
JH
20540: see if sys/access.h is available
20541set sys/access.h i_sysaccess
20542eval $inhdr
20543
20544: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20545set sys/filio.h i_sysfilio
20546eval $inhdr
20547echo " "
20548if $test `./findhdr sys/ioctl.h`; then
20549 val="$define"
20550 echo '<sys/ioctl.h> found.' >&4
20551else
20552 val="$undef"
20553 if $test $i_sysfilio = "$define"; then
20554 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20555 else
b4eb6b3d
JH
20556 $test $i_sgtty = "$define" && xxx="sgtty.h"
20557 $test $i_termio = "$define" && xxx="termio.h"
20558 $test $i_termios = "$define" && xxx="termios.h"
20559echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20560 fi
20561fi
20562set i_sysioctl
20563eval $setvar
20564
49a78c82
JH
20565: see if socket ioctl defs are in sys/sockio.h
20566echo " "
20567xxx=`./findhdr sys/sockio.h`
20568if $test "$xxx"; then
20569 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20570 val="$define"
20571 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20572 else
20573 val="$undef"
20574 echo "No socket ioctls found in <sys/sockio.h>." >&4
20575 fi
20576else
20577 val="$undef"
20578 $cat <<EOM
20579<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20580EOM
20581fi
20582set i_syssockio
20583eval $setvar
20584
b4eb6b3d
JH
20585
20586: see if this is a syslog.h system
20587set syslog.h i_syslog
20588eval $inhdr
20589
20590
20591: see if this is a sys/mode.h system
20592set sys/mode.h i_sysmode
20593eval $inhdr
20594
20595: see if sys/resource.h has to be included
20596set sys/resource.h i_sysresrc
20597eval $inhdr
20598
20599: see if sys/security.h is available
20600set sys/security.h i_syssecrt
20601eval $inhdr
20602
20603: see if this is a sys/statvfs.h system
20604set sys/statvfs.h i_sysstatvfs
20605eval $inhdr
20606
b4eb6b3d
JH
20607: see if this is a sys/un.h system
20608set sys/un.h i_sysun
20609eval $inhdr
20610
20611
20612: see if this is a sys/utsname.h system
20613set sys/utsname.h i_sysutsname
20614eval $inhdr
20615
20616: see if this is a syswait system
20617set sys/wait.h i_syswait
20618eval $inhdr
20619
20620: see if this is a ustat.h system
20621set ustat.h i_ustat
20622eval $inhdr
20623
20624: see if this is an utime system
20625set utime.h i_utime
20626eval $inhdr
20627
20628: see if this is a values.h system
20629set values.h i_values
20630eval $inhdr
20631
20632: see if this is a vfork system
20633case "$d_vfork" in
20634"$define")
20635 set vfork.h i_vfork
20636 eval $inhdr
20637 ;;
20638*)
20639 i_vfork="$undef"
20640 ;;
20641esac
20642
20643: see if gdbm.h is available
20644set gdbm.h t_gdbm
20645eval $inhdr
20646case "$t_gdbm" in
20647$define)
20648 : see if gdbm_open exists
20649 set gdbm_open d_gdbm_open
20650 eval $inlibc
20651 case "$d_gdbm_open" in
20652 $undef)
20653 t_gdbm="$undef"
20654 echo "We won't be including <gdbm.h>"
5f80c64f 20655 ;;
b4eb6b3d
JH
20656 esac
20657 ;;
20658esac
20659val="$t_gdbm"
20660set i_gdbm
20661eval $setvar
20662
20663echo " "
20664echo "Looking for extensions..." >&4
20665: If we are using the old config.sh, known_extensions may contain
20666: old or inaccurate or duplicate values.
20667known_extensions=''
20668nonxs_extensions=''
20669: We do not use find because it might not be available.
20670: We do not just use MANIFEST because the user may have dropped
20671: some additional extensions into the source tree and expect them
20672: to be built.
20673
20674: Function to recursively find available extensions, ignoring DynaLoader
20675: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20676find_extensions='
20677 for xxx in *; do
20678 case "$xxx" in
20679 DynaLoader|dynaload) ;;
20680 *)
20681 if $test -f $xxx/$xxx.xs; then
20682 known_extensions="$known_extensions $1$xxx";
20683 elif $test -f $xxx/Makefile.PL; then
20684 nonxs_extensions="$nonxs_extensions $1$xxx";
20685 else
20686 if $test -d $xxx -a $# -lt 10; then
20687 set $1$xxx/ $*;
6904989c 20688 cd "$xxx";
b4eb6b3d
JH
20689 eval $find_extensions;
20690 cd ..;
20691 shift;
20692 fi;
20693 fi
20694 ;;
20695 esac;
20696 done'
20697tdir=`pwd`
6904989c 20698cd "$rsrc/ext"
b4eb6b3d
JH
20699set X
20700shift
20701eval $find_extensions
4e1a6d26
AD
20702# Special case: Add in threads/shared since it is not picked up by the
20703# recursive find above (and adding in general recursive finding breaks
20704# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 20705known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
20706set X $nonxs_extensions
20707shift
20708nonxs_extensions="$*"
20709set X $known_extensions
20710shift
20711known_extensions="$*"
6904989c 20712cd "$tdir"
b4eb6b3d
JH
20713
20714: Now see which are supported on this system.
20715avail_ext=''
20716for xxx in $known_extensions ; do
20717 case "$xxx" in
20718 DB_File|db_file)
20719 case "$i_db" in
20720 $define) avail_ext="$avail_ext $xxx" ;;
20721 esac
20722 ;;
20723 GDBM_File|gdbm_fil)
20724 case "$i_gdbm" in
20725 $define) avail_ext="$avail_ext $xxx" ;;
20726 esac
20727 ;;
1d59c593 20728 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
20729 case "$i_langinfo$d_nl_langinfo" in
20730 $define$define) avail_ext="$avail_ext $xxx" ;;
20731 esac
20732 ;;
b4eb6b3d
JH
20733 NDBM_File|ndbm_fil)
20734 case "$i_ndbm" in
20735 $define)
20736 case "$osname-$use64bitint" in
0be9fa5d 20737 hpux-define)
b4eb6b3d
JH
20738 case "$libs" in
20739 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20740 esac
20741 ;;
20742 *) avail_ext="$avail_ext $xxx" ;;
20743 esac
20744 ;;
20745 esac
20746 ;;
20747 ODBM_File|odbm_fil)
20748 case "${i_dbm}${i_rpcsvcdbm}" in
20749 *"${define}"*)
20750 case "$osname-$use64bitint" in
0be9fa5d 20751 hpux-define)
b4eb6b3d
JH
20752 case "$libs" in
20753 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20754 esac
20755 ;;
20756 *) avail_ext="$avail_ext $xxx" ;;
20757 esac
20758 ;;
20759 esac
20760 ;;
20761 POSIX|posix)
20762 case "$useposix" in
20763 true|define|y) avail_ext="$avail_ext $xxx" ;;
20764 esac
20765 ;;
20766 Opcode|opcode)
20767 case "$useopcode" in
20768 true|define|y) avail_ext="$avail_ext $xxx" ;;
20769 esac
20770 ;;
20771 Socket|socket)
20772 case "$d_socket" in
4a9f028c
JH
20773 true|$define|y)
20774 case "$osname" in
20775 beos) ;; # not unless BONE
20776 *) avail_ext="$avail_ext $xxx" ;;
20777 esac
20778 ;;
b4eb6b3d
JH
20779 esac
20780 ;;
20781 Sys/Syslog|sys/syslog)
20782 : XXX syslog requires socket
20783 case "$d_socket" in
20784 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20785 esac
20786 ;;
20787 Thread|thread)
b00ec89b
AB
20788 case "$usethreads" in
20789 true|$define|y)
20790 case "$useithreads" in
20791 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20792 esac
b4eb6b3d
JH
20793 esac
20794 ;;
f9b6ed1c
AD
20795 XS/APItest|xs/apitest)
20796 # This is just for testing. Skip it unless we have dynamic loading.
20797
20798 case "$usedl" in
20799 $define) avail_ext="$avail_ext $xxx" ;;
20800 esac
20801 ;;
20802 XS/Typemap|xs/typemap)
20803 # This is just for testing. Skip it unless we have dynamic loading.
20804 case "$usedl" in
20805 $define) avail_ext="$avail_ext $xxx" ;;
20806 esac
20807 ;;
7deadc5f 20808 threads|threads/shared)
73e09c8f
JH
20809 # threads and threads::shared are special cases.
20810 # To stop people from asking "Perl 5.8.0 was supposed
20811 # to have this new fancy threads implementation but my
20812 # perl doesn't have it" and from people trying to
20813 # (re)install the threads module using CPAN.pm and
20814 # CPAN.pm then offering to reinstall Perl 5.8.0,
20815 # the threads.pm and threads/shared.pm will always be
20816 # there, croaking informatively ("you need to rebuild
20817 # all of Perl with threads, sorry") when threads haven't
20818 # been compiled in.
20819 # --jhi
20820 avail_ext="$avail_ext $xxx"
1dca008a 20821 ;;
b4eb6b3d
JH
20822 IPC/SysV|ipc/sysv)
20823 : XXX Do we need a useipcsysv variable here
20824 case "${d_msg}${d_sem}${d_shm}" in
20825 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20826 esac
20827 ;;
20828 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
20829 ;;
20830 esac
b4eb6b3d 20831done
5f80c64f 20832
b4eb6b3d
JH
20833set X $avail_ext
20834shift
20835avail_ext="$*"
5f80c64f 20836
ef0c5be8
JH
20837case "$onlyextensions" in
20838'') ;;
20839*) keepextensions=''
20840 echo "You have requested that only certains extensions be included..." >&4
20841 for i in $onlyextensions; do
20842 case " $avail_ext " in
20843 *" $i "*)
20844 echo "Keeping extension $i."
20845 keepextensions="$keepextensions $i"
20846 ;;
20847 *) echo "Ignoring extension $i." ;;
20848 esac
20849 done
20850 avail_ext="$keepextensions"
20851 ;;
20852esac
20853
20854case "$noextensions" in
20855'') ;;
20856*) keepextensions=''
20857 echo "You have requested that certain extensions be ignored..." >&4
20858 for i in $avail_ext; do
c3dadc13
AD
20859 case " $noextensions " in
20860 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
20861 *) echo "Keeping extension $i.";
20862 keepextensions="$keepextensions $i"
20863 ;;
20864 esac
20865 done
20866 avail_ext="$keepextensions"
20867 ;;
20868esac
20869
b4eb6b3d
JH
20870: Now see which nonxs extensions are supported on this system.
20871: For now assume all are.
20872nonxs_ext=''
20873for xxx in $nonxs_extensions ; do
20874 case "$xxx" in
20875 *) nonxs_ext="$nonxs_ext $xxx"
20876 ;;
20877 esac
20878done
5f80c64f 20879
b4eb6b3d
JH
20880set X $nonxs_ext
20881shift
20882nonxs_ext="$*"
20883
20884case $usedl in
20885$define)
20886 $cat <<EOM
20887A number of extensions are supplied with $package. You may choose to
20888compile these extensions for dynamic loading (the default), compile
20889them into the $package executable (static loading), or not include
20890them at all. Answer "none" to include no extensions.
20891Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
20892
20893EOM
b4eb6b3d 20894 case "$dynamic_ext" in
736accd3
YST
20895 '')
20896 : Exclude those listed in static_ext
20897 dflt=''
20898 for xxx in $avail_ext; do
20899 case " $static_ext " in
20900 *" $xxx "*) ;;
20901 *) dflt="$dflt $xxx" ;;
20902 esac
20903 done
20904 set X $dflt
20905 shift
20906 dflt="$*"
20907 ;;
b4eb6b3d
JH
20908 *) dflt="$dynamic_ext"
20909 # Perhaps we are reusing an old out-of-date config.sh.
20910 case "$hint" in
20911 previous)
20912 if test X"$dynamic_ext" != X"$avail_ext"; then
20913 $cat <<EOM
20914NOTICE: Your previous config.sh list may be incorrect.
20915The extensions now available to you are
20916 ${avail_ext}
20917but the default list from your previous config.sh is
20918 ${dynamic_ext}
9c839522 20919
b4eb6b3d
JH
20920EOM
20921 fi
9c839522
PM
20922 ;;
20923 esac
b4eb6b3d
JH
20924 ;;
20925 esac
5f80c64f 20926 case "$dflt" in
b4eb6b3d
JH
20927 '') dflt=none;;
20928 esac
20929 rp="What extensions do you wish to load dynamically?"
20930 . ./myread
20931 case "$ans" in
20932 none) dynamic_ext=' ' ;;
20933 *) dynamic_ext="$ans" ;;
5f80c64f 20934 esac
5f80c64f 20935
b4eb6b3d
JH
20936 case "$static_ext" in
20937 '')
20938 : Exclude those already listed in dynamic linking
20939 dflt=''
20940 for xxx in $avail_ext; do
20941 case " $dynamic_ext " in
20942 *" $xxx "*) ;;
20943 *) dflt="$dflt $xxx" ;;
20944 esac
20945 done
20946 set X $dflt
20947 shift
20948 dflt="$*"
20949 ;;
20950 *) dflt="$static_ext"
20951 ;;
20952 esac
9c839522 20953
b4eb6b3d
JH
20954 case "$dflt" in
20955 '') dflt=none;;
20956 esac
20957 rp="What extensions do you wish to load statically?"
20958 . ./myread
20959 case "$ans" in
20960 none) static_ext=' ' ;;
20961 *) static_ext="$ans" ;;
20962 esac
20963 ;;
20964*)
20965 $cat <<EOM
20966A number of extensions are supplied with $package. Answer "none"
20967to include no extensions.
20968Note that DynaLoader is always built and need not be mentioned here.
9c839522 20969
b4eb6b3d
JH
20970EOM
20971 case "$static_ext" in
20972 '') dflt="$avail_ext" ;;
20973 *) dflt="$static_ext"
20974 # Perhaps we are reusing an old out-of-date config.sh.
20975 case "$hint" in
20976 previous)
20977 if test X"$static_ext" != X"$avail_ext"; then
20978 $cat <<EOM
20979NOTICE: Your previous config.sh list may be incorrect.
20980The extensions now available to you are
20981 ${avail_ext}
20982but the default list from your previous config.sh is
20983 ${static_ext}
5f80c64f
JH
20984
20985EOM
b4eb6b3d
JH
20986 fi
20987 ;;
20988 esac
20989 ;;
20990 esac
20991 : Exclude those that are not xs extensions
20992 case "$dflt" in
20993 '') dflt=none;;
20994 esac
20995 rp="What extensions do you wish to include?"
20996 . ./myread
20997 case "$ans" in
20998 none) static_ext=' ' ;;
20999 *) static_ext="$ans" ;;
21000 esac
21001 ;;
5f80c64f 21002esac
f1f6834f
AD
21003#
21004# Encode is a special case. If we are building Encode as a static
21005# extension, we need to explicitly list its subextensions as well.
21006# For other nested extensions, this is handled automatically by
21007# the appropriate Makefile.PL.
21008case " $static_ext " in
21009 *" Encode "*) # Add the subextensions of Encode
21010 cd "$rsrc/ext"
21011 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21012 static_ext="$static_ext Encode/$xxx"
21013 done
21014 cd "$tdir"
21015 ;;
21016esac
5f80c64f 21017
b4eb6b3d
JH
21018set X $dynamic_ext $static_ext $nonxs_ext
21019shift
21020extensions="$*"
21021
93a2cd18
AD
21022# Sanity check: We require an extension suitable for use with
21023# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
21024# should show up as failures in the test suite, but it's helpful to
21025# catch them now.) The 'extensions' list is normally sorted
21026# alphabetically, so we need to accept either
21027# DB_File ... Fcntl ... IO ....
21028# or something like
21029# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
21030case " $extensions" in
21031*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21032*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21033*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
21034*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21035 echo "WARNING: The Perl you are building will be quite crippled." >& 4
21036 ;;
21037esac
21038
9c839522
PM
21039: Remove libraries needed only for extensions
21040: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
21041: The exception is SunOS 4.x, which needs them.
21042case "${osname}X${osvers}" in
21043sunos*X4*)
21044 perllibs="$libs"
21045 ;;
21046*) case "$usedl" in
21047 $define|true|[yY]*)
21048 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
21049 shift
21050 perllibs="$*"
21051 ;;
21052 *) perllibs="$libs"
21053 ;;
21054 esac
21055 ;;
9c839522 21056esac
5f80c64f
JH
21057
21058: Remove build directory name from cppstdin so it can be used from
21059: either the present location or the final installed location.
21060echo " "
21061: Get out of the UU directory to get correct path name.
21062cd ..
21063case "$cppstdin" in
21064`pwd`/cppstdin)
21065 echo "Stripping down cppstdin path name"
21066 cppstdin=cppstdin
21067 ;;
21068esac
21069cd UU
21070
21071: end of configuration questions
21072echo " "
21073echo "End of configuration questions."
21074echo " "
21075
21076: back to where it started
21077if test -d ../UU; then
21078 cd ..
21079fi
21080
48370efc
JH
21081: configuration may be patched via a 'config.arch' file
21082if $test -f config.arch; then
21083 echo "I see a config.arch file, loading it."
21084 . ./config.arch
21085fi
21086
5f80c64f
JH
21087: configuration may be patched via a 'config.over' file
21088if $test -f config.over; then
21089 echo " "
21090 dflt=y
21091 rp='I see a config.over file. Do you wish to load it?'
21092 . UU/myread
21093 case "$ans" in
21094 n*) echo "OK, I'll ignore it.";;
21095 *) . ./config.over
21096 echo "Configuration override changes have been loaded."
21097 ;;
21098 esac
21099fi
21100
21101: in case they want portability, strip down executable paths
21102case "$d_portable" in
21103"$define")
21104 echo " "
21105 echo "Stripping down executable paths..." >&4
21106 for file in $loclist $trylist; do
534ac15a
JH
21107 eval temp=\$$file
21108 eval $file=`basename $temp`
5f80c64f
JH
21109 done
21110 ;;
21111esac
21112
21113: create config.sh file
21114echo " "
21115echo "Creating config.sh..." >&4
21116$spitshell <<EOT >config.sh
21117$startsh
21118#
21119# This file was produced by running the Configure script. It holds all the
21120# definitions figured out by Configure. Should you modify one of these values,
21121# do not forget to propagate your changes by running "Configure -der". You may
21122# instead choose to run each of the .SH files by yourself, or "Configure -S".
21123#
21124
21125# Package name : $package
21126# Source directory : $src
21127# Configuration time: $cf_time
21128# Configured by : $cf_by
21129# Target system : $myuname
21130
21131Author='$Author'
21132Date='$Date'
21133Header='$Header'
21134Id='$Id'
21135Locker='$Locker'
21136Log='$Log'
21137Mcc='$Mcc'
21138RCSfile='$RCSfile'
21139Revision='$Revision'
21140Source='$Source'
21141State='$State'
21142_a='$_a'
21143_exe='$_exe'
21144_o='$_o'
b4eb6b3d 21145afs='$afs'
a6d26a0d 21146afsroot='$afsroot'
b4eb6b3d
JH
21147alignbytes='$alignbytes'
21148ansi2knr='$ansi2knr'
21149aphostname='$aphostname'
21150api_revision='$api_revision'
21151api_subversion='$api_subversion'
21152api_version='$api_version'
21153api_versionstring='$api_versionstring'
5f80c64f 21154ar='$ar'
b4eb6b3d
JH
21155archlib='$archlib'
21156archlibexp='$archlibexp'
21157archname64='$archname64'
21158archname='$archname'
5f80c64f 21159archobjs='$archobjs'
10bc17b6 21160asctime_r_proto='$asctime_r_proto'
5f80c64f 21161awk='$awk'
b4eb6b3d 21162baserev='$baserev'
5f80c64f 21163bash='$bash'
b4eb6b3d 21164bin='$bin'
b4eb6b3d 21165binexp='$binexp'
5f80c64f
JH
21166bison='$bison'
21167byacc='$byacc'
b4eb6b3d 21168byteorder='$byteorder'
5f80c64f 21169c='$c'
b4eb6b3d 21170castflags='$castflags'
5f80c64f
JH
21171cat='$cat'
21172cc='$cc'
21173cccdlflags='$cccdlflags'
21174ccdlflags='$ccdlflags'
21175ccflags='$ccflags'
b4eb6b3d 21176ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21177ccname='$ccname'
b4eb6b3d 21178ccsymbols='$ccsymbols'
6b356c8e 21179ccversion='$ccversion'
5f80c64f 21180cf_by='$cf_by'
b4eb6b3d 21181cf_email='$cf_email'
5f80c64f 21182cf_time='$cf_time'
b4eb6b3d 21183charsize='$charsize'
5f80c64f
JH
21184chgrp='$chgrp'
21185chmod='$chmod'
21186chown='$chown'
b4eb6b3d 21187clocktype='$clocktype'
5f80c64f
JH
21188comm='$comm'
21189compress='$compress'
21190contains='$contains'
21191cp='$cp'
21192cpio='$cpio'
21193cpp='$cpp'
b4eb6b3d
JH
21194cpp_stuff='$cpp_stuff'
21195cppccsymbols='$cppccsymbols'
5f80c64f
JH
21196cppflags='$cppflags'
21197cpplast='$cpplast'
21198cppminus='$cppminus'
21199cpprun='$cpprun'
21200cppstdin='$cppstdin'
b4eb6b3d 21201cppsymbols='$cppsymbols'
10bc17b6 21202crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21203cryptlib='$cryptlib'
5f80c64f 21204csh='$csh'
10bc17b6
JH
21205ctermid_r_proto='$ctermid_r_proto'
21206ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21207d_Gconvert='$d_Gconvert'
21208d_PRIEUldbl='$d_PRIEUldbl'
21209d_PRIFUldbl='$d_PRIFUldbl'
21210d_PRIGUldbl='$d_PRIGUldbl'
21211d_PRIXU64='$d_PRIXU64'
21212d_PRId64='$d_PRId64'
21213d_PRIeldbl='$d_PRIeldbl'
21214d_PRIfldbl='$d_PRIfldbl'
21215d_PRIgldbl='$d_PRIgldbl'
21216d_PRIi64='$d_PRIi64'
21217d_PRIo64='$d_PRIo64'
21218d_PRIu64='$d_PRIu64'
21219d_PRIx64='$d_PRIx64'
21220d_SCNfldbl='$d_SCNfldbl'
74cac757 21221d__fwalk='$d__fwalk'
b4eb6b3d
JH
21222d_access='$d_access'
21223d_accessx='$d_accessx'
55954f19 21224d_aintl='$d_aintl'
b4eb6b3d
JH
21225d_alarm='$d_alarm'
21226d_archlib='$d_archlib'
10bc17b6 21227d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21228d_atolf='$d_atolf'
21229d_atoll='$d_atoll'
0dbb1585
AL
21230d_attribute_format='$d_attribute_format'
21231d_attribute_malloc='$d_attribute_malloc'
21232d_attribute_nonnull='$d_attribute_nonnull'
21233d_attribute_noreturn='$d_attribute_noreturn'
21234d_attribute_pure='$d_attribute_pure'
21235d_attribute_unused='$d_attribute_unused'
21236d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21237d_bcmp='$d_bcmp'
21238d_bcopy='$d_bcopy'
5f80c64f 21239d_bsd='$d_bsd'
b4eb6b3d
JH
21240d_bsdgetpgrp='$d_bsdgetpgrp'
21241d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
21242d_builtin_choose_expr='$d_builtin_choose_expr'
21243d_builtin_expect='$d_builtin_expect'
b4eb6b3d
JH
21244d_bzero='$d_bzero'
21245d_casti32='$d_casti32'
21246d_castneg='$d_castneg'
21247d_charvspr='$d_charvspr'
21248d_chown='$d_chown'
21249d_chroot='$d_chroot'
21250d_chsize='$d_chsize'
758a5d79 21251d_class='$d_class'
b0a2e8e6 21252d_clearenv='$d_clearenv'
b4eb6b3d 21253d_closedir='$d_closedir'
4e0554ec 21254d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21255d_const='$d_const'
55954f19 21256d_copysignl='$d_copysignl'
b4eb6b3d 21257d_crypt='$d_crypt'
10bc17b6 21258d_crypt_r='$d_crypt_r'
b4eb6b3d 21259d_csh='$d_csh'
10bc17b6
JH
21260d_ctermid_r='$d_ctermid_r'
21261d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21262d_cuserid='$d_cuserid'
21263d_dbl_dig='$d_dbl_dig'
2ef53570 21264d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21265d_difftime='$d_difftime'
ae0e3d3b 21266d_dirfd='$d_dirfd'
b4eb6b3d
JH
21267d_dirnamlen='$d_dirnamlen'
21268d_dlerror='$d_dlerror'
5f80c64f 21269d_dlopen='$d_dlopen'
b4eb6b3d
JH
21270d_dlsymun='$d_dlsymun'
21271d_dosuid='$d_dosuid'
10bc17b6 21272d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21273d_drand48proto='$d_drand48proto'
21274d_dup2='$d_dup2'
21275d_eaccess='$d_eaccess'
21276d_endgrent='$d_endgrent'
10bc17b6 21277d_endgrent_r='$d_endgrent_r'
b4eb6b3d 21278d_endhent='$d_endhent'
10bc17b6 21279d_endhostent_r='$d_endhostent_r'
b4eb6b3d 21280d_endnent='$d_endnent'
10bc17b6 21281d_endnetent_r='$d_endnetent_r'
b4eb6b3d 21282d_endpent='$d_endpent'
10bc17b6 21283d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 21284d_endpwent='$d_endpwent'
10bc17b6 21285d_endpwent_r='$d_endpwent_r'
b4eb6b3d 21286d_endsent='$d_endsent'
10bc17b6 21287d_endservent_r='$d_endservent_r'
b4eb6b3d 21288d_eofnblk='$d_eofnblk'
5f80c64f 21289d_eunice='$d_eunice'
15b61c98 21290d_faststdio='$d_faststdio'
b363b713 21291d_fchdir='$d_fchdir'
b4eb6b3d
JH
21292d_fchmod='$d_fchmod'
21293d_fchown='$d_fchown'
21294d_fcntl='$d_fcntl'
9d9004a9 21295d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
21296d_fd_macros='$d_fd_macros'
21297d_fd_set='$d_fd_set'
21298d_fds_bits='$d_fds_bits'
21299d_fgetpos='$d_fgetpos'
758a5d79
JH
21300d_finite='$d_finite'
21301d_finitel='$d_finitel'
b4eb6b3d
JH
21302d_flexfnam='$d_flexfnam'
21303d_flock='$d_flock'
2ef53570 21304d_flockproto='$d_flockproto'
b4eb6b3d 21305d_fork='$d_fork'
758a5d79 21306d_fp_class='$d_fp_class'
b4eb6b3d 21307d_fpathconf='$d_fpathconf'
758a5d79
JH
21308d_fpclass='$d_fpclass'
21309d_fpclassify='$d_fpclassify'
21310d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21311d_fpos64_t='$d_fpos64_t'
21312d_frexpl='$d_frexpl'
21313d_fs_data_s='$d_fs_data_s'
21314d_fseeko='$d_fseeko'
21315d_fsetpos='$d_fsetpos'
21316d_fstatfs='$d_fstatfs'
21317d_fstatvfs='$d_fstatvfs'
411ab01c 21318d_fsync='$d_fsync'
b4eb6b3d
JH
21319d_ftello='$d_ftello'
21320d_ftime='$d_ftime'
dc814df1 21321d_futimes='$d_futimes'
b4eb6b3d
JH
21322d_getcwd='$d_getcwd'
21323d_getespwnam='$d_getespwnam'
21324d_getfsstat='$d_getfsstat'
21325d_getgrent='$d_getgrent'
10bc17b6
JH
21326d_getgrent_r='$d_getgrent_r'
21327d_getgrgid_r='$d_getgrgid_r'
21328d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21329d_getgrps='$d_getgrps'
21330d_gethbyaddr='$d_gethbyaddr'
21331d_gethbyname='$d_gethbyname'
21332d_gethent='$d_gethent'
21333d_gethname='$d_gethname'
10bc17b6
JH
21334d_gethostbyaddr_r='$d_gethostbyaddr_r'
21335d_gethostbyname_r='$d_gethostbyname_r'
21336d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21337d_gethostprotos='$d_gethostprotos'
4e0554ec 21338d_getitimer='$d_getitimer'
b4eb6b3d 21339d_getlogin='$d_getlogin'
10bc17b6 21340d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21341d_getmnt='$d_getmnt'
21342d_getmntent='$d_getmntent'
21343d_getnbyaddr='$d_getnbyaddr'
21344d_getnbyname='$d_getnbyname'
21345d_getnent='$d_getnent'
10bc17b6
JH
21346d_getnetbyaddr_r='$d_getnetbyaddr_r'
21347d_getnetbyname_r='$d_getnetbyname_r'
21348d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21349d_getnetprotos='$d_getnetprotos'
0c0643d0 21350d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21351d_getpbyname='$d_getpbyname'
21352d_getpbynumber='$d_getpbynumber'
21353d_getpent='$d_getpent'
21354d_getpgid='$d_getpgid'
21355d_getpgrp2='$d_getpgrp2'
21356d_getpgrp='$d_getpgrp'
21357d_getppid='$d_getppid'
21358d_getprior='$d_getprior'
10bc17b6
JH
21359d_getprotobyname_r='$d_getprotobyname_r'
21360d_getprotobynumber_r='$d_getprotobynumber_r'
21361d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21362d_getprotoprotos='$d_getprotoprotos'
21363d_getprpwnam='$d_getprpwnam'
21364d_getpwent='$d_getpwent'
10bc17b6
JH
21365d_getpwent_r='$d_getpwent_r'
21366d_getpwnam_r='$d_getpwnam_r'
21367d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21368d_getsbyname='$d_getsbyname'
21369d_getsbyport='$d_getsbyport'
21370d_getsent='$d_getsent'
10bc17b6
JH
21371d_getservbyname_r='$d_getservbyname_r'
21372d_getservbyport_r='$d_getservbyport_r'
21373d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21374d_getservprotos='$d_getservprotos'
21375d_getspnam='$d_getspnam'
10bc17b6 21376d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21377d_gettimeod='$d_gettimeod'
10bc17b6 21378d_gmtime_r='$d_gmtime_r'
5f80c64f 21379d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21380d_grpasswd='$d_grpasswd'
21381d_hasmntopt='$d_hasmntopt'
21382d_htonl='$d_htonl'
55954f19 21383d_ilogbl='$d_ilogbl'
b4eb6b3d
JH
21384d_index='$d_index'
21385d_inetaton='$d_inetaton'
21386d_int64_t='$d_int64_t'
21387d_isascii='$d_isascii'
758a5d79
JH
21388d_isfinite='$d_isfinite'
21389d_isinf='$d_isinf'
b4eb6b3d
JH
21390d_isnan='$d_isnan'
21391d_isnanl='$d_isnanl'
21392d_killpg='$d_killpg'
21393d_lchown='$d_lchown'
21394d_ldbl_dig='$d_ldbl_dig'
0a0abfba 21395d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21396d_link='$d_link'
10bc17b6 21397d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
21398d_locconv='$d_locconv'
21399d_lockf='$d_lockf'
21400d_longdbl='$d_longdbl'
21401d_longlong='$d_longlong'
21402d_lseekproto='$d_lseekproto'
21403d_lstat='$d_lstat'
21404d_madvise='$d_madvise'
7dd121ae
MB
21405d_malloc_good_size='$d_malloc_good_size'
21406d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
21407d_mblen='$d_mblen'
21408d_mbstowcs='$d_mbstowcs'
21409d_mbtowc='$d_mbtowc'
21410d_memchr='$d_memchr'
21411d_memcmp='$d_memcmp'
21412d_memcpy='$d_memcpy'
21413d_memmove='$d_memmove'
21414d_memset='$d_memset'
21415d_mkdir='$d_mkdir'
21416d_mkdtemp='$d_mkdtemp'
21417d_mkfifo='$d_mkfifo'
21418d_mkstemp='$d_mkstemp'
21419d_mkstemps='$d_mkstemps'
21420d_mktime='$d_mktime'
21421d_mmap='$d_mmap'
21422d_modfl='$d_modfl'
e67aeab1 21423d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21424d_modflproto='$d_modflproto'
b4eb6b3d
JH
21425d_mprotect='$d_mprotect'
21426d_msg='$d_msg'
21427d_msg_ctrunc='$d_msg_ctrunc'
21428d_msg_dontroute='$d_msg_dontroute'
21429d_msg_oob='$d_msg_oob'
21430d_msg_peek='$d_msg_peek'
21431d_msg_proxy='$d_msg_proxy'
21432d_msgctl='$d_msgctl'
21433d_msgget='$d_msgget'
4e0554ec 21434d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21435d_msgrcv='$d_msgrcv'
21436d_msgsnd='$d_msgsnd'
21437d_msync='$d_msync'
21438d_munmap='$d_munmap'
21439d_mymalloc='$d_mymalloc'
21440d_nice='$d_nice'
2765b840 21441d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21442d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 21443d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21444d_off64_t='$d_off64_t'
21445d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21446d_oldpthreads='$d_oldpthreads'
21447d_oldsock='$d_oldsock'
21448d_open3='$d_open3'
21449d_pathconf='$d_pathconf'
21450d_pause='$d_pause'
21451d_perl_otherlibdirs='$d_perl_otherlibdirs'
21452d_phostname='$d_phostname'
21453d_pipe='$d_pipe'
21454d_poll='$d_poll'
5f80c64f 21455d_portable='$d_portable'
c7aff470 21456d_procselfexe='$d_procselfexe'
d6483fcc 21457d_pthread_atfork='$d_pthread_atfork'
58d975c3 21458d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21459d_pthread_yield='$d_pthread_yield'
21460d_pwage='$d_pwage'
21461d_pwchange='$d_pwchange'
21462d_pwclass='$d_pwclass'
21463d_pwcomment='$d_pwcomment'
21464d_pwexpire='$d_pwexpire'
21465d_pwgecos='$d_pwgecos'
21466d_pwpasswd='$d_pwpasswd'
21467d_pwquota='$d_pwquota'
21468d_qgcvt='$d_qgcvt'
21469d_quad='$d_quad'
10bc17b6
JH
21470d_random_r='$d_random_r'
21471d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21472d_readdir='$d_readdir'
10bc17b6 21473d_readdir_r='$d_readdir_r'
b4eb6b3d 21474d_readlink='$d_readlink'
4e0554ec
JH
21475d_readv='$d_readv'
21476d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21477d_rename='$d_rename'
21478d_rewinddir='$d_rewinddir'
21479d_rmdir='$d_rmdir'
21480d_safebcpy='$d_safebcpy'
21481d_safemcpy='$d_safemcpy'
21482d_sanemcmp='$d_sanemcmp'
ef9f17be 21483d_sbrkproto='$d_sbrkproto'
55954f19 21484d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21485d_sched_yield='$d_sched_yield'
21486d_scm_rights='$d_scm_rights'
21487d_seekdir='$d_seekdir'
21488d_select='$d_select'
21489d_sem='$d_sem'
21490d_semctl='$d_semctl'
21491d_semctl_semid_ds='$d_semctl_semid_ds'
21492d_semctl_semun='$d_semctl_semun'
21493d_semget='$d_semget'
21494d_semop='$d_semop'
4e0554ec 21495d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21496d_setegid='$d_setegid'
21497d_seteuid='$d_seteuid'
21498d_setgrent='$d_setgrent'
10bc17b6 21499d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21500d_setgrps='$d_setgrps'
21501d_sethent='$d_sethent'
10bc17b6 21502d_sethostent_r='$d_sethostent_r'
4e0554ec 21503d_setitimer='$d_setitimer'
b4eb6b3d
JH
21504d_setlinebuf='$d_setlinebuf'
21505d_setlocale='$d_setlocale'
10bc17b6 21506d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21507d_setnent='$d_setnent'
10bc17b6 21508d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21509d_setpent='$d_setpent'
21510d_setpgid='$d_setpgid'
21511d_setpgrp2='$d_setpgrp2'
21512d_setpgrp='$d_setpgrp'
21513d_setprior='$d_setprior'
21514d_setproctitle='$d_setproctitle'
10bc17b6 21515d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21516d_setpwent='$d_setpwent'
10bc17b6 21517d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21518d_setregid='$d_setregid'
21519d_setresgid='$d_setresgid'
21520d_setresuid='$d_setresuid'
21521d_setreuid='$d_setreuid'
21522d_setrgid='$d_setrgid'
21523d_setruid='$d_setruid'
21524d_setsent='$d_setsent'
10bc17b6 21525d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21526d_setsid='$d_setsid'
21527d_setvbuf='$d_setvbuf'
21528d_sfio='$d_sfio'
21529d_shm='$d_shm'
21530d_shmat='$d_shmat'
21531d_shmatprototype='$d_shmatprototype'
21532d_shmctl='$d_shmctl'
21533d_shmdt='$d_shmdt'
21534d_shmget='$d_shmget'
21535d_sigaction='$d_sigaction'
983dbef6 21536d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21537d_sigsetjmp='$d_sigsetjmp'
4f5da3e9 21538d_snprintf='$d_snprintf'
49a78c82 21539d_sockatmark='$d_sockatmark'
2ef53570 21540d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21541d_socket='$d_socket'
21542d_socklen_t='$d_socklen_t'
21543d_sockpair='$d_sockpair'
21544d_socks5_init='$d_socks5_init'
360321b3 21545d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 21546d_sqrtl='$d_sqrtl'
10bc17b6
JH
21547d_srand48_r='$d_srand48_r'
21548d_srandom_r='$d_srandom_r'
eef837ea 21549d_sresgproto='$d_sresgproto'
640374d0 21550d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21551d_statblks='$d_statblks'
21552d_statfs_f_flags='$d_statfs_f_flags'
21553d_statfs_s='$d_statfs_s'
21554d_statvfs='$d_statvfs'
21555d_stdio_cnt_lval='$d_stdio_cnt_lval'
21556d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21557d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21558d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21559d_stdio_stream_array='$d_stdio_stream_array'
21560d_stdiobase='$d_stdiobase'
21561d_stdstdio='$d_stdstdio'
21562d_strchr='$d_strchr'
21563d_strcoll='$d_strcoll'
21564d_strctcpy='$d_strctcpy'
21565d_strerrm='$d_strerrm'
21566d_strerror='$d_strerror'
10bc17b6 21567d_strerror_r='$d_strerror_r'
b3c85772 21568d_strftime='$d_strftime'
08c92000
MB
21569d_strlcat='$d_strlcat'
21570d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21571d_strtod='$d_strtod'
21572d_strtol='$d_strtol'
21573d_strtold='$d_strtold'
21574d_strtoll='$d_strtoll'
28e5dec8 21575d_strtoq='$d_strtoq'
b4eb6b3d
JH
21576d_strtoul='$d_strtoul'
21577d_strtoull='$d_strtoull'
21578d_strtouq='$d_strtouq'
21579d_strxfrm='$d_strxfrm'
21580d_suidsafe='$d_suidsafe'
21581d_symlink='$d_symlink'
21582d_syscall='$d_syscall'
2ef53570 21583d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21584d_sysconf='$d_sysconf'
21585d_sysernlst='$d_sysernlst'
21586d_syserrlst='$d_syserrlst'
21587d_system='$d_system'
21588d_tcgetpgrp='$d_tcgetpgrp'
21589d_tcsetpgrp='$d_tcsetpgrp'
21590d_telldir='$d_telldir'
21591d_telldirproto='$d_telldirproto'
21592d_time='$d_time'
21593d_times='$d_times'
14b90194
JH
21594d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21595d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21596d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21597d_truncate='$d_truncate'
10bc17b6 21598d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21599d_tzname='$d_tzname'
4e0554ec
JH
21600d_u32align='$d_u32align'
21601d_ualarm='$d_ualarm'
b4eb6b3d
JH
21602d_umask='$d_umask'
21603d_uname='$d_uname'
21604d_union_semun='$d_union_semun'
758a5d79 21605d_unordered='$d_unordered'
bdf33aa7 21606d_unsetenv='$d_unsetenv'
4e0554ec 21607d_usleep='$d_usleep'
2ef53570 21608d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21609d_ustat='$d_ustat'
21610d_vendorarch='$d_vendorarch'
21611d_vendorbin='$d_vendorbin'
21612d_vendorlib='$d_vendorlib'
6e1038e0 21613d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21614d_vfork='$d_vfork'
21615d_void_closedir='$d_void_closedir'
21616d_voidsig='$d_voidsig'
21617d_voidtty='$d_voidtty'
21618d_volatile='$d_volatile'
21619d_vprintf='$d_vprintf'
4f5da3e9 21620d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
21621d_wait4='$d_wait4'
21622d_waitpid='$d_waitpid'
21623d_wcstombs='$d_wcstombs'
21624d_wctomb='$d_wctomb'
4e0554ec 21625d_writev='$d_writev'
5f80c64f
JH
21626d_xenix='$d_xenix'
21627date='$date'
b4eb6b3d
JH
21628db_hashtype='$db_hashtype'
21629db_prefixtype='$db_prefixtype'
640374d0
JH
21630db_version_major='$db_version_major'
21631db_version_minor='$db_version_minor'
21632db_version_patch='$db_version_patch'
b4eb6b3d
JH
21633defvoidused='$defvoidused'
21634direntrytype='$direntrytype'
21635dlext='$dlext'
5f80c64f 21636dlsrc='$dlsrc'
b4eb6b3d
JH
21637doublesize='$doublesize'
21638drand01='$drand01'
10bc17b6 21639drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21640dynamic_ext='$dynamic_ext'
21641eagain='$eagain'
21642ebcdic='$ebcdic'
5f80c64f
JH
21643echo='$echo'
21644egrep='$egrep'
21645emacs='$emacs'
10bc17b6
JH
21646endgrent_r_proto='$endgrent_r_proto'
21647endhostent_r_proto='$endhostent_r_proto'
21648endnetent_r_proto='$endnetent_r_proto'
21649endprotoent_r_proto='$endprotoent_r_proto'
21650endpwent_r_proto='$endpwent_r_proto'
21651endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21652eunicefix='$eunicefix'
21653exe_ext='$exe_ext'
21654expr='$expr'
b4eb6b3d 21655extensions='$extensions'
6fcddf3b 21656extras='$extras'
b4eb6b3d
JH
21657fflushNULL='$fflushNULL'
21658fflushall='$fflushall'
5f80c64f
JH
21659find='$find'
21660firstmakefile='$firstmakefile'
21661flex='$flex'
b4eb6b3d
JH
21662fpossize='$fpossize'
21663fpostype='$fpostype'
21664freetype='$freetype'
5440bc8e 21665from='$from'
b4eb6b3d
JH
21666full_ar='$full_ar'
21667full_csh='$full_csh'
21668full_sed='$full_sed'
2d736872 21669gccansipedantic='$gccansipedantic'
5b463ca7 21670gccosandvers='$gccosandvers'
5f80c64f 21671gccversion='$gccversion'
10bc17b6
JH
21672getgrent_r_proto='$getgrent_r_proto'
21673getgrgid_r_proto='$getgrgid_r_proto'
21674getgrnam_r_proto='$getgrnam_r_proto'
21675gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21676gethostbyname_r_proto='$gethostbyname_r_proto'
21677gethostent_r_proto='$gethostent_r_proto'
21678getlogin_r_proto='$getlogin_r_proto'
21679getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21680getnetbyname_r_proto='$getnetbyname_r_proto'
21681getnetent_r_proto='$getnetent_r_proto'
21682getprotobyname_r_proto='$getprotobyname_r_proto'
21683getprotobynumber_r_proto='$getprotobynumber_r_proto'
21684getprotoent_r_proto='$getprotoent_r_proto'
21685getpwent_r_proto='$getpwent_r_proto'
21686getpwnam_r_proto='$getpwnam_r_proto'
21687getpwuid_r_proto='$getpwuid_r_proto'
21688getservbyname_r_proto='$getservbyname_r_proto'
21689getservbyport_r_proto='$getservbyport_r_proto'
21690getservent_r_proto='$getservent_r_proto'
21691getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
21692gidformat='$gidformat'
21693gidsign='$gidsign'
21694gidsize='$gidsize'
21695gidtype='$gidtype'
5f80c64f 21696glibpth='$glibpth'
3c728e00 21697gmake='$gmake'
10bc17b6 21698gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 21699gnulibc_version='$gnulibc_version'
5f80c64f 21700grep='$grep'
b4eb6b3d
JH
21701groupcat='$groupcat'
21702groupstype='$groupstype'
5f80c64f 21703gzip='$gzip'
b4eb6b3d
JH
21704h_fcntl='$h_fcntl'
21705h_sysfile='$h_sysfile'
5f80c64f 21706hint='$hint'
b4eb6b3d 21707hostcat='$hostcat'
6e1038e0
MB
21708html1dir='$html1dir'
21709html1direxp='$html1direxp'
21710html3dir='$html3dir'
21711html3direxp='$html3direxp'
b4eb6b3d
JH
21712i16size='$i16size'
21713i16type='$i16type'
21714i32size='$i32size'
21715i32type='$i32type'
21716i64size='$i64size'
21717i64type='$i64type'
21718i8size='$i8size'
21719i8type='$i8type'
21720i_arpainet='$i_arpainet'
21721i_bsdioctl='$i_bsdioctl'
10bc17b6 21722i_crypt='$i_crypt'
b4eb6b3d
JH
21723i_db='$i_db'
21724i_dbm='$i_dbm'
21725i_dirent='$i_dirent'
5f80c64f 21726i_dld='$i_dld'
b4eb6b3d
JH
21727i_dlfcn='$i_dlfcn'
21728i_fcntl='$i_fcntl'
21729i_float='$i_float'
758a5d79
JH
21730i_fp='$i_fp'
21731i_fp_class='$i_fp_class'
b4eb6b3d
JH
21732i_gdbm='$i_gdbm'
21733i_grp='$i_grp'
b4eb6b3d
JH
21734i_ieeefp='$i_ieeefp'
21735i_inttypes='$i_inttypes'
2765b840 21736i_langinfo='$i_langinfo'
b4eb6b3d
JH
21737i_libutil='$i_libutil'
21738i_limits='$i_limits'
21739i_locale='$i_locale'
21740i_machcthr='$i_machcthr'
21741i_malloc='$i_malloc'
21742i_math='$i_math'
21743i_memory='$i_memory'
21744i_mntent='$i_mntent'
21745i_ndbm='$i_ndbm'
21746i_netdb='$i_netdb'
21747i_neterrno='$i_neterrno'
21748i_netinettcp='$i_netinettcp'
21749i_niin='$i_niin'
21750i_poll='$i_poll'
21751i_prot='$i_prot'
21752i_pthread='$i_pthread'
21753i_pwd='$i_pwd'
21754i_rpcsvcdbm='$i_rpcsvcdbm'
21755i_sfio='$i_sfio'
21756i_sgtty='$i_sgtty'
21757i_shadow='$i_shadow'
21758i_socks='$i_socks'
21759i_stdarg='$i_stdarg'
21760i_stddef='$i_stddef'
21761i_stdlib='$i_stdlib'
21762i_string='$i_string'
21763i_sunmath='$i_sunmath'
21764i_sysaccess='$i_sysaccess'
21765i_sysdir='$i_sysdir'
21766i_sysfile='$i_sysfile'
21767i_sysfilio='$i_sysfilio'
21768i_sysin='$i_sysin'
21769i_sysioctl='$i_sysioctl'
21770i_syslog='$i_syslog'
21771i_sysmman='$i_sysmman'
21772i_sysmode='$i_sysmode'
21773i_sysmount='$i_sysmount'
21774i_sysndir='$i_sysndir'
21775i_sysparam='$i_sysparam'
21776i_sysresrc='$i_sysresrc'
21777i_syssecrt='$i_syssecrt'
21778i_sysselct='$i_sysselct'
21779i_syssockio='$i_syssockio'
21780i_sysstat='$i_sysstat'
21781i_sysstatfs='$i_sysstatfs'
21782i_sysstatvfs='$i_sysstatvfs'
21783i_systime='$i_systime'
21784i_systimek='$i_systimek'
21785i_systimes='$i_systimes'
21786i_systypes='$i_systypes'
21787i_sysuio='$i_sysuio'
21788i_sysun='$i_sysun'
21789i_sysutsname='$i_sysutsname'
21790i_sysvfs='$i_sysvfs'
21791i_syswait='$i_syswait'
21792i_termio='$i_termio'
21793i_termios='$i_termios'
21794i_time='$i_time'
21795i_unistd='$i_unistd'
21796i_ustat='$i_ustat'
21797i_utime='$i_utime'
21798i_values='$i_values'
21799i_varargs='$i_varargs'
21800i_varhdr='$i_varhdr'
21801i_vfork='$i_vfork'
5f80c64f 21802ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
21803inc_version_list='$inc_version_list'
21804inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
21805incpath='$incpath'
21806inews='$inews'
b4eb6b3d
JH
21807installarchlib='$installarchlib'
21808installbin='$installbin'
6e1038e0
MB
21809installhtml1dir='$installhtml1dir'
21810installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
21811installman1dir='$installman1dir'
21812installman3dir='$installman3dir'
21813installprefix='$installprefix'
21814installprefixexp='$installprefixexp'
21815installprivlib='$installprivlib'
21816installscript='$installscript'
21817installsitearch='$installsitearch'
21818installsitebin='$installsitebin'
8d2cbf27
JH
21819installsitehtml1dir='$installsitehtml1dir'
21820installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 21821installsitelib='$installsitelib'
91e123a8
JH
21822installsiteman1dir='$installsiteman1dir'
21823installsiteman3dir='$installsiteman3dir'
6e1038e0 21824installsitescript='$installsitescript'
b4eb6b3d
JH
21825installstyle='$installstyle'
21826installusrbinperl='$installusrbinperl'
21827installvendorarch='$installvendorarch'
21828installvendorbin='$installvendorbin'
8d2cbf27
JH
21829installvendorhtml1dir='$installvendorhtml1dir'
21830installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 21831installvendorlib='$installvendorlib'
91e123a8
JH
21832installvendorman1dir='$installvendorman1dir'
21833installvendorman3dir='$installvendorman3dir'
6e1038e0 21834installvendorscript='$installvendorscript'
b4eb6b3d 21835intsize='$intsize'
4b661809 21836issymlink='$issymlink'
b4eb6b3d
JH
21837ivdformat='$ivdformat'
21838ivsize='$ivsize'
21839ivtype='$ivtype'
21840known_extensions='$known_extensions'
5f80c64f 21841ksh='$ksh'
5f80c64f
JH
21842ld='$ld'
21843lddlflags='$lddlflags'
21844ldflags='$ldflags'
b4eb6b3d
JH
21845ldflags_uselargefiles='$ldflags_uselargefiles'
21846ldlibpthname='$ldlibpthname'
5f80c64f
JH
21847less='$less'
21848lib_ext='$lib_ext'
21849libc='$libc'
b4eb6b3d 21850libperl='$libperl'
5f80c64f
JH
21851libpth='$libpth'
21852libs='$libs'
43999f95
JH
21853libsdirs='$libsdirs'
21854libsfiles='$libsfiles'
21855libsfound='$libsfound'
13b3f787 21856libspath='$libspath'
5f80c64f 21857libswanted='$libswanted'
b4eb6b3d 21858libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
21859line='$line'
21860lint='$lint'
21861lkflags='$lkflags'
21862ln='$ln'
21863lns='$lns'
10bc17b6 21864localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
21865locincpth='$locincpth'
21866loclibpth='$loclibpth'
b4eb6b3d
JH
21867longdblsize='$longdblsize'
21868longlongsize='$longlongsize'
21869longsize='$longsize'
5f80c64f
JH
21870lp='$lp'
21871lpr='$lpr'
21872ls='$ls'
b4eb6b3d
JH
21873lseeksize='$lseeksize'
21874lseektype='$lseektype'
5f80c64f
JH
21875mail='$mail'
21876mailx='$mailx'
21877make='$make'
21878make_set_make='$make_set_make'
b4eb6b3d
JH
21879mallocobj='$mallocobj'
21880mallocsrc='$mallocsrc'
21881malloctype='$malloctype'
21882man1dir='$man1dir'
21883man1direxp='$man1direxp'
21884man1ext='$man1ext'
21885man3dir='$man3dir'
21886man3direxp='$man3direxp'
21887man3ext='$man3ext'
5f80c64f 21888mips_type='$mips_type'
5129fff4 21889mistrustnm='$mistrustnm'
5f80c64f 21890mkdir='$mkdir'
b4eb6b3d
JH
21891mmaptype='$mmaptype'
21892modetype='$modetype'
5f80c64f 21893more='$more'
b4eb6b3d 21894multiarch='$multiarch'
5f80c64f 21895mv='$mv'
b4eb6b3d
JH
21896myarchname='$myarchname'
21897mydomain='$mydomain'
21898myhostname='$myhostname'
5f80c64f
JH
21899myuname='$myuname'
21900n='$n'
2cc61e15 21901need_va_copy='$need_va_copy'
b4eb6b3d
JH
21902netdb_hlen_type='$netdb_hlen_type'
21903netdb_host_type='$netdb_host_type'
21904netdb_name_type='$netdb_name_type'
21905netdb_net_type='$netdb_net_type'
5f80c64f
JH
21906nm='$nm'
21907nm_opt='$nm_opt'
21908nm_so_opt='$nm_so_opt'
b4eb6b3d 21909nonxs_ext='$nonxs_ext'
5f80c64f 21910nroff='$nroff'
b4eb6b3d
JH
21911nvEUformat='$nvEUformat'
21912nvFUformat='$nvFUformat'
21913nvGUformat='$nvGUformat'
53133ed1 21914nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
21915nveformat='$nveformat'
21916nvfformat='$nvfformat'
21917nvgformat='$nvgformat'
21918nvsize='$nvsize'
21919nvtype='$nvtype'
21920o_nonblock='$o_nonblock'
5f80c64f 21921obj_ext='$obj_ext'
b4eb6b3d 21922old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 21923optimize='$optimize'
b4eb6b3d 21924orderlib='$orderlib'
5f80c64f
JH
21925osname='$osname'
21926osvers='$osvers'
b4eb6b3d 21927otherlibdirs='$otherlibdirs'
5f80c64f 21928package='$package'
b4eb6b3d
JH
21929pager='$pager'
21930passcat='$passcat'
21931patchlevel='$patchlevel'
5f80c64f 21932path_sep='$path_sep'
b4eb6b3d 21933perl5='$perl5'
5f80c64f 21934perl='$perl'
151e6568 21935perl_patchlevel='$perl_patchlevel'
b4eb6b3d 21936perladmin='$perladmin'
9c839522 21937perllibs='$perllibs'
b4eb6b3d 21938perlpath='$perlpath'
5f80c64f 21939pg='$pg'
b4eb6b3d
JH
21940phostname='$phostname'
21941pidtype='$pidtype'
5f80c64f
JH
21942plibpth='$plibpth'
21943pmake='$pmake'
21944pr='$pr'
b4eb6b3d
JH
21945prefix='$prefix'
21946prefixexp='$prefixexp'
21947privlib='$privlib'
21948privlibexp='$privlibexp'
f24dbf84 21949procselfexe='$procselfexe'
b4eb6b3d
JH
21950prototype='$prototype'
21951ptrsize='$ptrsize'
21952quadkind='$quadkind'
21953quadtype='$quadtype'
21954randbits='$randbits'
21955randfunc='$randfunc'
10bc17b6 21956random_r_proto='$random_r_proto'
b4eb6b3d
JH
21957randseedtype='$randseedtype'
21958ranlib='$ranlib'
21959rd_nodata='$rd_nodata'
10bc17b6
JH
21960readdir64_r_proto='$readdir64_r_proto'
21961readdir_r_proto='$readdir_r_proto'
b4eb6b3d 21962revision='$revision'
5f80c64f
JH
21963rm='$rm'
21964rmail='$rmail'
5440bc8e 21965run='$run'
5f80c64f 21966runnm='$runnm'
b4eb6b3d
JH
21967sPRIEUldbl='$sPRIEUldbl'
21968sPRIFUldbl='$sPRIFUldbl'
21969sPRIGUldbl='$sPRIGUldbl'
21970sPRIXU64='$sPRIXU64'
21971sPRId64='$sPRId64'
21972sPRIeldbl='$sPRIeldbl'
21973sPRIfldbl='$sPRIfldbl'
21974sPRIgldbl='$sPRIgldbl'
21975sPRIi64='$sPRIi64'
21976sPRIo64='$sPRIo64'
21977sPRIu64='$sPRIu64'
21978sPRIx64='$sPRIx64'
21979sSCNfldbl='$sSCNfldbl'
21980sched_yield='$sched_yield'
21981scriptdir='$scriptdir'
21982scriptdirexp='$scriptdirexp'
5f80c64f 21983sed='$sed'
b4eb6b3d
JH
21984seedfunc='$seedfunc'
21985selectminbits='$selectminbits'
21986selecttype='$selecttype'
5f80c64f 21987sendmail='$sendmail'
10bc17b6
JH
21988setgrent_r_proto='$setgrent_r_proto'
21989sethostent_r_proto='$sethostent_r_proto'
21990setlocale_r_proto='$setlocale_r_proto'
21991setnetent_r_proto='$setnetent_r_proto'
21992setprotoent_r_proto='$setprotoent_r_proto'
21993setpwent_r_proto='$setpwent_r_proto'
21994setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
21995sh='$sh'
21996shar='$shar'
21997sharpbang='$sharpbang'
b4eb6b3d
JH
21998shmattype='$shmattype'
21999shortsize='$shortsize'
22000shrpenv='$shrpenv'
5f80c64f 22001shsharp='$shsharp'
b4eb6b3d
JH
22002sig_count='$sig_count'
22003sig_name='$sig_name'
22004sig_name_init='$sig_name_init'
22005sig_num='$sig_num'
22006sig_num_init='$sig_num_init'
76d3c696 22007sig_size='$sig_size'
b4eb6b3d
JH
22008signal_t='$signal_t'
22009sitearch='$sitearch'
22010sitearchexp='$sitearchexp'
22011sitebin='$sitebin'
22012sitebinexp='$sitebinexp'
8d2cbf27
JH
22013sitehtml1dir='$sitehtml1dir'
22014sitehtml1direxp='$sitehtml1direxp'
22015sitehtml3dir='$sitehtml3dir'
22016sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
22017sitelib='$sitelib'
22018sitelib_stem='$sitelib_stem'
22019sitelibexp='$sitelibexp'
91e123a8
JH
22020siteman1dir='$siteman1dir'
22021siteman1direxp='$siteman1direxp'
22022siteman3dir='$siteman3dir'
22023siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
22024siteprefix='$siteprefix'
22025siteprefixexp='$siteprefixexp'
6e1038e0
MB
22026sitescript='$sitescript'
22027sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
22028sizesize='$sizesize'
22029sizetype='$sizetype'
5f80c64f
JH
22030sleep='$sleep'
22031smail='$smail'
5f80c64f 22032so='$so'
b4eb6b3d
JH
22033sockethdr='$sockethdr'
22034socketlib='$socketlib'
22035socksizetype='$socksizetype'
5f80c64f
JH
22036sort='$sort'
22037spackage='$spackage'
22038spitshell='$spitshell'
10bc17b6
JH
22039srand48_r_proto='$srand48_r_proto'
22040srandom_r_proto='$srandom_r_proto'
5f80c64f 22041src='$src'
b4eb6b3d
JH
22042ssizetype='$ssizetype'
22043startperl='$startperl'
5f80c64f 22044startsh='$startsh'
b4eb6b3d
JH
22045static_ext='$static_ext'
22046stdchar='$stdchar'
22047stdio_base='$stdio_base'
22048stdio_bufsiz='$stdio_bufsiz'
22049stdio_cnt='$stdio_cnt'
22050stdio_filbuf='$stdio_filbuf'
22051stdio_ptr='$stdio_ptr'
22052stdio_stream_array='$stdio_stream_array'
10bc17b6 22053strerror_r_proto='$strerror_r_proto'
b4eb6b3d 22054strings='$strings'
5f80c64f 22055submit='$submit'
b4eb6b3d
JH
22056subversion='$subversion'
22057sysman='$sysman'
5f80c64f
JH
22058tail='$tail'
22059tar='$tar'
5440bc8e 22060targetarch='$targetarch'
5f80c64f
JH
22061tbl='$tbl'
22062tee='$tee'
22063test='$test'
b4eb6b3d
JH
22064timeincl='$timeincl'
22065timetype='$timetype'
10bc17b6 22066tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 22067to='$to'
5f80c64f
JH
22068touch='$touch'
22069tr='$tr'
22070trnl='$trnl'
22071troff='$troff'
10bc17b6 22072ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
22073u16size='$u16size'
22074u16type='$u16type'
22075u32size='$u32size'
22076u32type='$u32type'
22077u64size='$u64size'
22078u64type='$u64type'
22079u8size='$u8size'
22080u8type='$u8type'
22081uidformat='$uidformat'
22082uidsign='$uidsign'
22083uidsize='$uidsize'
22084uidtype='$uidtype'
5f80c64f
JH
22085uname='$uname'
22086uniq='$uniq'
b4eb6b3d
JH
22087uquadtype='$uquadtype'
22088use5005threads='$use5005threads'
22089use64bitall='$use64bitall'
22090use64bitint='$use64bitint'
5440bc8e 22091usecrosscompile='$usecrosscompile'
5f80c64f 22092usedl='$usedl'
15b61c98 22093usefaststdio='$usefaststdio'
b4eb6b3d
JH
22094useithreads='$useithreads'
22095uselargefiles='$uselargefiles'
22096uselongdouble='$uselongdouble'
19a100ff 22097usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
22098usemorebits='$usemorebits'
22099usemultiplicity='$usemultiplicity'
22100usemymalloc='$usemymalloc'
5f80c64f 22101usenm='$usenm'
b4eb6b3d
JH
22102useopcode='$useopcode'
22103useperlio='$useperlio'
22104useposix='$useposix'
9514c62b 22105usereentrant='$usereentrant'
d51aaa9d 22106userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
22107usesfio='$usesfio'
22108useshrplib='$useshrplib'
5f106f9c 22109usesitecustomize='$usesitecustomize'
29209bc5 22110usesocks='$usesocks'
b4eb6b3d
JH
22111usethreads='$usethreads'
22112usevendorprefix='$usevendorprefix'
22113usevfork='$usevfork'
5f80c64f
JH
22114usrinc='$usrinc'
22115uuname='$uuname'
b4eb6b3d
JH
22116uvXUformat='$uvXUformat'
22117uvoformat='$uvoformat'
22118uvsize='$uvsize'
22119uvtype='$uvtype'
22120uvuformat='$uvuformat'
22121uvxformat='$uvxformat'
22122vendorarch='$vendorarch'
22123vendorarchexp='$vendorarchexp'
22124vendorbin='$vendorbin'
22125vendorbinexp='$vendorbinexp'
8d2cbf27
JH
22126vendorhtml1dir='$vendorhtml1dir'
22127vendorhtml1direxp='$vendorhtml1direxp'
22128vendorhtml3dir='$vendorhtml3dir'
22129vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
22130vendorlib='$vendorlib'
22131vendorlib_stem='$vendorlib_stem'
22132vendorlibexp='$vendorlibexp'
91e123a8
JH
22133vendorman1dir='$vendorman1dir'
22134vendorman1direxp='$vendorman1direxp'
22135vendorman3dir='$vendorman3dir'
22136vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
22137vendorprefix='$vendorprefix'
22138vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
22139vendorscript='$vendorscript'
22140vendorscriptexp='$vendorscriptexp'
b4eb6b3d 22141version='$version'
861eb78d 22142version_patchlevel_string='$version_patchlevel_string'
d56c5707 22143versiononly='$versiononly'
5f80c64f 22144vi='$vi'
b4eb6b3d 22145voidflags='$voidflags'
5f80c64f 22146xlibpth='$xlibpth'
3659ebf1
JH
22147yacc='$yacc'
22148yaccflags='$yaccflags'
5f80c64f
JH
22149zcat='$zcat'
22150zip='$zip'
22151EOT
22152
22153: Add in command line options if available
22154$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22155
22156: add special variables
22157$test -f $src/patchlevel.h && \
d00b958f 22158awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 22159echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 22160echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22161
22162: propagate old symbols
22163if $test -f UU/config.sh; then
381aa1ff 22164 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 22165 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 22166 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22167 set X `cat UU/oldsyms`
22168 shift
22169 case $# in
22170 0) ;;
22171 *)
22172 cat <<EOM
22173Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22174EOM
22175 echo "# Variables propagated from previous config.sh file." >>config.sh
22176 for sym in `cat UU/oldsyms`; do
22177 echo " Propagating $hint variable "'$'"$sym..."
22178 eval 'tmp="$'"${sym}"'"'
22179 echo "$tmp" | \
22180 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22181 done
22182 ;;
22183 esac
22184fi
22185
22186: Finish up by extracting the .SH files
22187case "$alldone" in
22188exit)
22189 $rm -rf UU
24ccb310 22190 echo "Extraction done."
5f80c64f
JH
22191 exit 0
22192 ;;
22193cont)
22194 ;;
22195'')
22196 dflt=''
22197 nostick=true
22198 $cat <<EOM
22199
22200If you'd like to make any changes to the config.sh file before I begin
22201to configure things, do it as a shell escape now (e.g. !vi config.sh).
22202
22203EOM
22204 rp="Press return or use a shell escape to edit config.sh:"
22205 . UU/myread
22206 nostick=''
22207 case "$ans" in
22208 '') ;;
22209 *) : in case they cannot read
22210 sh 1>&4 -c "$ans";;
22211 esac
22212 ;;
22213esac
22214
22215: if this fails, just run all the .SH files by hand
22216. ./config.sh
22217
22218echo " "
22219exec 1>&4
a43e8593 22220pwd=`pwd`
5f80c64f 22221. ./UU/extract
6904989c 22222cd "$pwd"
5f80c64f
JH
22223
22224if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22225 dflt=y
22226 case "$silent" in
22227 true) ;;
22228 *)
22229 $cat <<EOM
22230
22231Now you need to generate make dependencies by running "$make depend".
22232You might prefer to run it in background: "$make depend > makedepend.out &"
22233It can take a while, so you might not want to run it right now.
22234
22235EOM
22236 ;;
22237 esac
22238 rp="Run $make depend now?"
22239 . UU/myread
22240 case "$ans" in
22241 y*)
3d5d58b1 22242 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22243 ;;
22244 *)
22245 echo "You must run '$make depend' then '$make'."
22246 ;;
22247 esac
22248elif test -f [Mm]akefile; then
22249 echo " "
22250 echo "Now you must run a $make."
22251else
24ccb310 22252 echo "Configure done."
5f80c64f
JH
22253fi
22254
22255if $test -f Policy.sh; then
22256 $cat <<EOM
22257
22258If you compile $package on a different machine or from a different object
22259directory, copy the Policy.sh file from this object directory to the
22260new one before you run Configure -- this will help you with most of
22261the policy defaults.
22262
22263EOM
22264fi
22265if $test -f config.msg; then
22266 echo "Hmm. I also noted the following information while running:"
22267 echo " "
22268 $cat config.msg >&4
22269 $rm -f config.msg
22270fi
22271$rm -f kit*isdone ark*isdone
22272$rm -rf UU
22273
22274: End of Configure
22275