This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH] fix 27987 for MSVC (was Re: Smoke [5.9.4] 28020 FAIL(m) MSWin32 Win2000...
[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#
eaf812ae 29# Generated on Mon Apr 17 14:14:39 CEST 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=''
f3f1a2d8 322initialinstalllocation=''
b4eb6b3d 323installbin=''
f3f1a2d8 324userelocatableinc=''
b4eb6b3d 325byteorder=''
2304df62 326cc=''
2304df62
AD
327ccflags=''
328cppflags=''
329ldflags=''
330lkflags=''
8e07c86e 331locincpth=''
2304df62 332optimize=''
b4eb6b3d 333cf_email=''
2304df62
AD
334cf_by=''
335cf_time=''
b4eb6b3d 336charsize=''
2304df62 337contains=''
b4eb6b3d 338cpp_stuff=''
2304df62
AD
339cpplast=''
340cppminus=''
341cpprun=''
342cppstdin=''
74cac757 343d__fwalk=''
b4eb6b3d
JH
344d_access=''
345d_accessx=''
55954f19 346d_aintl=''
b4eb6b3d 347d_alarm=''
10bc17b6
JH
348asctime_r_proto=''
349d_asctime_r=''
0dbb1585
AL
350d_attribute_format=''
351d_attribute_malloc=''
352d_attribute_nonnull=''
353d_attribute_noreturn=''
354d_attribute_pure=''
355d_attribute_unused=''
356d_attribute_warn_unused_result=''
b4eb6b3d
JH
357d_bcmp=''
358d_bcopy=''
635aebb7
AL
359d_builtin_choose_expr=''
360d_builtin_expect=''
b4eb6b3d
JH
361d_bzero=''
362d_casti32=''
363castflags=''
364d_castneg=''
365d_chown=''
366d_chroot=''
367d_chsize=''
758a5d79 368d_class=''
b0a2e8e6 369d_clearenv=''
b4eb6b3d
JH
370d_closedir=''
371d_void_closedir=''
4e0554ec 372d_cmsghdr_s=''
b4eb6b3d 373d_const=''
36adc09b 374d_copysignl=''
b4eb6b3d
JH
375cryptlib=''
376d_crypt=''
10bc17b6
JH
377crypt_r_proto=''
378d_crypt_r=''
b4eb6b3d
JH
379d_csh=''
380full_csh=''
10bc17b6
JH
381ctermid_r_proto=''
382d_ctermid_r=''
383ctime_r_proto=''
384d_ctime_r=''
b4eb6b3d
JH
385d_cuserid=''
386d_dbl_dig=''
2ef53570 387d_dbminitproto=''
b4eb6b3d 388d_difftime=''
ae0e3d3b 389d_dirfd=''
b4eb6b3d 390d_dlerror=''
a0d0e21e 391d_dlopen=''
b4eb6b3d
JH
392d_dlsymun=''
393d_dosuid=''
394d_suidsafe=''
10bc17b6
JH
395d_drand48_r=''
396drand48_r_proto=''
b4eb6b3d
JH
397d_drand48proto=''
398d_dup2=''
399d_eaccess=''
400d_endgrent=''
10bc17b6
JH
401d_endgrent_r=''
402endgrent_r_proto=''
b4eb6b3d 403d_endhent=''
10bc17b6
JH
404d_endhostent_r=''
405endhostent_r_proto=''
b4eb6b3d 406d_endnent=''
10bc17b6
JH
407d_endnetent_r=''
408endnetent_r_proto=''
b4eb6b3d 409d_endpent=''
10bc17b6
JH
410d_endprotoent_r=''
411endprotoent_r_proto=''
b4eb6b3d 412d_endpwent=''
10bc17b6
JH
413d_endpwent_r=''
414endpwent_r_proto=''
b4eb6b3d 415d_endsent=''
10bc17b6
JH
416d_endservent_r=''
417endservent_r_proto=''
15b61c98 418d_faststdio=''
b363b713 419d_fchdir=''
b4eb6b3d
JH
420d_fchmod=''
421d_fchown=''
422d_fcntl=''
9d9004a9 423d_fcntl_can_lock=''
b4eb6b3d
JH
424d_fd_macros=''
425d_fd_set=''
426d_fds_bits=''
427d_fgetpos=''
758a5d79
JH
428d_finite=''
429d_finitel=''
b4eb6b3d
JH
430d_flexfnam=''
431d_flock=''
2ef53570 432d_flockproto=''
b4eb6b3d 433d_fork=''
758a5d79
JH
434d_fp_class=''
435d_fpclass=''
436d_fpclassify=''
437d_fpclassl=''
b4eb6b3d
JH
438d_fpos64_t=''
439d_frexpl=''
440d_fs_data_s=''
441d_fseeko=''
442d_fsetpos=''
443d_fstatfs=''
411ab01c 444d_fsync=''
b4eb6b3d
JH
445d_ftello=''
446d_ftime=''
447d_gettimeod=''
dc814df1 448d_futimes=''
b4eb6b3d
JH
449d_Gconvert=''
450d_getcwd=''
451d_getespwnam=''
452d_getfsstat=''
453d_getgrent=''
10bc17b6
JH
454d_getgrent_r=''
455getgrent_r_proto=''
456d_getgrgid_r=''
457getgrgid_r_proto=''
458d_getgrnam_r=''
459getgrnam_r_proto=''
b4eb6b3d
JH
460d_getgrps=''
461d_gethbyaddr=''
462d_gethbyname=''
463d_gethent=''
464aphostname=''
465d_gethname=''
466d_phostname=''
467d_uname=''
10bc17b6
JH
468d_gethostbyaddr_r=''
469gethostbyaddr_r_proto=''
470d_gethostbyname_r=''
471gethostbyname_r_proto=''
472d_gethostent_r=''
473gethostent_r_proto=''
b4eb6b3d 474d_gethostprotos=''
4e0554ec 475d_getitimer=''
b4eb6b3d 476d_getlogin=''
10bc17b6
JH
477d_getlogin_r=''
478getlogin_r_proto=''
b4eb6b3d
JH
479d_getmnt=''
480d_getmntent=''
481d_getnbyaddr=''
482d_getnbyname=''
483d_getnent=''
10bc17b6
JH
484d_getnetbyaddr_r=''
485getnetbyaddr_r_proto=''
486d_getnetbyname_r=''
487getnetbyname_r_proto=''
488d_getnetent_r=''
489getnetent_r_proto=''
b4eb6b3d 490d_getnetprotos=''
0c0643d0 491d_getpagsz=''
b4eb6b3d
JH
492d_getpent=''
493d_getpgid=''
494d_getpgrp2=''
495d_bsdgetpgrp=''
496d_getpgrp=''
497d_getppid=''
498d_getprior=''
499d_getpbyname=''
500d_getpbynumber=''
10bc17b6
JH
501d_getprotobyname_r=''
502getprotobyname_r_proto=''
503d_getprotobynumber_r=''
504getprotobynumber_r_proto=''
505d_getprotoent_r=''
506getprotoent_r_proto=''
b4eb6b3d
JH
507d_getprotoprotos=''
508d_getprpwnam=''
509d_getpwent=''
10bc17b6
JH
510d_getpwent_r=''
511getpwent_r_proto=''
512d_getpwnam_r=''
513getpwnam_r_proto=''
514d_getpwuid_r=''
515getpwuid_r_proto=''
b4eb6b3d 516d_getsent=''
10bc17b6
JH
517d_getservbyname_r=''
518getservbyname_r_proto=''
519d_getservbyport_r=''
520getservbyport_r_proto=''
521d_getservent_r=''
522getservent_r_proto=''
b4eb6b3d
JH
523d_getservprotos=''
524d_getspnam=''
10bc17b6
JH
525d_getspnam_r=''
526getspnam_r_proto=''
b4eb6b3d
JH
527d_getsbyname=''
528d_getsbyport=''
10bc17b6
JH
529d_gmtime_r=''
530gmtime_r_proto=''
a4f3eea9 531d_gnulibc=''
5f6e0ee4 532gnulibc_version=''
b4eb6b3d
JH
533d_hasmntopt=''
534d_htonl=''
55954f19 535d_ilogbl=''
b4eb6b3d
JH
536d_inetaton=''
537d_int64_t=''
538d_isascii=''
758a5d79
JH
539d_isfinite=''
540d_isinf=''
b4eb6b3d
JH
541d_isnan=''
542d_isnanl=''
543d_killpg=''
544d_lchown=''
545d_ldbl_dig=''
0a0abfba 546d_libm_lib_version=''
b4eb6b3d 547d_link=''
10bc17b6
JH
548d_localtime_r=''
549localtime_r_proto=''
b4eb6b3d
JH
550d_locconv=''
551d_lockf=''
552d_longdbl=''
553longdblsize=''
554d_longlong=''
555longlongsize=''
556d_lseekproto=''
557d_lstat=''
558d_madvise=''
7dd121ae
MB
559d_malloc_good_size=''
560d_malloc_size=''
b4eb6b3d
JH
561d_mblen=''
562d_mbstowcs=''
563d_mbtowc=''
564d_memchr=''
565d_memcmp=''
566d_memcpy=''
567d_memmove=''
568d_memset=''
569d_mkdir=''
570d_mkdtemp=''
571d_mkfifo=''
572d_mkstemp=''
573d_mkstemps=''
574d_mktime=''
575d_mmap=''
576mmaptype=''
577d_modfl=''
e67aeab1 578d_modfl_pow32_bug=''
bc9a1b2c 579d_modflproto=''
b4eb6b3d
JH
580d_mprotect=''
581d_msg=''
582d_msgctl=''
583d_msgget=''
4e0554ec 584d_msghdr_s=''
b4eb6b3d
JH
585d_msgrcv=''
586d_msgsnd=''
587d_msync=''
588d_munmap=''
589d_nice=''
2765b840 590d_nl_langinfo=''
b4eb6b3d
JH
591d_off64_t=''
592d_open3=''
593d_fpathconf=''
594d_pathconf=''
595d_pause=''
596d_pipe=''
597d_poll=''
2304df62 598d_portable=''
a33c94aa 599d_procselfexe=''
f24dbf84 600procselfexe=''
b4eb6b3d
JH
601d_old_pthread_create_joinable=''
602old_pthread_create_joinable=''
d6483fcc 603d_pthread_atfork=''
58d975c3 604d_pthread_attr_setscope=''
b4eb6b3d
JH
605d_pthread_yield=''
606d_sched_yield=''
607sched_yield=''
608d_qgcvt=''
10bc17b6
JH
609d_random_r=''
610random_r_proto=''
611d_readdir64_r=''
612readdir64_r_proto=''
b4eb6b3d
JH
613d_readdir=''
614d_rewinddir=''
615d_seekdir=''
616d_telldir=''
10bc17b6
JH
617d_readdir_r=''
618readdir_r_proto=''
b4eb6b3d 619d_readlink=''
4e0554ec
JH
620d_readv=''
621d_recvmsg=''
b4eb6b3d
JH
622d_rename=''
623d_rmdir=''
624d_safebcpy=''
625d_safemcpy=''
626d_sanemcmp=''
ef9f17be 627d_sbrkproto=''
55954f19 628d_scalbnl=''
b4eb6b3d
JH
629d_select=''
630d_sem=''
631d_semctl=''
632d_semget=''
633d_semop=''
4e0554ec 634d_sendmsg=''
b4eb6b3d
JH
635d_setegid=''
636d_seteuid=''
637d_setgrent=''
10bc17b6
JH
638d_setgrent_r=''
639setgrent_r_proto=''
b4eb6b3d
JH
640d_setgrps=''
641d_sethent=''
10bc17b6
JH
642d_sethostent_r=''
643sethostent_r_proto=''
4e0554ec 644d_setitimer=''
b4eb6b3d
JH
645d_setlinebuf=''
646d_setlocale=''
10bc17b6
JH
647d_setlocale_r=''
648setlocale_r_proto=''
b4eb6b3d 649d_setnent=''
10bc17b6
JH
650d_setnetent_r=''
651setnetent_r_proto=''
b4eb6b3d
JH
652d_setpent=''
653d_setpgid=''
654d_setpgrp2=''
655d_bsdsetpgrp=''
656d_setpgrp=''
657d_setprior=''
658d_setproctitle=''
10bc17b6
JH
659d_setprotoent_r=''
660setprotoent_r_proto=''
b4eb6b3d 661d_setpwent=''
10bc17b6
JH
662d_setpwent_r=''
663setpwent_r_proto=''
b4eb6b3d
JH
664d_setregid=''
665d_setresgid=''
666d_setresuid=''
667d_setreuid=''
668d_setrgid=''
669d_setruid=''
670d_setsent=''
10bc17b6
JH
671d_setservent_r=''
672setservent_r_proto=''
b4eb6b3d
JH
673d_setsid=''
674d_setvbuf=''
675d_sfio=''
676usesfio=''
677d_shm=''
678d_shmat=''
679d_shmatprototype=''
680shmattype=''
681d_shmctl=''
682d_shmdt=''
683d_shmget=''
684d_sigaction=''
983dbef6 685d_sigprocmask=''
b4eb6b3d 686d_sigsetjmp=''
5f106f9c 687usesitecustomize=''
4f5da3e9
SP
688d_snprintf=''
689d_vsnprintf=''
49a78c82 690d_sockatmark=''
2ef53570 691d_sockatmarkproto=''
b4eb6b3d
JH
692d_msg_ctrunc=''
693d_msg_dontroute=''
694d_msg_oob=''
695d_msg_peek=''
696d_msg_proxy=''
697d_oldsock=''
698d_scm_rights=''
699d_socket=''
700d_sockpair=''
701sockethdr=''
702socketlib=''
703d_socklen_t=''
704d_socks5_init=''
360321b3 705d_sprintf_returns_strlen=''
b4eb6b3d 706d_sqrtl=''
10bc17b6
JH
707d_srand48_r=''
708srand48_r_proto=''
709d_srandom_r=''
710srandom_r_proto=''
eef837ea 711d_sresgproto=''
640374d0 712d_sresuproto=''
b4eb6b3d
JH
713d_statblks=''
714d_statfs_f_flags=''
715d_statfs_s=''
716d_fstatvfs=''
717d_statvfs=''
718d_stdio_cnt_lval=''
719d_stdio_ptr_lval=''
a7ffa9b9
NC
720d_stdio_ptr_lval_nochange_cnt=''
721d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
722d_stdiobase=''
723d_stdstdio=''
724stdio_base=''
725stdio_bufsiz=''
726stdio_cnt=''
727stdio_filbuf=''
728stdio_ptr=''
729d_index=''
730d_strchr=''
731d_strcoll=''
732d_strctcpy=''
733d_strerrm=''
734d_strerror=''
735d_sysernlst=''
736d_syserrlst=''
10bc17b6
JH
737d_strerror_r=''
738strerror_r_proto=''
b3c85772 739d_strftime=''
08c92000
MB
740d_strlcat=''
741d_strlcpy=''
b4eb6b3d
JH
742d_strtod=''
743d_strtol=''
744d_strtold=''
745d_strtoll=''
28e5dec8 746d_strtoq=''
b4eb6b3d
JH
747d_strtoul=''
748d_strtoull=''
749d_strtouq=''
750d_strxfrm=''
751d_symlink=''
752d_syscall=''
2ef53570 753d_syscallproto=''
b4eb6b3d
JH
754d_sysconf=''
755d_system=''
756d_tcgetpgrp=''
757d_tcsetpgrp=''
758d_telldirproto=''
759d_time=''
760timetype=''
761clocktype=''
762d_times=''
10bc17b6
JH
763d_tmpnam_r=''
764tmpnam_r_proto=''
b4eb6b3d 765d_truncate=''
10bc17b6
JH
766d_ttyname_r=''
767ttyname_r_proto=''
b4eb6b3d 768d_tzname=''
4e0554ec
JH
769d_u32align=''
770d_ualarm=''
b4eb6b3d
JH
771d_umask=''
772d_semctl_semid_ds=''
773d_semctl_semun=''
774d_union_semun=''
758a5d79 775d_unordered=''
bdf33aa7 776d_unsetenv=''
4e0554ec 777d_usleep=''
2ef53570 778d_usleepproto=''
b4eb6b3d
JH
779d_ustat=''
780d_vfork=''
781usevfork=''
782d_voidsig=''
783signal_t=''
784d_volatile=''
785d_charvspr=''
786d_vprintf=''
787d_wait4=''
788d_waitpid=''
789d_wcstombs=''
790d_wctomb=''
4e0554ec 791d_writev=''
b4eb6b3d 792dlext=''
85e6fe83
LW
793cccdlflags=''
794ccdlflags=''
2304df62 795dlsrc=''
232e078e 796ld=''
85e6fe83 797lddlflags=''
2304df62 798usedl=''
b4eb6b3d
JH
799doublesize=''
800ebcdic=''
801fflushNULL=''
802fflushall=''
803fpossize=''
804fpostype=''
2d736872 805gccansipedantic=''
5b463ca7 806gccosandvers=''
8a27cf78 807gccversion=''
b4eb6b3d
JH
808gidformat=''
809gidsign=''
810gidsize=''
811gidtype=''
812groupstype=''
813h_fcntl=''
814h_sysfile=''
6e1038e0
MB
815html1dir=''
816html1direxp=''
817installhtml1dir=''
818html3dir=''
819html3direxp=''
820installhtml3dir=''
b4eb6b3d 821i_arpainet=''
10bc17b6 822i_crypt=''
b4eb6b3d
JH
823db_hashtype=''
824db_prefixtype=''
640374d0
JH
825db_version_major=''
826db_version_minor=''
827db_version_patch=''
b4eb6b3d
JH
828i_db=''
829i_dbm=''
830i_rpcsvcdbm=''
831d_dirnamlen=''
832direntrytype=''
833i_dirent=''
a0d0e21e 834i_dld=''
b4eb6b3d
JH
835i_dlfcn=''
836i_fcntl=''
837i_float=''
758a5d79
JH
838i_fp=''
839i_fp_class=''
b4eb6b3d
JH
840i_gdbm=''
841d_grpasswd=''
842i_grp=''
b4eb6b3d
JH
843i_ieeefp=''
844i_inttypes=''
2765b840 845i_langinfo=''
b4eb6b3d
JH
846i_libutil=''
847i_limits=''
848i_locale=''
849i_machcthr=''
850i_malloc=''
851i_math=''
852i_memory=''
853i_mntent=''
854i_ndbm=''
855i_netdb=''
856i_neterrno=''
857i_netinettcp=''
858i_niin=''
859i_sysin=''
860i_poll=''
861i_prot=''
862i_pthread=''
863d_pwage=''
864d_pwchange=''
865d_pwclass=''
866d_pwcomment=''
867d_pwexpire=''
868d_pwgecos=''
869d_pwpasswd=''
870d_pwquota=''
871i_pwd=''
872i_sfio=''
873i_shadow=''
874i_socks=''
875i_stddef=''
876i_stdlib=''
877i_string=''
878strings=''
879i_sunmath=''
880i_sysaccess=''
881i_sysdir=''
882i_sysfile=''
883d_voidtty=''
884i_bsdioctl=''
885i_sysfilio=''
886i_sysioctl=''
887i_syssockio=''
888i_syslog=''
889i_sysmman=''
890i_sysmode=''
891i_sysmount=''
892i_sysndir=''
893i_sysparam=''
894i_sysresrc=''
895i_syssecrt=''
896i_sysselct=''
897i_sysstat=''
898i_sysstatfs=''
899i_sysstatvfs=''
900i_systimes=''
901i_systypes=''
902i_sysuio=''
903i_sysun=''
904i_sysutsname=''
905i_sysvfs=''
906i_syswait=''
907i_sgtty=''
908i_termio=''
909i_termios=''
14b90194
JH
910d_tm_tm_gmtoff=''
911d_tm_tm_zone=''
b4eb6b3d
JH
912i_systime=''
913i_systimek=''
914i_time=''
915timeincl=''
916i_unistd=''
917i_ustat=''
918i_utime=''
919i_values=''
920i_stdarg=''
921i_varargs=''
922i_varhdr=''
923i_vfork=''
f3f1a2d8 924d_inc_version_list=''
b4eb6b3d
JH
925inc_version_list=''
926inc_version_list_init=''
927installprefix=''
928installprefixexp=''
929installstyle=''
930installusrbinperl=''
931intsize=''
932longsize=''
933shortsize=''
4b661809 934issymlink=''
2304df62 935libc=''
b4eb6b3d
JH
936ldlibpthname=''
937libperl=''
938shrpenv=''
939useshrplib=''
a0d0e21e 940glibpth=''
2304df62 941libpth=''
8e07c86e 942loclibpth=''
2304df62
AD
943plibpth=''
944xlibpth=''
1cfa4ec7 945ignore_versioned_solibs=''
2304df62 946libs=''
43999f95
JH
947libsdirs=''
948libsfiles=''
949libsfound=''
13b3f787 950libspath=''
85e6fe83 951lns=''
b4eb6b3d
JH
952d_PRIEUldbl=''
953d_PRIFUldbl=''
954d_PRIGUldbl=''
955d_PRIeldbl=''
956d_PRIfldbl=''
957d_PRIgldbl=''
958d_SCNfldbl=''
959sPRIEUldbl=''
960sPRIFUldbl=''
961sPRIGUldbl=''
962sPRIeldbl=''
963sPRIfldbl=''
964sPRIgldbl=''
965sSCNfldbl=''
966lseeksize=''
967lseektype=''
d620c7b3 968mad=''
00e74f14
NC
969madlyh=''
970madlyobj=''
971madlysrc=''
f3f1a2d8
MB
972make_set_make=''
973d_mymalloc=''
974freetype=''
b4eb6b3d
JH
975mallocobj=''
976mallocsrc=''
977malloctype=''
9df442c2 978usemallocwrap=''
b4eb6b3d
JH
979usemymalloc=''
980installman1dir=''
981man1dir=''
982man1direxp=''
983man1ext=''
984installman3dir=''
985man3dir=''
986man3direxp=''
987man3ext=''
988modetype=''
989multiarch=''
990mydomain=''
991myhostname=''
992phostname=''
2304df62
AD
993c=''
994n=''
b4eb6b3d
JH
995d_eofnblk=''
996eagain=''
997o_nonblock=''
998rd_nodata=''
2cc61e15 999need_va_copy=''
b4eb6b3d
JH
1000netdb_hlen_type=''
1001netdb_host_type=''
1002netdb_name_type=''
1003netdb_net_type=''
1004groupcat=''
1005hostcat=''
1006passcat=''
1007orderlib=''
1008ranlib=''
1009d_perl_otherlibdirs=''
1010otherlibdirs=''
2304df62
AD
1011package=''
1012spackage=''
b4eb6b3d
JH
1013pager=''
1014api_revision=''
1015api_subversion=''
1016api_version=''
1017api_versionstring=''
1018patchlevel=''
151e6568 1019perl_patchlevel=''
b4eb6b3d
JH
1020revision=''
1021subversion=''
1022version=''
861eb78d 1023version_patchlevel_string=''
b4eb6b3d
JH
1024perl5=''
1025perladmin=''
1026perlpath=''
1027d_nv_preserves_uv=''
f607920a 1028d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1029i16size=''
1030i16type=''
1031i32size=''
1032i32type=''
1033i64size=''
1034i64type=''
1035i8size=''
1036i8type=''
1037ivsize=''
1038ivtype=''
53133ed1 1039nv_preserves_uv_bits=''
b4eb6b3d
JH
1040nvsize=''
1041nvtype=''
1042u16size=''
1043u16type=''
1044u32size=''
1045u32type=''
1046u64size=''
1047u64type=''
1048u8size=''
1049u8type=''
1050uvsize=''
1051uvtype=''
1052ivdformat=''
1053nvEUformat=''
1054nvFUformat=''
1055nvGUformat=''
1056nveformat=''
1057nvfformat=''
1058nvgformat=''
1059uvXUformat=''
1060uvoformat=''
1061uvuformat=''
1062uvxformat=''
1063pidtype=''
1064prefix=''
1065prefixexp=''
1066installprivlib=''
1067privlib=''
1068privlibexp=''
1069prototype=''
1070ptrsize=''
1071d_PRIXU64=''
1072d_PRId64=''
1073d_PRIi64=''
1074d_PRIo64=''
1075d_PRIu64=''
1076d_PRIx64=''
1077sPRIXU64=''
1078sPRId64=''
1079sPRIi64=''
1080sPRIo64=''
1081sPRIu64=''
1082sPRIx64=''
1083d_quad=''
1084quadkind=''
1085quadtype=''
1086uquadtype=''
1087drand01=''
1088randbits=''
1089randfunc=''
1090randseedtype=''
1091seedfunc=''
1092installscript=''
1093scriptdir=''
1094scriptdirexp=''
1095selectminbits=''
1096selecttype=''
8ff267be 1097sh=''
b4eb6b3d
JH
1098sig_count=''
1099sig_name=''
1100sig_name_init=''
1101sig_num=''
1102sig_num_init=''
76d3c696 1103sig_size=''
f3f1a2d8 1104d_sitearch=''
b4eb6b3d
JH
1105installsitearch=''
1106sitearch=''
1107sitearchexp=''
1108installsitebin=''
1109sitebin=''
1110sitebinexp=''
8d2cbf27
JH
1111installsitehtml1dir=''
1112sitehtml1dir=''
1113sitehtml1direxp=''
1114installsitehtml3dir=''
1115sitehtml3dir=''
1116sitehtml3direxp=''
b4eb6b3d
JH
1117installsitelib=''
1118sitelib=''
1119sitelib_stem=''
1120sitelibexp=''
91e123a8
JH
1121installsiteman1dir=''
1122siteman1dir=''
1123siteman1direxp=''
1124installsiteman3dir=''
1125siteman3dir=''
1126siteman3direxp=''
b4eb6b3d
JH
1127siteprefix=''
1128siteprefixexp=''
6e1038e0
MB
1129installsitescript=''
1130sitescript=''
1131sitescriptexp=''
b4eb6b3d
JH
1132sizesize=''
1133sizetype=''
a0d0e21e 1134so=''
b4eb6b3d 1135socksizetype=''
2304df62
AD
1136sharpbang=''
1137shsharp=''
1138spitshell=''
dfe9444c 1139src=''
b4eb6b3d
JH
1140ssizetype=''
1141startperl=''
2304df62 1142startsh=''
b4eb6b3d
JH
1143stdchar=''
1144d_stdio_stream_array=''
1145stdio_stream_array=''
1146sysman=''
5ff3f7a4 1147trnl=''
b4eb6b3d
JH
1148uidformat=''
1149uidsign=''
1150uidsize=''
1151uidtype=''
1152archname64=''
1153use64bitall=''
1154use64bitint=''
15b61c98 1155usefaststdio=''
b4eb6b3d
JH
1156ccflags_uselargefiles=''
1157ldflags_uselargefiles=''
1158libswanted_uselargefiles=''
1159uselargefiles=''
1160uselongdouble=''
1161usemorebits=''
1162usemultiplicity=''
2304df62 1163nm_opt=''
40a7a20a 1164nm_so_opt=''
2304df62
AD
1165runnm=''
1166usenm=''
b4eb6b3d 1167useperlio=''
29209bc5 1168usesocks=''
b4eb6b3d
JH
1169d_oldpthreads=''
1170use5005threads=''
1171useithreads=''
9514c62b 1172usereentrant=''
b4eb6b3d 1173usethreads=''
2304df62 1174incpath=''
2304df62
AD
1175mips_type=''
1176usrinc=''
b4eb6b3d
JH
1177d_vendorarch=''
1178installvendorarch=''
1179vendorarch=''
1180vendorarchexp=''
1181d_vendorbin=''
1182installvendorbin=''
1183vendorbin=''
1184vendorbinexp=''
8d2cbf27
JH
1185installvendorhtml1dir=''
1186vendorhtml1dir=''
1187vendorhtml1direxp=''
1188installvendorhtml3dir=''
1189vendorhtml3dir=''
1190vendorhtml3direxp=''
b4eb6b3d
JH
1191d_vendorlib=''
1192installvendorlib=''
1193vendorlib=''
1194vendorlib_stem=''
1195vendorlibexp=''
91e123a8
JH
1196installvendorman1dir=''
1197vendorman1dir=''
1198vendorman1direxp=''
1199installvendorman3dir=''
1200vendorman3dir=''
1201vendorman3direxp=''
b4eb6b3d
JH
1202usevendorprefix=''
1203vendorprefix=''
1204vendorprefixexp=''
6e1038e0
MB
1205d_vendorscript=''
1206installvendorscript=''
1207vendorscript=''
1208vendorscriptexp=''
d56c5707 1209versiononly=''
b4eb6b3d
JH
1210defvoidused=''
1211voidflags=''
3659ebf1
JH
1212yacc=''
1213yaccflags=''
2304df62
AD
1214CONFIG=''
1215
ecfc5424
AD
1216define='define'
1217undef='undef'
1218smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1219rmlist=''
1220
1221: We must find out about Eunice early
1222eunicefix=':'
1223if test -f /etc/unixtovms; then
1224 eunicefix=/etc/unixtovms
1225fi
1226if test -f /etc/unixtovms.exe; then
1227 eunicefix=/etc/unixtovms.exe
1228fi
1229
cfb04860 1230: Set executable suffix now -- needed before hints available
6153ba32
PG
1231if test -f "/libs/version.library"; then
1232: Amiga OS
1233 _exe=""
1234elif test -f "/system/gnu_library/bin/ar.pm"; then
1235: Stratus VOS
cfb04860 1236 _exe=".pm"
6153ba32
PG
1237elif test -n "$DJGPP"; then
1238: DOS DJGPP
cfb04860 1239 _exe=".exe"
5c728af0 1240elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1241: OS/2 or cygwin
ba863942
JH
1242 _exe=".exe"
1243fi
868439a2 1244
b4eb6b3d 1245i_whoami=''
9da7673b
MB
1246ccname=''
1247ccversion=''
1248perllibs=''
1249: set useposix=false in your hint file to disable the POSIX extension.
1250useposix=true
1251: set useopcode=false in your hint file to disable the Opcode extension.
1252useopcode=true
1253: Trailing extension. Override this in a hint file, if needed.
1254: Extra object files, if any, needed on this platform.
1255archobjs=''
1256archname=''
ff935051
JH
1257: Possible local include directories to search.
1258: Set locincpth to "" in a hint file to defeat local include searches.
1259locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1260locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1261:
1262: no include file wanted by default
1263inclwanted=''
1264
eaf812ae
MB
1265: Enable -DEBUGGING and -DDEBUGGING from the command line
1266EBUGGING=''
1267DEBUGGING=old
1268
b4eb6b3d 1269groupstype=''
64615a5e 1270libnames=''
732c9516
JH
1271: change the next line if compiling for Xenix/286 on Xenix/386
1272xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1273: Possible local library directories to search.
1274loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1275loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1276
1277: general looking path for locating libraries
5869b1f1 1278glibpth="/lib /usr/lib $xlibpth"
732c9516 1279glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1280test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1281test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1282
1283: Private path used by Configure to find libraries. Its value
1284: is prepended to libpth. This variable takes care of special
1285: machines, like the mips. Usually, it should be empty.
1286plibpth=''
1287
1cfa4ec7
GS
1288: default library list
1289libswanted=''
921b2963 1290: some systems want to use only the non-versioned libso:s
1cfa4ec7 1291ignore_versioned_solibs=''
9da7673b
MB
1292siteman1dir=''
1293siteman3dir=''
1294sitescript=''
b4eb6b3d
JH
1295archname64=''
1296ccflags_uselargefiles=''
1297ldflags_uselargefiles=''
1298libswanted_uselargefiles=''
1299: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1300: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1301: set usethreads on the Configure command line to enable threads.
cd040c5e 1302usereentrant='undef'
9da7673b
MB
1303: full support for void wanted by default
1304defvoidused=15
1305
ecfc5424 1306: List of libraries we want.
15431986 1307: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1308libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1309libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1310: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1311: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1312glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1313glibpth="/usr/shlib $glibpth"
1314: Do not use vfork unless overridden by a hint file.
1315usevfork=false
1316
8ff267be 1317: Find the basic shell for Bourne shell scripts
1318case "$sh" in
1319'')
8ff267be 1320 case "$SYSTYPE" in
1321 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1322 *) xxx='/bin/sh';;
1323 esac
1324 if test -f "$xxx"; then
1325 sh="$xxx"
1326 else
1327 : Build up a list and do a single loop so we can 'break' out.
1328 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1329 for xxx in sh bash ksh pdksh ash; do
1330 for p in $pth; do
1331 try="$try ${p}/${xxx}"
1332 done
1333 done
1334 for xxx in $try; do
1335 if test -f "$xxx"; then
1336 sh="$xxx";
8ff267be 1337 break
a5a94ea5
JH
1338 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1339 sh="$xxx";
1340 break
8ff267be 1341 elif test -f "$xxx.exe"; then
1342 sh="$xxx";
8ff267be 1343 break
1344 fi
1345 done
1346 fi
1347 ;;
1348esac
1349
1350case "$sh" in
a33c94aa 1351'') cat >&2 <<EOM
8ff267be 1352$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1353
8ff267be 1354Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1355Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1356we'll try to straighten this all out.
8ff267be 1357EOM
1358 exit 1
1359 ;;
1360esac
1361
760ac839 1362: see if sh knows # comments
73614538 1363if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1364 shsharp=true
1365 spitshell=cat
760ac839 1366 xcat=/bin/cat
a931254c
JH
1367 test -f $xcat$_exe || xcat=/usr/bin/cat
1368 if test ! -f $xcat$_exe; then
4bdb8fb5 1369 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1370 if test -f $p/cat$_exe; then
1deb0a86 1371 xcat=$p/cat
3c728e00
JH
1372 break
1373 fi
1374 done
1deb0a86
JH
1375 if test ! -f $xcat$_exe; then
1376 echo "Can't find cat anywhere!"
3c728e00
JH
1377 exit 1
1378 fi
1379 fi
5440bc8e
JH
1380 echo "#!$xcat" >sharp
1381 $eunicefix sharp
1382 chmod +x sharp
1383 ./sharp > today
760ac839 1384 if test -s today; then
760ac839
LW
1385 sharpbang='#!'
1386 else
5440bc8e
JH
1387 echo "#! $xcat" > sharp
1388 $eunicefix sharp
1389 chmod +x sharp
1390 ./sharp > today
760ac839 1391 if test -s today; then
760ac839
LW
1392 sharpbang='#! '
1393 else
760ac839
LW
1394 sharpbang=': use '
1395 fi
1396 fi
1397else
dfe9444c 1398 echo " "
8ff267be 1399 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1400 shsharp=false
1401 cd ..
1402 echo "exec grep -v '^[ ]*#'" >spitshell
1403 chmod +x spitshell
1404 $eunicefix spitshell
1405 spitshell=`pwd`/spitshell
1406 cd UU
1407 echo "I presume that if # doesn't work, #! won't work either!"
1408 sharpbang=': use '
1409fi
5440bc8e 1410rm -f sharp today
760ac839
LW
1411
1412: figure out how to guarantee sh startup
8ff267be 1413case "$startsh" in
1414'') startsh=${sharpbang}${sh} ;;
1415*)
760ac839 1416esac
5440bc8e 1417cat >sharp <<EOSS
760ac839
LW
1418$startsh
1419set abc
1420test "$?abc" != 1
1421EOSS
1422
5440bc8e
JH
1423chmod +x sharp
1424$eunicefix sharp
1425if ./sharp; then
8ff267be 1426 : echo "Yup, it does."
760ac839 1427else
dfe9444c
AD
1428 echo "Hmm... '$startsh' does not guarantee sh startup..."
1429 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1430fi
5440bc8e 1431rm -f sharp
760ac839 1432
aebf16e7
AD
1433
1434: Save command line options in file UU/cmdline.opt for later use in
1435: generating config.sh.
1436cat > cmdline.opt <<EOSH
1437# Configure command line arguments.
1438config_arg0='$0'
1439config_args='$*'
1440config_argc=$#
1441EOSH
1442argn=1
ee45ea83
IZ
1443args_exp=''
1444args_sep=''
aebf16e7
AD
1445for arg in "$@"; do
1446 cat >>cmdline.opt <<EOSH
1447config_arg$argn='$arg'
1448EOSH
ee45ea83
IZ
1449 # Extreme backslashitis: replace each ' by '"'"'
1450 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1451$arg
1452EOC
1453 arg_exp=`cat cmdl.opt`
1454 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1455 argn=`expr $argn + 1`
ee45ea83 1456 args_sep=' '
aebf16e7 1457done
ee45ea83
IZ
1458# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1459# used by ./hints/os2.sh
1460rm -f cmdl.opt
aebf16e7 1461
2304df62
AD
1462: produce awk script to parse command line options
1463cat >options.awk <<'EOF'
1464BEGIN {
02e93a22 1465 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1466
1467 len = length(optstr);
1468 for (i = 1; i <= len; i++) {
1469 c = substr(optstr, i, 1);
1470 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1471 if (a == ":") {
1472 arg[c] = 1;
1473 i++;
1474 }
1475 opt[c] = 1;
1476 }
1477}
1478{
1479 expect = 0;
1480 str = $0;
1481 if (substr(str, 1, 1) != "-") {
1482 printf("'%s'\n", str);
1483 next;
1484 }
1485 len = length($0);
1486 for (i = 2; i <= len; i++) {
1487 c = substr(str, i, 1);
1488 if (!opt[c]) {
1489 printf("-%s\n", substr(str, i));
1490 next;
1491 }
1492 printf("-%s\n", c);
1493 if (arg[c]) {
1494 if (i < len)
1495 printf("'%s'\n", substr(str, i + 1));
1496 else
1497 expect = 1;
1498 next;
1499 }
1500 }
1501}
1502END {
1503 if (expect)
1504 print "?";
1505}
1506EOF
1507
1508: process the command line options
4633a7c4
LW
1509set X `for arg in "$@"; do echo "X$arg"; done |
1510 sed -e s/X// | awk -f options.awk`
2304df62
AD
1511eval "set $*"
1512shift
1513rm -f options.awk
1514
1515: set up default values
1516fastread=''
1517reuseval=false
1518config_sh=''
1519alldone=''
1520error=''
1521silent=''
1522extractsh=''
ecfc5424 1523override=''
16d20bd9 1524knowitall=''
02e93a22 1525rm -f optdef.sh posthint.sh
28757baa 1526cat >optdef.sh <<EOS
1527$startsh
1528EOS
2304df62 1529
dfe9444c 1530
2304df62
AD
1531: option parsing
1532while test $# -gt 0; do
1533 case "$1" in
1534 -d) shift; fastread=yes;;
1535 -e) shift; alldone=cont;;
1536 -f)
1537 shift
1538 cd ..
1539 if test -r "$1"; then
1540 config_sh="$1"
1541 else
a0d0e21e 1542 echo "$me: cannot read config file $1." >&2
2304df62
AD
1543 error=true
1544 fi
1545 cd UU
1546 shift;;
1547 -h) shift; error=true;;
1548 -r) shift; reuseval=true;;
dfe9444c 1549 -s) shift; silent=true; realsilent=true;;
2304df62 1550 -E) shift; alldone=exit;;
16d20bd9 1551 -K) shift; knowitall=true;;
ecfc5424 1552 -O) shift; override=true;;
dfe9444c 1553 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1554 -D)
1555 shift
1556 case "$1" in
1557 *=)
1558 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1559 echo "$me: ignoring -D $1" >&2
1560 ;;
ecfc5424 1561 *=*) echo "$1" | \
1aef975c
AD
1562 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1563 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1564 esac
1565 shift
1566 ;;
1567 -U)
1568 shift
1569 case "$1" in
1aef975c 1570 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1571 *=*)
1572 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1573 echo "$me: ignoring -U $1" >&2
1574 ;;
1aef975c 1575 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1576 esac
1577 shift
1578 ;;
02e93a22
JH
1579 -A)
1580 shift
1581 xxx=''
1582 yyy="$1"
02e93a22 1583 zzz=''
5f83a3e9 1584 uuu=undef
02e93a22 1585 case "$yyy" in
f7c31117 1586 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1587 case "$zzz" in
1588 *:*) zzz='' ;;
1589 *) xxx=append
f7c31117
JH
1590 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1591 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1592 esac
1593 ;;
1594 esac
1595 case "$xxx" in
1596 '') case "$yyy" in
f7c31117
JH
1597 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1598 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1599 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1600 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1601 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1602 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1603 esac
1604 ;;
1605 esac
02e93a22
JH
1606 case "$xxx" in
1607 append)
5f83a3e9 1608 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1609 clear)
5f83a3e9 1610 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1611 define)
1612 case "$zzz" in
1613 '') zzz=define ;;
1614 esac
5f83a3e9 1615 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1616 eval)
5f83a3e9 1617 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1618 prepend)
5f83a3e9 1619 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1620 undef)
1621 case "$zzz" in
1622 '') zzz="$uuu" ;;
1623 esac
5f83a3e9
JH
1624 echo "$yyy=$zzz" >> posthint.sh ;;
1625 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1626 esac
bde6b06b 1627 shift
02e93a22 1628 ;;
dfe9444c 1629 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1630 exit 0;;
2304df62 1631 --) break;;
a0d0e21e 1632 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1633 *) break;;
1634 esac
1635done
1636
1637case "$error" in
1638true)
1639 cat >&2 <<EOM
2afac517 1640Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1641 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1642 -d : use defaults for all answers.
1643 -e : go on without questioning past the production of config.sh.
1644 -f : specify an alternate default configuration file.
1645 -h : print this help message and exit (with an error status).
1646 -r : reuse C symbols value if possible (skips costly nm extraction).
1647 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1648 -D : define symbol to have some value:
1649 -D symbol symbol gets the value 'define'
1650 -D symbol=value symbol gets the value 'value'
2304df62 1651 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1652 -K : do not use unless you know what you are doing.
ecfc5424 1653 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1654 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1655 -U : undefine symbol:
1656 -U symbol symbol gets the value 'undef'
1657 -U symbol= symbol gets completely empty
02e93a22 1658 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1659 -A symbol=value append " "value to symbol
02e93a22
JH
1660 -A append:symbol=value append value to symbol
1661 -A define:symbol=value define symbol to have value
02e93a22
JH
1662 -A clear:symbol define symbol to be ''
1663 -A define:symbol define symbol to be 'define'
1664 -A eval:symbol=value define symbol to be eval of value
1665 -A prepend:symbol=value prepend value to symbol
1666 -A undef:symbol define symbol to be 'undef'
1667 -A undef:symbol= define symbol to be ''
2304df62
AD
1668 -V : print version number and exit (with a zero status).
1669EOM
1670 exit 1
1671 ;;
1672esac
1673
dfe9444c
AD
1674: Sanity checks
1675case "$fastread$alldone" in
1676yescont|yesexit) ;;
1677*)
aaeb8e51
GS
1678 case "$extractsh" in
1679 true) ;;
1680 *)
1681 if test ! -t 0; then
1682 echo "Say 'sh Configure', not 'sh <Configure'"
1683 exit 1
1684 fi
1685 ;;
1686 esac
dfe9444c
AD
1687 ;;
1688esac
1689
2304df62
AD
1690exec 4>&1
1691case "$silent" in
1692true) exec 1>/dev/null;;
1693esac
1694
ecfc5424 1695: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1696touch optdef.sh
1697. ./optdef.sh
02e93a22
JH
1698: create the posthint manipulation script and leave the file out there...
1699touch posthint.sh
a0d0e21e 1700
2304df62 1701: set package name
85e6fe83 1702package=perl5
b4eb6b3d
JH
1703first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1704last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1705case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1706ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1707*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1708esac
2304df62 1709
2304df62
AD
1710: Some greps do not return status, grrr.
1711echo "grimblepritz" >grimble
1712if grep blurfldyick grimble >/dev/null 2>&1 ; then
1713 contains=contains
1714elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1715 contains=grep
1716else
1717 contains=contains
1718fi
1719rm -f grimble
1720: the following should work in any shell
1721case "$contains" in
1722contains*)
1723 echo " "
1724 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1725 cat >contains <<'EOSS'
1726grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1727EOSS
1728chmod +x contains
1729esac
1730
dfe9444c
AD
1731: Find the path to the source tree
1732case "$src" in
1733'') case "$0" in
b233458b
JH
1734 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1735 case "$src" in
1736 /*) ;;
8504afb7 1737 .) ;;
b233458b
JH
1738 *) src=`cd ../$src && pwd` ;;
1739 esac
1740 ;;
dfe9444c
AD
1741 *) src='.';;
1742 esac;;
1743esac
1744case "$src" in
1745'') src=/
1746 rsrc=/
1747 ;;
1748/*) rsrc="$src";;
1749*) rsrc="../$src";;
1750esac
1751if test -f $rsrc/Configure && \
1752 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1753then
1754 : found it, so we are ok.
1755else
1756 rsrc=''
1757 for src in . .. ../.. ../../.. ../../../..; do
1758 if test -f ../$src/Configure && \
1759 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1760 then
1761 rsrc=../$src
1762 break
1763 fi
1764 done
1765fi
1766case "$rsrc" in
1767'')
1768 cat <<EOM >&4
1769
1770Sorry, I can't seem to locate the source dir for $package. Please start
1771Configure with an explicit path -- i.e. /some/path/Configure.
1772
1773EOM
1774 exit 1
1775 ;;
1776../.) rsrc='..';;
1777*)
1778 echo " "
1779 echo "Sources for $package found in \"$src\"." >&4
1780 ;;
1781esac
1782
1783: script used to extract .SH files with variable substitutions
1784cat >extract <<'EOS'
a02608de 1785PERL_CONFIG_SH=true
dfe9444c 1786echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1787if test -f MANIFEST; then
1788 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1789else
1790 echo "(Looking for .SH files under the source directory.)"
6904989c 1791 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1792fi
1793shift
1794case $# in
6904989c 17950) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1796esac
6904989c 1797if test ! -f "$src/$1"; then
dfe9444c
AD
1798 shift
1799fi
1800mkdir_p='
1801name=$1;
1802create="";
1803while test $name; do
1804 if test ! -d "$name"; then
1805 create="$name $create";
1806 name=`echo $name | sed -e "s|^[^/]*$||"`;
1807 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1808 else
1809 name="";
1810 fi;
1811done;
1812for file in $create; do
1813 mkdir $file;
1814done
1815'
1816for file in $*; do
1817 case "$src" in
1818 ".")
1819 case "$file" in
1820 */*)
1821 dir=`expr X$file : 'X\(.*\)/'`
1822 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1823 (cd "$dir" && . ./$file)
dfe9444c
AD
1824 ;;
1825 *)
1826 . ./$file
1827 ;;
1828 esac
1829 ;;
1830 *)
1831 case "$file" in
1832 */*)
1833 dir=`expr X$file : 'X\(.*\)/'`
1834 file=`expr X$file : 'X.*/\(.*\)'`
1835 (set x $dir; shift; eval $mkdir_p)
6904989c 1836 sh <"$src/$dir/$file"
dfe9444c
AD
1837 ;;
1838 *)
6904989c 1839 sh <"$src/$file"
dfe9444c
AD
1840 ;;
1841 esac
1842 ;;
1843 esac
1844done
6904989c 1845if test -f "$src/config_h.SH"; then
dfe9444c
AD
1846 if test ! -f config.h; then
1847 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1848 . "$src/config_h.SH"
dfe9444c
AD
1849 fi
1850fi
1851EOS
1852
1853: extract files and exit if asked to do so
1854case "$extractsh" in
1855true)
1856 case "$realsilent" in
1857 true) ;;
1858 *) exec 1>&4;;
1859 esac
1860 case "$config_sh" in
1861 '') config_sh='config.sh';;
1862 esac
1863 echo " "
1864 echo "Fetching answers from $config_sh..."
1865 cd ..
1866 . $config_sh
1867 test "$override" && . ./optdef.sh
1868 echo " "
1869 . UU/extract
1870 rm -rf UU
24ccb310 1871 echo "Extraction done."
dfe9444c
AD
1872 exit 0
1873 ;;
1874esac
1875
1876: Eunice requires " " instead of "", can you believe it
1877echo " "
1878: Here we go...
1879echo "Beginning of configuration questions for $package."
1880
1881trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1882
2304df62
AD
1883: first determine how to suppress newline on echo command
1884echo " "
1885echo "Checking echo to see how to suppress newlines..."
1886(echo "hi there\c" ; echo " ") >.echotmp
1887if $contains c .echotmp >/dev/null 2>&1 ; then
1888 echo "...using -n."
1889 n='-n'
1890 c=''
1891else
1892 cat <<'EOM'
1893...using \c
1894EOM
1895 n=''
1896 c='\c'
1897fi
1898echo $n "The star should be here-->$c"
1899echo '*'
1900rm -f .echotmp
1901
1902: Now test for existence of everything in MANIFEST
1903echo " "
6904989c 1904if test -f "$rsrc/MANIFEST"; then
2304df62 1905 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1906 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1907 rm -f missing
dfe9444c 1908 tmppwd=`pwd`
2304df62 1909 for filelist in x??; do
6904989c 1910 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1911 done
1912 if test -s missing; then
1913 cat missing >&4
1914 cat >&4 <<'EOM'
1915
1916THIS PACKAGE SEEMS TO BE INCOMPLETE.
1917
1918You have the option of continuing the configuration process, despite the
1919distinct possibility that your kit is damaged, by typing 'y'es. If you
1920do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1921and contact the author (perlbug@perl.org).
2304df62
AD
1922
1923EOM
1924 echo $n "Continue? [n] $c" >&4
1925 read ans
1926 case "$ans" in
1927 y*)
1928 echo "Continuing..." >&4
1929 rm -f missing
1930 ;;
1931 *)
1932 echo "ABORTING..." >&4
1933 kill $$
1934 ;;
1935 esac
1936 else
dfe9444c 1937 echo "Looks good..."
2304df62
AD
1938 fi
1939else
1940 echo "There is no MANIFEST file. I hope your kit is complete !"
1941fi
1942rm -f missing x??
1943
5ff3f7a4
GS
1944echo " "
1945: Find the appropriate value for a newline for tr
1946if test -n "$DJGPP"; then
1947 trnl='\012'
1948fi
1949if test X"$trnl" = X; then
1950 case "`echo foo|tr '\n' x 2>/dev/null`" in
1951 foox) trnl='\n' ;;
1952 esac
1953fi
1954if test X"$trnl" = X; then
1955 case "`echo foo|tr '\012' x 2>/dev/null`" in
1956 foox) trnl='\012' ;;
1957 esac
1958fi
1959if test X"$trnl" = X; then
8be2c24c
JH
1960 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1961 fooxy) trnl='\n\r' ;;
1962 esac
1963fi
1964if test X"$trnl" = X; then
5ff3f7a4
GS
1965 cat <<EOM >&2
1966
1967$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1968
1969EOM
1970 exit 1
1971fi
1972
2304df62
AD
1973: compute the number of columns on the terminal for proper question formatting
1974case "$COLUMNS" in
1975'') COLUMNS='80';;
1976esac
1977
1978: set up the echo used in my read
1979myecho="case \"\$xxxm\" in
1980'') echo $n \"\$rp $c\" >&4;;
1981*) case \"\$rp\" in
1982 '') echo $n \"[\$xxxm] $c\";;
1983 *)
1984 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1985 echo \"\$rp\" >&4
1986 echo $n \"[\$xxxm] $c\" >&4
1987 else
1988 echo $n \"\$rp [\$xxxm] $c\" >&4
1989 fi
1990 ;;
1991 esac;;
1992esac"
1993
1994: now set up to do reads with possible shell escape and default assignment
1995cat <<EOSC >myread
28757baa 1996$startsh
2304df62
AD
1997xxxm=\$dflt
1998$myecho
1999ans='!'
2000case "\$fastread" in
2001yes) case "\$dflt" in
2002 '') ;;
2003 *) ans='';
2004 case "\$silent-\$rp" in
2005 true-) ;;
2006 *) echo " " >&4;;
2007 esac;;
2008 esac;;
2009*) case "\$silent" in
2010 true) case "\$rp" in
2011 '') ans='';;
2012 esac;;
2013 esac;;
2014esac
2015while expr "X\$ans" : "X!" >/dev/null; do
2016 read answ
2017 set x \$xxxm
2018 shift
dfe9444c 2019 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2020 case "\$answ" in
dfe9444c
AD
2021 "!")
2022 sh 1>&4
2023 echo " "
2024 $myecho
2025 ;;
2026 !*)
2027 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2028 shift
2029 sh 1>&4 -c "\$*"
2030 echo " "
2031 $myecho
2032 ;;
2304df62
AD
2033 "\$ans")
2034 case "\$ans" in
ecfc5424
AD
2035 \\&*)
2036 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2037 shift
2038 case "\$1" in
2039 -d)
2040 fastread=yes
40a7a20a 2041 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2042 ;;
2043 -*)
40a7a20a 2044 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2045 ;;
2046 esac
2047 $myecho
2048 ans=!
2049 ;;
2304df62
AD
2050 esac;;
2051 *)
2052 case "\$aok" in
2053 y)
2054 echo "*** Substitution done -- please confirm."
2055 xxxm="\$ans"
c9795ab7 2056 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2057 xxxm="\$ans"
2058 ans=!
2059 ;;
2060 *)
2061 echo "*** Error -- try again."
2062 ans=!
2063 ;;
2064 esac
2065 $myecho
2066 ;;
2067 esac
2068 case "\$ans\$xxxm\$nostick" in
2069 '')
2070 ans=!
2071 $myecho
2072 ;;
2073 esac
2074done
2075case "\$ans" in
2076'') ans="\$xxxm";;
2077esac
2078EOSC
2079
2080: create .config dir to save info across Configure sessions
2081test -d ../.config || mkdir ../.config
2082cat >../.config/README <<EOF
2083This directory created by Configure to save information that should
dfe9444c 2084persist across sessions for $package.
2304df62
AD
2085
2086You may safely delete it if you wish.
2087EOF
2088
9507cadf 2089xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2090case "$usedevel" in
0107c034 2091$define|true|[yY]*) ;;
9507cadf 2092*) case "$xversion" in
0107c034
JH
2093 *[13579])
2094 cat >&4 <<EOH
2095*** WHOA THERE!!! ***
2096
2097 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2098 The version of this $package distribution is $xversion, that is, odd,
2099 (as opposed to even) and that signifies a development release.
3d5d58b1 2100 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2101
2102 Do ***NOT*** install this into production use.
2103 Data corruption and crashes are possible.
2104
2105 It is most seriously suggested that you do not continue any further
2106 unless you want to help in developing and debugging Perl.
2107
6adc6a45
JH
2108 If you *still* want to build perl, you can answer 'y' now,
2109 or pass -Dusedevel to Configure.
2110
0107c034
JH
2111EOH
2112 rp='Do you really want to continue?'
2113 dflt='n'
2114 . ./myread
2115 case "$ans" in
8feeef0e
JH
2116 [yY]) echo >&4 "Okay, continuing."
2117 usedevel="$define" ;;
0107c034
JH
2118 *) echo >&4 "Okay, bye."
2119 exit 1
2120 ;;
2121 esac
2122 ;;
2123 esac
2124 ;;
2125esac
8feeef0e
JH
2126case "$usedevel" in
2127$define|true|[yY]*)
2128 case "$versiononly" in
2129 '') versiononly="$define" ;;
2130 esac
2131 case "$installusrbinperl" in
2132 '') installusrbinperl="$undef" ;;
2133 esac
2134 ;;
2135esac
0107c034 2136
2304df62
AD
2137: general instructions
2138needman=true
2139firsttime=true
760ac839 2140user=`(logname) 2>/dev/null`
dfe9444c
AD
2141case "$user" in
2142'') user=`whoami 2>&1`;;
760ac839 2143esac
2304df62
AD
2144if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2145 firsttime=false
2146 echo " "
2147 rp='Would you like to see the instructions?'
2148 dflt=n
2149 . ./myread
2150 case "$ans" in
2151 [yY]*) ;;
2152 *) needman=false;;
2153 esac
2154fi
2155if $needman; then
2156 cat <<EOH
4e2a5f63 2157
2304df62 2158This installation shell script will examine your system and ask you questions
a0d0e21e 2159to determine how the perl5 package should be installed. If you get
2304df62
AD
2160stuck on a question, you may use a ! shell escape to start a subshell or
2161execute a command. Many of the questions will have default answers in square
2162brackets; typing carriage return will give you the default.
2163
2164On some of the questions which ask for file or directory names you are allowed
2165to use the ~name construct to specify the login directory belonging to "name",
2166even if you don't have a shell which knows about that. Questions where this is
2167allowed will be marked "(~name ok)".
2168
2169EOH
2170 rp=''
2171 dflt='Type carriage return to continue'
2172 . ./myread
2173 cat <<'EOH'
2174
2175The prompter used in this script allows you to use shell variables and
2176backticks in your answers. You may use $1, $2, etc... to refer to the words
2177in the default answer, as if the default line was a set of arguments given to a
2178script shell. This means you may also use $* to repeat the whole default line,
2179so you do not have to re-type everything to add something to the default.
2180
2181Everytime there is a substitution, you will have to confirm. If there is an
2182error (e.g. an unmatched backtick), the default answer will remain unchanged
2183and you will be prompted again.
2184
2185If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2186the questions and use the computed defaults (or the previous answers if there
2187was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2188You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2189on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2190
2191EOH
2192 . ./myread
2193 cat <<EOH
2194
2195Much effort has been expended to ensure that this shell script will run on any
2196Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2197Configure and run it again. If you can't run Configure for some reason,
2198you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2199have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2200
2201This installation script affects things in two ways:
2202
22031) it may do direct variable substitutions on some of the files included
2204 in this kit.
22052) it builds a config.h file for inclusion in C programs. You may edit
2206 any of these files as the need arises after running this script.
2207
2208If you make a mistake on a question, there is no easy way to back up to it
2209currently. The easiest thing to do is to edit config.sh and rerun all the SH
2210files. Configure will offer to let you do this before it runs the SH files.
2211
2212EOH
2213 dflt='Type carriage return to continue'
2214 . ./myread
2215 case "$firsttime" in
2216 true) echo $user >>../.config/instruct;;
2217 esac
2218fi
2219
2304df62
AD
2220: find out where common programs are
2221echo " "
2222echo "Locating common programs..." >&4
2223cat <<EOSC >loc
2224$startsh
2225case \$# in
22260) exit 1;;
2227esac
2228thing=\$1
2229shift
2230dflt=\$1
2231shift
2232for dir in \$*; do
2233 case "\$thing" in
2234 .)
2235 if test -d \$dir/\$thing; then
2236 echo \$dir
2237 exit 0
2238 fi
2239 ;;
2240 *)
a0d0e21e 2241 for thisthing in \$dir/\$thing; do
ecfc5424 2242 : just loop through to pick last item
a0d0e21e 2243 done
25f94b33 2244 if test -f \$thisthing; then
a0d0e21e 2245 echo \$thisthing
2304df62 2246 exit 0
a5a94ea5
JH
2247 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2248 echo \$thisthing
2249 exit 0
2304df62 2250 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2251 if test -n "$DJGPP"; then
2252 echo \$dir/\$thing.exe
b921d661 2253 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2254 : on Eunice apparently
2255 echo \$dir/\$thing
b921d661 2256 exit 0
c4f23d77 2257 fi
2d736872 2258 exit 0
2304df62
AD
2259 fi
2260 ;;
2261 esac
2262done
2263echo \$dflt
2264exit 1
2265EOSC
2266chmod +x loc
2267$eunicefix loc
2268loclist="
2269awk
2270cat
f8006fac 2271chmod
b4eb6b3d
JH
2272comm
2273cp
2304df62
AD
2274echo
2275expr
2276grep
a0d0e21e 2277ls
b4eb6b3d 2278mkdir
2304df62
AD
2279rm
2280sed
b4eb6b3d 2281sort
85e6fe83 2282touch
2304df62 2283tr
b4eb6b3d 2284uniq
2304df62
AD
2285"
2286trylist="
2287Mcc
dfe9444c 2288ar
3659ebf1 2289bison
b4eb6b3d 2290byacc
2304df62 2291cpp
b4eb6b3d 2292csh
2304df62
AD
2293date
2294egrep
1fef16b3 2295gmake
8ff267be 2296gzip
b4eb6b3d 2297less
8ff267be 2298ln
3c728e00 2299make
b4eb6b3d 2300more
693762b4 2301nm
b4eb6b3d
JH
2302nroff
2303pg
2304df62
AD
2304test
2305uname
8ff267be 2306zip
2304df62 2307"
8e07c86e 2308pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2309pth="$pth /lib /usr/lib"
2310for file in $loclist; do
dfe9444c
AD
2311 eval xxx=\$$file
2312 case "$xxx" in
2313 /*|?:[\\/]*)
2314 if test -f "$xxx"; then
2315 : ok
2316 else
2317 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2318 xxx=`./loc $file $file $pth`
2319 fi
2320 ;;
2321 '') xxx=`./loc $file $file $pth`;;
2322 *) xxx=`./loc $xxx $xxx $pth`;;
2323 esac
a5a94ea5 2324 eval $file=$xxx$_exe
2304df62
AD
2325 eval _$file=$xxx
2326 case "$xxx" in
2327 /*)
2328 echo $file is in $xxx.
2329 ;;
8e07c86e
AD
2330 ?:[\\/]*)
2331 echo $file is in $xxx.
2332 ;;
2304df62 2333 *)
25f94b33
AD
2334 echo "I don't know where '$file' is, and my life depends on it." >&4
2335 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2336 exit 1
2304df62
AD
2337 ;;
2338 esac
2339done
2340echo " "
2341echo "Don't worry if any of the following aren't found..."
2342say=offhand
2343for file in $trylist; do
dfe9444c
AD
2344 eval xxx=\$$file
2345 case "$xxx" in
2346 /*|?:[\\/]*)
2347 if test -f "$xxx"; then
2348 : ok
2349 else
2350 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2351 xxx=`./loc $file $file $pth`
2352 fi
2353 ;;
2354 '') xxx=`./loc $file $file $pth`;;
2355 *) xxx=`./loc $xxx $xxx $pth`;;
2356 esac
306a8474 2357 eval $file=$xxx$_exe
2304df62
AD
2358 eval _$file=$xxx
2359 case "$xxx" in
2360 /*)
2361 echo $file is in $xxx.
2362 ;;
8e07c86e
AD
2363 ?:[\\/]*)
2364 echo $file is in $xxx.
2365 ;;
2304df62
AD
2366 *)
2367 echo "I don't see $file out there, $say."
2368 say=either
2369 ;;
2370 esac
2371done
2372case "$egrep" in
1fef16b3 2373egrep)
2304df62
AD
2374 echo "Substituting grep for egrep."
2375 egrep=$grep
868439a2 2376 _egrep=$grep
2304df62
AD
2377 ;;
2378esac
8ff267be 2379case "$ln" in
1fef16b3 2380ln)
8ff267be 2381 echo "Substituting cp for ln."
2382 ln=$cp
868439a2 2383 _ln=$cp
8ff267be 2384 ;;
2385esac
2e26f1d5
JH
2386case "$make" in
2387make)
2388 case "$gmake" in
2389 gmake)
2390 echo "I can't find make or gmake, and my life depends on it." >&4
2391 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2392 exit 1
2393 ;;
2394 esac
2395 ;;
2396esac
2397case "$gmake" in
2398gmake) ;;
2399*) # We can't have osname yet.
1fef16b3
JH
2400 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2401 # Assume that gmake, if found, is definitely GNU make
2402 # and prefer it over the system make.
2403 echo "Substituting gmake for make."
2404 make=$gmake
868439a2 2405 _make=$gmake
1fef16b3
JH
2406 fi
2407 ;;
a5a94ea5 2408esac
2304df62
AD
2409case "$test" in
2410test)
2411 echo "Hopefully test is built into your sh."
2412 ;;
2413*)
73614538 2414 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2415 echo "Using the test built into your sh."
2304df62
AD
2416 test=test
2417 _test=test
2418 fi
2419 ;;
2420esac
2421case "$echo" in
2422echo)
2423 echo "Hopefully echo is built into your sh."
2424 ;;
2425'') ;;
2426*)
2427 echo " "
2428echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2429 $echo $n "hi there$c" >foo1
2430 echo $n "hi there$c" >foo2
2431 if cmp foo1 foo2 >/dev/null 2>&1; then
2432 echo "They are compatible. In fact, they may be identical."
2433 else
2434 case "$n" in
2435 '-n') n='' c='\c';;
2436 *) n='-n' c='';;
2437 esac
2438 cat <<FOO
2439They are not compatible! You are probably running ksh on a non-USG system.
2440I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2441have echo built in and we may have to run some Bourne shell scripts. That
2442means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2443
2444FOO
2445 $echo $n "The star should be here-->$c"
2446 $echo "*"
2447 fi
2448 $rm -f foo1 foo2
2449 ;;
2450esac
2451
6b769f8f 2452cat <<EOS >trygcc
2573c5f9
JH
2453$startsh
2454EOS
6b769f8f 2455cat <<'EOSC' >>trygcc
2573c5f9
JH
2456case "$cc" in
2457'') ;;
2458*) $rm -f try try.*
2459 $cat >try.c <<EOM
2460int main(int argc, char *argv[]) {
2461 return 0;
2462}
2463EOM
e4778687 2464 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2465 :
2466 else
2467 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2468 despair=yes
2469 trygcc=yes
2470 case "$cc" in
2471 *gcc*) trygcc=no ;;
2472 esac
2473 case "`$cc -v -c try.c 2>&1`" in
2474 *gcc*) trygcc=no ;;
2475 esac
2476 if $test X"$trygcc" = Xyes; then
2477 if gcc -o try -c try.c; then
2478 echo " "
2479 echo "You seem to have a working gcc, though." >&4
2480 rp="Would you like to use it?"
2481 dflt=y
2482 if $test -f myread; then
2483 . ./myread
2484 else
2485 if $test -f UU/myread; then
2486 . ./UU/myread
2487 else
2488 echo "Cannot find myread, sorry. Aborting." >&2
2489 exit 1
2490 fi
2491 fi
2492 case "$ans" in
6371411c
RB
2493 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2494 if $test -f usethreads.cbu; then
2495 $cat >&4 <<EOM
2496
2497*** However, any setting of the C compiler flags (e.g. for thread support)
2498*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2499*** (together with e.g. -Dusethreads).
2500
2501EOM
2502 fi;;
2573c5f9
JH
2503 esac
2504 fi
2505 fi
6b769f8f
RB
2506 fi
2507 $rm -f try try.*
2508 ;;
2509esac
2510EOSC
2511
2512cat <<EOS >checkcc
2513$startsh
2514EOS
2515cat <<'EOSC' >>checkcc
2516case "$cc" in
2517'') ;;
2518*) $rm -f try try.*
2519 $cat >try.c <<EOM
2520int main(int argc, char *argv[]) {
2521 return 0;
2522}
2523EOM
2524 if $cc -o try $ccflags $ldflags try.c; then
2525 :
2526 else
2573c5f9 2527 if $test X"$despair" = Xyes; then
6b769f8f
RB
2528 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2529 fi
2530 $cat >&4 <<EOM
5dd4fbdf
MB
2531You need to find a working C compiler.
2532Either (purchase and) install the C compiler supplied by your OS vendor,
2533or for a free C compiler try http://gcc.gnu.org/
2534I cannot continue any further, aborting.
2535EOM
6b769f8f 2536 exit 1
2573c5f9
JH
2537 fi
2538 $rm -f try try.*
2539 ;;
2540esac
2541EOSC
2542
a0d0e21e
LW
2543: determine whether symbolic links are supported
2544echo " "
2545$touch blurfl
2546if $ln -s blurfl sym > /dev/null 2>&1 ; then
2547 echo "Symbolic links are supported." >&4
818f00be 2548 lns="$ln -s"
a0d0e21e
LW
2549else
2550 echo "Symbolic links are NOT supported." >&4
2551 lns="$ln"
2552fi
2553$rm -f blurfl sym
2554
dafca956
JH
2555: determine whether symbolic links are supported
2556echo " "
2557case "$lns" in
18ea2752 2558*"ln"*" -s")
dafca956
JH
2559 echo "Checking how to test for symbolic links..." >&4
2560 $lns blurfl sym
4b661809 2561 if $test "X$issymlink" = X; then
2e2a97a6
JH
2562 case "$newsh" in
2563 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2564 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2565 esac
5d644a95
MB
2566 if test $? = 0; then
2567 issymlink="test -h"
2e2a97a6
JH
2568 else
2569 echo "Your builtin 'test -h' may be broken." >&4
2570 case "$test" in
2571 /*) ;;
2572 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2573 for p in $pth
2574 do
2575 if test -f "$p/$test"; then
2576 test="$p/$test"
2577 break
2578 fi
2579 done
2580 ;;
2581 esac
2582 case "$test" in
2583 /*)
2584 echo "Trying external '$test -h'." >&4
2585 issymlink="$test -h"
2586 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2587 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2588 issymlink=''
2589 fi
2590 ;;
2591 *) issymlink='' ;;
2592 esac
5d644a95
MB
2593 fi
2594 fi
4b661809 2595 if $test "X$issymlink" = X; then
dafca956 2596 if $test -L sym 2>/dev/null; then
5d644a95 2597 issymlink="$test -L"
2e2a97a6 2598 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2599 fi
2600 fi
4b661809 2601 if $test "X$issymlink" != X; then
5d644a95 2602 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2603 else
2604 echo "I do not know how you can test for symbolic links." >&4
2605 fi
2606 $rm -f blurfl sym
2607 ;;
2608*) echo "No symbolic links, so not testing for their testing..." >&4
2609 ;;
2610esac
2611echo " "
2612
2613
2614case "$mksymlinks" in
2615$define|true|[yY]*)
2616 case "$src" in
2617 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2618 exit 1
2619 ;;
4b661809 2620 *) case "$lns:$issymlink" in
f314eb9f 2621 *"ln"*" -s:"*"test -"?)
dafca956
JH
2622 echo "Creating the symbolic links..." >&4
2623 echo "(First creating the subdirectories...)" >&4
2624 cd ..
2625 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2626 read directory
2627 test -z "$directory" && break
2628 mkdir -p $directory
2629 done
2630 # Sanity check 1.
2631 if test ! -d t/base; then
2632 echo "Failed to create the subdirectories. Aborting." >&4
2633 exit 1
2634 fi
2635 echo "(Then creating the symlinks...)" >&4
2636 awk '{print $1}' $src/MANIFEST | while true; do
2637 read filename
2638 test -z "$filename" && break
2639 if test -f $filename; then
5d644a95 2640 if $issymlink $filename; then
dafca956
JH
2641 rm -f $filename
2642 fi
2643 fi
2644 if test -f $filename; then
2645 echo "$filename already exists, not symlinking."
2646 else
2647 ln -s $src/$filename $filename
2648 fi
2649 done
2650 # Sanity check 2.
a0d24b8a
JH
2651 if test ! -f t/base/lex.t; then
2652 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2653 exit 1
2654 fi
2655 cd UU
2656 ;;
2657 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2658 ;;
2659 esac
2660 ;;
2661 esac
2662 ;;
2663esac
2664
5440bc8e
JH
2665
2666case "$usecrosscompile" in
2667$define|true|[yY]*)
93bc48fa 2668 $echo "Cross-compiling..."
5440bc8e
JH
2669 croak=''
2670 case "$cc" in
2671 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2672 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2673 ar=$targetarch-ar
2674 # leave out ld, choosing it is more complex
2675 nm=$targetarch-nm
2676 ranlib=$targetarch-ranlib
93bc48fa 2677 $echo 'extern int foo;' > try.c
f8006fac 2678 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2679 shift
2680 if $test $# -gt 0; then
2681 incpth="$incpth $*"
f8006fac
JH
2682 incpth="`$echo $incpth|$sed 's/^ //'`"
2683 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2684 for i in $*; do
f8006fac 2685 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2686 if $test -d $j; then
2687 libpth="$libpth $j"
2688 fi
2689 done
f8006fac
JH
2690 libpth="`$echo $libpth|$sed 's/^ //'`"
2691 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2692 fi
2693 $rm -f try.c
5440bc8e
JH
2694 ;;
2695 esac
2696 case "$targetarch" in
93bc48fa
JH
2697 '') echo "Targetarch not defined." >&4; croak=y ;;
2698 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2699 esac
2700 case "$incpth" in
93bc48fa 2701 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2702 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2703 esac
2704 case "$libpth" in
93bc48fa 2705 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2706 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2707 esac
93bc48fa
JH
2708 case "$usrinc" in
2709 '') for i in $incpth; do
2710 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2711 usrinc=$i
2712 echo "Guessing usrinc $usrinc." >&4
2713 break
2714 fi
2715 done
2716 case "$usrinc" in
2717 '') echo "Usrinc not defined." >&4; croak=y ;;
2718 esac
2719 ;;
2720 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2721 esac
93bc48fa
JH
2722 case "$targethost" in
2723 '') echo "Targethost not defined." >&4; croak=y ;;
2724 *) echo "Using targethost $targethost." >&4
5440bc8e 2725 esac
93bc48fa
JH
2726 locincpth=' '
2727 loclibpth=' '
5440bc8e 2728 case "$croak" in
93bc48fa 2729 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2730 esac
2731 case "$src" in
2732 /*) run=$src/Cross/run
93c0359c 2733 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2734 to=$src/Cross/to
2735 from=$src/Cross/from
2736 ;;
93bc48fa 2737 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2738 run=$pwd/Cross/run
f8006fac 2739 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2740 to=$pwd/Cross/to
2741 from=$pwd/Cross/from
2742 ;;
2743 esac
2744 case "$targetrun" in
2745 '') targetrun=ssh ;;
2746 esac
2747 case "$targetto" in
2748 '') targetto=scp ;;
2749 esac
2750 case "$targetfrom" in
2751 '') targetfrom=scp ;;
2752 esac
2753 run=$run-$targetrun
2754 to=$to-$targetto
2755 from=$from-$targetfrom
93bc48fa
JH
2756 case "$targetdir" in
2757 '') targetdir=/tmp
2758 echo "Guessing targetdir $targetdir." >&4
2759 ;;
2760 esac
5440bc8e 2761 case "$targetuser" in
93bc48fa
JH
2762 '') targetuser=root
2763 echo "Guessing targetuser $targetuser." >&4
2764 ;;
5440bc8e
JH
2765 esac
2766 case "$targetfrom" in
2767 scp) q=-q ;;
2768 *) q='' ;;
2769 esac
2770 case "$targetrun" in
2771 ssh|rsh)
2772 cat >$run <<EOF
2773#!/bin/sh
93c0359c
JH
2774case "\$1" in
2775-cwd)
2776 shift
2777 cwd=\$1
2778 shift
2779 ;;
2780esac
2781case "\$cwd" in
2782'') cwd=$targetdir ;;
2783esac
5440bc8e
JH
2784exe=\$1
2785shift
93c0359c
JH
2786if $test ! -f \$exe.xok; then
2787 $to \$exe
2788 $touch \$exe.xok
2789fi
2790$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2791EOF
2792 ;;
93bc48fa 2793 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2794 exit 1
2795 ;;
2796 esac
93c0359c
JH
2797 case "$targetmkdir" in
2798 */Cross/mkdir)
2799 cat >$targetmkdir <<EOF
2800#!/bin/sh
2801$targetrun -l $targetuser $targethost "mkdir -p \$@"
2802EOF
f8006fac 2803 $chmod a+rx $targetmkdir
93c0359c
JH
2804 ;;
2805 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2806 exit 1
2807 ;;
2808 esac
5440bc8e
JH
2809 case "$targetto" in
2810 scp|rcp)
2811 cat >$to <<EOF
2812#!/bin/sh
2813for f in \$@
2814do
93c0359c
JH
2815 case "\$f" in
2816 /*)
2817 $targetmkdir \`dirname \$f\`
2818 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2819 ;;
2820 *)
2821 $targetmkdir $targetdir/\`dirname \$f\`
2822 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2823 ;;
2824 esac
5440bc8e
JH
2825done
2826exit 0
2827EOF
2828 ;;
2829 cp) cat >$to <<EOF
2830#!/bin/sh
93c0359c
JH
2831for f in \$@
2832do
2833 case "\$f" in
2834 /*)
2835 $mkdir -p $targetdir/\`dirname \$f\`
2836 $cp \$f $targetdir/\$f || exit 1
2837 ;;
2838 *)
2839 $targetmkdir $targetdir/\`dirname \$f\`
2840 $cp \$f $targetdir/\$f || exit 1
2841 ;;
2842 esac
2843done
2844exit 0
5440bc8e
JH
2845EOF
2846 ;;
93bc48fa 2847 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2848 exit 1
2849 ;;
2850 esac
2851 case "$targetfrom" in
2852 scp|rcp)
2853 cat >$from <<EOF
2854#!/bin/sh
2855for f in \$@
2856do
93c0359c 2857 $rm -f \$f
5440bc8e
JH
2858 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2859done
2860exit 0
2861EOF
2862 ;;
2863 cp) cat >$from <<EOF
2864#!/bin/sh
2865for f in \$@
2866do
93c0359c 2867 $rm -f \$f
5440bc8e
JH
2868 cp $targetdir/\$f . || exit 1
2869done
2870exit 0
2871EOF
2872 ;;
93bc48fa 2873 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2874 exit 1
2875 ;;
2876 esac
93bc48fa
JH
2877 if $test ! -f $run; then
2878 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2879 else
f8006fac 2880 $chmod a+rx $run
5440bc8e 2881 fi
93bc48fa
JH
2882 if $test ! -f $to; then
2883 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2884 else
f8006fac 2885 $chmod a+rx $to
5440bc8e 2886 fi
93bc48fa
JH
2887 if $test ! -f $from; then
2888 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2889 else
f8006fac 2890 $chmod a+rx $from
5440bc8e 2891 fi
93bc48fa 2892 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2893 exit 1
2894 fi
2895 cat >&4 <<EOF
f8006fac
JH
2896Using '$run' for remote execution,
2897and '$from' and '$to'
93bc48fa 2898for remote file transfer.
5440bc8e
JH
2899EOF
2900 ;;
2901*) run=''
2902 to=:
2903 from=:
2904 usecrosscompile='undef'
2905 targetarch=''
2906 ;;
2907esac
2908
ecfc5424
AD
2909: see whether [:lower:] and [:upper:] are supported character classes
2910echo " "
ecfc5424
AD
2911case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2912ABYZ)
2913 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2914 up='[:upper:]'
2915 low='[:lower:]'
2916 ;;
416d0bea
MB
2917*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2918 # (0xd9 and 0xe2), therefore that is a nice testing point.
2919 if test "X$up" = X -o "X$low" = X; then
2920 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2921 rs) up='[A-Z]'
2922 low='[a-z]'
28e8609d
JH
2923 ;;
2924 esac
416d0bea 2925 fi
28e8609d 2926 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2927 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2928 rs) up='A-Z'
28e8609d
JH
2929 low='a-z'
2930 ;;
2931 esac
416d0bea 2932 fi
28e8609d 2933 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2934 case "`echo RS | od -x 2>/dev/null`" in
2935 *D9E2*|*d9e2*)
28e8609d
JH
2936 echo "Hey, this might be EBCDIC." >&4
2937 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2938 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2939 rs) up='[A-IJ-RS-Z]'
2940 low='[a-ij-rs-z]'
28e8609d
JH
2941 ;;
2942 esac
2943 fi
2944 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2945 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2946 rs) up='A-IJ-RS-Z'
2947 low='a-ij-rs-z'
28e8609d
JH
2948 ;;
2949 esac
2950 fi
2951 ;;
2952 esac
2953 fi
2954esac
416d0bea
MB
2955case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2956rs)
28e8609d
JH
2957 echo "Using $up and $low to convert case." >&4
2958 ;;
ecfc5424 2959*)
28e8609d
JH
2960 echo "I don't know how to translate letters from upper to lower case." >&4
2961 echo "Your tr is not acting any way I know of." >&4
2962 exit 1
2963 ;;
ecfc5424
AD
2964esac
2965: set up the translation script tr, must be called with ./tr of course
2966cat >tr <<EOSC
2967$startsh
2968case "\$1\$2" in
2969'[A-Z][a-z]') exec $tr '$up' '$low';;
2970'[a-z][A-Z]') exec $tr '$low' '$up';;
2971esac
2972exec $tr "\$@"
2973EOSC
2974chmod +x tr
2975$eunicefix tr
2976
2304df62
AD
2977: Try to determine whether config.sh was made on this system
2978case "$config_sh" in
2979'')
43999f95
JH
2980myuname=`$uname -a 2>/dev/null`
2981$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2982# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2983# because the A-Z/a-z are not consecutive.
a0d0e21e 2984myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2985 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2986newmyuname="$myuname"
2304df62 2987dflt=n
16d20bd9
AD
2988case "$knowitall" in
2989'')
2990 if test -f ../config.sh; then
2991 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2992 eval "`grep myuname= ../config.sh`"
2993 fi
2994 if test "X$myuname" = "X$newmyuname"; then
2995 dflt=y
2996 fi
2304df62 2997 fi
16d20bd9
AD
2998 ;;
2999*) dflt=y;;
3000esac
2304df62
AD
3001
3002: Get old answers from old config file if Configure was run on the
3003: same system, otherwise use the hints.
3004hint=default
3005cd ..
3006if test -f config.sh; then
16d20bd9
AD
3007 echo " "
3008 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3009 . UU/myread
3010 case "$ans" in
f83701cd
AD
3011 n*|N*) echo "OK, I'll ignore it."
3012 mv config.sh config.sh.old
3013 myuname="$newmyuname"
3014 ;;
2304df62 3015 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3016 tmp_n="$n"
3017 tmp_c="$c"
85cad39c 3018 tmp_sh="$sh"
2304df62
AD
3019 . ./config.sh
3020 cp config.sh UU
ecfc5424
AD
3021 n="$tmp_n"
3022 c="$tmp_c"
85cad39c 3023 : Older versions did not always set $sh. Catch re-use of such
3024 : an old config.sh.
3025 case "$sh" in
3026 '') sh="$tmp_sh" ;;
3027 esac
2304df62
AD
3028 hint=previous
3029 ;;
3030 esac
3031fi
2573c5f9 3032. ./UU/checkcc
2304df62
AD
3033if test ! -f config.sh; then
3034 $cat <<EOM
3035
4e2a5f63
AD
3036First time through, eh? I have some defaults handy for some systems
3037that need some extra help getting the Configure answers right:
2304df62
AD
3038
3039EOM
dfe9444c 3040 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3041 dflt=''
3042 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3043 : tests or hints, please send them to perlbug@perl.org
2304df62 3044 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3045 $test -f /irix && osname=irix
85e6fe83
LW
3046 $test -f /xenix && osname=sco_xenix
3047 $test -f /dynix && osname=dynix
3048 $test -f /dnix && osname=dnix
5f05dabc 3049 $test -f /lynx.os && osname=lynxos
3050 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3051 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3052 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3053 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3054 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3055 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3056 $test -d /usr/apollo/bin && osname=apollo
3057 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3058 $test -d /usr/include/minix && osname=minix
d54344fc 3059 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3060 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3061 osname=machten
4633a7c4 3062 if $test -x /sbin/version; then
dfe9444c 3063 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3064 $sed -e 's/[A-Za-z]$//'`
3065 elif $test -x /usr/etc/version; then
dfe9444c 3066 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3067 $sed -e 's/[A-Za-z]$//'`
3068 else
3069 osvers="$2.$3"
3070 fi
3071 fi
aaacdc8b
GS
3072
3073 $test -f /sys/posix.dll &&
3074 $test -f /usr/bin/what &&
3075 set X `/usr/bin/what /sys/posix.dll` &&
3076 $test "$3" = UWIN &&
3077 osname=uwin &&
3078 osvers="$5"
3079
2304df62
AD
3080 if $test -f $uname; then
3081 set X $myuname
3082 shift
3083
2304df62 3084 case "$5" in
85e6fe83 3085 fps*) osname=fps ;;
2304df62
AD
3086 mips*)
3087 case "$4" in
85e6fe83
LW
3088 umips) osname=umips ;;
3089 *) osname=mips ;;
2304df62 3090 esac;;
85e6fe83
LW
3091 [23]100) osname=mips ;;
3092 next*) osname=next ;;
ecfc5424 3093 i386*)
c6912327
JH
3094 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3095 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3096 osname='sco'
3097 osvers=$tmp
3098 elif $test -f /etc/kconfig; then
ecfc5424 3099 osname=isc
bd628c73 3100 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3101 osvers=4
3102 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3103 osvers=3
2304df62 3104 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3105 osvers=2
ecfc5424
AD
3106 fi
3107 fi
2000072c 3108 tmp=''
ecfc5424 3109 ;;
c4f23d77
AD
3110 pc*)
3111 if test -n "$DJGPP"; then
3112 osname=dos
3113 osvers=djgpp
3114 fi
3115 ;;
2304df62
AD
3116 esac
3117
3118 case "$1" in
a0d0e21e
LW
3119 aix) osname=aix
3120 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3121 case "$tmp" in
e81c5c2a
NC
3122 # oslevel can fail with:
3123 # oslevel: Unable to acquire lock.
3124 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3125 '<3240'|'<>3240') osvers=3.2.0 ;;
3126 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3127 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3128 *) osvers=$tmp;;
a0d0e21e
LW
3129 esac
3130 ;;
aaacdc8b
GS
3131 bsd386) osname=bsd386
3132 osvers=`$uname -r`
3133 ;;
3134 cygwin*) osname=cygwin
3135 osvers="$3"
3136 ;;
23f87696
SZ
3137 *dc.osx) osname=dcosx
3138 osvers="$3"
3139 ;;
a0d0e21e
LW
3140 dnix) osname=dnix
3141 osvers="$3"
3142 ;;
3143 domainos) osname=apollo
3144 osvers="$3"
3145 ;;
a774dfe6
RSG
3146 dgux) osname=dgux
3147 osvers="$3"
3148 ;;
3149 dragonfly) osname=dragonfly
a0d0e21e
LW
3150 osvers="$3"
3151 ;;
760ac839 3152 dynixptx*) osname=dynixptx
e58e581d 3153 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3154 ;;
a774dfe6 3155 freebsd) osname=freebsd
a0d0e21e 3156 osvers="$3" ;;
761ee4e8
BD
3157 genix) osname=genix ;;
3158 gnu) osname=gnu
3159 osvers="$3" ;;
a774dfe6 3160 hp*) osname=hpux
bfb7748a 3161 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3162 ;;
761ee4e8 3163 irix*) osname=irix
a0d0e21e
LW
3164 case "$3" in
3165 4*) osvers=4 ;;
3166 5*) osvers=5 ;;
ecfc5424 3167 *) osvers="$3" ;;
a0d0e21e
LW
3168 esac
3169 ;;
761ee4e8 3170 linux) osname=linux
a0d0e21e 3171 case "$3" in
a0d0e21e
LW
3172 *) osvers="$3" ;;
3173 esac
3174 ;;
761ee4e8 3175 MiNT) osname=mint
28e8609d
JH
3176 ;;
3177 netbsd*) osname=netbsd
ecfc5424
AD
3178 osvers="$3"
3179 ;;
4e81affe
MM
3180 news-os) osvers="$3"
3181 case "$3" in
3182 4*) osname=newsos4 ;;
3183 *) osname=newsos ;;
3184 esac
3185 ;;
aaacdc8b 3186 next*) osname=next ;;
28bb1e2c 3187 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3188 openbsd) osname=openbsd
3189 osvers="$3"
3190 ;;
5c728af0
IZ
3191 os2) osname=os2
3192 osvers="$4"
3193 ;;
aaacdc8b
GS
3194 POSIX-BC | posix-bc ) osname=posix-bc
3195 osvers="$3"
a0d0e21e 3196 ;;
ae3afa4e
TH
3197 powerux | power_ux | powermax_os | powermaxos | \
3198 powerunix | power_unix) osname=powerux
3199 osvers="$3"
3200 ;;
aaacdc8b
GS
3201 qnx) osname=qnx
3202 osvers="$4"
3203 ;;
a0d0e21e
LW
3204 solaris) osname=solaris
3205 case "$3" in
3206 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3207 *) osvers="$3" ;;
a0d0e21e
LW
3208 esac
3209 ;;
85e6fe83
LW
3210 sunos) osname=sunos
3211 case "$3" in
85e6fe83
LW
3212 5*) osname=solaris
3213 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3214 *) osvers="$3" ;;
2304df62
AD
3215 esac
3216 ;;
a0d0e21e 3217 titanos) osname=titanos
85e6fe83 3218 case "$3" in
a0d0e21e
LW
3219 1*) osvers=1 ;;
3220 2*) osvers=2 ;;
3221 3*) osvers=3 ;;
3222 4*) osvers=4 ;;
ecfc5424 3223 *) osvers="$3" ;;
2304df62
AD
3224 esac
3225 ;;
85e6fe83 3226 ultrix) osname=ultrix
ecfc5424 3227 osvers="$3"
2304df62 3228 ;;
28757baa 3229 osf1|mls+) case "$5" in
fed7345c
AD
3230 alpha)
3231 osname=dec_osf
fdd85a03 3232 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3233 case "$osvers" in
3234 [1-9].[0-9]*) ;;
3235 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3236 esac
ecfc5424
AD
3237 ;;
3238 hp*) osname=hp_osf1 ;;
3239 mips) osname=mips_osf1 ;;
85e6fe83
LW
3240 esac
3241 ;;
af1ff193 3242 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3243 openunix|unixware) osname=svr5
0337d152
BG
3244 osvers="$4"
3245 ;;
3c728e00 3246 uts) osname=uts
a0d0e21e
LW
3247 osvers="$3"
3248 ;;
3c728e00
JH
3249 vos) osvers="$3"
3250 ;;
85e6fe83 3251 $2) case "$osname" in
2304df62 3252 *isc*) ;;
a0d0e21e 3253 *freebsd*) ;;
5f05dabc 3254 svr*)
a0d0e21e 3255 : svr4.x or possibly later
a774dfe6 3256 case "svr$3" in
a0d0e21e
LW
3257 ${osname}*)
3258 osname=svr$3
3259 osvers=$4
3260 ;;
3261 esac
3262 case "$osname" in
3263 svr4.0)
3264 : Check for ESIX
3265 if test -f /stand/boot ; then
3266 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3267 if test -n "$INITPROG" -a -f "$INITPROG"; then
3268 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3269 if test -n "$isesix"; then
a0d0e21e
LW
3270 osname=esix4
3271 fi
3272 fi
3273 fi
3274 ;;
3275 esac
3276 ;;
2304df62 3277 *) if test -f /etc/systemid; then
a0d0e21e
LW
3278 osname=sco
3279 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3280 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3281 osvers=$1.$2.$3
c4f23d77 3282 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3283 osvers=$1.$2
c4f23d77 3284 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3285 osvers=$1
2304df62 3286 fi
a0d0e21e
LW
3287 else
3288 case "$osname" in
3289 '') : Still unknown. Probably a generic Sys V.
3290 osname="sysv"
3291 osvers="$3"
3292 ;;
3293 esac
2304df62
AD
3294 fi
3295 ;;
3296 esac
3297 ;;
a0d0e21e
LW
3298 *) case "$osname" in
3299 '') : Still unknown. Probably a generic BSD.
3300 osname="$1"
3301 osvers="$3"
3302 ;;
3303 esac
3304 ;;
2304df62
AD
3305 esac
3306 else
dfe9444c
AD
3307 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3308 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3309 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3310 osname=news_os
2304df62 3311 fi
dfe9444c 3312 $rm -f UU/kernel.what
5c728af0 3313 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3314 set X $myuname
3315 osname=os2
3316 osvers="$5"
2304df62
AD
3317 fi
3318 fi
a774dfe6 3319
5440bc8e
JH
3320 case "$targetarch" in
3321 '') ;;
3322 *) hostarch=$osname
3323 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3324 osvers=''
3325 ;;
3326 esac
3327
a0d0e21e
LW
3328 : Now look for a hint file osname_osvers, unless one has been
3329 : specified already.
3330 case "$hintfile" in
3331 ''|' ')
1e127011 3332 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3333 : Also try without trailing minor version numbers.
1e127011
DD
3334 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3335 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3336 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3337 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3338 case "$file" in
3339 '') dflt=none ;;
3340 *) case "$osvers" in
3341 '') dflt=$file
3342 ;;
dfe9444c 3343 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3344 dflt=$file
dfe9444c 3345 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3346 dflt=$xfile
dfe9444c 3347 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3348 dflt=$xxfile
dfe9444c 3349 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3350 dflt=$xxxfile
dfe9444c 3351 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3352 dflt=$xxxxfile
dfe9444c 3353 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3354 dflt="${osname}"
3355 else
3356 dflt=none
3357 fi
3358 ;;
3359 esac
85e6fe83
LW
3360 ;;
3361 esac
4e2a5f63
AD
3362 if $test -f Policy.sh ; then
3363 case "$dflt" in
3364 *Policy*) ;;
3365 none) dflt="Policy" ;;
3366 *) dflt="Policy $dflt" ;;
3367 esac
3368 fi
85e6fe83 3369 ;;
a0d0e21e 3370 *)
ecfc5424 3371 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3372 ;;
2304df62 3373 esac
1aef975c 3374
4e2a5f63
AD
3375 if $test -f Policy.sh ; then
3376 $cat <<EOM
3377
3378There's also a Policy hint file available, which should make the
3379site-specific (policy) questions easier to answer.
3380EOM
3381
3382 fi
3383
2304df62
AD
3384 $cat <<EOM
3385
3386You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63 3387A well-behaved OS will have no hints, so answering "none" or just "Policy"
a3635516 3388is a good thing. DO NOT give a wrong version or a wrong OS.
2304df62
AD
3389
3390EOM
4e2a5f63 3391
2304df62 3392 rp="Which of these apply, if any?"
dfe9444c 3393 . UU/myread
85e6fe83
LW
3394 tans=$ans
3395 for file in $tans; do
4e2a5f63
AD
3396 if $test X$file = XPolicy -a -f Policy.sh; then
3397 . Policy.sh
3398 $cat Policy.sh >> UU/config.sh
3399 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3400 . $src/hints/$file.sh
3401 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3402 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3403 : nothing
3404 else
85e6fe83
LW
3405 : Give one chance to correct a possible typo.
3406 echo "$file.sh does not exist"
3407 dflt=$file
3408 rp="hint to use instead?"
dfe9444c 3409 . UU/myread
85e6fe83 3410 for file in $ans; do
dfe9444c
AD
3411 if $test -f "$src/hints/$file.sh"; then
3412 . $src/hints/$file.sh
3413 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3414 elif $test X$ans = X -o X$ans = Xnone ; then
3415 : nothing
3416 else
3417 echo "$file.sh does not exist -- ignored."
3418 fi
3419 done
2304df62
AD
3420 fi
3421 done
85e6fe83 3422
2304df62 3423 hint=recommended
85e6fe83 3424 : Remember our hint file for later.
dfe9444c 3425 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3426 hintfile="$file"
85e6fe83 3427 else
a0d0e21e 3428 hintfile=''
85e6fe83 3429 fi
2304df62
AD
3430fi
3431cd UU
3432;;
3433*)
3434 echo " "
3435 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3436 tmp_n="$n"
3437 tmp_c="$c"
2304df62
AD
3438 cd ..
3439 cp $config_sh config.sh 2>/dev/null
a78b0d02 3440 chmod +w config.sh
2304df62
AD
3441 . ./config.sh
3442 cd UU
3443 cp ../config.sh .
ecfc5424
AD
3444 n="$tmp_n"
3445 c="$tmp_c"
2304df62
AD
3446 hint=previous
3447 ;;
3448esac
1aef975c 3449test "$override" && . ./optdef.sh
2304df62
AD
3450
3451: Restore computed paths
3452for file in $loclist $trylist; do
3453 eval $file="\$_$file"
3454done
3455
85e6fe83 3456cat << EOM
a0d0e21e 3457
85e6fe83 3458Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3459The default value is probably right if the name rings a bell. Otherwise,
3460since spelling matters for me, either accept the default or answer "none"
3461to leave it blank.
a0d0e21e 3462
85e6fe83 3463EOM
85e6fe83 3464case "$osname" in
a0d0e21e 3465 ''|' ')
85e6fe83 3466 case "$hintfile" in
a0d0e21e 3467 ''|' '|none) dflt=none ;;
ecfc5424 3468 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3469 esac
3470 ;;
3471 *) dflt="$osname" ;;
3472esac
3473rp="Operating system name?"
3474. ./myread
3475case "$ans" in
ecfc5424
AD
3476none) osname='' ;;
3477*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3478esac
8ff267be 3479echo " "
3480case "$osvers" in
3481 ''|' ')
3482 case "$hintfile" in
3483 ''|' '|none) dflt=none ;;
3484 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3485 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3486 case "$dflt" in
3487 ''|' ') dflt=none ;;
3488 esac
3489 ;;
3490 esac
3491 ;;
3492 *) dflt="$osvers" ;;
3493esac
3494rp="Operating system version?"
3495. ./myread
3496case "$ans" in
3497none) osvers='' ;;
3498*) osvers="$ans" ;;
3499esac
3500
02e93a22
JH
3501
3502. ./posthint.sh
3503
2304df62 3504: who configured the system
59b83a6f 3505cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3506case "$cf_by" in
3507"")
7c04078e 3508 cf_by=`(logname) 2>/dev/null`
dfe9444c 3509 case "$cf_by" in
7c04078e
GA
3510 "")
3511 cf_by=`(whoami) 2>/dev/null`
3512 case "$cf_by" in
3513 "") cf_by=unknown ;;
3514 esac ;;
8ff267be 3515 esac ;;
3516esac
2304df62 3517
f3f1a2d8
MB
3518: decide how portable to be. Allow command line overrides.
3519case "$d_portable" in
3520"$undef") ;;
3521*) d_portable="$define" ;;
b4eb6b3d 3522esac
b4eb6b3d 3523
f3f1a2d8
MB
3524: set up shell script to do ~ expansion
3525cat >filexp <<EOSS
3526$startsh
3527: expand filename
3528case "\$1" in
3529 ~/*|~)
3530 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3531 ;;
3532 ~*)
3533 if $test -f /bin/csh; then
3534 /bin/csh -f -c "glob \$1"
3535 failed=\$?
3536 echo ""
3537 exit \$failed
3538 else
3539 name=\`$expr x\$1 : '..\([^/]*\)'\`
3540 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3541 if $test ! -d "\$dir"; then
3542 me=\`basename \$0\`
3543 echo "\$me: can't locate home directory for: \$name" >&2
3544 exit 1
3545 fi
3546 case "\$1" in
3547 */*)
3548 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3549 ;;
3550 *)
3551 echo \$dir
3552 ;;
3553 esac
3554 fi
3555 ;;
3556*)
3557 echo \$1
3558 ;;
b29b105d 3559esac
f3f1a2d8
MB
3560EOSS
3561chmod +x filexp
3562$eunicefix filexp
b29b105d 3563
f3f1a2d8
MB
3564: now set up to get a file name
3565cat <<EOS >getfile
3566$startsh
3567EOS
3568cat <<'EOSC' >>getfile
3569tilde=''
3570fullpath=''
3571already=''
3572skip=''
3573none_ok=''
3574exp_file=''
3575nopath_ok=''
3576orig_rp="$rp"
3577orig_dflt="$dflt"
3578case "$gfpth" in
3579'') gfpth='.' ;;
b29b105d 3580esac
b29b105d 3581
f3f1a2d8
MB
3582case "$fn" in
3583*\(*)
3584 : getfile will accept an answer from the comma-separated list
3585 : enclosed in parentheses even if it does not meet other criteria.
3586 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3587 fn=`echo $fn | sed 's/(.*)//'`
3588 ;;
b29b105d
JH
3589esac
3590
f3f1a2d8
MB
3591case "$fn" in
3592*:*)
3593 loc_file=`expr $fn : '.*:\(.*\)'`
3594 fn=`expr $fn : '\(.*\):.*'`
3595 ;;
b29b105d 3596esac
b29b105d 3597
f3f1a2d8
MB
3598case "$fn" in
3599*~*) tilde=true;;
3600esac
3601case "$fn" in
3602*/*) fullpath=true;;
3603esac
3604case "$fn" in
3605*+*) skip=true;;
3606esac
3607case "$fn" in
3608*n*) none_ok=true;;
3609esac
3610case "$fn" in
3611*e*) exp_file=true;;
3612esac
3613case "$fn" in
3614*p*) nopath_ok=true;;
b29b105d 3615esac
b29b105d 3616
f3f1a2d8
MB
3617case "$fn" in
3618*f*) type='File';;
3619*d*) type='Directory';;
3620*l*) type='Locate';;
3621esac
b29b105d 3622
f3f1a2d8
MB
3623what="$type"
3624case "$what" in
3625Locate) what='File';;
3626esac
b29b105d 3627
f3f1a2d8
MB
3628case "$exp_file" in
3629'')
3630 case "$d_portable" in
3631 "$define") ;;
3632 *) exp_file=true;;
b29b105d
JH
3633 esac
3634 ;;
3635esac
3636
f3f1a2d8
MB
3637cd ..
3638while test "$type"; do
3639 redo=''
3640 rp="$orig_rp"
3641 dflt="$orig_dflt"
3642 case "$tilde" in
3643 true) rp="$rp (~name ok)";;
3644 esac
3645 . UU/myread
3646 if test -f UU/getfile.ok && \
3647 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3648 then
3649 value="$ans"
3650 ansexp="$ans"
3651 break
3652 fi
3653 case "$ans" in
3654 none)
3655 value=''
3656 ansexp=''
3657 case "$none_ok" in
3658 true) type='';;
b29b105d
JH
3659 esac
3660 ;;
f3f1a2d8
MB
3661 *)
3662 case "$tilde" in
3663 '') value="$ans"
3664 ansexp="$ans";;
3665 *)
3666 value=`UU/filexp $ans`
3667 case $? in
3668 0)
3669 if test "$ans" != "$value"; then
3670 echo "(That expands to $value on this system.)"
3671 fi
3672 ;;
3673 *) value="$ans";;
3674 esac
3675 ansexp="$value"
3676 case "$exp_file" in
3677 '') value="$ans";;
3678 esac
3679 ;;
3680 esac
3681 case "$fullpath" in
3682 true)
3683 case "$ansexp" in
3684 /*) value="$ansexp" ;;
3685 [a-zA-Z]:/*) value="$ansexp" ;;
3686 *)
3687 redo=true
3688 case "$already" in
3689 true)
3690 echo "I shall only accept a full path name, as in /bin/ls." >&4
3691 echo "Use a ! shell escape if you wish to check pathnames." >&4
3692 ;;
3693 *)
3694 echo "Please give a full path name, starting with slash." >&4
3695 case "$tilde" in
3696 true)
3697 echo "Note that using ~name is ok provided it expands well." >&4
3698 already=true
3699 ;;
3700 esac
3701 esac
3702 ;;
3703 esac
3704 ;;
3705 esac
3706 case "$redo" in
3707 '')
3708 case "$type" in
3709 File)
3710 for fp in $gfpth; do
3711 if test "X$fp" = X.; then
3712 pf="$ansexp"
3713 else
3714 pf="$fp/$ansexp"
3715 fi
3716 if test -f "$pf"; then
3717 type=''
3718 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3719 then
3720 echo "($value is not a plain file, but that's ok.)"
3721 type=''
3722 fi
3723 if test X"$type" = X; then
3724 value="$pf"
3725 break
3726 fi
3727 done
3728 ;;
3729 Directory)
3730 for fp in $gfpth; do
3731 if test "X$fp" = X.; then
3732 dir="$ans"
3733 direxp="$ansexp"
3734 else
3735 dir="$fp/$ansexp"
3736 direxp="$fp/$ansexp"
3737 fi
3738 if test -d "$direxp"; then
3739 type=''
3740 value="$dir"
3741 break
3742 fi
3743 done
3744 ;;
3745 Locate)
3746 if test -d "$ansexp"; then
3747 echo "(Looking for $loc_file in directory $value.)"
3748 value="$value/$loc_file"
3749 ansexp="$ansexp/$loc_file"
3750 fi
3751 if test -f "$ansexp"; then
3752 type=''
3753 fi
3754 case "$nopath_ok" in
3755 true) case "$value" in
3756 */*) ;;
3757 *) echo "Assuming $value will be in people's path."
3758 type=''
3759 ;;
3760 esac
3761 ;;
3762 esac
3763 ;;
3764 esac
b4eb6b3d 3765
f3f1a2d8
MB
3766 case "$skip" in
3767 true) type='';
3768 esac
3769
3770 case "$type" in
3771 '') ;;
3772 *)
3773 if test "$fastread" = yes; then
3774 dflt=y
3775 else
3776 dflt=n
3777 fi
3778 rp="$what $value doesn't exist. Use that name anyway?"
3779 . UU/myread
3780 dflt=''
3781 case "$ans" in
3782 y*) type='';;
3783 *) echo " ";;
3784 esac
3785 ;;
3786 esac
3787 ;;
3788 esac
3789 ;;
b4eb6b3d 3790 esac
f3f1a2d8
MB
3791done
3792cd UU
3793ans="$value"
3794rp="$orig_rp"
3795dflt="$orig_dflt"
3796rm -f getfile.ok
3797test "X$gfpthkeep" != Xy && gfpth=""
3798EOSC
3799
3800: determine root of directory hierarchy where package will be installed.
3801case "$prefix" in
3802'')
3803 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3804 ;;
3805*?/)
3806 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3807 ;;
3808*)
f3f1a2d8 3809 dflt="$prefix"
b4eb6b3d
JH
3810 ;;
3811esac
f3f1a2d8 3812$cat <<EOM
b4eb6b3d 3813
f3f1a2d8
MB
3814By default, $package will be installed in $dflt/bin, manual pages
3815under $dflt/man, etc..., i.e. with $dflt as prefix for all
3816installation directories. Typically this is something like /usr/local.
3817If you wish to have binaries under /usr/bin but other parts of the
3818installation under /usr/local, that's ok: you will be prompted
3819separately for each of the installation directories, the prefix being
3820only used to set the defaults.
c915ce7f
JH
3821
3822EOM
f3f1a2d8
MB
3823fn=d~
3824rp='Installation prefix to use?'
3825. ./getfile
3826oldprefix=''
3827case "$prefix" in
3828'') ;;
3829*)
3830 case "$ans" in
3831 "$prefix") ;;
3832 *) oldprefix="$prefix";;
3833 esac
c915ce7f
JH
3834 ;;
3835esac
f3f1a2d8
MB
3836prefix="$ans"
3837prefixexp="$ansexp"
c915ce7f 3838
f3f1a2d8
MB
3839case "$afsroot" in
3840'') afsroot=/afs ;;
3841*) afsroot=$afsroot ;;
b4eb6b3d 3842esac
b4eb6b3d 3843
f3f1a2d8
MB
3844: is AFS running?
3845echo " "
3846case "$afs" in
3847$define|true) afs=true ;;
3848$undef|false) afs=false ;;
3849*) if test -d $afsroot; then
3850 afs=true
3851 else
3852 afs=false
3853 fi
b4eb6b3d 3854 ;;
f3f1a2d8
MB
3855esac
3856if $afs; then
3857 echo "AFS may be running... I'll be extra cautious then..." >&4
3858else
3859 echo "AFS does not seem to be running..." >&4
9da7673b 3860fi
b4eb6b3d 3861
f3f1a2d8
MB
3862: determine installation prefix for where package is to be installed.
3863if $afs; then
3864$cat <<EOM
3865
3866Since you are running AFS, I need to distinguish the directory in which
3867files will reside from the directory in which they are installed (and from
3868which they are presumably copied to the former directory by occult means).
b4eb6b3d 3869
b4eb6b3d 3870EOM
f3f1a2d8
MB
3871 case "$installprefix" in
3872 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3873 *) dflt="$installprefix";;
3874 esac
3875else
3876$cat <<EOM
b4eb6b3d 3877
f3f1a2d8
MB
3878In some special cases, particularly when building $package for distribution,
3879it is convenient to distinguish the directory in which files should be
3880installed from the directory ($prefix) in which they will
3881eventually reside. For most users, these two directories are the same.
3882
3883EOM
3884 case "$installprefix" in
3885 '') dflt=$prefix ;;
3886 *) dflt=$installprefix;;
3887 esac
3888fi
3889fn=d~
3890rp='What installation prefix should I use for installing files?'
3891. ./getfile
3892installprefix="$ans"
3893installprefixexp="$ansexp"
3894
3895: Perform the prefixexp/installprefixexp correction if necessary
3896cat <<EOS >installprefix
3897$startsh
3898EOS
3899cat <<'EOSC' >>installprefix
3900: Change installation prefix, if necessary.
3901if $test X"$prefix" != X"$installprefix"; then
3902 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3903else
3904 eval "install${prefixvar}=\"\$${prefixvar}exp\""
3905fi
3906EOSC
3907chmod +x installprefix
3908$eunicefix installprefix
3909
3910: Set variables such as privlib and privlibexp from the output of ./getfile
3911: performing the prefixexp/installprefixexp correction if necessary.
3912cat <<EOS >setprefixvar
3913$startsh
3914EOS
3915cat <<'EOSC' >>setprefixvar
3916eval "${prefixvar}=\"\$ans\""
3917eval "${prefixvar}exp=\"\$ansexp\""
3918. ./installprefix
3919EOSC
3920chmod +x setprefixvar
3921$eunicefix setprefixvar
3922
3923: set up the script used to warn in case of inconsistency
3924cat <<EOS >whoa
3925$startsh
3926EOS
3927cat <<'EOSC' >>whoa
3928dflt=y
3929echo " "
3930echo "*** WHOA THERE!!! ***" >&4
3931echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3932rp=" Keep the $hint value?"
3933. ./myread
3934case "$ans" in
3935y) td=$was; tu=$was;;
3936esac
3937EOSC
3938
3939: function used to set $1 to $val
3940setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3941case "$val$was" in
3942$define$undef) . ./whoa; eval "$var=\$td";;
3943$undef$define) . ./whoa; eval "$var=\$tu";;
3944*) eval "$var=$val";;
3945esac'
3946
3947case "$usesocks" in
3948$define|true|[yY]*) dflt='y';;
3949*) dflt='n';;
3950esac
3951cat <<EOM
3952
3953Perl can be built to use the SOCKS proxy protocol library. To do so,
3954Configure must be run with -Dusesocks. If you use SOCKS you also need
3955to use the PerlIO abstraction layer, this will be implicitly selected.
3956
3957If this doesn't make any sense to you, just accept the default '$dflt'.
3958EOM
3959rp='Build Perl for SOCKS?'
3960. ./myread
3961case "$ans" in
3962y|Y) val="$define" ;;
3963*) val="$undef" ;;
3964esac
3965set usesocks
3966eval $setvar
3967
3968case "$usesocks" in
3969$define|true|[yY]*) useperlio="$define";;
3970esac
3971
3972case "$useperlio" in
3973$define|true|[yY]*|'') dflt='y';;
3974*) dflt='n';;
3975esac
3976cat <<EOM
3977
3978Previous version of $package used the standard IO mechanisms as
3979defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3980alternate IO mechanisms via the PerlIO abstraction layer, but the
3981stdio mechanism is still available if needed. The abstraction layer
3982can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3983Using PerlIO with sfio may cause problems with some extension modules.
3984
3985If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 3986EOM
f3f1a2d8
MB
3987rp='Use the PerlIO abstraction layer?'
3988. ./myread
3989case "$ans" in
3990y|Y)
b4eb6b3d
JH
3991 val="$define"
3992 ;;
f3f1a2d8
MB
3993*)
3994 echo "Ok, doing things the stdio way."
3995 val="$undef"
3996 ;;
3997esac
3998set useperlio
3999eval $setvar
4000
4001case "$usesocks" in
4002$define|true|[yY]*)
4003 case "$useperlio" in
4004 $define|true|[yY]*) ;;
4005 *) cat >&4 <<EOM
4006
4007You are using the SOCKS proxy protocol library which means that you
4008should also use the PerlIO layer. You may be headed for trouble.
4009
4010EOM
4011 ;;
b4eb6b3d 4012 esac
f3f1a2d8
MB
4013 ;;
4014esac
4015
4016
4017case "$usethreads" in
4018$define|true|[yY]*) dflt='y';;
4019*) # Catch case where user specified ithreads or 5005threads but
4020 # forgot -Dusethreads (A.D. 4/2002)
4021 case "$useithreads$use5005threads" in
4022 *$define*)
4023 case "$useperlio" in
4024 "$define") dflt='y' ;;
4025 *) dflt='n' ;;
4026 esac
4027 ;;
4028 *) dflt='n';;
4029 esac
4030 ;;
4031esac
4032cat <<EOM
4033
4034Perl can be built to take advantage of threads on some systems.
4035To do so, Configure can be run with -Dusethreads.
4036
4037Note that Perl built with threading support runs slightly slower
4038and uses more memory than plain Perl. The current implementation
4039is believed to be stable, but it is fairly new, and so should be
4040treated with caution.
4041
4042If this doesn't make any sense to you, just accept the default '$dflt'.
4043EOM
4044rp='Build a threading Perl?'
4045. ./myread
4046case "$ans" in
4047y|Y) val="$define" ;;
4048*) val="$undef" ;;
4049esac
4050set usethreads
4051eval $setvar
4052
4053case "$usethreads" in
4054$define)
4055 $cat <<EOM
4056
4057Since release 5.6, Perl has had two different threading implementations,
4058the newer interpreter-based version (ithreads) with one interpreter per
4059thread, and the older 5.005 version (5005threads).
4060The 5005threads version is effectively unmaintained and will probably be
4061removed in Perl 5.10, so there should be no need to build a Perl using it
4062unless needed for backwards compatibility with some existing 5.005threads
4063code.
4064
4065EOM
4066 : Default to ithreads unless overridden on command line or with
4067 : old config.sh
4068 dflt='y'
4069 case "$use5005threads" in
4070 $define|true|[yY]*) dflt='n';;
4071 esac
4072 case "$useithreads" in
4073 $undef|false|[nN]*) dflt='n';;
4074 esac
4075 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4076 . ./myread
4077 case "$ans" in
f3f1a2d8 4078 y|Y) val="$define" ;;
b4eb6b3d
JH
4079 *) val="$undef" ;;
4080 esac
f3f1a2d8
MB
4081 set useithreads
4082 eval $setvar
4083 : Now set use5005threads to the opposite value.
4084 case "$useithreads" in
4085 $define) val="$undef" ;;
4086 *) val="$define" ;;
4087 esac
4088 set use5005threads
4089 eval $setvar
4090 ;;
4091*)
4092 useithreads="$undef"
4093 use5005threads="$undef"
b4eb6b3d
JH
4094 ;;
4095esac
b4eb6b3d 4096
f3f1a2d8
MB
4097case "$useithreads$use5005threads" in
4098"$define$define")
4099 $cat >&4 <<EOM
96056487 4100
f3f1a2d8
MB
4101You cannot have both the ithreads and the 5.005 threads enabled
4102at the same time. Disabling the 5.005 threads since they are
4103much less stable than the ithreads.
4104
4105EOM
4106 use5005threads="$undef"
96056487
JH
4107 ;;
4108esac
4109
f3f1a2d8
MB
4110if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4111 cat >&4 <<EOF
4112***
4113*** To build with ithreads you must also use the PerlIO layer.
4114*** Cannot continue, aborting.
4115***
4116EOF
4117 exit 1
4118fi
4119
4120case "$d_oldpthreads" in
4121'') : Configure tests would be welcome here. For now, assume undef.
4122 val="$undef" ;;
4123*) val="$d_oldpthreads" ;;
4124esac
4125set d_oldpthreads
4126eval $setvar
4127
4128
4129: Look for a hint-file generated 'call-back-unit'. If the
4130: user has specified that a threading perl is to be built,
4131: we may need to set or change some other defaults.
4132if $test -f usethreads.cbu; then
4133 echo "Your platform has some specific hints regarding threaded builds, using them..."
4134 . ./usethreads.cbu
4135else
4136 case "$usethreads" in
4137 "$define"|true|[yY]*)
4138 $cat <<EOM
4139(Your platform does not have any specific hints for threaded builds.
4140 Assuming POSIX threads, then.)
4141EOM
4142 ;;
4143 esac
4144fi
4145
4146cat <<EOM
4147
4148Perl can be built so that multiple Perl interpreters can coexist
4149within the same Perl executable.
4150EOM
4151
4152case "$useithreads" in
4153$define)
4154 cat <<EOM
4155This multiple interpreter support is required for interpreter-based threads.
4156EOM
4157 val="$define"
4158 ;;
4159*) case "$usemultiplicity" in
4160 $define|true|[yY]*) dflt='y';;
4161 *) dflt='n';;
4162 esac
4163 echo " "
4164 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4165 rp='Build Perl for multiplicity?'
4166 . ./myread
4167 case "$ans" in
4168 y|Y) val="$define" ;;
4169 *) val="$undef" ;;
4170 esac
4171 ;;
4172esac
4173set usemultiplicity
4174eval $setvar
4175
4176
4177case "$usemorebits" in
4178"$define"|true|[yY]*)
4179 use64bitint="$define"
4180 uselongdouble="$define"
4181 usemorebits="$define"
4182 ;;
4183*) usemorebits="$undef"
4184 ;;
4185esac
4186
4187: make some quick guesses about what we are up against
4188echo " "
4189$echo $n "Hmm... $c"
4190echo exit 1 >bsd
4191echo exit 1 >usg
4192echo exit 1 >v7
4193echo exit 1 >osf1
4194echo exit 1 >eunice
4195echo exit 1 >xenix
4196echo exit 1 >venix
4197echo exit 1 >os2
4198d_bsd="$undef"
4199$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4200if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4201then
4202 echo "Looks kind of like an OSF/1 system, but we'll see..."
4203 echo exit 0 >osf1
381aa1ff 4204elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4205 xxx=`./loc addbib blurfl $pth`
4206 if $test -f $xxx; then
4207 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4208 echo exit 0 >bsd
4209 echo exit 0 >usg
4210 else
4211 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4212 echo "Looks kind of like an extended USG system, but we'll see..."
4213 else
4214 echo "Looks kind of like a USG system, but we'll see..."
4215 fi
4216 echo exit 0 >usg
4217 fi
4218elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4219 echo "Looks kind of like a BSD system, but we'll see..."
4220 d_bsd="$define"
4221 echo exit 0 >bsd
4222else
4223 echo "Looks kind of like a Version 7 system, but we'll see..."
4224 echo exit 0 >v7
4225fi
4226case "$eunicefix" in
4227*unixtovms*)
4228 $cat <<'EOI'
4229There is, however, a strange, musty smell in the air that reminds me of
4230something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4231EOI
4232 echo exit 0 >eunice
4233 d_eunice="$define"
4234: it so happens the Eunice I know will not run shell scripts in Unix format
4235 ;;
4236*)
4237 echo " "
4238 echo "Congratulations. You aren't running Eunice."
4239 d_eunice="$undef"
4240 ;;
4241esac
4242: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4243: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4244: semicolon as a patch separator
e5e20432
JH
4245case "$p_" in
4246:) ;;
4247*)
4248 $cat <<'EOI'
4249I have the feeling something is not exactly right, however...don't tell me...
4250lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4251(Or you may be running DOS with DJGPP.)
e5e20432
JH
4252EOI
4253 echo exit 0 >os2
4254 ;;
4255esac
4256if test -f /xenix; then
4257 echo "Actually, this looks more like a XENIX system..."
4258 echo exit 0 >xenix
4259 d_xenix="$define"
4260else
4261 echo " "
4262 echo "It's not Xenix..."
4263 d_xenix="$undef"
4264fi
4265chmod +x xenix
4266$eunicefix xenix
4267if test -f /venix; then
4268 echo "Actually, this looks more like a VENIX system..."
4269 echo exit 0 >venix
4270else
4271 echo " "
4272 if ./xenix; then
4273 : null
4274 else
4275 echo "Nor is it Venix..."
4276 fi
4277fi
4278chmod +x bsd usg v7 osf1 eunice xenix venix os2
4279$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4280$rm -f foo
4281
5869b1f1
JH
4282case "$cc" in
4283'') dflt=cc;;
4284*) dflt="$cc";;
4285esac
4286rp="Use which C compiler?"
4287. ./myread
4288cc="$ans"
6b769f8f
RB
4289
4290: See if they have not cc but they do have gcc
4291. ./trygcc
e5e20432
JH
4292: Look for a hint-file generated 'call-back-unit'. Now that the
4293: user has specified the compiler, we may need to set or change some
4294: other defaults.
4295if $test -f cc.cbu; then
4296 . ./cc.cbu
4297fi
2573c5f9 4298. ./checkcc
8a27cf78 4299
e5e20432
JH
4300echo " "
4301echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4302$cat >try.c <<EOM
e5e20432
JH
4303#include <stdio.h>
4304int main() {
4305#ifdef __GNUC__
4306#ifdef __VERSION__
4307 printf("%s\n", __VERSION__);
4308#else
4309 printf("%s\n", "1");
4310#endif
4311#endif
073b6de5 4312 return(0);
e5e20432
JH
4313}
4314EOM
5440bc8e
JH
4315if $cc -o try $ccflags $ldflags try.c; then
4316 gccversion=`$run ./try`
f3f1a2d8
MB
4317 case "$gccversion" in
4318 '') echo "You are not using GNU cc." ;;
4319 *) echo "You are using GNU cc $gccversion."
4320 ccname=gcc
4321 ;;
4322 esac
4323else
4324 echo " "
4325 echo "*** WHOA THERE!!! ***" >&4
4326 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4327 case "$knowitall" in
4328 '')
4329 echo " You'd better start hunting for one and let me know about it." >&4
4330 exit 1
2304df62
AD
4331 ;;
4332 esac
f3f1a2d8
MB
4333fi
4334$rm -f try try.*
4335case "$gccversion" in
43361*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4337esac
4338case "$gccversion" in
4339'') gccosandvers='' ;;
4340*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4341 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4342 gccshortvers=''
4343 case "$gccosandvers" in
4344 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4345 $osname$osvers) ;; # looking good
4346 $osname*) cat <<EOM >&4
4347
4348*** WHOA THERE!!! ***
4349
4350 Your gcc has not been compiled for the exact release of
4351 your operating system ($gccosandvers versus $osname$osvers).
4352
4353 In general it is a good idea to keep gcc synchronized with
4354 the operating system because otherwise serious problems
4355 may ensue when trying to compile software, like Perl.
4356
4357 I'm trying to be optimistic here, though, and will continue.
4358 If later during the configuration and build icky compilation
4359 problems appear (headerfile conflicts being the most common
4360 manifestation), I suggest reinstalling the gcc to match
4361 your operating system release.
4362
4363EOM
4364 ;;
4365 *) gccosandvers='' ;; # failed to parse, better be silent
4366 esac
4367 ;;
4368esac
4369case "$ccname" in
4370'') ccname="$cc" ;;
4371esac
4372
4373# gcc 3.* complain about adding -Idirectories that they already know about,
4374# so we will take those off from locincpth.
4375case "$gccversion" in
43763*)
4377 echo "main(){}">try.c
4378 for incdir in $locincpth; do
4379 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4380 grep '^c[cp]p*[01]: warning: changing search order '`
4381 if test "X$warn" != X; then
4382 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4383 fi
4384 done
4385 $rm -f try try.*
4386esac
2304df62 4387
bd9b35c9
JH
4388: What should the include directory be ?
4389echo " "
4390$echo $n "Hmm... $c"
4391dflt='/usr/include'
4392incpath=''
4393mips_type=''
4394if $test -f /bin/mips && /bin/mips; then
4395 echo "Looks like a MIPS system..."
4396 $cat >usr.c <<'EOCP'
4397#ifdef SYSTYPE_BSD43
4398/bsd43
4399#endif
4400EOCP
8a27cf78 4401 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4402 dflt='/bsd43/usr/include'
4403 incpath='/bsd43'
4404 mips_type='BSD 4.3'
4405 else
4406 mips_type='System V'
4407 fi
4408 $rm -f usr.c usr.out
4409 echo "and you're compiling with the $mips_type compiler and libraries."
4410 xxx_prompt=y
4411 echo "exit 0" >mips
4412else
4413 echo "Doesn't look like a MIPS system."
4414 xxx_prompt=n
4415 echo "exit 1" >mips
4416fi
4417chmod +x mips
4418$eunicefix mips
4419case "$usrinc" in
4420'') ;;
4421*) dflt="$usrinc";;
4422esac
4423case "$xxx_prompt" in
4424y) fn=d/
4425 echo " "
4426 rp='Where are the include files you want to use?'
4427 . ./getfile
4428 usrinc="$ans"
8e07c86e 4429 ;;
bd9b35c9 4430*) usrinc="$dflt"
8e07c86e
AD
4431 ;;
4432esac
2304df62 4433
96056487
JH
4434: see how we invoke the C preprocessor
4435echo " "
4436echo "Now, how can we feed standard input to your C preprocessor..." >&4
4437cat <<'EOT' >testcpp.c
4438#define ABC abc
4439#define XYZ xyz
4440ABC.XYZ
4441EOT
4442cd ..
4443if test ! -f cppstdin; then
4444 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4445 # AIX cc -E doesn't show the absolute headerfile
4446 # locations but we'll cheat by using the -M flag.
4447 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
4448 else
4449 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4450 fi
4451else
4452 echo "Keeping your $hint cppstdin wrapper."
4453fi
4454chmod 755 cppstdin
4455wrapper=`pwd`/cppstdin
4456ok='false'
4457cd UU
4458
4459if $test "X$cppstdin" != "X" && \
4460 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4461 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4462then
4463 echo "You used to use $cppstdin $cppminus so we'll use that again."
4464 case "$cpprun" in
4465 '') echo "But let's see if we can live without a wrapper..." ;;
4466 *)
4467 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4468 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4469 then
4470 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4471 ok='true'
4472 else
4473 echo "(However, $cpprun $cpplast does not work, let's see...)"
4474 fi
4475 ;;
4476 esac
4477else
4478 case "$cppstdin" in
4479 '') ;;
4480 *)
4481 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4482 ;;
4483 esac
4484fi
4485
4486if $ok; then
4487 : nothing
4488elif echo 'Maybe "'"$cc"' -E" will work...'; \
4489 $cc -E <testcpp.c >testcpp.out 2>&1; \
4490 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4491 echo "Yup, it does."
4492 x_cpp="$cc -E"
4493 x_minus='';
4494elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4495 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4496 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4497 echo "Yup, it does."
4498 x_cpp="$cc -E"
4499 x_minus='-';
4500elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4501 $cc -P <testcpp.c >testcpp.out 2>&1; \
4502 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4503 echo "Yipee, that works!"
4504 x_cpp="$cc -P"
4505 x_minus='';
4506elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4507 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4508 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4509 echo "At long last!"
4510 x_cpp="$cc -P"
4511 x_minus='-';
4512elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4513 $cpp <testcpp.c >testcpp.out 2>&1; \
4514 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4515 echo "It works!"
4516 x_cpp="$cpp"
4517 x_minus='';
4518elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4519 $cpp - <testcpp.c >testcpp.out 2>&1; \
4520 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4521 echo "Hooray, it works! I was beginning to wonder."
4522 x_cpp="$cpp"
4523 x_minus='-';
4524elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4525 $wrapper <testcpp.c >testcpp.out 2>&1; \
4526 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4527 x_cpp="$wrapper"
4528 x_minus=''
4529 echo "Eureka!"
4530else
4531 dflt=''
4532 rp="No dice. I can't find a C preprocessor. Name one:"
4533 . ./myread
4534 x_cpp="$ans"
4535 x_minus=''
4536 $x_cpp <testcpp.c >testcpp.out 2>&1
4537 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4538 echo "OK, that will do." >&4
4539 else
4540echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4541 exit 1
4542 fi
4543fi
4544
4545case "$ok" in
4546false)
4547 cppstdin="$x_cpp"
4548 cppminus="$x_minus"
4549 cpprun="$x_cpp"
4550 cpplast="$x_minus"
4551 set X $x_cpp
4552 shift
4553 case "$1" in
4554 "$cpp")
4555 echo "Perhaps can we force $cc -E using a wrapper..."
4556 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4557 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4558 then
4559 echo "Yup, we can."
4560 cppstdin="$wrapper"
4561 cppminus='';
4562 else
4563 echo "Nope, we'll have to live without it..."
4564 fi
4565 ;;
4566 esac
4567 case "$cpprun" in
4568 "$wrapper")
4569 cpprun=''
4570 cpplast=''
4571 ;;
4572 esac
4573 ;;
4574esac
4575
4576case "$cppstdin" in
4577"$wrapper"|'cppstdin') ;;
4578*) $rm -f $wrapper;;
4579esac
4580$rm -f testcpp.c testcpp.out
4581
bd9b35c9
JH
4582: Set private lib path
4583case "$plibpth" in
4584'') if ./mips; then
4585 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4586 fi;;
4587esac
4588case "$libpth" in
4589' ') dlist='';;
4590'') dlist="$loclibpth $plibpth $glibpth";;
4591*) dlist="$libpth";;
4592esac
4593
4594: Now check and see which directories actually exist, avoiding duplicates
4595libpth=''
4596for xxx in $dlist
4597do
4598 if $test -d $xxx; then
4599 case " $libpth " in
4600 *" $xxx "*) ;;
4601 *) libpth="$libpth $xxx";;
4602 esac
4603 fi
4604done
4605$cat <<'EOM'
4606
4607Some systems have incompatible or broken versions of libraries. Among
4608the directories listed in the question below, please remove any you
4609know not to be holding relevant libraries, and add any that are needed.
4610Say "none" for none.
8e07c86e
AD
4611
4612EOM
bd9b35c9
JH
4613case "$libpth" in
4614'') dflt='none';;
8e07c86e 4615*)
bd9b35c9
JH
4616 set X $libpth
4617 shift
4618 dflt=${1+"$@"}
8e07c86e 4619 ;;
a0d0e21e 4620esac
bd9b35c9
JH
4621rp="Directories to use for library searches?"
4622. ./myread
4623case "$ans" in
4624none) libpth=' ';;
4625*) libpth="$ans";;
4626esac
a0d0e21e 4627
bd9b35c9
JH
4628: compute shared library extension
4629case "$so" in
4630'')
4631 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4632 dflt='sl'
dd4e71fd 4633 else
bd9b35c9 4634 dflt='so'
dd4e71fd
JH
4635 fi
4636 ;;
bd9b35c9 4637*) dflt="$so";;
dd4e71fd 4638esac
dd4e71fd
JH
4639$cat <<EOM
4640
bd9b35c9 4641On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4642you want to suppress searching of shared libraries for the remainder
bd9b35c9 4643of this configuration.
dd4e71fd
JH
4644
4645EOM
bd9b35c9
JH
4646rp='What is the file extension used for shared libraries?'
4647. ./myread
4648so="$ans"
dd4e71fd 4649
bd9b35c9
JH
4650: Define several unixisms.
4651: Hints files or command line option can be used to override them.
4652: The convoluted testing is in case hints files set either the old
4653: or the new name.
4654case "$_exe" in
4655'') case "$exe_ext" in
1fef16b3 4656 '') ;;
bd9b35c9 4657 *) _exe="$exe_ext" ;;
dd4e71fd 4658 esac
bd9b35c9 4659 ;;
bfb7748a 4660esac
bd9b35c9
JH
4661case "$_a" in
4662'') case "$lib_ext" in
4663 '') _a='.a';;
4664 *) _a="$lib_ext" ;;
dd4e71fd
JH
4665 esac
4666 ;;
dd4e71fd 4667esac
bd9b35c9
JH
4668case "$_o" in
4669'') case "$obj_ext" in
4670 '') _o='.o';;
4671 *) _o="$obj_ext";;
4672 esac
4673 ;;
4674esac
4675case "$p_" in
4676'') case "$path_sep" in
4677 '') p_=':';;
4678 *) p_="$path_sep";;
4679 esac
4680 ;;
4681esac
4682exe_ext=$_exe
4683lib_ext=$_a
4684obj_ext=$_o
4685path_sep=$p_
dd4e71fd 4686
b4eb6b3d
JH
4687: Which makefile gets called first. This is used by make depend.
4688case "$firstmakefile" in
4689'') firstmakefile='makefile';;
4633a7c4 4690esac
4633a7c4 4691
1f603089
JH
4692case "$ccflags" in
4693*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4694esac
4695
4696case "$uselongdouble" in
4697$define|true|[yY]*) dflt='y';;
4698*) dflt='n';;
4699esac
4700cat <<EOM
4701
4702Perl can be built to take advantage of long doubles which
4703(if available) may give more accuracy and range for floating point numbers.
4704
4705If this doesn't make any sense to you, just accept the default '$dflt'.
4706EOM
4707rp='Try to use long doubles if available?'
4708. ./myread
4709case "$ans" in
4710y|Y) val="$define" ;;
4711*) val="$undef" ;;
4712esac
4713set uselongdouble
4714eval $setvar
4715
4716case "$uselongdouble" in
4717true|[yY]*) uselongdouble="$define" ;;
4718esac
4719
1f603089
JH
4720: Look for a hint-file generated 'call-back-unit'. If the
4721: user has specified that long doubles should be used,
4722: we may need to set or change some other defaults.
9da7673b
MB
4723if $test -f uselongdouble.cbu; then
4724 echo "Your platform has some specific hints regarding long doubles, using them..."
4725 . ./uselongdouble.cbu
4726else
4727 case "$uselongdouble" in
4728 $define)
1f603089 4729 $cat <<EOM
9da7673b 4730(Your platform does not have any specific hints for long doubles.)
1f603089 4731EOM
1f603089 4732 ;;
9da7673b
MB
4733 esac
4734fi
1f603089 4735
bd9b35c9
JH
4736: Looking for optional libraries
4737echo " "
4738echo "Checking for optional libraries..." >&4
4739case "$libs" in
4740' '|'') dflt='';;
4741*) dflt="$libs";;
4742esac
4743case "$libswanted" in
4744'') libswanted='c_s';;
4745esac
4746case "$usesocks" in
923fc586 4747"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4748esac
68435ea7
JH
4749libsfound=''
4750libsfiles=''
4751libsdirs=''
13b3f787
JH
4752libspath=''
4753for thisdir in $libpth $xlibpth; do
4754 test -d $thisdir && libspath="$libspath $thisdir"
4755done
bd9b35c9 4756for thislib in $libswanted; do
13b3f787 4757 for thisdir in $libspath; do
f7dd4e7f
JH
4758 xxx=''
4759 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4760 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4761 $test -f "$xxx" && eval $libscheck
4762 $test -f "$xxx" && libstyle=shared
4763 fi
4764 if test ! -f "$xxx"; then
4765 xxx=$thisdir/lib$thislib.$so
4766 $test -f "$xxx" && eval $libscheck
4767 $test -f "$xxx" && libstyle=shared
4768 fi
4769 if test ! -f "$xxx"; then
4770 xxx=$thisdir/lib$thislib$_a
4771 $test -f "$xxx" && eval $libscheck
4772 $test -f "$xxx" && libstyle=static
4773 fi
4774 if test ! -f "$xxx"; then
4775 xxx=$thisdir/$thislib$_a
4776 $test -f "$xxx" && eval $libscheck
4777 $test -f "$xxx" && libstyle=static
4778 fi
4779 if test ! -f "$xxx"; then
4780 xxx=$thisdir/lib${thislib}_s$_a
4781 $test -f "$xxx" && eval $libscheck
4782 $test -f "$xxx" && libstyle=static
09ea5ba9 4783 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4784 fi
4785 if test ! -f "$xxx"; then
4786 xxx=$thisdir/Slib$thislib$_a
4787 $test -f "$xxx" && eval $libscheck
4788 $test -f "$xxx" && libstyle=static
4789 fi
4790 if $test -f "$xxx"; then
43999f95 4791 case "$libstyle" in
f7dd4e7f
JH
4792 shared) echo "Found -l$thislib (shared)." ;;
4793 static) echo "Found -l$thislib." ;;
4794 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4795 esac
bd9b35c9
JH
4796 case " $dflt " in
4797 *"-l$thislib "*);;
f7dd4e7f 4798 *) dflt="$dflt -l$thislib"
43999f95
JH
4799 libsfound="$libsfound $xxx"
4800 yyy=`basename $xxx`
4801 libsfiles="$libsfiles $yyy"
1e127011 4802 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4803 case " $libsdirs " in
4804 *" $yyy "*) ;;
4805 *) libsdirs="$libsdirs $yyy" ;;
4806 esac
4807 ;;
bd9b35c9 4808 esac
f7dd4e7f
JH
4809 break
4810 fi
4811 done
4812 if $test ! -f "$xxx"; then
4813 echo "No -l$thislib."
bd9b35c9
JH
4814 fi
4815done
4816set X $dflt
4817shift
4818dflt="$*"
4819case "$libs" in
4820'') dflt="$dflt";;
4821*) dflt="$libs";;
4822esac
4823case "$dflt" in
4824' '|'') dflt='none';;
4825esac
4633a7c4 4826
bd9b35c9 4827$cat <<EOM
4633a7c4 4828
bd9b35c9
JH
4829In order to compile $package on your machine, a number of libraries
4830are usually needed. Include any other special libraries here as well.
4831Say "none" for none. The default list is almost always right.
8e07c86e 4832EOM
8e07c86e 4833
bd9b35c9
JH
4834echo " "
4835rp="What libraries to use?"
4836. ./myread
4837case "$ans" in
4838none) libs=' ';;
4839*) libs="$ans";;
4840esac
d71b2b6b 4841
bd9b35c9
JH
4842: determine optimization, if desired, or use for debug flag also
4843case "$optimize" in
4844' '|$undef) dflt='none';;
4845'') dflt='-O';;
4846*) dflt="$optimize";;
4847esac
4848$cat <<EOH
d71b2b6b 4849
bd9b35c9
JH
4850By default, $package compiles with the -O flag to use the optimizer.
4851Alternately, you might want to use the symbolic debugger, which uses
4852the -g flag (on traditional Unix systems). Either flag can be
4853specified here. To use neither flag, specify the word "none".
d71b2b6b 4854
bd9b35c9
JH
4855EOH
4856rp="What optimizer/debugger flag should be used?"
4857. ./myread
4858optimize="$ans"
4859case "$optimize" in
4860'none') optimize=" ";;
4861esac
4862
eaf812ae
MB
4863: Check what DEBUGGING is required from the command line
4864: -DEBUGGING or -DDEBUGGING or
4865: -DEBUGGING=both = -g + -DDEBUGGING
4866: -DEBUGGING=-g or -Doptimize=-g = -g
4867: -DEBUGGING=none or -UDEBUGGING =
4868: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
4869case "$EBUGGING" in
4870'') ;;
4871*) DEBUGGING=$EBUGGING ;;
4872esac
4873
4874case "$DEBUGGING" in
4875-g|$define)
4876 case "$optimize" in
4877 *-g*) ;;
4878 *) optimize="$optimize -g" ;;
4879 esac ;;
4880none|$undef)
4881 case "$optimize" in
4882 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
4883 shift
4884 optimize="$*"
4885 ;;
4886 esac ;;
4887esac
4888
bd9b35c9 4889dflt=''
eaf812ae
MB
4890case "$DEBUGGING" in
4891both|$define) dflt='-DDEBUGGING'
4892esac
4893
bd9b35c9
JH
4894: We will not override a previous value, but we might want to
4895: augment a hint file
4896case "$hint" in
4897default|recommended)
4898 case "$gccversion" in
eaf812ae 4899 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 4900 esac
eaf812ae
MB
4901 case "$optimize:$DEBUGGING" in
4902 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 4903 esac
bd9b35c9
JH
4904 case "$gccversion" in
4905 2*) if test -d /etc/conf/kconfig.d &&
4906 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4907 then
00e89ad4 4908 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
4909 dflt="$dflt -posix"
4910 fi
f0d04425 4911 ;;
bd9b35c9
JH
4912 esac
4913 case "$gccversion" in
4914 1*) ;;
4915 2.[0-8]*) ;;
4916 ?*) echo " "
4917 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4918 echo 'int main(void) { return 0; }' > gcctest.c
4919 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4920 echo "Yes, it does." 2>&1
4921 case "$ccflags" in
00e89ad4 4922 *strict-aliasing*)
bd9b35c9
JH
4923 echo "Leaving current flags $ccflags alone." 2>&1
4924 ;;
4925 *) dflt="$dflt -fno-strict-aliasing" ;;
4926 esac
4927 else
4928 echo "Nope, it doesn't, but that's ok." 2>&1
4929 fi
f0d04425 4930 ;;
e5e20432 4931 esac
00e89ad4
AD
4932 # For gcc, adding -pipe speeds up compilations for some, but apparently
4933 # some assemblers can't read from stdin. (It also slows down compilations
4934 # in other cases, but those are apparently rarer these days.) AD 5/2004.
4935 case "$gccversion" in
4936 ?*) echo " "
4937 echo "Checking if your compiler accepts -pipe" 2>&1
4938 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 4939 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
4940 echo "Yes, it does." 2>&1
4941 case "$ccflags" in
4942 *-pipe*)
4943 echo "Leaving current flags $ccflags alone." 2>&1
4944 ;;
4945 *) dflt="$dflt -pipe" ;;
4946 esac
4947 else
4948 echo "Nope, it doesn't, but that's ok." 2>&1
4949 fi
6347b5be
SP
4950
4951 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4952 echo 'int main(void) { return 0; }' > gcctest.c
4953 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4954 echo "Yes, it does." 2>&1
4955 case "$ccflags" in
4956 *-Wdeclaration-after-statement*)
4957 echo "Leaving current flags $ccflags alone." 2>&1
4958 ;;
4959 *) dflt="$dflt -Wdeclaration-after-statement" ;;
4960 esac
4961 else
4962 echo "Nope, it doesn't, but that's ok." 2>&1
4963 fi
00e89ad4
AD
4964 ;;
4965 esac
e5e20432
JH
4966 ;;
4967esac
4968
bd9b35c9
JH
4969case "$mips_type" in
4970*BSD*|'') inclwanted="$locincpth $usrinc";;
4971*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4972esac
4973for thisincl in $inclwanted; do
4974 if $test -d $thisincl; then
4975 if $test x$thisincl != x$usrinc; then
4976 case "$dflt" in
00e89ad4
AD
4977 *" -I$thisincl "*);;
4978 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
4979 esac
4980 fi
4981 fi
4982done
40a7a20a 4983
bd9b35c9
JH
4984inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4985 xxx=true;
4986elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4987 xxx=true;
4988else
4989 xxx=false;
4990fi;
4991if $xxx; then
4992 case "$dflt" in
4993 *$2*);;
4994 *) dflt="$dflt -D$2";;
4995 esac;
4996fi'
40a7a20a 4997
bd9b35c9 4998set signal.h LANGUAGE_C; eval $inctest
40a7a20a 4999
bd9b35c9
JH
5000case "$usesocks" in
5001$define)
5002 ccflags="$ccflags -DSOCKS"
5003 ;;
5004esac
40a7a20a 5005
bd9b35c9
JH
5006case "$hint" in
5007default|recommended) dflt="$ccflags $dflt" ;;
5008*) dflt="$ccflags";;
5009esac
40a7a20a 5010
bd9b35c9
JH
5011case "$dflt" in
5012''|' ') dflt=none;;
5013esac
422af00a 5014
bd9b35c9 5015$cat <<EOH
40a7a20a 5016
bd9b35c9
JH
5017Your C compiler may want other flags. For this question you should include
5018-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5019but you should NOT include libraries or ld flags like -lwhatever. If you
5020want $package to honor its debug switch, you should include -DDEBUGGING here.
5021Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5022
bd9b35c9 5023To use no flags, specify the word "none".
40a7a20a 5024
bd9b35c9
JH
5025EOH
5026set X $dflt
5027shift
5028dflt=${1+"$@"}
5029rp="Any additional cc flags?"
5030. ./myread
5031case "$ans" in
5032none) ccflags='';;
5033*) ccflags="$ans";;
5034esac
8e07c86e 5035
bd9b35c9 5036: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5037case "$cppflags" in
5038'') cppflags="$ccflags" ;;
5039*) cppflags="$cppflags $ccflags" ;;
5040esac
bd9b35c9
JH
5041case "$gccversion" in
50421*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5043esac
bd9b35c9
JH
5044case "$mips_type" in
5045'');;
5046*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5047esac
5048case "$cppflags" in
5049'');;
5050*)
5051 echo " "
5052 echo "Let me guess what the preprocessor flags are..." >&4
5053 set X $cppflags
5054 shift
5055 cppflags=''
5056 $cat >cpp.c <<'EOM'
5057#define BLURFL foo
8e07c86e 5058
bd9b35c9
JH
5059BLURFL xx LFRULB
5060EOM
5061 previous=''
5062 for flag in $*
5063 do
5064 case "$flag" in
5065 -*) ftry="$flag";;
5066 *) ftry="$previous $flag";;
5067 esac
5068 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5069 >cpp1.out 2>/dev/null && \
5070 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5071 >cpp2.out 2>/dev/null && \
5072 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5073 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5074 then
5075 cppflags="$cppflags $ftry"
5076 previous=''
5077 else
5078 previous="$flag"
5079 fi
5080 done
5081 set X $cppflags
5082 shift
5083 cppflags=${1+"$@"}
5084 case "$cppflags" in
5085 *-*) echo "They appear to be: $cppflags";;
5086 esac
5087 $rm -f cpp.c cpp?.out
2afac517 5088 ;;
5089esac
8e07c86e 5090
bd9b35c9
JH
5091: flags used in final linking phase
5092case "$ldflags" in
5093'') if ./venix; then
5094 dflt='-i -z'
10a23457 5095 else
bd9b35c9 5096 dflt=''
10a23457 5097 fi
bd9b35c9
JH
5098 case "$ccflags" in
5099 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5100 esac
bd9b35c9
JH
5101 ;;
5102*) dflt="$ldflags";;
5103esac
5104
5105: Try to guess additional flags to pick up local libraries.
5106for thislibdir in $libpth; do
5107 case " $loclibpth " in
5108 *" $thislibdir "*)
00e89ad4 5109 case "$dflt " in
bd9b35c9
JH
5110 *"-L$thislibdir "*) ;;
5111 *) dflt="$dflt -L$thislibdir" ;;
5112 esac
c4f23d77
AD
5113 ;;
5114 esac
bd9b35c9 5115done
c4f23d77 5116
bd9b35c9
JH
5117case "$dflt" in
5118'') dflt='none' ;;
5119esac
c4f23d77 5120
bd9b35c9
JH
5121$cat <<EOH
5122
5123Your C linker may need flags. For this question you should
5124include -L/whatever and any other flags used by the C linker, but you
5125should NOT include libraries like -lwhatever.
5126
5127Make sure you include the appropriate -L/path flags if your C linker
5128does not normally search all of the directories you specified above,
5129namely
5130 $libpth
5131To use no flags, specify the word "none".
5132
5133EOH
5134
5135rp="Any additional ld flags (NOT including libraries)?"
5136. ./myread
5137case "$ans" in
5138none) ldflags='';;
5139*) ldflags="$ans";;
5140esac
5141rmlist="$rmlist pdp11"
5142
5143: coherency check
5144echo " "
5145echo "Checking your choice of C compiler and flags for coherency..." >&4
5146$cat > try.c <<'EOF'
5147#include <stdio.h>
55954f19 5148int main() { printf("Ok\n"); return(0); }
bd9b35c9 5149EOF
7a282f6d 5150set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5151shift
5152$cat >try.msg <<'EOM'
5153I've tried to compile and run the following simple program:
5154
5155EOM
5156$cat try.c >> try.msg
5157
5158$cat >> try.msg <<EOM
5159
5160I used the command:
5161
5162 $*
5440bc8e 5163 $run ./try
bd9b35c9
JH
5164
5165and I got the following output:
5166
5167EOM
5168dflt=y
73614538 5169if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
5170 if $sh -c "$run ./try" >>try.msg 2>&1; then
5171 xxx=`$run ./try`
bd9b35c9
JH
5172 case "$xxx" in
5173 "Ok") dflt=n ;;
5174 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5175 case " $libs " in
5176 *" -lsfio "*)
5177 cat >> try.msg <<'EOQS'
5178If $libs contains -lsfio, and sfio is mis-configured, then it
5179sometimes (apparently) runs and exits with a 0 status, but with no
5180output! It may have to do with sfio's use of _exit vs. exit.
5181
5182EOQS
5183 rp="You have a big problem. Shall I abort Configure"
5184 dflt=y
5185 ;;
5186 esac
5187 ;;
5188 esac
5189 else
5190 echo "The program compiled OK, but exited with status $?." >>try.msg
5191 rp="You have a problem. Shall I abort Configure"
5192 dflt=y
5193 fi
5194else
5195 echo "I can't compile the test program." >>try.msg
5196 rp="You have a BIG problem. Shall I abort Configure"
5197 dflt=y
5198fi
5199case "$dflt" in
5200y)
5201 $cat try.msg >&4
5202 case "$knowitall" in
5203 '')
5204 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5205 ;;
bd9b35c9 5206 *) dflt=n;;
c4f23d77 5207 esac
bd9b35c9
JH
5208 echo " "
5209 . ./myread
5210 case "$ans" in
5211 n*|N*) ;;
5212 *) echo "Ok. Stopping Configure." >&4
5213 exit 1
c4f23d77
AD
5214 ;;
5215 esac
5216 ;;
bd9b35c9 5217n) echo "OK, that should do.";;
c4f23d77 5218esac
bd9b35c9 5219$rm -f try try.* core
c4f23d77 5220
bd9b35c9
JH
5221: define a shorthand compile call
5222compile='
5223mc_file=$1;
5224shift;
08413ebc 5225$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5226: define a shorthand compile call for compilations that should be ok.
5227compile_ok='
5228mc_file=$1;
5229shift;
7a282f6d 5230$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5231
8dfa8df9
JH
5232: determine filename position in cpp output
5233echo " "
5234echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5235case "$osname" in
5236vos) testaccess=-e ;;
5237*) testaccess=-r ;;
5238esac
8dfa8df9
JH
5239echo '#include <stdio.h>' > foo.c
5240$cat >fieldn <<EOF
5241$startsh
5242$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5243$grep '^[ ]*#.*stdio\.h' | \
5244while read cline; do
5245 pos=1
5246 set \$cline
5247 while $test \$# -gt 0; do
a5a94ea5 5248 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5249 echo "\$pos"
5250 exit 0
5251 fi
5252 shift
5253 pos=\`expr \$pos + 1\`
5254 done
5255done
5256EOF
5257chmod +x fieldn
5258fieldn=`./fieldn`
5259$rm -f foo.c fieldn
5260case $fieldn in
5261'') pos='???';;
52621) pos=first;;
52632) pos=second;;
52643) pos=third;;
5265*) pos="${fieldn}th";;
5266esac
5267echo "Your cpp writes the filename in the $pos field of the line."
5268
3c728e00
JH
5269case "$osname" in
5270vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5271os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5272*) cppfilter='' ;;
5273esac
8dfa8df9
JH
5274: locate header file
5275$cat >findhdr <<EOF
5276$startsh
5277wanted=\$1
5278name=''
5279for usrincdir in $usrinc
5280do
5281 if test -f \$usrincdir/\$wanted; then
5282 echo "\$usrincdir/\$wanted"
5283 exit 0
5284 fi
5285done
5286awkprg='{ print \$$fieldn }'
5287echo "#include <\$wanted>" > foo\$\$.c
5288$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5289$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5290while read cline; do
5291 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5292 case "\$name" in
5293 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5294 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5295 *) exit 2;;
5296 esac;
5297done;
5298#
5299# status = 0: grep returned 0 lines, case statement not executed
5300# status = 1: headerfile found
5301# status = 2: while loop executed, no headerfile found
5302#
5303status=\$?
5304$rm -f foo\$\$.c;
5305if test \$status -eq 1; then
5306 exit 0;
5307fi
5308exit 1
5309EOF
5310chmod +x findhdr
5311
5312: define an alternate in-header-list? function
5313inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5314cont=true; xxf="echo \"<\$1> found.\" >&4";
5315case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5316*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5317esac;
5318case $# in 4) instead=instead;; *) instead="at last";; esac;
5319while $test "$cont"; do
5320 xxx=`./findhdr $1`
5321 var=$2; eval "was=\$$2";
5322 if $test "$xxx" && $test -r "$xxx";
5323 then eval $xxf;
5324 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5325 cont="";
5326 else eval $xxnf;
5327 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5328 set $yyy; shift; shift; yyy=$@;
5329 case $# in 0) cont="";;
5330 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5331 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5332 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5333 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5334 esac;
5335done;
5336while $test "$yyy";
5337do set $yyy; var=$2; eval "was=\$$2";
5338 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5339 set $yyy; shift; shift; yyy=$@;
5340done'
5341
d1daaddf
JH
5342: see if stdlib is available
5343set stdlib.h i_stdlib
5344eval $inhdr
5345
5346: check for lengths of integral types
5347echo " "
5348case "$intsize" in
5349'')
5350 echo "Checking to see how big your integers are..." >&4
c63dfae1 5351 $cat >try.c <<EOCP
d1daaddf
JH
5352#include <stdio.h>
5353#$i_stdlib I_STDLIB
5354#ifdef I_STDLIB
5355#include <stdlib.h>
5356#endif
5357int main()
5358{
5359 printf("intsize=%d;\n", (int)sizeof(int));
5360 printf("longsize=%d;\n", (int)sizeof(long));
5361 printf("shortsize=%d;\n", (int)sizeof(short));
5362 exit(0);
5363}
5364EOCP
5365 set try
5366 if eval $compile_ok && $run ./try > /dev/null; then
5367 eval `$run ./try`
5368 echo "Your integers are $intsize bytes long."
5369 echo "Your long integers are $longsize bytes long."
5370 echo "Your short integers are $shortsize bytes long."
5371 else
5372 $cat >&4 <<EOM
5373!
5374Help! I can't compile and run the intsize test program: please enlighten me!
5375(This is probably a misconfiguration in your system or libraries, and
5376you really ought to fix it. Still, I'll try anyway.)
5377!
5378EOM
5379 dflt=4
5380 rp="What is the size of an integer (in bytes)?"
5381 . ./myread
5382 intsize="$ans"
5383 dflt=$intsize
5384 rp="What is the size of a long integer (in bytes)?"
5385 . ./myread
5386 longsize="$ans"
5387 dflt=2
5388 rp="What is the size of a short integer (in bytes)?"
5389 . ./myread
5390 shortsize="$ans"
5391 fi
5392 ;;
5393esac
5394$rm -f try try.*
5395
5396: check for long long
5397echo " "
5398echo "Checking to see if you have long long..." >&4
5399echo 'int main() { long long x = 7; return 0; }' > try.c
5400set try
5401if eval $compile; then
5402 val="$define"
5403 echo "You have long long."
5404else
5405 val="$undef"
5406 echo "You do not have long long."
5407fi
5408$rm try.*
5409set d_longlong
5410eval $setvar
5411
5412: check for length of long long
5413case "${d_longlong}${longlongsize}" in
5414$define)
5415 echo " "
5416 echo "Checking to see how big your long longs are..." >&4
5417 $cat >try.c <<'EOCP'
5418#include <stdio.h>
5419int main()
5420{
5421 printf("%d\n", (int)sizeof(long long));
5422 return(0);
5423}
5424EOCP
5425 set try
5426 if eval $compile_ok; then
5427 longlongsize=`$run ./try`
5428 echo "Your long longs are $longlongsize bytes long."
5429 else
5430 dflt='8'
5431 echo " "
5432 echo "(I can't seem to compile the test program. Guessing...)"
5433 rp="What is the size of a long long (in bytes)?"
5434 . ./myread
5435 longlongsize="$ans"
5436 fi
5437 if $test "X$longsize" = "X$longlongsize"; then
5438 echo "(That isn't any different from an ordinary long.)"
5439 fi
5440 ;;
5441esac
5442$rm -f try.* try
5443
8dfa8df9
JH
5444: see if inttypes.h is available
5445: we want a real compile instead of Inhdr because some systems
5446: have an inttypes.h which includes non-existent headers
5447echo " "
5448$cat >try.c <<EOCP
5449#include <inttypes.h>
5450int main() {
5451 static int32_t foo32 = 0x12345678;
5452}
5453EOCP
5454set try
5455if eval $compile; then
5456 echo "<inttypes.h> found." >&4
5457 val="$define"
5458else
5459 echo "<inttypes.h> NOT found." >&4
5460 val="$undef"
5461fi
5462$rm -f try.c try
5463set i_inttypes
5464eval $setvar
5465
5466: check for int64_t
5467echo " "
5468echo "Checking to see if you have int64_t..." >&4
5469$cat >try.c <<EOCP
5470#include <sys/types.h>
5471#$i_inttypes I_INTTYPES
5472#ifdef I_INTTYPES
5473#include <inttypes.h>
5474#endif
5475int main() { int64_t x = 7; }
5476EOCP
5477set try
5478if eval $compile; then
5479 val="$define"
5480 echo "You have int64_t."
5481else
5482 val="$undef"
5483 echo "You do not have int64_t."
5484fi
5485$rm -f try try.*
5486set d_int64_t
5487eval $setvar
5488
5489
5490echo " "
5491echo "Checking which 64-bit integer type we could use..." >&4
5492
5493case "$intsize" in
54948) val=int
5495 set quadtype
5496 eval $setvar
5497 val='"unsigned int"'
5498 set uquadtype
5499 eval $setvar
5500 quadkind=1
5501 ;;
5502*) case "$longsize" in
5503 8) val=long
5504 set quadtype
5505 eval $setvar
5506 val='"unsigned long"'
5507 set uquadtype
5508 eval $setvar
5509 quadkind=2
5510 ;;
5511 *) case "$d_longlong:$longlongsize" in
5512 define:8)
5513 val='"long long"'
5514 set quadtype
5515 eval $setvar
5516 val='"unsigned long long"'
5517 set uquadtype
5518 eval $setvar
5519 quadkind=3
5520 ;;
5521 *) case "$d_int64_t" in
5522 define)
5523 val=int64_t
5524 set quadtype
5525 eval $setvar
5526 val=uint64_t
5527 set uquadtype
5528 eval $setvar
5529 quadkind=4
5530 ;;
5531 esac
5532 ;;
5533 esac
5534 ;;
5535 esac
5536 ;;
5537esac
5538
5539case "$quadtype" in
5540'') echo "Alas, no 64-bit integer types in sight." >&4
5541 d_quad="$undef"
5542 ;;
5543*) echo "We could use '$quadtype' for 64-bit integers." >&4
5544 d_quad="$define"
5545 ;;
5546esac
5547
b4eb6b3d
JH
5548
5549case "$uselonglong" in
5550"$define"|true|[yY]*)
5551 cat <<EOM >&4
5552
5553*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5554EOM
5555 use64bitint="$define"
5556 ;;
5557esac
5558case "$use64bits" in
5559"$define"|true|[yY]*)
5560 cat <<EOM >&4
5561
5562*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5563EOM
5564 use64bitint="$define"
5565 ;;
5566esac
5567case "$use64bitints" in
5568"$define"|true|[yY]*)
5569 cat <<EOM >&4
5570
5571*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5572EOM
5573 use64bitint="$define"
5574 ;;
5575esac
5576case "$use64bitsint" in
5577"$define"|true|[yY]*)
5578 cat <<EOM >&4
5579
5580*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5581EOM
5582 use64bitint="$define"
5583 ;;
5584esac
5585case "$uselonglongs" in
5586"$define"|true|[yY]*)
5587 cat <<EOM >&4
5588
5589*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5590EOM
5591 use64bitint="$define"
5592 ;;
5593esac
5594case "$use64bitsall" in
5595"$define"|true|[yY]*)
5596 cat <<EOM >&4
5597
5598*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5599EOM
5600 use64bitall="$define"
5601 ;;
5602esac
5603
5604case "$ccflags" in
5605*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5606esac
5607case "$use64bitall" in
5608"$define"|true|[yY]*) use64bitint="$define" ;;
5609esac
5610
5611case "$longsize" in
56128) cat <<EOM
5613
5614You have natively 64-bit long integers.
5615EOM
5616 val="$define"
5617 ;;
5618*) case "$use64bitint" in
5619 "$define"|true|[yY]*) dflt='y';;
5620 *) dflt='n';;
5621 esac
8dfa8df9
JH
5622 case "$d_quad" in
5623 "$define") ;;
5624 *) dflt='n' ;;
5625 esac
b4eb6b3d
JH
5626 cat <<EOM
5627
5628Perl can be built to take advantage of 64-bit integer types
5629on some systems. To do so, Configure can be run with -Duse64bitint.
5630Choosing this option will most probably introduce binary incompatibilities.
5631
5632If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5633(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5634EOM
5635 rp='Try to use 64-bit integers, if available?'
5636 . ./myread
5637 case "$ans" in
5638 [yY]*) val="$define" ;;
5639 *) val="$undef" ;;
5640 esac
5641 ;;
5642esac
5643set use64bitint
5644eval $setvar
5645
5646case "$use64bitall" in
5647"$define"|true|[yY]*) dflt='y' ;;
5648*) case "$longsize" in
5649 8) dflt='y' ;;
5650 *) dflt='n' ;;
5651 esac
5652 ;;
5653esac
5654cat <<EOM
5655
5656You may also choose to try maximal 64-bitness. It means using as much
565764-bitness as possible on the platform. This in turn means even more
5658binary incompatibilities. On the other hand, your platform may not
5659have any more 64-bitness available than what you already have chosen.
5660
5661If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5662(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5663EOM
5664rp='Try to use maximal 64-bit support, if available?'
5665. ./myread
5666case "$ans" in
5667[yY]*) val="$define" ;;
5668*) val="$undef" ;;
5669esac
5670set use64bitall
5671eval $setvar
5672case "$use64bitall" in
5673"$define")
5674 case "$use64bitint" in
5675 "$undef")
5676 cat <<EOM
5677
5678Since you have chosen a maximally 64-bit build, I'm also turning on
5679the use of 64-bit integers.
5680EOM
5681 use64bitint="$define" ;;
5682 esac
5683 ;;
5684esac
5685
b4eb6b3d
JH
5686: Look for a hint-file generated 'call-back-unit'. If the
5687: user has specified that a 64-bit perl is to be built,
5688: we may need to set or change some other defaults.
19a100ff 5689if $test -f use64bitint.cbu; then
9da7673b 5690 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5691 . ./use64bitint.cbu
5692fi
9da7673b
MB
5693case "$use64bitint" in
5694"$define"|true|[yY]*)
b4eb6b3d
JH
5695 case "$longsize" in
5696 4) case "$archname64" in
5697 '') archname64=64int ;;
5698 esac
5699 ;;
5700 esac
5701 ;;
5702esac
5703
b4eb6b3d
JH
5704: Look for a hint-file generated 'call-back-unit'. If the
5705: user has specified that a maximally 64-bit perl is to be built,
5706: we may need to set or change some other defaults.
19a100ff 5707if $test -f use64bitall.cbu; then
9da7673b 5708 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5709 . ./use64bitall.cbu
5710fi
9da7673b
MB
5711case "$use64bitall" in
5712"$define"|true|[yY]*)
b4eb6b3d
JH
5713 case "$longsize" in
5714 4) case "$archname64" in
5715 ''|64int) archname64=64all ;;
5716 esac
5717 ;;
5718 esac
5719 ;;
5720esac
5721
1911a026
JH
5722case "$d_quad:$use64bitint" in
5723$undef:$define)
5724 cat >&4 <<EOF
5725
5726*** You have chosen to use 64-bit integers,
19a100ff 5727*** but none can be found.
09b58c7b 5728*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5729*** Cannot continue, aborting.
5730
5731EOF
5732 exit 1
5733 ;;
5734esac
5735
36adc09b
JH
5736: check for length of double
5737echo " "
5738case "$doublesize" in
5739'')
5740 echo "Checking to see how big your double precision numbers are..." >&4
5741 $cat >try.c <<EOCP
5742#include <stdio.h>
1911a026
JH
5743#$i_stdlib I_STDLIB
5744#ifdef I_STDLIB
5745#include <stdlib.h>
5746#endif
36adc09b
JH
5747int main()
5748{
5749 printf("%d\n", (int)sizeof(double));
1911a026 5750 exit(0);
36adc09b
JH
5751}
5752EOCP
5753 set try
5754 if eval $compile_ok; then
5755 doublesize=`$run ./try`
5756 echo "Your double is $doublesize bytes long."
5757 else
5758 dflt='8'
5759 echo "(I can't seem to compile the test program. Guessing...)"
5760 rp="What is the size of a double precision number (in bytes)?"
5761 . ./myread
5762 doublesize="$ans"
5763 fi
5764 ;;
5765esac
5766$rm -f try.c try
5767
5768: check for long doubles
5769echo " "
5770echo "Checking to see if you have long double..." >&4
5771echo 'int main() { long double x = 7.0; }' > try.c
5772set try
5773if eval $compile; then
5774 val="$define"
5775 echo "You have long double."
5776else
5777 val="$undef"
5778 echo "You do not have long double."
5779fi
5780$rm try.*
5781set d_longdbl
5782eval $setvar
5783
5784: check for length of long double
5785case "${d_longdbl}${longdblsize}" in
5786$define)
5787 echo " "
5788 echo "Checking to see how big your long doubles are..." >&4
5789 $cat >try.c <<'EOCP'
5790#include <stdio.h>
5791int main()
5792{
5793 printf("%d\n", sizeof(long double));
5794}
5795EOCP
5796 set try
5797 set try
5798 if eval $compile; then
5799 longdblsize=`$run ./try`
5800 echo "Your long doubles are $longdblsize bytes long."
5801 else
5802 dflt='8'
5803 echo " "
5804 echo "(I can't seem to compile the test program. Guessing...)" >&4
5805 rp="What is the size of a long double (in bytes)?"
5806 . ./myread
5807 longdblsize="$ans"
5808 fi
5809 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5810 echo "That isn't any different from an ordinary double."
5811 echo "I'll keep your setting anyway, but you may see some"
5812 echo "harmless compilation warnings."
36adc09b
JH
5813 fi
5814 ;;
5815esac
5816$rm -f try.* try
5817
89ce900e 5818: determine the architecture name
b4eb6b3d 5819echo " "
89ce900e
JH
5820if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5821 tarch=`arch`"-$osname"
5822elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5823 if uname -m > tmparch 2>&1 ; then
5824 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5825 -e 's/$/'"-$osname/" tmparch`
5826 else
5827 tarch="$osname"
5828 fi
5829 $rm -f tmparch
b4eb6b3d 5830else
89ce900e 5831 tarch="$osname"
b4eb6b3d 5832fi
89ce900e
JH
5833case "$myarchname" in
5834''|"$tarch") ;;
5835*)
5836 echo "(Your architecture name used to be $myarchname.)"
5837 archname=''
5838 ;;
5839esac
5840case "$targetarch" in
5841'') ;;
5842*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5843esac
5844myarchname="$tarch"
5845case "$archname" in
5846'') dflt="$tarch";;
5847*) dflt="$archname";;
5848esac
5849rp='What is your architecture name'
5850. ./myread
5851archname="$ans"
5852case "$usethreads" in
5853$define)
5854 echo "Threads selected." >&4
5855 case "$archname" in
5856 *-thread*) echo "...and architecture name already has -thread." >&4
5857 ;;
5858 *) archname="$archname-thread"
5859 echo "...setting architecture name to $archname." >&4
5860 ;;
5861 esac
5862 ;;
5863esac
5864case "$usemultiplicity" in
5865$define)
5866 echo "Multiplicity selected." >&4
5867 case "$archname" in
5868 *-multi*) echo "...and architecture name already has -multi." >&4
5869 ;;
5870 *) archname="$archname-multi"
5871 echo "...setting architecture name to $archname." >&4
5872 ;;
5873 esac
5874 ;;
5875esac
5876case "$use64bitint$use64bitall" in
5877*"$define"*)
5878 case "$archname64" in
5879 '')
5880 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 5881 ;;
89ce900e
JH
5882 *)
5883 case "$use64bitint" in
5884 "$define") echo "64 bit integers selected." >&4 ;;
5885 esac
5886 case "$use64bitall" in
5887 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5888 esac
5889 case "$archname" in
5890 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5891 ;;
5892 *) archname="$archname-$archname64"
5893 echo "...setting architecture name to $archname." >&4
5894 ;;
5895 esac
c1a7f87b
JH
5896 ;;
5897 esac
89ce900e
JH
5898esac
5899case "$uselongdouble" in
5900$define)
5901 echo "Long doubles selected." >&4
5902 case "$longdblsize" in
5903 $doublesize)
5904 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5905 ;;
5906 *)
5907 case "$archname" in
5908 *-ld*) echo "...and architecture name already has -ld." >&4
5909 ;;
5910 *) archname="$archname-ld"
5911 echo "...setting architecture name to $archname." >&4
5912 ;;
5913 esac
bd9b35c9
JH
5914 ;;
5915 esac
bd9b35c9 5916 ;;
89ce900e
JH
5917esac
5918case "$useperlio" in
5919$define)
5920 echo "Perlio selected." >&4
5921 ;;
bd9b35c9 5922*)
89ce900e
JH
5923 echo "Perlio not selected, using stdio." >&4
5924 case "$archname" in
5925 *-stdio*) echo "...and architecture name already has -stdio." >&4
5926 ;;
5927 *) archname="$archname-stdio"
5928 echo "...setting architecture name to $archname." >&4
5929 ;;
5930 esac
bd9b35c9
JH
5931 ;;
5932esac
d2e0c6f7
JH
5933if $test -f archname.cbu; then
5934 echo "Your platform has some specific hints for architecture name, using them..."
5935 . ./archname.cbu
5936fi
bd9b35c9 5937
b4eb6b3d
JH
5938: set the prefixit variable, to compute a suitable default value
5939prefixit='case "$3" in
5940""|none)
5941 case "$oldprefix" in
5942 "") eval "$1=\"\$$2\"";;
5943 *)
5944 case "$3" in
5945 "") eval "$1=";;
5946 none)
5947 eval "tp=\"\$$2\"";
5948 case "$tp" in
5949 ""|" ") eval "$1=\"\$$2\"";;
5950 *) eval "$1=";;
5951 esac;;
5952 esac;;
5953 esac;;
5954*)
5955 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5956 case "$tp" in
5957 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5958 /*-$oldprefix/*|\~*-$oldprefix/*)
5959 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5960 *) eval "$1=\"\$$2\"";;
5961 esac;;
5962esac'
5963
b4eb6b3d
JH
5964: get the patchlevel
5965echo " "
5966echo "Getting the current patchlevel..." >&4
5967if $test -r $rsrc/patchlevel.h;then
5968 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5969 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5970 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5971 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5972 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5973 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
35918792 5974 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
5975else
5976 revision=0
5977 patchlevel=0
5978 subversion=0
5979 api_revision=0
5980 api_version=0
5981 api_subversion=0
151e6568
MB
5982 perl_patchlevel=0
5983 $echo "(You do not have patchlevel.h. Eek.)"
b4eb6b3d 5984fi
35918792
YST
5985if $test -r $rsrc/.patch ; then
5986 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
151e6568
MB
5987 perl_patchlevel=`cat $rsrc/.patch`
5988 fi
5989fi
861eb78d 5990: Define a handy string here to avoid duplication in myconfig.SH and configpm.
f3f1a2d8
MB
5991version_patchlevel_string="version $patchlevel subversion $subversion"
5992case "$perl_patchlevel" in
59930|'') ;;
5994*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4d20abad 5995esac
4d20abad 5996
f3f1a2d8 5997$echo "(You have $package $version_patchlevel_string.)"
4d20abad 5998
f3f1a2d8
MB
5999case "$osname" in
6000dos|vms)
6001 : XXX Should be a Configure test for double-dots in filenames.
6002 version=`echo $revision $patchlevel $subversion | \
6003 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6004 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6005 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6006 ;;
6007*)
6008 version=`echo $revision $patchlevel $subversion | \
6009 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6010 api_versionstring=`echo $api_revision $api_version $api_subversion | \
6011 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6012 ;;
4d20abad 6013esac
f3f1a2d8
MB
6014: Special case the 5.005_xx maintenance series, which used 5.005
6015: without any subversion label as a subdirectory in $sitelib
6016if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6017 api_versionstring='5.005'
6018fi
4d20abad 6019
f3f1a2d8
MB
6020: determine installation style
6021: For now, try to deduce it from prefix unless it is already set.
6022: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6023case "$installstyle" in
6024'') case "$prefix" in
6025 *perl*) dflt='lib';;
6026 *) dflt='lib/perl5' ;;
6027 esac
6028 ;;
6029*) dflt="$installstyle" ;;
4d20abad 6030esac
f3f1a2d8
MB
6031: Probably not worth prompting for this since we prompt for all
6032: the directories individually, and the prompt would be too long and
6033: confusing anyway.
6034installstyle=$dflt
4d20abad 6035
eaf812ae
MB
6036: determine where public executables go
6037echo " "
6038set dflt bin bin
6039eval $prefixit
6040fn=d~
6041rp='Pathname where the public executables will reside?'
6042. ./getfile
6043if $test "X$ansexp" != "X$binexp"; then
6044 installbin=''
6045fi
6046prefixvar=bin
6047: XXX Bug? -- ignores Configure -Dinstallprefix setting.
6048. ./setprefixvar
6049
6050case "$userelocatableinc" in
6051$define|true|[yY]*) dflt='y' ;;
6052*) dflt='n' ;;
6053esac
6054cat <<EOM
6055
6056Would you like to build Perl so that the installation is relocatable, so that
6057library paths in @INC are determined relative to the path of the perl binary?
6058This is not advised for system Perl installs, or if you need to run setid
6059scripts or scripts under taint mode.
6060
6061If this doesn't make any sense to you, just accept the default '$dflt'.
6062EOM
6063rp='Use relocatable @INC?'
6064. ./myread
6065case "$ans" in
6066y|Y) val="$define" ;;
6067*) val="$undef" ;;
6068esac
6069set userelocatableinc
6070eval $setvar
6071
6072: Default prefix is now "up one level from where the binaries are"
6073case "$userelocatableinc" in
6074$define|true|[yY]*)
6075 initialinstalllocation="$binexp"
6076 bin=".../"
6077 binexp=".../"
6078 prefix=".../.."
6079 prefixexp=".../.."
6080 installprefixexp=".../.."
6081 ;;
6082esac
6083
b4eb6b3d
JH
6084: determine where private library files go
6085: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6086: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6087: /opt/perl/lib/perl5... would be redundant.
6088: The default "style" setting is made in installstyle.U
6089case "$installstyle" in
6090*lib/perl5*) set dflt privlib lib/$package/$version ;;
6091*) set dflt privlib lib/$version ;;
6092esac
6093eval $prefixit
6094$cat <<EOM
6095
6096There are some auxiliary files for $package that need to be put into a
6097private library directory that is accessible by everyone.
6098
6099EOM
eaf812ae 6100fn=$binexp
b4eb6b3d
JH
6101fn=d~+
6102rp='Pathname where the private library files will reside?'
6103. ./getfile
79522dd2
NC
6104prefixvar=privlib
6105. ./setprefixvar
b4eb6b3d
JH
6106
6107: set the prefixup variable, to restore leading tilda escape
6108prefixup='case "$prefixexp" in
6109"$prefix") ;;
6110*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6111esac'
6112
6113: determine where public architecture dependent libraries go
6114set archlib archlib
6115eval $prefixit
6116: privlib default is /usr/local/lib/$package/$version
6117: archlib default is /usr/local/lib/$package/$version/$archname
6118: privlib may have an optional trailing /share.
6119tdflt=`echo $privlib | $sed 's,/share$,,'`
6120tdflt=$tdflt/$archname
6121case "$archlib" in
6122'') dflt=$tdflt
6123 ;;
6124*) dflt="$archlib"
6125 ;;
6126esac
6127$cat <<EOM
6128
6129$spackage contains architecture-dependent library files. If you are
6130sharing libraries in a heterogeneous environment, you might store
6131these files in a separate location. Otherwise, you can just include
6132them with the rest of the public library files.
6133
6134EOM
eaf812ae 6135fn=$binexp
b4eb6b3d
JH
6136fn=d+~
6137rp='Where do you want to put the public architecture-dependent libraries?'
6138. ./getfile
79522dd2
NC
6139prefixvar=archlib
6140. ./setprefixvar
b4eb6b3d
JH
6141if $test X"$archlib" = X"$privlib"; then
6142 d_archlib="$undef"
6143else
6144 d_archlib="$define"
6145fi
b4eb6b3d 6146
b4eb6b3d
JH
6147: see if setuid scripts can be secure
6148$cat <<EOM
6149
6150Some kernels have a bug that prevents setuid #! scripts from being
6151secure. Some sites have disabled setuid #! scripts because of this.
6152
6153First let's decide if your kernel supports secure setuid #! scripts.
6154(If setuid #! scripts would be secure but have been disabled anyway,
6155don't say that they are secure if asked.)
6156
6157EOM
6158
6159val="$undef"
6160if $test -d /dev/fd; then
6161 echo "#!$ls" >reflect
6162 chmod +x,u+s reflect
6163 ./reflect >flect 2>&1
6164 if $contains "/dev/fd" flect >/dev/null; then
6165 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6166 val="$define"
6167 else
6168 $cat <<EOM
6169If you are not sure if they are secure, I can check but I'll need a
6170username and password different from the one you are using right now.
6171If you don't have such a username or don't want me to test, simply
6172enter 'none'.
6173
6174EOM
6175 rp='Other username to test security of setuid scripts with?'
6176 dflt='none'
6177 . ./myread
6178 case "$ans" in
6179 n|none)
6180 case "$d_suidsafe" in
6181 '') echo "I'll assume setuid scripts are *not* secure." >&4
6182 dflt=n;;
6183 "$undef")
6184 echo "Well, the $hint value is *not* secure." >&4
6185 dflt=n;;
6186 *) echo "Well, the $hint value *is* secure." >&4
6187 dflt=y;;
6188 esac
c1a7f87b 6189 ;;
b4eb6b3d
JH
6190 *)
6191 $rm -f reflect flect
6192 echo "#!$ls" >reflect
6193 chmod +x,u+s reflect
6194 echo >flect
6195 chmod a+w flect
6196 echo '"su" will (probably) prompt you for '"$ans's password."
6197 su $ans -c './reflect >flect'
6198 if $contains "/dev/fd" flect >/dev/null; then
6199 echo "Okay, it looks like setuid scripts are secure." >&4
6200 dflt=y
6201 else
6202 echo "I don't think setuid scripts are secure." >&4
6203 dflt=n
6204 fi
6205 ;;
6206 esac
6207 rp='Does your kernel have *secure* setuid scripts?'
6208 . ./myread
6209 case "$ans" in
6210 [yY]*) val="$define";;
6211 *) val="$undef";;
6212 esac
6213 fi
6214else
6215 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6216 echo "(That's for file descriptors, not floppy disks.)"
6217 val="$undef"
6218fi
6219set d_suidsafe
6220eval $setvar
6221
6222$rm -f reflect flect
6223
6224: now see if they want to do setuid emulation
6225echo " "
6226val="$undef"
6227case "$d_suidsafe" in
6228"$define")
6229 val="$undef"
3c728e00 6230 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6231 ;;
f3f1a2d8
MB
6232*)
6233 $cat <<EOM
6234Some systems have disabled setuid scripts, especially systems where
6235setuid scripts cannot be secure. On systems where setuid scripts have
6236been disabled, the setuid/setgid bits on scripts are currently
6237useless. It is possible for $package to detect those bits and emulate
6238setuid/setgid in a secure fashion. This emulation will only work if
6239setuid scripts have been disabled in your kernel.
6240
6241EOM
6242 case "$d_dosuid" in
6243 "$define") dflt=y ;;
6244 *) dflt=n ;;
6245 esac
6246 rp="Do you want to do setuid/setgid emulation?"
6247 . ./myread
6248 case "$ans" in
6249 [yY]*) val="$define";;
6250 *) val="$undef";;
6251 esac
6252 ;;
6253esac
6254set d_dosuid
6255eval $setvar
6256
f3f1a2d8
MB
6257: Find perl5.005 or later.
6258echo "Looking for a previously installed perl5.005 or later... "
6259case "$perl5" in
6260'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6261 : Check if this perl is recent and can load a simple module
6262 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6263 perl5=$tdir/perl
6264 break;
6265 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6266 perl5=$tdir/perl5
6267 break;
6268 fi
6269 done
6270 ;;
6271*) perl5="$perl5"
6272 ;;
6273esac
6274case "$perl5" in
6275'') echo "None found. That's ok.";;
6276*) echo "Using $perl5." ;;
6277esac
6278
6279$cat <<EOM
6280
6281After $package is installed, you may wish to install various
6282add-on modules and utilities. Typically, these add-ons will
6283be installed under $prefix with the rest
6284of this package. However, you may wish to install such add-ons
6285elsewhere under a different prefix.
6286
6287If you do not wish to put everything under a single prefix, that's
6288ok. You will be prompted for the individual locations; this siteprefix
6289is only used to suggest the defaults.
6290
6291The default should be fine for most people.
6292
6293EOM
6294fn=d~+
6295rp='Installation prefix to use for add-on modules and utilities?'
6296: XXX Here might be another good place for an installstyle setting.
6297case "$siteprefix" in
6298'') dflt=$prefix ;;
6299*) dflt=$siteprefix ;;
6300esac
6301. ./getfile
6302: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6303oldsiteprefix=''
6304case "$siteprefix" in
6305'') ;;
6306*) case "$ans" in
6307 "$prefix") ;;
6308 *) oldsiteprefix="$prefix";;
6309 esac
6310 ;;
6311esac
6312siteprefix="$ans"
6313siteprefixexp="$ansexp"
6314
6315: determine where site specific libraries go.
6316: Usual default is /usr/local/lib/perl5/site_perl/$version
6317: The default "style" setting is made in installstyle.U
6318: XXX No longer works with Prefixit stuff.
6319prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6320case "$sitelib" in
6321'') case "$installstyle" in
6322 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6323 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6324 esac
6325 ;;
6326*) dflt="$sitelib"
6327 ;;
6328esac
6329$cat <<EOM
6330
6331The installation process will create a directory for
6332site-specific extensions and modules. Most users find it convenient
6333to place all site-specific files in this directory rather than in the
6334main distribution directory.
6335
6336EOM
6337fn=d~+
6338rp='Pathname for the site-specific library files?'
6339. ./getfile
6340prefixvar=sitelib
6341. ./setprefixvar
6342sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6343
6344: Determine list of previous versions to include in @INC
6345$cat > getverlist <<EOPL
6346#!$perl5 -w
6347use File::Basename;
6348\$api_versionstring = "$api_versionstring";
6349\$version = "$version";
6350\$stem = "$sitelib_stem";
6351\$archname = "$archname";
6352EOPL
6353 $cat >> getverlist <<'EOPL'
6354# Can't have leading @ because metaconfig interprets it as a command!
6355;@inc_version_list=();
6356# XXX Redo to do opendir/readdir?
6357if (-d $stem) {
6358 chdir($stem);
6359 ;@candidates = glob("5.*");
6360}
6361else {
6362 ;@candidates = ();
6363}
6364
6365# XXX ToDo: These comparisons must be reworked when two-digit
6366# subversions come along, so that 5.7.10 compares as greater than
6367# 5.7.3! By that time, hope that 5.6.x is sufficiently
6368# widespread that we can use the built-in version vectors rather
6369# than reinventing them here. For 5.6.0, however, we must
6370# assume this script will likely be run by 5.005_0x. --AD 1/2000.
6371foreach $d (@candidates) {
6372 if ($d lt $version) {
6373 if ($d ge $api_versionstring) {
6374 unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6375 }
6376 elsif ($d ge "5.005") {
6377 unshift(@inc_version_list, grep { -d } $d);
6378 }
6379 }
6380 else {
6381 # Skip newer version. I.e. don't look in
6382 # 5.7.0 if we're installing 5.6.1.
6383 }
6384}
6385
6386if (@inc_version_list) {
6387 print join(' ', @inc_version_list);
6388}
6389else {
6390 # Blank space to preserve value for next Configure run.
6391 print " ";
6392}
6393EOPL
6394chmod +x getverlist
6395case "$inc_version_list" in
6396'') if test -x "$perl5$exe_ext"; then
6397 dflt=`$perl5 getverlist`
6398 else
6399 dflt='none'
6400 fi
6401 ;;
6402$undef) dflt='none' ;;
6403*) eval dflt=\"$inc_version_list\" ;;
6404esac
6405case "$dflt" in
6406''|' ') dflt=none ;;
6407esac
6408case "$dflt" in
64095.005) dflt=none ;;
6410esac
6411$cat <<EOM
6412
6413In order to ease the process of upgrading, this version of perl
6414can be configured to use modules built and installed with earlier
6415versions of perl that were installed under $prefix. Specify here
6416the list of earlier versions that this version of perl should check.
6417If Configure detected no earlier versions of perl installed under
6418$prefix, then the list will be empty. Answer 'none' to tell perl
6419to not search earlier versions.
b4eb6b3d 6420
f3f1a2d8
MB
6421The default should almost always be sensible, so if you're not sure,
6422just accept the default.
b4eb6b3d 6423EOM
f3f1a2d8
MB
6424
6425rp='List of earlier versions to include in @INC?'
6426. ./myread
6427case "$ans" in
6428[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6429*) inc_version_list="$ans" ;;
6430esac
6431case "$inc_version_list" in
6432''|' ')
6433 inc_version_list_init='0'
6434 d_inc_version_list="$undef"
6435 ;;
6436*) inc_version_list_init=`echo $inc_version_list |
6437 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6438 d_inc_version_list="$define"
b4eb6b3d
JH
6439 ;;
6440esac
f3f1a2d8 6441$rm -f getverlist
b4eb6b3d 6442
b4eb6b3d 6443: see if this is a malloc.h system
01d07975
YST
6444: we want a real compile instead of Inhdr because some systems have a
6445: malloc.h that just gives a compile error saying to use stdlib.h instead
6446echo " "
6447$cat >try.c <<EOCP
6448#include <stdlib.h>
6449#include <malloc.h>
6450int main () { return 0; }
6451EOCP
6452set try
6453if eval $compile; then
6454 echo "<malloc.h> found." >&4
6455 val="$define"
6456else
6457 echo "<malloc.h> NOT found." >&4
6458 val="$undef"
6459fi
6460$rm -f try.c try
6461set i_malloc
6462eval $setvar
b4eb6b3d 6463
c8b93cf9
JH
6464: check for void type
6465echo " "
6466echo "Checking to see how well your C compiler groks the void type..." >&4
6467case "$voidflags" in
6468'')
c727eafa 6469 $cat >try.c <<EOCP
d1daaddf
JH
6470#$i_stdlib I_STDLIB
6471#ifdef I_STDLIB
6472#include <stdlib.h>
6473#endif
c8b93cf9
JH
6474#if TRY & 1
6475void sub() {
6476#else
6477sub() {
6478#endif
6479 extern void moo(); /* function returning void */
6480 void (*goo)(); /* ptr to func returning void */
6481#if TRY & 8
6482 void *hue; /* generic ptr */
6483#endif
6484#if TRY & 2
6485 void (*foo[10])();
6486#endif
6487
6488#if TRY & 4
6489 if(goo == moo) {
6490 exit(0);
6491 }
6492#endif
6493 exit(0);
6494}
6495int main() { sub(); }
6496EOCP
6497 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6498 voidflags=$defvoidused
6499 echo "Good. It appears to support void to the level $package wants.">&4
6500 if $contains warning .out >/dev/null 2>&1; then
6501 echo "However, you might get some warnings that look like this:"
6502 $cat .out
6503 fi
6504 else
6505echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6506 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6507 echo "It supports 1..."
6508 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6509 echo "It also supports 2..."
6510 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6511 voidflags=7
6512 echo "And it supports 4 but not 8 definitely."
6513 else
6514 echo "It doesn't support 4..."
6515 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6516 voidflags=11
6517 echo "But it supports 8."
6518 else
6519 voidflags=3
6520 echo "Neither does it support 8."
6521 fi
6522 fi
6523 else
6524 echo "It does not support 2..."
6525 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6526 voidflags=13
6527 echo "But it supports 4 and 8."
6528 else
6529 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6530 voidflags=5
6531 echo "And it supports 4 but has not heard about 8."
6532 else
6533 echo "However it supports 8 but not 4."
6534 fi
6535 fi
6536 fi
6537 else
6538 echo "There is no support at all for void."
6539 voidflags=0
6540 fi
6541 fi
6542esac
6543case "$voidflags" in
6544"$defvoidused") ;;
6545*) $cat >&4 <<'EOM'
6546 Support flag bits are:
6547 1: basic void declarations.
6548 2: arrays of pointers to functions returning void.
6549 4: operations between pointers to and addresses of void functions.
6550 8: generic void pointers.
6551EOM
6552 dflt="$voidflags";
6553 rp="Your void support flags add up to what?"
6554 . ./myread
6555 voidflags="$ans"
6556 ;;
6557esac
6558$rm -f try.* .out
6559
6560: check for length of pointer
6561echo " "
6562case "$ptrsize" in
6563'')
6564 echo "Checking to see how big your pointers are..." >&4
6565 if test "$voidflags" -gt 7; then
6566 echo '#define VOID_PTR char *' > try.c
6567 else
6568 echo '#define VOID_PTR void *' > try.c
6569 fi
74d00865 6570 $cat >>try.c <<EOCP
c8b93cf9 6571#include <stdio.h>
d1daaddf
JH
6572#$i_stdlib I_STDLIB
6573#ifdef I_STDLIB
6574#include <stdlib.h>
6575#endif
c8b93cf9
JH
6576int main()
6577{
6578 printf("%d\n", (int)sizeof(VOID_PTR));
6579 exit(0);
6580}
6581EOCP
6582 set try
6583 if eval $compile_ok; then
6584 ptrsize=`$run ./try`
6585 echo "Your pointers are $ptrsize bytes long."
6586 else
6587 dflt='4'
6588 echo "(I can't seem to compile the test program. Guessing...)" >&4
6589 rp="What is the size of a pointer (in bytes)?"
6590 . ./myread
6591 ptrsize="$ans"
6592 fi
6593 ;;
6594esac
6595$rm -f try.c try
6596case "$use64bitall" in
6597"$define"|true|[yY]*)
6598 case "$ptrsize" in
6599 4) cat <<EOM >&4
6600
1911a026
JH
6601*** You have chosen a maximally 64-bit build,
6602*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6603*** Please rerun Configure without -Duse64bitall.
6604EOM
6605 case "$d_quad" in
6606 define)
6607 cat <<EOM >&4
6608*** Since you have quads, you could possibly try with -Duse64bitint.
6609EOM
6610 ;;
6611 esac
6612 cat <<EOM >&4
1911a026 6613*** Cannot continue, aborting.
c8b93cf9
JH
6614
6615EOM
09b58c7b 6616
1911a026 6617 exit 1
c8b93cf9
JH
6618 ;;
6619 esac
6620 ;;
6621esac
6622
19a100ff 6623
9df442c2
NC
6624: determine whether to use malloc wrapping
6625echo " "
6626case "$usemallocwrap" in
6627[yY]*|true|$define) dflt='y' ;;
6628[nN]*|false|$undef) dflt='n' ;;
6629*) case "$usedevel" in
6630 [yY]*|true|$define) dflt='y' ;;
6631 *) dflt='n' ;;
6632 esac
6633 ;;
6634esac
6635rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6636. ./myread
6637usemallocwrap="$ans"
6638case "$ans" in
6639y*|true)
6640 usemallocwrap="$define" ;;
6641*)
6642 usemallocwrap="$undef" ;;
6643esac
c8b93cf9 6644
b4eb6b3d
JH
6645: determine which malloc to compile in
6646echo " "
6647case "$usemymalloc" in
c4163172
JH
6648[yY]*|true|$define) dflt='y' ;;
6649[nN]*|false|$undef) dflt='n' ;;
6650*) case "$ptrsize" in
6651 4) dflt='y' ;;
6652 *) dflt='n' ;;
6653 esac
6654 ;;
8dfa8df9 6655esac
b4eb6b3d
JH
6656rp="Do you wish to attempt to use the malloc that comes with $package?"
6657. ./myread
6658usemymalloc="$ans"
6659case "$ans" in
6660y*|true)
6661 usemymalloc='y'
6662 mallocsrc='malloc.c'
6663 mallocobj="malloc$_o"
6664 d_mymalloc="$define"
6665 case "$libs" in
6666 *-lmalloc*)
6667 : Remove malloc from list of libraries to use
6668 echo "Removing unneeded -lmalloc from library list" >&4
6669 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6670 shift
6671 libs="$*"
6672 echo "libs = $libs" >&4
6673 ;;
6674 esac
6675 ;;
6676*)
6677 usemymalloc='n'
6678 mallocsrc=''
6679 mallocobj=''
6680 d_mymalloc="$undef"
6681 ;;
6682esac
6683
6684: compute the return types of malloc and free
6685echo " "
6686$cat >malloc.c <<END
6687#$i_malloc I_MALLOC
6688#$i_stdlib I_STDLIB
6689#include <stdio.h>
6690#include <sys/types.h>
6691#ifdef I_MALLOC
6692#include <malloc.h>
6693#endif
6694#ifdef I_STDLIB
6695#include <stdlib.h>
6696#endif
6697#ifdef TRY_MALLOC
6698void *malloc();
6699#endif
6700#ifdef TRY_FREE
6701void free();
6702#endif
6703END
6704case "$malloctype" in
6705'')
6706 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6707 malloctype='void *'
6708 else
6709 malloctype='char *'
6710 fi
6711 ;;
6712esac
6713echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6714
6715case "$freetype" in
6716'')
6717 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6718 freetype='void'
6719 else
6720 freetype='int'
6721 fi
6722 ;;
6723esac
6724echo "Your system uses $freetype free(), it would seem." >&4
6725$rm -f malloc.[co]
b4eb6b3d
JH
6726: determine where site specific architecture-dependent libraries go.
6727: sitelib default is /usr/local/lib/perl5/site_perl/$version
6728: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6729: sitelib may have an optional trailing /share.
6730case "$sitearch" in
6731'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6732 dflt="$dflt/$archname"
6733 ;;
6734*) dflt="$sitearch"
6735 ;;
6736esac
6737set sitearch sitearch none
6738eval $prefixit
6739$cat <<EOM
6740
6741The installation process will also create a directory for
6742architecture-dependent site-specific extensions and modules.
6743
6744EOM
6745fn=d~+
6746rp='Pathname for the site-specific architecture-dependent library files?'
6747. ./getfile
79522dd2
NC
6748prefixvar=sitearch
6749. ./setprefixvar
c95d0e17
GA
6750if $test X"$sitearch" = X"$sitelib"; then
6751 d_sitearch="$undef"
6752else
6753 d_sitearch="$define"
6754fi
b4eb6b3d
JH
6755
6756$cat <<EOM
6757
6758The installation process will also create a directory for
6759vendor-supplied add-ons. Vendors who supply perl with their system
6760may find it convenient to place all vendor-supplied files in this
6761directory rather than in the main distribution directory. This will
6762ease upgrades between binary-compatible maintenance versions of perl.
6763
6764Of course you may also use these directories in whatever way you see
6765fit. For example, you might use them to access modules shared over a
6766company-wide network.
6767
6768The default answer should be fine for most people.
6769This causes further questions about vendor add-ons to be skipped
6770and no vendor-specific directories will be configured for perl.
6771
6772EOM
6773rp='Do you want to configure vendor-specific add-on directories?'
6774case "$usevendorprefix" in
6775define|true|[yY]*) dflt=y ;;
6776*) : User may have set vendorprefix directly on Configure command line.
6777 case "$vendorprefix" in
6778 ''|' ') dflt=n ;;
6779 *) dflt=y ;;
6780 esac
6781 ;;
6782esac
6783. ./myread
6784case "$ans" in
6785[yY]*) fn=d~+
6786 rp='Installation prefix to use for vendor-supplied add-ons?'
6787 case "$vendorprefix" in
6788 '') dflt='' ;;
6789 *) dflt=$vendorprefix ;;
6790 esac
6791 . ./getfile
6792 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6793 oldvendorprefix=''
6794 case "$vendorprefix" in
6795 '') ;;
6796 *) case "$ans" in
6797 "$prefix") ;;
6798 *) oldvendorprefix="$prefix";;
6799 esac
6800 ;;
6801 esac
6802 usevendorprefix="$define"
6803 vendorprefix="$ans"
6804 vendorprefixexp="$ansexp"
6805 ;;
6806*) usevendorprefix="$undef"
6807 vendorprefix=''
6808 vendorprefixexp=''
6809 ;;
6810esac
6811
6812case "$vendorprefix" in
6813'') d_vendorlib="$undef"
6814 vendorlib=''
6815 vendorlibexp=''
6816 ;;
6817*) d_vendorlib="$define"
6818 : determine where vendor-supplied modules go.
6819 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6820 case "$vendorlib" in
6821 '')
6822 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6823 case "$installstyle" in
6824 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6825 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6826 esac
6827 ;;
6828 *) dflt="$vendorlib"
6829 ;;
6830 esac
6831 fn=d~+
6832 rp='Pathname for the vendor-supplied library files?'
6833 . ./getfile
6834 vendorlib="$ans"
6835 vendorlibexp="$ansexp"
6836 ;;
6837esac
6838vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6839prefixvar=vendorlib
6840. ./installprefix
b4eb6b3d
JH
6841
6842case "$vendorprefix" in
6843'') d_vendorarch="$undef"
6844 vendorarch=''
6845 vendorarchexp=''
6846 ;;
6847*) d_vendorarch="$define"
6848 : determine where vendor-supplied architecture-dependent libraries go.
6849 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6850 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6851 : vendorlib may have an optional trailing /share.
6852 case "$vendorarch" in
6853 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6854 dflt="$dflt/$archname"
6855 ;;
6856 *) dflt="$vendorarch" ;;
6857 esac
6858 fn=d~+
6859 rp='Pathname for vendor-supplied architecture-dependent files?'
6860 . ./getfile
6861 vendorarch="$ans"
6862 vendorarchexp="$ansexp"
6863 ;;
6864esac
a092d240
NC
6865prefixvar=vendorarch
6866. ./installprefix
b4eb6b3d
JH
6867
6868: Final catch-all directories to search
6869$cat <<EOM
6870
6871Lastly, you can have perl look in other directories for extensions and
6872modules in addition to those already specified.
6873These directories will be searched after
6874 $sitearch
6875 $sitelib
6876EOM
6877test X"$vendorlib" != "X" && echo ' ' $vendorlib
6878test X"$vendorarch" != "X" && echo ' ' $vendorarch
6879echo ' '
6880case "$otherlibdirs" in
6881''|' ') dflt='none' ;;
6882*) dflt="$otherlibdirs" ;;
6883esac
6884$cat <<EOM
6885Enter a colon-separated set of extra paths to include in perl's @INC
6886search path, or enter 'none' for no extra paths.
6887
6888EOM
6889
6890rp='Colon-separated list of additional directories for perl to search?'
6891. ./myread
6892case "$ans" in
6893' '|''|none) otherlibdirs=' ' ;;
6894*) otherlibdirs="$ans" ;;
6895esac
6896case "$otherlibdirs" in
6897' ') val=$undef ;;
6898*) val=$define ;;
6899esac
6900set d_perl_otherlibdirs
6901eval $setvar
6902
6903: Cruising for prototypes
6904echo " "
6905echo "Checking out function prototypes..." >&4
55954f19
JH
6906$cat >prototype.c <<EOCP
6907#$i_stdlib I_STDLIB
6908#ifdef I_STDLIB
6909#include <stdlib.h>
6910#endif
b4eb6b3d
JH
6911int main(int argc, char *argv[]) {
6912 exit(0);}
6913EOCP
6914if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6915 echo "Your C compiler appears to support function prototypes."
6916 val="$define"
6917else
6918 echo "Your C compiler doesn't seem to understand function prototypes."
6919 val="$undef"
6920fi
6921set prototype
6922eval $setvar
6923$rm -f prototype*
6924
6925case "$prototype" in
6926"$define") ;;
6927*) ansi2knr='ansi2knr'
6928 echo " "
6929 cat <<EOM >&4
6930
6931$me: FATAL ERROR:
6932This version of $package can only be compiled by a compiler that
6933understands function prototypes. Unfortunately, your C compiler
6934 $cc $ccflags
6935doesn't seem to understand them. Sorry about that.
6936
6937If GNU cc is available for your system, perhaps you could try that instead.
6938
6939Eventually, we hope to support building Perl with pre-ANSI compilers.
6940If you would like to help in that effort, please contact <perlbug@perl.org>.
6941
6942Aborting Configure now.
6943EOM
6944 exit 2
6945 ;;
6946esac
6947
6fcddf3b 6948echo " "
6fcddf3b 6949case "$extras" in
bf35c3f6
JH
6950'') dflt='n';;
6951*) dflt='y';;
6fcddf3b
JH
6952esac
6953cat <<EOM
6954Perl can be built with extra modules or bundles of modules which
6955will be fetched from the CPAN and installed alongside Perl.
6956
6957Notice that you will need access to the CPAN; either via the Internet,
6958or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
6959be asked later to configure the CPAN.pm module which will in turn do
6960the installation of the rest of the extra modules or bundles.)
6961
6962Notice also that if the modules require any external software such as
dd2de242
JH
6963libraries and headers (the libz library and the zlib.h header for the
6964Compress::Zlib module, for example) you MUST have any such software
6965already installed, this configuration process will NOT install such
6966things for you.
6fcddf3b
JH
6967
6968If this doesn't make any sense to you, just accept the default '$dflt'.
6969EOM
dd2de242 6970rp='Install any extra modules (y or n)?'
6fcddf3b
JH
6971. ./myread
6972case "$ans" in
6973y|Y)
6974 cat <<EOM
6975
6976Please list any extra modules or bundles to be installed from CPAN,
6977with spaces between the names. The names can be in any format the
dd2de242
JH
6978'install' command of CPAN.pm will understand. (Answer 'none',
6979without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
6980EOM
6981 rp='Extras?'
6982 dflt="$extras"
6983 . ./myread
6984 extras="$ans"
6985esac
6986case "$extras" in
6987''|'none')
6988 val=''
6989 $rm -f ../extras.lst
6990 ;;
6991*) echo "(Saving the list of extras for later...)"
dd2de242
JH
6992 echo "$extras" > ../extras.lst
6993 val="'$extras'"
6fcddf3b
JH
6994 ;;
6995esac
6996set extras
6997eval $setvar
6998echo " "
6999
6e1038e0
MB
7000: determine where html pages for programs go
7001set html1dir html1dir none
7002eval $prefixit
7003$cat <<EOM
7004
f3f1a2d8 7005If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7006the appropriate directory here. To skip installing html files,
7007answer "none".
7008EOM
7009case "$html1dir" in
7010''|none|$undef|' ') dflt=none ;;
7011*) dflt=$html1dir ;;
7012esac
7013fn=dn+~
7014rp="Directory for the main $spackage html pages?"
7015. ./getfile
79522dd2
NC
7016prefixvar=html1dir
7017. ./setprefixvar
6e1038e0
MB
7018: Use ' ' for none so value is preserved next time through Configure
7019$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7020
7021: determine where html pages for libraries and modules go
7022set html3dir html3dir none
7023eval $prefixit
7024$cat <<EOM
7025
7026If you wish to install html files for modules associated with $spackage,
7027indicate the appropriate directory here. To skip installing html files,
7028answer "none".
7029EOM
7030: There is no obvious default. If they have specified html1dir, then
7031: try to key off that, possibly changing .../html1 into .../html3.
7032case "$html3dir" in
7033'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7034*) dflt=$html3dir ;;
7035esac
7036fn=dn+~
7037rp="Directory for the $spackage module html pages?"
7038. ./getfile
79522dd2
NC
7039prefixvar=html3dir
7040. ./setprefixvar
6e1038e0
MB
7041: Use ' ' for none so value is preserved next time through Configure
7042$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7043
89ce900e
JH
7044: determine whether to install perl also as /usr/bin/perl
7045
7046echo " "
7047if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7048 $cat <<EOM
7049Many scripts expect perl to be installed as /usr/bin/perl.
7050
7051If you want to, I can install the perl you are about to compile
7052as /usr/bin/perl (in addition to $bin/perl).
7053EOM
7054 if test -f /usr/bin/perl; then
7055 $cat <<EOM
7056
7057However, please note that because you already have a /usr/bin/perl,
7058overwriting that with a new Perl would very probably cause problems.
7059Therefore I'm assuming you don't want to do that (unless you insist).
7060
7061EOM
7062 case "$installusrbinperl" in
7063 "$define"|[yY]*) dflt='y';;
7064 *) dflt='n';;
7065 esac
7066 else
7067 $cat <<EOM
7068
7069Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7070
7071EOM
7072 case "$installusrbinperl" in
7073 "$undef"|[nN]*) dflt='n';;
7074 *) dflt='y';;
7075 esac
7076 fi
7077 rp="Do you want to install perl as /usr/bin/perl?"
7078 . ./myread
7079 case "$ans" in
7080 [yY]*) val="$define";;
7081 *) val="$undef" ;;
7082 esac
7083else
7084 val="$undef"
7085fi
7086set installusrbinperl
7087eval $setvar
7088
7089echo " "
7090echo "Checking for GNU C Library..." >&4
7091cat >try.c <<'EOCP'
7092/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7093 alone are insufficient to distinguish different versions, such as
7094 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7095 libc version 2.1.0. A. Dougherty, June 3, 2002.
7096*/
7097#include <stdio.h>
7098int main(void)
7099{
7100#ifdef __GLIBC__
7101# ifdef __GLIBC_MINOR__
7102# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7103# include <gnu/libc-version.h>
7104 printf("%s\n", gnu_get_libc_version());
7105# else
7106 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7107# endif
7108# else
7109 printf("%d\n", __GLIBC__);
7110# endif
7111 return 0;
7112#else
7113 return 1;
7114#endif
7115}
7116EOCP
7117set try
7118if eval $compile_ok && $run ./try > glibc.ver; then
7119 val="$define"
7120 gnulibc_version=`$cat glibc.ver`
7121 echo "You are using the GNU C Library version $gnulibc_version"
7122else
7123 val="$undef"
7124 gnulibc_version=''
7125 echo "You are not using the GNU C Library"
7126fi
7127$rm -f try try.* glibc.ver
7128set d_gnulibc
7129eval $setvar
7130
7131: see if nm is to be used to determine whether a symbol is defined or not
7132case "$usenm" in
7133'')
7134 dflt=''
7135 case "$d_gnulibc" in
7136 "$define")
7137 echo " "
7138 echo "nm probably won't work on the GNU C Library." >&4
7139 dflt=n
7140 ;;
7141 esac
7142 case "$dflt" in
7143 '')
7144 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7145 echo " "
7146 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7147 echo "'nm' won't be sufficient on this sytem." >&4
7148 dflt=n
7149 fi
7150 ;;
7151 esac
7152 case "$dflt" in
7153 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7154 if $test $dflt -gt 20; then
7155 dflt=y
7156 else
7157 dflt=n
7158 fi
7159 ;;
7160 esac
b4eb6b3d 7161 ;;
89ce900e
JH
7162*)
7163 case "$usenm" in
7164 true|$define) dflt=y;;
7165 *) dflt=n;;
7166 esac
b4eb6b3d
JH
7167 ;;
7168esac
89ce900e 7169$cat <<EOM
b4eb6b3d 7170
89ce900e
JH
7171I can use $nm to extract the symbols from your C libraries. This
7172is a time consuming task which may generate huge output on the disk (up
7173to 3 megabytes) but that should make the symbols extraction faster. The
7174alternative is to skip the 'nm' extraction part and to compile a small
7175test program instead to determine whether each symbol is present. If
7176you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7177this may be the best solution.
b4eb6b3d 7178
89ce900e 7179You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7180
89ce900e
JH
7181EOM
7182rp="Shall I use $nm to extract C symbols from the libraries?"
7183. ./myread
7184case "$ans" in
7185[Nn]*) usenm=false;;
7186*) usenm=true;;
b4eb6b3d 7187esac
89ce900e
JH
7188
7189runnm=$usenm
7190case "$reuseval" in
7191true) runnm=false;;
b4eb6b3d 7192esac
b4eb6b3d 7193
89ce900e
JH
7194: nm options which may be necessary
7195case "$nm_opt" in
7196'') if $test -f /mach_boot; then
7197 nm_opt='' # Mach
7198 elif $test -d /usr/ccs/lib; then
7199 nm_opt='-p' # Solaris (and SunOS?)
7200 elif $test -f /dgux; then
7201 nm_opt='-p' # DG-UX
7202 elif $test -f /lib64/rld; then
7203 nm_opt='-p' # 64-bit Irix
7204 else
7205 nm_opt=''
7206 fi;;
7207esac
b4eb6b3d 7208
89ce900e
JH
7209: nm options which may be necessary for shared libraries but illegal
7210: for archive libraries. Thank you, Linux.
7211case "$nm_so_opt" in
7212'') case "$myuname" in
fb2e1bc0 7213 *linux*|gnu*)
89ce900e
JH
7214 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7215 nm_so_opt='--dynamic'
7216 fi
7217 ;;
7218 esac
7219 ;;
7220esac
b4eb6b3d 7221
89ce900e
JH
7222case "$runnm" in
7223true)
7224: get list of predefined functions in a handy place
7225echo " "
7226case "$libc" in
7227'') libc=unknown
7228 case "$libs" in
7229 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7230 esac
7231 ;;
b4eb6b3d 7232esac
89ce900e
JH
7233case "$libs" in
7234'') ;;
7235*) for thislib in $libs; do
7236 case "$thislib" in
7237 -lc|-lc_s)
7238 : Handle C library specially below.
7239 ;;
7240 -l*)
7241 thislib=`echo $thislib | $sed -e 's/^-l//'`
7242 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7243 :
7244 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7245 :
7246 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7247 :
7248 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7249 :
7250 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7251 :
7252 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7253 :
7254 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7255 :
7256 else
7257 try=''
7258 fi
7259 libnames="$libnames $try"
7260 ;;
7261 *) libnames="$libnames $thislib" ;;
7262 esac
7263 done
b4eb6b3d
JH
7264 ;;
7265esac
89ce900e
JH
7266xxx=normal
7267case "$libc" in
7268unknown)
7269 set /lib/libc.$so
7270 for xxx in $libpth; do
7271 $test -r $1 || set $xxx/libc.$so
7272 : The messy sed command sorts on library version numbers.
7273 $test -r $1 || \
7274 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7275 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7276 h
7277 s/[0-9][0-9]*/0000&/g
7278 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7279 G
7280 s/\n/ /' | \
7281 $sort | $sed -e 's/^.* //'`
7282 eval set \$$#
7283 done
7284 $test -r $1 || set /usr/ccs/lib/libc.$so
7285 $test -r $1 || set /lib/libsys_s$_a
7286 ;;
7287*)
7288 set blurfl
7289 ;;
7290esac
7291if $test -r "$1"; then
7292 echo "Your (shared) C library seems to be in $1."
7293 libc="$1"
7294elif $test -r /lib/libc && $test -r /lib/clib; then
7295 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7296 xxx=apollo
7297 libc='/lib/clib /lib/libc'
7298 if $test -r /lib/syslib; then
7299 echo "(Your math library is in /lib/syslib.)"
7300 libc="$libc /lib/syslib"
7301 fi
7302elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7303 echo "Your C library seems to be in $libc, as you said before."
7304elif $test -r $incpath/usr/lib/libc$_a; then
7305 libc=$incpath/usr/lib/libc$_a;
7306 echo "Your C library seems to be in $libc. That's fine."
7307elif $test -r /lib/libc$_a; then
7308 libc=/lib/libc$_a;
7309 echo "Your C library seems to be in $libc. You're normal."
7310else
7311 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7312 :
7313 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7314 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7315 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7316 :
7317 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7318 :
7319 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7320 :
7321 else
7322 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7323 fi
7324 if $test -r "$tans"; then
7325 echo "Your C library seems to be in $tans, of all places."
7326 libc=$tans
7327 else
7328 libc='blurfl'
7329 fi
7330fi
7331if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7332 dflt="$libc"
7333 cat <<EOM
b4eb6b3d 7334
89ce900e
JH
7335If the guess above is wrong (which it might be if you're using a strange
7336compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7337
89ce900e
JH
7338EOM
7339else
7340 dflt=''
7341 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7342 cat >&4 <<EOM
7343I can't seem to find your C library. I've looked in the following places:
5e366f65 7344
b4eb6b3d 7345EOM
89ce900e
JH
7346 $sed 's/^/ /' libpath
7347 cat <<EOM
5e366f65 7348
89ce900e 7349None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7350
7351EOM
89ce900e
JH
7352fi
7353fn=f
7354rp='Where is your C library?'
7355. ./getfile
7356libc="$ans"
5e366f65 7357
89ce900e
JH
7358echo " "
7359echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7360set X `cat libnames`
7361shift
7362xxx=files
7363case $# in 1) xxx=file; esac
7364echo "Extracting names from the following $xxx for later perusal:" >&4
7365echo " "
7366$sed 's/^/ /' libnames >&4
7367echo " "
7368$echo $n "This may take a while...$c" >&4
5e366f65 7369
89ce900e
JH
7370for file in $*; do
7371 case $file in
7372 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7373 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7374 esac
89ce900e
JH
7375done >libc.tmp
7376
7377$echo $n ".$c"
7378$grep fprintf libc.tmp > libc.ptf
7379xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7380xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7381xxx='[ADTSIW]'
ab900c53 7382if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7383 eval $xscan;\
7384 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7385 eval $xrun
7386elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7387 eval $xscan;\
7388 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7389 eval $xrun
7390elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7391 eval $xscan;\
7392 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7393 eval $xrun
7394elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7395 eval $xscan;\
7396 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7397 eval $xrun
7398elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7399 eval $xscan;\
7400 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7401 eval $xrun
7402elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7403 eval $xscan;\
7404 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7405 eval $xrun
7406elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7407 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7408 eval $xscan;\
7409 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7410 eval $xrun
7411elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7412 eval $xscan;\
7413 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7414 eval $xrun
7415elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7416 eval $xscan;\
7417 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7418 eval $xrun
7419elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7420 eval $xscan;\
7421 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7422 eval $xrun
7423elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7424 eval $xscan;\
7425 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7426 eval $xrun
7427elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7428 eval $xscan;\
7429 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7430 eval $xrun
7431elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7432 eval $xscan;\
7433 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7434 eval $xrun
7435elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7436 eval $xscan;\
7437 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7438 eval $xrun
b4eb6b3d 7439else
89ce900e
JH
7440 $nm -p $* 2>/dev/null >libc.tmp
7441 $grep fprintf libc.tmp > libc.ptf
7442 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7443 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7444 then
7445 nm_opt='-p'
7446 eval $xrun
7447 else
7448 echo " "
7449 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7450 com=''
7451 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7452 for thisname in $libnames $libc; do
7453 $ar t $thisname >>libc.tmp
7454 done
7455 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7456 echo "Ok." >&4
7457 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7458 # Repeat libc to extract forwarders to DLL entries too
7459 for thisname in $libnames $libc; do
7460 $ar tv $thisname >>libc.tmp
7461 # Revision 50 of EMX has bug in $ar.
7462 # it will not extract forwarders to DLL entries
7463 # Use emximp which will extract exactly them.
7464 emximp -o tmp.imp $thisname \
7465 2>/dev/null && \
7466 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7467 < tmp.imp >>libc.tmp
7468 $rm tmp.imp
7469 done
7470 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7471 echo "Ok." >&4
7472 else
7473 echo "$ar didn't seem to work right." >&4
7474 echo "Maybe this is a Cray...trying bld instead..." >&4
7475 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7476 then
7477 for thisname in $libnames; do
7478 bld t $libnames | \
7479 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7480 $ar t $thisname >>libc.tmp
7481 done
7482 echo "Ok." >&4
7483 else
7484 echo "That didn't work either. Giving up." >&4
7485 exit 1
7486 fi
7487 fi
7488 fi
b4eb6b3d 7489fi
89ce900e
JH
7490nm_extract="$com"
7491case "$PASE" in
7492define)
7493 echo " "
7494 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7495 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7496 ;;
7497*) if $test -f /lib/syscalls.exp; then
7498 echo " "
7499 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7500 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7501 fi
7502 ;;
7503esac
7504;;
7505esac
7506$rm -f libnames libpath
b4eb6b3d
JH
7507
7508: see if dld is available
7509set dld.h i_dld
7510eval $inhdr
7511
89ce900e
JH
7512: is a C symbol defined?
7513csym='tlook=$1;
7514case "$3" in
373dfab3
JH
7515-v) tf=libc.tmp; tdc="";;
7516-a) tf=libc.tmp; tdc="[]";;
7517*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7518esac;
7519tx=yes;
7520case "$reuseval-$4" in
7521true-) ;;
7522true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7523esac;
7524case "$tx" in
7525yes)
ab900c53 7526 tval=false;
5129fff4
JH
7527 if $test "$runnm" = true; then
7528 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7529 tval=true;
5129fff4 7530 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
373dfab3 7531 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7532 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3
JH
7533 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7534 $rm -f try$_exe try.c core core.* try.core;
89ce900e 7535 fi;
5129fff4 7536 else
373dfab3 7537 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7538 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
373dfab3 7539 $rm -f try$_exe try.c;
ab900c53
AB
7540 fi;
7541 ;;
89ce900e
JH
7542*)
7543 case "$tval" in
7544 $define) tval=true;;
7545 *) tval=false;;
ab900c53
AB
7546 esac;
7547 ;;
89ce900e
JH
7548esac;
7549eval "$2=$tval"'
7550
7551: define an is-in-libc? function
7552inlibc='echo " "; td=$define; tu=$undef;
7553sym=$1; var=$2; eval "was=\$$2";
7554tx=yes;
7555case "$reuseval$was" in
7556true) ;;
7557true*) tx=no;;
7558esac;
7559case "$tx" in
7560yes)
7561 set $sym tres -f;
7562 eval $csym;
7563 case "$tres" in
7564 true)
7565 echo "$sym() found." >&4;
7566 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7567 *)
7568 echo "$sym() NOT found." >&4;
7569 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7570 esac;;
7571*)
7572 case "$was" in
7573 $define) echo "$sym() found." >&4;;
7574 *) echo "$sym() NOT found." >&4;;
7575 esac;;
7576esac'
7577
b4eb6b3d
JH
7578: see if dlopen exists
7579xxx_runnm="$runnm"
7580runnm=false
7581set dlopen d_dlopen
7582eval $inlibc
7583runnm="$xxx_runnm"
7584
7585: determine which dynamic loading, if any, to compile in
7586echo " "
7587dldir="ext/DynaLoader"
7588case "$usedl" in
7589$define|y|true)
7590 dflt='y'
7591 usedl="$define"
7592 ;;
7593$undef|n|false)
7594 dflt='n'
7595 usedl="$undef"
7596 ;;
7597*)
7598 dflt='n'
7599 case "$d_dlopen" in
7600 $define) dflt='y' ;;
7601 esac
7602 case "$i_dld" in
7603 $define) dflt='y' ;;
7604 esac
7605 : Does a dl_xxx.xs file exist for this operating system
7606 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7607 ;;
7608esac
7609rp="Do you wish to use dynamic loading?"
7610. ./myread
7611usedl="$ans"
7612case "$ans" in
7613y*) usedl="$define"
7614 case "$dlsrc" in
7615 '')
7616 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7617 dflt="$dldir/dl_${osname}.xs"
7618 elif $test "$d_dlopen" = "$define" ; then
7619 dflt="$dldir/dl_dlopen.xs"
7620 elif $test "$i_dld" = "$define" ; then
7621 dflt="$dldir/dl_dld.xs"
7622 else
7623 dflt=''
7624 fi
7625 ;;
7626 *) dflt="$dldir/$dlsrc"
7627 ;;
7628 esac
7629 echo "The following dynamic loading files are available:"
7630 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7631 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7632 rp="Source file to use for dynamic loading"
7633 fn="fne"
7634 gfpth="$src"
7635 . ./getfile
7636 usedl="$define"
7637 : emulate basename
7638 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7639
7640 $cat << EOM
7641
7642Some systems may require passing special flags to $cc -c to
7643compile modules that will be used to create a shared library.
7644To use no flags, say "none".
7645
7646EOM
7647 case "$cccdlflags" in
7648 '') case "$gccversion" in
7649 '') case "$osname" in
7650 hpux) dflt='+z' ;;
7651 next) dflt='none' ;;
7652 irix*) dflt='-KPIC' ;;
48bcfe03 7653 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7654 sunos) dflt='-pic' ;;
7655 *) dflt='none' ;;
7656 esac
7657 ;;
7658 *) case "$osname" in
b6cc0f4c 7659 darwin) dflt='none' ;;
48bcfe03 7660 svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7661 *) dflt='-fpic' ;;
7662 esac ;;
7663 esac ;;
7664 ' ') dflt='none' ;;
7665 *) dflt="$cccdlflags" ;;
7666 esac
7667 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7668 . ./myread
7669 case "$ans" in
7670 none) cccdlflags=' ' ;;
7671 *) cccdlflags="$ans" ;;
7672 esac
7673
7674 cat << EOM
7675
7676Some systems use ld to create libraries that can be dynamically loaded,
7677while other systems (such as those using ELF) use $cc.
7678
7679EOM
7680 case "$ld" in
55954f19 7681 '') $cat >try.c <<EOM
b4eb6b3d
JH
7682/* Test for whether ELF binaries are produced */
7683#include <fcntl.h>
55954f19
JH
7684#$i_stdlib I_STDLIB
7685#ifdef I_STDLIB
b4eb6b3d 7686#include <stdlib.h>
55954f19 7687#endif
b4eb6b3d
JH
7688int main() {
7689 char b[4];
7690 int i = open("a.out",O_RDONLY);
7691 if(i == -1)
7692 exit(1); /* fail */
7693 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7694 exit(0); /* succeed (yes, it's ELF) */
7695 else
7696 exit(1); /* fail */
7697}
7698EOM
5440bc8e 7699 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7700 cat <<EOM
7701You appear to have ELF support. I'll use $cc to build dynamic libraries.
7702EOM
7703 dflt="$cc"
7704 else
7705 echo "I'll use ld to build dynamic libraries."
7706 dflt='ld'
7707 fi
7708 rm -f try.c a.out
7709 ;;
7710 *) dflt="$ld"
7711 ;;
7712 esac
7713
7714 rp="What command should be used to create dynamic libraries?"
7715 . ./myread
7716 ld="$ans"
7717
7718 cat << EOM
7719
7720Some systems may require passing special flags to $ld to create a
7721library that can be dynamically loaded. If your ld flags include
7722-L/other/path options to locate libraries outside your loader's normal
7723search path, you may need to specify those -L options here as well. To
7724use no flags, say "none".
7725
7726EOM
7727 case "$lddlflags" in
7728 '') case "$osname" in
7729 beos) dflt='-nostart' ;;
7730 hpux) dflt='-b';
7731 case "$gccversion" in
7732 '') dflt="$dflt +vnocompatwarnings" ;;
7733 esac
7734 ;;
fb2e1bc0 7735 linux|irix*|gnu*) dflt='-shared' ;;
b4eb6b3d
JH
7736 next) dflt='none' ;;
7737 solaris) dflt='-G' ;;
7738 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7739 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7740 *) dflt='none' ;;
7741 esac
7742 ;;
7743 *) dflt="$lddlflags" ;;
7744 esac
7745
7746 : Try to guess additional flags to pick up local libraries.
7747 : Be careful not to append to a plain 'none'
7748 case "$dflt" in
7749 none) dflt='' ;;
7750 esac
7751 for thisflag in $ldflags; do
7752 case "$thisflag" in
b5b9f165 7753 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7754 case " $dflt " in
7755 *" $thisflag "*) ;;
7756 *) dflt="$dflt $thisflag" ;;
7757 esac
7758 ;;
7759 esac
7760 done
7761
7762 case "$dflt" in
7763 ''|' ') dflt='none' ;;
7764 esac
7765
7766 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7767 . ./myread
7768 case "$ans" in
7769 none) lddlflags=' ' ;;
7770 *) lddlflags="$ans" ;;
7771 esac
7772
7773 cat <<EOM
7774
7775Some systems may require passing special flags to $cc to indicate that
7776the resulting executable will use dynamic linking. To use no flags,
7777say "none".
7778
7779EOM
7780 case "$ccdlflags" in
7781 '') case "$osname" in
fb2e1bc0 7782 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7783 next|sunos) dflt='none' ;;
7784 *) dflt='none' ;;
b4eb6b3d
JH
7785 esac ;;
7786 ' ') dflt='none' ;;
7787 *) dflt="$ccdlflags" ;;
7788 esac
7789 rp="Any special flags to pass to $cc to use dynamic linking?"
7790 . ./myread
7791 case "$ans" in
7792 none) ccdlflags=' ' ;;
7793 *) ccdlflags="$ans" ;;
7794 esac
7795 ;;
7796*) usedl="$undef"
7797 ld='ld'
7798 dlsrc='dl_none.xs'
7799 lddlflags=''
7800 ccdlflags=''
7801 ;;
7802esac
7803
7804also=''
7805case "$usedl" in
7806$undef)
7807 # No dynamic loading being used, so don't bother even to prompt.
7808 useshrplib='false'
7809 ;;
7810*) case "$useshrplib" in
7811 '') case "$osname" in
48bcfe03 7812 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7813 dflt=y
7814 also='Building a shared libperl is required for dynamic loading to work on your system.'
7815 ;;
7816 next*)
7817 case "$osvers" in
7818 4*) dflt=y
7819 also='Building a shared libperl is needed for MAB support.'
7820 ;;
7821 *) dflt=n
7822 ;;
7823 esac
7824 ;;
7825 *) dflt=n
7826 ;;
7827 esac
7828 ;;
7829 $define|true|[Yy]*)
7830 dflt=y
7831 ;;
7832 *) dflt=n
7833 ;;
7834 esac
7835 $cat << EOM
7836
7837The perl executable is normally obtained by linking perlmain.c with
7838libperl${_a}, any static extensions (usually just DynaLoader), and
7839any other libraries needed on this system (such as -lm, etc.). Since
7840your system supports dynamic loading, it is probably possible to build
7841a shared libperl.$so. If you will have more than one executable linked
7842to libperl.$so, this will significantly reduce the size of each
5cadb3f3 7843executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
7844default is probably sensible for your system.
7845$also
7846
7847EOM
7848 rp="Build a shared libperl.$so (y/n)"
7849 . ./myread
7850 case "$ans" in
7851 true|$define|[Yy]*)
7852 useshrplib='true' ;;
7853 *) useshrplib='false' ;;
7854 esac
7855 ;;
7856esac
7857
7858case "$useshrplib" in
7859true)
7860 case "$libperl" in
7861 '')
7862 # Figure out a good name for libperl.so. Since it gets stored in
7863 # a version-specific architecture-dependent library, the version
7864 # number isn't really that important, except for making cc/ld happy.
7865 #
7866 # A name such as libperl.so.3.1
7867 majmin="libperl.$so.$patchlevel.$subversion"
7868 # A name such as libperl.so.301
7869 majonly=`echo $patchlevel $subversion |
7870 $awk '{printf "%d%02d", $1, $2}'`
7871 majonly=libperl.$so.$majonly
7872 # I'd prefer to keep the os-specific stuff here to a minimum, and
7873 # rely on figuring it out from the naming of libc.
7874 case "${osname}${osvers}" in
7875 next4*)
7876 dflt=libperl.5.$so
7877 # XXX How handle the --version stuff for MAB?
7878 ;;
fb2e1bc0 7879 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
7880 dflt=libperl.$so
7881 ;;
b53432e4
GH
7882 cygwin*) # ld links against an importlib
7883 dflt=libperl$lib_ext
b4eb6b3d
JH
7884 ;;
7885 *) # Try to guess based on whether libc has major.minor.
7886 case "$libc" in
7887 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7888 *libc.$so.[0-9]*) dflt=$majonly ;;
7889 *) dflt=libperl.$so ;;
7890 esac
7891 ;;
7892 esac
7893 ;;
7894 *) dflt=$libperl
7895 ;;
7896 esac
7897 cat << EOM
7898
7899I need to select a good name for the shared libperl. If your system uses
7900library names with major and minor numbers, then you might want something
7901like $majmin. Alternatively, if your system uses a single version
7902number for shared libraries, then you might want to use $majonly.
7903Or, your system might be quite happy with a simple libperl.$so.
7904
7905Since the shared libperl will get installed into a version-specific
7906architecture-dependent directory, the version number of the shared perl
7907library probably isn't important, so the default should be o.k.
7908
7909EOM
7910 rp='What name do you want to give to the shared libperl?'
7911 . ./myread
7912 libperl=$ans
7913 echo "Ok, I'll use $libperl"
7914 ;;
7915*)
7916 libperl="libperl${_a}"
7917 ;;
7918esac
7919
7920# Detect old use of shrpdir via undocumented Configure -Dshrpdir
7921case "$shrpdir" in
7922'') ;;
7923*) $cat >&4 <<EOM
7924WARNING: Use of the shrpdir variable for the installation location of
7925the shared $libperl is not supported. It was never documented and
7926will not work in this version. Let me (perlbug@perl.org)
7927know of any problems this may cause.
7928
7929EOM
7930 case "$shrpdir" in
7931 "$archlibexp/CORE")
7932 $cat >&4 <<EOM
7933But your current setting of $shrpdir is
7934the default anyway, so it's harmless.
7935EOM
7936 ;;
7937 *)
7938 $cat >&4 <<EOM
7939Further, your current attempted setting of $shrpdir
7940conflicts with the value of $archlibexp/CORE
7941that installperl will use.
7942EOM
7943 ;;
7944 esac
7945 ;;
7946esac
7947
7948# How will the perl executable find the installed shared $libperl?
7949# Add $xxx to ccdlflags.
7950# If we can't figure out a command-line option, use $shrpenv to
7951# set env LD_RUN_PATH. The main perl makefile uses this.
7952shrpdir=$archlibexp/CORE
7953xxx=''
7954tmp_shrpenv=''
7955if "$useshrplib"; then
7956 case "$osname" in
7957 aix)
7958 # We'll set it in Makefile.SH...
7959 ;;
b5b9f165 7960 solaris)
b4eb6b3d
JH
7961 xxx="-R $shrpdir"
7962 ;;
a774dfe6 7963 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
7964 xxx="-Wl,-R$shrpdir"
7965 ;;
fb2e1bc0 7966 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
7967 xxx="-Wl,-rpath,$shrpdir"
7968 ;;
7969 next)
7970 # next doesn't like the default...
7971 ;;
7972 beos)
7973 # beos doesn't like the default, either.
7974 ;;
7975 hpux*)
7976 # hpux doesn't like the default, either.
7977 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7978 ;;
7979 *)
7980 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7981 ;;
7982 esac
7983 case "$xxx" in
7984 '') ;;
7985 *)
7986 # Only add $xxx if it isn't already in ccdlflags.
7987 case " $ccdlflags " in
7988 *" $xxx "*) ;;
7989 *) ccdlflags="$ccdlflags $xxx"
7990 cat <<EOM >&4
7991
7992Adding $xxx to the flags
7993passed to $ld so that the perl executable will find the
7994installed shared $libperl.
7995
7996EOM
7997 ;;
7998 esac
7999 ;;
8000 esac
8001fi
8002# Fix ccdlflags in AIX for building external extensions.
8003# (For building Perl itself bare -bE:perl.exp is needed,
8004# Makefile.SH takes care of this.)
8005case "$osname" in
8006aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8007esac
8008# Respect a hint or command-line value.
8009case "$shrpenv" in
8010'') shrpenv="$tmp_shrpenv" ;;
8011esac
8012case "$ldlibpthname" in
8013'') ldlibpthname=LD_LIBRARY_PATH ;;
8014none) ldlibpthname='' ;;
8015esac
8016
8017: determine where manual pages are on this system
8018echo " "
8019case "$sysman" in
8020'')
4a0a3829
SD
8021 syspath='/usr/share/man/man1 /usr/man/man1'
8022 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8023 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8024 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8025 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8026 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8027 sysman=`./loc . /usr/man/man1 $syspath`
8028 ;;
8029esac
8030if $test -d "$sysman"; then
8031 echo "System manual is in $sysman." >&4
8032else
8033 echo "Could not find manual pages in source form." >&4
8034fi
8035
8036: determine where manual pages go
8037set man1dir man1dir none
8038eval $prefixit
8039$cat <<EOM
8040
8041$spackage has manual pages available in source form.
8042EOM
8043case "$nroff" in
8044nroff)
8045 echo "However, you don't have nroff, so they're probably useless to you."
8046 case "$man1dir" in
8047 '') man1dir="none";;
8048 esac;;
8049esac
8050echo "If you don't want the manual sources installed, answer 'none'."
8051case "$man1dir" in
8052' ') dflt=none
8053 ;;
8054'')
4a0a3829
SD
8055 lookpath="$prefixexp/share/man/man1"
8056 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8057 lookpath="$lookpath $prefixexp/man/p_man/man1"
8058 lookpath="$lookpath $prefixexp/man/u_man/man1"
8059 lookpath="$lookpath $prefixexp/man/man.1"
8060 case "$sysman" in
8061 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8062 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8063 esac
8064 set dflt
8065 eval $prefixup
8066 ;;
8067*) dflt="$man1dir"
8068 ;;
8069esac
8070echo " "
8071fn=dn+~
8072rp="Where do the main $spackage manual pages (source) go?"
8073. ./getfile
8074if $test "X$man1direxp" != "X$ansexp"; then
8075 installman1dir=''
8076fi
79522dd2
NC
8077prefixvar=man1dir
8078. ./setprefixvar
8079
477140ee
NC
8080case "$man1dir" in
8081'') man1dir=' '
8082 installman1dir='';;
8083esac
b4eb6b3d
JH
8084
8085: What suffix to use on installed man pages
8086
8087case "$man1dir" in
8088' ')
8089 man1ext='0'
8090 ;;
8091*)
8092 rp="What suffix should be used for the main $spackage man pages?"
8093 case "$man1ext" in
8094 '') case "$man1dir" in
8095 *1) dflt=1 ;;
8096 *1p) dflt=1p ;;
8097 *1pm) dflt=1pm ;;
8098 *l) dflt=l;;
8099 *n) dflt=n;;
8100 *o) dflt=o;;
8101 *p) dflt=p;;
8102 *C) dflt=C;;
8103 *L) dflt=L;;
8104 *L1) dflt=L1;;
8105 *) dflt=1;;
8106 esac
8107 ;;
8108 *) dflt="$man1ext";;
8109 esac
8110 . ./myread
8111 man1ext="$ans"
8112 ;;
8113esac
8114
8115: see if we can have long filenames
8116echo " "
8117first=123456789abcdef
8118$rm -f $first
8119if (echo hi >$first) 2>/dev/null; then
8120 if $test -f 123456789abcde; then
8121 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8122 val="$undef"
8123 else
8124 echo 'You can have filenames longer than 14 characters.'>&4
8125 val="$define"
8126 fi
8127else
8128 $cat <<'EOM'
8129You can't have filenames longer than 14 chars.
8130You can't even think about them!
8131EOM
8132 val="$undef"
8133fi
8134set d_flexfnam
8135eval $setvar
8136$rm -rf 123456789abcde*
8137
8138: determine where library module manual pages go
8139set man3dir man3dir none
8140eval $prefixit
8141$cat <<EOM
8142
8143$spackage has manual pages for many of the library modules.
8144EOM
8145
8146case "$nroff" in
8147nroff)
8148 $cat <<'EOM'
8149However, you don't have nroff, so they're probably useless to you.
8150EOM
8151 case "$man3dir" in
8152 '') man3dir="none";;
8153 esac;;
8154esac
8155
8156case "$d_flexfnam" in
8157undef)
8158 $cat <<'EOM'
f3f1a2d8 8159However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8160EOM
8161 case "$man3dir" in
8162 '') man3dir="none";;
8163 esac;;
8164esac
8165
8166echo "If you don't want the manual sources installed, answer 'none'."
8167prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8168case "$man3dir" in
8169'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8170 if $test -d "$privlib/man/man3"; then
8171 cat <<EOM >&4
8172
8173WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8174$privlib/man/man3. This version will suggest a
8175new default of $dflt.
b4eb6b3d
JH
8176EOM
8177 tdflt=$dflt
8178 dflt='n'
8179 rp='Do you wish to preserve the old behavior?(y/n)'
8180 . ./myread
8181 case "$ans" in
8182 y*) dflt="$privlib/man/man3" ;;
8183 *) dflt=$tdflt ;;
8184 esac
8185 fi
8186 ;;
8187*) dflt="$man3dir" ;;
8188esac
8189case "$dflt" in
8190' ') dflt=none ;;
8191esac
8192echo " "
8193fn=dn+~
8194rp="Where do the $package library man pages (source) go?"
8195. ./getfile
79522dd2
NC
8196prefixvar=man3dir
8197. ./setprefixvar
8198
477140ee
NC
8199case "$man3dir" in
8200'') man3dir=' '
8201 installman3dir='';;
8202esac
b4eb6b3d
JH
8203
8204: What suffix to use on installed man pages
8205case "$man3dir" in
8206' ')
8207 man3ext='0'
8208 ;;
8209*)
8210 rp="What suffix should be used for the $package library man pages?"
8211 case "$man3ext" in
8212 '') case "$man3dir" in
8213 *3) dflt=3 ;;
8214 *3p) dflt=3p ;;
8215 *3pm) dflt=3pm ;;
8216 *l) dflt=l;;
8217 *n) dflt=n;;
8218 *o) dflt=o;;
8219 *p) dflt=p;;
8220 *C) dflt=C;;
8221 *L) dflt=L;;
8222 *L3) dflt=L3;;
8223 *) dflt=3;;
8224 esac
8225 ;;
8226 *) dflt="$man3ext";;
8227 esac
8228 . ./myread
8229 man3ext="$ans"
8230 ;;
8231esac
8232
8233: see if we have to deal with yellow pages, now NIS.
0384a54a 8234if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8235 if $test -f /usr/etc/nibindd; then
8236 echo " "
8237 echo "I'm fairly confident you're on a NeXT."
8238 echo " "
8239 rp='Do you get the hosts file via NetInfo?'
8240 dflt=y
8241 case "$hostcat" in
8242 nidump*) ;;
8243 '') ;;
8244 *) dflt=n;;
8245 esac
8246 . ./myread
8247 case "$ans" in
8248 y*) hostcat='nidump hosts .';;
8249 *) case "$hostcat" in
8250 nidump*) hostcat='';;
8251 esac
8252 ;;
8253 esac
8254 fi
8255 case "$hostcat" in
8256 nidump*) ;;
8257 *)
8258 case "$hostcat" in
8259 *ypcat*) dflt=y;;
8260 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8261 dflt=y
8262 else
8263 dflt=n
8264 fi;;
8265 *) dflt=n;;
8266 esac
8267 echo " "
8268 rp='Are you getting the hosts file via yellow pages?'
8269 . ./myread
8270 case "$ans" in
8271 y*) hostcat='ypcat hosts';;
8272 *) hostcat='cat /etc/hosts';;
8273 esac
8274 ;;
8275 esac
8276fi
8277case "$hostcat" in
8278'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8279esac
8280case "$groupcat" in
8281'') test -f /etc/group && groupcat='cat /etc/group';;
8282esac
8283case "$passcat" in
8284'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8285esac
8286
8287: now get the host name
8288echo " "
8289echo "Figuring out host name..." >&4
8290case "$myhostname" in
8291'') cont=true
8292 echo 'Maybe "hostname" will work...'
73614538 8293 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8294 myhostname=$tans
8295 phostname=hostname
8296 cont=''
8297 fi
8298 ;;
8299*) cont='';;
8300esac
8301if $test "$cont"; then
8302 if ./xenix; then
8303 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8304 if tans=`cat /etc/systemid 2>&1` ; then
8305 myhostname=$tans
8306 phostname='cat /etc/systemid'
8307 echo "Whadyaknow. Xenix always was a bit strange..."
8308 cont=''
8309 fi
8310 elif $test -r /etc/systemid; then
8311 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8312 fi
8313fi
8314if $test "$cont"; then
8315 echo 'No, maybe "uuname -l" will work...'
73614538 8316 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8317 myhostname=$tans
8318 phostname='uuname -l'
8319 else
8320 echo 'Strange. Maybe "uname -n" will work...'
73614538 8321 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8322 myhostname=$tans
8323 phostname='uname -n'
8324 else
8325 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8326 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8327 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8328 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8329 else
8330 case "$myhostname" in
8331 '') echo "Does this machine have an identity crisis or something?"
8332 phostname='';;
8333 *)
8334 echo "Well, you said $myhostname before..."
8335 phostname='echo $myhostname';;
8336 esac
8337 fi
8338 fi
8339 fi
8340fi
52a549d0
JH
8341case "$myhostname" in
8342'') myhostname=noname ;;
8343esac
b4eb6b3d
JH
8344: you do not want to know about this
8345set $myhostname
8346myhostname=$1
8347
8348: verify guess
8349if $test "$myhostname" ; then
8350 dflt=y
8351 rp='Your host name appears to be "'$myhostname'".'" Right?"
8352 . ./myread
8353 case "$ans" in
8354 y*) ;;
8355 *) myhostname='';;
8356 esac
8357fi
8358
8359: bad guess or no guess
8360while $test "X$myhostname" = X ; do
8361 dflt=''
8362 rp="Please type the (one word) name of your host:"
8363 . ./myread
8364 myhostname="$ans"
8365done
8366
8367: translate upper to lower if necessary
8368case "$myhostname" in
8369*[A-Z]*)
8370 echo "(Normalizing case in your host name)"
8371 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8372 ;;
8373esac
8374
8375case "$myhostname" in
8376*.*)
8377 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8378 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8379 echo "(Trimming domain name from host name--host name is now $myhostname)"
8380 ;;
8381*) case "$mydomain" in
8382 '')
8383 {
8384 test "X$hostcat" = "Xypcat hosts" &&
8385 ypmatch "$myhostname" hosts 2>/dev/null |\
8386 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8387 $test -s hosts
8388 } || {
8389 test "X$hostcat" != "X" &&
8390 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8391 /[ ]$myhostname[ . ]/p" > hosts
8392 }
8393 tmp_re="[ . ]"
f08cbdd1
PP
8394 if $test -f hosts; then
8395 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8396 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8397 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8398 hosts | $sort | $uniq | \
8399 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8400 case `$echo X$dflt` in
8401 X*\ *) echo "(Several hosts in the database matched hostname)"
8402 dflt=.
8403 ;;
8404 X.) echo "(You do not have fully-qualified names in the hosts database)"
8405 ;;
8406 esac
8407 else
8408 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8409 dflt=.
f08cbdd1 8410 fi
b4eb6b3d
JH
8411 case "$dflt" in
8412 .)
8413 tans=`./loc resolv.conf X /etc /usr/etc`
8414 if $test -f "$tans"; then
8415 echo "(Attempting domain name extraction from $tans)"
8416 dflt=.`$sed -n -e 's/ / /g' \
8417 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8418 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8419 case "$dflt" in
8420 .) dflt=.`$sed -n -e 's/ / /g' \
8421 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8422 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8423 ;;
8424 esac
8425 fi
8426 ;;
8427 esac
8428 case "$dflt" in
8429 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8430 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8431 case "$dflt" in
8432 '') dflt='.';;
8433 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8434 esac
8435 ;;
8436 esac
59c9e5d6
PP
8437 case "$dflt$osname" in
8438 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8439 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8440 ;;
8441 esac
b4eb6b3d
JH
8442 case "$dflt" in
8443 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8444 dflt='.nonet'
b4eb6b3d
JH
8445 ;;
8446 esac
8447 $rm -f hosts
8448 ;;
8449 *) dflt="$mydomain";;
8450 esac;;
8451esac
8452echo " "
8453rp="What is your domain name?"
8454. ./myread
8455tans="$ans"
8456case "$ans" in
8457'') ;;
8458.*) ;;
8459*) tans=".$tans";;
8460esac
8461mydomain="$tans"
8462
8463: translate upper to lower if necessary
8464case "$mydomain" in
8465*[A-Z]*)
8466 echo "(Normalizing case in your domain name)"
8467 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8468 ;;
8469esac
8470
8471: a little sanity check here
8472case "$phostname" in
8473'') ;;
8474*)
8475 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8476 $myhostname$mydomain|$myhostname) ;;
8477 *)
8478 case "$phostname" in
8479 sed*)
8480 echo "(That doesn't agree with your whoami.h file, by the way.)"
8481 ;;
8482 *)
8483 echo "(That doesn't agree with your $phostname command, by the way.)"
8484 ;;
8485 esac
8486 ;;
8487 esac
8488 ;;
8489esac
8490
8491$cat <<EOM
8492
8493I need to get your e-mail address in Internet format if possible, i.e.
8494something like user@host.domain. Please answer accurately since I have
8495no easy means to double check it. The default value provided below
8496is most probably close to reality but may not be valid from outside
8497your organization...
8498
8499EOM
8500cont=x
8501while test "$cont"; do
8502 case "$cf_email" in
8503 '') dflt="$cf_by@$myhostname$mydomain";;
8504 *) dflt="$cf_email";;
8505 esac
8506 rp='What is your e-mail address?'
8507 . ./myread
8508 cf_email="$ans"
8509 case "$cf_email" in
8510 *@*.*) cont='' ;;
8511 *)
8512 rp='Address does not look like an Internet one. Use it anyway?'
8513 case "$fastread" in
8514 yes) dflt=y ;;
8515 *) dflt=n ;;
8516 esac
8517 . ./myread
8518 case "$ans" in
8519 y*) cont='' ;;
8520 *) echo " " ;;
8521 esac
8522 ;;
8523 esac
8524done
8525
8526$cat <<EOM
8527
8528If you or somebody else will be maintaining perl at your site, please
8529fill in the correct e-mail address here so that they may be contacted
8530if necessary. Currently, the "perlbug" program included with perl
8531will send mail to this address in addition to perlbug@perl.org. You may
8532enter "none" for no administrator.
8533
8534EOM
8535case "$perladmin" in
8536'') dflt="$cf_email";;
8537*) dflt="$perladmin";;
8538esac
8539rp='Perl administrator e-mail address'
8540. ./myread
8541perladmin="$ans"
8542
674912d7
RB
8543: determine whether to only install version-specific parts.
8544echo " "
8545$cat <<EOM
8546Do you want to install only the version-specific parts of the perl
8547distribution? Usually you do *not* want to do this.
8548EOM
8549case "$versiononly" in
8550"$define"|[Yy]*|true) dflt='y' ;;
8551*) dflt='n';
8552esac
8553rp="Do you want to install only the version-specific parts of perl?"
8554. ./myread
8555case "$ans" in
8556[yY]*) val="$define";;
8557*) val="$undef" ;;
8558esac
8559set versiononly
8560eval $setvar
8561
ad493445
MB
8562case "$versiononly" in
8563"$define") inc_version_list=''
8564 inc_version_list_init=0
8565 ;;
8566esac
8567
b4eb6b3d
JH
8568: figure out how to guarantee perl startup
8569case "$startperl" in
8570'')
8571 case "$sharpbang" in
8572 *!)
8573 $cat <<EOH
8574
8575I can use the #! construct to start perl on your system. This will
8576make startup of perl scripts faster, but may cause problems if you
8577want to share those scripts and perl is not in a standard place
8578($binexp/perl) on all your platforms. The alternative is to force
8579a shell by starting the script with a single ':' character.
8580
8581EOH
674912d7
RB
8582 case "$versiononly" in
8583 "$define") dflt="$binexp/perl$version";;
8584 *) dflt="$binexp/perl";;
8585 esac
b4eb6b3d
JH
8586 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8587 . ./myread
8588 case "$ans" in
8589 none) startperl=": # use perl";;
8590 *) startperl="#!$ans"
8591 if $test 30 -lt `echo "$ans" | wc -c`; then
8592 $cat >&4 <<EOM
8593
8594WARNING: Some systems limit the #! command to 32 characters.
8595If you experience difficulty running Perl scripts with #!, try
8596installing Perl in a directory with a shorter pathname.
8597
8598EOM
8599 fi ;;
8600 esac
8601 ;;
8602 *) startperl=": # use perl"
8603 ;;
8604 esac
8605 ;;
8606esac
8607echo "I'll use $startperl to start perl scripts."
8608
8609: figure best path for perl in scripts
8610case "$perlpath" in
8611'')
5e20a8ca
RGS
8612 case "$versiononly" in
8613 "$define") perlpath="$binexp/perl$version";;
8614 *) perlpath="$binexp/perl";;
8615 esac
b4eb6b3d
JH
8616 case "$startperl" in
8617 *!*) ;;
8618 *)
8619 $cat <<EOH
8620
8621I will use the "eval 'exec'" idiom to start Perl on your system.
8622I can use the full path of your Perl binary for this purpose, but
8623doing so may cause problems if you want to share those scripts and
8624Perl is not always in a standard place ($binexp/perl).
8625
8626EOH
8627 dflt="$binexp/perl"
8628 rp="What path shall I use in \"eval 'exec'\"?"
8629 . ./myread
8630 perlpath="$ans"
8631 ;;
8632 esac
8633 ;;
8634esac
8635case "$startperl" in
8636*!*) ;;
8637*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8638esac
8639
8640: determine where public executable scripts go
8641set scriptdir scriptdir
8642eval $prefixit
8643case "$scriptdir" in
8644'')
8645 dflt="$bin"
8646 : guess some guesses
8647 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8648 $test -d /usr/share/bin && dflt=/usr/share/bin
8649 $test -d /usr/local/script && dflt=/usr/local/script
8650 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8651 $test -d $prefixexp/script && dflt=$prefixexp/script
8652 set dflt
8653 eval $prefixup
8654 ;;
8655*) dflt="$scriptdir"
8656 ;;
8657esac
8658$cat <<EOM
f3f1a2d8 8659
b4eb6b3d
JH
8660Some installations have a separate directory just for executable scripts so
8661that they can mount it across multiple architectures but keep the scripts in
8662one spot. You might, for example, have a subdirectory of /usr/share for this.
8663Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8664
b4eb6b3d
JH
8665EOM
8666fn=d~
8667rp='Where do you keep publicly executable scripts?'
8668. ./getfile
8669if $test "X$ansexp" != "X$scriptdirexp"; then
8670 installscript=''
8671fi
f3f1a2d8 8672installscriptdir=''
79522dd2
NC
8673prefixvar=scriptdir
8674. ./setprefixvar
8675: A little fix up for an irregularly named variable.
8676installscript="$installscriptdir"
8677
b4eb6b3d
JH
8678: determine where add-on public executables go
8679case "$sitebin" in
8680'') dflt=$siteprefix/bin ;;
8681*) dflt=$sitebin ;;
8682esac
8683fn=d~
8684rp='Pathname where the add-on public executables should be installed?'
8685. ./getfile
79522dd2
NC
8686prefixvar=sitebin
8687. ./setprefixvar
b4eb6b3d 8688
6e1038e0 8689: determine where add-on html pages go
8d2cbf27 8690: There is no standard location, so try to copy the previously-selected
6e1038e0 8691: directory structure for the core html pages.
8d2cbf27
JH
8692case "$sitehtml1dir" in
8693'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8694*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8695esac
8696case "$dflt" in
8697''|' ') dflt=none ;;
8698esac
8699fn=dn+~
8700rp='Pathname where the site-specific html pages should be installed?'
8701. ./getfile
79522dd2
NC
8702prefixvar=sitehtml1dir
8703. ./setprefixvar
6e1038e0
MB
8704
8705: determine where add-on library html pages go
8706: There is no standard location, so try to copy the previously-selected
8707: directory structure for the core html pages.
8d2cbf27
JH
8708case "$sitehtml3dir" in
8709'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8710*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8711esac
8712case "$dflt" in
8713''|' ') dflt=none ;;
8714esac
8715fn=dn+~
8716rp='Pathname where the site-specific library html pages should be installed?'
8717. ./getfile
79522dd2
NC
8718prefixvar=sitehtml3dir
8719. ./setprefixvar
6e1038e0
MB
8720
8721: determine where add-on manual pages go
91e123a8
JH
8722case "$siteman1dir" in
8723'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8724*) dflt=$siteman1dir ;;
6e1038e0 8725esac
257059b5
JH
8726case "$dflt" in
8727''|' ') dflt=none ;;
8728esac
6e1038e0
MB
8729fn=dn+~
8730rp='Pathname where the site-specific manual pages should be installed?'
8731. ./getfile
79522dd2
NC
8732prefixvar=siteman1dir
8733. ./setprefixvar
6e1038e0
MB
8734
8735: determine where add-on library man pages go
91e123a8
JH
8736case "$siteman3dir" in
8737'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8738*) dflt=$siteman3dir ;;
6e1038e0 8739esac
257059b5
JH
8740case "$dflt" in
8741''|' ') dflt=none ;;
8742esac
6e1038e0
MB
8743fn=dn+~
8744rp='Pathname where the site-specific library manual pages should be installed?'
8745. ./getfile
79522dd2
NC
8746prefixvar=siteman3dir
8747. ./setprefixvar
6e1038e0
MB
8748
8749: determine where add-on public executable scripts go
8750case "$sitescript" in
8751'') dflt=$siteprefix/script
8752 $test -d $dflt || dflt=$sitebin ;;
8753*) dflt="$sitescript" ;;
8754esac
8755fn=d~+
8756rp='Pathname where add-on public executable scripts should be installed?'
8757. ./getfile
79522dd2
NC
8758prefixvar=sitescript
8759. ./setprefixvar
6e1038e0 8760
15b61c98
JH
8761case "$usefaststdio" in
8762$define|true|[yY]*|'')
8763 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8764 case "$xversion" in
8765 [68]) dflt='y' ;;
8766 *) dflt='n' ;;
8767 esac
8768 ;;
8769*) dflt='n';;
8770esac
8771cat <<EOM
8772
8773Perl can be built to use 'fast stdio', which means using the stdio
8774library but also directly manipulating the stdio buffers to enable
8775faster I/O. Using stdio is better for backward compatibility (especially
8776for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8777interface has been preferred instead of stdio.
8778
8779If this doesn't make any sense to you, just accept the default '$dflt'.
8780EOM
8781rp='Use the "fast stdio" if available?'
8782. ./myread
8783case "$ans" in
8784y|Y) val="$define" ;;
8785*) val="$undef" ;;
8786esac
8787set usefaststdio
8788eval $setvar
8789
8790
96056487
JH
8791: define an is-a-typedef? function
8792typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8793case "$inclist" in
8794"") inclist="sys/types.h";;
8795esac;
8796eval "varval=\$$var";
8797case "$varval" in
8798"")
8799 $rm -f temp.c;
8800 for inc in $inclist; do
8801 echo "#include <$inc>" >>temp.c;
8802 done;
8803 echo "#ifdef $type" >> temp.c;
8804 echo "printf(\"We have $type\");" >> temp.c;
8805 echo "#endif" >> temp.c;
8806 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8807 if $contains $type temp.E >/dev/null 2>&1; then
8808 eval "$var=\$type";
8809 else
8810 eval "$var=\$def";
8811 fi;
8812 $rm -f temp.?;;
8813*) eval "$var=\$varval";;
8814esac'
8815
8816: define an is-a-typedef? function that prompts if the type is not available.
8817typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8818case "$inclist" in
8819"") inclist="sys/types.h";;
8820esac;
8821eval "varval=\$$var";
8822case "$varval" in
8823"")
8824 $rm -f temp.c;
8825 for inc in $inclist; do
8826 echo "#include <$inc>" >>temp.c;
8827 done;
8828 echo "#ifdef $type" >> temp.c;
8829 echo "printf(\"We have $type\");" >> temp.c;
8830 echo "#endif" >> temp.c;
8831 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8832 echo " " ;
8833 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8834 if $contains $type temp.E >/dev/null 2>&1; then
8835 echo "$type found." >&4;
8836 eval "$var=\$type";
8837 else
8838 echo "$type NOT found." >&4;
8839 dflt="$def";
8840 . ./myread ;
8841 eval "$var=\$ans";
8842 fi;
8843 $rm -f temp.?;;
8844*) eval "$var=\$varval";;
8845esac'
8846
8847: see what type lseek is declared as in the kernel
8848rp="What is the type used for lseek's offset on this system?"
8849set off_t lseektype long stdio.h sys/types.h
8850eval $typedef_ask
8851
8852echo " "
8853echo "Checking to see how big your file offsets are..." >&4
8854$cat >try.c <<EOCP
8855#include <sys/types.h>
8856#include <stdio.h>
8857int main()
8858{
8859 printf("%d\n", (int)sizeof($lseektype));
8860 return(0);
8861}
8862EOCP
8863set try
8864if eval $compile_ok; then
8865 lseeksize=`$run ./try`
8866 echo "Your file offsets are $lseeksize bytes long."
8867else
8868 dflt=$longsize
8869 echo " "
8870 echo "(I can't seem to compile the test program. Guessing...)"
8871 rp="What is the size of your file offsets (in bytes)?"
8872 . ./myread
8873 lseeksize="$ans"
8874fi
8875$rm -f try.c try
8876
8877: see what type file positions are declared as in the library
8878rp="What is the type for file position used by fsetpos()?"
8879set fpos_t fpostype long stdio.h sys/types.h
8880eval $typedef_ask
8881
8882echo " "
8883case "$fpostype" in
8884*_t) zzz="$fpostype" ;;
8885*) zzz="fpos_t" ;;
8886esac
8887echo "Checking the size of $zzz..." >&4
8888cat > try.c <<EOCP
8889#include <sys/types.h>
8890#include <stdio.h>
d1daaddf
JH
8891#$i_stdlib I_STDLIB
8892#ifdef I_STDLIB
8893#include <stdlib.h>
8894#endif
96056487
JH
8895int main() {
8896 printf("%d\n", (int)sizeof($fpostype));
8897 exit(0);
8898}
8899EOCP
8900set try
8901if eval $compile_ok; then
8902 yyy=`$run ./try`
8903 case "$yyy" in
8904 '') fpossize=4
8905 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8906 ;;
8907 *) fpossize=$yyy
8908 echo "Your $zzz is $fpossize bytes long."
8909 ;;
8910 esac
8911else
8912 dflt="$longsize"
8913 echo " " >&4
8914 echo "(I can't compile the test program. Guessing...)" >&4
8915 rp="What is the size of your file positions (in bytes)?"
8916 . ./myread
8917 fpossize="$ans"
8918fi
8919
96056487
JH
8920# Backward compatibility (uselfs is deprecated).
8921case "$uselfs" in
8922"$define"|true|[yY]*)
8923 cat <<EOM >&4
8924
8925*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8926EOM
8927 uselargefiles="$define"
8928 ;;
8929esac
8930
8931case "$lseeksize:$fpossize" in
89328:8) cat <<EOM
8933
8934You can have files larger than 2 gigabytes.
8935EOM
8936 val="$define" ;;
8937*) case "$uselargefiles" in
8938 "$undef"|false|[nN]*) dflt='n' ;;
8939 *) dflt='y' ;;
8940 esac
8941 cat <<EOM
8942
8943Perl can be built to understand large files (files larger than 2 gigabytes)
8944on some systems. To do so, Configure can be run with -Duselargefiles.
8945
8946If this doesn't make any sense to you, just accept the default '$dflt'.
8947EOM
8948 rp='Try to understand large files, if available?'
8949 . ./myread
8950 case "$ans" in
8951 y|Y) val="$define" ;;
8952 *) val="$undef" ;;
8953 esac
8954 ;;
8955esac
8956set uselargefiles
8957eval $setvar
96056487
JH
8958: Look for a hint-file generated 'call-back-unit'. If the
8959: user has specified that a large files perl is to be built,
8960: we may need to set or change some other defaults.
9da7673b
MB
8961if $test -f uselargefiles.cbu; then
8962 echo "Your platform has some specific hints regarding large file builds, using them..."
8963 . ./uselargefiles.cbu
8964fi
8965case "$uselargefiles" in
8966"$define")
96056487 8967 if $test -f uselargefiles.cbu; then
96056487
JH
8968 echo " "
8969 echo "Rechecking to see how big your file offsets are..." >&4
8970 $cat >try.c <<EOCP
8971#include <sys/types.h>
8972#include <stdio.h>
8973int main()
8974{
8975 printf("%d\n", (int)sizeof($lseektype));
8976 return(0);
8977}
8978EOCP
8979 set try
8980 if eval $compile_ok; then
8981 lseeksize=`$run ./try`
8982 $echo "Your file offsets are now $lseeksize bytes long."
8983 else
8984 dflt="$lseeksize"
8985 echo " "
8986 echo "(I can't seem to compile the test program. Guessing...)"
8987 rp="What is the size of your file offsets (in bytes)?"
8988 . ./myread
8989 lseeksize="$ans"
8990 fi
8991 case "$fpostype" in
8992 *_t) zzz="$fpostype" ;;
8993 *) zzz="fpos_t" ;;
8994 esac
8995 $echo $n "Rechecking the size of $zzz...$c" >&4
8996 $cat > try.c <<EOCP
8997#include <sys/types.h>
8998#include <stdio.h>
55954f19
JH
8999#$i_stdlib I_STDLIB
9000#ifdef I_STDLIB
9001#include <stdlib.h>
9002#endif
96056487
JH
9003int main() {
9004 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9005 return(0);
96056487
JH
9006}
9007EOCP
9008 set try
9009 if eval $compile_ok; then
9010 yyy=`$run ./try`
9011 dflt="$lseeksize"
9012 case "$yyy" in
9013 '') echo " "
9014 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9015 ;;
9016 *) fpossize=$yyy
9017 echo " $fpossize bytes." >&4
9018 ;;
9019 esac
9020 else
9021 dflt="$fpossize"
9022 echo " "
9023 echo "(I can't compile the test program. Guessing...)" >&4
9024 rp="What is the size of your file positions (in bytes)?"
9025 . ./myread
9026 fpossize="$ans"
9027 fi
9028 $rm -f try.c try
9029 fi
9030 ;;
9031esac
9032
b4eb6b3d
JH
9033case "$vendorprefix" in
9034'') d_vendorbin="$undef"
9035 vendorbin=''
9036 vendorbinexp=''
9037 ;;
9038*) d_vendorbin="$define"
9039 : determine where vendor-supplied executables go.
9040 case "$vendorbin" in
9041 '') dflt=$vendorprefix/bin ;;
9042 *) dflt="$vendorbin" ;;
9043 esac
9044 fn=d~+
9045 rp='Pathname for the vendor-supplied executables directory?'
9046 . ./getfile
9047 vendorbin="$ans"
9048 vendorbinexp="$ansexp"
9049 ;;
9050esac
a092d240
NC
9051prefixvar=vendorbin
9052. ./installprefix
b4eb6b3d 9053
6e1038e0 9054case "$vendorprefix" in
8d2cbf27
JH
9055'') vendorhtml1dir=''
9056 vendorhtml1direxp=''
6e1038e0
MB
9057 ;;
9058*) : determine where vendor-supplied html pages go.
9059 : There is no standard location, so try to copy the previously-selected
9060 : directory structure for the core html pages.
9061 : XXX Better default suggestions would be welcome.
8d2cbf27 9062 case "$vendorhtml1dir" in
6e1038e0 9063 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9064 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9065 esac
9066 case "$dflt" in
9067 ''|' ') dflt=none ;;
9068 esac
9069 fn=dn+~
9070 rp='Pathname for the vendor-supplied html pages?'
9071 . ./getfile
8d2cbf27
JH
9072 vendorhtml1dir="$ans"
9073 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9074 ;;
9075esac
9076: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9077$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9078prefixvar=vendorhtml1dir
9079. ./installprefix
6e1038e0
MB
9080
9081case "$vendorprefix" in
8d2cbf27
JH
9082'') vendorhtml3dir=''
9083 vendorhtml3direxp=''
6e1038e0
MB
9084 ;;
9085*) : determine where vendor-supplied module html pages go.
9086 : There is no standard location, so try to copy the previously-selected
9087 : directory structure for the core html pages.
9088 : XXX Better default suggestions would be welcome.
8d2cbf27 9089 case "$vendorhtml3dir" in
6e1038e0 9090 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9091 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9092 esac
9093 case "$dflt" in
9094 ''|' ') dflt=none ;;
9095 esac
9096 fn=dn+~
9097 rp='Pathname for the vendor-supplied html pages?'
9098 . ./getfile
8d2cbf27
JH
9099 vendorhtml3dir="$ans"
9100 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9101 ;;
9102esac
9103: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9104$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9105prefixvar=vendorhtml3dir
9106. ./installprefix
6e1038e0
MB
9107
9108case "$vendorprefix" in
91e123a8
JH
9109'') vendorman1dir=''
9110 vendorman1direxp=''
6e1038e0
MB
9111 ;;
9112*) : determine where vendor-supplied manual pages go.
91e123a8 9113 case "$vendorman1dir" in
6e1038e0 9114 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9115 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9116 esac
9117 case "$dflt" in
9118 ''|' ') dflt=none ;;
9119 esac
9120 fn=nd~+
9121 rp='Pathname for the vendor-supplied manual section 1 pages?'
9122 . ./getfile
91e123a8
JH
9123 vendorman1dir="$ans"
9124 vendorman1direxp="$ansexp"
6e1038e0
MB
9125 ;;
9126esac
9127: Use ' ' for none so value is preserved next time through Configure
91e123a8 9128$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9129prefixvar=vendorman1dir
9130. ./installprefix
6e1038e0
MB
9131
9132case "$vendorprefix" in
91e123a8
JH
9133'') vendorman3dir=''
9134 vendorman3direxp=''
6e1038e0
MB
9135 ;;
9136*) : determine where vendor-supplied module manual pages go.
91e123a8 9137 case "$vendorman3dir" in
6e1038e0 9138 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9139 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9140 esac
9141 case "$dflt" in
9142 ''|' ') dflt=none ;;
9143 esac
9144 fn=nd~+
9145 rp='Pathname for the vendor-supplied manual section 3 pages?'
9146 . ./getfile
91e123a8
JH
9147 vendorman3dir="$ans"
9148 vendorman3direxp="$ansexp"
6e1038e0
MB
9149 ;;
9150esac
9151: Use ' ' for none so value is preserved next time through Configure
91e123a8 9152$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9153prefixvar=vendorman3dir
9154. ./installprefix
6e1038e0
MB
9155
9156case "$vendorprefix" in
9157'') d_vendorscript="$undef"
9158 vendorscript=''
9159 vendorscriptexp=''
9160 ;;
9161*) d_vendorscript="$define"
9162 : determine where vendor-supplied scripts go.
9163 case "$vendorscript" in
9164 '') dflt=$vendorprefix/script
9165 $test -d $dflt || dflt=$vendorbin ;;
9166 *) dflt="$vendorscript" ;;
9167 esac
9168 $cat <<EOM
9169
f3f1a2d8 9170The installation process will create a directory for
6e1038e0
MB
9171vendor-supplied scripts.
9172
9173EOM
9174 fn=d~+
9175 rp='Pathname for the vendor-supplied scripts directory?'
9176 . ./getfile
9177 vendorscript="$ans"
9178 vendorscriptexp="$ansexp"
9179 ;;
9180esac
a092d240
NC
9181prefixvar=vendorscript
9182. ./installprefix
6e1038e0 9183
b4eb6b3d
JH
9184: see if qgcvt exists
9185set qgcvt d_qgcvt
9186eval $inlibc
9187
89ce900e
JH
9188echo " "
9189
9190if $test X"$d_longdbl" = X"$define"; then
9191
9192echo "Checking how to print long doubles..." >&4
9193
9194if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9195 $cat >try.c <<'EOCP'
9196#include <sys/types.h>
9197#include <stdio.h>
9198int main() {
9199 double d = 123.456;
9200 printf("%.3f\n", d);
9201}
9202EOCP
9203 set try
9204 if eval $compile; then
9205 yyy=`$run ./try`
9206 case "$yyy" in
9207 123.456)
9208 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9209 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9210 echo "We will use %f."
9211 ;;
9212 esac
9213 fi
9214fi
9215
9216if $test X"$sPRIfldbl" = X; then
9217 $cat >try.c <<'EOCP'
9218#include <sys/types.h>
9219#include <stdio.h>
9220int main() {
9221 long double d = 123.456;
9222 printf("%.3Lf\n", d);
9223}
9224EOCP
9225 set try
9226 if eval $compile; then
9227 yyy=`$run ./try`
9228 case "$yyy" in
9229 123.456)
9230 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9231 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9232 echo "We will use %Lf."
9233 ;;
9234 esac
9235 fi
9236fi
9237
9238if $test X"$sPRIfldbl" = X; then
9239 $cat >try.c <<'EOCP'
9240#include <sys/types.h>
9241#include <stdio.h>
9242int main() {
9243 long double d = 123.456;
9244 printf("%.3llf\n", d);
9245}
9246EOCP
9247 set try
9248 if eval $compile; then
9249 yyy=`$run ./try`
9250 case "$yyy" in
9251 123.456)
9252 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9253 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9254 echo "We will use %llf."
9255 ;;
9256 esac
9257 fi
9258fi
9259
9260if $test X"$sPRIfldbl" = X; then
9261 $cat >try.c <<'EOCP'
9262#include <sys/types.h>
9263#include <stdio.h>
9264int main() {
9265 long double d = 123.456;
9266 printf("%.3lf\n", d);
9267}
9268EOCP
9269 set try
9270 if eval $compile; then
9271 yyy=`$run ./try`
9272 case "$yyy" in
9273 123.456)
9274 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9275 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9276 echo "We will use %lf."
9277 ;;
9278 esac
9279 fi
9280fi
9281
9282if $test X"$sPRIfldbl" = X; then
9283 echo "Cannot figure out how to print long doubles." >&4
9284else
9285 sSCNfldbl=$sPRIfldbl # expect consistency
9286fi
9287
9288$rm -f try try.*
9289
9290fi # d_longdbl
9291
9292case "$sPRIfldbl" in
9293'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9294 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9295 d_SCNfldbl="$undef";
9296 ;;
9297*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9298 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9299 d_SCNfldbl="$define";
9300 ;;
9301esac
9302
b4eb6b3d 9303: Check how to convert floats to strings.
a5b10d80
YST
9304
9305if test "X$d_Gconvert" = X; then
9306
b4eb6b3d
JH
9307echo " "
9308echo "Checking for an efficient way to convert floats to strings."
9309echo " " > try.c
9310case "$uselongdouble" in
9311"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9312esac
9313case "$d_longdbl" in
9314"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9315esac
9316case "$d_PRIgldbl" in
9317"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9318esac
9319$cat >>try.c <<EOP
9320#ifdef TRY_gconvert
9321#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9322char *myname = "gconvert";
9323#endif
9324#ifdef TRY_gcvt
9325#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9326char *myname = "gcvt";
9327#endif
9328#ifdef TRY_qgcvt
9329#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9330char *myname = "qgcvt";
9331#define DOUBLETYPE long double
9332#endif
9333#ifdef TRY_sprintf
a5b10d80
YST
9334#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9335#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9336#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9337#else
a5b10d80
YST
9338#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9339#endif
9340#else
b4eb6b3d
JH
9341#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9342#endif
9343char *myname = "sprintf";
9344#endif
9345
9346#ifndef DOUBLETYPE
9347#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9348#define DOUBLETYPE long double
9349#else
9350#define DOUBLETYPE double
9351#endif
9352#endif
9353
9354#include <stdio.h>
9355
9356#define I_STDLIB $i_stdlib
9357#ifdef I_STDLIB
9358#include <stdlib.h>
9359#endif
9360
9361int
9362checkit(expect, got)
9363char *expect;
9364char *got;
9365{
9366 if (strcmp(expect, got)) {
9367 printf("%s oddity: Expected %s, got %s\n",
9368 myname, expect, got);
9369 exit(1);
9370 }
9371}
9372
9373int main()
9374{
9375 char buf[64];
9376 buf[63] = '\0';
9377
9378 /* This must be 1st test on (which?) platform */
9379 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9380 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9381 checkit("0.1", buf);
9382
a5b10d80
YST
9383 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9384 checkit("0.01", buf);
9385
9386 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9387 checkit("0.001", buf);
9388
9389 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9390 checkit("0.0001", buf);
9391
9392 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9393 if (strlen(buf) > 5)
9394 checkit("9e-005", buf); /* for Microsoft ?? */
9395 else
9396 checkit("9e-05", buf);
9397
b4eb6b3d
JH
9398 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9399 checkit("1", buf);
9400
9401 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9402 checkit("1.1", buf);
9403
9404 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9405 checkit("1.01", buf);
9406
9407 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9408 checkit("1.001", buf);
9409
9410 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9411 checkit("1.0001", buf);
9412
9413 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9414 checkit("1.00001", buf);
9415
9416 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9417 checkit("1.000001", buf);
9418
9419 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9420 checkit("0", buf);
9421
9422 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9423 checkit("-1", buf);
9424
9425 /* Some Linux gcvt's give 1.e+5 here. */
9426 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9427 checkit("100000", buf);
9428
9429 /* Some Linux gcvt's give -1.e+5 here. */
9430 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9431 checkit("-100000", buf);
9432
9433 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9434 checkit("123.456", buf);
9435
ab6ca9f4 9436 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9437 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9438 /* 34 should be enough to scare even long double
9439 * places into using the e notation. */
ab6ca9f4 9440 if (strlen(buf) > 5)
94b339ad 9441 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9442 else
94b339ad 9443 checkit("1e+34", buf);
8e2a5ede 9444
d1eb8299
YST
9445 /* For Perl, if you add additional tests here, also add them to
9446 * t/base/num.t for benefit of platforms not using Configure or
9447 * overriding d_Gconvert */
9448
b4eb6b3d
JH
9449 exit(0);
9450}
9451EOP
ab6ca9f4 9452: first add preferred functions to our list
a5b10d80 9453xxx_list=""
ab6ca9f4 9454for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9455 case $xxx_convert in
9456 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9457 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
a5b10d80
YST
9458 esac
9459done
9460: then add any others
9461for xxx_convert in gconvert gcvt sprintf; do
9462 case "$xxx_list" in
9463 *$xxx_convert*) ;;
9464 *) xxx_list="$xxx_list $xxx_convert" ;;
9465 esac
9466done
9467
9468case "$d_longdbl$uselongdouble" in
9469"$define$define")
9470 : again, add prefered functions to our list first
9471 xxx_ld_list=""
ab6ca9f4 9472 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9473 case $xxx_convert in
9474 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9475 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9476 esac
9477 done
9478 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9479 for xxx_convert in qgcvt sprintf $xxx_list; do
9480 case "$xxx_ld_list" in
9481 $xxx_convert*|*" $xxx_convert"*) ;;
9482 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9483 esac
9484 done
9485 : if sprintf cannot do long doubles, move it to the end
9486 if test "$d_PRIgldbl" != "$define"; then
9487 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9488 fi
9489 : if no qgcvt, remove it
9490 if test "$d_qgcvt" != "$define"; then
9491 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9492 fi
9493 : use the ld_list
9494 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9495 ;;
9496esac
9497
9498for xxx_convert in $xxx_list; do
9499 echo "Trying $xxx_convert..."
9500 $rm -f try try$_o
9501 set try -DTRY_$xxx_convert
9502 if eval $compile; then
9503 echo "$xxx_convert() found." >&4
5440bc8e 9504 if $run ./try; then
b4eb6b3d
JH
9505 echo "I'll use $xxx_convert to convert floats into a string." >&4
9506 break;
9507 else
9508 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9509 xxx_convert=''
b4eb6b3d
JH
9510 fi
9511 else
9512 echo "$xxx_convert NOT found." >&4
9513 fi
9514done
ab6ca9f4 9515
a5b10d80
YST
9516if test X$xxx_convert = X; then
9517 echo "*** WHOA THERE!!! ***" >&4
9518 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9519 xxx_convert=sprintf
9520fi
9521
b4eb6b3d
JH
9522case "$xxx_convert" in
9523gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9524gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9525qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9526*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9527 "$define$define$define")
9528 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9529 "$define$define$undef")
9530 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9531 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9532 esac
9533 ;;
9534esac
9535
a5b10d80
YST
9536fi
9537
74cac757
JH
9538: see if _fwalk exists
9539set fwalk d__fwalk
9540eval $inlibc
9541
b4eb6b3d
JH
9542: Initialize h_fcntl
9543h_fcntl=false
9544
9545: Initialize h_sysfile
9546h_sysfile=false
9547
9548: access call always available on UNIX
9549set access d_access
9550eval $inlibc
9551
9552: locate the flags for 'access()'
9553case "$d_access" in
9554"$define")
9555 echo " "
55954f19 9556 $cat >access.c <<EOCP
b4eb6b3d
JH
9557#include <sys/types.h>
9558#ifdef I_FCNTL
9559#include <fcntl.h>
9560#endif
9561#ifdef I_SYS_FILE
9562#include <sys/file.h>
9563#endif
9564#ifdef I_UNISTD
9565#include <unistd.h>
9566#endif
55954f19
JH
9567#$i_stdlib I_STDLIB
9568#ifdef I_STDLIB
9569#include <stdlib.h>
9570#endif
b4eb6b3d
JH
9571int main() {
9572 exit(R_OK);
9573}
9574EOCP
9575 : check sys/file.h first, no particular reason here
9576 if $test `./findhdr sys/file.h` && \
7a282f6d 9577 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9578 h_sysfile=true;
9579 echo "<sys/file.h> defines the *_OK access constants." >&4
9580 elif $test `./findhdr fcntl.h` && \
7a282f6d 9581 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9582 h_fcntl=true;
9583 echo "<fcntl.h> defines the *_OK access constants." >&4
9584 elif $test `./findhdr unistd.h` && \
7a282f6d 9585 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9586 echo "<unistd.h> defines the *_OK access constants." >&4
9587 else
9588 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9589 fi
9590 ;;
9591esac
9592$rm -f access*
9593
9594: see if accessx exists
9595set accessx d_accessx
9596eval $inlibc
9597
89ce900e
JH
9598: see if aintl exists
9599set aintl d_aintl
9600eval $inlibc
9601
b4eb6b3d
JH
9602: see if alarm exists
9603set alarm d_alarm
9604eval $inlibc
9605
a9dade78
JH
9606: see if POSIX threads are available
9607set pthread.h i_pthread
9608eval $inhdr
9609
10bc17b6
JH
9610: define a fucntion to check prototypes
9611$cat > protochk <<EOSH
9612$startsh
9613cc="$cc"
9614optimize="$optimize"
9615ccflags="$ccflags"
9616prototype="$prototype"
9617define="$define"
9618rm=$rm
a9dade78
JH
9619usethreads=$usethreads
9620i_pthread=$i_pthread
9621pthread_h_first=$pthread_h_first
10bc17b6
JH
9622EOSH
9623
9624$cat >> protochk <<'EOSH'
9625
9626$rm -f try.c
9627foo="$1"
9628shift
9629while test $# -ge 2; do
9630 case "$1" in
9631 $define) echo "#include <$2>" >> try.c ;;
9632 literal) echo "$2" >> try.c ;;
9633 esac
cce6a207
MB
9634 # Extra magic for the benefit of systems that need pthread.h
9635 # to be included early to correctly detect threadsafe functions.
9636 # Such functions must guarantee themselves, though, that the usethreads
9637 # and i_pthread have been defined, before calling protochk.
9638 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9639 echo "#include <pthread.h>" >> try.c
9640 pthread_h_done=yes
9641 fi
10bc17b6
JH
9642 shift 2
9643done
9644test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9645cat >> try.c <<'EOCP'
9646#ifdef CAN_PROTOTYPE
9647#define _(args) args
9648#else
9649#define _(args) ()
9650#endif
9651EOCP
9652echo "$foo" >> try.c
9653echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9654$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9655status=$?
9656$rm -f try.[co]
9657exit $status
9658EOSH
9659chmod +x protochk
9660$eunicefix protochk
9661
89ce900e
JH
9662hasproto='varname=$1; func=$2; shift; shift;
9663while $test $# -ge 2; do
9664 case "$1" in
9665 $define) echo "#include <$2>";;
9666 esac ;
9667 shift 2;
9668done > try.c;
9669$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9670if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9671 echo "$func() prototype found.";
9672 val="$define";
9673else
9674 echo "$func() prototype NOT found.";
9675 val="$undef";
9676fi;
9677set $varname;
9678eval $setvar;
9679$rm -f try.c tryout.c'
9680
10bc17b6
JH
9681: see if sys/types.h has to be included
9682set sys/types.h i_systypes
9683eval $inhdr
9684
9685: see if sys/select.h has to be included
9686set sys/select.h i_sysselct
9687eval $inhdr
9688
9689hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9690while $test $# -ge 2; do
9691 case "$1" in
9692 $define) echo "#include <$2>";;
9693 esac ;
9694 shift 2;
9695done > try.c;
9696echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9697set try;
9698if eval $compile; then
9699 val="$define";
9700else
9701 val="$undef";
9702fi;
9703set $varname;
9704eval $setvar;
9705$rm -f try.c try.o'
9706
9707: see if we should include time.h, sys/time.h, or both
9708echo " "
9709if test "X$timeincl" = X; then
9710 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9711 $echo $n "I'm now running the test program...$c"
55954f19 9712 $cat >try.c <<EOCP
10bc17b6
JH
9713#include <sys/types.h>
9714#ifdef I_TIME
9715#include <time.h>
9716#endif
9717#ifdef I_SYSTIME
9718#ifdef SYSTIMEKERNEL
9719#define KERNEL
9720#endif
9721#include <sys/time.h>
9722#endif
9723#ifdef I_SYSSELECT
9724#include <sys/select.h>
9725#endif
55954f19
JH
9726#$i_stdlib I_STDLIB
9727#ifdef I_STDLIB
9728#include <stdlib.h>
9729#endif
10bc17b6
JH
9730int main()
9731{
9732 struct tm foo;
9733#ifdef S_TIMEVAL
9734 struct timeval bar;
9735#endif
9736#ifdef S_TIMEZONE
9737 struct timezone tzp;
9738#endif
9739 if (foo.tm_sec == foo.tm_sec)
9740 exit(0);
9741#ifdef S_TIMEVAL
9742 if (bar.tv_sec == bar.tv_sec)
9743 exit(0);
9744#endif
9745 exit(1);
9746}
9747EOCP
9748 flags=''
9749 for s_timezone in '-DS_TIMEZONE' ''; do
9750 sysselect=''
9751 for s_timeval in '-DS_TIMEVAL' ''; do
9752 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9753 for i_time in '' '-DI_TIME'; do
9754 for i_systime in '-DI_SYSTIME' ''; do
9755 case "$flags" in
9756 '') $echo $n ".$c"
9757 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9758 if eval $compile; then
9759 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9760 shift
9761 flags="$*"
9762 echo " "
9763 $echo $n "Succeeded with $flags$c"
9764 fi
9765 ;;
9766 esac
9767 done
9768 done
9769 done
9770 done
9771 done
9772 timeincl=''
9773 echo " "
9774 case "$flags" in
9775 *SYSTIMEKERNEL*) i_systimek="$define"
9776 timeincl=`./findhdr sys/time.h`
9777 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9778 *) i_systimek="$undef";;
9779 esac
9780 case "$flags" in
9781 *I_TIME*) i_time="$define"
9782 timeincl=`./findhdr time.h`" $timeincl"
9783 echo "We'll include <time.h>." >&4;;
9784 *) i_time="$undef";;
9785 esac
9786 case "$flags" in
9787 *I_SYSTIME*) i_systime="$define"
9788 timeincl=`./findhdr sys/time.h`" $timeincl"
9789 echo "We'll include <sys/time.h>." >&4;;
9790 *) i_systime="$undef";;
9791 esac
9792 $rm -f try.c try
9793fi
9794: see if struct tm knows about tm_zone
9795case "$i_systime$i_time" in
9796*$define*)
9797 echo " "
9798 echo "Checking to see if your struct tm has tm_zone field..." >&4
9799 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9800 eval $hasfield
9801 ;;
9802*) val="$undef"
9803 set d_tm_tm_zone
9804 eval $setvar
9805 ;;
9806esac
9807case "$d_tm_tm_zone" in
9808"$define") echo "Yes, it does." ;;
9809*) echo "No, it doesn't." ;;
9810esac
9811: see if struct tm knows about tm_gmtoff
9812case "$i_systime$i_time" in
9813*$define*)
9814 echo " "
9815 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9816 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9817 eval $hasfield
9818 ;;
9819*) val="$undef"
9820 set d_tm_tm_gmtoff
9821 eval $setvar
9822 ;;
9823esac
9824case "$d_tm_tm_gmtoff" in
9825"$define") echo "Yes, it does." ;;
9826*) echo "No, it doesn't." ;;
9827esac
9828
9829: see if asctime_r exists
9830set asctime_r d_asctime_r
9831eval $inlibc
9832case "$d_asctime_r" in
9833"$define")
d63eadf0 9834 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9835 case "$d_asctime_r_proto:$usethreads" in
9836 ":define") d_asctime_r_proto=define
a48ec845
JH
9837 set d_asctime_r_proto asctime_r $hdrs
9838 eval $hasproto ;;
9839 *) ;;
9840 esac
9841 case "$d_asctime_r_proto" in
9842 define)
10bc17b6
JH
9843 case "$asctime_r_proto" in
9844 ''|0) try='char* asctime_r(const struct tm*, char*);'
9845 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9846 esac
9847 case "$asctime_r_proto" in
9848 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9849 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9850 esac
9851 case "$asctime_r_proto" in
9852 ''|0) try='int asctime_r(const struct tm*, char*);'
9853 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9854 esac
9855 case "$asctime_r_proto" in
9856 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9857 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9858 esac
9859 case "$asctime_r_proto" in
90e831dc 9860 ''|0) d_asctime_r=undef
10bc17b6 9861 asctime_r_proto=0
a48ec845 9862 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
9863 * ) case "$asctime_r_proto" in
9864 REENTRANT_PROTO*) ;;
9865 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9866 esac
9867 echo "Prototype: $try" ;;
9868 esac
9869 ;;
c18e646a
JH
9870 *) case "$usethreads" in
9871 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9872 esac
90e831dc
SB
9873 d_asctime_r=undef
9874 asctime_r_proto=0
c18e646a 9875 ;;
a48ec845
JH
9876 esac
9877 ;;
10bc17b6
JH
9878*) asctime_r_proto=0
9879 ;;
9880esac
9881
b4eb6b3d
JH
9882: see if atolf exists
9883set atolf d_atolf
9884eval $inlibc
9885
9886: see if atoll exists
9887set atoll d_atoll
9888eval $inlibc
9889
0dbb1585
AL
9890: Look for GCC-style attribute format
9891case "$d_attribute_format" in
bde30f85 9892'')
b4eb6b3d 9893echo " "
0dbb1585 9894echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
9895$cat >attrib.c <<'EOCP'
9896#include <stdio.h>
0dbb1585 9897void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
9898EOCP
9899if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9900 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 9901 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
9902 val="$undef"
9903 else
0dbb1585 9904 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
9905 val="$define"
9906 fi
9907else
9908 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9909 val="$undef"
9910fi
bde30f85 9911;;
0dbb1585 9912*) val="$d_attribute_format" ;;
bde30f85 9913esac
0dbb1585
AL
9914set d_attribute_format
9915eval $setvar
9916$rm -f attrib*
9917
9918: Look for GCC-style attribute malloc
9919case "$d_attribute_malloc" in
9920'')
9921echo " "
9922echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9923$cat >attrib.c <<'EOCP'
9924#include <stdio.h>
9925char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9926EOCP
9927if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9928 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9929 echo "Your C compiler doesn't support __attribute__((malloc))."
9930 val="$undef"
9931 else
9932 echo "Your C compiler supports __attribute__((malloc))."
9933 val="$define"
9934 fi
9935else
9936 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9937 val="$undef"
9938fi
9939;;
9940*) val="$d_attribute_malloc" ;;
9941esac
9942set d_attribute_malloc
9943eval $setvar
9944$rm -f attrib*
9945
9946: Look for GCC-style attribute nonnull
9947case "$d_attribute_nonnull" in
9948'')
9949echo " "
9950echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9951$cat >attrib.c <<'EOCP'
9952#include <stdio.h>
9953void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9954EOCP
9955if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9956 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9957 echo "Your C compiler doesn't support __attribute__((nonnull))."
9958 val="$undef"
9959 else
9960 echo "Your C compiler supports __attribute__((nonnull))."
9961 val="$define"
9962 fi
9963else
9964 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9965 val="$undef"
9966fi
9967;;
9968*) val="$d_attribute_nonnull" ;;
9969esac
9970set d_attribute_nonnull
9971eval $setvar
9972$rm -f attrib*
9973
9974: Look for GCC-style attribute noreturn
9975case "$d_attribute_noreturn" in
9976'')
9977echo " "
9978echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9979$cat >attrib.c <<'EOCP'
9980#include <stdio.h>
9981void fall_over_dead( void ) __attribute__((noreturn));
9982EOCP
9983if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9984 if $contains 'warning' attrib.out >/dev/null 2>&1; then
9985 echo "Your C compiler doesn't support __attribute__((noreturn))."
9986 val="$undef"
9987 else
9988 echo "Your C compiler supports __attribute__((noreturn))."
9989 val="$define"
9990 fi
9991else
9992 echo "Your C compiler doesn't seem to understand __attribute__ at all."
9993 val="$undef"
9994fi
9995;;
9996*) val="$d_attribute_noreturn" ;;
9997esac
9998set d_attribute_noreturn
9999eval $setvar
10000$rm -f attrib*
10001
10002: Look for GCC-style attribute pure
10003case "$d_attribute_pure" in
10004'')
10005echo " "
10006echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10007$cat >attrib.c <<'EOCP'
10008#include <stdio.h>
10009int square( int n ) __attribute__((pure));
10010EOCP
10011if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10012 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10013 echo "Your C compiler doesn't support __attribute__((pure))."
10014 val="$undef"
10015 else
10016 echo "Your C compiler supports __attribute__((pure))."
10017 val="$define"
10018 fi
10019else
10020 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10021 val="$undef"
10022fi
10023;;
10024*) val="$d_attribute_pure" ;;
10025esac
10026set d_attribute_pure
10027eval $setvar
10028$rm -f attrib*
10029
10030: Look for GCC-style attribute unused
10031case "$d_attribute_unused" in
10032'')
10033echo " "
10034echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10035$cat >attrib.c <<'EOCP'
10036#include <stdio.h>
10037int do_something( int dummy __attribute__((unused)), int n );
10038EOCP
10039if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10040 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10041 echo "Your C compiler doesn't support __attribute__((unused))."
10042 val="$undef"
10043 else
10044 echo "Your C compiler supports __attribute__((unused))."
10045 val="$define"
10046 fi
10047else
10048 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10049 val="$undef"
10050fi
10051;;
10052*) val="$d_attribute_unused" ;;
10053esac
10054set d_attribute_unused
10055eval $setvar
10056$rm -f attrib*
10057
10058: Look for GCC-style attribute warn_unused_result
10059case "$d_attribute_warn_unused_result" in
10060'')
10061echo " "
10062echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10063$cat >attrib.c <<'EOCP'
10064#include <stdio.h>
10065int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10066EOCP
10067if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10068 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10069 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10070 val="$undef"
10071 else
10072 echo "Your C compiler supports __attribute__((warn_unused_result))."
10073 val="$define"
10074 fi
10075else
10076 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10077 val="$undef"
10078fi
10079;;
10080*) val="$d_attribute_warn_unused_result" ;;
10081esac
10082set d_attribute_warn_unused_result
b4eb6b3d
JH
10083eval $setvar
10084$rm -f attrib*
10085
10086: see if bcmp exists
10087set bcmp d_bcmp
10088eval $inlibc
10089
10090: see if bcopy exists
10091set bcopy d_bcopy
10092eval $inlibc
10093
10094: see if this is a unistd.h system
10095set unistd.h i_unistd
10096eval $inhdr
10097
10098: see if getpgrp exists
10099set getpgrp d_getpgrp
10100eval $inlibc
10101
10102case "$d_getpgrp" in
10103"$define")
10104 echo " "
10105 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10106 $cat >try.c <<EOP
b4eb6b3d
JH
10107#$i_unistd I_UNISTD
10108#include <sys/types.h>
10109#ifdef I_UNISTD
10110# include <unistd.h>
10111#endif
55954f19
JH
10112#$i_stdlib I_STDLIB
10113#ifdef I_STDLIB
10114#include <stdlib.h>
10115#endif
b4eb6b3d
JH
10116int main()
10117{
10118 if (getuid() == 0) {
10119 printf("(I see you are running Configure as super-user...)\n");
10120 setuid(1);
10121 }
10122#ifdef TRY_BSD_PGRP
10123 if (getpgrp(1) == 0)
10124 exit(0);
10125#else
10126 if (getpgrp() > 0)
10127 exit(0);
10128#endif
10129 exit(1);
10130}
10131EOP
5440bc8e 10132 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10133 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10134 val="$define"
5440bc8e 10135 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10136 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10137 val="$undef"
10138 else
10139 echo "I can't seem to compile and run the test program."
10140 if ./usg; then
10141 xxx="a USG one, i.e. you use getpgrp()."
10142 else
10143 # SVR4 systems can appear rather BSD-ish.
10144 case "$i_unistd" in
10145 $undef)
10146 xxx="a BSD one, i.e. you use getpgrp(pid)."
10147 val="$define"
10148 ;;
10149 $define)
10150 xxx="probably a USG one, i.e. you use getpgrp()."
10151 val="$undef"
10152 ;;
10153 esac
10154 fi
10155 echo "Assuming your getpgrp is $xxx" >&4
10156 fi
10157 ;;
10158*) val="$undef";;
10159esac
10160set d_bsdgetpgrp
10161eval $setvar
5440bc8e 10162$rm -f try try.*
b4eb6b3d
JH
10163
10164: see if setpgrp exists
10165set setpgrp d_setpgrp
10166eval $inlibc
10167
10168case "$d_setpgrp" in
10169"$define")
10170 echo " "
10171 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10172 $cat >try.c <<EOP
b4eb6b3d
JH
10173#$i_unistd I_UNISTD
10174#include <sys/types.h>
10175#ifdef I_UNISTD
10176# include <unistd.h>
10177#endif
55954f19
JH
10178#$i_stdlib I_STDLIB
10179#ifdef I_STDLIB
10180#include <stdlib.h>
10181#endif
b4eb6b3d
JH
10182int main()
10183{
10184 if (getuid() == 0) {
10185 printf("(I see you are running Configure as super-user...)\n");
10186 setuid(1);
10187 }
10188#ifdef TRY_BSD_PGRP
10189 if (-1 == setpgrp(1, 1))
10190 exit(0);
10191#else
10192 if (setpgrp() != -1)
10193 exit(0);
10194#endif
10195 exit(1);
10196}
10197EOP
5440bc8e 10198 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10199 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10200 val="$define"
5440bc8e 10201 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10202 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10203 val="$undef"
10204 else
10205 echo "(I can't seem to compile and run the test program.)"
10206 if ./usg; then
10207 xxx="a USG one, i.e. you use setpgrp()."
10208 else
10209 # SVR4 systems can appear rather BSD-ish.
10210 case "$i_unistd" in
10211 $undef)
10212 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10213 val="$define"
10214 ;;
10215 $define)
10216 xxx="probably a USG one, i.e. you use setpgrp()."
10217 val="$undef"
10218 ;;
10219 esac
10220 fi
10221 echo "Assuming your setpgrp is $xxx" >&4
10222 fi
10223 ;;
10224*) val="$undef";;
10225esac
10226set d_bsdsetpgrp
10227eval $setvar
5440bc8e 10228$rm -f try try.*
635aebb7
AL
10229: Look for GCC-style __builtin_choose_expr
10230case "$d_builtin_choose_expr" in
10231'')
10232 echo " "
10233 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10234 $cat >try.c <<'EOCP'
10235#include <assert.h>
10236#include <stdlib.h>
10237#include <stdio.h>
10238
10239#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10240
10241int main(void) {
10242 assert( SYRINX(1) == 2112 );
10243 assert( SYRINX(1) != 5150 );
10244 assert( SYRINX(0) == 5150 );
10245 assert( SYRINX(0) != 2112 );
10246 puts( "All good!" );
10247 exit(0);
10248}
10249
10250EOCP
10251 set try
10252 if eval $compile; then
10253 echo "Your C compiler supports __builtin_choose_expr."
10254 val="$define"
10255 else
10256 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10257 val="$undef"
10258 fi
10259;;
10260*) val="$d_builtin_choose_expr" ;;
10261esac
10262
10263set d_builtin_choose_expr
10264eval $setvar
10265$rm -f try.* try core core.try.*
10266
10267: Look for GCC-style __builtin_expect
10268case "$d_builtin_expect" in
10269'')
10270 echo " "
10271 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10272 $cat >builtin.c <<'EOCP'
10273int main(void) {
10274 int n = 50;
10275 if ( __builtin_expect(n, 0) ) n = 1;
10276}
10277EOCP
10278 set try
10279 if eval $compile; then
10280 echo "Your C compiler supports __builtin_choose_expr."
10281 val="$define"
10282 else
10283 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10284 val="$undef"
10285 fi
10286 ;;
10287*) val="$d_builtin_expect" ;;
10288esac
10289
10290set d_builtin_expect
10291eval $setvar
10292$rm -f try.* try core core.try.*
10293
b4eb6b3d
JH
10294: see if bzero exists
10295set bzero d_bzero
10296eval $inlibc
10297
10298: see if signal is declared as pointer to function returning int or void
10299echo " "
10300xxx=`./findhdr signal.h`
10301$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10302if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10303 echo "You have int (*signal())() instead of void." >&4
10304 val="$undef"
10305elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10306 echo "You have void (*signal())()." >&4
10307 val="$define"
10308elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10309 echo "You have int (*signal())() instead of void." >&4
10310 val="$undef"
10311elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10312 echo "You have void (*signal())()." >&4
10313 val="$define"
10314else
10315 case "$d_voidsig" in
10316 '')
10317 echo "I can't determine whether signal handler returns void or int..." >&4
10318 dflt=void
10319 rp="What type does your signal handler return?"
10320 . ./myread
10321 case "$ans" in
10322 v*) val="$define";;
10323 *) val="$undef";;
10324 esac;;
10325 "$define")
10326 echo "As you already told me, signal handler returns void." >&4
10327 val="$define"
10328 ;;
10329 *) echo "As you already told me, signal handler returns int." >&4
10330 val="$undef"
10331 ;;
10332 esac
10333fi
10334set d_voidsig
10335eval $setvar
10336case "$d_voidsig" in
10337"$define") signal_t="void";;
10338*) signal_t="int";;
10339esac
10340$rm -f $$.tmp
10341
10342: check for ability to cast large floats to 32-bit ints.
10343echo " "
10344echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10345if $test "$intsize" -ge 4; then
10346 xxx=int
10347else
10348 xxx=long
10349fi
10350$cat >try.c <<EOCP
10351#include <stdio.h>
d1daaddf
JH
10352#$i_stdlib I_STDLIB
10353#ifdef I_STDLIB
10354#include <stdlib.h>
10355#endif
b4eb6b3d
JH
10356#include <sys/types.h>
10357#include <signal.h>
10358$signal_t blech(s) int s; { exit(3); }
10359int main()
10360{
10361 $xxx i32;
10362 double f, g;
10363 int result = 0;
10364 char str[16];
10365 signal(SIGFPE, blech);
10366
10367 /* Don't let compiler optimize the test away. Store the number
10368 in a writable string for gcc to pass to sscanf under HP/UX.
10369 */
10370 sprintf(str, "2147483647");
10371 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10372 g = 10 * f;
10373 i32 = ($xxx) g;
10374
10375 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10376 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10377 behavior here, which is to preserve the sign and give
10378 back 0x7fff ffff.
10379 */
10380 if (i32 != ($xxx) f)
10381 result |= 1;
10382 exit(result);
10383}
10384EOCP
10385set try
10386if eval $compile_ok; then
5440bc8e 10387 $run ./try
b4eb6b3d
JH
10388 yyy=$?
10389else
10390 echo "(I can't seem to compile the test program--assuming it can't)"
10391 yyy=1
10392fi
10393case "$yyy" in
103940) val="$define"
10395 echo "Yup, it can."
10396 ;;
10397*) val="$undef"
10398 echo "Nope, it can't."
10399 ;;
10400esac
10401set d_casti32
10402eval $setvar
10403$rm -f try try.*
10404
10405: check for ability to cast negative floats to unsigned
10406echo " "
10407echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10408$cat >try.c <<EOCP
10409#include <stdio.h>
d1daaddf
JH
10410#$i_stdlib I_STDLIB
10411#ifdef I_STDLIB
10412#include <stdlib.h>
10413#endif
b4eb6b3d
JH
10414#include <sys/types.h>
10415#include <signal.h>
10416$signal_t blech(s) int s; { exit(7); }
10417$signal_t blech_in_list(s) int s; { exit(4); }
10418unsigned long dummy_long(p) unsigned long p; { return p; }
10419unsigned int dummy_int(p) unsigned int p; { return p; }
10420unsigned short dummy_short(p) unsigned short p; { return p; }
10421int main()
10422{
10423 double f;
10424 unsigned long along;
10425 unsigned int aint;
10426 unsigned short ashort;
10427 int result = 0;
10428 char str[16];
10429
10430 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10431 a direct f = -123. assignment. gcc-2.8.0 reportedly
10432 optimized the whole file away
10433 */
10434 /* Store the number in a writable string for gcc to pass to
10435 sscanf under HP/UX.
10436 */
10437 sprintf(str, "-123");
10438 sscanf(str, "%lf", &f); /* f = -123.; */
10439
10440 signal(SIGFPE, blech);
10441 along = (unsigned long)f;
10442 aint = (unsigned int)f;
10443 ashort = (unsigned short)f;
10444 if (along != (unsigned long)-123)
10445 result |= 1;
10446 if (aint != (unsigned int)-123)
10447 result |= 1;
10448 if (ashort != (unsigned short)-123)
10449 result |= 1;
10450 sprintf(str, "1073741824.");
10451 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10452 f = f + f;
10453 along = 0;
10454 along = (unsigned long)f;
10455 if (along != 0x80000000)
10456 result |= 2;
10457 f -= 1.;
10458 along = 0;
10459 along = (unsigned long)f;
10460 if (along != 0x7fffffff)
10461 result |= 1;
10462 f += 2.;
10463 along = 0;
10464 along = (unsigned long)f;
10465 if (along != 0x80000001)
10466 result |= 2;
10467 if (result)
10468 exit(result);
10469 signal(SIGFPE, blech_in_list);
10470 sprintf(str, "123.");
10471 sscanf(str, "%lf", &f); /* f = 123.; */
10472 along = dummy_long((unsigned long)f);
10473 aint = dummy_int((unsigned int)f);
10474 ashort = dummy_short((unsigned short)f);
10475 if (along != (unsigned long)123)
10476 result |= 4;
10477 if (aint != (unsigned int)123)
10478 result |= 4;
10479 if (ashort != (unsigned short)123)
10480 result |= 4;
10481 exit(result);
10482
10483}
10484EOCP
10485set try
10486if eval $compile_ok; then
5440bc8e 10487 $run ./try
b4eb6b3d
JH
10488 castflags=$?
10489else
10490 echo "(I can't seem to compile the test program--assuming it can't)"
10491 castflags=7
10492fi
10493case "$castflags" in
104940) val="$define"
10495 echo "Yup, it can."
10496 ;;
10497*) val="$undef"
10498 echo "Nope, it can't."
10499 ;;
10500esac
10501set d_castneg
10502eval $setvar
10503$rm -f try.*
10504
10505: see if vprintf exists
10506echo " "
10507if set vprintf val -f d_vprintf; eval $csym; $val; then
10508 echo 'vprintf() found.' >&4
10509 val="$define"
55954f19 10510 $cat >try.c <<EOF
b4eb6b3d 10511#include <varargs.h>
55954f19
JH
10512#$i_stdlib I_STDLIB
10513#ifdef I_STDLIB
10514#include <stdlib.h>
10515#endif
b4eb6b3d
JH
10516
10517int main() { xxx("foo"); }
10518
10519xxx(va_alist)
10520va_dcl
10521{
10522 va_list args;
10523 char buf[10];
10524
10525 va_start(args);
10526 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10527}
10528EOF
5440bc8e
JH
10529 set try
10530 if eval $compile && $run ./try; then
b4eb6b3d
JH
10531 echo "Your vsprintf() returns (int)." >&4
10532 val2="$undef"
10533 else
10534 echo "Your vsprintf() returns (char*)." >&4
10535 val2="$define"
10536 fi
10537else
10538 echo 'vprintf() NOT found.' >&4
10539 val="$undef"
10540 val2="$undef"
10541fi
5440bc8e 10542$rm -f try try.*
b4eb6b3d
JH
10543set d_vprintf
10544eval $setvar
10545val=$val2
10546set d_charvspr
10547eval $setvar
10548
10549: see if chown exists
10550set chown d_chown
10551eval $inlibc
10552
10553: see if chroot exists
10554set chroot d_chroot
10555eval $inlibc
10556
10557: see if chsize exists
10558set chsize d_chsize
10559eval $inlibc
10560
758a5d79
JH
10561: see if class exists
10562set class d_class
10563eval $inlibc
10564
b0a2e8e6
MB
10565: see if clearenv exists
10566set clearenv d_clearenv
10567eval $inlibc
10568
4e0554ec
JH
10569hasstruct='varname=$1; struct=$2; shift; shift;
10570while $test $# -ge 2; do
10571 case "$1" in
10572 $define) echo "#include <$2>";;
10573 esac ;
10574 shift 2;
10575done > try.c;
10576echo "int main () { struct $struct foo; }" >> try.c;
10577set try;
10578if eval $compile; then
10579 val="$define";
10580else
10581 val="$undef";
10582fi;
10583set $varname;
10584eval $setvar;
10585$rm -f try.c try.o'
10586
4e0554ec
JH
10587socketlib=''
10588sockethdr=''
10589: see whether socket exists
10590echo " "
10591$echo $n "Hmm... $c" >&4
10592if set socket val -f d_socket; eval $csym; $val; then
10593 echo "Looks like you have Berkeley networking support." >&4
10594 d_socket="$define"
10595 if set setsockopt val -f; eval $csym; $val; then
10596 d_oldsock="$undef"
10597 else
10598 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10599 d_oldsock="$define"
10600 fi
10601else
10602 if $contains socklib libc.list >/dev/null 2>&1; then
10603 echo "Looks like you have Berkeley networking support." >&4
10604 d_socket="$define"
10605 : we will have to assume that it supports the 4.2 BSD interface
10606 d_oldsock="$undef"
10607 else
10608 echo "You don't have Berkeley networking in libc$_a..." >&4
10609 if test "X$d_socket" = "X$define"; then
10610 echo "...but you seem to believe that you have sockets." >&4
10611 else
10612 for net in net socket
10613 do
10614 if test -f /usr/lib/lib$net$_a; then
10615 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10616 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10617 if $contains socket libc.list >/dev/null 2>&1; then
10618 d_socket="$define"
10619 socketlib="-l$net"
10620 case "$net" in
10621 net)
10622 echo "...but the Wollongong group seems to have hacked it in." >&4
10623 sockethdr="-I/usr/netinclude"
10624 ;;
10625 esac
3c728e00 10626 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10627 if $contains setsockopt libc.list >/dev/null 2>&1; then
10628 d_oldsock="$undef"
10629 else
10630 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10631 d_oldsock="$define"
10632 fi
10633 break
10634 fi
10635 fi
10636 done
10637 if test "X$d_socket" != "X$define"; then
10638 echo "or anywhere else I see." >&4
10639 d_socket="$undef"
10640 d_oldsock="$undef"
10641 fi
10642 fi
10643 fi
10644fi
10645
10646: see if socketpair exists
10647set socketpair d_sockpair
10648eval $inlibc
10649
10650
10651echo " "
3c728e00 10652echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
10653for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10654 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10655 $cat >try.c <<EOF
10656#include <sys/types.h>
10657#include <sys/socket.h>
10658int main() {
10659 int i = $ENUM;
10660}
10661EOF
10662 val="$undef"
10663 set try; if eval $compile; then
10664 val="$define"
10665 fi
10666 set d_${enum}; eval $setvar
10667 $rm -f try.c try
10668done
10669
10670: see if this is a sys/uio.h system
10671set sys/uio.h i_sysuio
10672eval $inhdr
10673
10674
10675echo " "
10676echo "Checking to see if your system supports struct cmsghdr..." >&4
10677set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10678eval $hasstruct
10679case "$d_cmsghdr_s" in
10680"$define") echo "Yes, it does." ;;
10681*) echo "No, it doesn't." ;;
10682esac
10683
10684
b4eb6b3d
JH
10685: check for const keyword
10686echo " "
10687echo 'Checking to see if your C compiler knows about "const"...' >&4
10688$cat >const.c <<'EOCP'
10689typedef struct spug { int drokk; } spug;
76f47787 10690int main()
b4eb6b3d
JH
10691{
10692 const char *foo;
10693 const spug y;
10694}
10695EOCP
10696if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10697 val="$define"
10698 echo "Yup, it does."
10699else
10700 val="$undef"
10701 echo "Nope, it doesn't."
10702fi
10703set d_const
10704eval $setvar
10705
89ce900e
JH
10706: see if copysignl exists
10707set copysignl d_copysignl
10708eval $inlibc
10709
b4eb6b3d
JH
10710: see if crypt exists
10711echo " "
a5a94ea5
JH
10712set crypt d_crypt
10713eval $inlibc
10714case "$d_crypt" in
10715$define) cryptlib='' ;;
10716*) if set crypt val -f d_crypt; eval $csym; $val; then
10717 echo 'crypt() found.' >&4
b4eb6b3d 10718 val="$define"
a5a94ea5
JH
10719 cryptlib=''
10720 else
10721 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10722 if $test -z "$cryptlib"; then
10723 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10724 else
10725 cryptlib=-lcrypt
10726 fi
10727 if $test -z "$cryptlib"; then
10728 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10729 else
10730 cryptlib=-lcrypt
10731 fi
10732 if $test -z "$cryptlib"; then
10733 cryptlib=`./loc libcrypt$_a "" $libpth`
10734 else
10735 cryptlib=-lcrypt
10736 fi
10737 if $test -z "$cryptlib"; then
10738 echo 'crypt() NOT found.' >&4
10739 val="$undef"
10740 else
10741 val="$define"
10742 fi
b4eb6b3d 10743 fi
a5a94ea5
JH
10744 set d_crypt
10745 eval $setvar
10746 ;;
10747esac
b4eb6b3d 10748
10bc17b6
JH
10749: see if this is a crypt.h system
10750set crypt.h i_crypt
10751eval $inhdr
10752
10753: see if crypt_r exists
10754set crypt_r d_crypt_r
10755eval $inlibc
10756case "$d_crypt_r" in
10757"$define")
10758 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
10759 case "$d_crypt_r_proto:$usethreads" in
10760 ":define") d_crypt_r_proto=define
a48ec845
JH
10761 set d_crypt_r_proto crypt_r $hdrs
10762 eval $hasproto ;;
10763 *) ;;
10764 esac
10765 case "$d_crypt_r_proto" in
10766 define)
10bc17b6
JH
10767 case "$crypt_r_proto" in
10768 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10769 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10770 esac
10771 case "$crypt_r_proto" in
b430fd04
JH
10772 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10773 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10774 esac
10775 case "$crypt_r_proto" in
90e831dc 10776 ''|0) d_crypt_r=undef
10bc17b6 10777 crypt_r_proto=0
a48ec845 10778 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10779 * ) case "$crypt_r_proto" in
10780 REENTRANT_PROTO*) ;;
10781 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10782 esac
10783 echo "Prototype: $try" ;;
10784 esac
10785 ;;
c18e646a
JH
10786 *) case "$usethreads" in
10787 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10788 esac
90e831dc
SB
10789 d_crypt_r=undef
10790 crypt_r_proto=0
c18e646a 10791 ;;
a48ec845
JH
10792 esac
10793 ;;
10bc17b6
JH
10794*) crypt_r_proto=0
10795 ;;
10796esac
10797
b4eb6b3d
JH
10798: get csh whereabouts
10799case "$csh" in
10800'csh') val="$undef" ;;
10801*) val="$define" ;;
10802esac
10803set d_csh
10804eval $setvar
10805: Respect a hint or command line value for full_csh.
10806case "$full_csh" in
10807'') full_csh=$csh ;;
10808esac
10809
10bc17b6
JH
10810: see if ctermid_r exists
10811set ctermid_r d_ctermid_r
10812eval $inlibc
10813case "$d_ctermid_r" in
10814"$define")
31ee0cb7 10815 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
10816 case "$d_ctermid_r_proto:$usethreads" in
10817 ":define") d_ctermid_r_proto=define
a48ec845
JH
10818 set d_ctermid_r_proto ctermid_r $hdrs
10819 eval $hasproto ;;
10820 *) ;;
10821 esac
10822 case "$d_ctermid_r_proto" in
10823 define)
10bc17b6
JH
10824 case "$ctermid_r_proto" in
10825 ''|0) try='char* ctermid_r(char*);'
10826 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10827 esac
10828 case "$ctermid_r_proto" in
90e831dc 10829 ''|0) d_ctermid_r=undef
10bc17b6 10830 ctermid_r_proto=0
a48ec845 10831 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10832 * ) case "$ctermid_r_proto" in
10833 REENTRANT_PROTO*) ;;
10834 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10835 esac
10836 echo "Prototype: $try" ;;
10837 esac
10838 ;;
c18e646a
JH
10839 *) case "$usethreads" in
10840 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10841 esac
90e831dc
SB
10842 d_ctermid_r=undef
10843 ctermid_r_proto=0
c18e646a 10844 ;;
a48ec845
JH
10845 esac
10846 ;;
10bc17b6
JH
10847*) ctermid_r_proto=0
10848 ;;
10849esac
10850
10851: see if ctime_r exists
10852set ctime_r d_ctime_r
10853eval $inlibc
10854case "$d_ctime_r" in
10855"$define")
d63eadf0 10856 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10857 case "$d_ctime_r_proto:$usethreads" in
10858 ":define") d_ctime_r_proto=define
a48ec845
JH
10859 set d_ctime_r_proto ctime_r $hdrs
10860 eval $hasproto ;;
10861 *) ;;
10862 esac
10863 case "$d_ctime_r_proto" in
10864 define)
10bc17b6
JH
10865 case "$ctime_r_proto" in
10866 ''|0) try='char* ctime_r(const time_t*, char*);'
10867 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10868 esac
10869 case "$ctime_r_proto" in
10870 ''|0) try='char* ctime_r(const time_t*, char*, int);'
10871 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10872 esac
10873 case "$ctime_r_proto" in
10874 ''|0) try='int ctime_r(const time_t*, char*);'
10875 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10876 esac
10877 case "$ctime_r_proto" in
10878 ''|0) try='int ctime_r(const time_t*, char*, int);'
10879 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10880 esac
10881 case "$ctime_r_proto" in
90e831dc 10882 ''|0) d_ctime_r=undef
10bc17b6 10883 ctime_r_proto=0
a48ec845 10884 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10885 * ) case "$ctime_r_proto" in
10886 REENTRANT_PROTO*) ;;
10887 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10888 esac
10889 echo "Prototype: $try" ;;
10890 esac
10891 ;;
c18e646a
JH
10892 *) case "$usethreads" in
10893 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10894 esac
90e831dc
SB
10895 d_ctime_r=undef
10896 ctime_r_proto=0
c18e646a 10897 ;;
a48ec845
JH
10898 esac
10899 ;;
10bc17b6
JH
10900*) ctime_r_proto=0
10901 ;;
10902esac
10903
b4eb6b3d
JH
10904: see if cuserid exists
10905set cuserid d_cuserid
10906eval $inlibc
10907
10908: see if this is a limits.h system
10909set limits.h i_limits
10910eval $inhdr
10911
10912: see if this is a float.h system
10913set float.h i_float
10914eval $inhdr
10915
10916: See if number of significant digits in a double precision number is known
10917echo " "
10918$cat >dbl_dig.c <<EOM
10919#$i_limits I_LIMITS
10920#$i_float I_FLOAT
10921#ifdef I_LIMITS
10922#include <limits.h>
10923#endif
10924#ifdef I_FLOAT
10925#include <float.h>
10926#endif
10927#ifdef DBL_DIG
10928printf("Contains DBL_DIG");
10929#endif
10930EOM
10931$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10932if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10933 echo "DBL_DIG found." >&4
10934 val="$define"
10935else
10936 echo "DBL_DIG NOT found." >&4
10937 val="$undef"
10938fi
10939$rm -f dbl_dig.?
10940set d_dbl_dig
10941eval $setvar
10942
2ef53570
JH
10943: see if dbm.h is available
10944: see if dbmclose exists
10945set dbmclose d_dbmclose
10946eval $inlibc
10947
10948case "$d_dbmclose" in
10949$define)
10950 set dbm.h i_dbm
10951 eval $inhdr
10952 case "$i_dbm" in
10953 $define)
10954 val="$undef"
10955 set i_rpcsvcdbm
10956 eval $setvar
10957 ;;
10958 *) set rpcsvc/dbm.h i_rpcsvcdbm
10959 eval $inhdr
10960 ;;
10961 esac
10962 ;;
10963*) echo "We won't be including <dbm.h>"
10964 val="$undef"
10965 set i_dbm
10966 eval $setvar
10967 val="$undef"
10968 set i_rpcsvcdbm
10969 eval $setvar
10970 ;;
10971esac
10972
10973: see if prototype for dbminit is available
10974echo " "
10975set d_dbminitproto dbminit $i_dbm dbm.h
10976eval $hasproto
10977
b4eb6b3d
JH
10978: see if difftime exists
10979set difftime d_difftime
10980eval $inlibc
10981
10982: see if this is a dirent system
10983echo " "
10984if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10985 val="$define"
10986 echo "<dirent.h> found." >&4
10987else
10988 val="$undef"
10989 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10990 echo "<sys/dir.h> found." >&4
10991 echo " "
10992 else
10993 xinc=`./findhdr sys/ndir.h`
10994 fi
10995 echo "<dirent.h> NOT found." >&4
10996fi
10997set i_dirent
10998eval $setvar
10999
11000: Look for type of directory structure.
11001echo " "
11002$cppstdin $cppflags $cppminus < "$xinc" > try.c
11003
11004case "$direntrytype" in
11005''|' ')
11006 case "$i_dirent" in
11007 $define) guess1='struct dirent' ;;
11008 *) guess1='struct direct' ;;
11009 esac
11010 ;;
11011*) guess1="$direntrytype"
11012 ;;
11013esac
11014
11015case "$guess1" in
11016'struct dirent') guess2='struct direct' ;;
11017*) guess2='struct dirent' ;;
11018esac
11019
11020if $contains "$guess1" try.c >/dev/null 2>&1; then
11021 direntrytype="$guess1"
11022 echo "Your directory entries are $direntrytype." >&4
11023elif $contains "$guess2" try.c >/dev/null 2>&1; then
11024 direntrytype="$guess2"
11025 echo "Your directory entries seem to be $direntrytype." >&4
11026else
11027 echo "I don't recognize your system's directory entries." >&4
11028 rp="What type is used for directory entries on this system?"
11029 dflt="$guess1"
11030 . ./myread
11031 direntrytype="$ans"
11032fi
11033$rm -f try.c
11034
11035
11036: see if the directory entry stores field length
11037echo " "
11038$cppstdin $cppflags $cppminus < "$xinc" > try.c
11039if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11040 echo "Good, your directory entry keeps length information in d_namlen." >&4
11041 val="$define"
11042else
11043 echo "Your directory entry does not know about the d_namlen field." >&4
11044 val="$undef"
11045fi
11046set d_dirnamlen
11047eval $setvar
11048$rm -f try.c
11049
ae0e3d3b
JH
11050: see if this is an sysdir system
11051set sys/dir.h i_sysdir
11052eval $inhdr
11053
11054: see if this is an sysndir system
11055set sys/ndir.h i_sysndir
11056eval $inhdr
11057
11058: Look for dirfd
11059echo " "
11060$cat >dirfd.c <<EOM
11061#include <stdio.h>
55954f19
JH
11062#$i_stdlib I_STDLIB
11063#ifdef I_STDLIB
11064#include <stdlib.h>
11065#endif
ae0e3d3b
JH
11066#$i_dirent I_DIRENT /**/
11067#$i_sysdir I_SYS_DIR /**/
11068#$i_sysndir I_SYS_NDIR /**/
11069#$i_systypes I_SYS_TYPES /**/
11070#if defined(I_SYS_TYPES)
11071#include <sys/types.h>
11072#endif
11073#if defined(I_DIRENT)
11074#include <dirent.h>
11075#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11076#include <sys/dir.h>
11077#endif
11078#else
11079#ifdef I_SYS_NDIR
11080#include <sys/ndir.h>
11081#else
11082#ifdef I_SYS_DIR
11083#ifdef hp9000s500
11084#include <ndir.h> /* may be wrong in the future */
11085#else
11086#include <sys/dir.h>
11087#endif
11088#endif
11089#endif
11090#endif
11091int main() {
11092 DIR *dirp = opendir(".");
11093 if (dirfd(dirp) >= 0)
11094 exit(0);
11095 else
11096 exit(1);
11097}
11098EOM
5cadb3f3 11099val=$undef
ae0e3d3b
JH
11100set dirfd
11101if eval $compile; then
11102 val="$define"
11103fi
11104case "$val" in
11105$define) echo "dirfd() found." >&4 ;;
11106*) echo "dirfd() NOT found." >&4 ;;
11107esac
11108set d_dirfd
11109eval $setvar
11110$rm -f dirfd*
11111
b4eb6b3d
JH
11112: see if dlerror exists
11113xxx_runnm="$runnm"
11114runnm=false
11115set dlerror d_dlerror
11116eval $inlibc
11117runnm="$xxx_runnm"
11118
11119: see if dlfcn is available
11120set dlfcn.h i_dlfcn
11121eval $inhdr
11122
11123case "$usedl" in
11124$define|y|true)
11125 $cat << EOM
11126
11127On a few systems, the dynamically loaded modules that perl generates and uses
11128will need a different extension than shared libs. The default will probably
11129be appropriate.
11130
11131EOM
11132 case "$dlext" in
11133 '') dflt="$so" ;;
11134 *) dflt="$dlext" ;;
11135 esac
11136 rp='What is the extension of dynamically loaded modules'
11137 . ./myread
11138 dlext="$ans"
11139 ;;
11140*)
11141 dlext="none"
11142 ;;
11143esac
11144
11145: Check if dlsym need a leading underscore
11146echo " "
11147val="$undef"
11148
11149case "$dlsrc" in
11150dl_dlopen.xs)
11151 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11152 $cat >dyna.c <<'EOM'
11153fred () { }
11154EOM
11155
11156$cat >fred.c<<EOM
11157
11158#include <stdio.h>
55954f19
JH
11159#$i_stdlib I_STDLIB
11160#ifdef I_STDLIB
11161#include <stdlib.h>
11162#endif
b4eb6b3d
JH
11163#$i_dlfcn I_DLFCN
11164#ifdef I_DLFCN
5440bc8e 11165#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11166#else
11167#include <sys/types.h>
11168#include <nlist.h>
11169#include <link.h>
11170#endif
11171
11172extern int fred() ;
11173
11174int main()
11175{
11176 void * handle ;
11177 void * symbol ;
11178#ifndef RTLD_LAZY
11179 int mode = 1 ;
11180#else
11181 int mode = RTLD_LAZY ;
11182#endif
11183 handle = dlopen("./dyna.$dlext", mode) ;
11184 if (handle == NULL) {
11185 printf ("1\n") ;
11186 fflush (stdout) ;
11187 exit(0);
11188 }
11189 symbol = dlsym(handle, "fred") ;
11190 if (symbol == NULL) {
11191 /* try putting a leading underscore */
11192 symbol = dlsym(handle, "_fred") ;
11193 if (symbol == NULL) {
11194 printf ("2\n") ;
11195 fflush (stdout) ;
11196 exit(0);
11197 }
11198 printf ("3\n") ;
11199 }
11200 else
11201 printf ("4\n") ;
11202 fflush (stdout) ;
11203 exit(0);
11204}
11205EOM
11206 : Call the object file tmp-dyna.o in case dlext=o.
11207 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11208 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11209 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11210 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11211 xxx=`$run ./fred`
b4eb6b3d
JH
11212 case $xxx in
11213 1) echo "Test program failed using dlopen." >&4
11214 echo "Perhaps you should not use dynamic loading." >&4;;
11215 2) echo "Test program failed using dlsym." >&4
11216 echo "Perhaps you should not use dynamic loading." >&4;;
11217 3) echo "dlsym needs a leading underscore" >&4
11218 val="$define" ;;
11219 4) echo "dlsym doesn't need a leading underscore." >&4;;
11220 esac
11221 else
11222 echo "I can't compile and run the test program." >&4
11223 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11224 fi
11225 ;;
11226esac
11227
3c728e00 11228$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11229
11230set d_dlsymun
11231eval $setvar
11232
10bc17b6
JH
11233: see if drand48_r exists
11234set drand48_r d_drand48_r
11235eval $inlibc
11236case "$d_drand48_r" in
11237"$define")
11238 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11239 case "$d_drand48_r_proto:$usethreads" in
11240 ":define") d_drand48_r_proto=define
a48ec845
JH
11241 set d_drand48_r_proto drand48_r $hdrs
11242 eval $hasproto ;;
11243 *) ;;
11244 esac
11245 case "$d_drand48_r_proto" in
11246 define)
10bc17b6
JH
11247 case "$drand48_r_proto" in
11248 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11249 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11250 esac
11251 case "$drand48_r_proto" in
90e831dc 11252 ''|0) d_drand48_r=undef
10bc17b6 11253 drand48_r_proto=0
a48ec845 11254 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11255 * ) case "$drand48_r_proto" in
11256 REENTRANT_PROTO*) ;;
11257 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11258 esac
11259 echo "Prototype: $try" ;;
11260 esac
11261 ;;
c18e646a
JH
11262 *) case "$usethreads" in
11263 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11264 esac
90e831dc
SB
11265 d_drand48_r=undef
11266 drand48_r_proto=0
c18e646a 11267 ;;
a48ec845
JH
11268 esac
11269 ;;
10bc17b6
JH
11270*) drand48_r_proto=0
11271 ;;
11272esac
11273
11274: see if prototype for drand48 is available
11275echo " "
11276set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11277eval $hasproto
11278
b4eb6b3d
JH
11279: see if dup2 exists
11280set dup2 d_dup2
11281eval $inlibc
11282
11283: see if eaccess exists
11284set eaccess d_eaccess
11285eval $inlibc
11286
11287: see if endgrent exists
11288set endgrent d_endgrent
11289eval $inlibc
11290
10bc17b6
JH
11291: see if this is an grp system
11292set grp.h i_grp
11293eval $inhdr
11294
11295case "$i_grp" in
11296$define)
11297 xxx=`./findhdr grp.h`
11298 $cppstdin $cppflags $cppminus < $xxx >$$.h
11299
11300 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11301 val="$define"
11302 else
11303 val="$undef"
11304 fi
11305 set d_grpasswd
11306 eval $setvar
11307
11308 $rm -f $$.h
11309 ;;
11310*)
11311 val="$undef";
11312 set d_grpasswd; eval $setvar
11313 ;;
11314esac
11315
11316: see if endgrent_r exists
11317set endgrent_r d_endgrent_r
11318eval $inlibc
11319case "$d_endgrent_r" in
11320"$define")
11321 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11322 case "$d_endgrent_r_proto:$usethreads" in
11323 ":define") d_endgrent_r_proto=define
a48ec845
JH
11324 set d_endgrent_r_proto endgrent_r $hdrs
11325 eval $hasproto ;;
11326 *) ;;
11327 esac
11328 case "$d_endgrent_r_proto" in
11329 define)
10bc17b6
JH
11330 case "$endgrent_r_proto" in
11331 ''|0) try='int endgrent_r(FILE**);'
11332 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11333 esac
11334 case "$endgrent_r_proto" in
11335 ''|0) try='void endgrent_r(FILE**);'
11336 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11337 esac
11338 case "$endgrent_r_proto" in
90e831dc 11339 ''|0) d_endgrent_r=undef
10bc17b6 11340 endgrent_r_proto=0
a48ec845 11341 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11342 * ) case "$endgrent_r_proto" in
11343 REENTRANT_PROTO*) ;;
11344 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11345 esac
11346 echo "Prototype: $try" ;;
11347 esac
11348 ;;
c18e646a
JH
11349 *) case "$usethreads" in
11350 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11351 esac
90e831dc
SB
11352 d_endgrent_r=undef
11353 endgrent_r_proto=0
c18e646a 11354 ;;
a48ec845
JH
11355 esac
11356 ;;
10bc17b6
JH
11357*) endgrent_r_proto=0
11358 ;;
11359esac
11360
b4eb6b3d
JH
11361: see if endhostent exists
11362set endhostent d_endhent
11363eval $inlibc
11364
10bc17b6
JH
11365: see if this is a netdb.h system
11366set netdb.h i_netdb
11367eval $inhdr
11368
11369: see if endhostent_r exists
11370set endhostent_r d_endhostent_r
11371eval $inlibc
11372case "$d_endhostent_r" in
11373"$define")
11374 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11375 case "$d_endhostent_r_proto:$usethreads" in
11376 ":define") d_endhostent_r_proto=define
a48ec845
JH
11377 set d_endhostent_r_proto endhostent_r $hdrs
11378 eval $hasproto ;;
11379 *) ;;
11380 esac
11381 case "$d_endhostent_r_proto" in
11382 define)
10bc17b6
JH
11383 case "$endhostent_r_proto" in
11384 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11385 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11386 esac
11387 case "$endhostent_r_proto" in
11388 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11389 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11390 esac
11391 case "$endhostent_r_proto" in
90e831dc 11392 ''|0) d_endhostent_r=undef
10bc17b6 11393 endhostent_r_proto=0
a48ec845 11394 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11395 * ) case "$endhostent_r_proto" in
11396 REENTRANT_PROTO*) ;;
11397 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11398 esac
11399 echo "Prototype: $try" ;;
11400 esac
11401 ;;
c18e646a
JH
11402 *) case "$usethreads" in
11403 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11404 esac
90e831dc
SB
11405 d_endhostent_r=undef
11406 endhostent_r_proto=0
c18e646a 11407 ;;
a48ec845
JH
11408 esac
11409 ;;
10bc17b6
JH
11410*) endhostent_r_proto=0
11411 ;;
11412esac
11413
b4eb6b3d
JH
11414: see if endnetent exists
11415set endnetent d_endnent
11416eval $inlibc
11417
10bc17b6
JH
11418: see if endnetent_r exists
11419set endnetent_r d_endnetent_r
11420eval $inlibc
11421case "$d_endnetent_r" in
11422"$define")
11423 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11424 case "$d_endnetent_r_proto:$usethreads" in
11425 ":define") d_endnetent_r_proto=define
a48ec845
JH
11426 set d_endnetent_r_proto endnetent_r $hdrs
11427 eval $hasproto ;;
11428 *) ;;
11429 esac
11430 case "$d_endnetent_r_proto" in
11431 define)
10bc17b6
JH
11432 case "$endnetent_r_proto" in
11433 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11434 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11435 esac
11436 case "$endnetent_r_proto" in
11437 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11438 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11439 esac
11440 case "$endnetent_r_proto" in
90e831dc 11441 ''|0) d_endnetent_r=undef
10bc17b6 11442 endnetent_r_proto=0
a48ec845 11443 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11444 * ) case "$endnetent_r_proto" in
11445 REENTRANT_PROTO*) ;;
11446 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11447 esac
11448 echo "Prototype: $try" ;;
11449 esac
11450 ;;
c18e646a
JH
11451 *) case "$usethreads" in
11452 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11453 esac
90e831dc
SB
11454 d_endnetent_r=undef
11455 endnetent_r_proto=0
c18e646a 11456 ;;
a48ec845
JH
11457 esac
11458 ;;
10bc17b6
JH
11459*) endnetent_r_proto=0
11460 ;;
11461esac
11462
b4eb6b3d
JH
11463: see if endprotoent exists
11464set endprotoent d_endpent
11465eval $inlibc
11466
10bc17b6
JH
11467: see if endprotoent_r exists
11468set endprotoent_r d_endprotoent_r
11469eval $inlibc
11470case "$d_endprotoent_r" in
11471"$define")
11472 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11473 case "$d_endprotoent_r_proto:$usethreads" in
11474 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11475 set d_endprotoent_r_proto endprotoent_r $hdrs
11476 eval $hasproto ;;
11477 *) ;;
11478 esac
11479 case "$d_endprotoent_r_proto" in
11480 define)
10bc17b6
JH
11481 case "$endprotoent_r_proto" in
11482 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11483 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11484 esac
11485 case "$endprotoent_r_proto" in
11486 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11487 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11488 esac
11489 case "$endprotoent_r_proto" in
90e831dc 11490 ''|0) d_endprotoent_r=undef
10bc17b6 11491 endprotoent_r_proto=0
a48ec845 11492 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11493 * ) case "$endprotoent_r_proto" in
11494 REENTRANT_PROTO*) ;;
11495 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11496 esac
11497 echo "Prototype: $try" ;;
11498 esac
11499 ;;
c18e646a
JH
11500 *) case "$usethreads" in
11501 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11502 esac
90e831dc
SB
11503 d_endprotoent_r=undef
11504 endprotoent_r_proto=0
c18e646a 11505 ;;
a48ec845
JH
11506 esac
11507 ;;
10bc17b6
JH
11508*) endprotoent_r_proto=0
11509 ;;
11510esac
11511
b4eb6b3d
JH
11512: see if endpwent exists
11513set endpwent d_endpwent
11514eval $inlibc
11515
10bc17b6
JH
11516: see if this is a pwd.h system
11517set pwd.h i_pwd
11518eval $inhdr
11519
11520case "$i_pwd" in
11521$define)
11522 xxx=`./findhdr pwd.h`
11523 $cppstdin $cppflags $cppminus < $xxx >$$.h
11524
11525 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11526 val="$define"
11527 else
11528 val="$undef"
11529 fi
11530 set d_pwquota
11531 eval $setvar
11532
11533 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11534 val="$define"
11535 else
11536 val="$undef"
11537 fi
11538 set d_pwage
11539 eval $setvar
11540
11541 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11542 val="$define"
11543 else
11544 val="$undef"
11545 fi
11546 set d_pwchange
11547 eval $setvar
11548
11549 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11550 val="$define"
11551 else
11552 val="$undef"
11553 fi
11554 set d_pwclass
11555 eval $setvar
11556
11557 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11558 val="$define"
11559 else
11560 val="$undef"
11561 fi
11562 set d_pwexpire
11563 eval $setvar
11564
11565 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11566 val="$define"
11567 else
11568 val="$undef"
11569 fi
11570 set d_pwcomment
11571 eval $setvar
11572
11573 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11574 val="$define"
11575 else
11576 val="$undef"
11577 fi
11578 set d_pwgecos
11579 eval $setvar
11580
11581 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11582 val="$define"
11583 else
11584 val="$undef"
11585 fi
11586 set d_pwpasswd
11587 eval $setvar
11588
11589 $rm -f $$.h
11590 ;;
11591*)
11592 val="$undef";
11593 set d_pwquota; eval $setvar
11594 set d_pwage; eval $setvar
11595 set d_pwchange; eval $setvar
11596 set d_pwclass; eval $setvar
11597 set d_pwexpire; eval $setvar
11598 set d_pwcomment; eval $setvar
11599 set d_pwgecos; eval $setvar
11600 set d_pwpasswd; eval $setvar
11601 ;;
11602esac
11603
11604: see if endpwent_r exists
11605set endpwent_r d_endpwent_r
11606eval $inlibc
11607case "$d_endpwent_r" in
11608"$define")
11609 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
11610 case "$d_endpwent_r_proto:$usethreads" in
11611 ":define") d_endpwent_r_proto=define
a48ec845
JH
11612 set d_endpwent_r_proto endpwent_r $hdrs
11613 eval $hasproto ;;
11614 *) ;;
11615 esac
11616 case "$d_endpwent_r_proto" in
11617 define)
10bc17b6
JH
11618 case "$endpwent_r_proto" in
11619 ''|0) try='int endpwent_r(FILE**);'
11620 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11621 esac
11622 case "$endpwent_r_proto" in
11623 ''|0) try='void endpwent_r(FILE**);'
11624 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11625 esac
11626 case "$endpwent_r_proto" in
90e831dc 11627 ''|0) d_endpwent_r=undef
10bc17b6 11628 endpwent_r_proto=0
a48ec845 11629 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11630 * ) case "$endpwent_r_proto" in
11631 REENTRANT_PROTO*) ;;
11632 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11633 esac
11634 echo "Prototype: $try" ;;
11635 esac
11636 ;;
c18e646a
JH
11637 *) case "$usethreads" in
11638 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11639 esac
90e831dc
SB
11640 d_endpwent_r=undef
11641 endpwent_r_proto=0
c18e646a 11642 ;;
a48ec845
JH
11643 esac
11644 ;;
10bc17b6
JH
11645*) endpwent_r_proto=0
11646 ;;
11647esac
11648
b4eb6b3d
JH
11649: see if endservent exists
11650set endservent d_endsent
11651eval $inlibc
11652
10bc17b6
JH
11653: see if endservent_r exists
11654set endservent_r d_endservent_r
11655eval $inlibc
11656case "$d_endservent_r" in
11657"$define")
11658 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11659 case "$d_endservent_r_proto:$usethreads" in
11660 ":define") d_endservent_r_proto=define
a48ec845
JH
11661 set d_endservent_r_proto endservent_r $hdrs
11662 eval $hasproto ;;
11663 *) ;;
11664 esac
11665 case "$d_endservent_r_proto" in
11666 define)
10bc17b6
JH
11667 case "$endservent_r_proto" in
11668 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 11669 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
11670 esac
11671 case "$endservent_r_proto" in
11672 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 11673 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
11674 esac
11675 case "$endservent_r_proto" in
90e831dc 11676 ''|0) d_endservent_r=undef
10bc17b6 11677 endservent_r_proto=0
a48ec845 11678 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11679 * ) case "$endservent_r_proto" in
11680 REENTRANT_PROTO*) ;;
11681 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11682 esac
11683 echo "Prototype: $try" ;;
11684 esac
11685 ;;
c18e646a
JH
11686 *) case "$usethreads" in
11687 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11688 esac
90e831dc
SB
11689 d_endservent_r=undef
11690 endservent_r_proto=0
c18e646a 11691 ;;
a48ec845
JH
11692 esac
11693 ;;
10bc17b6
JH
11694*) endservent_r_proto=0
11695 ;;
11696esac
11697
b4eb6b3d
JH
11698: Locate the flags for 'open()'
11699echo " "
55954f19 11700$cat >try.c <<EOCP
b4eb6b3d
JH
11701#include <sys/types.h>
11702#ifdef I_FCNTL
11703#include <fcntl.h>
11704#endif
11705#ifdef I_SYS_FILE
11706#include <sys/file.h>
11707#endif
55954f19
JH
11708#$i_stdlib I_STDLIB
11709#ifdef I_STDLIB
11710#include <stdlib.h>
11711#endif
b4eb6b3d
JH
11712int main() {
11713 if(O_RDONLY);
11714#ifdef O_TRUNC
11715 exit(0);
11716#else
11717 exit(1);
11718#endif
11719}
11720EOCP
11721: check sys/file.h first to get FREAD on Sun
11722if $test `./findhdr sys/file.h` && \
5440bc8e 11723 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
11724 h_sysfile=true;
11725 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 11726 if $run ./try; then
b4eb6b3d
JH
11727 echo "and you have the 3 argument form of open()." >&4
11728 val="$define"
11729 else
11730 echo "but not the 3 argument form of open(). Oh, well." >&4
11731 val="$undef"
11732 fi
11733elif $test `./findhdr fcntl.h` && \
5440bc8e 11734 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
11735 h_fcntl=true;
11736 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 11737 if $run ./try; then
b4eb6b3d
JH
11738 echo "and you have the 3 argument form of open()." >&4
11739 val="$define"
11740 else
11741 echo "but not the 3 argument form of open(). Oh, well." >&4
11742 val="$undef"
11743 fi
11744else
11745 val="$undef"
11746 echo "I can't find the O_* constant definitions! You got problems." >&4
11747fi
11748set d_open3
11749eval $setvar
5440bc8e 11750$rm -f try try.*
b4eb6b3d
JH
11751
11752: see which of string.h or strings.h is needed
11753echo " "
11754strings=`./findhdr string.h`
11755if $test "$strings" && $test -r "$strings"; then
11756 echo "Using <string.h> instead of <strings.h>." >&4
11757 val="$define"
11758else
11759 val="$undef"
11760 strings=`./findhdr strings.h`
11761 if $test "$strings" && $test -r "$strings"; then
11762 echo "Using <strings.h> instead of <string.h>." >&4
11763 else
11764 echo "No string header found -- You'll surely have problems." >&4
11765 fi
11766fi
11767set i_string
11768eval $setvar
11769case "$i_string" in
11770"$undef") strings=`./findhdr strings.h`;;
11771*) strings=`./findhdr string.h`;;
11772esac
11773
3c728e00
JH
11774: see if this is a sys/file.h system
11775val=''
11776set sys/file.h val
11777eval $inhdr
11778
11779: do we need to include sys/file.h ?
11780case "$val" in
11781"$define")
11782 echo " "
11783 if $h_sysfile; then
11784 val="$define"
11785 echo "We'll be including <sys/file.h>." >&4
11786 else
11787 val="$undef"
11788 echo "We won't be including <sys/file.h>." >&4
11789 fi
11790 ;;
11791*)
11792 h_sysfile=false
11793 ;;
11794esac
11795set i_sysfile
11796eval $setvar
11797
11798: see if fcntl.h is there
11799val=''
11800set fcntl.h val
11801eval $inhdr
11802
11803: see if we can include fcntl.h
11804case "$val" in
11805"$define")
11806 echo " "
11807 if $h_fcntl; then
11808 val="$define"
11809 echo "We'll be including <fcntl.h>." >&4
11810 else
11811 val="$undef"
11812 if $h_sysfile; then
11813 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11814 else
11815 echo "We won't be including <fcntl.h>." >&4
11816 fi
11817 fi
11818 ;;
11819*)
11820 h_fcntl=false
11821 val="$undef"
11822 ;;
11823esac
11824set i_fcntl
11825eval $setvar
11826
b4eb6b3d
JH
11827: check for non-blocking I/O stuff
11828case "$h_sysfile" in
a0acbdc3
JH
11829true) echo "#include <sys/file.h>" > head.c;;
11830*)
11831 case "$h_fcntl" in
11832 true) echo "#include <fcntl.h>" > head.c;;
11833 *) echo "#include <sys/fcntl.h>" > head.c;;
11834 esac
11835 ;;
b4eb6b3d
JH
11836esac
11837echo " "
11838echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11839case "$o_nonblock" in
11840'')
11841 $cat head.c > try.c
3c728e00 11842 $cat >>try.c <<EOCP
b4eb6b3d 11843#include <stdio.h>
55954f19
JH
11844#$i_stdlib I_STDLIB
11845#ifdef I_STDLIB
80b3ef99 11846#include <stdlib.h>
55954f19 11847#endif
3c728e00
JH
11848#$i_fcntl I_FCNTL
11849#ifdef I_FCNTL
11850#include <fcntl.h>
11851#endif
b4eb6b3d
JH
11852int main() {
11853#ifdef O_NONBLOCK
11854 printf("O_NONBLOCK\n");
11855 exit(0);
11856#endif
11857#ifdef O_NDELAY
11858 printf("O_NDELAY\n");
11859 exit(0);
11860#endif
11861#ifdef FNDELAY
11862 printf("FNDELAY\n");
11863 exit(0);
11864#endif
11865 exit(0);
11866}
11867EOCP
11868 set try
11869 if eval $compile_ok; then
5440bc8e 11870 o_nonblock=`$run ./try`
b4eb6b3d
JH
11871 case "$o_nonblock" in
11872 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11873 *) echo "Seems like we can use $o_nonblock.";;
11874 esac
11875 else
11876 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11877 fi
11878 ;;
11879*) echo "Using $hint value $o_nonblock.";;
11880esac
11881$rm -f try try.* .out core
11882
11883echo " "
11884echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11885case "$eagain" in
11886'')
11887 $cat head.c > try.c
11888 $cat >>try.c <<EOCP
11889#include <errno.h>
11890#include <sys/types.h>
11891#include <signal.h>
11892#include <stdio.h>
55954f19
JH
11893#$i_stdlib I_STDLIB
11894#ifdef I_STDLIB
11895#include <stdlib.h>
11896#endif
1deb0a86
JH
11897#$i_fcntl I_FCNTL
11898#ifdef I_FCNTL
11899#include <fcntl.h>
11900#endif
b4eb6b3d
JH
11901#define MY_O_NONBLOCK $o_nonblock
11902#ifndef errno /* XXX need better Configure test */
11903extern int errno;
11904#endif
11905#$i_unistd I_UNISTD
11906#ifdef I_UNISTD
11907#include <unistd.h>
11908#endif
11909#$i_string I_STRING
11910#ifdef I_STRING
11911#include <string.h>
11912#else
11913#include <strings.h>
11914#endif
11915$signal_t blech(x) int x; { exit(3); }
11916EOCP
11917 $cat >> try.c <<'EOCP'
11918int main()
11919{
11920 int pd[2];
11921 int pu[2];
11922 char buf[1];
11923 char string[100];
11924
11925 pipe(pd); /* Down: child -> parent */
11926 pipe(pu); /* Up: parent -> child */
11927 if (0 != fork()) {
11928 int ret;
11929 close(pd[1]); /* Parent reads from pd[0] */
11930 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 11931#ifdef F_SETFL
b4eb6b3d
JH
11932 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11933 exit(1);
a0acbdc3
JH
11934#else
11935 exit(4);
11936#endif
b4eb6b3d
JH
11937 signal(SIGALRM, blech);
11938 alarm(5);
11939 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
11940 exit(2);
11941 sprintf(string, "%d\n", ret);
11942 write(2, string, strlen(string));
11943 alarm(0);
11944#ifdef EAGAIN
11945 if (errno == EAGAIN) {
11946 printf("EAGAIN\n");
11947 goto ok;
11948 }
11949#endif
11950#ifdef EWOULDBLOCK
11951 if (errno == EWOULDBLOCK)
11952 printf("EWOULDBLOCK\n");
11953#endif
11954 ok:
11955 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
11956 sleep(2); /* Give it time to close our pipe */
11957 alarm(5);
11958 ret = read(pd[0], buf, 1); /* Should read EOF */
11959 alarm(0);
11960 sprintf(string, "%d\n", ret);
868439a2 11961 write(4, string, strlen(string));
b4eb6b3d
JH
11962 exit(0);
11963 }
11964
11965 close(pd[0]); /* We write to pd[1] */
11966 close(pu[1]); /* We read from pu[0] */
11967 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
11968 close(pd[1]); /* Pipe pd is now fully closed! */
11969 exit(0); /* Bye bye, thank you for playing! */
11970}
11971EOCP
11972 set try
11973 if eval $compile_ok; then
11974 echo "$startsh" >mtry
868439a2 11975 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
11976 chmod +x mtry
11977 ./mtry >/dev/null 2>&1
11978 case $? in
11979 0) eagain=`$cat try.out`;;
11980 1) echo "Could not perform non-blocking setting!";;
11981 2) echo "I did a successful read() for something that was not there!";;
11982 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 11983 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
11984 *) echo "Something terribly wrong happened during testing.";;
11985 esac
11986 rd_nodata=`$cat try.ret`
11987 echo "A read() system call with no data present returns $rd_nodata."
11988 case "$rd_nodata" in
11989 0|-1) ;;
11990 *)
11991 echo "(That's peculiar, fixing that to be -1.)"
11992 rd_nodata=-1
11993 ;;
11994 esac
11995 case "$eagain" in
11996 '')
11997 echo "Forcing errno EAGAIN on read() with no data available."
11998 eagain=EAGAIN
11999 ;;
12000 *)
12001 echo "Your read() sets errno to $eagain when no data is available."
12002 ;;
12003 esac
12004 status=`$cat try.err`
12005 case "$status" in
12006 0) echo "And it correctly returns 0 to signal EOF.";;
12007 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12008 *) echo "However, your read() returns '$status' on EOF??";;
12009 esac
12010 val="$define"
12011 if test "$status" = "$rd_nodata"; then
12012 echo "WARNING: you can't distinguish between EOF and no data!"
12013 val="$undef"
12014 fi
12015 else
12016 echo "I can't compile the test program--assuming errno EAGAIN will do."
12017 eagain=EAGAIN
12018 fi
12019 set d_eofnblk
12020 eval $setvar
12021 ;;
12022*)
12023 echo "Using $hint value $eagain."
12024 echo "Your read() returns $rd_nodata when no data is present."
12025 case "$d_eofnblk" in
12026 "$define") echo "And you can see EOF because read() returns 0.";;
12027 "$undef") echo "But you can't see EOF status from read() returned value.";;
12028 *)
12029 echo "(Assuming you can't see EOF status from read anyway.)"
12030 d_eofnblk=$undef
12031 ;;
12032 esac
12033 ;;
12034esac
12035$rm -f try try.* .out core head.c mtry
12036
15b61c98
JH
12037: see if _ptr and _cnt from stdio act std
12038echo " "
b4eb6b3d 12039
15b61c98
JH
12040if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12041 echo "(Looks like you have stdio.h from BSD.)"
12042 case "$stdio_ptr" in
12043 '') stdio_ptr='((fp)->_p)'
12044 ptr_lval=$define
12045 ;;
12046 *) ptr_lval=$d_stdio_ptr_lval;;
12047 esac
12048 case "$stdio_cnt" in
12049 '') stdio_cnt='((fp)->_r)'
12050 cnt_lval=$define
12051 ;;
12052 *) cnt_lval=$d_stdio_cnt_lval;;
12053 esac
12054 case "$stdio_base" in
12055 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12056 esac
12057 case "$stdio_bufsiz" in
12058 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12059 esac
12060elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12061 echo "(Looks like you have stdio.h from Linux.)"
12062 case "$stdio_ptr" in
12063 '') stdio_ptr='((fp)->_IO_read_ptr)'
12064 ptr_lval=$define
12065 ;;
12066 *) ptr_lval=$d_stdio_ptr_lval;;
12067 esac
12068 case "$stdio_cnt" in
12069 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12070 cnt_lval=$undef
12071 ;;
12072 *) cnt_lval=$d_stdio_cnt_lval;;
12073 esac
12074 case "$stdio_base" in
12075 '') stdio_base='((fp)->_IO_read_base)';;
12076 esac
12077 case "$stdio_bufsiz" in
12078 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12079 esac
12080else
12081 case "$stdio_ptr" in
12082 '') stdio_ptr='((fp)->_ptr)'
12083 ptr_lval=$define
12084 ;;
12085 *) ptr_lval=$d_stdio_ptr_lval;;
12086 esac
12087 case "$stdio_cnt" in
12088 '') stdio_cnt='((fp)->_cnt)'
12089 cnt_lval=$define
12090 ;;
12091 *) cnt_lval=$d_stdio_cnt_lval;;
12092 esac
12093 case "$stdio_base" in
12094 '') stdio_base='((fp)->_base)';;
12095 esac
12096 case "$stdio_bufsiz" in
12097 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12098 esac
12099fi
b4eb6b3d 12100
15b61c98
JH
12101: test whether _ptr and _cnt really work
12102echo "Checking how std your stdio is..." >&4
12103$cat >try.c <<EOP
12104#include <stdio.h>
55954f19
JH
12105#$i_stdlib I_STDLIB
12106#ifdef I_STDLIB
9d9004a9 12107#include <stdlib.h>
55954f19 12108#endif
15b61c98
JH
12109#define FILE_ptr(fp) $stdio_ptr
12110#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12111int main() {
15b61c98
JH
12112 FILE *fp = fopen("try.c", "r");
12113 char c = getc(fp);
12114 if (
12115 18 <= FILE_cnt(fp) &&
12116 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12117 )
12118 exit(0);
12119 exit(1);
9d9004a9 12120}
15b61c98
JH
12121EOP
12122val="$undef"
12123set try
12124if eval $compile && $to try.c; then
12125 if $run ./try; then
12126 echo "Your stdio acts pretty std."
12127 val="$define"
9d9004a9 12128 else
15b61c98 12129 echo "Your stdio isn't very std."
9d9004a9 12130 fi
15b61c98
JH
12131else
12132 echo "Your stdio doesn't appear very std."
12133fi
12134$rm -f try.c try
12135
12136# glibc 2.2.90 and above apparently change stdio streams so Perl's
12137# direct buffer manipulation no longer works. The Configure tests
12138# should be changed to correctly detect this, but until then,
12139# the following check should at least let perl compile and run.
12140# (This quick fix should be updated before 5.8.1.)
12141# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12142# A. Dougherty, June 3, 2002.
12143case "$d_gnulibc" in
12144$define)
12145 case "$gnulibc_version" in
12146 2.[01]*) ;;
12147 2.2) ;;
12148 2.2.[0-9]) ;;
12149 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12150 val="$undef"
12151 ;;
12152 esac
9d9004a9
AD
12153 ;;
12154esac
15b61c98 12155set d_stdstdio
9d9004a9 12156eval $setvar
9d9004a9 12157
15b61c98
JH
12158: Can _ptr be used as an lvalue?
12159case "$d_stdstdio$ptr_lval" in
12160$define$define) val=$define ;;
12161*) val=$undef ;;
12162esac
12163set d_stdio_ptr_lval
12164eval $setvar
9d9004a9 12165
15b61c98
JH
12166: Can _cnt be used as an lvalue?
12167case "$d_stdstdio$cnt_lval" in
12168$define$define) val=$define ;;
12169*) val=$undef ;;
12170esac
12171set d_stdio_cnt_lval
12172eval $setvar
b4eb6b3d 12173
15b61c98
JH
12174
12175: test whether setting _ptr sets _cnt as a side effect
12176d_stdio_ptr_lval_sets_cnt="$undef"
12177d_stdio_ptr_lval_nochange_cnt="$undef"
12178case "$d_stdio_ptr_lval$d_stdstdio" in
12179$define$define)
12180 echo "Checking to see what happens if we set the stdio ptr..." >&4
12181$cat >try.c <<EOP
12182#include <stdio.h>
12183/* Can we scream? */
12184/* Eat dust sed :-) */
12185/* In the buffer space, no one can hear you scream. */
55954f19
JH
12186#$i_stdlib I_STDLIB
12187#ifdef I_STDLIB
12188#include <stdlib.h>
12189#endif
15b61c98
JH
12190#define FILE_ptr(fp) $stdio_ptr
12191#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12192#include <sys/types.h>
b4eb6b3d 12193int main() {
15b61c98
JH
12194 FILE *fp = fopen("try.c", "r");
12195 int c;
12196 char *ptr;
12197 size_t cnt;
12198 if (!fp) {
12199 puts("Fail even to read");
12200 exit(1);
12201 }
12202 c = getc(fp); /* Read away the first # */
12203 if (c == EOF) {
12204 puts("Fail even to read");
12205 exit(1);
12206 }
12207 if (!(
12208 18 <= FILE_cnt(fp) &&
12209 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12210 )) {
12211 puts("Fail even to read");
12212 exit (1);
12213 }
12214 ptr = (char*) FILE_ptr(fp);
12215 cnt = (size_t)FILE_cnt(fp);
12216
12217 FILE_ptr(fp) += 42;
12218
12219 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12220 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12221 exit (1);
12222 }
12223 if (FILE_cnt(fp) <= 20) {
12224 printf ("Fail (<20 chars to test)");
12225 exit (1);
12226 }
12227 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12228 puts("Fail compare");
12229 exit (1);
12230 }
12231 if (cnt == FILE_cnt(fp)) {
12232 puts("Pass_unchanged");
12233 exit (0);
12234 }
12235 if (FILE_cnt(fp) == (cnt - 42)) {
12236 puts("Pass_changed");
12237 exit (0);
12238 }
12239 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12240 return 1;
12241
12242}
12243EOP
12244 set try
12245 if eval $compile && $to try.c; then
12246 case `$run ./try` in
12247 Pass_changed)
12248 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12249 d_stdio_ptr_lval_sets_cnt="$define" ;;
12250 Pass_unchanged)
12251 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12252 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12253 Fail*)
12254 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12255 *)
12256 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12257 esac
12258 else
12259 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12260 fi
12261 $rm -f try.c try
12262 ;;
12263esac
12264
12265: see if _base is also standard
12266val="$undef"
12267case "$d_stdstdio" in
12268$define)
12269 $cat >try.c <<EOP
12270#include <stdio.h>
12271#$i_stdlib I_STDLIB
12272#ifdef I_STDLIB
12273#include <stdlib.h>
12274#endif
12275#define FILE_base(fp) $stdio_base
12276#define FILE_bufsiz(fp) $stdio_bufsiz
12277int main() {
12278 FILE *fp = fopen("try.c", "r");
12279 char c = getc(fp);
12280 if (
12281 19 <= FILE_bufsiz(fp) &&
12282 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12283 )
12284 exit(0);
12285 exit(1);
12286}
12287EOP
12288 set try
12289 if eval $compile && $to try.c; then
12290 if $run ./try; then
12291 echo "And its _base field acts std."
12292 val="$define"
12293 else
12294 echo "But its _base field isn't std."
12295 fi
12296 else
12297 echo "However, it seems to be lacking the _base field."
12298 fi
12299 $rm -f try.c try
12300 ;;
12301esac
12302set d_stdiobase
12303eval $setvar
12304
12305: see if fast_stdio exists
12306val="$undef"
12307case "$d_stdstdio:$d_stdio_ptr_lval" in
12308"$define:$define")
12309 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12310 *$define*)
12311 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12312 val="$define"
12313 ;;
12314 esac
12315 ;;
12316esac
12317set d_faststdio
12318eval $setvar
12319
12320
12321
12322: see if fchdir exists
12323set fchdir d_fchdir
12324eval $inlibc
12325
12326: see if fchmod exists
12327set fchmod d_fchmod
12328eval $inlibc
12329
12330: see if fchown exists
12331set fchown d_fchown
12332eval $inlibc
12333
12334: see if this is an fcntl system
12335set fcntl d_fcntl
12336eval $inlibc
12337
12338echo " "
12339: See if fcntl-based locking works.
12340$cat >try.c <<EOCP
12341#$i_stdlib I_STDLIB
12342#ifdef I_STDLIB
12343#include <stdlib.h>
12344#endif
12345#include <unistd.h>
12346#include <fcntl.h>
12347#include <signal.h>
12348$signal_t blech(x) int x; { exit(3); }
12349int main() {
12350#if defined(F_SETLK) && defined(F_SETLKW)
12351 struct flock flock;
12352 int retval, fd;
12353 fd = open("try.c", O_RDONLY);
12354 flock.l_type = F_RDLCK;
12355 flock.l_whence = SEEK_SET;
12356 flock.l_start = flock.l_len = 0;
12357 signal(SIGALRM, blech);
12358 alarm(10);
12359 retval = fcntl(fd, F_SETLK, &flock);
12360 close(fd);
12361 (retval < 0 ? exit(2) : exit(0));
12362#else
12363 exit(2);
12364#endif
12365}
12366EOCP
12367echo "Checking if fcntl-based file locking works... "
12368case "$d_fcntl" in
12369"$define")
12370 set try
12371 if eval $compile_ok; then
12372 if $run ./try; then
12373 echo "Yes, it seems to work."
12374 val="$define"
12375 else
12376 echo "Nope, it didn't work."
12377 val="$undef"
12378 case "$?" in
12379 3) $cat >&4 <<EOM
12380***
12381*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12382*** This is (almost) impossible.
12383*** If your NFS lock daemons are not feeling well, something like
12384*** this may happen, please investigate. Cannot continue, aborting.
12385***
12386EOM
12387 exit 1
12388 ;;
12389 esac
12390 fi
12391 else
12392 echo "I'm unable to compile the test program, so I'll assume not."
12393 val="$undef"
12394 fi
12395 ;;
12396*) val="$undef";
12397 echo "Nope, since you don't even have fcntl()."
12398 ;;
12399esac
12400set d_fcntl_can_lock
12401eval $setvar
12402$rm -f try*
12403
12404
12405: check for fd_set items
12406$cat <<EOM
12407
12408Checking to see how well your C compiler handles fd_set and friends ...
12409EOM
12410$cat >try.c <<EOCP
12411#$i_stdlib I_STDLIB
12412#ifdef I_STDLIB
12413#include <stdlib.h>
12414#endif
12415#$i_systime I_SYS_TIME
12416#$i_sysselct I_SYS_SELECT
12417#$d_socket HAS_SOCKET
12418#include <sys/types.h>
12419#ifdef HAS_SOCKET
12420#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12421#endif
12422#ifdef I_SYS_TIME
12423#include <sys/time.h>
12424#endif
12425#ifdef I_SYS_SELECT
12426#include <sys/select.h>
12427#endif
12428int main() {
12429 fd_set fds;
12430
12431#ifdef TRYBITS
12432 if(fds.fds_bits);
12433#endif
12434
12435#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12436 exit(0);
12437#else
12438 exit(1);
12439#endif
12440}
12441EOCP
12442set try -DTRYBITS
12443if eval $compile; then
12444 d_fds_bits="$define"
12445 d_fd_set="$define"
12446 echo "Well, your system knows about the normal fd_set typedef..." >&4
12447 if $run ./try; then
b4eb6b3d
JH
12448 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12449 d_fd_macros="$define"
12450 else
12451 $cat >&4 <<'EOM'
12452but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12453EOM
12454 d_fd_macros="$undef"
12455 fi
12456else
12457 $cat <<'EOM'
12458Hmm, your compiler has some difficulty with fd_set. Checking further...
12459EOM
5440bc8e 12460 set try
b4eb6b3d
JH
12461 if eval $compile; then
12462 d_fds_bits="$undef"
12463 d_fd_set="$define"
12464 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12465 if $run ./try; then
b4eb6b3d
JH
12466 echo "and you have the normal fd_set macros." >&4
12467 d_fd_macros="$define"
12468 else
12469 $cat <<'EOM'
12470but not the normal fd_set macros! Gross! More work for me...
12471EOM
12472 d_fd_macros="$undef"
12473 fi
12474 else
12475 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12476 d_fd_set="$undef"
12477 d_fds_bits="$undef"
12478 d_fd_macros="$undef"
12479 fi
12480fi
5440bc8e 12481$rm -f try try.*
b4eb6b3d
JH
12482
12483: see if fgetpos exists
12484set fgetpos d_fgetpos
12485eval $inlibc
12486
758a5d79
JH
12487: see if finite exists
12488set finite d_finite
12489eval $inlibc
12490
12491: see if finitel exists
12492set finitel d_finitel
12493eval $inlibc
12494
b4eb6b3d
JH
12495: see if flock exists
12496set flock d_flock
12497eval $inlibc
12498
2ef53570
JH
12499: see if prototype for flock is available
12500echo " "
12501set d_flockproto flock $i_sysfile sys/file.h
12502eval $hasproto
12503
b4eb6b3d
JH
12504: see if fork exists
12505set fork d_fork
12506eval $inlibc
12507
758a5d79
JH
12508: see if fp_class exists
12509set fp_class d_fp_class
12510eval $inlibc
12511
b4eb6b3d
JH
12512: see if pathconf exists
12513set pathconf d_pathconf
12514eval $inlibc
12515
12516: see if fpathconf exists
12517set fpathconf d_fpathconf
12518eval $inlibc
12519
758a5d79
JH
12520: see if fpclass exists
12521set fpclass d_fpclass
12522eval $inlibc
12523
12524: see if fpclassify exists
12525set fpclassify d_fpclassify
12526eval $inlibc
12527
12528: see if fpclassl exists
12529set fpclassl d_fpclassl
12530eval $inlibc
12531
b4eb6b3d
JH
12532
12533: check for fpos64_t
12534echo " "
12535echo "Checking to see if you have fpos64_t..." >&4
12536$cat >try.c <<EOCP
12537#include <stdio.h>
12538int main() { fpos64_t x = 7; }
12539EOCP
12540set try
12541if eval $compile; then
12542 val="$define"
12543 echo "You have fpos64_t."
12544else
12545 val="$undef"
12546 echo "You do not have fpos64_t."
12547 case "$fpossize" in
12548 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12549 esac
12550fi
12551$rm -f try.* try
12552set d_fpos64_t
12553eval $setvar
12554
12555: see if frexpl exists
12556set frexpl d_frexpl
12557eval $inlibc
12558
b4eb6b3d
JH
12559: see if this is a sys/param system
12560set sys/param.h i_sysparam
12561eval $inhdr
12562
12563: see if this is a sys/mount.h system
12564set sys/mount.h i_sysmount
12565eval $inhdr
12566
b4eb6b3d
JH
12567
12568echo " "
12569echo "Checking to see if your system supports struct fs_data..." >&4
12570set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12571eval $hasstruct
12572case "$d_fs_data_s" in
12573"$define") echo "Yes, it does." ;;
12574*) echo "No, it doesn't." ;;
12575esac
12576
12577: see if fseeko exists
12578set fseeko d_fseeko
12579eval $inlibc
12580case "$longsize" in
125818) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12582esac
12583
12584: see if fsetpos exists
12585set fsetpos d_fsetpos
12586eval $inlibc
12587
12588
12589: see if fstatfs exists
12590set fstatfs d_fstatfs
12591eval $inlibc
12592
12593
12594: see if statvfs exists
12595set statvfs d_statvfs
12596eval $inlibc
12597
12598: see if fstatvfs exists
12599set fstatvfs d_fstatvfs
12600eval $inlibc
12601
12602
411ab01c
JH
12603: see if fsync exists
12604set fsync d_fsync
12605eval $inlibc
12606
b4eb6b3d
JH
12607: see if ftello exists
12608set ftello d_ftello
12609eval $inlibc
12610case "$longsize" in
126118) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12612esac
12613
bff98e24
SP
12614d_futimes="$undef"
12615: check for a working futimes
12616echo " "
12617echo "Checking for a working futimes()" >&4
12618$cat >try.c <<EOCP
12619#include <stdio.h>
12620#include <sys/time.h>
12621#include <errno.h>
12622#include <fcntl.h>
12623
12624int main ()
12625{
12626 int fd, rv;
12627 fd = open ("try.c", O_RDWR);
12628 if (-1 == fd) exit (1);
12629 rv = futimes (fd, NULL);
12630 exit (rv == -1 ? errno : 0);
12631}
12632EOCP
12633set try
12634if eval $compile; then
12635 `$run ./try`
12636 rc=$?
12637 case "$rc" in
12638 0) echo "Yes, it does" >&4
12639 d_futimes="$define"
12640 ;;
12641 *) echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12642 ;;
12643 esac
12644else
12645 echo "No, it does not (probably harmless)\n" >&4
12646fi
12647$rm -f try.* try core core.try.*
dc814df1 12648
b4eb6b3d
JH
12649: see if getcwd exists
12650set getcwd d_getcwd
12651eval $inlibc
12652
12653: see if getespwnam exists
12654set getespwnam d_getespwnam
12655eval $inlibc
12656
12657
12658: see if getfsstat exists
12659set getfsstat d_getfsstat
12660eval $inlibc
12661
12662: see if getgrent exists
12663set getgrent d_getgrent
12664eval $inlibc
12665
10bc17b6
JH
12666: see if getgrent_r exists
12667set getgrent_r d_getgrent_r
12668eval $inlibc
12669case "$d_getgrent_r" in
12670"$define")
12671 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12672 case "$d_getgrent_r_proto:$usethreads" in
12673 ":define") d_getgrent_r_proto=define
a48ec845
JH
12674 set d_getgrent_r_proto getgrent_r $hdrs
12675 eval $hasproto ;;
12676 *) ;;
12677 esac
12678 case "$d_getgrent_r_proto" in
12679 define)
10bc17b6
JH
12680 case "$getgrent_r_proto" in
12681 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12682 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12683 esac
12684 case "$getgrent_r_proto" in
12685 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12686 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12687 esac
12688 case "$getgrent_r_proto" in
12689 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12690 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12691 esac
12692 case "$getgrent_r_proto" in
12693 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12694 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12695 esac
12696 case "$getgrent_r_proto" in
12697 ''|0) try='int getgrent_r(struct group*, char*, int);'
12698 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12699 esac
12700 case "$getgrent_r_proto" in
12701 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12702 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12703 esac
12704 case "$getgrent_r_proto" in
90e831dc 12705 ''|0) d_getgrent_r=undef
10bc17b6 12706 getgrent_r_proto=0
a48ec845 12707 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12708 * ) case "$getgrent_r_proto" in
12709 REENTRANT_PROTO*) ;;
12710 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12711 esac
12712 echo "Prototype: $try" ;;
12713 esac
12714 ;;
c18e646a
JH
12715 *) case "$usethreads" in
12716 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12717 esac
90e831dc
SB
12718 d_getgrent_r=undef
12719 getgrent_r_proto=0
c18e646a 12720 ;;
a48ec845
JH
12721 esac
12722 ;;
10bc17b6
JH
12723*) getgrent_r_proto=0
12724 ;;
12725esac
12726
12727: see if getgrgid_r exists
12728set getgrgid_r d_getgrgid_r
12729eval $inlibc
12730case "$d_getgrgid_r" in
12731"$define")
12732 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12733 case "$d_getgrgid_r_proto:$usethreads" in
12734 ":define") d_getgrgid_r_proto=define
a48ec845
JH
12735 set d_getgrgid_r_proto getgrgid_r $hdrs
12736 eval $hasproto ;;
12737 *) ;;
12738 esac
12739 case "$d_getgrgid_r_proto" in
12740 define)
10bc17b6
JH
12741 case "$getgrgid_r_proto" in
12742 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12743 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12744 esac
12745 case "$getgrgid_r_proto" in
12746 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12747 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12748 esac
12749 case "$getgrgid_r_proto" in
12750 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12751 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12752 esac
12753 case "$getgrgid_r_proto" in
12754 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12755 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12756 esac
12757 case "$getgrgid_r_proto" in
90e831dc 12758 ''|0) d_getgrgid_r=undef
10bc17b6 12759 getgrgid_r_proto=0
a48ec845 12760 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12761 * ) case "$getgrgid_r_proto" in
12762 REENTRANT_PROTO*) ;;
12763 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12764 esac
12765 echo "Prototype: $try" ;;
12766 esac
12767 ;;
c18e646a
JH
12768 *) case "$usethreads" in
12769 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12770 esac
90e831dc
SB
12771 d_getgrgid_r=undef
12772 getgrgid_r_proto=0
c18e646a 12773 ;;
a48ec845
JH
12774 esac
12775 ;;
10bc17b6
JH
12776*) getgrgid_r_proto=0
12777 ;;
12778esac
12779
12780: see if getgrnam_r exists
12781set getgrnam_r d_getgrnam_r
12782eval $inlibc
12783case "$d_getgrnam_r" in
12784"$define")
12785 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12786 case "$d_getgrnam_r_proto:$usethreads" in
12787 ":define") d_getgrnam_r_proto=define
a48ec845
JH
12788 set d_getgrnam_r_proto getgrnam_r $hdrs
12789 eval $hasproto ;;
12790 *) ;;
12791 esac
12792 case "$d_getgrnam_r_proto" in
12793 define)
10bc17b6
JH
12794 case "$getgrnam_r_proto" in
12795 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12796 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12797 esac
12798 case "$getgrnam_r_proto" in
12799 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12800 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12801 esac
12802 case "$getgrnam_r_proto" in
12803 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12804 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12805 esac
12806 case "$getgrnam_r_proto" in
12807 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12808 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12809 esac
12810 case "$getgrnam_r_proto" in
12811 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12812 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12813 esac
12814 case "$getgrnam_r_proto" in
90e831dc 12815 ''|0) d_getgrnam_r=undef
10bc17b6 12816 getgrnam_r_proto=0
a48ec845 12817 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12818 * ) case "$getgrnam_r_proto" in
12819 REENTRANT_PROTO*) ;;
12820 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12821 esac
12822 echo "Prototype: $try" ;;
12823 esac
12824 ;;
c18e646a
JH
12825 *) case "$usethreads" in
12826 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12827 esac
90e831dc
SB
12828 d_getgrnam_r=undef
12829 getgrnam_r_proto=0
c18e646a 12830 ;;
a48ec845
JH
12831 esac
12832 ;;
10bc17b6
JH
12833*) getgrnam_r_proto=0
12834 ;;
12835esac
12836
b4eb6b3d
JH
12837: see if gethostbyaddr exists
12838set gethostbyaddr d_gethbyaddr
12839eval $inlibc
12840
12841: see if gethostbyname exists
12842set gethostbyname d_gethbyname
12843eval $inlibc
12844
12845: see if gethostent exists
12846set gethostent d_gethent
12847eval $inlibc
12848
12849: see how we will look up host name
12850echo " "
12851call=''
12852if set gethostname val -f d_gethname; eval $csym; $val; then
12853 echo 'gethostname() found.' >&4
12854 d_gethname="$define"
12855 call=gethostname
12856fi
12857if set uname val -f d_uname; eval $csym; $val; then
12858 if ./xenix; then
12859 $cat <<'EOM'
12860uname() was found, but you're running xenix, and older versions of xenix
12861have a broken uname(). If you don't really know whether your xenix is old
12862enough to have a broken system call, use the default answer.
12863
12864EOM
12865 dflt=y
12866 case "$d_uname" in
12867 "$define") dflt=n;;
12868 esac
12869 rp='Is your uname() broken?'
12870 . ./myread
12871 case "$ans" in
12872 n*) d_uname="$define"; call=uname;;
12873 esac
12874 else
12875 echo 'uname() found.' >&4
12876 d_uname="$define"
12877 case "$call" in
12878 '') call=uname ;;
12879 esac
12880 fi
12881fi
12882case "$d_gethname" in
12883'') d_gethname="$undef";;
12884esac
12885case "$d_uname" in
12886'') d_uname="$undef";;
12887esac
12888case "$d_uname$d_gethname" in
12889*define*)
12890 dflt=n
12891 cat <<EOM
12892
12893Every now and then someone has a $call() that lies about the hostname
12894but can't be fixed for political or economic reasons. If you wish, I can
12895pretend $call() isn't there and maybe compute hostname at run-time
12896thanks to the '$phostname' command.
12897
12898EOM
12899 rp="Shall I ignore $call() from now on?"
12900 . ./myread
12901 case "$ans" in
12902 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12903 esac;;
12904esac
12905case "$phostname" in
12906'') aphostname='';;
12907*) case "$aphostname" in
12908 /*) ;;
12909 *) set X $phostname
12910 shift
12911 file=$1
12912 shift
12913 file=`./loc $file $file $pth`
12914 aphostname=`echo $file $*`
12915 ;;
12916 esac
12917 ;;
12918esac
12919case "$d_uname$d_gethname" in
12920*define*) ;;
12921*)
12922 case "$phostname" in
12923 '')
12924 echo "There will be no way for $package to get your hostname." >&4;;
12925 *)
12926 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12927 ;;
12928 esac;;
12929esac
12930case "$d_phostname" in
12931'') d_phostname="$undef";;
12932esac
12933
10bc17b6
JH
12934: see if gethostbyaddr_r exists
12935set gethostbyaddr_r d_gethostbyaddr_r
12936eval $inlibc
12937case "$d_gethostbyaddr_r" in
12938"$define")
12939 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12940 case "$d_gethostbyaddr_r_proto:$usethreads" in
12941 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
12942 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12943 eval $hasproto ;;
12944 *) ;;
12945 esac
12946 case "$d_gethostbyaddr_r_proto" in
12947 define)
10bc17b6
JH
12948 case "$gethostbyaddr_r_proto" in
12949 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12950 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12951 esac
12952 case "$gethostbyaddr_r_proto" in
12953 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12954 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12955 esac
12956 case "$gethostbyaddr_r_proto" in
12957 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12958 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12959 esac
12960 case "$gethostbyaddr_r_proto" in
12961 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12962 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12963 esac
12964 case "$gethostbyaddr_r_proto" in
12965 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12966 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12967 esac
12968 case "$gethostbyaddr_r_proto" in
12969 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12970 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12971 esac
12972 case "$gethostbyaddr_r_proto" in
12973 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12974 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12975 esac
12976 case "$gethostbyaddr_r_proto" in
12977 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12978 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12979 esac
12980 case "$gethostbyaddr_r_proto" in
12981 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12982 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12983 esac
12984 case "$gethostbyaddr_r_proto" in
12985 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12986 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12987 esac
12988 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
12989 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12990 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12991 esac
12992 case "$gethostbyaddr_r_proto" in
90e831dc 12993 ''|0) d_gethostbyaddr_r=undef
10bc17b6 12994 gethostbyaddr_r_proto=0
a48ec845 12995 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12996 * ) case "$gethostbyaddr_r_proto" in
12997 REENTRANT_PROTO*) ;;
12998 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12999 esac
13000 echo "Prototype: $try" ;;
13001 esac
13002 ;;
c18e646a
JH
13003 *) case "$usethreads" in
13004 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13005 esac
90e831dc
SB
13006 d_gethostbyaddr_r=undef
13007 gethostbyaddr_r_proto=0
c18e646a 13008 ;;
a48ec845
JH
13009 esac
13010 ;;
10bc17b6
JH
13011*) gethostbyaddr_r_proto=0
13012 ;;
13013esac
13014
13015: see if gethostbyname_r exists
13016set gethostbyname_r d_gethostbyname_r
13017eval $inlibc
13018case "$d_gethostbyname_r" in
13019"$define")
13020 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13021 case "$d_gethostbyname_r_proto:$usethreads" in
13022 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13023 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13024 eval $hasproto ;;
13025 *) ;;
13026 esac
13027 case "$d_gethostbyname_r_proto" in
13028 define)
10bc17b6
JH
13029 case "$gethostbyname_r_proto" in
13030 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13031 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13032 esac
13033 case "$gethostbyname_r_proto" in
13034 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13035 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13036 esac
13037 case "$gethostbyname_r_proto" in
13038 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13039 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13040 esac
13041 case "$gethostbyname_r_proto" in
90e831dc 13042 ''|0) d_gethostbyname_r=undef
10bc17b6 13043 gethostbyname_r_proto=0
a48ec845 13044 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13045 * ) case "$gethostbyname_r_proto" in
13046 REENTRANT_PROTO*) ;;
13047 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13048 esac
13049 echo "Prototype: $try" ;;
13050 esac
13051 ;;
c18e646a
JH
13052 *) case "$usethreads" in
13053 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13054 esac
90e831dc
SB
13055 d_gethostbyname_r=undef
13056 gethostbyname_r_proto=0
c18e646a 13057 ;;
a48ec845
JH
13058 esac
13059 ;;
10bc17b6
JH
13060*) gethostbyname_r_proto=0
13061 ;;
13062esac
13063
13064: see if gethostent_r exists
13065set gethostent_r d_gethostent_r
13066eval $inlibc
13067case "$d_gethostent_r" in
13068"$define")
13069 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13070 case "$d_gethostent_r_proto:$usethreads" in
13071 ":define") d_gethostent_r_proto=define
a48ec845
JH
13072 set d_gethostent_r_proto gethostent_r $hdrs
13073 eval $hasproto ;;
13074 *) ;;
13075 esac
13076 case "$d_gethostent_r_proto" in
13077 define)
10bc17b6
JH
13078 case "$gethostent_r_proto" in
13079 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13080 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13081 esac
13082 case "$gethostent_r_proto" in
13083 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13084 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13085 esac
13086 case "$gethostent_r_proto" in
13087 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13088 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13089 esac
13090 case "$gethostent_r_proto" in
13091 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13092 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13093 esac
13094 case "$gethostent_r_proto" in
13095 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13096 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13097 esac
13098 case "$gethostent_r_proto" in
13099 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13100 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13101 esac
13102 case "$gethostent_r_proto" in
90e831dc 13103 ''|0) d_gethostent_r=undef
10bc17b6 13104 gethostent_r_proto=0
a48ec845 13105 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13106 * ) case "$gethostent_r_proto" in
13107 REENTRANT_PROTO*) ;;
13108 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13109 esac
13110 echo "Prototype: $try" ;;
13111 esac
13112 ;;
c18e646a
JH
13113 *) case "$usethreads" in
13114 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13115 esac
90e831dc
SB
13116 d_gethostent_r=undef
13117 gethostent_r_proto=0
c18e646a 13118 ;;
a48ec845
JH
13119 esac
13120 ;;
10bc17b6
JH
13121*) gethostent_r_proto=0
13122 ;;
13123esac
b4eb6b3d
JH
13124
13125: see if prototypes for various gethostxxx netdb.h functions are available
13126echo " "
13127set d_gethostprotos gethostent $i_netdb netdb.h
13128eval $hasproto
13129
4e0554ec
JH
13130: see if getitimer exists
13131set getitimer d_getitimer
13132eval $inlibc
13133
b4eb6b3d
JH
13134: see if getlogin exists
13135set getlogin d_getlogin
13136eval $inlibc
13137
10bc17b6
JH
13138: see if getlogin_r exists
13139set getlogin_r d_getlogin_r
13140eval $inlibc
13141case "$d_getlogin_r" in
13142"$define")
13143 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13144 case "$d_getlogin_r_proto:$usethreads" in
13145 ":define") d_getlogin_r_proto=define
a48ec845
JH
13146 set d_getlogin_r_proto getlogin_r $hdrs
13147 eval $hasproto ;;
13148 *) ;;
13149 esac
13150 case "$d_getlogin_r_proto" in
13151 define)
10bc17b6
JH
13152 case "$getlogin_r_proto" in
13153 ''|0) try='int getlogin_r(char*, size_t);'
13154 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13155 esac
13156 case "$getlogin_r_proto" in
13157 ''|0) try='int getlogin_r(char*, int);'
13158 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13159 esac
13160 case "$getlogin_r_proto" in
13161 ''|0) try='char* getlogin_r(char*, size_t);'
13162 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13163 esac
13164 case "$getlogin_r_proto" in
13165 ''|0) try='char* getlogin_r(char*, int);'
13166 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13167 esac
13168 case "$getlogin_r_proto" in
90e831dc 13169 ''|0) d_getlogin_r=undef
10bc17b6 13170 getlogin_r_proto=0
a48ec845 13171 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13172 * ) case "$getlogin_r_proto" in
13173 REENTRANT_PROTO*) ;;
13174 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13175 esac
13176 echo "Prototype: $try" ;;
13177 esac
13178 ;;
c18e646a
JH
13179 *) case "$usethreads" in
13180 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13181 esac
90e831dc
SB
13182 d_getlogin_r=undef
13183 getlogin_r_proto=0
c18e646a 13184 ;;
a48ec845
JH
13185 esac
13186 ;;
10bc17b6
JH
13187*) getlogin_r_proto=0
13188 ;;
13189esac
13190
b4eb6b3d
JH
13191: see if getmnt exists
13192set getmnt d_getmnt
13193eval $inlibc
13194
13195: see if getmntent exists
13196set getmntent d_getmntent
13197eval $inlibc
13198
13199: see if getnetbyaddr exists
13200set getnetbyaddr d_getnbyaddr
13201eval $inlibc
13202
13203: see if getnetbyname exists
13204set getnetbyname d_getnbyname
13205eval $inlibc
13206
13207: see if getnetent exists
13208set getnetent d_getnent
13209eval $inlibc
13210
10bc17b6
JH
13211: see if getnetbyaddr_r exists
13212set getnetbyaddr_r d_getnetbyaddr_r
13213eval $inlibc
13214case "$d_getnetbyaddr_r" in
13215"$define")
13216 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13217 case "$d_getnetbyaddr_r_proto:$usethreads" in
13218 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13219 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13220 eval $hasproto ;;
13221 *) ;;
13222 esac
13223 case "$d_getnetbyaddr_r_proto" in
13224 define)
10bc17b6
JH
13225 case "$getnetbyaddr_r_proto" in
13226 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13227 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13228 esac
13229 case "$getnetbyaddr_r_proto" in
13230 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13231 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13232 esac
13233 case "$getnetbyaddr_r_proto" in
13234 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13235 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13236 esac
13237 case "$getnetbyaddr_r_proto" in
13238 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13239 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13240 esac
13241 case "$getnetbyaddr_r_proto" in
13242 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13243 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13244 esac
13245 case "$getnetbyaddr_r_proto" in
13246 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13247 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13248 esac
13249 case "$getnetbyaddr_r_proto" in
13250 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13251 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13252 esac
13253 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13254 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13255 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13256 esac
13257 case "$getnetbyaddr_r_proto" in
90e831dc 13258 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13259 getnetbyaddr_r_proto=0
a48ec845 13260 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13261 * ) case "$getnetbyaddr_r_proto" in
13262 REENTRANT_PROTO*) ;;
13263 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13264 esac
13265 echo "Prototype: $try" ;;
13266 esac
13267 ;;
c18e646a
JH
13268 *) case "$usethreads" in
13269 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13270 esac
90e831dc
SB
13271 d_getnetbyaddr_r=undef
13272 getnetbyaddr_r_proto=0
c18e646a 13273 ;;
a48ec845
JH
13274 esac
13275 ;;
10bc17b6
JH
13276*) getnetbyaddr_r_proto=0
13277 ;;
13278esac
13279
13280: see if getnetbyname_r exists
13281set getnetbyname_r d_getnetbyname_r
13282eval $inlibc
13283case "$d_getnetbyname_r" in
13284"$define")
13285 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13286 case "$d_getnetbyname_r_proto:$usethreads" in
13287 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13288 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13289 eval $hasproto ;;
13290 *) ;;
13291 esac
13292 case "$d_getnetbyname_r_proto" in
13293 define)
10bc17b6
JH
13294 case "$getnetbyname_r_proto" in
13295 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13296 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13297 esac
13298 case "$getnetbyname_r_proto" in
13299 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13300 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13301 esac
13302 case "$getnetbyname_r_proto" in
13303 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13304 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13305 esac
13306 case "$getnetbyname_r_proto" in
13307 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13308 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13309 esac
13310 case "$getnetbyname_r_proto" in
90e831dc 13311 ''|0) d_getnetbyname_r=undef
10bc17b6 13312 getnetbyname_r_proto=0
a48ec845 13313 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13314 * ) case "$getnetbyname_r_proto" in
13315 REENTRANT_PROTO*) ;;
13316 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13317 esac
13318 echo "Prototype: $try" ;;
13319 esac
13320 ;;
c18e646a
JH
13321 *) case "$usethreads" in
13322 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13323 esac
90e831dc
SB
13324 d_getnetbyname_r=undef
13325 getnetbyname_r_proto=0
c18e646a 13326 ;;
a48ec845
JH
13327 esac
13328 ;;
10bc17b6
JH
13329*) getnetbyname_r_proto=0
13330 ;;
13331esac
13332
13333: see if getnetent_r exists
13334set getnetent_r d_getnetent_r
13335eval $inlibc
13336case "$d_getnetent_r" in
13337"$define")
13338 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13339 case "$d_getnetent_r_proto:$usethreads" in
13340 ":define") d_getnetent_r_proto=define
a48ec845
JH
13341 set d_getnetent_r_proto getnetent_r $hdrs
13342 eval $hasproto ;;
13343 *) ;;
13344 esac
13345 case "$d_getnetent_r_proto" in
13346 define)
10bc17b6
JH
13347 case "$getnetent_r_proto" in
13348 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13349 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13350 esac
13351 case "$getnetent_r_proto" in
13352 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13353 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13354 esac
13355 case "$getnetent_r_proto" in
13356 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13357 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13358 esac
13359 case "$getnetent_r_proto" in
13360 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13361 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13362 esac
13363 case "$getnetent_r_proto" in
13364 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13365 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13366 esac
13367 case "$getnetent_r_proto" in
13368 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13369 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13370 esac
13371 case "$getnetent_r_proto" in
90e831dc 13372 ''|0) d_getnetent_r=undef
10bc17b6 13373 getnetent_r_proto=0
a48ec845 13374 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13375 * ) case "$getnetent_r_proto" in
13376 REENTRANT_PROTO*) ;;
13377 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13378 esac
13379 echo "Prototype: $try" ;;
13380 esac
13381 ;;
c18e646a
JH
13382 *) case "$usethreads" in
13383 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13384 esac
90e831dc
SB
13385 d_getnetent_r=undef
13386 getnetent_r_proto=0
c18e646a 13387 ;;
a48ec845
JH
13388 esac
13389 ;;
10bc17b6
JH
13390*) getnetent_r_proto=0
13391 ;;
13392esac
13393
b4eb6b3d
JH
13394: see if prototypes for various getnetxxx netdb.h functions are available
13395echo " "
13396set d_getnetprotos getnetent $i_netdb netdb.h
13397eval $hasproto
13398
0c0643d0
JH
13399: see if getpagesize exists
13400set getpagesize d_getpagsz
13401eval $inlibc
13402
b4eb6b3d
JH
13403
13404: see if getprotobyname exists
13405set getprotobyname d_getpbyname
13406eval $inlibc
13407
13408: see if getprotobynumber exists
13409set getprotobynumber d_getpbynumber
13410eval $inlibc
13411
13412: see if getprotoent exists
13413set getprotoent d_getpent
13414eval $inlibc
13415
13416: see if getpgid exists
13417set getpgid d_getpgid
13418eval $inlibc
13419
13420: see if getpgrp2 exists
13421set getpgrp2 d_getpgrp2
13422eval $inlibc
13423
13424: see if getppid exists
13425set getppid d_getppid
13426eval $inlibc
13427
13428: see if getpriority exists
13429set getpriority d_getprior
13430eval $inlibc
13431
10bc17b6
JH
13432: see if getprotobyname_r exists
13433set getprotobyname_r d_getprotobyname_r
13434eval $inlibc
13435case "$d_getprotobyname_r" in
13436"$define")
13437 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13438 case "$d_getprotobyname_r_proto:$usethreads" in
13439 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13440 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13441 eval $hasproto ;;
13442 *) ;;
13443 esac
13444 case "$d_getprotobyname_r_proto" in
13445 define)
10bc17b6
JH
13446 case "$getprotobyname_r_proto" in
13447 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13448 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13449 esac
13450 case "$getprotobyname_r_proto" in
13451 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13452 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13453 esac
13454 case "$getprotobyname_r_proto" in
13455 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13456 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13457 esac
13458 case "$getprotobyname_r_proto" in
90e831dc 13459 ''|0) d_getprotobyname_r=undef
10bc17b6 13460 getprotobyname_r_proto=0
a48ec845 13461 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13462 * ) case "$getprotobyname_r_proto" in
13463 REENTRANT_PROTO*) ;;
13464 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13465 esac
13466 echo "Prototype: $try" ;;
13467 esac
13468 ;;
c18e646a
JH
13469 *) case "$usethreads" in
13470 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13471 esac
90e831dc
SB
13472 d_getprotobyname_r=undef
13473 getprotobyname_r_proto=0
c18e646a 13474 ;;
a48ec845
JH
13475 esac
13476 ;;
10bc17b6
JH
13477*) getprotobyname_r_proto=0
13478 ;;
13479esac
13480
13481: see if getprotobynumber_r exists
13482set getprotobynumber_r d_getprotobynumber_r
13483eval $inlibc
13484case "$d_getprotobynumber_r" in
13485"$define")
13486 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13487 case "$d_getprotobynumber_r_proto:$usethreads" in
13488 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13489 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13490 eval $hasproto ;;
13491 *) ;;
13492 esac
13493 case "$d_getprotobynumber_r_proto" in
13494 define)
10bc17b6
JH
13495 case "$getprotobynumber_r_proto" in
13496 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13497 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13498 esac
13499 case "$getprotobynumber_r_proto" in
13500 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13501 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13502 esac
13503 case "$getprotobynumber_r_proto" in
13504 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13505 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13506 esac
13507 case "$getprotobynumber_r_proto" in
90e831dc 13508 ''|0) d_getprotobynumber_r=undef
10bc17b6 13509 getprotobynumber_r_proto=0
a48ec845 13510 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13511 * ) case "$getprotobynumber_r_proto" in
13512 REENTRANT_PROTO*) ;;
13513 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13514 esac
13515 echo "Prototype: $try" ;;
13516 esac
13517 ;;
c18e646a
JH
13518 *) case "$usethreads" in
13519 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13520 esac
90e831dc
SB
13521 d_getprotobynumber_r=undef
13522 getprotobynumber_r_proto=0
c18e646a 13523 ;;
a48ec845
JH
13524 esac
13525 ;;
10bc17b6
JH
13526*) getprotobynumber_r_proto=0
13527 ;;
13528esac
13529
13530: see if getprotoent_r exists
13531set getprotoent_r d_getprotoent_r
13532eval $inlibc
13533case "$d_getprotoent_r" in
13534"$define")
13535 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13536 case "$d_getprotoent_r_proto:$usethreads" in
13537 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13538 set d_getprotoent_r_proto getprotoent_r $hdrs
13539 eval $hasproto ;;
13540 *) ;;
13541 esac
13542 case "$d_getprotoent_r_proto" in
13543 define)
10bc17b6
JH
13544 case "$getprotoent_r_proto" in
13545 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13546 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13547 esac
13548 case "$getprotoent_r_proto" in
13549 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13550 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13551 esac
13552 case "$getprotoent_r_proto" in
13553 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13554 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13555 esac
13556 case "$getprotoent_r_proto" in
13557 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13558 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13559 esac
13560 case "$getprotoent_r_proto" in
90e831dc 13561 ''|0) d_getprotoent_r=undef
10bc17b6 13562 getprotoent_r_proto=0
a48ec845 13563 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13564 * ) case "$getprotoent_r_proto" in
13565 REENTRANT_PROTO*) ;;
13566 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13567 esac
13568 echo "Prototype: $try" ;;
13569 esac
13570 ;;
c18e646a
JH
13571 *) case "$usethreads" in
13572 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13573 esac
90e831dc
SB
13574 d_getprotoent_r=undef
13575 getprotoent_r_proto=0
c18e646a 13576 ;;
a48ec845
JH
13577 esac
13578 ;;
10bc17b6
JH
13579*) getprotoent_r_proto=0
13580 ;;
13581esac
13582
b4eb6b3d
JH
13583: see if prototypes for various getprotoxxx netdb.h functions are available
13584echo " "
13585set d_getprotoprotos getprotoent $i_netdb netdb.h
13586eval $hasproto
13587
13588: see if getprpwnam exists
13589set getprpwnam d_getprpwnam
13590eval $inlibc
13591
13592: see if getpwent exists
13593set getpwent d_getpwent
13594eval $inlibc
13595
10bc17b6
JH
13596: see if getpwent_r exists
13597set getpwent_r d_getpwent_r
13598eval $inlibc
13599case "$d_getpwent_r" in
13600"$define")
13601 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13602 case "$d_getpwent_r_proto:$usethreads" in
13603 ":define") d_getpwent_r_proto=define
a48ec845
JH
13604 set d_getpwent_r_proto getpwent_r $hdrs
13605 eval $hasproto ;;
13606 *) ;;
13607 esac
13608 case "$d_getpwent_r_proto" in
13609 define)
10bc17b6
JH
13610 case "$getpwent_r_proto" in
13611 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13612 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13613 esac
13614 case "$getpwent_r_proto" in
13615 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13616 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13617 esac
13618 case "$getpwent_r_proto" in
13619 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13620 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13621 esac
13622 case "$getpwent_r_proto" in
13623 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13624 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13625 esac
13626 case "$getpwent_r_proto" in
13627 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13628 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13629 esac
13630 case "$getpwent_r_proto" in
13631 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13632 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13633 esac
13634 case "$getpwent_r_proto" in
90e831dc 13635 ''|0) d_getpwent_r=undef
10bc17b6 13636 getpwent_r_proto=0
a48ec845 13637 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13638 * ) case "$getpwent_r_proto" in
13639 REENTRANT_PROTO*) ;;
13640 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13641 esac
13642 echo "Prototype: $try" ;;
13643 esac
13644 ;;
c18e646a
JH
13645 *) case "$usethreads" in
13646 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13647 esac
90e831dc
SB
13648 d_getpwent_r=undef
13649 getpwent_r_proto=0
c18e646a 13650 ;;
a48ec845
JH
13651 esac
13652 ;;
10bc17b6
JH
13653*) getpwent_r_proto=0
13654 ;;
13655esac
13656
13657: see if getpwnam_r exists
13658set getpwnam_r d_getpwnam_r
13659eval $inlibc
13660case "$d_getpwnam_r" in
13661"$define")
13662 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13663 case "$d_getpwnam_r_proto:$usethreads" in
13664 ":define") d_getpwnam_r_proto=define
a48ec845
JH
13665 set d_getpwnam_r_proto getpwnam_r $hdrs
13666 eval $hasproto ;;
13667 *) ;;
13668 esac
13669 case "$d_getpwnam_r_proto" in
13670 define)
10bc17b6
JH
13671 case "$getpwnam_r_proto" in
13672 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13673 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13674 esac
13675 case "$getpwnam_r_proto" in
13676 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13677 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13678 esac
13679 case "$getpwnam_r_proto" in
13680 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13681 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13682 esac
13683 case "$getpwnam_r_proto" in
13684 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13685 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13686 esac
13687 case "$getpwnam_r_proto" in
90e831dc 13688 ''|0) d_getpwnam_r=undef
10bc17b6 13689 getpwnam_r_proto=0
a48ec845 13690 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13691 * ) case "$getpwnam_r_proto" in
13692 REENTRANT_PROTO*) ;;
13693 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13694 esac
13695 echo "Prototype: $try" ;;
13696 esac
13697 ;;
c18e646a
JH
13698 *) case "$usethreads" in
13699 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13700 esac
90e831dc
SB
13701 d_getpwnam_r=undef
13702 getpwnam_r_proto=0
c18e646a 13703 ;;
a48ec845
JH
13704 esac
13705 ;;
10bc17b6
JH
13706*) getpwnam_r_proto=0
13707 ;;
13708esac
13709
13710: see if getpwuid_r exists
13711set getpwuid_r d_getpwuid_r
13712eval $inlibc
13713case "$d_getpwuid_r" in
13714"$define")
13715 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
13716 case "$d_getpwuid_r_proto:$usethreads" in
13717 ":define") d_getpwuid_r_proto=define
a48ec845
JH
13718 set d_getpwuid_r_proto getpwuid_r $hdrs
13719 eval $hasproto ;;
13720 *) ;;
13721 esac
13722 case "$d_getpwuid_r_proto" in
13723 define)
10bc17b6
JH
13724 case "$getpwuid_r_proto" in
13725 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13726 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13727 esac
13728 case "$getpwuid_r_proto" in
13729 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13730 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13731 esac
13732 case "$getpwuid_r_proto" in
13733 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13734 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13735 esac
13736 case "$getpwuid_r_proto" in
13737 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13738 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13739 esac
13740 case "$getpwuid_r_proto" in
90e831dc 13741 ''|0) d_getpwuid_r=undef
10bc17b6 13742 getpwuid_r_proto=0
a48ec845 13743 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13744 * ) case "$getpwuid_r_proto" in
13745 REENTRANT_PROTO*) ;;
13746 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13747 esac
13748 echo "Prototype: $try" ;;
13749 esac
13750 ;;
c18e646a
JH
13751 *) case "$usethreads" in
13752 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13753 esac
90e831dc
SB
13754 d_getpwuid_r=undef
13755 getpwuid_r_proto=0
c18e646a 13756 ;;
a48ec845
JH
13757 esac
13758 ;;
10bc17b6
JH
13759*) getpwuid_r_proto=0
13760 ;;
13761esac
13762
b4eb6b3d
JH
13763
13764: see if getservbyname exists
13765set getservbyname d_getsbyname
13766eval $inlibc
13767
13768: see if getservbyport exists
13769set getservbyport d_getsbyport
13770eval $inlibc
13771
13772: see if getservent exists
13773set getservent d_getsent
13774eval $inlibc
13775
10bc17b6
JH
13776: see if getservbyname_r exists
13777set getservbyname_r d_getservbyname_r
13778eval $inlibc
13779case "$d_getservbyname_r" in
13780"$define")
13781 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13782 case "$d_getservbyname_r_proto:$usethreads" in
13783 ":define") d_getservbyname_r_proto=define
a48ec845
JH
13784 set d_getservbyname_r_proto getservbyname_r $hdrs
13785 eval $hasproto ;;
13786 *) ;;
13787 esac
13788 case "$d_getservbyname_r_proto" in
13789 define)
10bc17b6
JH
13790 case "$getservbyname_r_proto" in
13791 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13792 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13793 esac
13794 case "$getservbyname_r_proto" in
13795 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13796 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13797 esac
13798 case "$getservbyname_r_proto" in
13799 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13800 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13801 esac
13802 case "$getservbyname_r_proto" in
90e831dc 13803 ''|0) d_getservbyname_r=undef
10bc17b6 13804 getservbyname_r_proto=0
a48ec845 13805 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13806 * ) case "$getservbyname_r_proto" in
13807 REENTRANT_PROTO*) ;;
13808 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13809 esac
13810 echo "Prototype: $try" ;;
13811 esac
13812 ;;
c18e646a
JH
13813 *) case "$usethreads" in
13814 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13815 esac
90e831dc
SB
13816 d_getservbyname_r=undef
13817 getservbyname_r_proto=0
c18e646a 13818 ;;
a48ec845
JH
13819 esac
13820 ;;
10bc17b6
JH
13821*) getservbyname_r_proto=0
13822 ;;
13823esac
13824
13825: see if getservbyport_r exists
13826set getservbyport_r d_getservbyport_r
13827eval $inlibc
13828case "$d_getservbyport_r" in
13829"$define")
13830 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13831 case "$d_getservbyport_r_proto:$usethreads" in
13832 ":define") d_getservbyport_r_proto=define
a48ec845
JH
13833 set d_getservbyport_r_proto getservbyport_r $hdrs
13834 eval $hasproto ;;
13835 *) ;;
13836 esac
13837 case "$d_getservbyport_r_proto" in
13838 define)
10bc17b6
JH
13839 case "$getservbyport_r_proto" in
13840 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13841 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13842 esac
13843 case "$getservbyport_r_proto" in
13844 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13845 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13846 esac
13847 case "$getservbyport_r_proto" in
13848 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13849 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13850 esac
13851 case "$getservbyport_r_proto" in
90e831dc 13852 ''|0) d_getservbyport_r=undef
10bc17b6 13853 getservbyport_r_proto=0
a48ec845 13854 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13855 * ) case "$getservbyport_r_proto" in
13856 REENTRANT_PROTO*) ;;
13857 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13858 esac
13859 echo "Prototype: $try" ;;
13860 esac
13861 ;;
c18e646a
JH
13862 *) case "$usethreads" in
13863 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13864 esac
90e831dc
SB
13865 d_getservbyport_r=undef
13866 getservbyport_r_proto=0
c18e646a 13867 ;;
a48ec845
JH
13868 esac
13869 ;;
10bc17b6
JH
13870*) getservbyport_r_proto=0
13871 ;;
13872esac
13873
13874: see if getservent_r exists
13875set getservent_r d_getservent_r
13876eval $inlibc
13877case "$d_getservent_r" in
13878"$define")
13879 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13880 case "$d_getservent_r_proto:$usethreads" in
13881 ":define") d_getservent_r_proto=define
a48ec845
JH
13882 set d_getservent_r_proto getservent_r $hdrs
13883 eval $hasproto ;;
13884 *) ;;
13885 esac
13886 case "$d_getservent_r_proto" in
13887 define)
10bc17b6
JH
13888 case "$getservent_r_proto" in
13889 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13890 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13891 esac
13892 case "$getservent_r_proto" in
13893 ''|0) try='int getservent_r(struct servent*, char*, int);'
13894 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13895 esac
13896 case "$getservent_r_proto" in
13897 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13898 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13899 esac
13900 case "$getservent_r_proto" in
13901 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13902 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13903 esac
13904 case "$getservent_r_proto" in
90e831dc 13905 ''|0) d_getservent_r=undef
10bc17b6 13906 getservent_r_proto=0
a48ec845 13907 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13908 * ) case "$getservent_r_proto" in
13909 REENTRANT_PROTO*) ;;
13910 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13911 esac
13912 echo "Prototype: $try" ;;
13913 esac
13914 ;;
c18e646a
JH
13915 *) case "$usethreads" in
13916 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13917 esac
90e831dc
SB
13918 d_getservent_r=undef
13919 getservent_r_proto=0
c18e646a 13920 ;;
a48ec845
JH
13921 esac
13922 ;;
10bc17b6
JH
13923*) getservent_r_proto=0
13924 ;;
13925esac
13926
b4eb6b3d
JH
13927: see if prototypes for various getservxxx netdb.h functions are available
13928echo " "
13929set d_getservprotos getservent $i_netdb netdb.h
13930eval $hasproto
13931
13932: see if getspnam exists
13933set getspnam d_getspnam
13934eval $inlibc
13935
10bc17b6
JH
13936: see if this is a shadow.h system
13937set shadow.h i_shadow
13938eval $inhdr
13939
13940: see if getspnam_r exists
13941set getspnam_r d_getspnam_r
13942eval $inlibc
13943case "$d_getspnam_r" in
13944"$define")
13945 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
13946 case "$d_getspnam_r_proto:$usethreads" in
13947 ":define") d_getspnam_r_proto=define
a48ec845
JH
13948 set d_getspnam_r_proto getspnam_r $hdrs
13949 eval $hasproto ;;
13950 *) ;;
13951 esac
13952 case "$d_getspnam_r_proto" in
13953 define)
10bc17b6
JH
13954 case "$getspnam_r_proto" in
13955 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13956 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13957 esac
13958 case "$getspnam_r_proto" in
13959 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13960 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13961 esac
13962 case "$getspnam_r_proto" in
90e831dc 13963 ''|0) d_getspnam_r=undef
10bc17b6 13964 getspnam_r_proto=0
a48ec845 13965 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13966 * ) case "$getspnam_r_proto" in
13967 REENTRANT_PROTO*) ;;
13968 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13969 esac
13970 echo "Prototype: $try" ;;
13971 esac
13972 ;;
c18e646a
JH
13973 *) case "$usethreads" in
13974 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13975 esac
90e831dc
SB
13976 d_getspnam_r=undef
13977 getspnam_r_proto=0
c18e646a 13978 ;;
a48ec845
JH
13979 esac
13980 ;;
10bc17b6
JH
13981*) getspnam_r_proto=0
13982 ;;
13983esac
13984
b4eb6b3d
JH
13985: see if gettimeofday or ftime exists
13986set gettimeofday d_gettimeod
13987eval $inlibc
13988case "$d_gettimeod" in
13989"$undef")
13990 set ftime d_ftime
13991 eval $inlibc
13992 ;;
13993*)
13994 val="$undef"; set d_ftime; eval $setvar
13995 ;;
13996esac
13997case "$d_gettimeod$d_ftime" in
13998"$undef$undef")
13999 echo " "
14000 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14001 ;;
14002esac
14003
10bc17b6
JH
14004: see if gmtime_r exists
14005set gmtime_r d_gmtime_r
14006eval $inlibc
14007case "$d_gmtime_r" in
14008"$define")
d63eadf0 14009 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14010 case "$d_gmtime_r_proto:$usethreads" in
14011 ":define") d_gmtime_r_proto=define
a48ec845
JH
14012 set d_gmtime_r_proto gmtime_r $hdrs
14013 eval $hasproto ;;
14014 *) ;;
14015 esac
14016 case "$d_gmtime_r_proto" in
14017 define)
10bc17b6
JH
14018 case "$gmtime_r_proto" in
14019 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14020 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14021 esac
14022 case "$gmtime_r_proto" in
14023 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14024 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14025 esac
14026 case "$gmtime_r_proto" in
90e831dc 14027 ''|0) d_gmtime_r=undef
10bc17b6 14028 gmtime_r_proto=0
a48ec845 14029 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14030 * ) case "$gmtime_r_proto" in
14031 REENTRANT_PROTO*) ;;
14032 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14033 esac
14034 echo "Prototype: $try" ;;
14035 esac
b4eb6b3d 14036 ;;
c18e646a
JH
14037 *) case "$usethreads" in
14038 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14039 esac
90e831dc
SB
14040 d_gmtime_r=undef
14041 gmtime_r_proto=0
c18e646a 14042 ;;
a48ec845
JH
14043 esac
14044 ;;
10bc17b6 14045*) gmtime_r_proto=0
b4eb6b3d
JH
14046 ;;
14047esac
14048
14049: see if hasmntopt exists
14050set hasmntopt d_hasmntopt
14051eval $inlibc
14052
14053: see if this is a netinet/in.h or sys/in.h system
14054set netinet/in.h i_niin sys/in.h i_sysin
14055eval $inhdr
14056
14057: see if arpa/inet.h has to be included
14058set arpa/inet.h i_arpainet
14059eval $inhdr
14060
14061: see if htonl --and friends-- exists
14062val=''
14063set htonl val
14064eval $inlibc
14065
14066: Maybe they are macros.
14067case "$val" in
14068$undef)
14069 $cat >htonl.c <<EOM
14070#include <stdio.h>
14071#include <sys/types.h>
14072#$i_niin I_NETINET_IN
14073#$i_sysin I_SYS_IN
14074#$i_arpainet I_ARPA_INET
14075#ifdef I_NETINET_IN
14076#include <netinet/in.h>
14077#endif
14078#ifdef I_SYS_IN
14079#include <sys/in.h>
14080#endif
14081#ifdef I_ARPA_INET
14082#include <arpa/inet.h>
14083#endif
14084#ifdef htonl
14085printf("Defined as a macro.");
14086#endif
14087EOM
14088 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14089 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14090 val="$define"
14091 echo "But it seems to be defined as a macro." >&4
14092 fi
14093 $rm -f htonl.?
14094 ;;
14095esac
14096set d_htonl
14097eval $setvar
14098
36adc09b
JH
14099: see if ilogbl exists
14100set ilogbl d_ilogbl
14101eval $inlibc
14102
b4eb6b3d
JH
14103: index or strchr
14104echo " "
14105if set index val -f; eval $csym; $val; then
14106 if set strchr val -f d_strchr; eval $csym; $val; then
14107 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14108 val="$define"
14109 vali="$undef"
14110 echo "strchr() found." >&4
14111 else
14112 val="$undef"
14113 vali="$define"
14114 echo "index() found." >&4
14115 fi
14116 else
14117 val="$undef"
14118 vali="$define"
8dfa8df9
JH
14119 echo "index() found." >&4
14120 fi
b4eb6b3d 14121else
8dfa8df9
JH
14122 if set strchr val -f d_strchr; eval $csym; $val; then
14123 val="$define"
14124 vali="$undef"
14125 echo "strchr() found." >&4
14126 else
14127 echo "No index() or strchr() found!" >&4
14128 val="$undef"
14129 vali="$undef"
14130 fi
b4eb6b3d 14131fi
8dfa8df9
JH
14132set d_strchr; eval $setvar
14133val="$vali"
14134set d_index; eval $setvar
14135
14136: check whether inet_aton exists
14137set inet_aton d_inetaton
14138eval $inlibc
b4eb6b3d
JH
14139
14140: Look for isascii
14141echo " "
36adc09b 14142$cat >isascii.c <<EOCP
b4eb6b3d
JH
14143#include <stdio.h>
14144#include <ctype.h>
55954f19
JH
14145#$i_stdlib I_STDLIB
14146#ifdef I_STDLIB
14147#include <stdlib.h>
14148#endif
b4eb6b3d
JH
14149int main() {
14150 int c = 'A';
14151 if (isascii(c))
14152 exit(0);
14153 else
14154 exit(1);
14155}
14156EOCP
14157set isascii
14158if eval $compile; then
14159 echo "isascii() found." >&4
14160 val="$define"
14161else
14162 echo "isascii() NOT found." >&4
14163 val="$undef"
14164fi
14165set d_isascii
14166eval $setvar
14167$rm -f isascii*
14168
758a5d79
JH
14169: see if isfinite exists
14170set isfinite d_isfinite
14171eval $inlibc
14172
14173: see if isinf exists
14174set isinf d_isinf
14175eval $inlibc
14176
b4eb6b3d
JH
14177: see if isnan exists
14178set isnan d_isnan
14179eval $inlibc
14180
14181: see if isnanl exists
14182set isnanl d_isnanl
14183eval $inlibc
14184
14185: see if killpg exists
14186set killpg d_killpg
14187eval $inlibc
14188
14189: see if lchown exists
14190echo " "
14191$cat > try.c <<'EOCP'
14192/* System header to define __stub macros and hopefully few prototypes,
14193 which can conflict with char lchown(); below. */
14194#include <assert.h>
14195/* Override any gcc2 internal prototype to avoid an error. */
14196/* We use char because int might match the return type of a gcc2
14197 builtin and then its argument prototype would still apply. */
14198char lchown();
14199int main() {
14200 /* The GNU C library defines this for functions which it implements
14201 to always fail with ENOSYS. Some functions are actually named
14202 something starting with __ and the normal name is an alias. */
14203#if defined (__stub_lchown) || defined (__stub___lchown)
14204choke me
14205#else
14206lchown();
14207#endif
14208; return 0; }
14209EOCP
14210set try
14211if eval $compile; then
14212 $echo "lchown() found." >&4
14213 val="$define"
14214else
14215 $echo "lchown() NOT found." >&4
14216 val="$undef"
14217fi
14218set d_lchown
14219eval $setvar
14220
14221: See if number of significant digits in a double precision number is known
14222echo " "
14223$cat >ldbl_dig.c <<EOM
14224#$i_limits I_LIMITS
14225#$i_float I_FLOAT
14226#ifdef I_LIMITS
14227#include <limits.h>
14228#endif
14229#ifdef I_FLOAT
14230#include <float.h>
14231#endif
14232#ifdef LDBL_DIG
14233printf("Contains LDBL_DIG");
14234#endif
14235EOM
14236$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14237if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14238 echo "LDBL_DIG found." >&4
14239 val="$define"
14240else
14241 echo "LDBL_DIG NOT found." >&4
14242 val="$undef"
14243fi
14244$rm -f ldbl_dig.?
14245set d_ldbl_dig
14246eval $setvar
14247
0a0abfba
MB
14248: see if this is a math.h system
14249set math.h i_math
14250eval $inhdr
14251
14252d_libm_lib_version="$undef"
14253case $i_math in
14254 $define)
14255 : check to see if math.h defines _LIB_VERSION
14256 echo " "
14257 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14258 $cat >try.c <<EOCP
14259#include <unistd.h>
14260#include <math.h>
14261int main (int argc, char *argv[])
14262{
14263 printf ("%d\n", _LIB_VERSION);
14264 return (0);
14265 } /* main */
14266EOCP
14267 set try
14268 if eval $compile; then
14269 foo=`$run ./try`
14270 echo "Yes, it does ($foo)" >&4
14271 d_libm_lib_version="$define"
14272 else
14273 echo "No, it does not (probably harmless)\n" >&4
14274 fi
14275 $rm -f try.* try core core.try.*
14276 ;;
14277
14278 esac
14279
b4eb6b3d
JH
14280: see if link exists
14281set link d_link
14282eval $inlibc
14283
10bc17b6
JH
14284: see if localtime_r exists
14285set localtime_r d_localtime_r
14286eval $inlibc
14287case "$d_localtime_r" in
14288"$define")
d63eadf0 14289 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14290 case "$d_localtime_r_proto:$usethreads" in
14291 ":define") d_localtime_r_proto=define
a48ec845
JH
14292 set d_localtime_r_proto localtime_r $hdrs
14293 eval $hasproto ;;
14294 *) ;;
14295 esac
14296 case "$d_localtime_r_proto" in
14297 define)
10bc17b6
JH
14298 case "$localtime_r_proto" in
14299 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14300 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14301 esac
14302 case "$localtime_r_proto" in
14303 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14304 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14305 esac
14306 case "$localtime_r_proto" in
90e831dc 14307 ''|0) d_localtime_r=undef
10bc17b6 14308 localtime_r_proto=0
a48ec845 14309 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14310 * ) case "$localtime_r_proto" in
14311 REENTRANT_PROTO*) ;;
14312 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14313 esac
14314 echo "Prototype: $try" ;;
14315 esac
14316 ;;
c18e646a
JH
14317 *) case "$usethreads" in
14318 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14319 esac
90e831dc
SB
14320 d_localtime_r=undef
14321 localtime_r_proto=0
c18e646a 14322 ;;
a48ec845
JH
14323 esac
14324 ;;
10bc17b6
JH
14325*) localtime_r_proto=0
14326 ;;
14327esac
14328
b4eb6b3d
JH
14329: see if localeconv exists
14330set localeconv d_locconv
14331eval $inlibc
14332
14333: see if lockf exists
14334set lockf d_lockf
14335eval $inlibc
14336
b4eb6b3d
JH
14337: see if prototype for lseek is available
14338echo " "
4786929f 14339set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14340eval $hasproto
14341
14342: see if lstat exists
14343set lstat d_lstat
14344eval $inlibc
14345
14346: see if madvise exists
14347set madvise d_madvise
14348eval $inlibc
14349
7dd121ae
MB
14350: see if malloc_size exists
14351set malloc_size d_malloc_size
14352eval $inlibc
14353
14354: see if malloc_size_good exists
14355set malloc_good_size d_malloc_good_size
14356eval $inlibc
14357
b4eb6b3d
JH
14358: see if mblen exists
14359set mblen d_mblen
14360eval $inlibc
14361
14362: see if mbstowcs exists
14363set mbstowcs d_mbstowcs
14364eval $inlibc
14365
14366: see if mbtowc exists
14367set mbtowc d_mbtowc
14368eval $inlibc
14369
14370: see if memchr exists
14371set memchr d_memchr
14372eval $inlibc
14373
14374: see if memcmp exists
14375set memcmp d_memcmp
14376eval $inlibc
14377
14378: see if memcpy exists
14379set memcpy d_memcpy
14380eval $inlibc
14381
14382: see if memmove exists
14383set memmove d_memmove
14384eval $inlibc
14385
14386: see if memset exists
14387set memset d_memset
14388eval $inlibc
14389
14390: see if mkdir exists
14391set mkdir d_mkdir
14392eval $inlibc
14393
14394: see if mkdtemp exists
14395set mkdtemp d_mkdtemp
14396eval $inlibc
14397
14398: see if mkfifo exists
14399set mkfifo d_mkfifo
14400eval $inlibc
14401
14402: see if mkstemp exists
14403set mkstemp d_mkstemp
14404eval $inlibc
14405
14406: see if mkstemps exists
14407set mkstemps d_mkstemps
14408eval $inlibc
14409
14410: see if mktime exists
14411set mktime d_mktime
14412eval $inlibc
14413
14414: see if this is a sys/mman.h system
14415set sys/mman.h i_sysmman
14416eval $inhdr
14417
14418: see if mmap exists
14419set mmap d_mmap
14420eval $inlibc
14421: see what shmat returns
14422: default to something harmless
14423mmaptype='void *'
14424case "$i_sysmman$d_mmap" in
14425"$define$define")
14426 $cat >mmap.c <<'END'
14427#include <sys/mman.h>
14428void *mmap();
14429END
14430 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14431 mmaptype='void *'
14432 else
14433 mmaptype='caddr_t'
14434 fi
14435 echo "and it returns ($mmaptype)." >&4
14436 ;;
14437esac
14438
14439
14440
89ce900e
JH
14441: see if sqrtl exists
14442set sqrtl d_sqrtl
14443eval $inlibc
14444
af1ff193
JH
14445: see if scalbnl exists
14446set scalbnl d_scalbnl
14447eval $inlibc
14448
89ce900e
JH
14449: see if modfl exists
14450set modfl d_modfl
14451eval $inlibc
14452
14453: see if prototype for modfl is available
14454echo " "
3a794506 14455set d_modflproto modfl $i_math math.h
89ce900e
JH
14456eval $hasproto
14457
14458d_modfl_pow32_bug="$undef"
14459
14460case "$d_longdbl$d_modfl" in
14461$define$define)
14462 $cat <<EOM
14463Checking to see whether your modfl() is okay for large values...
14464EOM
14465$cat >try.c <<EOCP
14466#include <math.h>
14467#include <stdio.h>
14468EOCP
14469if $test "X$d_modflproto" != "X$define"; then
14470 $cat >>try.c <<EOCP
14471/* Sigh. many current glibcs provide the function, but do not prototype it. */
14472long double modfl (long double, long double *);
14473EOCP
14474fi
14475$cat >>try.c <<EOCP
14476int main() {
14477 long double nv = 4294967303.15;
14478 long double v, w;
14479 v = modfl(nv, &w);
14480#ifdef __GLIBC__
14481 printf("glibc");
14482#endif
14483 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14484 return 0;
14485}
14486EOCP
14487 case "$osname:$gccversion" in
14488 aix:) saveccflags="$ccflags"
14489 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14490 esac
14491 set try
14492 if eval $compile; then
14493 foo=`$run ./try`
14494 case "$foo" in
14495 *" 4294967303.150000 1.150000 4294967302.000000")
14496 echo >&4 "Your modfl() is broken for large values."
14497 d_modfl_pow32_bug="$define"
14498 case "$foo" in
14499 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14500 ;;
14501 esac
14502 ;;
14503 *" 4294967303.150000 0.150000 4294967303.000000")
14504 echo >&4 "Your modfl() seems okay for large values."
14505 ;;
14506 *) echo >&4 "I don't understand your modfl() at all."
14507 d_modfl="$undef"
14508 ;;
14509 esac
14510 $rm -f try.* try core core.try.*
14511 else
14512 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14513 d_modfl="$undef"
14514 fi
14515 case "$osname:$gccversion" in
14516 aix:) ccflags="$saveccflags" ;; # restore
14517 esac
14518 ;;
14519esac
14520
14521if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14522 message=""
14523 if $test "$d_sqrtl" != "$define"; then
14524 message="$message sqrtl"
14525 fi
14526 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14527 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14528 echo "You have both aintl and copysignl, so I can emulate modfl."
14529 else
af1ff193 14530 message="$message modfl"
89ce900e 14531 fi
af1ff193
JH
14532 fi
14533 if $test "$d_frexpl" != "$define"; then
14534 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14535 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14536 else
14537 message="$message frexpl"
14538 fi
14539 fi
89ce900e 14540
af1ff193 14541 if $test "$message" != ""; then
89ce900e
JH
14542 $cat <<EOM >&4
14543
14544*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
14545*** the following mathematical functions needed for long double support:
14546*** $message
fe63a0b4
JH
14547*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14548*** Cannot continue, aborting.
89ce900e
JH
14549
14550EOM
14551
fe63a0b4 14552 exit 1
89ce900e
JH
14553 fi
14554fi
14555
b4eb6b3d
JH
14556: see if mprotect exists
14557set mprotect d_mprotect
14558eval $inlibc
14559
14560: see if msgctl exists
14561set msgctl d_msgctl
14562eval $inlibc
14563
14564: see if msgget exists
14565set msgget d_msgget
14566eval $inlibc
14567
14568: see if msgsnd exists
14569set msgsnd d_msgsnd
14570eval $inlibc
14571
14572: see if msgrcv exists
14573set msgrcv d_msgrcv
14574eval $inlibc
14575
14576: see how much of the 'msg*(2)' library is present.
14577h_msg=true
14578echo " "
14579case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14580*"$undef"*) h_msg=false;;
14581esac
14582case "$osname" in
14583freebsd)
14584 case "`ipcs 2>&1`" in
14585 "SVID messages"*"not configured"*)
14586 echo "Your $osname does not have the msg*(2) configured." >&4
14587 h_msg=false
14588 val="$undef"
14589 set msgctl d_msgctl
14590 eval $setvar
14591 set msgget d_msgget
14592 eval $setvar
14593 set msgsnd d_msgsnd
14594 eval $setvar
14595 set msgrcv d_msgrcv
14596 eval $setvar
14597 ;;
14598 esac
14599 ;;
14600esac
14601: we could also check for sys/ipc.h ...
14602if $h_msg && $test `./findhdr sys/msg.h`; then
14603 echo "You have the full msg*(2) library." >&4
14604 val="$define"
14605else
14606 echo "You don't have the full msg*(2) library." >&4
14607 val="$undef"
14608fi
14609set d_msg
14610eval $setvar
14611
4e0554ec
JH
14612
14613echo " "
14614echo "Checking to see if your system supports struct msghdr..." >&4
14615set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14616eval $hasstruct
14617case "$d_msghdr_s" in
14618"$define") echo "Yes, it does." ;;
14619*) echo "No, it doesn't." ;;
14620esac
14621
14622
b4eb6b3d
JH
14623: see if msync exists
14624set msync d_msync
14625eval $inlibc
14626
14627: see if munmap exists
14628set munmap d_munmap
14629eval $inlibc
14630
14631: see if nice exists
14632set nice d_nice
14633eval $inlibc
14634
2765b840
JH
14635: see if this is a langinfo.h system
14636set langinfo.h i_langinfo
14637eval $inhdr
14638
14639: see if nl_langinfo exists
14640set nl_langinfo d_nl_langinfo
14641eval $inlibc
14642
b4eb6b3d
JH
14643: check for length of character
14644echo " "
14645case "$charsize" in
14646'')
14647 echo "Checking to see how big your characters are (hey, you never know)..." >&4
74d00865 14648 $cat >try.c <<EOCP
b4eb6b3d 14649#include <stdio.h>
d1daaddf
JH
14650#$i_stdlib I_STDLIB
14651#ifdef I_STDLIB
14652#include <stdlib.h>
14653#endif
b4eb6b3d
JH
14654int main()
14655{
14656 printf("%d\n", (int)sizeof(char));
14657 exit(0);
14658}
14659EOCP
14660 set try
14661 if eval $compile_ok; then
5440bc8e 14662 dflt=`$run ./try`
b4eb6b3d
JH
14663 else
14664 dflt='1'
14665 echo "(I can't seem to compile the test program. Guessing...)"
14666 fi
14667 ;;
14668*)
14669 dflt="$charsize"
14670 ;;
14671esac
14672rp="What is the size of a character (in bytes)?"
14673. ./myread
14674charsize="$ans"
14675$rm -f try.c try
14676
1d1be0dc
NC
14677: check for volatile keyword
14678echo " "
14679echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14680$cat >try.c <<'EOCP'
76f47787 14681int main()
1d1be0dc
NC
14682{
14683 typedef struct _goo_struct goo_struct;
14684 goo_struct * volatile goo = ((goo_struct *)0);
14685 struct _goo_struct {
14686 long long_int;
14687 int reg_int;
14688 char char_var;
14689 };
14690 typedef unsigned short foo_t;
14691 char *volatile foo;
14692 volatile int bar;
14693 volatile foo_t blech;
14694 foo = foo;
14695}
14696EOCP
14697if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14698 val="$define"
14699 echo "Yup, it does."
14700else
14701 val="$undef"
14702 echo "Nope, it doesn't."
14703fi
14704set d_volatile
14705eval $setvar
14706$rm -f try.*
14707
b4eb6b3d
JH
14708
14709echo " "
14710$echo "Choosing the C types to be used for Perl's internal types..." >&4
14711
14712case "$use64bitint:$d_quad:$quadtype" in
14713define:define:?*)
14714 ivtype="$quadtype"
14715 uvtype="$uquadtype"
14716 ivsize=8
14717 uvsize=8
14718 ;;
14719*) ivtype="long"
14720 uvtype="unsigned long"
14721 ivsize=$longsize
14722 uvsize=$longsize
14723 ;;
14724esac
14725
14726case "$uselongdouble:$d_longdbl" in
14727define:define)
14728 nvtype="long double"
14729 nvsize=$longdblsize
14730 ;;
14731*) nvtype=double
14732 nvsize=$doublesize
14733 ;;
14734esac
14735
14736$echo "(IV will be "$ivtype", $ivsize bytes)"
14737$echo "(UV will be "$uvtype", $uvsize bytes)"
14738$echo "(NV will be "$nvtype", $nvsize bytes)"
14739
14740$cat >try.c <<EOCP
14741#$i_inttypes I_INTTYPES
14742#ifdef I_INTTYPES
14743#include <inttypes.h>
14744#endif
14745#include <stdio.h>
14746int main() {
14747#ifdef INT8
14748 int8_t i = INT8_MAX;
14749 uint8_t u = UINT8_MAX;
14750 printf("int8_t\n");
14751#endif
14752#ifdef INT16
14753 int16_t i = INT16_MAX;
14754 uint16_t i = UINT16_MAX;
14755 printf("int16_t\n");
14756#endif
14757#ifdef INT32
14758 int32_t i = INT32_MAX;
14759 uint32_t u = UINT32_MAX;
14760 printf("int32_t\n");
14761#endif
14762}
14763EOCP
14764
14765case "$i8type" in
14766'') case "$charsize" in
14767 1) i8type=char
14768 u8type="unsigned char"
14769 i8size=$charsize
14770 u8size=$charsize
14771 ;;
14772 esac
14773 ;;
14774esac
14775case "$i8type" in
14776'') set try -DINT8
14777 if eval $compile; then
5440bc8e 14778 case "`$run ./try`" in
b4eb6b3d
JH
14779 int8_t) i8type=int8_t
14780 u8type=uint8_t
14781 i8size=1
14782 u8size=1
14783 ;;
14784 esac
14785 fi
14786 ;;
14787esac
14788case "$i8type" in
14789'') if $test $charsize -ge 1; then
14790 i8type=char
14791 u8type="unsigned char"
14792 i8size=$charsize
14793 u8size=$charsize
14794 fi
14795 ;;
14796esac
14797
14798case "$i16type" in
14799'') case "$shortsize" in
14800 2) i16type=short
14801 u16type="unsigned short"
14802 i16size=$shortsize
14803 u16size=$shortsize
14804 ;;
14805 esac
14806 ;;
14807esac
14808case "$i16type" in
14809'') set try -DINT16
14810 if eval $compile; then
5440bc8e 14811 case "`$run ./try`" in
b4eb6b3d
JH
14812 int16_t)
14813 i16type=int16_t
14814 u16type=uint16_t
14815 i16size=2
14816 u16size=2
14817 ;;
14818 esac
14819 fi
14820 ;;
14821esac
14822case "$i16type" in
14823'') if $test $shortsize -ge 2; then
14824 i16type=short
14825 u16type="unsigned short"
14826 i16size=$shortsize
14827 u16size=$shortsize
14828 fi
14829 ;;
14830esac
14831
14832case "$i32type" in
14833'') case "$longsize" in
14834 4) i32type=long
14835 u32type="unsigned long"
14836 i32size=$longsize
14837 u32size=$longsize
14838 ;;
14839 *) case "$intsize" in
14840 4) i32type=int
14841 u32type="unsigned int"
14842 i32size=$intsize
14843 u32size=$intsize
14844 ;;
14845 esac
14846 ;;
14847 esac
14848 ;;
14849esac
14850case "$i32type" in
14851'') set try -DINT32
14852 if eval $compile; then
5440bc8e 14853 case "`$run ./try`" in
b4eb6b3d
JH
14854 int32_t)
14855 i32type=int32_t
14856 u32type=uint32_t
14857 i32size=4
14858 u32size=4
14859 ;;
14860 esac
14861 fi
14862 ;;
14863esac
14864case "$i32type" in
14865'') if $test $intsize -ge 4; then
14866 i32type=int
14867 u32type="unsigned int"
14868 i32size=$intsize
14869 u32size=$intsize
14870 fi
14871 ;;
14872esac
14873
14874case "$i64type" in
14875'') case "$d_quad:$quadtype" in
14876 define:?*)
14877 i64type="$quadtype"
14878 u64type="$uquadtype"
14879 i64size=8
14880 u64size=8
14881 ;;
14882 esac
14883 ;;
14884esac
14885
1d1be0dc
NC
14886$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14887: volatile so that the compiler has to store it out to memory.
14888if test X"$d_volatile" = X"$define"; then
14889 volatile=volatile
14890fi
b4eb6b3d
JH
14891$cat <<EOP >try.c
14892#include <stdio.h>
55954f19
JH
14893#$i_stdlib I_STDLIB
14894#ifdef I_STDLIB
14895#include <stdlib.h>
14896#endif
1d1be0dc
NC
14897#include <sys/types.h>
14898#include <signal.h>
14899#ifdef SIGFPE
14900$volatile int bletched = 0;
14901$signal_t blech(s) int s; { bletched = 1; }
14902#endif
b4eb6b3d
JH
14903int main() {
14904 $uvtype u = 0;
1d1be0dc 14905 $nvtype d;
b4eb6b3d
JH
14906 int n = 8 * $uvsize;
14907 int i;
1d1be0dc
NC
14908#ifdef SIGFPE
14909 signal(SIGFPE, blech);
14910#endif
14911
b4eb6b3d
JH
14912 for (i = 0; i < n; i++) {
14913 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
14914 d = ($nvtype)u;
14915 if (($uvtype)d != u)
b4eb6b3d 14916 break;
1d1be0dc
NC
14917 if (d <= 0)
14918 break;
14919 d = ($nvtype)(u - 1);
14920 if (($uvtype)d != (u - 1))
14921 break;
14922#ifdef SIGFPE
14923 if (bletched) {
14924 break;
14925#endif
14926 }
b4eb6b3d 14927 }
efd1522b 14928 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
14929 exit(0);
14930}
14931EOP
1d1be0dc
NC
14932set try
14933
14934d_nv_preserves_uv="$undef"
14935if eval $compile; then
53133ed1 14936 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 14937fi
53133ed1 14938case "$nv_preserves_uv_bits" in
1d1be0dc 14939\-[1-9]*)
53133ed1
NC
14940 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14941 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 14942 d_nv_preserves_uv="$define"
b4eb6b3d 14943 ;;
53133ed1 14944[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
14945 d_nv_preserves_uv="$undef" ;;
14946*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
53133ed1 14947 nv_preserves_uv_bits="$undef" ;;
b4eb6b3d
JH
14948esac
14949
1d1be0dc
NC
14950$rm -f try.* try
14951
f607920a
CB
14952$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14953: volatile so that the compiler has to store it out to memory.
14954if test X"$d_volatile" = X"$define"; then
14955 volatile=volatile
14956fi
14957$cat <<EOP >try.c
14958#include <stdio.h>
14959#$i_stdlib I_STDLIB
14960#ifdef I_STDLIB
14961#include <stdlib.h>
14962#endif
14963#$i_string I_STRING
14964#ifdef I_STRING
14965# include <string.h>
14966#else
14967# include <strings.h>
14968#endif
14969#include <sys/types.h>
14970#include <signal.h>
14971#ifdef SIGFPE
14972$volatile int bletched = 0;
14973$signal_t blech(s) int s; { bletched = 1; }
14974#endif
14975
14976int checkit($nvtype d, char *where) {
14977 unsigned char *p = (char *)&d;
14978 unsigned char *end = p + sizeof(d);
14979 int fail = 0;
14980
14981 while (p < end)
14982 fail += *p++;
14983
14984 if (!fail)
17f6277d 14985 return 0;
f607920a
CB
14986
14987 p = (char *)&d;
14988 printf("No - %s: 0x", where);
14989 while (p < end)
14990 printf ("%02X", *p++);
14991 printf("\n");
14992 return 1;
14993}
14994
14995int main(int argc, char **argv) {
14996 $nvtype d = 0.0;
14997 int fail = 0;
14998 fail += checkit(d, "0.0");
14999
15000 /* The compiler shouldn't be assuming that bletched is 0 */
15001 d = bletched;
15002
15003 fail += checkit(d, "bleched");
15004
15005#ifdef SIGFPE
15006 signal(SIGFPE, blech);
15007#endif
15008
15009 /* Paranoia - the compiler should have no way of knowing that ANSI says
15010 that argv[argc] will always be NULL. Actually, if it did assume this it
15011 would be buggy, as this is C and main() can be called from elsewhere in
15012 the program. */
15013 d = argv[argc] ? 1 : 0;
15014
15015 if (d) {
15016 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15017 }
15018
15019 fail += checkit(d, "ternary");
15020
15021 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15022
15023 if (d != 0.0) {
15024 printf("No - memset doesn't give 0.0\n");
15025 /* This might just blow up: */
15026 printf("(gives %g)\n", d);
15027 return 1;
15028 }
15029
15030#ifdef SIGFPE
15031 if (bletched) {
15032 printf("No - something bleched\n");
15033 return 1;
15034 }
15035#endif
15036 if (fail) {
15037 printf("No - %d fail(s)\n", fail);
15038 return 1;
15039 }
15040 printf("Yes\n");
15041 return 0;
15042}
15043EOP
15044set try
15045
15046d_nv_zero_is_allbits_zero="$undef"
15047if eval $compile; then
15048 xxx="`$run ./try`"
15049 case "$?" in
15050 0)
15051 case "$xxx" in
15052 Yes) cat >&4 <<EOM
150530.0 is represented as all bits zero in memory
15054EOM
15055 d_nv_zero_is_allbits_zero="$define"
15056 ;;
15057 *) cat >&4 <<EOM
150580.0 is not represented as all bits zero in memory
15059EOM
15060 d_nv_zero_is_allbits_zero="$undef"
15061 ;;
15062 esac
15063 ;;
15064 *) cat >&4 <<EOM
150650.0 is not represented as all bits zero in memory
15066EOM
15067 d_nv_zero_is_allbits_zero="$undef"
15068 ;;
15069 esac
15070fi
15071
15072$rm -f try.* try
15073
b4eb6b3d
JH
15074
15075: check for off64_t
15076echo " "
15077echo "Checking to see if you have off64_t..." >&4
15078$cat >try.c <<EOCP
15079#include <sys/types.h>
15080#include <unistd.h>
15081int main() { off64_t x = 7; }
15082EOCP
15083set try
15084if eval $compile; then
15085 val="$define"
15086 echo "You have off64_t."
15087else
15088 val="$undef"
15089 echo "You do not have off64_t."
15090 case "$lseeksize" in
15091 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15092 esac
15093fi
15094$rm -f try.* try
15095set d_off64_t
15096eval $setvar
15097
b4eb6b3d
JH
15098: how to create joinable pthreads
15099if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15100 echo " "
15101 echo "Checking what constant to use for creating joinable pthreads..." >&4
15102 $cat >try.c <<'EOCP'
15103#include <pthread.h>
15104int main() {
15105 int detachstate = JOINABLE;
15106}
15107EOCP
15108 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15109 if eval $compile; then
15110 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15111 val="$undef" # Yes, undef.
15112 set d_old_pthread_create_joinable
15113 eval $setvar
15114 val=""
15115 set old_pthread_create_joinable
15116 eval $setvar
15117 else
15118 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15119 if eval $compile; then
15120 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15121 val="$define"
15122 set d_old_pthread_create_joinable
15123 eval $setvar
15124 val=PTHREAD_CREATE_UNDETACHED
15125 set old_pthread_create_joinable
15126 eval $setvar
15127 else
15128 set try -DJOINABLE=__UNDETACHED
15129 if eval $compile; then
15130 echo "You seem to use __UNDETACHED." >&4
15131 val="$define"
15132 set d_old_pthread_create_joinable
15133 eval $setvar
15134 val=__UNDETACHED
15135 set old_pthread_create_joinable
15136 eval $setvar
15137 else
15138 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15139 val="$define"
15140 set d_old_pthread_create_joinable
15141 eval $setvar
15142 val=0
15143 set old_pthread_create_joinable
15144 eval $setvar
15145 fi
15146 fi
15147 fi
15148 $rm -f try try.*
15149else
15150 d_old_pthread_create_joinable="$undef"
15151 old_pthread_create_joinable=""
15152fi
15153
15154: see if pause exists
15155set pause d_pause
15156eval $inlibc
15157
15158: see if pipe exists
15159set pipe d_pipe
15160eval $inlibc
15161
15162: see if poll exists
15163set poll d_poll
15164eval $inlibc
15165
c7aff470
NIS
15166: see if readlink exists
15167set readlink d_readlink
15168eval $inlibc
15169
15170echo " "
f24dbf84 15171procselfexe=''
c7aff470 15172val="$undef"
a33c94aa
JH
15173case "$d_readlink" in
15174"$define")
c7aff470
NIS
15175 if $issymlink /proc/self/exe ; then
15176 $ls -l /proc/self/exe > reflect
51660ed5 15177 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15178 echo "You have Linux-like /proc/self/exe."
92236451 15179 procselfexe='"/proc/self/exe"'
f24dbf84 15180 val="$define"
f24dbf84
JH
15181 fi
15182 fi
15183 if $issymlink /proc/curproc/file ; then
15184 $ls -l /proc/curproc/file > reflect
15185 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15186 echo "You have BSD-like /proc/curproc/file."
92236451 15187 procselfexe='"/proc/curproc/file"'
f24dbf84 15188 val="$define"
c7aff470 15189 fi
c7aff470 15190 fi
a33c94aa
JH
15191 ;;
15192esac
428dc699 15193$rm -f reflect
c7aff470
NIS
15194set d_procselfexe
15195eval $setvar
15196
263fee3f
JH
15197: see whether the pthread_atfork exists
15198$cat >try.c <<EOP
15199#include <pthread.h>
15200#include <stdio.h>
15201int main() {
15202#ifdef PTHREAD_ATFORK
15203 pthread_atfork(NULL,NULL,NULL);
15204#endif
15205}
15206EOP
15207
d6483fcc 15208: see if pthread_atfork exists
263fee3f
JH
15209set try -DPTHREAD_ATFORK
15210if eval $compile; then
15211 val="$define"
15212else
15213 val="$undef"
15214fi
15215case "$usethreads" in
15216$define)
15217 case "$val" in
15218 $define) echo 'pthread_atfork found.' >&4 ;;
15219 *) echo 'pthread_atfork NOT found.' >&4 ;;
15220 esac
15221esac
15222set d_pthread_atfork
15223eval $setvar
d6483fcc 15224
58d975c3
JH
15225: see if pthread_attr_setscope exists
15226set pthread_attr_setscope d_pthread_attr_setscope
15227eval $inlibc
15228
b4eb6b3d
JH
15229
15230: see whether the various POSIXish _yields exist
15231$cat >try.c <<EOP
15232#include <pthread.h>
15233#include <stdio.h>
15234int main() {
15235#ifdef SCHED_YIELD
15236 sched_yield();
15237#else
15238#ifdef PTHREAD_YIELD
15239 pthread_yield();
15240#else
15241#ifdef PTHREAD_YIELD_NULL
15242 pthread_yield(NULL);
15243#endif
15244#endif
15245#endif
15246}
15247EOP
15248: see if sched_yield exists
15249set try -DSCHED_YIELD
15250if eval $compile; then
15251 val="$define"
15252 sched_yield='sched_yield()'
15253else
15254 val="$undef"
15255fi
15256case "$usethreads" in
15257$define)
15258 case "$val" in
15259 $define) echo 'sched_yield() found.' >&4 ;;
15260 *) echo 'sched_yield() NOT found.' >&4 ;;
15261 esac
15262esac
10bc17b6
JH
15263set d_sched_yield
15264eval $setvar
b4eb6b3d 15265
10bc17b6
JH
15266: see if pthread_yield exists
15267set try -DPTHREAD_YIELD
15268if eval $compile; then
15269 val="$define"
15270 case "$sched_yield" in
15271 '') sched_yield='pthread_yield()' ;;
15272 esac
15273else
15274 set try -DPTHREAD_YIELD_NULL
15275 if eval $compile; then
15276 val="$define"
15277 case "$sched_yield" in
15278 '') sched_yield='pthread_yield(NULL)' ;;
15279 esac
15280 else
15281 val="$undef"
15282 fi
15283fi
15284case "$usethreads" in
15285$define)
15286 case "$val" in
15287 $define) echo 'pthread_yield() found.' >&4 ;;
15288 *) echo 'pthread_yield() NOT found.' >&4 ;;
15289 esac
15290 ;;
15291esac
15292set d_pthread_yield
15293eval $setvar
b4eb6b3d 15294
10bc17b6
JH
15295case "$sched_yield" in
15296'') sched_yield=undef ;;
15297esac
b4eb6b3d 15298
10bc17b6
JH
15299$rm -f try try.*
15300
15301: see if random_r exists
15302set random_r d_random_r
15303eval $inlibc
15304case "$d_random_r" in
15305"$define")
15306 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15307 case "$d_random_r_proto:$usethreads" in
15308 ":define") d_random_r_proto=define
a48ec845
JH
15309 set d_random_r_proto random_r $hdrs
15310 eval $hasproto ;;
15311 *) ;;
15312 esac
15313 case "$d_random_r_proto" in
15314 define)
10bc17b6
JH
15315 case "$random_r_proto" in
15316 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15317 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15318 esac
15319 case "$random_r_proto" in
15320 ''|0) try='int random_r(long*, struct random_data*);'
15321 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15322 esac
15323 case "$random_r_proto" in
15324 ''|0) try='int random_r(struct random_data*, int32_t*);'
15325 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15326 esac
15327 case "$random_r_proto" in
90e831dc 15328 ''|0) d_random_r=undef
10bc17b6 15329 random_r_proto=0
a48ec845 15330 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15331 * ) case "$random_r_proto" in
15332 REENTRANT_PROTO*) ;;
15333 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15334 esac
15335 echo "Prototype: $try" ;;
15336 esac
b4eb6b3d 15337 ;;
c18e646a
JH
15338 *) case "$usethreads" in
15339 define) echo "random_r has no prototype, not using it." >&4 ;;
15340 esac
90e831dc
SB
15341 d_random_r=undef
15342 random_r_proto=0
c18e646a 15343 ;;
a48ec845
JH
15344 esac
15345 ;;
10bc17b6 15346*) random_r_proto=0
b4eb6b3d
JH
15347 ;;
15348esac
15349
15350: see if readdir and friends exist
15351set readdir d_readdir
15352eval $inlibc
15353set seekdir d_seekdir
15354eval $inlibc
15355set telldir d_telldir
15356eval $inlibc
15357set rewinddir d_rewinddir
15358eval $inlibc
15359
10bc17b6
JH
15360: see if readdir64_r exists
15361set readdir64_r d_readdir64_r
15362eval $inlibc
15363case "$d_readdir64_r" in
15364"$define")
15365 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15366 case "$d_readdir64_r_proto:$usethreads" in
15367 ":define") d_readdir64_r_proto=define
a48ec845
JH
15368 set d_readdir64_r_proto readdir64_r $hdrs
15369 eval $hasproto ;;
15370 *) ;;
15371 esac
15372 case "$d_readdir64_r_proto" in
15373 define)
10bc17b6
JH
15374 case "$readdir64_r_proto" in
15375 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15376 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15377 esac
15378 case "$readdir64_r_proto" in
15379 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15380 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15381 esac
15382 case "$readdir64_r_proto" in
90e831dc 15383 ''|0) d_readdir64_r=undef
10bc17b6 15384 readdir64_r_proto=0
a48ec845 15385 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15386 * ) case "$readdir64_r_proto" in
15387 REENTRANT_PROTO*) ;;
15388 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15389 esac
15390 echo "Prototype: $try" ;;
15391 esac
15392 ;;
c18e646a
JH
15393 *) case "$usethreads" in
15394 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15395 esac
90e831dc
SB
15396 d_readdir64_r=undef
15397 readdir64_r_proto=0
c18e646a 15398 ;;
a48ec845
JH
15399 esac
15400 ;;
10bc17b6
JH
15401*) readdir64_r_proto=0
15402 ;;
15403esac
15404
15405: see if readdir_r exists
15406set readdir_r d_readdir_r
15407eval $inlibc
15408case "$d_readdir_r" in
15409"$define")
15410 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15411 case "$d_readdir_r_proto:$usethreads" in
15412 ":define") d_readdir_r_proto=define
a48ec845
JH
15413 set d_readdir_r_proto readdir_r $hdrs
15414 eval $hasproto ;;
15415 *) ;;
15416 esac
15417 case "$d_readdir_r_proto" in
15418 define)
10bc17b6
JH
15419 case "$readdir_r_proto" in
15420 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15421 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15422 esac
15423 case "$readdir_r_proto" in
15424 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15425 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15426 esac
15427 case "$readdir_r_proto" in
90e831dc 15428 ''|0) d_readdir_r=undef
10bc17b6 15429 readdir_r_proto=0
a48ec845 15430 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15431 * ) case "$readdir_r_proto" in
15432 REENTRANT_PROTO*) ;;
15433 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15434 esac
15435 echo "Prototype: $try" ;;
15436 esac
15437 ;;
c18e646a
JH
15438 *) case "$usethreads" in
15439 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15440 esac
90e831dc
SB
15441 d_readdir_r=undef
15442 readdir_r_proto=0
c18e646a 15443 ;;
a48ec845
JH
15444 esac
15445 ;;
10bc17b6
JH
15446*) readdir_r_proto=0
15447 ;;
15448esac
15449
4e0554ec
JH
15450: see if readv exists
15451set readv d_readv
15452eval $inlibc
15453
15454: see if recvmsg exists
15455set recvmsg d_recvmsg
15456eval $inlibc
15457
b4eb6b3d
JH
15458: see if rename exists
15459set rename d_rename
15460eval $inlibc
15461
15462: see if rmdir exists
15463set rmdir d_rmdir
15464eval $inlibc
15465
15466: see if memory.h is available.
15467val=''
15468set memory.h val
15469eval $inhdr
15470
15471: See if it conflicts with string.h
15472case "$val" in
15473$define)
15474 case "$strings" in
15475 '') ;;
15476 *)
15477 $cppstdin $cppflags $cppminus < $strings > mem.h
15478 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15479 echo " "
15480 echo "We won't be including <memory.h>."
15481 val="$undef"
15482 fi
15483 $rm -f mem.h
15484 ;;
15485 esac
15486esac
15487set i_memory
15488eval $setvar
15489
15490: can bcopy handle overlapping blocks?
b6cc3bc4 15491echo " "
b4eb6b3d 15492val="$undef"
b6cc3bc4
AD
15493case "$d_memmove" in
15494"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15495*) case "$d_bcopy" in
15496 "$define")
15497 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15498 $cat >try.c <<EOCP
b4eb6b3d
JH
15499#$i_memory I_MEMORY
15500#$i_stdlib I_STDLIB
15501#$i_string I_STRING
15502#$i_unistd I_UNISTD
15503EOCP
15504 $cat >>try.c <<'EOCP'
15505#include <stdio.h>
15506#ifdef I_MEMORY
15507# include <memory.h>
15508#endif
15509#ifdef I_STDLIB
15510# include <stdlib.h>
15511#endif
15512#ifdef I_STRING
15513# include <string.h>
15514#else
15515# include <strings.h>
15516#endif
15517#ifdef I_UNISTD
15518# include <unistd.h> /* Needed for NetBSD */
15519#endif
15520int main()
15521{
15522char buf[128], abc[128];
15523char *b;
15524int len;
15525int off;
15526int align;
15527
b6cc3bc4
AD
15528/* Copy "abcde..." string to char abc[] so that gcc doesn't
15529 try to store the string in read-only memory. */
b4eb6b3d
JH
15530bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15531
15532for (align = 7; align >= 0; align--) {
15533 for (len = 36; len; len--) {
15534 b = buf+align;
15535 bcopy(abc, b, len);
15536 for (off = 1; off <= len; off++) {
15537 bcopy(b, b+off, len);
15538 bcopy(b+off, b, len);
15539 if (bcmp(b, abc, len))
15540 exit(1);
15541 }
15542 }
15543}
15544exit(0);
15545}
15546EOCP
b6cc3bc4
AD
15547 set try
15548 if eval $compile_ok; then
15549 if ./try 2>/dev/null; then
15550 echo "Yes, it can."
15551 val="$define"
15552 else
15553 echo "It can't, sorry."
15554 fi
b4eb6b3d 15555 else
b6cc3bc4 15556 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15557 fi
b6cc3bc4
AD
15558 ;;
15559 esac
15560 $rm -f try.* try core
b4eb6b3d
JH
15561 ;;
15562esac
b4eb6b3d
JH
15563set d_safebcpy
15564eval $setvar
15565
15566: can memcpy handle overlapping blocks?
b6cc3bc4 15567echo " "
b4eb6b3d 15568val="$undef"
b6cc3bc4
AD
15569case "$d_memmove" in
15570"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15571*) case "$d_memcpy" in
15572 "$define")
15573 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15574 $cat >try.c <<EOCP
b4eb6b3d
JH
15575#$i_memory I_MEMORY
15576#$i_stdlib I_STDLIB
15577#$i_string I_STRING
15578#$i_unistd I_UNISTD
15579EOCP
15580 $cat >>try.c <<'EOCP'
15581#include <stdio.h>
15582#ifdef I_MEMORY
15583# include <memory.h>
15584#endif
15585#ifdef I_STDLIB
15586# include <stdlib.h>
15587#endif
15588#ifdef I_STRING
15589# include <string.h>
15590#else
15591# include <strings.h>
15592#endif
15593#ifdef I_UNISTD
15594# include <unistd.h> /* Needed for NetBSD */
15595#endif
15596int main()
15597{
15598char buf[128], abc[128];
15599char *b;
15600int len;
15601int off;
15602int align;
15603
15604/* Copy "abcde..." string to char abc[] so that gcc doesn't
15605 try to store the string in read-only memory. */
15606memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15607
15608for (align = 7; align >= 0; align--) {
15609 for (len = 36; len; len--) {
15610 b = buf+align;
15611 memcpy(b, abc, len);
15612 for (off = 1; off <= len; off++) {
15613 memcpy(b+off, b, len);
15614 memcpy(b, b+off, len);
15615 if (memcmp(b, abc, len))
15616 exit(1);
15617 }
15618 }
15619}
15620exit(0);
15621}
15622EOCP
b6cc3bc4
AD
15623 set try
15624 if eval $compile_ok; then
15625 if ./try 2>/dev/null; then
15626 echo "Yes, it can."
15627 val="$define"
15628 else
15629 echo "It can't, sorry."
15630 fi
b4eb6b3d 15631 else
b6cc3bc4 15632 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15633 fi
b6cc3bc4
AD
15634 ;;
15635 esac
15636 $rm -f try.* try core
b4eb6b3d
JH
15637 ;;
15638esac
b4eb6b3d
JH
15639set d_safemcpy
15640eval $setvar
15641
15642: can memcmp be trusted to compare relative magnitude?
15643val="$undef"
15644case "$d_memcmp" in
15645"$define")
15646 echo " "
15647 echo "Checking if your memcmp() can compare relative magnitude..." >&4
15648 $cat >try.c <<EOCP
15649#$i_memory I_MEMORY
15650#$i_stdlib I_STDLIB
15651#$i_string I_STRING
15652#$i_unistd I_UNISTD
15653EOCP
15654 $cat >>try.c <<'EOCP'
15655#include <stdio.h>
15656#ifdef I_MEMORY
15657# include <memory.h>
15658#endif
15659#ifdef I_STDLIB
36adc09b 15660# include <stdlib.h>
b4eb6b3d
JH
15661#endif
15662#ifdef I_STRING
15663# include <string.h>
15664#else
15665# include <strings.h>
15666#endif
15667#ifdef I_UNISTD
15668# include <unistd.h> /* Needed for NetBSD */
15669#endif
15670int main()
15671{
15672char a = -1;
15673char b = 0;
15674if ((a < b) && memcmp(&a, &b, 1) < 0)
15675 exit(1);
15676exit(0);
15677}
15678EOCP
15679 set try
15680 if eval $compile_ok; then
5440bc8e 15681 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
15682 echo "Yes, it can."
15683 val="$define"
15684 else
15685 echo "No, it can't (it uses signed chars)."
15686 fi
15687 else
15688 echo "(I can't compile the test program, so we'll assume not...)"
15689 fi
15690 ;;
15691esac
15692$rm -f try.* try core
15693set d_sanemcmp
15694eval $setvar
15695
ef9f17be
JH
15696: see if prototype for sbrk is available
15697echo " "
15698set d_sbrkproto sbrk $i_unistd unistd.h
15699eval $hasproto
15700
b4eb6b3d
JH
15701: see if select exists
15702set select d_select
15703eval $inlibc
15704
15705: see if semctl exists
15706set semctl d_semctl
15707eval $inlibc
15708
15709: see if semget exists
15710set semget d_semget
15711eval $inlibc
15712
15713: see if semop exists
15714set semop d_semop
15715eval $inlibc
15716
15717: see how much of the 'sem*(2)' library is present.
15718h_sem=true
15719echo " "
15720case "$d_semctl$d_semget$d_semop" in
15721*"$undef"*) h_sem=false;;
15722esac
15723case "$osname" in
15724freebsd)
15725 case "`ipcs 2>&1`" in
15726 "SVID messages"*"not configured"*)
15727 echo "Your $osname does not have the sem*(2) configured." >&4
15728 h_sem=false
15729 val="$undef"
15730 set semctl d_semctl
15731 eval $setvar
15732 set semget d_semget
15733 eval $setvar
15734 set semop d_semop
15735 eval $setvar
15736 ;;
15737 esac
15738 ;;
15739esac
15740: we could also check for sys/ipc.h ...
15741if $h_sem && $test `./findhdr sys/sem.h`; then
15742 echo "You have the full sem*(2) library." >&4
15743 val="$define"
15744else
15745 echo "You don't have the full sem*(2) library." >&4
15746 val="$undef"
15747fi
15748set d_sem
15749eval $setvar
15750
15751: see whether sys/sem.h defines union semun
15752echo " "
15753$cat > try.c <<'END'
15754#include <sys/types.h>
15755#include <sys/ipc.h>
15756#include <sys/sem.h>
15757int main () { union semun semun; semun.buf = 0; }
15758END
15759set try
15760if eval $compile; then
15761 echo "You have union semun in <sys/sem.h>." >&4
15762 val="$define"
15763else
15764 echo "You do not have union semun in <sys/sem.h>." >&4
15765 val="$undef"
15766fi
2fad75a1 15767$rm -f try try.c
b4eb6b3d
JH
15768set d_union_semun
15769eval $setvar
15770
15771: see how to do semctl IPC_STAT
15772case "$d_sem" in
15773$define)
b4eb6b3d
JH
15774 echo " "
15775 $cat > try.h <<END
15776#ifndef S_IRUSR
15777# ifdef S_IREAD
15778# define S_IRUSR S_IREAD
15779# define S_IWUSR S_IWRITE
15780# define S_IXUSR S_IEXEC
15781# else
15782# define S_IRUSR 0400
15783# define S_IWUSR 0200
15784# define S_IXUSR 0100
15785# endif
15786# define S_IRGRP (S_IRUSR>>3)
15787# define S_IWGRP (S_IWUSR>>3)
15788# define S_IXGRP (S_IXUSR>>3)
15789# define S_IROTH (S_IRUSR>>6)
15790# define S_IWOTH (S_IWUSR>>6)
15791# define S_IXOTH (S_IXUSR>>6)
15792#endif
15793#ifndef S_IRWXU
15794# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15795# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15796# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15797#endif
15798END
2fad75a1 15799 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
15800 case "$d_semctl_semun" in
15801 '')
35918792 15802 val="$undef"
2fad75a1 15803 $cat > try.c <<END
b4eb6b3d
JH
15804#include <sys/types.h>
15805#include <sys/ipc.h>
15806#include <sys/sem.h>
15807#include <sys/stat.h>
15808#include <stdio.h>
15809#include <errno.h>
15810#include "try.h"
15811#ifndef errno
15812extern int errno;
15813#endif
15814#$d_union_semun HAS_UNION_SEMUN
15815int main() {
15816 union semun
15817#ifndef HAS_UNION_SEMUN
15818 {
15819 int val;
15820 struct semid_ds *buf;
15821 unsigned short *array;
15822 }
15823#endif
15824 arg;
15825 int sem, st;
15826
15827#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15828 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15829 if (sem > -1) {
15830 struct semid_ds argbuf;
15831 arg.buf = &argbuf;
15832# ifdef IPC_STAT
15833 st = semctl(sem, 0, IPC_STAT, arg);
15834 if (st == 0)
15835 printf("semun\n");
15836 else
15837# endif /* IPC_STAT */
15838 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15839# ifdef IPC_RMID
15840 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 15841# endif /* IPC_RMID */
b4eb6b3d
JH
15842 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15843 } else
15844#endif /* IPC_PRIVATE && ... */
15845 printf("semget failed: errno = %d\n", errno);
15846 return 0;
15847}
15848END
2fad75a1
JH
15849 set try
15850 if eval $compile; then
15851 xxx=`$run ./try`
15852 case "$xxx" in
15853 semun) val="$define" ;;
15854 esac
15855 fi
15856 $rm -f try try.c
35918792
YST
15857 set d_semctl_semun
15858 eval $setvar
2fad75a1
JH
15859 ;;
15860 esac
b4eb6b3d
JH
15861 case "$d_semctl_semun" in
15862 $define)
15863 echo "You can use union semun for semctl IPC_STAT." >&4
15864 also='also'
15865 ;;
15866 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
15867 also=''
15868 ;;
15869 esac
15870
15871 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
15872 case "$d_semctl_semid_ds" in
15873 '')
35918792 15874 val="$undef"
2fad75a1 15875 $cat > try.c <<'END'
b4eb6b3d
JH
15876#include <sys/types.h>
15877#include <sys/ipc.h>
15878#include <sys/sem.h>
15879#include <sys/stat.h>
15880#include "try.h"
15881#include <stdio.h>
15882#include <errno.h>
15883#ifndef errno
15884extern int errno;
15885#endif
15886int main() {
15887 struct semid_ds arg;
15888 int sem, st;
15889
15890#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15891 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15892 if (sem > -1) {
15893# ifdef IPC_STAT
15894 st = semctl(sem, 0, IPC_STAT, &arg);
15895 if (st == 0)
15896 printf("semid_ds\n");
15897 else
15898# endif /* IPC_STAT */
15899 printf("semctl IPC_STAT failed: errno = %d\n", errno);
15900# ifdef IPC_RMID
15901 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15902# endif /* IPC_RMID */
15903 printf("semctl IPC_RMID failed: errno = %d\n", errno);
15904 } else
15905#endif /* IPC_PRIVATE && ... */
15906 printf("semget failed: errno = %d\n", errno);
15907
15908 return 0;
15909}
15910END
2fad75a1
JH
15911 set try
15912 if eval $compile; then
15913 xxx=`$run ./try`
15914 case "$xxx" in
15915 semid_ds) val="$define" ;;
15916 esac
15917 fi
15918 $rm -f try try.c
35918792
YST
15919 set d_semctl_semid_ds
15920 eval $setvar
2fad75a1
JH
15921 ;;
15922 esac
b4eb6b3d
JH
15923 case "$d_semctl_semid_ds" in
15924 $define)
15925 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15926 ;;
15927 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15928 ;;
15929 esac
15930 $rm -f try.h
15931 ;;
15932*) val="$undef"
15933
15934 # We do not have the full sem*(2) library, so assume we can not
15935 # use either.
15936
15937 set d_semctl_semun
15938 eval $setvar
15939
15940 set d_semctl_semid_ds
15941 eval $setvar
15942 ;;
15943esac
15944
4e0554ec
JH
15945: see if sendmsg exists
15946set sendmsg d_sendmsg
15947eval $inlibc
15948
b4eb6b3d
JH
15949: see if setegid exists
15950set setegid d_setegid
15951eval $inlibc
15952
15953: see if seteuid exists
15954set seteuid d_seteuid
15955eval $inlibc
15956
15957: see if setgrent exists
15958set setgrent d_setgrent
15959eval $inlibc
15960
10bc17b6
JH
15961: see if setgrent_r exists
15962set setgrent_r d_setgrent_r
15963eval $inlibc
15964case "$d_setgrent_r" in
15965"$define")
15966 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
15967 case "$d_setgrent_r_proto:$usethreads" in
15968 ":define") d_setgrent_r_proto=define
a48ec845
JH
15969 set d_setgrent_r_proto setgrent_r $hdrs
15970 eval $hasproto ;;
15971 *) ;;
15972 esac
15973 case "$d_setgrent_r_proto" in
15974 define)
10bc17b6
JH
15975 case "$setgrent_r_proto" in
15976 ''|0) try='int setgrent_r(FILE**);'
15977 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15978 esac
15979 case "$setgrent_r_proto" in
15980 ''|0) try='void setgrent_r(FILE**);'
15981 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15982 esac
15983 case "$setgrent_r_proto" in
90e831dc 15984 ''|0) d_setgrent_r=undef
10bc17b6 15985 setgrent_r_proto=0
a48ec845 15986 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15987 * ) case "$setgrent_r_proto" in
15988 REENTRANT_PROTO*) ;;
15989 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15990 esac
15991 echo "Prototype: $try" ;;
15992 esac
15993 ;;
c18e646a
JH
15994 *) case "$usethreads" in
15995 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15996 esac
90e831dc
SB
15997 d_setgrent_r=undef
15998 setgrent_r_proto=0
c18e646a 15999 ;;
a48ec845
JH
16000 esac
16001 ;;
10bc17b6
JH
16002*) setgrent_r_proto=0
16003 ;;
16004esac
16005
b4eb6b3d
JH
16006: see if sethostent exists
16007set sethostent d_sethent
16008eval $inlibc
16009
10bc17b6
JH
16010: see if sethostent_r exists
16011set sethostent_r d_sethostent_r
16012eval $inlibc
16013case "$d_sethostent_r" in
16014"$define")
16015 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16016 case "$d_sethostent_r_proto:$usethreads" in
16017 ":define") d_sethostent_r_proto=define
a48ec845
JH
16018 set d_sethostent_r_proto sethostent_r $hdrs
16019 eval $hasproto ;;
16020 *) ;;
16021 esac
16022 case "$d_sethostent_r_proto" in
16023 define)
10bc17b6
JH
16024 case "$sethostent_r_proto" in
16025 ''|0) try='int sethostent_r(int, struct hostent_data*);'
16026 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16027 esac
16028 case "$sethostent_r_proto" in
16029 ''|0) try='void sethostent_r(int, struct hostent_data*);'
16030 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16031 esac
16032 case "$sethostent_r_proto" in
90e831dc 16033 ''|0) d_sethostent_r=undef
10bc17b6 16034 sethostent_r_proto=0
a48ec845 16035 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16036 * ) case "$sethostent_r_proto" in
16037 REENTRANT_PROTO*) ;;
16038 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16039 esac
16040 echo "Prototype: $try" ;;
16041 esac
16042 ;;
c18e646a
JH
16043 *) case "$usethreads" in
16044 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16045 esac
90e831dc
SB
16046 d_sethostent_r=undef
16047 sethostent_r_proto=0
c18e646a 16048 ;;
a48ec845
JH
16049 esac
16050 ;;
10bc17b6
JH
16051*) sethostent_r_proto=0
16052 ;;
16053esac
16054
4e0554ec
JH
16055: see if setitimer exists
16056set setitimer d_setitimer
16057eval $inlibc
16058
b4eb6b3d
JH
16059: see if setlinebuf exists
16060set setlinebuf d_setlinebuf
16061eval $inlibc
16062
16063: see if setlocale exists
16064set setlocale d_setlocale
16065eval $inlibc
16066
10bc17b6
JH
16067: see if locale.h is available
16068set locale.h i_locale
16069eval $inhdr
16070
16071: see if setlocale_r exists
16072set setlocale_r d_setlocale_r
16073eval $inlibc
16074case "$d_setlocale_r" in
16075"$define")
16076 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16077 case "$d_setlocale_r_proto:$usethreads" in
16078 ":define") d_setlocale_r_proto=define
a48ec845
JH
16079 set d_setlocale_r_proto setlocale_r $hdrs
16080 eval $hasproto ;;
16081 *) ;;
16082 esac
16083 case "$d_setlocale_r_proto" in
16084 define)
10bc17b6
JH
16085 case "$setlocale_r_proto" in
16086 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16087 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16088 esac
16089 case "$setlocale_r_proto" in
90e831dc 16090 ''|0) d_setlocale_r=undef
10bc17b6 16091 setlocale_r_proto=0
a48ec845 16092 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16093 * ) case "$setlocale_r_proto" in
16094 REENTRANT_PROTO*) ;;
16095 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16096 esac
16097 echo "Prototype: $try" ;;
16098 esac
16099 ;;
c18e646a
JH
16100 *) case "$usethreads" in
16101 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16102 esac
90e831dc
SB
16103 d_setlocale_r=undef
16104 setlocale_r_proto=0
c18e646a 16105 ;;
a48ec845
JH
16106 esac
16107 ;;
10bc17b6
JH
16108*) setlocale_r_proto=0
16109 ;;
16110esac
16111
b4eb6b3d
JH
16112: see if setnetent exists
16113set setnetent d_setnent
16114eval $inlibc
16115
10bc17b6
JH
16116: see if setnetent_r exists
16117set setnetent_r d_setnetent_r
16118eval $inlibc
16119case "$d_setnetent_r" in
16120"$define")
16121 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16122 case "$d_setnetent_r_proto:$usethreads" in
16123 ":define") d_setnetent_r_proto=define
a48ec845
JH
16124 set d_setnetent_r_proto setnetent_r $hdrs
16125 eval $hasproto ;;
16126 *) ;;
16127 esac
16128 case "$d_setnetent_r_proto" in
16129 define)
10bc17b6
JH
16130 case "$setnetent_r_proto" in
16131 ''|0) try='int setnetent_r(int, struct netent_data*);'
16132 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16133 esac
16134 case "$setnetent_r_proto" in
16135 ''|0) try='void setnetent_r(int, struct netent_data*);'
16136 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16137 esac
16138 case "$setnetent_r_proto" in
90e831dc 16139 ''|0) d_setnetent_r=undef
10bc17b6 16140 setnetent_r_proto=0
a48ec845 16141 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16142 * ) case "$setnetent_r_proto" in
16143 REENTRANT_PROTO*) ;;
16144 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16145 esac
16146 echo "Prototype: $try" ;;
16147 esac
16148 ;;
c18e646a
JH
16149 *) case "$usethreads" in
16150 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16151 esac
90e831dc
SB
16152 d_setnetent_r=undef
16153 setnetent_r_proto=0
c18e646a 16154 ;;
a48ec845
JH
16155 esac
16156 ;;
10bc17b6
JH
16157*) setnetent_r_proto=0
16158 ;;
16159esac
16160
b4eb6b3d
JH
16161: see if setprotoent exists
16162set setprotoent d_setpent
16163eval $inlibc
16164
16165: see if setpgid exists
16166set setpgid d_setpgid
16167eval $inlibc
16168
16169: see if setpgrp2 exists
16170set setpgrp2 d_setpgrp2
16171eval $inlibc
16172
16173: see if setpriority exists
16174set setpriority d_setprior
16175eval $inlibc
16176
16177: see if setproctitle exists
16178set setproctitle d_setproctitle
16179eval $inlibc
16180
10bc17b6
JH
16181: see if setprotoent_r exists
16182set setprotoent_r d_setprotoent_r
16183eval $inlibc
16184case "$d_setprotoent_r" in
16185"$define")
16186 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16187 case "$d_setprotoent_r_proto:$usethreads" in
16188 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16189 set d_setprotoent_r_proto setprotoent_r $hdrs
16190 eval $hasproto ;;
16191 *) ;;
16192 esac
16193 case "$d_setprotoent_r_proto" in
16194 define)
10bc17b6
JH
16195 case "$setprotoent_r_proto" in
16196 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16197 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16198 esac
16199 case "$setprotoent_r_proto" in
16200 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16201 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16202 esac
16203 case "$setprotoent_r_proto" in
90e831dc 16204 ''|0) d_setprotoent_r=undef
10bc17b6 16205 setprotoent_r_proto=0
a48ec845 16206 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16207 * ) case "$setprotoent_r_proto" in
16208 REENTRANT_PROTO*) ;;
16209 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16210 esac
16211 echo "Prototype: $try" ;;
16212 esac
16213 ;;
c18e646a
JH
16214 *) case "$usethreads" in
16215 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16216 esac
90e831dc
SB
16217 d_setprotoent_r=undef
16218 setprotoent_r_proto=0
c18e646a 16219 ;;
a48ec845
JH
16220 esac
16221 ;;
10bc17b6
JH
16222*) setprotoent_r_proto=0
16223 ;;
16224esac
16225
b4eb6b3d
JH
16226: see if setpwent exists
16227set setpwent d_setpwent
16228eval $inlibc
16229
10bc17b6
JH
16230: see if setpwent_r exists
16231set setpwent_r d_setpwent_r
16232eval $inlibc
16233case "$d_setpwent_r" in
16234"$define")
16235 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16236 case "$d_setpwent_r_proto:$usethreads" in
16237 ":define") d_setpwent_r_proto=define
a48ec845
JH
16238 set d_setpwent_r_proto setpwent_r $hdrs
16239 eval $hasproto ;;
16240 *) ;;
16241 esac
16242 case "$d_setpwent_r_proto" in
16243 define)
10bc17b6
JH
16244 case "$setpwent_r_proto" in
16245 ''|0) try='int setpwent_r(FILE**);'
16246 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16247 esac
16248 case "$setpwent_r_proto" in
16249 ''|0) try='void setpwent_r(FILE**);'
16250 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16251 esac
16252 case "$setpwent_r_proto" in
90e831dc 16253 ''|0) d_setpwent_r=undef
10bc17b6 16254 setpwent_r_proto=0
a48ec845 16255 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16256 * ) case "$setpwent_r_proto" in
16257 REENTRANT_PROTO*) ;;
16258 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16259 esac
16260 echo "Prototype: $try" ;;
16261 esac
16262 ;;
c18e646a
JH
16263 *) case "$usethreads" in
16264 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16265 esac
90e831dc
SB
16266 d_setpwent_r=undef
16267 setpwent_r_proto=0
c18e646a 16268 ;;
a48ec845
JH
16269 esac
16270 ;;
10bc17b6
JH
16271*) setpwent_r_proto=0
16272 ;;
16273esac
16274
b4eb6b3d
JH
16275: see if setregid exists
16276set setregid d_setregid
16277eval $inlibc
16278set setresgid d_setresgid
16279eval $inlibc
16280
16281: see if setreuid exists
16282set setreuid d_setreuid
16283eval $inlibc
16284set setresuid d_setresuid
16285eval $inlibc
16286
16287: see if setrgid exists
16288set setrgid d_setrgid
16289eval $inlibc
16290
16291: see if setruid exists
16292set setruid d_setruid
16293eval $inlibc
16294
16295: see if setservent exists
16296set setservent d_setsent
16297eval $inlibc
16298
10bc17b6
JH
16299: see if setservent_r exists
16300set setservent_r d_setservent_r
16301eval $inlibc
16302case "$d_setservent_r" in
16303"$define")
16304 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16305 case "$d_setservent_r_proto:$usethreads" in
16306 ":define") d_setservent_r_proto=define
a48ec845
JH
16307 set d_setservent_r_proto setservent_r $hdrs
16308 eval $hasproto ;;
16309 *) ;;
16310 esac
16311 case "$d_setservent_r_proto" in
16312 define)
10bc17b6
JH
16313 case "$setservent_r_proto" in
16314 ''|0) try='int setservent_r(int, struct servent_data*);'
16315 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16316 esac
16317 case "$setservent_r_proto" in
16318 ''|0) try='void setservent_r(int, struct servent_data*);'
16319 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16320 esac
16321 case "$setservent_r_proto" in
90e831dc 16322 ''|0) d_setservent_r=undef
10bc17b6 16323 setservent_r_proto=0
a48ec845 16324 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16325 * ) case "$setservent_r_proto" in
16326 REENTRANT_PROTO*) ;;
16327 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16328 esac
16329 echo "Prototype: $try" ;;
16330 esac
16331 ;;
c18e646a
JH
16332 *) case "$usethreads" in
16333 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16334 esac
90e831dc
SB
16335 d_setservent_r=undef
16336 setservent_r_proto=0
c18e646a 16337 ;;
a48ec845
JH
16338 esac
16339 ;;
10bc17b6
JH
16340*) setservent_r_proto=0
16341 ;;
16342esac
16343
b4eb6b3d
JH
16344: see if setsid exists
16345set setsid d_setsid
16346eval $inlibc
16347
16348: see if setvbuf exists
16349set setvbuf d_setvbuf
16350eval $inlibc
16351
16352: see if sfio.h is available
16353set sfio.h i_sfio
16354eval $inhdr
16355
16356
16357: see if sfio library is available
16358case "$i_sfio" in
16359$define)
16360 val=''
16361 set sfreserve val
16362 eval $inlibc
16363 ;;
16364*)
16365 val="$undef"
16366 ;;
16367esac
16368: Ok, but do we want to use it.
16369case "$val" in
16370$define)
16371 case "$usesfio" in
16372 true|$define|[yY]*) dflt='y';;
16373 *) dflt='n';;
16374 esac
16375 echo "$package can use the sfio library, but it is experimental."
16376 case "$useperlio" in
16377 "$undef")
16378 echo "For sfio also the PerlIO abstraction layer is needed."
16379 echo "Earlier you said you wouldn't want that."
16380 ;;
16381 esac
16382 rp="You seem to have sfio available, do you want to try using it?"
16383 . ./myread
16384 case "$ans" in
16385 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16386 useperlio="$define"
16387 val="$define"
16388 ;;
16389 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16390 val="$undef"
b4eb6b3d
JH
16391 ;;
16392 esac
16393 ;;
16394*) case "$usesfio" in
16395 true|$define|[yY]*)
16396 echo "Sorry, cannot find sfio on this machine." >&4
16397 echo "Ignoring your setting of usesfio=$usesfio." >&4
16398 val="$undef"
16399 ;;
16400 esac
16401 ;;
16402esac
16403set d_sfio
16404eval $setvar
16405case "$d_sfio" in
16406$define) usesfio='true';;
16407*) usesfio='false';;
16408esac
3659ebf1
JH
16409case "$d_sfio" in
16410$define) ;;
16411*) : Remove sfio from list of libraries to use
7483f793
JH
16412 case "$libs" in
16413 *-lsfio*)
16414 echo "Removing unneeded -lsfio from library list" >&4
16415 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16416 shift
16417 libs="$*"
16418 echo "libs = $libs" >&4
16419 ;;
16420 esac
3659ebf1
JH
16421;;
16422esac
16423
b4eb6b3d
JH
16424
16425: see if shmctl exists
16426set shmctl d_shmctl
16427eval $inlibc
16428
16429: see if shmget exists
16430set shmget d_shmget
16431eval $inlibc
16432
16433: see if shmat exists
16434set shmat d_shmat
16435eval $inlibc
16436: see what shmat returns
16437case "$d_shmat" in
16438"$define")
16439 $cat >shmat.c <<'END'
16440#include <sys/shm.h>
16441void *shmat();
16442END
16443 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16444 shmattype='void *'
16445 else
16446 shmattype='char *'
16447 fi
16448 echo "and it returns ($shmattype)." >&4
16449 : see if a prototype for shmat is available
16450 xxx=`./findhdr sys/shm.h`
16451 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16452 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16453 val="$define"
16454 else
16455 val="$undef"
16456 fi
16457 $rm -f shmat.[co]
16458 ;;
16459*)
16460 val="$undef"
16461 ;;
16462esac
16463set d_shmatprototype
16464eval $setvar
16465
16466: see if shmdt exists
16467set shmdt d_shmdt
16468eval $inlibc
16469
16470: see how much of the 'shm*(2)' library is present.
16471h_shm=true
16472echo " "
16473case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16474*"$undef"*) h_shm=false;;
16475esac
16476case "$osname" in
16477freebsd)
16478 case "`ipcs 2>&1`" in
16479 "SVID shared memory"*"not configured"*)
16480 echo "Your $osname does not have the shm*(2) configured." >&4
16481 h_shm=false
16482 val="$undef"
16483 set shmctl d_shmctl
16484 evat $setvar
16485 set shmget d_shmget
16486 evat $setvar
16487 set shmat d_shmat
16488 evat $setvar
16489 set shmdt d_shmdt
16490 evat $setvar
16491 ;;
16492 esac
16493 ;;
16494esac
16495: we could also check for sys/ipc.h ...
16496if $h_shm && $test `./findhdr sys/shm.h`; then
16497 echo "You have the full shm*(2) library." >&4
16498 val="$define"
16499else
16500 echo "You don't have the full shm*(2) library." >&4
16501 val="$undef"
16502fi
16503set d_shm
16504eval $setvar
16505
16506echo " "
16507: see if we have sigaction
16508if set sigaction val -f d_sigaction; eval $csym; $val; then
16509 echo 'sigaction() found.' >&4
073b6de5 16510 $cat > try.c <<EOP
b4eb6b3d
JH
16511#include <stdio.h>
16512#include <sys/types.h>
16513#include <signal.h>
073b6de5
JH
16514#$i_stdlib I_STDLIB
16515#ifdef I_STDLIB
16516#include <stdlib.h>
16517#endif
b4eb6b3d
JH
16518int main()
16519{
16520 struct sigaction act, oact;
16521 act.sa_flags = 0;
16522 oact.sa_handler = 0;
16523 /* so that act and oact are used */
16524 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16525}
16526EOP
16527 set try
16528 if eval $compile_ok; then
16529 val="$define"
16530 else
16531 echo "But you don't seem to have a useable struct sigaction." >&4
16532 val="$undef"
16533 fi
16534else
16535 echo 'sigaction NOT found.' >&4
16536 val="$undef"
16537fi
16538set d_sigaction; eval $setvar
16539$rm -f try try$_o try.c
16540
983dbef6
JH
16541: see if sigprocmask exists
16542set sigprocmask d_sigprocmask
16543eval $inlibc
16544
b4eb6b3d
JH
16545: see if sigsetjmp exists
16546echo " "
16547case "$d_sigsetjmp" in
16548'')
c727eafa 16549 $cat >try.c <<EOP
b4eb6b3d 16550#include <setjmp.h>
d1daaddf
JH
16551#$i_stdlib I_STDLIB
16552#ifdef I_STDLIB
16553#include <stdlib.h>
16554#endif
b4eb6b3d
JH
16555sigjmp_buf env;
16556int set = 1;
16557int main()
16558{
16559 if (sigsetjmp(env,1))
16560 exit(set);
16561 set = 0;
16562 siglongjmp(env, 1);
16563 exit(1);
16564}
16565EOP
16566 set try
16567 if eval $compile; then
5440bc8e 16568 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
16569 echo "POSIX sigsetjmp found." >&4
16570 val="$define"
16571 else
16572 $cat >&4 <<EOM
16573Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16574I'll ignore them.
16575EOM
16576 val="$undef"
16577 fi
16578 else
16579 echo "sigsetjmp not found." >&4
16580 val="$undef"
16581 fi
16582 ;;
16583*) val="$d_sigsetjmp"
16584 case "$d_sigsetjmp" in
16585 $define) echo "POSIX sigsetjmp found." >&4;;
16586 $undef) echo "sigsetjmp not found." >&4;;
16587 esac
16588 ;;
16589esac
16590set d_sigsetjmp
16591eval $setvar
16592$rm -f try.c try
16593
4f5da3e9
SP
16594: see if snprintf exists
16595set snprintf d_snprintf
16596eval $inlibc
16597
16598: see if vsnprintf exists
16599set vsnprintf d_vsnprintf
16600eval $inlibc
16601
2478f7a0
MB
16602case "$d_snprintf-$d_vsnprintf" in
16603"$define-$define")
16604 $cat <<EOM
16605Checking whether your snprintf() and vsnprintf() work okay...
16606EOM
16607 $cat >try.c <<'EOCP'
16608/* v?snprintf testing logic courtesy of Russ Allbery.
16609 * According to C99:
16610 * - if the buffer is too short it still must be \0-terminated
16611 * - if the buffer is too short the potentially required length
16612 * must be returned and not -1
16613 * - if the buffer is NULL the potentially required length
16614 * must be returned and not -1 or core dump
16615 */
16616#include <stdio.h>
16617#include <stdarg.h>
16618
16619char buf[2];
16620
16621int test (char *format, ...)
16622{
16623 va_list args;
16624 int count;
16625
16626 va_start (args, format);
16627 count = vsnprintf (buf, sizeof buf, format, args);
16628 va_end (args);
16629 return count;
16630}
16631
16632int main ()
16633{
16634 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16635 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16636}
16637EOCP
16638 set try
16639 if eval $compile; then
16640 `$run ./try`
16641 case "$?" in
16642 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16643 *) cat <<EOM >&4
16644Your snprintf() and snprintf() don't seem to be working okay.
16645EOM
16646 d_snprintf="$undef"
16647 d_vsnprintf="$undef"
16648 ;;
16649 esac
16650 else
16651 echo "(I can't seem to compile the test program--assuming they don't)"
16652 d_snprintf="$undef"
16653 d_vsnprintf="$undef"
16654 fi
16655 $rm -f try.* try core core.try.*
16656 ;;
16657esac
16658
49a78c82
JH
16659: see if sockatmark exists
16660set sockatmark d_sockatmark
16661eval $inlibc
16662
2ef53570
JH
16663: see if prototype for sockatmark is available
16664echo " "
16665set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16666eval $hasproto
16667
b4eb6b3d
JH
16668: see if socks5_init exists
16669set socks5_init d_socks5_init
16670eval $inlibc
16671
360321b3
YST
16672: see if sprintf returns the length of the string in the buffer as per ANSI
16673$echo "Checking whether sprintf returns the length of the string..." >&4
16674$cat <<EOP >try.c
16675#include <stdio.h>
16676#$i_stdlib I_STDLIB
16677#ifdef I_STDLIB
16678#include <stdlib.h>
16679#endif
16680#$i_string I_STRING
16681#ifdef I_STRING
16682# include <string.h>
16683#else
16684# include <strings.h>
16685#endif
16686#$i_math I_MATH
16687#ifdef I_MATH
16688#include <math.h>
16689#endif
16690
16691char buffer[256];
16692
16693int check (size_t expect, int test) {
16694 size_t got = strlen(buffer);
16695 if (expect == got)
16696 return 0;
16697
16698 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16699 test, buffer);
16700 exit (test);
16701}
16702
16703int main(int argc, char **argv) {
16704 int test = 0;
16705
16706 check(sprintf(buffer, ""), ++test);
16707 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16708 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16709
16710 return 0;
16711}
16712EOP
16713set try
16714
16715d_sprintf_returns_strlen="$undef"
16716if eval $compile; then
16717 xxx="`$run ./try`"
16718 case "$?" in
16719 0) cat >&4 <<EOM
16720sprintf returns the length of the string (as ANSI says it should)
16721EOM
16722 d_sprintf_returns_strlen="$define"
16723 ;;
16724 *) cat >&4 <<EOM
16725sprintf does not return the length of the string (how old is this system?)
16726EOM
16727 d_sprintf_returns_strlen="$undef"
16728 ;;
16729 esac
16730fi
16731
16732$rm -f try.* try
16733
10bc17b6
JH
16734: see if srand48_r exists
16735set srand48_r d_srand48_r
16736eval $inlibc
16737case "$d_srand48_r" in
16738"$define")
16739 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16740 case "$d_srand48_r_proto:$usethreads" in
16741 ":define") d_srand48_r_proto=define
a48ec845
JH
16742 set d_srand48_r_proto srand48_r $hdrs
16743 eval $hasproto ;;
16744 *) ;;
16745 esac
16746 case "$d_srand48_r_proto" in
16747 define)
10bc17b6
JH
16748 case "$srand48_r_proto" in
16749 ''|0) try='int srand48_r(long, struct drand48_data*);'
16750 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16751 esac
16752 case "$srand48_r_proto" in
90e831dc 16753 ''|0) d_srand48_r=undef
10bc17b6 16754 srand48_r_proto=0
a48ec845 16755 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16756 * ) case "$srand48_r_proto" in
16757 REENTRANT_PROTO*) ;;
16758 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16759 esac
16760 echo "Prototype: $try" ;;
16761 esac
16762 ;;
c18e646a
JH
16763 *) case "$usethreads" in
16764 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16765 esac
90e831dc
SB
16766 d_srand48_r=undef
16767 srand48_r_proto=0
c18e646a 16768 ;;
a48ec845
JH
16769 esac
16770 ;;
10bc17b6
JH
16771*) srand48_r_proto=0
16772 ;;
16773esac
16774
16775: see if srandom_r exists
16776set srandom_r d_srandom_r
16777eval $inlibc
16778case "$d_srandom_r" in
16779"$define")
16780 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16781 case "$d_srandom_r_proto:$usethreads" in
16782 ":define") d_srandom_r_proto=define
a48ec845
JH
16783 set d_srandom_r_proto srandom_r $hdrs
16784 eval $hasproto ;;
16785 *) ;;
16786 esac
16787 case "$d_srandom_r_proto" in
16788 define)
10bc17b6
JH
16789 case "$srandom_r_proto" in
16790 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16791 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16792 esac
16793 case "$srandom_r_proto" in
90e831dc 16794 ''|0) d_srandom_r=undef
10bc17b6 16795 srandom_r_proto=0
a48ec845 16796 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16797 * ) case "$srandom_r_proto" in
16798 REENTRANT_PROTO*) ;;
16799 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16800 esac
16801 echo "Prototype: $try" ;;
16802 esac
16803 ;;
c18e646a
JH
16804 *) case "$usethreads" in
16805 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16806 esac
90e831dc
SB
16807 d_srandom_r=undef
16808 srandom_r_proto=0
c18e646a 16809 ;;
a48ec845
JH
16810 esac
16811 ;;
10bc17b6
JH
16812*) srandom_r_proto=0
16813 ;;
16814esac
16815
eef837ea
JH
16816: see if prototype for setresgid is available
16817echo " "
16818set d_sresgproto setresgid $i_unistd unistd.h
16819eval $hasproto
16820
640374d0
JH
16821: see if prototype for setresuid is available
16822echo " "
16823set d_sresuproto setresuid $i_unistd unistd.h
16824eval $hasproto
16825
b4eb6b3d
JH
16826: see if sys/stat.h is available
16827set sys/stat.h i_sysstat
16828eval $inhdr
16829
16830
16831: see if stat knows about block sizes
16832echo " "
16833echo "Checking to see if your struct stat has st_blocks field..." >&4
16834set d_statblks stat st_blocks $i_sysstat sys/stat.h
16835eval $hasfield
16836
16837
16838: see if this is a sys/vfs.h system
16839set sys/vfs.h i_sysvfs
16840eval $inhdr
16841
16842
16843: see if this is a sys/statfs.h system
16844set sys/statfs.h i_sysstatfs
16845eval $inhdr
16846
16847
16848echo " "
16849echo "Checking to see if your system supports struct statfs..." >&4
16850set 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
16851eval $hasstruct
16852case "$d_statfs_s" in
16853"$define") echo "Yes, it does." ;;
16854*) echo "No, it doesn't." ;;
16855esac
16856
16857
16858
16859: see if struct statfs knows about f_flags
16860case "$d_statfs_s" in
16861define)
16862 echo " "
16863 echo "Checking to see if your struct statfs has f_flags field..." >&4
16864 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
16865 eval $hasfield
16866 ;;
16867*) val="$undef"
16868 set d_statfs_f_flags
16869 eval $setvar
16870 ;;
16871esac
16872case "$d_statfs_f_flags" in
16873"$define") echo "Yes, it does." ;;
16874*) echo "No, it doesn't." ;;
16875esac
16876
b4eb6b3d
JH
16877$cat >&4 <<EOM
16878Checking how to access stdio streams by file descriptor number...
16879EOM
16880case "$stdio_stream_array" in
16881'') $cat >try.c <<EOCP
16882#include <stdio.h>
16883int main() {
16884 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16885 printf("yes\n");
16886}
16887EOCP
16888 for s in _iob __iob __sF
16889 do
16890 set try -DSTDIO_STREAM_ARRAY=$s
16891 if eval $compile; then
5440bc8e 16892 case "`$run ./try`" in
b4eb6b3d
JH
16893 yes) stdio_stream_array=$s; break ;;
16894 esac
16895 fi
16896 done
16897 $rm -f try.* try$exe_ext
16898esac
16899case "$stdio_stream_array" in
16900'') $cat >&4 <<EOM
16901I can't figure out how to access stdio streams by file descriptor number.
16902EOM
16903 d_stdio_stream_array="$undef"
16904 ;;
16905*) $cat >&4 <<EOM
16906You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16907EOM
16908 d_stdio_stream_array="$define"
16909 ;;
16910esac
16911
16912: see if strcoll exists
16913set strcoll d_strcoll
16914eval $inlibc
16915
16916: check for structure copying
16917echo " "
16918echo "Checking to see if your C compiler can copy structs..." >&4
16919$cat >try.c <<'EOCP'
76f47787 16920int main()
b4eb6b3d
JH
16921{
16922 struct blurfl {
16923 int dyick;
16924 } foo, bar;
16925
16926 foo = bar;
16927}
16928EOCP
16929if $cc -c try.c >/dev/null 2>&1 ; then
16930 val="$define"
16931 echo "Yup, it can."
16932else
16933 val="$undef"
16934 echo "Nope, it can't."
16935fi
16936set d_strctcpy
16937eval $setvar
16938$rm -f try.*
16939
16940: see if strerror and/or sys_errlist[] exist
16941echo " "
16942if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16943 if set strerror val -f d_strerror; eval $csym; $val; then
16944 echo 'strerror() found.' >&4
16945 d_strerror="$define"
16946 d_strerrm='strerror(e)'
16947 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16948 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
16949 d_syserrlst="$define"
16950 else
16951 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16952 d_syserrlst="$undef"
16953 fi
16954 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16955 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16956 echo 'strerror() found in string header.' >&4
16957 d_strerror="$define"
16958 d_strerrm='strerror(e)'
16959 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16960 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16961 d_syserrlst="$define"
16962 else
16963 echo "(You don't appear to have any sys_errlist[], how can this be?)"
16964 d_syserrlst="$undef"
16965 fi
16966 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16967 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16968 d_strerror="$undef"
16969 d_syserrlst="$define"
16970 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16971 else
16972 echo 'strerror() and sys_errlist[] NOT found.' >&4
16973 d_strerror="$undef"
16974 d_syserrlst="$undef"
16975 d_strerrm='"unknown"'
16976 fi
16977fi
16978
10bc17b6
JH
16979: see if strerror_r exists
16980set strerror_r d_strerror_r
16981eval $inlibc
16982case "$d_strerror_r" in
16983"$define")
16984 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
16985 case "$d_strerror_r_proto:$usethreads" in
16986 ":define") d_strerror_r_proto=define
a48ec845
JH
16987 set d_strerror_r_proto strerror_r $hdrs
16988 eval $hasproto ;;
16989 *) ;;
16990 esac
16991 case "$d_strerror_r_proto" in
16992 define)
10bc17b6
JH
16993 case "$strerror_r_proto" in
16994 ''|0) try='int strerror_r(int, char*, size_t);'
16995 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16996 esac
16997 case "$strerror_r_proto" in
16998 ''|0) try='int strerror_r(int, char*, int);'
16999 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17000 esac
17001 case "$strerror_r_proto" in
17002 ''|0) try='char* strerror_r(int, char*, size_t);'
17003 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17004 esac
17005 case "$strerror_r_proto" in
90e831dc 17006 ''|0) d_strerror_r=undef
10bc17b6 17007 strerror_r_proto=0
a48ec845 17008 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17009 * ) case "$strerror_r_proto" in
17010 REENTRANT_PROTO*) ;;
17011 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17012 esac
17013 echo "Prototype: $try" ;;
17014 esac
17015 ;;
c18e646a
JH
17016 *) case "$usethreads" in
17017 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17018 esac
90e831dc
SB
17019 d_strerror_r=undef
17020 strerror_r_proto=0
c18e646a 17021 ;;
a48ec845
JH
17022 esac
17023 ;;
10bc17b6
JH
17024*) strerror_r_proto=0
17025 ;;
17026esac
17027
b3c85772
JH
17028: see if strftime exists
17029set strftime d_strftime
17030eval $inlibc
17031
08c92000
MB
17032: see if strlcat exists
17033set strlcat d_strlcat
17034eval $inlibc
17035
17036: see if strlcpy exists
17037set strlcpy d_strlcpy
17038eval $inlibc
17039
b4eb6b3d
JH
17040: see if strtod exists
17041set strtod d_strtod
17042eval $inlibc
17043
17044: see if strtol exists
17045set strtol d_strtol
17046eval $inlibc
17047
17048: see if strtold exists
17049set strtold d_strtold
17050eval $inlibc
17051
17052: see if strtoll exists
17053set strtoll d_strtoll
17054eval $inlibc
17055
17056case "$d_longlong-$d_strtoll" in
17057"$define-$define")
17058 $cat <<EOM
17059Checking whether your strtoll() works okay...
17060EOM
17061 $cat >try.c <<'EOCP'
17062#include <errno.h>
17063#ifdef __hpux
17064#define strtoll __strtoll
17065#endif
e75931a7
YST
17066#ifdef __EMX__
17067#define strtoll _strtoll
17068#endif
b4eb6b3d
JH
17069#include <stdio.h>
17070extern long long int strtoll(char *s, char **, int);
17071static int bad = 0;
17072int check(char *s, long long ell, int een) {
17073 long long gll;
17074 errno = 0;
17075 gll = strtoll(s, 0, 10);
17076 if (!((gll == ell) && (errno == een)))
17077 bad++;
17078}
17079int main() {
17080 check(" 1", 1LL, 0);
17081 check(" 0", 0LL, 0);
17082 check("-1", -1LL, 0);
17083 check("-9223372036854775808", -9223372036854775808LL, 0);
17084 check("-9223372036854775808", -9223372036854775808LL, 0);
17085 check(" 9223372036854775807", 9223372036854775807LL, 0);
17086 check("-9223372036854775808", -9223372036854775808LL, 0);
17087 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17088 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17089 if (!bad)
17090 printf("ok\n");
17091}
17092EOCP
17093 set try
17094 if eval $compile; then
5440bc8e 17095 yyy=`$run ./try`
e75931a7 17096 case "$yyy" in
b4eb6b3d
JH
17097 ok) echo "Your strtoll() seems to be working okay." ;;
17098 *) cat <<EOM >&4
17099Your strtoll() doesn't seem to be working okay.
17100EOM
17101 d_strtoll="$undef"
17102 ;;
69eadf66 17103 esac
e75931a7
YST
17104 else
17105 echo "(I can't seem to compile the test program--assuming it doesn't)"
17106 d_strtoll="$undef"
b4eb6b3d
JH
17107 fi
17108 ;;
17109esac
17110
28e5dec8
JH
17111: see if strtoq exists
17112set strtoq d_strtoq
17113eval $inlibc
17114
b4eb6b3d
JH
17115: see if strtoul exists
17116set strtoul d_strtoul
17117eval $inlibc
17118
d0e6d399
NC
17119case "$d_strtoul" in
17120"$define")
17121 $cat <<EOM
17122Checking whether your strtoul() works okay...
17123EOM
17124 $cat >try.c <<'EOCP'
17125#include <errno.h>
17126#include <stdio.h>
17127extern unsigned long int strtoul(char *s, char **, int);
17128static int bad = 0;
17129void check(char *s, unsigned long eul, int een) {
17130 unsigned long gul;
17131 errno = 0;
17132 gul = strtoul(s, 0, 10);
17133 if (!((gul == eul) && (errno == een)))
17134 bad++;
17135}
17136int main() {
17137 check(" 1", 1L, 0);
17138 check(" 0", 0L, 0);
17139EOCP
17140 case "$longsize" in
17141 8)
17142 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17143 check("18446744073709551615", 18446744073709551615UL, 0);
17144 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17145#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17146 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17147 check("-18446744073709551614", 2, 0);
17148 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17149 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17150 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17151#endif
d0e6d399
NC
17152EOCP
17153 ;;
17154 4)
17155 $cat >>try.c <<'EOCP'
17156 check("4294967295", 4294967295UL, 0);
17157 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17158#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17159 check("-1", 4294967295UL, 0);
17160 check("-4294967294", 2, 0);
17161 check("-4294967295", 1, 0);
17162 check("-4294967296", 4294967295UL, ERANGE);
17163 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17164#endif
d0e6d399
NC
17165EOCP
17166 ;;
17167 *)
17168: Should we write these tests to be more portable by sprintf-ing
17169: ~0 and then manipulating that char string as input for strtol?
17170 ;;
17171 esac
17172 $cat >>try.c <<'EOCP'
17173 if (!bad)
17174 printf("ok\n");
17175 return 0;
17176}
17177EOCP
17178 set try
17179 if eval $compile; then
5440bc8e 17180 case "`$run ./try`" in
d0e6d399
NC
17181 ok) echo "Your strtoul() seems to be working okay." ;;
17182 *) cat <<EOM >&4
17183Your strtoul() doesn't seem to be working okay.
17184EOM
17185 d_strtoul="$undef"
17186 ;;
17187 esac
17188 fi
17189 ;;
17190esac
17191
b4eb6b3d
JH
17192: see if strtoull exists
17193set strtoull d_strtoull
17194eval $inlibc
17195
17196case "$d_longlong-$d_strtoull" in
17197"$define-$define")
17198 $cat <<EOM
17199Checking whether your strtoull() works okay...
17200EOM
17201 $cat >try.c <<'EOCP'
17202#include <errno.h>
17203#ifdef __hpux
17204#define strtoull __strtoull
17205#endif
17206#include <stdio.h>
17207extern unsigned long long int strtoull(char *s, char **, int);
17208static int bad = 0;
17209int check(char *s, long long eull, int een) {
17210 long long gull;
17211 errno = 0;
17212 gull = strtoull(s, 0, 10);
17213 if (!((gull == eull) && (errno == een)))
17214 bad++;
17215}
17216int main() {
d0e6d399
NC
17217 check(" 1", 1LL, 0);
17218 check(" 0", 0LL, 0);
17219 check("18446744073709551615", 18446744073709551615ULL, 0);
17220 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17221#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17222 check("-1", 18446744073709551615ULL, 0);
17223 check("-18446744073709551614", 2LL, 0);
17224 check("-18446744073709551615", 1LL, 0);
17225 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17226 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17227#endif
b4eb6b3d
JH
17228 if (!bad)
17229 printf("ok\n");
17230}
17231EOCP
17232 set try
17233 if eval $compile; then
5440bc8e 17234 case "`$run ./try`" in
b4eb6b3d
JH
17235 ok) echo "Your strtoull() seems to be working okay." ;;
17236 *) cat <<EOM >&4
17237Your strtoull() doesn't seem to be working okay.
17238EOM
17239 d_strtoull="$undef"
17240 ;;
17241 esac
17242 fi
17243 ;;
17244esac
17245
17246: see if strtouq exists
17247set strtouq d_strtouq
17248eval $inlibc
17249
d0e6d399
NC
17250case "$d_strtouq" in
17251"$define")
17252 $cat <<EOM
17253Checking whether your strtouq() works okay...
17254EOM
17255 $cat >try.c <<'EOCP'
17256#include <errno.h>
17257#include <stdio.h>
17258extern unsigned long long int strtouq(char *s, char **, int);
17259static int bad = 0;
17260void check(char *s, unsigned long long eull, int een) {
17261 unsigned long long gull;
17262 errno = 0;
17263 gull = strtouq(s, 0, 10);
17264 if (!((gull == eull) && (errno == een)))
17265 bad++;
17266}
17267int main() {
17268 check(" 1", 1LL, 0);
17269 check(" 0", 0LL, 0);
17270 check("18446744073709551615", 18446744073709551615ULL, 0);
17271 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17272#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17273 check("-1", 18446744073709551615ULL, 0);
17274 check("-18446744073709551614", 2LL, 0);
17275 check("-18446744073709551615", 1LL, 0);
17276 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17277 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17278#endif
d0e6d399
NC
17279 if (!bad)
17280 printf("ok\n");
17281 return 0;
17282}
17283EOCP
17284 set try
17285 if eval $compile; then
5440bc8e 17286 case "`$run ./try`" in
d0e6d399
NC
17287 ok) echo "Your strtouq() seems to be working okay." ;;
17288 *) cat <<EOM >&4
17289Your strtouq() doesn't seem to be working okay.
17290EOM
17291 d_strtouq="$undef"
17292 ;;
17293 esac
17294 fi
17295 ;;
17296esac
17297
b4eb6b3d
JH
17298: see if strxfrm exists
17299set strxfrm d_strxfrm
17300eval $inlibc
17301
17302: see if symlink exists
17303set symlink d_symlink
17304eval $inlibc
17305
17306: see if syscall exists
17307set syscall d_syscall
17308eval $inlibc
17309
2ef53570
JH
17310: see if prototype for syscall is available
17311echo " "
17312set d_syscallproto syscall $i_unistd unistd.h
17313eval $hasproto
17314
b4eb6b3d
JH
17315: see if sysconf exists
17316set sysconf d_sysconf
17317eval $inlibc
17318
17319: see if system exists
17320set system d_system
17321eval $inlibc
17322
17323: see if tcgetpgrp exists
17324set tcgetpgrp d_tcgetpgrp
17325eval $inlibc
17326
17327: see if tcsetpgrp exists
17328set tcsetpgrp d_tcsetpgrp
17329eval $inlibc
17330
17331: see if prototype for telldir is available
17332echo " "
17333set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17334eval $hasproto
17335
ad493445
MB
17336: see if time exists
17337echo " "
17338if test "X$d_time" = X -o X"$timetype" = X; then
17339 if set time val -f d_time; eval $csym; $val; then
17340 echo 'time() found.' >&4
17341 val="$define"
17342 rp="What is the type returned by time() on this system?"
17343 set time_t timetype long stdio.h sys/types.h
17344 eval $typedef_ask
17345 else
17346 echo 'time() not found, hope that will do.' >&4
17347 val="$undef"
17348 timetype='int';
17349 fi
17350 set d_time
17351 eval $setvar
17352fi
17353
b4eb6b3d
JH
17354: see if this is a sys/times.h system
17355set sys/times.h i_systimes
17356eval $inhdr
17357
17358: see if times exists
17359echo " "
17360if set times val -f d_times; eval $csym; $val; then
17361 echo 'times() found.' >&4
17362 d_times="$define"
17363 inc=''
17364 case "$i_systimes" in
17365 "$define") inc='sys/times.h';;
17366 esac
17367 rp="What is the type returned by times() on this system?"
17368 set clock_t clocktype long stdio.h sys/types.h $inc
17369 eval $typedef_ask
17370else
17371 echo 'times() NOT found, hope that will do.' >&4
17372 d_times="$undef"
17373 clocktype='int'
17374fi
17375
10bc17b6
JH
17376: see if tmpnam_r exists
17377set tmpnam_r d_tmpnam_r
17378eval $inlibc
17379case "$d_tmpnam_r" in
17380"$define")
31ee0cb7 17381 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17382 case "$d_tmpnam_r_proto:$usethreads" in
17383 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17384 set d_tmpnam_r_proto tmpnam_r $hdrs
17385 eval $hasproto ;;
17386 *) ;;
17387 esac
17388 case "$d_tmpnam_r_proto" in
17389 define)
10bc17b6
JH
17390 case "$tmpnam_r_proto" in
17391 ''|0) try='char* tmpnam_r(char*);'
17392 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17393 esac
17394 case "$tmpnam_r_proto" in
90e831dc 17395 ''|0) d_tmpnam_r=undef
10bc17b6 17396 tmpnam_r_proto=0
a48ec845 17397 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17398 * ) case "$tmpnam_r_proto" in
17399 REENTRANT_PROTO*) ;;
17400 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17401 esac
17402 echo "Prototype: $try" ;;
17403 esac
17404 ;;
c18e646a
JH
17405 *) case "$usethreads" in
17406 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17407 esac
90e831dc
SB
17408 d_tmpnam_r=undef
17409 tmpnam_r_proto=0
c18e646a 17410 ;;
a48ec845
JH
17411 esac
17412 ;;
10bc17b6
JH
17413*) tmpnam_r_proto=0
17414 ;;
17415esac
17416
b4eb6b3d
JH
17417: see if truncate exists
17418set truncate d_truncate
17419eval $inlibc
17420
10bc17b6
JH
17421: see if ttyname_r exists
17422set ttyname_r d_ttyname_r
17423eval $inlibc
17424case "$d_ttyname_r" in
17425"$define")
17426 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17427 case "$d_ttyname_r_proto:$usethreads" in
17428 ":define") d_ttyname_r_proto=define
a48ec845
JH
17429 set d_ttyname_r_proto ttyname_r $hdrs
17430 eval $hasproto ;;
17431 *) ;;
17432 esac
17433 case "$d_ttyname_r_proto" in
17434 define)
10bc17b6
JH
17435 case "$ttyname_r_proto" in
17436 ''|0) try='int ttyname_r(int, char*, size_t);'
17437 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17438 esac
17439 case "$ttyname_r_proto" in
17440 ''|0) try='int ttyname_r(int, char*, int);'
17441 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17442 esac
17443 case "$ttyname_r_proto" in
17444 ''|0) try='char* ttyname_r(int, char*, int);'
17445 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17446 esac
17447 case "$ttyname_r_proto" in
90e831dc 17448 ''|0) d_ttyname_r=undef
10bc17b6 17449 ttyname_r_proto=0
a48ec845 17450 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17451 * ) case "$ttyname_r_proto" in
17452 REENTRANT_PROTO*) ;;
17453 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17454 esac
17455 echo "Prototype: $try" ;;
17456 esac
17457 ;;
c18e646a
JH
17458 *) case "$usethreads" in
17459 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17460 esac
90e831dc
SB
17461 d_ttyname_r=undef
17462 ttyname_r_proto=0
c18e646a 17463 ;;
a48ec845
JH
17464 esac
17465 ;;
10bc17b6
JH
17466*) ttyname_r_proto=0
17467 ;;
17468esac
17469
b4eb6b3d
JH
17470: see if tzname[] exists
17471echo " "
17472if set tzname val -a d_tzname; eval $csym; $val; then
17473 val="$define"
17474 echo 'tzname[] found.' >&4
17475else
17476 val="$undef"
17477 echo 'tzname[] NOT found.' >&4
17478fi
17479set d_tzname
17480eval $setvar
17481
4e0554ec
JH
17482case "$osname" in
17483next|rhapsody|darwin) multiarch="$define" ;;
17484esac
17485case "$multiarch" in
17486''|[nN]*) multiarch="$undef" ;;
17487esac
17488
24412007 17489: check for ordering of bytes in a UV
4e0554ec 17490echo " "
5440bc8e 17491case "$usecrosscompile$multiarch" in
4e0554ec
JH
17492*$define*)
17493 $cat <<EOM
17494You seem to be either cross-compiling or doing a multiarchitecture build,
17495skipping the byteorder check.
17496
17497EOM
5440bc8e 17498 byteorder='ffff'
4e0554ec
JH
17499 ;;
17500*)
17501 case "$byteorder" in
17502 '')
17503 $cat <<'EOM'
17504In the following, larger digits indicate more significance. A big-endian
17505machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17506little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17507machines may have weird orders like 3412. A Cray will report 87654321,
17508an Alpha will report 12345678. If the test program works the default is
17509probably right.
17510I'm now running the test program...
17511EOM
24412007 17512 $cat >try.c <<EOCP
4e0554ec 17513#include <stdio.h>
55954f19
JH
17514#$i_stdlib I_STDLIB
17515#ifdef I_STDLIB
17516#include <stdlib.h>
17517#endif
24412007
JH
17518#include <sys/types.h>
17519typedef $uvtype UV;
4e0554ec
JH
17520int main()
17521{
17522 int i;
17523 union {
24412007
JH
17524 UV l;
17525 char c[$uvsize];
4e0554ec
JH
17526 } u;
17527
24412007 17528 if ($uvsize > 4)
b5ded3e5 17529 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 17530 else
a4c53327 17531 u.l = (UV)0x04030201;
24412007 17532 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
17533 printf("%c", u.c[i]+'0');
17534 printf("\n");
17535 exit(0);
17536}
17537EOCP
17538 xxx_prompt=y
17539 set try
17540 if eval $compile && ./try > /dev/null; then
5440bc8e 17541 dflt=`$run ./try`
4e0554ec
JH
17542 case "$dflt" in
17543 [1-4][1-4][1-4][1-4]|12345678|87654321)
17544 echo "(The test program ran ok.)"
17545 echo "byteorder=$dflt"
17546 xxx_prompt=n
17547 ;;
17548 ????|????????) echo "(The test program ran ok.)" ;;
17549 *) echo "(The test program didn't run right for some reason.)" ;;
17550 esac
17551 else
17552 dflt='4321'
17553 cat <<'EOM'
17554(I can't seem to compile the test program. Guessing big-endian...)
17555EOM
17556 fi
17557 case "$xxx_prompt" in
17558 y)
24412007 17559 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
17560 . ./myread
17561 byteorder="$ans"
17562 ;;
17563 *) byteorder=$dflt
17564 ;;
17565 esac
17566 ;;
17567 esac
17568 $rm -f try.c try
17569 ;;
17570esac
17571
17572
17573$cat <<EOM
17574
17575Checking to see whether you can access character data unalignedly...
17576EOM
dc7b0a4f
JH
17577case "$d_u32align" in
17578'') $cat >try.c <<EOCP
4e0554ec 17579#include <stdio.h>
d1daaddf
JH
17580#$i_stdlib I_STDLIB
17581#ifdef I_STDLIB
17582#include <stdlib.h>
17583#endif
4e0554ec 17584#define U32 $u32type
d308175a
JH
17585#define BYTEORDER 0x$byteorder
17586#define U8 $u8type
9958dc3c
JH
17587#include <signal.h>
17588#ifdef SIGBUS
17589$signal_t bletch(s) int s; { exit(4); }
17590#endif
4e0554ec
JH
17591int main() {
17592#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 17593 U8 buf[8];
4e0554ec
JH
17594 U32 *up;
17595 int i;
17596
17597 if (sizeof(U32) != 4) {
17598 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17599 exit(1);
17600 }
17601
17602 fflush(stdout);
17603
9958dc3c
JH
17604#ifdef SIGBUS
17605 signal(SIGBUS, bletch);
17606#endif
17607
8906a23e
JH
17608 buf[0] = 0;
17609 buf[1] = 0;
17610 buf[2] = 0;
17611 buf[3] = 1;
7eac3fd6 17612 buf[4] = 0;
8906a23e
JH
17613 buf[5] = 0;
17614 buf[6] = 0;
7eac3fd6 17615 buf[7] = 1;
8906a23e 17616
4e0554ec
JH
17617 for (i = 0; i < 4; i++) {
17618 up = (U32*)(buf + i);
17619 if (! ((*up == 1 << (8*i)) || /* big-endian */
17620 (*up == 1 << (8*(3-i))) /* little-endian */
17621 )
17622 )
17623 {
17624 printf("read failed (%x)\n", *up);
17625 exit(2);
17626 }
17627 }
17628
17629 /* write test */
17630 for (i = 0; i < 4; i++) {
17631 up = (U32*)(buf + i);
17632 *up = 0xBeef;
17633 if (*up != 0xBeef) {
17634 printf("write failed (%x)\n", *up);
17635 exit(3);
17636 }
17637 }
17638
17639 exit(0);
17640#else
17641 printf("1\n");
17642 exit(1);
17643#endif
17644 return 0;
17645}
17646EOCP
17647set try
17648if eval $compile_ok; then
d308175a 17649 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 17650 $run ./try 2>&1 >/dev/null
4e0554ec
JH
17651 case "$?" in
17652 0) cat >&4 <<EOM
17653You can access character data pretty unalignedly.
17654EOM
17655 d_u32align="$undef"
17656 ;;
17657 *) cat >&4 <<EOM
17658It seems that you must access character data in an aligned manner.
17659EOM
17660 d_u32align="$define"
17661 ;;
17662 esac
4e0554ec
JH
17663else
17664 rp='Can you access character data at unaligned addresses?'
17665 dflt='n'
17666 . ./myread
17667 case "$ans" in
17668 [yY]*) d_u32align="$undef" ;;
17669 *) d_u32align="$define" ;;
17670 esac
17671fi
e36b5403 17672$rm -f core core.try.* try.core
dc7b0a4f
JH
17673;;
17674esac
4e0554ec
JH
17675
17676: see if ualarm exists
17677set ualarm d_ualarm
17678eval $inlibc
17679
b4eb6b3d
JH
17680: see if umask exists
17681set umask d_umask
17682eval $inlibc
17683
758a5d79
JH
17684: see if unordered exists
17685set unordered d_unordered
17686eval $inlibc
17687
bdf33aa7
SP
17688: see if unsetenv exists
17689set unsetenv d_unsetenv
17690eval $inlibc
17691
4e0554ec
JH
17692: see if usleep exists
17693set usleep d_usleep
17694eval $inlibc
17695
2ef53570
JH
17696: see if prototype for usleep is available
17697echo " "
17698set d_usleepproto usleep $i_unistd unistd.h
17699eval $hasproto
17700
b4eb6b3d
JH
17701: see if ustat exists
17702set ustat d_ustat
17703eval $inlibc
17704
17705: backward compatibility for d_hvfork
17706if test X$d_hvfork != X; then
17707 d_vfork="$d_hvfork"
17708 d_hvfork=''
17709fi
17710: see if there is a vfork
17711val=''
17712set vfork val
17713eval $inlibc
17714
17715: Ok, but do we want to use it. vfork is reportedly unreliable in
17716: perl on Solaris 2.x, and probably elsewhere.
17717case "$val" in
17718$define)
17719 echo " "
17720 case "$usevfork" in
17721 false) dflt='n';;
17722 *) dflt='y';;
17723 esac
17724 cat <<'EOM'
17725
17726Perl can only use a vfork() that doesn't suffer from strict
17727restrictions on calling functions or modifying global data in
17728the child. For example, glibc-2.1 contains such a vfork()
17729that is unsuitable. If your system provides a proper fork()
17730call, chances are that you do NOT want perl to use vfork().
17731
17732EOM
17733 rp="Do you still want to use vfork()?"
17734 . ./myread
17735 case "$ans" in
17736 y|Y) ;;
17737 *)
17738 echo "Ok, we won't use vfork()."
17739 val="$undef"
17740 ;;
17741 esac
17742 ;;
17743esac
17744set d_vfork
17745eval $setvar
17746case "$d_vfork" in
17747$define) usevfork='true';;
17748*) usevfork='false';;
17749esac
17750
b4eb6b3d
JH
17751: see if closedir exists
17752set closedir d_closedir
17753eval $inlibc
17754
17755case "$d_closedir" in
17756"$define")
17757 echo " "
17758 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 17759 cat > try.c <<EOM
b4eb6b3d
JH
17760#$i_dirent I_DIRENT /**/
17761#$i_sysdir I_SYS_DIR /**/
17762#$i_sysndir I_SYS_NDIR /**/
17763#$i_systypes I_SYS_TYPES /**/
17764
17765#if defined(I_SYS_TYPES)
17766#include <sys/types.h>
17767#endif
17768#if defined(I_DIRENT)
17769#include <dirent.h>
17770#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17771#include <sys/dir.h>
17772#endif
17773#else
17774#ifdef I_SYS_NDIR
17775#include <sys/ndir.h>
17776#else
17777#ifdef I_SYS_DIR
17778#ifdef hp9000s500
17779#include <ndir.h> /* may be wrong in the future */
17780#else
17781#include <sys/dir.h>
17782#endif
17783#endif
17784#endif
17785#endif
17786int main() { return closedir(opendir(".")); }
17787EOM
5440bc8e 17788 set try
b4eb6b3d 17789 if eval $compile_ok; then
5440bc8e 17790 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
17791 echo "Yes, it does."
17792 val="$undef"
17793 else
17794 echo "No, it doesn't."
17795 val="$define"
17796 fi
17797 else
17798 echo "(I can't seem to compile the test program--assuming it doesn't)"
17799 val="$define"
17800 fi
17801 ;;
17802*)
17803 val="$undef";
17804 ;;
17805esac
17806set d_void_closedir
17807eval $setvar
5440bc8e 17808$rm -f try try.*
b4eb6b3d
JH
17809: see if there is a wait4
17810set wait4 d_wait4
17811eval $inlibc
17812
17813: see if waitpid exists
17814set waitpid d_waitpid
17815eval $inlibc
17816
17817: see if wcstombs exists
17818set wcstombs d_wcstombs
17819eval $inlibc
17820
17821: see if wctomb exists
17822set wctomb d_wctomb
17823eval $inlibc
17824
4e0554ec
JH
17825: see if writev exists
17826set writev d_writev
17827eval $inlibc
17828
b4eb6b3d
JH
17829: preserve RCS keywords in files with variable substitution, grrr
17830Date='$Date'
17831Id='$Id'
17832Log='$Log'
17833RCSfile='$RCSfile'
17834Revision='$Revision'
17835
b4eb6b3d
JH
17836: check for alignment requirements
17837echo " "
5440bc8e 17838case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
17839*$define*)
17840 $cat <<EOM
17841You seem to be either cross-compiling or doing a multiarchitecture build,
17842skipping the memory alignment check.
17843
17844EOM
17845 case "$alignbytes" in
17846 '') alignbytes=8 ;;
17847 esac
17848 ;;
17849*)
17850 case "$alignbytes" in
17851 '') echo "Checking alignment constraints..." >&4
17852 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17853 $cat >try.c <<'EOCP'
17854typedef long double NV;
17855EOCP
17856 else
17857 $cat >try.c <<'EOCP'
17858typedef double NV;
17859EOCP
17860 fi
17861 $cat >>try.c <<'EOCP'
17862#include <stdio.h>
17863struct foobar {
17864 char foo;
17865 NV bar;
17866} try_algn;
17867int main()
17868{
17869 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17870 return(0);
17871}
17872EOCP
17873 set try
17874 if eval $compile_ok; then
5440bc8e 17875 dflt=`$run ./try`
b4eb6b3d
JH
17876 else
17877 dflt='8'
17878 echo "(I can't seem to compile the test program...)"
17879 fi
17880 ;;
17881 *) dflt="$alignbytes"
17882 ;;
17883 esac
17884 rp="Doubles must be aligned on a how-many-byte boundary?"
17885 . ./myread
17886 alignbytes="$ans"
17887 $rm -f try.c try
17888 ;;
17889esac
17890
17891
17892: set the base revision
17893baserev=5.0
17894
3099fc99 17895: how do we concatenate cpp tokens here?
b4eb6b3d 17896echo " "
3099fc99 17897echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
17898$cat >cpp_stuff.c <<'EOCP'
17899#define RCAT(a,b)a/**/b
17900#define ACAT(a,b)a ## b
17901RCAT(Rei,ser)
17902ACAT(Cir,cus)
17903EOCP
17904$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17905if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17906 echo "Oh! Smells like ANSI's been here." >&4
17907 echo "We can catify or stringify, separately or together!"
17908 cpp_stuff=42
17909elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17910 echo "Ah, yes! The good old days!" >&4
17911 echo "However, in the good old days we don't know how to stringify and"
17912 echo "catify at the same time."
17913 cpp_stuff=1
17914else
17915 $cat >&4 <<EOM
3099fc99
CW
17916Hmm, I don't seem to be able to concatenate tokens with your cpp.
17917You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
17918EOM
17919 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17920fi
17921$rm -f cpp_stuff.*
17922
17923: see if this is a db.h system
17924set db.h i_db
17925eval $inhdr
17926
17927case "$i_db" in
17928$define)
17929 : Check db version.
17930 echo " "
17931 echo "Checking Berkeley DB version ..." >&4
17932 $cat >try.c <<EOCP
17933#$d_const HASCONST
17934#ifndef HASCONST
17935#define const
17936#endif
17937#include <sys/types.h>
17938#include <stdio.h>
55954f19
JH
17939#$i_stdlib I_STDLIB
17940#ifdef I_STDLIB
17941#include <stdlib.h>
17942#endif
b4eb6b3d 17943#include <db.h>
640374d0 17944int main(int argc, char *argv[])
b4eb6b3d
JH
17945{
17946#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17947 int Major, Minor, Patch ;
17948 unsigned long Version ;
17949 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
17950 if (argc == 2) {
17951 printf("%d %d %d %d %d %d\n",
17952 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17953 Major, Minor, Patch);
17954 exit(0);
17955 }
17956 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
17957
17958 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17959 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17960 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17961 Major, Minor, Patch) ;
17962
17963 /* check that db.h & libdb are compatible */
17964 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 17965 printf("db.h and libdb are incompatible.\n") ;
b4eb6b3d
JH
17966 exit(3);
17967 }
17968
640374d0 17969 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
17970
17971 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17972 + DB_VERSION_PATCH ;
17973
17974 /* needs to be >= 2.3.4 */
17975 if (Version < 2003004) {
17976 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 17977 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
b4eb6b3d
JH
17978 exit(2);
17979 }
17980
17981 exit(0);
17982#else
17983#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
17984 if (argc == 2) {
17985 printf("1 0 0\n");
17986 exit(0);
17987 }
17988 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
17989 exit(0); /* DB version < 2: the coast is clear. */
17990#else
17991 exit(1); /* <db.h> not Berkeley DB? */
17992#endif
17993#endif
17994}
17995EOCP
17996 set try
5440bc8e 17997 if eval $compile_ok && $run ./try; then
b4eb6b3d 17998 echo 'Looks OK.' >&4
5440bc8e 17999 set `$run ./try 1`
640374d0
JH
18000 db_version_major=$1
18001 db_version_minor=$2
18002 db_version_patch=$3
b4eb6b3d
JH
18003 else
18004 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
18005 i_db=$undef
18006 case " $libs " in
18007 *"-ldb "*)
18008 : Remove db from list of libraries to use
18009 echo "Removing unusable -ldb from library list" >&4
18010 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18011 shift
18012 libs="$*"
18013 echo "libs = $libs" >&4
18014 ;;
18015 esac
18016 fi
18017 $rm -f try.*
18018 ;;
18019esac
18020
18021case "$i_db" in
18022define)
18023 : Check the return type needed for hash
18024 echo " "
18025 echo "Checking return type needed for hash for Berkeley DB ..." >&4
18026 $cat >try.c <<EOCP
18027#$d_const HASCONST
18028#ifndef HASCONST
18029#define const
18030#endif
18031#include <sys/types.h>
18032#include <db.h>
18033
18034#ifndef DB_VERSION_MAJOR
18035u_int32_t hash_cb (ptr, size)
18036const void *ptr;
18037size_t size;
18038{
18039}
18040HASHINFO info;
18041int main()
18042{
18043 info.hash = hash_cb;
18044}
18045#endif
18046EOCP
18047 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18048 if $contains warning try.out >>/dev/null 2>&1 ; then
18049 db_hashtype='int'
18050 else
18051 db_hashtype='u_int32_t'
18052 fi
18053 else
18054 : XXX Maybe we should just give up here.
18055 db_hashtype=u_int32_t
18056 $cat try.out >&4
18057 echo "Help: I can't seem to compile the db test program." >&4
18058 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18059 fi
18060 $rm -f try.*
18061 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18062 ;;
18063*) db_hashtype=u_int32_t
18064 ;;
18065esac
18066case "$i_db" in
18067define)
18068 : Check the return type needed for prefix
18069 echo " "
18070 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18071 cat >try.c <<EOCP
18072#$d_const HASCONST
18073#ifndef HASCONST
18074#define const
18075#endif
18076#include <sys/types.h>
18077#include <db.h>
18078
18079#ifndef DB_VERSION_MAJOR
18080size_t prefix_cb (key1, key2)
18081const DBT *key1;
18082const DBT *key2;
18083{
18084}
18085BTREEINFO info;
18086int main()
18087{
18088 info.prefix = prefix_cb;
18089}
18090#endif
18091EOCP
18092 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18093 if $contains warning try.out >>/dev/null 2>&1 ; then
18094 db_prefixtype='int'
18095 else
18096 db_prefixtype='size_t'
18097 fi
18098 else
18099 db_prefixtype='size_t'
18100 : XXX Maybe we should just give up here.
18101 $cat try.out >&4
18102 echo "Help: I can't seem to compile the db test program." >&4
18103 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18104 fi
18105 $rm -f try.*
18106 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18107 ;;
18108*) db_prefixtype='size_t'
18109 ;;
18110esac
18111
b4eb6b3d
JH
18112
18113: How can we generate normalized random numbers ?
18114echo " "
18115echo "Looking for a random number function..." >&4
18116case "$randfunc" in
18117'')
18118 if set drand48 val -f; eval $csym; $val; then
18119 dflt="drand48"
18120 echo "Good, found drand48()." >&4
18121 elif set random val -f; eval $csym; $val; then
18122 dflt="random"
18123 echo "OK, found random()." >&4
18124 else
18125 dflt="rand"
18126 echo "Yick, looks like I have to use rand()." >&4
18127 fi
18128 echo " "
18129 ;;
18130*)
18131 dflt="$randfunc"
18132 ;;
18133esac
18134cont=true
18135
18136case "$ccflags" in
18137*-Dmy_rand=*|*-Dmy_srand=*)
18138 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18139 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18140 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18141 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18142 ;;
18143esac
18144
18145while $test "$cont"; do
18146 rp="Use which function to generate random numbers?"
18147 . ./myread
18148 if $test "$ans" = "$dflt"; then
18149 : null
18150 else
18151 randbits=''
18152 fi
18153 randfunc="$ans"
18154 if set $ans val -f; eval $csym; $val; then
18155 cont=''
18156 else
18157 dflt=y
18158 rp="I cannot find function $ans. Use that name anyway?"
18159 . ./myread
18160 dflt=rand
18161 case "$ans" in
18162 [yY]*) cont='';;
18163 esac
18164 fi
18165 case "$cont" in
18166 '')
18167 case "$randfunc" in
18168 drand48)
18169 drand01="drand48()"
18170 seedfunc="srand48"
18171 randbits=48
18172 randseedtype=long
18173 ;;
18174 rand|random)
18175 case "$randbits" in
18176 '')
18177echo "Checking to see how many bits your $randfunc() function produces..." >&4
18178 $cat >try.c <<EOCP
18179#$i_unistd I_UNISTD
18180#$i_stdlib I_STDLIB
18181#include <stdio.h>
18182#ifdef I_UNISTD
18183# include <unistd.h>
18184#endif
18185#ifdef I_STDLIB
18186# include <stdlib.h>
18187#endif
18188int main()
18189{
18190 register int i;
18191 register unsigned long tmp;
18192 register unsigned long max = 0L;
18193
18194 for (i = 1000; i; i--) {
18195 tmp = (unsigned long) $randfunc();
18196 if (tmp > max) max = tmp;
18197 }
18198 for (i = 0; max; i++)
18199 max /= 2;
18200 printf("%d\n",i);
18201}
18202EOCP
18203 set try
18204 if eval $compile_ok; then
18205 dflt=`try`
18206 else
18207 dflt='?'
18208 echo "(I can't seem to compile the test program...)"
18209 fi
18210 ;;
18211 *)
18212 dflt="$randbits"
18213 ;;
18214 esac
18215 rp="How many bits does your $randfunc() function produce?"
18216 . ./myread
18217 randbits="$ans"
18218 $rm -f try.c try
18219 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18220 seedfunc="s$randfunc"
18221 randseedtype=unsigned
18222 ;;
18223 *)
18224 dflt="31"
18225 rp="How many bits does your $randfunc() function produce?"
18226 . ./myread
18227 randbits="$ans"
18228 seedfunc="s$randfunc"
18229 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18230 if set $seedfunc val -f; eval $csym; $val; then
18231 echo "(Using $seedfunc() to seed random generator)"
18232 else
18233 echo "(Warning: no $seedfunc() to seed random generator)"
18234 seedfunc=rand
18235 fi
18236 randseedtype=unsigned
18237 ;;
18238 esac
18239 ;;
18240 esac
18241done
18242
18243echo " "
18244echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18245$cat >try.c <<'EOM'
b4eb6b3d
JH
18246int main()
18247{
18248 if ('M'==0xd4) return 0;
18249 return 1;
18250}
18251EOM
18252
18253val=$undef
5440bc8e 18254set try
b4eb6b3d 18255if eval $compile_ok; then
5440bc8e 18256 if $run ./try; then
b4eb6b3d
JH
18257 echo "You seem to speak EBCDIC." >&4
18258 val="$define"
18259 else
5440bc8e 18260 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18261 fi
18262else
18263 echo "I'm unable to compile the test program." >&4
18264 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18265fi
5440bc8e 18266$rm -f try try.*
b4eb6b3d
JH
18267set ebcdic
18268eval $setvar
18269
18270echo " "
18271$cat >&4 <<EOM
18272Checking how to flush all pending stdio output...
18273EOM
18274# I only know how to find the first 32 possibly open files on SunOS.
18275# See also hints/sunos_4_1.sh and util.c --AD
18276case "$osname" in
18277sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18278esac
18279$cat >>try.c <<EOCP
18280#include <stdio.h>
55954f19
JH
18281#$i_stdlib I_STDLIB
18282#ifdef I_STDLIB
18283#include <stdlib.h>
18284#endif
b4eb6b3d
JH
18285#$i_unistd I_UNISTD
18286#ifdef I_UNISTD
18287# include <unistd.h>
18288#endif
18289#$d_sysconf HAS_SYSCONF
18290#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18291#ifdef HAS_STDIO_STREAM_ARRAY
18292# define STDIO_STREAM_ARRAY $stdio_stream_array
18293#endif
18294int main() {
5440bc8e
JH
18295 FILE* p;
18296 unlink("try.out");
18297 p = fopen("try.out", "w");
b4eb6b3d
JH
18298#ifdef TRY_FPUTC
18299 fputc('x', p);
18300#else
18301# ifdef TRY_FPRINTF
18302 fprintf(p, "x");
18303# endif
18304#endif
18305#ifdef TRY_FFLUSH_NULL
18306 fflush(NULL);
18307#endif
18308#ifdef TRY_FFLUSH_ALL
18309 {
18310 long open_max = -1;
18311# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18312 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18313# else
18314# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18315 open_max = sysconf(_SC_OPEN_MAX);
18316# else
18317# ifdef FOPEN_MAX
18318 open_max = FOPEN_MAX;
18319# else
18320# ifdef OPEN_MAX
18321 open_max = OPEN_MAX;
18322# else
18323# ifdef _NFILE
18324 open_max = _NFILE;
18325# endif
18326# endif
18327# endif
18328# endif
18329# endif
18330# ifdef HAS_STDIO_STREAM_ARRAY
18331 if (open_max > 0) {
18332 long i;
18333 for (i = 0; i < open_max; i++)
18334 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18335 STDIO_STREAM_ARRAY[i]._file < open_max &&
18336 STDIO_STREAM_ARRAY[i]._flag)
18337 fflush(&STDIO_STREAM_ARRAY[i]);
18338 }
18339 }
18340# endif
18341#endif
18342 _exit(42);
18343}
18344EOCP
18345: first we have to find out how _not_ to flush
5440bc8e 18346$to try.c
b4eb6b3d
JH
18347if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18348 output=''
18349 set try -DTRY_FPUTC
18350 if eval $compile; then
fbe73d74 18351 $run ./try 2>/dev/null
28f5ac64 18352 code="$?"
5440bc8e 18353 $from try.out
28f5ac64 18354 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18355 output=-DTRY_FPUTC
18356 fi
18357 fi
18358 case "$output" in
18359 '')
18360 set try -DTRY_FPRINTF
b4eb6b3d 18361 if eval $compile; then
fbe73d74 18362 $run ./try 2>/dev/null
28f5ac64 18363 code="$?"
5440bc8e 18364 $from try.out
28f5ac64 18365 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18366 output=-DTRY_FPRINTF
18367 fi
18368 fi
18369 ;;
18370 esac
18371fi
18372: check for fflush NULL behaviour
18373case "$fflushNULL" in
18374'') set try -DTRY_FFLUSH_NULL $output
18375 if eval $compile; then
5440bc8e 18376 $run ./try 2>/dev/null
b4eb6b3d 18377 code="$?"
5440bc8e 18378 $from try.out
b4eb6b3d
JH
18379 if $test -s try.out -a "X$code" = X42; then
18380 fflushNULL="`$cat try.out`"
18381 else
18382 if $test "X$code" != X42; then
18383 $cat >&4 <<EOM
18384(If this test failed, don't worry, we'll try another method shortly.)
18385EOM
18386 fi
18387 fi
18388 fi
18389 $rm -f core try.core core.try.*
18390 case "$fflushNULL" in
18391 x) $cat >&4 <<EOM
18392Your fflush(NULL) works okay for output streams.
18393Let's see if it clobbers input pipes...
18394EOM
18395# As of mid-March 2000 all versions of Solaris appear to have a stdio
18396# bug that improperly flushes the input end of pipes. So we avoid the
18397# autoflush on fork/system/exec support for now. :-(
18398$cat >tryp.c <<EOCP
18399#include <stdio.h>
18400int
18401main(int argc, char **argv)
18402{
18403 char buf[1024];
18404 int i;
18405 char *bp = buf;
18406 while (1) {
18407 while ((i = getc(stdin)) != -1
18408 && (*bp++ = i) != '\n'
18409 && bp < &buf[1024])
18410 /* DO NOTHING */ ;
18411 *bp = '\0';
18412 fprintf(stdout, "%s", buf);
18413 fflush(NULL);
18414 if (i == -1)
18415 return 0;
18416 bp = buf;
18417 }
18418}
18419EOCP
18420 fflushNULL="$define"
18421 set tryp
18422 if eval $compile; then
18423 $rm -f tryp.out
5440bc8e 18424 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18425 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18426 $cat >&4 <<EOM
18427fflush(NULL) seems to behave okay with input streams.
18428EOM
18429 fflushNULL="$define"
18430 else
18431 $cat >&4 <<EOM
18432Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18433EOM
18434 fflushNULL="$undef"
18435 fi
18436 fi
18437 $rm -f core tryp.c tryp.core core.tryp.*
18438 ;;
18439 '') $cat >&4 <<EOM
18440Your fflush(NULL) isn't working (contrary to ANSI C).
18441EOM
18442 fflushNULL="$undef"
18443 ;;
18444 *) $cat >&4 <<EOM
18445Cannot figure out whether your fflush(NULL) works or not.
18446I'm assuming it doesn't (contrary to ANSI C).
18447EOM
18448 fflushNULL="$undef"
18449 ;;
18450 esac
18451 ;;
18452$define|true|[yY]*)
18453 fflushNULL="$define"
18454 ;;
18455*)
18456 fflushNULL="$undef"
18457 ;;
18458esac
18459: check explicit looping only if NULL did not work, and if the pipe
18460: bug does not show up on an explicit flush too
18461case "$fflushNULL" in
18462"$undef")
18463 $cat >tryp.c <<EOCP
18464#include <stdio.h>
18465int
18466main(int argc, char **argv)
18467{
18468 char buf[1024];
18469 int i;
18470 char *bp = buf;
18471 while (1) {
18472 while ((i = getc(stdin)) != -1
18473 && (*bp++ = i) != '\n'
18474 && bp < &buf[1024])
18475 /* DO NOTHING */ ;
18476 *bp = '\0';
18477 fprintf(stdout, "%s", buf);
18478 fflush(stdin);
18479 if (i == -1)
18480 return 0;
18481 bp = buf;
18482 }
18483}
18484EOCP
18485 set tryp
18486 if eval $compile; then
18487 $rm -f tryp.out
5440bc8e 18488 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18489 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18490 $cat >&4 <<EOM
18491Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18492EOM
18493 : now check for fflushall behaviour
18494 case "$fflushall" in
18495 '') set try -DTRY_FFLUSH_ALL $output
18496 if eval $compile; then
18497 $cat >&4 <<EOM
18498(Now testing the other method--but note that this also may fail.)
18499EOM
5440bc8e 18500 $run ./try 2>/dev/null
28f5ac64 18501 code=$?
fbe73d74 18502 $from try.out
28f5ac64 18503 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18504 fflushall="`$cat try.out`"
18505 fi
18506 fi
18507 $rm -f core try.core core.try.*
18508 case "$fflushall" in
18509 x) $cat >&4 <<EOM
18510Whew. Flushing explicitly all the stdio streams works.
18511EOM
18512 fflushall="$define"
18513 ;;
18514 '') $cat >&4 <<EOM
18515Sigh. Flushing explicitly all the stdio streams doesn't work.
18516EOM
18517 fflushall="$undef"
18518 ;;
18519 *) $cat >&4 <<EOM
18520Cannot figure out whether flushing stdio streams explicitly works or not.
18521I'm assuming it doesn't.
18522EOM
18523 fflushall="$undef"
18524 ;;
18525 esac
18526 ;;
18527 "$define"|true|[yY]*)
18528 fflushall="$define"
18529 ;;
18530 *)
18531 fflushall="$undef"
18532 ;;
18533 esac
18534 else
18535 $cat >&4 <<EOM
18536All is futile. Even fflush(stdin) clobbers input pipes!
18537EOM
18538 fflushall="$undef"
18539 fi
18540 else
18541 fflushall="$undef"
18542 fi
18543 $rm -f core tryp.c tryp.core core.tryp.*
18544 ;;
18545*) fflushall="$undef"
18546 ;;
18547esac
18548
18549case "$fflushNULL$fflushall" in
18550undefundef)
18551 $cat <<EOM
18552OK, I give up. I cannot figure out how to flush pending stdio output.
18553We won't be flushing handles at all before fork/exec/popen.
18554EOM
18555 ;;
18556esac
18557$rm -f try.* try$exe_ext
18558
18559: Store the full pathname to the ar program for use in the C program
18560: Respect a hint or command line value for full_ar.
18561case "$full_ar" in
18562'') full_ar=$ar ;;
18563esac
18564
18565: Store the full pathname to the sed program for use in the C program
18566full_sed=$sed
18567
18568: see what type gids are declared as in the kernel
18569echo " "
18570echo "Looking for the type for group ids returned by getgid()."
18571set gid_t gidtype xxx stdio.h sys/types.h
18572eval $typedef
18573case "$gidtype" in
18574xxx)
18575 xxx=`./findhdr sys/user.h`
18576 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18577 case $1 in
18578 unsigned) dflt="$1 $2" ;;
18579 *) dflt="$1" ;;
18580 esac
18581 ;;
18582*) dflt="$gidtype";;
18583esac
18584case "$gidtype" in
18585gid_t) echo "gid_t found." ;;
18586*) rp="What is the type for group ids returned by getgid()?"
18587 . ./myread
18588 gidtype="$ans"
18589 ;;
18590esac
18591
18592echo " "
18593case "$gidtype" in
18594*_t) zzz="$gidtype" ;;
18595*) zzz="gid" ;;
18596esac
18597echo "Checking the size of $zzz..." >&4
18598cat > try.c <<EOCP
18599#include <sys/types.h>
18600#include <stdio.h>
d1daaddf
JH
18601#$i_stdlib I_STDLIB
18602#ifdef I_STDLIB
18603#include <stdlib.h>
18604#endif
b4eb6b3d
JH
18605int main() {
18606 printf("%d\n", (int)sizeof($gidtype));
18607 exit(0);
18608}
18609EOCP
18610set try
18611if eval $compile_ok; then
5440bc8e 18612 yyy=`$run ./try`
b4eb6b3d
JH
18613 case "$yyy" in
18614 '') gidsize=4
18615 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18616 ;;
18617 *) gidsize=$yyy
18618 echo "Your $zzz is $gidsize bytes long."
18619 ;;
18620 esac
18621else
18622 gidsize=4
18623 echo "(I can't compile the test program--guessing $gidsize.)" >&4
18624fi
18625
18626
18627echo " "
18628case "$gidtype" in
18629*_t) zzz="$gidtype" ;;
18630*) zzz="gid" ;;
18631esac
18632echo "Checking the sign of $zzz..." >&4
18633cat > try.c <<EOCP
18634#include <sys/types.h>
18635#include <stdio.h>
18636int main() {
18637 $gidtype foo = -1;
18638 if (foo < 0)
18639 printf("-1\n");
18640 else
18641 printf("1\n");
18642}
18643EOCP
18644set try
18645if eval $compile; then
5440bc8e 18646 yyy=`$run ./try`
b4eb6b3d
JH
18647 case "$yyy" in
18648 '') gidsign=1
18649 echo "(I can't execute the test program--guessing unsigned.)" >&4
18650 ;;
18651 *) gidsign=$yyy
18652 case "$gidsign" in
18653 1) echo "Your $zzz is unsigned." ;;
18654 -1) echo "Your $zzz is signed." ;;
18655 esac
18656 ;;
18657 esac
18658else
18659 gidsign=1
18660 echo "(I can't compile the test program--guessing unsigned.)" >&4
18661fi
18662
18663
18664echo " "
18665
18666if $test X"$quadtype" != X; then
18667
18668echo "Checking how to print 64-bit integers..." >&4
18669
18670if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18671 $cat >try.c <<'EOCP'
18672#include <sys/types.h>
18673#include <stdio.h>
18674int main() {
18675 int q = 12345678901;
18676 printf("%ld\n", q);
18677}
18678EOCP
18679 set try
18680 if eval $compile; then
5440bc8e 18681 yyy=`$run ./try`
b4eb6b3d
JH
18682 case "$yyy" in
18683 12345678901)
18684 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18685 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18686 echo "We will use %d."
18687 ;;
18688 esac
18689 fi
18690fi
18691
18692if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18693 $cat >try.c <<'EOCP'
18694#include <sys/types.h>
18695#include <stdio.h>
18696int main() {
18697 long q = 12345678901;
18698 printf("%ld\n", q);
18699}
18700EOCP
18701 set try
18702 if eval $compile; then
5440bc8e 18703 yyy=`$run ./try`
b4eb6b3d
JH
18704 case "$yyy" in
18705 12345678901)
18706 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18707 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18708 echo "We will use %ld."
18709 ;;
18710 esac
18711 fi
18712fi
18713
18714if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18715 $cat >try.c <<'EOCP'
18716#include <sys/types.h>
18717#include <inttypes.h>
18718#include <stdio.h>
18719int main() {
18720 int64_t q = 12345678901;
18721 printf("%" PRId64 "\n", q);
18722}
18723EOCP
18724 set try
18725 if eval $compile; then
5440bc8e 18726 yyy=`$run ./try`
b4eb6b3d
JH
18727 case "$yyy" in
18728 12345678901)
18729 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18730 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18731 echo "We will use the C9X style."
18732 ;;
18733 esac
18734 fi
18735fi
18736
2ef53570
JH
18737if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18738 $cat >try.c <<EOCP
b4eb6b3d
JH
18739#include <sys/types.h>
18740#include <stdio.h>
18741int main() {
2ef53570
JH
18742 $quadtype q = 12345678901;
18743 printf("%Ld\n", q);
b4eb6b3d
JH
18744}
18745EOCP
18746 set try
18747 if eval $compile; then
5440bc8e 18748 yyy=`$run ./try`
b4eb6b3d
JH
18749 case "$yyy" in
18750 12345678901)
2ef53570
JH
18751 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18752 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18753 echo "We will use %Ld."
b4eb6b3d
JH
18754 ;;
18755 esac
18756 fi
18757fi
18758
2ef53570
JH
18759if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18760 $cat >try.c <<'EOCP'
b4eb6b3d
JH
18761#include <sys/types.h>
18762#include <stdio.h>
18763int main() {
2ef53570
JH
18764 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18765 printf("%lld\n", q);
b4eb6b3d
JH
18766}
18767EOCP
18768 set try
18769 if eval $compile; then
5440bc8e 18770 yyy=`$run ./try`
b4eb6b3d
JH
18771 case "$yyy" in
18772 12345678901)
2ef53570
JH
18773 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18774 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18775 echo "We will use the %lld style."
b4eb6b3d
JH
18776 ;;
18777 esac
18778 fi
18779fi
18780
18781if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18782 $cat >try.c <<EOCP
18783#include <sys/types.h>
18784#include <stdio.h>
18785int main() {
18786 $quadtype q = 12345678901;
18787 printf("%qd\n", q);
18788}
18789EOCP
18790 set try
18791 if eval $compile; then
5440bc8e 18792 yyy=`$run ./try`
b4eb6b3d
JH
18793 case "$yyy" in
18794 12345678901)
18795 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18796 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18797 echo "We will use %qd."
18798 ;;
18799 esac
18800 fi
18801fi
18802
18803if $test X"$sPRId64" = X; then
18804 echo "Cannot figure out how to print 64-bit integers." >&4
18805fi
18806
18807$rm -f try try.*
18808
18809fi
18810
18811case "$sPRId64" in
18812'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
18813 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
18814 ;;
18815*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
18816 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
18817 ;;
18818esac
18819
18820
18821echo " "
18822$echo "Checking the format strings to be used for Perl's internal types..." >&4
18823
18824if $test X"$ivsize" = X8; then
18825 ivdformat="$sPRId64"
18826 uvuformat="$sPRIu64"
18827 uvoformat="$sPRIo64"
18828 uvxformat="$sPRIx64"
18829 uvXUformat="$sPRIXU64"
18830else
18831 if $test X"$ivsize" = X"$longsize"; then
18832 ivdformat='"ld"'
18833 uvuformat='"lu"'
18834 uvoformat='"lo"'
18835 uvxformat='"lx"'
18836 uvXUformat='"lX"'
18837 else
18838 if $test X"$ivsize" = X"$intsize"; then
18839 ivdformat='"d"'
18840 uvuformat='"u"'
18841 uvoformat='"o"'
18842 uvxformat='"x"'
18843 uvXUformat='"X"'
18844 else
18845 : far out
18846 if $test X"$ivsize" = X"$shortsize"; then
18847 ivdformat='"hd"'
18848 uvuformat='"hu"'
18849 uvoformat='"ho"'
18850 uvxformat='"hx"'
18851 uvXUformat='"hX"'
18852 fi
18853 fi
18854 fi
18855fi
18856
18857if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18858 nveformat="$sPRIeldbl"
18859 nvfformat="$sPRIfldbl"
18860 nvgformat="$sPRIgldbl"
18861 nvEUformat="$sPRIEUldbl"
18862 nvFUformat="$sPRIFUldbl"
18863 nvGUformat="$sPRIGUldbl"
18864else
18865 nveformat='"e"'
18866 nvfformat='"f"'
18867 nvgformat='"g"'
18868 nvEUformat='"E"'
18869 nvFUformat='"F"'
18870 nvGUformat='"G"'
18871fi
18872
18873case "$ivdformat" in
3c728e00 18874'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
18875 exit 1
18876 ;;
18877esac
18878
18879
18880echo " "
18881$echo "Checking the format string to be used for gids..." >&4
18882
18883case "$gidsign" in
18884-1) if $test X"$gidsize" = X"$ivsize"; then
18885 gidformat="$ivdformat"
18886 else
18887 if $test X"$gidsize" = X"$longsize"; then
18888 gidformat='"ld"'
18889 else
18890 if $test X"$gidsize" = X"$intsize"; then
18891 gidformat='"d"'
18892 else
18893 if $test X"$gidsize" = X"$shortsize"; then
18894 gidformat='"hd"'
18895 fi
18896 fi
18897 fi
18898 fi
18899 ;;
18900*) if $test X"$gidsize" = X"$uvsize"; then
18901 gidformat="$uvuformat"
18902 else
18903 if $test X"$gidsize" = X"$longsize"; then
18904 gidformat='"lu"'
18905 else
18906 if $test X"$gidsize" = X"$intsize"; then
18907 gidformat='"u"'
18908 else
18909 if $test X"$gidsize" = X"$shortsize"; then
18910 gidformat='"hu"'
18911 fi
18912 fi
18913 fi
18914 fi
18915 ;;
18916esac
18917
18918: see if getgroups exists
18919set getgroups d_getgrps
18920eval $inlibc
18921
18922: see if setgroups exists
18923set setgroups d_setgrps
18924eval $inlibc
18925
18926
18927: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18928echo " "
18929case "$d_getgrps$d_setgrps" in
18930*define*)
18931 case "$groupstype" in
18932 '') dflt="$gidtype" ;;
18933 *) dflt="$groupstype" ;;
18934 esac
18935 $cat <<EOM
18936What type of pointer is the second argument to getgroups() and setgroups()?
18937Usually this is the same as group ids, $gidtype, but not always.
18938
18939EOM
18940 rp='What type pointer is the second argument to getgroups() and setgroups()?'
18941 . ./myread
18942 groupstype="$ans"
18943 ;;
18944*) groupstype="$gidtype";;
18945esac
18946
d620c7b3
MB
18947
18948case "$mad" in
18949$define|true|[yY]*) dflt='y' ;;
18950*) dflt='n' ;;
18951esac
18952cat <<EOM
18953
18954Would you like to build with Misc Attribute Decoration? This is development
18955work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
18956overhead on the interpreter.
18957
18958If this doesn't make any sense to you, just accept the default '$dflt'.
18959EOM
18960rp='Build Perl with MAD?'
18961. ./myread
18962case "$ans" in
00e74f14
NC
18963y|Y) val="$define"
18964 madlyh='madly.h madly.act madly.tab'
18965 madlysrc='madly.c'
18966 madlyobj="madly$_o" ;;
18967*) val="$undef"
18968 madlyh=''
18969 madlysrc=''
18970 madlyobj='' ;;
d620c7b3
MB
18971esac
18972set mad
18973eval $setvar
18974
b4eb6b3d
JH
18975echo " "
18976echo "Checking if your $make program sets \$(MAKE)..." >&4
18977case "$make_set_make" in
18978'')
18979 $sed 's/^X //' > testmake.mak << 'EOF'
18980Xall:
18981X @echo 'maketemp="$(MAKE)"'
18982EOF
18983 case "`$make -f testmake.mak 2>/dev/null`" in
18984 *maketemp=*) make_set_make='#' ;;
18985 *) make_set_make="MAKE=$make" ;;
18986 esac
18987 $rm -f testmake.mak
18988 ;;
18989esac
18990case "$make_set_make" in
18991'#') echo "Yup, it does.";;
18992*) echo "Nope, it doesn't.";;
18993esac
18994
18995: see what type is used for mode_t
18996rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18997set mode_t modetype int stdio.h sys/types.h
18998eval $typedef_ask
18999
2cc61e15
DD
19000: see if stdarg is available
19001echo " "
19002if $test `./findhdr stdarg.h`; then
19003 echo "<stdarg.h> found." >&4
19004 valstd="$define"
19005else
19006 echo "<stdarg.h> NOT found." >&4
19007 valstd="$undef"
19008fi
19009
19010: see if varags is available
19011echo " "
19012if $test `./findhdr varargs.h`; then
19013 echo "<varargs.h> found." >&4
19014else
19015 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
19016fi
19017
19018: set up the varargs testing programs
19019$cat > varargs.c <<EOP
19020#ifdef I_STDARG
19021#include <stdarg.h>
19022#endif
19023#ifdef I_VARARGS
19024#include <varargs.h>
19025#endif
19026
19027#ifdef I_STDARG
19028int f(char *p, ...)
19029#else
19030int f(va_alist)
19031va_dcl
19032#endif
19033{
19034 va_list ap;
19035#ifndef I_STDARG
19036 char *p;
19037#endif
19038#ifdef I_STDARG
19039 va_start(ap,p);
19040#else
19041 va_start(ap);
19042 p = va_arg(ap, char *);
19043#endif
19044 va_end(ap);
19045}
19046EOP
19047$cat > varargs <<EOP
19048$startsh
19049if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19050 echo "true"
19051else
19052 echo "false"
19053fi
19054$rm -f varargs$_o
19055EOP
19056chmod +x varargs
19057
19058: now check which varargs header should be included
19059echo " "
19060i_varhdr=''
19061case "$valstd" in
19062"$define")
19063 if `./varargs I_STDARG`; then
19064 val='stdarg.h'
19065 elif `./varargs I_VARARGS`; then
19066 val='varargs.h'
19067 fi
19068 ;;
19069*)
19070 if `./varargs I_VARARGS`; then
19071 val='varargs.h'
19072 fi
19073 ;;
19074esac
19075case "$val" in
19076'')
19077echo "I could not find the definition for va_dcl... You have problems..." >&4
19078 val="$undef"; set i_stdarg; eval $setvar
19079 val="$undef"; set i_varargs; eval $setvar
19080 ;;
19081*)
19082 set i_varhdr
19083 eval $setvar
19084 case "$i_varhdr" in
19085 stdarg.h)
19086 val="$define"; set i_stdarg; eval $setvar
19087 val="$undef"; set i_varargs; eval $setvar
19088 ;;
19089 varargs.h)
19090 val="$undef"; set i_stdarg; eval $setvar
19091 val="$define"; set i_varargs; eval $setvar
19092 ;;
19093 esac
19094 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19095esac
19096$rm -f varargs*
19097
19098: see if we need va_copy
19099echo " "
19100case "$i_stdarg" in
19101"$define")
19102 $cat >try.c <<EOCP
19103#include <stdarg.h>
19104#include <stdio.h>
85c8a686
DD
19105#$i_stdlib I_STDLIB
19106#ifdef I_STDLIB
19107#include <stdlib.h>
19108#endif
19109#include <signal.h>
2cc61e15
DD
19110
19111int
19112ivfprintf(FILE *f, const char *fmt, va_list *valp)
19113{
19114 return vfprintf(f, fmt, *valp);
19115}
19116
19117int
19118myvfprintf(FILE *f, const char *fmt, va_list val)
19119{
19120 return ivfprintf(f, fmt, &val);
19121}
19122
19123int
19124myprintf(char *fmt, ...)
19125{
19126 va_list val;
19127 va_start(val, fmt);
19128 return myvfprintf(stdout, fmt, val);
19129}
19130
19131int
19132main(int ac, char **av)
19133{
85c8a686
DD
19134 signal(SIGSEGV, exit);
19135
2cc61e15
DD
19136 myprintf("%s%cs all right, then\n", "that", '\'');
19137 exit(0);
19138}
19139EOCP
19140 set try
5440bc8e
JH
19141 if eval $compile && $run ./try 2>&1 >/dev/null; then
19142 case "`$run ./try`" in
2cc61e15
DD
19143 "that's all right, then")
19144 okay=yes
19145 ;;
19146 esac
19147 fi
19148 case "$okay" in
19149 yes) echo "It seems that you don't need va_copy()." >&4
19150 need_va_copy="$undef"
19151 ;;
19152 *) echo "It seems that va_copy() or similar will be needed." >&4
19153 need_va_copy="$define"
19154 ;;
19155 esac
19156 $rm -f try.* core core.* *.core *.core.*
19157 ;;
19158*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19159 ;;
19160esac
19161
b4eb6b3d
JH
19162: see what type is used for size_t
19163rp="What is the type used for the length parameter for string functions?"
19164set size_t sizetype 'unsigned int' stdio.h sys/types.h
19165eval $typedef_ask
19166
19167: check for type of arguments to gethostbyaddr.
19168if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19169 case "$d_gethbyaddr" in
19170 $define)
19171 $cat <<EOM
19172
19173Checking to see what type of arguments are accepted by gethostbyaddr().
19174EOM
19175 hdrs="$define sys/types.h
19176 $d_socket sys/socket.h
19177 $i_niin netinet/in.h
19178 $i_netdb netdb.h
19179 $i_unistd unistd.h"
19180 : The first arg can 'char *' or 'void *'
19181 : The second arg is some of integral type
19182 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19183 for yyy in size_t long int; do
19184 case "$netdb_host_type" in
19185 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19186 if ./protochk "$try" $hdrs; then
19187 echo "Your system accepts $xxx for the first arg."
19188 echo "...and $yyy for the second arg."
19189 netdb_host_type="$xxx"
19190 netdb_hlen_type="$yyy"
19191 fi
19192 ;;
19193 esac
19194 done
19195 done
19196 : In case none of those worked, prompt the user.
19197 case "$netdb_host_type" in
19198 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19199 dflt='char *'
19200 . ./myread
19201 netdb_host_type=$ans
19202 rp='What is the type for the 2nd argument to gethostbyaddr?'
19203 dflt="$sizetype"
19204 . ./myread
19205 netdb_hlen_type=$ans
19206 ;;
19207 esac
19208 ;;
19209 *) : no gethostbyaddr, so pick harmless defaults
19210 netdb_host_type='char *'
19211 netdb_hlen_type="$sizetype"
19212 ;;
19213 esac
19214 # Remove the "const" if needed. -- but then we'll have a
19215 # prototype clash!
19216 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19217fi
19218
19219: check for type of argument to gethostbyname.
19220if test "X$netdb_name_type" = X ; then
19221 case "$d_gethbyname" in
19222 $define)
19223 $cat <<EOM
19224
19225Checking to see what type of argument is accepted by gethostbyname().
19226EOM
19227 hdrs="$define sys/types.h
19228 $d_socket sys/socket.h
19229 $i_niin netinet/in.h
19230 $i_netdb netdb.h
19231 $i_unistd unistd.h"
19232 for xxx in "const char *" "char *"; do
19233 case "$netdb_name_type" in
19234 '') try="extern struct hostent *gethostbyname($xxx);"
19235 if ./protochk "$try" $hdrs; then
19236 echo "Your system accepts $xxx."
19237 netdb_name_type="$xxx"
19238 fi
19239 ;;
19240 esac
19241 done
19242 : In case none of those worked, prompt the user.
19243 case "$netdb_name_type" in
19244 '') rp='What is the type for the 1st argument to gethostbyname?'
19245 dflt='char *'
19246 . ./myread
19247 netdb_name_type=$ans
19248 ;;
19249 esac
19250 ;;
19251 *) : no gethostbyname, so pick harmless default
19252 netdb_name_type='char *'
19253 ;;
19254 esac
19255fi
19256
19257: check for type of 1st argument to getnetbyaddr.
19258if test "X$netdb_net_type" = X ; then
19259 case "$d_getnbyaddr" in
19260 $define)
19261 $cat <<EOM
19262
19263Checking to see what type of 1st argument is accepted by getnetbyaddr().
19264EOM
19265 hdrs="$define sys/types.h
19266 $d_socket sys/socket.h
19267 $i_niin netinet/in.h
19268 $i_netdb netdb.h
19269 $i_unistd unistd.h"
19270 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19271 case "$netdb_net_type" in
19272 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19273 if ./protochk "$try" $hdrs; then
19274 echo "Your system accepts $xxx."
19275 netdb_net_type="$xxx"
19276 fi
19277 ;;
19278 esac
19279 done
19280 : In case none of those worked, prompt the user.
19281 case "$netdb_net_type" in
19282 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19283 dflt='long'
19284 . ./myread
19285 netdb_net_type=$ans
19286 ;;
19287 esac
19288 ;;
19289 *) : no getnetbyaddr, so pick harmless default
19290 netdb_net_type='long'
19291 ;;
19292 esac
19293fi
19294: locate the preferred pager for this system
d604bb53 19295fn=f/
b4eb6b3d
JH
19296case "$pager" in
19297'')
19298 dflt=''
19299 case "$pg" in
19300 /*) dflt=$pg;;
19301 [a-zA-Z]:/*) dflt=$pg;;
19302 esac
19303 case "$more" in
19304 /*) dflt=$more;;
19305 [a-zA-Z]:/*) dflt=$more;;
19306 esac
19307 case "$less" in
19308 /*) dflt=$less;;
19309 [a-zA-Z]:/*) dflt=$less;;
19310 esac
19311 case "$dflt" in
19312 '') dflt=/usr/ucb/more;;
19313 esac
19314 ;;
d604bb53
JH
19315*) dflt="$pager"
19316 : Instruct ./getfile to trust the hinted or previous pager value,
19317 : even if it does not begin with a slash. For example, on os2,
19318 : pager might be cmd /c more. See comments in UU/getfile.
19319 fn="f/($pager)"
19320 ;;
b4eb6b3d
JH
19321esac
19322echo " "
b4eb6b3d
JH
19323rp='What pager is used on your system?'
19324. ./getfile
19325pager="$ans"
19326
19327: see what type pids are declared as in the kernel
19328rp="What is the type of process ids on this system?"
19329set pid_t pidtype int stdio.h sys/types.h
19330eval $typedef_ask
19331
b4eb6b3d
JH
19332: see if ar generates random libraries by itself
19333echo " "
19334echo "Checking how to generate random libraries on your machine..." >&4
19335echo 'int bar1() { return bar2(); }' > bar1.c
19336echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19337$cat > foo.c <<EOP
19338#$i_stdlib I_STDLIB
19339#ifdef I_STDLIB
19340#include <stdlib.h>
19341#endif
b4eb6b3d
JH
19342int main() { printf("%d\n", bar1()); exit(0); }
19343EOP
19344$cc $ccflags -c bar1.c >/dev/null 2>&1
19345$cc $ccflags -c bar2.c >/dev/null 2>&1
19346$cc $ccflags -c foo.c >/dev/null 2>&1
19347$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19348if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19349 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19350 echo "$ar appears to generate random libraries itself."
19351 orderlib=false
e39a9d84
LC
19352 if [ "X$ranlib" = "X" ]; then
19353 ranlib=":"
19354 fi
88d4d47b
PC
19355elif $ar s bar$_a >/dev/null 2>&1 &&
19356 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19357 $run ./foobar >/dev/null 2>&1; then
19358 echo "a table of contents needs to be added with '$ar s'."
19359 orderlib=false
19360 ranlib="$ar s"
b4eb6b3d 19361elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19362 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19363 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19364 echo "a table of contents needs to be added with '$ar ts'."
19365 orderlib=false
19366 ranlib="$ar ts"
19367else
19368 case "$ranlib" in
19369 :) ranlib='';;
19370 '')
19371 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19372 $test -f $ranlib || ranlib=''
19373 ;;
19374 esac
19375 if $test -n "$ranlib"; then
19376 echo "your system has '$ranlib'; we'll use that."
19377 orderlib=false
19378 else
19379 echo "your system doesn't seem to support random libraries"
19380 echo "so we'll use lorder and tsort to order the libraries."
19381 orderlib=true
19382 ranlib=":"
19383 fi
19384fi
88d4d47b 19385$rm -f foo* bar*
b4eb6b3d
JH
19386
19387: check for type of arguments to select.
19388case "$selecttype" in
19389'') case "$d_select" in
19390 $define)
19391 echo " "
19392 $cat <<EOM
19393Checking to see what type of arguments are accepted by select().
19394EOM
19395 hdrs="$define sys/types.h
19396 $i_systime sys/time.h
19397 $i_sysselct sys/select.h
19398 $d_socket sys/socket.h"
19399 : The first arg can be int, unsigned, or size_t
19400 : The last arg may or may not be 'const'
19401 val=''
19402 : void pointer has been seen but using that
19403 : breaks the selectminbits test
19404 for xxx in 'fd_set *' 'int *'; do
19405 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19406 for tmo in 'struct timeval *' 'const struct timeval *'; do
19407 case "$val" in
19408 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19409 if ./protochk "$try" $hdrs; then
19410 echo "Your system accepts $xxx."
19411 val="$xxx"
19412 fi
19413 ;;
19414 esac
19415 done
19416 done
19417 done
19418 case "$val" in
19419 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19420 case "$d_fd_set" in
19421 $define) dflt="fd_set *" ;;
19422 *) dflt="int *" ;;
19423 esac
19424 . ./myread
19425 val=$ans
19426 ;;
19427 esac
19428 selecttype="$val"
19429 ;;
19430 *) : no select, so pick a harmless default
19431 selecttype='int *'
19432 ;;
19433 esac
19434 ;;
19435esac
19436
19437: check for the select 'width'
19438case "$selectminbits" in
e6e7e605
JH
19439'') safebits=`expr $ptrsize \* 8`
19440 case "$d_select" in
b4eb6b3d
JH
19441 $define)
19442 $cat <<EOM
19443
19444Checking to see on how many bits at a time your select() operates...
19445EOM
19446 $cat >try.c <<EOCP
19447#include <sys/types.h>
19448#$i_time I_TIME
19449#$i_systime I_SYS_TIME
19450#$i_systimek I_SYS_TIME_KERNEL
19451#ifdef I_TIME
19452# include <time.h>
19453#endif
19454#ifdef I_SYS_TIME
19455# ifdef I_SYS_TIME_KERNEL
19456# define KERNEL
19457# endif
19458# include <sys/time.h>
19459# ifdef I_SYS_TIME_KERNEL
19460# undef KERNEL
19461# endif
19462#endif
19463#$i_sysselct I_SYS_SELECT
19464#ifdef I_SYS_SELECT
19465#include <sys/select.h>
19466#endif
19467#$d_socket HAS_SOCKET
19468#ifdef HAS_SOCKET
19469# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19470#endif
19471#include <stdio.h>
d1daaddf
JH
19472#$i_stdlib I_STDLIB
19473#ifdef I_STDLIB
19474#include <stdlib.h>
19475#endif
b4eb6b3d
JH
19476$selecttype b;
19477#define S sizeof(*(b))
19478#define MINBITS 64
19479#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19480#define NBITS (NBYTES * 8)
19481int main() {
e6e7e605 19482 char *s = malloc(NBYTES);
b4eb6b3d
JH
19483 struct timeval t;
19484 int i;
19485 FILE* fp;
19486 int fd;
19487
e6e7e605
JH
19488 if (!s)
19489 exit(1);
b4eb6b3d
JH
19490 fclose(stdin);
19491 fp = fopen("try.c", "r");
19492 if (fp == 0)
e6e7e605 19493 exit(2);
b4eb6b3d
JH
19494 fd = fileno(fp);
19495 if (fd < 0)
e6e7e605 19496 exit(3);
b4eb6b3d
JH
19497 b = ($selecttype)s;
19498 for (i = 0; i < NBITS; i++)
19499 FD_SET(i, b);
19500 t.tv_sec = 0;
19501 t.tv_usec = 0;
19502 select(fd + 1, b, 0, 0, &t);
19503 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19504 free(s);
b4eb6b3d
JH
19505 printf("%d\n", i + 1);
19506 return 0;
19507}
19508EOCP
19509 set try
19510 if eval $compile_ok; then
5440bc8e 19511 selectminbits=`$run ./try`
b4eb6b3d
JH
19512 case "$selectminbits" in
19513 '') cat >&4 <<EOM
19514Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19515I'll play safe and guess it is $safebits bits.
b4eb6b3d 19516EOM
e6e7e605
JH
19517 selectminbits=$safebits
19518 bits="$safebits bits"
b4eb6b3d
JH
19519 ;;
19520 1) bits="1 bit" ;;
19521 *) bits="$selectminbits bits" ;;
19522 esac
19523 echo "Your select() operates on $bits at a time." >&4
19524 else
19525 rp='What is the minimum number of bits your select() operates on?'
19526 case "$byteorder" in
e6e7e605
JH
19527 12345678) dflt=64 ;;
19528 1234) dflt=32 ;;
b4eb6b3d
JH
19529 *) dflt=1 ;;
19530 esac
19531 . ./myread
19532 val=$ans
19533 selectminbits="$val"
19534 fi
19535 $rm -f try.* try
19536 ;;
19537 *) : no select, so pick a harmless default
e6e7e605 19538 selectminbits=$safebits
b4eb6b3d
JH
19539 ;;
19540 esac
19541 ;;
19542esac
19543
19544: Trace out the files included by signal.h, then look for SIGxxx names.
19545: Remove SIGARRAYSIZE used by HPUX.
19546: Remove SIGSTKSIZE used by Linux.
19547: Remove SIGSTKSZ used by Posix.
19548: Remove SIGTYP void lines used by OS2.
19549: Some cpps, like os390, dont give the file name anywhere
19550if [ "X$fieldn" = X ]; then
19551 : Just make some guesses. We check them later.
19552 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19553else
19554 xxx=`echo '#include <signal.h>' |
19555 $cppstdin $cppminus $cppflags 2>/dev/null |
19556 $grep '^[ ]*#.*include' |
a938a3bb 19557 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19558fi
19559: Check this list of files to be sure we have parsed the cpp output ok.
19560: This will also avoid potentially non-existent files, such
19561: as ../foo/bar.h
19562xxxfiles=''
19563for xx in $xxx /dev/null ; do
19564 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19565done
19566: If we have found no files, at least try signal.h
19567case "$xxxfiles" in
19568'') xxxfiles=`./findhdr signal.h` ;;
19569esac
19570xxx=`awk '
19571$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19572 print substr($2, 4, 20)
19573}
19574$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19575 print substr($3, 4, 20)
19576}' $xxxfiles`
19577: Append some common names just in case the awk scan failed.
19578xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19579xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19580xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19581xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19582xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19583
19584: generate a few handy files for later
55954f19 19585$cat > signal.c <<EOCP
b4eb6b3d
JH
19586#include <sys/types.h>
19587#include <signal.h>
55954f19
JH
19588#$i_stdlib I_STDLIB
19589#ifdef I_STDLIB
19590#include <stdlib.h>
19591#endif
b4eb6b3d
JH
19592#include <stdio.h>
19593int main() {
19594
19595/* Strange style to avoid deeply-nested #if/#else/#endif */
19596#ifndef NSIG
19597# ifdef _NSIG
19598# define NSIG (_NSIG)
19599# endif
19600#endif
19601
19602#ifndef NSIG
19603# ifdef SIGMAX
19604# define NSIG (SIGMAX+1)
19605# endif
19606#endif
19607
19608#ifndef NSIG
19609# ifdef SIG_MAX
19610# define NSIG (SIG_MAX+1)
19611# endif
19612#endif
19613
19614#ifndef NSIG
3609ea0d
JH
19615# ifdef _SIG_MAX
19616# define NSIG (_SIG_MAX+1)
19617# endif
19618#endif
19619
19620#ifndef NSIG
b4eb6b3d
JH
19621# ifdef MAXSIG
19622# define NSIG (MAXSIG+1)
19623# endif
19624#endif
19625
19626#ifndef NSIG
19627# ifdef MAX_SIG
19628# define NSIG (MAX_SIG+1)
19629# endif
19630#endif
19631
19632#ifndef NSIG
19633# ifdef SIGARRAYSIZE
3609ea0d 19634# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
19635# endif
19636#endif
19637
19638#ifndef NSIG
19639# ifdef _sys_nsig
19640# define NSIG (_sys_nsig) /* Solaris 2.5 */
19641# endif
19642#endif
19643
19644/* Default to some arbitrary number that's big enough to get most
19645 of the common signals.
19646*/
19647#ifndef NSIG
19648# define NSIG 50
19649#endif
19650
19651printf("NSIG %d\n", NSIG);
19652
19653#ifndef JUST_NSIG
19654
19655EOCP
19656
19657echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19658{
19659 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 19660 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
19661 printf $1; printf ");\n"
19662 printf "#endif\n"
19663}
19664END {
19665 printf "#endif /* JUST_NSIG */\n";
19666 printf "exit(0);\n}\n";
19667}
19668' >>signal.c
19669$cat >signal.awk <<'EOP'
19670BEGIN { ndups = 0 }
65197d93 19671$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 19672($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
19673 if ($2 > maxsig) { maxsig = $2 }
19674 if (sig_name[$2]) {
19675 dup_name[ndups] = $1
19676 dup_num[ndups] = $2
b4eb6b3d
JH
19677 ndups++
19678 }
1ebe1ffb 19679 else {
65197d93
JH
19680 sig_name[$2] = $1
19681 sig_num[$2] = $2
b4eb6b3d
JH
19682 }
19683}
19684END {
19685 if (nsig == 0) {
19686 nsig = maxsig + 1
19687 }
19688 printf("NSIG %d\n", nsig);
19689 for (n = 1; n < nsig; n++) {
19690 if (sig_name[n]) {
19691 printf("%s %d\n", sig_name[n], sig_num[n])
19692 }
19693 else {
19694 printf("NUM%d %d\n", n, n)
19695 }
19696 }
19697 for (n = 0; n < ndups; n++) {
19698 printf("%s %d\n", dup_name[n], dup_num[n])
19699 }
19700}
19701EOP
19702$cat >signal_cmd <<EOS
19703$startsh
19704if $test -s signal.lst; then
19705 echo "Using your existing signal.lst file"
19706 exit 0
19707fi
19708xxx="$xxx"
19709EOS
19710$cat >>signal_cmd <<'EOS'
19711
19712set signal
19713if eval $compile_ok; then
1eb9ad5b 19714 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19715else
19716 echo "(I can't seem be able to compile the whole test program)" >&4
19717 echo "(I'll try it in little pieces.)" >&4
19718 set signal -DJUST_NSIG
19719 if eval $compile_ok; then
5440bc8e 19720 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
19721 $cat signal.nsg
19722 else
19723 echo "I can't seem to figure out how many signals you have." >&4
19724 echo "Guessing 50." >&4
19725 echo 'NSIG 50' > signal.nsg
19726 fi
19727 : Now look at all the signal names, one at a time.
19728 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19729 $cat > signal.c <<EOCP
19730#include <sys/types.h>
19731#include <signal.h>
19732#include <stdio.h>
19733int main() {
19734printf("$xx %d\n", SIG${xx});
19735return 0;
19736}
19737EOCP
19738 set signal
19739 if eval $compile; then
19740 echo "SIG${xx} found."
5440bc8e 19741 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
19742 else
19743 echo "SIG${xx} NOT found."
19744 fi
19745 done
19746 if $test -s signal.ls1; then
19747 $cat signal.nsg signal.ls1 |
65197d93 19748 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
19749 fi
19750
19751fi
19752if $test -s signal.lst; then
19753 :
19754else
19755 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19756 echo 'kill -l' >signal
19757 set X `csh -f <signal`
19758 $rm -f signal
19759 shift
19760 case $# in
19761 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19762 esac
19763 echo $@ | $tr ' ' $trnl | \
19764 $awk '{ printf "%s %d\n", $1, ++s; }
19765 END { printf "NSIG %d\n", ++s }' >signal.lst
19766fi
19767$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19768EOS
19769chmod a+x signal_cmd
19770$eunicefix signal_cmd
19771
19772: generate list of signal names
19773echo " "
19774case "$sig_name_init" in
19775'') doinit=yes ;;
19776*) case "$sig_num_init" in
19777 ''|*,*) doinit=yes ;;
19778 esac ;;
19779esac
19780case "$doinit" in
19781yes)
19782 echo "Generating a list of signal names and numbers..." >&4
19783 . ./signal_cmd
19784 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19785 sig_name=`$awk 'BEGIN { printf "ZERO " }
19786 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19787 sig_num=`$awk 'BEGIN { printf "0 " }
19788 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19789 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
19790 !/^NSIG/ { printf "\"%s\", ", $1 }
19791 END { printf "0\n" }' signal.lst`
19792 sig_num_init=`$awk 'BEGIN { printf "0, " }
19793 !/^NSIG/ { printf "%d, ", $2}
19794 END { printf "0\n"}' signal.lst`
19795 ;;
19796esac
19797echo "The following $sig_count signals are available:"
19798echo " "
19799echo $sig_name | $awk \
19800'BEGIN { linelen = 0 }
19801{
19802 for (i = 1; i <= NF; i++) {
19803 name = "SIG" $i " "
19804 linelen = linelen + length(name)
19805 if (linelen > 70) {
19806 printf "\n"
19807 linelen = length(name)
19808 }
19809 printf "%s", name
19810 }
19811 printf "\n"
19812}'
76d3c696 19813sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
19814$rm -f signal signal.c signal.awk signal.lst signal_cmd
19815
19816echo " "
19817case "$sizetype" in
19818*_t) zzz="$sizetype" ;;
19819*) zzz="filesize" ;;
19820esac
19821echo "Checking the size of $zzz..." >&4
19822cat > try.c <<EOCP
19823#include <sys/types.h>
19824#include <stdio.h>
d1daaddf
JH
19825#$i_stdlib I_STDLIB
19826#ifdef I_STDLIB
19827#include <stdlib.h>
19828#endif
b4eb6b3d
JH
19829int main() {
19830 printf("%d\n", (int)sizeof($sizetype));
19831 exit(0);
19832}
19833EOCP
19834set try
19835if eval $compile_ok; then
5440bc8e 19836 yyy=`$run ./try`
b4eb6b3d
JH
19837 case "$yyy" in
19838 '') sizesize=4
19839 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19840 ;;
19841 *) sizesize=$yyy
19842 echo "Your $zzz size is $sizesize bytes."
19843 ;;
19844 esac
19845else
19846 sizesize=4
19847 echo "(I can't compile the test program--guessing $sizesize.)" >&4
19848fi
19849
19850
19851: check for socklen_t
19852echo " "
19853echo "Checking to see if you have socklen_t..." >&4
19854$cat >try.c <<EOCP
19855#include <sys/types.h>
19856#$d_socket HAS_SOCKET
19857#ifdef HAS_SOCKET
19858#include <sys/socket.h>
19859#endif
19860int main() { socklen_t x = 16; }
19861EOCP
19862set try
19863if eval $compile; then
19864 val="$define"
19865 echo "You have socklen_t."
19866else
19867 val="$undef"
19868 echo "You do not have socklen_t."
19869 case "$sizetype" in
19870 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19871 esac
19872fi
19873$rm -f try try.*
19874set d_socklen_t
19875eval $setvar
19876
a7710f8d
JH
19877: see if this is a socks.h system
19878set socks.h i_socks
19879eval $inhdr
19880
b4eb6b3d
JH
19881: check for type of the size argument to socket calls
19882case "$d_socket" in
19883"$define")
19884 $cat <<EOM
19885
19886Checking to see what type is the last argument of accept().
19887EOM
b4eb6b3d
JH
19888 yyy=''
19889 case "$d_socklen_t" in
19890 "$define") yyy="$yyy socklen_t"
19891 esac
19892 yyy="$yyy $sizetype int long unsigned"
19893 for xxx in $yyy; do
19894 case "$socksizetype" in
19895 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
19896 case "$usesocks" in
19897 "$define")
19898 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19899 echo "Your system accepts '$xxx *' for the last argument of accept()."
19900 socksizetype="$xxx"
19901 fi
19902 ;;
19903 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
19904 echo "Your system accepts '$xxx *' for the last argument of accept()."
19905 socksizetype="$xxx"
19906 fi
19907 ;;
19908 esac
b4eb6b3d
JH
19909 ;;
19910 esac
19911 done
19912: In case none of those worked, prompt the user.
19913 case "$socksizetype" in
19914 '') rp='What is the type for socket address structure sizes?'
19915 dflt='int'
19916 . ./myread
19917 socksizetype=$ans
19918 ;;
19919 esac
19920 ;;
19921*) : no sockets, so pick relatively harmless default
19922 socksizetype='int'
19923 ;;
19924esac
19925
19926: see what type is used for signed size_t
19927set ssize_t ssizetype int stdio.h sys/types.h
19928eval $typedef
19929dflt="$ssizetype"
5440bc8e 19930$cat > try.c <<EOM
b4eb6b3d 19931#include <stdio.h>
d1daaddf
JH
19932#$i_stdlib I_STDLIB
19933#ifdef I_STDLIB
19934#include <stdlib.h>
19935#endif
b4eb6b3d
JH
19936#include <sys/types.h>
19937#define Size_t $sizetype
19938#define SSize_t $dflt
19939int main()
19940{
19941 if (sizeof(Size_t) == sizeof(SSize_t))
19942 printf("$dflt\n");
19943 else if (sizeof(Size_t) == sizeof(int))
19944 printf("int\n");
19945 else
19946 printf("long\n");
19947 exit(0);
19948}
19949EOM
19950echo " "
5440bc8e
JH
19951set try
19952if eval $compile_ok && $run ./try > /dev/null; then
19953 ssizetype=`$run ./try`
b4eb6b3d
JH
19954 echo "I'll be using $ssizetype for functions returning a byte count." >&4
19955else
19956 $cat >&4 <<EOM
19957Help! I can't compile and run the ssize_t test program: please enlighten me!
19958(This is probably a misconfiguration in your system or libraries, and
19959you really ought to fix it. Still, I'll try anyway.)
19960
19961I need a type that is the same size as $sizetype, but is guaranteed to
19962be signed. Common values are ssize_t, int and long.
19963
19964EOM
19965 rp="What signed type is the same size as $sizetype?"
19966 . ./myread
19967 ssizetype="$ans"
19968fi
5440bc8e 19969$rm -f try try.*
b4eb6b3d
JH
19970
19971: see what type of char stdio uses.
19972echo " "
359842a5
JH
19973echo '#include <stdio.h>' > stdio.c
19974$cppstdin $cppminus < stdio.c > stdioh
aa517f50 19975if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
19976 echo "Your stdio uses unsigned chars." >&4
19977 stdchar="unsigned char"
19978else
aa517f50
JH
19979 echo "Your stdio uses signed chars." >&4
19980 stdchar="char"
b4eb6b3d 19981fi
359842a5 19982$rm -f stdio.* stdioh
b4eb6b3d 19983
b4eb6b3d
JH
19984: see what type uids are declared as in the kernel
19985echo " "
19986echo "Looking for the type for user ids returned by getuid()."
19987set uid_t uidtype xxx stdio.h sys/types.h
19988eval $typedef
19989case "$uidtype" in
19990xxx)
19991 xxx=`./findhdr sys/user.h`
19992 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19993 case $1 in
19994 unsigned) dflt="$1 $2" ;;
19995 *) dflt="$1" ;;
19996 esac
19997 ;;
19998*) dflt="$uidtype";;
19999esac
20000case "$uidtype" in
20001uid_t) echo "uid_t found." ;;
20002*) rp="What is the type for user ids returned by getuid()?"
20003 . ./myread
20004 uidtype="$ans"
20005 ;;
20006esac
20007
20008echo " "
20009case "$uidtype" in
20010*_t) zzz="$uidtype" ;;
20011*) zzz="uid" ;;
20012esac
20013echo "Checking the size of $zzz..." >&4
20014cat > try.c <<EOCP
20015#include <sys/types.h>
20016#include <stdio.h>
d1daaddf
JH
20017#$i_stdlib I_STDLIB
20018#ifdef I_STDLIB
20019#include <stdlib.h>
20020#endif
b4eb6b3d
JH
20021int main() {
20022 printf("%d\n", (int)sizeof($uidtype));
20023 exit(0);
20024}
20025EOCP
20026set try
20027if eval $compile_ok; then
5440bc8e 20028 yyy=`$run ./try`
b4eb6b3d
JH
20029 case "$yyy" in
20030 '') uidsize=4
20031 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20032 ;;
20033 *) uidsize=$yyy
20034 echo "Your $zzz is $uidsize bytes long."
20035 ;;
20036 esac
20037else
20038 uidsize=4
20039 echo "(I can't compile the test program--guessing $uidsize.)" >&4
20040fi
20041
20042echo " "
20043case "$uidtype" in
20044*_t) zzz="$uidtype" ;;
20045*) zzz="uid" ;;
20046esac
20047echo "Checking the sign of $zzz..." >&4
20048cat > try.c <<EOCP
20049#include <sys/types.h>
20050#include <stdio.h>
20051int main() {
20052 $uidtype foo = -1;
20053 if (foo < 0)
20054 printf("-1\n");
20055 else
20056 printf("1\n");
20057}
20058EOCP
20059set try
20060if eval $compile; then
5440bc8e 20061 yyy=`$run ./try`
b4eb6b3d
JH
20062 case "$yyy" in
20063 '') uidsign=1
20064 echo "(I can't execute the test program--guessing unsigned.)" >&4
20065 ;;
20066 *) uidsign=$yyy
20067 case "$uidsign" in
20068 1) echo "Your $zzz is unsigned." ;;
20069 -1) echo "Your $zzz is signed." ;;
20070 esac
20071 ;;
20072 esac
20073else
20074 uidsign=1
20075 echo "(I can't compile the test program--guessing unsigned.)" >&4
20076fi
20077
20078
20079
20080echo " "
20081$echo "Checking the format string to be used for uids..." >&4
20082
20083case "$uidsign" in
20084-1) if $test X"$uidsize" = X"$ivsize"; then
20085 uidformat="$ivdformat"
20086 else
20087 if $test X"$uidsize" = X"$longsize"; then
20088 uidformat='"ld"'
20089 else
20090 if $test X"$uidsize" = X"$intsize"; then
20091 uidformat='"d"'
20092 else
20093 if $test X"$uidsize" = X"$shortsize"; then
20094 uidformat='"hd"'
20095 fi
20096 fi
20097 fi
20098 fi
20099 ;;
20100*) if $test X"$uidsize" = X"$uvsize"; then
20101 uidformat="$uvuformat"
20102 else
20103 if $test X"$uidsize" = X"$longsize"; then
20104 uidformat='"lu"'
20105 else
20106 if $test X"$uidsize" = X"$intsize"; then
20107 uidformat='"u"'
20108 else
20109 if $test X"$uidsize" = X"$shortsize"; then
20110 uidformat='"hu"'
20111 fi
20112 fi
20113 fi
20114 fi
20115 ;;
20116esac
20117
4afd418c
MB
20118
20119case "$usesitecustomize" in
20120 $define|true|[Yy]*)
20121 usesitecustomize="$define"
20122 ;;
20123 *)
20124 usesitecustomize="$undef"
20125 ;;
20126 esac
20127
3659ebf1
JH
20128: determine compiler compiler
20129case "$yacc" in
20130'')
20131 dflt=yacc;;
20132*)
20133 dflt="$yacc";;
20134esac
20135echo " "
20136comp='yacc'
3c728e00 20137if $test -f "$byacc$_exe"; then
3659ebf1
JH
20138 dflt="$byacc"
20139 comp="byacc or $comp"
20140fi
3c728e00 20141if $test -f "$bison$_exe"; then
3659ebf1
JH
20142 comp="$comp or bison -y"
20143fi
20144rp="Which compiler compiler ($comp) shall I use?"
20145. ./myread
20146yacc="$ans"
20147case "$yacc" in
20148*bis*)
20149 case "$yacc" in
20150 *-y*) ;;
20151 *)
20152 yacc="$yacc -y"
20153 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20154 ;;
20155 esac
20156 ;;
20157esac
20158
758a5d79
JH
20159: see if this is a fp.h system
20160set fp.h i_fp
20161eval $inhdr
20162
20163: see if this is a fp_class.h system
20164set fp_class.h i_fp_class
20165eval $inhdr
20166
b4eb6b3d 20167: see if this is a ieeefp.h system
b5b9f165
JH
20168case "$i_ieeefp" in
20169'' ) set ieeefp.h i_ieeefp
20170 eval $inhdr
20171 ;;
20172esac
b4eb6b3d
JH
20173
20174: see if this is a libutil.h system
20175set libutil.h i_libutil
20176eval $inhdr
20177
b4eb6b3d
JH
20178: see if mach cthreads are available
20179if test "X$usethreads" = "X$define"; then
20180 set mach/cthreads.h i_machcthr
20181 eval $inhdr
20182else
20183 i_machcthr="$undef"
20184fi
20185
20186
20187
b4eb6b3d
JH
20188: see if this is a mntent.h system
20189set mntent.h i_mntent
20190eval $inhdr
20191
20192: see if ndbm.h is available
20193set ndbm.h t_ndbm
20194eval $inhdr
1c6861ad
JS
20195
20196case "$t_ndbm" in
20197$undef)
20198 # Some Linux distributions such as RedHat 7.1 put the
20199 # ndbm.h header in /usr/include/gdbm/ndbm.h.
20200 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 20201 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
20202 ccflags="$ccflags -I/usr/include/gdbm"
20203 cppflags="$cppflags -I/usr/include/gdbm"
20204 t_ndbm=$define
20205 fi
20206 ;;
20207esac
20208
b4eb6b3d
JH
20209case "$t_ndbm" in
20210$define)
20211 : see if dbm_open exists
20212 set dbm_open d_dbm_open
20213 eval $inlibc
20214 case "$d_dbm_open" in
20215 $undef)
20216 t_ndbm="$undef"
20217 echo "We won't be including <ndbm.h>"
20218 ;;
20219 esac
20220 ;;
20221esac
20222val="$t_ndbm"
20223set i_ndbm
20224eval $setvar
20225
20226: see if net/errno.h is available
20227val=''
20228set net/errno.h val
20229eval $inhdr
20230
20231: Unfortunately, it causes problems on some systems. Arrgh.
20232case "$val" in
20233$define)
20234 cat > try.c <<'EOM'
20235#include <stdio.h>
20236#include <errno.h>
20237#include <net/errno.h>
20238int func()
20239{
20240 return ENOTSOCK;
20241}
20242EOM
20243 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20244 echo "We'll be including <net/errno.h>." >&4
20245 else
20246 echo "We won't be including <net/errno.h>." >&4
20247 val="$undef"
20248 fi
20249 $rm -f try.* try
20250 ;;
20251esac
20252set i_neterrno
20253eval $setvar
20254
20255: see if netinet/tcp.h is available
20256set netinet/tcp.h i_netinettcp
20257eval $inhdr
20258
20259: see if this is a poll.h system
20260set poll.h i_poll
20261eval $inhdr
20262
20263: see if this is a prot.h system
20264set prot.h i_prot
20265eval $inhdr
20266
20267echo " "
ddfca5da 20268$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
20269$cat <<'EOSH' > Cppsym.know
20270a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20271AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 20272alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20273ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20274BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20275BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20276bull c cadmus clipper CMU COFF COMPILER_VERSION
20277concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 20278CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
20279Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20280FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20281GLIBC GLIBC_MINOR
20282GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
20283H3050R H3050RX hbullx20 hcx host_mips
20284hp200 hp300 hp700 HP700 hp800 hp9000
20285hp9000s200 hp9000s300 hp9000s400 hp9000s500
20286hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20287i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20288IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20289INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20290LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20291LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20292Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20293LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20294M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20295M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20296M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20297MATH_HAS_NO_SIDE_EFFECTS
20298mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20299mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20300mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20301MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20302mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20303NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20304news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20305ns32016 ns32332 ns32k nsc32000
20306OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20307pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20308pc532 pdp11 PGC PIC plexus PORTAR posix
20309POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20310POSIX_C_SOURCE POSIX_SOURCE POWER
20311PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20312riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20313SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20314sony sony_news sonyrisc sparc sparclite spectrum
20315stardent stdc STDC_EXT stratos sun sun3 sun386
20316Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20317SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20318SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20319sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20320TM3200 TM5400 TM5600
b4eb6b3d
JH
20321tower tower32 tower32_200 tower32_600 tower32_700
20322tower32_800 tower32_850 tss
20323u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20324ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20325unix UNIX95 UNIX99 unixpc unos
20326USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20327USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20328USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20329USGr4 USGr4_2
44c87379 20330Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
20331XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20332XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20333z8000
20334EOSH
20335# Maybe put other stuff here too.
20336cat <<EOSH >>Cppsym.know
20337$osname
20338EOSH
20339./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20340./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20341$cat Cppsym.know > Cppsym.c
381aa1ff 20342$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20343$rm -f Cppsym.a Cppsym.b Cppsym.c
20344cat <<EOSH > Cppsym
20345$startsh
20346if $test \$# -gt 0; then
20347 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20348 if $test -s Cppsym.got; then
20349 $rm -f Cppsym.got
20350 exit 0
20351 fi
20352 $rm -f Cppsym.got
20353 exit 1
20354else
20355 $tr " " "$trnl" | ./Cppsym.try
20356 exit 0
20357fi
20358EOSH
20359chmod +x Cppsym
20360$eunicefix Cppsym
20361cat <<EOSH > Cppsym.try
20362$startsh
20363cat <<'EOCP' > try.c
20364#include <stdio.h>
360321b3
YST
20365#if cpp_stuff == 1
20366#define STRINGIFY(a) "a"
20367#endif
20368#if cpp_stuff == 42
20369#define StGiFy(a) #a
20370#define STRINGIFY(a) StGiFy(a)
20371#endif
20372#if $cpp_stuff != 1 && $cpp_stuff != 42
20373# include "Bletch: How does this C preprocessor stringify macros?"
20374#endif
b4eb6b3d
JH
20375int main() {
20376EOCP
20377$awk \\
20378EOSH
20379cat <<'EOSH' >> Cppsym.try
20380'length($1) > 0 {
360321b3
YST
20381 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20382 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20383 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20384 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 20385}' >> try.c
2ef53570 20386echo 'return 0;}' >> try.c
b4eb6b3d
JH
20387EOSH
20388cat <<EOSH >> Cppsym.try
20389ccflags="$ccflags"
20390case "$osname-$gccversion" in
20391irix-) ccflags="\$ccflags -woff 1178" ;;
20392os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20393esac
360321b3 20394$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
20395EOSH
20396chmod +x Cppsym.try
20397$eunicefix Cppsym.try
20398./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 20399: Add in any linux cpp "predefined macros":
b6a7163e
MB
20400case "$osname::$gccversion" in
20401 *linux*::*.*)
20402 tHdrH=_tmpHdr
20403 rm -f $tHdrH'.h' $tHdrH
20404 touch $tHdrH'.h'
20405 if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20406 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20407 if [ -s $tHdrH'_cppsym.real' ]; then
20408 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20409 fi
20410 fi
20411 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20412 ;;
20413esac
b4eb6b3d
JH
20414: now check the C compiler for additional symbols
20415postprocess_cc_v=''
20416case "$osname" in
20417aix) postprocess_cc_v="|$tr , ' '" ;;
20418esac
20419$cat >ccsym <<EOS
20420$startsh
20421$cat >tmp.c <<EOF
20422extern int foo;
20423EOF
20424for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20425do
20426 case "\$i" in
20427 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20428 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20429 esac
20430done
20431$rm -f try.c
20432EOS
20433postprocess_cc_v=''
20434chmod +x ccsym
20435$eunicefix ccsym
20436./ccsym > ccsym1.raw
20437if $test -s ccsym1.raw; then
20438 $sort ccsym1.raw | $uniq >ccsym.raw
20439else
20440 mv ccsym1.raw ccsym.raw
20441fi
20442
20443$awk '/\=/ { print $0; next }
20444 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
20445$comm -13 Cppsym.true ccsym.list >ccsym.own
20446$comm -12 Cppsym.true ccsym.list >ccsym.com
20447$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
20448also=''
20449if $test -z ccsym.raw; then
20450 echo "Your C compiler doesn't seem to define any symbols!" >&4
20451 echo " "
20452 echo "However, your C preprocessor defines the following symbols:"
20453 $cat Cppsym.true
20454 ccsymbols=''
20455 cppsymbols=`$cat Cppsym.true`
20456 cppsymbols=`echo $cppsymbols`
20457 cppccsymbols="$cppsymbols"
20458else
20459 if $test -s ccsym.com; then
20460 echo "Your C compiler and pre-processor define these symbols:"
20461 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20462 also='also '
20463 symbols='ones'
20464 cppccsymbols=`$cat ccsym.com`
20465 cppccsymbols=`echo $cppccsymbols`
20466 $test "$silent" || sleep 1
20467 fi
20468 if $test -s ccsym.cpp; then
20469 $test "$also" && echo " "
20470 echo "Your C pre-processor ${also}defines the following symbols:"
20471 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20472 also='further '
20473 cppsymbols=`$cat ccsym.cpp`
20474 cppsymbols=`echo $cppsymbols`
20475 $test "$silent" || sleep 1
20476 fi
20477 if $test -s ccsym.own; then
20478 $test "$also" && echo " "
20479 echo "Your C compiler ${also}defines the following cpp symbols:"
20480 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20481 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20482 ccsymbols=`$cat ccsym.own`
20483 ccsymbols=`echo $ccsymbols`
20484 $test "$silent" || sleep 1
20485 fi
20486fi
b4eb6b3d
JH
20487
20488: see if this is a termio system
20489val="$undef"
20490val2="$undef"
20491val3="$undef"
20492if $test `./findhdr termios.h`; then
20493 set tcsetattr i_termios
20494 eval $inlibc
20495 val3="$i_termios"
20496fi
20497echo " "
20498case "$val3" in
20499"$define") echo "You have POSIX termios.h... good!" >&4;;
20500*) if ./Cppsym pyr; then
20501 case "`/bin/universe`" in
20502 ucb) if $test `./findhdr sgtty.h`; then
20503 val2="$define"
20504 echo "<sgtty.h> found." >&4
20505 else
20506 echo "System is pyramid with BSD universe."
20507 echo "<sgtty.h> not found--you could have problems." >&4
20508 fi;;
20509 *) if $test `./findhdr termio.h`; then
20510 val="$define"
20511 echo "<termio.h> found." >&4
20512 else
20513 echo "System is pyramid with USG universe."
20514 echo "<termio.h> not found--you could have problems." >&4
20515 fi;;
20516 esac
20517 elif ./usg; then
20518 if $test `./findhdr termio.h`; then
20519 echo "<termio.h> found." >&4
20520 val="$define"
20521 elif $test `./findhdr sgtty.h`; then
20522 echo "<sgtty.h> found." >&4
20523 val2="$define"
20524 else
20525echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20526 fi
20527 else
20528 if $test `./findhdr sgtty.h`; then
20529 echo "<sgtty.h> found." >&4
20530 val2="$define"
20531 elif $test `./findhdr termio.h`; then
20532 echo "<termio.h> found." >&4
20533 val="$define"
20534 else
20535echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20536 fi
20537 fi;;
20538esac
20539set i_termio; eval $setvar
20540val=$val2; set i_sgtty; eval $setvar
20541val=$val3; set i_termios; eval $setvar
20542
b4eb6b3d
JH
20543: see if stddef is available
20544set stddef.h i_stddef
20545eval $inhdr
923fc586 20546
b4eb6b3d
JH
20547: see if this is a sunmath.h system
20548set sunmath.h i_sunmath
20549eval $inhdr
5f80c64f 20550
b4eb6b3d
JH
20551: see if sys/access.h is available
20552set sys/access.h i_sysaccess
20553eval $inhdr
20554
20555: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20556set sys/filio.h i_sysfilio
20557eval $inhdr
20558echo " "
20559if $test `./findhdr sys/ioctl.h`; then
20560 val="$define"
20561 echo '<sys/ioctl.h> found.' >&4
20562else
20563 val="$undef"
20564 if $test $i_sysfilio = "$define"; then
20565 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20566 else
b4eb6b3d
JH
20567 $test $i_sgtty = "$define" && xxx="sgtty.h"
20568 $test $i_termio = "$define" && xxx="termio.h"
20569 $test $i_termios = "$define" && xxx="termios.h"
20570echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20571 fi
20572fi
20573set i_sysioctl
20574eval $setvar
20575
49a78c82
JH
20576: see if socket ioctl defs are in sys/sockio.h
20577echo " "
20578xxx=`./findhdr sys/sockio.h`
20579if $test "$xxx"; then
20580 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20581 val="$define"
20582 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20583 else
20584 val="$undef"
20585 echo "No socket ioctls found in <sys/sockio.h>." >&4
20586 fi
20587else
20588 val="$undef"
20589 $cat <<EOM
20590<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20591EOM
20592fi
20593set i_syssockio
20594eval $setvar
20595
b4eb6b3d
JH
20596
20597: see if this is a syslog.h system
20598set syslog.h i_syslog
20599eval $inhdr
20600
20601
20602: see if this is a sys/mode.h system
20603set sys/mode.h i_sysmode
20604eval $inhdr
20605
20606: see if sys/resource.h has to be included
20607set sys/resource.h i_sysresrc
20608eval $inhdr
20609
20610: see if sys/security.h is available
20611set sys/security.h i_syssecrt
20612eval $inhdr
20613
20614: see if this is a sys/statvfs.h system
20615set sys/statvfs.h i_sysstatvfs
20616eval $inhdr
20617
b4eb6b3d
JH
20618: see if this is a sys/un.h system
20619set sys/un.h i_sysun
20620eval $inhdr
20621
20622
20623: see if this is a sys/utsname.h system
20624set sys/utsname.h i_sysutsname
20625eval $inhdr
20626
20627: see if this is a syswait system
20628set sys/wait.h i_syswait
20629eval $inhdr
20630
20631: see if this is a ustat.h system
20632set ustat.h i_ustat
20633eval $inhdr
20634
20635: see if this is an utime system
20636set utime.h i_utime
20637eval $inhdr
20638
20639: see if this is a values.h system
20640set values.h i_values
20641eval $inhdr
20642
20643: see if this is a vfork system
20644case "$d_vfork" in
20645"$define")
20646 set vfork.h i_vfork
20647 eval $inhdr
20648 ;;
20649*)
20650 i_vfork="$undef"
20651 ;;
20652esac
20653
20654: see if gdbm.h is available
20655set gdbm.h t_gdbm
20656eval $inhdr
20657case "$t_gdbm" in
20658$define)
20659 : see if gdbm_open exists
20660 set gdbm_open d_gdbm_open
20661 eval $inlibc
20662 case "$d_gdbm_open" in
20663 $undef)
20664 t_gdbm="$undef"
20665 echo "We won't be including <gdbm.h>"
5f80c64f 20666 ;;
b4eb6b3d
JH
20667 esac
20668 ;;
20669esac
20670val="$t_gdbm"
20671set i_gdbm
20672eval $setvar
20673
20674echo " "
20675echo "Looking for extensions..." >&4
20676: If we are using the old config.sh, known_extensions may contain
20677: old or inaccurate or duplicate values.
20678known_extensions=''
20679nonxs_extensions=''
20680: We do not use find because it might not be available.
20681: We do not just use MANIFEST because the user may have dropped
20682: some additional extensions into the source tree and expect them
20683: to be built.
20684
20685: Function to recursively find available extensions, ignoring DynaLoader
20686: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20687find_extensions='
20688 for xxx in *; do
20689 case "$xxx" in
20690 DynaLoader|dynaload) ;;
20691 *)
20692 if $test -f $xxx/$xxx.xs; then
20693 known_extensions="$known_extensions $1$xxx";
20694 elif $test -f $xxx/Makefile.PL; then
20695 nonxs_extensions="$nonxs_extensions $1$xxx";
20696 else
20697 if $test -d $xxx -a $# -lt 10; then
20698 set $1$xxx/ $*;
6904989c 20699 cd "$xxx";
b4eb6b3d
JH
20700 eval $find_extensions;
20701 cd ..;
20702 shift;
20703 fi;
20704 fi
20705 ;;
20706 esac;
20707 done'
20708tdir=`pwd`
6904989c 20709cd "$rsrc/ext"
b4eb6b3d
JH
20710set X
20711shift
20712eval $find_extensions
4e1a6d26
AD
20713# Special case: Add in threads/shared since it is not picked up by the
20714# recursive find above (and adding in general recursive finding breaks
20715# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 20716known_extensions="$known_extensions threads/shared"
b4eb6b3d
JH
20717set X $nonxs_extensions
20718shift
20719nonxs_extensions="$*"
20720set X $known_extensions
20721shift
20722known_extensions="$*"
6904989c 20723cd "$tdir"
b4eb6b3d
JH
20724
20725: Now see which are supported on this system.
20726avail_ext=''
20727for xxx in $known_extensions ; do
20728 case "$xxx" in
20729 DB_File|db_file)
20730 case "$i_db" in
20731 $define) avail_ext="$avail_ext $xxx" ;;
20732 esac
20733 ;;
20734 GDBM_File|gdbm_fil)
20735 case "$i_gdbm" in
20736 $define) avail_ext="$avail_ext $xxx" ;;
20737 esac
20738 ;;
1d59c593 20739 I18N/Langinfo|i18n_lan)
4bbcc6e8
JH
20740 case "$i_langinfo$d_nl_langinfo" in
20741 $define$define) avail_ext="$avail_ext $xxx" ;;
20742 esac
20743 ;;
b4eb6b3d
JH
20744 NDBM_File|ndbm_fil)
20745 case "$i_ndbm" in
20746 $define)
20747 case "$osname-$use64bitint" in
0be9fa5d 20748 hpux-define)
b4eb6b3d
JH
20749 case "$libs" in
20750 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20751 esac
20752 ;;
20753 *) avail_ext="$avail_ext $xxx" ;;
20754 esac
20755 ;;
20756 esac
20757 ;;
20758 ODBM_File|odbm_fil)
20759 case "${i_dbm}${i_rpcsvcdbm}" in
20760 *"${define}"*)
20761 case "$osname-$use64bitint" in
0be9fa5d 20762 hpux-define)
b4eb6b3d
JH
20763 case "$libs" in
20764 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20765 esac
20766 ;;
20767 *) avail_ext="$avail_ext $xxx" ;;
20768 esac
20769 ;;
20770 esac
20771 ;;
20772 POSIX|posix)
20773 case "$useposix" in
20774 true|define|y) avail_ext="$avail_ext $xxx" ;;
20775 esac
20776 ;;
20777 Opcode|opcode)
20778 case "$useopcode" in
20779 true|define|y) avail_ext="$avail_ext $xxx" ;;
20780 esac
20781 ;;
20782 Socket|socket)
20783 case "$d_socket" in
4a9f028c
JH
20784 true|$define|y)
20785 case "$osname" in
20786 beos) ;; # not unless BONE
20787 *) avail_ext="$avail_ext $xxx" ;;
20788 esac
20789 ;;
b4eb6b3d
JH
20790 esac
20791 ;;
20792 Sys/Syslog|sys/syslog)
20793 : XXX syslog requires socket
20794 case "$d_socket" in
20795 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20796 esac
20797 ;;
20798 Thread|thread)
b00ec89b
AB
20799 case "$usethreads" in
20800 true|$define|y)
20801 case "$useithreads" in
20802 $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20803 esac
b4eb6b3d
JH
20804 esac
20805 ;;
f9b6ed1c
AD
20806 XS/APItest|xs/apitest)
20807 # This is just for testing. Skip it unless we have dynamic loading.
20808
20809 case "$usedl" in
20810 $define) avail_ext="$avail_ext $xxx" ;;
20811 esac
20812 ;;
20813 XS/Typemap|xs/typemap)
20814 # This is just for testing. Skip it unless we have dynamic loading.
20815 case "$usedl" in
20816 $define) avail_ext="$avail_ext $xxx" ;;
20817 esac
20818 ;;
7deadc5f 20819 threads|threads/shared)
73e09c8f
JH
20820 # threads and threads::shared are special cases.
20821 # To stop people from asking "Perl 5.8.0 was supposed
20822 # to have this new fancy threads implementation but my
20823 # perl doesn't have it" and from people trying to
20824 # (re)install the threads module using CPAN.pm and
20825 # CPAN.pm then offering to reinstall Perl 5.8.0,
20826 # the threads.pm and threads/shared.pm will always be
20827 # there, croaking informatively ("you need to rebuild
20828 # all of Perl with threads, sorry") when threads haven't
20829 # been compiled in.
20830 # --jhi
20831 avail_ext="$avail_ext $xxx"
1dca008a 20832 ;;
b4eb6b3d
JH
20833 IPC/SysV|ipc/sysv)
20834 : XXX Do we need a useipcsysv variable here
20835 case "${d_msg}${d_sem}${d_shm}" in
20836 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20837 esac
20838 ;;
20839 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
20840 ;;
20841 esac
b4eb6b3d 20842done
5f80c64f 20843
b4eb6b3d
JH
20844set X $avail_ext
20845shift
20846avail_ext="$*"
5f80c64f 20847
ef0c5be8
JH
20848case "$onlyextensions" in
20849'') ;;
20850*) keepextensions=''
20851 echo "You have requested that only certains extensions be included..." >&4
20852 for i in $onlyextensions; do
20853 case " $avail_ext " in
20854 *" $i "*)
20855 echo "Keeping extension $i."
20856 keepextensions="$keepextensions $i"
20857 ;;
20858 *) echo "Ignoring extension $i." ;;
20859 esac
20860 done
20861 avail_ext="$keepextensions"
20862 ;;
20863esac
20864
20865case "$noextensions" in
20866'') ;;
20867*) keepextensions=''
20868 echo "You have requested that certain extensions be ignored..." >&4
20869 for i in $avail_ext; do
c3dadc13
AD
20870 case " $noextensions " in
20871 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
20872 *) echo "Keeping extension $i.";
20873 keepextensions="$keepextensions $i"
20874 ;;
20875 esac
20876 done
20877 avail_ext="$keepextensions"
20878 ;;
20879esac
20880
b4eb6b3d
JH
20881: Now see which nonxs extensions are supported on this system.
20882: For now assume all are.
20883nonxs_ext=''
20884for xxx in $nonxs_extensions ; do
20885 case "$xxx" in
20886 *) nonxs_ext="$nonxs_ext $xxx"
20887 ;;
20888 esac
20889done
5f80c64f 20890
b4eb6b3d
JH
20891set X $nonxs_ext
20892shift
20893nonxs_ext="$*"
20894
20895case $usedl in
20896$define)
20897 $cat <<EOM
20898A number of extensions are supplied with $package. You may choose to
20899compile these extensions for dynamic loading (the default), compile
20900them into the $package executable (static loading), or not include
20901them at all. Answer "none" to include no extensions.
20902Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
20903
20904EOM
b4eb6b3d 20905 case "$dynamic_ext" in
736accd3
YST
20906 '')
20907 : Exclude those listed in static_ext
20908 dflt=''
20909 for xxx in $avail_ext; do
20910 case " $static_ext " in
20911 *" $xxx "*) ;;
20912 *) dflt="$dflt $xxx" ;;
20913 esac
20914 done
20915 set X $dflt
20916 shift
20917 dflt="$*"
20918 ;;
b4eb6b3d
JH
20919 *) dflt="$dynamic_ext"
20920 # Perhaps we are reusing an old out-of-date config.sh.
20921 case "$hint" in
20922 previous)
20923 if test X"$dynamic_ext" != X"$avail_ext"; then
20924 $cat <<EOM
20925NOTICE: Your previous config.sh list may be incorrect.
20926The extensions now available to you are
20927 ${avail_ext}
20928but the default list from your previous config.sh is
20929 ${dynamic_ext}
9c839522 20930
b4eb6b3d
JH
20931EOM
20932 fi
9c839522
PM
20933 ;;
20934 esac
b4eb6b3d
JH
20935 ;;
20936 esac
5f80c64f 20937 case "$dflt" in
b4eb6b3d
JH
20938 '') dflt=none;;
20939 esac
20940 rp="What extensions do you wish to load dynamically?"
20941 . ./myread
20942 case "$ans" in
20943 none) dynamic_ext=' ' ;;
20944 *) dynamic_ext="$ans" ;;
5f80c64f 20945 esac
5f80c64f 20946
b4eb6b3d
JH
20947 case "$static_ext" in
20948 '')
20949 : Exclude those already listed in dynamic linking
20950 dflt=''
20951 for xxx in $avail_ext; do
20952 case " $dynamic_ext " in
20953 *" $xxx "*) ;;
20954 *) dflt="$dflt $xxx" ;;
20955 esac
20956 done
20957 set X $dflt
20958 shift
20959 dflt="$*"
20960 ;;
20961 *) dflt="$static_ext"
20962 ;;
20963 esac
9c839522 20964
b4eb6b3d
JH
20965 case "$dflt" in
20966 '') dflt=none;;
20967 esac
20968 rp="What extensions do you wish to load statically?"
20969 . ./myread
20970 case "$ans" in
20971 none) static_ext=' ' ;;
20972 *) static_ext="$ans" ;;
20973 esac
20974 ;;
20975*)
20976 $cat <<EOM
20977A number of extensions are supplied with $package. Answer "none"
20978to include no extensions.
20979Note that DynaLoader is always built and need not be mentioned here.
9c839522 20980
b4eb6b3d
JH
20981EOM
20982 case "$static_ext" in
20983 '') dflt="$avail_ext" ;;
20984 *) dflt="$static_ext"
20985 # Perhaps we are reusing an old out-of-date config.sh.
20986 case "$hint" in
20987 previous)
20988 if test X"$static_ext" != X"$avail_ext"; then
20989 $cat <<EOM
20990NOTICE: Your previous config.sh list may be incorrect.
20991The extensions now available to you are
20992 ${avail_ext}
20993but the default list from your previous config.sh is
20994 ${static_ext}
5f80c64f
JH
20995
20996EOM
b4eb6b3d
JH
20997 fi
20998 ;;
20999 esac
21000 ;;
21001 esac
21002 : Exclude those that are not xs extensions
21003 case "$dflt" in
21004 '') dflt=none;;
21005 esac
21006 rp="What extensions do you wish to include?"
21007 . ./myread
21008 case "$ans" in
21009 none) static_ext=' ' ;;
21010 *) static_ext="$ans" ;;
21011 esac
21012 ;;
5f80c64f 21013esac
f1f6834f
AD
21014#
21015# Encode is a special case. If we are building Encode as a static
21016# extension, we need to explicitly list its subextensions as well.
21017# For other nested extensions, this is handled automatically by
21018# the appropriate Makefile.PL.
21019case " $static_ext " in
21020 *" Encode "*) # Add the subextensions of Encode
21021 cd "$rsrc/ext"
21022 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21023 static_ext="$static_ext Encode/$xxx"
21024 done
21025 cd "$tdir"
21026 ;;
21027esac
5f80c64f 21028
b4eb6b3d
JH
21029set X $dynamic_ext $static_ext $nonxs_ext
21030shift
21031extensions="$*"
21032
93a2cd18
AD
21033# Sanity check: We require an extension suitable for use with
21034# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
21035# should show up as failures in the test suite, but it's helpful to
21036# catch them now.) The 'extensions' list is normally sorted
21037# alphabetically, so we need to accept either
21038# DB_File ... Fcntl ... IO ....
21039# or something like
21040# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
21041case " $extensions" in
21042*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21043*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21044*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
21045*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21046 echo "WARNING: The Perl you are building will be quite crippled." >& 4
21047 ;;
21048esac
21049
9c839522
PM
21050: Remove libraries needed only for extensions
21051: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
21052: The exception is SunOS 4.x, which needs them.
21053case "${osname}X${osvers}" in
21054sunos*X4*)
21055 perllibs="$libs"
21056 ;;
21057*) case "$usedl" in
21058 $define|true|[yY]*)
21059 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
21060 shift
21061 perllibs="$*"
21062 ;;
21063 *) perllibs="$libs"
21064 ;;
21065 esac
21066 ;;
9c839522 21067esac
5f80c64f
JH
21068
21069: Remove build directory name from cppstdin so it can be used from
21070: either the present location or the final installed location.
21071echo " "
21072: Get out of the UU directory to get correct path name.
21073cd ..
21074case "$cppstdin" in
21075`pwd`/cppstdin)
21076 echo "Stripping down cppstdin path name"
21077 cppstdin=cppstdin
21078 ;;
21079esac
21080cd UU
21081
21082: end of configuration questions
21083echo " "
21084echo "End of configuration questions."
21085echo " "
21086
21087: back to where it started
21088if test -d ../UU; then
21089 cd ..
21090fi
21091
48370efc
JH
21092: configuration may be patched via a 'config.arch' file
21093if $test -f config.arch; then
21094 echo "I see a config.arch file, loading it."
21095 . ./config.arch
21096fi
21097
5f80c64f
JH
21098: configuration may be patched via a 'config.over' file
21099if $test -f config.over; then
21100 echo " "
21101 dflt=y
21102 rp='I see a config.over file. Do you wish to load it?'
21103 . UU/myread
21104 case "$ans" in
21105 n*) echo "OK, I'll ignore it.";;
21106 *) . ./config.over
21107 echo "Configuration override changes have been loaded."
21108 ;;
21109 esac
21110fi
21111
21112: in case they want portability, strip down executable paths
21113case "$d_portable" in
21114"$define")
21115 echo " "
21116 echo "Stripping down executable paths..." >&4
21117 for file in $loclist $trylist; do
534ac15a
JH
21118 eval temp=\$$file
21119 eval $file=`basename $temp`
5f80c64f
JH
21120 done
21121 ;;
21122esac
21123
21124: create config.sh file
21125echo " "
21126echo "Creating config.sh..." >&4
21127$spitshell <<EOT >config.sh
21128$startsh
21129#
21130# This file was produced by running the Configure script. It holds all the
21131# definitions figured out by Configure. Should you modify one of these values,
21132# do not forget to propagate your changes by running "Configure -der". You may
21133# instead choose to run each of the .SH files by yourself, or "Configure -S".
21134#
21135
21136# Package name : $package
21137# Source directory : $src
21138# Configuration time: $cf_time
21139# Configured by : $cf_by
21140# Target system : $myuname
21141
21142Author='$Author'
21143Date='$Date'
21144Header='$Header'
21145Id='$Id'
21146Locker='$Locker'
21147Log='$Log'
21148Mcc='$Mcc'
21149RCSfile='$RCSfile'
21150Revision='$Revision'
21151Source='$Source'
21152State='$State'
21153_a='$_a'
21154_exe='$_exe'
21155_o='$_o'
b4eb6b3d 21156afs='$afs'
a6d26a0d 21157afsroot='$afsroot'
b4eb6b3d
JH
21158alignbytes='$alignbytes'
21159ansi2knr='$ansi2knr'
21160aphostname='$aphostname'
21161api_revision='$api_revision'
21162api_subversion='$api_subversion'
21163api_version='$api_version'
21164api_versionstring='$api_versionstring'
5f80c64f 21165ar='$ar'
b4eb6b3d
JH
21166archlib='$archlib'
21167archlibexp='$archlibexp'
21168archname64='$archname64'
21169archname='$archname'
5f80c64f 21170archobjs='$archobjs'
10bc17b6 21171asctime_r_proto='$asctime_r_proto'
5f80c64f 21172awk='$awk'
b4eb6b3d 21173baserev='$baserev'
5f80c64f 21174bash='$bash'
b4eb6b3d 21175bin='$bin'
b4eb6b3d 21176binexp='$binexp'
5f80c64f
JH
21177bison='$bison'
21178byacc='$byacc'
b4eb6b3d 21179byteorder='$byteorder'
5f80c64f 21180c='$c'
b4eb6b3d 21181castflags='$castflags'
5f80c64f
JH
21182cat='$cat'
21183cc='$cc'
21184cccdlflags='$cccdlflags'
21185ccdlflags='$ccdlflags'
21186ccflags='$ccflags'
b4eb6b3d 21187ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21188ccname='$ccname'
b4eb6b3d 21189ccsymbols='$ccsymbols'
6b356c8e 21190ccversion='$ccversion'
5f80c64f 21191cf_by='$cf_by'
b4eb6b3d 21192cf_email='$cf_email'
5f80c64f 21193cf_time='$cf_time'
b4eb6b3d 21194charsize='$charsize'
5f80c64f
JH
21195chgrp='$chgrp'
21196chmod='$chmod'
21197chown='$chown'
b4eb6b3d 21198clocktype='$clocktype'
5f80c64f
JH
21199comm='$comm'
21200compress='$compress'
21201contains='$contains'
21202cp='$cp'
21203cpio='$cpio'
21204cpp='$cpp'
b4eb6b3d
JH
21205cpp_stuff='$cpp_stuff'
21206cppccsymbols='$cppccsymbols'
5f80c64f
JH
21207cppflags='$cppflags'
21208cpplast='$cpplast'
21209cppminus='$cppminus'
21210cpprun='$cpprun'
21211cppstdin='$cppstdin'
b4eb6b3d 21212cppsymbols='$cppsymbols'
10bc17b6 21213crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21214cryptlib='$cryptlib'
5f80c64f 21215csh='$csh'
10bc17b6
JH
21216ctermid_r_proto='$ctermid_r_proto'
21217ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21218d_Gconvert='$d_Gconvert'
21219d_PRIEUldbl='$d_PRIEUldbl'
21220d_PRIFUldbl='$d_PRIFUldbl'
21221d_PRIGUldbl='$d_PRIGUldbl'
21222d_PRIXU64='$d_PRIXU64'
21223d_PRId64='$d_PRId64'
21224d_PRIeldbl='$d_PRIeldbl'
21225d_PRIfldbl='$d_PRIfldbl'
21226d_PRIgldbl='$d_PRIgldbl'
21227d_PRIi64='$d_PRIi64'
21228d_PRIo64='$d_PRIo64'
21229d_PRIu64='$d_PRIu64'
21230d_PRIx64='$d_PRIx64'
21231d_SCNfldbl='$d_SCNfldbl'
74cac757 21232d__fwalk='$d__fwalk'
b4eb6b3d
JH
21233d_access='$d_access'
21234d_accessx='$d_accessx'
55954f19 21235d_aintl='$d_aintl'
b4eb6b3d
JH
21236d_alarm='$d_alarm'
21237d_archlib='$d_archlib'
10bc17b6 21238d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21239d_atolf='$d_atolf'
21240d_atoll='$d_atoll'
0dbb1585
AL
21241d_attribute_format='$d_attribute_format'
21242d_attribute_malloc='$d_attribute_malloc'
21243d_attribute_nonnull='$d_attribute_nonnull'
21244d_attribute_noreturn='$d_attribute_noreturn'
21245d_attribute_pure='$d_attribute_pure'
21246d_attribute_unused='$d_attribute_unused'
21247d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21248d_bcmp='$d_bcmp'
21249d_bcopy='$d_bcopy'
5f80c64f 21250d_bsd='$d_bsd'
b4eb6b3d
JH
21251d_bsdgetpgrp='$d_bsdgetpgrp'
21252d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
21253d_builtin_choose_expr='$d_builtin_choose_expr'
21254d_builtin_expect='$d_builtin_expect'
b4eb6b3d
JH
21255d_bzero='$d_bzero'
21256d_casti32='$d_casti32'
21257d_castneg='$d_castneg'
21258d_charvspr='$d_charvspr'
21259d_chown='$d_chown'
21260d_chroot='$d_chroot'
21261d_chsize='$d_chsize'
758a5d79 21262d_class='$d_class'
b0a2e8e6 21263d_clearenv='$d_clearenv'
b4eb6b3d 21264d_closedir='$d_closedir'
4e0554ec 21265d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21266d_const='$d_const'
55954f19 21267d_copysignl='$d_copysignl'
b4eb6b3d 21268d_crypt='$d_crypt'
10bc17b6 21269d_crypt_r='$d_crypt_r'
b4eb6b3d 21270d_csh='$d_csh'
10bc17b6
JH
21271d_ctermid_r='$d_ctermid_r'
21272d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21273d_cuserid='$d_cuserid'
21274d_dbl_dig='$d_dbl_dig'
2ef53570 21275d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21276d_difftime='$d_difftime'
ae0e3d3b 21277d_dirfd='$d_dirfd'
b4eb6b3d
JH
21278d_dirnamlen='$d_dirnamlen'
21279d_dlerror='$d_dlerror'
5f80c64f 21280d_dlopen='$d_dlopen'
b4eb6b3d
JH
21281d_dlsymun='$d_dlsymun'
21282d_dosuid='$d_dosuid'
10bc17b6 21283d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21284d_drand48proto='$d_drand48proto'
21285d_dup2='$d_dup2'
21286d_eaccess='$d_eaccess'
21287d_endgrent='$d_endgrent'
10bc17b6 21288d_endgrent_r='$d_endgrent_r'
b4eb6b3d 21289d_endhent='$d_endhent'
10bc17b6 21290d_endhostent_r='$d_endhostent_r'
b4eb6b3d 21291d_endnent='$d_endnent'
10bc17b6 21292d_endnetent_r='$d_endnetent_r'
b4eb6b3d 21293d_endpent='$d_endpent'
10bc17b6 21294d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 21295d_endpwent='$d_endpwent'
10bc17b6 21296d_endpwent_r='$d_endpwent_r'
b4eb6b3d 21297d_endsent='$d_endsent'
10bc17b6 21298d_endservent_r='$d_endservent_r'
b4eb6b3d 21299d_eofnblk='$d_eofnblk'
5f80c64f 21300d_eunice='$d_eunice'
15b61c98 21301d_faststdio='$d_faststdio'
b363b713 21302d_fchdir='$d_fchdir'
b4eb6b3d
JH
21303d_fchmod='$d_fchmod'
21304d_fchown='$d_fchown'
21305d_fcntl='$d_fcntl'
9d9004a9 21306d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
21307d_fd_macros='$d_fd_macros'
21308d_fd_set='$d_fd_set'
21309d_fds_bits='$d_fds_bits'
21310d_fgetpos='$d_fgetpos'
758a5d79
JH
21311d_finite='$d_finite'
21312d_finitel='$d_finitel'
b4eb6b3d
JH
21313d_flexfnam='$d_flexfnam'
21314d_flock='$d_flock'
2ef53570 21315d_flockproto='$d_flockproto'
b4eb6b3d 21316d_fork='$d_fork'
758a5d79 21317d_fp_class='$d_fp_class'
b4eb6b3d 21318d_fpathconf='$d_fpathconf'
758a5d79
JH
21319d_fpclass='$d_fpclass'
21320d_fpclassify='$d_fpclassify'
21321d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21322d_fpos64_t='$d_fpos64_t'
21323d_frexpl='$d_frexpl'
21324d_fs_data_s='$d_fs_data_s'
21325d_fseeko='$d_fseeko'
21326d_fsetpos='$d_fsetpos'
21327d_fstatfs='$d_fstatfs'
21328d_fstatvfs='$d_fstatvfs'
411ab01c 21329d_fsync='$d_fsync'
b4eb6b3d
JH
21330d_ftello='$d_ftello'
21331d_ftime='$d_ftime'
dc814df1 21332d_futimes='$d_futimes'
b4eb6b3d
JH
21333d_getcwd='$d_getcwd'
21334d_getespwnam='$d_getespwnam'
21335d_getfsstat='$d_getfsstat'
21336d_getgrent='$d_getgrent'
10bc17b6
JH
21337d_getgrent_r='$d_getgrent_r'
21338d_getgrgid_r='$d_getgrgid_r'
21339d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21340d_getgrps='$d_getgrps'
21341d_gethbyaddr='$d_gethbyaddr'
21342d_gethbyname='$d_gethbyname'
21343d_gethent='$d_gethent'
21344d_gethname='$d_gethname'
10bc17b6
JH
21345d_gethostbyaddr_r='$d_gethostbyaddr_r'
21346d_gethostbyname_r='$d_gethostbyname_r'
21347d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21348d_gethostprotos='$d_gethostprotos'
4e0554ec 21349d_getitimer='$d_getitimer'
b4eb6b3d 21350d_getlogin='$d_getlogin'
10bc17b6 21351d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21352d_getmnt='$d_getmnt'
21353d_getmntent='$d_getmntent'
21354d_getnbyaddr='$d_getnbyaddr'
21355d_getnbyname='$d_getnbyname'
21356d_getnent='$d_getnent'
10bc17b6
JH
21357d_getnetbyaddr_r='$d_getnetbyaddr_r'
21358d_getnetbyname_r='$d_getnetbyname_r'
21359d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21360d_getnetprotos='$d_getnetprotos'
0c0643d0 21361d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21362d_getpbyname='$d_getpbyname'
21363d_getpbynumber='$d_getpbynumber'
21364d_getpent='$d_getpent'
21365d_getpgid='$d_getpgid'
21366d_getpgrp2='$d_getpgrp2'
21367d_getpgrp='$d_getpgrp'
21368d_getppid='$d_getppid'
21369d_getprior='$d_getprior'
10bc17b6
JH
21370d_getprotobyname_r='$d_getprotobyname_r'
21371d_getprotobynumber_r='$d_getprotobynumber_r'
21372d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21373d_getprotoprotos='$d_getprotoprotos'
21374d_getprpwnam='$d_getprpwnam'
21375d_getpwent='$d_getpwent'
10bc17b6
JH
21376d_getpwent_r='$d_getpwent_r'
21377d_getpwnam_r='$d_getpwnam_r'
21378d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21379d_getsbyname='$d_getsbyname'
21380d_getsbyport='$d_getsbyport'
21381d_getsent='$d_getsent'
10bc17b6
JH
21382d_getservbyname_r='$d_getservbyname_r'
21383d_getservbyport_r='$d_getservbyport_r'
21384d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21385d_getservprotos='$d_getservprotos'
21386d_getspnam='$d_getspnam'
10bc17b6 21387d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21388d_gettimeod='$d_gettimeod'
10bc17b6 21389d_gmtime_r='$d_gmtime_r'
5f80c64f 21390d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21391d_grpasswd='$d_grpasswd'
21392d_hasmntopt='$d_hasmntopt'
21393d_htonl='$d_htonl'
55954f19 21394d_ilogbl='$d_ilogbl'
f3f1a2d8 21395d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
21396d_index='$d_index'
21397d_inetaton='$d_inetaton'
21398d_int64_t='$d_int64_t'
21399d_isascii='$d_isascii'
758a5d79
JH
21400d_isfinite='$d_isfinite'
21401d_isinf='$d_isinf'
b4eb6b3d
JH
21402d_isnan='$d_isnan'
21403d_isnanl='$d_isnanl'
21404d_killpg='$d_killpg'
21405d_lchown='$d_lchown'
21406d_ldbl_dig='$d_ldbl_dig'
0a0abfba 21407d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21408d_link='$d_link'
10bc17b6 21409d_localtime_r='$d_localtime_r'
b4eb6b3d
JH
21410d_locconv='$d_locconv'
21411d_lockf='$d_lockf'
21412d_longdbl='$d_longdbl'
21413d_longlong='$d_longlong'
21414d_lseekproto='$d_lseekproto'
21415d_lstat='$d_lstat'
21416d_madvise='$d_madvise'
7dd121ae
MB
21417d_malloc_good_size='$d_malloc_good_size'
21418d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
21419d_mblen='$d_mblen'
21420d_mbstowcs='$d_mbstowcs'
21421d_mbtowc='$d_mbtowc'
21422d_memchr='$d_memchr'
21423d_memcmp='$d_memcmp'
21424d_memcpy='$d_memcpy'
21425d_memmove='$d_memmove'
21426d_memset='$d_memset'
21427d_mkdir='$d_mkdir'
21428d_mkdtemp='$d_mkdtemp'
21429d_mkfifo='$d_mkfifo'
21430d_mkstemp='$d_mkstemp'
21431d_mkstemps='$d_mkstemps'
21432d_mktime='$d_mktime'
21433d_mmap='$d_mmap'
21434d_modfl='$d_modfl'
e67aeab1 21435d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21436d_modflproto='$d_modflproto'
b4eb6b3d
JH
21437d_mprotect='$d_mprotect'
21438d_msg='$d_msg'
21439d_msg_ctrunc='$d_msg_ctrunc'
21440d_msg_dontroute='$d_msg_dontroute'
21441d_msg_oob='$d_msg_oob'
21442d_msg_peek='$d_msg_peek'
21443d_msg_proxy='$d_msg_proxy'
21444d_msgctl='$d_msgctl'
21445d_msgget='$d_msgget'
4e0554ec 21446d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21447d_msgrcv='$d_msgrcv'
21448d_msgsnd='$d_msgsnd'
21449d_msync='$d_msync'
21450d_munmap='$d_munmap'
21451d_mymalloc='$d_mymalloc'
21452d_nice='$d_nice'
2765b840 21453d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21454d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 21455d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21456d_off64_t='$d_off64_t'
21457d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21458d_oldpthreads='$d_oldpthreads'
21459d_oldsock='$d_oldsock'
21460d_open3='$d_open3'
21461d_pathconf='$d_pathconf'
21462d_pause='$d_pause'
21463d_perl_otherlibdirs='$d_perl_otherlibdirs'
21464d_phostname='$d_phostname'
21465d_pipe='$d_pipe'
21466d_poll='$d_poll'
5f80c64f 21467d_portable='$d_portable'
c7aff470 21468d_procselfexe='$d_procselfexe'
d6483fcc 21469d_pthread_atfork='$d_pthread_atfork'
58d975c3 21470d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21471d_pthread_yield='$d_pthread_yield'
21472d_pwage='$d_pwage'
21473d_pwchange='$d_pwchange'
21474d_pwclass='$d_pwclass'
21475d_pwcomment='$d_pwcomment'
21476d_pwexpire='$d_pwexpire'
21477d_pwgecos='$d_pwgecos'
21478d_pwpasswd='$d_pwpasswd'
21479d_pwquota='$d_pwquota'
21480d_qgcvt='$d_qgcvt'
21481d_quad='$d_quad'
10bc17b6
JH
21482d_random_r='$d_random_r'
21483d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21484d_readdir='$d_readdir'
10bc17b6 21485d_readdir_r='$d_readdir_r'
b4eb6b3d 21486d_readlink='$d_readlink'
4e0554ec
JH
21487d_readv='$d_readv'
21488d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21489d_rename='$d_rename'
21490d_rewinddir='$d_rewinddir'
21491d_rmdir='$d_rmdir'
21492d_safebcpy='$d_safebcpy'
21493d_safemcpy='$d_safemcpy'
21494d_sanemcmp='$d_sanemcmp'
ef9f17be 21495d_sbrkproto='$d_sbrkproto'
55954f19 21496d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21497d_sched_yield='$d_sched_yield'
21498d_scm_rights='$d_scm_rights'
21499d_seekdir='$d_seekdir'
21500d_select='$d_select'
21501d_sem='$d_sem'
21502d_semctl='$d_semctl'
21503d_semctl_semid_ds='$d_semctl_semid_ds'
21504d_semctl_semun='$d_semctl_semun'
21505d_semget='$d_semget'
21506d_semop='$d_semop'
4e0554ec 21507d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21508d_setegid='$d_setegid'
21509d_seteuid='$d_seteuid'
21510d_setgrent='$d_setgrent'
10bc17b6 21511d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21512d_setgrps='$d_setgrps'
21513d_sethent='$d_sethent'
10bc17b6 21514d_sethostent_r='$d_sethostent_r'
4e0554ec 21515d_setitimer='$d_setitimer'
b4eb6b3d
JH
21516d_setlinebuf='$d_setlinebuf'
21517d_setlocale='$d_setlocale'
10bc17b6 21518d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21519d_setnent='$d_setnent'
10bc17b6 21520d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21521d_setpent='$d_setpent'
21522d_setpgid='$d_setpgid'
21523d_setpgrp2='$d_setpgrp2'
21524d_setpgrp='$d_setpgrp'
21525d_setprior='$d_setprior'
21526d_setproctitle='$d_setproctitle'
10bc17b6 21527d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21528d_setpwent='$d_setpwent'
10bc17b6 21529d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21530d_setregid='$d_setregid'
21531d_setresgid='$d_setresgid'
21532d_setresuid='$d_setresuid'
21533d_setreuid='$d_setreuid'
21534d_setrgid='$d_setrgid'
21535d_setruid='$d_setruid'
21536d_setsent='$d_setsent'
10bc17b6 21537d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21538d_setsid='$d_setsid'
21539d_setvbuf='$d_setvbuf'
21540d_sfio='$d_sfio'
21541d_shm='$d_shm'
21542d_shmat='$d_shmat'
21543d_shmatprototype='$d_shmatprototype'
21544d_shmctl='$d_shmctl'
21545d_shmdt='$d_shmdt'
21546d_shmget='$d_shmget'
21547d_sigaction='$d_sigaction'
983dbef6 21548d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21549d_sigsetjmp='$d_sigsetjmp'
c95d0e17 21550d_sitearch='$d_sitearch'
4f5da3e9 21551d_snprintf='$d_snprintf'
49a78c82 21552d_sockatmark='$d_sockatmark'
2ef53570 21553d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21554d_socket='$d_socket'
21555d_socklen_t='$d_socklen_t'
21556d_sockpair='$d_sockpair'
21557d_socks5_init='$d_socks5_init'
360321b3 21558d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 21559d_sqrtl='$d_sqrtl'
10bc17b6
JH
21560d_srand48_r='$d_srand48_r'
21561d_srandom_r='$d_srandom_r'
eef837ea 21562d_sresgproto='$d_sresgproto'
640374d0 21563d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21564d_statblks='$d_statblks'
21565d_statfs_f_flags='$d_statfs_f_flags'
21566d_statfs_s='$d_statfs_s'
21567d_statvfs='$d_statvfs'
21568d_stdio_cnt_lval='$d_stdio_cnt_lval'
21569d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21570d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21571d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21572d_stdio_stream_array='$d_stdio_stream_array'
21573d_stdiobase='$d_stdiobase'
21574d_stdstdio='$d_stdstdio'
21575d_strchr='$d_strchr'
21576d_strcoll='$d_strcoll'
21577d_strctcpy='$d_strctcpy'
21578d_strerrm='$d_strerrm'
21579d_strerror='$d_strerror'
10bc17b6 21580d_strerror_r='$d_strerror_r'
b3c85772 21581d_strftime='$d_strftime'
08c92000
MB
21582d_strlcat='$d_strlcat'
21583d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21584d_strtod='$d_strtod'
21585d_strtol='$d_strtol'
21586d_strtold='$d_strtold'
21587d_strtoll='$d_strtoll'
28e5dec8 21588d_strtoq='$d_strtoq'
b4eb6b3d
JH
21589d_strtoul='$d_strtoul'
21590d_strtoull='$d_strtoull'
21591d_strtouq='$d_strtouq'
21592d_strxfrm='$d_strxfrm'
21593d_suidsafe='$d_suidsafe'
21594d_symlink='$d_symlink'
21595d_syscall='$d_syscall'
2ef53570 21596d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21597d_sysconf='$d_sysconf'
21598d_sysernlst='$d_sysernlst'
21599d_syserrlst='$d_syserrlst'
21600d_system='$d_system'
21601d_tcgetpgrp='$d_tcgetpgrp'
21602d_tcsetpgrp='$d_tcsetpgrp'
21603d_telldir='$d_telldir'
21604d_telldirproto='$d_telldirproto'
21605d_time='$d_time'
21606d_times='$d_times'
14b90194
JH
21607d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21608d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21609d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21610d_truncate='$d_truncate'
10bc17b6 21611d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21612d_tzname='$d_tzname'
4e0554ec
JH
21613d_u32align='$d_u32align'
21614d_ualarm='$d_ualarm'
b4eb6b3d
JH
21615d_umask='$d_umask'
21616d_uname='$d_uname'
21617d_union_semun='$d_union_semun'
758a5d79 21618d_unordered='$d_unordered'
bdf33aa7 21619d_unsetenv='$d_unsetenv'
4e0554ec 21620d_usleep='$d_usleep'
2ef53570 21621d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21622d_ustat='$d_ustat'
21623d_vendorarch='$d_vendorarch'
21624d_vendorbin='$d_vendorbin'
21625d_vendorlib='$d_vendorlib'
6e1038e0 21626d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21627d_vfork='$d_vfork'
21628d_void_closedir='$d_void_closedir'
21629d_voidsig='$d_voidsig'
21630d_voidtty='$d_voidtty'
21631d_volatile='$d_volatile'
21632d_vprintf='$d_vprintf'
4f5da3e9 21633d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
21634d_wait4='$d_wait4'
21635d_waitpid='$d_waitpid'
21636d_wcstombs='$d_wcstombs'
21637d_wctomb='$d_wctomb'
4e0554ec 21638d_writev='$d_writev'
5f80c64f
JH
21639d_xenix='$d_xenix'
21640date='$date'
b4eb6b3d
JH
21641db_hashtype='$db_hashtype'
21642db_prefixtype='$db_prefixtype'
640374d0
JH
21643db_version_major='$db_version_major'
21644db_version_minor='$db_version_minor'
21645db_version_patch='$db_version_patch'
b4eb6b3d
JH
21646defvoidused='$defvoidused'
21647direntrytype='$direntrytype'
21648dlext='$dlext'
5f80c64f 21649dlsrc='$dlsrc'
b4eb6b3d
JH
21650doublesize='$doublesize'
21651drand01='$drand01'
10bc17b6 21652drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
21653dynamic_ext='$dynamic_ext'
21654eagain='$eagain'
21655ebcdic='$ebcdic'
5f80c64f
JH
21656echo='$echo'
21657egrep='$egrep'
21658emacs='$emacs'
10bc17b6
JH
21659endgrent_r_proto='$endgrent_r_proto'
21660endhostent_r_proto='$endhostent_r_proto'
21661endnetent_r_proto='$endnetent_r_proto'
21662endprotoent_r_proto='$endprotoent_r_proto'
21663endpwent_r_proto='$endpwent_r_proto'
21664endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
21665eunicefix='$eunicefix'
21666exe_ext='$exe_ext'
21667expr='$expr'
b4eb6b3d 21668extensions='$extensions'
6fcddf3b 21669extras='$extras'
b4eb6b3d
JH
21670fflushNULL='$fflushNULL'
21671fflushall='$fflushall'
5f80c64f
JH
21672find='$find'
21673firstmakefile='$firstmakefile'
21674flex='$flex'
b4eb6b3d
JH
21675fpossize='$fpossize'
21676fpostype='$fpostype'
21677freetype='$freetype'
5440bc8e 21678from='$from'
b4eb6b3d
JH
21679full_ar='$full_ar'
21680full_csh='$full_csh'
21681full_sed='$full_sed'
2d736872 21682gccansipedantic='$gccansipedantic'
5b463ca7 21683gccosandvers='$gccosandvers'
5f80c64f 21684gccversion='$gccversion'
10bc17b6
JH
21685getgrent_r_proto='$getgrent_r_proto'
21686getgrgid_r_proto='$getgrgid_r_proto'
21687getgrnam_r_proto='$getgrnam_r_proto'
21688gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21689gethostbyname_r_proto='$gethostbyname_r_proto'
21690gethostent_r_proto='$gethostent_r_proto'
21691getlogin_r_proto='$getlogin_r_proto'
21692getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21693getnetbyname_r_proto='$getnetbyname_r_proto'
21694getnetent_r_proto='$getnetent_r_proto'
21695getprotobyname_r_proto='$getprotobyname_r_proto'
21696getprotobynumber_r_proto='$getprotobynumber_r_proto'
21697getprotoent_r_proto='$getprotoent_r_proto'
21698getpwent_r_proto='$getpwent_r_proto'
21699getpwnam_r_proto='$getpwnam_r_proto'
21700getpwuid_r_proto='$getpwuid_r_proto'
21701getservbyname_r_proto='$getservbyname_r_proto'
21702getservbyport_r_proto='$getservbyport_r_proto'
21703getservent_r_proto='$getservent_r_proto'
21704getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
21705gidformat='$gidformat'
21706gidsign='$gidsign'
21707gidsize='$gidsize'
21708gidtype='$gidtype'
5f80c64f 21709glibpth='$glibpth'
3c728e00 21710gmake='$gmake'
10bc17b6 21711gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 21712gnulibc_version='$gnulibc_version'
5f80c64f 21713grep='$grep'
b4eb6b3d
JH
21714groupcat='$groupcat'
21715groupstype='$groupstype'
5f80c64f 21716gzip='$gzip'
b4eb6b3d
JH
21717h_fcntl='$h_fcntl'
21718h_sysfile='$h_sysfile'
5f80c64f 21719hint='$hint'
b4eb6b3d 21720hostcat='$hostcat'
6e1038e0
MB
21721html1dir='$html1dir'
21722html1direxp='$html1direxp'
21723html3dir='$html3dir'
21724html3direxp='$html3direxp'
b4eb6b3d
JH
21725i16size='$i16size'
21726i16type='$i16type'
21727i32size='$i32size'
21728i32type='$i32type'
21729i64size='$i64size'
21730i64type='$i64type'
21731i8size='$i8size'
21732i8type='$i8type'
21733i_arpainet='$i_arpainet'
21734i_bsdioctl='$i_bsdioctl'
10bc17b6 21735i_crypt='$i_crypt'
b4eb6b3d
JH
21736i_db='$i_db'
21737i_dbm='$i_dbm'
21738i_dirent='$i_dirent'
5f80c64f 21739i_dld='$i_dld'
b4eb6b3d
JH
21740i_dlfcn='$i_dlfcn'
21741i_fcntl='$i_fcntl'
21742i_float='$i_float'
758a5d79
JH
21743i_fp='$i_fp'
21744i_fp_class='$i_fp_class'
b4eb6b3d
JH
21745i_gdbm='$i_gdbm'
21746i_grp='$i_grp'
b4eb6b3d
JH
21747i_ieeefp='$i_ieeefp'
21748i_inttypes='$i_inttypes'
2765b840 21749i_langinfo='$i_langinfo'
b4eb6b3d
JH
21750i_libutil='$i_libutil'
21751i_limits='$i_limits'
21752i_locale='$i_locale'
21753i_machcthr='$i_machcthr'
21754i_malloc='$i_malloc'
21755i_math='$i_math'
21756i_memory='$i_memory'
21757i_mntent='$i_mntent'
21758i_ndbm='$i_ndbm'
21759i_netdb='$i_netdb'
21760i_neterrno='$i_neterrno'
21761i_netinettcp='$i_netinettcp'
21762i_niin='$i_niin'
21763i_poll='$i_poll'
21764i_prot='$i_prot'
21765i_pthread='$i_pthread'
21766i_pwd='$i_pwd'
21767i_rpcsvcdbm='$i_rpcsvcdbm'
21768i_sfio='$i_sfio'
21769i_sgtty='$i_sgtty'
21770i_shadow='$i_shadow'
21771i_socks='$i_socks'
21772i_stdarg='$i_stdarg'
21773i_stddef='$i_stddef'
21774i_stdlib='$i_stdlib'
21775i_string='$i_string'
21776i_sunmath='$i_sunmath'
21777i_sysaccess='$i_sysaccess'
21778i_sysdir='$i_sysdir'
21779i_sysfile='$i_sysfile'
21780i_sysfilio='$i_sysfilio'
21781i_sysin='$i_sysin'
21782i_sysioctl='$i_sysioctl'
21783i_syslog='$i_syslog'
21784i_sysmman='$i_sysmman'
21785i_sysmode='$i_sysmode'
21786i_sysmount='$i_sysmount'
21787i_sysndir='$i_sysndir'
21788i_sysparam='$i_sysparam'
21789i_sysresrc='$i_sysresrc'
21790i_syssecrt='$i_syssecrt'
21791i_sysselct='$i_sysselct'
21792i_syssockio='$i_syssockio'
21793i_sysstat='$i_sysstat'
21794i_sysstatfs='$i_sysstatfs'
21795i_sysstatvfs='$i_sysstatvfs'
21796i_systime='$i_systime'
21797i_systimek='$i_systimek'
21798i_systimes='$i_systimes'
21799i_systypes='$i_systypes'
21800i_sysuio='$i_sysuio'
21801i_sysun='$i_sysun'
21802i_sysutsname='$i_sysutsname'
21803i_sysvfs='$i_sysvfs'
21804i_syswait='$i_syswait'
21805i_termio='$i_termio'
21806i_termios='$i_termios'
21807i_time='$i_time'
21808i_unistd='$i_unistd'
21809i_ustat='$i_ustat'
21810i_utime='$i_utime'
21811i_values='$i_values'
21812i_varargs='$i_varargs'
21813i_varhdr='$i_varhdr'
21814i_vfork='$i_vfork'
5f80c64f 21815ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
21816inc_version_list='$inc_version_list'
21817inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
21818incpath='$incpath'
21819inews='$inews'
f3f1a2d8 21820initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
21821installarchlib='$installarchlib'
21822installbin='$installbin'
6e1038e0
MB
21823installhtml1dir='$installhtml1dir'
21824installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
21825installman1dir='$installman1dir'
21826installman3dir='$installman3dir'
21827installprefix='$installprefix'
21828installprefixexp='$installprefixexp'
21829installprivlib='$installprivlib'
21830installscript='$installscript'
21831installsitearch='$installsitearch'
21832installsitebin='$installsitebin'
8d2cbf27
JH
21833installsitehtml1dir='$installsitehtml1dir'
21834installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 21835installsitelib='$installsitelib'
91e123a8
JH
21836installsiteman1dir='$installsiteman1dir'
21837installsiteman3dir='$installsiteman3dir'
6e1038e0 21838installsitescript='$installsitescript'
b4eb6b3d
JH
21839installstyle='$installstyle'
21840installusrbinperl='$installusrbinperl'
21841installvendorarch='$installvendorarch'
21842installvendorbin='$installvendorbin'
8d2cbf27
JH
21843installvendorhtml1dir='$installvendorhtml1dir'
21844installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 21845installvendorlib='$installvendorlib'
91e123a8
JH
21846installvendorman1dir='$installvendorman1dir'
21847installvendorman3dir='$installvendorman3dir'
6e1038e0 21848installvendorscript='$installvendorscript'
b4eb6b3d 21849intsize='$intsize'
4b661809 21850issymlink='$issymlink'
b4eb6b3d
JH
21851ivdformat='$ivdformat'
21852ivsize='$ivsize'
21853ivtype='$ivtype'
21854known_extensions='$known_extensions'
5f80c64f 21855ksh='$ksh'
5f80c64f
JH
21856ld='$ld'
21857lddlflags='$lddlflags'
21858ldflags='$ldflags'
b4eb6b3d
JH
21859ldflags_uselargefiles='$ldflags_uselargefiles'
21860ldlibpthname='$ldlibpthname'
5f80c64f
JH
21861less='$less'
21862lib_ext='$lib_ext'
21863libc='$libc'
b4eb6b3d 21864libperl='$libperl'
5f80c64f
JH
21865libpth='$libpth'
21866libs='$libs'
43999f95
JH
21867libsdirs='$libsdirs'
21868libsfiles='$libsfiles'
21869libsfound='$libsfound'
13b3f787 21870libspath='$libspath'
5f80c64f 21871libswanted='$libswanted'
b4eb6b3d 21872libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
21873line='$line'
21874lint='$lint'
21875lkflags='$lkflags'
21876ln='$ln'
21877lns='$lns'
10bc17b6 21878localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
21879locincpth='$locincpth'
21880loclibpth='$loclibpth'
b4eb6b3d
JH
21881longdblsize='$longdblsize'
21882longlongsize='$longlongsize'
21883longsize='$longsize'
5f80c64f
JH
21884lp='$lp'
21885lpr='$lpr'
21886ls='$ls'
b4eb6b3d
JH
21887lseeksize='$lseeksize'
21888lseektype='$lseektype'
a724edfe 21889mad='$mad'
f3f1a2d8
MB
21890madlyh='$madlyh'
21891madlyobj='$madlyobj'
21892madlysrc='$madlysrc'
5f80c64f
JH
21893mail='$mail'
21894mailx='$mailx'
21895make='$make'
21896make_set_make='$make_set_make'
b4eb6b3d
JH
21897mallocobj='$mallocobj'
21898mallocsrc='$mallocsrc'
21899malloctype='$malloctype'
21900man1dir='$man1dir'
21901man1direxp='$man1direxp'
21902man1ext='$man1ext'
21903man3dir='$man3dir'
21904man3direxp='$man3direxp'
21905man3ext='$man3ext'
5f80c64f 21906mips_type='$mips_type'
5129fff4 21907mistrustnm='$mistrustnm'
5f80c64f 21908mkdir='$mkdir'
b4eb6b3d
JH
21909mmaptype='$mmaptype'
21910modetype='$modetype'
5f80c64f 21911more='$more'
b4eb6b3d 21912multiarch='$multiarch'
5f80c64f 21913mv='$mv'
b4eb6b3d
JH
21914myarchname='$myarchname'
21915mydomain='$mydomain'
21916myhostname='$myhostname'
5f80c64f
JH
21917myuname='$myuname'
21918n='$n'
2cc61e15 21919need_va_copy='$need_va_copy'
b4eb6b3d
JH
21920netdb_hlen_type='$netdb_hlen_type'
21921netdb_host_type='$netdb_host_type'
21922netdb_name_type='$netdb_name_type'
21923netdb_net_type='$netdb_net_type'
5f80c64f
JH
21924nm='$nm'
21925nm_opt='$nm_opt'
21926nm_so_opt='$nm_so_opt'
b4eb6b3d 21927nonxs_ext='$nonxs_ext'
5f80c64f 21928nroff='$nroff'
b4eb6b3d
JH
21929nvEUformat='$nvEUformat'
21930nvFUformat='$nvFUformat'
21931nvGUformat='$nvGUformat'
53133ed1 21932nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
21933nveformat='$nveformat'
21934nvfformat='$nvfformat'
21935nvgformat='$nvgformat'
21936nvsize='$nvsize'
21937nvtype='$nvtype'
21938o_nonblock='$o_nonblock'
5f80c64f 21939obj_ext='$obj_ext'
b4eb6b3d 21940old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 21941optimize='$optimize'
b4eb6b3d 21942orderlib='$orderlib'
5f80c64f
JH
21943osname='$osname'
21944osvers='$osvers'
b4eb6b3d 21945otherlibdirs='$otherlibdirs'
5f80c64f 21946package='$package'
b4eb6b3d
JH
21947pager='$pager'
21948passcat='$passcat'
21949patchlevel='$patchlevel'
5f80c64f 21950path_sep='$path_sep'
b4eb6b3d 21951perl5='$perl5'
5f80c64f 21952perl='$perl'
151e6568 21953perl_patchlevel='$perl_patchlevel'
b4eb6b3d 21954perladmin='$perladmin'
9c839522 21955perllibs='$perllibs'
b4eb6b3d 21956perlpath='$perlpath'
5f80c64f 21957pg='$pg'
b4eb6b3d
JH
21958phostname='$phostname'
21959pidtype='$pidtype'
5f80c64f
JH
21960plibpth='$plibpth'
21961pmake='$pmake'
21962pr='$pr'
b4eb6b3d
JH
21963prefix='$prefix'
21964prefixexp='$prefixexp'
21965privlib='$privlib'
21966privlibexp='$privlibexp'
f24dbf84 21967procselfexe='$procselfexe'
b4eb6b3d
JH
21968prototype='$prototype'
21969ptrsize='$ptrsize'
21970quadkind='$quadkind'
21971quadtype='$quadtype'
21972randbits='$randbits'
21973randfunc='$randfunc'
10bc17b6 21974random_r_proto='$random_r_proto'
b4eb6b3d
JH
21975randseedtype='$randseedtype'
21976ranlib='$ranlib'
21977rd_nodata='$rd_nodata'
10bc17b6
JH
21978readdir64_r_proto='$readdir64_r_proto'
21979readdir_r_proto='$readdir_r_proto'
b4eb6b3d 21980revision='$revision'
5f80c64f
JH
21981rm='$rm'
21982rmail='$rmail'
5440bc8e 21983run='$run'
5f80c64f 21984runnm='$runnm'
b4eb6b3d
JH
21985sPRIEUldbl='$sPRIEUldbl'
21986sPRIFUldbl='$sPRIFUldbl'
21987sPRIGUldbl='$sPRIGUldbl'
21988sPRIXU64='$sPRIXU64'
21989sPRId64='$sPRId64'
21990sPRIeldbl='$sPRIeldbl'
21991sPRIfldbl='$sPRIfldbl'
21992sPRIgldbl='$sPRIgldbl'
21993sPRIi64='$sPRIi64'
21994sPRIo64='$sPRIo64'
21995sPRIu64='$sPRIu64'
21996sPRIx64='$sPRIx64'
21997sSCNfldbl='$sSCNfldbl'
21998sched_yield='$sched_yield'
21999scriptdir='$scriptdir'
22000scriptdirexp='$scriptdirexp'
5f80c64f 22001sed='$sed'
b4eb6b3d
JH
22002seedfunc='$seedfunc'
22003selectminbits='$selectminbits'
22004selecttype='$selecttype'
5f80c64f 22005sendmail='$sendmail'
10bc17b6
JH
22006setgrent_r_proto='$setgrent_r_proto'
22007sethostent_r_proto='$sethostent_r_proto'
22008setlocale_r_proto='$setlocale_r_proto'
22009setnetent_r_proto='$setnetent_r_proto'
22010setprotoent_r_proto='$setprotoent_r_proto'
22011setpwent_r_proto='$setpwent_r_proto'
22012setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
22013sh='$sh'
22014shar='$shar'
22015sharpbang='$sharpbang'
b4eb6b3d
JH
22016shmattype='$shmattype'
22017shortsize='$shortsize'
22018shrpenv='$shrpenv'
5f80c64f 22019shsharp='$shsharp'
b4eb6b3d
JH
22020sig_count='$sig_count'
22021sig_name='$sig_name'
22022sig_name_init='$sig_name_init'
22023sig_num='$sig_num'
22024sig_num_init='$sig_num_init'
76d3c696 22025sig_size='$sig_size'
b4eb6b3d
JH
22026signal_t='$signal_t'
22027sitearch='$sitearch'
22028sitearchexp='$sitearchexp'
22029sitebin='$sitebin'
22030sitebinexp='$sitebinexp'
8d2cbf27
JH
22031sitehtml1dir='$sitehtml1dir'
22032sitehtml1direxp='$sitehtml1direxp'
22033sitehtml3dir='$sitehtml3dir'
22034sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
22035sitelib='$sitelib'
22036sitelib_stem='$sitelib_stem'
22037sitelibexp='$sitelibexp'
91e123a8
JH
22038siteman1dir='$siteman1dir'
22039siteman1direxp='$siteman1direxp'
22040siteman3dir='$siteman3dir'
22041siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
22042siteprefix='$siteprefix'
22043siteprefixexp='$siteprefixexp'
6e1038e0
MB
22044sitescript='$sitescript'
22045sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
22046sizesize='$sizesize'
22047sizetype='$sizetype'
5f80c64f
JH
22048sleep='$sleep'
22049smail='$smail'
5f80c64f 22050so='$so'
b4eb6b3d
JH
22051sockethdr='$sockethdr'
22052socketlib='$socketlib'
22053socksizetype='$socksizetype'
5f80c64f
JH
22054sort='$sort'
22055spackage='$spackage'
22056spitshell='$spitshell'
10bc17b6
JH
22057srand48_r_proto='$srand48_r_proto'
22058srandom_r_proto='$srandom_r_proto'
5f80c64f 22059src='$src'
b4eb6b3d
JH
22060ssizetype='$ssizetype'
22061startperl='$startperl'
5f80c64f 22062startsh='$startsh'
b4eb6b3d
JH
22063static_ext='$static_ext'
22064stdchar='$stdchar'
22065stdio_base='$stdio_base'
22066stdio_bufsiz='$stdio_bufsiz'
22067stdio_cnt='$stdio_cnt'
22068stdio_filbuf='$stdio_filbuf'
22069stdio_ptr='$stdio_ptr'
22070stdio_stream_array='$stdio_stream_array'
10bc17b6 22071strerror_r_proto='$strerror_r_proto'
b4eb6b3d 22072strings='$strings'
5f80c64f 22073submit='$submit'
b4eb6b3d
JH
22074subversion='$subversion'
22075sysman='$sysman'
5f80c64f
JH
22076tail='$tail'
22077tar='$tar'
5440bc8e 22078targetarch='$targetarch'
5f80c64f
JH
22079tbl='$tbl'
22080tee='$tee'
22081test='$test'
b4eb6b3d
JH
22082timeincl='$timeincl'
22083timetype='$timetype'
10bc17b6 22084tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 22085to='$to'
5f80c64f
JH
22086touch='$touch'
22087tr='$tr'
22088trnl='$trnl'
22089troff='$troff'
10bc17b6 22090ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
22091u16size='$u16size'
22092u16type='$u16type'
22093u32size='$u32size'
22094u32type='$u32type'
22095u64size='$u64size'
22096u64type='$u64type'
22097u8size='$u8size'
22098u8type='$u8type'
22099uidformat='$uidformat'
22100uidsign='$uidsign'
22101uidsize='$uidsize'
22102uidtype='$uidtype'
5f80c64f
JH
22103uname='$uname'
22104uniq='$uniq'
b4eb6b3d
JH
22105uquadtype='$uquadtype'
22106use5005threads='$use5005threads'
22107use64bitall='$use64bitall'
22108use64bitint='$use64bitint'
5440bc8e 22109usecrosscompile='$usecrosscompile'
5f80c64f 22110usedl='$usedl'
15b61c98 22111usefaststdio='$usefaststdio'
b4eb6b3d
JH
22112useithreads='$useithreads'
22113uselargefiles='$uselargefiles'
22114uselongdouble='$uselongdouble'
19a100ff 22115usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
22116usemorebits='$usemorebits'
22117usemultiplicity='$usemultiplicity'
22118usemymalloc='$usemymalloc'
5f80c64f 22119usenm='$usenm'
b4eb6b3d
JH
22120useopcode='$useopcode'
22121useperlio='$useperlio'
22122useposix='$useposix'
9514c62b 22123usereentrant='$usereentrant'
d51aaa9d 22124userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
22125usesfio='$usesfio'
22126useshrplib='$useshrplib'
5f106f9c 22127usesitecustomize='$usesitecustomize'
29209bc5 22128usesocks='$usesocks'
b4eb6b3d
JH
22129usethreads='$usethreads'
22130usevendorprefix='$usevendorprefix'
22131usevfork='$usevfork'
5f80c64f
JH
22132usrinc='$usrinc'
22133uuname='$uuname'
b4eb6b3d
JH
22134uvXUformat='$uvXUformat'
22135uvoformat='$uvoformat'
22136uvsize='$uvsize'
22137uvtype='$uvtype'
22138uvuformat='$uvuformat'
22139uvxformat='$uvxformat'
22140vendorarch='$vendorarch'
22141vendorarchexp='$vendorarchexp'
22142vendorbin='$vendorbin'
22143vendorbinexp='$vendorbinexp'
8d2cbf27
JH
22144vendorhtml1dir='$vendorhtml1dir'
22145vendorhtml1direxp='$vendorhtml1direxp'
22146vendorhtml3dir='$vendorhtml3dir'
22147vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
22148vendorlib='$vendorlib'
22149vendorlib_stem='$vendorlib_stem'
22150vendorlibexp='$vendorlibexp'
91e123a8
JH
22151vendorman1dir='$vendorman1dir'
22152vendorman1direxp='$vendorman1direxp'
22153vendorman3dir='$vendorman3dir'
22154vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
22155vendorprefix='$vendorprefix'
22156vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
22157vendorscript='$vendorscript'
22158vendorscriptexp='$vendorscriptexp'
b4eb6b3d 22159version='$version'
861eb78d 22160version_patchlevel_string='$version_patchlevel_string'
d56c5707 22161versiononly='$versiononly'
5f80c64f 22162vi='$vi'
b4eb6b3d 22163voidflags='$voidflags'
5f80c64f 22164xlibpth='$xlibpth'
3659ebf1
JH
22165yacc='$yacc'
22166yaccflags='$yaccflags'
5f80c64f
JH
22167zcat='$zcat'
22168zip='$zip'
22169EOT
22170
22171: Add in command line options if available
22172$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22173
22174: add special variables
22175$test -f $src/patchlevel.h && \
d00b958f 22176awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 22177echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 22178echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22179
22180: propagate old symbols
22181if $test -f UU/config.sh; then
381aa1ff 22182 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 22183 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 22184 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22185 set X `cat UU/oldsyms`
22186 shift
22187 case $# in
22188 0) ;;
22189 *)
22190 cat <<EOM
22191Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22192EOM
22193 echo "# Variables propagated from previous config.sh file." >>config.sh
22194 for sym in `cat UU/oldsyms`; do
22195 echo " Propagating $hint variable "'$'"$sym..."
22196 eval 'tmp="$'"${sym}"'"'
22197 echo "$tmp" | \
22198 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22199 done
22200 ;;
22201 esac
22202fi
22203
22204: Finish up by extracting the .SH files
22205case "$alldone" in
22206exit)
22207 $rm -rf UU
24ccb310 22208 echo "Extraction done."
5f80c64f
JH
22209 exit 0
22210 ;;
22211cont)
22212 ;;
22213'')
22214 dflt=''
22215 nostick=true
22216 $cat <<EOM
22217
22218If you'd like to make any changes to the config.sh file before I begin
22219to configure things, do it as a shell escape now (e.g. !vi config.sh).
22220
22221EOM
22222 rp="Press return or use a shell escape to edit config.sh:"
22223 . UU/myread
22224 nostick=''
22225 case "$ans" in
22226 '') ;;
22227 *) : in case they cannot read
22228 sh 1>&4 -c "$ans";;
22229 esac
22230 ;;
22231esac
22232
22233: if this fails, just run all the .SH files by hand
22234. ./config.sh
22235
22236echo " "
22237exec 1>&4
a43e8593 22238pwd=`pwd`
5f80c64f 22239. ./UU/extract
6904989c 22240cd "$pwd"
5f80c64f
JH
22241
22242if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22243 dflt=y
22244 case "$silent" in
22245 true) ;;
22246 *)
22247 $cat <<EOM
22248
22249Now you need to generate make dependencies by running "$make depend".
22250You might prefer to run it in background: "$make depend > makedepend.out &"
22251It can take a while, so you might not want to run it right now.
22252
22253EOM
22254 ;;
22255 esac
22256 rp="Run $make depend now?"
22257 . UU/myread
22258 case "$ans" in
22259 y*)
3d5d58b1 22260 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22261 ;;
22262 *)
22263 echo "You must run '$make depend' then '$make'."
22264 ;;
22265 esac
22266elif test -f [Mm]akefile; then
22267 echo " "
22268 echo "Now you must run a $make."
22269else
24ccb310 22270 echo "Configure done."
5f80c64f
JH
22271fi
22272
22273if $test -f Policy.sh; then
22274 $cat <<EOM
22275
22276If you compile $package on a different machine or from a different object
22277directory, copy the Policy.sh file from this object directory to the
22278new one before you run Configure -- this will help you with most of
22279the policy defaults.
22280
22281EOM
22282fi
22283if $test -f config.msg; then
22284 echo "Hmm. I also noted the following information while running:"
22285 echo " "
22286 $cat config.msg >&4
22287 $rm -f config.msg
22288fi
22289$rm -f kit*isdone ark*isdone
22290$rm -rf UU
22291
22292: End of Configure
22293